Posts

Showing posts from July, 2014

e commerce - Integrating Netbanking to website using JAVA/PHP (in India) -

how integrate netbanking feature website in java/php technology? is there common api available integrate of banks website or else should separate api each bank wish integrate? imho there no free api ..but can use paid api of ccavenue but costly. other alternates google checkout & paypal can used getting payments credit cards

How would i figure out the price difference efficiently with PHP? -

i have page , if scroll second "customize" in middle of page , click see print_r() products , thing trying figure out difference in price between selected , other 2 products....all 3 products in array , if below see radio buttons need....here php looks awful...any suggestions $current_price = $product[$selected_product]['product_price']; $standard_price = $product["standard"]['product_price'] - $current_price; $business_price = $product["business"]['product_price'] - $current_price; $premium_price = $product["premium"]['product_price'] - $current_price; if($standard_price == 0){ $standard_price = "included"; } if($standard_price > 0){ $standard_price = "subtract " . $standard_price; }else{ $standard_price = "add " . $standard_price; } if($business_price == 0){ $business_price = "included"; } if($business_price > 0){ $business_price = &quo

java - JSF - base page refresh automatically after close popup window -

i have 3 pages main page popup page started main page using onclick javascript method (consists input , button) foo page i'm creating form on main page, operations admin key needed, popup window opened button. when popup window filled, submitted , key found in database, popup window redirected foo page , closed. i'm on main page , need automatically refresh take changes. i can't using onclick="window.opener.location.href='main.xhtml'; on button because quick there time delay find key in database. do have suggestion? how close it? injecting javascript after postback? add function refreshes opener; window.onbeforeunload = function() { window.opener.reload(true); }; window.close(); untested. balusc right in comment, sufficient with window.opener.reload(true); window.close();

c# - Problem with SQL Query Tracking -

okay here's issue. the user can go onto site , retrieve 8 records @ time, he/she given option load more. these 8 records can sorted param passed proc. when these 8 records on front end, have id's (hidden user though obviously), id's not in specific order because records sorted variety of possible things. when click "load more", should able next 8 records database, sorted in same fashion first 8 were. for example, "give me top 8 records sorted age". -> click load more -> give me next 8 oldest records without showing me onces saw. how can call proc , make sure none first result set returned though? want return 8 records @ time efficiency reasons. select top 8 m.message, m.votes, (geography::point(@latitude, @longitude, 4326).stdistance(m.point)) * 0.000621371192237334 distance, m.location, datediff(hour,m.timestamp, getdate()) age, m.messageid, ml.voted, ml.flagged tblmessages m

android - What does getLastKnownLocation really do? -

does give user's current location if device online? how determine last known location? locationmanager docs taken docs & reworded getlastknownlocation returns last known location fix obtained given provider. device not need start provider information battery life. however, if users phone has been sleeping or turned off , has moved location out-of-date. if need location up-to-date wouldn't use method, instead request single update, depending on applications requirements. note: requesting location updates available provider effect users battery life if used irresponsibly

Discovering the cause of Vim exit status -

on running: vim /tmp/blah :q echo $? i exit status of 1 . breaking various things including git. if run vim without vimrc: vim -u none /tmp/blah :q echo $? i exit status of 0 . use pathogen disables plugins. have suggestion efficiently determining cause of exit status? i'm aware of running vim verbosely , logging file. should looking specific in file? if there method of finding exact line determines exit status love know of searching around didn't turn up. finally found command in help: :cq[uit] . after verbose logging, search \<cq\%[uit]\> . update: there methods alter exit status using vim compiled interpreters support: @ least, following works: python import sys python sys.exit(1) " (same python3) perl exit 1 i not know other languages enough write here examples of code quit vim different exit status. note such commands inside files sourced using :pyfile , :rubyfile , other :*file should work, code in modules not distributed plugin

jquery: when select list value is changes, date field is required -

i've got form , when status select list changed, status effective date needs required field. function checkstatuses(){ $('.status').each(function (){ thisstatus = $(this).val().tolowercase(); thisorig_status = $(this).next('.orig_status').val().tolowercase(); target = $(this).parents('td').nextall('td:first').find('.datepicker'); if ( thisstatus == thisorig_status ) { target.val(''); } else if( thisstatus == 'production' || thisstatus == 'production w/o appl') { target.val('<cfoutput>#dateformat(now(), "mm/dd/yyyy")#</cfoutput>').focus(); alert('the status effective date required.'); return false; } else { target.val('<cfoutput>#dateformat(now(), "mm/dd/yyyy")#</cfoutput>'); return false;

c++ - Possible scope issues with my implementation of Dijkstra's shortest path algorithm in OpenMP? -

i've been working on small program calculates shortest paths every vertex in given graph using openmp split calculations between multiple threads instead of doing 1 vertex @ time. while current implementation works, want make can read graph data in file in format "vertex1 vertex2 weight" graphs aren't hard-coded program. sources here: http://pastebin.com/bkr7qysb compiled follows: g++ -fopenmp graphtest.cpp weightedgraph.cpp -o dijkstra using following data input: foo derp 50 narf balls 30 foo balls 20 balls derp 60 derp narf 40 derp cox 30 foo narf 50 narf pie 99 cox pie 15 cox narf 10 my output is: enter filename: lol.out printing edges in graph: (foo, derp) : cost 50 (narf, balls) : cost 30 (foo, balls) : cost 20 (balls, derp) : cost 60 (derp, narf) : cost 40 (derp, cox) : cost 30 (foo, narf) : cost 50 (narf, pie) : cost 99 (cox, pie) : cost 15 (cox, narf) : cost 10 [thread:0] showing single-source shortest path run source vertex balls. format (

c# - create some sort of loop inside linq query -

i have method want use filter listview. creating listview dynamically therfore don't know number of colums in advance. lstcurrentdynamicitems class 1 property , property named c , type object[]. created class in order hold objects of listview. if have same listview have no problem building following method. how implement following method? public void filterlistview(string[] columnscontains) { // lstcurrentdynamicitems list of objects // columnscontains want filter. var qr = in lstcurrentdynamicitems a.c[0].tostring().contains(columnscontains[0]) && a.c[1].tostring().contains(columnscontains[1]) && a.c[2].tostring().contains(columnscontains[2]) && // ... // ... // ... a.c[columnscontains.length].tostring().co

Converting python datetime to timestamp and back in UTC still uses local timezone -

i'm working code gives me utc timestamps , want convert them appropriate datetimes. unfortunately when test simple cases pytz datetime has added 6 hours (the cst offset utc). need keep timezone data correct because calculating difference between other timezones well. ideas why , how convert utc timestamp utc datetime? in [1]: import pytz in [2]: datetime import datetime in [3]: import time in [4]: datetime.fromtimestamp(time.mktime(datetime(7,1,1, tzinfo=pytz.utc).timetuple()), tz=pytz.utc) out[4]: datetime.datetime(2007, 1, 1, 6, 0, tzinfo=<utc>) in [5]: datetime.fromtimestamp(time.mktime(datetime(7,1,1).utctimetuple()), tz=pytz.utc) out[5]: datetime.datetime(2007, 1, 1, 6, 0, tzinfo=<utc>) in [6]: datetime.fromtimestamp(time.mktime(datetime(7,1,1).utctimetuple())) out[6]: datetime.datetime(2007, 1, 1, 0, 0) to naive datetime object represents time in utc "seconds since epoch" timestamp: from datetime import datetime utc_dt = dateti

jbox2d - Which direction is zero (0) in Box2D? -

Image
which direction considered 0 degrees in box2d? north, south, east, west? , angles increase clockwise, or counter-clockwise? i've read through manual , doesn't seem mention anywhere. box2d uses radians... 0 correspond "east". http://en.wikipedia.org/wiki/radian

otp - How do I use Nitrogen as a GUI frontend for an Erlang app? -

i have got basic server-side erlang app (not otp'd yet) start on command-line. want turn interactive system using browser gui nitrogen (version 2.0.4). general plan to turn current module gen_server model part; analyses data , generates events reflect properties of data interested in. add controller module both gen_event (to pick events generated model) , gen_server (to allow queries gui frontend) use nitrogen view, updating relevant pages ajax facilities through calls controller module (which in turn queries model) as far can see want general application supervisor 3 children: model, view, , controller. talk each other via apis mapped otp communication modes. and stuck: should put of nitrogen directory tree? should set new app dir structure , have 3 components (including nitrogen) under there? need start nitrogen server child of app supervisor (the nitrogen start script looks rather more complex expected)? have started going through erlang , otp in action , haven'

c# - PropertyChangedEventHandler usage question -

i have event, propertychangedeventhandler , raise this: propertychanged(this, new propertychangedeventargs("logfile")); propertychanged(this, new propertychangedeventargs("nodes")); i attached it: propertychanged += updatecamxwindowevent; how can execute updatecamxwindowevent when event raised "logfile" ? what should change in code? there no way execute specific method parameters, unless created event. should change updatecamxwindowevent , when parameter logfile . if can't or logically doesn't make sense in application, can add handler tests argument , if matches, calls method: propertychanged += (s, e) => { if (e.propertyname == "logfile") updatecamxwindowevent(s,e); }; note wouldn't able unsubscribe anonymous method event. if need that, use normal method same functionality.

actionscript - Flex BarChart Stacked BarSeries labelFunction - Bar Count vs. Stacked Sum -

i have stacked bar chart bars need custom labeling. each bar needs display bar's value preceeded label. support this, have created custom labelfunction various barseries in barchart (see below). the function rendering labels, in case of stacked bars, label values not displaying want. instead of showing bar's value, showing sum of bars in stack. example, if barset contains 3 bars values 3, 4, , 5, labels being displayed not "3", "4", , "5", "3", "7", , "12". from this example looks can achieve results want creating separate labelfunction each individual barseries , accessing specific property (e.g. data.item.@foocount). however, i'd prefer having 1 generic function if possible. there property can access in place of xnumber gets me bar's particular value , not sum? note default label behavior (i.e. not setting labelfunction) displays individual values, not sums... i'm assuming it's possib

php - Set mysql values from radio buttons in html form -

i want 2 radio buttons on webpage (written in php) representing "yes" , "no". when load page want fetch value mysql db , set corresponding radio button. , when click on other button, want update database , reload page. i'm trying simple html form, no luck. code have far (that not working @ :( is: if (!isset($_post['submit'])) { $sql = "select challenge_me contestants id=$id"; $res = (mysql_fetch_assoc(mysql_query($sql, $db))); $challenge_me = $res["challenge_me"]; }else{ $sql = "update contestants set challenge_me='" . $_post['yesno'] . "' id='$id'"; if(!mysql_query($sql, $db)) echo mysql_error(), "<br/>query '$sql'"; $challenge_me = $_post['yesno']; } echo'<form method="post" action="' . $php_self . '">'; echo '<input type="hidden" name="submit&qu

Rest-Client Ruby Gem Headers -

i'm attempting use rest-client gem post something, reason, keep getting internal server error. used simple rest client on chrome, , got same error unless sent following header: content-type: application/x-www-form-urlencoded so i'm trying send header post request, reason, it's still not working. here tried: restclient.post "server", :content_type=>"content-type: application/x-www-form-urlencoded",:name=> 'test', :message_type=> 'request', :version=> '2.0' restclient.post "server", {:content_type=> "content-type: application/x-www-form-urlencoded"},:name=> 'test', :message_type=> 'request', :version=> '2.0' restclient.post "server", {"content-type" =>"content-type: application/x-www-form-urlencoded"},:name=> 'test', :message_type=> 'request', :version=> '2.0' restclient.post "server&qu

c# - How to open a Dialog Window using MVVM -

can please me work out how open dialog window, the simplest scenario can think of is: have main window button , label, when user presses button, a dialog window text box , 2 buttons appear, one button says submit, when user presses submit closes window, it changes color of mainwindows background red, and takes input placed in textbox , changes label on main window content(i bot worried part how part), while other button cancels operation, assume datacontext of mainwindow , dialogwindow mainwindowviewmodel , userinputviewmodel respectivily. now on this link cameron talks using service, ie idialogservice , dialogservice please explain me how implement methods in scenario above? or if there way please let me know? please don't link me any pages because i've read them , can't seem clear understanding of meant happening? ~slowly loosing sanity because mvvm makes things harder :( not answer, think i'll add pov anyway. how use dialogs in mvvm

iphone - How can I call objective-c code from within an html file in a UIWebView? -

so know type of thing achieved in java using jsp files, wondering how can mix code , html inside ios view. reason need have (local) html content being loaded uiwebview, , if click on html button, need fire ibaction example, , stuff locally. is possible in xcode? missing? you can not have objective-c code mixed html file runs locally on uiwebview . said, there workarounds may fit needs. one i've used, have html link custom url, , detect on appropriate method in uiwebview delegate class, follows: - (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype in method, check url schema created means of checking request parameter, , decide selector code on objective-c code.

Javascript RegEx replacing &quot; -

i'm trying patch drupal panels module fix this nasty issue , makes ajax errorhandler unreadable. error handler has this: // replace &lt; , &gt; < , > error_text = error_text.replace("/&(lt|gt);/g", function (m, p) { return (p == "lt")? "<" : ">"; }); i've tried 2 approaches: adding // replace &quot ' readability, goodness sakes, per // http://drupal.org/node/1124042 error_text = error_text.replace(/&quot;/g, "'"); modifying // replace &lt; , &gt; < , > error_text = error_text.replace("/&(lt|gt|quot);/g", function (m, p) { return (p == "lt")? "<" : (p == "gt") ? ">" : "'"; }); yet neither has worked. little help? edit: when printed out console (in ff4 or chrome) html entities not shown. resulting alert(""), however, looks so: an error occurred @ /home

c# - Can I define implementation of methods on Rhino Mocked objects? -

with rhino.mocks, once mock interface can: set "return" values non void methods on mocked object inspect how , values methods called with however, possible selectively define implementation methods on mocked objects? ideally i'd (rhinoimplement rhino extension i'm hoping exists!): var messages = new list<imessage>(); ibus bus = mockrepository.generatemock<ibus>(); bus.rhinoimplement(b => b.send(arg<imessage>.is.anything), imess => messages.add(imess)); //now run test on class uses ibus //now, can inspect local (list<imessage>)messages collection update answer thanks patrick's answer below, correct code achieve above is: var messages = new list<imessage>(); ibus bus = mockrepository.generatemock<ibus>(); bus .expect(b => b.send(arg<imessage>.is.anything)) .whencalled(invocation => messages.add((imessage)invocation.arguments[0])) .repeat.any() //the repeat part because metho

How to load PHP through jQuery and append it to an existing div container -

i'm attempting create "click add" link user can click many times necessary. each time click it, 3 additional input fields pop up. this, i've got jquery loads php file creates 3 additional inputs , loads them existing div container. my problem after user has clicked "click add" link once , seen 3 new input fields, if click "click add" second time, initial 3 fields wiped out new 3 fields being added. how can remedy each time user clicks 3 fields added , prior ones preserved well. (note: i've looked using append() in conjunction jquery have below must getting syntax incorrect if indeed best solution). my jquery here: var loadphp = "create_new_bucket.php"; $(".add_bucket").click(function(){ $("#tree_container2").load(loadphp); return false; }); jquery.load() replaces content in container. 1 way around append new element object, , populate element new html. exam

Cannot save image with PHP? -

i trying take user uploaded file, resize, , fill empty section white using premade code snipit found here . seems working fine until attempt write code below code: since may problem file permissions, absolute path saving http://test.local/uploads , script running http://test.local/library/ajaxupload.php . $save = '../uploads/' . $filename; $image_p = imagecreatetruecolor($fwidth, $blank_height); $white = imagecolorallocate($image_p, $colorr, $colorg, $colorb); imagefill($image_p, 0, 0, $white); switch($filetype){ case "gif": $image = @imagecreatefromgif($_files[$filename]['tmp_name']); break; case "jpg": $image = @imagecreatefromjpeg($_files[$filename]['tmp_name']); break; case "jpeg": $image = @imagecreatefromjpeg($_files[$filename]['tmp_name']); break; case "png": $image = @imagecreatefrompng($_files[$filename]['tmp_name']); break; }

c# - WCF REST Not Processing Asynchronously -

we implementing new wcf rest service in iis our site , on number of pages may making handful of ajax calls using jquery asynchronously. problem seems though wcf (on server side) executing synchronously. on page load we're making 3 separate calls 3 different methods. using logging, can see them hit global.asax file within 5ms of each other. there, logging shows executing in order exit global.asax (not order in made calls page via javascript). expected each call receive own thread , return individually. when attaching debugger can see won't execute next method until step through current method it's on. here operation contracts 3 of methods 'thought' implemented use async model. [operationcontract(asyncpattern = true)] [webinvoke( method = "post" , uritemplate = "/listuserpreferences" , bodystyle = webmessagebodystyle.wrapped , responseformat = webmessageformat.json , requestformat = web

how to disable webview for a while in android -

assume have 10 web page. first time im loading 1st page , next page loaded when user swipes screen.so incrementing web page count when user swipes screen. problem while loading page if user swipes screen many times web view loades page incremented unnecessary swipe done user while loading .. want disable user touch webview screen while page loading . how can that? what description if user swipe page 1 page 2 , page loading in mean time if user swipe 3 times load page 2,3,4,5 , want disable swipe @ unless page 2 has been loaded. if correct below solution in onfling() method check boolean whether page loaded or not if not return without further processing , suppose code downloading code not run. boolean must set false before call downloading method , set true downloading finished. apart suggest load particular page on user scrolls rather disabling swipe have nothing onfling check whether downloader thread alive last page or not if yes interrupt , start again curren

c# - Why are these two strings with linebreaks different? -

"[a='b\\\nc']" and @"[a='b\ c']" does second add \r or something? there easy way escape can "see" line break characters? nevermind. tried putting through regex.escape escapes bit more should, show \r .

java - Writing contents of a JTable to a file -

i cannot seem manage complete functionality. need write out text file. my jtable populated when query run, query results populate jtable. results users of program have option of writing contents of jtable text file. the output file have column headings running along top of text file returned query data underneath it. edit: getting header values added part of code other writing file, can use following.. stringbuffer buffer = new stringbuffer(); int row,column,header; // write header for(header=0;header<jtable.getcolumncount;header++) { //buffer.append(jtable.getcolumnmodel().getcolumn(header).getheadervalue(); -- not needed buffer.append(jtable.getcolumnname(header); buffer.append(','); } buffer.append('\n'); // write cell data for(row=0;row<jtable.getrowcount();row++) { for(column=0; column< jtable.getcolumncount();column++) { buffer.append(jtable.getmodel().getvalueat(row, column)); buffer.append('

php - Braintree subscription for recurring payments -

let customer has subscribed product $10 monthly , starting date 11-may-2011 ends on 10-june-2011, question after expiry of subscription on 11-june-2011 charge recurring payment customer. braintree charge customer or (merchant) have send request braintree. if merchant have charge process , great if provides php code sample. you can set subscription in braintree charge customers monthly. need set subscription plan manually (such $10 per month) in braintree admin control panel, use api sign customers subscription plan created, , not need have app remind braintree bill each month. the braintree api docs setup subscriptions in php @ following link: http://www.braintreepayments.com/docs/php/subscriptions/overview

android - Audio signal Processing-Retrieving information from audio -

is possible retrieve information id audio signal ? first, need sure of information want audio file , if format audio signal in supports storage of meta data. the following formats have data associated them: 1. wav: may need read wav header getting data such sampling rate, bytes per sample etc. 2. mp3: each mp3 file comes id3 tag. these id3 tags contain information such date of recording, artist, album, track etc. these tags optional , not mp3 files may have them. need find id3 editor/reader @ information. place start can here . take @ android documentation. there may inbuilt (especially wav formats - sampling rate etc.) already. hth, sriram.

Configure eXist - LDAP security manager -

i trying configure exist ldap authenticate users , have checked out documentation @ exist ldap security . turns out default configuration supports 3 settings: security.ldap.connection.url (the connection url of ldap server), security.ldap.dn.user (the user list dn), , security.ldap.dn.group (the group list dn). it doesn't work case because ldap server not enable anonymous queries, means have provide user name/password in order establish connection. any suggestion on how achieve other enable anonymous queries on ldap server? thanks, thomas it seems can implement own context factory , feed exist security.ldap.contextfactory parameter. the context factory java class used initialize connection directory. can implement context factory initializes connection ad-hoc credentials. the idea implement class this: public class mycustomcontextfactory implements initialcontextfactory { public context getinitialcontext(hashtable env) { // fetch application dn ,

c# - How to change the visibility of a template button in a listbox? -

i creating windows phone application , have problem listbox template. hide "morebutton" defined in morelistboxstyle @ runtime. tried create property , bind visibility property of button doesn't work. how should ? <phone:phoneapplicationpage.resources> <style x:key="morelistboxstyle" targettype="listbox"> <setter property="background" value="transparent"/> <setter property="foreground" value="{staticresource phoneforegroundbrush}"/> <setter property="scrollviewer.horizontalscrollbarvisibility" value="disabled"/> <setter property="scrollviewer.verticalscrollbarvisibility" value="auto"/> <setter property="borderthickness" value="0"/> <setter property="borderbrush" value="transparent"/> <setter property="padding&quo

Restrict additional pagehead in sharepoint popup window -

hi have added additionalpagehead in sharepoint run javascript functions show texts. working fine in sharepoint pages working in sharepoint popup window also. how can restrict popup windows. try use code inside placeholderadditionalpagehead placeholder: <script type="text/javascript"> var isdlg = (/[\\?&]isdlg=([^&#]*)/.test(window.location.href)); if (!isdlg) { // javascript code ... } </script>

java - How to set multiple items as selected in JList using setSelectedValue? -

i have jlist populated dynamically adding underlying listmodel. if have 3 strings value know , do for(i=0;i<3;i++){ jlist.setselectedvalue(obj[i],true);//true shouldscroll or not } only last item appears selected...if can't done , have set selection underlying model how should go it??? also please note jlist has selection mode: jlist.setselectionmode(listselectionmodel.multiple_interval_selection); thanks in advance although stanislasv answer valid, prefer avoid adding 1 selection interval another. instead, should prefer call jlist associated listselectionmodel#setselectioninterval(int, int) method : jlist.getselectionmodel().setselectioninterval(0, 3) if want list selection disjoint, you'll have write own listselectionmodel .

php - Want to store sessions using zend Framework -

i need set remember me function users log website everytime close browser not need relogin website. i'm using zend framework here , have tried use bit of zend_session code. created table , sessions being written table. when close browser , open site again - need relogin manually again. this code setting sessions in bootstrap file. $config = array( 'name' => 'session', 'primary' => 'id', 'modifiedcolumn' => 'modified', 'datacolumn' => 'data', 'lifetimecolumn' => 'lifetime' ); //create zend_session_savehandler_dbtable , //set save handler zend_session zend_session::setsavehandler(new zend_session_savehandler_dbtable($config)); //start session! zend_session::start(); where missing - far know teh session management related code in site i'm missing out here. have set stored sessions earlier in earlier websites time need using zend framewo

java - Prevent session timeout during database update -

background a web application calls stored procedure perform intensive database update. relevant portion of web.xml updated 4 hours: <session-config> <session-timeout>240</session-timeout> </session-config> the technologies available solution include java 1.4.2, struts 2, tomcat 5.5, , apache commons. other technologies (such jquery) not permitted. problem the update takes hour run, configuration value of 4 hours against corporate standards (for reason). 4 hour timeout configuration not permitted in production. question what ensure request not time out while database update executes? ideas my concern in first 2 cases spawned process killed servlet container. page refresh spawn database update process background task. have servlet continually refresh page check completion. javascript ping spawn database update process background task. have javascript code ping server while. similar preventing session timeout during long p

database - iBatis gives an error: "com.ibatis.sqlmap.client.SqlMapException" -

i making cache ibatis. using cache-model flushinterval , flushonexecute lines , property named reference-type . after deploy mentioned error: java.lang.runtimeexception: error parsing xpath '/sqlmapconfig/end()'. cause: com.ibatis.sqlmap.client.sqlmapexception: there no statement named ibatorgenerated_updatebyprimarykeyselective in sqlmap.` on flushonexecute element there attribute statement set value 'some_query'. had use 'naming.some_query' wbecause using namespace 'naming'. namespace usage not needed times part needs it.

Regex to get date from string -

i need regular expression date out of following string anything-2011.01.17-16.50.19.xml is correct 1 ^\\.(.+)-([0-9.]+-[0-9.]+)\\.xml$ ? this here checking format yyyy.mm.dd-hh.mm.ss ^(.*?)-(\d{4}(?:\.\d{2}){2}-\d{2}(?:\.\d{2}){2})\.xml$ but not verify if date or time valid value. online check on regexr .

Android user presses a key -

is there way register receiver app running in background when user presses key. kind of "action_user_present" if keys pressed on screen. more detail: app running service in background. user opens phone , presses keys, searching online on driod. can capture key presses in background? to detect whether user using device use information whether screen on or off approximation (making assumption screen timeout set). this blog entry shows how capture screen on , off events (i haven't done myself though).

web os application connecting MYSQL server through VPN -

i'm trying develop application verifies user name , password on vpn server , if success has give access mysql server. can 1 give me logic , if working examples appreciated. tried google on topic got information feel i'm missing thing, please. thank in advance

internet explorer 7 - jQuery $(element).html() not working in ie7 -

i have strange problem ie7. loading content in div element using ajax request. in ajax response html there div id "compare_div" content. when try html using $('#compare_div').html(), returns null. below javascript code, function myfunction() { $.ajax({ type : "post", data: data, url : my_url, success : function(response) { $('#parent_div').html(response); var compare_div_html = $('#compare_div').html(); }, error : function(xmlhttprequest, textstatus, errorthrown) { alert(textstatus); } }); return false; } i getting null in compare_div_html variable. code works fine other browser. please help. first check element exists, if confirm same ensure data not empty if every thing ok then try $('#parent_div',"container").html(response); this solve problem

sql - Tsql - performing a join on a delimited column - performance and optimisation issue -

i have following (slightly simplified in columns returned) query. select products.product, products.id, products.customers products products.ordercompletedate null this return, example producta 1 bob producta 1 jane productb 2 john,dave note customers can comma delimited list. want add, column 'customer locations', above becomes producta 1 bob ireland producta 1 jane wales productb 2 john,dave scotland,england i created function below, fn_split returns single row per delimited item. create function [dbo].[getlocations] (@customernames varchar(256) ) returns @templocations table (customerlocations varchar(256)) begin declare @namestr varchar(256) declare @temp table(singleloc varchar(256)) insert @temp select customerlocation.location customerlocation inner join customers on customers.id = customerlocation.id inner join dbo.fn_split(@customernames,',') split on split.item = customers.name select @namestr = coalesce(@na

What’s a good client-side fallback for HTML5 form field validation? -

i've seen many different suggestions fallbacks browsers don't implement html5 forms (solutions involving modernizr, yepnope, jquery validate...) haven't managed work effectively. essentially apart adding datepicker i've managed going modernizr , jquery datepicker need validation work in browsers (main priority email validation) chrome , ff seems work natively, yet surprisingly safari validates without proper email address. ie doesn't support either could reasonably straightforward fallback (probably via modernizr)? thanks have tried webshims lib ? it's build on top of jquery , have implemented forms chapter of html5 accurately. can find list of supported attributes, properties , methods on webforms site of webhims lib . i have feedback on this. cheers alex

android - Help wanted regarding Location, Timer and Service -

here code: main service class public class simpleservice extends service { timer mytimer; private string provider; //locationmanager locationmanager; //locationlistener mloclistener; //private handler toasthandler = new handler(); @override public ibinder onbind(intent arg0) { // todo auto-generated method stub return null; } @override public void oncreate() { super.oncreate(); toast.maketext(this,"service created ...", toast.length_long).show(); mytimer = new timer(); mytimer.schedule(new timertask() { @override public void run() { // todo auto-generated method stub toasthandler.sendemptymessage(0); } },0,1000); } @override public void ondestroy() { super.ondestroy(); toast.maketext(this, "service destroyed ...", toast.length_long).show(); mytimer.cancel(); } private final handler toasthandler=new handler() { public void handlemessage(message msg) {

symfony1 - How to get the value of a textarea in Symfony -

i can't seem inputted text of textarea. when : die($request->getpostparameter('comment')) it outputs word "array". when print_r() show textarea array , value stored in array. don't know how value can put field in table. @greg0ire: doing because trying save data 2 different tables. html page displays form made of 2 forms 2 different classes/models. have managed save fields both tables except comment field. tried getting value , realising array, wondered if causing data not save. why asking question. have asked question explains context. these functions run on clicking submit button public function executeupdateinlineform(sfwebrequest $request) { $overdueinvestigation = doctrine_core::gettable('investigation')->find( $request->getparameter('id')); $investigationform = new investigationinlineform($overdueinvestigation); $commentform=new commentform(); $investigationform->bind($request->

Android-Expandable List view -

how move group item left when deleted default group indicator using setgroupindicator() method. you may try adjust textview left 36dip (assuming you're using standard group indicator android) <textview android:paddingleft="36dip"/> i did in own project, hope helps :)

jsf - Used trinidad chart tag <tr:chart> in XHTML, but no output is coming -

below code facing issue, not getting output of graphs. kindly me. my xhtml code <?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:tr="http://myfaces.apache.org/trinidad"> <h:body> <h1>director screen</h1> <tr:document> <tr:form> <tr:chart value="#{chartbean}" type="pie" /> <tr:chart value="#{chartbean}" type="bar" /> <tr:chart value="#{chartbean}" type="circulargauge"> </tr:form> </tr:document> </h:body> </h

c# - Compiled expressions run much slower than interpreted versions -

i have rules engine, supports 2 modes of operations: compilation c# program , linked engine parsing reverse-polish stack-based instructions , interpreted the rules simple arithmetical expressions function calls (max, min, sin, cos etc.) i have assumed compiled version (i.e. #1) much faster interpreted version (i.e. #2) -- in fact, that's main reason having compiled mode in first place. however, speed tests showed otherwise. compiled version action<double>[] rules = new[] { calc1, calc2, calc3 ... }; double[] v = new double[...]; // variables void calc1(double arg) { v[3]=v[12]+v[15]/v[20] }; // "x3=x12+x15/x20" void calc2(double arg) { ... }; : // start timer rules.asparallel().forall(r => r(...)); // end timer interpreted version expression[] rules = ... // each rule parsed expression object, set of // reverse-polish stack-based instructions. // example, "x3=x12+x15/x20" parsed to: // [ push(12), push(15), push(20), d

wcf ria services - How to Use Sync Framework with Silverlight Isolated Storage Options -

a google sync framework shows few blog posts may 2010 possibilities, have not seen using sync framework + sl isolated storage. has done this? awesome if reuse wcf ria service, isn't requirement. the actual goal have true one-way pull offline use of frozen set of data server stored in isolated storage. thoughts? rusty silverlight support supposed come in sync framework v4. unfortunately, v4 release has been postponed. microsoft release parts of v4 ctp code samples. may check sync framework forums see when made available unfortunately, sl/isolated storage feature not integrated wcf ria services. uses own extensions on top of odata protocol , sync fx 2.1 though. another option may want @ wcf data services reference caching extensions ctp

Error using spring framework in android -

i using spring framework in android getting error on these import org.springframework.social.connect.serviceproviderconnection; import org.springframework.social.facebook.connect.facebookmobileserviceprovider; so solution that. you don't error is, i'll it's class not found error. solution jar contains classes , put in classpath. this url might help: https://github.com/springsource/spring-social/commits/master/spring-social-core/src/main/java/org/springframework/social/connect/support/connectionrepository.java once have it, you'll have know how add jar classpath in android project.

how to add the Phonon::SeekSlider to horizontalSlider in qt -

i have added horizontal slider on ui , need use slider in phonon audio player used onclick function in button , added phonon::seekslider *slider = new phonon::seekslider; slider->setmediaobject(moo); slider->show(); if used slider opening window .how can map horizontal use in ui seek slider in qt you create slider without parent. the documentation states "any qwidget has no parent become window". when create slider make sure set parent qwidget, 1 of widgets in ui. from question make you're using slider in ui? don't use one, use seekslider instead.

architecture - Name of anti pattern for complexity -

is there standard anti-pattern or referenced, argue when system reaches given complexity become unmaintainable , collapse? something systems never finished abandoned, more serious version. here suggestion: lava flow description . isn't you're talking about, might, longer description of project. i've encountered monster on several big scale projects.

html - In PHP, how to remove wrapping paragraph, but only if it's the only paragraph -

how remove (in case, useless) wrapping paragraph in cases this: <p>only paragraph</p> but keep string when there more 1 paragraph involved: <p>paragraph 1</p> <p>paragraph 2</p> preg_replace trick in here if can handle regexps.. :/ here 1 way, 2 test cases, $a , $b $a = '<p>only paragraph</p>'; $b = '<p>only paragraph</p> <p>only paragraph</p> <p>only paragraph</p>'; // change values $a , $b if( count( explode('<p>', $a) ) == 2 ){ $c = preg_replace('#</?p>#', '', $a); } if( isset( $c)) { var_dump( $c ); } // 'only paragraph' you might need add trim() first well. does not cater malformed input eg <p>para1 </p> para 2</p>