Posts

Showing posts from May, 2013

java - Android: Adding a Drawable to an existing LayerDrawable -

i have layerdrawable construct array of drawables of 5 drawables. let’s in run-time want add drawable layerdrawable, in response event. how do without having re-create layerdrawable, time array of drawables of 6 drawables? thanks. after layerdrawable created, new drawables can not added it. see source of layerdrawable : array of drawables saved in mlayerstate.mchildren , set in constructor. however, setdrawablebylayerid(..) can used exchange existing drawable new one.

jquery - Storing HTML or XML code in javascript variables -

i'd store html/xml markups in javascript variable. problem text relatively large. example how can store following xml piece in javascript variable? <questionform xmlns="[the questionform schema url]"> <overview> <title>game 01523, "x" play</title> <text> helping decide next move in game of tic-tac-toe. board looks this: </text> <binary> <mimetype> <type>image</type> <subtype>gif</subtype> </mimetype> <dataurl>http://tictactoe.amazon.com/game/01523/board.gif</dataurl> <alttext>the game board, "x" move.</alttext> </binary> <text> player "x" has next move. </text> </overview> <question> <questionidentifier>nextmove</questionidentifier> <displayname>the next move</displayname> <isreq...

awt - Inserting text into another program's text field using Java -

i've searched website , couldn't find answer problem. i'm trying write program in java input text , submit java program. so far, know 1 option using robot think mean need know program's text box on screen. any suggestions appreciated, , if easier in c++ okay that. thanks in advance help without cooperation other java application, choices (both bad) robot , jni

compiler construction - C++0x TMP compilation speed -

this question focuses on template metaprogramming constructs. have found 2 articles ( one , two , 2 doesn't show hard evidence, trust claims) provide evidence showing c++0x prototype compilers turn exponential compilation times linear compilation times. i have vague inkling auto, decltype , variadic templates have enablers of this. see ground explanation of changes languages , compiler technologies enable this, explaining how , why. in terms of skill level, have used boost tmp library spirit in anger, , toy mpl programs. it's clear first slower process compiler second , there is, say, evidence that . /* first */ template<typename a> void f(a const&); template<typename a> void f(a&); template<typename a1, typename a2> void f(a1 const&, a2&); template<typename a1, typename a2> void f(a1&, a2 const&); template<typename a1, typename a2> void f(a1 const&, a2 const&); template<typename a1, typename ...

osx snow leopard - Mac os x: How to have makefile reference /Applications/application -

os mac os x 10.6.6 emacs 23.2.1 i'm trying install magit on carbon emacs using proposed make solution. i'm complete makefile newby might on complete wrong path altogether. makefile displays: %.elc: %.el $(batch) --eval '(byte-compile-file "$<")' which gets expanded to: emacs -batch -q -no-site-file -eval "(setq load-path (cons (expand-file-name \".\") load-path))" --eval '(byte-compile-file "magit.el")' what understand. comes with: cannot open load file: subst-ksc what after bit of googling reveals missing libraries. realized emacs referenced in expanded command pointing /usr/bin/emacs 1 big file, don't see normal lisp / site-lisp / etc directories. know prefered emacs carbon emacs located in /application/emacs.app opens when clicking on it, or alternatively, can open in terminal: open /application/myapp.app finally title question: how can make makefile using emacs.app on applications directory...

Modularizing CSS files -

many people keep number of external css , javascript files minimum reduce round trip time. example, google recommends maximum 2 css , javascript files per web site, respectively. the problem is, i've broken css code several files depending on nature part of "modularization". example, i've put css code used in part of application in separate file. result, files have less hundred lines of code. i'm java develper, , recommended practice in java, css totally different creature , don't know css. here questions. does make sense keep many css files see fit readability , maintainability? how many css files manageable in web project? what's average number of css files in web applications you've worked on in past? i agree other have said here, yes when develop have muliple css files, production should merge minify them. however not agree should merge them 1 single file. mean people want visit home page must wait css on pages x,y,z downlo...

java - Other options for lossless image saving in Android? -

my application needs save large images in lossless format. i'm willing sacrifice disk space speed of saving , i'd prefer save in standardised format instead of rolling own. i've found built-in .png encoder slow needs, taking 5 seconds save 1000x1000 image. i've found can save images quicker saving raw pixel values disk (i.e. no compression) , saving raw pixel values compressed java's deflate class tweaked compression settings. unfortunately, there no option alter android's png compression level know of. what options have? i'm prepared use ndk i'm cautious using external library hasn't been tested on android. example, libtiff candidate can't find info on getting working in ndk , how stable is. just throwing out there newest version of opencv 2.2 comes ndk port android. includes several image libraries including libpng , libtiff. i haven't tested use of via jni interface or stability @ least compiles readily android using n...

java - Thread stuck in Thread.join(), even though other thread has terminated -

our java application starts worker thread (using thread.start() ). shortly thereafter calls thread.join() on worker thread. worker thread stuff , terminates. first thread exits call join() , goes on merry way. standard stuff: thread t = new workerthread(); t.start(); // blah blah t.join(); class workerthread extends thread { public void run() { // stuff } } at least that's how it's supposed work, , how work in case can reproduce. have 1 customer, however, persistently running trouble. looking @ threads using psiprobe, see worker thread created. runs awhile, after time disappears list of threads. happens @ unexpected time (based on timing of other events related worker thread). main thread never gets out of join() call. this seem break join() 's contract, , implies me sort of jvm-level error. has witnessed behavior this, or have idea cause it? edit 3-3-11: i'm still waiting conclusive data customer, seems didn't know thought knew...

Mirth Connect Script to Re-process Errors? -

we have go through , re-process connection-type errors in mirth connect. possible have script somewhere re-processes these restraints? can't reprocess transformer errors can't keep reprocessing connection-type errors when interface down i thinking of script launched manually go through feeds errors , reprocess valid connection-type errors. possible? thank :) todd if you're storing messages, database reader connected mirth's own db trick. you'd need come solution keep messages reprocessing endlessly, though.

