Posts

Showing posts from February, 2013

php - How to send SQL count data & array data together? -

i have script designed print out values of students have accrued more 3 tardies. want script print out both student name, , amount of times they've been tardy, far i've been able print out names following script: $sql = "select distinct studentid,classid,date attendance_main status = 'tardy' , classid '%adv%'"; $result = mysql_query($sql) or die (mysql_error()); while($row=mysql_fetch_array($result)) { $studentid = $row['studentid']; $sql2 = "select distinct studentid,classid,date attendance_main studentid = '$studentid' , status = 'tardy' , classid '%adv%'"; $result2 = mysql_query($sql2) or die (mysql_error()); while($row2=mysql_fetch_array($result2)) { $tardycount = mysql_num_rows($result2); $studentid = $row2['studentid']; if($tardycount >= 3) { $sql3 = "select * students rf...

How to send multiple items to PayPal -

i want send multiple item names , item prices paypal unable post item name , price below code can please me? <form method="post" name="cart" action="https://www.sandbox.paypal.com/cgi-bin/webscr"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="navive_1295939206_biz@gmail.com"> <input type="hidden" name="lc" value="us"> <input type="hidden" name="currency_code" value="usd"> <input type="hidden" name="button_subtype" value="services"> <input type="hidden" name="notify_url" value="http://newzonemedia.com/henry/ipn.php" /> <input type="hidden" name="bn" value="pp-buynowbf:btn_buynowcc_lg.gif:nonhosted"> <input type=...

python - Django: Uploading photo and word doc on same form not working correctly -

i have upload form allow user upload photo, word doc, or both. need logic long have photo or document selected uploading, form valid , upload work. works when have both photo , doc, appears randomly work when it's photo or document. here current code: def upload(request): """ uploads document/photo """ if request.method == 'post': form1 = documentform(request.post, request.files) form2 = photoform(request.post, request.files) if form1.is_valid() , form2.is_valid() : post1 = document(user = request.user, document= form1.cleaned_data['document'], title = form1.cleaned_data['title']) post1.save() post2 = photo(user = request.user, alias = request.user.username, img = form2.cleaned_data['img'], title = "") post2.save() return httpresponse(template.template(''' <html><head><title>uploaded</title></...

c# - Most efficient way to reverse the order of a BitArray? -

i've been wondering efficient way reverse order of bitarray in c#. clear, don't want inverse bitarray calling .not(), want reverse order of bits in array. cheers, chris public void reverse(bitarray array) { int length = array.length; int mid = (length / 2); (int = 0; < mid; i++) { bool bit = array[i]; array[i] = array[length - - 1]; array[length - - 1] = bit; } }

android - App Freez and UI Blocking -

hy! i have 2 classes: main: public class main extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //setcontentview(r.layout.main); startactivityforresult(new intent(main.this, login.class), 1); } } login: public class login extends activity{ progressdialog pd = null; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.login); final edittext user = (edittext)findviewbyid(r.id.login_etuser); final edittext pw = (edittext)findviewbyid(r.id.login_etpw); button btlogin = (button)findviewbyid(r.id.login_btlog); final thread thread = new thread (){ public void run() { try { string result = "...

objective c - how to receive object (on iphone side)returned by webservice? -

in xcode want call webservice return value object ? 1. soap message call web service ? 2. how xcode receive object , use? right have 1 method return string , know how call use of soap, dont know if change in case of object.. thank in advance generally webservice has return kind of standard xml. if webservice conforms strictly soap return soap-xml message like: <?xml version="1.0"?> <soap:envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:header> </soap:header> <soap:body> <m:getstockprice xmlns:m="http://www.example.org/stock"> <m:stockname>ibm</m:stockname> </m:getstockprice> </soap:body> </soap:envelope> for more information see soap on wikipedia

cluster computing - Programming through PBS -

i want schedule program on multiple nodes how can so.im new programming got hint pbs.how can following. in advance if have particular problem, should describe in question. if have no idea how deal pbs, should read following: http://www.phy.bme.hu/~cluster/docs/pbs.html http://www.adaptivecomputing.com/resources/docs/torque/index.php (section 2) once again, advise post complete description of want submit on cluster (kind of job, input data, output data, number of jobs, ...), can bit more.

vb6 - How do I redistribute a VB 6 application that uses Crystal Reports? -

assuming target system has "crystal reports visual studio 2008", how can distribute vb 6 application excutable along report file? moving executable , report file doesn't work. want know how create redistributable package. use cr10. my suggestion create setup program automatically install application's executable file , of dependencies (including crystal reports runtime libraries) onto target machines. you could use package , deployment wizard provided visual basic 6, wouldn't recommend it. i'm particularly fond of inno setup , free installer simple, intuitive interface used many different commercial , open-source applications. it's easy use install vb 6 applications, well. see this knowledge base article listing of dlls need include part of vb runtime, , specific instructions on how modify installer script accordingly.

serialize graph of javabeans into xml having separate xml file for each java instance -

could please suggest framework or tool serialize graph of javabeans xml having separate xml file each java instance? java xml tools managed find serialzie single file, need them separate, example: model: class { b b; } class b { } a = new a(); a.b = new b(); serialize : a.xml: <a> <property name="b>somehow ref b</property> </a> b.xml <b> </b> best regards, ebu. you use jaxb , xmladapter following: a import java.util.arraylist; import java.util.list; import javax.xml.bind.annotation.xmlrootelement; import javax.xml.bind.annotation.adapters.xmljavatypeadapter; @xmlrootelement @xmljavatypeadapter(myadapter.class) public class { private b b; private list<c> c; public a() { c = new arraylist<c>(); } public b getb() { return b; } public void setb(b b) { this.b = b; } public list<c> getc() { return c; } ...

How to scroll text Horizontally in textview in android -

possible duplicate: horizontal scrolling text in android <textview android:id="@+id/dtitle" android:layout_marginleft="100dp" android:text="title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scrollhorizontally="true" /> this code in xml file do mean marquee ?

java - How do I use the TrackBall API in Blackberry? -

i want scroll , down in custom menu have made using trackball, how receive , filter trackball events? (i know how process keyboard events using protected boolean keychar(char key, int status, int time) .) your best bet use navigationclick, navigationmovement , navigationunclick methods in field: http://www.blackberry.com/developers/docs/4.2.1api/net/rim/device/api/ui/screen.html#navigationmovement%28int,%20int,%20int,%20int%29 or if want events before of fields do, override same methods on top-level screen. rim discourages use of old trackwheel api. navigation way go.

iphone - Call function from UIActionSheet -

i have stupid problem uiactionsheet. want function "sendmail" launched clicking on first button of action sheet. so here did : - (void)actionsheet:(uiactionsheet *)actionsheet clickedbuttonatindex:(nsinteger)buttonindex{ nslog(@"%d", buttonindex); if (buttonindex == 0) { sendmail(); } } i declared function sendmail in .h file, contains : -(void)sendmail; -(void)actionsheet; when want build , run, have following error : undefined symbols: "_sendmail", referenced from: -[my1viewcontroller actionsheet:clickedbuttonatindex:] in my1viewcontroller.o ld: symbol(s) not found collect2: ld returned 1 exit status i don't understand going on. if copy/paste what's inside sendmail function inside (void)actionsheet function, works charm. looks call of sendmail function problem, , don't understand why. thanks ! objective-c calls methods not functions , it's this: [self sendmail]; ...

Sample algorithm to "linearize" a graph -

Image
simplifying business example, have following situation: some objects should distributed in graph in "linear" way possible given "thermometer". say, voyager visits cities. several cities visited multiple times. so, have list of cities in ordinate axis (that may duplicated), , time in abscissas one. now, given path, (a => x => => b => c) should display line, in "most linear way possible". by eg. in image above, green line optimal one (1 > 2 > 3 > 4 > 5) but there multiple possible outputs (1 > 2 > 1 > 4 > 5) (1 > 2 > 3 > 4 > 5) (1 > 2 > 6 > 4 > 5) (3 > 2 > 1 > 4 > 5) (3 > 2 > 3 > 4 > 5) (3 > 2 > 6 > 4 > 5) (6 > 2 > 1 > 4 > 5) (6 > 2 > 3 > 4 > 5) (6 > 2 > 6 > 4 > 5) is there algorithms helping in such situations? construct graph node pairing of city+value , time (e.g. a(3)/1). edg...

c++ - Boost. Multithreading -

class accel{ public: accel(int threads, string params); private: void getfile(int from, int to); void download(int threads); }; void accel::download(int threads){ boost::thread g(&getfile(0, 1)); //<<<< } gives error '&' requires l-value. have been doing example. how make work? boost::thread g (boost::bind(&accel::getfile, this, 0, 1));

iis 7 - Service Unavailable 503 + The HTTP service located at http://localhost/ProductsService/Service.svc is too busy -

hi have been trying solve problem, couldn't it. the problem http://localhost/productservice/service.svc when type address in browser gives me 503 service unavailable error when run code vs 2010 gives me the http service located @ http://localhost/productsservice/service.svc busy. exception. productservice running in asp.net v4.0 integrated application pool applicationpoolidentity. i got no idea need do! (windows 7 home & iis7) basichttpbinding used the server side config <?xml version="1.0"?> <configuration> <connectionstrings> <add name="adventureworksentities" connectionstring="metadata=res://*/productsmodel.csdl|res://*/productsmodel.ssdl|res://*/productsmodel.msl;provider=system.data.sqlclient;provider connection string=&quot;data source=pinchy\sqlexpress;initial catalog=adventureworks;integrated security=true;multipleactiveresultsets=true&quot;" providername="system....

php - MySQL left join problem -

$squery = ' select distinct sql_calc_found_rows if( `profiles`.`couple`=0, `profiles`.`id`, if( `profiles`.`couple`>`profiles`.`id`, `profiles`.`id`, `profiles`.`couple` ) ) `id` `profiles`'; $scountries = implode("','", $mvalue); $sjoin .= " left join `hm_locations` on (`hm_locations`.`country` in '".$scountries."' , `hm_locations`.`profileid` = `profiles`.`id`) "; this query gathered different functions put function, want know how re-write left join section work properly. i'm trying add on own left join here search grab ids hm_locations country matches search. i want left join section because that's part not working. thanks alot you need put countries in parenthesis: "... `hm_locations`.`country` in ('".$scountries."') ..."

jquery - SlideDown Div with Close link -

greetins, i wanna use sliding div displaying messages "profile updated". this code. div slides down when load page , dissapers after few seconds (the delay). want able close div before timeout link, cant attach slideup it... why? $("#message").hide(); $("#message").slidetoggle('slow', function() { $(this).delay(2000).slidetoggle("slow"); }); $("#close").click(function() { $("#message").slideup(); }); }); <div id="message" style="display:none; border: 3px solid #ccc; width: 500px; height: 30px; background: #eee;"> message goes here! <a id="close" href="#" style="float: right;">close div</a> </div> try adding .stop() close div click event. $("#close").click(function() { $("#message").stop().slideup(); }); jsfiddle example

How to selectivly compile C# projects in Visual Studio 2005? -

i have following setup: project a project b depends on a each project has pre , post build events. of time make changes in project b. every time tell vs compile project b other project compiled too. happens despite facts no changes done , date dll present. how tell vs compile project b in case? thanks in advance if right click on solution , select configuration manager can tell projects not build.

objective c - Hooking up events to NSWindowController in single window application -

i've been working iphone/ipad while using xcode , have no trouble hooking required connections uiviewcontroller in interface builder make things work, seems more difficult when attempting simple app osx. i've created new cocoa application in xcode (non-document based) main nib file window. have created new nswindowcontroller subclass called testwindowcontroller . in ib, change file's owner new testwindowcontroller . i've added ibaction 's controller subclass , hooked them in ib. all appears fine , compiles when @ debug log see: could not connect action sayhelloclicked: target of class testwindowcontroller. i've been going round in circles hours trying various methods , can't actions hooked up. going wrong? i should mention tried ditching view controller , adding actions main nsapplicationdelegate class same results. thanks, j

java - Multiple Instances of <C:if / Choose /When> condition to be made as one -

1: have jsp multiple html "tr's" <tr>'s my page <% ...%> <html> ... <body> <table> <tr class="1"> first line</tr> <br/> <tr class="2"> second line</tr> <br/> <tr class="3"> third line</tr> <br/> <tr class="4"> fourth line</tr> <br/> <tr class="5"> fifth line</tr> <br/> ... </html> 2: getting user session (if logged in). note>>:using liferay themedisplay here <%string useremail=themedisplay.getuser().getemailaddress();%> <c:set var="useremail" value="<%=useremail%>"></c:set> 3: made check see if guest or registered/logged in user. then display changes first , last "tr's" logged-in user. <% ...%> <html> ... <body> <table> <c:if test=...

objective c - declare a forward reference to block typedef? -

in 1 header file have like: typedef void (^myblock)(void); i need use same exact reference in header file. sure, can #import 1 header file another, or include typedef in global pre-compiled header, instead there way forward reference block typedef? not far know, i'd put in shared header , include needed.

html - Link around inline-block span and Internet Explorer -

the following works fine in chrome , firefox, , makes container clickable. in internet explorer clickable too, change cursor indicate inner div , not either span . i can fix cursor:pointer , more importantly not allow right click open in new tab. is there solution problem? thanks! <html> <head> <style type="text/css"> span{display:inline-block;width:100px} </style> </head> <body> <a href="/"> <div> <div>title</div> <span>text</span><span>text</span> </div> </a> </body> </html> your html invalid, although browsers expect, never validate. as clickable div, can use jquery want: $(function (){ $("#clickme").click(function(event) { event.preventdefault(); window.open('http://www.whatever.com'); }); }); example here .

crunching serialized data vs adding more fields - php - mysql -

okay, let's pretend i've got fifty pieces of information want store in each record of table. when pull data out, i'm going doing basic maths on of them. on given page request, i'm going pull out hundred records , calculations. what performance impacts of: a - storing data serialized array in single field , doing crunching in php vs b - storing data fifty numeric fields , having mysql sums , avgs instead please assume normalization not issue in fifty fields. please assume don't need sort of these fields. thanks in advance! first, never store data serialized , it's not portable enough. perhaps in json encoded field, not serialized. second, if you're doing data (searching, aggregating, etc), make them columns in table. , mean (sorting, etc). the time it's acceptable store formatted data (serialized, json, etc) in column if it's read only. meaning you're not sorting on it, you're not using in clause, you're not...

Quartz Integration with Spring -

i have web application , trying start quartz scheduler programmatically in spring. have service class create instance of schedulerfactory , scheduler. the code follows. @service("auctionwinnerservice") public class normalauctionwinnerserviceimpl implements auctionwinnerservice { public static final string normal_auction = "normal auction"; public static int normal_auction_counter = 0; private schedulerfactory schedulerfactory; private scheduler scheduler; public void declarewinner(int auctionid, map<string, object> parametermap) { system.out.println("inside declarewinner of normalauctionwinner"); schedulerfactory = new stdschedulerfactory(); try { scheduler = schedulerfactory.getscheduler(); system.out.println("got scheduler : "+scheduler); } catch (schedulerexception e1) { e1.printstacktrace(); } jobdetail jd = new jobdetail()...

image - CSS blogspot background positioning help -

i'm trying hands on coding skin blogspot.com got else done except 1 issue part of design. beside title of blog, i've design such there image floating right next title of blog. easy if use add in tag widget section, if share among people (where have different blog name result in different length) image move according title's length. i'm having problem this. i've no idea how should attempt on can't use php on blogspot =/ to better understand said, here's example of meant http://i558.photobucket.com/albums/ss23/crayscrays/randomfonthelp.jpg since it's applied background image, can set value "right", make go right side of element. say, example, markup: <h1>this blog post</h1> your css this: h1 { background: transparent url(myimage.jpg) no-repeat right center; padding-right: [widthofimage]px; } that align image right side of text.

random - Python list does not shuffle in a loop -

i'm trying create randomized list of keys iterating: import random keys = ['1', '2', '3', '4', '5'] random.shuffle(keys) print keys this works perfect. however, if put in loop , capture output: a = [] x in range(10): random.shuffle(keys) a.append(keys) i getting 10 times of same shuffle?! fundamentally wrong here... in advance. the problem shuffling list in place , adding reference of list combined list. end same list structure 10 times. "fundamental change" list has copied before appending it. here bit more "pythonic" way of achieving same result list comprehension. import random def shuffleacopy(x): b = x[:] # make copy of keys random.shuffle(b) # shuffle copy return b # return copy keys = [1,2,3,4,5,6,7,8] = [shuffleacopy(keys) x in range(10)] print(a)

lucene - Using Hibernate Search over 2 subclasess with a shared property -

i have following data model: @entity @inheritance(strategy = inheritancetype.table_per_class) public abstract class abstractrecord implements serializable { ... @id @generatedvalue(strategy = generationtype.table) @column(name = "id", nullable = false) @documentid private integer id; ... } @entity @inheritance(strategy = inheritancetype.table_per_class) @namedqueries(...) }) public abstract class abstractentrydetail extends abstractrecord implements serializable { ... } @indexed(index = "entrydetailindex") @entity @table(name = "nacha_entry_detail") @namedqueries(...) }) public class entrydetail extends abstractentrydetail implements serializable { ... @field(index = index.tokenized, store = store.no) @column(name = "receiver_name", nullable = false) private string receivername; ... } @indexed(index = "entrydetailctxindex") @entity @table(name = ...

ruby on rails - How can I send a file as a parameter from controller to model? -

from controller, there way call method in model file parameter, without getting uninitialized stream error when try use received file in model? i trying use delayed_job upload files s3 (using paperclip). use heroku, request time out after 30 secs, , want allow multiple file uploads @ once. the same problem talked in delayed_job google group , there never solution. you'll have save file locally first, or directly s3 without going through delayed job. option have user upload directly s3 rather going through stack - approach has other issues around authentication , ability screen data first, handle data screening in delayed job instead.

php - UTF8 real decode -

possibly simple question , wondering how can decode utf8 characters readable characters. for example : l&#x27;heure supr&#xea;me into l'heure suprême i tried following : utf8_encode , utf8_decode , `html_entity_decode($string, ent_compat, "utf-8");` the output never gave me correct characters , example html_entity_decode($string, ent_compat, "utf-8"); returned l'heure suprême edit : stupid question , html_entity_decode($string, ent_compat, "iso-8859-15"); did trick in order results displayed, you'll need tell receiving end, encoding used: header('content-type: text/plain; charset=utf-8'); $string = 'l&#x27;heure supr&#xea;me'; print html_entity_decode($string, ent_compat, "utf-8"); the output without explicitly naming charset encoding provokes undefined behavior. earlier today, suggested a great article joel spolsky on unicode , character sets. makes read , i...

asp.net - Mulitple linkbuttons in user control needs to call event handler in the aspx page -

i have multiple user controls on page , each of them have multiple linkbuttons perform same logic on server side. there way linkbuttons have same event handler defined in code behind of page? if needed, can change linkbuttons other html or asp.net control long can support clickable image. inside usercontrol create event , wire up. call linkbuttons onclick event handler: usercontrol.ascx: <asp:linkbutton runat="server" id="linkbutton1" onclick="linkbuttonclicked"> click me </asp:linkbutton> <asp:linkbutton runat="server" id="linkbutton2" onclick="linkbuttonclicked"> click me again </asp:linkbutton> usercontrol.ascx.cs public event eventhandler usercontrollinkclick; protected void linkbuttonclicked(object sender, eventargs e) { if (this.usercontrollinkclick!= null) { this.usercontrollinkclick(this, e); } } inside parent page wire user controls usercont...

iphone - Putting a back button inside of a Modal view pushed by another modal view -

check this, im pushing modal view inside of modal view. but, im trying put button inside of modal view, without luck. what im doing wrong? thanks! cadastroviewcontroller *addcontroller = [[cadastroviewcontroller alloc] initwithnibname:@"cadastroviewcontroller" bundle:nil]; // wrap view nicely in navigation controller uinavigationcontroller *navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:addcontroller]; // can set style of stuff before show navigationcontroller.navigationbar.barstyle = uibarstyleblackopaque; navigationcontroller.navigationitem.leftbarbuttonitem = [[uibarbuttonitem alloc] initwithtitle:@"ok" style:uibarbuttonitemstylebordered target:self action:@selector(buy)]; // , want present view in modal fashion nice , animated [self presentmodalviewcontroller:navigationcontroller animated:yes]; // make sure release stuff [navigationcontroller release]; [addcontroller release]; it seems me, problem here...

c++ - Automatically Relaunch Application On Crash? -

on android, i'm running application using ndk runs series of tests in c++. if ever 1 of tests fails, means crash, i'd application relaunch , start @ next test. i wish use exceptions ndk doesn't support them. is possible? why application have crash? why not catch exception being thrown? compiler doesn't enforce add try..catch block, runtimeexceptions might still thrown. you can use thread.setdefaultuncaughtexceptionhandler . note must called per thread. if, reason, solutions above not suitable you, create background service acts watchdog timer . edit: check this link : custom version of ndk supports c++ exceptions. found in this thread .

c# - How to move item in listBox up and down? -

i have listbox1 object , contains items. have button move selected item , move selected item down. should code 2 buttons? private void upclick() { // if first item isn't current 1 if(listbox1.listindex > 0) { // add duplicate item in listbox listbox1.additem(listbox1.text, listbox1.listindex - 1); // make current item listbox1.listindex = (listbox1.listindex - 2); // delete old occurrence of item listbox1.removeitem(listbox1.listindex + 2); } } private void downclick() { // if last item isn't current 1 if((listbox1.listindex != -1) && (listbox1.listindex < listbox1.listcount - 1)) { // add duplicate item down in listbox listbox1.additem(listbox1.text, listbox1.listindex + 2); // make current item listbox1.listindex = listbox1.listindex + 2; // delete old occurrence of item listbox1.removeitem(listbox1.listindex - 2); } }

iphone - Use LLVM compiler by default for all Xcode projects? -

i enjoy switching gcc llvm compiler, have switch manually every time start new project, or there way make llvm default compiler? i'm talking xcode 3. thanks. to accomplish have modify project template within developer directory. navigate templates (probably like: /developer/platforms/iphoneos.platform/developer/library/xcode/project templates/ once you're there, can select project template wish modify, , locate it's .xcodeproj file. can "show package contents" , inside project.pbxproj . can modify file , edit in build setting change default compiler. you'll have find each section relates build settings each configuration (debug, release etc.), search /* begin xcbuildconfiguration section */ . then you'll have add gcc_version key , com.apple.compilers.llvm.clang.1_0 value (1_0 in instance llvm 1.6 according xcode. assume key-name gcc_version has gcc in legacy reasons, updated compiler_version or in future). save template , cr...

ruby on rails - How would you allow a user to authenticate and post a comment at the same time -

i'm looking implement similar feature disqus app user can post comment , login site @ same time. the way see working user shown text field comment along submit button. when submit button pressed user shown variety of authentication providers (facebook, twitter etc) , after authentication complete comment posted. i have commenting , authenticating working 2 separate actions i'm wondering best solution combine them one. you use modular popup authentication instead of redirecting new page. option have drop-down button submit button options "post facebook", "post using twitter account"...

Assembly loading error in my ASP.NET app, and the assembly isn't even referenced anymore -

i had code referenced noesis.javascript assembly (http://javascriptdotnet.codeplex.com) , had renamed noesis.javascript.dll noesis.javascript.0.4.dll. referenced file through visual studio, , when launched web app in asp.net development server, got error: could not load file or assembly 'noesis.javascript.0.4' or 1 of dependencies. located assembly's manifest definition not match assembly reference. (exception hresult: 0x80131040) i tried remove reference , re-reference older version of library. got same error. tried remove reference entirely , comment out code used library. still same error. have tried explicitly close out asp.net development server icon in system tray, still occurs. can find no reference of assembly anywhere in project now, yet error persists. might happening? there cache i'm not finding? how can resolve error? go registry , set [hklm\software\microsoft\fusion!enablelog] (dword) 1. refresh page , error output ...

iphone - [NSURL URLWithString:stringContainingSpecialCharacters] -

say, have address bar uitextfield called textfield, , uiwebview named webview. of time follow code works: [webview loadurl:[nsurl urlwithstring:textfield.text]]; when put in long string special characters, urlwithstring: returns null . readability bookmarklet example: javascript:(function(){readconvertlinkstofootnotes=true;readstyle='style-newspaper';readsize='size-medium';readmargin='margin-wide';_readability_script=document.createelement('script');_readability_script.type='text/javascript';_readability_script.src='http://lab.arc90.com/experiments/readability/js/readability.js?x='+(math.random());document.documentelement.appendchild(_readability_script);_readability_css=document.createelement('link');_readability_css.rel='stylesheet';_readability_css.href='http://lab.arc90.com/experiments/readability/css/readability.css';_readability_css.type='text/css';_readability_css.media='all';docum...

c# 3.0 - How can I execute different methods at the same time? -

in application using dataset , 4 methods below. dataset ds=new dataset(); ds=businesslogiclayerobject.method1(a,b,c,d); ds=businesslogiclayerobject.method2(a,b,c,d,e); ds=businesslogiclayerobject.method3(a,b,c,d,e,f); ds=businesslogiclayerobject.method4(a,b,c,d,e,f,g,h); (a,b,c,d,e,f,g,h) parameters stored procedure in businesslogic layer. till did not implement threading concept executing 1 one.this takes lot of time result set in dataset. how can execute above 4 methods @ same time? help me. regards, n.sriram since using .net 3 make use backgroundworker take care of marshaling effort ui thread of other complexities of threading. not take care of locking; sure address locking aspect if needed. backgroundworker worker = new backgroundworker(); worker.dowork += new doworkeventhandler(ongrabdata); worker.runworkercompleted += new runworkercompletedeventhandler(ongrabdatacompleted); worker.runworkerasync(new dataclass(a,b,c,d,e,f,g)); dataclass encapsulate par...

android - Matching incoming and outgoing phone numbers -

i'm making sms viewing application , using contentresolver obtain sms messages on phone (yes, understand risks). other applications, want group messages same person 1 thread, display latest message them, , order contacts date of last message. when comes address values of incoming messages, contain country code (e.g. +44123456789). when user saves contacts, ignore country code , type in local format. outgoing messages stored 0123456789. so, database contain same address in both formats, +44123456789 , 0123456789. how match 2 , remove duplicate address? note: 1) messages same person may not have same "thread id" 2) there may not "contact id"/"display name" value address actually, messages , same contact in same thread, therefore have same thread_id. (apart multiple recipient messages, in own thread). by looking in content://sms , storing list of obtained thread_ids can make sure there's no duplicates. address value can use follow...

Rails: on-the-fly streaming of output in zip format? -

i need serve data database in zip file, streaming on fly such that: i not write temporary file disk i not compose whole file in ram i know can streaming generation of zip files filesystemk using zipoutputstream here . know can streaming output rails controller setting response_body proc here . need (i think) way of plugging 2 things together. can make rails serve response zipoutputstream ? can zipoutputstream give me incremental chunks of data can feed response_body proc ? or there way? i had similar issue. didn't need stream directly, had first case of not wanting write temp file. can modify zipoutputstream accept io object instead of filename. module zip class iooutputstream < zipoutputstream def initialize io super '-' @outputstream = io end def stream @outputstream end end end from there, should matter of using new zip::iooutputstream in proc. in controller, you'd like: self.response_body ...

c++ - Immutable container with mutable content -

the story begins thought pretty simple : i need design class use stl containers. need give users of class access immutable version of containers. not want users able change container (they can not push_back() on list instance), want users able change contained objects (get element back() , modify it) : class foo { public: // [...] immutablelistwithmutableelementstype getimmutablelistwithmutableelements(); // [...] }; // [...] mylist = foo.getimmutablelistwithmutableelements(); myelement = mylist.back(); myelement.change(42); // ok // [...] // mylist.push_back(myotherelement); // not possible at first glance, seems const container do. of course, can use const iterator on const container , can not change content. at second glance, things specialized container or iterator come mind. end that. then, thought "someone must have done !" or "an elegant, generic solution must exist !" , i'm here asking first question on : how d...

Translate Wordpress Plugin -

Image
i have translated plugin in german. membership 1.x i took language.pot file , translate lines. after changed information: i have uploaded file server , replaced old one... stil in english... blog in german "de_de" can me?! you shouldn't translate .pot file (it's source of translations), should instead copy , name after textdomain specified inside plugin (assuming it's written support translation). if there other translations made, @ name of files, otherwise line in plugin: load_plugin_textdomain('name', false, dirname(plugin_basename(__file__))); here name should call file, followed locale specification i.e.: name-de_de.po then have compile .po file .mo (there several ways depending on operating system) , upload in correct directory.

Bulk insert of component collection in Hibernate? -

i have mapping listed below. when update detached categories item (that doesn't contain hibernate class comes dto converter) notice hibernate first delete employer wages instances (the collection link) , insert employer wage entries one-by-one :(... i understand has delete , insert entries detached. but, don't understand, why hibernate not inserting entries through bulk-insert?.. is: inserting employer wage entries in 1 sql statement ? how can tell hibernate use bulk-insert? (if possible). tried playing following value didn't see difference: hibernate.jdbc.batch_size=30 my mapping snippet: <class name="com.sample.categoriesdefault" table="dec_cats" > <id name="id" column="id" type="string" length="40" access="property"> <generator class="assigned" /> </id> <component name="incomeinfomember" class="com.sample.incomeinfodefault"...

ASP.NET State Server security -

am correct when using state server traffic between web site , state server isn't encrypted? if isn't, how can secure (ssl)? the asp.net session state server uses clear-text http-requests om rest-like manner communication. actual protocol specification publicly available @ [ms-asp]: asp.net state server protocol specification . i've never heard of encrypting state traffic, cant find references it, , nothing states it's possible.

asp.net - "Invalid use of response filter" when compressing response from an IHttpHandler -

i have ihttphandler returning file. when response stream compressed, either automatically using telerik radcompression or explicitly setting filter using context.response.filter = new gzipstream(context.response.filter, compressionmode.compress); the response returned browser correct @ end of response html. html contains exception: [httpexception (0x80004005): invalid use of response filter] system.web.httpresponsestreamfiltersink.verifystate() +3928894 system.web.httpresponsestreamfiltersink.write(byte[] buffer, int32 offset, int32 count) +28 system.io.compression.deflatestream.dispose(boolean disposing) +363 system.io.stream.close() +28 system.io.compression.gzipstream.dispose(boolean disposing) +63 system.io.stream.close() +28 system.io.compression.deflatestream.dispose(boolean disposing) +595 system.io.stream.close() +28 system.io.compression.gzipstream.dispose(boolean disposing) +63 system.io.stream.close() +28 system.web.httpwriter.f...

r - Convert factor to integer -

this question has answer here: how convert factor integer\numeric without loss of information? 5 answers i manipulating data frame using reshape package. when using melt function, factorizes value column, problem because subset of values integers want able perform operations on. does know of way coerce factor integer? using as.character() convert correct character, cannot perform operation on it, , as.integer() or as.numeric() convert number system storing factor as, not helpful. thank you! jeff you can combine 2 functions; coerce characters thence numerics: > fac <- factor(c("1","2","1","2")) > as.numeric(as.character(fac)) [1] 1 2 1 2

ubuntu - Postfix its installed but how do i test -

i tried read online test , cant email go out telnet <ip> 25 ehlo mail from: <from-email> rcpt to: <recipient-email> data type message here. . <enter> => i tried , when type period nothing.....but postfix installed to check whether postfix running or not sudo postfix status if not running, start it. sudo postfix start then telnet localhost port 25 test email id ehlo localhost mail from: root@localhost rcpt to: your_email_id data subject: first mail on postfix hi, there? regards, admin . do not forget . @ end, indicates end of line

SQL/Oracle Grouping Data by field by hours for a certain type on a given day -

okay trying construct single query save myself whole bunch of time (rather writing ton of seperate queries), don't know how start on this. what need @ single day , type , break out counts on actions, hour, between 8:00am - 8:00pm. example have following fake table type_ action_ timestamp_ ------------------------------ processed 2010-11-19 10:00:00.000 processed 2010-11-19 10:46:45.000 processed 2010-11-19 11:46:45.000 processed 2010-11-19 12:46:45.000 processed 2010-11-19 12:48:45.000 pending 2010-11-19 11:46:45.000 pending 2010-11-19 11:50:45.000 pending 2010-11-19 12:46:45.000 pending 2010-11-19 12:48:45.000 b pending 2010-11-19 19:48:45.000 b pending 2010-11-19 21:46:45.000 .etc so if wanted @ records with type_ = 'a' on date 2010-11-19 grouped action_ per hour i see result action_ numoccurences range -----------------------------------------...

How to have Capistrano NOT rollback if a task fails -

we're using capistrano/webistrano (with lee hambley's railsless-deploy gem) push our php application production servers. have custom tasks run during various parts of deploy process. as example, have tasks attempt stop , restart jetty solr instance. however, bit fails during deploy, capistrano rolls entire deploy , reverts previous revision. pain. :-) i'd tell capistrano ignore return result of these tasks, if fail, capistrano continues on it's way , finishes deploy anyway. it's easy me ssh server after fact , kill , restart solr instance, rather having complete deploy again. here relevant parts of deploy script: before "deploy:symlink", :solr_kill after "deploy:symlink", :solr_start, :solr_index task :solr_kill run "cd #{current_path}/base ; #{sudo} phing solr-kill" end task :solr_start run "cd #{current_path}/base ; #{sudo} phing solr-start" run "sleep 10" end task :solr_index ru...

html - JQuery tabs system -

wrote script , seems ok me reason jquery doesnt want work. been trying work ages no luck. if wouldnt mind skim on me. apologise if missing simple eyes glazed lol. heres html & php <ul class="tabs"> <li class=""><a href="#about">about</a></li> <li class=""><a href="#contact">contact <?php echo $retailers['retailer']['company'];?></a></li> </ul> <div class="tab_container"> <div id="about" class="tab_content"> <h3>about <?php echo $retailers['retailer']['company'];?></h3> <p><?php echo $retailers['retailer']['description'];?></p> </div> <div id="contact" class="tab_content"> <h3>contact <?php echo $retailers['retailer']['company']...

vb.net - DataTable and bound winform textbox control? -

i have winform textbox controls bound dataset datatable. this: me.customernametextbox.databindings.add("text", mydataset, "tblcustomer.customername") me.customercodetextbox.databindings.add("text", mydataset, "tblcustomer.customercode") me.billaddresstextbox.databindings.add("text", mydataset, "tblcustomer.bill_address") me.billcitytextbox.databindings.add("text", mydataset, "tblcustomer.bill_city") when enter values in textboxes , press button (=leave edit) find table (mydataset.table(0)) contains values entered besides last control/textbox in. what reason/solution? are tabbing out of textbox before clicking button? without investigating, suspecting tht yoou either need require user exit last textbox before clicking buttin, (isuspect) triggers update of dataset. if click button after completing entry in last text box, instead of exiting control using tab key, mouse click button while c...

php - Selecting and ordering data from another table -

i have 2 tables topsites, , tophits. tophits has id, account, useragent, ip referral, time topsites has id, name, email, url, return, active everytime clicks link, stored in tophits table account being id topsites. basically want echo out top hits day, figure need count how many hits there account=4 on time=today order top here have far $this->db->select('name, url'); $this->db->from('topsites'); $this->db->where('active' '1'); $this->db->join('tophits', 'tophits.id = topsites.account'); (this codeigniter) i'm stuck. help? try (untested) when joining tables need specify in select statements table given field belongs to. ci default protects fieldnames backticks, if use sql methods in select/where statements, need give second parameter false keep doing this, because malform intended sql methods. need add statement restrict today. $this->db->select('topsites.name, topsi...

javascript - Change the type of events -

is possible change type of event in javascript? in scenario triggering events jquery on canvas, on specific elements in rendered canvas, drawn shapes or images. mousemoveevent ---> [canvas] -> [find element] ---> mousemoveoverelementevent basically catch onmousemove event on complete canvas with: $('canvas').bind('mousemove'........ but dom not exist within canvas want transform (to chatch later in process) to: $('canvas').bind('mousemoveoverelement'........ $('canvas').bind('mouseenteronelement'........ $('canvas').bind('mouseleaveonelement'........ and assign e.element = 'imageatacertainpositioninthecanvas' i prefer pass modified event instead of assigning new callback. canvasscript3 offers library features such events. there few things mouseover event, mouseout event. check list of tests . there examples of associating events canvas "elements" in previous ...