Posts

Showing posts from July, 2011

python - mysqldb not installing -

hi using python 2.7 working on windows 7. have changed registry_key = software\mysql ab\mysql server 5.1 in site.cfg, , apended ld_args.append(‘/manifest’) in msvc9compiler.py. still got error please have ... traceback (most recent call last): file "c:\mysql-python-1.2.3\setup.py", line 15, in metadata, options = get_config() file "c:\mysql-python-1.2.3\setup_windows.py", line 7, in get_config serverkey = _winreg.openkey(_winreg.hkey_local_machine, options['registry_ke y']) windowserror: [error 2] system cannot find file specified why not use precompiled binaries. can them example here : http://www.codegood.com/archives/129

ruby on rails - How resque removes job from the queue? -

i have implemented resque queuing system in rails app. want know flow of resque job starting enqueue removed out queue. the traditional work flow, along method used gem is, 1. resque enqueue job(resque::job.create) , 2. job calls 'perform' method of class(resque::job.perform), and 3. resque removes job queue. i debugged gem find out method used in step 3, couldn't find it. methods resque::job.destroy, resque::job.dequeue not responsible task, debugged. can tell me method using remove job queue . please note that, not want remove job explicitly, want typical resque method removes job queue. thanks in advance. resque uses 'dequeue' method remove job: def dequeue(klass, *args) job.destroy(queue_from_class(klass), klass, *args) end to pick job queue processing uses 'pop' method: def pop(queue) decode redis.lpop("queue:#{queue}") end

c# - Reflection get type of FieldInfo object? -

