Posts

Showing posts from April, 2012

c++ - Difference between QSharedPointer and QSharedDataPointer? -

what difference between these 2 types of pointers? far can read, qsharedpointer can handle situation well, need qshareddatapointer? from qt documentation qshareddatapointer the qshareddatapointer class represents pointer implicitly shared object. qshareddatapointer makes writing own implicitly shared classes easy. qshareddatapointer implements thread-safe reference counting, ensuring adding qshareddatapointers reentrant classes won't make them non-reentrant. implicit sharing used many qt classes combine speed , memory efficiency of pointers ease of use of classes. see shared classes page more information. example usage - #include <qshareddata> #include <qstring> class employeedata : public qshareddata { public: employeedata() : id(-1) { } employeedata(const employeedata &other) : qshareddata(other), id(other.id), name(other.name) { } ~employeedata() { } for qsharedpointer the ...

c - How to wrap a void* pointer into a TCL Object -

i'm trying save void* pointer (or pointer) tcl object can retrieve later. saw swig convert string encoding , later decode it. in order make more efficient, want directly pointer in , out of tcl obj. tcl_getpointerfromobj(). there anyway it? need dig tcl_obj structure , dirty work? i suggest reading this page on tcler's wiki on topic.

mysql - reducing execution time of indivual php files that are not mandatory to the system like Ajax JSON requests -

i want make sure ajax responses dynamic json pages not slow down server when sql queries take long. i'm using php, mysql apache2. had idea use ini_set() recude execution of pages inline use of mentioned method or set_time_limit() method. effective? alternatives or mysql syntax equivalent query time? these being used example jquery ui autosuggestions , things better not work if gonna slow down server. if makes sense application, go ahead , set_time_limit desired max execution time. however, makes more sense tweak queries , introduce caching of query results.

node.js - nodejs (nodejs.org/) experience / comments -

has experience nodejs? how performance? memory management? i'm looking technology allows me create real-time web app tracking system , chat. if considered , decided don't use it, did use? memory node.js' strengths come ability keep a lot of connections open , idle. instance apache need connection limit (sometimes it's low 20 concurrent connections, depending on server environment) because allocates 2 mb of memory each connection, node.js doesn't need that. apache doesn't keeping connections open because of problem, , keeping connections open becomes hassle. a node app programmed single thread (though in background uses threads various blocking operations, not on per-connection basis). if you've programmed in erlang may know how liberating not having care other agents (or connections) doing, while still being able share data between (virtual) instances without effort. in theory node can handle many connections max number of file descri...

arrays - Java Reflection API - Getting the value of a String[] field -

