Posts

android - How correctly test if subscriber is called with correct data in onNext() (RxJava2) -

i test method: void updateavailablescreens() { safiecam.availablecameras() .flatmap(this::getavailablescreensforcameras) // causing failure .observeon(schedulers.mainthread()) .subscribe( screens -> { view.setavailablepagesonviewpager(screens); view.setavailablepagesonbottomsheet(screens); }, timber::e ); } with test (so giving known data, expect calling view expected enum list): @test public void widgetsshouldgetallscreens() { when(camera.availablecameras()).thenreturn( observable.just(arrays.aslist( safiecam.cameratype.selfie, safiecam.cameratype.rear))); testedvppresenter.updateavailablescreens(); list<viewpagerview.pages> pages = arrays.aslist( viewpagerview.pages.selfie, vie...

sql - How to compare with date in mm/yy format in MySQL? -

i have column named 'exp_date' , date mm/yy. i.e: 07/17. want select rows exp_date less or equal 2 months remaining today. how can this? you need post sql dialect using. assume sql92. cast function first step: cast('20' || substring (exp_date,4,2) || '/' || substring (exp_date, 1,2) date) . mssql uses ' + instead of || . after that, compare current_date - interval '1 month' . caps here optional.

Street and Road names in Google Map -

i retrieve road , street names, if enters area in search box. possible in google api ? i have checked list of street , road names in google in api solution, there been given auto complete box , request not requirement. also learnt open street maps provide these data, unfortunately perform operations based upon google api's. can suggest me way, otherthan osm. google maps api not provide such functionality. however, there google maps roads api 1 of premium paid apis lets query nearest road names , other road metadata. can check out here: https://developers.google.com/maps/documentation/roads/intro you can try overpass-turbo ( https://overpass-turbo.eu/ ) lets query osm data. can set bounds , osm tags interested in.

hp ux - Limitation of HP awk -

a simple awk script works fine in linux , own hpux 11.31 platform, doesn't work in other hpux 11.31 system. can't access problematic hpux system not able test now. @ input data mystring my.linuxsrc running 16840 yourstring your.linuxsrc running 41794 @ myawk.awk /mystring / { printf "%s#%s#%s#%s",$1,$2,first,$3; printf "\n"; flag="yes"} @ error in other hpux system syntax error source line 1 error context <<< >>> awk: quitting source line 1. the version of awk in other hpux system: other_hpux] /usr/bin/awk /usr/bin/awk: main.c $date: 2009/02/17 15:25:17 $revision: r11.31/1 patch_11.31 (phco_36132) run.c $date: 2009/02/17 15:25:20 $revision: r11.31/1 patch_11.31 (phco_36132) $revision: @(#) awk r11.31_bl2010_0503_1 patch_11.31 phco_40052 my hpux system: my_hpux] /usr/bin/awk /usr/bin/awk: main.c $date: 2008/05/19 14:40:42 $revision: r11.23/3 patch_11.23 (phco...

Python Pandas Dataframe Column of Lists, convert list to string in new column -

i have dataframe column of lists can created with: import pandas pd lists={1:[[1,2,12,6,'abc']],2:[[1000,4,'z','a']]} #create test dataframe df=pd.dataframe.from_dict(lists,orient='index') df=df.rename(columns={0:'lists'}) the dataframe df looks like: lists 1 [1, 2, 12, 6, abc] 2 [1000, 4, z, a] i need create new column called ' liststring ' takes every element of each list in lists , creates string each element separated commas. elements of each list can int , float , or string . result be: lists liststring 1 [1, 2, 12, 6, abc] 1,2,12,6,abc 2 [1000, 4, z, a] 1000,4,z,a i have tried various things, including converting panda df list string : df['liststring']=df.lists.apply(lambda x: ', '.join(str(x))) but unfortunately result takes every character , seperates comma: lists liststring 1 [1, 2, 1...

html5 - Whether browser recognize document HTML version -

i have html document written in html 4. used required attribute html 5 worked surprise. saw error red border when input empty. think browser recognized document html 5 document , ignored doctype. question is, how browser google chrome recognize html document version. thanks hints. <!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd"> <html> <head> <style> input:invalid { border: 2px dashed red; } input:valid { border: 2px solid black; } </style> </head> <body> <form> <label for="name">name</label> <input id="name" name="name" required> <button>submit</button> </form> </body> </html> how browser google chrome recognize html document version they don't. parse html. (the ex...

node.js - Why would someone create an index on a collection in MongoDB? -

db.collection.createindex()¶ creates indexes on collections. i understand why need indexes on documents, why on collections? thanks helping! we not creating indexes on documents, index documents on collections, selecting 1 or more keys. index columns in tables on relational db world. just find right document (row) collection (table).