Posts

Showing posts from February, 2015

.net - How to automatically position window like Popup? -

i created virtual keyboard implemented custom control inhereted window . want know if there way automatically position keyboard near textbox popup when it's popupplacement property wasn't set. or should implement custom algorithm? update: need move virtual keyboard 1 textbox , position near * textbox * fits screen. you try using tooltip class - has placementtarget property allow lock specific uielement. think should able modify suit needs.

uitableview - Mark tableview cell as completed when user user returns from subview -

i writing application teaches user in lessons separated sections. have tableview filled custom tableview cells have check mark want unhide when user completes lesson , lesson view popped table. there way viewwillappear called can unhide checkmark label in specific tableview cell? i store information in nsdictionary . in case, when user loads lesson, can add bool value nsdictionary mean lesson complete, in cellforrowatindexpath: delegate, add this: if([plistdict objectforkey:@"kcomplete"] == yes){ cell.accessorytype = uitableviewcellaccessorycheckmark; }else{ cell.accessorytype = uitableviewcellaccessorynone; }

sql - Java PreparedStatement equivalent for OraclePreparedStatement registerReturnParameter -

oraclepreparedstatement has registerreturnparameter works "returning into" sql clause. what's java equivalent (and sql statement) same? believe getgeneratedkeys() returns auto-incremented column -- there way entire resultset rows updated. thanks!

iphone - Calling cellForRowAtIndexPath through an instance -

i wondering if following scenario possible. have uitableviewcontroller class contains ten rows displaying data. now, want show first 5 rows in 1 tableview , last 5 in another. since don't want fetch data again hoping create instance of original table class , call cellforrowatindexpath:(nsindexpath*)indexpath return table cells , add other 2 table views. possible call delegate method through instance? if so, how can create nsindexpath object pointing particular row in section of table... thanks replies. tried calling cellforrowatindexpath:(nsindexpath*)indexpath shows following warning 'rootviewcontroller' may not respond '-cellforrowatindexpath:' also application crashes message ***terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[rootviewcontroller cellforrowatindexpath:]: unrecognized selector sent instance 0x4bad30' had initialized nsindexpath andrei described. guess not possible call function...

g++ - Compiler flag to reveal functions like strdup -

i've been given starter code project have complete in class i'm taking. code compiles fine on university computers when try compile code on own computer errors due function call strdup. can gather caused because strdup not iso c99 function ( https://bugzilla.redhat.com/show_bug.cgi?id=130815 ). how should go getting code compile? i'd imagine need throw in additional compiler flags i'm not sure ones. in case need info ran g++ -v , here output: using built-in specs. target: x86_64-linux-gnu configured with: ../src/configure -v --with-pkgversion='ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/readme.bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --ena...

android - Listview with checkedtextview -

i have 2 questions: if using checkedtextview in listview , class extends activity (instead of listactivity ), since have button @ bottom below listview , event should listen on, when checkbox selected in checkedtextview ? if extend class use listactivity , can use onlistitemclick event, right? how can add new button type of layout? here code.. public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); m_versiontext=(textview)findviewbyid(r.id.versiontext); m_versiontext.settext("android version is:" + build.version.release); m_btnallcalendars = (button)findviewbyid(r.id.btn_allcalendars); m_btnallcalendars.setonclicklistener(mcalendarlistener); m_calendarlist=(listview)findviewbyid(r.id.callist); //populatelist uses simplecursoradapter add items listview..(this part working) populatelist(); m_calchecktext = (checkedtextview)findviewbyid(r.id.caltextview); ...

r - How can I get Emacs ess to recognize a query string (within quotes) as code? -

