Posts

android - Changing a business object in an Adapter -

i'm building android app similar facebook (gets newsfeed stored in db rest api), , implementing reddit-like voting system, in every feed item has vote state (none, up, down) stored in db. when retrieve newsfeed json, set votestate vote state in json, display through newsfeed adapter. but if set votestate in newsfeed adapter value (based on onclicklistener), changed value not reach actual newsfeed. because every time scroll newsfeed, newsfeed adapter gets new instance of newsfeed, , doesn't care value changed. thus, i'm looking best way modify permanently newsfeed vote state newsfeed adapter (this can generalized variable assigned arraylist , displayed through arraylistadapter). if have suggestions, please feel free respond. thank :) edit : public class newsfeedadapter extends recyclerview.adapter<newsfeedadapter.viewholder> { private newsfeed newsfeed; private feeditem item; public newsfeedadapter(..., newsfeed newsfeed) { ...; this.newsfee...

symfony - DomCrawler complex div nesting -

i'm having trouble trying data using dom crawler. want name 'avocado' , '£1.50' though i'd able $message = $crawler->filterxpath('h3')->text(); <div class="product"> <div class="productinner"> <div class="productinfowrapper"> <div class="productinfo"> <h3> <a href="http://website.com" > avocado <img src="pic.jpg" alt="" /> </a> </h3> </div> </div> <div class="pricingandtrolleyoptions"> <div class="pricing"> <p class="priceperunit"> £1.50<abbr title="per">/</abbr><abbr title="unit"><span class="priceperunitunit">unit</span></abbr> </p> <p class="pricepermeasure">£1.50<abbr title="per">/...

java - Assertions on many files with required pre-processing -

i have large set of files (>1000) on want running same set of assertions. assertions organized in logical groups, have broken them down more 30 @test methods in single class. in order run assertions want, need run before each file expensive pre-processing, , assertions run on results of pre-processing. as pre-processing required each @test method, want running executing once each file. i used @dataprovider following way: @contextconfiguration({ "classpath:/meta-inf/spring/ev-xml-test-context.xml" }) public class fantastictest extends abstracttestngspringcontexttests { private string[][] files = new string[][] { { "file1.xml" }, { "file2.xml" }, { "..." }, { "file1000.xml" } }; private map<string, object> preprocessingresults = new hashmap<>(); @beforeclass public void setup() throws exception { for(int i=0; i<files.length; i++...

html - Alignment in form-horizontal using bootstrap -

actually m new on bootstrap,i using form-horizontal creating layout responsive. code: <div class="panel-body"> <form class="form-horizontal" role="form"> <div class="form-group"> <div class="col-md-2"> <label for="" class="control-label">from:</label> <div id="date_dropdown" ></div> <div> <div class="col-md-2"> <label for="" class="control-label">to:</label> <div id="date_dropdown1" ></div> </div> <div class="col-md-2"> <label for="" class="control-label">dept:</label> <div id="dept_dropdown" ></div> </div> <div class="col-md-2"> <label fo...

How to call Oracle procedure have Userdefined "Type" IN parameters using jdbc in java -

this question has answer here: how call oracle stored procedure include user-defined type in java? 4 answers i have created below user defined type in oracle. using type in procedure in parameter. how call procedure using jdbc callablestatement. create or replace type "varchar_tab" table of varchar2(500); my procedure is: procedure delete_album_metadata ( p_catalog_tab in varchar_tab ); please me. you need use setplsqlindextable binder method defined in oracle.jdbc.oraclepreparedstatement. here pointer javadoc: https://docs.oracle.com/database/121/jajdb/oracle/jdbc/oraclepreparedstatement.html#setplsqlindextable_int__java_lang_object__int__int__int__int_

In Rails how to set two sets of routes to one resource? (Example Category for Photos and Albums) -

i have categories model shared both albums , photos. need use photo categories under /photos/categories , album categories under /albums/categories . how can this? i tried failed. first set routes : namespace :albums resources :categories end namespace :photos resources :categories, controller: 'photos/categories' end then in view printed category links : link_to category.name.titleize, photos_category_path(category) the links fine when visit them error : uninitialized constant photos what doing wrong here? thanks i think both categories controllers need defined in own namespace: # controllers/albums/categories_controller.rb module albums class categoriescontroller < applicationcontroller ... end end # controllers/photos/categories_controller.rb module photos class categoriescontroller < applicationcontroller ... end end

ruby - Error trying to start Rails Server -

i have issue rying start server on ruby on rails. c:\users\ogautier\ror\holamundo>rails server c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw32/lib/nokogiri.rb:29:in `require': cannot load such file -- nokogiri/nokogiri (loaderror) c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw32/lib/nokogiri.rb:29:in `rescue in <top (required)>' c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw32/lib/nokogiri.rb:25:in `<top (required)>' c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/loofah-2.0.2/lib/loofah.rb:3 :in `require' c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/loofah-2.0.2/lib/loofah.rb:3 :in `<top (required)>' c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/rails-html-sanitizer-1.0.2/lib/rails-html-sanitizer.rb:2:in `require' c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/rails-html-sanitizer-1.0.2/lib/rails-html-sanitizer.rb:2:in `<top (required)>' c:/r...