2018-10-22         Edith

How to compare one object value with other in angular 5

I have written the code for getting the server sent events using EventSource, in which i have this below code. In the below code i have 2 objects one is tasksRes & other is tasks1. Case 1: So among them i have to check one id with the other in both the objects. If the id matches with the first object then i have to over rite the first object id with the second object id in the template.Case 2: If the id is not there in the object then i have to bind those id related json data in the first of the list.tasks(){ this.handler.activateLoader(); this.tasksService.get(th...

 javascript                     1 answers                     73 view
 2018-10-22         Edith

Testing validity of database seed file in rails

Seed files can become invalid fast as code grows. I just had a situation where the open merge request had all tests running and passing but when I run rails db:seed on staging server failed as the seed file did not have all the required fields for that particular model.Is there a way we can always test for validity of the seed file?Maybe relevant: I am using gitlab CI for running CI and deploymentrails version - 5.2rspec version 3 You can define a separate CI task that runs rails db:seed, next to your existing one that runs rspec (or rails spec, or whatever spelling it ...

 ruby-on-rails                     2 answers                     38 view
 2018-10-22         Edith

Compile multiple source files in an Autoconf test

I'm working on a test for GCC init_priority and MSC init_seg. I want to craft a test to compile and link two source files in a specific order.I'm having trouble finding information on compiling and linking two source files using AC_COMPILE_IFELSE or AC_LINK_IFELSE. The Autoconf docs don't appear to discuss the use case. Searching for terms like "Autoconf test with two source files" are returning irrelevant results. I think I might be missing good search terms.Is it possible to use two source files during an Autoconf test? If so, then how do I do it? AC_COMPILE_IFELSE and...

 autotools                     1 answers                     36 view
 2018-10-22         Edith

How can I define a Given statements in Cucumber using other When statements?

I’ve been using Cucumber with Cypress a lot lately (actually writing a framework: picklejs.com). I’m in love with defining everything using plain English. However I can’t seem to find a way to define my Given statements using other When statements. I can only programmatically define it. Any thoughts on how to make this possible?Ex GivenDef: I do 2 actions When I do action 1 And I do action 2Scenario: I do 3 actions Given I do 2 actions When I do action 3 You want to call a scenario from another scenario. That is not supported in Gherkin. And it is not likel...

 cucumber                     2 answers                     37 view
 2018-10-22         Edith

Python3 and ConfigParser returns unicode HTML characters differently

I have this ini file[temp]units = \u00b0 CIf I retrieve the value with ConfigParser, I get the following resultpi@pi-vm1:~ $ python3Python 3.5.3 (default, Jan 19 2017, 14:11:04)[GCC 6.3.0 20170118] on linuxType "help", "copyright", "credits" or "license" for more information.>>> from configparser import ConfigParser>>> parser = ConfigParser()>>> parser.read('/home/pi/myapp/units.ini', encoding='utf-8')['/home/pi/myapp/units.ini']>>> items = parser.items('temp')>>> print(items[0])('units', '\\u00b0 C')This is passed as an API resp...

 python-3.x                     1 answers                     78 view
 2018-10-22         Edith

Trying to merge DataFrames with many conditions

This is a weird one: I have 3 dataframes, "prov_data" with contains a provider id and counts on regions and categories (ie. how many times that provider interacted with those regions and categories). prov_data = DataFrame({'aprov_id':[1122,3344,5566,7788],'prov_region_1':[0,0,4,0],'prov_region_2':[2,0,0,0], 'prov_region_3':[0,1,0,1],'prov_cat_1':[0,2,0,0],'prov_cat_2':[1,0,3,0],'prov_cat_3':[0,0,0,4], 'prov_cat_4':[0,3,0,0]}) "tender_data" which contains the same but for tenders.tender_data = DataFrame({'atender_id':['AA12','BB33','CC45'],...

 python                     2 answers                     32 view
 2018-10-22         Edith

calendarView.setOnDateChangeListener android studio

everytime user select date the TextView only showing current datepublic void initOverall(){ TextView dateTest = (TextView)findViewById(R.id.cnvrt); CalendarView calendarView = (CalendarView)findViewById(R.id.calendarView); calendarView.setOnDateChangeListener(new CalendarView.OnDateChangeListener() { @Override public void onSelectedDayChange(@NonNull CalendarView view, int year, int month, int dayOfMonth) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String selectedDates = sdf.format(new Date(calendarView.getDate()...

 android                     3 answers                     24 view
 2018-10-22         Edith

Incorrect return value, not getting a 'True' return, Python

I am expecting a return of True, but is getting a return of None. I have put some print statement in the code to help debug. It shows that the 'print("Got True")' statement ran, so I know the code ended up in the right branch of the code just before 'return True' but for some reason I am getting 'None'. However 'return False' works perfectly when I put in a word that isn't a palindrome.Thanks for the help.def first(word): return word[0]def last(word): return word[-1]def middle(word): return word[1:-1]def is_palindrome(word): print(word) if len(word) <= 1: ...

 python                     3 answers                     53 view
 2018-10-22         Edith

CS50 Pset5 check() counting too many words as misspelled

I have loaded the dictionary into a tree structure and successfully gotten speller.c to compile with the following implementations of load() and check().However, when I run the program, an incorrect number of words are counted as misspelled by my check() function. (In the case of lalaland.txt, it's 17187 words out of 17756).I can't figure out what's wrong with my code and would be extremely grateful to anyone who could help point me in the right direction.typedef struct node{ bool isword; struct node *children[27];}node;node *root = NULL;// Function returns the position o...

 c                     1 answers                     85 view
 2018-10-22         Edith

Not able to install and run mysqlnd_ms in ubuntu

I have hard time installing mysqlnd_ms on my ubuntu machine.Steps followed:Updated my local machine to run php 7Followed https://github.com/sergiotabanelli/mysqlnd_ms and installed required libraries sudo apt-get install libxml2-dev sudo apt-get install libmemcached-dev sudo apt-get install php-jsonmake and sudo make installcreated a json file with hostname, username, password, database{ "myapp": { "master": { "master_0": { "host": "XXXX.rds.amazonaws.com", "username":"XXXX", "password":"XXXX", ...

 php                     1 answers                     5 view
 2018-10-22         Edith

How do I copy SQL Server 2012 database to localdb instance?

I'm looking to copy a SQL Server 2012 Standard database to my localdb instance. I've tried the wizard which complains that localdb isn't a SQL Server 2005 or later express instance. I also did a backup/restore but upon the restore in my localdb I get the following error...Running this...RESTORE DATABASE CSODevFROM DISK = 'C:\MyBckDir\CSODev.bak'WITH MOVE 'CSOdev_Data' TO 'C:\Users\cblair\CSOdev_Data.mdf',MOVE 'CSOdev_Log' TO 'C:\Users\cblair\CSOdev_Log.ldf',REPLACEError message I get... Processed 8752 pages for database 'CSODev', file 'CSOdev_Data' on file 1. Processed 5 ...

 sql                     8 answers                     68 view
 2018-10-22         Edith

How can I get SQL Server 2008 R2 Web Edition?

I hope someone can shed some light on the SPLA methodology which allows you to get SQL Server 2008 R2 for ~$25/month if I understand correctly.Do you have to do anything special in order to get SPLA access? I don't get the 'hosted' and 'service provider' definition - let's say I have a few web applications that I developed and I want to put those on a server and charge people monthly to use them, is that scenario SPLA covered? The users not being 'Windows'/'CAL' type users with windows authentication, but just regular ASP.NET authentication.I really like SQL Server and I'd ...

 sql-server                     2 answers                     80 view
 2018-10-22         Edith

how to select for input on a dynamic list of channels in Go?

Go has a mechanism to do a blocking read from one of several channels, the select statement. So you can sayselect { case <- c1: case <- c2:}will block until we get input from either of these two channels. Very nice. But this requires that I specify in the source code how many channels I want to poll. What if I have a slice or array of channels and I want to block until I get input on any of them? Just a thought, but you could use a multiplexing pattern, where you spawn off a goroutine with 2 channels that blocks on both and sends the output to a new channe...

 go                     4 answers                     71 view
 2018-10-22         Edith

How can I post my Object via Ajax and store int into the database via Entity Manager?

$('#form_save').on( 'click', function (e) { e.preventDefault(); var form = $(this).closest('form'); var formData = form.serializeArray(); alert(formData.toSource()); $.ajax({ method:'POST', url:'{{ path('edit_form', { 'slug': page.slug }) }}', data: formData, success: function(data){ alert("success"); } }); });var formData is giving me the following alert output:[{name:"form[username]", value:"1"}, {name:"form[email]", value:"1@12.sw"}, {name:"form[is_active]", value:"1"}, {name:"form[plainPassword...

 ajax                     2 answers                     63 view
 2018-10-22         Edith

Delete a string from line starting with a specific string

I have a file :# Allow incoming TCP portsTCP_IN = "20,21,22,25,53,80,110,143,443,4433,465,587,993,995,3306,9200,8080,8888,10000:20000,"# Allow outgoing TCP portsTCP_OUT = "20,21,22,25,53,80,110,113,143,443,465,4433,587,993,995,3306,9200,8080,8888,10000:20000,"# Allow incoming UDP portsUDP_IN = "20,21,53,111"# Allow outgoing UDP ports# To allow outgoing traceroute add 33434:33523 to this list UDP_OUT = "20,21,53,113,123,111"# Allow incoming PING. Disabling PING will likely break external uptime# monitoringICMP_IN = "1"I want to delete, lets say 443 from line starting with TC...

 bash                     3 answers                     44 view
 2018-10-22         Edith

Tweepy Cursor Search - User input and Mention

I'm trying to have a user input search and a set search parameter in the api.search function of tweepy. Essentially I want it like this: print("input search term to search within Tesla tweets")keyword = input()print("Thanks!")print("Tweets are cooking in the background now...")# create list to append tweets totweets = []# append all tweet data to listfor tweet in tweepy.Cursor(api.search, q="@tesla" + keyword, tweet_mode="extended", count=10000, since="2018-08-01").items(): tweets.append(tweet) word_string = repr(tweet)But that won't work it jus...

 python                     1 answers                     84 view

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