Posts

Showing posts from March, 2014

sql - oracle: can you assign an alias to the from clause? -

can assign alias clause? like: select - b "markup" retail a, cost b; edit: sorry typed out bit quick , tried simplify question point didnt make sense what im trying use aliases compare months between 2 publishing dates in same table. here's found works: select distinct to_char(months_between((select distinct pubdate books3 pubid = 2), (select distinct pubdate books3 pubid = 4)), '99.99') "answer" books3 i wanted looks this: select distinct months_between(a,b) (select distinct pubdate books3 pubid = 2 a), (select distinct pubdate books3 pubid = 4 b) but isn't working yes, oracle supports table aliases. supports as in select list not in from list: select a

How can I get data from JavaScript code in a .NET WebBrowser control running on mono? -

the webbrowser control designed able make calls javascript .net (and pass data) via objectforscripting property (on .net side) , window.external object on javascript side. however, not implemented in mono. what options getting data and/or making calls javascript side .net side? (mono support communication in other direction via document.invokescript method.) ahh, found way: mono , window.external upodate: crap. in mono, setting location.url causes browser control's document property clear, makes impossible later call script using document.invokescript.

arraylist - check to see if 3 values in array are consecutive? -

i have array, example contains values 123456, contains more 3 consecutive values. i want method return true if array contains @ least 3 consecutive values in it, in advance. for example: 972834 - return true (234) 192645 - return true (456) etc. etc.. update! : i have array in java, takes in 6 integers. example nextturn[], , contains 8 4 2 5 6 5 @ moment sorts array - 2 4 5 5 6 8 how return true if there 3 consecutive numbers throughout array? ie find 4 5 6 i return position of integer in array, original array 8 4 2 5 6 5 it return, 2 4 5 or 2 5 6 thanks guys, appreciated the straight forward solution loop through items, , check against next 2 items: bool hasconsecutive(int[] a){ for(int = 0; < a.length - 2; i++) { if (a[i + 1] == a[i] + 1 && a[i + 2] == a[i] + 2) return true; } return false; } another solution loop through items , count consecutive items: bool hasconsecutive(int[] a){ int cnt = 1; (int = 1; < a.len

php - What is the best solution for 2 sites integrated to each other -

i have 2 sites integrated one, wordpress second site under subdirectory of first site "mysite/community" have integrated registration , login. being hesitant combining tables 1 database since uses both of native sessions. install database of wordpress separate 1 or can combine them? i'm confused of combining them since first site ecommerce site. what point of integrating them? do want users impression on using 1 site? if having 1 login , 1 , feel important things. do want ease administration? merging databases might helpful. when talking 2 databases, won't worry it. update: speed: depends on lot if things if 2 or single database faster. way tell try it. , remember tuning worth effort when performance become problem. reliability single database db problem 1 site becomes automatically problem both sites. security: similar reliability: vulnerability in 1 site might punch through other site, bad if 1 ecommerce site. maintainability: if have 1 db

iis - How can I open an .EXE file from an ASP.NET site? -

can open executable files on client machine asp.net site hosted on iis? i have tried using following code in asp.net: process notepad = new process(); notepad.startinfo.filename = "notepad.exe"; notepad.startinfo.arguments = @"e:\abc.txt"; notepad.startinfo.createnowindow = false; notepad.startinfo.useshellexecute = false; notepad.startinfo.redirectstandardoutput = false; notepad.start(); and in javascript following code: function launch() { var w = new activexobject("wscript.shell"); w.run('notepad.exe'); return true; } but both snippets open file when site not hosted in iis. any appreciated. thank in advance. you not able launch executable on client (the computer running browser) under pretty circumstance... your code in c# lives on server looks trying run notepad if working opening notepad instances on server...not client. if did manage allow client give permissions run notepad (a big if), you'd w

Struts and ValidatorForm --> does it work with variable number of form elements? -

hi, i have form generate rows of input elements (using javascript) users enter data. each row contains data particular box user entering (e.g. height, width, length, etc.). i've gotten form work , can read actionform into/out of arraylist object. i'd validate these entries catch invalid entries front. (i'm on 1.3.10) can't seem find documentation using validatorform dynamic number of form elements. is, never know how many rows of boxes entered, , wonder if has used validator validate dynamic form elements? is possible? or resigned implement .validate() method? is possible use validator elements , leave rest .validate() method? has done this, , if so, pitfalls? i'd appreciate comments or pointer resource can read up. you can making following steps. 1. define class (simple pojo) dimensionbean; contains value of 1 row input elements (like height, width, length etc). 2. in form bean (child of validatorform), define array or list of dimensio

c - Can we invoke functions of a DLL compiled for 64 bit using an application compiled for 32 bit? -

can invoke functions of dll compiled 64 bit using application compiled 32 bit? i using windows 2008 64 bit system. but, application still compiled using 32 bit. the code involves mfc & windows sdk functions. no. 32-bit application cannot load 64-bit module process space (nor vice versa). remember 32-bit processes supported on 64-bit versions of windows in dedicated windows-on-windows (wow64) subsystem. makes interoperability tricky @ best. raymond chen's blog entry on subject quite instructive, if care technical details. you either need recompile 1 or other, or load separate process , use interprocess communication coordinate between two.

Android - Upload Large image to server -

i trying have application upload images webserver using code below. works sometimes, seems fail memory error. can please post example of how accomplish if file size big? also, building support 1.5 , up. don't mind if code given me resizes image smaller before upload. httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(urlstring); file file = new file(nameoffile); fileinputstream fileinputstream = new fileinputstream(file); inputstreamentity reqentity = new inputstreamentity(fileinputstream, file.length()); httppost.setentity(reqentity); reqentity.setcontenttype("binary/octet-stream"); httpresponse response = httpclient.execute(httppost); httpentity responseentity = response.getentity(); if (responseentity != null) { responseentity.consumecontent(); } httpclient.getconnectionmanager().shutdown(); you have 2 option make code workable. you should use multi part approach upload larger size file. using in code. its apa

iphone - NSRegularExpression for stripping HTML Tag -

i developing ebook reader app. have .epub file entire ebook in each topic of ebook html file. want implement search functionality in app. using nsregularexpression class searching. please consider following html code: <temp> temp in tempo temptation </temp> say example in above html code want search word temp. in above code temp appearing 5 times -> <temp> </temp> temp tempo temptation. looking regular expression can extract whole word "temp". don't want consider word temp in html tags <temp> </temp> . don't want word tempo , temptation considered. thanks in advance how this? [^<\/?\w*>]+(temp\s) http://rubular.com/r/3pkdvnzsbr nsstring *evaluate_string = @"<temp> temp in tempo temptation </temp>"; nsstring *word = @"temp"; nserror *outerror; nsregularexpression *regex = [nsregularexpression regularexpressionwithpattern:[nsstring stringwithformat:@"[^<\\/?\\

Neural networks in Haskell - advice -

can suggest me tutorial, book, blog or share code sample neural networks in haskell ? have experience in neural networks in imperative languages, want try in haskell. there several libraries on hackage: haskellnn haskell library uses hmatrix (and, transitively, gsl , liblbfgs c libraries) heavy lifting (gpl). claims fast. instinct pure-haskell library claims fast (bsd). hnn minimal haskell neural network library (lgpl). bindings-fann bindings fann library. hfann other bindings fann library.

c# - When are method variables, accessible in an anonymous method, garbage collected? -

for instance is necessary add timer instance list doing here prevent timer being garbage collected? tyically if callback not anonymous aswer yes, since anonymous imagine variables in method block accessible in anonymous method block garbage collected when anonymous method completes? in case no need save ref doing..: private static list<timer> timers = new list<timer>(); public static void runcallbackafter(action callback, int secondstowait) { timer t = null; t = new timer(new timercallback(delegate(object state) { somethread.begininvoke(callback); timers.remove(t); }), null, secondstowait*1000, timeout.infinite); timers.add(t); } the objects referred captured variables in anonymous method not eligible garbage collection until delegate created anonymous method eligible garbage collection. however, if it's timer has reference delegate, , nothing else has reference timer, su

objective c - What GCD queue, main or not, am I running on? -

i trying write thread safe methods using: ... dispatch_queue_t main = dispatch_get_main_queue(); dispatch_sync(main,^{ [self dosomethingintheforeground]; }); ... but if on main thread not necessary, , can skip dispatch calls, know thread on. how can know this? or, perhaps not make difference (in performance) doing it? is ok comparison? if (dispatch_get_main_queue() == dispatch_get_current_queue()){...} updated answer : the apple docs have changed , "when called outside of context of submitted block, function returns main queue if call executed main thread. if call made other thread, function returns default concurrent queue." checking dispatch_get_main_queue() == dispatch_get_current_queue() should work. original answer : using dispatch_get_main_queue() == dispatch_get_current_queue() won't work. docs dispatch_get_current_queue "when called outside of context of submitted block, function returns default concurrent queue". defaul

asp.net mvc - telerik mvc combobox copy and initialize -

i using telerik combobox , using jquery make clone of it. the control being rendered correctly, dropdown not working believe due fact javascript has not been initialized on control. is there way or better way make duplicate of control? i may have resort making ajax request ideally keep clientside. cheers, mark after clone need attach ajax call follows. var c = $('rowtemplate').clone(); c.find('selectortogetinputcontrol').tautocomplete({ ajax: { "selecturl": "your ajax call" },filter: 1 });

makefile - use of PARALLEL in make -

i have been working on makefiles , trying reduce compilation time. structure of code consists of various sub directories each having own makefile. subdirectories in main directory seem independent whenever run make in of subdirectories, runs fine , shows no error. thus, want run sub-make subdirectories in parallel. possible> , if yes, how? thank in advance here crude effective method: subdirs = /something /something/else /another .phony: $(subdirs) all: $(subdirs) $(subdirs): @$(make) -s -c $@ run make -j .

Cannot add project after using tf destroy in TFS 2010 -

it keeps showing error: tf10175: team project folder xxxx not exists. i'm sure have enough permission. please help. has new project same name old one?

multithreading - Parallel-processing in Java; advice needed i.e. on Runnanble/Callable interfaces -

assume have set of objects need analyzed in 2 different ways, both of take relatively long time , involve io-calls, trying figure out how/if go optimizing part of software, utilizing multiple processors (the machine sitting on ex 8-core i7 never goes above 10% load during execution). i quite new parallel-programming or multi-threading (not sure right term is), have read of prior questions, particularly paying attention highly voted , informative answers. in process of going through oracle/sun tutorial on concurrency . here's thought out far; a thread-safe collection holds objects analyzed as there objects in collection (they come couple @ time series of queries), thread per object started each specific thread takes care of initial pre-analysis preparations; , calls on analyses. the 2 analyses implemented runnables/callables, , called on thread when necessary. and questions are: is reasonable scheme, if not, how go doing this? in order make sure things don't

svn - Apply Subversion auto-props after the fact -

for reason auto-props in ~/subversion/config not applied; makefile* = svn:eol-style=native;svn:keywords=id headurl . there quick way apply current auto-props recursively? $ grep enable-auto-props ~/.subversion/config | grep -v ^# enable-auto-props = yes subversion's automatic properties affect adds , imports (read this ). if not applied newly added files, check whether enable-auto-props option set yes .

On postback htmlgeneric control remove its childeren controls in asp.net, why? -

i have htmlgeneric control , on run time adding control in when click on button added controls disappear. dynamically created controls need created on every post back. need give them id if want maintain , restore viewstate. for example, show textbox first time page loaded, on subsiquent page loads, control missing: protected void page_init(object sender, eventargs e) { if (!ispostback) { textbox newcontrol = new textbox() { id = "newcontrol" }; somecontrol.controls.add(newcontrol); } } however, if create control on every postback same id, control maintained it's text: protected void page_init(object sender, eventargs e) { textbox newcontrol = new textbox() { id = "newcontrol" }; somecontrol.controls.add(newcontrol); } here's article dealing dynamic controls .

dependency injection - Ninject with ASP.NET MVC 3 global.asax rewrite -

in asp.net mvc v2 app's global.asax.cs have ninject v2 wireup. looking complete information on how same in mvc 3, right way using idependencyresolver find many references fact 1 should use interface not actual code how use it. instance here says should use it. i've checked brad wilson's blog lacks detailed info. i've downloaded ninject.web.mvc mvc3 , latest ninject 2.1 web support , added both solution. that's have now. i've referred piece of code scottgu designed around class mvcservicelocator , not exist anymore. in unable find example of how rtms versions of both mvc 3 , new ninject mvc3. now need inherit http application ninjecthttpapplication in version 2 or what? after more searches on web found complete , up-to-date solution described here remo gloor.

c# - Order List by Date and Time (in string format) -

probably i'm asking quite simple don't seem getting 1 out. have list of elements containing date field , time field. date field regular datetime , time field string. time formatted hh:mm , ranges in 24h. ordering list date simple doing list.orderby(e => e.date), don't seem able later order time order of records according date , time. i tried out it's big mistake! list = list.orderby(e => e.estimateddate).orderby(e => new timespan(int.parse(e.estimatedtime.substring(0,e.estimatedtime.lastindexof(":"))),int.parse(e.estimatedtime.substring(e.estimatedtime.lastindexof(":")+1)),0).totalminutes); i hope can me out one. you want orderby(...).thenby(...); , - not if time in hh:mm you don't have parse it - can sort alphabetically, i.e. list = list.orderby(e => e.estimateddate).thenby(e => e.estimatedtime).tolist(); or via linq: list = (from e in list orderby e.estimateddate, e.estimatedtime

Real time progress bar in asp.net -

i made progress bar uploading using web services , javascript. got problem. ever late web services file save function. thous, information not real in client side. how can do? the requests particular session queued, see this answer . that's why can't upload , check how has arrived @ same time.

audio - Java ogg vorbis encoding -

i using tritonous package audio encoding in ogg-vorbis. face problem when giving audio format. unsupported conversion: vorbis 44100.0hz, unknown bits per sample, mono, unknown frame size, pcm_signed 44100.0 hz, 16 bit, mono, 2 bytes/frame, little-endian this code specifying format file outputfile = new file(userdir+"//san"+"_"+strfilename + ".spx"); // using pcm 44.1 khz, 16 bit signed,stereo. if(osname.indexof("win") >= 0){ system.out.println("windows"); audioformat = getwindowsaudioformat(); samplerate = 44100.0f; }else { system.out.println("mac"); audioformat = getmacaudioformat(); samplerate = 44100.0f; } audioformat v

.net - Visual C++ combobox question -

i still new c++/cli in visual studio 2010 express.i trying add adapters name combobox, go error: error c2664: 'system::windows::forms::combobox::objectcollection::add' : cannot convert parameter 1 'std::string' 'system::object ^' no user-defined-conversion operator available, or no user-defined-conversion operator available can perform conversion, or operator cannot called my code is: public ref class form1 : public system::windows::forms::form { public: form1(void) { initializecomponent(); ip_adapter_info adapterinfo[16]; pip_adapter_info padapterinfo; dword buff=sizeof(adapterinfo); dword getinfo = getadaptersinfo(adapterinfo, &buff); padapterinfo = adapterinfo; { string desc = padapterinfo->description; combobox1->items->add(desc);//error here padapterinfo = padapterinfo->next

android - How many items a ListView can store? -

i'm new android programming. wonder how many items listview can store? search in docs don't talk this. if put lot (maybe 10k) items listadapter, affect performance? cheers, mk. the listview virtualized in android. practically speaking, means there's no actual limit number of elements inside it. can put millions of rows inside list , it'll allocate memory visible ones (or few more tops). check out dozens of tutorials regarding writing custom adapter class adapterview (listview extends that). check out google i/o 2010 session on listviews; it's useful: here

iphone - Views Below the cell? -

how can integrate uiscrollview,uiview,textview under tableviewcell.for example if press button in tableview cell, uitextview must come under cell…(it wont go next page).. you need add new cell under 1 clicked. new cell have on content view uitextview . - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { // insert new cell containing text view on indexpath.row+1 }

java - Map database table to a Hashtable -

i have simple table in oracle db columns : "key", "value". map table in java code there anyway of doing straightly in jpa? or should manually ? thanks, ray. if key , value basic or embedded types want use @elementcollection @collectiontable(name = "table") @mapkeycolumn(name = "key") @column(name = "value") protected map<a,b> map; if entites want have @ docs following, can choose appropriate. @onetomany @manytomany @mapkey @mapkeyclass

java - Close wicket modal window by pressing a button -

i want close modal window pressing button residing on modal window page. not working. modal window page contains video player. my code is: public class playvideowindow extends webpage { public playvideowindow(final page modalwindowpage, final modalwindow window, final string itemid) { final string xmlfilepath = ((webapplication) getapplication()).getservletcontext().getrealpath("/resources/video/xml/video.xml"); string filename = null; try { filename = webvideo.getvideo(itemid, xmlfilepath); } catch (saxexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } webmarkupcontainer videocontainer = new webmarkupcontainer("videodiv"); add(videocontainer); add(headercontributor.forjavascript("resources/video/js/swfobject.js")); final string script = "var swfversionstr = '10.0.0';&quo

java - split a linked list into 2 even lists containing the smallest and largest numbers -

given linked list of integers in random order, split 2 new linked lists such difference in sum of elements of each list maximal , length of lists differs no more 1 (in case original list has odd number of elements). i can't assume numbers in list unique. the algorithm thought of merge sort on original linked list ( o(n·log n) time, o(n) space ) , use recursive function walk end of list determine length, doing splitting while recursive function unwinding. recursive function o(n) time , o(n) space. is optimal solution? can post code if thinks it's relevant. no it's not optimal; can find median of list in o(n) , put half of them in 1 list (smaller median or equal, upto list size n/2) , half of them in list ((n+1)/2). sum difference maximized, , there no need sort ( o(n·log(n) ). things done in o(n) (space , time).

ruby on rails 3 - LONGTEXT valid in migration for PGSQL and MySQL -

i developing ruby on rails application stores lot of text in longtext column. noticed when deployed heroku (which uses postgresql) getting insert exceptions due 2 of column sizes being large. there special must done in order tagged large text column type in postgresql? these defined "string" datatype in rails migration. if want longtext datatype in postgresql well, create it. domain do: create domain longtext text; create table foo(bar longtext);

php - Articles and Categories - The efficient way -

i want add categories website - more complex sorting. lets have article a . now, want a under main category a , on category c thats parent b . i thought of doing this: article have main category field, , parent_ids parent_ids every category item belong to. problem is: lets have: parent_ids: |1|5|2|7| . now in category id - 7 . how select query like? select * categories parent_ids '%|7|%' is efficient? there better idea? never store multiple values in 1 column. column values in normalized database should atomic (single-valued). the relationship between articles , categories many-to-many . means should have separate table, such article_category (article_id, category_id) containing 1 row each category each article in.

aggregate functions - How to make subquery fast -

for author overview looking query show authors including best book. problem query lacks speed. there 1500 authors , query generate overview taking 20 seconds. the main problem seems te generating average rating of books per person. selecting following query, still rather fast select person.id pers_id, person.firstname, person.suffix, person.lastname, thriller.title, year(thriller.orig_pubdate) year, thriller.id thrill_id, count(user_rating.id) nr, avg(user_rating.rating) avgrating thriller inner join thriller_form on thriller_form.thriller_id = thriller.id inner join thriller_person on thriller_person.thriller_id = thriller.id , thriller_person.person_type_id = 1 inner join person on person.id = thriller_person.person_id left outer join user_rating on user_rating.thriller_id = thriller.id , user_rating.rating_type_id = 1 thriller.id in (select top 1 b.id thriller b inner join thrille

ubuntu - Installing boost library in /usr/lib: sudo ./boostrap.sh command not found -

i trying install boost c++ libraries using these instructions . using ubuntu 10.10. have unzipped .zip file in /usr/lib , , cd'd boost_1_45_0 folder. run: sudo ./boostrap.sh --help and following error: sudo: ./bootstrap.sh: command not found i don't understand why is, bootstrap.sh there in current folder. is because of location installing to, or perhaps command within bootstrap.sh can't found? clean ubuntu install unsure why getting error when following instructions precisely. on unix, want install tarball , not .zip file. tarballs preserve unix permissions. to make ./bootstrap.sh executable, issue chmod 755 bootstrap.sh .

C# Hashtable "object reference not set" -

i have interesting problem trying solve. have following code below function merging values html file , giving me result set. using hashtable purposes. the function follows (please bear in mind inherited functionality , cannot changed @ present) public static string parsetemplate(string _filename, int _numberofsomething) { hashtable templatevars = new hashtable(); templatevars.add("nameoffile", _filename); templatevars.add("numberofsomething", _numberofsomething); templateparser.parser parser = new templateparser.parser( system.web.httpcontext .current.server.mappath("~/docs/templatenr.htm"), templatevars); return parser.parse(); } on our dev , live servers working perfectly. trying deploy app production server , "object reference not set instance of object". breaks on "hashtable templatevars = new hashtable();" line. bit puzzled. if coding problem should not work everywhere surely? t

mysql - getting individual records from a group by -

i have 2 tables, 1 table of names category tag , other table of scores each name id name category 1 dave 1 2 john 1 3 lisa 2 4 jim 2 and score table is personid score 1 50 2 100 3 75 4 50 4 75 i query returned like category totalscore names 1 150 dave, john 2 200 lisa, jim is possible 1 query? i can totals sum query , grouping category cannot see way names like. many thanks you need use group_concat: select category, sum(score) totalscore, group_concat(name) names categories join scores on scores.category = categories.category group category or better: group_concat(distinct name order name asc separator ',') names

c++ - template in cpp -

i hav following piece of code in module. controller name of class. allocate_route member function of it. while defining member function given as template<ui num_ip> void controller<num_ip>::allocate_route() { } ui unsigned integer. num_ip not defined where. has not used num_ip anywhere inside code. tell compiler statement. not able comprehend use of templates here. wat code do? that code implements function allocate_route defined in template class controller . when creating template classes, have 2 way implement functions: template <int a> class { void x() { ... } }; or template <int a> class { void x(); }; template <int a> void a<a>::x() { }

iphone - resignFirstResponder and close keyboard from anywhere? -

i have situation keyboard maybe open , nstimer pops view on text view. there anyway close keyboard globally rather text view resignfirstresponder method? reason ask textview dynamic in maybe there , not others. 1 way give tag. can multiple items referenced same tag? i think answer no interested in thoughts? thanks steve the endediting: method of uiview should trick. send superview of potentially existing uitextview when want dismiss keyboard.

c# - arp -a and route print -

i need write program displays information: netstat tcp / udp connections information ip ipconfig /all arp-a route print i have of them, have problem route print , arp -a . not want execute command using process.start() because not spectacular: process p = new process (); p.startinfo.windowstyle = processwindowstyle.hidden; p.startinfo.useshellexecute = false; p.startinfo.filename = "route"; p.startinfo.arguments = "print"; p.startinfo.redirectstandardoutput = true; p.startinfo.createnowindow = true; p.startinfo.standardoutputencoding = encoding.default; p.startinfo.windowstyle = processwindowstyle.hidden; p.start(); textbox1.text = p.standardoutput.readtoend(); i use foreach loop data listview or datagrid columns. has ~ t able me? how can data each column: destination, netmask, gateway, interface, metrics , permanent route? , in case of arp, internet address type of physical address? i suppose parse text retrieve out values want , put t

performance - Deep Cloning of Java objects (Not beans) -

the project working on has lot of objects serialized in order deep copy of the existing object. works fine until have multiple calls @ runtime in cased have 100, 200, or 1000 calls between components , hit performance headache. historical reason copying these objects being cloned , 2 different component working on same objects under different functionality should not change each other e.g. changes in swing ui should not change object values in backend until save or synchronized button pressed. we have quite large code base, thought if write clone based on reflection work faster compared serialization , either due our complex hierarchies of objects or due other reason , approach slower. i tried using cloneutils (sourceforge project) , slower (we not using hibernate @ all). spring beanutils not option (i assume docs uses beans i.e. introspection , in case use if fields exposed using non standard accessor , not able copy those). has idea , improve performance while still wor

mysql - PHP output couple times data from a column -

how output data column, like.. example - column 40 lines of query results , want output that, 10 30 . how php? for mysql, use limit offset , maxrows : select * tbl limit 9,20; will rows 10-30. note offset value 0 based, hence 9 rather 10.

javascript - jquery fading in from full opacity to 0.2 -

when page loads span overlay fade in full #000 opacity 0.2 , stay @ 0.2 when hover goes opacity 0 this code have @ moment $(function () { $('ul li a').append('<span id="load"></span>'); $('span').css('display', 'block').fadeout(3400); $('span') .animate ({ "opacity" : .2 }); $('span') .hover(function() { $ (this) .animate ({"opacity": 0}); }, function () { $(this).stop() .animate ({"opacity": .2 }); }); }); here example http://satbulsara.com/experiment-04/ something this? $(function () { var animateduration = 2000; /* no-no since should use id single element on page - should use class instead */ $('ul li a').append('<span id="load"></span>'); /* i'm not sure understood correctly, sounds want like: */ $('span').css

iphone - Receiving UINavBar Items actions -

- (void)viewdidload { //so created navbar item in detail view uibarbuttonitem * savebutton = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemsave target:self action:@selector(savefunc)]; self.navigationitem.rightbarbuttonitem = savebutton; } i want write code save data when user clicks save button in navbar. how write method this. stuck did when created navbar item through interface builder having troubles doing when create button through code. now implement method -(void) savefunc and dont forget add: [savebutton release];

matching - Best way in php to find most similar strings? -

hell, php has lot of string functions levenshtein, similar_text , soundex can compare strings similarity. http://www.php.net/manual/en/function.levenshtein.php which best accuracy , performance? similar_text has complexity o(max(n,m)**3) , levenshtein complexity of o(m*n), n , m lengths of strings, levenshtein should faster. both 100% accurate, in give same output same input, outputs each function differ. if using different measure of accuracy, you'll have create own comparison function.

php - Alternate line colors - understanding a code provided -

in example this : $c = true; // let's not forget initialize our variables, shall we? foreach($posts $post) echo '<div'.(($c = !$c)?' class="odd"':'').">$post</div>"; i understand how works. what trying example? alternate div row changing true false , false true? yes. $c = !$c assigns opposite value of $c itself. variable evaluated after assignment. this results in changing value between true , false . this codes takes advantage of foreach loop. if have normal for loop, use counter variable instead: for($i = 0, $l = count($posts); $i < $l; $i++) { echo '<div'.(($i % 2)?' class="odd"':'').">{$posts[$i]}</div>"; }

php - How to make a post open a specific link -

in wordpress blog, want make specific post open specific link, when clicks on post, don't want post open, instead want redirect visitor new link know. can please tell me how ? in other words want use 1 posts teaserview teaser post... recommend not doing way though possible. rather write different text in excerpt. "the wordpress excerpt optional summary or description of post; in short, post summary. "the excerpt has 2 main uses: it replaces full content in rss feeds when option display summaries selected in dashboard › settings › reading. depending on wordpress theme, can displayed in places quick summaries preferable full content: search results tag archives category archives monthly archives author archives " to show different image when in teasermode use custom fields: http://www.smashingmagazine.com/2010/04/29/extend-wordpress-with-custom-fields/ http://wordpress.org/extend/plugins/custom-field-template/

ASP.NET MVC2 ModelMetadataProviders: What's the difference between overriding CreateMetadata() and GetMetadataForProperty()? -

i'm statring explore framework's extension points, starting metadataproviders. i've implemented populating modelmetadata.isrequired property using requiredattribute succesfully, can't seem find difference between overriding createmetadata() or getmetadataforproperty() , since both options seem work. in general, examples i've seen override createmetadata() . what pro , cons of using either options? are there scenarios 1 of these preferred options? as extra: there resources (blogs, books) learn extension point? the getmetadataforproperty() declared on class modelmetadataprovider . associatedmetadataprovider derives modelmetadataprovider . createmetadata() declared on associatedmetadataprovider . dataannotationsmetadataprovider overridden in link provide derived associatedmetadataprovider . the mvc framework makes calls modelmetadataprovider 's getmetadataforproperty() method. the reason overriding createmetadata() working b

c++ - Don't understand why I can't call setCentralWidget in QMainWindow subclass -

//clposter.h class clposter : public qmainwindow { q_object public: clposter(); private slots: qwidget createcentralwidget(); void createactions(); void createmenu(); void createstatusbar(); void loadsavedposts(); }; //clposter.cpp clposter::clposter() { setwindowtitle("craigslist poster"); qwidget mainwidget = createcentralwidget(); setcentralwidget(mainwidget); // createactions(); // createmenu(); // createstatusbar(); // loadsavedposts(); // checkforactionsneeded(); //may want break more functions } the error i'm getting this: /usr/include/qt4/qtgui/qwidget.h:: in constructor ‘clposter::clposter()’: /usr/include/qt4/qtgui/qwidget.h:787: error: ‘qwidget::qwidget(const qwidget&)’ private /home/brett/projects/clposter/clposter-build-desktop/../clposter/clposter.cpp:9: error: within context /home/brett/projects/clposter/clposter-build-desktop/../clposter/clposter.cpp:10: error: no matching func

cell - Retrieving extracted text with Apache Solr -

i'm new apache solr, , want use indexing pdf files. managed , running far , can search added pdf files. however, need able retrieve searched text results. i found xml snippet in default solrconfig.xml concerning that: <requesthandler name="/update/extract" class="org.apache.solr.handler.extraction.extractingrequesthandler" startup="lazy"> <lst name="defaults"> <!-- main content goes "text"... if need return extracted text or highlighting, use stored field. --> <str name="fmap.content">text</str> <str name="lowernames">true</str> <str name="uprefix">ignored_</str> <!-- capture link hrefs ignore div attributes --> <str name="captureattr">true</str> <str name="fmap.a">links</str> <str name="fmap.div">ignored_</str> </lst> from here (http:/

php - Google's predictive text as you type code example - w/o auto suggest dropdown menu -

google's new predictive text predicts search "as type" in box showing next characters in light gray font. know of code this? aware of typical suggest drop down menus looking example code in search box - without auto suggest dropdown menu. i found 1 similar script here suggest words google when user type search query https://sourceforge.net/projects/searchpuppy/files/

c# - I'm looking for a SPARQL query program -

i have various sparql queries i'd test. there website or simple programm allows me test these queries? i dont want validator one , i'd execute query , result. as pointed above might see if provider has given web interface on sparql endpoint. normaly e.g. dbpedia , bbc backstage etc. for tool allows enter arbitrary endpoint can query might want check twinkle . it's program know this.

How does one build the java JRE from source (src.zip in JDK)? -

surprisingly enough couldn't find answer question. i trying rebuild java jre source. obtain java jre source extracting src.zip file in jdk. after making changes need make jre, how compile new source .java files (after can compress rt.jar file). thanks. some of java sources make rt.jar generated during build process, scripts , other means. of properties files generated way, , of properties files turned java source contributes rt.jar. without doing complete build first , populating 'gensrc' directory, won't have sources make rt.jar. taken from: http://www.java.net/forum/topic/jdk/java-se-snapshots-project-feedback/it-possible-just-build-rtjar so when javac on java files inside src.zip won't compile dependency graph broken (missing generated files) also have @ this: where full source code rt.jar?

phpmyadmin - Automatically initializing mySQL structures (without mysql shell) -

my isp not give me access mysql shell , therefore i'm forced in manual import of initial tables structures. can use : phpmyadmin , ftp sql server idea how automate php script? apart last resort consists of writing creation steps 1 one in php. perhaps sql dump interpreter issuing sql commands exist ? basically have create own interpreter.... quite simple simple actually.

c++ - Reading Data From Another Application -

how read data window's application? the other application has tg70.apexgridoledb32 according spy++. has 3 columns , few rows. need read data application writing. can me? i writing code in mfc/c++ operating systems donot allow directly reading data different applications/processes. in case "application" sub-process of main application, can use shared objects pass data , fro. however, in case, seems appropriate dump data on disk. suppose have applications , b. b can generate data , push data onto regular file or database. can access file/database proceed. note costly implementation because of sheer number of i/os performed. so if application generating lot of data, making both applications threads way go.

html - Page Navigation Won't Stay On One Line -

here html: <div id="leftmenu"> <ul> <li class="border"><a href="index.html">home</a></li> <li class="border"><a href="services.html">services</a></li> <li class="border"><a href="ourwork.html">our work</a></li> <li class="border"><a href="testimonials.html">testimonials</a></li> <li class="border"><a href="clients.html">clients</a></li> <li class="border"><a href="quote.html">get quote</a></li> <li class="border"><a href="documents.html">documents &amp; forms</a></li> <li class="border"><a href="charities.html">charity information</a></li> <li class

Python wrapper over c/c++ library to manipulate bits and wildcards -

the question is: there python wrapper on c/c++ library manipulate bits on lower lever ? (like bitmagic) main purpose search bit wildcard (smth like: 0b11**0110**101*11 , * - insignificant bit). wildcard not byte aligned (i mean might 10 bits or 13 bits length or evn more) not want create bicycle (using state machine , on...)

jsp - Getting current date in JSTL EL and doing arithmetic on it -

without using scriptlets, what's correct way doing date arithmetic in jsp? here examples i'm trying do: get current year (yyyy) subtract current year 1 previous year (yyyy) thanks! use <jsp:usebean> construct new date . use jstl <fmt:formatdate> year out of it. use el substract it. <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <jsp:usebean id="now" class="java.util.date" /> <fmt:formatdate var="year" value="${now}" pattern="yyyy" /> <p>current year: ${year}</p> <p>previous year: ${year - 1}</p> result: current year: 2011 previous year: 2010 note pattern full year yyyy , not yyyy .

.net - Finding Needle in a haystack (thread in the process) -

one of threads in process burning 1 cpu core full extent. 8 cores, 12,5% cpu used. @ (procexp screenshot) http://dl.dropbox.com/u/10020780/scr1.png another thing bothers me start address of 0x0 !?!? i trying find thread in list provided vs2008 thread view, not single thread there (or have overlooked) has tight loop (without sleep() ) or clear indication of trouble. any hints? case update: it seems i'm beyond code realm on one; i'll post pictures obtained stack button, can maybe have hunch on issue @ hand. first situation http://dl.dropbox.com/u/10020780/smallstack.png second situation (same thread, 2 alternating) http://dl.dropbox.com/u/10020780/largerstack.png guys, i? use windows media, sockets, ... have tried take hang dump adplus, , running !runaway commnand in windbg ? show sure thread, , can use !clrstack thread aws doing.

java - Permutations of a string -

public class permute { public static void main(string[] args) throws ioexception { system.out.println("enter string"); bufferedreader bufreader = new bufferedreader(new inputstreamreader(system.in)); string text = bufreader.readline(); shuffle("",text); } public static void shuffle(string dummy, string input){ if(input.length() <= 1) system.out.println(dummy+input); else{ for(int i=0; <input.length();i++){ input = input.substring(i,1) + input.substring(0,i) + input.substring(i+1); shuffle(dummy+input.substring(0,1),input.substring(1)); } } } } am trying print permutations of string entered. , cannot guess going wrong because on paper find executing. going wrong. try change shuffle: public static void shuffle(string dummy, string input){ if(input.length() <= 1) system.out.println(d

boolean - what are the steps to simplifying this (a+b)(a+!b)=a -

what steps simplifying (a+b)(a+!b)=a (a + b).(a + !b) = a.(b + !b) ; distributivity [1] = a.1 ; complements [1] = see wikipedia page on boolean algebra

html5 - simple php websocket example -

could please give me simple websocket code. i creating websocket example it's not working fine , don't know what's problem. thanks. examples: server-side , client-side . take @ source here: http://www.dwalker.co.uk/source_code/nav.html?phpjobscheduler_3.5/pjsfiles/functions.php.source.html from line 310 shows how connect using both curl , fsockopen hope helps...

python - How to close Toplevel window after the function it calls completes? -

edit: let me include code can specific help. import tkinter def gopush(): win2=tkinter.toplevel() win2.geometry('400x50') tkinter.label(win2,text="if have prepared describes select go otherwise select go back").pack() tkinter.button(win2,text="go",command=bounceprog).pack(side=tkinter.right,padx=5) tkinter.button(win2, text="go back", command=win2.destroy).pack(side=tkinter.right) def bounceprog(): d=1 print d root=tkinter.tk() root.geometry('500x100') tkinter.button(text='go', command=gopush).pack(side=tkinter.right,ipadx=50) root.mainloop() so when run program opens window says go. go opens window asks if youve read help(which didnt include in code sample) , offers go back(which goes back) , go. when select go calls function prints 1. after prints 1 want window close returning original window containing go button. how do such thing? @kosig won't quit root. ie. self.foo = tk.tople

ilookup - filter linq lookup based on values -

i filter linq lookup based on values: the lookup: ilookup<int, article> lookup here's i've got far isn't working: ilist<int> cityindexes = getcityindexesbynames(cities); lookup = lookup .where(p => p.any(x => cityindexes.contains((int)x.articlecity))) .selectmany(l => l) .tolookup(l => (int)l.articleparentindex, l => l); just clarify: want articles city index contained in above city index list. the problem code posted, you're getting articles same id article has matching city index. if unpack groups first, there's no problem. ilist<int> cityindexes = getcityindexesbynames(cities); lookup = lookup .selectmany(g => g) .where(article => cityindexes.contains((int)article.articlecity))) .tolookup(article => (int)article.articleparentindex); or lookup = ( g in lookup article in g cityindexes.contains((int)article.articlecity))) selec

Ruby vs Perl in network programming -

whats difference between ruby , perl when comes networking. better use , why? both languages similar , if you're starting out ruby easier learn perl. but if have specific area targeting, comes down has better libraries in area. , in questions breadth , quality of libraries, perl wins battles because of cpan . take few minutes , search types of libraries you're interested in , compare you'll find on ruby gems

asp.net - Do all instances of the same ASPX page share the same static field? -

let's consider page's code-behind: public partial class products : page { private static someclass sharedfield; public product() { // ... logic } } do products pages instances share same sharedfield , know basic concept of static fields. in case, really? users can have access (and can't have own instance of) same static field on website-level? if so, in aspects used web developer? or non-recommended practice? yes, there single instance of static field users, within single worker process. if have web farms/web gardens, each have own static instance. if worker process restarts, you'll new static instance. you'll have use locking around shared field ensure thread safety. as why use that, i'm not sure, never it. best example can give built-in static httpcontext.current , gives access request, response, etc.

php - magic_quotes help -

recently have been faced problematics magic_quotes provides. did notice there 3 different type(s) what? magic_quotes_gpc magic_quotes_runtime magic_quotes_sybase i know it's practice check enabled magic quotes ones should check if not gpc? if (get_magic_quotes_gpc() || get_magic_quotes_runtime()) { $string = stripslashes($string); } i want able have similar runs in code way if ever issue server working fix magic quote issues. how guys/girls perform check that's successful or correct? magic_quotes_gpc() applies data coming (g)et, (p)ost, , (c)ookies magic_quotes_runtime() applies data coming in source (file_get_contents(), fread(), etc...) magic_quotes_sybase switches between escaping single quote ( ' ) , backslash ( \ ), not databases use backslashes escaping (like sybase).

google app engine - Spring-MVC forms on GAE -

i trying create form using spring framework, according (http://groups.google.com/group/google-appengine-java/ browse_thread/thread/d93fd7385bf85bf7), need override initbinder. well, think did , still doesn't work. my jsp (priceincreasejsp): <%@ page contenttype="text/html;charset=utf-8" language="java" iselignored="false" session="false" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/ form" %> <form:form method="post" commandname="priceincrease"> increase (%): <form:input path="percentage"/> <input type="submit" value="execute"> </form:form> myapp-servlet.xml has following: <bean name="/priceincrease.htm" class="myapp.web.priceincreaseformcontroller"> <property name="sessionform" value="true"/> <property name="commandname" value=&