Posts

vba - mid()=foo in VBS? -

in vba , vb6 can assign mid example mid(str,1,1)="a" in vbs doesn't work. need because string concatenation freakin' slow here actual code hacked real quick function fastxmlencode(str) dim strlen strlen = len(str) dim buf dim varptr dim dim j dim charlen varptr = 1 buf = space(strlen * 7) dim char = 1 strlen char = cstr(asc(mid(str, i, 1))) charlen = len(char) mid(buf, varptr, 2) = "&#" varptr = varptr + 2 mid(buf, varptr, charlen) = char varptr = varptr + charlen mid(buf, varptr, 1) = ";" varptr = varptr + 1 next fastxmlencode = trim(buf) end function how can work in vbs? authoritative source explicitly stating it's not available in vbscript: visual basic applications features not in vbscript : strings: fixed-length strings lset, rset mid statement strconv vba has both mid statement , mid functi...

c++ - choose correct template specialization at run-time -

i have template <int i> struct { static void f (); }; with specializations done @ different places in code. how can call correct a<i>::f i known @ runtime? void f (int i) { a<i>::f (); } // won't compile i don't want list possible values of i in big switch . edit: i thought of like #include <iostream> template <int i> struct { static void f (); }; struct regf { typedef void (*f)(); enum { arrsize = 10 }; static f v[arrsize]; template < int > static int apply (f f) { static_assert (i < arrsize, ""); v[i] = a<i>::f; return 0; } }; regf::f regf::v[arrsize]; template <int i> struct reg { static int dummy; }; template <int i> int reg<i>::dummy = regf::apply<i> (); void f (int i) { return regf::v[i] (); } #define add(i) \ template <> struct a<i> : reg<i> { \ static void f () { std::cout << << "\n"; } \ }; add(1...

java - Decoding RIMM streaming file format -

i want decode video (visual) frames within blackberry rimm file. far have parser , , corresponding container documentation rim. the video codec h264 , explicitly set on device using 1 of video.encodings properties. however, ffmpeg not able decode frames , driving me nuts. edit 1: issues seems lack of sps , pps in frames, , artificially inserting them have proven unsuccessful far (all grey image). blackberry 9700 sends 0x00 0x00 0x?? 0x?? 0xtype where type according table 7-1 in h264 spec (i , p frames). believe 0x?? 0x?? represent size of frame, size not correspond size found parser (the parser seems working correctly). i have windows decoder codec blackberry, called mc_demux_mp2_ds.ax, , can play mpeg-4 files captured same way, binary windows. , h264 files not play either way. aware of previous attempts . capture url javax.microedition.media.manager is encoding=video-3gpp_width=176_height=144_video_codec=h264_audio_codec=aac and writing output stream. example files...

Sync files between pc and Android phone like Windows ActiveSync? -

is possible sync files (like textfiles) specific path on android phone specific folder on pc via usb? pretty activesync connect phone pc , syncs specific files phone pc if changed. i not talking outlook, contacts or word documents, plain text files custom extension. basically app makes changes textfile whenever app used, , when user done syncs textfile pc read our main program. is possible sync files (like textfiles) specific path on android phone specific folder on pc via usb? there no apis in android sdk access usb. developer can via ddms, or via adb pull , app has no way of initiating this, let alone arbitrary users.

c++ - If there are virtual methods, is vtable is going to be created? -

if create simple class : class { public : virtual void foo() { } }; (no virtual destructor) compiler going create vtable? or modern compilers smart enough recognize case (which might bad copy , paste) , not add virtual table such classes? the v-table implementation detail. compilers use v-tables virtual functions create 1 class. don't, won't.

php - post rating for an individual item in a list using codeigniter -

i’m having heck of time figuring out how post rating individual item in list of items, this code let’s me rate multiple items, not single items: for($i=0;$i<2;$i++){ $doc_item_id = $_post['item_id0'][$i]; $doc_rating = $_post['document_rating'][$i]; $it_rt = array( 'item_id' => $doc_item_id, 'rating' => $doc_rating, ); $this->purchases_model->update_document($it_rt); } whereas code let’s me rate first item (or last item depending on put "break;"): foreach($_post['item_id0'] $doc_item_id){ foreach($_post['document_rating'] $doc_rating){ } break; } $it_rt = array( 'item_id' => $doc_item_id, 'rating' => $doc_rating, ); $this->purchases_model->update_document($it_rt); any thoughts on how correct either of these such user rate individual item of choosing appreciated, if user supposed choose item rate (in...

jsf 2 - JSF 2 OpenJPA 2 Glassfish 3.1 WEB9031 Error -

i got error according apache support issue relating glassfish rather openjpa: java.lang.illegalstateexception: web9031: webappclassloader unable load resource [org.apache.openjpa.util.longid], because has not yet been started, or stopped the stacktrace is: caused by: java.lang.illegalstateexception: web9031: webappclassloader unable load resource [org.apache.openjpa.util.longid], because has not yet been started, or stopped @ org.glassfish.web.loader.webappclassloader.loadclass(webappclassloader.java:1410) @ org.glassfish.web.loader.webappclassloader.loadclass(webappclassloader.java:1368) @ com.ckd.model.bookmodel.pcnewobjectidinstance(bookmodel.java) @ org.apache.openjpa.enhance.pcregistry.newobjectid(pcregistry.java:138) @ org.apache.openjpa.meta.metadatarepository.processregisteredclass(metadatarepository.java:1693) @ org.apache.openjpa.meta.metadatarepository.processregisteredclasses(metadatarepository.java:1643) ... 112 more has come across ...