Posts

Showing posts from September, 2013

java - What is the difference between Class.getResource() and ClassLoader.getResource()? -

java - What is the difference between Class.getResource() and ClassLoader.getResource()? - i wonder difference between class.getresource() , classloader.getresource() ? edit: want know if caching involved on file/directory level. in "are directory listings cached in class version?" afaik next should same, not: getclass().getresource() getclass().getclassloader().getresource() i discovered when fiddling study generation code creates new file in web-inf/classes/ existing file in directory. when using method class, find files there @ deployment using getclass().getresource() , when trying fetch newly created file, recieved null object. browsing directory shows new file there. filenames prepended forwards slash in "/myfile.txt". the classloader version of getresource() on other hand did find generated file. experience seems there kind of caching of directory listing going on. right, , if so, documented? from api docs on class.getresource() ...

Eclipse Pydev: 'Error: Python stdlib not found' -

Eclipse Pydev: 'Error: Python stdlib not found' - i trying add together interpreter (created using virtualenv) pydev next error: it seems python /lib folder (which contains standard library) not found /selected during instal process. this folder (which contains files such threading.py , traceback.py) required pydev function (and must contain actual source files, not .pyc files) ... note if virtualenv install, /lib folder base of operations install needs selected (unlike site-packages optional)... the problem there no /lib folder under default installation... created virtualenv 'no-site-packages' option... how can solve? thanks! i've come across myself before. when adding interpreter created using virtualenv in pydev, when asks folders need added scheme pythonpath, had select /usr/lib/python2.7 /usr/lib/python2.7/lib-tk /usr/lib/python2.7/plat-linux2 see screenshot had do. here temp virtualenv. even ...

gnuplot, not including a line in data fit -

gnuplot, not including a line in data fit - i have .dat file create in next format: q h error the first line of info not relevant fit. setting xrange not include undesired point, mean value not used in fit? there 2 main lines proceed: put # in front end of first line like: # q h error use every skip first line of info file so: plot 'data.dat' every 1::2 the same thing holds fit . info modifier not allowed fit smooth . gnuplot data-fitting

c# - What design pattern to use when I want only some derived classes to have access to a method in base class? -

c# - What design pattern to use when I want only some derived classes to have access to a method in base class? - i have unique problem/situation here. trying create simple possible. have base of operations class (say parent) , whole bunch of derived classes (say child1, child2 ..childn) straight deriving base of operations class (parent). want alter base of operations class , add together "averyprivilegedmethod" accessible child2 , child3 , not other children (or create configurable such in future child5 can utilize in future, minimal changes). design pattern /architectural pattern fit bill? language used - c#. ps: thinking using internalvisibleto realize gets applied @ assembly level it sounds though you're missing abstract class ( specialchild want of improve name) inherits parent child2 , child3 derived. parent | |------------------|------------|----------| child1 specialchild ...

drupal - How to set default input format for admin? -

