Posts

Showing posts from May, 2010

android - Adding menus to child preference screens -

i have menu comes preferenceactivity. in child preference screens, lose menu (doesn't pop up). how can make menu pop children too? thanks. example: <preferencescreen xmlns:android="http://schemas.android.com/apk/res/android" android:persistent="true"> <preferencecategory android:title="some category" android:persistent="true" android:orderingfromxml="true"> <preferencescreen android:title="some child screen" android:summary="some child summary"> <preferencecategory ... the first preference screen has menu, when click on child one, no menu. how can add menu? i faced similar issue. here did overcome issue. in preferenceactivity oncreate method, final preferencescreen childpref = (preferencescreen) findpreference("childprefid"); childpref .setonpreferenceclicklistener(new onpreferenceclicklistener...

html - css float right space -

Image
anyone know how fix this! on 'get in touch button' it works find in browser except ie7; html: <nav> <ul> <li><a href="#">home</a></li> <li><a href="#">branding</a></li> <li><a href="#">about</a></li> <li><a href="#">get in touch</a></li> </ul> </nav> css: nav { float:right;} nav ul { margin:0px; padding:0px; } nav ul li { float:left; } nav ul li { display:block; background:#ccc; padding:5px; margin-left:5px;} add white-space:nowrap nav ul li css rule. about white-space property: http://vidasp.net/css-white-space-property.html

c# - Best way to update a database's serialized objects after changing the object form -

i write objects out database in xml form. however, if change form of objects, changing name or changing fields, can no longer read them database, makes difficult task of reading them, converting them new form, , writing them out database. i'd rather not have rename classes everytime change them. *note: relying on c#'s xmlserialization/deserialization of objects generating xml. perhaps not desirable if change format of objects. if implement iserializable interface on objects, can implement custom serialization/deserialization routines provide backwards compatibility older versions of objects. see here example of how can done: iserializable , backward compatibility

php - PHP5 - OOP - Polymorphism - Help me to rewrite this simple switch -

assuming have classic switch , know when building classes not practice use switch method, so, how can rebuild class without using switch polymorphism , understand approach. /** * globals below holding unique id * $franklin['franklin_id'] , * $granny_smith['granny_smith_id'] , * etc etc... */ global $fuji, $gala, $franklin, $granny_smith; switch($apple) { case 'fuji': $color = 'yellowish green'; $size = 'medium'; $origin = 'japan'; $season = 'october - january'; $appleid = $fuji['fuji_id']; break; case 'gala': $color = 'yellow'; $size = 'medium'; $origin = 'new zealand'; $season = 'october - january'; $appleid = $gala['gala_id']; break; case 'franklin': $color = 'well-colored'; $size = 'medium'; $origin = 'ohio'; $season = 'october'; $appleid = $fra...

java - Get Item ID From Context Menu -

hey people, trying id of item, in case table row, long pressed bring context menu. code far. @override public void oncreatecontextmenu(contextmenu menu, view v, contextmenuinfo menuinfo) { super.oncreatecontextmenu(menu, v, menuinfo); menuinflater inflater = getmenuinflater(); inflater.inflate(r.menu.context_menu, menu); } @override public boolean oncontextitemselected(menuitem item) { adaptercontextmenuinfo info = (adaptercontextmenuinfo) item.getmenuinfo(); switch (item.getitemid()) { case r.id.delete: deleteitem(id); //id of item should passed method deleteitem toast.maketext(this, "delete", toast.length_long).show(); return true; default: return super.oncontextitemselected(item); } } as can see need id of table row pass method. have tried using info null. missing here you'll able point me in right direction. thanks. check adaptercontex...

java - Simple music visualizer -

i understand general concepts this, new java graphics programming. the idea is: 1. byte data song , store in byte array. 2. take small chunk of byte data, perform fft, , sort of useful data (different things can once fft performed). 3. feed processed data graphics function somehow use whatever visualization active. i'm having hard time on figuring out how 2 , 3 in real time. want data processed, song played, , processed data influencing graphics function drawing @ same time. understand how these things separately, can't quite figure out how put together. fourier transforms cannot performed in real time (not fast fourier variety). have able "lead" music source reading ahead generate frequency histogram. need sample of nonzero length analyze. make realtime, analyzer might grab samples of, say, half second, ten times second (so there significant overlap), compute fft on each, show difference between sample beginning @ current point in music , next 1 (...

Wireframes in OpenGL -

glpolygonemode(gl_front_and_back, gl_fill) on, , how can wireframe @ situation? there way wireframe rendering without switch polygone mode gl_line ? glpolygonmode( gl_front_and_back, gl_line ); fill fills it... want lines. edit: remember, can put fill when you're done, this glpolygonmode( gl_front_and_back, gl_line ); // add polygons here glpolygonmode( gl_front_and_back, gl_fill );

Objective-c image loading problem. Problem is relative/absolut path -

i'm trying show image screen provider provider = cgdataprovidercreatewithfilename(filename); doesn't create correctly if give relative path of image: all classes in project/classes/ , ball.png in project/ if write: "/volumes/sagitter/lavoro/progetti xcode/ivbricker test/ball.png" i have http://img412.imageshack.us/i/schermata20110217a15482.png/ so provide correctly created. if write "ball.png" have http://img43.imageshack.us/i/schermata20110217a15484.png/ how can solve? thank you you need provide path image. include in application bundle , use nsbundle retrieve path.

r - Plot probability with ggplot2 (not density) -

Image
i'd plot data such on y axis there probability (in range [0,1]) , on x-axis have data values. data contiguous (also in range [0,1]), i'd use kernel density estimation function , normalize such y-value @ point x mean probability of seeing value x in input data. so, i'd ask: a) reasonable @ all? understand cannot have probability of seeing values not have in data, interpolate between points have using kernel density estimation function , normalize afterwards. b) there built-in options in ggplot use, override default behavior of geom_density() example doing this? thanks in advance, timo edit: when said "normalize" before, meant "scale". got answer, guys clearing mind this. this isn't ggplot answer, if want bring ideas of kernel smoothing , histograms bootstrapping + smoothing approach. you'll beat head , shoulders stats folks doing ugly things this, use @ own risk ;) start synthetic data: set.seed(1) randomdata <- c(r...

c++ - In regards to array size calculation -

possible duplicate: can explain template code gives me size of array? hi, looking @ answer posted here: computing length of array copied here: template <typename t, std::size_t n> std::size_t size(t (&)[n]) { return n; } can 1 pls explain me significance of (&) ? the & says array passed reference. prevents type decaying pointer. without passing reference decay, , no information array size. non-template example: void foo( int (&a)[5] ) { // whatever } int main() { int x[5]; int y[6]; foo( x ); // ok //foo( y ); // !incompatible type } cheers & hth.,

Generate RSA keypair in perl efficently with custom PRNG -

i want generate public , private keypair, effciently (fast) in perl, , able input random data myself. inputting random data, of course mean, function requires lets x random bits generate public/private keypair of y bits, , should able supply these x bits function. so idially, function should like: ($private, $public) = genrsakeypair($randomdata, 1024); and $private contains: ----begin rsa private key----- .... ----end .... and $public contains ----begin rsa public , on... $randomdata string of random bits random generator. if $randomdata consistent between instance1 , instance2, instance1 , instance2 should return same public , private keys. if want know use of is, plan make password-based rsa key generation system, without need store keys anywhere . key generated straight out password, using sha512 chained in specific way create static random data. of course, same public , private key must returned everytime same password entered in system, else system useless. ...

oracle - Need to write a sql query: There can only be one value for another particular value -

for example, in table addresses there column zip_code. zip codes can anything, 90210, 45430, 45324. there can multiple instances of 90210 or other zip code. zip code, there can one value in state column. if 90210 in zip code column, state column must ca, if there record 90210 , has oh or ga or else, incorrect. looking find these particular zip codes have other 1 single value in other column. not homework question. select zip_code, count(distinct state) address group zip_code having count(distinct state) > 1;

java - Install .zip in clockwork from app? -

so in app im trying make flash .zip in clockwork recovery using runtime run = runtime.getruntime(); process p = null; dataoutputstream out = null; try{ p = run.exec("su"); out = new dataoutputstream(p.getoutputstream()); out.writebytes("echo install_zip sdcard:" +clickedfile.tostring() +" > /cache/recovery/extendedcommand\n"); out.writebytes("reboot recovery\n"); // testing out.flush(); }catch(exception e){ log.e("flash", "unable reboot recovery mode:", e); e.printstacktrace(); } it boot recovery not flash .zip.. whats wrong.. oh, , if need whole .java file here is: http://pastebin.com/npislz90 out.writebytes("...

Sql Multiple Where Clauses on Same field -

i have several queries in ms access database rewriting in sql stored procedure. queries have several filters applied same field. select * dt.sm_t_ocdetails (rest1 <> 's' or rest1 null) , (rest2 <> 's' or rest2 null) , (rest3 <> 's' or rest3 null) , (rest4 <> 's' or rest4 null) is there better way write (rest1 <> 's' or rest1 null) part of queries? looked @ coalesce unless doing wrong, don't think works. thanks using coalesce: coalesce(rest1,'not-s') <> 's' though think original clearer.

Custom jboss-app.xml using Maven -

i declared custom jboss-app.xml in pom.xml, plugin generated internal , empty jboss-app.xml file ear/meta-inf. i implemented pom.xml based on article , following definition: <plugin> <artifactid>maven-ear-plugin</artifactid> <configuration> <data-sources> <data-source>${artifactid}/src/main/resources/mytest-ds.xml</data-source> </data-sources> <jboss>${artifactid}/src/main/resources/jboss-app.xml</jboss> <defaultlibbundledir>lib</defaultlibbundledir> <archive> <manifest> <addclasspath>true</addclasspath> </manifest> </archive> <modules> <ejbmodule> <groupid>com.testproject</groupid> <artifactid>ejb-project</artifactid> </ejbmodule> </modules> ...

PHP/WSDL/SOAP: Error passing parameters -

i'm using local wsdl make service calls. i'm fine passing/retrieving data when 1 parameter expected service method(s), when method expects 2 or more parameters errors out. ironically, when attempt pass 2 or more parameters says expects 1. method establishidentity expects 2 parameters (processid=string & identityattributes = object made of properties found in code below.) i've include errors passing 1 , 2 parameters. <?php set_time_limit(0); require_once('nusoap.php'); require_once('benefitsoap.php'); $client = new soapclient('c:\wsdl\benefitdeterminationprocess_benefitdialogueservicesoap.wsdl', array('trace' => 1)); $procid = (array)$client->start(array("prefix"=>"")); $newstringid = implode(null, $procid); // $exchange = $client->exchangeoptions($procid); $identityattributes = new identityattributes(); $identityattributes->ssn = 41441414; $identityattributes->firstname = 'john2...

python - Accessing global attributes from inside a macro in Jinja2 -

i've been using macros in jinja2 extensively , find them dry-ish; there 1 thing bothering me: how access global stuff macros? neat if somehow access url_for() natively macro. you can make callable available in jinja environment: jinja_env = environment(...) jinja_env.globals['url_for'] = url_for for example, output u'foobar' in shell: from jinja2 import environment env = environment() env.globals['foo'] = lambda: "foobar" env.from_string('{% macro bar() %}{{ foo() }}{% endmacro %}{{ bar() }}').render()

How to graph requests per second from web log file using R -

i'm trying graph request per second using our apache log files. i've massaged log down simple listing of timestamps, 1 entry per request. 04:02:28 04:02:28 04:02:28 04:02:29 ... i can't quite figure out how r recognize time , aggregate per second. help it seems me since have time-stamps @ one-second granularity, need do frequency-count of time-stamps , plot frequencies in original time-order . timestamps array of time-stamps, do: plot(c( table( timestamps ) ) ) i'm assuming want plot log-messages in each one-second interval on period. i'm assuming hms time-stamps within 1 day. note table function produces frequency-count of argument.

c# - Security Runtime Engine VS AntiXSS Library -

i see web protection library (wpl) comes 2 different options: security runtime engine (sre) antixss library the first 1 seems great since no code necessary, it's httpmodule. second requires manually add escaping logic on code. despite advantage mentioned, sre not popular , i'm wondering why. there known problem library or big advantage of using antixss i'm not seeing? thanks! the biggest flaw see in sre looks me reliant on "blacklisting" behavior. example, tries detect sql statements in order provide sql injection protection. blacklisting weak, fact have know potentially harmful input in order provide 100% protection. http://www.owasp.org/index.php/data_validation#data_validation_strategies that not don't see value in sre. think looks nice tool have in arsenal, considered additional layer of defense. the other disadvantage see using library may encourage coders lazy learning how secure applications. relying on individual too...

Compiling a spark expression within a string -

i have asp.net mvc2 application within trying use spark view engine render input string, e.g.: "!{html.actionlink(\"a link\", \"index\")} followed text" i run problems when trying utilize htmlhelpers. spark compiler returns error 'the name 'html' not exist in current context' . full method below: public actionresult index() { var templates = new inmemoryviewfolder(); var engine = new sparkviewengine() { viewfolder = templates }; var stringresult = new stringbuilder(); stringresult.appendline("!{html.actionlink(\"a link\", \"index\")} followed text"); templates.add("string.spark", stringresult.tostring()); var descriptor = new sparkviewdescriptor().addtemplate("string.spark"); var view = engine.createinstance(descriptor); var result = new stringbuilder(); stringwriter sw = new stringwriter(result); ...

javascript - Date.parse(2/4/2011 9:34:48 AM) -

my input variable (ticket.creationdate) , 2/4/2011 9:34:48 (it vary of course) ideally pass in variable as-is , different results unknowndatefunc(ticket.datecreation) \ outputs= friday, february 4, 2011 unknowntimefunc(ticket.datecreation) \ outputs= 9:34 am meddling date.parse() , .todatestring() , can't figure out. resolved : using steve levithan method var datevar = dateformat(ticketlist.tickets[ticket].creationdate.split(" ", 1), "fulldate"); // without .split(" ",1) displayed "thu, feb 24, 2011 00:00" don't know why var timevar = dateformat(ticketlist.tickets[ticket].creationdate, "shorttime"); i suggest combination of 2 different date libraries aware of. the first, parsing date string, datejs. can find @ http://www.datejs.com/ . example parses library fine (once include appropriate quote marks) // results in date object tostring is: // fri feb 04 2011 09:34:48 gmt-0600 (central standar...

java - Is it safe or advisable to re-enqueue a Runnable with the same Executor if a problem occurs and I want to retry? -

i wrote code in runnable's run() method: try { dbconnection = myapp.datasource.getconnection(); } catch (sqlexception e) { logger.log(level.severe, "could not obtain db connection! re-enqueuing task. message: " + e.getmessage(), e); myapp.executor.execute(this); return; } as can see, if task can't obtain db connection, should re-enqueue itself, same queue in before ran. i'm thinking probably safe, feels funny, , want make sure there aren't gotchyas i'm missing. thanks! this fine far executor goes. but keep in mind failures may occur pretty quickly, , executor may re-run code quickly. can result in burning lot of cpu no results. build in forced retry delays , maximum loop counts.

sedna - Odd behavior in XQuery comments -

i have set of xquery transformations running on files stored in sedna database. have following format: declare namespace ns0 = "http://www.someuri.com/foo.xsd"; declare namespace ns1 = "http://www.someuri.com/bar.xsd"; (:declare few functions following:) declare function local:to-xs-boolean( $string xs:string? ) xs:boolean? { if (fn:upper-case($string) = 'y') xs:boolean('true') else if (fn:upper-case($string) = 'n') xs:boolean('false') (:if isn't y or n attempt normal cast - fail if isn't of 'true', 'false', 1, or 0 :) else if ($string != '') xs:boolean($string) else () (:endif:) (:endif:) }; (:omitted several other functions:) (:start main program:) (: { :) $formname in /ns0:formname return <ns1:newformname> { let $addres...

android - What is the actual string that is passed in in the onProviderEnabled(String provider) method? -

suppose have location listener might listening location updates network provider. want whenever user enables gps listener stop using network , start listening gps. my understanding whenever provider enabled sends message onproviderenabled() method passing in string name. what actual value passed in gps? "gps", "gps" or "gps_provider"? thanks mike the sdk documentation provides current value of string literals each defined constant: http://developer.android.com/reference/android/location/locationmanager.html#gps_provider you can see value locationmanager.gps_provider "gps". however, in code should refer value constant locationmanager.gps_provider . hope helps!

sed - Unable to remove carriage returns -

greetings! i have been tasked create report off files receive our hardware suppliers. need grep these files 2 fields 'test_version' , 'model-manufacturer' ; each field, need capture corresponding values. in previous post , found create basic report so: find . -name "*.ver" -exec egrep -a 1 'test_version=|model-manufacturer:' {} ';' model-manufacturer:^m r22-100^m test_version=2.6.3^m model-manufacturer:^m r16-300^m test_version=2.6.3^m however, data that's output riddled dos carriage returns "^m". boss wants "model-manufacturer" show "test_version" i.e model-manufacturer:r22-100 test_version=2.6.3 model-manufacturer:r16-300 test_version=2.6.3 using sed, attempted remove "^m" characters "model-manufacturer" no avail: find . -name "*.ver" -exec egrep -a 1 'test_version=|model-manufacturer:' {} ';' | sed 's/model-manufacturer:^m//g' t...

Adding Facebook Application to a page through API -

i trying add facebook application through api. used http://www.facebook.com/add.php?api_key=xxx&pages=1&page=xxx this adds app tab in page , works. doubts are 1) supposed documented feature? couldn't find formal documentation (or missing something?) 2) method or there other means? for, above 1 requires active login. through graph api etc. through oauth_token used in external application. 3) else can other adding? making landing tab, etc. thanks lot. here how use graph api https://graph.facebook.com/<page_id>/tabs?app_id=<your_app_id>&method=post&access_token=<previously_fetched_access_token_for_page_id> first need request access scope including 'manage_pages' within request. then, can user's pages using '/me/accounts?access_token=' once list of pages, each page should come access token use tabs api call. here references - http://forum.developers.facebook.net/viewtopic.php?pid=361995 https://devel...

.net 4.0 - Dynamically Aggregating WCF/ServiceBus connections via MEF -

i have many existing applications listen on azure servicebus this: uri address = servicebusenvironment.createserviceuri("https", servicenamespace, "image"); webservicehost host = new webservicehost(typeof(imageservice), address); host.open(); however since charged per connection in servicebus, i'd dynamically aggregate addins single connection. if, in addition imageservice above, have echoservice1 , echoservice2 , how can join services single listening connnection on azure service bus? i intend discover , load services through mef framework in .net 4.

jquery - Use of ajax framework to develop a webapp employing php, codeigniter -

i going start developing webapp using php framework codeigniter. app going of database dealing using ajax/jquery. know, implementing following steps particular task create view page the events performed on view page's elements, i.e., click, mouseover etc. attached event handler functions in js files included in view js functions making get, post requests server side in case dynamic values need passed js functions they'll passed using inline php code given below. on server side, database queries performed generate json(sometimes xml) sent response based on response, js function callback manipulate dom. now, question whether there ajax framework can further simplify implementation of steps given above. if not framework, may better approach implementing ajax , php. // part of view page <a href="delete user" onclick="deleteuser('<?php echo $userid; ?>')" /> i don't know mean "ajax framework" , whether y...

javascript - How do I automatically click link inside iFrame containing Google search results? -

this tough one.... me. i have link video on youtube. when clicks it, navigate page containing iframe has google search results preloaded. after 3 seconds link search results clicked automatically search list click it. page move in ranking , rule world. not sure if can done. this have far. still need js wait 3 seconds , go click link search results. can provide. <!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"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> </head> <body> <iframe src="http://www.google.com/search?client=safari&rls=en&q=independent+financial+news&ie=utf-8&oe=utf-8" name="name" width="1000" height="1200"> </iframe> </b...

c# - How to create an IAsyncResult that immediately completes? -

i implementing interface requires implementations of begindosomething , enddosomething methods. dosomething isn't long-running. simplicity assume dosomething compares 2 variables , return whether > b so begindosomething should like: protected override iasyncresult begindosomething(int a, int b, asynccallback callback, object state) { bool returnvalue = > b; return ...; //what should return here? //the method completed , don't need wait } i don't know should return. implement begindosomething because have to, not because method long-running. need implement own iasyncresult ? there implementation in .net libraries? the quick hack way of doing use delegate: protected override iasyncresult begindosomething(int a, int b, asynccallback callback, object state) { bool returnvalue = > b; func<int,int,bool> func = (x,y) => x > y; return func.begininvoke(a,b,callback,state); } the downside of approach, ...

clojure - For a lein project, why is lib/ in .gitignore? -

i'm relatively new clojure , java. why lib folder in lein project not added git repo of lein project? think convenient have necessary jars there distributed development. in leiningen project, project.clj file dictates project's dependencies, , when run 'lein deps', dependencies listed in project.clj file downloaded lib/. therefore, there's no need check in jars because project.clj in combination 'lein deps' command that's necessary person reproduce same lib/ have. checking in jars redundant , waste of space. moreover, mblinn points out, it's better pull jars artifact repositories designed purpose of distributing , updating dependencies, rather changing , committing new jars whenever dependency gets updated. true when project depends on snapshot jars, subject frequent change; if checked in jars, you'd have check in new jar every time snapshot gets updated, if rely on 'lein deps' pull jars artifact repos, you'll stay d...

axapta - MS Dynamics AX 2009: is it possible to recreate infolog from infologdata? -

is possible restore infolog infologdata? consider code static void job12(args _args) { infologdata infologdata; ; // here report error("something awful"); error("something terrible"); setprefix("scary"); warning("mouse"); // here infolog data infologdata = infolog.infologdata(); infolog.clear(0); // code // here view infolog once again } what should write instead of // code restore "something awful","something terrible", "scary\tmouse" infolog infologdata? my goal perform operation, store infolog in database, , show user, when want it. the simple solution: store returned value in container field. remember, not store container fields in transaction tables, requires 1 disc operation per container/memo field retrieve record. you may later display value in infolog: infolog.view(x.infologdata); you can convert container string: info(in...

Easier way to access the OSX defaults system through Python and Ruby? -

recently have become fan of storing various settings used testing scripts in osx defaults system allows me keep various scripts in git , push them github without worrying leaving passwords/settings/etc hardcoded script. when writing shell script using simple bash commands, easy enough use backticks call defaults binary read preferences , if there error reading preference, script stops execution , can see error , fix it. when try similar thing in python or ruby tends little more annoying since have additional work check return code of defaults see if there error. i have been attempting search via google off , on library use osx defaults system ends being difficult when "defaults" part of query string. i thought of trying read plist files directly seems plist libraries have found (such built in python one) able read xml ones (not binary ones) problem if ever set defaults program since convert binary plist. recently while trying search python library changed search ...

iis 7 - ASP.Net MVC 404 errors when route contains an .svc extension -

i have asp.net mvc 2 site set under iis7 using integrated pipeline following route: routes.maproute( "myroute", "mycontroller/{name}/{*path}", new { controller = "mycontroller", action = "index", path = urlparameter.optional } ); there no other routes above route, whenever try , access above route path value has .svc extension, example: http://localhost/myvirtualdirectory/mycontroller/test/somepath.svc asp.net returns 404 error without executing controller (i have log message call @ start of action method). if change extension benign (like .txt) works perfectly, seems somewhere along line asp.net interpreting request standard asp.net call web service doesn't exist - asp.net 404 response (not iis response). what causing this, , how stop happening? is iis configured server .svc files? may need add .svc mime type iis in iis select website click on mime types click on 'add' add .svc mime ...

php - Data Gateway Pattern and Foreign Keys -

how 2 concepts work ? i have scenario city table country table city.country_id fk country.id objective fetch cities , display country name also my problem fetch method cities table if need country name have search or inner join doing make queries when not necessary (display city info example) question what right way apply data gateway pattern in case. you should use join if need h associated country name. add method fetchwithcountry .

java - Fetching data from the other sites and displaying into our page.? -

is ther way data other sites , display in our jsp pages dynamically. http://www.dictionary30.com/meaning/misty see url in 1 block wikipedia meaning , definition on 'misty' in block fetching data wikipedia , displaying dictionaly30. question: how fetching wiki data site.? need display data in jsp page fetching other site. you can use urlconnection , read other site's data. or better use jsoup parse specific data other site. for case document document = jsoup.parse(new url("http://www.dictionary30.com/meaning/misty"), 10000); element div = document.select("div[id=contentbox]").first(); system.out.println(div.html());

c# - In a drap and drop between explorer and your app, how to know your app directory? -

i have little command line app tool xyz.exe accepts filename f argument , call program abc.exe lives in same folder xyz.exe data argument plus f . the ideia drag , drop file windows explorer program calls abc.exe proper parameters. when drop program, mean drop file abc.exe , runs filename argument. the problem need way know in folder abc.exe is. know same folder xyz.exe , seems in drag , drop operations environment.currentdirectory show windows folder instead of folder abc.exe / xyz.exe reside. how can solve this? you can : path.getdirectoryname(assembly.getexecutingassembly().location) to find current directory.

java - Spring MVC Scoped Bean Dependencies and Race Conditions -

i have serious doubts regarding scope bean dependencies because of lack of spring knowledge. i have read reference manual @ 3.5.4.5 scoped beans dependencies , have implemented sucessfully example it. however before going further more, wanted share concerns. let me share use case , little implementation details for each user request create city per user. @configuration public class cityfactory{ @bean(name = {"currentcity" , "loggedincity"}) @scope(value = webapplicationcontext.scope_request,proxymode = scopedproxymode.target_class) @autowired public citybean getcitybean(httpservletrequest request) { return cityutil.findcitywithhostname(request.getservername()); } for each request want inject city singleton scoped controller default scope controller. @requestmapping("/demo") @controller public class democontroller { @autowired citybean city; @requestmapping(value = "/hello/{name}", method = req...

php - Bing Map On GeoLocation Basis in iPhone Application -

i need display bing map in iphone app on basis of particular latitude , longitude. far able display map on iphone launching in uiwebview this url i need here on adjust load map on lat , long basis. any help/clue on appreciated. thanks.

php - Drupal convert nid/vid from int to bigint -

i busy project nid , vid values may reach limit. need mechanism modify current , future nid , vid data types int bigint. i figured maybe there schema alter hook, or limilar. see there hook called hook_schema_alter. how reliable build module simple checks nid , vid in schema, , modifies bigint? practical way of solving problem? work content types, module ones , cck? g. as hook_schema_alter fired on module install, rather build complex module manages automatically, should pick subset of modules know using, install them, , manually update schema. if going have 4 billion nodes (other poster said 2bn, nid unsigned doubles available range) should not turning modules on , off @ random. architecture should rock solid , planned out in advance. also, what's use case wanting many nodes in drupal? kind of database operation many rows going very, intensive when optimized , without weight of drupal stack (and it's love of expensive join queries) on top of it. drupal ...

design - Which software to use for drawing nice architecture/deployment diagrams? -

i see lot of nice diagrams showing infrastructure of various sites, deployment options, high level designs etc. wondering software ppl use draw these types of diagrams. please let me know preferred software drawing these diagrams. like, http://2.bp.blogspot.com/_swahp4sgx0k/s4v_we8cr5i/aaaaaaaaack/cmv9zw4o8o4/s1600-h/redditarchdiagramwhitebg.png i use conceptdraw pro. it's ms visio software, part of conceptdraw office suite include mind mapper , ms project like. it's not free run on windows, linux , os-x.

django - Best practices: Good idea to create a new table for every user? -

i'm writing little django app practice framework. app lets user log in, write entries , see list of entries. how should assign entries user created them? idea create table every new user , save entries there or should add additional field in entry model (e.g. 'created_by') , filter items displayed in list accordingly? one thing thats need considered, there should absolutely no way user sees entries other own (e.g someones uses app write diary). given both ways? i've newer worked databases before, appreciate explanation why 1 way better other. based on requirements, having different database table each user make things way more difficult, , wouldn't worth trade-off. 1 example: in "one table per user" scenario, when go retrieve information user, have figure out name of user's table is. i'm not sure how go doing that, since information user stored in table itself. (ignoring session storage.) an bigger headache comes when try store j...

ruby - ActiveRecord: peer models -

what best way relate models peers? for example, consider classic banking example class transaction < ar::base belongs_to :account # attribute: amount decimal end class account < ar::base has_many :transactions # attribute name string end # move money this: t1 = transaction.create(:amount=>10, :account=>account.find_by_name('mine')) t2 = transaction.create(:amount=>-10, :account=>account.find_by_name('yours')) i want relate 2 transactions can go particular deposit exact withdrawal opposite. i add transaction model: belongs_to :mirror_transaction, :class_name=>'transaction' has_one :other_transaction, :class_name=>'transaction', :foreign_key=>'mirror_transaction_id' ... feels bit icky. can't express better that! the other way can think of create third wrapper model, like: class transactionset < ar::base has_many :transactions end note cannot extend transaction model relate bot...

Book on design patterns with java examples for beginners -

i'm looking book simple understand beginner. nice if book should provide examples in java. best if these examples close real world business cases not virtual foo or bar class kind of things. head first design patterns . when picked book, brought of things alive , made them accessible understanding. no more abstract speak real-world, concrete examples. writing style seems silly i've found way remember things add exaggeration , imagination make memorable. examples in java, find best beginner text on subject regardless of language.

process - C# freeze while starting batch stream -

hey people! working little tool called mineme, , used handle minecraft servers. so made file stream, should stream output of start_base.cmd (the file starts server). goes wrong, window form freezes, until kill process (java.exe - ran start_base.cmd) here code: processstartinfo processinfo = new system.diagnostics.processstartinfo("cmd"); processinfo.windowstyle = processwindowstyle.normal; processinfo.redirectstandardoutput = true; processinfo.redirectstandardinput = true; processinfo.redirectstandarderror = true; processinfo.createnowindow = true; processinfo.useshellexecute = false; process p = new process(); p.startinfo = processinfo; p.start(); textwriter tw = p.standardinput; tw.flush(); tw.writeline("start_base.cmd"); tw.close(); textreader tr = p.standardoutput; string output = tr.readline(); while (output != null) ...

Problem med space in path in Proguard parameter call -

when trying parameter proguard, throws exception: java -xms128m -xmx256m -jar "../../../tools/proguard/proguard.jar" @game_specific.pro -libraryjars "c:/program files/java/jdk1.5.0_22/jre/lib/rt.jar" error: expecting class path separator ';' before 'files/java/jdk1.5.0_22/jre/lib/rt.jar in argument number 3 this due space in file name, know much. have tried various work-arounds " , ', thing works when use progra~1 in path. not viable solution me, since command should able run on lot of different computer various paths java. what doing wrong ? for sake of convenience, proguard accepts arbitrarily grouped command-line arguments, using shell quotes, e.g.: java -jar proguard.jar "-keep public class * { public <methods>; }" the shell groups arguments , gobbles quotes. result, file names containing spaces have quoted once more, e.g. different quotes: java -jar proguard.jar "-injars 'some input.jar'...

Can I show error message or window that remains visible after application exit using vb6 -

i trying open form in new window , want window open after closing vb6 application. code using dim frmwb frmerrwindow set frmwb = new frmerrwindow frmwb.wberrorwindow.registerasbrowser = true set ppdisp = frmwb.wberrorwindow.object frmwb.show thanks in advance. any forms , objects create vb6 closed when application closes, because exist within process memory space. way keep window open after application closes (that know of) use dll injection put code foreign process. way, vb6 app exit , dll in external process remain running. unfortunately, dll injection not possible using vb6 alone.

java - Convenient place to put a change log -

i old school c programmer , have habbit of putting change log in comments @ top of main source file. i put change log in more convenient place pull @ run time , display user on request. any suggestions ? you can add folder "raw" in resource folder , store own files there - text files. file "res/raw/changelog.txt" gets identifier r.raw.changelog in java code, can open , read file using getresources().openrawresource() . :-) http://developer.android.com/reference/android/content/res/resources.html#openrawresource%28int%29

c# - Why do I get different results in .NET4 compared to .NET 3.5 -

when have project's target framework set framework 4.0 , run following code: assembly pasm = assembly.loadfrom(amagpath); foreach (module m in pasm.getmodules()) { type t = m.gettype("typename")); } typename user defined type 3rd party dll. t null. if change target type framework 3.5 t not null. i don't change else. change target framework , rerun application. can explain why happening? there tool let me more? update: changed code following. assembly pasm = assembly.loadfrom(amagpath); type t = pasm.gettype(string.format("gm.fcat.{0}.{0}+fblock+{1}function+{2}casestream+{2}repeatableparameterstream", fblockname, pname, aparam.name), false); i still have same problem. t = null in version 4.0 , doesn't in version 3.5 i can't find type when load .net reflector. guess not there. some framework types have moved across assemblies between versions, assembly binding redirection make usually invisible clients. may ...

c# - Enabling/Disabling the menu item from another thread -

i trying change menu item thread. able use invokerequired/invoke on other controls, since menu item not control, having difficulty in achieving same functionality. for other controls, doing this: private delegate void setcontrolenablehandler(object sender, boolean bvalue); private void setcontrolenabled(object sender, boolean bvalue) { control control = (control)sender; if (control.invokerequired) control.invoke( new setcontrolenablehandler(setcontrolenabled), new object[] { sender, bvalue } ); else control.enabled = bvalue; } from worker thread simple call: this.setcontrolenabled(btnpress, true); and job. can me menu item here? thank you, -bhaskar the menu item not control, form hosting menustrip is. so, method in form can modify menuitem, if called in correct thread. so, private void enablemenuitem(toolstripmenuitem item, bool enabled) { this.begininvoke(new methodinvoker(delegate() { it...

java - problem with comparing a name from getter method to user input string -

i'm having trouble comparing in if statement, in c programming using "==" double equal sign compare 2 string... how comparing string using getter method new string... try use double equal sign prompted change this: if (entry[i].getname().equals(ename)) by way whole code: import javax.swing.joptionpane; import javax.swing.jtextarea; public class addressbook { private addressbookentry entry[]; private int counter; private string ename; public static void main(string[] args) { addressbook = new addressbook(); a.entry = new addressbookentry[100]; int option = 0; while (option != 5) { string content = "choose option\n\n" + "[1] add entry\n" + "[2] delete entry\n" + "[3] update entry\n" + "[4] view entries\n" + "[5] view specific entry\n" ...

c# - How to change login status in LoginView control -

how change status first template second template when i'm login system? <asp:loginview id="headloginview" runat="server" enableviewstate="false"> <anonymoustemplate> [ <a href="~/login.aspx" id="headloginstatus" runat="server">log in</a> ] </anonymoustemplate> <loggedintemplate> welcome! [ <asp:loginstatus id="headloginstatus" runat="server" logoutaction="redirect" logouttext="log out" logoutpageurl="/logout.aspx"/> ] </loggedintemplate> </asp:loginview> how detect login status? take @ thread

python - libgmail login() runs with error -

i installed libgmail on centos 5, python 2.6 easy_install. there problem, until installed mechanize manually. after easy_install said ok , wrote 1st test program sample googled: import libgmail ga = libgmail.gmailaccount("someaccount@gmail.com", "mypassword") ga.login() folder = ga.getmessagesbyfolder('inbox') thread in folder: print thread.id, len(thread), thread.subject msg in thread: print " ", msg.id, msg.number, msg.subject print msg.source i following error message: traceback (most recent call last): file "gm.py", line 4, in <module> ga.login() file "build/bdist.linux-i686/egg/libgmail.py", line 305, in login file "build/bdist.linux-i686/egg/libgmail.py", line 340, in _retrievepage file "build/bdist.linux-i686/egg/mechanize/_request.py", line 31, in __init__ file "build/bdist.linux-i686/egg/mechanize/_rfc3986.py",...

sql - PHP: Show table of results from database -

i have simple bit of php should showing table of invites: // connect database $host = '###'; $username = '###'; $pass = '###'; mysql_connect($host,$username,$pass); mysql_select_db("###"); // select news table $query = "select * creathive_applications"; $result = mysql_query($query); echo "<table>"; echo "<tr>"; while( ($row = mysql_fetch_array($result))) { echo "<td>".$row['firstname']."</td>"; echo "<td>".$row['lastname']."</td>"; echo "<td>".$row['email']."</td>"; echo "<td>".$row['url']."</td>"; } echo "</tr>"; echo "</table>"; // disconnect database mysql_close(); however it's not working? ideas...

php - easiest way to establish that a foreach loop is in it's final iteration -

possible duplicate: how determine first , last iteration in foreach loop? what best way establish foreach loop in it's final loop, , perform different functions accordingly? the way approach increment variable , test variable against size of array ( count() ): $i = 0; $c = count($array); foreach($array $key => $value) { $i++; if ($i == $c) { // last iteration } else { // stuff } } this may, obviously, not efficient method, though.

java - design patterns assignments -

is there place find multiple assignments implementing design patterns( along solutions ?) my idea hands on in proper way. implement in java. @ moment need basic design patterns , not j2ee patterns. i'm looking complete application developed uses of design patterns. (all design patterns in single assignment) build me antfarm!! you want assignment? i'll give one. it's due tuesday, february 22 @ 9:00pm pacific time. going build me antfarm, , you're going use common design patterns it. this not have every design pattern, because that's silly. does, however, have enough interactions complex while being simple enough implement quickly. once done, can @ adding in more features our ant farm! i add requirements (with revision added) needs arise. here's requirements: functional requirements : a meadow can have many ant farms in them. assignment, ever allow 1 meadow take place. a meadow should capable of spawning logically unlimited number of...

iis 6 - Recycle App Pool on IIS6 using C# -

i'm attempting recycle app pool on iis6 programmatically through web application. have searched on net , found bunch of solutions (most involving impersonation) none of them seem work. common error e_accessdenied despite entering valid username , password. can point me in right direction? the solution use sort of thing (where you're trying run process asp.net needs administrative privileges) following: write whatever need done self hosted wcf service. preferably http rest service, it's easy call (even using browser testing) make sure service run using administrator account. can use task scheduler make sure service running @ times run using administrator account. execute methods on service asp.net application using wcf client and works time no matter "process" i'm trying run within asp.net application. now far details (code) concerned let me know if need help. code below code you'd have in console application in order make self ho...