Posts

python - Can't run monkeyrunner script - java.lang.IllegalArgumentException: Bad level -

i tried shows me middle finger: ~/software/android-sdk-linux_x86-1.6_r1/tools$ sudo ./monkeyrunner -v help.py exception in thread "main" java.lang.illegalargumentexception: bad level "help.py" @ java.util.logging.level.parse(level.java:336) @ com.android.monkeyrunner.monkeyrunneroptions.processoptions(monkeyrunneroptions.java:130) @ com.android.monkeyrunner.monkeyrunnerstarter.main(monkeyrunnerstarter.java:192) it on freshly installed java, jdk, jre, eclipse, androidsdk, adt any ideas? why sudo ? shouldn't use it. other problem missing log level -v: usage: monkeyrunner [options] script_file -s monkeyserver ip address. -p monkeyserver tcp port. -v monkeyserver logging level (all, finest, finer, fine, config, info, warning, severe, off) also, sure have help.py in current working directory or specify path.

java - Upload image using POST, php and Android -

i getting following error message after trying upload image using multipartentity in android: error: problem [picture] (file upload error 4) i using following code upload image: string url = "http://www.uploadurl.com/api/files.php"; httpclient httpclient = new defaulthttpclient(); httpcontext localcontext = new basichttpcontext(); httppost httppost = new httppost(url); multipartentity multientity = new multipartentity(httpmultipartmode.browser_compatible); file file = new file(environment.getexternalstoragedirectory().getabsolutepath() + "/temp/" + image_filename); contentbody cbody = new filebody(file); stringbody sb1 = new stringbody(getnameformatted()); stringbody sb2 = new stringbody(getdeviceid()); multipartentity multipartcontent = new multipartentity(); multipartcontent.addpart("name", sb1); multipartcontent.addpart("uuid", sb2); multipartcontent.addpart("picture", cbody); httppost.setentity(multipartcontent); ...

how to receive response from ajax call with sencha touch from codeigniter / ExtJS -

