Posts

xls - java.lang.IllegalArgumentException: Your InputStream was neither an OLE2 stream, nor an OOXML stream -

when i'm reading excel file(.xls format), keep getting exception : java.lang.illegalargumentexception: input stream neither ole 2 stream, nor ooxml stream. i go-ogled , found if input stream not supporting reset or mark, should wrap pushbackstream . input stream not mark\reset supported. so using pushbackstream option? how use it? , whats use of it? thanks your inputstream neither ole2 stream, nor ooxml stream java.lang.illegalargumentexception: inputstream neither ole2 stream, nor ooxml stream i guess using workbook factory or different format input file , different workbook type. error pops when not able not able read file type. apache poi not check file extension. if open in text editor, you'll see instead it'll in different format. or might initializing workbook type hssf or xssf, before using workbook factory. simpler solution open file using microsoft excel , save file(using file>save option microsoft excel > menu ). workbook factory...

c# - Shell Context Menus -

i running windows 7 x64 machine . i have written following code add context menu on right click: registrykey rkey = registry.classesroot.opensubkey("directory\\background\\shell", true); string[] names = rkey.getsubkeynames(); foreach (string s in names) { system.windows.forms.messagebox.show(s); } registrykey newkey = rkey.createsubkey("your application"); registrykey newsubkey = newkey.createsubkey("command"); newsubkey.setvalue("", "c:\\windows\\system32\\notepad.exe"); newsubkey.close(); newkey.close(); rkey.close(); if repeat procedure directly on registry, works, not via this. i able access registry, have added snippet tells lists subkeys require, not add one. i have tested code , & good. looks dont have access rights open registry code. follow these simple steps: close visual studio. open again run administrator mode. 1 can right cl...

matlab - How does "bwareaopen" work? -

i saw documentation of bwareaopen , confusing me number of pixels. when 8-neighbourhood , doesn't mean 9-pixels ? in function, specify number of pixels, , if see example provided in documentation, find mention 50-pixels , mean 10x5 window? so, if specify number of pixels, function do? mentions removing small pixels. mean? isn't each square in image matrix considered square? small pixel in case? thanks. you mixing 2 of variables. in documentation can see following: bw2 = bwareaopen(bw, p) bw2 = bwareaopen(bw, p, conn) where have p , conn variables. conn neighbourhood variable. chose values understand "neigbour". see example: conn=4; - x - x 0 x - x - conn=8 x x x x 0 x x x x higher numbers higher dimensions. p variable variable choose "small". the function bwareaopen delete white areas smaller p pixels. in example in documentation can see: bw = imread('text.png'); bw2 = bwareaopen(bw, 50); imshow...

python - No POST responses from real time callbacks -

basic idea of i'm doing. want grab users' likes , print them in cli application (python script listens get/post messages using twisted framework). i have done oauth via inline canvas html: <a target='_top' href="https://www.facebook.com/dialog/oauth/?client_id=1111111111111&redirect_uri=https://apps.facebook.com/xxxxxxx/&scope=user_likes">grant permissions</a> right seems well? okay i've gone real time subscriptions section within facebook app section , added see image* : http://i.stack.imgur.com/l2i3t.png , when run test, python code returns result, see*: http://i.stack.imgur.com/9d2ek.png so i'm stuck though. because expect happen when like callback show in callback script. i'm printing given render_post , render_get , responses come out fine, example get {'hub.verify_token': ['test'], 'hub.challenge': ['73678294'], 'hub.mode': ['subscribe']} {'hub.verify_...

How to delete superclass entity whose subclass entity has been removed in Hibernate? -

there 2 entity classes , b, , instances a, b (a , b have same id). b subclass of ( b extends a). removed entity "b" database. then, saw "a" has not been deleted. s want. @ point of code, want remove "a" too. when entitymanager.remove(a) throws exception saying, detached entity can t removed. seems removing subclass entity makes superclass entity detached although superclass entity remains in database. can me remove instance a. note: , b have same ids because when create b, automatically created same id ( rule of inheritance). you should use session.delete(b) . deletes both records database. after having deleted b record native sql delete statement, have delete record accordingly native delete statement.

Struts2: Is there a way that checkbox directly links to action class when checkbox is checked? -

for eg: <s:checkbox name="checkme" fieldvalue="true" label="check me testing" action="someactionclass"/> when checkbox selected, control not redirecting particular action class method. you must use javascript problem , toggle action of form according change event of checkbox. here's example using jquery: $('#checkboxid').change(function() { if(this.checked) { // when checked, change action. } else { // else } });

