Posts

Showing posts from February, 2013

java - Column Index not finding a column that definitely exists -

try { cursor c = db.rawquery("select time updatetimes type = 'root'", null); long time = c.getlong(c.getcolumnindex("time")); } catch (cursorindexoutofboundsexception e) { } this exception gets thrown, though column "time" exists, the same query returns data expected when using sqlite3 client. ideas? the cursor not @ valid index. need move first: if (c.movetonext()) { time = c.getlong(c.getcolumnindex("time")); }

javascript - Clear TEXTAREA value after click (onFocus) -

i'm using.. onfocus="this.value=''; return false;" to clear value within textarea leaving comments. however, when click enter comment , type few things, if click outside box maybe read else on page , return comment clicking within textarea box again, clears current input. is there anyway clear textarea on initial click clear default value , not rest of clicks rest of browser page's session? it's better put instructions label tag, position on textarea, , hide or show if textarea focused. reason because textearea populated instructions , these might sent if inside form. but, solve problem, have is: onfocus="if(this.value== "your initial text"){this.value=''}; return false;"

sql - Constraint using a Trigger -

i using 3 tables - orders, employee , position. orders has employee_no, , employee table has position_no. want make sure employee_nos in order table numbers of employee in sales. position_no of employees in sales 3, 4, 5, 6. used query 1 (see below) add check constraint. however, doesn't subquery. use query 2 (see below) makes sure employee_no in orders table in list (the list employee nos of employees in sales). however, query 2 wouldn't work if new employee joins. know solved using trigger, not sure how. glad if me out. i don't triggers this. might have syntax not quite right. create or replace trigger check_order_employee_no on insert orders before each row match_count integer; begin select count(*) match_count employee employee_no = :new.employee_no , position in (3,4,5,6); if match_count = 0 raise_application_error( -20000, 'employee # order must sales employee' ); end if; end check_orde...

jquery - How to detect if an element has scrolled out, but only once? -

i trying detect if element has been scrolled out , have done following code $(window).bind('scroll', function(){ var $btn = $('#intro div.summary a[href=#top]'); if($(window).scrolltop() > ($btn.offset().top+$btn.height())){ console.log('out'); } }); i have anchor in body text, hoping clone , make fixed nav out of once div.intro scrolled out. my problem code fires element out of view, keeps firing. cannot more more keep firing. is there way fire 'out' once it's out , 'in' once it's in? aside setting variable. to execute event once can do $(window).one('scroll', function(){ var $btn = $('#intro div.summary a[href=#top]'); if($(window).scrolltop() > ($btn.offset().top+$btn.height())) { console.log('out'); } });

python - How to achieve desired results when using the subprocees Popen.send_signal(CTRL_C_EVENT) in Windows? -

in python 2.7 in windows according documentation can send ctrl_c_event (python 2.7 subprocess popen.send_signal documentation). when tried did not receive expected keyboard interrupt in subprocess. this sample code for parent process: # file : parentprocess.py import subprocess import time import signal create_new_process_group = 512 process = subprocess.popen(['python', '-u', 'childprocess.py'], stdin=subprocess.pipe, stdout=subprocess.pipe, stderr=subprocess.stdout, universal_newlines=true, creationflags=create_new_process_group) print "pid = ", process.pid index = 0 maxloops = 15 while index < maxloops: index += 1 # send 1 message every 0.5 seconds time.sleep(0.5) # send data subprocess process.stdin.write('bar\n') # read data subprocess temp = process.stdout.readline() print temp, ...

c# - Dynamic content w/ jQuery -

i starting learn jquery, , want load content seperate .aspx page dynamically div. using example here: http://www.asp.net/ajaxlibrary/jquery_webforms_dynamic_load.ashx?hl=var . however doesn't seem responding , i'm missing piece of this. here code / script in .aspx page: <asp:content id="content2" contentplaceholderid="contentplaceholder1" runat="server"> <script src="scripts/jquery-1.5.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { // external aspx page calling $("#btn_submit").click(loaddynamic); }); function loaddynamic() { $("#dynamicresults").load("resultsview.aspx", {name: $("#cbox_user").val() }, function (content) { $(this).hide().fadein("slow"); return false; }); } <header...

c - Adding external Graphics library in Ubuntu10.04 -

i beginner c progmmng, right nw m coding c on ubuntu using gedit , compiling in gcc, want plot graph in c prog, read regarding gnuplot , koolplot, when include files in prog output as: fatal error/no such directory etc..can tell me how work out..please give in detail ans..coz m new using ubuntu... appreciate answers thankx how did install gnuplot , how using in program? did follow instructions in gnuplot manual ? koolplot appears designed mingw environment under windows, wouldn't recommend using if you're in linux environment.

android - Slow startup of second activity -

