Posts

Showing posts from June, 2013

java - How do I send a null variable, instead of a blank one to my sql DB? -

whenever tries register using program, , leaves non-required textfield blank, instruction sends "" (blank) data, instead on null one, how make data i'm inserting null whenever textfield blank? thanks if you're using raw sql: insert mytable values ('foo', null, 'bar') if you're using prepared statements: preparedstatement.setobject(columnindex, null); using query comment, here's simple fix: apply replaceall() change blanks null , this: st.executeupdate("insert clientes (nombre, telefono, calle, numero,colonia, municipio, estado, codigo_postal,sexo,fecha_nacimiento) values ('" + snombre_cliente + "','" + stelef_cliente + "','" + scalle + "','" + snumero + "','" + scolonia + "','" + smunicipio + "','" + sestado + "','" + scodigop + "','" + ssexo + "','...

css - Reorder div table-cells using media queries -

i have div table 2 cells. want show second cell @ top , first cell @ bottom of page, when page displayed on smartphone: <div class="table"> <div class="cell1"></div> <div class="cell2"></div> </div> .table { display: table; } .table .cell1, .table .cell2 { display: table-cell; } @media (max-width: 480px) { .table .cell1, .table .cell2 { width: 100%; // must full width on smartphones display: block; } // how display cell2 @ top , cell1 @ bottom? } i tried add float properties float: left , float: right , doesn't work. ps i cannot remove table layout , use floats. there reason must displayed table on desktop. you can flexbox model . new flexbox model not yet supported (especially not older browsers, specification has changed recently), since mention meant work on smartphones, solution might trick you. i believe smartphone browsers support solut...

angularjs - Show hidden div on ng-click within ng-repeat -

i'm working on angular.js app filters through json file of medical procedures. i'd show details of each procedure when name of procedure clicked (on same page) using ng-click. have far, .procedure-details div set display:none: <ul class="procedures"> <li ng-repeat="procedure in procedures | filter:query | orderby:orderprop"> <h4><a href="#" ng-click="?">{{procedure.definition}}</a></h4> <div class="procedure-details"> <p>number of patient discharges: {{procedure.discharges}}</p> <p>average amount covered medicare: {{procedure.covered}}</p> <p>average total payments: {{procedure.payments}}</p> </div> </li> </ul> i'm pretty new @ angular. suggestions? remove display:none , , use ng-show instead: <ul class="procedures"> <l...

c# - Writing jpeg image into a SQL Server 2000 style TEXT field -

i have client asking me import jpeg files sql server database. the problem database vendor build product in sql server 2000 (or earlier) although database sits on sql server 2008 r2 instance. appears old data looks it's being dumped big field of datatype text . is possible read jpeg file memorystream write directly sql server database? if so, how go doing this? or, there better way? thanks, andre i suppose if needed this, can build byte-stream string this: memorystream ms = [your stream]; byte[] memorybytes = ms.toarray(); stringbuilder sbuilder = new stringbuilder(); foreach(byte nextbyte in memorybytes) sbuilder.append((char)nextbyte); string res = sbuilder.tostring(); then store in database passing string. should try , work out of client offering update database structure though ;)

jquery - javascript indexOf multi-dimensional array of objects -

this question has answer here: getting index of array's element based on properties 7 answers i have array of objects example: var myvar = new array(); myvar.push({'abc':'123','def':'456'}); myvar.push({'ghi':'789','jkl':'012'}); and find indexof array level of given object property/value. alert(myvar.indexof('ghi')); does not appear route of action find it, , think understand why, figuring out how index of array of object has property of ghi has got me stumped, , open idea's. var findindex=function(key,arr) { for(var i=0, j=arr.length; i<j; i++) { if(arr[i].hasownproperty(key)) { return i; } } return -1; }; var index=findindex('ghi',myvar); edit jan made important point: remember expect integers no lower 0 s...

android - How to edit an item in a json file? -

i have structure generated application , read in listview: [{ "phone": "202020", "name": "jhon", "id": 10, "age": 20 }, { "phone": "303030", "name": "rose", "id": 11, "age": 22 }] when select item in listview, open screen form passing values ​​of clicked item. lv.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { // getting values selected listitem string name = ((textview) view.findviewbyid(r.id.name)).gettext().tostring(); string age = ((textview) view.findviewbyid(r.id.age)).gettext().tostring(); string phone = ((textview) view.findviewbyid(r.id.phone)).gettext().tostring(); // starting new intent intent in = new intent(getapplicationcontext(), singlemenuitemactivity.class)...

Eclipse/MapReduce plugin -

i've been searching mapreduce plugin eclipse, of them didn't work me. 1 did work had old api's template when creating mappers/reducers/drivers. so thought i'll compile 1 myself, unfortunately uses same "old api" default template gives errors. newest alpha , beta (2.0.3 , 2.0.4) versions of hadoop. i got working. i've changed source of $hadoop_home/src/contrib/eclipse_plugin , compiled hadoop 1.2.0. thought i'd share didn't know where. place came mind stackoverflow, sorry if isn't place. so here is, hadoop eclipse plugin new api template: https://www.dropbox.com/s/y990pp610t3edfo/hadoop-eclipse-plugin-1.2.0-newapi.jar if wants compile himself i'll post source codes too, 3 more *.java files. ask.

javascript - How to remove a div's content with jQuery -

how go removing content inside div tag class content . <div class="content"></div> i imagine like: $(.content).remove separately, how go adding string of text inside same div ? use .empty() remove contents in div tag. $('.content').empty(); for second question; can add text or content using $('.content').html(newcontent) or $('.content').text(newcontenttext); //specifically text content.

objective c - TPKeyboardAvoiding issue -

Image
i'm using tpkeyboardavoiding project , in doing have issue size of scroll view. the scrolling works great reason it's not using full screen, despite being set in storyboard. https://github.com/michaeltyson/tpkeyboardavoiding wow turned out large image! anyway, nicely shows cut off @ top. has 1 had similar issue? how resolved? are using autolayouts? had these problems autolayouts. disabling them makes work.

java - Scaling graphics causes game to stop rendering -

Image
i'm making (currently rather simple) top-down 2d game in java, , having trouble implementing zooming. it seems way can scale reducing width , height, , feeding multiplied-up version setpreferredsize(). i'd instead use affinetransform scale graphics2d @ render time, including g2d.settransform(transformer); line gives being rendered null tile. without: with: i tried feeding class handles tile/sprite rendering multiplied-up/divided down values width , height, exact same result. ideas? here's render method: bs = getbufferstrategy(); if (bs == null) { createbufferstrategy(3); // woo, triple buffering! return; } transformer.scale(scale, scale); // other stuff here . . . // draw screen.pixels pixels (int = 0; < pixels.length; i++) { pixels[i] = screen.pixels[i]; } // draw g2d = (graphics2d)bs.getdrawgraphics(); g2d.settransform(transformer); { g2d.drawimage(image, 0, 0, width, h...

java - <form:select> does not comes selected -

my page has combos don't know why 1 of combos doesn't comes selected on edit mode. if put show value , id of fiel values appears ok, because of there's no reason combo doesn't comes selected. here combo problem: <form:select required="true" path="orcamento.area"> <form:option value="" label="--- selecione ---" /> <form:options items="${listaarea}" itemlabel="descricao" itemvalue="id" /> </form:select> if if put: appears correctly my other combos 1 below correctly displays selected data: <form:select required="true" path="orcamento.representante" id="selectrepresentante" name="representante"> <form:option value="" label="--- selecione ---" /> <form:options items="${listafuncionario}" itemlabel="nome" itemvalue="id" />

mysql - How to delete video from Vimeo account through vimeo api -

in previous asked question how upload video in vimeo account through vimeo api in symfony 2.2 closed . have 1 more requirement want delete uploaded video vimeo account through application of vimeo api used "vimeo.videos.delete" method given below /** * deletes video entity. * * @route("/{id}", name="video_delete") * @method("delete") * @secure(roles="role_super_admin") */ public function deleteaction(request $request, $id) { $vimeo = new phpvimeo('my_api_key', 'my_api_key_secret', 'my_token', 'my_token_secret'); $form = $this->createdeleteform($id); $form->bind($request); $em = $this->getdoctrine()->getmanager(); $video = $em->getrepository('mybundle:video')->find($id); if (!$video) { throw $this->createnotfoundexception('unable find video entity.'); } $videoid = $video->getvideoid(); ...

Using last column's value in tabular form in apex -

i'm new oracle apex.i have master/detail form , in detail, tabular, need pass values of last column. let me clearyfy : have 3 columns,all use lovs.in first 1 pick first name,in second 1 want pick last name, lov must show family names related first name returned lov,and third 1 must show orders person (based on name , falmiy). guy taught me basics said impossible,but still believe there must way.we use apex 4.2 . thank in advance. ps : 20-25 people! if understand correctly need cascading lov chris story said, problem there's no cascading option in tabular forms you'll need work... check out jari lane guide accomplish that.

html - how can i pass the info in a text area to a c# method? -

have html this <form> user: <input type="text" name="firstname"><br> pw : <input type="text" name="lastname"><br> <input type="submit" value="submit"> </form> and c# method evaluate string uname = "bob"; string pass = "bigballs"; public void authenticate(string username, string pw) { if (username == uname && pw == pass) { /// go admin area } } what want know how can server method access form data? like in asp.net <form> user: <input type="text" name="firstname" id= "firstname"><br> pw : <input type="text" name="lastname" id = "lastname"><br> <input type="submit" value="submit"> </form> string strfirstname = request.form["firstname"]; string strlastname = request.form[...

Minutes(Integer) conversion to Hours(Float) in HH.MM format in SQL Server 2008 -

how convert minutes ( integer ) values in hours float (hh.mm) in sql server 2008. example 398 minutes converted 6.38 hours, 419 minutes converted 6.59 hours etc. please try: select 398 / 60 + (398 % 60) / 100.0 select 419 / 60 + (419 % 60) / 100.0 specific select convert(numeric(18, 2), 398 / 60 + (398 % 60) / 100.0) select convert(numeric(18, 2), 419 / 60 + (419 % 60) / 100.0)

build.gradle - How to execute task in Gradle? -

i have following project structure: application build.gradle build.gradle settings.gradle application/build.gradle: apply plugin: 'java' settings.gradle: include ':application' build.gradle: task custom << { project.tasks.getbyname("build").execute() } so want execute task "build" inside task "custom". when run "gradle custom" result is: :custom failed failure: build failed exception. * where: build file '/tmp/test/build.gradle' line: 3 * went wrong: execution failed task ':custom'. > task name 'build' not found in root project 'test'. * try: run --stacktrace option stack trace. run --info or --debug option more log output. build failed total time: 1.183 secs how can execute task "build" inside task "custom" ? you cannot. task execution declarative, not imperative. tasks depend on each other, not execute each other. (also, s...

user interface - How to send data from child figure to its parent in matlab? -

i have "main" figure in matlab project opens "settings" figure. user can change fields in settings figure , press "apply" button in settings figure. want send settings data settings figure main figure when apply button pressed. i set apply button's callback update settings figure's handles.output fields , in main figure assigned output variable while calling settings figure. function apply_callback(hobject, eventdata, handles) handles.output = [str2num(get(handles.precinp, 'string')) get(handles.plotcheck, 'value') get(handles.stepcheck, 'value') get(handles.speedslid, 'value')]; guidata(hobject, handles); and how open settings figure main figure: function settingsbutton_callback(hobject, eventdata, handles) handles.settingsdata = cell2mat(settings()); guidata(hobject, handles); so assignment occurs when settings figure opened, want when apply button pressed try using uiwait after cr...

Working with parameters passed via URL directly through query string via Python -

using python cgi script, want take parameters given directly via url (the user type in url directly way) , store data in query string variables. how can this? how import url variable in first place? you can use python cgi module or if want use more powerful backend server try basic version of cherrypy test examples.

sqlite - listview Onitemclick listener in Android -

i getting trouble on itemclick listener in android using sqlite ,i getting data sqlite data base , need pass same arraylist next activity using onitemclick listener.,but not working . contactlist.clear(); string query = "select * messagetable userid = '" + userid +"'"; system.out.println("queryinsert="+query); cursor c1 = sqlhandler.selectquery(query); if (c1 != null && c1.getcount() != 0) { if (c1.movetofirst()) { { contactlistitems contactlistitems = new contactlistitems(); contactlistitems.setslno(c1.getstring(c1.getcolumnindex("id"))); contactlistitems.setmessage(c1.getstring(c1.getcolumnindex("message"))); contactlist.add(contactlistitems); } while (c1.movetonext()); } } c1.close(); } here arraylist arraylist<contactl...

Any Android Intent to make SIP Call? -

Image
can body suggest me, android intent make sip call? or third party framework/lib/app, has facility invoked using intent , parameters fine. kindly note: not regular phone call, needed intent sip/internet phone call. thanks in advance. 1) mean want implement sip app? then, check this: http://developer.android.com/guide/topics/connectivity/sip.html make app , listen action_call. or 2) want invoke calling app? usual action_call do. (for example, in phone action_call prompt me if want use skype or phone app) added: using sipdroid in 1 of phone. happens when try make call:

sql - Cast a string into datetime in Oracle -

this question has answer here: oracle to_date function. mask needed 2 answers how can cast string date datetime in oracle. sun apr 21 21:32:13 irdt 2013 "irdt" time zone , equal in records. if don't care timezone , equal in records can try select to_date('sun apr 21 21:32:13 irdt 2013' ,'dy mon dd hh24:mi:ss "irdt" yyyy') "date" dual; output: | date | -------------------------------- | april, 21 2013 21:32:13+0000 | sqlfiddle but if need take account , store timezone info might want use timestamp time zone data type , to_timestamp_tz()

android - Setting Background Image is not working -

i trying set background image relative layout, error occured here code in advance relative_topheader = new relativelayout(this); relative_topheader.setid(1); relativelayout.layoutparams lp_topheader = new relativelayout.layoutparams(relativelayout.layoutparams.fill_parent,relativelayout.layoutparams.wrap_content); resources resources_topheader = getresources(); drawable drawable_topheader = resources_topheader.getdrawable(r.drawable.headerbar_m); relative_topheader.setbackground(drawable_topheader); setcontentview(1); my log cat: 05-21 11:40:05.655: i/dalvikvm(510): not find method android.widget.relativelayout.setbackground, referenced method com.example.metromatineeapplicationlayer.mainactivity.oncreate 05-21 11:40:05.698: w/dalvikvm(510): vfy: unable resolve virtual method 3324: landroid/widget/relativelayout;.setbackground (landroid/graphics/drawable/drawable;)v 05-21 11:40:05.698: d/dalvikvm(510): vfy: replacing opcode 0x6e @ 0x0052 05-21 11:40:05.788: d/androidrunti...

java - How to test class with local connection to EJB -

i facing problem testing class has implemented local connection ejb in constructor. connection used inside constructor , sets private attributes of instantiated class. myclass want test: public class myclass { private string myvalue; public myclass() throws exception { mybeanlocal local = ejbfactory.getlocal(mybeanlocal.class); myvalue = local.fetchvalue(); } public void processvalue() { ... string magic should tested ... } public string getvalue() { return myvalue; } } ejbfactory contains enhanced lookup (with caching) , can return local or remote connection (remote requires server location). mybeanlocal interface public interface mylocalbean { public string fetchvalue(); } and junit class want test myclass.processvalue method: public class myclasstest { private myclass myclass; @before public void setup() { myclass = new myclass(); } @test public void testprocessvalue() { assert.assertequals(myclass.process...

java me - codenameone - Storage file doesn't delete -

i've added storage file codenameone application. in event wanna delete specific storage file , recreate old filtered data , new data. doesn't work on deletion. first create method clear storage file in storagemanager class: public void cleardata(string pstoragetable){ storage.getinstance().deletestoragefile(pstoragetable); } in other class use method this: // load data of specific storage file // ... new dbmanager().cleardata(threetrans.db_name); // write old data filtering of specific id , new data // ... here method of write data: public void write(threetrans ptt){ if(store == null) { store = storage.getinstance(); } db_name = "tt"; if(!store.exists(db_name)) { hashtable dephash = new hashtable(); string k = "1" + ptt.getnumber(); dephash.put(k, ptt.tostring()); store.writeobject(db_name, dephash); } else { hashtable dephash = (hashtable)store.readobject(db_name...

php - How to convert stringified data to an object? -

my php has header('content-type: application/json') , json_encode . ajax code use send data php file has datatype: 'json' , sending data string ( json.stringify ). problem is, can't make $_post['data'] work on string. way convert object? edit: trying achieve is, sending data ajax php query looks information database , php file sends array using json ajax , ajax displays it. ajax: function op_prof(obj) { var xval = obj.id; $.ajax({ type: "post", url: '../script/profile.php', datatype: 'json', data: json.stringify({'u_search':'xval'}), cache: false, success: function(data) { console.log(data); alert(data); alert({u_search:xval}['u_search']); $("#co_profile").html(data).show(); } }); }; php: <?php include(dirname(__file__). '/../script/config.php'); session_start(); $id = $_post['u_search']; fore...

javascript - Alert Message on event -

i looking way change following javascript when user clicks on right button, shows custom message in alert box. <script type="text/javascript"> function mousedwn(e) { try { if (event.button == 2||event.button == 3) return false; } catch (e) { if (e.which == 3) return false; } } document.oncontextmenu = function() { return false; } document.ondragstart = function() { return false; } document.onmousedown = mousedwn; </script> try below code disabling right click alert/without alert. <script language=javascript> <!-- //edit unwanted var message="put messege here"; /////////////////////////////////// function clickie4(){ if (event.button==2){ alert(message); return false; } } function clickns4(e){ if (document.layers||document.getelementbyid&&!document.all){ if (e.which==2||e.which==3){ alert(message); return false; } } } if (document.layers){ document.captureevents(event.mousedown); document.onm...

database - MariaDB 5.5 Installation on top of MySQL -

i trying use mariadb instead of mysql on windows 7 desktop. below steps have done far. i have mysql installed in pc. i have not uninstalled mysql. downloaded mariadb-5.5.30-win32.msi mariadb.org installed mariadb-5.5 while installing asked me change service name(by default showing service name mysql , port number 3306) have mysql installed same service name & port no. changed service name mariadb & port 3305. now when connecting hedisql port no: 3305 , localhost able connect mariadb , showing 4 default databases same mysql i.e. information_schema, mysql ,performance_schema, , test. same way can connect hedisql port no: 3306(i.e. default port no of installed mysql), able connect old mysql , showed other application databases. till absolutely fine. but how connect mariadb command line used connect mysql using below command: mysql -uroot -proot i.e. mysql client. and can see in mariadb 5.5/bin .exe files (except .exe files) same mysql/bin. using same mysql ser...

java - The import package cannot be resolved -

i have liferay portlet. i've added external libraries using maven. in ide no errors, can recognize, when deploying ant , says no such package , class import pack.someclass; import pack cannot resolved code: import pack.someclass; public class mainportlet extends mvcportlet { public void doview(renderrequest renderrequest,renderresponse renderresponse) { someclass = new someclass(); } } if using maven , have defined dependency scope system or provided likesystem or provided> not included in war file generated on deployment or package. if have third party jar on local , want include them in war file install jar file local repository , remove scope pom.xml while package maven include jar file war , not error on deployment command install jar in local repository mvn install:install-file -dfile=c:\kaptcha-{version}.jar -dgroupid=com.google.code -dartifactid=kaptcha -dversion={version} -dpackaging=jar hope helps!!

iphone - Handling try catch -

my project service oriented , comes services.i m loading data in uilabel's,tableviews etc.when particular text doesn't come service dont want show null there ,neither display view.so want redirect other view displays error image.but @try ,@catch not working. -(void)viewdidload { //activity indicator code [self performselector:@selector(threadstartanimating) withobject:nil afterdelay:0.1]; nsstring *name=[nsstring stringwithformat:@"%@", self.provname]; cgsize constraint1 = cgsizemake(250, 2000.0f); cgsize size1 = [name sizewithfont: [uifont fontwithname:@"helvetica-bold" size:18] constrainedtosize:constraint1 linebreakmode:uilinebreakmodewordwrap]; self. pname =[[uilabel alloc] init]; @try { if([name length]>0 { self.pname.text=[nsstring stringwithformat:@"%@" ,name]; } else { nsexception *exception = [nsexception exceptionwithname:@"" ...

c# - Using two contexts in one Transaction and error with DTC -

in 1 transation use 2 different contexts: using (transactionscope scope = new transactionscope()) { using (entities1 context = new entities1()) { .... } using (entities2 context2 = new entities2()) { .... var tmp = in context2.... } } when read context2 have error: network access distributed transaction manager (msdtc) has been disabled. please enable dtc network access in security configuration msdtc using component services administrative tool my firewall turned off. components services: http://imageshack.us/photo/my-images/109/88086476.png/ . error still exists! how can fix ??? server: windows server 2008, ms sql 2008 client: windows 7 64 bit.

vb6 - What is the VB 6 equivalent of Process.Start? -

i stuck on stuck 1 line. in vb.net easy, how do in vb6? tried search google few hours , got nothing. feels embrassing. here's code. (.net) process.start("runme.exe", " -parameter1 " & "-parameter2 " & "-parameter3") i want run exe, same directory program is, parameters. sure there simple solution, can't work. appreciated. you can use shell , shellexecute shell "c:\runme.exe", vbnormalfocus http://msdn.microsoft.com/en-us/library/aa242087(v=vs.60).aspx

Can I Run 2 Entity Framework contexts simultaneously (1 read, 1 read/write)? -

i writing tool copies data (user selectable) tables in 1 database database running same schema. can use 2 entity framework contexts (each different conn string) in following way or run problems? read row context1 search row in context2 (based on name example) if name doesnt exist in context2: make copy of row context1 manipulate fields in copy insert copy context2 i know response little late but... absolutely possible. since pointing towards 2 separate databases don't see issues @ all.

Using Python scripts create dynamic html file -

using below python scripts can able create html file set variables(a,b,c,d) global.i want run script dynamically, don't set variables globally ,for eg: if didn't set value of "a" global throwing error "global 'a' not defined".so please let me know python scripts dynamically taking values , convert them in html table. import html import html2 html2 import * #print #print b file = open('out.html', 'w') table_data = [ ['s.no', 'testcase - id', 'result'], ['1', a, b], ['2', c, d], ] htmlcode = html.table(table_data) c=htmlcode print htmlcode file.write(c) table_data needs a , b , etc. defined. incorporates values new global. this has otherwise nothing html.table() ; table_data list cannot defined stands without a , b being defined well. if want a , b , c , d used parameters module, need make function: def create_table(a, b, c, d): ...

c# - Match data in SQL Server database using multiple and varying columns -

we have database table consisting of 6 "header" criteria , need match combination of these columns retrieve detail data. we wont know of criteria underlying database have each of 8 header columns optional. using example data :- first name, last name, home town, age, gender, skill , salary james , smith , new york , 30, male , train driver, 30000 pete , jones , ? , 30, male , ? , 35000 ? , smith , new york , ?, male , ? , 75000 ? , ? , ? , 30, , ? , 30000 when want find salary might specify :- first name = james last name = smith home town = new york age = 30 gender = male skill = train driver using criteria expect 1st, 3rd , 4th row returned. is there slick way of doing apart iteratively working through criteria different combinations?! many in advance. in mysql use ifnull() (i think there equivalent nvl() method in sql server) e.g. in que...

sql server - Should this T-SQL be done using a UNION -

using table below (call tablea), need create sql statement selects 2 sets of data , combines them together. first, need select rows status = 1 , datecreated greater (meaning newer) specified date, i'll call startdate. need select rows status = 0 , datecreated greater specified date results sorted datecreated descendingly , number of these records limited 2. so if table data looks this: id status datecreated 1 1 2013-05-01 14:00 2 1 2013-05-01 15:00 3 1 2013-05-01 16:00 4 0 2013-05-01 17:00 5 0 2013-05-01 18:00 6 0 2013-05-01 19:00 7 0 2013-05-01 20:00 and set @startdate 2013-05-01 14:30 , want result set this: 2 1 2013-05-01 15:00 3 1 2013-05-01 16:00 6 0 2013-05-01 19:00 7 0 2013-05-01 20:00 is best done union joins 2 results or there better more efficient way? you should benchmark real data set performanc...

c# - disable jquery blockUI in timer1_tick -

i have masterpage with function returns current date , time, problem everytime timer ticks, blockui being called.. there way can disable in particular event timer1_tick? thank in advance. masterpage: <asp:scriptmanager runat="server" id="mainscriptmanager" asyncpostbacktimeout="36000"/> <asp:updatepanel runat="server" id="updatepanel"> <contenttemplate> <%=getdatetime()%> <asp:timer id="timer1" runat="server" interval="1"></asp:timer></td> </contenttemplate> </asp:updatepanel> codebehind: public static string getdatetime() { string currentdatetime = datetime.now.tostring(); return currentdatetime; } protected void timer1_tick(object sender, eventargs e) { getdatetime(); }

visual studio 2010 - Alternate solution of Microsoft.Jet.OLEDB.4.0 provider for x64 bit version -

i saving values access database , used microsoft.jet.oledb.4.0 provider , have configure platform mode cpu x86 in project in visual studio , works fine x86 platform when start unit testing using nunit not accepting x86 platform , nunit shows error "unittest_finance.test.class1.insertcashpayment: system.invalidoperationexception : 'microsoft.jet.oledb.4.0' provider not registered on local machine." now want alternative way handle error while performing unit testing using nunit. here code reference class repairdll { string dbconn = "provider=microsoft.jet.oledb.4.0;data source=c:/autorepairdb.mdb"; //method booking value public virtual bool insert_data_repair_history(entityclass ec) { bool isinsert = false; //connect database oledbconnection connection = new oledbconnection(dbconn); connection.open(); try { //insert custom...

android - How to connect a PHONE GAP application with FACEBOOK,TWITTER,SMS,EMAIL,LINKED-IN? -

i new phone gap-android. i access social media network respective native applications . sms facebook twitter email linked-in i implementing on lower version of cordova. cordova 2.1.0 please suggest me plug-ins preferably using java script. uptill now,i have tried sms here . it not going native application. go through plugin facebook.i have developed application using plugin facebook. facebook-plugin-for-android and here,you can browse plugins platform. here

android - FQL Query in another FQL Query issue -

i started rebulding application integrate new facebook sdk 3.0.1 comply breaking changes scheduled july, 13. all working perfect till then. attempting pull in newsfeed querying stream fql table did using earlier sdk. the background: my earlier query (code) was: string qryfeeds = "select post_id, created_time, updated_time, filter_key, actor_id, message, app_data, attachment, comments, likes, place, permalink, description, type stream filter_key in (select filter_key stream_filter uid = me() , type = 'newsfeed') limit 10 offset 0"; bundle bun = new bundle(); bun.putstring("method", "fql.query"); bun.putstring("query", qryfeeds); string result = utility.mfacebook.request(bun); jsonarray jafeeds = new jsonarray(result); (int = 0; < jafeeds.length(); i++) { jsonobject jofeeds = jafeeds.getjsonobject(i); /** actor details **/ if (jofeeds.has("actor_id")) { actor_id = jofeeds.getstring(...

javascript - Filtering out values of a bidimensional array -

i have bidimensional array looks this: [[10, 20, 30, s1] [10, 20, 30, s1] [10, 20, 30, s1] [50, 70, 80, g1] [50, 70, 80, g1] [50, 70, 80, g1]] i want filter out every "non-first" occurence of 4th value of each sub-array, this: [[10, 20, 30, s1] [10, 20, 30] [10, 20, 30] [50, 70, 80, g1] [50, 70, 80] [50, 70, 80]] how possible? in advance you can use object keep track of found values, , remove last item subarrays when found before: var items = {}; (var = 0; < arr.length; i++) { var id = arr[i][arr[i].length - 1]; if (items.hasownproperty(id)) { arr[i].pop(); } else { items[id] = 1; } }

Convex optimization - matlab - 4D optimization variable -

in matlab optimization toolbox, possible optimization variable 4d matrix , if so, how specify start point? can give zeros? 4d matrix, mean matrix of matrices. 4 indices needed fix value. after working on month, have concluded not possible. has circumvented changing operations involved accommodate 1d vector has interpreted as: a1b1c1d1,a1b1c1d2,a1b1c2d1,a1b1c2d2,.... my point vector contains data , there innermost , outermost variables along intermediate ones. matrix operations have designed accommodate this.

Android Services and Android LifeCycle handling -

i have created app use 2 activities such that: 1st activity main activity, & 2nd activity starts main activity using button. now have started sound(using service) in main activity , want keep service alive long app alive want stop if app closes(by either pressing button or home button). the problem when use onpause/onresume methods sound service stops when start 2nd activity. anyone having idea how tackle it? in advance! instead of using onresume() , onpause() , use onuserleavehint() . when call other activity add intent : intent.addflags(intent.flag_activity_no_user_action); you can read more here: http://developer.android.com/reference/android/app/activity.html#onuserleavehint%28%29

ios - Core Plot : Grid lines appear once per two plots -

Image
am using core plot plot memory statistics iphone app. here sample plot why grid line appearing every alternating plot? want appear every plot. how do it? here's code configure grid line. cptmutablelinestyle *majorgridlinestyle = [cptmutablelinestyle linestyle]; majorgridlinestyle.linewidth = 0.5f; majorgridlinestyle.linecolor = [cptcolor lightgraycolor]; //[[cptcolor lightgraycolor] colorwithalphacomponent:0.6f]; axisset.xaxis.majorgridlinestyle = majorgridlinestyle; axisset.yaxis.majorgridlinestyle = majorgridlinestyle; please help. the majorgridlinestyle grid lines @ major tick locations, i.e., ones labels in sample image. set minorgridlinestyle draw lines @ minor tick locations between major ticks. 2 line styles can different, example emphasize major grid lines.

express route return necessary or not -

i use express framework webapp. pickup codes book, looked @ code, route page. app.post('/register', function(req, res) { var firstname = req.param('firstname', ''); var lastname = req.param('lastname', ''); var email = req.param('email', null); var password = req.param('password', null); if ( null == email || email.length < 1 || null == password || password.length < 1 ) { res.send(400); return; } what has return meaning here, necessary? the return necessary if have more code below point in route handler function , want bypass rest of function. nothing in express @ or care value return. if @ bottom of function anyway, may omit return statement entirely. typically, see patterns like: first prerequisite checking, validation, authorization, or similar logic if of fails, send , error , return function bypass main logic main logic code comes next , executes if return wasn...

windows - Qt creator: This application has failed to start because MSVCP110.dll was not found -

given downloaded " qt 64bit version " " windows vista ", after installation, " qt creator 2.7.0 " shows based on " qt 5.0.2 (32bit) ". however, when creating new project or opening existing one, following message appears: this application has failed start because msvcp110.dll not found . note message box titled " uic.exe - unable locate component ". but when click on "ok" button, creates project (or opens it). why happening? installing msvc 2012 dlls should help: http://www.microsoft.com/en-us/download/details.aspx?id=30679

ios - How to get the SerialNumber of MAC Laptop in QT -

i developing desktop application osx using qt. how can serial number of osx machine using qt api's. this solution in qt qprocess proc; qstringlist args; args << "-c" << "ioreg -rd1 -c ioplatformexpertdevice | awk '/ioplatformserialnumber/ { print $3; }'"; proc.start( "/bin/bash", args ); proc.waitforfinished(); qstring uid = proc.readall(); qdebug()<<uid; uid serial number

c# 4.0 - Calling stored procedure using Nhibernate named query -

i facing problem while calling procedure using named query in nhibernate.i have procedure accept 3 parameters, first 1 varchar(max) guid list, second varchar(50) , third 1 bit type. i have using following procedure in c# using named query nhibernate var customerbalance = session.getnamedquery("ar_tarcustomer_readaccount_forbalancedetail_new") .setparameter("customerlist", "'''bced443a-ce86-4675-bca6-ae5646ad9c2e'' , ''bced443a-ce86-4675-bca6-ae5646ad9c2e'''") .setparameter("asofdate", "10/1/2012") .setparameter("postedonly", postedonly) .setresulttransformer(new aliastobeanresulttransformer(typeof(tarcustomer))).list<tarcustomer>(); and following code .hbm.xml file <sql-query name="ar_tarcust...

ffmpeg - av_guess_format h264 returns NULL on Android -

executing code: av_log_set_callback(_log_callback); av_register_all(); avcodec_register_all(); log(avcodec_configuration()); avoutputformat * fmt = av_guess_format( "h264", null, null ); and showing in log file next configuration: --target-os=linux --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-avfilter --disable-everything --enable-libx264 --enable-encoder=libx264 --enable-decoder=h264 --enable-gpl .... av_guess_format returning null. any suggestion? many thanks try list registered codecs: avcodec * codec = null; while(codec = av_codec_next(codec)) { log(codec->name); } upd you can create encoder h264: avcodec * avcodec = avcodec_find_encoder_by_name("h264"); avcodeccontext * avcodecctx = avcodec_alloc_context3(avcodec); // fill required fields in avcodecctx avdictionary * opt = null; avcodec_open2(avcodecctx, avcodec, &opt); you not have formats, because specified option ...

delphi - How to check if the system master volume is mute or unmute? -

i'm using code mute/unmute system master volume: const appcommand_volume_mute = $80000; wm_appcommand = $319; procedure tform1.button1click(sender: tobject); begin // toggle mute/unmute sendmessagew(handle, wm_appcommand, handle, appcommand_volume_mute); end; (got code https://stackoverflow.com/a/154128/1140885 ) it works fine on xp (didn't test on win7 yet). need method check (get) current "mute" state? mute or not. ideas? update: xp ended using code here: how master volume in windows xp? (thanks @sertac akyuz) i had change single line: mxlc.dwcontroltype := mixercontrol_controltype_volume; to: mxlc.dwcontroltype := mixercontrol_controltype_mute; return value either 0 (not mute) or 1 (mute). starting windows vista must use core audio sdk control windows audio. check if master volume muted must use iaudioendpointvolume.getmute method. try sample code {$apptype console} uses sysutils, windows, activex, com...

iphone - Dismiss modal and push a segue -

Image
i'm pretty new @ ios development , i'm stuck using storyboards. i've modal view (zoekcriteriaviewcontroller) button on it. when button pressed dismiss view , push tableviewcontroller.. i'm getting error: not find navigation controller segue 'searchedsegue'. the segue zoekcriteriaviewcontroller kroegentableviewcontroller called searchedsegue the code i'm using (c#): this.dismissviewcontroller(true, () => { this.performsegue("searchedsegue", this); }); my storyboard: is able me out issue? when using segues, don't dismiss calling controllers! do this.performsegue("searchedsegue", this);

Ruby Wait and Signal -

i have two threads in ruby process. want have one sleep , other send signal wake up. i know how mutex , conditionalvariables, don't have critic section run it's not right solution. i know how thread stop , thread run, on thread stops , other calls run on it, it's i'm looking for. is there other way? i'm trying accomplish have on thread wait content in database , other notify when there content. maybe work? require "thread" q = queue.new thread.new sleep 10 q.push "*" end p q.pop

php - PUT with jquery returns error -

i trying update field small jquery script keeps returning error , cannot see have problem. i have anchor onclick="reportad(myaid)" runs this: function reportad(aid) { var conf = confirm("will report ad?"); if(conf == true) { $.ajax({ url: rooturl + '/reportad/', type: 'put', datatype: 'json', contenttype: 'application/json', data: {'aid': ''+aid+''}, success: function(data) { alert("ad have been reported"); }, error: function(data) { console.log(data); } }); } return false; } which should run this: $app->put('/reportad/', function() use ($app, $adverts) { $request = slim::getinstance()->request(); $data = json_decode($request->getbody()); $adverts->report_ad($data->aid); }); firebug gives me this: object { ready...

wix - previously present folder is getting deleted -

i installing wix msi. adds folders , files existing folder installed application. when uninstall msi, deletes existing folder. tried using shared="yes". problem persists. if try add same set of files installed other application folder (but different guid), uninstalling 1 remove files.

c++ - Singleton destructor called error -

this question has answer here: what undefined reference/unresolved external symbol error , how fix it? 27 answers #pragma once #include <time.h> class ctimer { time_t _last; ctimer() { _last = time( null ); } ctimer(const ctimer &); ctimer& operator=(const ctimer&); ~ctimer(); public: static ctimer& getinstance(){ static ctimer instance; return instance; } float getdelta(){ time_t = time( null ); float delta = (float)(now - _last); return delta; } //should called @ beginning of rendering function void update(){ _last = time( null ); } }; this timer singleton code. wanted use that: somewhere in player class: posx += vel * ctimer::getinstance().getdelta(); and in main loop file: void gameloop(){ ctimer::getinstance().updat...

cordova - how to speed up changepage in jquery mobile for phonegap app -

i using jquerymobile 1.3.1 phonegap android app. change page methord slow (more 1 sec) in android without page transition (defaultpagetransition=none). touchstart , tap events firing on next page form elements.. any idea? there few ways: in case using 1 html file multiple pages, wrap them single div: <div id="container"/> and set css: body { margin: 0; } #container { position: absolute; width: 100%; height: 100%; } js code: $(document).one("mobileinit", function () { $.mobile.pagecontainer = $('#container'); $.mobile.defaultpagetransition = 'slide'; }); more aproach can found here: http://outof.me/fixing-flickers-jumps-of-jquery-mobile-transitions-in-phonegap-apps/ other common solution set css: .ui-page { -webkit-backface-visibility: hidden; } the problem solution breaks select list on forms. turn them off: $(document).bind("mobileinit", function(){ ...

php - Impersonate windows user in apache -

i have wamp server 64 bit installed on windows server 2008 apache version 2.42 along php, question i using odbc_connect function connect oracle database in oracle connection packet apache sends system user in connection packet need is, should send current logged in user on windows desktop oracle that current windows user must impersonate oracle connection packet for example if on windows desktop accessing application http:\\192.168.xx.xx\testapp on browser , current logged in user on desktop harry apache must send harry in oracle connection packet

git - global .gitignore vs .gitignore in repository -

if have global .gitignore setup , project has .gitignore in repo 1 in repo override global 1 or add rules example: if global has: *.exe *.ini and repo has: *.ini *.co will *.exe's project? both gitignores apply. in case, .exe not project. however, if had !*.exe in local repository gitignore, .exe files repository. github has article subject: https://help.github.com/articles/ignoring-files

sorting - mootools json filter with groups -

i have json string. looks like: var data= [{"name":"name1","value":"value1","group":"group1","order":"1"}, {"name":"name2","value":"value2","group":"group1","order":"2"}, {"name":"name3","value":"value3","group":"group1","order":"3"}, {"name":"name4","value":"value4","group":"group2","order":"4"}, {"name":"name5","value":"value5","group":"group2","order":"5"}, {"name":"name6","value":"value6","group":"group3","order":"6"}, {"name":"name7","value...

apache - Showing 404 error when a cookie is not set -

i think title clear; want create rule on web-server if user tries reach specific path http://mysite.com/admin face 404 error, while folder available , contains files. if cookie set on client's system, he/she can visit path. i'm looking .htaccess solution, other answers (php or anything) appreciated too. i'm not familiar writing rewrite rules this may help: rewriteengine on rewritecond %{request_uri} ^/admin rewritecond %{http_cookie} !mycookie=9856012345 rewriterule .* - [l,f] it shows 403 error, , people know path exists, want them feel there's no such path on folder showing 404 error. you can using 404 redirect rewriteengine on rewritecond %{request_uri} ^/admin rewritecond %{http_cookie} !mycookie=9856012345 rewriterule .* - [l,r=404]

Unable get the proper altitude from gps satellite in android Device -

i using android in small spy android helicopter getting proper latitude , longitude when above 500ft ground ,i doing landing of helicopter based on height calculated altitude .but getting altitude of times wrong due helicopter crashing in ground have idea how proper altitude gps satellite.and using getaltitude() method getting altitude , using in menifest <uses-permission android:name="android.permission.access_fine_location"></uses-permission> <uses-permission android:name="android.permission.access_mock_location" /> using gps satellites landing bad idea. android using ellipsoid earth approximation. in location give me 40 meters in data i'm receiving getaltidude(). don't forget inaccuracy of gps signal can add next more 10 meters.