Posts

Showing posts from 2011

android - Write a private access file to another app's files directory -

the 2 apps have same shareduserid. when use code in app1 context.openfileoutput("/data/data/org.me.app2/files/shared-data.dat", mode_private) i exception telling me file contains path separator. i trying write file app1 app2's storage. (i of course need make sure app2's files directory exists first) ideally, write user specific directory instead of app specific directory, not know if can done first of all, never use full path internal storage /data/data . let operating system give path (for example, via context.getfilesdir() or environment.getexternalstoragestate() ). don't make assumption on data is. secondly - doing that! unlike file , context.openfileoutput prepends /data/data/[package] path, don't need specify that. specify file name. if feel it's safe , necessary, , if both apps share same user id using android:shareduserid in manifest, can context of other app using context.createpackagecontext() , use context_restricted,

model - Find() one of each matching field CakePHP -

trips hasmany legs airports has no associations how can find cheapest trip each destination airport using cakephp? right now, thing can think of foreach through array of airports. require hundreds of queries database (which think not fastest way of doing it). function getcheapesttrip($origin){ $airports=$this->airport->getairports(); foreach($airports $airport): $cheapest_flights=$this->trip->find('first', array( 'conditions'=>array('leg.origin'=>$origin, 'min(trip.price) price'), 'fields'=>array('trip.origin','price','leg.destination','leg.depart','leg.arrive'), 'recursive'=>2, )); endforeach; } } also, think data type stuff should in model per cakephp conventions (fat models, skinny controllers). read call different model's function such getairports can use loadmodel found in cakephp's controller method section. how should 1 model's data/m

c++ - Make QListWidget only show 1 item -

i have created class inherits qlistwidget , meant stack of cards. i have overloaded drag , drop functions allow card dragged table (another object of program) , stumble on problem. the qlistwidget shows items (mainly because add them gui beginning). so how goes: in mainwindow initialise cardpile object , fill shuffled vector of cards. now want qlistwidget show 1 (but showing grid cards). on drop remove item qlistwidget. have no idea if add , remove 1 card @ time (so shows 1 card ofcourse) in code. public: tilestack(qwidget *parent = 0); void addcard(qpixmap pixmap, qpoint location); qpixmap showcard(); protected: void dragenterevent(qdragenterevent *event); void dragmoveevent(qdragmoveevent *event); void startdrag(qt::dropactions supportedactions); //in function remove current item these functions in cardpile : qlistwidget. so: void tilestack::startdrag(qt::dropactions /*supportedactions*/) { qlistwidgetitem *item = currentitem();

ReSharper - code style sharing documentation -

Image
in resharper options menu under formatting style, displays code looks after formatting. these stored anywhere? i'm planning publish style settings shared location other developers on team can import settings. have document out there people can view before importing settings see code after formatting. is there online documentation somewhere shows defaults? or rather there way export (or parse if these snippets stored somewhere on disk) can format displayed without having go through each setting individually , copy/paste? you can use r# code style sharing this: anyhow don't know document shows r# defaults or tool map current settings code snippet or template. hope helps.

javascript - Simple form validation -

post #1 how can validate simple form (checking empty field strings)? <p>please select gift certificate amount below. please enter name , gift certificate recipient's name. once click 'buy now' sent our paypal site complete purchase.</p> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="sdsafsdafsadfdsafsdafsadfsadfsadfasdfsadfsdaf"> <table width="100%"> <tr> <td width="130"><input type="hidden" name="on0" value="amount"><p>amount</p></td> <td><select name="os0"> <option value="option 1">$20.00</option>

Git clone issue; fatal: index-pack failed -

so have weird issue. im hosting project on @ git repository, have local box (mac os x) , remote production box (linux). cloning git repository (which being hosted codebasehq) local machine works great, no issues. cloning remote box makes fail index-pack failed err. it worked in beginning project has grown issues has become more , more frequent , have revert getting tar archive of repository seeing git clone fails on remote machine while still succeeding on local machine. all pack utilities in path, have run git gc multiple times , pushed, still same issue. ideas? edit so im accessing repos ssh , there no other error message paste underneath. :( still have same issue, annoying. receiving objects: 100% (9830/9830), 51.14 mib | 1940 kib/s, done. fatal: index-pack failed1/2570)

asp.net - Cannot read ASP localhost, plus problems with virtual directories -

Image
when going http://localhost/ on personal machine, blank screen. i have site @ c:/inetpub/wwwroot/ contents of folder aren't listed should be. i tried going directly site, , got error: line 16 error 15: <sectiongroup name="scripting" type="system.web.configuration.scriptingsectiongroup, system.web.extensions, version=3.5.0.0, culture=neutral, publickeytoken=31bf3856ad364e35"> 16: <section name="scriptresourcehandler" type="system.web.configuration.scriptingscriptresourcehandlersection, system.web.extensions, version=3.5.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" requirepermission="false" allowdefinition="machinetoapplication"/> 17: <sectiongroup name="webservices" type="system.web.configuration.scriptingwebservicessectiongroup, system.web.extensions, version=3.5.0.0, culture=neutral, publickeytoken=31bf3856ad364e35"> removing line web.

php - mysql query search record in BETWEEN and list if exits or not -