MSBuild says XML doc file (created from C# comments) does not exist, but it exists prior to build -

when set property <documentationfile> on msbuild project, corecompile task executed, when files present , up-to-date. msbuild says runs corecompile task because th file "c:\users\georges\documents\visual studio 2010\projects\test\test\bin\debug\test.xml" not exist, exists , up-to-date. details below. my msbuild file i created brand new console application project in visual studio 2010, , added following lines .csproj (just before import of $(msbuildtoolspath)\microsoft.csharp.targets near end of file): <propertygroup> <targetstriggeredbycompilation> $(targetstriggeredbycompilation);mytarget </targetstriggeredbycompilation> <usehostcompilerifavailable>false</usehostcompilerifavailable> <documentationfile>$(msbuildprojectdirectory)\$(outputpath)$(msbuildprojectname).xml</documentationfile> </propertygroup> <target name="mytarget"> <message text="myt...

regex - How do I mod_rewrite this URL? -

i have url www.domain.com/catalog.php?category_title=widgets i want mod_rewrite www.domain.com/widgets/ i've tried rewriteengine on rewriterule /([^/.]+)/[?]*[^\/\.]*$ /catalog.php?category_title=$1 so i'm searching /([^/.]+)/ the [?]*[^\/\.]* part page can work google adwords appends query string flat url. this regex worked on a previous implementation using zeus's request rewrite module proprietary version of mod_rewrite. this first go @ apache mod_rewrite, , can't work. try using: rewriteengine on rewriterule ^([^/]*)/$ /catalog.php?category_title=$1 [l]

java - Ehcache with tomcat simple example -

i want include ehcache in java web application hosted in tomcat. want check cache key , if key exists retrieve it, if not add cache later retrieval (just memcached usage scenario). i searched documentation , couldn't find useful information on how implement simple example. found out need put ehcache-core.jar , slf4j*.jar in classpath along ehcache.xml. ? can see ehcache cache object in examples - should instantiate in order accessible servlets / jsps ? also, can recommend simple cache configuration put in ehcache.xml ? default <defaultcache maxentrieslocalheap="0" eternal="false" timetoidleseconds="1200" timetoliveseconds="1200"> </defaultcache> ok ? do like cachemanager.getinstance().addcache("xyz"); // creates cache called xyz. cache xyz = cachemanager.getinstance().getcache("xyz"); xyz.put(new element("key", new person()))...

php - SPHINX enable_star not working -

i wish search substrings using results sphinx returned. is setting ok? do need restart searchd process? index dev_jobs { source = dev_jobs_src path = /home/sphinx/jobs/dev_jobs docinfo = extern charset_type = utf-8 enable_star = 1 min_infix_len = 3 } searchd { port = 9312 log = /var/log/sphinx/searchd.log query_log = /var/log/sphinx/query.log read_timeout = 5 max_children = 30 pid_file = /var/run/sphinx/searchd.pid max_matches = 100000 seamless_rotate = 1 preopen_indexes = 0 unlink_old = 1 } and php part of code: $sphinx_search = yii::app()->search; $sphinx_search->setselect('*'); $sphinx_search_final = ''; $sphinx_search_query = trim($this->q); if (strlen($sphinx_search_query) > 0) { $sphinx_search_query = str_replace('-', ' ', $sphinx_search_query); $keys = exp...

c++ - QProcess - Unable to start program - No such file or directory -

i trying start program (tftp) qprocess. no matter how start it, won't run. have tried add absolute path, call inside cmd shell, system can't find it. on windows 8, using qt 4.8 qstring command("c:\\windows\\system32\\tftp.exe"); qprocess* downloadprocess = new qprocess(this); downloadprocess->setworkingdirectory("c:\\windows\\system32"); downloadprocess->setreadchannelmode(qprocess::mergedchannels); connect(downloadprocess, signal(finished(int,qprocess::exitstatus)), this, slot(ondownloadfinished(int,qprocess::exitstatus))); connect(downloadprocess, signal(error(qprocess::processerror)), this, slot(onprocesserror(qprocess::processerror))); connect(downloadprocess, signal(started()), this, slot(onprocessstart())); downloadprocess->start(command); result: "process failed start: no such file or directory could due execution privilege or else? (howeve tftp runs in shell)

initialization - Using Critical Sections/Semaphores in C++ -

i started using c++ instead of delphi. , there things seem quite different. example don't know how initialize variables semaphores , criticalsections. know 2 possible ways: 1. initializing critical section in constructor stupid since every instance using own critical section without synchronizing anything, right? 2. using global var , initializing when form created seems not perfect solution, well. can tell me how achieve this? just short explanation need critical section : i'd fill listbox different threads. semaphore : different threads moving mouse, shouldn't interrupted. thanks! contrary delphi, c++ has no concept of unit initialization/finalization (but found out that). what left little. need distinguish 2 things: where declare variable (global, static class member, class member, local function, static in function -- guess covers all) where initialize variable (since concerned c api have call initialization function yourself) fact is, in case ...

objective c - how to upload/download a file from/to dropbox using xcode -

i new ios. how upload/download file from/to dropbox? integrated dropbox applications in app, couldn't upload/download file. this upload code: - (nsstring *)getdocumentpath { nsmutabledata * pdfdata = [nsmutabledata data]; uigraphicsbeginpdfcontexttodata(pdfdata, self.view.bounds, nil); uigraphicsbeginpdfpage(); cgcontextref pdfcontext = uigraphicsgetcurrentcontext(); [self.view.layer renderincontext:pdfcontext]; uigraphicsendpdfcontext(); nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *path = [[paths objectatindex:0] stringbyappendingpathcomponent:@"vani.doc"]; [pdfdata writetofile:path atomically:yes]; return path; } - (ibaction)upload:(id)sender { nsstring *path = [self getdocumentpath]; nsstring * local = [path lastpathcomponent]; nsstring *destdir = @"/plist folder/vani.doc"; [restclient uploadfile:local topath:destdir wit...