Posts

Showing posts from September, 2011

How to reset mysql root password? -

How to reset mysql root password? - i have little problem phpmyadmin, in fact accidentally delete multiple user accounts. since impossible connect without error: # 1045 - access denied user 'root' @ 'localhost' (using password: no) i have search little on net before, , technic: update mysql.user set password = password ('') user = 'root'; flush privileges; does not work, or didn't understood how worked. i'm on freebsd 8.1, version of phpmyadmin 2.11. thank in advance answers. i summarised solution here: http://snippets.dzone.com/posts/show/13267 sudo stop mysql sudo mysqld --skip-grant-tables --skip-networking mysql mysql> update mysql.user set password = password('your_new_password') user = 'root'; mysql> flush privileges; mysql> exit; sudo mysqladmin shutdown sudo start mysql mysql mysql-error-1045

css - A span can be a div, but a div can't be a span -

css - A span can be a div, but a div can't be a span - i'm wondering if (my title) ever incorrect, other html validation. i've had start supporting ie7 1 time again (i've been lucky plenty not have past 3 years or so) , fact div's can't inline-block has gotten me 10 times in past month due fact create div default , go , stylize elements. i'm considering making everything span if later go , create inline-block i'm not trying figure out why it's not working in ie7. so question -- there ever case, in browser (ie7+, ff, webkit, opera), knows of span can not deed div? i'm not concerned html not validating due having block elements within inline ones. i'm not going straight reply question, think worth saying. i've had start supporting ie7 1 time again (i've been lucky plenty not have past 3 years or so) , fact div's can't inline-block has gotten me 10 times in past month you can util...

actionscript 3 - Distributing changes to an existing SWF application theory -

actionscript 3 - Distributing changes to an existing SWF application theory - lets have online application written in as3 , served server swf. first version go out v1.0. several users, behind proxy server, utilize v1.0 application , there cached re-create on client machines , proxy server. v1.1 released , placed on server. users should see v1.1, results vary, served fresh copy, period receive cache's copy, , served cache'd re-create in proxy server. i can code in v1.0 checks server variable see if it's out of date. if out of date, there way in as3 forcefulness download fresh copy, or apply differences itself? considering don't have access proxy server , can't manually or automatically clear cache. i think citizen conn provides simple solution, albeit introduces unnecessary server load. you utilize citizen conn's approach instead of timestamp, utilize app's version tag. main.swf?app_version=1.1 a different approach forcefuln...

math - Tricky algorithm for sorting symbols in an array while preserving relationships via order -

math - Tricky algorithm for sorting symbols in an array while preserving relationships via order - the problem i have multiple groups specify relationships of symbols.. example: [a b c] [a d e] [x y z] what these groups mean (for first group) symbols, a, b, , c related each other. (the sec group) symbols a, d, e related each other.. , forth. given these data, need set unique symbols 1-dimension array wherein symbols somehow related each other placed closer each other. given illustration above, result should like: [b c d e x y z] or [x y z d e b c] in resulting array, since symbol has multiple relationships (namely b , c in 1 grouping , d , e in another) it's located between symbols, preserving relationship. note order not important. in result, x y z can placed first or lastly since symbols not related other symbols. however, closeness of related symbols what's important. what need help in i need help in determining algorithm takes groups of...

jQuery Drop Menu Click not Hover -

jQuery Drop Menu Click not Hover - i'm trying drop menu work click instead of hover cant seem work. ideas ? // drop menu $(".navigation ul ul, .shoppingbasket ul ul").css({display: "none"}); $(".navigation ul li, .shoppingbasket ul li").hover(function(){ $(this).find('ul:first').css({visibility: "visible",display: "none"}).slidedown(400); },function(){ $(this).find('ul:first').css({visibility: "hidden"}); }); .hover() takes 2 handlers, first 1 executed when mouse enters, sec executed when mouse leaves. reason, swapping .hover() .click() not work, since .click() takes 1 handler executes when click. however, .toggle() can used bind multiple handlers executed on alternate clicks. $(".navigation ul ul, .shoppingbasket ul ul").css({display: "none"}); $(".navigation ul li, .shoppingbasket ul li").toggle(function(){ $(this).find('ul:first').css({visibil...

c++ - Committing a TLB file to repository -

c++ - Committing a TLB file to repository - i'm importing tlb file project since i'm using com dll. tlb file binary file, need compile source code , wondering if it's programming practice commit repository. yes, it's ok set binary files in source repository. rule called 'do not set binary files in source repository' should improve called 'do not set temporary files or files compilation result in source repository'. can't produced other files , relevant project (i.e. no editor preference files) can set in repository. c++ windows dll repository type-library

performance - Real time text processing using Python -

performance - Real time text processing using Python - real time text processing using python. e.g. consider sentance going schol today i want next (real time): 1) tokenize 2) check spellings 3) stem(nltk.porterstemmer()) 4) lemmatize (nltk.wordnetlemmatizer()) currently using nltk library these operations, not real time (meaning taking few seconds finish these operations). processing 1 sentence @ time, possible create efficient update: profiling: fri jul 8 17:59:32 2011 srj.profile 105503 function calls (101919 primitive calls) in 1.743 cpu seconds ordered by: internal time list reduced 1797 10 due restriction ncalls tottime percall cumtime percall filename:lineno(function) 7450 0.136 0.000 0.208 0.000 sre_parse.py:182(__next) 602/179 0.130 0.000 0.583 0.003 sre_parse.py:379(_parse) 23467/22658 0.122 0.000 0.130 0.000 {len} 1158/142 0.092 0.000 0.313 0.002 sre_compile.p...