hi trying make query run records table , between tow years working fine need list values search between query select sum(price) orders year between 2004 , 2009 group year 2005 | 200 2006 | 100 2008 | 400 trying show 2005 | 200 2006 | 100 2007 | 0 2008 | 400 2009 | 0 -- ---------------------------- -- table structure `orders` -- ---------------------------- drop table if exists `orders`; create table `orders` ( `id` int(11) not null auto_increment, `price` decimal(10,0) default null, `year` int(11) default null, primary key (`id`) ) engine=myisam auto_increment=4 default charset=latin1; -- ---------------------------- -- records of orders -- ---------------------------- insert orders values ('1', '200', '2005'); insert orders values ('2', '100', '2006'); insert orders values ('3', '400', '2008'); or need in php loop or somthing suggestions you need auxiliary tables of numbers

php - CSRF protection with Symfony -

i'm unable find symfony documentation activate csrf protection in existent forms (with no protection). i've set csrf_protection token , on, forms failing , guess needed work correctly. check that: there's entry in settings.yml the csrf token rendered form in template csrf token not disabled inside form class (or parents) ... should work.

CSS cascading rules for html controls -

why css rules not cascade down automatically html controls input or select , style display of text in them? for ex: have css class applied on body tag renders text in red. due cascading rules, text in html document rendered in red (unless overridden). if have textbox control in document, style not cascade textbox render text in in red. could point me reference document talks that?? the reason default css styles determined browser. input , select have default colors/sizes/padding etc. most other elements use inherit color , size. another example font-size of table fixed , not inherited default, , must overridden developer. try example html: <html> <style type="text/css"> body { color:red; font-size:36px; } </style> <body> hello <input type="text" value="test value"/> <table><tr><td>cell value</td></tr></table> </body> </html> you see font-size ,

odbc - what is the best way to export data from Filemaker Pro 6 to Sql Server? -

