Posts

Showing posts from June, 2014

synchronization - WSO2 ESB Deployment Synchronizer stuck (can't gracefully shutdown or deploy services) -

we facing issues wso2 esb sincronizer, since have clustered configuration, using svn store content of "repository/deployment/server". carbon.xml configuration following: <deploymentsynchronizer> <enabled>true</enabled> <autocommit>false</autocommit><!--true mgt node--> <autocheckout>true</autocheckout> <repositorytype>svn</repositorytype> <svnurl>https://svn/x/trunk/serveresb/desenv/</svnurl> <svnuser>user</svnuser> <svnpassword>password</svnpassword> <svnurlappendtenantid>false</svnurlappendtenantid> </deploymentsynchronizer> it works correctly time, after deploys , undeploys stops working. although still gives message going sincronize , svn update seems corectly performed, esb not load newly deployed xmls: tid: [0] [esb] info {org.wso2.carbon.core.deployment.synchronizerepositoryrequest} - received [synchronizerepositor

postgresql - Return 0 or 1 rows from function -

is possible function return 1 record, return 0 records if there empty result set. example: if have empty table contains no data... create table foo ( fooid serial constraint pk_foo primary key, foovalue integer not null ); ... , function ... create or replace function get_onefoo() returns foo $$ select fooid, foovalue foo limit 1 $$ language sql; ... ... select get_onefoo() ... results in ... total query runtime: 11 ms. 1 row retrieved. ... ... select fooid, foovalue foo limit 1 ... results in ... total query runtime: 10 ms. 0 rows retrieved. returns setof foo in instead of returns foo the later returns composite type: http://www.postgresql.org/docs/current/static/rowtypes.html http://www.postgresql.org/docs/current/static/extend-type-system.html#aen51678

java - How to return a lazily-instantiated dynamic webelement -

i've been using @findby while now, , love fact element doesn't located until necessary (not on instantiation). however, webpage may have anywhere 2-10 of element, , id's on elements numbered (so first element has id of "element1" , forth) i write function can pass in integer, , return webelement appropriate id, and lazily instantiated. means having function following won't work: public webelement getelement(int numonpage){ return driver.findelement(by.id("element"+numonpage)); } because instant call function webelement gets located. (the reason why can't instantiated because have function waits until element exists calling isdisplayed() on , on over it, catching nosuchelementexception s). i realize create list<webelement> selects via css every element id starts "element" have had other cases i've wanted return dynamically generated element, , had use workaround there well. thanks! first, don&#

substring - mysql Opposite of SUBSTRING_INDEX -

i can select text string before @ character: sample entry in db: email@domain.com , sample output: email with: select substring_index(email,'@',1) but command selecting text string after @ character ? thank you use negative value count this: select substring_index(email,'@',-1) see documentation here: http://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_substring-index

c# - Printing values using crystal reports using different database -

Image
i have developed application payroll management , facing trouble while using crystal reports printing pay bills hi have 2 tables, first pay_head_table 2 fields pay_head_id , pay_head_name, i have around 40 entries in table, firstly want show values in pay_head_name in page header of crystal reports, these names treated columns. now in second table, have entries of employees respective pay heads this now, want print them in crystal reports this basic salary grade pay hra da .............................. etc.... shish pal 10330 2800 2626 (0 or no value if there no entry) mk. upa... 9750 2800 2510 9036 total 20080 5600 ............. ..................... i tried lot many ways couldn't exact result, please help create group based on employee id or name, place information in group

osx mountain lion - NumPy in IDLE (Python 3.3.2) on Mac OSx 10.8 -

i know may repeat question, answers i've found on here way above head. i'm new @ python, use numpy in idle (python 3.3.2). idle doesn't seem access numpy comes w/ osx 10.8 (which python 2.7). can't find numpy python 3 installer mac osx. of instructions i've found complicated , assume know lot more , still wouldn't me idle if execute them. can point me instructions beginners on installation? example, start compiling step - i'm not sure how this. i'd appreciate can give. thanks. if fresh python install: type which python terminal window make sure correct python selected. guessing should /library/frameworks/python.framework/versions/3.3 . download setuptools , pip https://pypi.python.org , untar both (can double click in osx window). in terminal change directory downloaded setuptools folder: cd ~/downloads/setuptools-x.x.x type python setup.py install . repeat 3 & 4 pip. now can type pip install numpy , download , install nump

excel - Copying Row Info from one sheet to another based on match -

i have excel book has 2 sheets: 1) import 2) pricing rules. pricing rules sheet the a column need match on. example values include sta_pnp4 , sta_pst .. , others. there potentially around 50 different rows in sheet, , continue grow on time. each row, there pricing values in columns b cf . import sheet this sheet has same number of columns, column a filled out. example values include sta_pnp4_001_00 , sta_pnp4_007_00 , sta_pst_010_00 .. , many more. what need do: if text in import sheet column a before second "_" matches column identifer in pricing rules sheet column a , copy rest of b cf of pricing rules sheet row import sheet row matched on. any idea on begin one? why don't using formulas only? assuming : 1.) data in import sheet (col a) sta_pnp4_007_00 sta_pnp4_001_00 sta_pnp4_001_00 . . 2.) data in pricing rules sheet (col a) (col b) (colc) (col d) ....... sta_pnp4 1 2 3 ..... sta

