2018-10-22         Godfery

Rest Assured - JsonPath - I need two values to extract at the same time based on condition

I'm facing difficulty in extracting the values using JsonPath. Here is my json, applications:[ { "ab": 123, "isReady": true, "proId": 234 }, { "ab": 345, "isReady": false, "proId": 098 }, { "ab": 332, "isReady": true, "proId": 100 }]I wanted to extract values of "ab" and "proId" when "isReady" value is true. And once it is done, I need to construct the below json with above mentioned values. Example below,[{ "ab": 332, "proId": 100},{ "ab": 123, "proId": 234}]I can only be able to extract single values like below,L...

 java                     1 answers                     32 view
 2018-10-22         Godfery

Django rest framework writeable nested serializer data missing from validated_data

I'm trying to create a writeable nested serialiser for my API endpoint, however upon entering my parent serialiser's create method the nested data doesn't appear in my validated_data dictionary like it is supposed to in the example here. Instead, the nested key is not even present in the dictionary. Instead, it looks like: {'foo': 'bar'}. So, the nested keys appear to be flattened, and any other nested object with the same keys are overwritten.Any clues as to what the problem might be? I have some fairly complicated validation logic, however after trimming all of this out t...

 python                     2 answers                     6 view
 2018-10-22         Godfery

yagmail how to hidden recipients

I'm trying to develop a mass email script by yagmail. My script works properly but what I want is to showing only the receiving recipient's Email in the 'To' field and not all others. E.g. If I send Emails to example1@email.com and example2@email.com, example1 should see example1@email.com and example2 should see example2@email.com in the 'To' field.Is there a way to achieve this? Or maybe do I have to use loop over each recipient with send_mail?Here's my scriptimport yagmailwith open("folder/email.txt") as f: recipients = f.read()yag = yagmail.SMTP('my.username')email_s...

 python                     1 answers                     72 view
 2018-10-22         Godfery

javascript - join 2 array of date

I have a problem with DateTime in Javascript. My issue is that I have 2 array of DateTime range. For example:var list1 = [ {start: 2018-08-28 00:00:00, end: 2018-08-28 04:00:00}, {start: 2018-08-28 04:00:00, end: 2018-08-28 10:00:00}, {start: 2018-08-28 12:00:00, end: 2018-08-28 14:00:00}, {start: 2018-08-28 20:00:00, end: 2018-08-28 22:00:00},];var list2 = [ {start: 2018-08-28 03:00:00, end: 2018-08-28 06:00:00}, {start: 2018-08-28 11:00:00, end: 2018-08-28 11:30:00}, {start: 2018-08-28 13:00:00, end: 2018-08-28 17:00:00},];After merge two list the res...

 javascript                     3 answers                     15 view
 2018-10-22         Godfery

Designing a BitStream in C#

I'm looking at the C# library called BitStream, which allows you to write and read any number of bits to a standard C# Stream object. I noticed what seemed to me a strange design decision:When adding bits to an empty byte, the bits are added to the MSB of the byte. For example:var s = new BitStream();s.Write(true);Debug.Assert(s.ToByteArray()[0] == 0x80); // and not 0x01var s = new BitStream();s.Write(0x7,0,4);s.Write(0x3,0,4);Debug.Assert(s.ToByteArray()[0] == 0x73); // and not 0x37However, when referencing bits in a number as the input, the first bit of the input number ...

 c#                     3 answers                     41 view
 2018-10-22         Godfery

Trying to get attendees set in google calendar API / PHP

I´m trying to create an event and that part works, but it will not for some reason send out the invitations / attendees in the calendar system with google API using PHP. It does create the event but that also it. So I hope someone can help me figuring out what I´m doing wrong. myfile.php // Event detailsparameters = { title: $("#event-title").val(), event_time: { start_time: $("#event-type").val() == 'FIXED-TIME' ? $("#event-start-time").val().replace(' ', 'T') + ':00' : null, end_time: $("#event-type").val() == ...

 php                     1 answers                     76 view
 2018-10-22         Godfery

Toolbar title remains black while testing on physical device

I'm doing an Android app through Xamarin and I have a problem that I really can't figure out. I've set the Toolbar to use the Theme.Material.Light.DarkActionBar with white text on the toolbar. The toolbar contains also the Up arrow and an action icon, both white. When I debug the app on emulators, it works fine, with the correct colors.When I debug on a old Note3 running Android 5.0, it works fine too. When I debug on a S7Edge running 8.0 or a J7 running 7.1 the toolbar title stays black, regardless of any change. The Up arrow and the icon stay white!I can't understand what...

 java                     1 answers                     8 view
 2018-10-22         Godfery

Increment the value of the column of which the Serial no is greatest in mysql

So i have a table(table_name), the columns of which are Sno,count. The default value of count being 1.If wanna increment the value of the count column where Sno is, say 1..UPDATE table_name SET count=count+1 where Sno=1;it works!!!But what if I wanna increment the value of count where Sno is Max?Sno count 1 2 2 1Basically I need help creating hybrid of :UPDATE table_name SET count=count+1 where Sno=1;&select MAX(Sno) from table_name; Use the following:UPDATE table_name t1 INNER JOIN (SELECT MAX(t2.Sno) AS max_Sno FROM table_name t2) AS t3 ON t3.max...

 mysql                     3 answers                     96 view
 2018-10-22         Godfery

