Posts

Showing posts from June, 2010

xml - Android : Parse using xmlpullparser -

i have xml file in location res/xml/data.xml need parse xml file xmlresourceparser xrp=context.getresources().getxml(r.xml.data); i used code file. returns xmlresourceparser tried xmlpullparser xmlpullparserfactory factory = xmlpullparserfactory.newinstance(); factory.setnamespaceaware(true); xmlpullparser xpp = factory.newpullparser(); i not getting clear idea between these 2 parser. question how parse xml file in resource folder using xmlpullparser ? xmlresourceparser interface extends xmlpullparser . getxml wil return xmlresourceparser object. can read parser text similar how parse input stream or string using xmlpullparser here sample code parse resource xml try { xmlresourceparser xmlresourceparser = getresources().getxml(r.xml.data); int eventtype = xmlresourceparser.geteventtype(); while (eventtype != xmlpullparser.end_document) { if (eventtype == xmlpullparser.start_document) { system.out.pr

unicode - Number of bytes of CString in C++ -

i have unicode string stored in cstring , need know number bytes string takes in utf-8 encoding. know cstring has method getlength() , returns number of charactes, not bytes. i tried (beside other things) converting char array, (logically, guess) array of wchar_t , doesn't solve problem. to clear goal. input lets "aaa" want "3" output (since "a" takes 1 byte in utf-8). input "āaa", i'd see output "4" (since ā 2 byte character). i think has quite common request, after 1,5 hours of search , experimenting, couldn't find correct solution. i have little experience windows programming, maybe left out crucial information. if feel that, please let me know, i'll add information request. use widechartomultibyte output charset cp_utf8 the function return number of bytes written output buffer, or length of utf-8 encoded string lpcstr instr; char outstr[max_outstr_size]; int utf8_len = widechartomultibyte(c

ruby on rails 4 - Why is db:create making development DB when all other indications are it's in production -

i have strange problem. i have following database.yml production: adapter: postgresql encoding: unicode database: mydb_production # details on connection pooling, see rails configuration guide # http://guides.rubyonrails.org/configuring.html#database-pooling pool: 5 test: adapter: postgresql host: localhost username: password: database: test # or whatever name encoding: utf8 development: adapter: postgresql encoding: unicode database: mydb_development pool: 5 username: dazzaroonie password: my environment.rb has: # load rails application. require file.expand_path('../application', __file__) env['rails_env'] ||= 'production' # initialize rails application. chatrpix::application.initialize! my passenger vhost is: <virtualhost *:80> ... <directory /users/dazzaroonie/sites/newapp/public> allowoverride options -multiviews railsenv production </directory>

php - url error in wordpress site -

i have set wordpress site okay in localhost when upload in server there problem in url. i have checked table wp-options , other table , wp-config files not working. wordpress url uinter.com when use in server shows uinter.com/uinter.com/ . show correct page if url this. need make url appear uinter.com . appreciated. i spending lot of time on , not found solution. me out this.

Rails NoMethodError when converting strings to date from submitted form -

rails 4.0.3. have form date field. in other words, works when use date_select. works on dev machine. when deploy production, form refuses submit , throws nomethoderror upon reaching date, complaining lack of utc method. can't trace because production server's log never tells me more line fails, line model.new(params[:form]) line , failure during type conversion magic. the field text field value supplied jquery ui datepicker, problem exists when plain rails formhelper date_field. gets date, fails... works in dev , i'm deploying production using git, know on same page. locally, i'm working in jruby , using neo4j.rb 2.3 db. have mimicked dev environment running production app server, torquebox, , still local, fails remote. i'm running same version of jruby in both locations , have of gems locked specific versions rule out weird version-specific bug. thoughts appreciated! try code , see if works:- date_string = "#{review_params['date(1i)'

clojure - Iteratively apply function to its result without generating a seq -

this 1 of "is there built-in/better/idiomatic/clever way this?" questions. i want function--call fn-pow --that apply function f result of applying f argument, apply result of applying result, etc., n times. example, (fn-pow inc 0 3) would equivalent to (inc (inc (inc 0))) it's easy iterate : (defn fn-pow-0 [f x n] (nth (iterate f x) n)) but creates , throws away unnecessary lazy sequence. it's not hard write function scratch. here 1 version: (defn fn-pow-1 [f x n] (if (> n 0) (recur f (f x) (dec n)) x)) i found twice fast fn-pow-0 , using criterium on (fn-pow inc 0 10000000) . i don't consider definition of fn-pow-1 unidiomatic, fn-pow seems might standard built-in function, or there may simple way define couple of higher-order functions in clever arrangement. haven't succeeded in discovering either. missing something? the built-in looking dotimes . i'll tell why in round-about fashion. time

javascript - round to 2 decimal places in js invoice -

i have invoice js script done , working, cant figure out how round grand total 2 decimal spaces. js: var item = document.getelementbyid('item'); var item1 = document.getelementbyid('item1'); var item2 = document.getelementbyid('item2'); var item3 = document.getelementbyid('item3'); item.onchange = function() { price.innerhtml = "$" + this.value; qty.value = 1; //order 1 default. add(); }; qty.onchange = function() { add(); } item1.onchange = function() { price1.innerhtml = "$" + this.value; qty1.value = 1; //order 1 default. add(); }; qty1.onchange = function() { add(); } item2.onchange = function() { price2.innerhtml = "$" + this.value; qty2.value = 1; //order 1 default. add(); }; qty2.onchange = function() { add(); } item3.onchange = function () { price3.innerhtml = "$&qu

java - SocketTimeoutException after four requests to local bitcoind -

i want connect bitcoind using java. plan use htmlunit , gson. right can complete single request successfully. however, can not more four subsequent requests due sockettimeoutexception being thrown @ fifth request. i tried: waiting between requests. (no effect visible) forcing failing http status code e.g. requesting getinfoo instead of getinfo . (i not timeout after 4 failing requests) any or comment appreciated! package test; import com.gargoylesoftware.htmlunit.browserversion; import com.gargoylesoftware.htmlunit.failinghttpstatuscodeexception; import com.gargoylesoftware.htmlunit.httpmethod; import com.gargoylesoftware.htmlunit.webclient; import com.gargoylesoftware.htmlunit.webrequest; import com.google.gson.gson; import java.io.ioexception; import java.net.sockettimeoutexception; import java.net.url; public class test { public static void main(string[] args) { webclient client = new webclient(browserversion.firefox_24); // http://[bitcoin

javascript - Creating spans that hide when another object is clicked -

here html: <div id="sidebar"> <table id="table1"> <tr> <th>table</th> </tr> <tr> <td> <a rel="img1">link1</a> </td> <td> <a rel="img2">link2</a> </td> </tr> </table> </div> <div id="box"> <img src="cant-believe-it-icon.png" id="img1"/> <img src="too-much-icon.png" id="img2"/> </div> <span>text fist image</span> <span>text second image</span> and jquery: $('a').click(function(){ imgid = $(this).attr('rel'); $('a').removeclass('active'); $(this).addclass('active'); $('img').hide(); $('#'+imgid).fadein('

java - memory allocation change -

public void changecolor(int[] value) { color = value; } in above code color is int array in class. , value array in scope of method changecolor. color = value; assigning memory space allocated value color. per understanding once method ended variable specific method deleted, in case color able access value after method ends?? "will color able access value after method ends??" short answer: yes, otherwise why define variable global.(no matter it's reference or primitive) please run code see happens: public class test { int[] color = new int[2]; int = 20; public static void main(string[] args) { test t = new test(); t.changecolor(new int[] {1,2,3}); system.out.println(arrays.tostring(t.color)); system.out.print(t.i); } public void changecolor(int[] value) { color = value; = 10; } }

java - Overloading methods in an interface using generics as parameters -

i have java interface defining method takes interface b parameter. want know if possible overload method in implementing class give parameter object implements interface b. here's sample code of mean: public interface sampleinterfacea{ public void samplemethod(sampleinterfaceb b); } public class classb implements sampleinterfaceb{} public class classc implements sampleinterfaceb{} public class sampleclassa implements sampleinterfacea{ @override public void samplemethod(classb b){} } public class sampleclassb implements sampleinterfacea{ @override public void samplemethod(classc c){} } thanks in advance help. if try it, you'll see sampleclassa , sampleclassb seen compiler missing needed implement sampleinterfacea . you need implement actual method defined in interface. a way approximately seem want use generics: public interface sampleinterfacea <t extends sampleinterfaceb>{ public void samplemethod(t b); } public class

c# - EF Query Help - Grouping and Sub queries -

i have data table (docs, dbset in context) below data id code rev 1 a1 1 2 a1 2 3 a1 3 4 a3 1 5 a2 1 6 a2 2 i need select records has records each code has highest rev. expected result id code rev 3 a1 3 6 a2 2 4 a3 1 the id column pk of table , code+rev unique. note: there other fields in table need result. ideal iqueryable (doc model class), think of selecting id within inner query , use iqueryable of docs. thanks in advance try this: var res = r in docs (from c in docs group c c.code g select new { localcode = g.key, localrev = g.max(t => t.rev) }).any(x => x.localcode == r.code && x.localrev == r.rev) select r; res iqueryable.

mapreduce - Availability of inputs to reducers -

in map-reduce stages, enforces barrier between map , reduce. reducers cannot continue until mappers completed assigned jobs. possible reducer start new job earlier higher efficiency? if answer yes or no why? no reduce phase can’t complete until mappers have completed assigned workload. because can’t predicted ahead of time because prediction of completing jobs , reduce job totally unpredictable till time mappers finished.

c++11 - Contiguous associative container : what would be the fastest implementation? -

after 2 months of applied maths research, have found way have substantial gains manage data in application domain (to published...). in short, application domain requires associative container, contiguous in memory avoid cache misses in large scale supercomputing applications. fast insertions , deletions not priority : priority have fastest possible binary search on keys via std::upper_bound . have working implementation, thinking implementing stl-like container design. so, associative container has following properties: it contains between 10 , 100 millions of keys , values keys unsigned integers of 8 , 16 , 32 , 64 or 128 bits values tuples of ~10 different types each key associated single value the critical operation binary search on keys (probably via call std::upper_bound ) insertions/deletions/sorting not critical so question is: best internal implementation (of course run benchmarks, discarding possibilities great): std::vector<std::pair<key

vb.net - About decompiler -

i try open .exe (i think visual basic language) ex. private class jtojyfwfywdp0omhf7t82oyvualiflo1n3p64naliflo1n3p64nat9q3itig85ja private ywwmy1ygzhrj1ywwmy1ygzhrjacyz5jqj3lgwaaxj0brst4ptmraxj0brst4ptm0 string() private hnpxeecheskx2l6bd3s1h70sral6bd3s1h70sraobgzqem4lcg3a2ykefpb5kbya xnamespace() private 2ykefpb5kbym3toxycdgiwnyaaylv2mdpifm9uaylv2mdpifm9uaccaok0g5sxe0 list(of xattribute) <editorbrowsable(editorbrowsablestate.never)> friend sub new(inscopeprefixes string(), inscopens xnamespace(), attributes list(of xattribute)) me.ywwmy1ygzhrj1ywwmy1ygzhrjacyz5jqj3lgwaaxj0brst4ptmraxj0brst4ptm0 = inscopeprefixes me.hnpxeecheskx2l6bd3s1h70sral6bd3s1h70sraobgzqem4lcg3a2ykefpb5kbya = inscopens me.2ykefpb5kbym3toxycdgiwnyaaylv2mdpifm9uaylv2mdpifm9uaccaok0g5sxe0 = attributes end sub .... have way understand ? private ywwmy1ygzhrj1ywwmy1ygzhrjacyz5jqj3lgwaaxj0brst4ptmraxj0brst4ptm0 me.ywwmy1ygzhrj1ywwmy1ygzhrjacyz5jqj3lgwa

html5 - Video embedded into HTML doesn't play -

i trying accomplish simple task; @ least think should not. i trying embed video html , nothing try seems works. here code using it: <video width="560" height="340" controls> <source src="video/30.mp4" type='video/mp4; codecs="avc1.42e01e, mp4a.40.2"'> <source src="video/30.ogv" type='video/ogg; codecs="theora, vorbis"'> <object width="640" height="384" type="application/x-shockwave-flash" data="video/player_flv_maxi.swf?image=placeholder.jpg&file=video/30.swf"> <param name="movie" value="video/player_flv_maxi.swf?image=placeholder.jpg&file=video/30.swf" /> </object> </video> i using resource try , accomplish this: http://www.webmonkey.com/2010/05/embed-videos-in-your-web-pages-using-html5/ i have tried: http://www.w3schools.com/html/html5_video.asp and none of seem

rpm spec - RPM %files absolute path issue -

i relatively new creating rpm packages. using fedora 19 os , not able make rpm pick %files absolute path. please advice on same name: samplerpm version: 1 license: none release: 5.6 buildroot: /root/rpmbuild prefix: /root/rpmbuild summary: sample group: applications/sample %prep rm -r /home/siva/rpmbuild/sources/ %build cd /home/siva/repos/centina/sa ant clean make-private dist cp /home/siva/repos/centina/sa/dist/sample.zip /root/rpmbuild/sources %install cp /home/siva/repos/centina/sa/dist/sample.zip /root/setup cd /root/setup unzip sample.zip chmod +x setup.sh ./setup.sh -o %description empty %files /root/rpmbuild/sources i following error error: file not found: /root/rpmbuild/buildroot/samplerpm-1-5.6.x86_64/root/rpmbuild/sources thanks in advance %files final files be. recommend finding rpm primer online - there many walk right thru step step.

javascript - bootstrap navigation active links not working -

i'm trying make navigation active on active div, following example shows , hides correct divs doesn't add active class link: html <div class="list-group" id="admin-list"> <a href="#add-user" data-toggle="tab" class="list-group-item"> add user </a> </div> js $("#nav li a").on("click", navigation("#nav li")); $("#admin-list a").on("click", navigation("#admin-list a")); var foo = function(navigation) { $(navigation).removeclass("active"); //remove "active" li $("#home, #about, #contact", "#add-user").hide(); //hide "pages" $($(this).prop("href")).show(); //show current target $(this).addclass("active"); //set click active }; i think problem lies within ($(this).prop("href")).show(); because not valid selector. if trying curre

javascript - knockoutjs cannot apply bindings to different ids -

i have several views in project , each applies bindings on own tag this: (note: periods represents more code removed show problem have, created fiddle bit more complete here: http://jsfiddle.net/eyb8e/ ) html <div id="ui-main"> ... html code bound mainviewmodel here <div/> ... <div id="ui-partial"> ... </div> javascript function mainviewmodel() {...}; var mainviewmodel = new mainviewmodel(); ko.applybindings(mainviewmodel, document.getelementbyid("ui-main")); ... function partialviewmodel() {...}; ko.applybindings(partialviewmodel, document.getelementbyid("ui-partial")); but second applybindings not apply because: "error: cannot apply bindings multiple times same element." . (see in jsfidle: http://jsfiddle.net/eyb8e ) i cannot figure out wrong. your <div /> should </div> .

php - How to hide a subfolder in url rewriting -

my site : www.mysite.com/subfolder/login/index.php i want url there www.mysite.com/login/index.php . tried modifying .htaccess file in root folder follows: rewriterule ^login\/index\.php$ /subfolder/login/index.php [l] --but problem can't use or access css file (style.css) login folder. # fix js/images/css rewriterule ^.+?/((img|css|js)/.+)$ /subfolder/login/$1 [l,nc] try adding first rule in htaccess . or can use # fix js/images/css rewriterule ^.+?/((img|css|js)/.+)$ http://www.yourdomain.com/subfolder/login/$1 [l,nc] you can see more examples , ways of rewriting here: https://wiki.apache.org/httpd/rewrite

How to not lose messages when publishing to RabbitMQ from Mule until the proper "Ack" is received? -

i have synchronized mule flow reads messages sonic topic , publish rabbit exchange. i loosing messages when rabbit brought up/down. rabbit exchange publishing ha queues. how can make sure mule not consuming message until proper "ack" received rabbit broker? here flow. <jms:connector name="sonicmqconnectorsub" validateconnections="true" connectionfactory-ref="factorysub" doc:name="jms" clientid="testclient" durable="true" maxredelivery="-1" > <reconnect-forever frequency="30000"/> </jms:connector> <spring:beans> <spring:bean id="soniqmqconnectionfactorybeansub" name="factorysub" class="progress.message.jclient.connectionfactory"> <spring:property name="connectionurls" value="tcp://server1:7800" /> <spring:property name="defaultuser" value="user" />

php - upload files to to the same folder -

i created function uploads files. problem i'm calling different file , different folders, means path image folder's changing. how can set folder absolute? btw - need work on local computer (using wamp) , linux server (where website located) $usersfiles = './images/usersfiles/'; if (move_uploaded_file($files['file']['tmp_name'][$i], $usersfiles.$files['file']['name'][$i])) you can use $_server['document_root'] path root level of website, e.g. $usersfiles = $_server['document_root'] . '/images/usersfiles/'; if (move_uploaded_file($files['file']['tmp_name'][$i], $usersfiles.$files['file']['name'][$i]))

javascript - How to find a SHA1 encrypted string from the 5-word encrypted hash in Ruby? -

say you're encrypting string "alextoul" cryptojs.sha1. as explained in source below object looks that: cryptojs.sha1("alextoul") = {words: { 0: 1025575641 1: -2026381578 2: 1077518901 3: 1028391820 4: 1049226021 }} turns out if convert string get: cryptojs.sha1("alextoul").tostring() = "3d210ad98737def64039a2353d4c038c3e89eb25" now i'm trying find string above ("3d210ad98737def64039a2353d4c038c3e89eb25") 5 words in ruby. thefunctionineed(params[:words]) # equal "3d210ad98737def64039a2353d4c038c3e89eb25" source: https://code.google.com/p/crypto-js/#the_hasher_output just reading source: https://code.google.com/p/crypto-js/source/browse/tags/3.1.2/src/core.js#181 --> https://code.google.com/p/crypto-js/source/browse/tags/3.1.2/src/core.js#306 --> function stringify(wordarray) { // shortcuts var words = wordarray.words; var sigbytes = wordarray

android - Name of technique behind 3D effects like HTC one dimension plus -

the htc 1 m8 uses dual cameras achieve 3d dimension plus effect. name of technique? here's demonstration: video it's image processing using depth map, more information see: https://www.htcdev.com/devcenter/opensense-sdk/htc-dual-lens-api no need reverse engineer - dimensionplus effect implementation of 2d-plus effect (if need name) described here: https://en.wikipedia.org/wiki/2d-plus-depth this effect uses depth map included in photos create standard geometry sdk uses visualize effect using gyro (alternatively can program touch navigation).

Java: Using "08" and "09" in an array -

how can store 08 , 09 int array? understand cannot due binary characteristics , have tried both... 0b08, 0b09 ... , ... 0b08, 0b09 no luck. the following line of code ideally i'd have: final int[] monthvaliddosinputs = {00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12}; here error... convertdate.java:15: error: integer number large: 08 convertdate.java:15: error: integer number large: 09 thanks! when start literal integer 0 , it's considered octal number, 1 uses base 8 rather base 10. means 8 , 9 not valid digits. if really want leading 0 (i.e., octal), need like: int[] monthvaliddosinputs = {000, 001, ..., 007, 010, 011, 012, 013, 014}; which gives decimal numbers 0 through 12 , in octal. however, if want keep them evenly spaced decimal, use leading space instead of zero: int[] monthvaliddosinputs = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; // ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ al

java - EhCache Deadlock issue while using RMI Cache Replicator -

i facing cache deadlock issue in application while rmi cache replicator strategy. following exception log: net.sf.ehcache.transaction.deadlockexception: deadlock detected in cache [abccache] on key [1] between current transaction [139003] , foreign transaction [138998] @ net.sf.ehcache.transaction.local.localtransactionstore.put(localtransactionstore.java:200) @ net.sf.ehcache.transaction.local.jtalocaltransactionstore.put(jtalocaltransactionstore.java:268) @ net.sf.ehcache.cache.putinternal(cache.java:1434) @ net.sf.ehcache.cache.put(cache.java:1367) @ net.sf.ehcache.cache.put(cache.java:1339) following ehcache configuration rmi synchronization: <transactionmanagerlookup class="net.sf.ehcache.transaction.manager.defaulttransactionmanagerlookup" properties="jndiname=java:comp/usertransaction" propertyseparator=";"/> <cachemanagerpeerproviderfactory class="net.sf.ehcache.distribution.rmicachemanagerpeerproviderfactory&

jsf - JSF2.2 Annotated Validation not working -

i developing application using tomcat 7, jsf 2.2.6 (mojarra), hibernate validator 4.3.1 , have come across documented bug shown here: https://java.net/jira/browse/javaserverfaces-3183 . i have patched temporarily using fix given in answer on question: https://stackoverflow.com/a/21700488/1089995 , until such time 2.2.7 released publicly. however when attempt use annotations on fields, such @notnull, @size, etc, these ignored - there no relevant stack trace this, no error occurs , annotations ignored during validation phase. page.xhtml <input type="text" placeholder="e.g. joe bloggs" jsf:id="txtadminname" jsf:validator="#{bean.validateadminname}" jsf:value="#{bean.model.adminname}"/> model.java //model bean bean validation, not applied field. @size(min = 3, max = 50, message = "please enter between 3 , 50 characters.") private string adminname; bean.java //the model bean bean validation, shown below.

Neo4j embedded online backup using Java in Ubuntu -

i using neo4j(embedded) enterprise edition 1.8.3. tried online backup using code below def backup_data() { val backuppath: file = new file("d:/neo4j/data/backup/") val backup = onlinebackup.from( "127.0.0.1" ) if(backuppath.list().length > 0) { backup.incremental( backuppath.getpath(), false ) } else { backup.full( backuppath.getpath() ); } } the above code working fine in windows got error client not connect localhost/127.0.0.1:6362 same code in ubuntu. should change make work in ubuntu?

javascript - Leaflet.markercluster cluster added to DOM event -

i'm trying customize marker clusters appear pie charts, using chart.js library. i've overridden iconcreatefucntion additional calculations necessary , set data, transform icons actual charts, need call additional js when cluster icon added dom. how can hook leaflet.markercluster's "cluster icon added" event? ok, figured out. it's simple adding like: cluster.on 'add', (event) -> # stuff event.target, l.markerclustergroup instance to iconcreatefunction hope helps else out 1 day...

jquery - Issue in iterating the array in javascript -

i have array named a[] contains city_id , city name then doing edit , details such cityid , countryid ,etc and save in var b= cityid now cityname , appending field textbox i iterating array thru each function function f1() { jquery(a). each(function(m) { if(this.city_id(from array a) == cityid) if(c== "") { c += this.cityname; } else { c += ","+ this.cityname; } }); } c global var problem on click of edit c bombay , delhi , puna but again next time if click on radio button fetch details gets appended bombay , delhi , puna , chennai instead of clearing first one. try this.. here each obj in array. $.each( a, function( i, val ) { if(i.city_id== cityid) if(c== "") { c += this.cityname; } else { c += ","+ this.cityname; } });

c# - EventWaitHandle.Close() - what type of call this is sync or Async? -

i have eventwaithandle wait receive events. once, receive event. supposed release resources used eventwaithandle. releasing events using eventwaithandle.close(). my question after calling eventwaithandle.close(). should wait or sleep times release resources?

excel - Report generation based on multi lookup and dynamic columns -

i little stuck report trying generate in excel , hoping help. here summary of trying do: table 1 has 1 column called people (it’s list of employees) table 2 has 1 column called countries (it’s list of relevant countries) table 3 has 3 columns called person, country , date. there 1 entry every person each time review country. so data like: person | country | date john | uk | 10/01/2013 paul | uk | 15/01/2013 john | france | 15/01/2013 bob | spain | 16/01/2013 the report need produce 1 shows has/hasn't checked each country. columns ‘person’, uk, france, spain (and other unique value country table). there 1 single row each person yes/no value in relevant column if person has reviewed country i.e. table 3 contains value matches value person , country. so clear report should similar to: person | uk | france | spain john | yes

javascript - jQuery: How to toggle H1 tags at different time intervals? -

i need toggle 2 h1 tags. first 1 needs displayed 3 seconds on screen, , second needs displayed 8 seconds on screen. i need jquery solution. try code. html <h1> first h1 </h1> <h1> second h1 </h1> jquery <script type="text/javascript"> $(document).ready(function(){ //initially hide second h1 $("h1:nth-child(2)").hide(); function show_second_h1(){ $("h1:nth-child(1)").hide(); $("h1:nth-child(2)").show(); settimeout(show_first_h1,8000); } function show_first_h1(){ $("h1:nth-child(1)").show(); $("h1:nth-child(2)").hide(); settimeout(show_second_h1,3000); } settimeout(show_second_h1,3000); }); </script> it call show_first_h1() , show_second_h1() @ given time-interval 1 one show respective h1 tag. demo jsfiddle edit: if have control on html , can set id h1 following simplified code

excel - Insert a column chart that shows the number of values found in a range of rows -

Image
assume have data follows: id; author; customer ticket 1; john; alice ticket 2; john; bob ticket 3; ken; charles ticket 4; ken; darren (i use ; symbolize end of cell/column) i want produce column chart has 1 column per unique value author , height of column number of times value occurs. in example, have 2 columns ( john , ken ) , each 2 in size. how do that? i think want achieved pivottable author rows , count of author sigma values select data , insert column chart:

java - How to replace the value of '0' in a given pattern? -

i new in java, , trying replace value of "0's" "x" @ index "0,1,7,13,20,21,22, , 23" in below given sequence of 0 , 1's. , code far given. problem due can not obtain desired result. 001111 101110 100010 110000 public class task { public static void main (string args[]) { file file = new file("c:\\netbeansprojects\\task\\src\\file.txt"); bufferedreader reader = null; try { reader = new bufferedreader(new filereader(file)); string text = null; //array lis declaration arraylist<string> list = new arraylist<>(); while( (text = reader.readline()) != null){ list.add(text); } //printing array list. system.out.println("print array list\n"); for(string d:list){ // system.out.println(d); } //convert arraylist 2darray

Code coverage report from jacoco.exec file using ant -

i trying generate code coverage report jacoco.exec file using ant. my ant build is: <?xml version="1.0"?> <project xmlns:jacoco="antlib:org.jacoco.ant" name="example ant build jacoco" default="rebuild"> <description> example ant build file demonstrates how jacoco coverage report can itegrated existing build in 3 simple steps. </description> <property name="src.dir" location="./java"/> <property name="result.dir" location="./target"/> <property name="result.classes.dir" location="./classes"/> <property name="result.report.dir" location="${result.dir}/site/jacoco"/> <property name="result.exec.file" location="./jacoco.exec"/> <!-- step 1: import jacoco ant tasks --> <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml"&g

multithreading - Java make sleeping threads do work in a thread pool -

i have thread pool fixed number of working threads (say 4). continiously fetch new runnables executor. of these runnables have long period sleep call, waiting thread interrupted it: runnable runnable = new runnable() { @override public void run() { //do preparation doprework(); //wait other runnable interrupt me try { thread.sleep(40000); } catch(interruptedexception e) { } //finish work doafterwork(); } } so question is: when fetch first 4 runnables executor, working threads sleeping , other incoming runnables(a lot of them, because continiously incoming) queued , have wait available threads. there way, can use sleeping threads execute new incoming runnables, maintaining others sleeping? no, sleeping thread sleeping. can't make else. what should add scheduled task delayed amount of time want. free current thread , allow else. scheduledexecut

regex - .htaccess RewriteRule for directory -

i use rewriterule following www.mysite.com/xyz or www.mysite.com/xyz/ ==> should go www.mysite.com/page.php?var=xyz www.mysite.com/xyz.html www.mysite.com/xyz.htm www.mysite.com/xyz.php or other extension ==> should not rewritten only when there's no file extension, rewrite rule should used thanks! put code in document_root/.htaccess file: rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([^.]+?)/?$ /page.php?var=$1 [l,qsa]

javascript - Replace element on click -

when developing apps android through phonegap using html there noticeable flicker when switching pages. caused loading in new html file. can avoided replacing element on click , having fade in? i don't mind using javascript or jquery can't seem find way using html , css. i'm creating childrens interactive story/book. clicking goback or goforth buttons load in new content, without effecting buttons. it's best understand causing flicker, since you've given no information go on, there's not can that. it's pretty easy replace element plain javascript: function replaceelem(origelem, newelem) { var parent = origelem.parentnode; parent.insertbefore(newelem, origelem); parent.removechild(origelem); } if want fade new element in, can css transition or library supports animations. if want new element fadein on top of old element, have play games overlapping objects , positioning , remove old element after new element faded in. d

c# - Windows WebHDFS Client to Cloudera Hadoop -

we have windows application communicating fine via webhdfs client (in incubator phase) http:/ /hadoopsdk.codeplex.com/wikipage?title=webhdfs%20client&referringtitle=home cloudera hadoop installation. next phase establish kerberos authentication via http. having difficulty finding on topic between windows client , linux/apache server. most of examples i've seen using curl --negotiate mechanism : http://hadoop.apache.org/docs/r1.0.4/webhdfs.html#delegation+token+operations everything else i've found .net has been low level http://msdn.microsoft.com/en-us/library/ms995331.aspx is there out there can use or going have write custom code? i found solution problem being misunderstood how kerebros snego implemented. for of in same predicament hope helps..the authentication done between client (windows machine) , kdc (linux) @ time of users logon of client (for 1 configuration). after ticket has been issued webhdfs communication can established in more secure m

hadoop - Error running a MapReduce streaming job using Python -

i'm trying run mapper , reducer code (*disclaimer - part of solution training course) mapper.py import sys line in sys.stdin: data = line.strip().split("\t") if len(data) == 6: date, time, store, item, cost, payment = data print "{0}\t{1}".format(1, cost) reducer.py import sys stotal = 0 trans = 0 line in sys.stdin: data_mapped = line.strip().split("\t") if len(data_mapped) != 2: continue stotal += float(data_mapped[1]) trans += 1 print transactions, "\t", salestotal keeps throwing error: undef/bin/hadoop job -dmapred.job.tracker=0.0.0.0:8021 -kill job_201404041914_0012 14/04/04 23:13:53 info streaming.streamjob: tracking url: http://0.0.0.0:50030/jobdetails.jsp?jobid=job_201404041914_0012 14/04/04 23:13:53 error streaming.streamjob: job not successful. error: na 14/04/04 23:13:53 info streaming.streamjob: killjob... streaming command failed! i've tried both explicitl

html - How can I put a div tag to automatically go UNDERNEATH a position:relative div -

i've been getting web development , i've begun test abilities creating own websites. i've run problem though. website structured position:fixed header stay is. because of this, had include in text container underneath position:relative. the problem having footer literally inside text container. want footer @ bottom of content* (hence, footer) unable so. this code far: (html) <html> <head> <title>bigbeno37's test page</title> <link rel="stylesheet" type="text/css" href="reset.css" /> <link rel="stylesheet" type="text/css" href="stylesheet.css" /> </head> <body> <div class="header"> <h1 class="headertext"> bigbeno37's site </h1> <ul class="menu"> <li><a href="#">co

graphics - what format of pic can genereate mimap in opengl-es -

as title, used use .dds , did work,now use type of .png , can generate mipmap? here functions using: glteximage2d(…) .or maybe glubuild2dmipmaps(…) better choice? dds image format contains precalculated mipmaps. far quality goes, precalculated mipmaps offer best quality, since can downsampled offline advanced filter kernels lancozs, without having care runtime efficiency. png not contain additional mipmap levels have compute mipmaps @ runtime. should not use glubuild2dmipmaps this. 1 function known exhibit buggy behavior in conditions , furthermore unconditionally resample images power-of-2 dimensions, although since opengl-2 non power-of-2 dimensions fine texture images. instead should load base level image glteximage2d(…) , use glgeneratemipmap(…) (available since opengl-3) build mipmap image pyramid there. if don't use opengl-3, can use sgis_generate_mipmap extension, if available. however advised online mipmap generation may yield not results offline gen

css - DIV color not displaying properly in IE -

Image
i developing application in oracle apex custom theme. application run in browser except ie, ie doesn't show color expecting. this result comes chrome browser. now in internet explorer 8 (ie8) messed up, color effect not displaying properly. here css 1,2,3,4 <div> .top-tabs .tab:nth-child(1),.head1 .region-header { background-color: #014fa2; } .top-tabs .tab:nth-child(2),.head2 .region-header { background-color: #1e69b9; } .top-tabs .tab:nth-child(3),.head3 .region-header { background-color: #3481d2; } .top-tabs .tab:nth-child(4),.head4 .region-header { background-color: #58a1f0; } here html <ul class="top-tabs"> <li class="tab"> <a href="#"> <div class="top-tab-nr">1</div> <div class="top-tab-label">admission<br>application</div> </a> </li> <li class="tab"> <a href=&qu

symfony - Symfony2 - Callback validator on collection -

in symfony2 i'm tying use callback validate form, callback never called. class wherein callback is, called in main form through collection. here code... main class : class inscriptiontype extends abstracttype { /** * @param formbuilderinterface $builder * @param array $options */ public function buildform(formbuilderinterface $builder, array $options) { $builder ->add('inscriptionreponses','collection',array('label'=>false, 'type'=>new inscriptionreponsetype(), 'error_bubbling'=>false, 'by_reference'=>false)) ; } } inscriptionreponse class : use symfony\component\validator\constraints assert; use symfony\component\validator\executioncontextinterface; /** * inscriptionrepon

c# - Lync InvalidStateException when changing contact relationship -

trying change accesslevel of contacts, never succeeds unless use accesslevel.default. here's i've got currently: private void beginsearchcallback(iasyncresult r) { object[] asyncstate = (object[])r.asyncstate; contactmanager cm = (contactmanager)asyncstate[0]; try { searchresults results = cm.endsearch(r); if (results.allresults.count == 0) { console.writeline("no results."); } else if (results.allresults.count == 1) { contactsubscription srs = cm.createsubscription(); contact contact = results.contacts[0]; // change relationship contact.beginchangesetting(contactsetting.accesslevel, accesslevel.colleague, setprivacycallback, contact); } else { console.writeline("more 1 result."); } } catch (searchexception se) { console.writeline("search failed: " + se.re