Friday, 15 June 2012

PHP CURL image upload to remote System -



PHP CURL image upload to remote System -

i using next code

$ch = curl_init("http://198.155.239.118/~bulacs/ssapi-staging/images/upload_images"); curl_setopt($ch, curlopt_useragent, "mozilla/5.0 (x11; linux x86_64; rv:21.0)gecko/20100101 firefox/21.0"); curl_setopt($ch, curlopt_post, true); curl_setopt( $ch, curlopt_postfields, array( 'image' => '@' . $_files['image']['tmp_name'] . ';filename=' . $_files['image']['name'] . ';type=' . $_files['image']['type'] )); curl_setopt($ch, curlopt_returntransfer, true); var_dump(curl_exec($ch));

here there no error , showing success message file not moving destination.

curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, array( 'image' => '@' . $_files['image']['tmp_name'] ));

i did , set tmp_name, above. should work.

php curl

jquery - Combine 2 functions into 1 -



jquery - Combine 2 functions into 1 -

how can combine functions. basically, when if checkbox clicked, happens , if page loads , if checkbox clicked, same thing happens sec function.

$(document).on("click", ".dimensions", function() { var size = $('.td-hide'); if ($('input#dimensions').is(':checked')) { size.show(); $('.single-select-sm').css('width','148px') } else { size.hide(); $('.single-select-sm').css('width','230px') } }); $(function() { var size = $('.td-hide'); if ($('input#dimensions').is(':checked')) { size.show(); $('.single-select-sm').css('width','148px') } else { size.hide(); $('.single-select-sm').css('width','230px') } });

var myfunc = function() { var size = $('.td-hide'); if ($('input#dimensions').is(':checked')) { size.show(); $('.single-select-sm').css('width','148px') } else { size.hide(); $('.single-select-sm').css('width','230px') } } $(document).on("click", ".dimensions", function() { myfunc(); } $(function() { myfunc(); }

jquery function

android - Database to use for storing profile information -



android - Database to use for storing profile information -

i'm making application android used store profile info of user( firstname, lastname, email, username, password ). store profile image of person. can think of applications whatsapp, viber tango. there many more it.

in order store , access info , efficiently, how should these info stored? i'm thinking storing info in relational database mysql. have fn,ln,email,username, password , link profile image columns of table. 1 more issue had in mind if user has 100 friends, should create new table per user his/her friends can separate , accessed single table or should run complex sql query returns list of friends of user?

thanks lot

i believe on right track. mysql fine selection storing info long on server can accessed application.

you need 2 tables: 1 store of users , map users friends.

your users table pretty straight forwards have laid out. other table (could named user_friends) have column containing id of friend made request, column containing id of friend accepted request, , other x amount of columns may need contain info friendship. record without id accepted friend can displayed pending request.

i create sure there can 1 record containing mapping of friends prevent duplicates well.

android sql database database-design relational-database

java - Is there an easy way to populate a ListView with Cursor? -



java - Is there an easy way to populate a ListView with Cursor? -

i wondering if there easy way fill listview cursor, can edittext:

final edittext visnavn=(edittext)findviewbyid(r.id.visnavn); dbadapter db; cursor cur = db.findall(); if(cur.movetofirst()){ do{ visnavn.append(cur.getstring(0)); visnavn.append(" "); visnavn.append(cur.getstring(1)); visnavn.append("\n"); }while(cur.movetonext()); } cur.close();

i've tried this, no luck:

cursor c = db.findall(); listview list = (listview)findviewbyid(r.id.list); if(c.movetofirst()){ do{ list.add(c.getstring(0)); list.add(" "); list.add(c.getstring(1)); }while(c.movetonext()); } c.close();

oke, said in comments there easy way load cursor info listview, here code used. maybe it's useful you! :)

final cursor locations = <get info here> locations.movetofirst(); layoutinflater inflater = this.getlayoutinflater(); while ( locations.isafterlast() == false ) { view tablerow = inflater.inflate(r.layout.tablerow, null); textview txtname = (textview)tablerow.findviewbyid(r.id.txtname); txtname.settext(locations.getstring(1)); sview.addview(tablerow); locations.movetonext(); }

java android android-listview android-sqlite android-cursor

c++ - Intersection of two actors - Vtk -



c++ - Intersection of two actors - Vtk -

i seek indicate intersection part of 2 vtkactors. have 3 vtkactors in total- 2 cones , 1 intersection of cones.

i have used vtkintersectionpolydatafilter draw intersection. couldn't create dynamic. when move actors different positions using keyboard interaction defined, intersection actor's initial state remains same. not beingness updated. how can create , alter intersection actor dynamically?

from description seems modifying actors, representation of polydata. vtkintersectionpolydatafilter works on polydata (that is, independent representation). if original polydata untouched, intersection same.

on other hand, if updating polydata (e.g. changing height of cone), remember set flag modified() trigger update of vtkintersectionpolydatafilter

c++ vtk

Can't cast or instanceof to true from Object to IProject || Java Eclipse Plugin-Development -



Can't cast or instanceof to true from Object to IProject || Java Eclipse Plugin-Development -

why can not cast content array of type object, eclipse framework method getting selection of bundle explorer returns, iproject? instanceof returns false , casting without check causes exception. debugger shows content of object[]-array have instance-variables , of iproject-type:

private list<iproject> getvalidselectedprojects(iworkbenchwindow window) { final iselectionservice service = window.getselectionservice(); final istructuredselection structured = (istructuredselection) service.getselection("org.eclipse.jdt.ui.packageexplorer"); if (structured == null){ homecoming null; } else { final object[] selectedprojects = structured.toarray(); arraylist<iproject> validatedprojects = new arraylist<iproject>(); (final object projectobj : selectedprojects){ if (projectobj instanceof iproject){ iproject project = (iproject) projectobj; //do } //rest of method; returning list of validated projects

i tried how convert between object[] , interface (iproject[]) in java?

but there exception @ line:

system.arraycopy(objectarray, 0, projectarray, 0, objectarray.length);

user interface objects returned getselection() not straight instances of iproject, ifile or iresource.

to iproject ... utilize iadaptermanager:

iproject project = (iproject)platform.getadaptermanager().getadapter(projectobj, iproject.class);

sometimes object not provide adapter straight iproject, seek more general iresource:

iresource resource = (iresource)platform.getadaptermanager().adapt(projectobj, iresource.class); if (resource instanceof iproject) { iproject project = (iproject)resource; ... code }

java eclipse casting eclipse-plugin instanceof

How to change cursor Icon in C# like in autoit -



How to change cursor Icon in C# like in autoit -

this question has reply here:

using custom colored cursors in c# windows application 4 answers

i alter cursor in autoit syntax:

dllcall($user32, 'int', 'loadcursorfromfile', 'str', 'data\cursors\rotmg.cur')

does know how in c#?

you need utilize pinvoke/dllimport create windows api calls.

from pinvoke.net, declaration be:

[dllimport("user32.dll")] static extern intptr loadcursorfromfile(string lpfilename);

and sample use:

intptr colorcursorhandle = loadcursorfromfile("c:\\temp.cur"); cursor mycursor = new cursor(colorcursorhandle); this.cursor = mycursor;

pinvoke.net resource getting right function signatures of pinvoke calls , construction marshalling.

c# cursor autoit