Posts

eclipse - dynamically rectify error from java code using java program (Source Code analysis + error removal) -

i have been given task need convert c# library java library, use utility tool (c# java converter) convert c# code java. however, tool 60% efficent in converting code. need write program rest of rectification. to achieve it, have used java compiler api locate errorneous code. error returned java compiler diagnostics generic, , not give lot of indication program error , how rectified? i believe eclipse has quick fix (hint , solution given @ compile time) in practicality achieves same, there way can use eclipse api 'quick fix' out code, , if not ideal approach towards problem? i did eclipse api unable locate quickfix api.

html / css how to Middle (vertically) align text inside a <textarea> -

Image
i want centre text inside text area; trying line height, doesn't work. you use contenteditable="true" attribute on <div> , skin css. here link cross browser compatibility: reliable cross-browser info on contenteditable

floating point - python float to in int conversion -

i have issue drives me mad. doing int(20.0) result in 20 . far good. but: levels = [int(gex_dict[i]) in sorted(gex_dict.keys())] while gex_dict[i] returns float, e.g. 20.0 , results in: "invalid literal int() base 10: '20.0'" i 1 step away munching last piece of keyboard. '20.0' string, not float ; can tell single-quotes in error message. can int out of first parsing float , truncating int : >>> int(float('20.0')) 20 (though maybe you'd want store floats instead of strings in dictionary, since seem expecting.)

c++ - overloaded global new operator issue with msvc2008 -

i'm working @ own library, , have own allocators. i've declared common interface this: class myallocator { public: void * allocate(size_t size); void * allocate(size_t size, size_t align); void deallocate(void *); //... }; now, if want allocate c++ objects allocators must use placement new in manner: myallocator a; myobject * o = new(a.allocate(sizeof(myobject))) myobject(param1, param2, ...); this, of course, works pretty well. now, time ago wanted make global allocator, take allocator parameter, in order avoid repetitive sizeof(). come this: template< typename allocatort > inline void *operator new(size_t n_bytes, allocatort & allocator) { return allocator.allocate(n_bytes); } with this, can call: myallocator my_alloc; myobject * o = new(my_alloc) myobject(param1, param2); a syntax clean, , cool. works pretty (with gcc, , msvc2010), today, when have tried in msvc2008 got errors: that's because of msvc2008 compiler fooled temp...

ruby - 'Require' works on one computer but not on another -

i error on server i'm trying run ruby script. require: no such file load -- ssch_mail_lib (loaderror) however, on workstation computer script runs fine. here's relevant code. #!/usr/bin/ruby $: << './lib' require 'ssch_mail_lib' output of $load_path /library/ruby/site/1.8 /library/ruby/site/1.8/powerpc-darwin11.0 /library/ruby/site/1.8/universal-darwin11.0 /library/ruby/site /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/vendor_ruby/1.8 /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/vendor_ruby/1.8/universal-darwin11.0 /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/vendor_ruby /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8 /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/powerpc-darwin11.0 /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 . ./lib i've tripled checked names , directo...

javascript - Loading Text file to HTML textarea from mobile phone storage -

i writing app mobile phones using html5, javascript , css. 1 part of app should allow user load text file present phone's local storage on text area provided on page. questions are: how create file dialog box ask user select txt file. (is possible?) i read php etc load files have no experience in it. there code snippet use load text file? can javascript, jquery mobile has this? once load textarea, want edit , save again. it helpful if can throw light on or direct me towards resource can learn it. local i/o never allowed directly, should obvious security reasons. need set <input type="file"> form this, i'm not sure how behave on mobile platform. i'm sure that between platforms. assuming successful file upload , transmission editing area, saving storage require file download have initiate, , user choose accept or ignore. you use words "local storage" , tags include html 5, there additional options. can in localstorage api, al...

objective c - Clang NSTask with streams -

never-mind "why?","useless?", , "don't bother" comments. want compile program inside program using clang. can create nstask , set arguments , work if file exists, (ie. no stream), , writes physical file. haven't been able use streams both input , output. know both clang , gcc allow compiling stdin if use -xc , - options unable implement feature using pipes. not sure how redirect clang's output file handle or stream. here code have compiles , generates correct output in outfile task = [[nstask alloc] init]; nspipe* outputpipe = [[nspipe alloc] init]; [task setstandardoutput:outputpipe ]; [task setstandarderror: [task standardoutput]]; nspipe* inpipe = [nspipe pipe]; [task setstandardinput:inpipe]; [task setlaunchpath:@"/usr/bin/clang"]; nsstring* outfile= [nsstring stringwithformat:@"%@.out",[[filename lastpathcomponent] stringbydeletingpathextension]]; //[data writetofile:@"file.c" atomically:yes]; [t...