java

Your experience with "modular" web sites in Java?

I'm building small web site in Java (Spring MVC with JSP views) and am trying to find best solution for making and including few reusable modules (like "latest news" "upcoming events"...). So the question is: Portlets, tiles or some other technology? ...

Java Applet crashes .NET Webbrowsercontrol

Hi, in our application we have a Java applet running inside a .NET browser control. It is a know issue from Sun that running an applet this way may crash the control. Has anyone come across the same problem and solved it? Atm we are running the applet in a Webbrowser but we need to run it in a browser control. Thx for any help. ...

Export ChartFX7 to SVG in Java

Can anybody give an example for exporting a ChartFX7 chart to SVG? I've tried: ByteArrayOutputStream baos = new ByteArrayOutputStream(); m_chart.setOutputWriter(new SvgWriter()); m_chart.exportChart(FileFormat.EXTERNAL, baos); and also: ByteArrayOutputStream baos = new ByteArrayOutputStream(); m_chart.setRenderFo...

Can Unix shell script be used to manipulate databases?

I have to read data from some files and insert the data into different tables in a database. Is Unix shell script powerful enough to do the job? Is it easy to do the job in shell script or should I go about doing this in Java? ...

How can I detect from a Swing app that the PC is being shut-down?

Well behaved windows programs need to allow users to save their work when they are shutting the PC down. How can I make my app detect the shutdown event? Any solution should allow the user to abort the shutdown if user selects, say "Cancel". The normal Swing window closing hook doesn't work, nor does adding a shutdown hook. On testing...

Java Documentation

Hi guys, I have a school project which has to be coded in java and I'm having a little trouble getting started, mainly finding good documentation for this language. Is there anything for java like what http://www.php.net is for php? ...

Any good interview questions to ask prospective Junior java developers?

Does anyone have a good interview question to ask prospective junior java developers? They will have a two year minimum experience requirement. The questions will be on a written test and they will have five to ten minutes to answer each question. Limit to one interview question per response for voting purposes please. ...

How to compile a java application which uses Google webdriver from comand line without ant

Hi, I want to compile an example code which using google`s webdriver. I saved webdriver into /home/iyo/webdriver. My code is: package com.googlecode.webdriver.example; import com.googlecode.webdriver.By; import com.googlecode.webdriver.WebDriver; import com.googlecode.webdriver.WebElement; import com.googlecode.webdriver.htmlun...

How do I set the HttpOnly flag on JSF/Richfaces

I'd like to add the HttpOnly flag to JSF/richfaces cookies, especially the session cookie, to up the level of security on my web app. Any ideas? ...

Given a Date Object how do I determine the last day of its month?

I'm trying to use the following code but it's returning the wrong day of month. Calendar cal = Calendar.getInstance(); cal.setTime(sampleDay.getTime()); cal.set(Calendar.MONTH, sampleDay.get(Calendar.MONTH)+1); cal.set(Calendar.DAY_OF_MONTH, 0); return cal.getTime(); ...

equivalent vb code for a java code

Can anyone tell me what exactly does thi java code do? SecureRandom random = SecureRandom.getInstance("SHA1PRNG"); byte[] bytes = new byte[20]; synchronized (random) { random.nextBytes(bytes); } return Base64.encode(bytes); Step by step explanation will be useful so that I can recreate this code in VB. Thanks ...

Good book for a C# developer going over to Java?

I'm pretty fluent in C#, but maybe need to go over to the dark^H^H^H^H other side and code some Java again. I'm ok with the Java language, as well as OO in general. But I want to learn some more about whats special in Java, as well as, if possible, whats different for me as a C# developer. Especially I need to catch up on some GUI stuff....

Join multiple XML files with xinclude tags into single file

I am creating an installer in IzPack. It is quite large, and I have broken up my XML files appropriately using <xinclude> and <xfragment> tags. Unfortunately, IzPack does not combine them together when you build your installer. This requires you to package the files with the installer, which just won't work. I was about to start writin...

Modal dialogs in IE gets hidden behind IE if user clicks on IE pane

I have to write an applet that brings up a password dialog. The problem is that dialog is set to be always on top but when user clicks on IE window dialog gets hidden behind IE window nevertheless. And since dialog is modal and holds all IE threads IE pane does not refresh and dialog window is still painted on top of IE (but not refreshe...

Embedded Jetty serving static content with form authentication

Dear all, I try to use the Forms-Based authentication within an embedded Jetty 6.1.7 project. That's why I need to serve servlets and html (login.html) under the same context to make authentication work. I don't want to secure the hole application since different context should need different roles. The jetty javadoc states that a Con...

How to implement a simple auto-complete functionality?

I'd like to implement a simple class (in Java) that would allow me to register and deregister strings, and on the basis of the current set of strings auto-complete a given string. So, the interface would be: void add(String) void remove(String) String complete(String) What's the best way to do this in terms of algorithms and data-str...

MySQL Data Truncation Error

I'm working with a fairly simple database, from a Java application. We're trying to insert about 200k of text at a time, using the standard JDBC mysql adapter. We intermittently get a com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column error. The column type is longtext, and database collation is UTF-8. Th...

I need an ID3 tag reader library for Java - preferably a fast one

I'd like to know a good ID3 tag reader library for Java. Would be good if it was easy to use or had very good documentation, but my main criteria is speed - I want to be able to read ID3 tags from over 10,000 files as quickly as possible. Edit 04-Jan-2010 I'm not entirely sure what to do with this question now - it was a high priority ...

Access USB with Java, in order to find thumbdrive manufacturer's serial#/unique-ID

Looking for a way to read the unique ID / serial# of a USB thumb drive; please note that - I am looking for the value that the manufacturer's value, not the one Windows allocates for it - need to support multiple OSs (Windows, Unix, Mac), thus needs to be a Java solution the idea is to be able to distinguish between different USB thumb ...

How do you read JavaDoc?

What tools/websites do you use to read JavaDocs? I currently use Firefox with 20+ tabs open when working on a J2EE project to have all the documentation available which is not very usable, is eating too much memory and is not searchable. What I would expect from such a tool/website: Aggregate JavaDocs from different locations Direct...