iphone - Play video invoked from Javascript on a UINavigationController in iPhoneSDK -

i have application , on clicking button, want create uinavigationcontroller on fly. current view on navigationcontroller uiwebview rendering javascript embedded video in it. when click on play button of video, video starts playing, i'm not able see video on foreground. i'm able see video if dismiss uinavigationcontroller . how make sure when click on "play" button in uiwebview inside uinavigationcontroller , renders video in native player in foreground , when clicked on "done" in native player, go " uinavigationcontroller " ? how displaying initalizing video view controller? are creating instance , presenting modal view? this diffs depending on version of ios using: nsstring *videopath = [[nsbundle mainbundle] pathforresource:@"video" oftype:@"mp4"]; nsurl *videourl = [nsurl fileurlwithpath:videopath]; if ([[[uidevice currentdevice] systemversion] doublevalue] >= 3.2) { nslog(@"> 3.2...

.net - GIS systems, Rundown of advantages -

first word of warning, believe stackoverflow rather programmers question, mods feel free move if i'm wrong. the company @ looking create gis solutions, based on desktops, mobile(wm/android/etc) or web. vague management requirement targeted markets not 100% defined may not heavily gis based expected. have been looking main gis providers in uk , see these been esri, capcorp , mapinfo. know esri , cadcorp both have full suites covering our requirements in terms of platform devices , targeted experience of development team .net framework. the problem picking company go based on swot analysis. question have have used, 1 or systems. , advantages, weaknesses, strengths , opportunities. have been reading on them, great, want feel have used them in development , business processes. my feeling many key bits of software start merge , cover same functionality, making competitor products hard differentiate. have had small chance use esri , found slow , verbose program in, compared cad...

xpath - msxml selectnodes: namespace in text node -

i have following xml file: <root xmlns="http://someurl/element" xmlns:text="http://someurl/text"> <elements> <element> <id>text:some_id</id> <!-- other elements --> </element> <element> <!-- other elements --> <reference> <link ref="text:some_id" /> </refernce> </element> </elements> </root> i want select child elements of elment node have element id=text:some_id reference node. want in c++ using selectnodes method of ixmldomnode object msxml parser. in following exmaple have refence node selected in pchild , selectionnamespaces propetey set xmlns:n="http://someurl/element" : msxml2::ixmldomnodeptr pselectednodes = pchild->selectnodes("../../n:element[n:id=n:link/@ref]/n:*"); __assert(pselectednodes->length > 0) this not working. doing wrong? ...

sql server - Which is faster? Multiplication in code, or multiplication in SQL? -

question: what's faster: multiplying 2 doubles in sql table , return table, or returning table , multiplying 2 column values in code ? you can assume 2 columns need multiplied need returned anyway. multiplication extremely fast computation, , whether chip asked sql or places shouldnt make differnce. thing make quicker in sql can done in single pass (though depends on how sql implements it), if in code have cycle through result set, again might doing anyway. the real answer though doesnt matter unless plan multiply 10's of millions of numbers @ time.

android - My app doesn't appear in the AVD, after running from eclipse -

i created small app in eclipse android, , when press "run", new avd created, eclipse tells me app installed on avd, can't find on virtual device. why can be? thanks i think forgot add these lines in manifest file. had same problem in app , showed app installed, not find in emulator. <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> also make sure set target avd run configurations. run->run configurations-> target, select avd list, click apply, ok. hope helps.

java - Is it possible to create a managed JAX-WS dispatch client? -

does know if possible create dispatch dynamic webservice client in jax-ws managed application server? reason asking because we'd configure policies on client admin console @ deployment time. the way i've managed service clients noticed application server when create clients based on sei classes generated wsdl's. im running websphere application 7. ws in message level, had issues solved right now. message level handling able handle incoming request in 1 place, there can dispatch messages anywhere. if thinking stg else you, please forgive me. @ question: message level jax-ws service

How to enable Java assertions in jetty-maven-plugin? -

how enable assertions in jetty-maven-plugin ? default disabled. set environment variable maven_opts -ea . jetty default runs within maven process , affected setting. there interesting library called force assertions hooks java 1.6 compilation process. during compilation assert cond : detail; transparently compiled if (!cond) throw new assertion(detail); blocks, means assertions work no matter jvm parameters are. worth check.

r - Changing line colors with ggplot() -

Image
i don't use ggplot2 much, today thought i'd give go on graphs. can't figure out how manually control colors in geom_line() i'm sure i'm overlooking simple, here's test code: x <- c(1:20, 1:20) variable <- c(rep("y1", 20), rep("y2", 20) ) value <- c(rnorm(20), rnorm(20,.5) ) df <- data.frame(x, variable, value ) d <- ggplot(df, aes(x=x, y=value, group=variable, colour=variable ) ) + geom_line(size=2) d which gives me expected output: i thought had simple like: d + scale_fill_manual(values=c("#cc6666", "#9999cc")) but changes nothing. missing? color , fill separate aesthetics. since want modify color need use corresponding scale: d + scale_color_manual(values=c("#cc6666", "#9999cc")) is want.

javascript - More than one pop up is not coming in IE -

i have following html <form action="http://www.test.com" method="post" name="form_test" target="" > <input type="image" src="loader.gif" id="icon" alt="image" onclick="popup();"/> </form> <div id="ij"> ghgfhg </div> <script type="text/javascript"> function popup(){ window.open ("http://www.google.com","one"); window.open ("http://www.yahoo.com","two"); } </script> and when click image button 2 pop ups, 1 google , 1 yahoo in every browser except ie. in ie, 1 popup 'google', coming. and if allow popup blocker settings in ie brower site, page located, 2 popups. so let me know reason in ie. the popup blocker blocks every popup except first. http://www.microsoft.com/austria/windowsxp/sp2/sp2_popupblocker.mspx explains in last paragraph parts of how d...

Merge Image using Javascript -

is possible merge pictures using javascript? for example, if have 2 rectangle .jpg or .png images files of same size, possible can align side side , produce merged copy of 2 in new .jpg or .png image file? you can use javascript 'merge' them 1 canvas, , convert canvas image. var c=document.getelementbyid("mycanvas"); var ctx=c.getcontext("2d"); var imageobj1 = new image(); var imageobj2 = new image(); imageobj1.src = "1.png" imageobj1.onload = function() { ctx.drawimage(imageobj1, 0, 0, 328, 526); imageobj2.src = "2.png"; imageobj2.onload = function() { ctx.drawimage(imageobj2, 15, 85, 300, 300); var img = c.todataurl("image/png"); document.write('<img src="' + img + '" width="328" height="526"/>'); } }; due security, 2 images must on same domain javascript file (i.e http://123.com/1.png , http://123.com/2.png , http://123.com/s...

data structures - Finding specific shapes in point clouds quickly -

i've got point cloud, , detect occurrences of patterns of points in code. let's have 1000 points in 3d space, , want detect instances of 3 points form 'l' shape each segment of l has specific length. point cloud may not have exact matches, may close (i.e. in point cloud, length of segment of 'l' may longer/shorter ideal) my initial idea this: record distance between points in shape trying detect create empty 'potential shape' for each point in our potential shape, examine points at/near distances found in part 1) if find point, add our potential shape, , repeat part 3) until have points. check angles between points verify shape indeed correct. if not correct, go on next point , start again the problem approach has terrible worst case running time. ideally, have kind of data structure speed queries 'find points between distancemin , distancemax away given point. can point me useful data structures might help. i thinking of putting p...

matlab - Wavelet Transform for N dimensions -

Image
i came across amazing response applying matlab's idwt2 several times executed understand myself. however, unable how use same work rgb image. so, have 3 questions. how code applied rgb image transformed image displayed in output along high , low frequency components along row , column,is possible view fusion of components single image? aware have put cat operator, cant understand how go it. secondly, getting mazed image! perplexed since cannot seem follow reason. have attached same code statement showing how image has been generated. 3.what term db1 in function signature of dwt imply? code: load woman; % load image data %startimage=imread('pic_rgb.jpg'); % if want work rgb image nlevel = 3; % number of decompositions ncolors = size(map,1); % number of colors in colormap ca = cell(1,nlevel); % approximation coefficients ch = cell(1,nlevel); % horizontal detail coefficients cv = cell(1,nlevel); % ve...

jquery - Inject something in jWYSIWYG at cursor pointer? -

i want inject dropdown selected value in jwysiwyg @ cursor pointer.i want that: <select id="shirt" name="shirt"> <option value="small">small</option> <option value="medium">medium</option> <option value="large">large</option> </select> <a href="#" id="btn_insert" name="btn_insert">insert</a> <textarea id="testing_txt" name="testing_txt"></textarea> the trick cursor position reliably. found how existing so thread . once have cursor position matter of getting before , after text, inserting new value in middle. http://jsfiddle.net/vr99u/1/ $("#mybutton").click( function() { var pos = getcaret(document.getelementbyid('mytextarea')); var currenttext = $("#mytextarea").val(); var currenttextstart = currenttext.substr(0, pos); var currenttextend = currenttext....

Incrementing a variable by 0.025 for each loop in BASH (NOT loop variable) -

i wanted increment variable, k inside loop. each increment 0.025. tried using: let "k += 0.025" and let "$k += 0.025" and k += 0.025 and many other variations. know how accomplish this? use integer math , convert decimal when needed. #!/bin/bash k=25 # start of loop # # increment variable 0.025 (times 1000). # let k="$k+25" # value fraction (uses bc). # v=$(echo "$k/1000"|bc -l) # end of loop # echo $v save t.sh , then: $ chmod +x t.sh $ ./t.sh .05000000000000000000

What's the utility of a pointer to function in C? -

possible duplicate: what point of function pointers? i read pointers function in k+r. understand how these pointers work, don't see utility they. what's use type of pointers in programming? you can use function pointers variety of tasks such registering factories, applying algorithm on data structure (e.g. sorting list using user-defined sort function). there few other uses need them inversion of control: let else call code, , providing pointer function.

javascript - What's the time complexity of array.splice() in Google Chrome? -

if remove 1 element array using splice() so: arr.splice(i, 1); will o(n) in worst case because shifts elements after i? or constant time, linked list magic underneath? worst case should o(n) (copying n-1 elements new array). a linked list o(1) single deletion. for interested i've made lazily-crafted benchmark . ( please don't run on windows xp/vista ). as can see though, looks constant (i.e. o(1) ), knows they're doing behind scenes make crazy-fast. note regardless, actual splice fast. rerunning extended benchmark directly in v8 shell suggest o(n) . note though need huge array sizes runtime that's affect code. should expected if @ v8 code uses memmove create new array.