hi all, need access class someclass declared has private field in wrapper class, using reflection far have been able private field members . how cast original type access properties , other members. internal class program { private static void main(string[] args) { wrapper wrap = new wrapper { someproperty = new someclass { number = 007 } }; type type = wrap.gettype(); fieldinfo[] infos = type.getfields(bindingflags.nonpublic | bindingflags.instance); foreach (var item in infos) { } } } internal class someclass { public int number { get; set; } } internal class wrapper { private someclass _tempsomeobj; public someclass someproperty { { return _tempsomeobj; } set

php - Magento. Destination folder is not writable or does not exists -

hey i'm stuck following problem, plz help. i "destination folder not writable.." when trying add image product, permission needed folders 777 ! had deleted files on server, didn`t touch db, reinstalled magento scratch new db, , ok. when switched previous db (change settings in local.xml ) bug appeared again. how can db impact folder permissions? update: thanx lot, found out magento jump method: public function getbasemediaurl() { return mage::getbaseurl('media') . 'catalog/product'; } to following method: public function getbasetmpmediaurl() { return mage::getbaseurl('media') . 'tmp/catalog/product'; } does know why , how???? there's 1 spot in magento code base uses error language. file: lib/varien/file/uploader.php ... if( !is_writable($destinationfolder) ) { throw new exception('destination folder not writable or not exists.'); } ... add temporary debugging code right above

matlab - Construct matrix according to the arrangement in another matrix -

i have matrix 'eff_tot' dimension (m x n) want rearrange according matrix called 'matches' (e.g. [n2 n3; n4 n5] ) , put collumns not specified in 'matches' @ end. that is, want have [eff_tot(:,n2) eff_tot(:,n3) ; eff_tot(:,n4) eff_tot(:,n5) ; eff_tot(:,n1)] . that's folks! taking example in first answer, have is: eff_tot = 81 15 45 15 24 44 86 11 14 42 92 63 97 87 5 19 36 1 58 91 27 52 78 55 95 82 41 0 0 0 87 8 0 0 0 9 24 0 0 0 40 13 0 0 0 26 19 0 0 0 regards. create vector listing indices of columns in eff_tot , use setdiff determine columns not occur in [n2 n3 n4 n5] . these columns unmatched ones. concatenate matched , unmatched column indices create column-reordered eff_tot matrix. >> eff_tot = randi(100, 5, 7) eff_tot = 45 82 81 15 15 41 24 11 87

Securing Oracle distributed transactions against network failures -

i synchronizing table in local database data table on database on opposite side of earth using distributed transactions. networks connected through vpn on internet. of time works fine, when connection disrupted during active transaction, lock preventing job running again. cannot kill locking session. trying returns "ora-00031: session marked kill" , not killed before cycle local database. the sync job basically cursor trans_cursor select col_a, col_b, col_c remote_mastertable@my_link updated null; begin trans in trans_cursor loop insert local_mastertable (col_a, col_b, col_c) values (trans.col_a, trans.col_b, trans.col_c); insert local_detailstable (col_a, col_d, col_e) select col_a, col_d, col_e remote_detailstable@my_link col_a = trans.col_a; update remote_mastertable@my_link set updated = 1 col_a = trans.col_a; end loop; end; any ideas make sync operation more

Perl Win32::API() call() function -

dear all, trying value of char pointer or string in return of call() function dll. dll having function randomdec(long , int*) , returns string. call using win32::api(). have tried , didn't succeed. plz help use win32::api; @lpbuffer = " " x 20; $pp= \@lpbuffer; $xy=0; $ff= \$xy; $fun2 = new win32::api('my.dll','randomdec','np','**p**')or die $^e; $pp = $fun2->call(4,$ff); how using $pp ? there multiple errors in code. my @lpbuffer = " " x 20; $pp= \@lpbuffer; => my $pp = " " x 20; you mixing arrays strings, , don't need perl ref c ptr. similar int*. n number not long. l unsigned, need signed, l. use win32::api; $pp = " " x 20; # alloc string $xy = 0; # alloc int $fun2 = new win32::api('my.dll','randomdec','lp','p') or die $^e; $pp = $fun2->call(4,$xy); i haven't check if win32::a

mysql conditional insert -

can have sql insert this? insert a_has_b ( a_id , b_id ) values (1,2) if not (select count( a_id ) a_has_b a_id = 1 , b_id = 2); to answer question, do: insert a_has_b ( a_id, b_id ) select 1, 2 a_has_b a_id = 1 , b_id = 2; however, think looking insert ignore : insert ignore a_has_b ( a_id, b_id ) values (1, 2); this way ignore if there duplicate rows , have proper primary key on values.

swing - Java Reflection Problem -

hi doing final year project; need develop algorithm visualization tool. need cater user-defined algo; animate algorithm user types in text-editor provided in tool. i using java compiler api compile code user has typed , saved. tool offers set of classes user can use in his/her algo. for example: myarray(this class provided tool) import java.awt.*; import java.util.logging.level; import java.util.logging.logger; import javax.accessibility.accessiblecontext; import javax.swing.*; public class myarray extends jcomponent { int size = 0; int count = 0; int[]hold; thread th; public myarray(int[]arr)//pass user array parameter { //th = new thread(); size=arr.length; hold = arr;//make copy of array use later in swap operation } public int length() { return hold.length; } public void setaccessiblecontext(accessiblecontext accessiblecontext) { this.accessiblecontext = accessiblecontext; } public void paintcomponent(graphics g) { super.paintcompo

struts2 - How To Generate unique HTML id attributes within Struts 2 iterator tag -

i need generate unique id attributes within struts iterator on lines of <div id="divid1"/> <div id="divid2"/> etc, etc. i've tried <s:iterator value="mylistfunction" status="#status"> <s:set var="uniqueid" value="divid#status.count/> <s:div id="%{uniqueid}/> </s:iterator> and variations of above, nothing seems work. point me in right direction please try this: <s:iterator value="mylistfunction" status="status"> <s:div id="divid%{#status.count}/> </s:iterator>

android - Trouble With TabActivity on Frequent Clicking The Tabs -

in application there 3 tabs tab host contains activities . these activities downloading images , videos server.the problem when click tabs force close due many exceptions. if solve 1 exception arise. want introduce progress dialog on tab click user unable click other tabs.i tried including progress bar @ starting of oncreate() , ontabchanged() no use please me regard this. if information not eno you need use asynctask show progress bar.and downloading use thread allowing ui load smoothly. check out link progress bar async task progress bar

Need to write a SQL query to fetch data from a Oracle database -

i need write sql query can fetch data 1 table a. senario - lets take table has 2 column c1 , c2. c1 has row_id's , c2 has vaues "site=google;site=gmail,site=yahoo" requirment - need write query can fetch row_id column c1 of table value should come column c2 "google;gmail;yahoo". means should not show "site=" values of c2 column in data fetch. , 1 more condition if there , in place of ; in value query should convert ; , show data. how this: select c1, replace(replace(c2, 'site=', ''), ',', ';') c2 table share , enjoy.

c# - Waiting for commands to be complete -

i working winform runs cmd in background, redirecting input , output asynchronously. currently, winform iterating through array of commands, writing each cmd via streamwriter standardinput redirected to. how can force loop wait until present command complete in cmd before writing next line in? edit: took out of actual project code, , replaced this, stripped down version of i'm trying do, including components of project relevant question. public partial class form1 : form { public delegate void writetoconsolemethod(string text); process _process; string[] _commands = { "echo hello world", "echo name t.k.", "echo here list of commands" }; public form1() { initializecomponent(); processstartinfo processstartinfo = new processstartinfo("cmd") { redirectstandarderror = true, redirectstandardinput = true, redirectstandardout

objective c - private methods in cocoa? -

possible duplicate: best way define private methods class in objective-c hi, can have private methods class in cocoa application? if yse, how? yes can! in *.m file (implementation) #import "myclass.h" @interface myclass() - (void)privatemethod(); @end @implementation myclass - (void)dealloc { [super dealloc]; } - (void)privatemethod { nslog(@"myprivatemethod"); } @end

jsp - Java Object creation vs. String parsing -

i'm working on migrating project jsp-centric using velocity. in many places jsp pages parsing strings display various things. makes jsp ugly , difficult maintain obviously. i have modified controller class work me (i.e. creating list of pojos), iterating on pieces using velocity. have feeling it's going come heavy resistance. i realize creating object comes overhead, makes our pages easier debug, write , use. besides fact separates ui core logic of occurring in background. not mention our appservers bored. database wincing in pain. see tenfold increase in users (which why developed parse strings in jsp & skip object creation) -- smells me of premature optimization. what further arguments support claim should eat cost associated object creation? object creation in java somewhat expensive, 15 years ago. java runtimes have improved lot since then. nowadays, java object creation faster in c++. it never expensive decisive factor in basic applicatio

c# - Sharepoint 2010 problems with WCF service -

Image
i need create wcf service sharepoint 2010. idea use jquery ajax communicate service. cals service methods fail. i try use wcf test client , message: failed invoke service. possible causes: service offline or inaccessible; client-side configuration not match proxy; existing proxy invalid. refer stack trace more detail. can try recover starting new proxy, restoring default configuration, or refreshing service. and error detais: content type text/html; charset=utf-8 of response message not match content type of binding (text/xml; charset=utf-8). if using custom encoder, sure iscontenttypesupported method implemented properly. first 227 bytes of response were: 'a transport-level error has occurred when sending request server. (provider: shared memory provider, error: 0 - either required impersonation level not provided, or provided impersonation level invalid.)'. server stack trace: @ system.servicemodel.channels.httpchannelutilities.validaterequestreplyrespon

eclipse - Android project Refactor greyed out -

Image
i renamed project in eclipse via 'refactor > rename' suggested in this answer . i want rename again, refactor menu has only one menu item (android > extract android string...) greyed out! i using eclipse 3.6.1 latest android sdk 9. why , how restore normal? update (1): after following sankar ganesh's suggestion (selecting string), refactor menu appeared again. selected rename... menu item again , received following error message box: this better previous situation, in had no idea why refactor menu had been disabled , do. still, don't understand why , rules should follow when using refactor function. wanted rename project... that's all. :) update (2): tried same exact operation again again (refactor > rename while project selected in project explorer) , worked! (without issuing message box shown above). what's going on? must bug, because inconsistent . i wonder,why struggling renaming project, if want rename project, ca

c# - HTTP 502 Proxy Error - The size of the response header is too large. Contact your ISA server administrator. (12216) -

some of users getting following error http 502 proxy error - size of response header large. contact isa server administrator. (12216) internet security , acceleration server i guessing has size of hidden "__viewstate" tag in asp.net pages. i realize restriction imposed on users end , have no contol on it. i disabled viewstate on controls in asp.net pages. however, __viewstate still generated large (as always) persist control-state (e.g. checkbox, radiobutton, etc.) is there workaround can try? first, if isa complaining response "header" it's not viewstate. viewstate "simply" form field in body of page. there many things can reduce size of viewstate, along products let eliminate page response (ours @ http://www.techsoftinc.com/viewstate being 1 of many.) if you've disabled viewstates on page , it's still "very large" i'd suggest running through viewstate decoder see what's in it. have perhaps not disa

sql server - Execute one SSIS Package from Another, but using a DIFFERENT proxy user. Is it possible? -

i have 1 ssis package must run proxy a , must run proxy b . love have first package run, and, 1 of tasks, execute second package. possible? thanks lot! you have first package use sp_start_job kick off job set run second package. if "fire-and-forget", that's need do. if need wait until it's completed, things more messy - you'd have loop around calling (and parsing output of) sp_help_jobactivity , use waitfor delay until run completes. this more complex if need determine actual outcome of running second package.

java - How can I auto select a webservice? -

my application needs connect web service xml data. have primary , secondary web service. what best way failover secondary web service if primary fails respond? how set timeout waiting primary? thanks the best solution set vip web service, , have failover automatically. way application cares 1 endpoint , doesn't need worry details. if want handle java code, depends on libraries using connect web service. if using core java, might this: try { url primaryurl = new url(web_service_endpoint); httpurlconnection con = (httpurlconnection) primaryurl.openconnection(); con.setconnecttimeout(5000); //set timeout 5 seconds //try retrieving xml } catch (java.net.sockettimeoutexception e) { //try connecting secondary web service //maybe recursive method call different url or }

ios - UITableViewCell left side color -

Image
i set color left of uitableviewcell, want fall withing bounds of cell. because use uitableviewstylegrouped uitableview color have round corner first , last cell. how can this? i have color in table, thats it. code: uiview *theview = [[uiview alloc] initwithframe:cgrectmake(0, 0, 10, cell.frame.size.height)]; [theview setbackgroundcolor:[uicolor purplecolor]]; [cell.contentview addsubview:theview]; [[cell textlabel] settext:@"some row"]; this result: best regards, paul peelen the fastest , easiest way use images first , last cells. there bit more sophisticated way - drawing of core graphics edit: case rectangle plus quoter of ellipse (or pie slice ).

asp.net 2.0 asp:FIleUpload control saving uploaded files to a different server -

i'm trying use asp:fileupload control allow users upload files (.doc, .gif, .xls, .jpg) server outside of our dmz , not web server. want have ability @ these files viruses, structure, etc prior saving them directory allow access outside users. have read control allow files uploaded web server. can control used upload files server other web server? if can done should type of functionality or how force go https:\servername\folder name (where server name not web server)? have read file write other server? thanks, erin fileuoload control can upload data web server. if need save file different server, need handle post request, read data fileupload control , save them unc share.

java - Any trap which we should beware of Integer.MIN_VALUE == -Integer.MIN_VALUE == Math.abs(Integer.MIN_VALUE) -

i realize below code holds true integer.min_value == -integer.min_value == math.abs(integer.min_value) this because when negate -2147483648 , should become +2147483648 . since maximum positive integer can represented in java +2147483647 , integer overflow occur. when overflow occur, becomes -2147483648 again. i wondering, is there trap should keep eye on it, above situation? the biggest trap slient overflow of example. similar examples. long.min_value == -long.min_value; 0.0d == -0.0d 0.0f == -0.0f double.nan != double.nan float.nan != float.nan double.compare(double.nan, 0) == 1 double.nan > 0 false float.compare(float.nan, 0) == 1 float.nan > 0 false fyi byte.min_value != -byte.min_value; short.min_value != -short.min_value; character.min_value == -character.min_value;

php - Execute & store result from command in C -

i'm trying test php file c program(...) basically have filename want check against php -l , store output further processing. a simple solution in case redirect output file. , read file array. can have further processing array. something this(in c): system("php -l yourfile.php > myfile"); file *f = fopen("myfile", "rb"); fseek(f, 0, seek_end); long pos = ftell(f); fseek(f, 0, seek_set); char *array = malloc(pos); fread(array, pos, 1, f); fclose(f); //your processing part here.. free(array); // free allocated memory solution #2 : invoke php interpreter, , pipe output program. following in console: php -l yourfile.php | pathtoyourcprogram in above case, read output of php stdin. can read entire input, , directly store array.

New Android SDK Tools causing havok -

i've updated new sdk platform version 11 , tools version 10 , generate invalid .apk files. eclipse doesn't complain until try , install it, says android launch! adb running normally. could not find someapp.apk! this because apk messed up. using adb install someapp.apk see eocd not found, not zip note, i'm building against 2 referenced libraries. please me resolve issue. i've spent day looking answer, , chagrin unable find answer. did narrow culprit down either eclipse 3.4 or ant though. reasoning: ant 1.8 needed use command line tools, updated , build via command line. eclipse has plugins 1.7 though, builds still failed. to solve this, updated eclipse 3.6 , works now. helps someones else.

c# - Need advice: How to implement dynamic workflow creation -

i going implement user editable workflow. they should support if/then clauses , perhaps cycles. operation domain not editable , contain predefined set of operations like: send email, notify, message etc. these operations have parameters. p.s. if have experience implementing this, please share it. check this: design workflows wf4 in silverlight and on codeplex: workflow designer developed in silverlight . http://sharedesigner.codeplex.com/releases/view/32301

c# - .NET DB2 OLEDB pre-requisites -

i have written windows forms application in c#, .net framework 2.0, uses system.data.oledb talk sql server 2000 database, working fine. need enhance application talk db2 database on as/400 . matter of configuring connection string, or need additional driver software (where from) and/or references in project? i still use oledb, db2. edit: downloaded microsoft ole db provider unable install onto desktop development pc because not have sql server installed. provider seems integrating sql server db2, whereas want integrate windows forms application db2. there different download location ole db provider not require sql server, can use windows desktop? you can use microsoft's oledb db2 provider this. connection string change. like: provider=db2oledb;network transport library=tcpip;network address=xxx.xxx.xxx.xxx;initial catalog=myctlg;package collection=mypkgcol;default schema=schema;user id=myusername;password=mypassword; or can use ibm's own ibm ole d

wpf - Why does BitmapImage RequestCachePolicy get ignored? -

i'm finding setting requestcachepolicy property on bitmapimage has no effect on how bitmap downloaded when image 's source set instance of bitmapimage . for example, if set requestcachepolicy cacheonly , expect no internet traffic occur whatsoever - specified image should retrieved cache. instead, see request being made server download image: source = new bitmapimage(bmi.urisource, new requestcachepolicy(requestcachelevel.cacheonly)); // image gets downloaded! if set static defaultcachepolicy property on httpwebrequest , application behaviour changes in way expect. ie when it's set cacheonly , no network traffic occurs. why requestcachepolicy property on bitmapimage not having effect expect? according msdn site: http://msdn.microsoft.com/en-us/library/system.net.cache.requestcachepolicy%28v=vs.110%29.aspx "caching web services not supported."

Wordpress Multisite www non-www Page Redirect Failure -

my wordpress multisite setup without www. having issue whenever add www. i.e. www.domain.com/post-name/ redirect me domain.com. i found out because removed /blog/ part of permalink structure in super admin section site. redirects working fine again. however pages weren't. whenever accessed www.domain.com/page1 redirect domain.com any solution this? remove define('noblogredirect', 'http://www.domain.com'); wp-config file. add in htaccess file right under rewriteengine on rewritecond %{http_host} ^domain.com$ [nc] rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,l]

wpf - Close all open modal dialog windows -

i have wpf application has several modal window used various purposes. accomplished using showdialog function. however, in application have timer measure idle time (i.e. no mouse moves or key strokes) cause user logged off. there way (when timer fires) find , close open modal windows without tracking each explicitly? update close messagebox.show instances. possible? thanks, matt is there way (when timer fires) find , close open modal windows without tracking each explicitly? you use componentdispatcher.isthreadmodal check see if you're ui thread in modal state. if is, application.current.windows property give list of opened windows. if have single mainwindow, close others (as they'd modal dialogs), if have multiple windows, you'd have check each one. unfortunately, there's no direct api determine whether specific window modal - there private variable in window class use this. example, following method uses reflection determine whethe

javascript - IE: Problem with local content and Flash -

i using tgetproperty in javascript interact flash movie. works fine in ie when hosted web server, if try , open page local drive, javascript loses ability communicate flash movie , returns 'unspecified error'. i presume happening due restrictive security policy regarding local content. what can overcome problem? thanks. use externalinterface

How to Find memory leaks from native code in android -

just wondering if knows how find out memory leaks in native code android. google search gives lot of solution, none of them full. please let me know if knows how this. really useful information got find leaks in native code. add native=true in ~/.android/ddms.cfg replace /system/lib/libc.so /system/lib/libc_debug.so restart framework, start ddms, you'll see tab native-heap in native-heap, can see allocations native code. for more information click here

collections - Getting an item from an ArrayList, within another ArrayList in Java?(Board wants to get a player within a location) -

its monopoly type game in java. want know how can specific player id, goes through array list of locations on board, checks each one's arraylist particular player. public class board private arraylist<location> alllocations = new arraylist<location>(); public player getplayer(int pl){ int index = 0; for(location temp : alllocations) { if(temp.getplayerid() == pl) {return temp;} } return null; } } public abstract class location { private arraylist<player> players = new arraylist<player>(); public player getplayerid (int id) { int index = 0; for(player temp : players) { if(temp.getid() == id) {return temp;} else {return null;} } return null; } } public class player { public int getid() { return playerid; } } i want can find out player id 1, example, on board. rather have list of location , having search players based on id. add loca

c# - Simplify nested loop logic -

i having trouble trying simplify logic contained in nested loops i have provided pseudo code below, basics of i'm dealing with. actual code more complex , contains multiple nested loop structures. i'm in charge of maintaining code, i'm not original writer of it would place goto valid. while(condition) { while(conditition2) { if(condition3) break condition2 if(condition4) break condition } } there many complexities preforming these code breaks. i not allowed use goto, think easier solution trying do. should try , justify use of goto in case. thanks prashant :) you're setting messy , complicated code. consider linq if possible (loops practically code smell these days, complicated ones), otherwise consider refactoring inner loop separate method , using return; . edit: great post eric lippert critiquing various alternatives problem: http://blogs.msdn.com/b/ericlippert/archive/2010/01/11/continuing-to-an-outer-loop.asp

NuGet official package source: Should I be worried about the safety of the packages? -

according this page : no central approval process adding packages. when upload package nuget package gallery (which doesn’t exist yet), won’t have wait around days or weeks waiting review , approve it. instead, we’ll rely on community moderate , police when comes feed. in spirit of how codeplex.com , rubygems.org work. this makes me feel uneasy. before download firefox add-on, know should not contain malicious code, because afaik add-ons on addons.mozilla.org reviewed mozilla. before download open source project codeplex.com or code.google.com, know should safe because can check it's source code. , can use wot (web of trust) check how other people think project. but before download package nuget official package source. take this one example. no know made package, nor contained in package. seems me can pack package, give name want (like "microsoft prism", long name not taken), upload official package source. should worried safety of packages on nuget offi

cherrypy - sqlalchemy pymssql "connection reset by peer" recovery -

i'm running cherrypy webservice , wondering best option recover "connection reset peer" pymssql connection via sqlalchemy. right have restart webservice. this seems bug in is_disconnect() method pymssql ignore tcp connection , timeout failures, leaving cursor in unhappy state; see http://www.sqlalchemy.org/trac/ticket/2172 . now, can monkey-patch as: from sqlalchemy.dialects.mssql import pymssql def is_disconnect(self, e): msg in ( "20003", "20004", "error 10054", "not connected ms sql server", "connection closed" ): if msg in str(e): return true else: return false pymssql.msdialect_pymssql.is_disconnect = is_disconnect

.net - How to add text to request body in RestSharp -

i'm trying use restsharp consume web service. far everything's gone (cheers john sheehan , contributors!) i've run snag. want insert xml body of restrequest in serialized form (i.e., string). there easy way this? appears .addbody() function conducts serialization behinds scenes, string being turned <string /> . any appreciated! edit: sample of current code requested. see below -- private t executerequest<t>(string resource, restsharp.method httpmethod, ienumerable<parameter> parameters = null, string body = null) t : new() { restclient client = new restclient(this.baseurl); restrequest req = new restrequest(resource, httpmethod); // add parameters (and body, if applicable) request req.addparameter("api_key", this.apikey); if (parameters != null) { foreach (parameter p in parameters) req.addparameter(p); } if (!st

memcached - Rails Action Caching for user specific records -

i rails newbie trying implement caching app. installed memcached , configured in development.rb follows: config.action_controller.perform_caching = true config.cache_store = :mem_cache_store i have controller productscontroller shows user specific products when logged in. class productscontroller < applicationcontroller caches_action :index, :layout => false before_filter :require_user def index @user.products end end route index action is: /products the problem when login 1) user first time, rails hits controller , caches products action. 2) logout , login user b, still logs me in user , shows products user , not user b. doesn't hit controller. the key route, in memcached console see it's fetching based on same key. 20 views/localhost:3000/products 20 sending key views/localhost:3000/products is action caching not should use? how cache , display user specific products? thanks help. the first problem

