Posts

php - Using cURL in a loop -

i'm writing script in unspecified number of files need uploaded via curl requests remote api. however, script hangs , times out. strangely enough, requests successful (the files uploaded), script unable continue. here's loop: foreach ($paths $path) { $ch = curl_init($path); curl_setopt($ch, curlopt_httpheader, array('x-auth-token: '.$token, 'content-length: '.filesize($path)); curl_setopt($ch, curlopt_put, true); curl_setopt($ch, curlopt_infile, fopen($path, 'r')); curl_setopt($ch, curlopt_infilesize, filesize($path)); echo curl_exec($ch); } i believe has loop. i've tried adding curl_close within loop, doesn't solve problem. ideas? put timeout in curl foreach ($paths $path) { $ch = curl_init($path); curl_setopt($ch, curlopt_httpheader, array('x-auth-token: '.$token, 'content-length: '.filesize($path)); curl_setopt($ch, curlopt_put, true); curl_setopt($ch, curlopt_infile, fopen($path, 'r...

linker - Error: C++ unresolved external symbol -

Image
this question has answer here: what undefined reference/unresolved external symbol error , how fix it? 27 answers i using 2 c files written others in c++ project in visual studio 2008 (actually, provided free online polygon intersection library). the 2 files downloaded gcp.h , gcp.c. copied gcp.h , gcp.c project directory. linker gave me error: unresolved external symbol: void __cdecl gpc_polygon_clip(enum gpc_op,struct gpc_polygon *,struct gpc_polygon *,struct gpc_polygon *) below how wrote code uses library: static int poly_intersection(convex_polygon& poly1,convex_polygon& poly2,convex_polygon& rp) { if(!poly1.is_convex() || !poly2.is_convex()) return 1; // construct 1st convex polygon gpc_vertex *gvp1 = new gpc_vertex[poly1.size()]; gpc_vertex v1; (unsigned int n = 0; n < poly1.size(); n++) { ...

sql server 2008 error: 26 - error locating server/instance specified -

this arun chennai. have developed first application in wpf (c#) vs 2008 & sql server 2008. works fine on system. after deployment, won't work on other systems. it shows following error message. system.data.sqlclient.sqlexception - network related or instance specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections.(provider: sql network interfaces, error: 26 - error locating server/instance specified). i have gone through google , done following steps no use. server name : ecare432\sqlexpress instance name : sqlexpress app.config has: <connectionstrings> <add name="timetracker.properties.settings.myecareconnectionstring" connectionstring="data source=ecare432\sqlexpress;initial catalog=myecare;persist security info=true;user id=sa;password=ecare123@" providername="system.data.s...

javascript - Ajax request to send file from jsp to servlet -

following been done using struts framework jsp <html:form action="/uploaddrawing" method="post" enctype="multipart/form-data"> <input type="file" name="attachfile" class="regi_textbox"/> <input type="submit" name="button" class="update_but" value="upload file" /> </html:form> form private formfile attachfile; public formfile getattachfile() { return attachfile; } public void setattachfile(formfile attachfile) { this.attachfile = attachfile; } action class formfile attachfile = uploaddrawingform.getattachfile(); this works fine me , need using ajax request (jsp-servlet), following tried no success--- jsp <script> function dynamicupload() { alert("function played"); var fd = new formdata($("attachfileform")); fd.append( 'file', input.files[0] ); alert(fd); $.ajax({ url: 'uploaddrawingser...

javascript - how to center modal window with body hidden after scroll? -

Image
i have model dialog, while model dialog open setting body overflow:hidden makes model window display half only. onclose resetting body overflow. body height more window size , scrolled open modal dialog. how center display modal dialog? as option, can create function position modal depending on window size, this: something this: function repositionmodal(modal){ var windoww = $(window).width(), windowh = $(window).height(), modalw = modal.width(), modalh = modal.height(); if (modalw>windoww) modal.width(windoww); if (modalh>windowh) modal.height(windowh); modal.css({ "top": (windowh-modalh)/2)+"px", "left": (windoww-modalw)/2)+"px" }); } then call function when modal invoked, and, on window resize $(window).resize(function(){ if($(".my-modal").is(:visible)){ repositionmodal($(".my-modal")) } })

android - Launching an activity from the ListView -

public class listitem { public int sname; public int s_img; public string sid; } class xyz extends listactivity { . . . protected void onlistitemclick(listview l, view v, int position, long id) { //super.onlistitemclick(l, v, position, id); toast.maketext(listpage.this,items.get(position).sid,toast.length_short).show(); intent intent = new intent(v.getcontext(),displayscheme.class); startactivityforresult(intent,0); } } i wish start new activity above xyz class. activity should start when 1 of items on list clicked. in next activity, wish display further details of "listitem" object viz. s_img , sname; there way pass on clicked listitem object next displayscheme activity ? coz there no way in next activity find out item clicked in earlier activity. in advance. .............. edited ............... protected void onlistitemclick(listview l, view v, int position, long id) { //super.onlistitemclick(l, v, position, id); ...

java - Recovery deleted log files at logback worked fine on Windows but didn't work on Linux SUSE -

i using slf4j + logback 1.0.12 application logging infrastruction. run application on both windows xp , linux suse os. have scenario following: i deleted log files when application running. on windows xp logback recovery mechanism worked fine , after passing seconds (about 10 seconds) log files generate again on linux suse log files don't generate again. my question : why logback recovery mechanism has different behavior on 2 os? under linux, if process writes file , target file removed, process continues quietly write ghost file. error condition not trigger exception. this answers why recovery process behavior depends on os.