Posts

Showing posts from May, 2010

xcode - How to write like query in sqlite ,for iphone app -

i bit confused writing query in sample app iphone .i writing query below not help.i dont know wrong in query. the str_id passing july here in db not saving whole word july need compare first 3 words in query(so cant use select * tbl month = jul ,so use "like" query ) const char *sql = [[nsstring stringwithformat:@"select tourid, tourname, firstname, lastname, notes, date, issale, image, solidamount, soliddate, ispaid salesdataentry month %@",str_id]utf8string]; hope clear question. i think should check out nspredicate documentation , , introduction predicates programming guide

objective c - Twitter-client-like NSCollectionView implementation on OS X (>=10.6)? -

i'm trying subclass nscollectionview imitate behaviors of uitableview twitter does. i've been trying subclass/hack amcollectionview , “has lot less features.” amcollectionview used immutable array populate data items, however, visioned twitter table/list, data arrays mutable, , should support insertion , removal uitableview does. btw, i'm still struggling key-value binding stuff. suggestion/solution/example code nscollectionview appreciated. thank you. twitter released twui libs .

osx - 'The Java JAR file "NetC.jar" could not be launched.' -

mac powerpc osx 10.5 i trying open .jar file ppc keep getting error : the java jar file "netc.jar" not launched.' i downloaded java 5 . i went " java preferences " , made sure set java 5 . rebooted ppc well. below error when try run command in terminal: salvador-castros-power-mac-g4:netc-0.2.0 becky$ java -jar netc.jar exception in thread "main" java.lang.unsupportedclassversionerror: bad version number in .class file @ java.lang.classloader.defineclass2(native method) @ java.lang.classloader.defineclass(classloader.java:775) @ java.security.secureclassloader.defineclass(secureclassloader.java:160) @ java.net.urlclassloader.defineclass(urlclassloader.java:254) @ java.net.urlclassloader.access$100(urlclassloader.java:56) @ java.net.urlclassloader$1.run(urlclassloader.java:195) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloa...

arrays - Is Linked List an ADT or is it a Data Structure, or both? -

if use standard definition of abstract data type black box provides functions manage collection of data, linked list fits description: a container offers functions add(x) , get(i) (among others) can used maintain list of objects. but when ask question, time complexity of these operations, realize depends on how container implemented: if internally maintain link head node, above 2 operations perform in o(n) time. if additionally maintain link tail node, you'll o(1) time on both. so question is, learning purposes, consider linked list adt or data structure? this question came when trying implement stack adt skiena's algorithm design manual, , reading how performance of it's put(x) , get() methods depend on data structure chosen implement it. book says in case doesn't matter if choose array or linked list data structure implement adt, both offer similar performance. but they? doesn't depend on how link list implemented? there many ways implement linked...

unit testing - Android autobuild + tests -

what easiest way run autobuild of android app, includes compiling, running tests , creating apk file (using ant)? thanks! use android tool sdk. if have that's running project in eclipse need run android project in base directory of project: android update project --path . and should generate ant build scripts needed able build debug , release apks command line. as testing, there's options create new test project using android tool: http://developer.android.com/guide/developing/testing/testing_otheride.html docs in there go through details automating , setting test projects. if you're looking way automate stuff check out 1 of continuous integration servers, jenkins (http://jenkins-ci.org/) they're tailored watch software repository, automate actions, , monitor output.

javascript - How to get real exception message when using UpdatePanel? -