java - API Demo - Text-to-Speech - How to Change the "Again" Button to Something Else -

java newbie here. interested in learning programming android. i'm going through samples , tutorials on developer.android.com. using eclipse , android sdk developing. checking out apidemos , noticed when compiling texttospeechactivity file, , run in phone/emulator, able click on "again" button , have read aloud text in texttospeechactivity file. i'd know this.... cannot figure out button coming from, how getting labeled word "again" on , how knows placed in exact spot on phone/emulator screen. button being "built" java or actual file located someplace else? i've looked through various folders in apidemos project, have not been able locate graphic looks 1 showing on phone/emulator. 1 last thing, when rolling on button on phone/emulator, button turns grey orange. how button created, , how knows placed on page appreciated. without looking @ in detail, think should looking xml file. understanding layout/components declared in x

.net - ZeroMQ PUSH/PULL and lost message -

i'm making use of zeromq .net , got stuck trying fix weird issue. i've got socket of type push , 1 of type pull on tcp. when client disconnects, server still able to send message (note no flags passed socket.send method) gets lots before starting block , waiting client reconnect , delivering messages try send afterwards. how can avoid losing message (or in worst case test if client connected , if not send dummy message can afford losing)? thanks in advance! edit: further testing reveals if wait 1 second after sending first message after disconnection client, second 1 block, if don't wait @ can send many messages want , they'll lost. that's quite confusing... the zeromq documentation notes problem push/pull setups , suggests following pattern: addition of rep/req setup provide node coordination when you're expecting fixed number of subscribers. however, if not able know number of subscribers in advance, should consider changing protocol more r