background i have function dbquery simplifies process of querying mysql database within r. dbquery <- function(querystring) { dvr <- dbdriver("mysql") con <- dbconnect(dvr, group = "databasename") q <- dbsendquery(con, querystring) data <- fetch(q, n = -1) return(data) } thus can send: dbquery(querystring = "select field_1, field_2, field_3 table_a join table_b on = join table_c on = field_4 in (1,2,3);" however, variable querystring must contained within quotes. makes emacs ess not nicely indent queries if in sql mode - or if there no quotes in ess-r mode. question is possible ess this? perhaps writing function accept query without quote (and add quotes within function), or perhaps adding .emacs or ess.el? i think want in mmm mode . name suggests: multimajormode mode allows have multiple modes on different regions of same buffe...

c# - Silverlight Combobox Binding to Element -

i have silverlight telerik radcombobox. designing master detail page. in grid have list of people - 1 of columns in grid salutation. when click on item in grid textboxes below fill according binding. but combobox wondering if can bind this. selecteditem="{binding elementname=persongrid, path=selecteditem.salutationlookupvalue, mode=twoway}" im guessing cannot way. way im thinking need bind selecteditem selectedsalutation , set when selected item set grid.. public person selectedpersonresult { { return _selectedpersonresult; } set { setobject(ref _selectedpersonresult, value, "selectedpersonresult"); if (_selectedsalutationresult != null) { selectedsalutation = salutationlist.where(x => x.value == selectedpersonresult.salutationlookupvalue).firstordefault(); } } } again id prefer first way (within xaml) im guessing doing second way way? ...

multithreading - How to Kill a C# Thread? -

i've got thread goes out , looks data on our (old) sql server. as data comes in, post information modal dialog box - user can't & shouldn't else while processing going on. modal dialog box let them see i'm doing , prevent them running query @ same time. sometimes (rarely) when code makes call sql server, server not respond (it has down maintenance, lan line got cut, or pc isn't on network) or person doing query runs out of time. so, modal dialog box have cancel button. the thread object (system.threading.thread) has isbackground=true . when clicks cancel, call killthread method. note: can not use backgroundworker component in class because shared windows mobile 5 code & wm5 not have backgroundworker. void killthread(thread th) { if (th != null) { manualresetevent mre = new manualresetevent(false); thread thread1 = new thread( () => { try { if (th.isalive) { //th.stop(); // ...

string - Kohana ORM Result - How to display? -

maybe simple, got big problem with... orm result. i'm loading object relation using with(). generates following query: select `article`.`id` `article:id`, `article`.`name` `article:name` now's question... how display article name in view? sorry dumb question, can't beliebe i'm asking it. edit here's code: $activity = $user->activity->with('article')->where('article.status', '=', 1)->find_all()->as_array(); relations correct sure. can swear saw similar today morning on kohana forums cannot find it. cheers! i haven't tested work if this: $activities = $user->activity->with('article')->where('article.status', '=', 1)->find_all(); foreach($activities $activity) { echo $activity->name.'<br />'; }

SQL Server 2000 DTS Package Failing with "The number of failing rows exceeds the maximum specified" -

i have inherited sql server 2000 dts package migrates data sql server oracle. package moves 20 tables' data oracle every night no transformations, , transformed set of sps , used gis application. twice week, during migration between sql server , oracle, package has failed "the number of failing rows exceeds maximum specified". has failed on different table each time, though. each time it's failed, we've rerun process next morning , has worked. because process works second time it's run, makes me think data being changed or between initial failure , our successful second run. i change dts package log failing rows in text document can compare them later. can me that? can't seem figure part out. scott never mind. found exceptions file under options tab.

Bus error in C Program on Unix machine -

i'm unexperienced c , running "bus error" cannot understand cause of. had never heard of gdb came across on forum , tried using on problem program , got following output: % gdb proc1 gnu gdb 5.0 ... this gdb configured "sparc-sun-solaris2.8"... (no debugging symbols found)... (gdb) run starting program: /home/0/vlcek/cse660/lab3/proc1 (no debugging symbols found)... (no debugging symbols found)... (no debugging symbols found)... program received signal sigsegv, segmentation fault. 0x10a64 in main () i have no idea means, saying there's error in line 10 in code? if so, line 10 in code merely "int main()" i'm not sure issue there... when try running program says "bus error" i'm not sure go here. tried putting printf right after main , doesn't print string, gives me bus error. below code: // compilation command: gcc -o proc1 proc1.c ssem.o ssh...

Can you call an object method dynamically off class parameterization in Scala? -

i'm quite new scala, i'm trying implement following situation. suppose have trait: trait sometrait { def kakaw } and 2 scala objects extend it: object samplea extends sometrait { def kakaw = "woof" } object sampleb extends sometrait { def kakaw = "meow" } what i'd call 1 of these 2 object functions based on parameterized function call. example (and know furthest thing correct): class someother { def saysomething[t] = t.kakaw } so can like: val s = new someother s.saysomething[samplea] is @ possible in scala? & scala welcome scala version 2.8.1.final (java hotspot(tm) 64-bit server vm, java 1.6.0_23). type in expressions have them evaluated. type :help more information. scala> trait sometrait { | def kakaw : string | } defined trait sometrait scala> class samplea extends sometrait { | def kakaw = "woof" | } defined class samplea scala> implicit val samplea = new sam...

python - Django - Rebuild a query string without one of the variables -

i have django view processes request. want rebuild query string include variables except one. i using list comprehension: >>> django.http import querydict >>> q = querydict('a=2&b=4&c=test') // <--- make believe request.get >>> z = querydict('').copy() >>> z.update(dict([x x in q.items() if x[0] != 'b'])) >>> z.urlencode() but believe may better solution: >>> django.http import querydict >>> q = querydict('a=2&b=4&c=test') // <--- make believe request.get >>> z = q.copy() >>> del z['b'] >>> z.urlencode() can think of better approach? django puts request variables dictionary you, request.get querydict. can this: z = request.get.copy() del z['a'] note dictionaries in python (and django querydicts) don't have del() method, have use python's built in del() function. querydicts immutable (but cop...

python - How can you dynamically create variables via a while loop? -

this question has answer here: how create variable number of variables? 10 answers i want create variables dynamically via while loop in python. have creative means of doing this? unless there overwhelming need create mess of variable names, use dictionary, can dynamically create key names , associate value each. a = {} k = 0 while k < 10: <dynamically create key> key = ... <calculate value> value = ... a[key] = value k += 1 there interesting data structures in new 'collections' module might applicable: http://docs.python.org/dev/library/collections.html

linux - SHELL: How do I use a or operator when defining a string -

this may not possible im writing first shell script , need use regexp type operator in string (shown below) files=tif2/name(45|79)*.pdf is possible? or have have 2 strings. files=tif2/name45*.pdf files=tif2/name79*.pdf alternatives in shell globbing syntax use comma-separated list enclosed semicolons. example becomes: files=tif2/name{45,79}*.pdf there's a pretty nice quick reference here glob syntax supported shells. for more esoteric bash-specific glob syntax, see http://www.gnu.org/software/bash/manual/bashref.html#shell-expansions

validate if table exists while selecting and inserting SQL Server -

hello have dynamic query like set @template = 'select x x,... temporaltable from' + @table_name then execute it exec (@template) how validate if temporaltable exists, if so, drop it? use information schema or sp_help function. i prefer information schema since it's sql ansi , can port code other databases: select count(1) information_schema.tables table_name = 'temporaltable'; sys.tables sqlserver specific option similar inforamtion schema can explore.

css - Why does changing font-size and line-height screw up my HTML layout? -

i post code if helpful (but it's lot). basically, if change line-height or font-size big value, breaks html layout - specifically, divs seem getting bigger...but don't have text in divs. any inline element pay attention line-height : on block container element content composed of inline-level elements, 'line-height' specifies minimal height of line boxes within element. in case, have <img> elements (which inline elements default) inside <div> elements (which block containers). changing font-size implicitly alters pixel value of line-height , default line-height: normal , means: tells user agents set used value "reasonable" value based on font of element. so, altering either font-size or line-height change vertical space inline elements occupy.

android - Problem with parsing xml file -

i have website need parse android app. http://www.wow-coupons.com/rss_online_coupons.xml i using code androidxml below site parse http://www.ibm.com/developerworks/opensource/library/x-android/index.html?ca=dgr-lnxw82android-xml&s_tact=105agx59&s_cmp=grlnxw82 there no syntax errors in xml file. other websites work same code. if there connection problem, how resolve it? please help. thanks, siri i tested feed buzzbox sdk demo app , parsed fine. see http://hub.buzzbox.com/android-sdk/demoapp you can sdk , integrate in app. or can rewrite parser. sdk using org.xml.sax.xmlreader , javax.xml.parsers.saxparser

Linux server performance analytics and load monitoring software -

Image
what looking software thats runs on linux (centos) can following: show human readable cpu, memory, disk, apache, mysql utilization/performance. provide historic reports on above metrics (today, week, month, year etc...) provide data in easy view web based report or @ least exportable excel/csv. i have looked @ cacti , don't think enterprise solution. don't care if free or paid software, though open source nice looking best solution. does exist linux? problem company faced have no way of measuring how changes make in our code , server configurations impact overall performance. when saw lets - it, can't shows benefits or revert cause negative in terms of performance. not linux guru, developer linux skills, open suggestions. reading. even though there lot of open source projects main drawback suffer away harder configure. have across free called sealion way easier install , configure. , has awesome timeline base representing outputs. there differen...

c# - Images that are H264 encoded should be encoded again? What are key frames -

i have images h264 encoded. have generated video these images. need encode video again h264? , keyframes? you might want re-check encoding of individual images -- h.264 defined video, not individual still images. once you've created video, h.264 encoding make sense. in particular great deal of compression h.264 motion prediction -- i.e., encode block in 1 frame based on similar block in previous frame (or can use bidirectional prediction, it's based on both previous , subsequent frame). a key frame 1 isn't predicted other frames (i.e., i-frame) that's used let picking video in middle of transmission synchronized , have basis other frames it's going receive.

php - sales tax rate retreval from zip code -

what popular 3rd party applications can use retrieve current sales tax rate zip code? using php. thought building own after noticed u.s. has 40k+ zip codes wouldn't easy. options. are free or have pay monthly thanks a zip code not enough determine sales tax, since area covered can (and does) span multiple tax jurisdictions. need package retrieve based on street address , zip code. there companies out there allow perform such queries via web service, fee. in process of looking https://www.taxdatasystems.net . charge between 7 , 15 cents per query, depending on monthly volume.

eclipse - how to get testng reports on executing junit test -

i want execute test script junit or other test want reports in testng reports format: is there way invoke org.testng.reporters methods in junit framework obtain testng style reports (xml reports, emailable-reports.html ) on executing code junit test? i don't know if can invoke part of testng junit. what can execute junit test directly (without changes) testng: see section "junit tests" testng manual

Real Time File Transfer using python script -

i want create application needs time time file transfer (i want write server client). what best way file transfer? thanks in advance.. nimmy... pyftpdlib server. and linux box client.

configuration - Adding Data.php Helper in Magento got error -

following alan storm tutorial in custom magento system configuration, when tried adding the data.php in helper folder still error: fatal error: class 'mage_helloworld_helper_data' not found in e:\xampp\htdocs\magento \app\mage.php on line 520 **alanstormdotcom\helloworld\helper\data.php** <?php class alanstormdotcom_helloworld_helper_data extends mage_core_helper_abstract { } **alanstormdotcom\helloworld\etc\system.xml** <?xml version="1.0"?> <config> <tabs> <helloconfig translate="label" module="helloworld"> <label>hello config</label> <sort_order>99999</sort_order> </helloconfig> </tabs> </config> **alanstormdotcom\helloworld\etc\config.xml** <?xml version="1.0"?> <config> <modules> <alanstormdotcom_helloworld> <version>0.1.0</versio...

c# - Lambda Expression for join -

public class coursedetail { public coursedetail(); public string courseid { get; set; } public string coursedescription { get; set; } public long courseser { get; set; } } public class refuidbycourse { public long courseser { get; set; } public double delivereddose{ get; set; } public double planneddose{ get; set; } public string refuid { get; set; } } public class refdata { public double dailydoselimit { get; set; } public string refname { get; set; } public string refuid { get; set; } public double sessiondoselimit { get; set; } } public class coursesummary { public long courseser { get; set; } public double delivereddose{ get; set; } public double planneddose{ get; set; } public list<refdata> lstrefdata {get;set;} } for 1 courseser there can multiple refuid in refuidbycourse , every ...

html - codeigniter, php error - errot text problem -

i use codeigniter framework in project. encountered php error. english errors display well~ but, there odd texts can not readable. this... a php error encountered severity: warning message: simplexml_load_file(http://localhost/uploads/seoul.kml) [function.simplexml-load-file]: failed open stream: ����� ��������κ��� ����� ��� �������� ���߰ų�, È£��Æ®�κ��� ����� ��� ������ ������Ï´�. filename: controllers/editor.php line number: 113 so, think it's becase of text encoding~ . project's setting utf-8(korean)) in config/congif.php. $config['charset'] = "utf-8"; but, can not find should put html utf-8 setting this. in application/error/error_php.php file, can not find place put utf-8 setting this. because it's div tags, no html header. <div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;"> <h4>a php error encountered</h4> <p>severity: <?php echo $severity; ?></p> <p>messa...

c# - Crystal report With parameter passing & change database information dynamically -

please me out crystal report more 1 parameters passing & change database information dynamically. had code follows: parameterfields paramfields = new parameterfields(); reportdocument reportdocument = new reportdocument(); reportdocument.load(server.mappath(reportname + ".rpt")); parameterdiscretevalue crparameterdiscretevalue= new parameterdiscretevalue(); parameterfielddefinitions crparameterfielddefinitions ; parameterfielddefinition crparameterfieldlocation ; parametervalues crparametervalues = new parametervalues(); crparameterfielddefinitions= reportdocument.datadefinition.parameterfields; // 1stparameter satrt crparameterfieldlocation= crparameterfielddefinitions["@userid"]; crparametervalues= crparameterfieldlocation.currentvalues; crparameterdiscretevalue= new crystaldecisions.shared.parameterdiscretevalue(); crparameterdiscretevalue.value=co...

c# - Does there exist any NON-GPL/AGPL virus scanning library? -

is there c#/.net code (or convertible .net, such java/python) virus scanning not under gpl/agpl ? found c# wrapper clamav, clamav gpl... lgpl suffice, , matter of fact, prefer. preferably in managed code, dllimport welcome. com interop no-go, need cross-platform (=windows & linux). how metascan - supports multiple av engines , has .net support. not sure if uses com underneath available on windows. another thought use command line version of av engines.

iphone - How to load data in tableView -

hi have following code trying add uitableview on uialertview have subclassed uialertview in uialerttableview. #import "uialerttableview.h" #define ktablepadding 8.0f @interface uialertview (private) - (void)layoutanimated:(bool)fp8; @end @implementation uialerttableview @synthesize datasource; @synthesize tabledelegate; @synthesize tableheight; @synthesize tableview; - (void)layoutanimated:(bool)fp8 { [super layoutanimated:fp8]; [self setframe:cgrectmake(self.frame.origin.x, self.frame.origin.y - tableextheight/2, self.frame.size.width, self.frame.size.height + tableextheight)]; // lowest non-control view (i.e. labels) can place table view below uiview *lowestview; int = 0; while (![[self.subviews objectatindex:i] iskindofclass:[uicontrol class]]) { lowestview = [self.subviews objectatindex:i]; i++; } cgfloat tablewidth = 262.0f; tableview.frame = cgrectmake(11.0f, lowestview.frame.origin.y + lowestview.frame....

c# - Connecting WCF service from an application which is behind proxy - Testing simulation -

i have wcf client application connects wcf service. need test behavior of application in case client machine using proxy. my test environment not use proxy, how can simiulate scenario such can confidently test case? typically wcf clients use proxy if client machine configured use one. is, if using proxy , ie (internet explorer) configured use proxy well, wcf client use proxy (unless configured otherwise). basichttpbinding (in confic file) has usedefaultwebproxy element true default. if don't see in config file (on client) true you use public proxy server test make sure. there many free , paid proxy servers can use. example http://www.publicproxyservers.com/ paid proxy server. basically you'll use proxy out onto internet , you'll need configure ie use proxy. when next run wcf client, use proxy well. here website lists proxys. you'll find ip address/post , username/password use. can configure test machine use 1 of these proxies , test away. note: f...

Objective-c class create methods -

let's have class base. @inerface base : nsobject { } +(id) instance; @end @implementation base +(id) instance { return [[[self alloc] init] autorelease]; } -(id) init { ... } @end and have derived class derived. @interface derived : base { } @end which reimplements init method. now want create instance of derived class using class method +(id) instance . id foo = [derived instance]; and foo base class. how achieve foo derived class in case? should reimplement class method derived classes ? (actually immplementation totally same). is there more elegant way ? when create instance using [derived instance] , instance of class derived . try it. trick messaging self in instance method: +(id) instance { return [[[self alloc] init] autorelease]; } when send instance message base , self base . when send same message derived , self derived , therefore whole thing works desirable.

iphone - custom MKAnnotationView -

i have been trying create mkannotationview has display multiple line of text. some 1 has pointed me things said in below url how add more details in mkannotation in ios but not sure how attain due small knowledge in iphone programming.. i have searched long tme no use ... looking help...please guide me .. just clarify, , based on saying, want customise of callout bubble shows title/subtitle, not annotation view itself, correct? in case you're not clear, mkannotationview image/icon/button see on top of map specific location. once tap on image/icon, if enabled, call out bubble appear can set view left hand side, title, subtitle , view right hand side - hoping customise? if that's case, non-trivial task , if new iphone development chances going take long time implement. if still want have look, here's blog post might of interest you... http://blog.asolutions.com/2010/09/building-custom-map-annotation-callouts-part-1/

inversion - How can I reverse the colors of an image with the tool ColorMatrix? -

what values have put in matrix? dim clmatriz imaging.colormatrix = new imaging.colormatrix(new single()() _ {new single() {¿?, 0, 0, 0, 0}, _ new single() {0, ¿?, 0, 0, 0}, _ new single() {0, 0, ¿?, 0, 0}, _ new single() {0, 0, 0, ¿?, 0}, _ new single() {0, 0, 0, 0, ¿?}) though not sure how particular version of color matrix works , if pixel values in range 0-255 or 0-1 here's how should work: in case pixel range 0-255: dim clmatriz imaging.colormatrix = new imaging.colormatrix(new single()() _ {new single() {-1, 0, 0, 0, 255}, _ new single() {0, -1, 0, 0, 255}, _ new single() {0, 0, -1, 0, 255}, _ new single() {0, 0, 0, 1, 0}, _ new single() {0, 0, 0, 0, 1}) in case 0-1: dim clmatriz imaging.colormatrix = new imaging.colormatrix(new single()() _ {new single() {-1, 0, 0, 0, 1}, _ new single() {0, -1, 0, 0, 1}, _ new single() {0, 0, -1, 0, 1}, _ new single() {0, 0, 0, 1, 0}, _ new single() {0, 0, 0, 0, 1})

Magento - batch import error -

i creating batch script import products particular category. i however, receiving error in output: exception 'pdoexception' message 'sqlstate[23000]: integrity constraint violation: 1062 duplicate entry '51-1' key 'idx_stock_product'' this seems insert first record in csv file, fails on next one. has gone wrong database, or issue script? thanks it seems though database corrupt. reverting older sql dump seemed have fixed problem

Bind Devexpress girdview 2 from devexpress gridview1's callback -

i have 2 devexpress gridview in page. i tried binding data devexpress gridview2 devexpress gridview1's custom callback method.. well no result populated on devepress gridview 2.. it's bank... the code shown aspxgridview1_customcallback(object sender, aspxgridviewcustomcallbackeventargs e) { datatable dt_getdata = commonbl.getuserdefinedresult("select * accounts id='tr=009'"); if(dt_getdata!=null) { aspxgridview2.datasource = dt_getdata; aspxgridview2.databind();}} no errors found while debugging...why so?? please suggest solution! the problem appears because callback response contains information control initiated callback. i.e. if aspxgridview2 not part of aspxgridview1, code not have effect since information aspxgridview not passed client. possible solution send callback aspxgridview2 , bind control data in customcallback event handler. please refer how show detail information in separate aspxgridview example.

How to detect if part or all of object overlaps with another object in Android OpenGL-ES application? -

assume have 3 cubes @ random location/orientation , want detect if of cube overlapping (or colliding) cube. overlap or collision happen cubes location/rotation changed in each frame. please note looking android based , opengl es (1.0 or 1.1) based solution this. this isn't opengl problem - rendering. don't know of ready-made android libraries 3d collision detection, might have maths yourself. efficient collision detection art of using quick, cheap tests avoid doing more expensive analysis. problem, approach detecting if cube intersects cube b quick rejection test, either compute bounding spheres , b - if distance between 2 sphere's centers greater sum of radii, , b not intersect compute axis-aligned bounding boxes , b - if bounds not intersect ( very easy test ), neither , b if bounds test indicates possible collision it's time maths. there 2 ways go here: testing vertex inclusion , testing edge/face intersection vertex inclusion testing vertices ...

php - display exception on div block -

is possible display exception on particular div block? catch (exception $e) { // want display message on html div block. echo $e->getmessage(); exit; } edit -> suppose have index.php file. , there div block called error. want show exception on <div id="error"> </div> thanks catch (exception $e) { // want display message on html div block. echo sprintf('<div>%s</div>', $e->getmessage()); exit; }

bpm - Bonita open studio schedule task -

i have bonita open studio project working great. now, don't know how schedule process run daily the solution is: put timer in pool. add transition timer step. finaly config timer run daily: click timer go "general" press "edit.." in "timer condition" press "finish" buttom

visual studio 2010 - Should I compile my application to the latest .NET Framework even if I'm not using any new features? -

i've developed application using visual studio 2010, default compiles .net framework 4. however, far i'm aware, application not using .net 4 specific features , work fine compiled 3/3.5 or 2. main problem see compiling v4 many users won't have v4 framework installed , need go through process of downloading , installing it. there performance/security/etc benefits running same code compiled v4 rather previous versions justify using v4, or should use older versions until need new features found in 4? amr to honest think go other way, use .net 4.0 anyway. gives ability use new features should become relevant doing. more , more users getting .net4 more apps use may there anyway.

c# - Deserializing JSON string to Object with json.net -

i'm building small application pulls statistics api have no control over. json string looks this: { "weapons": [ { "aek": { "name":"aek-971 vintovka", "kills":47, "shots_fired":5406, "shots_hit":858 }, "xm8": { "name":"xm8 prototype", "kills":133, "shots_fired":10170, "shots_hit":1790 }, } ] } and objects set follows: class weapscollection { public weaponlist[] weapons { get; set; } } class weaponlist { public weapondetails aek { get; set; } public weapondetails xm8 { get; set; } } class w...

inversion of control - Prism 4.0 : Overriding InitializeShell() Method -

i've been going through documentation creating prism applications , setting shell seems split 2 methods, createshell() , initializeshell() for createshell have: protected override dependencyobject createshell() { return servicelocator.current.getinstance<shell>(); } the documentation says code needed in intializeshell() method ensure ready displayed. following given example: protected override void initializeshell() { application.current.mainwindow = (window)this.shell; application.current.mainwindow.show(); } i have noticed if omit first line , call show() method seems work (mainwindow appears have shell assigned it). can tell me why case, , why still need explicity set mainwindow property here? also did not register shell interface within container, how able resolve shell in createshell()? question 1: why calling show() seem work , why application.current.mainwindow seem populated? there few things s...

powershell - SharePoint 2010 - Performance (New-SPWeb $Url).ApplyWebTemplate("{GUID}#MyCustomTemplate") -

i want create new spwebs custom template. $web = new-spweb $url $web.applywebtemplate("{guid}#mycustomtemplate") my problem creation 1 spweb custom template takes 40 s on vm. there other , faster way create spwebs custom template? why not use -template parameter. example, new-spweb -url $url -template "{guid}#mycustomtemplate" i did not have custom template use took 2 seconds on system.

c# - XNA Texturing issue -

ok, i've been trying lot of new things lately, , i've had few stopping points. decided leave 3d because figured didn't , couldn't understand coding involved, i'm pretty @ math though, figured give shot. i'm trying learn 3d xna in c#, i've worked out 2d , wish move on, problem (in opinion) basic of 3d shapes, cube, run problems, after exporting cube blender (after 7th try >_>) , importing xna, cant texture correctly show on cube, downloaded cube model sample source code file, , attempted use that, , default texture, , still have problems. basically, code draw cube is: foreach (modelmesh mesh in model.meshes) { graphicsdevice.rasterizerstate = rasterizerstate.cullclockwise; foreach (basiceffect effect in mesh.effects) { effect.textureenabled = true; //effect.texture = texture; effect.world = world; effect....

java - mxGraph editor - fire an event when a node is created -

i'm playing sample mxgraph editor comes jgraph. have method i'd called every time new node created. know how this? i have feeling has mxgraphcomponent, couldn't figure out how it. have @ api docs of mxgraph class. fires number of granular events specify changes have occurred. interested in mxevent.cells_added.so add listener with: graph.addlistener(mxevent.cells_added, myhandler); where myhandler implements mxieventlistener interface requires invoke method implemented (your method gets called when event fired).

python - How do I enable transactional DDL in pysqlite? -

i using pysqlite which, default, not enable transactional ddl (although ddl transactional sqlite3 client). how enable transactional ddl within pysqlite? pysqlite performs implicit commit unless lowercased query string starts optional whitespace , 1 of 'select', 'insert', 'update' , 'delete', or 'replace'. there no elegant way turn off. work around this, edit pysqlite c source code.

jfreechart - java linear regression in the logarithmic scale -

i have set of 2 data vectors representing x , y. able plot them using jfreechart both on linear , logarithmic scale. on linear scale curve exponantial , on logarithmic scale curve appears linear. want calculate parametrs , b of linear curve in logarithmic scale. i understand regression in linear domain, can use least square method how can in logarithmic domain? how can linear regression on logarithmic representation of curve? anyone can clarifying how can proceed? afaik, nonlinear regression not feature of jfreechart . description, sounds data may amenable linearization transformation , reduce problem linear regression.

eclipse - Enforce type specification on public members of Groovy types -

in groovy, specifying types optional. there advantages specifying them on public class members methods , properties. it's form of documentation , enables ides perform auto-completion, refactor code, find references, , other static analysis tasks more reliably described in groovy coding style article. is there way enforce policy in eclipse warning appear when public member missing explicit type? along lines of checkstyle or findbugs tool groovy great. no, there nothing in groovy-eclipse @ moment, interesting idea. can raise enhancement request this: http://jira.codehaus.org/browse/greclipse

http - Local proxy question -

is possible install proxy locally (on windows xp) , redirect, example, traffic "google.com" "yahoo.com". if call http://www.google.com/test should redirect http://www.yahoo.com/test , return response yahoo. long story short : have old program , there url used in (for web service), value of url compiled in app. now, it's connecting in production i'd make tests in qa, redirect url "http://prod.webservice.website.com" "http://qa.webservice.website.com" without having recompile old application. maybe fiddler job. it's local proxy capable of transforming requests.

asp.net - Unexpected postback happening on a user control -

we creating new user control using boiler plate template our application. noticed anytime textbox on new user control has focus , enter key pressed, form executes postback. happens if autopostback on text box set true. no other user controls in our app behave way. of places me look? thanks! this default browser behaviour. check answer here turn off. hdi: disable postback on html input box

Patterns on apple based (iPhone & iPod) serial numbers? -

we running iphone repair website , looking identifying phones , ipods serial numbers. has come across pattern in serial numbers or api built purpose ? i know apple have there service checker build somthing our admin system. the pattern triplets of letters or numbers. they're never mixed.

Closing a Window in WPF (When not in that Window) -

i have application starts simple start screen allowing user select either new or open project. when selecting new have new window displayed wizard collects data passed main window. i create new window main window , show that. close wizard enough this.close(); how close initial window startup uri window? application.current.mainwindow.close();

vb.net - Label position should fixed right and grow to left -

how can set labels align on right when have diffrent lenghts. have set of labels occuring next each other , underneath each other. problem align left within label row,but need them align on right showing sums other rows. just verify not talking text align looking solution align labels. thanks in advance simply set autosize property false in designer. adjust size fit column. set textalign 1 of right-alignment ones.

Requesting for a clientaccesspolicy file in Silverlight 3 -

i want know if possible send request clientaccesspolicy.xml file in silverlight? server offline begin , client not policy file on start. gets cached , further requests fail. i want send request server , request policy file periodically. ok or have no option restart application ? thanks unfortunately usecase not supported in silverlight 4. it well-known issue , microsoft take upon fix in silverlight vnext. if you're passionate fixing issue consider voting on uservoice .

internet explorer - How to debug css in IE? -

is there way debug css file in ie? wish see if particular background-image loaded or not. in reference question: extjs gridfilter icon not showing in ie shows in firefox or version of ie, try firebug lite . can bookmark link given on page (bookmarklet) , then, open firebug thingy whilst on ie, click on bookmark added.

click - jQuery prevent an image from being clicked on until other function is completed -

i have function preload. i want make image on page nothing when click on until preloading has completed. page loads preloading begins - clicking on main image nothing preloading completes - clicking on main image call intended function how can realized? thanks use .load() event handler $('#myimage').load(function() { // handler .load() called. });

iphone - Cloudmade distance between two points -

i need distance between 2 points without showing map on iphone app. i'm trying use cloudmade ... can't figure out documentation provided. can me ... , make little step-by-step tutorial or give me pointers ? thank you *i want use cloudmade because need distance following public roads. know it's stupid "question" can't seem head around ... i think post useful you, can info route instructions.

django - Inline Formset Object Not Iterable -

my ultimate goal here save action modelforms given website (the foreign key). after form validation, want sum points individual actions , confirm it's below threshold (100 points) before save actions. if total exceeds 100, i'll raise validationerror. my issue here i'm receiving following error message: "'actionformformset' object not iterable" the instances exist, issue seems iterating on particular object. in official documentation, there's example iterates on modelformset in exact fashion. however, modelformset populated queryset, whereas inlineformset not explicitly populated in same way(maybe implicitly, don't know). can not iterate on object? should here? thanks actionformset=inlineformset_factory(website, action, extra=1, can_delete=true) if request.method=='post': action_formset=actionformset(request.post, instance=website,prefix="actions") if action_formset.is_valid(): #after vali...

c# - MongoDB + NoRM- Concurrency and collections -

lets have following document structure: class blogpost { [mongoidentifier] public guid id{get;set;} public string body{get;set;} .... } class comment { [mongoidentifier] public guid id{get;set;} public string body {get;set;} } if assume multiple users may post comments same post, best way model relation between these? if post have collection of comments, might concurrency problems, won't ? and placing fk attribute on comment seems relational , or? you have 2 options: 1. aggregate comments in post document, or 2. model post , comment documents. if aggregate comments, should either a) implement revision number on post, allowing detect race conditions , implement handling of optimistic concurreny, or b) add new comments mongodb modifier - e.g. like var posts = mongo.getcollection<post>(); var crit = new { id = postid }; var mod = new { comments = m.push(new comment(...)) }; posts.update(crit, mod, false, false); if model post , c...

file io - Change Sticky bit with Java -

is there way add/remove sticky bit (s_isvtx) on file , directory java ? call out /bin/chmod command. since sticky bit platform specific java not provide standard library api it.

.net - WPF installation under Microsoft folder by default -

when publish wpf application visual studio, creates under microsoft folder in start menu of windows. how change it? actually, "microsoft" "company name" entered (looks skipped entering) while installing visual studio. every project default has company name "microsoft" in version info. either reinstall visual studio company name, or change assembly info - company in every new project create. that's see when right-click exe file, , go properties->details tab. default options in properties > publish > options should taken assembly info

Javascript / jQuery Find Text duplicates -

how approach finding duplicates in text document. duplicates can set of consecutive words or sentence. sentence not necessary ending dot. let's page contains document of 200 lines of 2 sentences identical, want highlight 2 sentences duplicates when "check duplicate button" clicked. interesting question — here's idea on how i'd probably: http://jsfiddle.net/saqas/1/ —  not anyhow optimized! var text = $('p').text(), words = text.split(' '), sortedwords = words.slice(0).sort(), duplicatewords = [], sentences = text.split('.'), sortedsentences = sentences.slice(0).sort(), duplicatesentences = []; (var i=0; i<sortedwords.length-1; i++) { if (sortedwords[i+1] == sortedwords[i]) { duplicatewords.push(sortedwords[i]); } } duplicatewords = $.unique(duplicatewords); (var i=0; i<sortedsentences.length-1; i++) { if (sortedsentences[i+1] == sortedsentences[i]) { duplicatese...

iphone - UIImagePickerController crashes in iPad -

-(ibaction)selectpressed:(id)sender { uiimagepickercontroller *picker = [[uiimagepickercontroller alloc] init]; picker.delegate = self; picker.sourcetype = uiimagepickercontrollersourcetypephotolibrary; [self presentmodalviewcontroller:picker animated:yes]; [picker release]; } i testing code on ipad , iphone simulators. in iphone simulator (and on real iphones too) it's ok - gallery appears. on ipad simulator (i don't have device), crashes. ideas why? please read exception messages in device log: on ipad, uiimagepickercontroller must presented via uipopovercontroller

Silverlight "Processing..." indicator -

i'm interested in including "throbber" in silverlight application since such common thing i'd download 1 or follow simple tutorial. can suggest site can tutor me in or can provide 1 me download? by "throbber" mean thing app uses show processing. sorta spinning blue lifesaver in windows 7 or spinning beachball in osx or other of million out there. also, clear, i'm not talking altering silverlight app loading one. thank you take @ busyindicator control.

javascript - Problem with regexp in userscript for chrome -

this might noob question, have tried find answere here , on other sites , have still not find answere. @ least not understand enough fix problem. this used in userscript chrome. i'm trying select date string. string innerhtml tag have managed select. html structure, , string, this: (the div selected tag within content of string) <div id="the_selected_tag"> <a href="http://www.something.com" title="something xxx">link</a> " 2011-02-18 23:02" <a href="http://www.somthingelse.com" title="another link">thing</a> </div> if have solution helps me select date without fuzz, great. the javascript: var pattern = /\"\s[\d\s:-]*\"/i; var tag = document.queryselector('div.the_selected_tag'); var date_str = tag.innerhtml.match(pattern)[0] when use script ordinary javascript on html document test it, works perfectly, when install userscript in chro...

android - When should I do certain SQLite operations on another thread(not the main thread)? -

my android application includes sqlite database sqliteopenhelper class manage it. during application use, user may perform operations such adding/deleting/updating etc on database. at points size of operation known, this: user clicks button save item the sqlitedatabase performs single insert query user continues using app at other areas of app, operation may large, inserting 10+ items database @ once. questions: should thread simple operations inserting/updating/deleting/viewing 1 item? will take longer insert 1 item table contains many items(like 30+) take insert table no items? if don't need thread such simple operations, @ point suggest start threading them? when thread mean using thread not main ui thread. edit: realize small operations not take time , away doing them on main thread. concerned bad practice executing them on main thread , clarification! general rule everything: if it's fast enough, on main thread. if not, use worker ...

sql - How to delete rows from same table? -

i have table logs requests , responses. table has timestamp column , transaction type column 2 possible values: req , resp . regardless of why, have resp rows have no matching req row. i trying delete resp rows don't have matching req row same timestamp. ideas? what need in pseudocode is: delete rows in table transaction type equals resp , has no matching req row same timestamp. try this: delete table t txtype = 'resp' , not exists (select * table timestamp = t.timestamp , txtype = 'req') (inside of transaction can roll if fails!) and oh yeah, chris lively below raises excellent point.. when refer " timestamp " speaking generically? or talking sql server timestamp data type guaranteed unique ?? if former, , using datetime or such, sure can't have 2 or more different requests @ exact same time ??

iphone - How to limit the number of tabs on a UITabBarController? -

i have working iphone app uitabbarcontroller. works fine. app has more tabs can shown across portrait width of display, see 5 tabs in total (the last being "more" tab). thing is, want relegate of "less interesting" things behind "more" tab. know if had 2 view controllers, i'd see 2 tabs, , on until exceeded 5 tabs. how can show 4 tabs (3 plus "more" tab), instead of 5? my guess is: not possible setting attribute (which convenient!), since cannot find in docs, or here frankly, suggest otherwise. short of implementing own "more" tab, , supplying tab bar controller 4 view controllers (the last being own "more" controller), tips, tricks, or hints appreciated. thanks! this not appear possible standard uitabbarcontroller. don't think else has run problem, , solved already.

trouble in overriding a method in vb.net -

protected overrides sub dispose(byval disposing boolean) try if disposing = true , components isnot nothing components.dispose() end if mybase.dispose(disposing) end try end sub error: protected overrides sub dispose(disposing boolean)' has multiple definitions identical signatures. how can call without raising error ? the error says have two(or more) dispose methods same signature. try search dispose method in same class, , if same implementation, remove it.

objective c - How to implement exchanging items' locations by drag and drop -

i working on mac application have ran road block. trying create 2 images , make can dragged , dropped swap locations. lost here thorough explanation appreciated! i'm not new programing ive been working xcode , objective c few months. in advance! the similar way true images. difference replacing 2 objects @ same time, should create 2 temporary variables. create cgrect variable named img1rect store rectangle of 1st image , img2rect variable (i think you've got what) drag 1st image onto 2nd, place. if dragg'n'drop successfull (e.g. check whether touch coordinate located on 2nd mage) set img1rect frame 2nd image , img2rect frame 1st. if matter of question drag'n'drop handling find plenty of information using search. example, chck out: basic drag , drop in ios

c++ - Why throw a class over an enum? -

just wondering, why better throw class on enum surely throwing classes more overhead? e.g. enum myexception { except_a, except_b, except_c } void function f(){ throw a; } int main(int arc, char* argv[]){ try{ } catch (myexception e){ switch(e){ except_a: break; except_b: break; except_c: break; } } return 0; } apart overhead. need declare class each 1 might override std::exception or something. more code, larger binary... what's benefit? given enum myexception { except_a, except_b, except_c } write catch clause catches except_c exceptions. with struct my_except {}; struct my_except_a : my_except {}; struct my_except_b : my_except {}; struct my_except_c : my_except {}; that's easy, since can catch base class or derived classes. many of common advantages of derivation apply exceptions. example, base classed can stand in derived classes , code needs know base classes deal derived excep...