drupal - How to set default input format for admin? - does know, how set default input format admin? i utilize tinymce. , when add together page, need "full html" input format (to add together image example). default "filtered html". can switch it, tinymce doesn't work then. also don't want set "full html" default. want tinymce used admin. thanks. for drupal 6, utilize improve formats (http://drupal.org/project/better_formats) specify default format per role , whole lot of other options. drupal drupal-6

How can I speed up my MySQL UUID v4 stored function? -

How can I speed up my MySQL UUID v4 stored function? - i'm attempting write mysql stored function generate v4 uuids described in rfc 4122's section 4.4 ( http://www.ietf.org/rfc/rfc4122.txt ). initial naive effort after few tweaks following: create function uuid_v4() returns binary(16) reads sql info begin set @uuid = concat( lpad( hex( floor( rand() * 4294967296 ) ), 8, '0' ), lpad( hex( floor( rand() * 4294967296 ) ), 8, '0' ), lpad( hex( floor( rand() * 4294967296 ) ), 8, '0' ), lpad( hex( floor( rand() * 4294967296 ) ), 8, '0' ) ); set @uuid = concat( substr( @uuid 1 12 ), '4', substr( @uuid 14 3 ), substr( 'ab89' floor( 1 + rand() * 4 ) 1 ), substr( @uuid 18 ) ); homecoming unhex(@uuid); end the above function quite slow: 100 times slower built-in uuid() , according mysql's benchmark() feature. short of writing udf u...

Show time delta in perl's template toolkit -

Show time delta in perl's template toolkit - i want supply integer template::toolkit template. integer represents number of seconds elapsed. i want format number so: 1 => "1 sec ago" 2 => "2 seconds ago" 43342 => "12 hours, 2 minutes ago" # ignoring remaining 42 seconds 4333342 => "1 month, 19 days ago" # ignoring remaining 17h, 42m & 22s i can't find tt plugin this. will need formatting outside of tt? thanks there's code comes close, if utilize datetime::duration represent duration. datetime::format::human::duration can of need, tend include additional parts of duration beyond interested in. because formatter object, duration, both can injected template variables. utilize duration units straight in template, lot of logic. time::duration improve precision thing, provide limit 2 unit types, doesn't have object interface, can't inject straight variable, might basi...

Python - Are there more search paths than in sys.path? -

Python - Are there more search paths than in sys.path? - i thought sys.path finish list of all search paths python modules. however, on ubuntu machine, '/usr/local/lib/python2.6/dist-packages/' modules , path not in sys.path. , can still import module on path. edit, not true: if set sys.path empty list, can still import path. where implicit knowledge of dist-packages path come from? , there other paths in implicit grouping of search paths, or whatever is? edit: seems sec part of post not true. indeed, "sys.path = []", mean can not import anything, not current working directory. apologies. note mention of installation-dependent default in following: 6.1.2. module search path when module named spam imported, interpreter searches file named spam.py in directory containing input script , in list of directories specified environment variable pythonpath . has same syntax shell variable path , is, list of directory names. when pyth...

python - SQLAlchemy ON DUPLICATE KEY UPDATE -

python - SQLAlchemy ON DUPLICATE KEY UPDATE - is there elegant way insert ... on duplicate key update in sqlalchemy? mean syntax similar inserter.insert().execute(list_of_dictionaries) ? on duplicate key update in sql statement if want generated sql include on duplicate key update , simplest way involves using @compiles decorator. the code (linked thread on subject on reddit) illustration can found on github: class="lang-py prettyprint-override"> from sqlalchemy.ext.compiler import compiles sqlalchemy.sql.expression import insert @compiles(insert) def append_string(insert, compiler, **kw): s = compiler.visit_insert(insert, **kw) if 'append_string' in insert.kwargs: homecoming s + " " + insert.kwargs['append_string'] homecoming s my_connection.execute(my_table.insert(append_string = 'on duplicate key update foo=foo'), my_values) but note in approach, have manually create append_string. al...

JavaScript && opertor in return statement -

JavaScript && opertor in return statement - i have piece of javascript code follows: function main(condition){ if(condition){ dosomething(); homecoming obj; } } now want refactor code rid of "if" statement. here want do function main(condition){ var dosomethingandreturnobj = function(){ dosomething(); homecoming obj; } homecoming status && dosomethingandreturnobj(); } here need help. caller of main function expects homecoming value of "undefined" or obj. in refactored code, return status && dosomethingandreturnobj(); convert homecoming value true , false type? thanks replies. javascript's && operator coalescing. js> 0 && 7 0 js> 1 && 7 7 javascript

c++ - Invoking VS debugger on process crash vista-win8k -

c++ - Invoking VS debugger on process crash vista-win8k - on xp, every time process crash os pop dialog asking if debug process. cant find way enable functionality on later version of windows. reiterate, want attach debugger native process that's auto broken on crash. does know how done? enable just-in-time debugging. edit: since doesn't work you, additional suggestions - make sure aedebug registry key values correct. setup wer create total crash dumps, , debug dumps. not sure this, possible user doesn't have debug permissions? have never checked that, assume prevent user beingness offered chance debug process (and if do, uac might circumvent them - don't know fact). c++ visual-studio debugging windows-7 windows-xp

django - replacement of the python facebook API? -

django - replacement of the python facebook API? - as stated in bug #17429, official back upwards python api ending, know of up-to-date facebook api python? or should language or web framework? according ticket back upwards sdk ends. whole facebook api language/technology agnostic , regular oauth-based restful one python django facebook api

parsing - Python script to extract new data from file since it was last read -

parsing - Python script to extract new data from file since it was last read - i working on python script following:- i read log file every 10 mins , on each read, extract added info file since lastly read (preferably without having read entire log file each time). example:- at 09:00 read log file , content is:- 1. 2011-07-04 11:15:04,507 processing request 17897931 status 7 13 2. 2011-07-04 11:15:04,508 processing request 17897931 status 13 17 3. 2011-07-04 11:15:04,508 processing request d0fcb681 status 7 13 4. 2011-07-04 11:15:04,509 processing request d0fcb681 status 13 17 5. 2011-07-04 11:15:04,509 processing request 178819a1 status 7 13 at 09:10 read log file 1 time again , content is:- 1. 2011-07-04 11:15:04,507 processing request 17897931 status 7 13 2. 2011-07-04 11:15:04,508 processing request 17897931 status 13 17 3. 2011-07-04 11:15:04,508 processing request d0fcb681 status 7 13 4. 2011-07-04 11:15:04,509 processing request d0fcb681 status 13 17 5. 2...

qt - QScrollBar Values Not Updating on QListWidget Resize -

qt - QScrollBar Values Not Updating on QListWidget Resize - i have qlistwidget populated names sits above qlabel. when name selected, text appears in qlabel detailing more info person. label becomes larger new info , forces qlistwidget shrink. interestingly, while playing around vertical scroll bar of qlsitwidget, noticed first name selected, maximum , pagestep values same before , after qlistwidget changes size. however, values updated 1 time name qlistwidget selected. is there way forcefulness these values update after qlistwidget size has changed? qt pyqt

php - How do I upload a simple swf for flash game site? -

php - How do I upload a simple swf for flash game site? - swf , want upload image file. codes follows. problem? if ($_files["o_img"]["error"] > 0 , $_files["o_swf"]["error"] > 0) { echo "return code: " . $_files["o_img"]["error"] . "<br />"; echo "return code: " . $_files["o_swf"]["error"] . "<br />"; } else { if (file_exists("../resimler" . $_files["o_img"]["name"]) , file_exists("../swf" . $_files["o_swf"]["name"])) { echo $_files["o_img"]["name"] . "bu isimde bir resim daha önce yüklenmiş "; echo $_files["o_swf"]["name"] . "bu isimde bir resim daha önce yüklenmiş "; } else { move_uploaded_file($_files["o_img"]["tmp_name"], ...

Django enumaration problem -

Django enumaration problem - i seek implement enumartion construction in django such that class status(): pending = 0 confirmed = 1 denied = 2 status =( (pending,_("salary_status_pending")), (confirmed,_("salary_status_confirmed")), (denied,_("salary_status_denied")), ) and in model utilize like class mymodel(models.model): status = models.integerfield(null=false, choices=status.status) it works fine , if want label of enum field in template utilize {{ mymodel.get_status_display }} , writes label _('key..') in enum field instead of number explained in django documents however, if want label in view.py ? want write code below , should give me label of enum field instead of number status.confirmed how can achive ? thanks how this? class mymodel(models.model): pending = 0 confirmed = 1 denied = 2 status = {pending:_("salary_status_pending"), confirmed:..., denied:...

sql server - How to check whether (var)char is a valid ISO date (112) -

sql server - How to check whether (var)char is a valid ISO date (112) - i have char(8) field should contain value in yyyymmdd dateformat. given (hypothetical) table id(int)|datestring(char(8)) able select id, isvaliddate(datestring) my_hypothetical_table it's of import me can run query (so could, example, select * othertable inner bring together hypothetical_table on hypothetical_table.id = othertable.hypothetical_fk isvaliddate(hypothetical_table.datestring) = 1 ). catching errors doesn't seem viable. note isdate() function works slash delimited dates, , not yyyymmdd formats. you may want add together check length if unsure values beingness 8 digits in length. declare @mytable table (id int, datestring char(8)) insert @mytable values (1, '20110711') insert @mytable values (2, '2011') insert @mytable values (3, '20110228') insert @mytable values (4, '20110229') insert @mytable values (5, '2011071') insert @my...

how do I export svn repository to git when I don't have svn credential? -

how do I export svn repository to git when I don't have svn credential? - i have total checkout of svn repository in folder. don't have credentials of svn repository(hosted in unfuddle). want move folder new git repostitory ( github) history , changes intact . if possible maintain commiters . how export exiting svn folder github ? an svn checkout not include it's own history, can treat normal set of files. git init newgit svn export yourcheckout newgit git commit -a newgit svn export re-create files except hidden .svn directories. git commit -a recursively add together alter command , commit it. you'll prompted commit note, of course. to publish github, first create business relationship @ github, go here create repository: http://help.github.com/create-a-repo/ let's called test , business relationship prabesh, it's total name git@github.com:prabesh/test.git the total details of shown on github when create repo, 1 time re...

iphone - iOS data management -

iphone - iOS data management - i'm writing simple ios app manage email address, maybe contacts. don't know best way organize info in ios , don't know database ios , xcode support. know ios supports xml & sqlite, there other databases supported? which best database (xml, sqlite,...) app? if going add together email , contacts suggestion utilize plist. http://developer.apple.com/technologies/ios/data-management.html iphone ios xcode data-management

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? - what difference between "some" == "some\0" , strcmp("some","some\0") in c++? why if("some" == "some\0") returns false , if(!strcmp("some","some\0")) returns true ? see next diagram. shows 2 strings in memory, content in box, beside box you'll see address of each one. when you're doing if("some" == "some\0") comparing addresses. translated if (0xdeadbeef == 0x0badcafe) false. when utilize strcmp , compare content of each box until reach \0 in each of them. that's why sec test returns true. if alter first test if("some" == "some") compiler may potentially see same strings , store them once. means test transform if (0x0badcafe == 0x0badcafe) true. c++ string comparison

orm - How to Ensure Fluent NHibernate Mappings and Migrations are in sync? -

orm - How to Ensure Fluent NHibernate Mappings and Migrations are in sync? - i utilize migrator dot net version database schema, , fluent nhibernate map models schema. is there (read: automated) way compare schema generated running migrations schema generated nh schema export ensure table definitions, keys, indices etc in sync? the thing can think of export both schemas, utilize unknown (answer if know one!) library script them out, compare script strings. is there improve way? edit: clarify, verify not tables, columns, , column types, indices , foreign keys. there schema validator in nhibernate: schemavalidator validator = new schemavalidator(configuration); validator.validate(); nhibernate orm fluent-nhibernate database-migration

ios - TableView scroll down event -

ios - TableView scroll down event - i using tableview in facebook application. i want show loader in header when @ first cell , scroll down. help? i used - (void)scrollviewdidscroll:(uiscrollview *)scrollview it's called every time scroll tableview . ios uitableview

android - Networkonmainthread exception while executing httprequest in a bound service from another service via aidl -

android - Networkonmainthread exception while executing httprequest in a bound service from another service via aidl - i have service binds service via aidl.the bound service executes httprequest , returns response when method invoked callign service via aidl. getting networkonmainthread exception while doing this. usage of asynctask failed here webservice query.any help appreciated :) android web-services exception aidl

How to tell Android NDK to use a different toolchain -

How to tell Android NDK to use a different toolchain - i've downloaded custom toolchain (linaro) build arm based android apps. how tell ndk utilize it? can define or set in android.mk , application.mk allow me that? there way? as other reply mentions, toolchains discovered ndk-build makefile scheme in $(ndk_root)/toolchains/ , can mirror ideas see there. there few concepts supporting non-android target platforms interesting although may outdated ndk-build starts explicitly back upwards other platforms, such mingw targeting win32 (or other gcc compilers targeting plain 'ol linux). in config.mk : toolchain_abis := (list of abis toolchain supports) this of import definition, because can utilize name in application.mk build using toolchain particular abi. 1 of benefits of corrupting usage of definition, ndk-build can simultaneously build multiple abis. always assumes platform android, if want target win32 using mingw based toolchain, can define "ab...

regex - How to write regular expressions in CSS -

regex - How to write regular expressions in CSS - how utilize regular expressions in css? found tutorial here matching static strings in css, haven't been able find 1 using regular expressions match multiple strings in css. (i found 1 here, couldn't work. looked @ w3c documentation on using regular expressions, couldn't create sense of document.) i'm want match series of <div> tags ids start @ s1 , increment 1 (ie. #s1 #s2 #s3 ...). i know div[id^=s] , div[id^='s'] , , div[id^='s'] each perform match intend in css. however, each of match id of #section , don't want happen. believe "/^s([0-9])+$/" equivalent php string--i'm looking in css version. there no way match elements regular expression, even in css3. best alternative utilize class div s. <style> .s-div { // stuff specific each div } </style> <div id="s1" class="s-div"><!-- stuff --></div>...

android - Should I use many simple listeners or one complex one? -

android - Should I use many simple listeners or one complex one? - i'm new developing in android although have much experience java , .net (but i've been on hiatus bunch of years). first time programming mobile platforms , have been thinking limited memory of these devices usual approach event-handling may not work here. usually, prefer have dedicated listener / event-handler each control, let's say, bunch of buttons. think easier maintain code , feels more object-oriented-like, say. but in java, each listener new instance of class, if have 20 buttons , 20 listeners, think i'm going spend more memory necessary. true? what pros , cons of using 1 listener these buttons? recommended practice? thanks. don't headache 20 listeners. memory footprint neglectable. seek take variant makes write less code , more robust , scalable. android events listeners

c# - Work out minutes difference between dates -

c# - Work out minutes difference between dates - i have next code: datetime pickerdate = convert.todatetime(pickerwakeupdate.selecteddate); string enteredstr = pickerdate.toshortdatestring() + " " + textwakeuptime.text; string format = "dd/m/yyyy hh:mm"; datetime entereddate = datetime.parseexact(enteredstr, format, null); the problem facing workout difference between set date , date , time now. value need provide me value of how many minutes there between dates. i tried using: datetime todaysdatetime = datetime.now; timespan span = entereddate.subtract(todaysdatetime); int totalmins = span.minutes; but gave me wrong value 0 when value set 10 minutes ahead. can help me solve this thanks. i think want span.totalminutes (i cant tell how many times has caught me out on timespan class!) for reference timespan.minutes - "gets minutes component of time interval represented current timespan structure." timespan.totalminutes...

encryption - Flex 3: is md5 possible? -

encryption - Flex 3: is md5 possible? - is there way utilize kind of encryption (md5, hash, etc...) determine if 2 arraycollections same or not? it looks there couple libraries generating hash. http://code.google.com/p/as3corelib/ edit: answered actionscript comparing arrays flex encryption

clojure - Best way to lazily collapse multiple contiguous items of a sequence into a single item -

clojure - Best way to lazily collapse multiple contiguous items of a sequence into a single item - [note: title , text heavily edited create more clear i'm not particularly after strings, after general sequences, , lazy processing of same] using character sequences / strings example, want turn string like "\t a\r      s\td \t \r \n          f \r\n" into " s d f " in more general terms, want turn contiguous whitespace (or other arbitray set of items) in sequence single item, , lazily. i've come next partition-by/mapcat combo, wonder if there easier or otherwise improve ways (readability, performance, anything) accomplish same thing. (defn is-wsp? [c] (if (#{\space \tab \newline \return} c) true)) (defn collapse-wsp [coll] (mapcat (fn [[first-elem :as s]] (if (is-wsp? first-elem) [\space] s)) (partition-by is-wsp? coll))) in action: => (apply str (collapse-wsp...

android layout - how to merge tablecolom in TableLayout -

android layout - how to merge tablecolom in TableLayout - i want create using tablelayout , generating problem shown in below image-1 want tablelayout image-2. give xml code create.! image-1 , want perfect output next image you have utilize nested layout given below. first : linearlayout take textview in linearlayout second : take tablelayout in linearlayout set android:layout_length , android.layout_width fill_parent. in table layout , take 2 textview , edittext , button. i hope can work want. android-layout

silverlight - Build dynamic Expression for search -

silverlight - Build dynamic Expression for search - i'm in trouble, can't figure out seems simple thing in plain sql can done within 1 minute, it's been several hours far. here situation: i have single field user may come in many words he/she likes i need build look find match let's there 3 fields in database: firstname, middlename, lastname i need split search entry , compare against 3 fields i'm dealing silverlight ria, ef once 1 time again search entry contains unknown number of words here under i'm trying accomplish, homecoming type mandatory: public expression<func<myentity, bool>> getsearchexpression(string text) { expression<func<myentity, bool>> result; var keywords = text.trim().split(" "); foreach(var keyword in keywords) { // todo: // check whether 'or' required (i.e. after sec loop) // (firstname = 'keyword' // , // mi...

database - Do Virtualized systems effect Explain Plans? -

database - Do Virtualized systems effect Explain Plans? - i'm having unusual , different results explain plans on postgresql. postgresql server installed on vmware machine , when executing several explain plans given sql query, different results returned. seems me hardware virtualization may provide "erroneous" info postgresql server returns "anormal , random" costs measurements. right or there other explanation surprising , unusual results? in case, if know any, i'd appreciate helpful docs. vacuum should regular part of database operations. it's not source of problem, though. we recommend active production databases vacuumed (at to the lowest degree nightly), in order remove dead rows. after adding or deleting big number of rows, might thought issue vacuum analyze command affected table. update scheme catalogs results of recent changes, , allow postgresql query planner create improve choices in planning queries. ...

cuda - Estimating increase in speed when changing NVIDIA GPU model -

cuda - Estimating increase in speed when changing NVIDIA GPU model - i developing cuda application deployed on gpu much improve mine. given gpu model, how can estimate how much faster algorithm run on it? you're going have hard time, number of reasons: clock rate , memory speed have weak relationship code speed, because there lot more going on under hood (e.g., thread context switching) gets improved/changed new hardware. caches have been added new hardware (e.g., fermi) , unless model cache hit/miss rates, you'll have tough time predicting how impact speed. floating point performance in general dependent on model (e.g.: tesla c2050 has improve performance "top of line" gtx-480). register usage per device can alter different devices, , can impact performance; occupancy affected in many cases. performance can improved targeting specific hardware, if algorithm perfect gpu, improve if optimize new hardware. now, said, can create predictions ...

php - Using YUI3 how do I update a record in Mysql? -

php - Using YUI3 how do I update a record in Mysql? - i have built drag , drop interface reads list mysql db. how can save "sort order" id? have php function saving notice yui , need javascript function phone call php function update record. this copied build drag , drop. http://developer.yahoo.com/yui/3/examples/dd/list-drag.html any help appreciated. in order update record, need making ajax xmlhtpprequest can create http post request , have info passed server side language. in end, server side language update record adding info existing record..it in form: yui().use("io-base", function(y) { var cfg, request, uri; uri = "sspage.php" //the php page in pass info cfg = { method: 'post', //you want post transaction data: 'user=yahoo', //your info arguments: { 'foo' : 'bar' } }; request = y.io(uri, cfg); }) i not familiar yui3, , can read d...

shell - size of every www folder in users' home -

shell - size of every www folder in users' home - i need create shell script size of every www directory of users home folder i need somethings username - wwwdirsize username - wwwdirsize total www size = ... i know have play du unix command any help? to recursive size of folder: du -hs | cutting -f 1 so size of each user's www folder: ls /home | while read username; echo "$username $(du -hs "/home/$username/public_html" | cutting -f 1)"; done shell size du

ruby on rails 3 - Creating a polymorphic relationship from the subordinate -

ruby on rails 3 - Creating a polymorphic relationship from the subordinate - i have 3 models have polymorphic relationship between them: category, sector , course. course of study can belong either category or sector, not both. in course of study model set follows: belongs_to :parent, :polymorphic => true accepts_nested_attributes_for :parent for both category , sector model have next relationship defined: has_many :courses, :as => :parent now in course of study view want able set appropriate parent course of study editing through select box. have next line in _form.html.erb: <%= f.collection_select( :parent_id, @parent_options, :id, :name, {}, { :multiple => false } ) %> this homecoming right parent_id hash, within array. when @ record in database stores 1 parent_id on courses table (the number of items in array?) , not store appropriate name @ (which not surprising, not passed in through parameters). understand wrong, can't figure ou...

ruby - How do I pass an array to a method that accepts an attribute with a splat operator? -

ruby - How do I pass an array to a method that accepts an attribute with a splat operator? - if have method like: def sum *numbers numbers.inject{|sum, number| sum += number} end how able pass array numbers? ruby-1.9.2-p180 :044 > sum 1,2,3 #=> 6 ruby-1.9.2-p180 :045 > sum([1,2,3]) #=> [1, 2, 3] note can't alter sum method take array. just set splat when calling method? sum(*[1,2,3]) ruby splat

iphone - How to evaluate/watch a variable or method whilst debugging in XCode -

iphone - How to evaluate/watch a variable or method whilst debugging in XCode - i come delphi , .net background , have started iphone development. came across problem whilst debugging. i had next code: if ([displaytext rangeofstring:@"."].location != nsnotfound) .....etc i wanted evaluate whilst debugging not work out how it. found expressions window , entered below nil happened: [displaytext rangeofstring:@"."].location as i'm used delphi & .net (and know xcode different product) easy stick in variables, methods etc watch window , see result cannot see how in xcode. please can tell me how evaluate things whilst debugging?? thanks in case, @ debugger type: p (nsrange)[displaytext rangeofstring:@"."] you can print out value of objects po, things c structures have printed out "p" , have cast homecoming types objc calls right struct type. also, putting in expressions window should result in value: ...

SQL Server: Function Evaluation Time -

SQL Server: Function Evaluation Time - sql server 2005: query below returns no info ((0 row(s) affected)), ok. but when line #3 function phone call enabled, query fails!"conversion failed when converting datetime character string." coming oracle background - unthinkable! please tell me what's going on - doing wrong ?doesn't ss evaluate function calls in select list @ lastly step (like oracle - or sensible programmer do) ? select 1 1 --,datepart(yyyy,cast(inception_date27 datetime)) inception_yr [dbo].[h5_premium_detail] dtl, [dbo].[h5_policy_master] polmst polmst.policy_no2 = cast(dtl.arch_master_policy_no41 numeric) , len(inception_date27) != 8 here little clip recorded thanks note: know root source of bad info (some rows have "0" instead of "20110704") ss complains here - the gist why failure arise no info found join. doesn't ss evaluate function calls in select list @ lastly ...

Android SDK tools r12 update on Linux -

Android SDK tools r12 update on Linux - i utilize ubuntu 10.04. update android sdk tools r12 version. when start avd scale 0.5 1.0 256-colors screen. it? i believe known bug linux r12 , scaling in emulator: http://code.google.com/p/android/issues/detail?id=18299 android linux sdk

c++ - boost::asio only works when run within Visual Studio -

c++ - boost::asio only works when run within Visual Studio - i using boost::asio::io_service , boost::asio::deadline_timer secondary (i.e. non-gui) worker thread. works when programme run within visual studio (2010). however, when run release executable outside of visual studio, async_wait()/run() combination doesn't seem anything. i have confirmed run() indeed block. have confirmed debug executable works fine, release executable not work (i.e. function specified in async_wait() not run). perhaps there project setting, optimization need disable, or something? (reposting comment question can marked answered) you have uninitialized variable somewhere, i.e. default-initialized object of scalar or pod type. c++ visual-studio multithreading boost boost-asio

javascript - Manage when someone tries to close the browser window/tab -

javascript - Manage when someone tries to close the browser window/tab - in onbeforeunload event, asked user whether want leave page or remain on it. when click "stay on page", want redirect them webpage in same window. sounds weird, that's i've been assigned do. basically, main page plays video - think advertising purchase something, , when close decide remain on page, want video go away/stop playing , different info appear (a different "webpage"). there way this, without showing/hiding divs? can override function? i'm trying way(as seen below) dialog box not showing @ all. working before ideas i'm doing wrong, or how accomplish task? <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>the shocking truth - cabot market letter</title> <script t...

css - centering a div -

css - centering a div - i trying center div due beingness block , general text or image beingness inline not work...the stuff within div gets centered not div itself...how can this? ive tried bunch of things google couldn't work... http://dev.icalapp.rogersdigitalmedia.com.rogers-test.com/menutest.htm the code of involvement below: <head> <script type="text/javascript"> var mygallery=new fadeslideshow({ wrapperid: "fadeshow1", //id of blank div on page house slideshow dimensions: [500, 360], //width/height of gallery in pixels. should reflect dimensions of largest image imagearray: [ ["01.jpg"], ["02.jpg"], ["03.jpg"], ["04.jpg"] //<--no trailing comma after lastly image element! ], displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false}, persist: false, fadeduration: 500, //transition duration (milliseconds) ...

php - JSON getting "name":"\u05d7\u05d1\u05e8\u05d4" for non-English -

php - JSON getting "name":"\u05d7\u05d1\u05e8\u05d4" for non-English - i getting json returned ajax php json_encode have hebrew characters turned "\u05d7\u05d1\u05e8\u05d4" how can turn them hebrew? (the db encoded utf8 , when calling php file hebrew displayed correctly) as quentin pointed out, correct. \uxxxx right escape sequence unicode character. in fact, if type in firebug console, prompt "חברה" . hebrew me, although can't tell whether it's correct. therefore after parsing info received (either eval or json.parse ) character should unescaped automatically. php encoding character-encoding json

php - Help with Joomla site accumulating massive cache in com_content -

php - Help with Joomla site accumulating massive cache in com_content - not sure exact problem is, com_content cache accumulated real , site crashing when browsing homepage category. urgent assistance needed. might simple, experienced joomla developer know. you didn't leave much intel here based on that. why don't disable cache in global configuration > scheme > cache settings. it's not solution prepare problem in short-term. unfortunately caching bit broken in joomla 1.5.x versions, , plugins. php joomla joomla1.5

android - Weird behavior of ListView item and state selector background drawable -

android - Weird behavior of ListView item and state selector background drawable - i having unusual listview behavior when using statelistdrawable background. i've tried follow reply this post, wasn't getting state_checked state work, listview going crazy. when click on item, doesn't alter color state_checked item in selector. after clicking around bit though, many of views switch state_checked background. it's seemingly random. here state selector xml code: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" > <shape> <gradient android:startcolor="@color/grey" android:endcolor="@color/darkgrey" android:angle="270" /> <stroke android:width="0dp" ...

command line - Batch file to create a user and then assign permissions with mysql -

command line - Batch file to create a user and then assign permissions with mysql - i trying create batch file create new user , assign permissions new user. want this: c:\mysql\bin\mysql -uroot -ppassword < create user 'username_here'@'localhost' identified 'password_here'; c:\mysql\bin\mysql -uroot -ppassword < grant on mydb.* 'username_here'@'localhost'; problem error saying scheme can not find file specified. know calling mysql exe right place because if do: c:\mysql\bin\mysql -uroot -ppassword it logs in , gives me mysql prompt. doing wrong? you can utilize --execute alternative pass 1 statement database: class="lang-none prettyprint-override"> c:\mysql\bin\mysql -uroot -ppassword --execute="create user 'username_here'@'localhost' identified 'password_here';" c:\mysql\bin\mysql -uroot -ppassword --execute="grant on mydb.* 'username_here'@...

javascript - Push function to front of object literal -

javascript - Push function to front of object literal - i have html popup jquery ui modal: <a href="my/url" class="popup">click me</a> with javascript code: $('.popup').click(function() { var = this; var dialog = $('<div>').load($(a).attr('href'), function() { var form = dialog.find('form'); dialog.dialog({ modal: true, title: $(a).attr('title'), buttons: { add together : function () { $.post($(form).attr('action'), $(form).serialize()); dialog.dialog('close'); }, cancel: function () { dialog.dialog('close'); } } }); if ($(a).attr('data-third')) { // add together here button } }); homecoming false; }); the thought reso...

Android collision detection -

Android collision detection - description: i've got project finished now, i've noticed collision not working. it's snake-like game can controlled via touch-screen, sharp (?, sorry german) angles possible. @ moment leave bit of tolerance (ignore first 2 sprites) enable bit of turning. main problem sprites beingness rotated results in overdimensional collision boxes. i'm not using game engines or opengl. collision code: offsetx & offsety bitmaps width or height / 2, called on head of snake. each link in snake (bird) placeable public boolean doeshit(placeable p) { int xlen = math.abs(this.x - p.x); int ylen = math.abs(this.y - p.y); if (bmp != null) { if (xlen < offsetx + p.offsetx && ylen < offsety + p.offsety) homecoming true; } else { if (xlen < bird.big_w[bird.musebird] / 2 && ylen < bird.big_h[bird.musebird] / 2) homecoming true; } homecoming...

jsf 2 - How can I get JSF 2.0 to include JS as 'application/javascript' instead of 'text/javascript' -

jsf 2 - How can I get JSF 2.0 to include JS as 'application/javascript' instead of 'text/javascript' - in our jsf 2.0 application @ work, include several javascript files via <h:outputscript> . <h:outputscript library="javascript" name="dostuff.js"/> the resulting html references them 'text/javascript'. <script type="text/javascript" src="/mycontext/javax.faces.resource/dostuff.js.jsf?ln=javascript"></script> according this question, "text/javascript" obsolete, what's more, htmlunit complains type rather verbosely. of course, works fine , shut off htmlunit's logging, i'd rather have jsf generate right type. is there way override type chosen <h:outputscript> ? this hardcoded in default renderer of <h:outputscript> . assuming you're using mojarra, it's com.sun.faces.renderkit.html_basic.scriptrenderer . according source, type attrib...

listview - soft keyboard full screen in android application -

listview - soft keyboard full screen in android application - i have application, have list view, , list view made upon custom adapter. have made suggestive search on list view. problem that, when type in edit text search pan; soft keyboard pop gets total length width , height in screen, have no alternative see whether list view getting changed on text alter in edit text. beingness enable see search result until press done button in soft keyboard. want soft keyboard pop pops half screen of application can see listview info changes on text alter given in edit text. there solution related issue??? add edittext attribute android:imeoptions="flagnoextractui" . prevent soft keyboard take full-screen size. check answer: disabling fullscreen editing view soft keyboard input in landscape? android listview android-softkeyboard

objective c - CAMediaTimingFunction with 3 {0.0f} Control Points? -

objective c - CAMediaTimingFunction with 3 {0.0f} Control Points? - i'm trying animate alpha transitions of nsviews. needs happen during animation, of it's superview (a bounds change). it's kind of complicated explain why, need these alpha transitions have timing function wherein alpha stays @ 0.0 first 3/4 of duration (0.25 seconds). thought if defined own timing function command points 0.0, 0.0, 0.0, 1.0, accomplish desired effect. obviously, don't understand timing functions , math in general. if provide advice, great! regards, alec the camediatimingfunction creates bezier curve using command points. think task improve solution utilize keyframes opacity animation. cakeyframeanimation *animation = [cakeyframeanimation animation]; animation.values = [nsarray arraywithobjects: [nsnumber numberwithfloat:0.0], [nsnumber numberwithfloat:1.0], nil]; animation.keytimes = [nsarray arraywithobjects: ...

java - Retrieving Xpath from SOAP Message -

java - Retrieving Xpath from SOAP Message - i want retrieve xpaths soap message @ run time. for example, if have soap message like <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:bodyxmlns:ns1="http://xmlns.oracle.com/testappln_jws/testemail/testemail"> <ns1:process> <ns1:to></ns1:to> <ns1:subject></ns1:subject> <ns1:body></ns1:body> </ns1:process> </soap:body> </soap:envelope> then possible xpaths soap message are /soap:envelope/soap:body/ns1:process/ns1:to /soap:envelope/soap:body/ns1:process/ns1:subject /soap:envelope/soap:body/ns1:process/ns1:body how can retrive java? use xpath type namespacecontext. map<string, string> map = new hashmap<string, string>(); map.put("foo", "http://xmlns.oracle.com/testappln_jws/testemail/testemail"); namespacecontext context =...

excel - CSV Exporting: Preserving leading zeros -

excel - CSV Exporting: Preserving leading zeros - i'm working on .net application exports csv files open in excel , i'm having problem preserving leading zeros when file opened in excel. i've used method mentioned @ http://creativyst.com/doc/articles/csv/csv01.htm#csvandexcel this works great until user decides save csv file within excel. if file opened 1 time again in excel leading zeros lost. is there can when generating csv file prevent happening. this not csv issue. this excel loving play csv files. change extension else. excel csv

ruby on rails - Simple word - synonym model, serialized attribute or association? -

ruby on rails - Simple word - synonym model, serialized attribute or association? - i working on simple dictionary have words , synonyms words. i not sure model improve solution, working serialized attribute or association. with association: class reservedword < activerecord::base has_many :synonyms end class synonym < activerecord::base belongs_to :reserved_word end with serialization: class reservedword < activerecord::base serialize :synonyms end in terms of info redundancy there isn't such big problem because synonyms aren't supposed repeat other reserved words. i appreciate suggestions. what sql query pattern expected like? using serialize mechanism, won't able easily query based on synonyms. based on beingness able reverse lookup reservedword 's based on synonyms, recommend belongs_to / has_many standard rails approach. ruby-on-rails ruby-on-rails-3 serialization activerecord model

maven 2 - Can maven3 runtime execute maven2 compatible pom.xml files -

maven 2 - Can maven3 runtime execute maven2 compatible pom.xml files - some of our new projects have been migrated maven3 , of older projects still using maven2 compliant pom.xml files. can maven3 runtime execute maven2 compatible pom.xml files also? maven 3 compatible maven 2 configuration. there still incompatibilities. for total list should check here there sometime problems plugins (as torsten suggested). resources: maven 3.x plugin compatibility matrix on same topic: switching maven3 maven-2 maven maven-3

iphone - How set text field and button at center of view automatically when mode change? -

iphone - How set text field and button at center of view automatically when mode change? - i want set text field , uibutton, label , image view @ center of uiview automatically when alter mode of view either land scape or portrait mode.my mean when alter orientation text field , button , image automatically set in center of view. how set them using interface builder or dynamically? write code in method -(bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { homecoming yes; } -(void)didrotatefrominterfaceorientation:(uiinterfaceorientation)frominterfaceorientation { if (frominterfaceorientation == uiinterfaceorientationlandscapeleft || frominterfaceorientation == uiinterfaceorientationlandscaperight ) { //write code specific orientation } else if(frominterfaceorientation == uiinterfaceorientationportrait || frominterfaceorientation == uiinterfaceorientationportraitupsidedown) { //writ...

javascript - How to wrap existing event handler without modifying "this"? -

javascript - How to wrap existing event handler without modifying "this"? - i using existing code has form submit handler: function ajaxformsubmit(e) { [...] var form = $(this); [...] } to bind handler in view code have this: $('myform').submit(ajaxformsubmit); what want run other code before calling ajaxformsubmit this: $('myform').submit(function(e) { dosomething(); ajaxformsubmit(e); }); the problem in ajaxformsubmit, phone call $(this) doesn't form element. best way accomplish this? you need sure this gets called in right context. $('myform').submit(function(e) { dosomething(); ajaxformsubmit.call(this, e); }); javascript jquery

javascript - unbinding hover() - not the normal case -

javascript - unbinding hover() - not the normal case - i have jquery that, whenever document ready, binds hover event handler element class="widget-box" . issue 1 time document ready, hover event handler gets binded, when user clicks button on page, ajax used part of page reloaded , document ready causes hover event binded 1 time again same element. don't want behavior occur , want hover event binded once. i've tried unbind hover() whenever document ready gets called 1 time again unbind('mouseenter') , unbind('mouseleave') somehow, doesn't work remove hover binded. have ideas how prepare this? thanks! you may have done wrong. way: $(".widget-box").unbind('mouseenter mouseleave').bind('hover', ...); hope helps. cheers javascript jquery hover unbind

Open and Close jQuery Overlay with Same Element -

Open and Close jQuery Overlay with Same Element - i'm using jquery tools overlay fade in overlay on website. here's overlay's html: <div id="contact">..div content..</div> here's element i'm using open overlay: <span rel="#contact"></span> here's jquery i'm using overlay: $(document).ready(function() {$("span[rel]").overlay(); } ); when click span rel="#contact" , div id="contact" fades in. want know how click same span rel="#contact" 1 time again close element. look @ .toggle() jquery overlay toggle switch-statement

extjs4 - ExtJS 4 / Sencha Touch Container, Component, Element and Panel -

extjs4 - ExtJS 4 / Sencha Touch Container, Component, Element and Panel - what relations or differences between container, component, element , panel? please help. if briefly... element wrapper dom element. component basic class widgets. container subclass of component. can have "items" (i.e. container can contain other components). panel subclass of container. can have header, footer, toolbars, , other docked items. you can find more info in layouts & containers , components sencha-touch extjs4 extjs

android - Passing database connection between intents -

android - Passing database connection between intents - i`m should database connection if alter intent ? for illustration have mainactivity list of records , button. when click button i m starting new intent (addactivity). in mainactivity i ve opened database connection display records. want add together new record in addactivity need connection. should ? honest see 2 solutions 1) close connection while invoking new intent , in addactivity open again 2) pass theconnection addactivity. don`t know how or maybe should in other way ? close connection. improve practice close connection , open seek maintain open between activities. android database sqlite

python - Which file is used in import statement for 'MultipleObjectsReturne' exception -

python - Which file is used in import statement for 'MultipleObjectsReturne' exception - i using code except multipleobjectsreturned: homecoming httpresponse('some error') but error global name 'multipleobjectsreturned' not defined you can either: from django.core.exceptions import multipleobjectsreturned except multipleobjectsreturned e: homecoming httpresponse(e) or: except yourmodel.multipleobjectsreturned e: homecoming httpresponse(e) https://docs.djangoproject.com/en/1.3/ref/exceptions/#django.core.exceptions.multipleobjectsreturned a base of operations version of exception provided in django.core.exceptions ; each model class contains subclassed version can used identify specific object type has returned multiple objects. python exception-handling

android - How to upgrade SQLDatabase with this code? -

android - How to upgrade SQLDatabase with this code? - i want upgrade database newer version. how go doing in upgrade method gives you? private static final string database_name = " nba"; private static final string database_table = "booklist"; private static final int database_version = 1; private static string tag = "upgrading database!"; public static final string key_book = "book"; public static final string key_author = "author"; public static final string key_isbn = "isbn"; public static final string key_rowid = "_id"; public static final string key_rating = "rating"; public static final string key_status = "status"; private databasehelper mdbhelper; private sqlitedatabase mdb; private static final string database_create = " create table " + database_table + " (" + key_rowid + " integer primary key autoincrement, " + key_a...