multithreading - Does Android enforce performing UI actions only from the UI thread? -

i understand android applications have a single ui thread . does runtime enforce ui calls made thread, or programmer make sure no ui calls made other threads? if try touch view thread other owning ui thread nice calledfromwrongthreadexception. jal

c# - Asynchronous threads and session -

when new async thread has been spawned using signature, asp.net session object available new thread? iasyncresult asynccall = f.begininvoke(null, f); i don't know session object talking if talk asp.net session might not available. bad practice access asp.net session background threads. recommend passing object containing necessary information background tread instead of having pull stuff session => makes less reusable. normally if caller of thread waits complete session should available along it's bad design , avoid it.

ruby on rails - Fast way to check if page is online -

i using nokogiri parsing xml . problem in response time of external resource. works fine. respond time can on 30 seconds. returns different error codes. need find out fastest way know if xml ready requested open-uri . , make actual request. what doing setting timeout 5 seconds prevent delays. begin timeout::timeout(5) link = uri.escape("http://domain.org/timetable.xml") @doc = nokogiri::html(open(link)) end rescue timeout::error @error = "data server offline" end for checks @ level code shows, you'll need cooperation remote service, e.g., conditional head requests and/or etag comparison (those own preference.) looks may have of returns error codes, though if error codes in xml payload they're not going , of course, if remote service's responsiveness variable fluctuate between check , subsequent main request. fwiw: if you're looking improve app's responsiveness when using data, there cache approaches can use,