i wondering if possible grab string[] of unknown size class using java reflection api , store elsewhere? thanks. class foo { private string[] bar; public foo(string[] bar) { this.bar = bar; } public static void main(string[] args) throws exception { foo foo = new foo(new string[] {"a", "b", "c"}); field barfield = foo.class.getdeclaredfield("bar"); string[] bar = (string[]) barfield.get(foo); system.out.println(arrays.tostring(bar)); // [a, b, c] } } in addition getdeclaredfield(string) , there's getfield(string) , getfields() return public fields getdeclaredfields() fields class declares.

Issue in android list -

i have list view , listening using key listener keycode_5. issue facing whenever press 5, function onkey() (inside listener) called twice. idea? could not checking wether the event fired keyup or keydown? if need catch event keydown create eventhandler this: public boolean onkey(view v, int keycode, keyevent event) { // if event key-down event on "5" button if ((event.getaction() == keyevent.action_down) && (keycode == keyevent.keycode_5)) { // perform action on key press // event code goes here return true; } return false; }

query a mysql table for rows that have the same month value and store as a php array for later use displaying them on a calendar -

the subject sums up, working on calendar in php client should pull events table , display them in appropriate cells. the calendar table working no prob, trying avoid making separate db call each day of month. i trying figure out way store results in array of arrays first, calendar created, each day has event(s) display portion of data there. it's conceptual problem having , can't seem solve it. also, not sure if it's possible. any appreciated. thanks. for example: select day, title, desc month = $month , year = $year order day asc and output without hitting db 31 times: day1. title / desc day2. title / desc <br> title / desc day3. title / desc you can 1 query events in mounth, like write select day, title, desc mytable month = $month , year = $year order day asc and in foreach loop on results, store in array like while ($row = mysql_fetch_array($result, mysql_assoc)) { $events[$row['day']][] = $row; } so in...

javascript - Tab focus granting event -

i need capture tab focus granting event in firefox browser. there type of listener implement event? the detecting tab selection section of tabbed browser article explains how detect when tab selected.

jquery - How do I assign a real function into a javascript object to use as a callback? -

i've got javascript mess looks like: note: not working code, trying illustrate problem... $(function() { $(foo).something( { //something grid control buttons: { add: { onclick: function() { //build dialog box add stuff grid $('<div></div>') .html('...') .dialog({ buttons: { done: { //finished button on dialog box onclick: function() { $(this).dialog('close'); } } } }); } } } } ); }); i'd replace of function(){...} s real functions, clean things bit , rid of indenting. how assign real function 1 of callbacks rather anonymous function? function abc(){ return false; }...

java - Hashed passwords updated through JDBC become corrupt. (More of encoding problem than hashing) -

i've tried following mysql utf-8 , latin-1, no avail. i hash passwords (in case tosecurify) using sha-1 so: if(tosecurify == null) { throw new exception("tosecurifystring must not null"); } try { messagedigest messagedigest = messagedigest.getinstance("sha-1"); byte[] sha1hashbytes = new byte[40]; messagedigest.update(tosecurify.getbytes(), 0, tosecurify.length()); sha1hashbytes = messagedigest.digest(); return new string(sha1hashbytes, "utf-8"); } catch(nosuchalgorithmexception nsae) { throw new exception("hash algorithm not supported."); } catch(unsupportedencodingexception uee) { throw new exception("encoding not supported."); } then store in mysql database password column. now here's tricky part can query db kind of like: there record username=<insertusername> , password = thathashfunctionupthere(<insertpassword>); this works great. but now, updating records l...

oop - how python manage object delete or destruction -

guys, rather new python , learning build gui application (with wypython). have question related object destruction in python. e.g. in myframe have onnew (create new document) , onopen (open file) method. briefly, looks this. def onnew self.data=datamodel() self.viewwindow=viewwindow(self.data) def onopen dlg = wx.filedialog(self, "open file", os.getcwd(), "", "*.*", wx.open) if dlg.showmodal() == wx.id_ok: self.data=datamodel.from_file(...) self.view=view(self.data) now, want consider "if user click open or new again, after click either before." so window classes, call self.viewwindow.destroy() destry windows. data model object? if first call new: self.data=datamodel() , call open , re-assign self.data=datamodel.from_file(...) , old instance? need destruct myself or python manage destruction? python has garbage collection. long don't have references old object hanging ar...

has and belongs to many - Adding an object in a has_and_belongs_to_many association with Rails -

i have simple has_and_belongs_to_many association between users, works perfectly. however, add friendship relation between new users created , first user (yup, myspace's tom), directly in create method: def create @user = user.new(params[:user]) if @user.save @user.friends << user.find(1) redirect_to root_path else render :action => :new end end i don't understand why doesn't work. no error, nothing, doesn't add first user new user's friends. (for information, i'm using rails 2.3.4) what should do? kevin first, fire script/console , check whether associations working correctly in console. second, must arrange code association between user , friends before save command.

java - Android device to PC's socket connection -

i facing problem establish socket connection android device pc's specific port 8080 . want create socket connect specific port , write data stream on port. i have written code purpose code giving me exception as: tcp error:java.net.connectexception:/127.0.0.1:8080-connection refused i giving code below: private static textview txtsendstatus; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); initcontrols(); string sentence = "tcp test #1n"; string modifiedsentence; try { socket clientsocket = new socket("192.168.18.116", 8080); dataoutputstream outtoserver = new dataoutputstream(clientsocket.getoutputstream()); bufferedreader infromserver = new bufferedreader(new inputstreamreader(clientsocket.getinputstream())); printscr(...

javascript - Trigger event on body load complete js/jquery -

i want trigger 1 event on page load complete using javascript/jquery. is there way trigger event or call simple function once page loading completes. please suggest folks if reference. everyone's mentioned ready function (and shortcuts), earlier that, can put code in script tag before closing body tag (this yui , google closure folks recommend), this: <script type='text/javascript'> pageload(); </script> </body> at point, above script tag available in dom. so options in order of occurrence: earliest: function call in script tag before closing body tag. dom is ready @ point (according google closure folks, , should know; i've tested on bunch of browsers). earlyish: jquery.ready callback (and shortcut forms). late, after all page elements including images loaded: window onload event. here's live example: http://jsbin.com/icazi4 , relevant extract: </body> <script type='text/javascript'> ...

jQuery Selector: How to select the children of just THIS element -

so, have code looks this: <span class="comic_menu mid_menu_title"> <ul> <li class="level-0 page_item page-item-264"><a href="http://www.domain.com.php5-15.dfw1-1.websitetestlink.com/wordpress/?page_id=264" title="ca$h rulez">ca$h rulez</a> <ul class='children'> <li class="level-1 page_item page-item-266"><a href="http://www.domain.com.php5-15.dfw1-1.websitetestlink.com/wordpress/?page_id=266" title="1994">1994</a></li> <li class="level-1 page_item page-item-268"><a href="http://www.domain.com.php5-15.dfw1-1.websitetestlink.com/wordpress/?page_id=268" title="1995">1995</a></li> <li class="level-1 page_item page-item-270"><a href="http://www.domain.com.php5-15.dfw1-1.websitetestlink.com/wordpress/?page_id=270" title="19...

python - how to send the output of pprint module to a log file -

i have following code: logfile=open('c:\\temp\\mylogfile'+'.txt', 'w') pprint.pprint(dataobject) how can send contents of dataobject log file on pretty print format ? pprint.pprint(dataobject, logfile) see the documentation

jquery - Image upload, resolution check, crop and preview. PHP -

i looking solution upload image, check resolution crop if necessary then preview image before gets printed onto canvas. i have found loads of examples of nothing straight forward, plus don't want rip off elses work. asp not option site uses php , on 'nix box. any pointers appreciated. basically file need posted php script. can html forms( input type='file' ) or jquery background uploaders . uploads stored default in temporary directory of web server, current directory can found looking @ output of phpinfo() . next check out $_files global move_uploaded_file() , can find image type type key in $_files array, though can manipulated client side it might better check file type manually using magic byte functions . once have file uploaded need manipulate it. can use either gd or imagemagick , imagemagick may not built-in php version, gd pretty common. more familar gd, i'll suggest check out functions imagecreatefromjpeg() /png/gif & imagecop...

XSLT 1.0 - Create node set and pass as a parameter -

using xslt 1.0, i'm trying create small node set , pass parameter template, following: <xsl:call-template name="widget"> <xsl:with-param name="flags"> <items> <item>widget.recent-posts.trim-length=100</item> <item>widget.recent-posts.how-many=3</item> <item>widget.recent-posts.show-excerpt</item> </items> </xsl:with-param> </xsl:call-template> the idea within widget template write like: <xsl:value-of select="$flags/item[1]" /> obviously compile errors.. how can achieve sort of thing? there way (non-standard) in xslt 1.0 create temporary trees dynamically , evaluate xpath expressions on them, however requires using xxx:node-set() function . whenever nodes dynamically created inside body of xsl:variable or xsl:param , type of xsl:variable / xsl:param rtf (result tree fragment) , w3 xslt 1.0 spec. limits severyly kind o...

How do I register a new user in eJabberd server through C# Client? -

i'm developing messenger type application jabbernet server & library. i'm having problem registering new users. first of want know, required login admin register new user? i tried register , without admin login " not authorized ". jid jid = new jid("test4", server_ip_address, ""); jclient.user = "test4"; jclient.password = "test4"; jclient.autologin = false; jclient.onloginrequired += new bedrock.objecthandler(this.onloginrequired); jclient.onregisterinfo += new registerinfohandler(this.onregisterinfo); jclient.onregistered += new iqhandler(this.onregistered); jclient.connect(); jclient.register(jid); jclient.close(true); return true; what doing wrong? you not providing host name, required register method try using full explanation in parameters must pass register method, @ least far understand question.

FMDB open database -

i'm trying open database have in project inside resources. the problem seems impossible find database file! tried complete path, , works, not solution. i how open it! i'm using code: db = [fmdatabase databasewithpath:@"bbdd.sql"]; i don't know how find other part of "actual" path. do have solution me? thanks!!!! you need find full path of database in resource bundle, : nsstring *databasepath = [[nsbundle mainbundle] pathforresource:@"mysqlitedatabasefile" oftype:@"sqlite3"]; there's complete example in thread copying data application data folder on iphone

php - is it possible to pass parameters to an assoc array? -

think array this: ... "key1" => some_call("val1", $params), "key2" => some_call("val1", $params), ... now want pass parameters ($params) when addressing array entries $x = $array['key1'] , $params ... is there way this? update why this? using codeigniter , in language file assoc array, right side holds text in predicted language. want abuse little bit , want load email templates, pass parameter holds values shell replaced in template. update 2 for php 5.2.* since php 5.3 can use anonymous functions. maybe want this: <?php function some_call($arg,$params) { echo "$arg: ",count($params),"\n"; } $array = array( 'key1' => function($params) { some_call('val1',$params); }, 'key2' => function($params) { some_call('val1',$params); } ); $array['key1'](array(1,2,3));

iphone - Easy way to link UITableViewCell to Object property in CRUD using Core Data -

first, have different forms generate automatically (uitableview). forms consits of textfields, pickers, , switches. generate them using self wrote plist file logic in it. second, have made objects fill via datamodel , work fine. now, it' time "the best practice" fill uitableviewcells objects , vica verca. what can do( dont't it) uitableviewcell *celltofillup = [self.tableview cellforrowatindexpath:0]; celltofillup = helloworldobject.property1; uitableviewcell *celltofillup = [self.tableview cellforrowatindexpath:1]; celltofillup = helloworldobject.property2; ... but looks silly. there way handle this? thanks

jQuery across models in Ruby on Rails -

i have rather simple ruby on rails application : 2 models lists , items . lists have many items , items belong lists . ok. the show method of listscontroller prints page list of items belonging given list (in partial lists/_listofitems.html.erb ). @ end of show.html.erb view, there form lets users add item list. in standard (no jquery) ror, works perfectly. now, want let user add item list without reloading page. have managed jquery add item database problem refresh html list without reloading page. have managed have create.js.erb executed in itemscontroller , can make things appear on page problem create.js.erb lives in itemscontroller , not in listscontroller if try make create.js.erb render partial _listofitems.html.erb , fail since create.js.erb lives in itemscontroller , hence cannot access variables defined in show method of listscontroller . i guess work charm if using index method of itemscontroller display list of items since living in there might y...

Distributed system on Amazon EC2 -

how create cluster of computers in amazon ec2? best practices security? can access other machines in local network? thanks! the way aws likes utilizing security groups firewall. generally each instance has security group - minimum 1 called default . security group allows white-list others can connect to. the others include: single ip addresses ip networks other security groups everyone example database server: db.example.org security groups: default database two application servers: app1.example.org app2.example.org security groups: default appserver i assume these instances run , have security groups associated them. if not -- it's pretty trivial using aws console. let me know if need pointers. in examples, use aws ec2 cli tools . first, open port 80 (web) on appservers everyone: ec2-authorize appserver -p 80 this cli command ec2-authorize , can on aws console well. above command allows connect port 80 on instances when ha...

fontfamily - Flex: How Do I Reference the System Font? -

i've embedded font in component. of text in component uses embedded font. but, want button use standard system font. how set button's fontfamily system font? <mx:button label="hello" fontfamily="?" /> thank you. -laxmidi don't specify font family style, , fall on defaults of framework. look @ fontfamily style documentation here: http://help.adobe.com/en_us/flashplatform/reference/actionscript/3/mx/controls/textinput.html?filter_flex=4.1&filter_flashplayer=10.1&filter_air=2#top the default font halo theme "verdana". default font spark theme "arial".

inputstream - How to store large blobs in an android content provider? -

i have large files (images , video) need store in content provider. android documentation indicates... if exposing byte data that's big put in table — such large bitmap file — field exposes data clients should contain content: uri string. field gives clients access data file. record should have field, named "_data" lists exact file path on device file. field not intended read client, contentresolver. client call contentresolver.openinputstream() on user-facing field holding uri item. contentresolver request "_data" field record, , because has higher permissions client, should able access file directly , return read wrapper file client. -- http://developer.android.com/guide/topics/providers/content-providers.html#creating i having difficulty finding example. in particular wish use bitmap in context imageview. consider following code quasi-code (it doesn't work)... imageview iv = .... string iconuri = ...

