Posts

java - Spring Transactional not using same JDBC connection -

can please tell me why sql exception "invalid object #emp_temp" if running both queries under same transaction? @transactional public map<string, eventtype> findeventsbydaterange(final date starttimestamp, final date endtimestamp) throws exception { log.debug("fetching events data"); string event_query = "select id, name, status, joindate #emp_temp employee joindate >= ? , joindate < ?"; this.jt.execute(event_query, new preparedstatementcallback<boolean>() { @override public boolean doinpreparedstatement(preparedstatement preparedstatement) throws sqlexception, dataaccessexception { preparedstatement.settimestamp(1, new java.sql.timestamp(starttimestamp.gettime())); preparedstatement.settimestamp(2, new java.sql.timestamp(endtimestamp.gettime())); return preparedstatement.execute(); } }); //this.jt.execute(event_query); return this.jt.query("s...

scala - Functional combinator for filter then map -

i have collection of tuples of type (boolean, a) i'd transform collection of a . is there known combinator following? .filter(_._1).map(_._2) .collect { case (b, x) if b => x } ( filter isn't operation available on functors in general, depends on mean "i have functor on tuple (boolean, a)")

multithreading - Running a Sinatra app from within Rails breaks CTRL-C behaviour -

as explained here , rails creates trap int signals starts. i have rails app starts sinatra app in separate thread. thread.new begin sinatraapp.run! rescue => e puts e.message end end it seems running sinatra app in separate thread causes rails app no longer respond int signals, meaning can't kill via ctrl-c. sinatra app "steals" of int signals. how fix this? possible configure rails app ctrl-c kills both , sinatra app? my sinatra app booting via webrick. found using jruby-based server instead, puma or trinidad (with trap flag set false ), solved problem. this answer helped me find solution.

meteor - waitOn blocking template from loading -

when start meteor server , navigate default route, see apploading template inside mainlayout (as expected), main template never loads after subscription loaded. i've got simple routes.js file (below) autopublish still turned on. i seeded db , can confirm in browser console subscription there, , there items in services collection. probably missing simple here. /*=================== configure defaults ====================*/ router.configure({ layouttemplate: 'mainlayout', loadingtemplate: 'apploading', notfoundtemplate: 'notfound' }); /*=================== configure routes ====================*/ router.route('/', { // default route name: 'main', template: 'main', waiton: function() { return meteor.subscribe('services'); }, data: function() { return services.find(); } }); i'm guessing not have publication? client waiting "ready" notification publicat...

java - Priority queue (from scratch) and linked lists -

i trying create linked list unordered raw data (string1...priority10, string2...intpriority2, etc) , have had trouble conceptualizing how can sort write method priority queueing. need method enqueue each object, in order, without using sorting algorithm on final linked list, or using linkedlist or priorityqueue itself. my enqueue method, nothing hard here: public class objectqueue{ object front = null; //points first element of queue object prev = null; //points last element of queue /** * creates object of object , adds class queue * @param name of object * @param rank of priority sort */ public void enqueue(string name, int rank) { object current = new object(name, rank); //uses current entry string name, int rank if(isempty()) //if empty, add element front { front = current; } else //if elements exist, go end , create new element { prev.next = current; } pre...

Cannot pass javascript variable to php page under jquery .click() method -

in code below window.location.href not working. when use outside .click function works inside not. <script> $('#para').click(function(e) { var getid= $("#"+e.target.id).text(); id = getid.substring(getid.indexof("id: ")+3,getid.length); alert ("success"); window.location.href = "specificimagepage.php?id=" + id; } </script> the below code ( just showing para id is ) used retrieve images database , when user clicks on image want pass image id next page, can again used. <div id = "para"> <?php $j; $files = glob("upload/*.*"); require 'config.php'; //database config file ($i=0; $i<count($files); $i++) { $image = $files[$i]; $info = pathinfo($image); $file_name = basename($image); $sql = "select id,address, cuisine, imagename postfood imagename = '".$file_name."' "; ...

javascript - document.cookie/setCookie not working on Safari and IE -

i trying play music last end point after each page loaded. example not working on safari , ie working fine on firefox,opera , chrome. possible replace jquery cookie plugin , how? <audio preload="auto" src="a.mp3" loop="true" autobuffer autoplay="true"> unsupported in firefox </audio> <script> function setcookie(c_name,value,exdays) { var exdate=new date(); exdate.setdate(exdate.getdate() + exdays); var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toutcstring()); document.cookie=c_name + "=" + c_value; } function getcookie(c_name) { var i,x,y,arrcookies=document.cookie.split(";"); (i=0;i<arrcookies.length;i++) { x=arrcookies[i].substr(0,arrcookies[i].indexof("=")); y=arrcookies[i].substr(arrcookies[i].indexof("=")+1); x=x...