Ong CherYee

Greenhorn
+ Follow
since Jan 17, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ong CherYee

Hi, I would like to know how to get the id of a specific outputLink in a Panel Series? (Not the panel series itself but the individual link which the user clicks on)
The context is that a word cloud is displayed and when a user clicks on a text (which is an output link) in the word cloud, a search operation based on that text is launched.

I would like to use getElementById in a javascript function to get the value of the specific outputLink based on its id.

Alternatively, is there a way to pass the value of the outputLink to the javascript function?
I had tried this.value as arguments to the launchSearch function but the result is always undefined. I had also tried passing this.id as an argument then use getElementById to read the value but the result is also undefined.

Attached is the code:





I've been stuck at this for some time and it's driving me crazy. :banghead:
10 years ago
JSF
There is a zip file which contains a folder inside it. The folder itself contains a few files. I would need to know how to extract the folder (with its contents) from inside a zip file.

I have found a few unzipping code samples which show how to handle a folder inside a zip file. An example is shown below:



The code sample which deals with the part where the zipEntry is a directory creates a directory with the same path and name. ( if(isDirectory){ )

Another similar variation is:


When the code creates a directory for the folder, does it unzip the contents inside the folder as well?

If not, how do I extract the files inside the folder?
[ April 09, 2008: Message edited by: Ong CherYee ]
16 years ago
I've printed out the exception message and it says that the Zip file must have at least one entry.



However, the folder which was zipped has got 4 files inside. What could be causing the problem?
16 years ago
I have a method which performs zipping. I took the zipping code found on the net and modified it to make sure that folders can be zipped as well.

When using the code to zip a folder, it always produces an exception. Yet, the strange thing is that the code still manages to zip the folder correctly. I can view the contents of the zipped folder and unzip it.

There is no such problem if the zipping is done on a file.

The code is shown below:



I guess it is the code within the elseif(file.isDirectory()) clause which cause the exception but I cant figure out which line is the culprit, especially when the folder still manages to be zipped correctly.
16 years ago
I have a java project in JCreator and the project is organised into packages. I have also configured JCreator to provide 2 arguments to the main method when the project is executed.

I would want to create a batch file (.bat) for this project where the batch file can automatically use the arguments set in JCreator when the program runs.

How do I go about creating the batch file?
16 years ago
If I have a <file> </file> element in an XML file and I want to insert a filename of the form PED<yyMMdd>232, how do I insert the < and > brackets as an element value inside the <file> tag?

I use JCreator to edit the xml file and it treats <yyMMdd> as a seperate element instead of being part of the filename.

16 years ago
I have an xsd file which the SAXParser is to parse and use it to validate some xml files.

I used the setEntityResolver and parse methods of the SAXParser and a custom class called MyEntityResolver. But errors appeared when the code is run.

The class where the SAXParser and the custom class is used is shown below:



The custom class MyEntityResolver is listed below:



The SAXParseException was caught when the code runs. Is there something wrong with the code above or does the fault lie with the xsd/xml file?
16 years ago
I would like to unzip a zip file which contains 2 text files and another zip file inside it.

For example, the zip file to unzip is called "Books.zip" and it contains 2 text files and another zip file called "Price.zip".

I googled for the unzipping code commonly found on the net and used it. But the problem is that the code can only unzip the 2 text files. It seems unable to retrieve the contents inside the "Price.zip" folder.

The code used is shown below:


How do I unzip and retrieve all the contents of a zip file which contains another zip file?
16 years ago
am doing java logging to file using the logger class. In order to write logs to the file, a file handler was created using the 'append' mode.

However, when the
log entries are written to the log file, they are all entered on a single line.

How do I make each new log entry start on a new line?

16 years ago
I have written a zip code which can zip files from a directory into 1 zip file. However, when it encounters a folder in that directory, it compresses the folder into a seperate zip file.

Below is the code:



The part where the folder is dealt with is under the "elseif fileArray[i].isDirectory()) ". Recursion is used to get into the folder to read the files inside for compression.

I have made the file and zip output streams to have the same location (destZipFile) so that the folder to be compressed can be placed in the same zip file. However, when I ran the program, there is no trace of the folder being zipped.

How do I manage to zip all files and folders inside a directory into 1 zip file?
16 years ago
Hi,

Firstly, i'm new here, so good day to you all. Good to have found this friendly java website

Firstly, I have to move a file from 1 directory to another.
Then I have to rename the file according to its timestamp. (in the yymmddmmss format. From year all the way down to seconds)

How do I move the file and get the file's timestamp?
16 years ago