java - Processing for Android and regular input apps -

processing has android support , seems pretty awesome 10 minutes of playing it. make regular (nongraphics) application twitter feed reader or something. there processing can regular apps? besides titanium... basically looking make coding android easier, processing easy working happy it, graphics only. titanium didn't give me same wow factor , isn't open kind of takes away it. other tools out there? i'm going give answer looking , advice. processing can of things thinking doing. if want textboxes etc, can use control p5 library . it's great. if expert @ processing , want port on processing code android, processing android great. but that's not want do. want write application. , want write on android. there frameworks designed give leg in writing cross-platform mobile apps , nothing going make writing android application easier learning java , learning how android stack works. it's designed , easy follow once start grokking "inten...

python - How to change text on gtk.label in frequent intervals - PyGTK -

i coding desktop application shows contents text file in gtk.label, update text file, once in every 15 mints. are there methods make application read text file in constant intervals , display without restarting window on platforms, can call gobject.timeout_add() read file every once in while, or gobject.idle_add() mtime check when app idle. on linux, i'd recommend using pyinotify monitor file , re-read when it's updated.

c# - Generalize an algorithm that needs to work on different data members -

i have piece of code this: void somealgorithm(sometype somevar) { somevar.somemember = createsomevalue(); lock(something) { sometype someothervar = something.find(somevar.unrelatedmember); if(someothervar != null) someothervar.somemember = somevar.somemember; } } (i needed adapt bit posting, please bear me if messed in doing so.) now need exact piece of code another member of somevar (which has related, different type) , another creation function . know can take code, copy it, replace few identifiers, , done. feel dirty doing so. feel there should way generalize little algorithm. i know can pass creation function delegate, don't know how generalize member access , there's issue of members (and creation functions) having different types. in c++, use member pointers combined templates doing this. member pointers aren't piece of cake use, once had looked weird syntax, i'd done within few minutes. how in c#? edit: since doesn't s...