scripting - Execute PHP files periodicaly -

the question easy, want execute several php files every "n" minutes. example: every n minutes { execute(script1.php) execute(script2.php) execute(script3.php) } i know crontab trying find solution. suggestions? in advance. using cron job usual solution. can explain why don't want use cron? i've seen libraries add cron-like features system. example in java/groovy/grails world there's quartz library/plugin. quick google search yielded php library called phpjobscheduler seems similar quartz. have never used phpjobscheduler can't vouch it. i'd interested in why don't want use crontabs this? going primary web operations person running server or relying on existing sysop team? may want input since ones impacted method choose. i've found tend fond of cron simple scheduling.

.net - Bind to storyboard defined inside a UserControl from the parent window -

i got storyboard working, i'm trying encapsulate of functionality usercontrol. the goal take button on window, , have start storyboard (that slides user control view) defined within usercontrol, when button within usercontrol clicked trigger yet storyboard in user control (to slide the usercontrol out.) i found question , seems quite similar; however, there's no satisfactory answer there , additionally, i'm open other solutions achieve goal. my assumption usercontrol should know how "slide" view , out of view, control glorified input dialog told "show" self externally, know when hide itself. i ok animation/storyboarding being defined outside control, if best (which seems consensus question above) -- how "slide-out" when ok or cancel button pushed within control? it feels ugly window perform "slide-in" , control perform "slide-out" -- originating control exists. i'd rather xaml solution; i'm open dropp