i'm not seeing real error in custom error page when using updatepanel. in global.asax have following code: sub application_error(byval sender object, byval e eventargs) 'get exception dim lasterror = server.getlasterror() if lasterror isnot nothing dim ex exception = lasterror.getbaseexception() if ex isnot nothing 'log error if log.iserrorenabled log4net.threadcontext.properties("method") = ex.targetsite.name log4net.threadcontext.properties("userid") = user.current.username log.error(ex.message, ex) end if end if end if end sub if review log or set breakpoint can see i'm getting timeout issue. have following code send user error page , display error: <script language="javascript" type="text/javascript"> function endrequesthandler(sender, args) { if (args.get_error() != undefine...

android - Is "ANR" an exception or an error or what? -

is anr exception, error or what? can catch in try{} catch(){} structure? anr (application not responding) not error. shown when application sluggish , takes lot of time respond, making user wait. user won't appreciate if application makes them wait long time. so, android framework gives user option of closing application. http://developer.android.com/guide/practices/design/responsiveness.html this occurs when doing long running operations on main thread. system can't process user interactions during period since main thread blocked. solution heavy operations in worker thread , keep main thread free.

C++ COM Interop: Using C# namespace with dot notation in c++ -

i have c# namespace defined a.b.c tried using in c++ header using namespace a::b::c; and error c2653: not class or namespace. the unmanaged project referencing managed project namespace. how around this? tia. com interop doesn't let that. com interop lets retrieve c++ com interface pointer .net object, using e.g. cocreateinstance . if want refer c# namespaces , types directly (not through com interface pointer), want c++/cli (the /clr option visual c++).

.net - WCF error when sending special characters -

i have simple wcf service analyse raw text extracted .pdf or .doc file. 99% of uploaded string ok in cases, server raise bad request exception the remote server returned unexpected response: (400) bad request. after investigating faulty text, did find out problem related form feed character (ascii / unicode #12). the easy solution remove characters before uploading string in case, don't have control on every clients consume wcf service. so, there server side alternative allow me upload special characters (and other character might lead the same exception)? if using basic or wshttp binding, safe way pass kind of strings around use base64 encoding on both client , server side. in case suggest using byte[] in terms serialized base64 string. unfortunately there no way handle bad requests on server side, know about.

iphone - Objective-c pointers -

i don't know how delete pointer not object, example: have class: @interface model : nsobject { nsmutablearray *tab; } and when this: model1 = [[model alloc]init]; nsmutablearray * tab2 = [model1 tab]; ... operations ... i want delete pointer tab *tab2, when i'm releasing tab2, tab releasing too. in c++ when i'm clearing this: int =10; *w = &a; and when i'm deleting pointer delete w; and variable still in memory , that's ok. should in obj-c delete pointer? in situation objective-c, there's no reason delete pointer. let fall out of scope. you're not allocating new objets. you're not making copy of tab. you're not retaining it. you're creating pointer original tab object. if like, can set tab2 = nil doesn't matter either way. in second c++ example, i'm not certain, you're falling undefined behavior because of fact code example gave works on compiler tested! not valid c++ delete pointer not created...

php - Update database field to -1 of current value -

i haven't been able come clear answer on this, figure before give up, ask here. i'm looking update database field 1 less current value without having query database, write code math, update database new value. is possible, or have make own function so? update 'table' set 'field' = 'field' - 1 'id' = 2

java - XmlJavaTypeAdapter and enunciate? -

i'm having hard time running enunciate on project. project multi-module maven project, available https://svn.opentripplanner.org/trunk . want out of enunciate api docs. nothing else. used have working via maven , hudson, broke while ago, , person set isn't available. really, prefer via command-line interface, if has maven solution, i'll take it. my enunciate command-line is: /home/novalis/otp/enunciate-1.23/bin/enunciate -v -f /home/novalis/otp/workspace/opentripplanner/opentripplanner-api-webapp/enunciate.xml `find /home/novalis/otp/workspace/opentripplanner/ -name *.java -type f |grep -v /test/` my enunciate.xml looks this: <enunciate xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="http://enunciate.codehaus.org/schemas/enunciate-1.17.xsd"> <services> <rest> <content-types> <content-type type="text/plain" id="txt"/>...

indexing - Jquery index can't find element (-1) wrong input (with live function) -

i index of li element. li elements created after page loaded. jquery returns -1 not found error. the structure html (found in dom, not in page source): <div id="warp-expand"> <ul> <li><div class="song"><div class="list_b"></div><a>test1</a></div></li> <li><div class="song"><div class="list_b"></div><a>test2</a></div></li> </ul> </div> jquery li index: $("#warp-expand ul li a").live('click',function () { var x = $("warp-expand ul li").index(this); alert(x); //returns -1 }); how li's made: $("#playlister").click(function () { $("#jp_playlist_2 ul li").each(function() { var s = $(this).text(); $('#warp-expand ul').append('<li><div class="song"><div class="list_b">...

Load Testing for Django Application -

i have been looking tool load test django application. wondering if there go 1 django web applications. required login , place various requests site multiple users , see how site scales traffic. i have come across following framweworks: seige jmeter funkload i wondering if community had opinions on best, , fit best django web application. i welcome suggestions haven't mentioned well. please , thank you if don't need use javascript, , aren't looking test web server, i'm huge fan of mechanize exact reason. spawn off several instances of mechanize traverse site, , can idea of performance issues lie. that said, if need javascript anything, mechanize not work has no ability handle javascript. in case need use selenium or webdriver. i've combined selenium nunit extremely great success. can run several selenium instances , use selenium-rc remotely track/control them. if have cash, browsermob fantastic job of you. if need test web server, no f...

flex - How to keep a list from scrolling on dataProvider refresh/update/change? -

i have simple list , background refresh protocol. when list scrolled down, refresh scrolls top. want stop this. i have tried catching collection_change event , validatenow(); // try component reset new data list.ensureindexisvisible(previousindex); // actually, search previous data id in ilist, that's not important this fails because list resets after change (in datagroup.commitproperties). i hate use timer, enter_frame, or calllater(), cannot seem figure out way. the other alternatives can see sub-classing list can catch dataproviderchanged event datagroup in skin throwing. any ideas? i ll try explain approach...if still unsure let me know , ll give source code well. 1) create variable store current scroll position of viewport. 2) add event listener event.change , mouseevent.mouse_wheel on scroller , update variable created in step 1 current scroll position; 3) add event listener on viewport flexevent.updatecomplete , set scroll position varia...

How can I use jclcompression in Delphi, is there any example? -

i installed jclcompressin component yesterday. when use there error "load 7z.dll". has example code using jclcompressıon unit? if compress text file? in order work jclcompression unit must have 7z.dll file in same path exe located. can file downloding 7zip installer here ( remember use 32-bit x86 version of dll ). for samples using unit can check project located in folder <path jcl library>\jcl\examples\windows\compression\archive or can check question using 7-zip delphi?

c - Update FILEVERSION in resource file at build -

i have unmanaged program (fortran) i'm adding version.rc resource file include version information. there way update last number of version information @ build time random number generated @ each build? example. fileversion = <major>,<minor>,<rev>,<build_hash> where updated @ each build , others input. this question similar programmatically updating fileversion in mfc app w/svn revision number except not svn number. as @hans suggested above. best approach add pre-build event in visual studio runs script (perl in case) reach *.rc file , change random number.

iphone - Tab Bar Controller Customization and "More" Problem -

here's problem: i have tab bar controller customized tab item highlights yellow instead of default blue. what's wrong "more" item comes because have many tab items (removing them not option), , "more" still blue. i used classes got internet implement customization. here code: // uitabbar+colorextensions.m @implementation uitabbar (colorextensions) - (void)recoloritemswithcolor:(uicolor *)color shadowcolor:(uicolor *)shadowcolor shadowoffset:(cgsize)shadowoffset shadowblur:(cgfloat)shadowblur { cgcolorref cgcolor = [color cgcolor]; cgcolorref cgshadowcolor = [shadowcolor cgcolor]; (uitabbaritem *item in [self items]) if ([item respondstoselector:@selector(selectedimage)] && [item respondstoselector:@selector(setselectedimage:)] && [item respondstoselector:@selector(_updateview)]) { cgrect contextrect; contextrect.origin.x = 0.0f; contextrect.origin.y = 0.0f; contextrect.siz...

ruby - Stripping commas from Integers or decimals in rails -

is there gsub equivalent integers or decimals? should gsub work integers? i'm trying enter decimal ruby form , user able use commas. example, want user able enter 1,000.99. i've tried using before_save :strip_commas def strip_commas self.number = self.number.gsub(",", "") end but following error "undefined method `gsub' 8:fixnum" "8" replaced whatever number user enters. if field fixnum, never have commas, rails have convert user input number in order store there. however, calling to_i on input string, not want. overriding normal setter like def price=(num) num.gsub!(',','') if num.is_a?(string) self[:price] = num.to_i end not tested, resembling should work... you need @ commas while input still string. edit: noted in comments, if want accept decimals, , create not integer, need different conversion string.to_i . also, different countries have different conventions numeric pu...

java - Override dependencies of third party jar in maven -

like org.carrot2 depending on commons-httpclient 3.1 how can change commons-httpclient 3.1 httpclient 4.1.1 . working in eclipse. want remove commons-httpclient:3.1 depending on jar file , want replace httpclient 4.1.1 . so trying do.. doubled click on org.carrot2 dependency hierarchy folder , went pom.xml file , trying change commons-httpclient 3.1 httpclient 4.1.1 not allowing me change backspace , delete not working on that.. any suggestions appreciated.. firstly please ensure mentioned artifact can work httpclient 4.1.1 . we can define " the exclusion " each dependency mentioned @ http://maven.apache.org/pom.html#exclusions exclusions explicitly tell maven don't want include specified project dependency of dependency (in other words, transitive dependency) exclusions : exclusions contain 1 or more exclusion elements, each containing groupid , artifactid denoting dependency exclude. unlike optional, may or may not ...

javascript - What are some good tools, if any, for Gtk3 / Gnome Shell theme/extension development? -

i seasoned web developer (xhtml/css/javascript/x-browser), , have installed fedora 15. fedora on bleeding edge, , ships gnome 3 / gnome shell default desktop. know gnome3, gtk3, mutter, , gnome shell use web technologies theming , extensions. there editor/ide developing , testing these themes/extensions? working on suite of rubles in eclipse/aptana purpose, save time if knows better tools. gtk3 uses web alike technology looks css not. and no, @ moment gtk3 not have tools , not documentation it's theming layer. it's done trial , error cloning theme , playing it.

Using GET Query Strings with Expressionengine and Structure -

i trying set pagination on 1 of ee structure pages , query string results in 404 error. think has .htaccess file cant figure out. here .htaccess file, i'm using exclude method removing index.php url, rewritecond $1 !^(images|system|themes|modules|scripts|uploads|css|favicon\.ico|robots\.txt|index\.php|sitemap\.php|sitemap\.xml) [nc] rewriterule ^(.*)$ /index.php/$1 [qsa,l] so if add simple query like, /account/?page=2 i 404 error... thanks guys can offer! yes, it's trying find template named "?page=2" , doesn't throws 404 error. try using index.php filename in url: /account/index.php?page=2. or, make url variables segments , use {segment_#} parse them. so, /account/page2/ , use {segment_2} in template variable.

c# - HtmlAgilityPack - how to grab <DIV> data in a large web page -

i trying grab data webpage , <div> particular class <div class="personal_info"> has 10 similar <div> s , of same class "personal_info" ( shown in html code , want extract divs of class personal_info in 10 - 15 in every webpage . <div class="personal_info"><span class="bold">rama anand</span><br><br> mobile: 9916184586<br>rama_asset@hotmail.com<br> bangalore</div> to needful started using html agile pack suggested 1 in stack overflow , stuck @ beginning self bcoz of lack of knowledge in htmlagilepack c# code goes htmlagilitypack.htmldocument dochtml = new htmlagilitypack.htmldocument(); htmlagilitypack.htmlweb dochfile = new htmlweb(); dochtml = dochfile.load("http://127.0.0.1/2.html"); then how code further data div class "personal_info" can grabbed ... suggestion example appreciated i can't check ri...

c++ - delete[] Array of characters -

possible duplicate: delete[] supplied modified new-ed pointer. undefined behaviour? let's i've allocated handful of characters using new char[number] . will possible delete few end characters (something delete[] (chararray + 4); , supposedly de-allocate of characters except first four)? i read implementations' new[] store number of objects allocated before array of objects delete[] knows how many objects de-allocate, it's unsafe i'm asking... thanks. edit: is manually deleting unwanted end bytes using separate delete statements safe way i'm asking? the "safe" way allocate new array, copy data, , delete old one. or follow std::vector way , differentiate between "capacity" (the size of array) , "size" (the amount of elements in it).

ruby on rails - Nesting Resources 3 Levels Deep -

i have idea of going wrong, having trouble fixing it. to explain situation again, have 3 elements : jobs, questions , answers . of relationships set below. expanding on previous question had jobs > questions relationship, have added answers relationship in jobs > questions > answers. so, new resource in routes.rb getting routing errors, fixing going. problem occurred when got form answers#new page , had modify form_for scaffolding , build on create action in answers controller ( can see code 2 below). i able fix enough show form on new answers page, when click submit getting error: no route matches {:action=>"show", :controller=>"answers", :job_id=>nil, :question_id=>1, :id=>#<answer id: 3, job_id: nil, question_id: 1, answer1: "", answer2: "", answer3: "", answer4: "", answer5: "", created_at: "2011-07-01 03:12:06", updated_at: "2011-07-01 03:12:06">} ...

javascript - jquery if check long object -

i know dojo has feature, how jquery or other libraries? $.ifobject(foo.bar.baz.qux[0]) if (foo && foo.bar && foo.bar.baz && foo.bar.baz.qux[0]) assuming arbitrary size of object nesting, i'm looking sugar function check whether or not object i'm looking defined, , not crash server along way. in case want dive coffee script, has great feature in ? operator. if foo?.bar?.baz?.qux?[0] alert 'yay!' which compiles nasty, yet efficient, javascript var _ref, _ref2, _ref3; if (typeof foo !== "undefined" && foo !== null ? (_ref = foo.bar) != null ? (_ref2 = _ref.baz) != null ? (_ref3 = _ref2.qux) != null ? _ref3[0] : void 0 : void 0 : void 0 : void 0) { alert('yay!'); }

java - Head First Design Patterns - Combined Pattern -

i'm reading chapter 12 on combined pattern in head first design patterns. on page 541,the sample djview,it cant't run correctly in computer.when press 'start', program sounds once rather circularly . i'm not sure whether because of environment of system. if add 1 line code in method meta of class beatmodel ,it works.like: public void meta(metamessage message) { if (message.gettype() == 47) { beatevent(); sequencer.setmicrosecondposition(0); //add line sequencer.start(); setbpm(getbpm()); } } can tell me why? i'm confused,is wrong code given book or other reason? me . in advance!! so sorry,the code long not put here,you download offical website,here link http://www.headfirstlabs.com/books/hfdp/headfirstdesignpatterns_code102507.zip can find sample in folder '\headfirstdesignpatterns_code102507\hf_dp\src\headfirst\combined\djview'. run class djtestdrive.java forward h...

regex - TCL regexp example -

i want word in string starts abc_ or xyz_ writing regexp. here script: [regexp -nocase -- {.*\s+(abc_|xyz_\s+)\s+.*} $str necessarystr] so if apply above written regexp on str1 , str2 want "xyz_hello" $str1 , "abc_bye" $str2. set str1 "gfrdgasjklh dlasd =-0-489 xyz_hello sddf 89rn sf n9" set str2 "dytfasjklh abc_bye dlasd =-0tyj-489 sddf tyj89rn sjf n9" but regexps not work. , questions are: 1) wrong regexp? 2) find works starting predefined prefixes regexp or better use string functions (string match or so)? it not clear in question consitutes word. further underscores permitted? digits permitted? "words consist of prefix", e.g. "abc_" or "xyz"? making conservative assumptions (based on examples) expecting letters english alphabet, @ least 1 further character, , don't care case, can simplify regexp: [regexp -nocase -- {\m(abc_|xyz_)[a-za-z]+} $str match] this set match matching word...

how to split Excel file using java? -

i have excel sheet 200000 rows.i want splits excel file each 50000 records. using apache poi api read , write excel file.is possible split file if number of row reaches on defined record size.please me solution problem. code: public string[][] getsheetdata(int sheetindex) { int noofcolumns = 0;xssfrow row = null; xssfcell cell = null; int i=0;int noofrows=0; int j=0; string[][] data=null; xssfsheet sheet=null; try { loadfile(); //load give excel if(validateindex(sheetindex)) { sheet = workbook.getsheetat(sheetindex); noofcolumns = getnumberofcolumns(sheetindex); noofrows =getnumberofrows(sheetindex)+1; data = new string[noofrows][noofcolumns]; iterator rowiter = sheet.rowiterator(); while(rowiter.hasnext()) ...

ruby - Handling javascript popups in watir using an event driven mechanism -

i have scenario trying automate data entry/retrieval into/from form. form consists of buttons support general add/edit/delete operations on data. well, problem have depending upon entries user enters (e.g. duplicate entries, incorrect password/login id), pop-up triggered. need obtain text appearing in popup , dismiss it. i used following links on how handle them javascript popup handling discussion on popup handling in watir . i saw lot of solutions javascript pop-ups (either using auto-it or without using it). from understand, a) solution 2 on wiki starts off process , polls whether popup appears every 1 second. b) solutions 3,4,5 write handler dismiss popups know in advance when popup going appear. c) trying make sense of solution 7 posted tony, pointers on appreciated. in scenario described, popups generated dynamically click of button, solution 2 seems right option, polling appearing of popup seems overkill. know ruby not provide native support event handlin...

javascript - how to set default focus on the submit button in a popup window -

please me someone,,,, i write code popup window using following code. <div id="email_confirmation_pending" class="popupcontact" style="z-index:10003;"> <div class="popup_textarea"> <h3><h:outputlabel value="#{labelmsgs.emailpendinglabel}"/></h3> <div class="verifyemailtext"> <h:outputlabel value="#{labelmsgs.clicktosendemail}"/> <span class="fontitalic"><h:outputlabel value="#{headerbean.emailaddress}."/></span> <br /><br /> </div> <div class="suspendedboxmsg"> <h:outputlabel value="#{labelmsgs.accountsuspend}"/><br /> <h3><h:ou...

iphone - uiwebview not loading the web page -

in program uiwebview not loading url address.when nslogged request object not null.however when nslog webview.request returns null.what may reason not loading - (void)viewdidload { [super viewdidload]; self.web = [[uiwebview alloc] init]; nsstring *urladdress = @"http://www.google.com"; nsurl *url = [nsurl urlwithstring:urladdress]; nsurlrequest *requestobj = [nsurlrequest requestwithurl:url]; nslog(@"%@",requestobj); [self.web loadrequest:requestobj]; [web setframe:cgrectmake(0, 0, 320, 370)]; nslog(@"%@ %@",self.web,self.web.request); } the nslog results <nsurlrequest http://www.google.com> <uiwebview: 0xbb17ff0; frame = (0 0; 320 370); layer = <calayer: 0xbb12f20>> (null) as per suggestions site changed ib , made code .i made class confirm uiwebview delegate..both webviewdidstart , webview did finish being called these nslog outputs these ...

Does Reset.css affects other stylesheets? -

i starting new project, thought start using reset.css in projects. got concept of using reset.css, 1 thing bothering me if affects other style applied on same element.. in reset.css div have 0 margin , 0 padding... , if apply margin of divs in stylesheet, wont disturbed? please clear doubt not if style applied other divs more specific. http://coding.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/ in general style applied using class, or id in selector going take precedence on 1 doesn't. there many other rules in area should become aware of. i.e. div.mystyle {...} will overrule div {...}

.net - What can cause slow run at debug mode? -

i had issues debugging complex integration test in our application. test involves setting environment, deploying database , tested code uses lot of database queries nhibernate, spring.net (di, aop, transactions, ...), multithreading , network activity when communicating integration platform (includes calls native dlls). i have 2 systems work same code base: notebook i7 (2 cores ht = 4 logical cpus), 4gb ram, 5400 rpm disk, win 7 64bit virtual machine (oracle virtual box) host: i7 (4 cores ht = 8 logical cpus, 12 gb ram, system runs ssd, virtual machine 7200 rpm disk, win 7 64bit) virtual machine: 4 cores assigned, 8 gb ram assigned, win 2008 r2 enterprise (64 bit) vpn network communication no other virtual machine runs on host now if run test without debugging execution time same 12-15s (so network communication should not issue) if run test debugging takes less 2 minutes on notebook more 4 minutes on virtual machine (i need debug code @ end of test). expect virt...

Emacs feature similar to JEdit's indent folding mode? -

possible duplicate: emacs equivalent of vim's foldmethod = indent jedit has mode (specifically, folding mode: indent, in options) lets fold code blocks based purely on indentation . not require additional configuration, or knowledge of language using. that is, if have code this: foo bar blah oof and cursor on second or third line, , tell jedit fold, 2 lines hidden. i have read similar questions, haven't found in emacs "just works", buffer, jedit's code folding does. i have tried fold dwim. doesn't work me. folds right end of buffer, reason, utterly useless. take @ minor mode folding-mode

php - Magento plural support -

anybody knows whether magento utilizes zend's plural in templates? far haven't found traces in code i want make use of display 1 review , 3 reviews unfortunately, magento doesn't support mechanism.

jquery - How to Iterate Over JavaScript Object and Display results In Specified Place? -

i have object replies : [object { content="comment #1."}, object { content="comment #2."}] and have selector selects place content should placed... $('.post .comment_this[rel="3"]').parent().parent().append(encoded.content + '<br />'); how iterate on object , display results in place 1 one? replies array, can use simple for loop: var $target = $('.post .comment_this[rel="3"]').parent().parent(); for(var = 0, l = replies.length; < l; i++) { $target.append(replies[i].content + '<br />'); }

c# - how to disable displaying time in datatype smalldatetime -

i have textbox should inserting date in dd/mm/yyyy format. can find , use smalldatetime or datetime. pick smalldatetime , data displayed example 01/07/2011 12:00:00 am. codes involved sort out displaying 01/07/2011 (without time)? sqljobmaster.insertparameters["startdate"].defaultvalue = txtstartdate.text.tostring(); asp.net start date use tostring("dd/mm/yyyy"); . formatted way want to.

javascript - Ajax Popup Control -

basically have is: a user joins room creator of room has ability kick people. i know can execute close pop command on user thats when has window active. if user closed window it's no problem since window closed. there anyway close pop while not have active? have ever tried develop chat application? regularly check database new message , updates chatboxes on either side. can same thing lil bit of customization. when user enters chatroom, far understand ur text, in new window. so, while launching new window, save handle it. this: var mywindow = window.open("foo.html","windowname"); now have ajax script on parent page regularly checks server commands. when want user kick out of room, make signal server point (maybe database or file) ajax script consulting. now, ajax gets signal, make fire close signal this: mywindow.close(); this 1 solution. best thing here instead of closing window, may redirect window more informative page tells him ...

Php adding xml for no reason -

i calling database query , using foreach loop display results, causing w3c error , on inspection have found adding '<?xml version="1.0" encoding="utf-8"?>' first echo...i have no idea why?? have moved php top of file body still same problem :( can me? where seeing <xml ... > header? note if viewing in browser source, browser automatically add if doctype xhtml.

jQuery Validation - error placement -

i'm trying use 'errorplacement' jquery validation docs : $("#myform").validate({ errorplacement: function(error, element) { error.appendto( element.parent("td").next("td") ); }, debug:true }) i want place error before not valid input, not work: $("#myform").validate({ errorplacement: function(error, element) { error.appendto( element.parent("form").prev("input") ); }, debug:true }) live demo any appreciated! since want insert error message before invalid element, use insertbefore() : errorplacement: function(error, element) { error.insertbefore(element); }

powershell - extract values from printlog file , getting user and pagecount from a specific printer -

is there easy way per user total pages have printed on specific printer. , put them in text or csv file? printserver have windows 2008 32 bits os. in 2008 ad enviroment regards dennis this easy value each computer, using performance counter cmdlets built powershell v2. it's less easy match these values set of users, active directory should lot of help. get-counter counter values, , list counters exist. 1 liner gives print queue counters: get-counter -listset "*print*" | select-object -expandproperty paths to see how many pages computer has printed, use: get-counter '\print queue(*)\total pages printed' hope helps

php - Varchar values to numerical classification -

i have database containing 3 tables: practices - 8 fields patients - 47 fields exacerbations - 11 fields the majority of fields in these tables recorded in varchar format, other fields include integers, doubles , dates. i have transform data numerically classified data can used statistician extrapolate patterns in data. acheive have convert varchar fields integers represent classification string belongs to, example being 'severity' has following possible string values: mild moderate severe very severe this field in patients table has finite list of string values can appear, other fields have endless possibility of string values cannot classified until encountered database (unless implement form of intelligent approach). for time being trying construct best approach converting each field entries in each of 3 tables numeric values. pseudo code have in head far follows (it's not complete): function profiledatabase each table in database e...

ios - How to send IplImage from server to iPod client UIImage via TCP -

i have server in linux using berkeley_sockets , create tcp connection ipod client. have iplimage* img; send server ipod. use write(socket,/*data*/,43200); command , data tried send is: reinterpret_cast<char*>(img) , img , img->imagedata . of choices send kind of data. on ipod side receive data way (as i've seen here in so. don't mind complicated stuff, it's receiving data single image.): bytesread = [istream read: (char*)[buffer mutablebytes] + totalbytesread maxlength: 43200 - totalbytesread]; after receiving whole image, have this: [buffer setlength: 43200]; nsdata *imagem = [nsdata datawithbytes:buffer length:43200]; uiimage *final= [self uiimagefromiplimage:imagem]; now.. know have opencv working on ipod, can't find simple explanation on how work, used the second code webpage , adapted it, since know specifications of image (for instance set variables cgimagecreate() function.): - (uiimage *)uiimagefromiplimage:(nsdata *)image { cgcol...

how to create uncollectable garbage in python? -

i have large long-running server, and, on weeks memory usage steadily climbs. generally, pointed out below, unlikely leaks problem; however, have not got lot go on want see if there leaks. getting @ console output tricky i'm not running gc.set_debug() . not big problem though, have added api run gc.collect() , iterate through gc.garbage , send results out me on http. my problem running locally short time gc.garbage empty. can't test bit of code lists leaks before deploy it. is there trivial recipe creating uncollectable bit of garbage can test code lists garbage? any cycle of finalizable objects (that is, objects __del__ method) uncollectable (because garbage collector not know order run finalizers in): >>> class finalizable: ... def __del__(self): pass ... >>> = finalizable() >>> b = finalizable() >>> a.x = b >>> b.x = >>> del >>> del b >>> import gc >>> gc.collect...

java - Collections.emptyList() instead of null check? -

if have used collection in class may instantiated many times, may resort following "idiom" in order save unnecessary object creations: list<object> list = null; void add(object object) { if (list == null) list = new arraylist<object>(); list.add(object); } // somewhere else if (list != null) (object object : list) ; now wondering if couldn't eliminate null checks using collections.emptylist() , have alter if check in add() so: if (list == collections.<object>emptylist()) list = new arraylist<object>(); is there better way handle other allocating new empty collection every time? edit: clear, would like use collections.emptylist(), above check in add() really ugly... wondering if there's better way or whole other way of handling this. in order save unnecessary object creations that's bad idea litter code == null checks , other handling of corner cases (and presumably end in ...

Multiline Balloon Hints in Delphi -

Image
i changing applications tooltips use balloonhints. test using single line , displayed nicely. when hint text multi-line (i.e existing hints ... 'this test' + #13 + 'hello'+ #13 + 'hello'+ #13 + 'hello'+ #13 + 'hello' when displayed in balloonhint, size wrong , whole list of entries offset disappear. anyone got helpful suggestions ? update: seems title messes display up. i'll report in qc. so knew if put #13#10 properties inspector that's putting characters literally string. way instead: procedure tform2.formcreate(sender: tobject); begin button1.hint := 'this test' + #13 + 'hello'+ #13 + 'hello'+ #13 + 'hello'+ #13 + 'hello'; end; when try in delphi xe, looks fine me. tms's hint component nicer -- if can switch else, try that. try tjvballoonhint in jvcl.

php - How does phpunit command make search class testing? -

i use windows. example have website structure smth this: site/ engine/ modelclass.php www/ index.php tests/ modelcalsstest.php phpunit.bat where should store phpunit.bat run test modelclasstest.php? you should not need store phpunit.bat @ all. should in path . just install via pear , done. if don't want , have locally on system or want phpunit sources in version control (some people want that) doesn't matter phpunit.bat really. project root fine, somewhere in vendor/phpunit/phpunit.bat fine if have ant or phing or .bat file in project root lets "run tests now" . what observe "best-practice" put phpunit.xml.dist (the config file) in application root people can just: get source type phpunit see works see: a sample project made phpunit author what i've seen people put config file in "tests" folder have "clean project root". works out nicely. references: documentation...

How to get dates from date to to date in MS-ACCESS and JSP? -

this query: string query1="select * demand_register payment_date> ='"+fromdate+"' , payment_date<='"+todate+"' " ; if todate=23/6/2011 , fromdate=25/6/2011 retrieves data of dates 24 , 25 not 23? if todate=23/6/2011 , fromdate=23/6/2011 retrieves nothing. thanks in advance. dates in access/jet/ace stored not text representation double, integer part day since 12/30/1899 , decimal part time. dates have time portion. if have been using now() populate field in question, or otherwise storing time part other 0 in field, won't exact match. instead, you'll have use this: todate>=#23/6/2011# , todate<#24/6/2011# , fromdate>=#25/6/2011# , fromdate<#26/6/2011# this include todate values day 23/6/2011 have time portion. now, question why including time part other 0 in fields name todate , fromdate -- if dates, should have time part. if you're populating dates in access or via jet/ace sql, c...

actionscript 3 - Spark images in spark list with TileLayout disappear on scroll and drag in Flex app -

i have renderer looks this: <s:itemrenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" autodrawbackground="true"> <s:group width="160" tooltip="{data.tooltip}" doubleclickenabled="true"> <s:layout> <s:verticallayout gap="5" horizontalalign="center" paddingbottom="2" paddingleft="2" paddingright="2" paddingtop="2"/> </s:layout> <mx:canvas width="156" height="156" borderstyle="solid" bordercolor="#aaaaaa" verticalscrollpolicy="off" horizontalscrollpolicy="off"> <mx:image id="image" source="{data.thumbnail}...

java - Reversing string and toggle lower-upper-case -

i need write application takes string input. after processing, should print out string reversed, , characters switched lower uppercase , vise versa. want achieve using stringbuilder . sample run: input: hello human output: namuh olleh here straight forward , simple way of solving problem: read user input using instance scanner class. , nextline() method. (construct scanner giving system.in argument.) create stringbuilder . fetch array of characters input string, using instance input.tochararray() reverse array arrays.aslist , collections.reverse collections.reverse(arrays.aslist(yourchararray)); loop through list using instance for-each loop. for (character c : yourchararray) { ... } for each character, check if c.isuppercase (if append c.tolowercase() ) else append c.touppercase() . (an alternative approach give stringbuilder input-string argument, , manipulate string in-place using reverse , charat , setcharat methods.)

How to link to class methods in doxygen html -

i've got setup use doxygen describe set on unit tests (i use qttest run tests). output tests parsed little python snippet produces nice , tidy report. now, i'd love link report each test case, i.e. private slot member method, in doxygen material. however, anchors defined doxygen looks this: <a class="anchor" id="a2a0e066d4dad8e0dff6c9231bf65fd65"></a> <!-- doxytag: member="pradiotunertst::scanfm" ref="a2a0e066d4dad8e0dff6c9231bf65fd65" args="()" --> sure, parse doxygen html , match method reference key, i'd rather have readable links. not overload unit test case methods, having them enumerated not issue - i'd able pick first , only. i'd happy calculate id hash myself. need know how to. so, basically, questions is: does know how tune doxygen generate readable anchors if not, how calculate hash? instead of trying reconstruct hash (which md5 checksum on method's definition ...

datetime - convert mmm to numeric in R -

i have been given csv column called month char variable first 3 letters of month. e.g. "jan", "feb","mar",..."dec". is there way convert numeric representation of month, 1 12, or type in date format? thanks. use match , predefined vector month.abb : tst <- c("jan","mar","dec") match(tst,month.abb) [1] 1 3 12

javascript - clearTimeout is not working -

settimeout not working follwing code: $("#clkdblclk").click(function(){ var clicktimer=settimeout(function(){ //some code execute },1000); $(this).data("clicktimer",clicktimer); }); $("#clkdblclk").dblclick(function(){ var clicktimer=$(this).data("clicktimer"); cleartimeout(clicktimer); //some ajaxrequest }); the element registered both click , double click events.to cancel out click event on doubleclick, settimeout function registered.i ineger timer id in double click method, cleartimeout not cancelling out function execute. i'm not getting error. in advance. there no way distinguish between click , double-click, every double-click also triggers 2 separate click events. each of those click events also starting settimeout , overwrites .data('clicktimer') value. here's proof: http://jsfiddle.net/mattball/az6zy/ one s...

php - Passing data between webpages -

i have webpage form on it. heading of form this: <form name="sw" method ="post" action="logger1.php"> after event has happened, javascript function submits form this: document.forms["sw"].submit(); the php file logs data form in text file on server, , redirects browser page. issue want examine 1 of values in form previous page on page browser redirected to. lost. help! you can append ?info=hello end of url redirects to, retrieve in php $_get['info']

tell sharpdevelop to use unix line endings? -

is there option tell sharpdevelop (specifically version 3.2.1) save files in unix line endings? i want automatically convert dos endings unix endings when saves. oops. missed option first time looked. tools > options > general > load/save ; there see dropbox specify line endings

'Unable to connect to remote host: No route to host' through SVN protocol -

i want checkout work copy svn server cmd 'svn co svn:///mypro', encountered error 'unable connect remote host: no route host'. can same thing @ server , can remotely access server through ssh. the path relative server, there's context when execute command via ssh. if run on local machine, mypro has no context. it's trying connect localhost 2 different machines -- each take different location. try using full path.

override maven mirror settings on a build server -

we have settings.xml on build server restricts access outside repositories , forces access local repository. with cooperation of policy makers behind this, investigating possibility selectively (from project's pom.xml) enable outside repository access. is possible? if so, simple configuring repository in pom.xml? i'm afraid isn't possible. need specify alternative settings.xml on command line.

Create JSON of one dimension Ruby -

i want have this: ["(gka) goroka, goroka, papua new guinea"] instead of: [ [ "(gka)", "goroka", "goroka", "papua new guinea" ] ] i have code far: @aeropuertos = "" f = file.open("./public/aeropuertos/aeropuertos.cvs", "r") f.each_line { |line| fields = line.split(':') if (fields[2] == "n/a") @line = "(" << fields[1] << ")" << ",," << fields[3] << "," << fields[4] else @line = "(" << fields[1] << ")" << "," << fields[2] << "," << fields[3] << "," << fields[4] end @aeropuertos += @line << "\n" } return csv.parse(@aeropuertos).to_json what should do? @aero...

html - Bullets center with unordered list -

does know css makes bullet point sit @ top of multi-line bulleted list? reason template using bullet point centers left instead of sitting next first word if have more 1 line of text. set list style position inside list item, see this demo fiddle . css: ul { list-style-position: inside; }

audio - Detecting the current volume on Android -

i'm building application recording audio microphone, whenever audio reaches threshold perform action. however how should calc appropriate volume threshold ? i've static volume coded works across devices not devices (in somes cases sensitive or vice versa). i'm using audiorecord, here's part of code: int buffersize = audiorecord.getminbuffersize(constants.recording_frequency,constants.channelconfiguration,constants.audioencoding); audiorecord audiorecord = new audiorecord( mediarecorder.audiosource.mic,constants.recording_frequency,constants.channelconfiguration,constants.audioencoding, buffersize); short[] buffer = new short[buffersize]; while(true) { int bufferreadresult = audiorecord.read(buffer, 0, buffersize); (int = 0; < bufferreadresult; i++) { currentvolume = java.lang.math.abs(buffer[i]); if (currentvolume > constants.no_volume_amplitude) // alright ! i'm looking :d } } so, question is: how calculate consta...