i trying response codeigniter when send ajax request sencha touch/ ext with ext.ajax.request({// url: formbase.url, //something 'http://path.to/mobile/login/ajax_validatelogin', success: function(response, opts) { console.log('login success!'); console.log('data: ' + response.responsetext); }, failure: function(result){ console.log('login error! '); }, method: 'post', params: form.getvalues() }); form = new ext.form.formpanel(formbase); //... and in codeigniter like function ajax_validatelogin() { $username = $this->input->post('username'); $password = $this->input->post('password'); $data['username'] = 'arschkarte'; //$username; if($username == "f"){ $data["success"] = true; } else { $data[...

java multithreading problem -

below part of code. confused why "notify 1" can not wake function waiting. it seams have with: when 1 thread executing synchronized method object, other threads invoke synchronized methods same object block (suspend execution) until first thread done object. why result not: wait, notify1, wait finish, notify2, . . . instead is: wait, notify1, notify2, notify2, . . . notify2, notify 2, notify 3, wait finish, skip wait, skip wait, skip wait, . . . code { . . . multithreadcontent m; void dividetoparts(file testfile,fileinputstream fileinputstream, object hashmachine) throws ioexception, interruptedexception{ . . . //run here m = new multithreadcontent(fileinputstream,(int)temp23,(int) (testfile.length()%temp23), numberofparts, hashmachine); new thread(new read()).start(); m.upda...

java - Eclipse surround with quotes and other blocks -

i find myself wanting highlight string in eclipse , double or single quoting it. can't seem find shortcut it. in textmate example if highlight string , type either ' or " string surrounded them. same should work ) , } think well. i've added code template doing doesn't ever appear in menu , there doesn't seem way create shortcuts either. note should entirely keyboard driven , not involve secondary menus, that's goal anyway. go java > editor > templates , add new template, e.g. called quote , follows: "${word_selection}"${cursor} then, in editor, write text want quote, highlight it, press ctrl + space , type quote , hit return. highlighted text should quoted now. if don't template proposals when pressing ctrl + space , make sure have them checked in java > editor > content assist > advanced . just tried , works me!

qt - Compiling OpenCV SVN trunk in Windows - error in highgui/libVideoInput -

i know there several questions none has shown me can against error get. using this guide able compile current opencv release (2.2) using guide , cmake. release works fine , can write code using in qt. therefore need with_qt enabled , need build myself. but unfortunately found out 2.2 release doesn't support types of cameras (since camera stream 720p webcam). i've read fixed in latest svn trunk version. so checked newest svn trunk out , ran cmake again, created new folder, selected source files, mingw compile links g++.exe , qcc.exe, configured , enabled "with_qt" , generated necessary makefiles. i started windows powershell admin , tried compile "mingw32-make"... @ 56% crashes this: [ 56%] building cxx object modules/highgui/cmakefiles/opencv_highgui.dir/src/grfmt_sunras.obj [ 56%] building cxx object modules/highgui/cmakefiles/opencv_highgui.dir/src/grfmt_tiff.obj linking cxx shared library ..\..\bin\libopencv_highgui220d.dll creating library...

c++ - Why use QVector(Qt) instead of std::vector -

i'm new c++ , qt, i'm @ c#/java. the point cross-platform, i'm confuse qt. isn't std::vector cross-platform, doesn't qt provide equivalent non-crossplatform thing? also how file , qfile different? a link nice, :) this article loooks good. compares qt template library standard template library: qtl vs stl hope, you'll find interesting seeing differences listed there in article. edit: here find interesting: my opinion biggest advantage of qtl has same implementation (including binary compatibility) on oses supported qt . stl implementations might below par when comes performance or might missing functionality. platforms don’t have stl! on other hand, stl more customizable , available in entirety in header files… like said, there no clear winner . like said, no clear winner. still reading article makes lots of things clear. better know difference going one, without knowing other.

debugging - Visual Studio 2010 F10/F11 Stepping Slow, Toolbar Stepping Fine? -

i'm running visual studio 2010 sp1, r# 5.1, , few other extensions (like powercommands , productivity power tools). somewhere along lines, debugging got super slow. if use f10 / f11 keys step, vs hangs bit , steps. if use toolbar buttons stepping, it's snappy expected. any idea what's shortcut keys? i had same problem - extremely slow debugging keyboard ( f10 example). symptoms: if click step on toolbar, works normal, the lag during debugging present not in visual studio anywhere (notepad, browser,...), if set other browser default browser in visual studio (i tried firefox), works ok, if disable third-party browser extensions in ie, works ok, if enable third-party browser extensions , disable lastpass, problem gone , debugging keyboard fast again! so, try disable lastpass extension if have or extensions , try it. edit1 - allready posted on lastpass forum: http://forums.lastpass.com/viewtopic.php?f=12&t=61029 edit2 - , here on :) https:...

jquery - Can I replace all asp controls with simple html controls form with same functionalities? -

i having project asp.net controls in .aspx page , javascript validation , stored procedures databases , asp:gridview , datasource controls display , such things. now, want change old aspx controls : asp:textbox, asp:dropdownlist with input, select in html. how time take develop 100 aspx forms in simple html query, xml datasource, cs file , generic handlers ?? have 1 done before or tried 1 ? idea or bad idea... suggestions welcomed :) added after mvc suggestions(to make more clear) typically want complete within month. use jquery , cs page connections, create dynamic html , things, handler call 2 files , aspx design , database configuration file (config file connections, security , things )... my main doubt able obtain perfect functionality ? this kind of broad question, i'll give shot. changing asp:textbox input type="text" loses server side functionality. aspx can't access plain html control. add id , runat="server" it, ...

html - Javascript: Disable button on Drop Down Select -

i have dropdown menu couple of values link functions. have textbox , submit button. want if value in drop down box selected disables or hides submit button , possibly textbox made blank , once value selected turns both on. my html code: <body> <p><label>drawing tool: <select id="dtool"> <option value="line">line</option> <option value="rect">rectangle</option> <option value="pencil">pencil</option> <option value="eraser">eraser</option> </select></label></p> //some canvas code <form id="frmcolor"> <input type='color' id='color' /> </form> <input type='submit' value='change color' id="colorsubmit"/> javascript in linked file called canvas.js: ... tools.eraser = function () { var tool = th...

iphone - Add Observer to BOOL variable -

is possible add observers simple variables such bools or nsintegers , see when change? thanks! you observe keys notified when value changes. data type can anything. defined objective-c property (with @property in .h file) ready go if want observe bool property add view controller follows: in myviewcontroller.h: @interface myviewcontroller : uiviewcontroller { bool mysetting; } @property (nonatomic) bool mysetting; in myviewcontroller.m @implementation myviewcontroller @synthesize mysetting; // rest of myviewcontroller implementation @end in otherviewcontroller.m: // assumes myvc defined property of otherviewcontroller - (void)presentmyviewcontroller { self.myvc = [[[myviewcontroller alloc] init] autorelease]; // note: remove self observer before myvc released/dealloced [self.myvc addobserver:self forkeypath:@"mysetting" options:0 context:nil]; // present myvc modally or navigation controller here } - (void)observ...

wpf - How do I move something I made in Microsoft Blend into Visual Basic? -

i need submit project tomorrow, , topic wpf using xaml. using vb way. still beginner @ programming, needed help. i've got ton of wpf , blend tutorials open in tabs in browser, have no idea start, , no idea project. asked tutor , said he'll checking our understanding of xaml, , creating object using xaml other way round. i stumbled onto tutorials of media players main in wpf, , decided go it. because have never used blend or wpf along xaml before, don't know do, if make button in blend effects, may add coding behind in vb. please me out. i've got 15 hours before have submit. you're going need microsoft vb.net express 2010 at least. i'm not sure if supports wpf free. i'd , start drinking coffee. if guess copying xaml new project place start.

c# - How do I get the _real_ thread id in a CLR "friendly" way? -

as exercise writing code display o/s processes , o/s threads within process (like sysinternals process explorer does). i found .net's managedthreadid(s) not o/s thread ids. after bit of reading came across appdomain.getcurrentthreadid(). unfortunately, function marked "obsolete" (which mean "not available" in future). 1 solution found use interopservices directly call win32 getcurrentthreadid. fine but, feels counter .net philosophy. my question is: there clr "friendly" way of obtaining real id of current thread ? for reference, here snippet of code showing i've tried far. // 1 , // 2 display correct thread id, // 3 , // 4 attempts obtain same info in clr friendly way (but don't work.) thank help, john. [dllimport("kernel32.dll")] static extern int getcurrentthreadid(); static void main(string[] args) { // appdomain.getcurrentthreadid() "obsolete" int threadid1 = appdomain.getcurrentthreadid(); //...

php - How do I alphabetize a list of domains in this way? -

so if wanted organize list of websites alphabetically, , there of form: example1.com, test.com, stackoverflow.com, google.com, easy. however, want organize subdomains. consider following 3 domains: a.domain.com domain.com anotherdomain.com if handed them on software alphabetize, alphabetized this: a.domain.com anotherdomain.com domain.com however, not how want them alphabetized. want them alphabetized domain, , subdomain "tiebreaker," in other words, this: anotherdomain.com domain.com a.domain.com could tell me how code php (or javascript) this? (you can assume each "website" on fresh line of code.) $array = array( 'b.domain.com', 'a.domain.com', 'domain.com', 'anotherdomain.com', 'php.net', 'example.com' ); function sort_domains($domain1, $domain2) { $domain1 = array_reverse(explode('.', $domain1)); $domain2 = array_reverse(explode('.', $dom...

Send SMS Freeswitch via web interface -

i installed freeswitch , bought khomp device send sms trought it! i'm able send sms command line inside freeswitch client(fs_cli). enabled xml-rpc module send via web, i'm not able start application send via web. anybody had heard sending sms using xml-rpc connecting freeswitch virtual machine , sending it? thanks , sorry bad english.

java - Apache HttpClient: Location of redirected URLs -

i'm using apache's httpclient (for java) load url getting redirected http 301 response. news, httpclient follows redirect automatically, , don't need manually loop through redirects. the part haven't figured out final destination. because i'm getting headers of final successful (http 200) query, there no location header. since redirect occurs behind scenes of httpclient.execute(..), code doesn't know whether there has been redirect, , has redirected to. how vital piece of information? need recode in java.net classes info? for record, i'm using apache httpclient on android, , need backward compatibility android 1.6. all hail redirecthandler (helps read docs)

objective c - Memory management in interface builder -

if put label in interface builder, , don't connect iboutlet, have memory leak? or system call dealloc itself? no, won't have leak. without iboutlet, never directly calling retain on object. therefore thing retaining object view label subview of, because when add subview view, calls retain. when parent view dealloced, call release on of subviews, dealloc label.

C# split string but keep separators -

there exist similar questions, of them use regexen. code i'm using (that strips separators): string[] sentences = s.split(new string[] { ". ", "? ", "! ", "... " }, stringsplitoptions.none); i split block of text on sentence breaks , keep sentence terminators. i'd avoid using regexen performance. possible? i don't believe there existing function this. can use following extension method. public static ienumerable<string> splitandkeepseparators(this string source, string[] separators) { var builder = new text.stringbuilder(); foreach (var cur in source) { builder.append(cur); if (separators.contains(cur)) { yield return builder.tostring(); builder.length = 0; } } if (builder.length > 0) { yield return builder.tostring(); } }

Rails: "new or edit" path helper? -

is there simple , straightforward way provide link in view either create resource if doesn't exist or edit existing on if does? ie: user has_one :profile currently doing like... -if current_user.profile? = link_to 'edit profile', edit_profile_path(current_user.profile) -else = link_to 'create profile', new_profile_path this ok if it's way, i've been trying see if there's "rails way" like: = link_to 'manage profile', new_or_edit_path(current_user.profile) is there nice clean way that? view equivalent of model.find_or_create_by_attribute(....) write helper encapsulate more complex part of logic, views can clean. # profile_helper.rb module profilehelper def new_or_edit_profile_path(profile) profile ? edit_profile_path(profile) : new_profile_path(profile) end end now in views: link_to 'manage profile', new_or_edit_profile_path(current_user.profile)

tsql - Getting those records that have a match of all records in another table -

within realm of problem have 3 entities: user position license then have 2 relational (many-to-many) tables: positionlicense - 1 connects position license ie. licenses required particular position userlicense - 1 connects user license ie. licenses particular user has. additional complexity: user licenses have validity date range ( validfrom , validto ) the problem these input variables: userid identifiers particular user rangefrom defines lower date range limit rangeto defines upper date range limit what need get ? particular user (and date range) need list of positions particular user can work at. problem user must have @ least licenses required every matching position. i'm having huge problems writing sql query list. if @ possible using single sql query (can have additional ctes of course). if can convince me doing in several queries more efficient i'm willing listen in. some workable data copy , runs script. 3 users, 3 positions...