How can i make sure my file serving is reliable and scalable? How many parallel request it can handle?
I am thinking beyond the hardware capability and band width.
i am following http://stackoverflow.com/questions/55709/streaming-large-files-in-a-java-servlet
...
As a java programmer who wishes to perfect his programming skills, I often come across the situations that I have to create a runtime exception. I know it's a good practice if one use wisely.
Personally, NullPointerException and IllegalStateException are the most commonly used in the softwares that I have created. How about you?
What ...
before call protected void onSubmit() { , what method is called by wicket? my texfield string loginName is null ,but if i close the browser and restart the browser and view the page, i able to see the textfield string loginame is populated with value i entered in the textfield.
> <td class="label"><wicket:message
> key="log...
When I want to apply the DRY principle, i.e. to unify the code of multiple Struts action for different use-cases (for example the administrator role and the operator role ), one option would be to use an abstract base class "BaseAction" for the action and then use "AdminAction extends BaseAction" and "OperatorAction extends BaseAction". ...
I am transforming some XML using XSLT and Saxon like this:
Source sourceXML = new StreamSource(...);
Source sourceXSLT = new StreamSource(...);
System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl");
TransformerFactory transFact = TransformerFactory.newInstance();
Templa...
I want a delivery receipt after sending email through java mail service and also want to save this receipt to CSV file in text format, send me a running code.
...
Hi All:
I want to use org.apache.java.lang.Bytes class in my code. For that, i need org.apache.java package. Is it a free source package and Where shall i download?
...
I went to this interview for a software developer position and they gave me a test with some corner-case-code situations, with usually 4 options to choose.
One of the questions had an enum declared outside the class scope, I promptly checked the "does not compile" answer and went ahead with the other questions.
It was something like:
en...
Hi,
Similar question to:
http://stackoverflow.com/questions/903488/strange-problem-with-jdbc-select-returns-null
but people didn't ask for this.
My code:
public int myMethod(String day) throws SQLException{
String sql = "Select count(*) from MyTable WHERE someColumn = " + day;
Connection connection = ConnFactory.get();
PreparedS...
After checking the database the incorrect password should be displayed on the same login page.
I have used servlet and forwarded that to the login page but i couldn't add the message "incorrect password".
RequestDispatcher rd = getServletContext().getRequestDispatcher("/register.jsp");
if(dbpwd.equals(null)) {
pw.println("Not a ...
So, i have some not well-formated xml document, some empty tags() don't have "/" at the end, example: <loader local="test.bat" dir="/usr/home">
And how can i elegant(using regex:)) add for each "loader" tag "/" at the of this tag(using Java); must be:
<loader local="test.jpg" dir="/usr/home"/>
...
I'm completely lost on this one: System.getProperty("user.home") and System.getProperty("user.name") returns a questionmark "?".
System-Specs:
Kubuntu 9.04
Gnome 2.2.61
Java 1.5.0_16
My testcase looks like that:
$ more Test.java
class Test { public static void main( String[] args ) { System.out.println( System.getProperties() ); } }
...
As far as I know, JPA itself offers all the shiny features like ORM, JPQL, entity relations mapping and so on. But I don't really understand, why do people use Hibernate or Toplink on top of JPA.
What does Hibernate offer that JPA itself doesn't have?
...
I have a JSF app and would like to have the user auto logout after a period of inactivity. Is there an standard way to do this?
...
Hello, I plan to store an array of numbers in a file and read it when needed. What would be a good way to do this? I can think of afew ways such as storing each element in a line as a text file or serialize it and store / call by that method. Speed is my first concern.
Thanks
...
I'm willing to save a file in the user's "My Documents" folder.
I tried getting the location like this :
System.getenv("USERPROFILE")+"\\My Documents\\"
then, I realised this wouldn't work in a system where the language is set to another language, french for example.
is there another way of getting the "My Documents" folder efficien...
Im running into some problems when trying to convert a SQL query into HQL (or Criteria/Restriction). I have the following SQL query:
Select count(n), CreatedDate from (
Select count(serverId) as n, Date(Created) as CreatedDate
from mytable
group by Date(Created), serverId
) as tbl
group by CreatedDate;
So what is the HQL (or ...
Hi i am new to cactus and when i am using tomcat5.1 and have included all the necessary jars. But when i am trying to execute it, it is showing the error,
Error : "javax.servlet.ServletException: Failed to load test suite [SampleTest], Reason is [Class not found "SampleTest"] "
Please let me know what the problem is??
...
I am implementing a webservice that returns the content of binary files. The files are about 100MB big. The webservice and the client are build upon Axis2.
What is the best joice for the return type of the method that returns the data?
I tried byte[], but I always get OutOfMemoryErrors on the server side. Plus I am not very happy to ha...
Hi,
I'm using Windows and have a batch file (contents attached below) where I'm building up a classpath before trying to run a Java class. Unfortunately the classpath is fairly big and the file ends up being ~14kb. When I run it I'm getting an 'input line too long' error. I have read elsewhere that the max. size for an env variable i...