Create Sequence only for flag N '

I want to create a row number when flag='n' only Or I am okay to sort the data by flags and rank them. For example:+-----+-------+-------+| ID | Flag1 | Flag2 |+-----+-------+-------+| 100 | N | N || 100 | N | N || 100 | Y | N || 100 | N | Y || 101 | N | N || 101 | N | Y |+-----+-------+-------+Output:+---------+-----+-------+-------+| Seq_num | ID | flag1 | flag2 |+---------+-----+-------+-------+| 1 | 100 | N | N || 2 | 100 | N | N || 3 | 100 | Y | N || 4 | 100 | N | Y ...

 sql                     1 answers                     60 view
 2018-10-22         Godfery

How to optimize my sql query or database on SQL Server?

There are 4 tables as follows: the table [T_D ] has about 5 million rows and other tables have less than 5000 rows; [T_D ] has three primary key columns: c_id, datetime, a_id.The relations between the 4 tables are as follows: table T_D ( c_id numeric, -- primary key, reference on (M_C.c_id ) datetime datetime, -- primary key a_id numeric, -- primary key, reference on (M_A.a_id ) data float) table M_C ( c_id numeric, -- primary key ...)table M_B ( b_id numeric, -- primary key ...)table M_A( a_id numeric, -- primar...

 sql-server                     1 answers                     68 view
 2018-10-22         Godfery

Doesn't receive a message from a channel

Edit:After I added a small part of file I was using (7 GB) and tried to run the program, I could see this:fatal error: all goroutines are asleep - deadlock!goroutine 1 [chan receive]:main.main() /media/developer/golang/manual/examples/sp/v2/sp.v2.go:71 +0x4a9exit status 2Situation:I'm completely new to GO, so I'm sorry if my question is really simple.I am trying to stream xml file, split documents and then parse them in different GO Routines.Example of XML file I'm using:<?xml version="1.0" encoding="UTF-8"?><osm version="0.6" generator="CGImap 0.0.2"> <...

 go                     2 answers                     62 view
 2018-10-22         Godfery

Programming Geoserver 2.0.2 to add a new data store and layer without the UI

I have a directory of imagery that will be updated continually. From this imagery, I am making Image Pyramids using the Geotool's PyramidBuilder utility. I need to setup a cron job to automatically add new datastores and layers to Geoserver without using the UI.After looking at the REST section of the Geoserver manual I was able to add my workspace, "testWS", but trying the create an ImagePyramid datastore did not work.Since I have access to the datastore, I expanded on the shapefile example and tried to curl -u admin:geoserver -XPUT -H 'Content-type: text/plain' \ -d '/...

 datastore                     1 answers                     52 view
 2018-10-22         Godfery

php, xampp and debug - can't get to work

I know this question has been asked before and I've looked through the responses but no matter what I do, I can't create an environment to step through my php programs.I've downloaded the XAMPP stack, and Eclipse and enabled xdebug but nothing.PHPinfo reports: Debug Build, No. Does that mean that I'll never get an XAMPP installation to debug. If so is there another Windows, Apache, PHP, MySQL stack recommended?I downloaded the Komodo IDE 21 day free trial and their wizard can't start debug either.help No, the Debug Build phpinfo() refers to is a compile-time switch/defin...

 php                     2 answers                     45 view
 2018-10-22         Godfery

Can I Use Python to Make a Delete Button in a 'web page'

I have written a script that goes through a bunch of files and snips out a portion of the files for further processing. The script creates a new directory and creates new files for each snip that is taken out. I have to now evaluate each of the files that were created to see if it is what I needed. The script also creates an html index file with links to each of the snips. So I can click the hyperlink to see the file, make a note in a spreadsheet to indicate if the file is correct or not and then use the back button in the browser to take me back to the index list. I w...

 python                     4 answers                     80 view
 2018-10-22         Godfery

Power BI Bullet Chart Custom Visual Truncating Category Label

Change the category values in the samplelet categoryValues = ["Total Category of Data", "Net Category of Data", "Gross Category of Data"];You will see that overflow places elipsis where there is room for double the amount of label text leaving wasted white space and truncated label. You can override the default label width in code by settingprivate static MaxLabelWidth = 180;I changed it from 80 to 180 [XXX]

 powerbi                     1 answers                     70 view
 2018-10-22         Godfery

Downloading Google Documents using api

this is shareable link link to fileid = 1wzCjl51u131v1KBgpbiKLJs8DPPakhXCFosfYjp7BY0so manage downloads documentation.file_id = '11wzCjl51u131v1KBgpbiKLJs8DPPakhXCFosfYjp7BY0'request = drive_service.files().export_media(fileId=file_id, mimeType='application/pdf')fh = io.BytesIO()downloader = MediaIoBaseDownload(fh, request)done = Falsewhile done is False: status, done = downloader.next_chunk() print ("Download %d%%." % int(status.progress() * 100))i saved the file as dd.py, run using f5 and got this error line 2, in r...

 python                     1 answers                     77 view

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