CSS Hover+Background Image -

Image
i'm creating special ui control using html/css mimic windows 7 control panel buttons. far, i've got layout right , i'd add cosmetics it. as seen here, there gradient appears when hover on button mouse. http://m.cncfps.com/zack/files/this-control.png now, can see here i've got layout done. i'd add :hover effect whole div item background image. currently, here have css- yet doesn't work. no image shows in ie8, or firefox edit: works in chrome, not in firefox or ie. #cp .cp-item:hover { background:url(images/hoverbg.png) repeat-x; } it work background-color rather image. there's nothing (relevant) wrong css. the path image correct. it works in chrome. chrome seems more intelligent (or lenient) other browsers. if inspect page, it's inserting stuff: it doesn't work in other browsers because don't have proper page structure (no doctype, no <html> tag, no <body> tag, etc) - page doesn't val

javascript - IE Distorts Slideshow "BACK" and "FORWARD" Navigation -

live example: http://newsite.702wedding.com/vegas-wedding-chapels.asp works great in firefox, chrome, ie slide show arrow buttons move left. any permanent fixes? or how can address ie users , give left margin? (seems ugly, real fixs?) thanks much, james you can target internet explorer conditional stylesheets fix inconsistencies cause ie. it's not ugly - it's pretty common fix , if done requires small number of styles targeted @ ie. include ie specific css files so: <!--[if ie 7]> <link type="text/css" rel="stylesheet" href="ie7.css" /> <![endif]--> <!--[if lte ie 6]> <link type="text/css" rel="stylesheet" href="ie6.css" /> <![endif]--> the top selector targets ie7, while bottom targets browsers <= ie6. use <!--[if lte ie 7]> target browsers <= ie7 single stylesheet instead.

oracle - Query about JRockit Garbage Collection -