android - How I get URL from webview on click -

android - How I get URL from webview on click - how can "clicked url" webview on click event?? @override public void onclick(view v) { if( v.getid() == r.id.webview) { //here want clicked url } } thanks in advance. webview.setwebviewclient(new webviewclient() { public boolean shouldoverrideurlloading(webview view, string url){ webview.loadurl(url); // here string url hold 'clicked url' homecoming false; } }); android

c# - WPF Create sibling window and close current one -

c# - WPF Create sibling window and close current one - what need such event handler in window class. void someeventhandler(object sender, routedeventargs e) { mynewwindow mnw = new mynewwindow(); mnw.owner = window.getwindow(this); mnw.showdialog(); this.close(); } window.getwindow(this) returns parent window of current window. i had thought when owner of new window parent window of current one, wait parent; , not current one. did not work way. current window waits execution of new , closes after. if utilize show() instead of showdialog() reason window not shown @ all. probably need delegate methods not sure start. edit: guess need improve question future references: new window should dialog parent window. if utilize show() parent window becomes accesible , dont want that. if utilize showdialog() becomes dialog current window, meaning current window not close until new window closed, , dont want either. closing window causes windows owns to ...

c# 3.0 - filesavedialog.showdialog hangs in windows 7 -

c# 3.0 - filesavedialog.showdialog hangs in windows 7 - i making custom setup project msi. there unusual problem in 1 of windows while installation goes. there show dialog phone call on click of button. installer running fine on xp on win 7 installer goes not-responding , never comes back. below piece of code using showing dialog: private void btnsetfilelocationws_click(object sender, eventargs e) { savefiledialog1.title = "set ws log file path"; savefiledialog1.defaultext = "log"; savefiledialog1.filter = "log files (*.log)|*.log|text files (*.txt)|*.txt"; savefiledialog1.filterindex = 0; savefiledialog1.restoredirectory = true; if (savefiledialog1.showdialog() == dialogresult.ok) { txtfilepathws.text = savefiledialog1.filename; } btnnextwslogging.enabled = enabledisablednextwsloggingbutton(); } anybody?? the msi running under business relationship doesn't have access desktop. this...

Why does Eclipse Java Package Explorer use the System Font? -

Why does Eclipse Java Package Explorer use the System Font? - there no way adjust font or font size of java bundle explorer. inherits font settings system. in case of windows xp, default 8 point font little taste. i'd enlarge it. when that, however, affects browser , other applications , in cases makes font big in other contexts (such firefox tab text). eclipse supposed respect os settings turns out on mac os x default setting eclipse utilize little fonts rather standard os fonts. on mac os x can alter edit eclipse.ini file , remove -dorg.eclipse.swt.internal.carbon.smallfonts restart eclipse , presto find bundle explorer looks brilliant reasonable sized fonts. eclipse fonts

Monitoring certain system calls done by a process in Windows -

Monitoring certain system calls done by a process in Windows - i able monitor scheme calls made process, file i/o calls. on linux can away using strace suitable parameters, how can on windows? i'm interested in running process , figuring out files has read , written. edit: want programmatically process. i'm aware of processmonitor, receive info in form can import programme farther analysis. edit: if narrow downwards requirements further, plenty able monitor calls createfile(). i'm interested in files opened, , if opened read/write or read. requirement didn't state speed important; planning on doing things compiling c++-file, , pulling total gui generates 20mb logfile have prohibitive overhead. edit: nice if did not require administrative privileges. there several options on windows. windows performance toolkit can used enable tracing of various scheme events, including file i/o, , includes tools processing , viewing these events. can uti...

c++ - Parsing C Header Files -

c++ - Parsing C Header Files - i have c header file have precompiled using gcc -e flag, , trying parse using lex , yacc; however, getting hung on typedef'd variables. for example: typedef unsigned long ulong; ulong = 5; will throw syntax error @ sec line's ulong. i have tried redefine part of grammar (found here) http://www.quut.com/c/ansi-c-grammar-y.html, under type_specifer replacing type_name identifier , create multiple s/r , r/r errors unable fix. are there other approaches recommend? or different approach @ precompiling together? in code link too: http://www.quut.com/c/ansi-c-grammar-y.html, look @ bottom: see function int check_type(void) { /* * pseudo code --- should check * * if (yytext == type_name) * homecoming type_name; * * homecoming identifier; */ /* * homecoming identifier */ homecoming identifier; } you need write code identifies weather sequence (yytest, yytext+yylength] identifier or type_na...

c# - focus on user control -

c# - focus on user control - i want focus on user command giving me errors function getfocus() { document.getelementbyid('<%myusercontrol.clientid%>').focus() } <a href.... onclick="getfocus()>click</a> how can this? thank you replace this: document.getelementbyid('<%myusercontrol.clientid%>').focus() with this: document.getelementbyid('<%= myusercontrol.clientid%>').focus() c# asp.net

java - sort JTable's entries without clicking on column header -

java - sort JTable's entries without clicking on column header - i've implemented row sorting on jtable both using defaultrowsorter , custom defined row sorter class. works fine clicking on column header sort table. but if want invoke sort operation within application code ( without clicking on column header). method have phone call ? edit: i initialize tables row sorter way: public void buildrowsorter() { tablerowsorter<mymodel> sorter = new tablerowsorter<mymodel>((mymodel)this.table.getmodel()); seek { sorter.setcomparator(0, new mycustomcomparator<double>(sorter,0)); sorter.setcomparator(1, new mycustomcomparator<string>(sorter,1)); } grab (parseexception e) { e.printstacktrace(); } this.table.setrowsorter(sorter); } now like, having reference jtable (table), retrieve associated row sorter particular column of model, , invoke sort operation on it. ...

java - how to delete a particular character at particular position from a character array ? -

java - how to delete a particular character at particular position from a character array ? - i need delete character character array , re-size array. until now, have worked on replacing particular character special character. in code searching matches found i.e , if characters matching in male , female character array , if found replacing "*". instead of have delete character , resize array. private static void compare(string male,string female) { char[] male; char[] female; // converting string charecter array male=male.tochararray(); female=female.tochararray(); //finding matches i.e, charecter matching or not for(int i=0;i<male.length;i++){ for(int j=0;j<female.length;j++) { string m = character.tostring(male[i]); string fm = character.tostring(female[j]); if(m.equals(fm)){ //if charecters equal replacing them "*" male[i]='*...

c++ - how to understand what part of the boost::regex failed to match/search -

c++ - how to understand what part of the boost::regex failed to match/search - i using boost::regex match (better boost::regex_search ) text vs regular expression. this 1 doesn't match , regex huge. do know if in library there function telling me part of regex failed match? i using linux/gcc std::string text; // whatever boost::regex rgx( "(\\w+) (\\d+) (\\s+)" ); boost::smatch m; if( !boost::regex_search( text, m, rgx ) ){ // how know (\\w+) or (\\d+) or (\\s+) failed? } there no tool in library knowledge, using boost version 1.28.0. did seek execute (\w+), (\d+) , (\s+) independantly of each other? @ to the lowest degree 1 of them should fail matching. c++ linux boost-regex

php - Search Database for strings -

php - Search Database for strings - am going right way? i've got 4 input areas revolve around filtering db search , little confused how correctly. i've got: $e_s=mysql_real_escape_string($_post['var_specs']); $ven=mysql_real_escape_string($_post['vender']); $xtp=mysql_real_escape_string($_post['xtype']); $sar=mysql_real_escape_string($_post['sarea']); if(strlen($e_s) > 1){ if ($e_s && $area=="vars"){ $areasearch = "db_vars"; $typeresults = "vars"; $typeurl = "vars"; $search = $e_s; } // if vender if($ven=="all" || $ven==""){ $vender_search="%"; } else { $vender_search="%".$ven."%"; } // if type if($xtp=="all"){ $xtype_search="%"; } else { $xtype_search="%".$xtp."%"; } // if area if(...

winapi - Tool for determining version of Win32 APIs used by C++ code? -

winapi - Tool for determining version of Win32 APIs used by C++ code? - i'm modifying big c++ project first release windows 7-only work on vista , xp. the main work alter w7 api calls utilize getprocaddress @ runtime (to avoid static linking methods not available on other platforms), , i'm wondering if there tools can help identify calls need changed -- examining c++ code itself. failing that, best seek building project against older windows sdk? -- example: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=6510 #define winver 0x501 now newer windows xp cause compilation error. replace causes error until none remain. if have sed -fu, can write filter straight finds #if winver > 0x501 blocks in windows headers, me, bit out of scope :-) c++ winapi api version

python - How to use django-tracker? -

python - How to use django-tracker? - is know how utilize django-tracker? can find more details how utilize django-tracker? have looked here? http://pypi.python.org/pypi/django-tracker python django

html - Relating the use of multiple type of style sheets in a single web page -

html - Relating the use of multiple type of style sheets in a single web page - i'am in process of learning css. well, problem have read in css tutorial precedance of different types of style sheets when used simultaneously in single webpage follows: 1.browser default 2.external style sheet 3.internal style sheet (in head section) 4.inline style (inside html element) where number 4 has highest priority. so, inline style (inside html element) has highest priority, means override style defined within tag, or in external style sheet, or in browser (a default value). but in illustration have tried: <html> <head> <style type="text/css"> img{height:auto;} </style> </head> <body> <img src="logocss.gif" width="95" height="100" /><br /> </body> </html> the problem here internal style overriding inline style , changes made height in inline form...

android - option menu not working with Webview? -

android - option menu not working with Webview? - i using webview in activity , want utilize alternative menu too. not display alternative menu on clicking menu button 1 guide me problem? oncreate { _webview.setwebviewclient(new webviewclient() { @override public void onpagestarted(webview view, string url, bitmap favicon) { super.onpagestarted(view, url, favicon); //if(_dialog != null && !_dialog.isshowing()) // _dialog.show(); } @override public void onpagefinished(webview view, string url) { super.onpagefinished(view, url); if (_dialog != null && _dialog.isshowing()) { _dialog.dismiss(); } } @override public void onreceivederror(webview view, int errorcode, string description, string failingurl) { i...

c - CUDA Parallel Nsight local debugging on a GTX 590 -

c - CUDA Parallel Nsight local debugging on a GTX 590 - is possible local debugging using parallel nsight on gtx590 on windows 7? understand local debugging require 2 gpus. 590 has 2 gpus cannot work. error message: parallel nsight debug local debugging failed. nsight incompatible wpf acceleration. please see documentation wpf acceleration. run disablewpfhardwareacceleration.reg in nsight installation. i have looked @ documentation wpf acceleration , used file "disablewpfhardwareacceleration.reg" disable wpf acceleration - i've checked using regedit , reg_dword set 1, showing hardware acceleration has been disabled. have set "wddm tdr enabled" "false" in nsight monitor options. i have disabled sli mode through nvidia command panel selecting 'disable multi-gpu mode' in 'set multi-gpu , physx configuration' tab. using code: int devcount; cudagetdevicecount(&devcount); printf("cuda device query...\n")...

c# - Which is the best way to generate unique serial number? -

c# - Which is the best way to generate unique serial number? - i develop application needs have licence. should unique per machine. in before versions used windows serial number purpose: read win, made tricks/encryption on generete serial number & lic file. own solution, in new project i'd create new one. my question is: there used way generate unique serial numbers? any, based on hardware serial number, motherboard or processor etc.? (.net4/c#/vs2010) thanks in advance! try here: generating unique key (finger print) computer licensing purposes c# licensing

c++ - How to solve BSTR leak memory com object? -

c++ - How to solve BSTR leak memory com object? - at first excuse bad english language . i using microsoft isa server 2006 c++ programming sdk . i info isa server isa functions needs bstr variable , create memory leak , using ::sysfreestring(bstr) doesn't solve memory leak . should have ? fpclib::ifpclogentryptr::get_clientip(bstr *); by default, com bstr values cached runtime library, can give appearance of leak on time. though own code has no leaks, heap size still grows - annoying. if want rule out cause, can disable using setoanocache api. if still have apparent leak after doing that, can track downwards using process dumper consecutive snapshots , run 1 time again compare them. run against debug build if possible, callstacks easier decipher in case. c++ visual-c++

c# - Getting lookup view model to trigger Modal Dialog -

c# - Getting lookup view model to trigger Modal Dialog - what's right way viewmodel trigger custom lookup command throw modal dialog represents lookup viewmodel? custom lookup control's info context of parent record view model. lookup command has dependencyproperty has bound lookupviewmodel property on parent record view model , represents sub lookupviewmodel. method 1) currrently utilize event on lookupviewmodel custom command knows hear for. method 2) tried throwing validation exception within setter of property on lookupviewmodel lookup control's text propery bound too. hooked errorevent in custom lookup control. seems if user "corrects" value within dialog while in event, original value sticks. , worse, after phone call validation.clearinvalid, errorevent still fires somehow adds error back. works here in sense viewmodels have right data, it's seems textbox ignoring bound text property has changed on underlying info source when wit...

log4cxx is throwing exception on ~Logger -

log4cxx is throwing exception on ~Logger - i started log4cxx doing little app familiar it. compiled visual studio 2005, no warnings or errors. looks : #includes<...> ... ... loggerptr logger(logger::getlogger("myapp")); void main(...) { //some logs here } it works expected until close app when exception while trying destroy global logger object. here trace: log4cxx.dll!apr_pool_cleanup_kill(apr_pool_t * p=0xdddddddd, const void * data=0x01cf6158, int (void *)* cleanup_fn=0x10174250) line 1981 + 0x3 bytes log4cxx.dll!apr_pool_cleanup_run(apr_pool_t * p=0xdddddddd, void * data=0x01cf6158, int (void *)* cleanup_fn=0x10174250) line 2025 log4cxx.dll!apr_thread_mutex_destroy(apr_thread_mutex_t * mutex=0x01cf6158) line 133 log4cxx.dll!log4cxx::helpers::mutex::~mutex() line 57 log4cxx.dll!log4cxx::logger::~logger() line 55 + 0xb bytes log4cxx.dll!log4cxx::logger::`vbase destructor'() + 0x19 bytes log4cxx.dll!log4cxx::logger::`vector deleting destr...

javascript - Why does animate opacity not work in chrome? -

javascript - Why does animate opacity not work in chrome? - i have simple code highlighting specific list item: var $highlights = $j("div.ab-highlights ul li a"); $highlights.hover( function () { $j(this).children().addclass('active'); $j(this).parent().animate({opacity: 1}, 200); $highlights.not(this).parent().animate({opacity: 0.2}, 200); }, function () { $j(this).children().removeclass('active'); } ); the big problem not work in chrome (in firefox 4 & ie9 works great) the site http://www.alonbt.com the html is <div class="ab-highlights"> <ul> <li class="mansfred"><a href="http://alonbt.com/musical-biography/"><span>musical biography</span></a></li> <li class="museek"><a href="http://alonbt.com/music-visualization-project/"><span>music visulisation p...

javascript - Mootools LightFace plugin and Mootools tooltips integration -

javascript - Mootools LightFace plugin and Mootools tooltips integration - i using light face plugin written davidwalsh in project. in loading content page. page contains form. want mootools tooltip on form elements, tool tips not beingness displayed in lite face dialog. if remove lightface.css file, tooltips displayed correctly. may css error, unable observe whats happening , newbie in css. i able solve question help of davidwalsh himself. problem related z-index. z-index of lightface 9001 , changed z-index of tooltip 9002 , changed "position" of tool tip "relative". javascript mootools

python - OpenCV/C++ program slower than its numpy counterpart, what should I do? -

python - OpenCV/C++ program slower than its numpy counterpart, what should I do? - i implemented time ago procrustes analysis algorithm in python , told port opencv/c++ recently. after finishing ran tests , same input/instances, c++ code taking twice time python code (roughly 8 vs 4 seconds, respectively. i'm repeating tests one thousand times create sure i'm not measuring them on period small). i'm baffled these results. i've used gprof seek understand what's going on, can't tell whole lot beingness wrong, besides fact cv::mat::~mat() taking 34.67% of execution time , beingness called 100+ times more other functions. not sure should either, unless i'm supposed replace cv::mats std::vectors or raw arrays, both of seem bad practice me. void align(const cv::mat& points, const cv::mat& pointsref, cv::mat& res, cv::mat& ops) { cv::mat pts(points.rows, points.cols, cv_64fc1); cv::mat ptsref(points.rows, points.cols, cv_64fc1...

c# - Choosing 'Edit Web Part' is selecting the wrong instance of the web part -

c# - Choosing 'Edit Web Part' is selecting the wrong instance of the web part - i've created custom web part , i've added 3 instances of same web part in page. if seek edit sec web part opening tool part 3rd web part. in fact whatever web part edit opens tool part of instance of web part added in page in lastly (latest). if have added 10 web parts editing web part 1-9 opens tool part of 10th instance of web part. any ideas? ok, i've fixed it. uncertainty whether bug in sp 2010. in web part class commented oninit() method , worked. method - /// <summary> /// init /// </summary> /// <param name="e"></param> protected override void oninit(eventargs e) { this.title = "my title"; } any comments on this? c# .net sharepoint sharepoint-2010 web-parts

javascript - Error calling method on NPObject! -

javascript - Error calling method on NPObject! - sorry english updated uploadify recent version (uploadify-v2.1.4) , broked uploadify: can't upload . firebug console returns erroe when i'm trying phone call "error calling method on npobject!". what doing wrong?! here's code: http://pastebin.com/bheyhxhw thanks, daniil. /* original code */ uploadifycancel:function(id) { jquery(this).each(function() { document.getelementbyid(jquery(this).attr('id') + 'uploader').cancelfileupload(id, true, true, false); }); }, /*new code */ uploadifycancel:function(id){ jquery(this).each(function(){ document.getelementbyid(jquery(this).attr("id")+"uploader").cancelfileupload(id,true,false) }); }, /*original code */ jquery...

c# - datagridview column index -

c# - datagridview column index - i have form datagridview widget , need index of column selected name. for example, let's have table 2 columns: name, surname. need way index of column name. problem changes time depending on datasource column has same name "name". does know how solve problem? to retrieve datagridview column name reference through columns collection indexer: datagridview1.columns["columnname"] then can column index column: datagridview1.columns["columnname"].index; do note if utilize invalid column name reference homecoming null, may want check column reference not null before using it, or utilize columns collection .contains() method first. c# datagridview indexing

ios - How to make requests with HessianKit -

ios - How to make requests with HessianKit - i working on ios app needs connect hessian service live stock prices. using hessiankit ios. i told connect to: http://www.ourserviceurl.com:8080/tt/sub?hessian=true&tickers=ba|c tickers pipe delimited list. had hide name of url well. my protocol is: @protocol cwhelloservice -(nsstring*)sub:(bool)hessian tickers:(nsstring *)tickers; @end i tried connect way: nsurl * url = [nsurl urlwithstring:@"http://www.ourserviceurl.com:8080/tt/"]; id<cwhelloservice> proxy = (id<cwhelloservice>)[cwhessianconnection proxywithurl:url protocol:@protocol(cwhelloservice)]; nslog(@"hello: %@", [proxy sub:yes tickers:@"ba|c"]); i maintain getting 404 error when trying create connection. i have never used hessian protocol before , sure missing simple, still can't figure out going wrong i informed using hessian streaming protocol , isn't supported various hessian apis out...

How to upload binary data to Amazon S3 from a Rails app? -

How to upload binary data to Amazon S3 from a Rails app? - i using gems paperclip & aws-s3 upload images amazon s3 rails app. works fine. trying upload binary info s3 , homecoming url. how can that? you'll find tutorial examples here: http://amazon.rubyforge.org look @ s3object.store method. edit: you should utilize official amazon sdk: http://aws.amazon.com/sdkforruby/ ruby-on-rails ruby-on-rails-3 amazon-s3

c++ - How to suppress runtime errors caused by assert() using google test? -

c++ - How to suppress runtime errors caused by assert() using google test? - i using google test in c++ project. functions utilize assert() in order check invalid input parameters. read death-tests (what google test, death tests) , started using them in test cases. however, wonder if there way suppress runtime errors caused failing assertions. @ time each failing assertion creates pop-up window have close everytime run tests. project grows, behaviour increasingly disturbs workflow in unacceptable way , tend not test assert()-assertions longer. know there possibilities disable assertions in general, seems more convenient suppress os-generated warnings within testing framework. ok, found solution myself: have select test-style threadsafe . add together next line test code: ::testing::flags_gtest_death_test_style = "threadsafe"; you can either tests in test-binary or affected tests only. latter faster. got updated faq: googletest advancedguide c++ ...

iphone - Invalidate and release an NSTimer when popping a view (with a UINavigationController) -

iphone - Invalidate and release an NSTimer when popping a view (with a UINavigationController) - i'm using uinavigationcontroller: in first view there uibutton pushes view using code - (ibaction)gototrack:(id)sender { map *map2 = [[map alloc] initwithnibname:@"map" bundle:[nsbundle mainbundle]]; [self.navigationcontroller pushviewcontroller:map2 animated:yes]; [map2 release]; } in sec view there map indicates position of object. object moving fast, need refresh position every second: i'm doing nstimer, calls method calculates new coordinates , refreshes map. ok, works fine, when user pops view (with usual button in navigationbar) sec view not released, because nstimer still working! what can invalidate , release nstimer when user pops sec view? there methods called automatically? (i tried nothing) thanks! you can seek invalidating nstimer in -viewwilldisappear or viewdiddisappear . viewwilldisappear : this method called ...

php - Making a string safe by removing all javascript codes and events -

php - Making a string safe by removing all javascript codes and events - i want remove javascript codes string contains html code. for illustration these unwanted javascript codes may cause problems on website: <div onmouseover='window.location = "http://to-undesirable-location"'></div> or <img onload='window.location = "http://to-undesirable-location"'></img> or <script language="javascript> ...unwanted code... </script> since hackers can utilize js functions redirect page unwanted pages wonder why there not source create type of content safe... on website there simple wysiwyg editor users can set html content within it. thanks i've heard things on stack overflow html purifier. php

jsf 2 - JSF 2.0 ViewExpiredException -

jsf 2 - JSF 2.0 ViewExpiredException - i've been using jsf 1.2 viewhandler described in reply : icefaces session expiry causes exception useful because when exception occurs page automatically regenerated, public pages. problem is not compatible jsf 2.0. have thought how create work in jsf 2.0 or replacement? edit : i've found solution : stateless jsf, still wondering if there way viewhandler doing in jsf 1.2. here jsf 2.0 current code : public class autoregeneratorviewhandler extends globalresourcesviewhandler { public autoregeneratorviewhandler(viewhandler viewhandler) { super(viewhandler); } @override public uiviewroot restoreview(facescontext p_ocontext, string p_sviewid) { uiviewroot oviewroot = super.restoreview(p_ocontext,p_sviewid); seek { if(oviewroot == null) { initview(p_ocontext); oviewroot = createview(p_ocontext,p_svi...

iphone - Calling methods on a certain UIViewController while another viewController is on the screen? -

iphone - Calling methods on a certain UIViewController while another viewController is on the screen? - i have regular app bunch of view controllers - let's viewcontrollera, viewcontrollerb, , viewcontrollerweb. "viewcontrollerweb" uiwebviewdelegate , has uiwebview in it. phone call methods on when interacting viewcontrollera or viewcontrollerb. (methods [webview stringbyevaluatingjavascriptfromstring:] ) so essentially, seems want "viewcontrollerweb" open in background somehow. know how accomplish this? thinking wrong way? hope guys can help me out! lot! well, if want phone call these methods vc webviewcontroller created, making webviewcontroller global variable. if want access outside vc, create webviewcontroller singleton can access anywhere within app. do: static webviewcontroller *sharedcontroller = nil; + (webviewcontroller*)sharedcontroller { if(sharedcontroller == nil) sharedcontroller = [[webviewcontroller alloc]...

loops - how to practice good ethics while executing many curl requests in php -

loops - how to practice good ethics while executing many curl requests in php - i have done fair amount of reading on , not quite sure right way go is. i accessing websites api provides info using on site. on average making on 400 different api requests means on 400 curl requests. proper way create code pause amount of time continue. site not limit amount of hits on not banned pulling of stuff @ once, not want server when 10,000 people me same thing. trying pause code , politely utilize service offer. what best method pause php execution resource consumption in mind? what courteous amount of requests per wait cycle? what courteous amount of wait per cycle? with of these questions obtain info fast possible while attempting remain in above questions. sample eve central api response thank in advance time , patience. here's thought: have asked? if api has problem handling high load, include limit in terms. if not, i'd recommend emailing service ...

NHibernate Spatial official source control -

NHibernate Spatial official source control - anyone knows official source command scheme nhibernate spatial? in github there one, source diffent nhforge.org, , lastly doesn't back upwards oraclespatial. github's not "compilable". ideas find official? the svn repository at: https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib/trunk/src/nhibernate.spatial hasn't been updated in while... nhibernate oracle-spatial

testing - Switching focus to a Popup window and taking a screenshot -

testing - Switching focus to a Popup window and taking a screenshot - i'm writing testscript in selenium 2 takes screenshot of popup. popup window pdf. after clicking link, i'm using code try { file scrfile = ((takesscreenshot)driver).getscreenshotas(outputtype.file); fileutils.copyfile(scrfile, new file("c:\\tmp\\screenshot.png")); } grab (ioexception e) { e.printstacktrace(); } } to take screenshot, however, takes shot of main page , not popup window. there way have selenium 2, alter focus new popup, take screenshot, , close popup , switch main window? you have switch focus of driver this: string mainwindow = driver.getwindowhandle(); (string handle : driver.getwindowhandles()) { if (!handle.equals(mainwindow)) { driver.switchto().window(handle) //put screenshot phone call here driver.close(); driver.switchto().window(mainwindow); } } this of course of study take screenshot of other windows if...

reverse geocoding - How can I get the customer address from google map? -

reverse geocoding - How can I get the customer address from google map? - i have online shop , people purchase our products , send products address. customers come in bad address , cant find address. want display google map client locate address on map , client address retrieved google map , saved in address filed in shopping card automatically. google offers feature? i see site worked want. find postal address yes, service known reverse geocoding. , it's quite simple implement. assuming lat , long values map click event, so: var map; function initialize() { var mylatlng = new google.maps.latlng(-25.363882,131.044922); var myoptions = { zoom: 4, center: mylatlng, maptypeid: google.maps.maptypeid.roadmap } map = new google.maps.map(document.getelementbyid("map_canvas"), myoptions); google.maps.event.addlistener(map, 'click', function(event) { getaddress(event.latlng); }); } function getaddress(location latlng) { ...

android - Error while using jxl to access Excel files -

android - Error while using jxl to access Excel files - i'm trying write applicate read/write excel spreadsheet files. haven't done serious yet other effort marry jxl java code eclipse android project. i'm getting failure: class="lang-none prettyprint-override"> a fatal error has been detected java runtime environment: internal error (classfileparser.cpp:3494), pid=4868, tid=6000 error: shouldnotreachhere() jre version: 6.0_26-b03 java vm: java hotspot(tm) client vm (20.1-b02 mixed mode windows-x86) my code simply: package com.ulsanonline.gradebook; import java.io.file; import java.io.ioexception; import jxl.cell; import jxl.celltype; import jxl.sheet; import jxl.workbook; import jxl.read.biff.biffexception; import android.app.activity; import android.os.bundle; import android.os.environment; import android.widget.edittext; public class importstudents extends activity { private string inputfile; private gradebookdbadapter ...

Using crow's feet notation in data modelling in enterprise architect -

Using crow's feet notation in data modelling in enterprise architect - i able utilize connectors in enterprise architect traditional 0..* style multiplicity rather crow's feet connectors. i've tried using different drawing styles , still cannot work out how alter connectors. help much appreciated :) i found way utilize crow's foot notation. it's pretty simple. here's how it: right-click data-diagram , select properties (you can in working area straight or through browsing project browser). navigate connectors tab. on right side you'll see little section labeled "connector notation", there select "information engineering" , that's it! data-modeling enterprise-architect multiplicity

authentication - Redirecting a web client from a servlet-filter (client-server connection via AJAX) -

authentication - Redirecting a web client from a servlet-filter (client-server connection via AJAX) - i'm doing web jaasrealm authentication (in tomcat 7). filter servlets: private string loginpage = "welcome.jsp"; @override public void dofilter(servletrequest request, servletresponse response, filterchain filterchain) throws ioexception, servletexception { if ((request instanceof httpservletrequest) && (response instanceof httpservletresponse)) { httpservletrequest httpservletrequest = (httpservletrequest) request; httpservletresponse httpservletresponse = (httpservletresponse) response; if (httpservletrequest.getuserprincipal() == null) { // user not logged in, redirect login page. httpservletrequest.setattribute("from", httpservletrequest.getrequesturi()); httpservletresponse.sendredirect(loginpage); } else { filterchain.dofilter(request, resp...

ruby on rails - Passing parameters to partial view -

ruby on rails - Passing parameters to partial view - i have view displays multiple images , images' associated tags. decided utilize partial view each image , tags, having problem passing in image object partial view. here main view's relevant code: <table> <% @images.each |i| %> <tr> <%= render :partial => :image_tag, :image => %> </tr> <% end %> </table> here partial view's relevant code (partial view named _image_tag.html.erb): <table> <%= image.id %> <%= image_tag image.src %> </table> i read in this thread can pass in image object way doing it. tried passing in id through options hash on render method, , didn't work. error getting is: undefined method `model_name' symbol:class centered around line calling render :partial in main view. <%= render :partial => "image_tag", :locals => {:image => i} %> is how pass...

html - How to Customise select tag? -

html - How to Customise select tag? - possible duplicate: is possible style select box? i want customise select tag image above should looks as in browsers. css: .select-bg { background:url(../images/select-bg.png) no-repeat top center; width:350px; height:47px; } .select-bg select { background:#ff0000; } <div class="select-bg"> <select> <option>1</option> <option>1</option> <option>1</option> <option>1</option> </select> </div> i want the above image background of select box. so, can please help ? what attempting here impossible pure css , html . going need jquery. here list of great list box plugins. one looks 1 , personal favorite. html css image select

c - C99: Will arrays or heap-allocated buffers ever end at UINTPTR_MAX? -

c - C99: Will arrays or heap-allocated buffers ever end at UINTPTR_MAX? - can assume next invariant? void foo(char *buf, size_t len) { // "buf" points either array or memory allocated malloc(). assert((uintptr_t)(buf + len) < uintptr_max); } in parser writing want mark offsets using pointers: illustration might have char *end_of_submessage , end_of_submessage relative current buffer. if submessage not end within current buffer, want utilize value larger offset in current buffer perchance be. do: void parse(char *buf, size_t len, uintptr_t end_of_submessage) { // parsing might increment "buf" // ... // if end_of_submessage == uintptr_max, processing not // triggered if have processed our entire current buffer. if ((uintptr_t)buf >= end_of_submessage) process_submsg_end(); } but scheme thwarted if malloc() returned memory such ptr + len == uintptr_max , or array had same property. safe assume never happen? safe accor...

iphone - Permutations/Anagrams in Objective-C -- I am missing something -

iphone - Permutations/Anagrams in Objective-C -- I am missing something - (code below regarding question) per this stack overflow question used pegolon's approach generating possible permutations of grouping of characters within nsstring. however, trying not generate anagram permutations of same length, possible combinations (any length) of characters in string. would know how alter next code this? much like: generate permutations of lengths -- (for fear of them needing reply homework) did not leave code. have sample of thought @ bottom of post... did not. so, code, is, generates the , teh , hte , het , eth , eht when given the . need along lines of: t , h , e , th , ht , te , he (etc) in add-on above 3 character combinations. how alter this, please. (ps: there 2 methods in this. added allpermutationsarrayofstrings in order results strings, want them, not array of characters in array). assuming magic happen in pc_next_permutation anyway -- thought ment...

http status code 301 - .htaccess 301 redirect -

http status code 301 - .htaccess 301 redirect - does know how can 301 redirect traffic 1 domain other - including same url elements after domain name - , apply same rule possible links without writing each url separately - illustration this: http://www.olddomain.com/catalogue/category/fruits/pg/2.html to redirect to: http://www.newdomain.com/catalogue/category/fruits/pg/2.html at moment have this: rewritecond %{http_host} ^olddomain\.com$ [or] rewritecond %{http_host} ^www\.olddomain\.com$ rewriterule ^/?$ "http\:\/\/www\.newdomain\.com" [r=301,l] but won't work next situation instance: http://www.olddomain.com/login.html it won't redirect new domain , maintain /login.html after. any clues? have tried simply: redirect 301 / http://newdomain.com/ in root folder of olddomain.com .htaccess http-status-code-301

c# - Equivalent to Unix cksum in Windows -

c# - Equivalent to Unix cksum in Windows - i download file , checksum (generated cksum unix command). so, want, in c# app test if checksum in adequation app downloaded. i checked @ unix man page of chsum: cksum command calculates , prints standard output checksum each named file, number of octets in file , filename. cksum uses portable algorithm based on 32-bit cyclic redundancy check. algorithm finds broader spectrum of errors 16-bit algorithms used sum (see sum(1)). crc sum of next expressions, x each byte of file. x^32 + x^26 + x^23 +x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + x^0 results of calculation truncated 32-bit value. number of bytes in file printed. so wrote simple programme sum : byte[] arr = file.readallbytes(@"myapp").toarray(); int cksum = 0; foreach (byte x in arr) { cksum += (x ^ 32 + x ^ 26 + x ^ 23 + x ^ 22 + x ^ 16 + x ^ 12 + x ^ 11 + x ^ 10 + x ^ 8 + x ^ 7 + x ^...

javascript - Select content within a variable instead of within the current DOM with jQuery? -

javascript - Select content within a variable instead of within the current DOM with jQuery? - i have ajax function using jquery defines error function called. when error occurs on server error function runs. 1 of variables passed in "jqxhr" contains property called responsetext. want dump response text div on page, response text contains fully-formed html document. there way utilize jquery traverse variable containing html in same way traverse regular dom? $.ajax({ blah blah blah..., error: function (jqxhr, textstatus, errorthrown) { var errortext = $(jqxhr.responsetext).find('body').html(); // above line not work. errortext null. $('#maincontent').html(errortext); } }); i above code snippet way i'm doing not work. there way traverse variable if dom navigate jquery? update here console.log($(jqxhr.responsetext)) some sweetness discovery me on one. this doesn't work because behind scene...

objective c - How to import and use the .db file in my application in iphone sdk -

objective c - How to import and use the .db file in my application in iphone sdk - i have .db file taken android application, , need utilize .db file in iphone application , access database. can please suggest me how so? thanks. you can utilize sqlite database in iphone application. info on how incorporate it, please see myriad solutions post: add sqlite database iphone app objective-c sqlite3

Matlab question: Displaying math equations in the title of a plot using (la)tex -

Matlab question: Displaying math equations in the title of a plot using (la)tex - possible duplicate: how can create figure title in matlab? i write downwards math equations in m-file in plot such as let define d = 1; in matlab code. want plot title such as title('the solution of equations $f(x,t)=0$ when parameter %d') please advise. title(text('interpreter','latex',... 'string','the solution is: $$\int_0^x\!\int_y df(u,v)$$',... 'position',[.5 .5],... 'fontsize',16)) matlab

c++ - deleting a file with string in the arguments -

c++ - deleting a file with string in the arguments - how can remove file directory in c++ ? i know function int remove ( const char * filename ) deletes file file name specified in argument. accepts char* . there other function in c++ accepts string it's argument ? if have std::string , can const char* calling c_str() fellow member function. the remove function <cstdio> part of c standard library. c has no concept of classes or std::string , hence why function takes const char* , not std::string . c++ string visual-c++

java - Why does AbstractCollection not implement size()? -

java - Why does AbstractCollection not implement size()? - when sub-classing abstractcollection , must still implement size() , though (i believe) there reasonable right (though non-performant) default implementation: public int size() { int count = 0; (iterator<e> = iterator(); i.hasnext();) { i.next(); count++ } homecoming count; } why did designers not include default implementation of size() ? trying forcefulness developers consciously think method, causing developer offer implementation performs improve default? i suspect lastly sentence real reason. when subclassing abstract class it's tempting override abstract methods. expect every implementation have improve implementation iterating - if want pretty much override method, it's thought not provide base of operations (slow) implementation. reduces chances of screwing :) java collections size

video and audio processing library in python -

video and audio processing library in python - which video/audio libraries available in python recognize sound pattern within video recording? i'm trying exclude origin of recording video file (skipping particular sound pattern) , hence i'd need way scan file beginning recognize sound pattern (a particular piece of music same) record/copy rest of video recording point on. video details format :- real media ( not matters though can convert more ) length :- varies 18 - 24 minutes running media info tool on 1 such video gives next details video id : 1 format : realvideo 4 codec id : rv40 codec id/info : based on avc (h.264), real player 9 duration : 19mn 18s bit rate : 195 kbps width : 332 pixels height : 248 pixels display aspect ratio : 4:3 frame...

undefined behavior - Explanation of output of C code -

undefined behavior - Explanation of output of C code - i came across code: #include<stdio.h> void main() { int x; float t; scanf("%f",&t); printf("%d\n",t); x=90; printf("%f\n",x); { x=1; printf("%f\n",x); { x=30; printf("%f\n",x); } printf("%f\n",x); } printf("%f\n",x); } glancing @ thought of undefined output quoted in standards: a warning: printf uses first argument decide how many arguments follow , type is. confused, , wrong answers, if there not plenty arguments of if wrong type. but output didn't allow me leave question without giving sec thought. (input given 23). 23 0 23.000000 23.000000 23.000000 23.000000 23.000000 why 23.00000? compiler trying here? instead of messing around value stored @ x , why print value of t ? have explanation, because there seems def...