Posts

Showing posts from July, 2010

file io - Python error: list indices must be integers, not unicode -

there problem: i'm trying numbers tkinter's text widget(get's text file) way: text = self.text_field.get(1.0, 'end') s = re.findall("\d+", text) s returns this: [u'0', u'15', u'320', u'235', u'1', u'1', u'150', u'50', u'2', u'2', u'20'] than try add tags text widget: for in s: self.text_field.tag_add('%s', '5.0', '6.0') %s[i] and gives error: list indices must integers, not unicode thanx helping me :) in python when do for x in l: ... inside body loop x list element, not index. in case correction needed use % i instead of % s[i] . if in other cases need both list element , index number common python idiom is: for index, element in enumerate(l): ...

Android custom adapter getView() NullPointerException out of nowhere! -

i've got custom adapter supply data listview. worked fine, 'suddenly'(i don't have word what's happening) app started crashing while loading activity listview: w/dalvikvm( 228): threadid=3: thread exiting uncaught exception (group=0x4001b188) e/androidruntime( 228): uncaught handler: thread main exiting due uncaught exception e/androidruntime( 228): java.lang.nullpointerexception e/androidruntime( 228): @ advertisementlistadapter.getview(advertisementlistadapter.java:72) e/androidruntime( 228): @ android.widget.abslistview.obtainview(abslistview.java:1274) e/androidruntime( 228): @ android.widget.listview.measureheightofchildren(listview.java:1147) e/androidruntime( 228): @ android.widget.listview.onmeasure(listview.java:1060) e/androidruntime( 228): @ android.view.view.measure(view.java:7964) e/androidruntime( 228): @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:3023) e/androidruntime( 228): @ android.w

.net - Extend DataSet Class Not Working -

i've created dataset using dataset designer. 1 of tables called users , there class called usersdatatable . in class properties, namely connection . created partial class usersdatatable , none of routines, properties, or variables usersdatatable class in designer codebehind file visible me. i'm trying extend class add own routines leverage connections , strong typing of designer-generated class. i've tried creating own partial classes , testing them see if have problem other classes , don't. these dataset designer-generated classes can not access items in other half of partial class. i'm working in .net 4. might doing wrong? all of "partial" classes must declared such in order technique work, , i'm guessing visual studio dataset designer isn't generating partial classes: http://msdn.microsoft.com/en-us/library/wa80x488(v=vs.100).aspx you might need inherit designer-generated classes instead. edit: looked @ vs2010-generate

path - php: setting root directory for project? -

i'm having following url test project on local server: http://localhost/projects/test/ now i'd have have possibilty of using root directory eg. includes/images - <img src='/img/test.jpg'> - way save me lot of time simple put online without path modifications/flag. any ideas how work? thanks i guess not php related question, more on html. may on <base> tag. instead of saying: <img src='/img/test.jpg'> go , make: <head><base href="http://localhost/projects/test/" /> ... </head> <body> <img src="img/test.jpg" /> </body> which in fact point to: http://localhost/projects/test/ img/test.jpg and php scripts use set_include_path() function <?php $path = '/usr/lib/pear'; set_include_path(get_include_path() . path_separator . $path); ?>

dll - C++: 'adding references' to namespaces (and class libraries)? -

i'm curious adding references through "property pages" dialog in visual studio c++. adding 'class libraries' and, more so, 'namespaces'. in i'm reading says both 'class library's , 'namespaces' can referenced in way-- can see reference 'class libraries' (bringing in dll able access it's '.h' files , such-- correct me if i'm wrong). referencing namespace do? understand 'using' declarative allows not qualify namespace anymore-- 'referencing namespaces' way that? to clarify mean 'referencing': i'm talking when right clicking on project in solution explorer , selecting 'references' brings 'property pages' dialog , selecting 'add new reference...' button. 'add reference' in .net #include ing in normal c++. allows use classes , namespaces inside .cs file, not in project, e.g., system libraries. if you're coding normal c++, don't wo

ios4 - can we retrieving text messages from iPhone memory in iPhone sdk? -

hello friends want know whether can access or fetch or retrieve text messages in iphone memory can make pdf of these text messages. in advance. no. pretty bad privacy , security standpoint if allowed that.

Perl regex - exponential values -

what's regex match decimal number check not contain exponential values? thanks help. can match except if contains "e-", "e+", "e-" or "e+"? the thing cost field, , can contain currency symbols, parenthesis , other characters that without detailed specs it's not easy task using regular expressions. in opinion, regex inappropriate when know little format of input. update after op's edit: can match except if contains "e-", "e+", "e-" or "e+"? that e.g. ^(?!.*[ee][+-]).*$ (using negative lookahead ), matching more like…

css - color the ordered list in html -

possible duplicate: is there easy way change color of bullet in list? i have ordered list ul{ list-style-type:circle; } <ul> <li>one</li> <li>two</li> </ul> how fill circle blue color , not font? first, unordered list, not ordered, ordered ol , elements has particular explicit order. second, can set color of li element trigger bullet change color

cuda - Python GPU programming -

i working on project in python, , make use of gpu calculations. at first glance seems there many tools available; @ second glance, feel im missing something. copperhead looks awesome has not yet been released. appear im limited writing low-level cuda or opencl kernels; no thrust, no cudpp. if id have sorted, im going have myself. that doesnt seem quite right me. indeed missing something? or gpu-scripting not quite living hype yet? edit: gpulib seems might need. documentation rudimentary, , python bindings mentioned in passing, im applying download link right now. has experience that, or links similar free-for-academic-use gpu libraries? reedit: ok, python bindings infact nonexistant. edit2: guess best bet write in c/cuda , call python? pycuda provides integration cuda , has several helper interfaces make writing cuda code easier in straight c api. here example wiki 2d fft without needing c code @ all.

linux - Can't get the correct format for my .screenrc -

this .screenrc. goal, load client in furthest left panel width of 85 (in gnome-terminal, fyi), next section split in two, top , bottom. both running tail on 2 different files. , furthest right yet tail occupying whatever space left over. startup_message off term screen-256color screen -t tintin++ 0 bash select tintin++ split -v focus down screen -t map 1 tail -f -s .01 $home/tintin/minimap select tail split -v focus down screen -t group 2 tail -f $home/tintin/group select group split focus down screen -t chats 3 tail -f $home/tintin/aardwolf-chats select chats focus down select tintin++ altscreen on edit: getting closer code, still not right.

flash - ActionScript errors when Swf embedded into HTML -

hey using swf object embed swf html page. when compile swf there no errors yet when embed web page keep getting thrown either 1 of these 2 errors first time page loads in safari , chrome typeerror: error #1009: cannot access property or method of null object reference @ tracks/loadflashvars() @ tracks/init() @ tracks securityerror: error #2000: no active security context. in firefox thrown same errors everytime page loads. swf loads other swfs , and have xml loaders thought maybe base swf not being loaded before code run have been playing around settimeout(); try , make work around unsure if correct or if embed code wrong, can see below. there live version here http://music-shed.org/tracks/ any hints or tips appreciated. can't tell you're trying because haven't shown as3 code. however, if you're trying load files remote location you'll need load cross domain policy that's held @ end. security.allowdomain("*"); s

python - How to Iterate a dictionary of references to matplotlib figures -

i have number of functions each of creates 1 or more figures. figures created, reference added dictionary, so: self.figures['figurekey'] = figure() in function, iterate dictionary , save each of figures; nice use dictionary key part or of filename. have been able iterate dictionary figure() function seems require integer corresponding figure number, rejecting reference given key. fig in self.figures: figure(self.figures[fig]) #does not work figure(fig) #also not work savefig(fig) #seems let me use key filename--nice i have attempted use `get_fignums()' , iterate returned array, loses association key names. perhaps possible dereference figure number figure pointer? have slick approach this? please resist tendency begin answer phrase "why don't just..." answer not obvious approach me. i'm sort of new @ this. you can figure number figure instance. from docs : the retur

ios - Providing autorotation support to a subview loaded programmatically - iPad -

i have ipad project structured as: - appdelegate - mainwindow - view controller -- view the view controllers .m file loads view programmatically , positions on screen. view going slid in , out. i this: - (void)viewdidload { [super viewdidload]; cgrect viewrect = cgrectmake(0, 0, 0, 0); calculatorview *v = [[[calculatorview alloc] initwithframe:viewrect] autorelease]; [self.view.window addsubview:v]; [uiview beginanimations:nil context:null]; [uiview setanimationcurve:uiviewanimationcurveeasein]; v.view.frame = cgrectmake(0, 0, 460, 320); [uiview commitanimations]; } the issue having subview i'm adding here doesnt' seem have correct orientation. project supports landscape, , launches landscape. container view fine, , contains buttons fine well. programmatically loaded view stuck in portrait mode. have provided following auto-rotation code (in loaded view's .m): - (bool)shouldautorotatetoi

C++ If and if else error messages -

i making collection of math functions. used if statements create error messages , cut down on user errors.. don't think did right. string error_0; string error_i; if (num1 == 0;) {error_0 = "you cannot divide zero. fail."} else {error_0 = "";} if (num1=<0;) {error_i = "sorry, can't imaginary numbers."} //for sqroot function else {error_i = "";} if (num2=<0;) {error_i = "sorry, can't imaginary numbers."} else {error_i = "";} ... gives me following error messages in code::blocks compiling. expected ")" before ";" token (the if lines) expected primary expression before ")" token (the if lines) else without previous if (just last else) i'm new @ c++ , examples have looks correct. appreciated. thanks. you need semicolon after strings , don't need 1 inside if conditions. also, operator <= , not =< . string error_0; string error_i

switching configurations between VS testing and deployment for WCF web service due to HTTPS -

requirement: need deploy wcf webservice application in iis 6 accessible https. problem: difficult switch between debugging in visual studio (which cannot use ssl in vs 2008 asp.net development server because of web configuration settings. what efficient way work around this? can manipulate https configuration bindings through code switch between servers? thanks! if can set different build configurations asp.net development server , iis can either web.config transformations use post build event example lets decide debug build used dev server , release iis. using post build event approach create 2 web.config files name web.config.debug , web.config.release. in post build event based on mode of build rename 1 of config file web.config. first approach read docs. find web.config transformation difficult implement.

python - Is it safe to modify the output of globals()? -

the documentation locals() function warns not modify output, interpreters may not reflect changes in local scope. i'm assuming means python spec doesn't require it, though works in cpython. i'd know if same globals(). there's no warning in the documentation , find strange differ each function apparently performs same action on different scope. if it's safe, modifying globals()' output improve simplicity , compatibility of project i'm working on. modifying locals() doesn't work reliably, in cpython. happens work in module , class scopes, fails inside function (any modifications "won't take", since locals() provides copy of local namespace in case, rather reference real thing) however, globals() different, since always refers module namespace, , module namespaces required behave ordinary dictionaries. yes, lack of warning on globals() isn't oversight, allowed.

c# - Moq - cannot iterate through a hidden IEnumerable -

we have reasonably complicated interface hierarchy , i'm struggling moq want to. i have interface ireservation extends irulesreservation , , hides enumerator new implementation of type. public interface ireservation : irulesreservation { new ienumerator<iroutepart> getenumerator(); } irulesreservation extends ienumerable . public interface irulesreservation : ienumerable<irulesroutepart> { } the method i'm trying test takes in ireservation , @ various points needs access ienumerable<irulesroutepart> . mock setup so: m_mock = new mock<ireservation>(); m_mock.as<irulesreservation>().setup(r => r.getenumerator()).returns(routeparts.select(rp => (irulesroutepart)rp).getenumerator()); in example, routeparts list of irouteparts come mock<irouteparts> objects setup .as<irulesroutepart>() . whenever bit of code in function i'm testing uses enumerator, steps on iteration though collection empty. am doing

ruby - Javascript Rails JSON Problem -

i have large json rails controller: @json = {:nodes => @nodes.as_json(:only => [:id, :lat, :lon])} and want use in javascript in views. in larger scope, want use json retrieve lat , lon's plot on google map. however, right now, i'm trying see if can points properly. question is: what's way parse json in javascript file? (note: file's extension still html.erb) i've tried: var stuff = eval('(' + <%= @json %> + ')'); but doesn't seem working. can help? much! since json legal javascript syntax, this: var stuff = <%= @json_hash.to_json %>; simplest thing possibly work. if getting json untrusted source, it's better use library function parse it, prevent executing code. also, sure call to_json on final hash. don't want to_s it, default in erb .

Rails, How to integrate this module -

i'm working add fb registration plugin app. way works plugin posts 1 param, params["signed_request"] needs decoded app. i found tutorial: http://veerasundaravel.wordpress.com/2011/01/27/facebook-registration-plugin-in-rails/ my question module live? , access in controller's def create method recieves params["signed_request"] ? thanks create 1 ruby file inside lib folder , put module code inside file. next have autoload module add below line in config/application.rb config.autoload_paths += %w(#{config.root}/lib) restart server. can access module inside controller.

qt - QImage in a QGraphics scene -

i quite new qt. having troubles in inserting qimage scene. please tell me how add qimage qgraphicsscene ? for use qgraphicspixmapitem add scene other qgraphicsitem . the qgraphicspixmapitem can initialized qpixmap device-dependent representation of bitmap , can qimage example static function qpixmap::fromimage() . update (example code) #include <qtglobal> #if qt_version >= 0x050000 #include <qtwidgets> #else #include <qtgui> #endif int main(int argc, char *argv[]) { qapplication a(argc, argv); qimage image("test.png"); qgraphicspixmapitem item( qpixmap::fromimage(image)); qgraphicsscene* scene = new qgraphicsscene; scene->additem(&item); qgraphicsview view(scene); view.show(); return a.exec(); }

css - How to make a DIV adapt it's width and height automated? -

i want label 3 divs, write following code, doesn't work: <table> <tr> <td> <tr><div id="leftupdiv" style="width:20%;height:50%;border:1px solid gray"></div></tr> <tr><div id="leftdowndiv" style="width:20%;height:50%;border:1px solid gray"></div></tr> </td> <td> <div id="rightdiv" style="width:80%;height:100%;border:1px solid gray"></div> </td> </tr> </table> but if change percentages numbers (20% -> 200; 50% -> 500; 80% -> 800; 100% -> 1000), works. my question is: how change code, divs can labeled above percentages? div's default use 100% width, , 100% height of whatever content in there. if nothing in there, height of 100% = 0px. should fix formatting of table. shouldn't work way. css: td{ border:1px solid red; } html: <table> <tr> &

Android FaceDetector.Face Euler angles are 0 all the time -

i'm trying euler angle of face detected facedetector. here use output logcat: log.v("debug", " x: " + face.pose(face.euler_x) + " y: " + face.pose(face.euler_y) + " z: " + face.pose(face.euler_z) ); but returns 0.0 three, no matter angle face at. ideas why? yeah facedetector api 1 never returns pose angle. can @ source code verify. the newer facedetectionlistener api 14 return pose angle, it's available on limited number of devices right now. not devices running api 14 can use it. have call getmaxnumdetectedfaces() see if device supports api. you can alternately try using opencv. couple options http://code.opencv.org/projects/opencv/wiki/opencv4android , http://code.google.com/p/javacv/ . in experience aren't worth hassle unless really, need pose angle.

objective c - When I set the anchor point, my image is not loading -

Image
i have uiview on loading image view sub view. image showing when doesn't set anchor point whenever set anchor point image not showing .i have added quartzcore frame work also. i adding code below cgrect apprect=cgrectmake(0, 0, 1024, 768); uiview *containerview = [[uiview alloc] initwithframe:apprect1]; containerview.backgroundcolor = [uicolor whitecolor]; [self.view addsubview:containerview]; handleview1= [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"large.gif"]]; [handleview1 setalpha:1]; //[handleview1 setframe:cgrectmake(390, 172.00, 56.00, 316.00)]; handleview1.userinteractionenabled = yes; handleview1.layer.anchorpoint=cgpointmake(490.0, 172.0); [containerview addsubview:handleview1]; the problem values use anchorpoint. don't set points position of frame values. let me quote apple: the anchorpoint property cgpoint specifies location within bounds of layer corresponds position coordinate. anchor point specifies how bounds

c# store a picture to database -

i not able insert picture in database.this sample code.i able select image computer , display in picture box.once try store image displayed in picture box database says object reference not set instance of object. this sample code. namespace picutre_storage { public partial class form1 : form { public form1() { initializecomponent(); } private void button2_click(object sender, eventargs e) { try { sqlconnection con = new sqlconnection (@"user id=sa;password=password123;initial catalog=picuture;persist security info=true;data source=enmedia-ea6278e\enmedia"); //i have used table named "tblusers" , fill fields sqlcommand cmd = new sqlcommand("insert blobtest (blobdata) values (@blobdata)", con); //save image picturebox memorystream object. memorystream ms = new memorystream();

html - Choose font sizes for tag cloud (rails3) -

i set font sizes tags based on rating. sample ratings like: 206 82 25 24 25 19 8 5 0 3 2 1 6 1 1 0 32 6 3 -1 112 31 6 8 2 24 18 2 2 1 1 1 2 6 67 35 37 25 0 1 7 8 2 3 0 1 2 1 -2 8 19 -2 1 1 -3 -4 6 1 1 8 11 3 1 3 1 2 5 1 0 1 1 2 2 2 1 2 2 1 1 1 1 1 0 1 1 2 1 2 1 1 0 1 1 2 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 -1 0 1 -1 -1 1 -1 -1 0 -5 -1 2 2 i've tried using k-means clustering (gem) can't seem pick right number of centroids because ratings vary case case. also, i'm not sure font range use. what's best way this? here find algorithm font sizes using logarithmic scaling based on number of occurrences of each tag: http://blogs.dekoh.com/dev/2007/10/29/choosing-a-good-font-size-variation-algorithm-for-your-tag-cloud/

php - Android phone as SMS gateway -

i must develop simple functionality customer, sms forwarding , receiving. crm system written in php, , has implemented function forwards , listens http requets pass sms. i decided use android phone simple sms gateway, after long research app seems work sms gateway unfortunatly freezes time time. do please can recomend me solution solve problem, maybe of has experience developing android app sending/receiving sms , forwarding web application. the application freezes because u r not using "wakelock",so whenever phone goes sleep, wifi or gprs goes on sleep..and application not able send request server.

Best way to read Namespace from XML stream (using Java) -

i wondering if people had opinions on following. i have xml segments like: <?xml version="1.0" encoding="utf-8"?> <clashes:matchingelementandattribute xmlns:clashes="http://example.com/attribelemclashes" clash="123"> <clash>strval</clash> </clashes:matchingelementandattribute> and want able extract namespace of xml fragment. what best way of doing (within java) - , performant. thanks , suggestions rob you can use stax parser woodstox perform large xmls. loads xml stream , event start of element. provides way qname (qualified name) of element object has namespace available property. have @ http://www.xml.com/pub/a/2003/09/17/stax.html

sorting - XSLT sort by tag name and attribute value -

i'm noob xslt, please excuse ignorance... i'm trying sort simple xml file attribute value , tag name, struggle in accessing value of attribute. here complete example: <a> <b attribute="e"></b> <b attribute="b"></b> <d attribute="a"></d> <c></c> </a> and expected result is: <a> <b attribute="b"></b> <b attribute="e"></b> <c></c> <d attribute="a"></d> </a> here attempt solve this: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output indent="yes" /> <xsl:strip-space elements="*" /> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="@*"> <xsl:sort select=

c# - Transparent control flickering on scrolling -

i've created application in c# has custom buttons. these have transparent background therefore enherited control , override createparams/onpaintbackground , added invalidateex function. now need grid layout(tablelayoutpanel) transparent. again created own control , override createparams/onpaintbackground , added invalidateex function. on scroll see backgrounds 'remembers' has drawn , therefore see ghosting (if thats correct word). hooking invalidateex function scroll event make panel flicker on scrolling. is there way remove flicker? public class gridlayout : tablelayoutpanel { public gridlayout() { this.scroll += delegate { this.invalidateex(); }; } protected override createparams createparams { { createparams cp = base.createparams; cp.exstyle |= 0x20; //transparent return cp; } } protected override void onpaintbackground(painteventargs e) { // nothing

ASP.net: How to list a WebApplication All users Session -

i want know website memory usage,first want know session detail of users,this me decide whether change sessionstate mode "sqlserver" or "stateserver". how can do? thanks for website memory usage, @ perfmon. if wanted count how memory using in each user session, count when adding not when abandoning session. tricky if you've got session["foo"]=bar on place, needs wrapped somehow. if change out of process session state, need test touches session. session variables crossing process boundaries, need serializable , there things don't work.

How to extend existing template in C++? -

i working legacy code of template based on template<class keytype, class dtype> foo bar(const dtype val) somewhere in code place made debug function this: virtual void getdebugstr01(int db_id, ofcstring & db_str) { //ofcstringstream ss; if(db_id==0) { map<keytype, dtype>::iterator = m_statedata.begin(); for(;it!=m_statedata.end();it++) { (it->second).getdebugstr01(db_str); } } } now, need use template class float. there anyway this? currently a: error c2228: left of '.getdebugstr01' must have class/struct/union getdebugstr01() should member of class/struct . virtual methods cannot stand alone. you can like, foo bar (const float f) { ... }

Django share CSS and Javascript for admin and public -

i using django grapelli. in static/admin/ directory, used admin site. i create public directory, separate admin, , can access public. django grapelli come jquery , other css. should create static/public/ store css , js public site or should use admin static css , js? i create a directory name public in static directory - static/public/, seems not able serve static files. in order make seamless possible, django serves admin media in development server within django sources. in order make take grapelli media, should do: python manage.py runserver --adminmedia=./static/public and serves admin media directory!

TSQL or SSIS convert Columns into Rows -

could please suggest how achieve following? i.e. convert columns in rows using either tsql or ssis: e.g. this: col1 col2 start end to this: start end from this: col1 col2 col3 col4 start break start end to this: start break start break thank you. you can write results temporary table , transpose rows in table. solution of transposing in blog: http://sql-tricks.blogspot.com/2011/04/sql-server-rows-transpose.html

java - Some parcelables objects put together in an Intent/bundle could be interfere themselves and to compromise the read of Intent/Bundle? -

some parcelables objects put in intent/bundle interfere , compromise read of intent/bundle? i extract code where, think, there problem. code works: public void writetoparcel(parcel arg0, int arg1) { arg0.writeparcelable(object1, arg1); arg0.writetypedlist(arraylist1); } public void readfromparcel(parcel in) { object1 = in.readparcelable(object1.class.getclassloader()); arraylist1 = new arraylist<object3>(); in.readtypedlist(arraylist1, object3.creator); } but if add other complex parcelable object (with intern parcelable arraylist): public void writetoparcel(parcel arg0, int arg1) { arg0.writeparcelable(object1, arg1); arg0.writeparcelable(object2, arg1); arg0.writetypedlist(arraylist1); } public void readfromparcel(parcel in) { object1 = in.readparcelable(object1.class.getclassloader()); object2 = in.readparcelable(object2.class.getclassloader()); arraylist1 = new arraylist<object3>(); in.readtypedlis

iphone - Why does the font of my UITextField change when editing? -

Image
my uitextfield's font gets lighter when being edited, , bolder whenever editing finishes. these images should illustrate problem: can explain why is, , how stop it? this code i've got - first uitextfield subclass (which there add margins): @interface rltextfield : uitextfield { } @end @implementation rltextfield - (cgrect)editingrectforbounds:(cgrect)bounds { cgrect editingrect = cgrectmake(bounds.origin.x+35, bounds.origin.y-5, bounds.size.width, bounds.size.height); return editingrect; } - (cgrect)textrectforbounds:(cgrect)bounds { cgrect editingrect = cgrectmake(bounds.origin.x+35, bounds.origin.y-5, bounds.size.width, bounds.size.height); return editingrect; } @end and it's added in viewcontroller: - (void)viewdidload { cgrect notetitletextframe = cgrectmake(self.view.bounds.origin.x, self.view.bounds.origin.y+10, self.view.bounds.siz

Zend Framework - session id regenerated, can't stay logged in -

awe come on people :( isn't there 1 can me out here hi guys, i'm trying store sessions in database using zend sessions somereason sessions die out. im not sure if theres code being executed or whether else. i've noticed session id seems regenerated after breif time after having logged in. this despite having added following line in htaccess file: php_value session.auto_start 0 the end result i'm logged out every minute i'm logged in. heres code in bootstrap file $config = array( 'name' => 'session', 'primary' => 'id', 'modifiedcolumn' => 'modified', 'datacolumn' => 'data', 'lifetimecolumn' => 'lifetime' ); $savehandler = new zend_session_savehandler_dbtable($config); zend_session::rememberme($seconds = (60 * 60 * 24 * 30)); $savehandler->setlifetime($seconds)->setoverridelifetime(true); zend_session::se

java - Building both war and ear files for same project using maven -

in project have both web related stuff(jsps, controllers, ..) , ejb beans. need build war file web related stuff , deploy tomcat and need build ear file ejb's , deploy jboss using maven. can suggest me solution modify pom.xml accordingly. thank you, pavan the best way split project multiple sub-projects: 1 builds ejbs, 1 builds war, , third packages them together. described in maven: complete reference , , example in better builds maven .

devexpress - How to Get row by key value or visible index in ASPxGridView then change column value? -

hi in aspxgridview, there way row visibleindex or keyvalue can change column value in it?, mean this: var row = mygrid.selectrowbykeyvalue(mykeyvalue); or: var row = mygrid.selectrowbyvisibleindex(mykeyvalue); row["column1"] = true; edit: i'm tring every time hit button want check 1 specific row (i'm using ajax not reload page); thanks this can done using aspxgridview.getrow() method. note, changing value in datarow not enough. if want these changes preserved, save them db. since using unbound columns, should handle customunboundcolumndata event , provide modified data row within event handler. common approach described in providing data unbound columns topic. if not help, please describe in greater details. update your approach incorrect. aspxgridview not provide method set text of cell (td). instead, should force grid raise customunboundcolumndata event. can done using aspxgridview's databind method. in event handler, s

php - separate queries of SQL functions? -

i using combination of php , mysql. case using 2 queries (one 'select' , 'insert') activity, 3 queries. done different users. i using mysql_query function separately execute queries. or better use sql function executes queries. want know better regarding performance. in opinion better practice create function performs single operation well. makes functions easier test , allows them utilized in other operations in future. in case create stored procedure execute routine.

css - CSS3 border radius problem with Chrome, Opera, Safari -

Image
i ran problem when trying add rounded corners divs , can't seem find solution. i'm using css class assigned divs: -moz-box-shadow: 0px 5px 5px #cccccc; -webkit-box-shadow: 0px 5px 5px #cccccc; box-shadow: 0px 5px 5px #cccccc; -moz-border-radius: 5px; -webkit-border-radius: 5px; -khtml-border-radius: 5px; border-radius: 5px; the following how shows in chrome, safari , opera: and here how displays in firefox , ie9: it looks if background in chrome , others somehow clip on the background color in top border. css associated colored top border is: border-top:8px solid #333333; any ideas? check fiddle in various browsers: http://jsfiddle.net/qvs9x/ when remove border-radius , goes normal. may have discovered bug in webkit , opera implementations of border-radius . check if hasn't been reported , if not, might want report :). [edit] i'm quite bug. it manifests in chrome & opera the bug looks different in chrome , opera the buggy pa

Mercurial source control - pros and cons of Forking -

i'm customizing blogengine.net support custom local features (farsi calendar, rtl theme, etc.) blogengine.net uses mercurial source control , able create fork of project , commit changes it. i'd release separate project since there major modifications in code support persian language , not intend send pull request main project. afaik have 2 options: i can download blogengine.net's source code, create new project, commit original source files , commit changes repository. i can fork main project , have clone repository. can commit on repository. now benefits of using fork? if create fork, able release project in own page independent project (option no.1)? saying "its own page' mean i'd have address "farsiblogengine.codeplex.com" , make binary version, source code version available download, have discussion forum, etc. features have when not use forking. generally, pros of using forking instead of downloading main project, creati

sql - Localizable strings in JPA -

to solve need localized dynamic (user created, stored in db) data in java ee 6 project, made general localized string table capable of storing string in language. avoid having make ~15 tables containing names stuff. know 2 things: 1) think good or bad idea, , why? 2) know know of clean solution issue listed under cons? my experiences: pros : 1 table needed, general solution easy configure both in jpa , db. duplicated code nonexistant. cons : big issue find due muiltilingual_string table knowing objects using it, cascade deletes won't work sql (but works in jpa orphanremoval). produces possibilities "dead" strings remain in database if worked outside jpa. the entities: (abstractentity mapped superclass containing @id , @version) @entity @table(schema = "competence", name = "multilingual_string") public class multilingualstring extends abstractentity{ @elementcollection(fetch=fetchtype.eager) @mapkey(name = "language"

c# - Use Moq to verify if list within object is changed properly -

i'm trying add moq tests in mstest test parts of code. the code want test not working piece of code should filter data retreived service , pass through. code set through mvp pattern , have following components. (i'm testing presenter) service -> service retrieving list of objects , putting in model (i'm using mock (moq) return values) model -> entity object general properties , list of documents view -> interface usercontrol implementing talk presenter. view mocked moq. presenter -> object retrieve model service , assign model property of view. in first scenario working retrieve model service , presenter passes property of view. //setup accountspayableservice mock _mockeddocumentservice = new mock<idocumentservice>(); documentmodel<invoicedocumentrow> model = new documentmodel<invoicedocumentrow>(); list<invoicedocumentrow> invoices = new list<invoicedocumentrow>(); invoicedocumentrow row = new invoicedocumentrow();

java - How to implement a font that can display french characters -

i working on project multiple languages have french, problem displays weird characters, in stead of normal french, can some1 me ( in java ) beforehand if using resource bundles in ".properties" format, issue can resolved escaping al not standard characters respective unicode notation. .propertie resource bundles in iso-8859-1 encoding, problem comes converting iso-8859-1 encoding utf-8 you can convert these characters escaped unicode representation using 1 of these tools: native2ascii or anyedit using nonstandard characters in resource bundles

.net - Hosting WCF in IIS 7.5 vs Windows Service for Performance Considerations -

i have simple , direct question: there performance benefits (or other type of benefit) unaware of when comparing hosting of wcf service in iis 7.5 vs. windows service? i not in dark on topic , have hosted several wcf services in both hosting environments. start new service has heavier use , wanted 're-visit' topic. right leaning twoard windows service. i have read posts following: iis wcf service hosting vs windows service gives information, bit out of date (yes @ 1.5 years old; still using codename 'dublin technologies'). there no ding against windows services me because quite comfortable setup, deployment, , configuration (including applying ssl cert port hosting wcf service), not big deal me vs. iis. i thought application recycling in iis downside hosting wcf service, allowing potential small possible breaks in communication. know .asmx iis hosted service (converting wcf) have receives random '401 unauthorized' (i mean random every 5-10,000 ca

hibernate - query with criteria on associated objects -

i've been struggling hibernate query problem , i'm hopeful can nudge in right direction. i have object named flashcard has associated objects named tags. flashcard can have 1 or more tags (kind of how stackoverflow question can assigned multiple tags). i'm trying use hibernate return flashcards assigned specific tags. example, query flashcards have both "tag2" , "tag4". i've tried approach criteria queries, example queries , hql without luck far. here's database looks like: mysql> select * flashcard; +--------------+------------+----------+ | flashcard_id | question | answer | +--------------+------------+----------+ | 1 | question 1 | answer 1 | | 2 | question 2 | answer 2 | | 3 | question 3 | answer 3 | | 4 | question 4 | answer 4 | +--------------+------------+----------+ 4 rows in set (0.00 sec) mysql> select * tag; +--------+------+ | tag_id | name | +--------+------+ |

click on one of the buttons in a jQuery UI dialog -

a question jquery ui dialogs. i'm creating auto-login feature , want give visual feedback. login done jquery ui dialogs. question: how force click on submit-button? in samples on site form hasn't got properties set, there must function triggered when button clicked manually. i want program click on 1 of buttons in jquery ui dialog. anyone knows how this? when open dialog can find buttons , add ids on them select using # . this option on dialog() function. open: function () { //assign ids/classes buttons var buttonpane$ = $(this).siblings('.ui-dialog-buttonpane'); var okbutton = buttonpane$.find('button:contains("ok")'); okbutton.addclass('ui-priority-primary'); okbutton.attr('id', 'youridhere'); } when need trigger click use $('#youridhere').click(); edit if create function outside of dialog, can add dialog option

fonts - Diamond-question-marks in Visual Studio -

Image
i'm running visual studio 2005 first time on new machine (an hp thin client accessing virtual machine on hp sam client software). when execution halts on exception, text line appears below. appears can't find characters in font variant or something, can't figure out. i tried changing font courier new other ones, , made no difference. same character showed in alternate font. wasn't sure try searching on here or google one. update: i'm seeing in various other places in code, @ design-time. appears linked specific font attribute, though haven't been able tell which. update 2: i'm not sure whether surprising or not, copying , pasting question marks application works though there's no problem. update 3: on same machine, visual studio 2008 behaves expected (that say, normally). provide additional details on vs2005, i'm running version 8.0.5727.42. updating visual studio 2005 sp1 fixed bug. our default installation outdated versi

swing - java DefaultListModel -

if(incasationbegin > 0) { int anwser = joptionpane.showconfirmdialog(null, config.question,"confirm", joptionpane.yes_no_option); if(anwser == 1) { jlist0.setselectedindex(incasationbegin); return; } } incasationbegin = jlist0.getselectedindex(); how setselectedindex without calling jlist0listselectionvaluechanged action? because when click on option confirm popup , when click no, new item still selected. have tried add incasationbegin =0; before return, on first click confirm popup. let me see if understood correctly. adding listselectionlistener jlist , want prevent call setselectedindex firing valuechanged event, it? you can try lot of different approaches here: delay call jlist0.addlistselectionlistener(... in such way no listener exists when call setselectedindex . have listener valuechanged method check "enabled condition", example read boolean isenabled . set condition false before calling setselectedinde

How to establish an ssh connection in a Lua script to execute a command on a remote server? -

i want write script in lua establishing ssh connection execute command on remote server can give me hint thank you you can use os.execute ('ssh user@127.0.0.1') make connection, may have use os.execute ('ssh user@127.0.0.1 &'..yourcommand) make execute afterwards in shell, i'm not entirely work. maybe better create script in bash , execute lua. if needed run differing commands, have script receive arguments.

java - How do I remove quotes from a boolean value in a JSON string? -

i have: string example = {"test":"true"} but want have: example = {"test":true} how can convert first string second? use regular expression and/or string class method 'replaceall'.

c# - Detect adding control to form -

hi write component , need when 1 control add form detect event , add control component list , possible ? (design time) excuse me poor english tnx do mean system.windows.forms.control.controladded event? edit: event raised in designtime either. i created form2 class: public partial class form2 : form { public form2() { initializecomponent(); this.controladded += new controleventhandler(form2_controladded); } void form2_controladded(object sender, controleventargs e) { this.text += " " + e.control.name; } } and created form3 class derived form2 class. public partial class form3 : form2 { public form3() { initializecomponent(); } } after recompiled solution, opened designer of form3 class, added new button toolbox , text property of form changed "form3" "form3 button1".

php - One-to-one association in form? -

in symfony 2.0, how create drop down list using one-to-one association in form? can guys put example please? i try answer question way understand it. let's have faculty object bound single university object. in form used create or edit faculty, display combo box of university in database , user choose 1 among them. there 1 special symfony field type this: entity type. below code of buildform method use in facultytype object used create faculty form: // application\acmebundle\form\type\facultytype public function buildform(formbuilder $builder, array $options) { $builder->add('name'); $builder->add('university', 'entity', array( // class of entity used combo box item 'class' => 'acmebundle:university', // property of entity displaying entity text 'property' => 'name', // query builder used populate combo box, accepts // querybuilder object

ruby on rails 3 - Rails3 and Heroku: Sending Emails? -

i have deployed beta app heroku , reading articles sending emails. don't imagine generating more 100 per day. there seems 2 routes suggest: 1) sendgrid add-on article 2) using gmail article 3) have own non-rails web hosting package - use this? does have experience of using either of these? considered better/easier manage? on heroku recommend sendgrid on gmail solution. sendgrid integrated , won't touch 200 emails limit. currently, use both: sendgrid communityguides on heroku , gmail local testing. sendgrid painless set up.

ruby on rails - IN clause using active record query base in order to create list of integers -

i trying replicate sql functionality using activerecord. problem relates use of ruby join method (not confused sql join). here code: scope :stats_tips_given, lambda { |date| where("created_at >= ? , tipper_id in(?)",date, user.stats_users(date).collect(&:id).join(', ')) } however resultant sql query has result: select "tip_events".* "tip_events" (created_at >= '2011-04-14' , tipper_id in('4, 5, 11, 17, 22, 48, 54, 65, 88, 103, 147, 151, 181, 182, 189, 195, 190, 196, 202, 226, 227, 231, 243, 245, 232, 225, 212, 217, 220, 263, 265, 273, 281, 282, 284, 286, 293, 271, 299, 300, 309, 310, 312, 318, 321, 308, 303, 297, 333, 346, 362, 368, 377, 386, 389, 392, 353, 398, 427, 420, 434, 418, 454, 456, 477, 484, 480, 453, 450, 452, 458, 497, 498, 503, 510, 511, 515, 522, 529, 537, 540, 508, 499, 524, 521, 502, 542, 546, 548, 557, 559, 571, 575, 576, 581, 587, 562, 580, 544, 567, 565, 573, 577, 597, 606, 619, 620, 640, 636, 6

java - Help creating servlet in existing jsf project -

i'm trying create servlet inside jsf project. first servlet i've created , i'm using http://www.servletworld.com/servlet-tutorials/simple-servlet-example.html example me started. the thing folder structure little different because of existing jsf. i can form.html page display, when type name in , click submit, 404. my folder structure follows (only relevant files shown) catalog (my project in eclipse) - src - - b - c - catalog - backing - welcomeservlet.java - webcontent - catalog - form.html - web-inf - web.xml - classes - - b - c - catalog - backing - welcomeservlet.class here servlet mappings in web.xml <servlet> <servlet-name>welcomeservlet</servlet-name> <servlet-class>a.b.c.catalog.backing.welcomeservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>welcom

Running Batch Stript in Windows 7 causes process to be launched under wrong cmd process -

whenever run batch file on comuter (64 bit architecture running 64 bit windows 7), console window opened running in 32-bit mode, , checking task manager confirms indeed running 32-bit process. want run batch file under 64-bit process, not 32-bit process. have changed comspec environment variable point proper variable, no avail. know how fix when click on batch file, run in 64-bit mode. i realize open 64 bit command window , run batch file. however, workaround , doesn't @ root of problem, , won't when give file others. thanks, mm are file associations .cmd associated 32bit cmd.exe or 64bit cmd.exe?

spring ws - PayloadRootAnnotationMethodEndpointMapping not working -

i have pojo annotated @endpoint , @payloadroot , have payloadrootannotationmethodendpointmapping in spring configuration file getting error "no adapter found". you need both endpointmapping (which tells spring-ws which endpoint invoke), , endpointhandler (which tells spring-ws how invoke it). you have first 1 (the payloadrootannotationmethodendpointmapping ), need endpointhandler , such payloadmethodendpointadapter . from spring-ws 2.0 onwards, can declare <sws:annotation-driven/> , , it'll taken care of (see docs details ).

Can I use SQL functions in NHibernate QueryOver? -

i have been searching internet , can't find example on how use queryover of nhibernate 3.0 example use string functions on clause of queryover ex: var item = query.where(x => x.name.tolower() == name.tolower()).firstordefault(); but doesn't work, because nhibernate can't understand tolower, how can extend dialect in way becomes possible? session.queryover<foo>() .where(restrictions.eq( projections.sqlfunction("lower", nhibernateutil.string, projections.property<foo>(x => x.name)), name.tolower())) should sql where lower(name) = @p0

multitasking - how to tell if app was launched from closed or background on iphone? -

hi there specific delegate method called when app brought foreground background on ios? reason being want perform different actions when app launched , when resumed background? many thanks jules when you're coming background, applicationwillenterforeground: called. when starts "from closed", applicationdidfinishlaunching: called.

java - Regarding hibernate caching -

here scenario: i select records database, 1000 records. operations on result set, insert 1 more record in or update existing record. the entire above mentioned process repeat multiple times, 2000 times. (i.e. again select records, need not same records every time) i sure can use sort of caching better performance. don't know how. can guide me? when use hibernate, using 2 caches. first session cache. let's query 2000 records, update , save changes 5, , run same query again (all in scope of single session). hibernate not run query second time - knows have 2000 records (and 5 edits) loaded memory. cache turned on automatically - can't turn off, it's part of hibernate's core functionality. need close (or @ least flush) session ensure changes applied - don't want open 1 giant session , keep changing things or run out of memory. the second level cache puts key-value store in between application , database. cache longer-lived, , multiple sess