2018-10-22         Enoch

Python Binary String Loop

The question on my assignment is as follows: Write a function that takes, as an argument, a string, identified by the variable aString. If the string only contains digits 0 and 1, return the string formed by concatenating the argument with the string "is a binary string." Otherwise, return a string indicating the length of the argument, as specified in the examples that follow. Name this function AmIBinary(aString). I am having trouble figuring out how to form a loop which searches through a string and determines whether or not the string is a binary string. I understand h...

 python                     4 answers                     11 view
 2018-10-22         Enoch

Public SAML v2 service providers for testing?

I'm wondering if there are any publicly available SAML v2 SPs that I can use to test with. I think Salesforce and Google apps both have an SSO solution which is compatible, but I'm just not sure how to go about getting access (and unclear whether it costs.) Maybe I should just set up an SP (using OpenSSO or something) on another box? Thanks in advance. Samling is a serverless SAML IdP for the purpose if testing any SAML SP endpoint. It supports AuthnRequest and LogoutRequest.It runs solely in the browser to simulate SAML responses returned from a SAML IdP - no registrati...

 testing                     7 answers                     94 view
 2018-10-22         Enoch

Select related foreign key value in the dropdown menu in the Add/Change page of Django Admin

models.pyclass Doctor(models.Model): name = models.CharField(max_length=255)class Album(models.Model): doc = models.ForeignKey(Doctor) name = models.CharField(max_length=255)class Video(models.Model): doc = models.ForeignKey(Doctor) album = models.ForeignKey(Album) src = models.CharField(max_length=500)As show above, in the Video Admin add/change page, there are two dropdown menu for selecting: Album and Doctor.However, when I choose an Album (e.g. album.id=1 and belongs to doctor.id=5), the Doctor dropdown menu display all Doctors, but I only wanna the on...

 django                     1 answers                     79 view
 2018-10-22         Enoch

How to get Amazon Lex to respond with voice to a text message?

I'm using the Amazon Lex service. My input is always a text message, but sometimes I'd like a spoken response in addition to the text. I configured an output voice in the Lex settings.I've tried adding a header amz-lex:accept-content-types=SSML to the request, but it returns with Invalid Bot Configuration: No usable messages given the current slot and sessionAttribute set. (Service: AmazonLexRuntime; Status Code: 400; Error Code: BadRequestException;. The same request works just fine when I ask for PlainText. And even if I ask for SSML,PlainText it'll respond with plain tex...

 amazon-web-services                     1 answers                     46 view
 2018-10-22         Enoch

compiling numpy for python3 for AIX works but import fails

Has someone had success building the numpy package for AIX6.1 or 7.1?I downloaded numpy-1.9.2.tar.gz and ran "python3 setup.py install".After patching a few source files it compiles. However, when I try to import numpy it says:ImportError: 0509-022 Cannot load module /python3.4/site-packages/numpy/core/multiarray.so. 0509-187 The local-exec model was used for thread-local storage, but the module is not the main program. 0509-193 Examine the .loader section header with the 'dump -Hv' command.My guess is that it has got some -fPI...

 python-3.x                     1 answers                     24 view
 2018-10-22         Enoch

Django template: access inner dictionary

A newbie django template question, hope to get some pointers.I'm passing back a dictionary to render to html for a page. The structure of the dictionary is like the following:dic:{ "names":["name1", "name2", "name3"], "names1":{ "addresses":["address1","address2","address3"], "key2":[......] ...... } "name2":{......} }How do I access the inner dictionaries? The only way to know the keys for those inner dictionaries is from the list, but I was unable to iterate through values pointed by key "names" and use that value as a ke...

 django                     1 answers                     8 view
 2018-10-22         Enoch

Rolling 12 Months Decrements in SQL

I have data something like thisYearMonth Recovery Segment 201701 0.002 NULL . . . . . . 201712 0.002 NULL 201801 0.002 NULL . . . . . . 201812 0.002 NULLLikewise, I have data for 10 years, I want to populate Segment Column using Recovery column (distinct throughout 10 years). For first-year 201701-201712, Segment is 0.002 then for next year 201801-201812 it is 0.002*(1 - 0.2) = 0.0004 after that for 201901-201912 it is 0.0004*(1-0.2) and so on....

 sql                     2 answers                     23 view
 2018-10-22         Enoch

select2 and jquery validation not working properly

Trying to use validation on select2 with a few issues :the error message will show, but it will not remove when a valid entry is entered.I am loading an initial value which works fine... the validator, however, does not recognize the value and tells me it is invalid... I have to manually type in the same value and then it validates, but still does not remove the error class/message showing it is valid.form :<div class="col-md-12 margin-bottom-30 form-group"> <div class="input-modal-group"> <label for="vedit-filter" class="f-14"><b>filter :&...

 jquery                     1 answers                     96 view
 2018-10-22         Enoch

MySQL DISTINCT ignored in SELECT displays duplicate