i'm migrating/consolidating multiple fmp6 databases single c# application backed sql server 2008. problem have how export data real database (sql server) can work on data quality , normalisation. significant, there number of repeating fields need normalised child tables. as see there few different options, of involve either connecting to fmp on odbc , using intermediate copy data across (either custom code or ms acess linked tables), or, exporting flat file format (csv no header or xml) , either use excel generate insert statements or write custom code load file. i'm leaning towards writing custom code migration (like this article does, in c# instead of perl) on odbc, i'm concerned overhead of writing migrator used once (as new system existing db's archived)... a few little joyful caveats: in version of fmp there's 1 table per file, , single column may have multi-value attributes, separated hex 1d, ascii group separator, of course! does have experience

html - Using an image to submit a search form -

i have done lot of times have problem, i'm trying google form, google name have slashes not working on browsers, there different way this? any clue :d code: <form action="http://www.webpage.com/search.php" id="cse-search-box" name="cse-search-box"> <div> <input type="hidden" name="cx" value="partner-pub-number" /> <input type="hidden" name="cof" value="forid:number" /> <input type="hidden" name="ie" value="iso-8859-1" /> <input type="text" name="q" size="31" class="form-search" /> <a name="sa" id="sa" href="javascript:document.cse-search-box.submit();"><img src="images/arrow.jpg" class="img-search"/></a> </div> </

jQuery if else and selected value from select tag -

why can't value selected input, doing wrong? if($('#target option:selected').text() == "add") $("#add").show(selectedeffect, options, 500, callback ); else if ($('#target option:selected').text() == "exit") $("#exit").show(selectedeffect, options, 500, callback ); else if ($('#target option:selected').text() == "refuse") $("#refuse").show(selectedeffect, options, 500, callback ); else alert('test'); var target = $('#target option:selected').val(); if(target == "add") $("#add").show(selectedeffect, options, 500, callback ); else if ($('#target option:selected').text() == "exit") $("#exit").show(selectedeffect, options, 500, callback ); else if ($('#target option:selected').te

WCF restful returning JSON by using Entity Framework Complex -

recently have set wcf restful service ef4. worked out when returning xml format response. when comes json, got 504 error. unable return json data, wcf resful service .net 4.0 by digging deeper using service trace viewer: found error: 'the type 'xxx.dataentity.appview' cannot serialized json because isreference setting 'true'. json format not support references because there no standardized format representing references. enable serialization, disable isreference setting on type or appropriate parent class of type.' the "appview" complex object class generated ef4 store procedure. spend quite bit time google how disable isreference, little result far. anyone? solutions? thanks in advance code: [operationcontract] [webinvoke(method = "get", bodystyle = webmessagebodystyle.wrapped, uritemplate = "app/{id}/{format}")] appview funcdetail(string id, string for

php - Logic behind counting the views of a page -

i m trying created code page in no. of views needed shown in bottom of page. i don't know logic behind counting views. let's views on home page of stackoverflow. way display. , logic same. (it'll done via php-mysql) please in advance set function select if ip address in table track hits, if don't add 1 count, otherwise add 1 count ip future tracking.

objective c - How to make an iPhone dropdown-looking button -

Image
i've seen dropdown-like button on many apps, including turf wars, simulates dropdown picker. need use same functionality in app, i'm not sure best way go may be. example: i figured make 2 images , set them uibuttons background image different states , have button open pickerview. any input appreciated. rod you can use button image dropdown image. , can place picker on button hidden. in click event show picker. , after selection on picker have update text value of button , hide picker again. hope helps you...

android some files use or override a deprecated api -

when compile android2.1 source,it give me attention:android files use or override deprecated api,please use - xlink: deprecation recompiled. can tell me why give information,it have negative effect ? it not have negative effect or worry about. it's because android sourcecode (in java) written compatibility older jdk versions (like 1.4, 1.5). , in recent versions of old apis had been deprecated.

kSOAP 2 Android -

i don't know why not able this?....maybe missing or plain dumb i want trying call webservice android app now came across ksoap 2 android library needed however, see many guys in many posts pointing 1 have include jar ksoap2 android platform in eclipse but jar include ? at "http://code.google.com/p/ksoap2-android/" see link git source entire source there.....so take files needed , make jar out of it. also see many guys saying include jar file ending "-dependencies"....however, downloading such file seems issue....i don't file correct size. so, jar file include in eclipse calling webservices w.r.t. ksoap 2 ? thanks yogurt you want include file: ksoap2-android-assembly-2.5.2-jar-with-dependencies.jar' file 142 kb, or 145,350 bytes. don't need make jar directly, can downloaded here . also, video here you'll fine quite helpful.

XSLT, XPath unique child nodes only problem where non unique nodes are not selected at all -

<root> <parent> <child> <name>john</name> </child> <child> <name>ben</name> </child> </parent> <parent> <child> <name>john</name> </child> <child> <name>mark</name> </child> <child> <name>luke</name> </child> </parent> </root> i want unique child nodes i.e. 1 child node if there more 1 same name. such as: john ben mark luke i have tried: <xsl:for-each select="parent"> <xsl:for-each select="child[name != preceding::name]"> <xsl:value-of select="name"/> </xsl:for-each> </xsl:for-each> but get: ben mark luke ?! your problem using != operator comparison between value , node-set . this wrong -- avoid using != operator , use not() function , = operator when 1 of

eclipse - ClassNotFoundException with URLClassLoader in classes.jar (java.net package) -

Image
on eclipse galileo, got following classnotfoundexception when doing debug as/web application. works fine when doing run as/web application. i given message "the source attachment not contain source file urlclassloader.class. can change source attachment clicking change attached source below:" in project window, seems urlclassloader class java.net package, /system/library/frameworks/javavm.framework/versions/1.6.0/classes/classes.jar. i found jar on machine, else missing? why it's debug issue? could possible jre system library have on imac 10.6.5 machine outdated? or somehow install/unstall of jar/package caused issue? this have - jre system library [jvm 1.6.0 (macos x default)] - update fixing issue? how updated? please help! com.google.appengine.tools.development.devappservermain @ localhost:57873 thread [main] (suspended (exception classnotfoundexception)) launcher$extclassloader(urlclassloader).findclass(string) line: 207 launcher$extclassload

objective c - Store & retrieve data from cache in Iphone -

i have app in want store pages (in webview) navigated once in cache(iphone). so if same page accessed again should come cache & not server. if new page accessed come server. any help/tutorial/suggestion(with sample code) please. the behavior you're looking happens default, assuming cache headers set correctly on server side. then, though, size of cache quite limited. you can take @ this post on creating custom cache uiwebview . isn't you're looking for, give need create own cache works regardless of cache headers server say, , more generous size.

.htaccess - Help with variables in htaccess redirects -

i want this, redirect: http:// anysubdomain(wildcard) .mydomain.com/ to anysubdomain(wildcard) .mydomain.com/page2.php i tried this: rewritecond %{http_host} ^(.*)\.mydomain.com$ [or] rewriterule ^/?$ "http\:\/\/$1\.mydomain\.com\/page2\.php" [r=301,l] but not work, rewritecond part works well, because, subdomain redirected. but reaches: " .mydomain.com/page2.php" can me? thanks! there's few things wrong rewrite: the [or] making apply everything you don't need escape many chars on rule. need pass through hostname variable using %1 it'll create infinite loop, it'll try redirecting page2.php itself. this should it: rewritecond %{request_filename} !.*page2.php$ rewritecond %{http_host} ^(.*)\.mydomain.com$ rewriterule ^(.*)$ http://%1.mydomain.com/page2.php [r=301,l]

iphone - destroy a view when back button is pressed -

my navigation controller organized way: firstviewcontroller -> secondviewcontroller -> thirdviewcontroller in first search on web , display result in uitableview when select cell push second search based on key pressed , display information , button "more info" when press button push third view , works fine... the problem when press 2 times button doing search: when arrive @ third view display every time informations first search! this because display of information in loadview , called first time, right? how should do? thank you! indeed viewdidshow called after view has been loaded , created nib file . means should use method initialization stuff. add new method , call everytime have new results: - (void) updateandshowresults { // code update third view goes here // , called whenever new results available } you'd call first or second view controller this: [thirdview updateandshowresults]; hope helps. please mark best answ

jQuery eased animation -

i've codes as <div id="container"> <div id="one"></div> <div id="two"></div> <div id="three"></div> <div id="four"></div> </div> each div has width of 250px & floated left; when click button, i'm using hide('one'); when div#one disappears, remaining 3 divs takes it's empty place , happens of sudden. want is, when div#one disappears, want remaining 3 divs slide left slowly.. in eased manner. how should that. if give duration .hide() you're set, it'll animation, this: $("#one").hide("slow"); you can test here . note: works or without jquery ui, it's part of jquery core

c# - Store and search directory tree in memory efficiently -

i want store directories on huge drive efficiently in memory possible , able retrieve directory given it's full path. each directory has fields it's name (not it's full path) , pointer it's parent , list of subdirectories. way think way go is? as see there's couple of ways: a) store full paths each directory in dictionary , simple lookup. pros: fast, cons: each full path string takes uneccessary , redundant amount of memory b) store actual directory name in dictionary list of directories name, check matches if it's correct: pros: pretty fast, cons: has either store list each directory or use boxing store either list or directory in dictionary. c) skip dictionary, traverse tree root , find match splitting path. perhaps use plinq speed things up. pros: no memory overhead dictionary, cons: potentially slower lookup. d) other way haven't thought of... if store subdirectories dictionary rather list (and cases want subdirectories, that'

wpf - Binding brush color to properties in ControlTemplate -

i trying make customcontrol derives button, shows colored rectangle. want have 2 properties on control can set, specify normal color (coldcolor), , color used when mouse on control (hotcolor). i can't figure out how binding set between brush color , control properties. code: generic.xaml: <style targettype="{x:type local:testcustomcontrol}"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type local:testcustomcontrol}"> <border borderbrush="{templatebinding borderbrush}" borderthickness="{templatebinding borderthickness}" name="myborder"> <border.background> <!-- works: --> <!--<solidcolorbrush color="green" />--> <!-- doesn't work: -->

ios4 - How to display strings in Xcode debugger? -

i used able see nsstring values in debugger, without problem. since updating 3.2.5 see format string {(char *)xcode_cfstringsummary($var, $id)}:s i can't see wrong that. can please tell me correct formatter should be? i'm having same problem , haven't found solution. @ least did figure out can still view strings right clicking on string variable , selecting "print description console".

ruby on rails - Run initializer only for Rake tasks -

i'd initializer run when executing rake task, not when running rails server. what best way differentiate rake invocation , server invocation? rake allows specify dependencies tasks. best recommended action put rake-specific initialization in own task in turn depends on "environment" task. example: namespace :myapp task :custom_environment => :environment # special initialization stuff here # or call initializer script end task :my_task => :custom_environment # perform actions need custom setup end end if want make rake-specific directory of initializer scripts have rails proper, implement in our :custom_environment task. task :custom_environment => :environment dir.glob("config/rake-initializers/*.rb").each |initializer| require initializer end end this allows keep rake-specific intializers separate regular initializers. have remember depend on :custom_environment set u

.net - Design Patterns with C# -

i planning learn c# on job - moderately complex (2000 lines of code) project. interested in picking "design patterns" along way. can suggest book doesn't assume of c# expertise , teaches design patterns? it's ok if book not devoted design patterns (it 1 of chapters). an excellent book head first design patterns . easy understand , follow , fun read. the gof book started, found dry , difficult grasp. not recommend learning. examples in java, concepts translate well. you can c# examples .

mysql - How to do a count query that groups by distinct product -

ok have query select * configure_system estimateid='edb95py0z2' , stepid=1 which return following 8 rows...i need query returns distinct productid , total price , quantity of them ...so example i want this productid productprice totalprice quantity 2 575 1175 2 3 839 1678 2 9 1349 4047 3 12 1699 1699 2 i tried using distinct query , count have not been successful select productid , productprice , count(*) * productprice totalprice, count(*) quantity configure_system estimateid='edb95py0z2' , stepid =1 group productid, productprice

jquery - Show message on page after editing from jeditable plugin -

i working in mvc , using jquery.jeditable plugin.the editing working fine in grid.when update content in grid & click on enter edit post controller cllass called & returns string updated text. i want show message somewhere else on page after update done. [httppost]public string edit(formcollection collection) {..... // show success message on page other grid column ... return <updated column value>; } if talking showing message after ajax call, show ;) problem? // variant 1: alert(response); // variant 2: $.growlui("server response", response); // using blockui plugin // or other popup div information ajax http request if return more 1 value, return them json-object, this: return "{ updatedcolumnvalue: " + value + ", msgtext: '" + msgtext.replace("'", @"\'") + "' }"; if want show after postback, make usercontrol visible message diplayed.

java - How to make a filter to detect if the user requested a page that is not found? -

i want create filter in app such before each request, detects whether requested page exists. if doesn't exist, forward user error page. how detect page exists? i need solution filter , not using web.xml tag method. if don't have authentication, can. make filter use httpservletresponsewrapper , override senderror() , setstatus() pass wrapped response through chain.dofilter(req, wrapper) if senderror() in wrapper, see if it's 404. take appropriate response. you may have override getoutputstream() , getwriter() avoid response flushed client before chance stuff.

Conditional CSS (if div present, set top = x, else, set top = y) -

i have relatively positioned div (call "marker") in markup influences top "y" position of sibling's absolutely positioned child div (call "subject"). the marker div may or may not present in markup. how can write css sibling child div it's top position increased 100px when marker div present in markup. here's markup when marker div present... <div class="wrapper"> <div class="marker"></div> <div class="content"></div> <div class="sidebar"> <div class="subject"></div> </div> </div> the "subject" div 1 need conditional height defined in css. here's markup when marker div not present... <div class="wrapper"> <div class="content"></div> <div class="sidebar"> <div class="subject"></div> </

html - Difficulties in styling CSS form -

with controversy surrounding tables layout option forms, i've decided go unordered list. have labels , elements displaying intend, 'note' div i've added refuses line inputs above it. i've included code below, please excuse garish background colours i've chosen me judge placement! have suggestions why 'note' div refuses play along? i'm sure there's simple solution i'm stumped. thank in advance. form.contact label { float: left; position: absolute; background: red; } form.contact input { width: 200px; margin-left: 15em; } form.contact .note { margin-left: 15em; width: 176px; background: yellow; } form.contact ul { list-style: none; position: absolute; padding: 0; } form.contact ul li { float: left; clear: left; width: 100%; padding-bottom: 1em; margin-bottom: 10px; background: pink; left: 0; } <ul> <li> <label for=&q

c# - Enter "&" symbol into a text Label in Windows Forms? -

how 1 enter special characters label in c# (windows forms)? if try write "&" label you'll sort of underscore instead.. so what's c# equivalent of "&"? ("\&" doesn't work). two ways: escape ampersand ( && ). set usemnemonic label false . causes ampersands within text taken literally don't need double of them. you'll lose underlining , access key features though. you can set value either in designer, or in code: mylabel.usemnemonic = false; mylabel.text = "text&text";

Stop a jQuery content slider when playing a YouTube video -

i trying create jquery content slider stop when youtube video played , resume when video stopped. similar slider on taprootfoundation.org . player.getplayerstate() in youtube javascript api returns status of player. video has not started should return value of -1. my script below uses return false; stop slideshow if getplayerstate() returns value other -1. taking bottom block in code below (followed //detect playing youtube video) out, works fine, "return false;" firing regardless of getplayerstate() value. i used swfobject embed player, recommended in youtube javascript api. here's screenshot showing html of embedded player . i must calling .getplayerstate() incorrectly, i'm not sure how correct it. $(document).ready(function(){ //initial setup //adds class "last" last link-tab item $('.link-tab:last').addclass('last'); //moves summary elements down out of view $('.rotate-image > div').children(

db2 - Foreign keys in tables -

when create foreign key in table become duplicate index? in db2 z/os, if create table foreign key, not have define index on underlying column. an index not defined automatically when create table. if want one, can create 1 separately (via create index statement). think common define index includes foreign key column(s), not requirement. depends on how application accesses data. for overview on db2 keys, check out: http://publib.boulder.ibm.com/infocenter/zos/basics/index.jsp?topic=/com.ibm.db2z.doc.intro/db2z_keys.html .

java - Simple if statement problem -

i trying return tostring if true. i have code: public void printoutsailings() { (sailing s:sailings) { string hamburg = ("hamburg"); if ((s.getdepartureport()) == hamburg) { system.out.println(s.tostringadjusted()); } } } however nothing when run method (when should getting something). assume have somehow messed logic or not understood =,== , eq properly, i'm not sure. there nothing wrong tostring or loop, , i'm not getting compiler or run time errors. it's logic wrong. if put me right that'd appreciated. thanks. you should using .equals() instead of == check string equality. try following: if ((s.getdepartureport()).equals(hamburg)) { system.out.println(s.tostringadjusted()); } in short, == checks see if 2 strings exact same reference, , .equals() checks see if 2 strings same. it should said need use .equals() checking equality of object type, not strings. primitive types

java - chunking XML and loading it into relational tables -

i work credit union (roughly 60k accounts). statement process '70s , tightly coupled data layout. in short, run job , produces text file contains statement each account. i've modified mainframe config , instead of getting text out, xml so: <statements> <statement account='1'> ...statement info checking/savings/certificate/visa/loan/heloc shares </statement> <statement account='n'> ...statement info checking/savings/certificate/visa/loan/heloc shares </statement> </statements> i wrote java code pull data relational table(s) , build pdfs on fly itext. of data shows on statement calculated data in xml. instance, xml contains transactions on share. on statement, want show number of credits , number of debits. once loaded db, can use view calculate these values on fly , provide data java app. this xml file ~900mb , going grow add more members. i want process xml 1 "statement&quo

android - Starting an Activity and delaying its transition -

i have 2 activities : - activity gathering data internet (it takes time) - activity b building ui elements based on data received (it takes time too) when activity start downloading, app enter loading phase. when it's complete, activity b starts, have transition between views of & b. b requires loading phase. i have loading - transition - loading - result doesn't nice @ all. i have loading - transition - result loadings of both activities grouped. so question : there way start activity delay transition ? i don't think going right way this. suggest having 1 activity loader. use asynctask load data in different thread. update ui data gets loaded , when done remove loader. should use multiple threads work takes time because otherwise ui freeze. looking @ said above, don't see why need 2 activities.

Targeting a specific Wordpress widget form with jQuery -

i'm developing new wordpress widget. configuration form in widgets admin panel includes category , subcategory dropdowns (these not wordpress categories). the values these dropdowns need retrieved via ajax, plus changing category dropdown should load new values subcategory dropdown via ajax. so, need use jquery target current dropdowns, , set handler change event. how can right jquery selector in wordpress achieve this? user may add several of these widgets sidebar, can't use generic id or css class. or there more reasonable way code this, maybe using wp_localize_script? there has unique factor amongst category dropdowns (since making selection there load options within subcategory). i use data() method attach unique identifier (whether id, or whatever) each of these pulldowns, attaching class each of pulldowns (mywidgetname-category, or whatever). then iterate on each of elements matches class, attaching change() event handler reads unique identifier attac

Ipad Test simulator -

i have develop application html5 ipad, cannot find simulator test, please me, can simulator or download?it's urgent please. yes, can download ios sdk ios dev center , contain iphone simulator note you need snow leopard (mac os x 10.6+) ipad support. leopard's ios sdk not have ipad support. (if do have snow leopard select "device" top menu , select ipad see ipad simulator) there are options out there if on windows or don't have snow leopard these testing html5 in browser rather compiled app. bbdemo2 - adobe air app (so uses webkit, same safari & iphone/ipad) ipad peek - web based browser simulate dimensions (for best results maybe try using safari)

Membase Client - ContainsKey? -

does know how check if key exists using membase client (enyim)? dont want pull entire object cache, check if in there. unfortunately there no "exists" operation in memcached, there hacks can do: do client.store(storemode.add, keytocheck, null, new date(2000, 1, 1)); add fails if item exists, , return false in case. you can client.append(keytocheck, new arraysegment<byte>(new byte[0])) return true if key exists, value not change. or client.cas(storemode.set, keytocheck, null, uint64.maxvalue) fail if item exists. please keep in mind 3 operations will create item if key not exist, need clean after them. also, if multiple threads checking same item, it's possible 1 thread treat threads temp item real one.

algorithm - Complexity for recursive functions - Time and Space -

i interested in knowing how calculate time , space complexity of recursive functions permutation, fibonacci(described here ) in general can have recursion @ many places @ permutaion or recursion, looking approach followed calculate tmie ans space complexity thank you take @ http://www.cs.duke.edu/~ola/ap/recurrence.html

java - how to add items to a list box from another class in netbeans -

i add elements list box on jframe, different class doesn't seem work no matter try... not error or feedback on whats wrong this... heres layout have, listbox using defaultlistmodel lm2 i know how add elements jlist in jframe class, reason unable add elments class when adding inside jframe class: public void log(string str) { lm2.addelement(str); } and on "other class" frmmain doit = new frmmain(); doit.log("add list box"); # more details add- --- > # i have 3 classes , here are: frmmain.class // jframe class builds jframe (from jframe template) public class frmmain extends javax.swing.jframe { /** creates new form frmmain */ public frmmain() { initcomponents(); } public void log(string str) { lm2.addelement(str); } public defaultlistmodel lm2 = new defaultlistmodel(); } requestinfo.class // requestinfo.class, trying add item /

WPF Binding and Validation -

i have issue validation in wpf can't seem resolve. have class (that implements idataerrorinfo) uses property like-so. private double? _sizesearchvalue; public double? sizesearchvalue { { return _sizesearchvalue; } set { _sizesearchvalue = value; notifychange("sizesearchvalue"); validateinputrow("sizesearchvalue"); } } it bound textbox in xaml this. <stackpanel orientation="horizontal"> <textblock verticalalignment="center" text="size:"/> <combobox text="{binding sizesearchoption, validatesondataerrors=true}"/> <textbox text="{binding sizesearchvalue, validatesondataerrors=true, updatesourcetrigger=propertychanged, validatesonexceptions=false}"/> </stackpanel> the validateinputrow() function in property setter go through , run custom validation routines , set errors appropriately combobox , textbox in stackpanel men

SQL Server 2008 Full Text Search - indexing is VERY SLOW -

i'm experimenting full text search. have 50 million row table xml field, , set full text search on it. it's 2 days later now, , indexing still ongoing. looks it's not hung, , continuing index, very, slowly. based on fact when query table, more results time. also, looking @ full text index properties (right-click on table in sql server management studio) full text docs processed continues go up is normal, indxing slow? @ speed, it's not usable. see no errors in full text search log file. looking @ log file more - see apparently when created half million row table , put full text index on that, took 1 hour index. so, extrapolating that, take 100 hours index table. how can speed up? thanks input! sylvia with 50 million rows, reaching scale sql servers have other overhead , better existing text search engine uses inverted indexes. there various flavors of sharepoint search little money, or use open source search engine , move on there.

javascript - Can I disable Chrome/Webkit parallel CSS & JS download feature? -

i'm experiencing documented bug webkit browsers render page incorrectly on first load because javascript executing before css has finished downloading (due them being downloaded in parallel). while quick refresh fixes of page, solution inadequate problem (i run command-line utilities take screenshots of our pages, these utilities don't have option "refresh" page before taking screenshot) does have suggestions or solutions ensuring css-include loaded in it's entirety before javascript-include , inline-javascript executed? thanks! -dan edit -- not using library. 'ol javascript. if using library think of them allow this. it's easy jquery, if not can use <script defer="(x number of second)">function()</script> @ end of hte page. may consider moving javascripts bottom of page possible. js best practices.

functional programming - Influence of KRC and SASL on Haskell? -

while learning haskell took side road (so speak) in researching kent recursive calculator , sasl functional languages. struck similarities between them , haskell , since predate wonder if/how provided influence. any information regarding influence (or lack thereof) of krc , sasl on haskell appreciated. the connection you're looking here david turner , largely responsible sasl , krc, involved miranda , non-strict, purely functional language. miranda relatively popular in time, proprietary language; open standard alternative miranda major motivation creation of haskell. for further details, see a history of haskell: being lazy class , hudak, hughes, spj, , wadler, mentions turner's work other influences on haskell.

php - sign in via facebook account (in codeigniter) -

i have simple website calculates grades of college students. there different subjects each department. each department has 42 subjects. thinking of providing username/password authentication users don't have input grades each subject every time. not want users register on site filling sign form. want them log in via face book account. thinking can't figure out how can this. have developed site in codeigniter. i looked same solution, here blog post it: http://blog.biernacki.ca/2010/11/a3m-a-codeigniter-account-authentication-authorization-module-installation/ a3m codeigniter pretty @ doing want, plus offers other openid providers (other facebook)

c# - How does one dynamically add a new datalist or a row to a gridview? -

to able dynamically add new datalist or row gridview when placed in foreach loop example have sql query outputs values each time id number in list, need way output them… so create new datalist or row each 1 created?? or there way achieve this first filter list, assign gridview datasource: mygridview.datasource = yourlist.where(i => i.theid == 123); mygridview.databind(); that automatically create row each list item.

mysql - PHP 2 people logging in at the same time from the same computer pt.02 -

does alright login script //player 1 login username , password $p1name = $_post['p1name']; $p1pass = $_post['p1pass']; //player 2 login username , password $p2name = $_post['p2name']; $p2pass = $_post['p2pass']; $connection = mysql_connect("db_host", "db_user", "db_pass"); mysql_select_db("db_name", $connection); get_user($p1name, $p1pass); get_user($p2name, $p2pass); $row = $result; $found = false; if(($row["username"] == $p1name && $row["password"] == sha1("$p1pass")) && ($row["username"] == $p2name && $row["password"] == sha1("$p2pass"))) { $found = true; break; } function get_user($username, $password) { $query = 'select * users'; $query .= ' username = ' . mysql_real_escape_string($username); $query .= ' , password = ' . mysql_real_escape_string(sha1($password)); $res

ant - Get list of files from URL -

i'll automate somehow keeping netbeans daily build what's available. basically follows: get file list http://bits.netbeans.org/download/trunk/nightly/latest/zip/ download file (let's i'm interested in java.zip) unzip i have ant script capable of doing 2 , 3. need figure out how first. see below: <?xml version="1.0" encoding="utf-8"?> <project name="netbeans daily build" basedir="."> <description>updates daily build</description> <property name="zip.name" value="netbeans-6.9.1-201007282301-ml-javase.zip"/> <property name="dist" value="z:/program files/netbeans 7.0/"/> <property name="zip.url" value="http://bits.netbeans.org/download/trunk/nightly/latest/zip/"/> <fileset id="ant-contrib-jar" dir="./"> <include name="ant-contrib-*.jar" /> </fileset> <pathconver

Sql, Wpf, Xaml, C#, Binding data, Dynamic resource, accessing to non-static data, Obtaining a Reference to an Object -

ok, pretty pretty pretty new wpf , xaml, despite search not find simple solution , seems me won't able find answer pretty soon. the question simple, have created wpf project , have datagrid in selectlist.xaml once row selected, save selected row in object object called "category". far ok can't figure out how going obtain reference object other place temp.xaml ? thanks highly appreciated cheers a common way provide indirect communication in wpf leverage mediator pattern. can use mediator publish selection of category, , have temp view subscribe notification of change in selection of category. see http://www.eggheadcafe.com/tutorials/aspnet/ec832ac7-6e4c-4ea8-81ab-7374d3da3425/wpf-and-the-model-view-vi.aspx simple example of concrete mediator. there several popular mvvm frameworks available provide mediator pattern implementations if want more robust implementation. simple mediator implementation: public sealed class mediator { private static

jQuery toggle on Internet Explorer 7. Position and height Problem -

i made simple script hide/show hidden div. page automatically adjusts height on firefox, safari , chrome. however on internet explorer 7, div overlaps contents @ bottom i'm using joomla cms. have gone wrong ? have tried including "position:relative" bottom contents isn't helping. $j(idname).css({"opacity": "0"}); $j(idname).slidetoggle('fast', function() { $j(idname).animate({opacity:"1"}, function() { if(jquery.browser.msie) { this.style.removeattribute('filter'); $j("#main-body").css("height","auto"); } }); }); visit http://educationtechnologysummit.com/sponsors-a-partners.html clearer view i'm bit unclear question, looks of it, think problem presenting when mouseover menu item in ie7 menu div hidden behind other elements. (the menu div hidden shown through jquery slidetoggle function) it looks you've included z

ipad - Which security frameworks and tools can I use on the iPhone to secure my data? -

which encryption tools / methods / frameworks ios sdk provide? there third party solutions use in app? i'll using core data , encrypt sales details if finds lost iphone he/she can't see how (or how little ;-) ) company makes. from know, iphone os provides framework security. example, if want store password, username or other data encrypting them, can use keychain... you can find more infos here: https://developer.apple.com/library/ios/navigation/index.html#section=topics&topic=security

orm - Supply default default value in NHibernate mapping for unused columns -

my domain object doesn't use 2 non-nullable columns table in database. both of columns guids. there way can supply default value these columns in mapping file i'm able save domain object database? you have few options: provide own <sql-insert> in hbm.xml file. unfortunately forces take control of insert logic. map columns private fields within object aren't exposed , set guids when create new instance. nhibernate can save these fields when inserting. can mark mappings update="false" they're ever inserted. add default values columns in database schema.

authentication - How to get user's First and Last Name from SSO login? -

i using oracle sso server authenticate users of apex app. wish display user's first name , last name on app, don't want ask users info. how can info sso server ? have read cookies? when using sso, information typically passed in application through custom header. should able configure sso provider pass user name application through header, , client side of application should have api withdrawing there.

html - How to get Facebook like button to add a website and add the user to our Facebook page -

i've set new website @ http://www.elitefightkit.co.nz , have facebook page don't have url hand @ moment (but it's called elite fight kit). want add facebook buttons website. can understand how add them product pages want have 'join on facebook' button @ base of page in footer i'm producing visitors can added list of people on our facebook page. we're growing nice group of people on there. i've looked facebook button , seems suggest when user clicks (if configured correctly) feed item added users profile website , provide link site. seems either have them website or facebook group. that's great wondered if there way have them click button, add link website join them our facebook page. there way or 2 seperate buttons? this article helpful when looking facebook button: http://www.webmonkey.com/2010/04/adding-facebook-like-buttons-to-your-site-is-damn-easy/ pretty got me rolling, although facebook developer page wasn't hard head around eith

python - Mako template encoding urls -

i have variable value html: c.url = '<a href=""></a>' when display in mako template, output is: &lt;a href=&quot;&quot;&gt;&lt;/a&gt; what's going on? thanks. your variable's content being filtered it's safe present. markupsafe.escape() being run on it.

How to optimize Canvas drawing - drawBitmap on Android? -

i've done profiling , seems of time spent during drawbitmap, called (understandingly) on every frame. i use surfaceview/updating thread/canvas locking approach demonstrated in lunarlander sample. i've changed (according this question ) on first frame construct bitmap buffer , paint onto it paint each subsequent frame reusing bitmap (not on screen changes) at end of each frame paint buffer once target canvas (to screen) traceview showed me drawbitmap takes 5ms each frame on 800x480 device. can better or 'carved stone' , have optimize other parts of code achieve frames per second? it depends on many things, drawbitmap() fast can get. in particular case, if don't need blending, make sure using opaque bitmap. in addition, try use bitmap in format compatible surface. instance, if using 16 bits surface, drawing 16-bits (rgb565) bitmap fast (it's memcpy call.) if surface 32 bits, use argb8888 opaque bitmap.

c# - How to call function on timer ASP.NET MVC -

i need call function on timer (lets onticktack() function) , reload info in asp.net mvc project. know there several ways that, 1 best opinion? note: function should called 1 place only, , should called every x mins till application up. edit 1: reload info - example have in cache , want update db on timer - once day in time. the answer question depend on mean reload info in asp.net mvc project . not stated problem , such, more obviously, cannot have stated answer. so if assume want periodically poll controller action , update information on view use setinterval javascript function periodically poll server sending ajax request , update ui: window.setinterval(function() { // send ajax request every 5s poll changes , update ui // example jquery: $.get('/foo', function(result) { // todo: use results returned controller action // update ui }); }, 5000); if on other hand mean executing task on server @ regular periods use regist

ruby on rails - Heroku: Redirect / to /features -

how can have make auto redirecting every user goes mysite.com/ mysite.com/features? thanks set root route direct folks there (these rails 3 routes): in config/routes.rb root "content#features" in app/controllers/contents_controller.rb class contentscontroller < applicationcontroller def features end end that won't redirect, however. that, you'll need this: in config/routes.rb match "features" => "contents#features", :as => "features" root "content#index" in app/controllers/contents_controller.rb class contentscontroller < applicationcontroller def index redirect_to features_url end def features end end

c# - Quickly find and render terrain above a given elevation -

given elevation map consisting of lat/lon/elevation pairs, fastest way find points above given elevation level (or better yet, the 2d concave hull)? i'm working on gis app need render overlay on top of map visually indicate regions of higher elevation; it's determining polygon/region has me stumped (for now). have simple array of lat/lon/elevation pairs (more specifically, gtopo30 dem files), i'm free transform data structure suggest. we've been pointed toward triangulated irregular networks (tins), i'm not sure how efficiently query data once we've generated tin. wouldn't surprised if our problem solved how 1 generate contour map, don't have experience it. suggestions awesome. it sounds you're attempting create polygonal representation of boundary of high land. if you're working raster data (sampled on rectangular grid), try this. think of grid assembly of right triangles. let's have 3x3 grid of points a b c d e f

php - Preventing warnings from fsockopen -

i use fsockopen() connect multiple servers in loop. however servers not valid , php warnings 1 below: warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: requested name valid, no data of requested type found is there way prevent these warnings. like checking whether server before trying fsockopen it? or there or better solution this? use error control operator , check results of fsockopen() verfiy have valid connection. $rc = @fsockopen(...); if (is_resource($rc)) { // work }

web services - sending a SOAP message via HTTP in java -

i have following code: string xmldata = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>" + "<soap-env:envelope xmlns:soap-env=\"http://www.w3.org/2003/05/soap-envelope\" " + "xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" " + "xmlns:ns1=\"http://org.apache.axis2/xsd\" " + "xmlns:ns=\"http://tfc\" " + "xmlns:wsaw=\"http://www.w3.org/2006/05/addressing/wsdl\" " + "xmlns:http=\"http://schemas.xmlsoap.org/wsdl/http/\" " + "xmlns:xs=\"http://www.w3.org/2001/xmlschema\"" + "xmlns:mime=\"http://schemas.xmlsoap.org/wsdl/mime/\" " + "xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\" " + "xmlns:soap12=\"http://schemas.xmlsoap.org/w