Tag Archives: java

Java Apache FileUtils readFileToString and writeStringToFile problems

Questions: I need to parse a java file (actually a .pdf) to an String and go back to a file. Between those process I’ll apply some patches to the given string, but this is not important in this case. I’ve developed the following JUnit test case: String f1String=FileUtils.readFileToString(f1); File temp=File.createTempFile(“deleteme”, “deleteme”); FileUtils.writeStringToFile(temp, f1String); assertTrue(FileUtils.contentEquals(f1, temp));… Read More »

java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller

Questions: I am trying to generate Excel using Xssf API because its memory footprint is small. It is working fine in my local machine which is having jdk1.7. But when I try to run it on UNIX where java version is 1.6.0_75 it gives me the following error. java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller I… Read More »

Reference ASP.NET control by ID in JavaScript?

Questions: When ASP.NET controls are rendered their ids sometimes change, like if they are in a naming container. Button1 may actually have an id of ctl00_ContentMain_Button1 when it is rendered, for example. I know that you can write your JavaScript as strings in your .cs file, get the control’s clientID and inject the script into… Read More »

HTTP HEAD Request in Javascript/Ajax?

Questions: Is it possible to do a HTTP Head request solely using an XMLHTTPRequest in JavaScript? My motivation is to conserve bandwidth. If not, is it possible to fake it? Answers: Easy, just use the HEAD method, instead of GET or POST: function UrlExists(url, callback) { var http = new XMLHttpRequest(); http.open(‘HEAD’, url); http.onreadystatechange =… Read More »

change url without redirecting using javascript [duplicate]

Questions: This question already has an answer here: Modify the URL without reloading the page 18 answers Answers: use pushState: window.history.pushState(“”, “”, ‘/newpage’); Questions: Answers: If you want to know exactly what they using, it’s Backbone.js (see lines 4574 and 4981). It’s all mixed up in there with the jQuery source, but these are the… Read More »

DRY URLs in Django Javascript

Questions: I’m using Django on Appengine. I’m using the django reverse() function everywhere, keeping everything as DRY as possible. However, I’m having trouble applying this to my client-side javascript. There is a JS class that loads some data depending on a passed-in ID. Is there a standard way to not-hardcode the URL that this data… Read More »