Posts

Showing posts from April, 2014

xml - How to transfer contents of a string, not a file, directly to client via http download in Drupal? -

i'm getting stuck while developing form in drupal; upon valid submission, want form initiate http file transfer client, opening file download prompt data generated in-memory string, not file. file_transfer($source, $headers) looked quite promising, $source expected uri file. there similar function accepts contents of string instead of file uri? in search through drupal api documentation, have yet find anything. i have tried (hackish) more manual approach: header("header statements"); header("more header statements"); echo $string_contents; exit; this method of course, interrupts drupal's form processing, can't lead things in long term. any appreciated. thanks! something along these lines: <?php header("content-type: application/octet-stream"); header("content-disposition: attachment; filename=\"my-file.txt\""); $data="hey text file, yay \n"; $data .= "it has stuff in it"; ech...

Gwt RequestFactory: editing a proxy immediately after receiving it -

i want requestcontext.edit(anobject) after receive in receiver.onsuccess, can put in client-side database editable. unfortunately, when so, requestfactory complains request in progress. how can achieve this? requestcontext.findorganization(id).fire(new receiver<organizationproxy>() { public void onsuccess(organizationproxy response) { database.put(requestcontext.edit(response)); //fails because request in progress } }); i resolved using disposable request context create request, , using more-permanent request context edit object: temporaryrequestcontext.findorganization(id).fire(new receiver<organizationproxy>() { public void onsuccess(organizationproxy response) { database.put(permanentrequestcontext.edit(response)); //succeeds because has not been fired, though edit() has been called many times } });

android - FilterQueryProvider not updating ListView -

trying use filterqueryprovider function update contents of listview, characters entered filter, runquery function called, , new cursor filtered content returned, listview not update show new contents. docs state after runquery returns, changecursor called. isn't enough update listview display? code set filter is: madapter = new itemadapter(curs); madapter.setfilterqueryprovider(new itemfilter()); setlistadapter(madapter); and filter class simply: class itemfilter implements filterqueryprovider { public cursor runquery(charsequence filter) { return getnewcursor(filter); } } the cursor getnewcursor correctly fetch subset of rows. have missed in getting listview update?

exchange server - Dynamics Ax Emailing PDF from within Ax -

we trying email pdf messages out of ax when send them out going out rich text emails. in reading online looks default ax. the problem sends out winmail.dat file in peoples emails , can not view file have sent them. have worked around sending emails outlook outside of ax , works fine our settings in outlook set send emails html. i wondering if there way either within ax or outside of ax change html can view emails. there setting or option within exchange can make sure emails sent html or not. this setup problem in exchange. http://support.microsoft.com/kb/138053 the power of google.

php - Duplicate Filename Protection by Incrementation -

first post, , rather asking question proposing answer 1 couldn't find answer for, may else. the issue saving file uploads locally, , trying find nice way handle duplicate file names. given filename of filename.ext can form, give first filename of form filename-\d+.ext doesn't exist $file = "upload.jpg"; while(is_file($file)) { preg_match("/\d+\.[^.]*$/", $file, $matches); if (!$matches) { $file = preg_replace('/(\.[^.]*)$/', '-1${1}', $file); echo $file."<br>"; } else { list($i, $extension) = explode(".",$matches[0]); $file = preg_replace('/(\d+\.[^.]*)$/', ++$i.".".$extension, $file); } } echo $file; hope might someone this algorithm not scalable. uploading n files same name cause o( n ) behavior in algorithm, leading o( n ²) total running time, including o( ...

makefile - GNU make differences in multiline variable declarations -

i read question, , surprised wasn't working: why gnu make canned recipe doesn't work? so tried myself , got same results. here's example makefile: define foo bar baz endef define bar = foo baz endef $(info foo: $(foo)) $(info bar: $(bar)) all: and here's output running it: $ make foo: bar baz bar: make: nothing done `all'. what's happening here? gnu make manual seems indicate these 2 variable declarations should same - missing here? edit: some quotations manual referring to: 3.7 how make reads makefile define immediate deferred endef define immediate = deferred endef 5.8 defining canned recipes here example of defining canned recipe: define run-yacc = yacc $(firstword $^) mv y.tab.c $@ endef 6.8 defining multi-line variables ... may omit variable assignment operator if prefer. if omitted, make assumes ‘=’ , creates recursively-expanded variable... as can see, canned recipes section explicit...

facelets - PrimeFaces Datatable Column Sorting is not working in IE8 but it works fine in Firefox -

primefaces datatable column sorting not working in ie8 works fine in firefox. webpage error details user agent: mozilla/4.0 (compatible; msie 8.0; windows nt 5.1; trident/4.0; .net clr 1.1.4322; .net clr 2.0.50727; .net clr 3.0.4506.2152; .net clr 3.5.30729) timestamp: thu, 17 feb 2011 17:56:48 utc message: unexpected call method or property access. jquery.js.jsf line: 23 char: 21078 code: 0 uri: http://localhost:8080/primefacestutorial/javax.faces.resource/jquery/jquery.js.jsf?ln=primefaces&v=2.2.1 you might have: <h:form id="form1"> ..... <h:form id="form2"> ... </h:form> ... </h:form> i got same error, remove nested form. removed form2 , worked fine.

c# - Get pure XML from Object -

i have following code converts object xml , working fine. public static string convertobjecttoxml(object obj) { string xmlizedstring = null; memorystream memorystream = new memorystream(); xmlserializer xs = null; if (obj derivedclass2) { xs = new xmlserializer(typeof(derivedclass2)); } textwriter w = new stringwriter(); //this.s = new xmlserializer(this.type); xs.serialize(w, notoficationorder); w.flush(); //return w; xmlizedstring = w.tostring(); w.close(); return xmlizedstring.trim(); } and gives following output <?xml version="1.0" encoding="utf-16"?>* <obj xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <list> <!--...--> </list> </obj> but not want xml depicts xml namespace...

CryptoAPI: How to verify a DSA signature from OpenSSL or Java using CryptVerifySignature -

i able verify openssl-generated dsa signature using microsoft cryptoapi. consider have following inputs: an existing dsa public key: the data verified a binary signature the signature has been converted base64 series of 48 bytes. without knowledge of cryptoapi, more difficult should be. the major stumbling blocks were: decode x509 dsa public key using cryptstringtobinarya , cryptdecodeobjectex convert dsa signature format openssl's dsa_sign produces dsa signature in asn.1 der format cryptoapi's cryptverifysignature expects dsa signature in p1363 format here's rough sample of how solved problem: const char* pubkey = "miibtjccassgbyqgsm44baewggeeaogbanw/k8nyrektrmvishnjtsawxf33hau4" ..... "/fegaibbop31rjq9ufaj2t06en0t0b+dp1hjz/mfpgtpoxhqf3dqndra3ot1fstp"; bool verify(const unsigned char* msgdata, unsigned int msglength, const unsigned char* signature, unsigned int signaturel...

coding style - In Python, should I use else after a return in an if block? -

first, couldn't find answer in pep 8 . doesn't mean isn't in there. feel free point me @ it. which style prefer? the first one : if spam: # stuff. return eggs else: # maybe other stuff. return parrots or the second one : if spam: # stuff. return eggs # maybe other stuff. return parrots it depends, if return parrots, when not return eggs, first 1 more clear. if trying catch error or that, second 1 better.

Postgresql replication: londiste vs. slony -

has had experience using londiste ? alternative slony postgres replication. have been beating head against wall trying slony work way need , looking easier way. londiste seems alternative, wanted see if has pros/cons before commit switch. i have used both , requirements londiste option. have simple set subset of tables replicated staging server live large batch updates , insert , intraday smaller updates running on postgres 8.4 , centos 5.5 , skytools 2 , use queue component event based actions. have used slony 1.* series can't comment on more recent versions. some pros londiste simple set up generally simple administer haven't had issues robustness of replication in 8 months of production use also can used generic queing system outside of replication , quite simple write own consumer some cons documentation pretty scant you need careful when implementing ddl changes it won't stop making changes in slave can't used cascading replicati...

Simple Facebook API usage in Rails 3 -

i want connect app facebook in order post on user's wall. want user click post message on wall, pop-up of js sdk should appear, login , authorize , redirected home page pop-up disappears. i trying fb_graph gem had hard troubles , want know: there simpler way it? note don't want make user able login in app facebook, post wall. as facebook not offer ruby api, have choose between using js sdk or implementing facebook share link. if want post in user's wall, recommend second option because of ease , nature. can customize content of post this way . if decide go js way, have to: create fb app. include fb sdk page. initialize sdk app settings. ask permissions user in order post wall. assign button function check login. if she's logged, show window post wall (fb popup or own form, iframe dialogs available inside facebook pages). there alternative step 5 using graph api , access token, it's little bit more complicated , don't recommend if...

asp.net mvc 3 - jqGrid saving a row with nullable columns -

so have jqgrid on asp.net mvc 3 website. it's loading data, searching, filtering, , saving rows built in pop-up editor. can't work saving nullable property. i'm using largejsonresult instead of built in jsonresult, example of row in grid this: // c# class public class row { public string { get; set; } public string b { get; set; } public int c { get; set; } } // example object instance, let's these values come db var ret = new row { = "a", b = null, c = 5 }; // json string sent grid (notice b omitted) // "{ a: 'a', c: 5 }" now, grid show as: a b c undefined 5 and brings me problem. pop-up edit form show "undefined" in textbox b, , post server. if save database, i'll have "undefined" in db instead of null. how jqgrid preserve null value round trip? 1 solution seems me hacky based on oleg solved in thread: // override jqgrid serialization jquery.extend(jquery.jgrid.edit, ...

iphone - facebook iOS sdk custom delegate and SSO authorization -

i've been toying new facebook ios sdk. have gotten project point can login successfully. have 2 questions: 1) hit graph api issue following call: [facebookinstance requestwithgraphpath:@"me" anddelegate:self]. possible specificy delegate other self? responses go (void)request: (fbrequest *) request didload:(id) result. since app may issue requests facebook api @ different times , need different things happen each respective request issued, how can specifiy callback function response should hit in app? possible? 2) once user has logged in, how can check authorization/login status can disable login button if logged in? consider example of user turning on app 1st time , logging in. closing app, , opening few minutes later. rather not show user login button 2nd time , instead start pulling information display such name. 1) there shouldn't wrong specifying delegate other self, long object provide delegate conforms fbrequestdelegate protocol. alternately c...

java - Combined JAX-RS and JAX-WS -

is there framework, library or technique combines jax-rs , jax-ws (or equivalent functionality) 1 combined service in similar way using 2 endpoints (one soap , 1 rest) same service in wcf? apache cxf can job. read more @ http://cxf.apache.org/docs/frontends.html

iphone - Grab all values in NSDictionary inside an NSArray -

i have nsarray full of nsdictionary objects, , each nsdictionary has unique id inside. want lookups of particular dictionaries based on id, , information dictionary in own dictionary. myarray contains: [index 0] mydictionary object name = apple, weight = 1 pound, number = 294, [index 1] mydictionary object name = pear, weight = .5 pound, number = 149, [index 3] mydictionary object (etc...) i want name , weight second dictionary object (i won't know index of object... if there 2 dicts, make dictionary [myarray objectatindex:1] ) so, know number 149. how able second mydictionary object out of myarray new nsdictionary? as alternative jacob's answer, ask dictionary find object: nspredicate *finder = [nspredicate predicatewithformat:@"number = 149"]; nsdictionary *targetdictionary = [[array filteredarrayusingpredicate:finder] lastobject];

jQuery collapsing faded divs and expanding animation problem -

i'm trying animate image full width , height of div works top left image i'd expect others moves image top left , animates it here's link jsfiddle is there way fade siblings out , animate image current position? thanks solution to desired effect works in browsers did jsfiddle thanks iwasrobbed helping solution it possible, not fadein or fadeout functions. instead, have animate opacity on absolutely positioned elements. if try , use fadein or fadeout nothing. here jfiddle version jquery 1.5.0 works (added orbling's images firefox users can't see broken image symbol): http://jsfiddle.net/iwasrobbed/qpkr5/1/ <!doctype html> <html> <style media="screen" type="text/css"> /* positioning */ img.topleft {position: absolute; top: 0; left: 0;} img.topright {position: absolute; top: 0; right: 0;} img.bottomleft {position: absolute; bottom: 0; left: 0;} img.bottomright {position: absolu...

mysql sorting by 2 columns dependencies -

i'm searching trick, how sort this: have 2 columns: status (numeric) , modification_date (date). if status<9 (means me if case not closed) - should "order status,modification_date if status=9 (if case closed) - should sorted "order status,modification_date desc so - if have cases not closed - should first in chronological order, if closed - should in reversed order (newest first) i hoped, can union, it's not possible use "order by" in both sections (or maybe i'm doing wrong) is possible do? order status, if(status < 9, 1, -1) * modification_date

oop - C# compiler ignores duplicated parameter name in constructor -

i'm not sure why happening - hoping can explain it! i have base class called baserequest in it: protected int cartnumber; i have derived class, inherits baserequest. has public field , constructor follows: public int currentcartnumber; public extendedbaserequest(int cartnumber) { currentcartnumber = cartnumber; } yes, know it's bit silly have parameter same name protected field in base class, didn't notice until now! this compiles , runs, public currentcartnumber value in derived class not set uses value base class, 0 initialised. shouldn't compiler moan because declaration of cartnumber in constructor's signature has same name 1 in base? looking forward hearing you. your analysis of what's happening incorrect. there's else going on here. are sure you're not passing 0 constructor? the unqualified cartnumber refer parameter. inherited field need qualified this or base . in code shown in question, statement current...

java - another homework question error unexpected type required:variable found:value -

i have error, unexpected type required:variable found:value , can't figure out why. code follows: public class isbntext extends jtextfield { protected static final int isbn_num=10; protected static string booknum; protected jtextfield booktext; protected string valid; public isbntext() { super(20); } public string getisbn() { booknum = gettext(); return booknum; } private string validateisbn(string booknum)throws isbnexception { boolean check=false; booknum.replaceall("-",""); if (booknum.length()!=isbn_num) throw new isbnexception ("isbn "+ booknum + " must 10 characters"); (int i=0;i<booknum.length()-1;i++) { if (character.isdigit(booknum.charat(i))) check=true; } if (booknum.charat(9)=='x') check=true; if (character...

Delphi/visual studio designer like snap-to -

i application i'm working on have snap-to functionality when moving controls around designer similar seen in delphi 2006 , higher. does know if there existing free components can add application in order working or i'll need implement myself? thank you. although not free might want take @ http://www.devexpress.com/products/vcl/exlayoutcontrol/ not sure if mean though.

asp.net mvc - Linq to SQL over zealous serialization -

im developing api using .net mvc , returning results in json format. @ first seemed work ok results returned database ienumerable converted jsonresult type returned. this serializes hierrachy me , child objects loaded automaticaly based on relationships in designer , become part of json hierrachy. ienumerable<book> books= _contentrepository.getbooks(); return json(new { success = true, data = new { books = books } }, jsonrequestbehavior.allowget); this power problem whole load of child objects loaded dont need. example, i've got book entity has related books , these related books have related books, tree gets deep quickly. rick strahl talks towards end of article: http://www.west-wind.com/weblog/posts/147218.aspx i still want keep hierrachy, json hierrachical. e.g. book.author, book.publisher[0].name want control on loaded in query. am looking ...

c# - How can I create new blank solution in vs 2008 programmatically? -

the design based approach is: new project -> other project type -> visual studio solution -> blank solution i have create blank solution programmatically in c# , in solution add new empty project , files. found lot of code on web using dte adding empty project in existing solution explorer please give me reference code. you can create new blank solution using dte this: string visualstudioprogid = "visualstudio.solution.9.0"; type solutionobjecttype = system.type.gettypefromprogid(visualstudioprogid, true); object obj = system.activator.createinstance(solutionobjecttype, true); solution3 solutionobject = (solution3)obj; solutionobject.create(".", "mysolution"); solutionobject.saveas(@"c:\temp\mysolution.sln"); //or wherever prefer you have add references envdte.dll, envdte80.dll, , envdte90.dll. resulting file simple , created in other ways (as plain text file).

In Common Lisp, is there a function that returns a symbol from a given string? -

i want >(??? "car") car >((??? "car") '(1 2)) 1 i can't seem find function this. are looking this? (eval (read-from-string "(car '(1 2))")) gives: 1 update: how (funcall (intern "car") '(1 2)) ? :)

sql - Inner join query -

Image
please go thourgh attached image descirbed scenario: i want sql join query. have @ like select * orders o exists ( select 1 orderbooks ob inner join books b on ob.bookid = b.bookid o.orderid = ob.orderid , b.isbook = @isbook ) the query return orders based on given criteria. so, is, when @isbook = 1 return orders there exists 1 or more entries linked order books. , if @isbook = 0 return orders there exists 1 or more entries linked order not books.

oop - Revision books for experienced developers -

when asked yesterday, couldnt explain difference between abstract class , interface, though understand difference (couldn't right normal-human-language words out). forgot formal definition of 3-tier architecture, though use concept every day. is there book or site complete read-through of same refresher-course experienced developers? in other words: "here of things should know, brief definition each"? obviously, go out of date relatively quickly, mean want 1 core oo , architectural design concepts. i think should refer wikipedia short explanations , definitions. kind of information looking won't found in books experienced developers. should rather search books beginners. , if need brief definition.

javascript - PHP Comet. How to do it better? -

i have simple comet chat. javascript send ajax request long polling. when server find new messages in database, answers , gives json. next, javascript send request again. javascript: function cometconnect(){ $.ajax({ cache:false, type:"get", data:'ts='+ts, url: urlback, async: true, success: function (arr1) { //work json //..... }, complete:function(){ cometconnect(true); nerr=false; }, datatype: "text" }); } php $flag=true; $lastmodif = isset($_get['ts']) ? $_get['ts'] : 0; while($flag){ $q=mysql_query("select text, posterid,modified, fromuserid,touserid, login commonmessage modified>$lastmodif"); while($r=mysql_fetch_row($q)){ $flag=false; //prepare json... variable $resp //......... } usleep(5000); } echo $resp; the problem following: "while($flag)" can execute lon...

iphone - How to type cast UIView into a CPGraphHostingView? -

how type cast uiview cpgraphhostingview? thanks. unless uiview not created real uiview object ([[uiview alloc]initwithframe:]) try, cpgraphhostingview object ([[cpgraphhostingview alloc]initwithframe:]) try (cpgraphhostingview*)view as normal type cast written.

c# - public event EventHandler SomeEvent = delegate { }; -

i kind of tired of having useless noise in code: private void raisesomeothereventifitisnotnull() { if (this.someotherevent != null) { this.someotherevent(this, eventargs.empty); } } in 99.9% of cases don't care if attached or if null or not. raise event! don't why c# compiler makes me write noise. so though maybe declare event this: public event eventhandler someotherevent = delegate { }; this allow me rid of useless null check , useless raise* method. do: this.someotherevent(this, eventargs.empty); now when compare standard approach "my" approach in lutz röder's reflector see signigicant differences. compiler has overriden add{} , remove{} there static instance of anonymous delegate: [compilergenerated] private static eventhandler cs$<>9__cachedanonymousmethoddelegate1; and there this: .method private hidebysig static void <.ctor>b__0(object, class [mscorlib]system.eventargs) cil managed { .custom inst...

Getting Same Facebook "Like" count for different URLS -

i'm trying add multiple "like" buttons on same page specifying different url's i have 2 urls want "like" on separate page http://www.spoilertv.com/search/label/brothers%20and%20sisters http://www.spoilertv.com/search/label/better%20with%20you here code. better <iframe src="http://www.facebook.com/plugins/like.php?href=http%3a%2f%2fwww.spoilertv.com%2fsearch%2flabel%2fbetter%2520with%2520you&amp;layout=button_count&amp;show_faces=false&amp;width=150&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:150px; height:21px;" allowtransparency="true"></iframe> brothers , sisters <iframe src="http://www.facebook.com/plugins/like.php?href=http%3a%2f%2fwww.spoilertv.com%2fsearch%2flabel%2fbrothers%2520and%2520sisters&amp;layout=button_count&amp;show_faces=fals...

uitableview - What's the Best way for Lazy loading images in iPhone? -

i want know, best way lazy loading. me, of applications have used parsing , url server , put image table view. have implemented lazy loading improving performance of application. want know best method lazy loading images. because have used lazy loading 4 ways, lazy loading images apple developer.com implemented asynchronous method improving lazy loading used separate main thread handling image downloaded. have used ecoimageloadingdemo application lazy loading. but have used above 4 methods achieve lazy loading. want know what's best method lazy loading. 1 best performance wise , memory wise suitable that? thanks in advance. regards, pugal from experience, performance-wise , memory-wise solutions on opposite ends of slider. can move around solution somewhere between these two, disadvantage having best solution performance-wise, means worse solution memory-wise , vice-versa. hope explained clear enough :) here's how handle problem of lazy loading im...

java - problem caused by single quotes in select query -

public void getexp(string bool_expression,int groupid,int explevel){ list<string> list=new arraylist<string>(); list<string> nextexpressionlist = new arraylist<string>(); try{ resultset resultset=null; string sqlstring = null; statement stmt = null; if(explevel==1){ system.out.println("explevel---"+explevel+"group id --"+groupid); sqlstring ="select bool_expression lnp_eng_expressions fk_group="+groupid+" , expression_level="+explevel+""; stmt =connection.createstatement(); resultset= stmt.executequery(sqlstring); while(resultset.next()){ nextexpressionlist.add(resultset.getstring(1)); system.out.println("expression -- "+ resultset.getstring(1)); } } if(explevel > 1 ){ system.out.println("bool_ expression --"+b...

jquery - How to call a page inside a div with flash? -

i need call page inside div, flash! i have script on page: $('#bt_aoptica').click(function () { $('#my_site_content').load("aoptica.html"); $("#menu ul li a").not(this).removeclass("currentmenu"); $(this).toggleclass("currentmenu"); }); and works menu! how call actionscript 2?? ty! i think looking if not :) sorry http://codingrecipes.com/calling-a-javascript-function-from-actionscript-3-flash as2 geturl('javascript:fromflash();') js function fromflash(){ // put ur javascript/jquery instructions here }

android - Safely wipe file content -

how safely delete file content? mean data should unrecoverably wiped, if (intruder) undelete deleted file, 1 find instead of real data garbage? in practical terms, can't because have no idea kind of medium being used storage , whether blocks can reliably overwritten. true on mobile devices containing flash, has wear-leveling prolong life , isn't guaranteed overwrite same block internally when overwrite block on filesystem. make possible determined adversary gains physical control on medium recover previously-written blocks. you better off assuming data intercepted , encrypting storage. this vulnerability has nothing os , medium. shred et al depend on assumption overwriting block in file happens in place. on medium limited write cycles (e.g., flash), unsafe assumption because on-board controller reassigns logical block addresses new blocks of physical memory on writes way delay reaching write cycle limit on physical block. process transparent host. hard ...

design patterns - Singleton in C# -

i collect more variants create singleton class. please provide me best creation way in c# opinion. thanks. public sealed class singleton { singleton _instance = null; public singleton instance { { if(_instance == null) _instance = new singleton(); return _instance; } } // default private constructor can instanctiate private singleton() { } // default private static constructor private static singleton() { } } i have entire article on may find useful. oh, , try avoid using singleton pattern in general, due pain testability etc :)

c# - Redirecting unauthorized controller in ASP.NET MVC -

i have controller in asp.net mvc i've restricted admin role: [authorize(roles = "admin")] public class testcontroller : controller { ... if user not in admin role navigates controller greeted blank screen. what redirect them view says "you need in admin role able access resource." one way of doing i've thought of have check in each action method on isuserinrole() , if not in role return informational view. however, i'd have put in each action breaks dry principal , cumbersome maintain. create custom authorization attribute based on authorizeattribute , override onauthorization perform check how want done. normally, authorizeattribute set filter result httpunauthorizedresult if authorization check fails. have set viewresult (of error view) instead. edit : have couple of blog posts go more detail: http://farm-fresh-code.blogspot.com/2011/03/revisiting-custom-authorization-in.html http://farm-fresh-code.blogspot.com/2009/11/c...

iphone - How can I get any controller in UINavigationController? -

how can controller in uinavigationcontroller? can top controller using property topviewcontroller; how can example top -1 ? there property of uinavigationcontroller namely "viewcontrollers" work follows: nsarray *controllers = [navcontroller viewcontrollers]; and can access view controller returned array!

How to make an Android application use specific version of another application -

i have develop android application should access specific version of application installed on same machine. there way can handle check programmatically? android newbie. appreciated. thanks in advance, navin is there way can handle check programmatically? use packagemanager , getpackageinfo() packageinfo object specific application, identified package (e.g., com.commonsware.mygreatapp ). versioncode , versionname fields on packageinfo have information seek.

min - Finding minimum time from record and splitting it in LINQ -

we have database of swimmers times. create ranking want fastest time of each athlete. var rankings = ( r in _db.results orderby r.swimtime group r r.athleteid rg select new { athleteid = rg.key, firstname = rg.min(f2 => f2.athlete.firstname), swimtime = rg.min(f8 => f8.swimtime), hours = rg.min(f9 => f9.swimtime.hours), minutes = rg.min(f10 => ("00" + f10.swimtime.minutes.tostring()).substring(("00" + f10.swimtime.minutes.tostring()).length - 2)), // 2 digits in minutes seconds = rg.min(f11 => ("00" + f11.swimtime.seconds.tostring()).substring(("00" + f11.swimtime.seconds.tostring()).length - 2)), // 2 digits in seconds milliseconds = rg.min(f12 => (f12.swimtime.milliseconds.tostring() + "00").substring(0, 2)), // because miliseconds not filled } ); ...

css - Help with footer background image -

possible duplicate: how footer stay @ bottom of web page? the 2nd background image on page isn't positioned... i'm struggling come fix... need footer @ bottom of page, always. min-height doesn't work because need remain @ bottom regardless of resolution. is there css fix this? -url removed- sounds looking sticky footer. http://ryanfait.com/sticky-footer/ * { margin: 0; } html, body { height: 100%; } .wrapper { min-height: 100%; height: auto !important; height: 100%; margin: 0 auto -142px; /* bottom margin negative value of footer's height */ } .footer, .push { height: 142px; /* .push must same height .footer */ } /* sticky footer ryan fait http://ryanfait.com/ */

java - How to retrieve the date format for a locale -

i've been using dateformat format dates, need pass format locale jquery date widget. how can format? update : to clarify, need pattern in java can output elsewhere. e.g. in javascript might want create string date format in it: $('#datepicker').datepicker({'dateformat':'dd/mm/yy'}) you can date pattern using ((simpledateformat) dateformat.getdatetimeinstance(dateformat.long, dateformat.long, locale.uk)).topattern() or if need date ((simpledateformat) dateformat.getdateinstance(dateformat.short, locale.uk)).topattern() api: simpledateformat.topattern() , dateformat.getdatetimeinstance() , dateformat.getdateinstance() second question how convert jquery specific format pattern. java date formatting . vs jquery datepicker date formatting day of year in java d, in jquery o short year in java yy, in jquery y long year in java yyyy, in jquery yy month without leading zeros in java m, in jquery m month leading zeros in java mm...

android - Onclicklistener for a programatically created button -

i have looked answer can't seem find one. i have button has been created programmatically (rather in xml file) , want happen when clicked, show alert or move screen etc. button code: button submitbutton = new button(this); submitbutton.setid(99); submitbutton.settext("submit"); listener code: view submitbuttonlistener = findviewbyid(99); submitbuttonlistener.setonclicklistener(this); so have set listner find button error the method setonclicklistener(view.onclicklistener) in type view not applicable arguments (registerscreen) registerscreen.java /accessibleapp/src/org/project/accessible line 217 java problem i think may fact don't have setcontentview(); @ start of class because whole page written programmatically (because need add checkboxes programmatically). here code below if helps: public class registerscreen extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(sav...

Copying data from a MS Access form into Excel -

i have code takes fields ms access form , copies data saved excel file. first record in access in imported excel range of a2:i2. second record in access imported excel range of a3:i3, , on.... happens if close form in access , open up, , had 2 records imported same excel file, , want add third record, start on @ first row (a2:i2) , write on there. question how can i, if close , open access keep starting on over (a2:i2), , instead start @ next available row, follow example given (a4:i4)? code have private sub command73_click() set objxlapp = createobject("excel.application") set objxlbook = objxlapp.workbooks.open("y:\123files\edmond\hotel reservation daily.xls") objxlapp.application.visible = true objxlbook.activesheet set r = .usedrange = r.rows.count + 1 .cells(i + 1, 1).value = me.guestfirstname & " " & guestlastname .cells(i + 1, 2).value = me.phonenumber .cells(i + 1, 3).value = me.cbocheckindate .cells(i + 1, 4).value = me.cbocheckou...

java - Accessing Map attribute with dynamic key in Struts 2 OGNL -

i have list of strings attribute names , map. i'm trying access model(ex.project) in map using attribute name in string list. here have now. <s:iterator value="themap" var="element"> <tr> <s:iterator value="attributelist" var="attrname"> <td><p><s:property value="#element.project.#attrname" /></p></td> </s:iterator> </tr> </s:iterator> if hard code attribute name works fine: <td><p><s:property value="#element.project.projectname" /></p></td> any advice appreciated. using ognl <s:property value="#element.project[#attrname]" />

building - Pyquery invalidates html code -

i using pyquery construct webpage: > page = pyquery('<html><head><script type="text/javascript" src="jquery-1.4.min.js"></script><script type="text/javascript" src="tools.min.js"></script></head><body></body></html>') > print page output: <html><head><script type="text/javascript" src="jquery-1.4.min.js"/><script type="text/javascript" src="tools.min.js"/></head><body/></html> the script (and body) tags aren't supposed end though. firefox ignores rest of header. i tried breaking above single elements (ie adding 1 script tag @ time), no avail: > page = pyquery('<html><head></head></html>') > page.find('head').append('<script type="text/javascript" src="jquery-1.4.min.js"/></script>') > page...

WPF + Tasks + WCF = No SynchronizationContext? -

i have wpf application using system.threading.tasks call wcf service in background. i'm using task.continuewith return results of service call wpf ui thread. issue that, although continuation run on ui thread, when synchronizationcontext.current null. can run same code, commenting out wcf call in initial task, , continuation on ui thread, dispatchersynchronizationcontext expected. the wcf proxy generated using channelfactory, , uses wshttpbinding. there no callback contract. relevant code shown below: private taskscheduler _uischeduler; public mainwindow() { initializecomponent(); _uischeduler = taskscheduler.fromcurrentsynchronizationcontext(); } private void button_click(object sender, routedeventargs e) { var servicetask = new task<int32>(servicecallwrapper, cancellationtoken.none, taskcreationoptions.none); var continuetask = servicetask.continuewith(result => servicecont...

html - make div fill up remaining space -

i have 3 divs conatined within outer div. aligning them horizontally floating them left. , div3 float right <div id="outer"> <div id="div1">always shows</div> <div id="div2">always shows</div> <div id="div3">sometimes shows</div> </div> div1 , div3 have fixed sizes. if div3 left out want div 2 fill remaining space. how can it? what this? http://jsfiddle.net/steweb/elkqg/ css: #container{ width: 100%; float:left; overflow:hidden; /* instead of clearfix div */ } #right{ float:right; width:50px; background:yellow; } #left{ float:left; width:50px; background:red; } #remaining{ overflow: hidden; background:#dedede; } body: <div id="container"> <div id="right">div3</div> <div id="left">div1</div> <div id="remaining">div2, remaining</div...

java - JSF: AJAX Testing best practices -

we have jsf 2.0 project heavy use of ajax (provided openfaces tag library). our project cool , many useful things, , love it. there 1 thing frustrates - our project doesn't have integration tests. @ all. has selenium tests of course, cover project user's perspective. i'd love have integration tests deal ajax-related logic. i'm not sure how achieve this... things capturing mind jsfunit , httpunit, wonder if there better ajax-based jsf project. have concerns this? thanks! you try fireunit or firebugtest. haven't tried either of these might work. have wished feature too.

standards - Free tools to check compliance with MISRA C? -

are there open-source or free tools out there, check misra c compliance? relatively speaking, pc-lint virtually free when compared full-blown static analysis tools misra compliance checks. furthermore, have found pc-lint better job of reporting expensive (i.e. >$20,000) tools.

PHP cURL with SS validation -

i have working curl scripts have been relying on remote server ss validation. want add validation our curl scripts if aren't filled out correctly request won't sent. have client side js validation, want duplicate ss validation. here example of curl script: <?php $url = 'https://remoteserver.com/post.svc/foo'; $field1 = $_post["field1"]; //other input data $fields = array( 'field1'=>urlencode($field1), //other input data ); foreach($fields $key=>$value) { $fields_string .= $key.'='.$value.'&'; } $fields_string = rtrim($fields_string,'& '); $ch = curl_init($url); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $fields_string); curl_setopt($ch, curlopt_ssl_verifyhost, 0); curl_setopt($ch, curlopt_ssl_verifypeer, 0); curl_setopt($ch, curlopt_returntransfer, 1); $output = curl_exec($ch); echo $output; curl_close($ch); ?> can create if/else...

c# - Which approach to use on a provider with entity framework? -

i have class: public class tool { [edmscalarpropertyattribute(entitykeyproperty=true, isnullable=false)] [datamemberattribute()] public int64 id { get; set; } [edmscalarpropertyattribute(entitykeyproperty=false, isnullable=false)] [datamemberattribute()] public string name { get; set; } } my provider has 2 methods: public ienumerable<tool> getfirst() { using (var db = new entitites()) { return db.tools.firstordefault(); } } public void update(tool o) { using (var db = new entities()) { db.tools.savechanges(); } } it doesn't work because on different contexts, parameter on update method not being used. can object database , change fields 1 one parameter object save changes. what should do? update object , save? keep 1 context on providers? another approach? i found attach method another question , quite similar using (var db = new entitites()) { // attach object on context ...

web services - number of servers running app in cluster -

i have web service app running in cluster on weblogic 10.3. can tell me if there way programmatically determine number of servers in cluster have app , running? any appreciated. thanks! respectfully, kal i think best best use wlst scripting connect each of running servers in cluster , see within list of deployed (or running) apps if yours present there commands - @ list below http://download.oracle.com/docs/cd/e13222_01/wls/docs90/config_scripting/reference.html#1024213

cocoa - How to create a burn folder? -

my app needs both burn discs , create burn folders. i'm able use discrecording framework, , delving many options burn disc methods, , starting that, don't see reference creating 'burn folder'. i've looked in nsfilemanager (thinking key needs set), , searched docs , site 'burn folder', no result. it's overlooking obvious how programmatically. will shed light here? thanks. just create directory extension of .fpbf .

Xcode won't start after first launch? -

i installed xcode , after closing out of first launch (because realized had more configuring do). cannot re-launch. icon come up, no program show up. not error, , launching /developer folder (not /applications). have tried re-installing/restarting multiple times no avail. have latest version, , running snow leopard (10.6.6). the icon come up, no program show up. are new os x? sounds describing way os x apps start up. default, xcode pops window list of recent projects, can switch off. doesn't mean xcode isn't running, means don't have xcode windows open. can still select of usual menu items start new projects, open existing projects, etc.

python - Tix ComboBox causes python2.7 to crash -

i've been using tix create combobox , causes intermittent crash if entry box left empty. i'm new python , new gui programming i've been using example teach myself stuff. when using following example code, should able enter value entry box or select form dropdown menu, if leave entry field empty , press go cause python crash. import tix import tkmessagebox class app(object): def __init__(self, window): window.winfo_toplevel().wm_title("test") self.window = window self.combo = tix.combobox(window) self.combo.insert(tix.end, 'thing1') self.combo.insert(tix.end, 'thing2') self.combo.entry['state'] = "normal" self.combo['editable'] = true self.combo.pack() button = tix.button(window) button['text'] = "go" button['command'] = self.go button.pack() def go(self): tkmessagebox.show...

How to write CUDA global function for this? -

i want convert following function cuda. void fun() { for(i = 0; < terraingridlength; i++) { for(j = 0; j < terraingridwidth; j++) { //code of function } } } i wrote function : __global__ void fun() { int = blockidx.x * blockdim.x + threadidx.x; int j = blockidx.y * blockdim.y + threadidx.y; if((i < terraingridlength)&&(j<terraingridwidth)) { //code of function } } i declared both terraingridlength , terraingridwidth constants , assigned value 120 both. , calling function like fun<<<30,500>>>() but not getting correct output. is code wrote correct?.i didn't understood parellel execution of code.please explain me how code work , correct me if done mistakes. you use y dimension means using 2d array threads, cannot invoke kernel only: int numblock = 30; int numthreadsperblock = 500; fun<<<numblock,numthreadsperblock>>>() t...