Posts

Showing posts from September, 2010

c# - Download and save file from http server using .Net Socket -

hello everybody. i know how download , save file hard drive, zip file http server using system.net.socket.sockets class. i know there allot easier ways download file .net, know how with sockets , if possible of course although i'm pretty sure is. i've tried few things, nothing worked once don't have background experience sockets. your satisfying curiosity appreciated. question ask. thank you. note : the file standard zip file, way work file type. the file size different every day. the file downloaded every minute, caching of such file must disabled accurate , update file version server. file url sample: www.somewhere.com/files/feed/list.zip you directly .net socket, require parsing , understanding http request. the standard way use higher level system.net classes. example, can done in 2 lines of code via webclient.downloadfile - why make life more difficult yourself? if must raw sockets, take lot of work. @ it's core, can conne...

c++ - How to get fileindex without using file handle? -

the function getfileinformationbyhandle gives structure values nfileindexhigh , nfileindexlow comprise of fileindex . what number? same usn? is there way fileindex of file without opening it (any other method except getfileinformationbyhandle)? you can use zwquerydirectoryfile fileobjectidinformation , fileidbothdirectoryinformation , fileidfulldirectoryinformation query object id information files in directory. in case have open directory having file , not file itself. can useful example if file opened exclusive access or of cause if has no permission open file , not have or want not use backup privilege. updated : following test example #include <windows.h> #include <stdio.h> #include <tchar.h> typedef long ntstatus; #define nt_success(status) (((ntstatus)(status)) >= 0) #define nt_status(x)((ntstatus) { x }) #define status_success ((ntstatus)0x00000000l) #define status_no_more_files ((ntstatus)0x80000006l) #define statu...

wpf - How to declare a string resource that bound to a property? -

as may know, can declare string "variable" using resource: <sys:string x:key="somekey">somevalue</sys:string> i want replace somevalue binding property, how can it? i don't think possible. then, why need this. couldn't controls bind same string instead of using resource?

sql - Using the result of an Stored procedure in a Select statement -

i have stored procedure returns dataset(table) . how can use result of stored procedure in select statement? i need this select t1.* dummy t0 inner join (exec [dbo].[spgetresults] '900',300,'usd') t1 on t1.akey=t0.akey i'm using sql server 2005 create table-valued user-defined function instead.

Success handler not getting called in file upload using extjs -