I have the following query that is joining 3 tables but is displaying duplicate results where I only one instance of a record by using DISTINCT on the r.Email column. SELECT DISTINCT FirstName, LastName, r.Email, ListingID, ListingFirmID FROM sancap_Residential_Property e JOIN sancap_Agent r ON e.ListingAgentID=r.AgentID JOIN sancap_Office d ON e.ListingFirmID=d.firmID WHERE ListingFirmID != 'BrokerC'The data looks like this, the ListingID information being unique is why I believe the query is showing the Agent ID. How do I overcome this?Buck | Rogers ...

 mysql                     2 answers                     88 view
 2018-10-22         Enoch

Is it safe to include extra columns in the SELECT list of a SQLite GROUP BY query?

I have a simple SQLite table called "message":sequence INTEGER PRIMARY KEYtype TEXTcontent TEXTI want to get the content of the last message of each type (as determined by its sequence). To my surprise, the following simple query works:SELECT MAX(sequence), type, contentFROM messageGROUP BY typeSurprise, because I know that MSSQL or Postgres would refuse to include a column in the SELECT list that is not part of the GROUP BY clause or an aggregate function and I'd have to do a join, like this:SELECT m.sequence, m.type, m.contentFROM( SELECT MAX(sequence) as sequence, typ...

 sql                     3 answers                     55 view
 2018-10-22         Enoch

java:getting sqlexception message "incorrrect syntax near '{' "

platform :sql server 2000java 1.4String queryStringForCustomer = "{call MIGRATE_CUSTOMERS_FILE(?,?)}";String queryStringForCard = "{call MIGRATE_CARDS_FILE(?,?)}";for(int i=0;i<recordIds.size();i++){ if(FileType.equals("1")){ callableStatement = connection.prepareCall(queryStringForCustomer); callableStatement.setString(1,(String)recordIds.get(i)); callableStatement.setInt(2, 0); callableStatement.execute(); }else { callableStatement = connection.prepareCall(queryStringForCard); callableStatement.setString(1,(String)recordIds.get(i)); callableStatement.setInt(2, 0...

 java                     1 answers                     65 view
 2018-10-22         Enoch

pipenv insists on installing Python 3.6

I set up my Python dev environment on macOS using the following commands:brew install pyenvpyenv install 3.7.0pyenv install 2.7.15pyenv global 3.7.0I also added the following to my .bash_profile:export PATH="/Users/me/.local/bin:$PATH"eval "$(pyenv init -)"Python seems to be working as expected:01:29 $ python --versionPython 3.7.0I then installed pipenv the "pragmatic" way, since installing via Homebrew would install a whole copy of Python as well (which I didn't want, since I was using pyenv already):pip install --user pipenvNow when I try to start a new pipenv project I g...

 python                     1 answers                     24 view
 2018-10-22         Enoch

How to add additional include directory on solution level?

I have a big solution with ~30 projects(it's not my fault). I have several versions of boost. Each solution uses it's own version of boost. For now boost is set for each project(30 times). How to set boost on solution level? I want to say this solution uses boost_1.39, this solution uses boost_1.33.I can add path globally on VisualStudio level in Tools/Options/Project and Solutions/VC++ Directories. This way is bad, because then all my solutios use one boost. Or i can set boost on Project level. But how to do it for solution? Such feature is present on any build system. ...

 directory                     2 answers                     30 view
 2018-10-22         Enoch

Facebook C# SDK Azure documentation

I am about to emabark on a project that will use Azure and Facebook C# SDK. I was just wondering when will the documentation be available on the C# SDK website? I have no idea where to begin and would love some documentation/tutorials.Thanks,Rhonda As you need some pointer about where to begin, I sure can give your some pointers but get ready for a time of adventure because you sure going to hit some hardtime. What you really need is to develop your project in two steps:Create an ASP.NET (MVC?) Web application using FaceBook C# SDKConvert this ASP.NET application to We...

 c#                     2 answers                     74 view
 2018-10-22         Enoch

Left Align Badges

I have created this card here in which i have some badges but they are not aligned in the right way i need to left align them like this image.. Can anyone help me in aligning these badges just like they are aligned in the second image? I am using bootstrap 3.3.7 and this just a little code snippet and i think this is enough information.here is the html code. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"><...

 html                     1 answers                     10 view
 2018-10-22         Enoch

SQL Relationship to Secondary Table Without Adding Duplicate Column

There are Cities, Job Types, and Tasks. Cities can have multiple Job Types. Tasks are created for a City that can have multiple Job Types. Cities can have Many Tasks. But when adding the Job Types for the Tasks assigned to a City, must make sure the City has that Job Type. How to create Relationship/Constraint when Adding/Updating Task_JobTypes to make sure the City associated with the Task has that Job Type allowed in City_JobTypes? The constraint in Task_JobTypes "FK_Task_JobTypes_JobTypes" need to be referencing that instead of just JobTypes.Cities - Id,Name JobType...

 sql                     2 answers                     60 view

Page 1 of 146  |  Show More Pages:  Top Prev Next Last