Posts

dynamic - Conditional jsf include -

how can conditionally include jsf facelets file @ runtime? sample functionality required if ( add button click) { ui:include src="add.xhtml" } if ( update button click) { ui:include src="update.xhtml" } the syntax above indicative ... mojarra 2.1.1 / apache tomcat 7.0.22 / primefaces 3.4 ui:include doesn't have rendered attribute have encapsulate in other component. set property on server base on button clicked. <h:form> <p:commandbutton value="add" update=":includecontainer"> <f:setpropertyactionlistener value="add" target="#{mybean.action}"/> </p:commandbutton> <p:commandbutton value="update" update=":includecontainer"> <f:setpropertyactionlistener value="update" target="#{mybean.action}"/> </p:commandbutton> </h:form> <h:panelgroup id="includecontainer"> <h:panelgroup re...

javascript - JS code does not work on mobile -

i have following code $('.checkbox.radio-info input[type="checkbox"]').change(function() { if ($(this).parent().parent().find('input[type="checkbox"]:checked').length > 1) { $(".checkbox.radio-info input[type='checkbox'").prop('checked', false); $(this).prop('checked', true); } }); this works expected on desktop, however, on iphone (ios 9, chrome) doesn't work. not uncheck checkbox when check one. is there in code device related? it seems missing "]" in line: $(".checkbox.radio-info input[type='checkbox'").attr('checked', false); maybe desktop browser more forgiving? if doesn't help, please share html well.

hive - Avro,parquet and SequenceFileFormat position in Hadoop Ecosystem and their utility -

i have seen different file formats being used while importing , storing hdfs , data processing engines utilize these formats while performing own set of procedures.so kind of difference these file formats make , how choice made different use cases.being newbie creates confusion.kindly same. the choice depends on use case facing according type of data have, compatibility processing tools, schema evolution, file size, type of query , read performances. in general : avro more suitable event data can change on time sequence datasets sharded between mr jobs parquet more suitable analytics due it's columnar format here keys can you writing performance ( more + have faster ) sequence : +++ avro : ++ parquet : + reading performance ( more + have faster ) sequence : + avro : + + + parquet : + + + + + file sizes ( more + have smaller file ) sequence : + avro : ++ parquet : + + + and here facts each file type avro : better in schema ev...

java - JUnit Testing a class -

this first time i've had write j unit test , i'm stuck on how start. class represents single cell on othello board has grid , token value. i wanted test constructor both "black" , "white" , different locations, , wanted test of setters , getters. any appreciated. public class boardcell { /** * item @ boardcell. */ private item token; /** * celllocation of boardcell. */ private boardlocation location; /** * constructor. * @param row row number. * @param col column number. * @param token item value. */ public boardcell(int row, int col, item token) { this.token = token; location = new boardlocation(row, col); } /** * sets item value. * @param token item value. */ public void setitem(item token) { this.token = token; } /** * set value of item in boardcell. * @param val value of item. */ public v...

vector - C++ read in a line of string as ints? -

i trying read line of string characters numbers (e.g "30 40 50 20") , put them vector. need avoid empty space , newlines. when read input, doesn't see string "30", sees characters "3" , "4". void input() { getline(cin,line, '\n'); (int = 0; < line.length(); i++) { if (! (isspace(line[i]))) { cout << line[i] << ", "; scores.push_back(line[i]);//(atoi(input)); } } cout << scores.size() << "! "; } a line "30 40 50" won't give vector size of 3, give size of 6. optimal ways around issue? edit: should have clarified in original message challenge, in unable include string stream library in original case. i think you're doing right thing grabbing whole line before parsing, otherwise bit of pickle. have parsing. right you're pulling out individual characters. ...

php - insert element on array on private function -

how can insert element final position of array array on private function?? private function getdata() { return array( 1 => array( 'open_cookie_id' => 1, 'text' => 'i may throw on ya', 'who' => 'leonard mccoy', ), 2 => array( 'open_cookie_id' => 2, 'text' => 'i think these things pretty safe.', 'who' => 'james t. kirk' ), 3 => array( 'open_cookie_id' => 3, 'text' => 'well, hate break you, starfleet operates in space.', 'who' => 'james t. kirk' ), 4 => array( 'open_cookie_id' => 4, 'text' => 'yea...

php - Joomla 3.X - Transactions split between functions -

i have problem (once every 1-3 months) transaction gets run twice, , result, data gets entered db twice. here's gist of goes on: function foo() { $arr = getsomearray(); $db = jfactory::getdbo(); try { bar($arr); } catch(exception $e) { $db->transactionrollback(); } } function bar($arr) { $db = jfactory::getdbo(); $db->transactionstart(); // series of inserts , updates // if fail, throw exception $db->transactioncommit(); return true; } here, $arr in foo() should contain unique values. code prevents duplicate entries being inserted db checking if particular entry exists. to test base checks work, i've mocked $arr contain 2 values same. receive exception expected. however, i'm still getting double entries in db , i'm stumped how it's possible. time stamps suggest single transaction gets duplicated , both run in parallel. haven't been able find on particular issue, because it's no...