i have j2ee web app form upload file location on server. during upload waitmsg shown user should disappear once upload completed msgbox indicating same. code success case provided in js file. upload works fine, waitmsg continues after upload @ server has completed. js code given: ext.onready(function(){ ext.quicktips.init(); var msg = function(title, msg){ ext.msg.show({ title: title, msg: msg, minwidth: 200, modal: true, icon: ext.msg.info, buttons: ext.msg.ok }); }; var fp = new ext.formpanel({ renderto: 'fi-form', fileupload: true, width: 500, frame: true, title: 'upload xml config file ', autoheight: true, bodystyle: 'padding: 10px 10px 0 10px;', labelwidth: 50, defaults: { anchor: '95%', allowblank: false, msgtarget: 'side'...

iphone - UIimagepicker controller image only selection -

i have give functionality select photos user. have used this: ipc.sourcetype = uiimagepickercontrollersourcetypephotolibrary; now have restrict user select photos , want videos not displayed on list. or somehow user should not select video @ all. how achieve that? basically you're trying set "media types". , luckily imagepicker has property called "mediatypes". :) receives array of media types show selection. even luckily-er default behaviour of imagepicker show image types. but if want make sure can this: [imagepicker setmediatypes: [nsarray arraywithobject:kuttypeimage]]; and don't forget add @ top of file... :) #import <mobilecoreservices/utcoretypes.h> but really, think can trust apple when it's they're default behavior... :)

c# - Concatenated string column is not displaying properly in dropdown list(asp.net) -

below query in storedprocedure(sql server 2008) return list of items table. query: select ( coalesce(reviewdescription,'')+ replicate (' ', 20 - len(reviewdescription)) + '|' + ( convert(varchar(100),reviewcharge))) reviewtypes reviewtype query result(copied text pad looking below): sample review type |200 but after binding asp drop down control displaying below drop down display: sample review type|200 please 1 can on this. thanks in advance... it sounds browser collapsing whitespace. in html source see what's actually being sent down. can determine whether it's problem in display or data access. (i'm not sure way of displaying pseudo-table in drop-down, honest.)

How to read excel(2007+ xlsx) sheet using actionscript(AIR)? -

how read excel(2007+ xlsx) sheet using actionscript(air)? as3xls an actionscript 3 library reading , writing excel files. reading numbers, text, , formulas excel version 2.0-2003 , writing numbers, text, , dates excel 2.0 supported. no server-side needed. support information documentation , samples @ http://code.google.com/p/as3xls/

winforms - c# Cannot get list of subdirectories -

i've seen code (and similar) on web, cannot work. whenever debug line line, breaks out of debugging , loads application. no error messages presented, , code after "faulty" line remains unprocessed. here offending code: foreach (string folder in allfolders) { string[] subfolders = directory.getdirectories(folder, "*", searchoption.alldirectories); messagebox.show("test"); } the foreach loop entered into, message box never displayed. if remove searchoption.alldirectories code processed successfully, need way include all subdirectories within directories. any ideas? your code works fine me. seems me method call takes lot of time execute. example, if there root directory in allfolders have wait several minutes (depends on system parameters). have checked code snippet on directories few number of nested directories? assumed, work in winforms , execution doesn't reach messagebox.show call.

ruby on rails - Application works in development mode but not in production mode -

i succeed set in place rails server. when i'm trying add new "machine" have error. can see in logs actionview::templateerror (undefined method `owner_id' #<machine:0x7f85a0d279e0>) on line #49 of app/views/machines/_form.html.erb: 46: </div> 47: <p> 48: <%= f_machine.label :owner %><br /> 49: <%= f_machine.collection_select :owner_id, owner.find(:all), :id, :name, :prompt => "select owner"%> 50: </p> 51: <p> 52: <%= f_machine.label :category %><br /> app/views/machines/_form.html.erb:49 app/views/machines/new.html.erb:4 app/views/machines/new.html.erb:3 app/controllers/machines_controller.rb:35:in `new' passenger (2.2.15) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request' passenger (2.2.15) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop' passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:441:in `start_request_h...

Making parts of Texture2D transparent in XNA -

i'm starting game development , thought game tank wars or worms nice. hardest part can think of far making terrain destructible , want know how it's done before doing easy parts. i thought explosion have mask texture scaled different weapons. using mask should make underlying terrain transparent (and optionally draw dark border). http://mikakolari.fi/wp-content/uploads/2010/10/terrain.png how achieve that? have change alpha value pixel pixel or can use kind of masking technique? drawing blue circle on top of terrain isn't option. i have versions 3.1 , 4.0 of xna. this difficult question answer - because there many ways it. , there pros , cons each method. i'll give overview: as overall design, need keep track of: original texture, "darkness" applied, , "transparency" applied. 1 thing can sure want "accumulate" results of explosions somewhere - don't want doing maintaining list of explosions have ever happened. so ...

javascript - jQuery selector: Firefox recognize but IE not -

this element custom attribute: <input type="radio" status="b" name="opt_parent"/> my script: alert($(this).attr("status")); alert($(this).attr("test")); output: firefox 3.0.10 --> "b" , "undefined" ie 8.0.7600.16385 --> "true" , "undefined" my observation: ie return option button "checked state" true/false not custom attribute value. ie can detect whether custom attribute exist. my question: how custom attribute value in ie? this workaround ie, using outerhtml var status = ($(this) .get(0) .outerhtml .replace(/^.+?\bstatus\s*=\s*(?:['"])(\w+).*$/, function(tag, valueattr) { return valueattr; })) || '';

c# - Import hotmail friend's emails in asp.net application -

i build application import friend list hotmail accounts. tired find out exact solution. of links provide solution, no 1 work. can 1 give me more information this. thanks in advance. imad check out: http://msdn.microsoft.com/en-us/library/bb463989.aspx

delete line backwards (Emacs) -

this basic tried find answer. "c-k" deletes cursor end of line, there analogous shortcut delete line backwards cursor point? best try c-u 0 c-k - i.e. c-k prefix 0 kills point start of line. see documentation c-k (kill-line) more information.

ruby on rails - How to save something to the database after failed ActiveRecord validations? -

basically want log action on mymodel in table of mymodellog. here's pseudo code: class mymodel < activerecord::base validate :something def # test errors.add(:data, "bug!!") end end i have model looking this: class mymodellog < activerecord::base def self.log_something self.create(:log => "something happened") end end in order log tried : add mymodellog.log_something in something method of mymodel call mymodellog.log_something on after_validation callback of mymodel in both cases creation rolled when validation fails because it's in validation transaction. of course want log when validations fail. don't want log in file or somewhere else database because need relationships of log entries other models , ability requests. what options? nested transactions seem work in mysql. here tried on freshly generated rails (with mysql) project: ./script/generate model event title:string --skip-...

Company name in info.plist file - iPhone -

i planning release iphone app. can set company's name in info.plist file? update: in addition company's name, wanted set product name , version. is itunes connect option? or can in project itself. the name appears under application in app store set in itunes connect. can't set per app... name 1 time thing - can't change this, unless buy new developer account! you set name displays under application icon on home screen of iphone in info.plist. bundle display name . application title in app store set in itunes connect (and version number - although do have specify version number in xcode well, , if version number differs xcode itunes connect - i've heard - app rejected). just go through process (like else) , you'll understand.

ios4 - iOS 4 Multitasking Tutorial -

i've been looking on google , i've got page 10 of results , still did not find guide on how implement multitasking application. anyone has one? thanks apple's own guide multitasking

Getting rid of \x## in strings (Python) -

i need extract description file, looks this: "tes4!\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x00\x00\x00hedr\x0c\x00\xd7\xa3p?h\x03\x00\x00\x00\x08\x00\xffcnam\t\x00martigen\x00snam\xaf\x00mart's mutant mod - rc4\n\ndiverse creatures & npcs, new creatures & npcs, dynamic size , stat scaling, increased spawns, improved ai, improved factions, , more.\n\n\x00mast\r\x00fallout3.esm\x00data\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00mast\x16\x00mart's mutant mod.esm\x00data\x08" i've laready figured out how part need, there's still unwanted data in there don't know how rid of: \xaf\x00mart's mutant mod - rc4\n\ndiverse creatures & npcs, new creatures & npcs, dynamic size , stat scaling, increased spawns, improved ai, improved factions, , more.\n\n\x00 should become: mart's mutant mod - rc4\n\ndiverse creatures & npcs, new creatures & npcs, dynamic size , stat scaling, increased spawns, improved ai, impr...

java - How to ensure the same account is not used to log in two different people at the same time in Spring Security? -

i have spring mvc app not protect updates of user data transactions. it assumes single user accessing account data account @ 1 time. however, if 2 users log in using same authentication credentials, theoretically possible, although unlikely, 2 database updates on same user data overlap , conflict. is there simple way protect against in spring security? spring security supports protection against concurrent logins. see 2.3.3 session management instructions of how enable it.

asp.net - Why does IIS7 take a long time -

it looks likes if don't visit low traffic site day, takes long time first page load. believe it's because iis7 shuts down application when receives no requests length of time. how can stop happening? i have dedicated server have access required change things in iis there 2 ways can handle this. modify "idle timeout" value within application pool. default shutdown application if there no requests 20 minutes if using asp.net 4.0 can use new auto-start behavior keep app "always running" can see blog post examples on how configure it.

Show shortcut keys in ScreenTips in Visual Studio 2010 -

in visual studio 2005 , 2008 used able mouse on toolbar , tooltip pop showing associated shortcut key if turned on feature. feature seems missing in vs 2010. method configure feature in 2005 , 2008: display keyboard shortcuts in visual studio context menus suzanne hanson microsoft indicated in post 2010, feature not configurable , turned on default. http://connect.microsoft.com/visualstudio/feedback/details/489554/toolbar-icons-tool-tips-missing-shortcut-hint . does have feature turned on? visual studio version out-dated? (help -> reports visual studio 2010 v. 10.0.30319.1 rtmrel) the tooltips there default (at least in version visual studio 2010 v. 10.0.30319.1 rtmrel). if don't see them, try repairing/reinstalling. fixed me.

optimization - Minimize html, doubts and questions -

minimizing html section on google's page speed there still room improvement. my site dynamic , html deflated there no reason put more pressure on server (i don't want minimize pages real time before sending). what minimize template files. templates files mix of php , html i've come code think pretty safe community revised. // loop trough template files // php cleaned first line-comments not interfere regex $original = file_get_contents($dir.'/'.$file); $php_clean = php_strip_whitespace($dir.'/'.$file); $minimized = preg_replace('/\s+/', ' ', $php_clean); this make template files single long file alternated places db content inserted. google's homepage source looks more or less wonder if follow similar approach. question 1: antecipate potencial problems? question 2: there anyway better (more efficient this)? and please remember i'm not trying validate html templates not valid html (header , footer includes, examp...

Drupal Views of nodes to show node comments -

i've encountered drupal problem: i'm using views module rendering nodes of kind, based on user id of it's author (it content profile actually). want view show comments node, in node/%. not find option in views or relevant module. in wrong direction , should reorganize stuff this...? any ideas, how can done? regards, laci using views not best plan of action. should instead create node template in theme , customize it. if needed can put logic in preprocess function. requires more coding want.

Suppressing/hiding/overriding Android call UI -

is possible initiate outgoing call without having phone invoke it's default dialing screen? point able make call without knowing i'm making call. from sdk application, not possible.

sql server - Is there a legitimate reason for using so many varchar fields? (MS SQL DB) -

i'm working on data migration old ibm universe-based system new enterprise-level data-information management system, , learning database design in process. i took @ back-end database structure of new system (it's ms sql db, 100 tables), , find things pretty odd. don't know if inexperience reason think , standard practice, or if these oddities bad database/application design. for example: some date fields varchar(20) fields store measurements varchar(50), rather decimal , enum store units of measurement isbn 10 & 13 number fields varchar(50) some look-up id foreign keys varchar(100), though actual look-up table primary key int some fields varchar(0) additional separate fields storing month & year, each of varchar(250) - i don't know kind of design decision require maximum of 250 characters year, unless went overkill on y2k compliancy, or decided use seconds since beginning of universe store datetime and plenty of others. db looks more half va...

c - How could these case conversion functions be improved? -

as learning exercise, 3 functions—togglecase, lowercase , uppercase—each expect pointer ascii char string, terminated null character; work expected. there more efficient or faster methods of accomplishing task? breaking unspoken rules of c coding? i've made use of macros because, think, makes code better , more efficient function calls. typical or overkill? please feel free nit-pick , critique code (but nice). case_conversion.h #define case_flag 32 #define a_z(c) (c >= 'a' && c <= 'z') #define a_z(c) (c >= 'a' && c <= 'z') void togglecase(char* c); void lowercase(char* c); void uppercase(char* c); case_conversion.c #include "case_conversion.h" void togglecase(char* c) { while (*c) { *c ^= a_z(*c) || a_z(*c) ? case_flag : 0; c++; } } void lowercase(char* c) { while (*c) { *c ^= a_z(*c) ? case_flag : 0; c++; } } void uppercase(char* c) { while (*c) { *c ^= a_z(*c) ? case_flag :...

prevent *.bak *.inc file upload from a apache server -

is possible prevent people seeing files .bak apache directory ? if there request url (http://foo.com/bar.bak), it'd have 404 error, , prevent upload file. now know answer, here : 1 of them use rewriterule in httpd.conf. – cedric 14 secs ago edit know answer, here : 1 of them use rewriterule in httpd.conf. rewriteengine on # turn on rewriting engine rewriterule rewriterule ^(.*(\.(html|htm|gif|js|jpg|jpeg|php|css)|\/))$ $1 [l,nc] # not (no rewriting), don't execute next rule #("nc", tells apache rule should case-insensitive, , "l" tells apache not process more rules if 1 used.) rewriterule ^.*$ / [nc,r] # rewrite other urls / this main idea. please, modify first regex needs ! (as urls foo?bar=obu won't work, nor foo/bar )

functional programming - Haskell function application and currying -

i interested in learning new languages, fact keeps me on toes , makes me (i believe) better programmer. attempts @ conquering haskell come , go - twice far - , decided time try again. 3rd time's charm, right? nope. re-read old notes... , disappointed :-( the problem made me lose faith last time, easy one: permutations of integers. i.e. list of integers, list of lists - list of permutations: [int] -> [[int]] this in fact generic problem, replacing 'int' above 'a', still apply. from notes: i code first on own, succeed. hurrah! i send solution friend of mine - haskell guru, helps learn gurus - , sends me this, told, "expresses true power of language, use of generic facilities code needs". it, drank kool-aid, let's go: permute :: [a] -> [[a]] permute = foldr (concatmap.ins) [[]] ins x [] = [[x]] ins x (y:ys) = (x:y:ys):[ y:res | res <- ins x ys] hmm. let's break down: bash$ cat b.hs ins x [] = [[x]] ...

Bash - Hex to String -

in bash, how can convert hex-encoded string this: 2e2f65202d6b2022616622 or \x2e\x2f\x65\x20\x2d\x6b\x20\x22\x61\x66\x22 (or similiar) to: ./e -k "af" ... , execute it? thanks! eval `printf "\x2e\x2f\x65\x20\x2d\x6b\x20\x22\x61\x66\x22"`

Webresource.axd doesn't load on my asp.net application running on my web farm -

i'm working on asp.net web application. i'm getting errors on of pages runtime javascript errors. i've narrowed problem down single asp menu control on master page. created blank page asp menu control. asp menu control bound web.sitemap . page intermittently gives runtime errors. however, if refresh page, error may or may not appear on given page load. sometimes, works; sometimes, browser throws runtime errors when loading page or when mouse on asp menu control. when catch error in visual studio, message "microsoft jscript runtime error 'sys' undefined". when google message, find associated ajax. however, thing on page single asp control. there absolutely no javascript on page except gets generated .net framework. what causing problem? update i've found out environment has load balancing web farm of 3 servers servicing url. when access application on 1 of servers individually ip address, works fine. to clarify, understand whe...

c# - Can I use a Windows -> Class Library inside a WP7 application? -

i'm creating library application act wrapper exposed api. library ideally should work on desktop application, truth told i'm intending use on wp7 once i'm done creating library. would work? from silverlight.net : silverlight application development platform windows phone 7. high performance gaming supported through xna framework. you can't reference .net assembly compiled against full .net framework in silverlight application. develop library silverlight , should fine.

rails relationship using unique key -

table/entity 1: retrieveddatarecords columns: id record_key table/entity 2: sourcekeys columns: id key_name (unique key) i cant alter these tables legacy reasons, want rails relationship between retrieveddatarecord , sourcekey using record_key , key_name (they same key) in retrieveddatarecord, tried like: belongs_to :source_key, :foreign_key => :record_key but doesn't work. need way tell rails record_key on table same key_name on other table.... you have specify primary_key : belongs_to :source_key, :primary_key => :key_name, :foreign_key => :record_key it should work!

javascript - How do I get VML working in standards mode? -

i able use vml objects on page rendering in standards mode rather quirks mode. i've found fragments of answers scattered around can't figure out. raphael pulls off somehow can't reverse figure out what's happening. basic working example great. i think have figured out. step 1 importing vml namespace though javascript. document.namespaces.add('v', 'urn:schemas-microsoft-com:vml', "#default#vml"); this got random vml samples work in quirks mode not standards. key elements require unit measurements quirks mode assume px if unit not provided. shapes have styled position:absolute; although lines apparently not need part. here's sample 2 ovals. both ovals render in quirks mode blue oval not show in standards mode. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <h...

design patterns - singleton in abstract class php -

i have simple question. use singleton implements abstract class. possible put getinstance() method , variable $_instance in abstract class instead of concrete 1 want create? here's code: <?php class command_log extends command_abstract { private static $_instance=null; public static function getinstance() { if (self::$_instance==null) self::$_instance=new self(); return self::$_instance; } protected function realexecute() { } protected function realsimulate($filehandle) { } } and <?php abstract class command_abstract implements command_interface { protected $_data=array(); //private static $_instance=null; protected $_isexecuted=false; protected $_execute=false; public function enableexecute() { $this->_execute=true; return $this; } protected function __construct() { } protected function __clone() {} public function adddata($data) { ar...

c++ - Does a vector sort invalidate iterators? -

std::vector<string> names; std::vector<string>::iterator start = names.begin(); std::vector<string>::iterator end = names.end(); sort (start,end); //are start , end valid @ point? //or not point front , tail resp? according c++ standard §23.1/11: unless otherwise specified (either explicitly or defining function in terms of other functions), invoking container member function or passing container argument a library function shall not invalidate iterators to, or change values of, objects within container. §25.3 "sorting , related operations" doesn't specify iterators invalidated, iterators in question should stay valid.

XSLT: Modify attribute value based on sibling attribute value -

i have following xml: <?xml version="1.0" encoding="utf-8"?> <odm fileoid="some oid" description="some desc" creationdatetime="2010-10-06t22:35:00-06:00" filetype="snapshot" > <study oid="s_test"> <globalvariables> <studyname>study_name</studyname> <studydescription> study description </studydescription> <protocolname>some protocol name</protocolname> </globalvariables> <metadataversion oid="v1.0.0" name="metadataversion_v1.0.0"> <protocol> <studyeventref studyeventoid="se01" ordernumber="36" mandatory="yes"/> <studyeventref studyeventoid="se02" ordernumber="37" mandatory="yes"/> </protocol> ...

Android - How to add a View progamatically to an Activity's Absolute Layoute setting it's possition? -

i have form several views on it, last 1 spinner bound adapter it's data web server via post request, @ end append additional entry "other...". if option selected on spinner, new edittext view @ bottom user enters custom value, i've managed edittext view show on screen, it's positioned @ top, on other views , can't seem find way make appear @ bottom, below spinner want to, here code have far: edittext suggestcarrierfield = new edittext(getbasecontext()); suggestcarrierfield.setlayoutparams(new viewgroup.layoutparams( viewgroup.layoutparams.fill_parent, viewgroup.layoutparams.wrap_content)); suggestcarrierfield.sethint("suggest carrier"); ((absolutelayout) findviewbyid(r.id.createaccountview)).addview(suggestcarrierfield); ((absolutelayout) findviewbyid(r.id.createaccountview)).invalidate(); using absolutelayout, need use absolutelayout.layoutparams,...

c89 - Problem trying to use the C qsort function -

#include <stdio.h> #include <stdlib.h> float values[] = { 4, 1, 10, 9, 2, 5, -1, -9, -2,10000,-0.05,-3,-1.1 }; int compare (const void * a, const void * b) { return ( (int) (*(float*)a - *(float*)b) ); } int main () { int i; qsort (values, 13, sizeof(float), compare); (i = 0; < 13; i++) { printf ("%f ",values[ ]); } putchar('\n'); return 0; } the result is: -9.000000 -3.000000 -2.000000 -1.000000 -1.100000 -0.050000 1.000000 2.000000 4.000000 5.000000 9.000000 10.000000 10000.000000 it's wrong because order of -1 , -1.1 changed. believe happening because "compare" function. how can fix this? thanks your comparison function broken. says, example, -1.0 equal (equivalent) -1.1 , since (int) ((-1.0) - (-1.1)) zero. in other words, told qsort relative order of -1.0 , -1.1 not matter. why surprised in resultant ordering these values not sorted? in general, should avoid ...

python - PyQT4 and Ctrl C -

i have programs runs several threads (on while loop until ctrl c pressed). app has gui developed in pyqt. however, facing following problem: if press ctrl c on console, , close gui, program exits fine. however, if close gui first, other threads won't stop , program keeps running after ctrl c . knows how address problem? in qt overload onclose method widget/frame or hook lastwindowsdclosed signal whatever need shut down app - don't know if it's diiferent python

c++ - OpenCV - cvExtractSURF is causing a memory leak? -

i using opencv function: cvextractsurf finding major memory leak. has implemented call? my code follows: iplimage *cvimage = [self createiplimagefromuiimage:image grayscale:yes]; cvmemstorage* storage = cvcreatememstorage(0); cvseq *objectkeypoints = 0; //cvseq *objectdescriptors = 0; cvsurfparams params = cvsurfparams(self.hessianthreshold, 0); double tt = (double)cvgettickcount(); //extract features cvextractsurf( cvimage, 0, &objectkeypoints, null, storage, params, 0); tt = (double)cvgettickcount() - tt; //nslog(@"%d features found in %gms seconds\n", objectkeypoints->total, tt/(cvgettickfrequency()*1000.)); cvreleaseimage(&cvimage); cvreleasememstorage(&storage); any ideas leaking? when comment out line: cvextractsurf( cvimage, 0, &objectkeypoints, null, storage, params, 0); no leak occurs. the function cvextractsurf creates list of objects of type cvsurfpoint , puts pointer in objectkeypoints. have free up. add call... ...

wpf - XAML - is LayoutRoot mandatory? -

when create xaml page in silverlight or wpf, system creates top level container called "layoutroot". there special name, or can top level container called (or nothing)? you can absolutely call whatever like. there nothing special layoutroot name. i have ask though, , don't mean seem facetious, did try removing name , seeing happens?

python - How to get setuptools to use a relative path in easy-install.pth when doing "setup.py develop" -

i'm installing python egg using setuptools "python setup.py develop" command. it's important install paths relative. see can do: python setup.py develop --egg-path ../../../../my_directory and .egg-link file uses relative path. however, path added easy-install.pth still absolute path. how make path in easy-install.pth file relative path? if sourcecode in subdirectory of installation directory, made relative automatically. why need relative, anyway?

iphone - Two Views in 1 view controller -

basically, trying have testviewcontroller , there 2 views under it, first view start tool bar , 2 buttons, 1 imagepicker , other 1 mail sending, done that, , after pick image photo library, second view popped out(i want image editing here) tool bar , 1 button first view. doing [self.view addsubview:2ndview], , works, when trying use -(ibaction)dismissdrawing:{[2ndview removefromsuperview] }the program shut down. can me? appreciate help! look @ sample application did last year. need view act superview, add views on top of (if remember correctly, it's been while since did way, use multiple xibs).

Hashing strings to Color in C# -

Image
i don't know if hashing right word this, want convert string hex or argb color semi randomly. i've used string.gethascode function, results skew towards greenness: string[] list = { "test string", "something else", "test hooray" }; foreach (string k in list) { string x = k.toupper().gethashcode().tostring("x8"); console.writeline("#" + x.substring(0,6)); } i'd ideally strings begin similar prefixes have different colors. example, "test string" , "test hooray" should different because both begin "test." i'm not worried absolute solution, want enough. list[] @ most have 10 elements in @ single time, , of time 2, 3 or 4. means color has distinct 2 or 3 other colors. i'm generating visual list, color references name, name should map same color. edit: sample output: #66bd44 #7ec83e #95e4fe colors: http://www.colorcombos.com/combotester.html?color0=66bd44&...

hibernate - Multiple JPA persistence units pointing to same database? -

can have more 1 jpa persistence units pointing same database, in different java projects , deployed on server @ same time? same time mean, not deployed @ same second deployed together. using hsqldb database. i having client-server model project. have 1 single unified database table in server fills data , client access data in different project. can populate database through server. when deploy client project data database gets erased. i using <property name="hibernate.hbm2ddl.auto" value="update" /> both persistence units. can have more 1 jpa persistence units pointing same database, in different java projects , deployed on server @ same time? as long don't have incompatible mappings in both projects, should work. won't able use second level caching though. but when deploy client project data database gets erased. (...) that's not behavior i'd expect hbm2ddl.auto set update don't know if behavior defined wh...

How to set the default page for a .CHM file in HTML Help Workshop? -

when open (.chm) application, see table of contents. default, first entry in file selected, couldn't see corresponding page data. instead, see "this program cannot display web page" (the default error message comes in ie7).the page displayed when click on of contents on left side. is there way of showing page default without clicking on entry? the following code .hhp file. [options] compatibility = 1.1 or later compiled file=config.chm contents file=config.hhc default topic=d:\apps\bin\debug\html\databases.htm language=0x409 english (united states) display compile progress=no title=etl_config documentation [files] d:\apps\bin\debug\html\databases.htm d:\apps\bin\debug\html\instanceinformation.htm your default topic should reference relative file name inside chn file, not file outside of chm.

model view controller - C# 4.0 Generics and ASP.net MVC -

it appears in c# 4.0, variance specifiers applicable interface types. so let's have viewmodel / editmodel classes , simple hierarchy of models. class myeditmodel<t> t : base { ... } class derived1 : base { ... } class derived2 : base { ... } i have partial view accepts myeditmodel of type (so long it's derived base) , 1 accepts instances of derived1. how render both on same page? the partial view accepts myeditmodel shared between editor derived1 , editor derived2. the has if view accept view model of base. oo perspective myeditmodel , derived1 share base common base class - don't share else - there no other relationship. hence, if you're trying use same have derive base. presumably properties on base ones have in common. edit : mis-interpreted original question. based on literal text of question, thought passing derived1 base on comment below passing myeditmodel<derived1> . you're seeking: inherits="system.web.mvc.viewpag...

nginx - using ngnix infront of node.js -

i using ngnix infront of 4 instances of node.js apps running on 1 machine (quad core) can ngnix experts give me advice on how configure out of web app. i using connect/express frameworks on node , think allow smart caching etc, but not sure bits let ngnix , bits let frameworks handle. guidance on getting out of setup great help, thanks. you need take account 1 node instance use several threads, , keep @ least 1 thread occupied i/o. run 4 instances on quad core, means 4 instances produce blocking threads, meaning have @ least 4 blocking threads (if have busy server) meaning @ point block activity short periods. i suggest not starting more (number of cores)-1 instances of node, half sure @ least keeps moving. i assume there 1 blocking thread per node instance, wrong. there more. point remains same. more "free" threads start, more "blocking" threads created well.

Why is my php loop not working? -

ok have php variable $question looks this: $question['3']['type'] = 'checkbox'; $question['3']['desc'] = 'checkbox question'; $question['3']['deft'] = '1'; $question['3']['opts'] = 'check test 1'; $question['3']['opts'] = 'check test 2'; what want have question on survey desc question, , opts multiple answers. i have statement: if ($type == "checkbox") { if (strtolower($deft) == 'y') { $box_value = "1"; $checked = ' checked'; } else { $box_value = "0"; $checked = ''; } print "<input type=\"checkbox\" name=\"$key\" value=\"$box_value\"$checked>\n<br>"; } it works doesn't allow me include question (only answers). i want this: if ($type == "checkbox") { print "...