Select the values of one property on all objects of an array in PowerShell -

let's have array of objects $objects. let's these objects have "name" property. this want $results = @() $objects | %{ $results += $_.name } this works, can done in better way? if like: $results = objects | select name $results array of objects having name property. want $results contain array of names. is there better way? i think might able use expandproperty parameter of select-object . for example, list of current directory , have name property displayed, 1 following: ls | select -property name this still returning directoryinfo or fileinfo objects. can inspect type coming through pipeline piping get-member (alias gm ). ls | select -property name | gm so, expand object of type of property you're looking at, can following: ls | select -expandproperty name in case, can following have variable array of strings, strings name property: $objects = ls | select -expandproperty name

Structure and Class in C# -

possible duplicates: structure vs class in c# when should use struct instead of class? dear all, please tell me when use class , when use structure in c#.

Android page Curl animation -

is there simple way curl page flipping animation? curl animation animation of pages flipping, including page above rolling , shadows on lower page. what recommended way "gallery" displays 2 pages @ time (just book)? is it: letting adapter display linear layout of 2 images @ time? (it won't let me show page flipping on other book) using 2 pages, placing somehow 1 near other, , when it's time animate -move next 2 pages over? better way enable displaying left page flipping on right page? i'm implementing 2d page curl in native canvas. check answer in: implement page curl on android? edit: code project of implementation: http://code.google.com/p/android-page-curl/ edit2: links updated

javascript - Curly Brackets Converted to Hexidecimal when using URL.Document or window.location.href -

would take document.url, find string curly brackets, remove curly brackets, , show string inside curly brackets. however, seems document.url or window.location.href convert curly brackets hexidecimal values (%7b & %7d) , can't match against actual {string}. appreciated. var txt = document.url; // url http://site.com/somepage&value0={string} var re1='.*?'; // non-greedy match on filler var re2='(\\{.*?\\})'; // curly braces 1 var p = new regexp(re1+re2,["i"]); var m = p.exec(txt); if (m != null) { var cbraces1=m[1]; document.write(cbraces1.replace("{","").replace("}","")); } use decodeuri(document.url) first. var txt = decodeuri(document.url);

c# - Can't read session variable value in ashx in Firefox? -

on login puttign user id in session variable next page sending request ashx. here issue cannot read session variable here , error message "object refrence not set instance of object". works fine in ie error accure in ff. my ashx file implementing ireadonlysessionstate. you need have on ashx file public class loginauthentication : ihttphandler, irequiressessionstate since putting user id in session..

Do python's variable length arguments (*args) expand a generator at function call time? -

consider following python code: def f(*args): in args: pass foo = ['foo', 'bar', 'baz'] # python generator expressions ftw gen = (f f in foo) f(*gen) does *args automatically expand generator @ call-time? put way, iterating on gen twice within f(*gen) , once expand *args , once iterate on args? or generator preserved in pristine condition, while iteration happens once during loop? the generator expanded @ time of function call, can check: def f(*args): print(args) foo = ['foo', 'bar', 'baz'] gen = (f f in foo) f(*gen) will print ('foo', 'bar', 'baz')

Visual Studio 2010 - cshtml always opens in Design View -

in vs2010, of cshtml files open in design view. it's okay annoying, have set source view default under options > html designer > general > start pages . weirdly, it's files this. happens if close files in vs, restart, whatever. anybody know problem might be?

c# - HtmlAgilityPack: Get whole HTML document as string -

does htmlagilitypack have ability return whole html markup htmldocument object string? sure, can this: htmldocument doc = new htmldocument(); // call 1 of doc.loadxxx() functions console.writeline(doc.documentnode.outerhtml); outerhtml contains whole html.

objective c - Add Objects from one Array to Another at a Specific Position -

i have 2 mutable arrays, firstarray , secondarray. both populated objects. want add objects secondarray firstarray @ specific point (not @ end , not @ beginning) in firstarray. there way this? i'm using line of code: [self.firstarray addobjectsfromarray:secondarray]; what want foo code: self.firstarray addobjectfromarray @ specific point x: secondarray,specificpointx) any appreciated! answering own question, works: int z; z = (int)self.specificposition; // start adding @ index position z , secondarray has count items nsrange range = nsmakerange(z, [secondarray count]); nsindexset *indexset = [nsindexset indexsetwithindexesinrange:range]; [self.firstarray insertobjects:secondarray atindexes:indexset];

Jquery in Drupal 7 in IE7 -

all, on our website having issues getting jquery code execute in ie7 (ie9 running in ie7 compatibility mode). what confusing javascript code running fine (for validation & css properties change), however, none of jquery code running in ie7 mode. below snippet of jquery code (placed inside drupal block) using on our site showing jquery popup after user email has been accepted db. <?php drupal_add_js('jquery(document).ready(function () { jquery(".input1").keypress(function(){ jquery(this).css({ "color": "black", }); }); jquery(".input2").blur(function(){ var itext= jquery(this).val(); if(itext=="email address" || itext=="enter invite code") { jquery(this).css({ "color": "rgb(200,200,200)", }); } });','inline'); ?> the problem code runs fine in browsers except ie6 & ie7. please shed light on might going wrong making our site compatible ie7. best, dear inte...

sqlprofiler - How to find out client process ID in SQL Server Profiler? -

i using sql server profiler view database activities. in that, want find out client process id associate machine (from application running). because there multiple instance of application running on different machines. want identify them. there way find out clientprocessid? you can use hostname in profiler, same host_name() function in t-sql run in query window select host_name() in profiler hostname, have check "show columns" see it

asp.net - updating a row gives error Operation must use an updateable query -

i'm getting error when i'm trying update record: error [hy000] [microsoft][odbc microsoft access driver] operation must use updateable query however when add new record, add fine. i did searching , found out problem because asp.net worker process not have permission update database. how being able insert new record (isn't inserting updating database!) not update (set record different value). odbcconnection dbconnection = new odbcconnection("dsn=inv"); dbconnection.open(); try { string newpassword = password1.text; odbccommand dbcommand = new odbccommand("update users" + " set [password] = '" + newpassword + "'" + " name = '" + session["loginid"] + "'" + ";", dbconnection); dbcommand.executenonquery(); server.transfer("default.aspx", true); } you error if don't have primary key declared on table. your code pretty ugly...

unit testing - Is it possible to find out if an Android application runs as part of an instrumentation test -

is there runtime check application find out if runs part of instrumentation test? background: our application performs database sync when starting. should happen when started regularly. interferes instrumentation tests testing db sync. not surprisingly. and other tests it's waste of cpu cycles. if you're using activityunittestcase, set custom application object setapplication, , have flag in there switch database sync on or off? there's example of using custom application object on blog: http://www.paulbutcher.com/2011/03/mock-objects-on-android-with-borachio-part-3/

javascript - What is the most elegant way to insert this conditional statement? -

i pass variable either cause method click or hover . right now, defaults click. var defaults = { xoffset: 10, yoffset: 25, tooltipid: "easytooltip", clickremove: true, content: "", useelement: "", clickappear: true }; var options = $.extend(defaults, options); var content; $(this).click(function(e){ $("#" + options.tooltipid).remove(); content = (options.content != "") ? options.content : title; content = (options.useelement != "") ? $("#" + options.useelement).html() : content; $(this).attr("title",""); if (content != "" && content != undefined){ $("body").append("<div id='"+ options.tooltipid +"'...

android - Application interrupts like crazy -

i had running c++ (android native) application .. introduced try { } catch {} statements , if debug application interrupts crazy in random, correct pieces of code. if run application stops interrupt zygote ( app_process ) complains signal 2 , sigint . i had few try-catch clauses in application running fine before added ton of try-catch clauses. @ point sure there lot of nested try-catch blocks, maybe android os can't handle many interrupts nested blocks ? i mention on windows same code runs flawlessly. do full rebuild. debug info may off. that's best answer 1 can give info in op.

iphone - Convert NSMutableArray into integer -

i working on xml parsing , getting 3 item numbers server 1 2 3, have taken 3 numbers nsmutable array , assign them in delegate value mutable array, want pass 1 number @ time function response server, please let me know how convert nsmutable array value integer while parsing function. do this for(int i=0;i<[yourarrayfromxmlparsing count];i++) { int a=[[yourarrayfromxmlparsing objectatindexpath:i] intvalue]; [obj function:a]; }

iphone - UIBarButtonItem on specific views using UITabBarController -

i have uitabbarcontroller , want button seen on 1 of tabs, not rest. in method handle when tab bar pressed, add button this: #pragma mark - uitabbarcontroller delegate - (void) tabbarcontroller:(uitabbarcontroller *)tabbarcontroller didselectviewcontroller:(uiviewcontroller *)viewcontroller { // check type of class based on tab pressed ... nsmutablearray *baritems = [[self.maintoolbar items] mutablecopy]; uibarbuttonitem *sortbarbuttonitem = [[uibarbuttonitem alloc] initwithtitle:@"sort" style:uibarbuttonitemstylebordered target:self action:@selector(sortbuttonpressed:)]; [baritems insertobject:sortbarbuttonitem atindex:0]; [self.maintoolbar setitems:baritems]; now how remove when in other views when tabbarcontroller pressed without disturbing buttons in uitoolbar have added in ib. this achieved same way added button, make ivar, gets instanciated once when detect particular view controller first time. ...

How to test if an element resides in an iFrame using jQuery? -

how test if element resides in iframe using jquery , if does, how select iframe? try work you. var requirediframe; $("iframe").each(function(){ if($(this).contents().find("elementyouarelookingfor").length){ requirediframe = $(this); return false; } });

c# - What is an "Action<IEnumerable<TwitterStatus>,TwitterResponse>action"? -

hi i've made attempt @ using tweetsharp twitter application i'm building , had success on desktop application. when wanted port wp7, methods required argument: action<ienumerable<twitterstatus>,twitterresponse>action i'm not sure method asking for. didn't have use in desktop app. can explain it's asking or maybe point me proper documentation can understand how works? thanks. it's describing method takes 2 arguments, ienumerable<twitterstatus> , twitterresponse , has void return type. there many ways satisfy concise: (status, response) => blah ordinary method: private void mymethod(ienumerable<twitterstatus> status, twitterresopnse response) { blah } the latter example can passed methods directly: obj.sometwittermethod(mymethod);

c++ - Why is the heap after array allocation so large -

i've got basic application boils down following code: char* gbigarray[200][200][200]; unsigned int initialise(){ for(int ta=0;ta<200;ta++) for(int tb=0;tb<200;tb++) for(int tc=0;tc<200;tc++) gbigarray[ta][tb][tc]=new char; return sizeof(gbigarray); } the function returns expected value of 32000000 bytes, approximately 30mb, yet in windows task manager (and granted it's not 100% accurate) gives memory (private working set) value of around 157mb. i've loaded application vmmap sysinternals , have following values: i'm unsure image means (listed under type), although irrelevant of value around i'm expecting. throwing things out me heap value, apparent enormous size coming from. what don't understand why is? according this answer if i've understood correctly, gbigarray placed in data or bss segment - i'm guessing each element uninitialised pointer placed in bss segment. why heap value larger...

memcached - How to store an object in Memcache and how to retrieve it using PHP -

i doing project using mvc architecture. maintaining values in session. 1 of senior developer tell me not right procedure , suggest me store values in cache. is right? if yes, how can using php... memcache not answer everything, can dramatically increase page loads web applications have lots of load. the concept store data key-value pairs in memory (a memcache) , retrieve data using key whenever necessary. here quick example of setting , retrieving data memcache in php: $memcache = new memcache; $memcache->connect('192.168.1.2', 11211) or die ("unable connect"); $memcache->set(‘key1’, 'value1'); // set data $memcache->get('key1'); // data read on of this: http://papermashup.com/using-memcache-with-php/ http://fschiettecatte.wordpress.com/2008/05/15/to-use-or-not-to-use-memcached-that-is-the-question/ http://www.majordojo.com/2007/03/memcached-howto.php good luck, let me know if have more questions

c# - Ninject with Object Initializers and LINQ -

i'm new ninject i'm trying may not possible wanted ask. free-handed below there may typos. let's have interface: public interface iperson { string firstname { get; set; } string lastname { get; set;} string getfullname(); } and concrete: public class person : iperson { public string firstname { get; set; } public string lastname { get; set; } public string getfullname() { return string.concat(firstname, " ", lastname); } } what i'm used doing when i'm retrieving data arrays or xml: public ienumerable<iperson> getpeople(string xml) { xelement persons = xelement.parse(xml); ienumerable<iperson> people = ( person in persons.descendants("person") select new person { firstname = person.attribute("fname").value, lastname = person.attribute("lname").value }).tolist(); return people; } i don...

c++ - Can I run code *after* a built-in wxWidgets event is handled? -

i suspect there must built-in way this, google-fu has failed me. i'm using wxscrolledwindow , , have paint unscrolled background picture behind contents each time window scrolled. i've made scroll handler this... void homewindow_t::onscroll(wxscrollevent &evt) { refresh(); evt.skip(); } ...which works force redraw entire window each time. unfortunately, draws window before scroll handled, background repainted , scrolled or down, screwing alignment. documentation suggests refresh invalidates screen, meaning scroll handler must forcing redraw. the way around can see handle scrolling code myself, i'd rather not if don't have to. ideas, suggestions, clues...? the general solution i've found running code after event handled post second, different event event queue before skipping current event (so gets handled default handler), , handle when comes up. however, perusing wxwidgets source code, i've found answer specific problem: ...

Ruby/Rails Parsing Emails -

i'm using following parse emails: def parse_emails(emails) valid_emails, invalid_emails = [], [] unless emails.nil? emails.split(/, ?/).each |full_email| unless full_email.blank? if full_email.index(/\<.+\>/) email = full_email.match(/\<.*\>/)[0].gsub(/[\<\>]/, "").strip else email = full_email.strip end email = email.delete("<").delete(">") email_address = emailveracity::address.new(email) if email_address.valid? valid_emails << email else invalid_emails << email end end end end return valid_emails, invalid_emails end the problem i'm having given email like: bob smith <bob@smith.com> the code above delete bob smith , returning bob@smith. but want hash of fname, lname, email. fname , lname optional e...

automation - batch file: arithmetic operations on decimal values -

i'm forced use dos write batch scripts. how arithmetic operations on variables? how re-write last line? for %%f in (*.ogg) call :runsox "%%f" del temp.ogg tmpfile goto :eof :runsox soxi -d %1>tmpfile set /p decvalue=<tmpfile * 1.2 update:: following bhu1st's post, couldn't see how apply script. gnu bash has same problem, cannot operate on floating point numbers. way solve in bash calculate value bc , command line calculator. download command line calculator . , use in line: calcoo %decvalue%*1.2>tmpfile try this: set /p tmpvalue=<tmpfile set /a decvalue=tmpvalue * 1.2 but then, result truncated. no decimals.

html - Why is this document rendered as XML not HTML5? -

why second document below renedered xml not html? document.constructor becomes xmldocument . edit web server replies application/xhtml+xml; charset=utf-8 when issue request browser (instead of curl ). noticed, when sniffing wireshark. perhaps need not have posted question then, since seems have configured web server incorrectly. edit 2: lift-web issue (the web framework use). see reply below. (this breaks google's svg web me. svg web works fine, in case, html not xml. , have no idea how make web browser consider document being html not xml -- think have specified html not xml.) the first document below rendered html though. cannot life of me find relevant difference in http headers or <meta> tags of first , second documents!? (i've diffed them; there're uninteresting headers differ.) in particular, both documents specify content-type: text/html; charset=utf-8 , both in http headers , <meta> tags. (does browser check other stuff, in ad...

javascript - window.print then redirect from codebehind c# -

i have searched every possible way , i'm stuck :( can give me pointers on how accomplish following: page1 opens page2 page2 windows.print() after prints redirect page1 now page2 loads information in codebehind on page_load after done loading prints if put response.redirect after done loading page never prints. hope understandable can give me sort of solution. i've tried put timer problem user might not print right away or have wait computer recognize printer or other situation have rely on printing , redirecting. also redirect must pass variable codebehind i'm thinking maybe calling windows.print codebehind , passing parameter after done can redirect javascript correct value? appreciated. thanks in advance a possible solution open page2 in new window window.open(); user prints, , closes window. simple, clean, effective.

regex - Mod_rewrite works on local, not on remote, version? -

i have site. let's call htp://www.mysite.com i have rewrite rule change htp://www.mysite.com/?q=words%20etc/0/10 http://www.mysite.com/words%20etc/0/10 (or http://www.mysite.com//0/10 or http://www.mysite.com/0/10 ) .htaccess:errordocument 404 htp://www.mysite.com/404.html options +followsymlinks rewriteengine on rewritecond %{request_uri} !-f rewritecond %{request_uri} !-d rewritecond %{request_uri} !index\.php rewriterule ^/?([^/]+?)?/?([0-9]+?)/([0-9]+?)$ index.php/%{the_request} [nc] now, works on local apache 2.2.11 server, no errors. on host's apache 1.3.41 server, following error: [sat mar 5 21:42:14 2011] [alert] [client [ip]] /home/_/public_html/mysite.com/.htaccess: rewriterule: cannot compile regular expression '^/?([^/]+?)?/?([0-9]+?)/([0-9]+?)$'\n i imagine it's quirky apache version other sites on host use mod_rewrite without hitch. i've tried removing +followsymlinks line, rewrite engine line. haven't tried removing condi...

ASP.NET MVC session lost between page loads -

i trying use session state in mvc , have been stuck entire evening! realise session state should used sparingly in mvc - sure want use 1 page - appreciate solutions rather opinions. basically, have contact form captcha image. when page loads want set session characters used in captch image (dynamically generated image). have 'new image' link async creates new code, sets session , dynamically loads new image screen. the session stays sets long page doesn't load or reload. need able validate user input against code in session (which should reflect displayed user) session empty. if perform ajax reload on image i.e. set session asynchronously - session set when perform post!! what's going on? i need able persist session value - arrrhhhh! i have base controller: public new httpcontextbase httpcontext { { httpcontextwrapper context = new httpcontextwrapper(system.web.httpcontext.current); return (httpcontextbase)context; } } and in...

Image uploading using CKEditor in asp.net mvc -

i using ckeditor in application rich text box. used provide bullets , numbering. need upload images in between text. how can accomplish this? configuraion set? should use ckfinder this? if please detail me on this. you can try this: in view. filebrowserimageuploadurl: '../../upload/uploadnow' in controller public actionresult uploadnow(httppostedfilewrapper upload, string ckeditorfuncnum) { string path = ""; string pathweb =""; if (upload != null) { string imagename = upload.filename; string extention = path.getextension(imagename); string name = datetime.now.tostring("yymmddhhmmssms"); imagename = name + extention; pathweb = "/images/uploads/" + imagename; path = system.io.path.combine(server.mappath("~/images/uploads"), imagename); upload.saveas(path); httpcontext.response.wri...

iphone - Does [NSDate date] return the local date and time? -

am stupid? time thought [nsdate date] returned local date , time. after having trouble nsstringformatter/stringfromdate/datefromstring today noticed [nsdate date] returning 2011-03-06 11:00:00 +0000. after researching see [nsdate date] returns raw date gmt. what purpose gmt offset portion serve if shows +0000? not understand [mydate description]. docs says supposed display gmt offset dst information. same thing [nsdate date]. bottom line me, if use [nsdate date] current date , after 2pm tomorrow's date in -10 time zone. not mention problems ran today nsdateformatter. am seeing correctly? funny thing seem remember seeing [nsdate date] returning 2011-03-06 11:00:00 -36000, or did think seeing 2011-03-06 11:00:00 -10000. i can work it, maybe can expound on me better understand nsdate. nsdate returns current date. though can convert , string format in different locales/time zones, nsdate has no internal concept of time zone. nsdates not bound particular region. if...

jquery - How to replace dynatree node with new node? -

i have created dynatree right contex menu further has sub-menu. requirement such on click of of item of sub-menu, sub-menu item should replace tree node activated. followin pictorial view: abc def ghi-> lets on right click of ghi, have context menu->xyz further has sub-menu-> pqr. want on click of pqr, should replace ghi. i have following code written create tree , context menus. $(function(){ $("#tree").dynatree({ initajax: { url: "sample-data1.json" } , onactivate: function(node) { $("#echoactive").text(node.data.title); }, ondeactivate: function(node) { $("#echoactive").text("-"); } }); }); function replacetest() { var tree = $("#tree").dynatree("gettree"); } function replace() { ...

sql - what does EXEC master.. Do? -

i have seen like: exec master.dbo.xp_cmdshell what master refer to? update , why followed 2 points: master.. generally use master.dbo. correct, why people write master.. ? master 1 of default sql server system databases . can tell because posted: exec master.dbo.xp_cmdshell ...uses 3 name notation. "master" in database position, "dbo" schema, , "xp_cmdshell" function/stored procedure in case. use notation referring tables , views, in different contexts. this: exec master..xp_cmdshell ...just omits schema, isn't idea if there more 1 schema being used in database.

javascript - Context menu and touch-screen devices -

now touch-screen devices common, it's bad idea design websites uses custom context menu? i'm talking this kind of menus . how iphone users , android mobile users see context menus? users able interact custom context menus? other bad practices when programming thinking on kind of devices? in android..context menu appears (eg. in browser) when press , hold particular link or text. think can still have context menus except event on gets fired different.

timer - delay closing window javascript -

i writing google chrome extension. here putting silly-assed questions. routine primitive runs fine. problem runs fast overloads server , ip address gets blocked. needs throttle. the question whether better construct timer or setinterval. after examining particular page, content script closes window self.close(). if put setinterval, delay closing of page , slow whole process as length of interval. seems throttle. now last line of content script simply: self.close(); i presume if modify code follows delay: var t=settimeout("self.close()",2000); will work? there better way it? i'd rather use : settimeout(function(){ self.close(); },2000); but way valid too...

android - Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE? during runing emulator -

[2011-07-22 16:33:02 - today] ------------------------------ [2011-07-22 16:33:02 - today] android launch! [2011-07-22 16:33:02 - today] adb running normally. [2011-07-22 16:33:02 - today] performing com.horror.android.today.mymain activity launch [2011-07-22 16:33:02 - today] automatic target mode: launching new emulator compatible avd 'google09' [2011-07-22 16:33:02 - today] launching new emulator virtual device 'google09' [2011-07-22 16:33:10 - today] new emulator found: emulator-5554 [2011-07-22 16:33:10 - today] waiting home ('android.process.acore') launched... [2011-07-22 16:34:07 - today] home on device 'emulator-5554' [2011-07-22 16:34:07 - today] uploading today.apk onto device 'emulator-5554' [2011-07-22 16:35:12 - today] installing today.apk... [2011-07-22 16:35:31 - today] installation error: **install_failed_insufficient_storage** [2011-07-22 16:35:31 - today] please check logcat output more details. [2011-07-22 16:35:32 - today...

php - disable smarty notice -

i disable smarty-s notices. this exactly: notice: undefined variable: xy because know variables undefined , in cases don't want define them. but don't want disable other php notices. thanks help! you should use this: http://www.smarty.net/docs/en/variable.error.reporting.tpl just set $smarty->error_reporting = e_all & ~e_notice;

pyqt - Python with beautiful UI + glass effect -

i'm new in python. know can create interface on python, wpf? didn't find glass effect pyqt. it's important decision. thanks. i'm sorry didn't give lot of details. need port wpf app python. main goal still need ui. can make http://www.codeproject.com/kb/silverlight/silverlightglassorbbutton.aspx?msg=3170079 on python? can use different styles mouseover , normal state? glass effect qt skin , has nothing python in particular. people there's tutorial qt skinning . failed google ready-made glass-like skin, though.

Most efficient way to return a random specific sample size in sql / coldfusion -

i need return values based on sample size. if user selects 5% query resulting in random 5% of rows origonal query. there way can achieve sql? currently process run query generate random numbers remove rows until 5% left, build new query off rows left. not believe efficient way, better ideas? thanks what end? support out of box, eg. sql server limiting result sets using tablesample : select firstname, lastname person.person tablesample (5 percent) ; in system should try filter on server, not on client. eg. use mysqls crc32 compute row checksum , use checksum qualify 5% rows. or use rand() similar effect. whatever do, don't fetch entire table , filter rows on client.

how to embed a button in a textbox control using c# in compact framework -

i'm trying create searchbox control using c# in compact framework. i'm thinking of developing custom control has textbox button @ end of it. button should overlayed picture (of magnifying glass indicate search action). should ideally google search toolbar control. is doable? how should start? pointers or code examples great. thanks why not create custom control, consisting of textbox , button right of textbox? add border / styling make them if single control. shouldn't difficult

android - Problem in playing video :( -

i have list view , want when row click play video, code : public void onitemclick(adapterview<?> a, view v, int position, long id) { setcontentview(r.layout.video); videoview videoview = (videoview)findviewbyid(r.id.videoview); mediacontroller mc = new mediacontroller(?); videoview.setmediacontroller(mc); videoview.setvideouri(uri.parse((string) mylist.getitematposition(position))); videoview.requestfocus(); videoview.start(); } please use putextra method in activity protected void onlistitemclick(listview l, view v, int position, long id) { super.onlistitemclick(l, v, position, id); object o = this.getlistadapter().getitem(position); string videouri= o.tostring(); intent in = new intent(getapplicationcontext(), videoexamplesactivity.class); in.putextra(key_name, videouri); startactivity(in); toast.maketext(this, "you have chosen videouri: " + " " + videouri, toast.length_long).show(); }

coldfusion - How to create a new CouchDB User without Futon or Curl? -

i'm searching way create new couchdb user without using futon or curl... straight http request. one way found (http://stackoverflow.com/questions/3456256/error-creating-user-in-couchdb-1-0) puts json doc "http://localhost:5984/_users/org.couchdb.user:username" create user. i have attempted following: <cfhttp url="http://127.0.0.1/_users/org.couchdb.user:xyz_company" port="5984" method="put" username="#variables.couch_username#" password="#variables.couch_password#"> <cfhttpparam type="header" name="content-type" value="application/json"> <cfhttpparam type='body' name='org.couchdb.user:xyz_company' value='{"roles":[],"name":"xyz_company","salt":"3b33bf09-26b9-d60a-8f469d01286e9590","id":"org.couchdb.user:xyz_company","password_sha":"096ea41a5a81ea1507f2c6f7edc364c0b8...

JQuery images in plone4 -

which product plone 4 can use insert preview-sized images in sites , on, , have them automatically jquery-linked fullsize views? eg: it's been solved in plone.org products screenshot preview. plone.app.jquerytools included in plone 4, , may added plone 3.3.x. see documentation on overlay helpers recipes setting popups images. popup manager plone 4, , we're using on plone.org.

geospatial - Simple latitude/longitude + integer database? -

is there fast, persistent database storing latitude, longitude, , integer value quick geo-spacial lookups? the idea have lots of id's of different things , want search lat/lon squares id's in given location. my first thought creative use of key-value store membase or redis. however, can't figure out method search based on properties latitude , longitude short of creating set sized lat/lon blocks , placing ids value (which doesn't work well). how spatiallite, geocouch, mongodb spatial extension, or postgis? don't use mysql - doesn't have of spatial functions implemented

git - Getting CalendarDateSelect gem to work with Rails 3 -

when follow instructions here , run bundle install , get: fetching http://github.com/paneq/calendar_date_select.git c:/ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/source.rb:560:in ``': no such file or directory - git clone "http://github.com/paneq/calendar_date_select.git" "c:/ruby192/lib/ruby/gems/1.9.1/cache/bundler/git/calendar_date_select-32215bd0f96918494c96e788d776d90837363fe4" --bare --no-hardlinks (errno::enoent) what doing wrong? can see git repository want @ https://github.com/paneq/calendar_date_select/tree/rails3test . i sorted way. error message ( ``': no such file or directory ) obfuscating real problem, git wasn't on path . hmm.