i have question oracle's jrockit 1.6. when use genpar, select parallel new generation or old generation or both. in sun jdk young (unless set useparalleloldgc) ; trying understand whether same true jrockit. "genpar" uses parallel collection both new , old generation. see description at: http://download.oracle.com/docs/cd/e15289_01/doc.40/e15062/optionx.htm#i1011879

authentication - IIS 7 cannot log into Sql Server Database -

i have iis 7 application uses domain login. (basic settings, connect as) the application log in server name @ first until set application in it's own application pool. now application gets read data gridview when attempt detailsview edit permission fails. i had database set accept machine read/write (and worked) can't use solution being application move different machine , want use specific set of credentials. any idea how solve this? i had set account of application pool user http://learn.iis.net/page.aspx/624/application-pool-identities/ in above tutorial there section: configuring iis application pool identities just set 'custom account' instead of default user. now can use ssip access machine db read/write

java - ManyToOne column in embeddable class -

i have 2 entities embed ( @embedded ) adress embeddable. in adress class there property points entity location. in adress class put @manytoone , @joincolumn(...) annotations above it. error: exception description: table [persons] not present in descriptor. descriptor: relationaldescriptor(com.wordpress.aiids.voeder.model.location --> [databasetable(locations)]) it's @joincolumn annotation causes trouble: @manytoone //@joincolumn(name = "gemeente", referencedcolumnname = "gemeente", nullable = false) private gemeente gemeente; here's full code of embbedable class. http://aiids.pastebin.com/g1sijnbl do wrong putting annotations there or what's cause of error? solution! the solution referencedcolumnname must point primary key of entity gemeente "postcode" , not "gemeente".

synchronization - VMware time sync problem - ubuntu (guest) on windows 7 (host) -

i running ubuntu guest os using vmware player on windows 7 machine. problem have syncing clock in ubuntu machine. happens when close vmware player , open suspended session. example if close vmware player running ubuntu @ 4:15 pm , restore @ 5:45 pm, still shows 4:15 pm. (this not happen when shutdown ubuntu os.) i searched stackoverflow forum , found setting tools.synctime = true tools.synctime.period = 60 should resolve problem. change did not work me. pointers resolve issue helpful. i had same clock sync issue. installing vmware tools solves problem. but if doesn't help, can manually calling sudo ntpdate ntp.ubuntu.com every time open suspended session.

c++ - Compile a specific obj in a Visual Studio Project from the Command Line? -

i want compile file.obj commandline. within ide, if i'm viewing file.cpp , can click on build -> compile (or hit ctrl-f7), , compile file.obj object. able commandline. ideally, akin to: vcbuild project.vcproj debug file.obj // not valid command i have looked @ documentation vcbuild , msbuild , , devenv . i've experimented three, cannot find way this. can find way build entire project, that's not want. want build specific source file. /pass1 tells vcbuild compile (not link), compiles entire project. i looked @ using cl , compiler. in order use it, have know right parameters pass set environment correctly. automatically taken care of msbuild/vcbuild. with makefiles, make file.obj , , set path, include dirs, etc. any options this? there automated way extract appropriate settings .vcproj file, , pass them cl ? using cl way compile single files command line. say, requires/allows specify options want use. options! if don't want t

php - HTML POST and fetch array -