java - Spring injecting or autowiring datasource bean to class -

this may novice question, have searched , either have large gap in understanding or doing incorrectly cannot figure out. in context file here excerpt <bean id="datasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource"> <property name="driverclassname" value="${datasource.driverclassname}" /> <property name="url" value="${datasource.url}" /> <property name="username" value="${datasource.username}" /> <property name="password" value="${datasource.password}" /> </bean> <bean id="mybeanone" class="a.b.c.mybeanone"> <property name="datasource" ref="datasource" /> </bean> now in mybeanone have: private datasource datasource; private jdbctemplate jdbctemplate; @autowired public void setdatasource (datasource datasource) { this.jdbctempla

How to capture key events from bluetooth headset with android -

my app can controlled normal headset. overrides "onkeydown". key events bluetooth headset not captured - why? or how capture bluetooth key events? the "log cat" shows following if press button on headset: bluetooth @ recv(3043): at+vgs=15 audiopolicymanagerbase(13654): fm radio recording off audioservice(2261): sendvolumeupdate, iskeyguardlocked...not update volume panel. volumepanel(2261): change volume msg_volume_changed volumepanel(2261): onvolumechanged(streamtype: 6, flags: 0) volumepanel(2261): call setchangeseekbarcolor(false) i tried handle media button actions isn't working. idea free configurable key mapping: user chooses "set key" app hears on keys (hardware, media buttons, bluetooth headset) user presses key , event/key code stored in config. summerizing not working answers: volume buttons must captured "volume_changed_action". problem intents broadcasted other apps , abortbroadcast() doesn't work (it works "

c++ - Creating and running a file with command line arguments -

i new linux , apologize if descriptions not savvy. try relevantly detailed. currently working on terminal using fedora, , goal create smaller data set run program. given example, , mentor said run program had type "./filename" console. filename has command line arguments follows: "./main ./textfile1 ./textfile2" basically, each argument separated space. tried recreating document similar format, not sure save as, nor work when try running same way file larger data set. also, filename bold in terminal, whereas document created not. i'm not sure if helps @ all, difference noticed. any appreciated. you need set execute bit on file. chmod +x filename

windows authentication - IIS accessing resources via logged in user and NOT pool identity. How to enforce POOL Identity -

i have classic asp website following iis settings: 1. windows authentication enabled 2. impersonation disabled, anonymous , basic authentication 3. app pool .net 4.0, integrated pipeline custom process model identity. identityt given exclusive full access unc local , network shares, batch files etc asp application 1. displays user information of user logging intot web application, 2. accesses above mentioned shares display reports, 3. creates reports calling dlls post asp file in web application (uing webrequest) , xml , write xml share. issue facing above calls being made on behalf of application user instead of process model identity user in app pool. because of this, of requests throw permission denied or 401 errors. question : how can configure web site calls made can on behalf of app pool user only?

How to Parse JSON response into ng-repeat correctly in Angularjs -

i want able use ng-repeat in order parse response on front end. having trouble parsing responses have multiple items versus single item using ng-repeat list. i able parse; have create 2 different list separate ng-repeat configuration on front end , add ugly logic not display if length of array greater one. my goal have 1 ng-repeat element in partial , handles both responses or better approach handle requirement. detailed explanation , jsfiddle below. want use ng-repeat setup both json responses. <ul ng:repeat="report in reportconfigured.reports"> <li ng:repeat="reportitem in report">{{reportitem.reportname.$}}</li> </ul> below response webservice when there multiple reports. { "reports": { "@xmlns": { "$": "http:\/\/ws.wso2.org\/dataservice" }, "report": [{ "reportid": { "

qt - remove items from QComboBox from ui -

i trying tweak ui of qcombobox in way user can remove items drop down list (without first selecting them). the background using qcombobox indicate data file open right now. using cache opened files. user able remove entries not want have listed anymore. either hitting delete key, or context menu, or whatever straightforward implement. not want rely on selecting item first. similar behavior can found in firefox, old cached suggestions entry filed can deleted. i considering subclassing list view used qcombobox, however, did not find enough documentation me started. i grateful hints , suggestions. using pyqt, have no problems c++ samples. i solved problem using code installeventfilter documentation. //must in header, otherwise moc gets confused missing vtable class deletehighlighteditemwhenshiftdelpressedeventfilter : public qobject { q_object protected: bool eventfilter(qobject *obj, qevent *event); }; bool deletehighlighteditemwhenshiftdelpressedeventfilt

CSS - Colour blend gradient - Is this possible? -

Image
this question has answer here: css3 gradient background 2 answers i know if possbile using css only. choose hex values of 2 colours , blend them in gradient way, visual here: i forward ideas? time. graham you can css3 gradient . here quick example 1 of online gradient generators : background: -moz-linear-gradient(top, #7f1919 0%, #207cca 100%, #2989d8 100%); /* ff3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#7f1919), color-stop(100%,#207cca), color-stop(100%,#2989d8)); /* chrome,safari4+ */ background: -webkit-linear-gradient(top, #7f1919 0%,#207cca 100%,#2989d8 100%); /* chrome10+,safari5.1+ */ background: -o-linear-gradient(top, #7f1919 0%,#207cca 100%,#2989d8 100%); /* opera 11.10+ */ background: -ms-linear-gradient(top, #7f1919 0%,#207cca 100%,#2989d8 100%); /* ie10+ */ background: linear-gradient(to bottom, #

swing - Java : Memory Game -

i working on memory game project, click on 2 cards check if pictures same or not. problem facing if both cards don't have same picture, second picture not appear , first 1 closes well. here code think has sort of error in. public void actionperformed(actionevent e) { clicks +=1; card clicked = (card)e.getsource(); clicked.changecolor(); for(int i=0;i<16;i++) if(clicked == cards.get(i)) opencardindices.add(i); if(clicks==2 && opencardindices.get(opencardindices.size()-1)!=opencardindices.get(opencardindices.size()-2)) { if(cards.get(opencardindices.get(opencardindices.size()-1)).equals(cards.get(opencardindices.get(opencardindices.size()-2)))) { (cards.get(opencardindices.get(opencardindices.size()-1))).removeac

ActiveMQ topics and security (or Apollo) -

i new active mq. wondering following possible in active mq (or apollo). essentially, have process generate messages enable or disable particular site. when message (enable/disable) sent activemq, there multiple consumers of message depending on routing key of message. example, if message enable site a, routing key site.a.enable. , site monitoring sitea queue message system wide processor monitors enable/disable messages. now, think doable in active mq using topics. sitea subscribe topics of site.a.* , system process subscribe topics of site.*.enable , site.*.disable . is best way in activemq? i want make sure sitea cannot subscribe site.b.* or site.c.* topics. can receive messages site.a.* . , system process can access site.*.* topics. think can done via security plugs. update config file , specify read/write/admin access each site topic , connect user/pass or ldap identify site connecting. is correct? work if sites external? i want able add new sites minimal

spring - Struts 2 Annotation With Interceptors not Working -

i have been trying implement interceptors in application each , works fine till time don't include interceptor annotation in action. but, when add interceptoref tag in action code below: @interceptorrefs({ @interceptorref("mylogging") }) public class loginaction implements modeldriven{ it starts giving me exception severe: exception starting filter struts2 unable load configuration. - [unknown location] @ org.apache.struts2.dispatcher.dispatcher.init(dispatcher.java:431) @ org.apache.struts2.dispatcher.ng.initoperations.initdispatcher(initoperations.java:69) @ org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter.init(strutsprepareandexecutefilter.java:51) @ org.apache.catalina.core.applicationfilterconfig.initfilter(applicationfilterconfig.java:281) @ org.apache.catalina.core.applicationfilterconfig.getfilter(applicationfilterconfig.java:262) @ org.apache.catalina.core.applicationfilterconfig.<init>(applic

php - How to keep users from viewing images by URL? -

imagine have image file secretimage.png on webspace , want several users have right access image on index.php . can done: // index.php if($userisallowed) echo '<img src="secretimage.png" />'; the problem is, users theoretically still access image browsing directly www.mydomain.com/secretimage.png . there way prevent them doing so, image can viewed inside index.php ? you can use htaccess route requests specific folder through .php file. in file, can determine whether user can see file or not... if so, deliver correct headers , image. if not, show whatever want (404, placeholder image).

javascript - Using CORS + SOAP + WCF for a HTTPS service -

i'm trying cors working new version of our soap web service (which runs under https , has username/password authentication) can connected via js. at moment i'm getting working fine locally (not cross-domain) using different domain following wcf traceviewer. (400 bad request in iis7) <exceptionstring>system.xml.xmlexception: body of message cannot read because empty.</exceptionstring> it seems it's not getting part message inspector runs add appropriate cors headers. has experienced before or managed cors work under https soap service? i'd appreciate advice can give. cheers, jamie actually can implement response custom header per request this. response.appendheader("access-control-allow-origin", "*"); there more ways this. can chooise is. enabling cross domain access on wcf articles? implemented project used wcf service wcf , wcf service hosts on cross domain. can use jsonp webhttp binding. example answer here;

matlab - CCA for Feature Fusion -

in of multi-modal recognition methods, using canonical correlation analysis (cca) fuse 2 input feature vectors single , low dimension one. matlab has code cca is: [a,b,r,u,v] = canoncorr(x,y); see: http://www.mathworks.com/help/stats/canoncorr.html i wonder how can reach final (fused) feature vector using function. can explain steps or suggest reference, please? i found out how perform feature fusion using cca. wrote matlab code , shared code in matlab central . detailed descriptions can found in paper: m. haghighat, m. abdel-mottaleb, w. alhalabi, " fully automatic face normalization , single sample face recognition in unconstrained environments ," expert systems applications, vol. 47, pp. 23-34, april 2016.

c++ - cocos2d-x determine where a object will be based off its vector -

in game want towers shoot enemy going time bullet reaches it. i don't want bullet curve, want shoot directly estimated location based on speed unit moving , direction moving my thought determine direction of enemy subtracting current position last position every time moves. lets direction (1,1) after not 100% sure logic need do. i thinking need know distance tower enemy determine time need estimate how far enemy going when bullet should reach it. i don't know start one, if can give me pointers on how should handle solution. in case of uniformly accelerated linear movement x(t) = x0 + vx * t y(t) = y0 + vy * t where vx , vy projections of velocity v on coordinate axis. velocity vector scalar value speed, , direction in direction of movement. in case, if direction vector normalized, multiply speed velocity. you know starting position: (x0, y0) . need projections vx , vy . if w angle between x-axis , velocity, then vx = v * cos(w) vy = v * sin(w)

Returning user data using facebook php sdk -

i'm trying figure out basics of facebook php sdk. i'm using pretty simple code below... <?php include 'facebook.php'; $app_id = "my_id"; $app_secret = "my_secret"; $facebook = new facebook(array( 'appid' => $app_id, 'secret' => $app_secret, )); $userid = $facebook->getuser(); echo $userid; $userinfo = $facebook->api("/$userid"); echo $userinfo['name']; ?> when ask $userid $userid = $facebook->getuser(); echo $userid; i correct value. when try take next step , retrieve logged in user's name : $userinfo = $facebook->api("/$userid"); echo $userinfo['name']; nothing returned. see error? thanks! '/$userid' use literal string /$userid . want "/$userid" or '/me'

ruby - How to set the $Display variable for website application? -

i running tk8.6 ruby 1.9.1 on solaris box (with no display, console). have tk , tcl configured , installed. website , running , runs other applications fine. thing missing want button on website calculation , prompt user tk window ruby. the error message saying that... tcltklib: fail tk_init(). no display name , no $display environment variable (runtimeerror) i know have change $display variable, what? different display each time different user clicks on button respective browsers... you cannot use tk in web application. period.

ember.js - emberData bulk create hasMany relationship -

the app working on has event model this app.event = ds.model.extend({ title: ds.attr('string'), ... tests: ds.hasmany('app.test') }); now have eventcontroller create , save new record this.set('content', app.event.createrecord()); this.get('model').save(); saving title attribute works fine, want able save hasmany-relationships (e.g. test) via modal-dialog. creating dialog via {{outlet modal}} plus according controller, similar answers here on stackoverflow. seem able modal work objectcontroller and app.testcontroller = em.objectcontroller.extend({ needs: ['event'], init: function(){ var event = this.get('controllers.event').get('content') this.set('content', event.get('test').createrecord()); } }); to honest, haven't tested code yet full if works, seems is. template has according form fill in details. have arraycontroller in , button in template 'add

Ipython sympy plot error -

i trying plot equation result of solve block using sympy here code , error message follows: %pylab inline sympy import init_printing;init_printing() sympy import * d,vf,a,vi,t,x,h,g,theta=symbols('d vf vi t x h g theta') equations=[eq(sin(theta),(0.5*g*t**2+h)/(vi*t)),eq(cos(theta),x/(vi*t))] ans=solve(equations,[h,t],dict=true) h=ans[0][h] vi=5 g=9.8 theta=0.707 plot(h,(x,0,5)) then following error: --------------------------------------------------------------------------- valueerror traceback (most recent call last) <ipython-input-11-f388e50e21e7> in <module>() ----> 1 plot(h,(x,0,5)) c:\anaconda\lib\site-packages\sympy\plotting\plot.pyc in plot(*args, **kwargs) 1158 show = kwargs.pop('show', true) 1159 series = [] -> 1160 plot_expr = check_arguments(args, 1, 1) 1161 series = [lineover1drangeseries(*arg, **kwargs) arg in plot_expr] 1162 c:\anaconda\lib\site-packages\sympy\plotti

java - Methods for giving best estimate of Location from three Android location providers -

after reading older post, good way of getting user's location in android , wondered if has theories on how solve problem finding best estimate of location. gps ideal assume second gives bad measure every often. lets 3 measures, gps , wifi , , cell tower degrees of accuracy, methods might suggest find "best" location? my initial reaction type of weighted centroid function have 3 points , assign weights 3 accuracy , find closest point 3 points given accuracies. other thought use machine learning seems excessive unless i'm making solve problem. thoughts? based on me wondering how skyhook solves problem using data. //declare constants // minimum distance change updates in meters private static final long min_distance_change_for_updates = 20; // 10 meters // minimum time between updates in milliseconds private static final long min_time_bw_updates = 2000 * 60 * 1; // 1 minute public void getlocation() { locationmanager = (locationmanager) get

python - bufsize must be an integer error while grepping a message -

i running following error while trying grep message consisting of multipe lines in log...can provide inputs on how overcome error? code:- print gerrit_commitmsg gerritlog = popen('git','log','--grep','gerrit_commitmsg', stdout=pipe, stderr=pipe) print gerritlog error:- commit message:- build system changes build system changes include packages in build change-id: i697558f01ae367d2baacdf2c7fcf1a03753edacd traceback (most recent call last): file "gerrits_in_workspace.py", line 87, in <module> main() file "gerrits_in_workspace.py", line 77, in main grep_commitmsg(gerrit_commitmsg) file "gerrits_in_workspace.py", line 48, in grep_commitmsg gerritlog = popen('git','log','--grep','gerrit_commitmsg', stdout=pipe, stderr=pipe) file "/usr/lib/python2.7/subprocess.py", line 629, in __init__ raise typeerror("bufsize must integer&qu

speech recognition - Is there any relation the number of MFCC coefficients with noise? -

i'm implementing voice recognition using mfcc + gmm in android device. but wondering whether mfcc feature can noisy-robust adjusting number of mfcc coefficients or other things frequency range, number of filters, windowsize. thanks in advance

r - Is there a reason to prefer extractor functions to accessing attributes with $? -

on thread on crossvalidated, made following comment: i suspect r question difference between working s3 classes (that accessed via $ ) & s4 classes (that accessed via @ )... @gavin simpson subsequently commented: @gung more spot on, solution not delve objects , rip out whatever feel learn use extractor functions, in case coefficients() or shorter alias coef() , in coef(fit) i'm intrigued this. why using coef(model) be better than model$coefficients[,1] , example? (i recognize latter uglier , requires more typing, doubt that's reason intended.) case there isn't existing extractor function (e.g., accessing t-statistics)? because author of package using free change underlying structure of model object without worrying breaking everyone's code. obviously generalizes r core well. recommended use extractor functions because can sure return correct information, if function authors find necessary shuffle things aro

build android project failed with gradle -

Image
i have android project , when try build gradle, faild when proceed "mergedebugresources" task. the gradle build file : buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android' repositories { mavencentral() } dependencies { compile 'com.android.support:support-v4:13.0.+' compile filetree(dir: 'libs', include: '*.jar') } android { compilesdkversion 17 buildtoolsversion "17.0.0" defaultconfig { minsdkversion 9 targetsdkversion 17 } dependencies { compile project(":android-uitableview") compile project(":dragsortlistview") compile project(":newquickaction") compile project(":pulltorefresh") compile project(":slidingmenu") compile project(":umeng")

xml - Regex for tagging UPPERCASE CAUTION data -

fellow forum members, i'm using notepad++ , have bunch of cautions embedded within other text data. 2 constants set caution data apart rest of text data 2 factors. 1 caution text in uppercase text , second caution text starts word "caution" in uppercase. below small example of i'm descibing: bla bla bla bla bla. caution not perform maintenance on machine without first reading owner's manual. bla bla bla bla bla bla. is possible regex find many different variations of text below: caution not perform maintenance on machine without first reading owner's manual. and replace following: <caution><para>do not perform maintenance on machine without first reading owner's manual.</para></caution> i need coding regex following: is able target data starts word "caution" (in uppercase) is able target of uppercase text follows word "caution" until changes on lowercase text. deletes word "caution&q

Android - How to Send Image to other activity from load Image from SD Card -

i want ask send path image other activity , show imageview browsephoto.java private static int pick_from_file = 1; private static int intent_image = 2; private imagebutton buttonloadimage; private imagebutton reloadphoto; private imagebutton imagedone; private imageview mimageview; private uri mimagecaptureuri; textview textimagepath; uri imageuri = null; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); overridependingtransition(r.anim.push_left_in, r.anim.hold); setcontentview(r.layout.browse); buttonloadimage = (imagebutton) findviewbyid(r.id.btnloadimage); imagedone = (imagebutton) findviewbyid(r.id.btnphotook); reloadphoto = (imagebutton) findviewbyid(r.id.btnreload); mimageview = (imageview) findviewbyid(r.id.iv_pic); textimagepath = (textview) findviewbyid(r.id.imagepath); buttonloadimage.setonclicklistener(new view.onclicklistener() {

css Property for jquery ajax success function -

i'm working mvc3, using following jquery ajax call: function displaymaingrid () { var geo = $('#ddlgeo').val(); var vertical = $('#ddlvertical').val(); var month = $('#ddlmonth').val(); if(vertical == "all") { var flag = 1; } else { var flag = 2; } $.ajax({ url: "@url.action("trunutilizedownershipchange", "travelready")", datatype: "html", type: "post", data: {strgeo:geo, strvertical:vertical, intmonth:month, intflag:flag}, error: function(){}, success: function(data){ $('.travtablecontent').empty(); var text3 = data.data.lstunutilizedownershipentities; for( var item in text3) { $('<tr />').html(text3[item]).appendto('.travtablecontent'); $

android - Gathering SQLite row id to delete entry from context menu -

i query database , returns sorted arrays populate listview . when click on listview can obtain row id according database, context menu can't access same array, guidance on how go fixing this? of examples found online won't because database's row id not match listview id because of sorting goes on. this calls database , displays info: public class sqlview extends listactivity { private simpleadapter adapter; listview drinklist; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); // full screen requestwindowfeature(window.feature_no_title); setcontentview(r.layout.sqlview); // definitions sharedpreferences somebar; somebar = getsharedpreferences("barpreferences", 0); string originalbar = somebar.getstring("currentbar", "my local bar"); originalbar = originalbar.replace("'", "''"

javascript - Jquery on() prevent default dosent work -

im using $('#c_itinerarios').click(function(e) { e.preventdefault(); $("#visordetallado").empty(); var url = $(this).attr('href'); $("#visorgeneral").load(url); }); works perfect i'm trying move on() handler this $('#c_itinerarios').on('click', function(e) { e.preventdefault(); $("#visordetallado").empty(); var url = $(this).attr('href'); $("#visorgeneral").load(url); }); but preventdefault not doing job. $( '#c_itinerarios' ).click( function( e ) { $( "#visordetallado" ).empty(); var url = $(this).attr( 'href' ); $( "#visorgeneral" ).load(url); return false; });

In python, how can you delete the third forth and fifth line of a text file? -

there question deleting first 3 , last line, used .writelines() , work if want delete outside lines, not delete lines in the middle. any ways of deleting multiple specific lines anywhere in text file in python? please, please, please help!! try following code: with open('input.txt') f, open('output.txt', 'w') fout: fout.writelines(line lineno, line in enumerate(f, 1) if lineno not in (3,4,5))

java - update components based on which tab its called from -

Image
hello guru's beginner java swing developer , trying build simple app... here simplified version. setup: 1 jframe, 2 borderlayout based tabbed panels (a , b) each has 1 textfiled, shared jpanel class combo box , itemlistener initialized in each tab's (north) issue: how control updates textfield's text based on panel came eg. if select apples in taba, item listener updates textfield on tabb well. accomplish determine call came taba or tabb , update textfield associated tab. hope makes sense public class main extends jframe { private static final long serialversionuid = 1l; private jpanel contentpane; public jtextfield tfpanela; public jtextfield tfpanelb; /** * launch application. */ public static void main(string[] args) { eventqueue.invokelater(new runnable() { public void run() { try { main frame = new main(); frame.setvisible(true); }