php - How to create directory like urls for each page on a website -

i have content site spreads across multiple pages there 1 index.php file retrieves data database based on page no. currently url direction has domainname.com/page/content.php?page=3 i have noticed, quite few sites have directory structure urls like: domainname.com/page/3 i know how change domainname.com/page/?page=3 looking remove ?page part. how can this, without individually creating directory each page, content keeps growing, hence changes each page. thanks these sites use mod_rewrite "rewrite" on requested url using regular expression edit: rewriting this: domainname.com/page/3 to that: domainname.com/page/content.php?page=3 would in .htaccess file: <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([a-za-z]*)/(.*)$ /content.php/$1/page=$2 [l] </ifmodule> <ifmodule !mod_rewrite.c> errordocument 404 /error_with_mod_rewrite...

python - How do I use regular expressions to parse HTML tags? -

was wondering how extrapolate value of html element using regular expression (in python preferably). for example, <a href="http://google.com"> hello world! </a> what regex use extract hello world! above html? regex + html... but beautifulsoup handy library. >>> beautifulsoup import beautifulsoup >>> html = '<a href="http://google.com"> hello world! </a>' >>> soup = beautifulsoup(html) >>> soup.a.string u' hello world! ' this, instance, print out links on page: import urllib2 beautifulsoup import beautifulsoup q = urllib2.urlopen('https://stackoverflow.com/questions/3884419/') soup = beautifulsoup(q.read()) link in soup.findall('a'): if link.has_key('href'): print str(link.string) + " -> " + link['href'] elif link.has_key('id'): print "id: " + link['id'] else: ...

