Posts

java - RxJava- CombineLatest but only fire for one Observable's emission? -

let's have 2 infinite observables can emit values @ moment. combine create observable<processfileevent> . observable<integer> selectedfileid= ... observable<mouseclick> buttonclick = ... observable<processfileevent> `processfileevent` = observable.combinelatest(selectedfileid, buttonclick, (s,b) -> { //create processfileevent here }); the problem want processfileevent emit when buttonclick emits something, not selectedfileid . it's not behavior user expects when file id inputted , kicks off processfileevent . how combine emit when buttonclick emits? use .distinctuntilchanged() on mouseclick object. way you'll events when mouseclick changes. create class contains both fileid , mouseclick : static class filemouseclick { final int fileid; final mouseclick mouseclick; filemouseclick(int fileid, mouseclick mouseclick) { this.fileid = fileid; this.mouseclick = mouseclick; } } then obs...

java - How can I set the name of markers inside a cluster manager using a list? -

so have around 850 markers have on map, , have implemented cluster manager successfully, can't seem figure out how can set each marker's title (which have kept in list). have tried below code, of marker's title's set first item in list. thoughts? jacob here code i've tried (where universityname list) mclustermanager.getmarkercollection().setonmarkerclicklistener(new googlemap.onmarkerclicklistener() { @override public boolean onmarkerclick(marker marker) { for(int = 0; < 835; i++) { marker.settitle(universityname.get(i)); } return false; } }); here myclass: class myitem implements clusteritem { private final latlng mposition; public myitem(double lat, double lng) { mposition = new latlng(lat, lng); } @override public latlng getposition() { return mposition; ...

sql - Same Data, two different results -

i have sql call gets data year , displays in month month breakdown per code below. select materialcode, [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12] (select mb.materialcode, datepart(m, date) [dp], weight issues iss join materialbatches mb on iss.materialbatchid = mb.id left join materials m on mb.materialcode = m.code issuetype = 'materialissue' , datepart(yyyy,date) = 2013 , weight > 0 , (coalesce(m.isnondispensematerial,0) = 0 or cast((select value configurationsettings name = 'includenondispenseweights') varchar(10)) = 'true')) pivot (sum(weight) i.dp in ( [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12] )) pvt this code needs change make starting selected month changeable. using code below 948 more records \ row back. select code, [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12] (select mb.code, datepart(m, date) [dp], weight issues iss join batches mb on iss.id = mb.id left join mats m on mb.code...

Can you use a Mule ESB Collection Splitter to on a HashMap? -

can use collection splitter split hashmap resulting in messages identified key , containing value in payload? example, have map<string, list<object>> , , process each list differently based on key. if possible, i'm assuming list mapped payload, how key mapped resulting message? message header? you split on entry set of hash map. i.e use following split expression #[maymap.entryset()] please see javadoc method understand how key , value each entry.

vanilla JavaScript solution to check if number has no more than 6 digits and 2 decimal places -

i need return validation check (boolean) if number has no more 6 number of digits , no more 2 decimal places. for example: 1 = valid 10 = valid 111111 = valid 111111.11 = valid 1111111.11 = invalid 1.111 = invalid looking through stack overflow can find answers input automatically rounded (not want) or decimal places have equal 2 decimal places (not @ 2). obviously, need function valid(n) { return no_more_than_six_digits(n) && no_more_than_two_decimal_places(n); } so how define these functions? function no_more_than_six_digits (n) { return n < 1e7; } function no_more_than_two_decimal_places(n) { return math.floor(n * 100) === n * 100; }

ruby - Rails test can't find route when it clearly exists? -

okay, tired, , new rails possibly missing super basic. anyways, started new project , implementing controller static pages. wrote unit tests make sure routes correct (there 4 far). 3 of them pass fourth gives me error message: 1) error: staticpagescontrollertest#test_terms_of_service_should_return_success: actioncontroller::urlgenerationerror: no route matches {:action=>"terms", :controller=>"static_pages "} test/controllers/static_pages_controller_test.rb:18:in `block in <class:staticpagescontrollertes t>' its saying can't find route. however, when rake routes exists: /about(.:format) static_pages#about contact /contact(.:format) static_pages#contact privacy /privacy(.:format) static_pages#privacy terms /terms(.:format) static_pages#terms_of_service here part of routes.rb: 'about' => 'static_pages#about' 'contact' => 'static_pages#contact' 'privacy' => ...

Rails 4 has_many :through accessing field on join table -

i have 3 models: class user < activerecord::base has_many :user_leave_portfolios has_many :leave_portfolios, :through => :user_leave_portfolios end class leaveportfolio < activerecord::base has_many :user_leave_portfolios, dependent: :destroy has_many :users, :through => :user_leave_portfolios end class userleaveportfolio < activerecord::base belongs_to :user belongs_to :leave_portfolio # table has additional field named 'leave_amount' end the 'leave_amount' field on user_leave_portfolio table used user chosen leave amount based on leave_portfolio according documentation , various other blogs , articles, should able access 'leave amount' field with: u = user.first u.leave_portfolios.first.leave_amount however, following error: nomethoderror: undefined method `leave_amount' #leaveportfolio:0x007f8708e3dbe0 schema: create_table "leave_portfolios", force: :cascade |t| t.string "name...