i have 2 problems here: 1. have problem value of checkbox 2. have problem mysql_fetch_array($variable, assoc); method --> data database varchar type 1. variable with, @ end 'cb', signified value checkbox of form. if checkbox checked, means row (ex: username) in select method database (ex: select username from...) i receive error 1. undefined index: fonctioncb in c:\wamp\www\projet compte utilisateur\manip_liste.php on line 7 2. undefined variable: tab in c:\wamp\www\projet compte utilisateur\manip_liste.php on line 14 ...etc checkbox if not checked .. here php code <?php $prep = ""; if(!$_post['username']) echo 'nom d\'utilisateur manquant'; if(($_post["usercb"]) && ($_post["suffixecb"]) && ($_post["fonctioncb"]) && ($_post["passwordcb"])){ $prep = " * "

math - Avoid Generating a singular matrix in MATLAB -

how generate random matrix not singular in matlab.? i know matrix determinant can used check this, after reading matlab determinant : "using det(x) == 0 test matrix singularity appropriate matrices of modest order small integer entries. testing singularity using abs(det(x)) <= tolerance not recommended difficult choose correct tolerance. function cond(x) can check singular , singular matrices." so if want generate big random matrix (axb) a=5000, b=5000 , how it??. a randomly generated matrix full rank (and hence invertible, if square) probability 1: a = randn(5000); you can check using min(svd(a)) , , verifying smallest singular value larger zero. this well-known fact, here's example paper if want one .

ios4 - More iPhone 4 resolution scaling fun -

so have 2 images set fill screen - 1 @ 320x480 (iphone 3) , other @ 640x960 (iphone 4). img.png (320x480) img@2x.png (640x960) in interface builder, have img.png set fill view (it shouldn't filling iphone 4 view, though, right?), , when build , run, notably small. so, when opposite, setting img@2x.png img, giant blue question mark fills view. project still builds , image fills screen, pixelated if has been rescaled. shouldn't have been rescaled, though, higher resolution. now using... img.png (640x960) img@2x.png (320x480) i've tried switching file takes @2x suffix, has not helped either. smaller file taking @2x suffix, , setting image view img.png, shows way larger view canvas, way small when on phone. smaller file still having @2x suffix, tried switching view new img@2x.png , once again got oversized, pixelated question mark in ib , low res full-screen image when deployed phone. i made sure view size set 640x960 in size inspector. else shou

Do I need a ETL? -

we use datastage etl - export csv/text file data 15 tables(3 different schemas) on daily basis. i wondering if there simpler way accomplish out using etl. tried scriptella. looks simple/fast, again etl. please suggest.. we use python. every programming language -- every single 1 ever invented -- alternative etl. you never need etl. the questions these: which cheaper build? custom software or configuration of etl? which cheaper maintain operate? which easier adapt changing requirements?

jquery - How do I change my code so the .click acts upon it's parent element? -

here html code <div class="column"> <div class="open"></div> <div class="close"></div> <div class="content"> content. content. content. content. content. content.this content. content. content. content. content. content. content. content. content. content. </div> </div> and jquery $(document).ready(function() { //page load $('.column').css({ width: '30px' }); // open $('.open').click(function() { $('.column').animate({ width: '400px' }, 200); $('.open').hide(); $('.close').show(); $('.content').fadein('slow', function() { $('.content').show(); }); }); // close $('.close').click(function() { $('.column').animate({ width: '30px' }, 500, fun

java - Extended Ascii doesn't work in console! -

for example system.out.println("╚"); displays ?, same goes system.out.println("\u255a"); why doesn't work? stdout indeed support these characters don't it. see this question . when java’s default character encoding not utf-8 — case, seems, on windows , os x, not linux — characters fail encode converted question marks. can pass correct switch ( -dfile.encoding=utf-8 on terminals, don’t have windows box in front of me) jvm’s command line, or can set environment variable. portably determining should might impossible, if know run on win32 console, example, can choose charset explicitly encode characters before writing them standard output, or can directly write bytes need.

android - uncaught Exception java.lang.outofmemoryError at dalvik.system.Nativstart.main(Native Method) -

i implement , thread , httppost connection m getting "error uncaught exception java.lang.outofmemoryerror @ dalvik.system.nativstart. main(native method) here following log result 02-24 09:16:42.550: error/dalvikvm-heap(850): out of memory on 120-byte allocation. 02-24 09:16:42.550: info/dalvikvm(850): "thread-10" prio=5 tid=19 runnable 02-24 09:16:42.560: info/dalvikvm(850): | group="main" scount=0 dscount=0 s=0 =0x437921a8 02-24 09:16:42.560: info/dalvikvm(850): | systid=858 nice=0 sched=0/0 handle=1702960 02-24 09:16:42.560: info/dalvikvm(850): @ lang.throwable.nativefillinstacktrace (native method) 02-24 09:16:42.570: info/dalvikvm(850): @ java.lang.throwable.fillinstacktrace (throwable. java:138) 02-24 09:16:42.570: info/dalvikvm(850): @ java.lang.throwable.<init>(throwable.java:80) 02-24 09:16:42.570: info/dalvikvm(850): @ java.lang.error.<init>(error.java:41) 02-24 09:16:42.570: info/dalvikvm(850)

android - findViewByID(R.layout.skeleton_activity) returns null -

i trying register context menu in skeleton app's oncreate(): /** called activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // inflate our ui xml layout description. setcontentview(r.layout.skeleton_activity); view v = findviewbyid(r.layout.skeleton_activity); registerforcontextmenu(v); // find text editor view inside layout, because // want various programmatic things it. meditor = (edittext) findviewbyid(r.id.editor); // hook button presses appropriate event handler. ((button) findviewbyid(r.id.back)).setonclicklistener(mbacklistener); ((button) findviewbyid(r.id.clear)).setonclicklistener(mclearlistener); meditor.settext(gettext(r.string.main_label)); } the debugger tells me findviewbyid(r.layout.skeleton_activity) returns null. @commonsware solution similar post wait until onfinishinflate(). however, in sample project provides, doesn'

iphone - string to another view -

i've followed tutorial passing data between classes did it, , working fine, need send string value (a date) view, (is simple know im noob this!), so problem need send string (date), other view, string ok, dont seem (yet)how construct function, i no warnings app breaks, - (void)calendarview:(klcalendarview *)calendarview tappedtile:(kltile *)atile{ nslog(@"date selected %@",[atile date]); string1 = [[atile date] description]; dateis.text = string1; //label check string working nslog(@"ahi va! %@", string1); nsstring *cucux = dateis.text; crotime *croco = [crotime alloc]; croco.string1 = cucux; [self.view addsubview:croco.view]; nslog(@"croco = %@", cucux); } console message terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[crotime setstring1:]: unrecognized selector sent instance 0x5e2e1e0' thanks lot!! setstring1 setter method calls when set property value.so erro

iphone - How can i select the standard program in developer.apple.com -

i registered ios developer in developer.apple.com company id. want test app in real device. follow tutorial follows. http://mobiforge.com/developing/story/deploying-iphone-apps-real-devices in that, can login developer.apple.com/iphone/program/ , select program wish in 2 programs. can't find standard , enterprise programs. shows this... http://developer.apple.com/programs/start/standard/create.php i can't understand how can go through , select. can please solve problem. thanks chakradhar. go here: http://developer.apple.com/programs/register/ you have register $99/individual membership able push app physical device. free membership not allow push app device, run in simulator. there lengthy process must go through able app onto device after register. go ahead , register, approved, , pay $99. next, login here: http://developer.apple.com/devcenter/ios/index.action once logged in, see 'ios provisioning portal' on right. go there, , throug