java - Implementing interface with generic type -

i'm trying implement spring's rowmapper interface, however, ide prompting me cast return object "t" , don't understand why. can explain i'm missing? public class usermapper<t> implements rowmapper<t> { public t maprow(resultset rs, int row) throws sqlexception { user user = new user(); user.firstname(rs.getint("fname")); user.lastname(rs.getfloat("lname")); return user; // why being prompted cast "t", should fine? } } if row maps user, should rowmapper<user> ie: public class usermapper implements rowmapper<user> { public user maprow(resultset rs, int row) throws sqlexception { user user = new user(); user.firstname(rs.getint("fname")); user.lastname(rs.getfloat("lname")); return user; } }

sql server - Create Sql Database Tables from Business Objects -

what best way create sql server tables business objects. example i'm writing application has user object store user information. what's best practice creating tables these objects? create objects first , define database or there tool transform business objects tables? i'm curious how others doing type of task. use orm (object-relational mapping) tool, list tools several languages can found here: http://en.wikipedia.org/wiki/list_of_object-relational_mapping_software

unreported exception java.io.IOException -

Image
what's wrong code import java.io.ioexception; import java.net.serversocket; import java.net.socket; /** * * @author master */ public class server { try { serversocket s = new serversocket(3333); socket = s.accept(); } catch(ioexception e) { system.out.println("ioerror"); } } firstly wrote code without try catch , got unreported exception java.io.ioexception; must caught or declared thrown error netbeans didn't suggest add try-catch block . added try-catch block manually still shows error , suggests must add try-catch block ! you're trying add try block @ top level of class - can't that. try blocks have in methods or initializer blocks. if really want create server socket on construction, put code in constructor: public class server { private serversocket serversocket; private socket firstconnection; public server { try { serversocket = new serversock...

php - Help comprehending how the following framework fits together: -

i getting oop , framework design. have started using following 3 tutorials; http://net.tutsplus.com/tutorials/php/creating-a-php5-framework-part-1/ http://net.tutsplus.com/tutorials/php/create-a-php5-framework-part-2/ http://net.tutsplus.com/tutorials/php/create-a-php5-framework-part-3/ this first framework have tried work , because tutorial not aimed @ complete novices finding myself having reverse-engineer code see how works. problem i'm stuck. first, understand basic concepts of framework including directory structure. second, understand registry , database class (although don't understand every function within them yet). my problem comes index.php, template.class.php , page.class.php files. broadly know each should (although further explanation nice!) not how fit i.e. how index page interact template , page objects produce page displayed. cannot work out in order called. the index appears me as: require registry class create instance of registry (don...

sketchflow - How to set a State when clicking on a cell in a DataGrid -

while working on silverlight4 sketchflow prototype have datagrid has column of hyperlinkbuttons. set state when 1 of these buttons clicked. doesn't appear controls inside datagrid exposed drop behavior on them. there way this? essentially, trying set state can add window display detail data selected row. maybe there better way tackle problem in sketchflow? thanks! bill campbell i have see exact xaml, going assume couple of things, importantly hyperlinkbuttons produced template. if case, behavior needs specified in template rather directly in datagrid. if post xaml page, should able further.

load web page into jquery ui -

is there anyway of loading web page different domain jquery ui dialog? only if you're using <iframe> or proxying content through own domain, otherwise you're blocked same-origin policy . example: $('<iframe src="http://www.google.com" />').dialog();

How to start jquery datepicker with focus -

i'm new jquery , start datepicker focus. my first textbox date field , have tried give box focus javascript datepicker won't come unless click somewhere else on page , give focus clicking inside box. is there way start datepicker focus , maybe have widget start when page loads drop focus when user leaves box? $( "#date" ).datepicker({ dateformat: "mm-dd-yy" }); try - http://www.jsfiddle.net/wnuwq/embedded/result $(document).ready(function() { $("#datepick").datepicker({ dateformat: "mm-dd-yy" }); $("#datepick").focus(function() { $("#datepick").datepicker("show"); }); $("#datepick").focus(); }); edit: .ready() function of $(document) object fired when dom loaded in browser. first attach datepicker input , , attach focus eventhandler shows datepicker , last set focus on input. this chained 1 line in: $(document).ready(functio...

iphone - UINavigationController Problem -

in view controller adding uinavigationcontroller , has around 20-30 pixels on top of it. doesnt fit navigationcontroller properly. soem reason adds subview 20-30 px below navcontroller = [[uinavigationcontroller alloc] init]; navcontroller.navigationbar.tintcolor = [uicolor graycolor]; unitviewcontroller *unitcontroller = [[unitviewcontroller alloc] init]; [navcontroller pushviewcontroller:unitcontroller animated:yes]; [self.view addsubview:navcontroller.view]; any idea? if full screen app perhaps unitviewcontroller's view not setup correctly. may assuming presence of status bar , leaving room it.

Resolve selected merge conflicts using p4merge in GIT -

is there way resolve selected file having conflicts using p4merge in git? lets there 25 conflicts , each conflict has resolved each developer, if developer runs 'git mergetool' p4merge setup starts first conflict. conflict maynot related developers, searching way dev can resolve specific conflicted file using p4merge tool invoked unix. or there way git show version/commit of $base $local $remote can use in gui mode of p4merge resolve conflict. have looked @ this: http://www.andymcintosh.com/?p=33

regex - Emacs Lisp Align Keybinding Definition in init file -

i have following line in emacs init file. (global-set-key (kbd "c-x r") 'align-regexp) is there way hard-code in particular regex don't have specify every time? you create own command hard-coded regexp so: (defun align-specific-regexp (beg end) "call 'align-regexp regexp ..." (interactive "r") (align-regexp beg end "^some.*regexp\\(here\\)?"))

java - Access maven project version in Spring config files -

i display running version of web application in page. project based on maven, spring, , wicket. i'd somehow value of maven's ${project.version} , use in spring xml files, way use spring propertyplaceholderconfigurer read property file settings use in application. if had maven project.version available variable in spring config, this: <bean id="applicationbean" class="com.mysite.web.wicketapplication"> <property name="version"><value>${project.version}</value></property> </bean> how can this? you can use maven filtering suggested. or read pom.properties file created maven under meta-inf directory directly spring: <util:properties id="pom" location="classpath:meta-inf/groupid/artifactid/pom.properties" /> and use bean. the drawback of later approach pom.properties created @ package phase time (and won't there during, say, test ).

configuration - Configure or Create hudson job automatically -

Image
is there way create new hudson job 1 more hudson job based 1 previous jobs? for example if need create new bunch of jobs 1 one, automatically create 4 jobs similar configuration different parameter basically steps this create svn branch can call svn cp command , make parametrized using script create build based on new svnbranch name later tag or other word, need clone previous job , give new branch name ever $ branch comes in new job. thanks you can try hudson remote api kind of task ( setting hudson project ). see tutorial instance, , remember can display quite easily: java -jar hudson-cli.jar -s http://your_hudson_server/ so, copy job: java -jar hudson-cli.jar -s http://your_hudson_server/ copy-job myjob copy-myjob

c++ - QVariant to QObject* -

i'm trying attach pointer qlistwidgetitem , used in slot itemactivated . the pointer i'm trying attach qobject* descendant, so, code this: image * im = new image(); // here add data image object // create item qlistwidgetitem * lst1 = new qlistwidgetitem(*icon, serie->getseriesinstanceuid(), m_iconview); // set instance qvariant qvariant v(qmetatype::qobjectstar, &im) // "attach" variant item. lst1->setdata(qt::userrole, v); //after this, connect signal , slot ... now problem, itemactivated slot. here need extract image* variant, , don't know how to. i tried this, error: ‘qt_metatype_id’ not member of ‘qmetatypeid’ void mainwindow::itemactivated( qlistwidgetitem * item ) { image * im = item->data(qt::userrole).value<image *>(); qdebug( im->getimage().toascii() ); } any hint? image * im = item->data(qt::userrole).value<image *>(); the answer this // qvariant qobject * qobject * obj = qv...

Database Design - Column In One Table References Two Tables -

here example of have (take stack overflow). have 2 tables, questions , answers . have comments table. comments table reference both questions , answers. how should set database? have 2 columns in comments, questionid , answerid. have 1 table both questions , answers? have table in between somehow tells me question or answer? edit: found data explorer, uses 1 table both questions , answers ... don't posts table having many nulls in it. have negative effects, on performance? stackoverflow models questions , answers being same entity: posts . have identical properties, aside indicating answer accepted/granted. comments own table, , relate respective post using foreign key -- post_id . without needing load monthly dumps, you can view (and query) schema via stackexchange data explorer .

c# ASP.NET Controls collections code block nonsense -

what can cause: the controls collection cannot modified because control contains code blocks (i.e. <% ... %>). i ask because, code not contain code blocks. anywhere. there not single <%= %> block on page in entire site. have <%@ %> directive lines. edit: below code causing error. /// <summary> /// adds javascript variables page asp control id accessable via javascript. /// variable names asp_controlid. /// </summary> /// <param name="page">the page add javascript to</param> /// <param name="ctls">the controls make accessable</param> public static void addjavascriptids(page page, params control[] ctls) { literal litjs = new literal(); litjs.text = getjavascriptids(ctls); page.form.controls.add(litjs); ////////// <-- error here } /// <summary> /// returns string containing javascript allow javascript access /// asp controls. /// </summary> /// <param name="ctls...

javascript - How to replace src attribute name with data attribute name -

i have html document uses object tag src attribute. need replace src(attribute name) "data" (attribute name). is possible using javascript? referred shows can change attribute values, couldnt find method replace attribute node name. could please help you have src attribute value , set data attribute value. you can use .removeattribute() if want rid of src attributes. something this: var att = element.getattribute("src"); element.setattribute("data", att); element.removeattribute("src"); jsfiddle example if want bunch of elements, select them , loop. example going on div s: var att, i, elie = document.getelementsbytagname("div"); (i = 0; < elie.length; ++i) { att = elie[i].getattribute("src"); elie[i].setattribute("data", att); elie[i].removeattribute("src"); } jsfiddle example .getattribute() .removeattribute() .setattribute()

c# - How to dispose timer -

i have following code uses system.timers.timer: // instance variable timer inside method timer atimer = new timer(); atimer.elapsed += new elapsedeventhandler(onelapsedtime); atimer.interval = 300000; atimer.autoreset = false; atimer.enabled = true; while (atimer.enabled) { if (count == expectedcount) { atimer.enabled = false; break; } } and have following code handle event: private static void onelapsedtime(object source, elapsedeventargs e) { // } the question is: if timer event gets triggered , enters onelapsedtime, timer object stops , garbage collected? if not, can dispose of timer object/stop it? don't want timer creep , cause havoc in app. call timer.dispose: http://msdn.microsoft.com/en-us/library/zb0225y6.aspx private static void onelapsedtime(object source, elapsedeventargs e) { ((timer)source).dispose(); }

svn - Use user-environment variable in apache -

i create svn config file, use apache as: <location /svn/myproject> svnpath d:\svnserver\projects\myproject\svn authzsvnaccessfile d:\svnserver\projects\myproject\conf\access.conf include d:\svnserver\projects\myproject\conf\require_users </location> but root-path repeated much. i want set path environment variable simple config. setenvironment project_path d:\svnserver\projects <location /svn/myproject> svnpath $project_path\myproject\svn authzsvnaccessfile $project_path\myproject\conf\access.conf include $project_path\myproject\conf\require_users </location> is possible? how implement this? i tried setenv, setenvif of apache, couldn't success. please help. per documentation setenv : sets environment variable, passed on cgi scripts , ssi pages. so using setenv (and setenvif) makes var available scripts, not apache itself. unfortunately you're wanting isn't supported.

How to port Java interface codes into C++ abstract base class? -

im new in oop programming , c++ , im learning design patterns. just grab head first design patterns book learn from. great , im getting hold basic concepts.the first chapter talks programming interface rather implementation. unfortunately me though, examples uses java. below java code sample books using "interface", understand cannot directly ported in c++. ive tried implement c++'s abstract base class. im lost in setting quackbehavior dynamically. can c++ virtual functions definition dynamic? can please show me how best way port java code c++? need sure im on right track in learning oop. thanks! //flybehavior.java public interface flybehavior{ public void fly(); //the interface flying behavior classes implement } public class flywithwings implements flybehavior { public void fly(){ system.out.println("im flying!"); //flying behavior implementation ducks fly } } //quackbehavior.java public interface quackbehavior{ public vo...

What would make it easier to really work with Lua? -

i love lua, using more , more projects primary (not embedded) language. current project approaching 10,000 lines , end @ 15,000 lines. have found useful when developing in lua @ scale? have bumped head against, , solutions have found? i'm thinking development tools, language features & techniques, third-party modules? my top 3: strict.lua - use modified version of this. without being alerted accesses of unused/unintended variables i'd go crazy. coroutines - not multithreading capability, continuability. useful simplifying implementation of state machines. serialization function - indispensable dumping table contents, , persisting tables disk (i use many times when otherwise i'd have reached database). my wishlist: visual debugger os x. i'm using print()s now, debugger let me single-step through source files great. a continue statement. using repeat...until true workaround ugly, , many nested ifs becomes complex , ugly. a metamethod that's inv...

php - Flow for: fill form, make paypal payment, create account -

i've implemented paypal transaction before 1 has twist i'm not quite sure what's best way handle it. the basic idea want create account user when provides details , makes payment via paypal. until both user details filled out correctly , payment made correctly, shouldn't create account user. the setup i've done before paypal button user clicks, makes payment, , gets forwarded generic page "your order processed , shipped" there no pre-order form involved. this 1 different though because before paypal, need collect initial user data after paypal, need create new user account , use in user data collected pre-paypal form i'm sure there's logical way implement this, i'm not quite sure what's flow should follow it. i use zend framework way, shouldn't matter in case zend has easier way me i'm trying do. i following (though in asp.net): user fills out form info saved in order table in db unique invoice number...

java - How can I read file from classes directory in my WAR? -

i need read text file classpath in java war application. how can read inputstream. file located in /web-inf/classes/ folder, when use following code, returns null. inputstream input = servletcontext.getclass().getclassloader().getresourceasstream("my_filename.txt"); prefix forward slash denote root of classpath: getresourceasstream("/my_filename.txt") alternatively, can use serlvetcontext.getresourceasstream(..) looks resources relative context root. classes /web-inf/classes .

python - Appengine - Upload to Google Spreadsheet datastore values -

i´d know how upload google spreadsheet, values stored in database of application. objective: connecting google spreadsheet , automatically fill in chart in admin area values passed upload. i've been giving in docs , seems me have use bulk loader. way? if yes how configure handler if have spreadsheet link link text someone make script access google spreadsheet , pass values of model? model: class user (db.model): photo= db.blobproperty() name = db.stringproperty (required = true) surname = db.stringproperty (required = true) adress = db.postaladdressproperty (required = true) phone = db.phonenumberproperty (required = true) the bulk loader has nothing interacting google docs spreadsheet. used adding records application's datastore. to manipulate google spreadsheet, you'll need use google spreadsheet api , find on own using google. no 1 here going write code you. not free code-writing service. if write code doesn't work ,...

javascript - HTML5 canvas: Same code outputs different results in different browsers -

Image
in simple canvas test created performance , quality measurement purposes, canvas painted randomised colors , images during unlimited period. a sample shown here: http://litterific.com/minisite/ warning : open in opera or chrome, script pretty heavy can hang on slow computers, don't leave script running while getting coffee ;)) rough prototype , did not optimize it. what noticed here results painted script ( js/asset.js ) different in various browsers. in opera there more "green" in painting in chrome code found here: http://litterific.com/minisite/js/asset.js my question is: how caused. different random seeds? different rounding or different color behavior in opera? note: same script in both browsers, perhaps have @ in both chrome , opera. it's not random numbers causing problems, it's "funny" pixel data. here's change: for (i = 0, n = pixels.data.length; < n; += 4){ pixels.data[i + 0] = math.max(0, math.min...

php - Zend Framework Database Insert Issue -

i'm starting out using zend framework , have created suitable model saves data database table. issue having sql statement trying insert '?' value each column in database. have created following save function passes array of data dbtable adapter functions: public function save() { $data = $this->getdata(); if ($data['pageid']==0) { $this->getdbtable()->insert($data); } else { $this->getdbtable()->update($data, array('pageid = ?' => $data['pageid'])); } } this seems go through appropriate motions item not added database , sql statement within mysql logs looks like: insert db_table ('pageid','title','body') values ('?', '?', '?'); not quite sure falling down, pointers gratefully received. thanks data should in next format: $data = array( 'pageid' => 1, 'title' => 'title', 'body...

xsd - XML schema and problem when deriving from mixed type -

i have following xml schema: <?xml version="1.0" encoding="utf-8" standalone="no"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="content" type="contenttype"/> <xs:complextype name="contenttype"> <xs:complexcontent> <xs:extension base="versionedelementtype"> <xs:sequence> <xs:element name="item" type="itemtype" minoccurs="1" maxoccurs="unbounded" /> </xs:sequence> </xs:extension> </xs:complexcontent> </xs:complextype> <xs:complextype name="itemtype" mixed="true"> <xs:complexcontent> <xs:extension base="itemtypebase"> <xs:sequence> ...

ocaml - What are the pros and cons of Batteries and Core? -

in ocaml world @ present there appear number of competing extensions standard library, batteries , jane street core being major ones far can determine (i understand extlib has been subsumed batteries?). pros , cons of each one? equivalent? can coexist? make sense "mix , match" or should pick 1 , focus on it? core used outside of jane street? if makes difference on debian, windows support not factor me. thanks! caveat: i'm 1 of authors of batteries (although i've been out of touch year now) , author of page linked above. the big differences following: core used daily in industrial environment, while afaik batteries doesn't have same following core maintained 1 company, while batteries community-maintained afaik (but can wrong), core doesn't accept submissions or feature requests, while batteries does batteries aims accept program written ocaml's standard library, while core doesn't aim maintain backward-compatibility batterie...