what should when settings activity starting slow? anr keydispatch error if takes long. should using preferenceactivity . absolute first time go settings delay time slow (about 5-10 seconds), otherwise goes super smooth. appear when i'm reinstalling application , start settings first time (so it's first time thing). some code in settings preferenceactivity : @override protected void oncreate(bundle icicle) { super.oncreate(icicle); pref = getpreferencemanager(); pref.setsharedpreferencesname(livewallpaper.preferences); addpreferencesfromresource(r.xml.live); pref.getsharedpreferences().registeronsharedpreferencechangelistener(this); pref.findpreference("username").setonpreferenceclicklistener(new onpreferenceclicklistener() { public boolean onpreferenceclick(preference preference) { // stuff... return true; } } )...

javascript - An easy question about Google Maps - centering -

every time embed iframe google maps keeps marker in middle. and if there's tooltip , cuts tooltip data: http://jsfiddle.net/v2sva/ are there url parameters or center map on tooltip? well, if using api, can issue call map.setcenter() . if including maps inline in example, need change initial starting point. the url using embed map is: http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode= &amp;q=museum+near+washington,+united+states&amp;aq=0 &amp;sll=40.702863,-74.055748&amp;sspn=0.025669,0.055747&amp;ie=utf8 &amp;hq=museum&amp;hnear=washington+d.c.,+district+of+columbia &amp;ll=38.913976,-77.05111&amp;spn=0.052698,0.111494&amp;t=h&amp;z=14 &amp;iwloc=a&amp;cid=4718114823360363843&amp;output=embed just matter of adjusting parameters. the parameters need adjust ll = center location , z = zoom level , spn/sspn = span / screen span . surprisingly awkward find info...

Creating and running a Java applet -

i thought try hand @ applets - made applet using eclipse. runs fine using run -> java applet. i read bit running outside eclipse, did following: made folder. created new -> java project [applet_test]. inside project, created new -> other -> visual swing class -> applet [number1] - created number1.class . added code , ran java applet - ran fine. exported project jar file (not runnable jar file). wrote html using textedit (mac's version of windows' notepad ). html follows, below... i put jar file, html , .class file in folder. in terminal (mac's version of windows command prompt window), ran appletviewer applet_testx2.html (that's name of html). i see brief flash of application name @ top of screen (as other running application). however, application (which should display jpanel label , button) did not appear. tried running firefox , safari. html code appeared. so, doing wrong? and, more importantly, how do correctly? code follow...

windows phone 7 - Launching WP7 Map Application -

hopefully easy one. in app, have event page address listed. have link view map brings page in application uses map control, , using lat/long pass, displays location of event. what send lat/long existing maps application driving directions (etc) handled application. is possible? there 2 new tasks introduced in 'mango' release of windowsphone. bingsearchtask & bingdirectionstask useful map functionality. http://msdn.microsoft.com/en-us/library/microsoft.phone.tasks.bingmapsdirectionstask_members(v=vs.92).aspx refer link tasks available - http://msdn.microsoft.com/en-us/library/ff428753(v=vs.92).aspx

iphone - Sending data to a method registered for a notification -

i need pass data method registering execute once receive notification [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(keyboardwillshow:withcell:) name:uikeyboardwillshownotification object:nil]; here want send data withcell part of method. how can achieve this? short answer: can't. you're registering notification , can't control sent notification. what do?

php - MySQL Query using $_GET -

ok, maybe i'm bit overtired, can't understand why isn't working! have comments box on website, profiles people post. want show posts in profile. profile page userinfo.php?user=(whatever) this query failing: $query = "select message,`date`,ip,name,website,id `guestbook_message` name=" . intval($_get['user']) . " , deleted=0 order `date` desc"; you getting name of user , casting directly integer , comparing name. not make sense. if $_get['user'] id of user, compare id , not name . if $_get['user'] username of user, have put quotes around username value. username value string, need encapsulate in quotes , remove intval . this: $query = "select message,`date`,ip,name,website,id `guestbook_message` name='" . mysql_real_escape_string($_get['user']) . "' , deleted=0 order `date` desc"; ...

algorithm - What are some fast approximations of Nearest Neighbor? -

say have huge (a few million) list of n vectors, given new vector, need find pretty close 1 set doesn't need closest. (nearest neighbor finds closest , runs in n time) what algorithms there can approximate nearest neighbor @ cost of accuracy? edit: since help, should mention data pretty smooth of time, small chance of spikiness in random dimension. there exist faster algoritms o(n) search closest element arbitary distance. check http://en.wikipedia.org/wiki/kd-tree details.

extjs gridfilter icon not showing in IE but shows in Firefox -

in gridfilters, if using stringfilter field, there property in stringfilter.js called : icon: 'ux-gridfilter-text-icon', basically loads 'binocular' icon in beside filter text box. works fine mozila, ie, icon not showing up. known problem chance? using source @ : http://ccinct.com/lab/filter-grid/ ext js ver 3.2.1 girdfilters version seems v0.2.7 per gridfilters.js edit: works in chrome fine. ie problem edit#2: , other css properties column headers etc fine. loading of image there problem. thanks. got solved. had taken filters plugin (ux,resources) folders, , distributed files in diff packages in web application. reason, messed things though references correct. when started using package given, got solved. not sure why though.

c# 4.0 - C# 4.0 Anonymous Functions -

how do following shown in javascript in c# 4.0: var output = dosomething(variable, function() { // anonymous function code }); i'm sure i've seen somewhere before cannot find examples. you'll want in lambda expressions though it's not quite javascript because c# works quite bit differently. may want check out delegates . example code: namespace test { class tests { delegate string mydelegate(); public void main(string[] args) { var output = dosomething("test1", () => { return "test2";} ); } public string dosomething(string test, mydelegate d) { return test + d(); } } }

mongodb - Mongo data modeling/updates for voting (up and down) -

there example on voting data model/update queries in mongo: http://www.mongodb.org/display/docs/mongodb+data+modeling+and+rails#mongodbdatamodelingandrails-atomicupdates however need both , down votes (basically, 1 person can either cast vote or down vote). also, want voter able change mind , change upvote downvote or vice-versa (so list of voters , total number not fit). what best data model , corresponding update call? i see 2 possibilities, either 'votes': [{ 'user_id' : ... , 'vote': ±1 }] or 'upvoters': [...], 'downvoters': [...] but can't make update query first 1 yet, , second 1 looks bit weird (though may me). first schema looks good. second schema hard because when user click upvote , downvote need add userid 'upvoters' 'downvoters' , remove 'upvoters' , vice versa. i suppose votes nestead collection of document(suppose questions). db.questions.update({votes.userid: .. },{ $se...

XML parsing java -

i need parse xml file in java, (i using dom) built tree, , need create objects using nodes (and attributes). way of approach? can still same thing without, sax, or dom? jaxb standard way create objects xml.

java - Can't replace a letter in a string -

i have asked couple of questions loop: string[] book = new string [isbn_num]; booknum.replaceall("-",""); if (booknum.length()!=isbn_num) throw new isbnexception ("isbn "+ booknum + " must 10 characters"); (int i=0;i<booknum.length();i++) { if (character.isdigit(booknum.charat(i))) book[j]=booknum.charat(i); //this problem right here j++; if (book[9].isnotdigit()|| book[9]!="x" || book[9]!="x") throw new isbnexception ("isbn " + booknum + " must contain digits" + "or 'x' in last position"); } which not compile. answer had other question asked told me line error occurs wrong in booknum.charat(i) (immutable) string, , can't values book array way. need on assignment check isbn number (booknum) see numbers, except last digit can 'x' (valid isbn). best way it? if ...

php - How to make ajax calls from HTTP to HTTPS WS using jquery -

some of web services in https home page in http how can make ajax calls secure data. trying using curl in php page. there other option using jquery 1.5 the simplest , obvious answer make page https well. thats not feasible so, need use jsonp circumvent same origin policy . can learn more jsonp here

resize - Resizing a Qt window when a child element has been removed. -

i have qwidget window, contains qsplitter . have qstackedlayout (within qwidget container) on both left , right of splitter. main application resides in left region, can trigger qwebviews appear on right. when remove right qwebview , window attempts resize, stays @ width of qwebview . when try drag window, snaps position around left side of splitter. i want window snap show left side of splitter on removing last widget right qstackedwidget . i've tried various incantations, don't know qt well, , attempting learn go. the below code in java, using jambi wrappers. concepts should same in c++, , i'm able translate other language binding jambi if necessary. i attempt set window minimum width on add , remove of widgets rightstackedlayout , breaks splitter handle in cases. consider hack workaround. if can point me in right direction of having changes right side of splitter update top level window, i'll grateful. // main window class public window() { // #qwidge...

php - line break on regular expressions -

i'm trying replace between 2 tags, i'm not able build right expression. this did: /<tag>(.*|\n*)</tag>/ i want capture characters including line breaks. this example of need capture: <tag> <div class="feed_title">some title</div> <div class="feed_content">some text</div> </tag> can of tell me i'm doing wrong? here link regexr , full example of content looks like: http://regexr.com?2t4n1 '#.#m' the m means multiline, makes point able match newlines=line breaks \n edit: as has been corrected sharp eyes , brain, evidently '#.+#s' edit2: as michael goldshteyn said, should work $ch = '<tag>\s+<div class="feed_title">some title</div>\s+<div class="feed_content">some text</div>\s+</tag>' preg_match('#<tag>(.+?)</tag>#s',$ch,$match) there solution, without ...

html - Using Links in iOS Fullscreen Web Apps -

i'm working on quick landing page access number of small, mobile-optimized applications on same server. dashboard pattern. want have on home screen can of apps in fullscreen mode rather in toolbar-heavy mobile safari. however, when click on link, takes me out of fullscreen mode safari -- don't want. is there way (e.g. using anchor's target attribute) stay in fullscreen mode while navigating different page? or should throw <iframe> ? you'll need intercept onclick event using javascript. example, here's iwebkit noeffect css class applied <a> tag: window.onload = function () { function fullscreen() { var = document.getelementsbytagname("a"); (var = 0; < a.length;i++) { if (a[i].classname.match("noeffect")) { // nothing } else { a[i].onclick = function () { window.location = this.getattribute("href...

c++ - Disable VS debugger for specific thread -

i'm writing open source software capture , process raw mouse , keyboard events. when event captured, communicate win32 window ask precisely event (i.e. pass along or consume it). it's quite similar hidmacros. the section decides whether or not consume event runs in memory space not control (i.e. windows running). means, unfortunately, have no ability debug section of code. fortunately simple code , haven't had debug yet. on other side of things, i've got win32 event loop running in own thread, , handles requests sent aforementioned section of code. above section sends window message, decides do, , returns answer. simple enough. the problem this. when attach debugger, win32 window event loop stopped. other code keeps right on running since it's not in actual memory or process. , when user like, oh say, press f10 (to step next line), keyboard hook i've registered (1) catch keystroke, , (2) call off win32 window answer. unfortunately window frozen debugge...

visual studio 2010 - Windows Forms problem in VB.NET -

i'm making simple game application. main form (form1) has single button on labeled button1. (very creative naming, eh?) point of application move button in random directions across form. problem when start debugging (i'm using visual studio 2010) form never shows up, , when open windows task manager name of .exe never shows in process list. wondering if code i'm using have that. here's code: class form1 private sub form1_load(...) initializecomponent() while true moveit() end while end sub sub moveit() dim rand short randomize() rand = (rnd() * 5) select case rand case 0 'move button 5px button1.top -= 5 case 1 'move button 5px button1.top -= 5 case 2 'move button left 5px button1.left -= 5 case 3 ...

c# - Is there a better approach for dealing with mulitple processes reading/writing to a file -

i have 3 processes each of listens data feed. 3 processes need read , update same file after receiving data. 3 processes keep running whole day. obviously, each process needs have exclusive read/write lock on file. i use "named mutex" protect read/write of file or can open file using fileshare.none. would these 2 approaches work? 1 better? the programe written in c# , runs on windows. use named mutex this. if open file fileshare.none in 1 process, other processes exception thrown when attempt open file, means have deal waiting , retrying etc. in these processes.

sql server - how long does a query take to run? -

i want time query. how do that? want change order of operators see produce best results; best way it? i'm using sql server , .net 4. thanks. sql server profiler give best measurement of query speed. comes sql management studio.

ASP.NET MVC 3 - Partial vs Display Template vs Editor Template -

so, title should speak itself. to create re-usable components in asp.net mvc, have 3 options (could others haven't mentioned): partial view: @html.partial(model.foo, "somepartial") custom editor template: @html.editorfor(model => model.foo) custom display template: @html.displayfor(model => model.foo) in terms of actual view/html, 3 implementations identical: @model webapplications.models.fooobject <!-- bunch of html --> so, question - when/how decide 1 of 3 use? what i'm looking list of questions ask before creating one, answers can used decide on template use. here's 2 things have found better editorfor/displayfor: they respect model hierarchies when rendering html helpers (e.g if have "bar" object on "foo" model, html elements "bar" rendered "foo.bar.elementname", whilst partial have "elementname"). more robust, e.g if had list<t> of in viewmodel, use @html.dis...

perl - Accessing and printing Hash of array -

i have question of how print hash: @language(1,2,3); $i (0 .. $#language) { $statement = $db->selectall_arrayref( "select word words left outer join language on words.languageid = language.languageid words.languageid = $language;" ); %words=((@language[$language])=> {@$statement}); } return %words; how can print out hash i tried this: foreach $key(keys %newwordslist) { print "dozzzz: " . $key . "\n"; $ind(0 .. @{$newwordslist{$key}}-1){ print $newwordslist{$key}[$ind] . "\n"; } } but nothing. and have question: hash sequential order or not mean $key , because try yo print $keys supposed print 123 prints out 132 what wrong? hash tables don't preserve insertion order. you'll need use different data structure, perhaps tie::ixhash.

c# - ADO.Net Mocking Context Generator Interface Problem -

i'm working ef 4 , repository pattern. in adventures in trying unit test ef data context, came across ado.net mocking context generator template, name describes, aids in mocking data context. while context build fine, i'm having problems repository , it's bit of mystery. here repository interface (abbreviated): public interface irepository<t> t : class { /// <summary> /// finds entities /// </summary> /// <returns></returns> iqueryable<t> find(); /// <summary> /// find alls entities , loads included relational properties. /// </summary> /// <param name="includes">relational properties load.</param> /// <returns></returns> iqueryable<t> find(params expression<func<t, object>>[] includes); /// <summary> /// adds entity repository. /// </summary> /// <param name="entity">entity add...

iphone - Issue in navigation -

hi every have made application , run in simulator , iphone works fine , alnalize , remove memory leakages. but today ran app on simulator when going second view display view fine when came second view crash without showing message ... is bad excess? don't think soo... ok try this dont release appdelegate object here.it shared copy whole app. release object before super dealloc. - (void)dealloc { //[appdelegate release];//here crash [staticimagedictionary release]; [sitedata release]; [newdata release]; [connection release]; [webdata release]; [activity release]; [super dealloc]; }

Perl pocket reference (online) -

looking perl cheatsheet, or online version of pocket reference. perl 5 cheat sheet little on short end of i'm looking for, , perl pocket reference, fourth edition available buy pdf, if there's free version of equal or better -- i'd rather use it; in part because i'd reference it. questions, feedback, comments -- comment, thanks!! it's shame didn't update perl pocket reference perl 5.12 (or 5.14 should out later year) when did ebook version. still, 5.8 reference still actual. misses awesome new stuff given / when , smart-match operator ~~ , regular expression modifiers new. for has changed between different versions of perl must refer perldelta documents. see has changed between 5.8 , 5.10 see perl5100delta , perl5101delta differences between 5.10.0 , 5.10.1. perl 5.12 see perl51200delta , subsequent perl51xxdelta documents. i can't remember current perl pocket reference mention deprecated features though, did. don't have in h...

arrays - Partial sum lookup / partial sum set assignment -

i have following problem solve. as input have 2 decimal arrays. sum of elements of both of them equal. actuall problem assign values 1 array second 1 partial sums - if element 1 array sum of number of elements second array - should assigned each other. sample1: array1: 25.0, 25.0, 50.0, 50.0 array2: 50.0, 100.0 expected result: 50.0 sum of 25.0 , 25.0, 100.0 sum of 50.0 , 50.0 (0->0,1; 1->2,3) sample2: array1: 20.0, 70.0, 80.0, 130.0 array2: 100.0, 200.0 expected result: 100 = 20+80, 200 = 70+130 (0->0,2; 1->1,3) idea return assigned array element indexes , return less assingments possible. this called subset sum problem . unfortunately np-complete, meaning have check possible combinations. however, if problem has small quantity of partial sums (such examples) brute force away. moron correct, not np-complete problem require checking possible combinations. believe subset sum 1 does .

Whats the default search query(FreeText or Contains) for sharepoint? -

i think based on search keyword call query. contians:"sharepoint" freetext:"sharepoint configuration" wildcard: "shar*" contains:when will go contains search? freetext:when move freetext search. how identify call freetext query. wildcard search:how idenfify include wild card. the web front end uses keyword search. use sharepointsearchservice tool information on using webservice.

jQuery cookies and .each() help requested -

hi i'm using jquery-cookies plugin (http://plugins.jquery.com/project/cookie) , it's great setting , deleting cookies when know are. what i'd accomplish have script read extant cookies , each cookie exists, something. i'm using looks this: -- // set dummy cookies $.cookie('cookie_name', 'cookie_value'); $.cookie('2', '2_value'); $.cookie('3', '3_value'); $.cookie('4', '4_value'); // returns "cookie_value" alert, know above cookies set , scripts included: alert($.cookie('cookie_name')); // debug (working) // each cookie found, check input same id - pop alert, debug $.cookie(i,v).each(function(v) { $('input#' + v + ').attr('checked', true); alert(v); // debug (not working) }); -- ... .each statement doesn't squat. it's matter of syntax documentation cookie plugin doesn't cover well. have ideas? thank in advance , please let me know ...

In 64-bit MongoDB When the sharding process starts from one shards to another shards? -

i undergoing unit test in 64-bit mongodb in 64-bit linux machine.i have 2 shards both of shards configured in local machine testing purpose.so when sharding process starts on 1 shards another?.whether have give size limit first shard once size exceeded in first shard go next shard?please give me solution. advance thanks, data in given collection stored in "chunks" of data in contiguous/order preserving manner, default 200mb in size. once chunk reaches size, split 2. , once shard has imbalance of data, mongo start rebalance data moving chunks around between shards - it's these "chunks" of data being moved. so default, need populate collection reasonable amount of data in order end multiple chunks of 200mb start moved around between shards. testing purposes, can change chunk size (e.g. first time played around it, set 1mb) setting --chunksize argument on mongos process. means need few mb of data in collection before start seeing sharding kick in. ...

mysql query to generate weekly report store wise -

visitor trend between 2 date,result in weekly manner.. hard answer question without little more context, have @ datetime functions in mysql: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_week a simple group week(datefld) take care of "weekly" aspect of question, statistical/mathematical functions need depend on specific case: http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html

javascript - sort entries of a drop down alphabitically -

i dynamically adding drop entries drop down using following code. var x =document.getelementbyid("x"); var optn = document.createelement("option"); optn.text="hhh"; optn.value="val"; x.add(optn); the above thing done in loop want sort alphabatically.how can it? public void sortdropdownlist(dropdownlist ddl) { //create listitem array size of items //in dropdownlist listitem[] sorted = new listitem[ddl.items.count]; //loop through items in listitem array (int = 0; < sorted.length; i++) { //resize array on each iteration array.resize(ref sorted, i); //add current index array sorted[i] = ddl.items[i]; } //call array.sort sort listitem array array.sort(sorted); //remove items dropdownlist ddl.items.clear(); //add sorted items dropdownlist ddl.items.addrange(sorted); } u use of function after items bound dropdownlist

I cannot find the searchableController or the view for the Searchable plugin in Grails -

i installed searchable plugin on grails , when run application can browse , searchable function works fine. the problem cannot find searchablecontroller or view of in project. i'm not able edit or rewire code fit in controller or view. any appreciated. kind regards. the searchablecontroller , views located inside searchable plugin, see $home/.grails/<version>/projects/<projectname>/plugins/searchable. be warned: it's bad idea modify in $home/.grails manually unless you're sure you're doing. instead either: download plugin svn/git , reference 'inplace' plugin. if don't know inplace plugins, google it. copy searchablecontroller $home/.grails project , modify it.

javascript object declaration using prototype(including case) -

possible duplicate: use of 'prototype' vs. 'this' in javascript? i donot know why developer use javascript prototype object exactly. so, made sample code below. 1 using prototype object, other plain syntax. difference btwn 2 of them? there benefit use prototype syntax, first case? car.prototype.engine_ = 'bmw'; car.prototype.getengine = function(){ return this.engine_; } car.prototype.setengine = function(engine){ this.engine_ = engine; } function car(){ //.... } var mycar = new car(); mycar.getengine(); mycar.setengine('benz'); console.debug(mycar.getengine()); vs function car(){ this.engine_ = 'bmw'; this.setengine = function(engine){ engine_ = engine; } this.getengine = function() { return engine_; } //... } var mycar = new car(); mycar.getengine(); mycar.setengine('benz'); console.debug(mycar.getengine()); yes, there difference. using prototype , property or...

java - What is the history of the import statement? -

i know of 2 languages use import statement: java , python. , know the import antigravity joke . which language introduced statement? 1 of two, or 1 altogether? when? import 1 way specify dependency on other class/module. way of specifying has been present in many, many languages. in fact import in java , import in python 2 entirely different things: in java import provides ability refer type (or field/method, if using import static ) short name instead of qualified name. no "module loading" of kind happens based on import . in python import loads module , optionally provides short name (or all) of members. other keywords similar things include in c , use in perl. many, many languages have kind of way specify kind of dependency, technical details vary lot. one language import statement predates both java , python modula-2 (1978) , successor modula-3 .

jquery hoverscroll in firefox gives me scrollbars -

i created small media player playlist using flowplayer. used hoverscroll plugin make playlist scroll on hover. have small issue in firefox. when click on 1 of links in playlist play video/music displays firefox default scroll bars. you can check out demo here here preview of code js: // override default parameters onload jquery.fn.hoverscroll.params = jquery.extend(jquery.fn.hoverscroll.params, { vertical : true, width: 355, height: 100, arrows: false }); flowplayer("video", "assets/flowplayer/flowplayer-3.2.6.swf", { clip: { // default not auto play autoplay: false }, playlist: 'assets/gallery/mrss-video.xml', // show playlist buttons in controlbar plugins: { controls: { url: 'flowplayer.controls-3.2.4.swf', buttoncolor: 'rgba(0, 0, 0, 0.9)', buttonovercolor: '#000000', backgroundcolor: '#d7d7d7', ...

image permalink PHP problem with Wordpress -

the site http://www.christopherwaller.com/wordpress/ if take on above site i'm trying insert link page on each of images on carousel, if click anywhere on image navigate new page. have created link want on post title text (ie. 1, 2 etc . . .) using <h2 class="postitle"><a href="<?php the_permalink();?>"><?php the_title(); ?></a></h2> but can't life of me find right php create same links on each of carousel photos? i'm still trying grips php if advise great.thanks this php <div class="edit"><?php edit_post_link(); ?></div> </div> <div class="postcontent"> <?php $content = $post->post_content; $searchimages = '~<img [^>]* />~'; preg_match_all( $searchimages, $content, $pics ); $inumberofpics = count($pics[0]); if ( $inumber...

html - How to center a (background) image within a div? -

is possible center background image in div? have tried - no success: <div id="doit"> lorem ipsum ... </div> //css #doit { background-image: url(images/pic.png); background-repeat: none; text-align: center; } is possible? #doit { background: url(url) no-repeat center; }

size - JavaFX unknown loop depth -

is there easy way make loop of unknown depth size, don't have create loops, can use 1 function. var letters = [97..122]; //size 1 (x in letters) print(x character); //size 2 (x in letters, y in letters) { print(x character); println(y character); } //size 20 (x1 in letters, .., x20 in letters) { print(..); } in output have: aa ab ac and on. i know have folow recurison in way. thank you. public static void printalphabetcombinations( int recursecounter, string current ) { string temp = current; if( recursecounter == 0 ) { system.out.println( temp ); numberofcombinations ++; return; } else { recursecounter--; for( int = char_start; < char_end+1; i++ ) { temp = current + (char) (i); printalphabetcombinations( recursecounter, temp ); } } usage: printalphabetcombinations(3, ""); thanks :)

java - How to move a file using Mule2 -

i expected following mule ( 2.1.2 ) file move files in " /path/to/dir1 " " /path/to/dir2 ", doesn't work: <mule xmlns="http://www.mulesource.org/schema/mule/core/2.1" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:file="http://www.mulesource.org/schema/mule/file/2.1" xsi:schemalocation=" http://www.mulesource.org/schema/mule/core/2.1 http://www.mulesource.org/schema/mule/core/2.1/mule.xsd http://www.mulesource.org/schema/mule/file/2.1 http://www.mulesource.org/schema/mule/file/2.1/mule-file.xsd"> <file:endpoint name="move" path="/path/to/dir1" movetodirectory="/path/to/dir2"/> <model> <service name="service name: move file"> <inbound> <inbound-endpoint ref="move"/> </inbound> </service> </...

spell checking - Is it possible to toggle a vim option when switching to insert mode? -

i discovered spell option this answer on code review , , feel option both useful (while editing) , annoying (while reading code, because of false positives). i somehow enable option automatically when switching insert mode: set spell and disable automatically when switching normal mode: set nospell adding following commands in .vimrc should trick (as long not using ctrl+c leave insert mode) : autocmd insertenter * setlocal spell autocmd insertleave * setlocal nospell since great trick, have added these lines .vimrc ! if want rid of words being highlighted, can add them "good" word list putting cursor on them , type zg . see :help spell for more information

monitoring - Can ServersAlive monitor a WCF service? -

i have wcf service monitor using serversalive. able check service available connection perspective able call method on service check purpose of service working. thanks how hard depends on binding you're using. serversalive : web services - verify status , content of web servers (http, https, mms, , rtsp). , retrieving page (http(s) get) or posting data (http(s) post). using proxy? not problem can handle that. webpage protected password (http basic or ntlm authentication)? again not problem, support that. servers alive can check validity of ssl web certificates. if you're using simple wshttp, you're ready go out of box. however, if you're doing more requires wcf stack, you'll have write custom code: write own check - have ability write custom software own checks through servers alive. have several examples including: * virtual machine check in vmware server/esx/gsx * mailflow * ipv6 ping * *nix diskspace * *nix proc...

Gitolite git clone error -

i trying setup gitolite on server (macos server). i followed instructions in install document found here : http://sitaramc.github.com/gitolite/doc/1-install.html i installed root method. i got setup (ssh pubkey authentication , default gitolite setup) $ssh git@server info hello admin, gitolite version here v1.5.9.1-27-gb97115f gitolite config gives following access: r w gitolite-admin @r_ @w_ testing according installation instruction should able checkout repository. but when try clone gitolite-admin repositry error: $ git clone git@server:gitolite-admin cloning gitolite-admin... assertion failed: (argv0_path), function system_path, file exec_cmd.c, line 27. error: git-shell died of signal 6 fatal: remote end hung unexpectedly i got latest git version of gitolite , git v. 1.7.3.4 can me? edit 1: added git clone command before error message it seems correct fix error add $env{git_exec_path} = "/usr/libexec/git-core"; to .gitoli...

directory - How do I organize my project files and directories to be put to svn and back? -

possible duplicate: how organize subversion repository in house software projects hi, this svn question regarding big projects , many directories in it. i'm new svn googled 1 simple answer , didn't find it: how organize project files , directories put svn , back? or there other solution question? my project consists of these: php, java, action script , mysql. can see these totally separate entities. reorganizing 1 directory during devlopment, in order put svn, seems make mess in project. are there best practices on how manage this? notice! english not native language. chris you may checkout folder svn location on hard drive. may use folder structure will, need know project directories. comfortable have 1 folder 1 project.

sql - How do I get the MediaCatalogDB OLE DB Provider? -

i have windows server 2003 instance running sql2005 linked server using mediacatalogdb ole db provider. we're migrating (most of) server 1 running windows server 2003 64bit sql2008 r2. however, doesn't have mediacatalogdb ole db provider. does know can provider 64bit sql 2008? or work around? i don't know system we're linking (it's black box provided third party). thanks! it turns out error getting when using sql server native client 10.0 reporting useful error message: "the provider supports interface, returns failure code when used." it seems sql 2000 sp4 (which source system is) doesn't support 64 bit linked servers querying without first running script (that comes on disc) provide catalog suitable 64 bit server query: http://support.microsoft.com/default.aspx?scid=kb;en-us;906954 a further blog post here describes workaround if doesn't work: http://sqlblog.com/blogs/roman_rehak/archive/2009/05/10/issue-with-64-bit-sql...

perl - perl6/rakudo: Problem with writing on the loop-variable -

#!perl6 use v6; $longest = 3; @list = <a b c d e f>; @list -> $element rw { $element = sprintf "%*.*s", $longest, $longest, $element; $element.say; } this works. in second , third error-message. how make them work? #!perl6 use v6; $longest = 3; @list = <a b c d e f>; @list <-> $element { $element = sprintf "%*.*s", $longest, $longest, $element; $element.say; } # ===sorry!=== # missing block @ line 11, near "" . #!perl6 use v6; $longest = 3; $list = <a b c d e f>; $list.list -> $element rw { $element = sprintf "%*.*s", $longest, $longest, $element; $element.say; } # cannot modify readonly value # in '&infix:<=>' @ line 1 # in <anon> @ line 8:./perl5.pl # in main program body @ line 1 regarding second example the <-> may not have worked in rakudo perl used, has been fixed in more recent versions. (it had deep parsing issue requ...

ruby on rails - Is there a way to Test (Unit/Integration) that CSS is applied to the expected HTML Elements? -

i testing views cucumber , rails right , enjoy experience. can say: background: given logged in customer scenario: view welcome page when go home page should on "welcome" page , should see following in sidebar: | selector | text | | h3 | search | | .home-page | home | | .about-page | | now i'm wondering, how can go 1 step further , say: and should see following colors on "welcome" page: | selector | background | | #content | white | | #sidebar | grey | | #navigation | blue | i feel saw possible node.js or other serverside javascript, because it's browser dependent. there way this, maybe selenium in safari , firefox? i want test colors , fonts, not layout b/c of cross brow...

How to launch two java program in the same time through another one? -

i'm beginner , try code simple java programs , here have 2 java programs. the first program selecting recent files folder. the second program concatenating these recents files. what want create third java program -will launch first program. -then wait 10s -launch second java program. i want keep separately first , second program. because want use them further application. is possible? have use process method if want launch notepad.exe through java? or else? thank you there nothing special main method. can call directly third program if like. public static void main(string[] args) throws exception { program1.main(args); thread.sleep(10000); program2.main(args); }

http post - Android - image upload sending no content -

i've been looking last day or 2 , can not seem find solution issue. trying post image server using httppost. have tried 2 ways of doing , both complete post no content i.e. content length 0. first follows: string url = "myurl"; httpclient httpclient = new defaulthttpclient(); try { httpclient.getparams().setparameter("http.socket.timeout", new integer(90000)); // 90 second httppost post = new httppost(url); file sdcardroot = environment.getexternalstoragedirectory(); file file = new file(sdcardroot,"/dcim/100msdcf/dsc00004.jpg"); fileentity entity; entity = new fileentity(file,"binary/octet-stream"); entity.setchunked(true); post.setentity(entity); post.addheader("header", "uniquename"); httpresponse response = httpclient.execute(post); if (response.getstatusline...

Does generated WCF service client in Silverlight re-use the ChannelFactory? -

should 1 use generated wcf service client (e.g. myserviceclient) when invoking wcf service silverlight, or instead use channelfactory (e.g. channelfactory.create())? other questions have asked question: wcf/silverlight: why use channelfactory instead of client? however, responses it's best re-use channelfactory. if done directly, lose of other functionality of generated wcf service client (the async events, etc.) is there no way generated wcf service client re-use channelfactory itself? wcf fiasco start_rant even microsoft , wcf team know way channelfactory , channel , clientbase designed , way changed because of various performance issues real fiasco. fact disposing of proxy real mess enough know underneath extensibility of wcf, dealing inefficent, bloated , convoluted design. bad bad bad. end_rant ok, have looked @ documentation assume have not been able find answers - did not - since there no easy answer. here findings summarises these points (you ...

mod rewrite - .htaccess ReWriteRule - Quick Question -

i've created rewriterule, think points claim.php?claimlisting=$# the rule written follows : # claim rewriterule ^listing/claim/([a-za-z0-9-]+).(.html|htm)$ claim.php?claimlisting=$1 [l] an example link : /listing/claim/anne-morrison--hypnotherapy-cognitive-behaviour-therapists i mod_rewrite point root dir , claim.php?claimlisting=$id_here i've put file up, doesnt seem affecting site @ all? i've done correct , else factor preventing functioning correctly? thanks # claim rewriteengine on rewriterule ^listing/claim/([a-za-z0-9\-]+).(html|htm)$ /claim.php?claimlisting=$1 [l] and missing .html @ end of link

asp.net - Web.config isn't showing errors remotely even with customErrors="Off" (on ubuntu/mono) -

here web.config file: <?xml version="1.0"?> <configuration> <system.web> <customerrors mode="off" /> <compilation debug="true" strict="false" explicit="true /> <pages> <namespaces> <clear /> <add namespace="system" /> <add namespace="system.collections" /> <add namespace="system.collections.generic" /> <add namespace="system.collections.specialized" /> <add namespace="system.configuration" /> <add namespace="system.text" /> <add namespace="system.text.regularexpressions" /> <add namespace="system.web" /> <add namespace="system.web.caching" /> <add namespace="system...