Ben Tse's blog
Java source code formatter plug-in for Ant
Mon, 2007-01-29 10:28 in- Add new comment
- Read more
- 1832 reads
Jalopy is a Java source code formatter, which has a plug-in for Ant. Most modern IDE already includes source code formatting functionality. However, having a common source code formatter for the whole team, integrated in the build process, provides a standardized style formatting.
After downloading the Jalopy Ant plug-in, place the jar files in your project directory. Personally, I am happy with the default style. However, if you would like to customize the style, for example adding javadoc, you can use the preference.bat or preference.sh executable that comes with the download. You can export the style you customized to an xml file, which can be placed in your project directory and referenced in your ant task.
Getting rounded corners on a webpage often means making custom pieces of images to “pad” the edges. It is tedious and increases the size of the page due to the additional images.
Nifty Corner Cube is a library of CSS and javascript that can help you create rounded corners without any additional images. (Examples: link1, link2, link3) With only two parameters (one optional), it is very easy to integrate with existing website. The link above explains how to use the package, however, let’s explore how it is done.
I have recently worked on a project that used the Scrum model of software development, and here are some of my observations and thoughts about it.
From the Scrum website: “Scrum is an agile, lightweight process that can be used to manage and control software and product development using iterative, incremental practices.”
Scrum advocates short iterations (“Sprints” in Scrum terminology) and short daily 15 minutes meetings (“Scrum Meetings”). Scrum also uses a Burn-down chart to keep track of outstanding tasks for each Sprint, each release and the product/project as a whole. The idea is to be able to easily and accurately determine the status of development.
Microsoft has made Virtual PC 2004 for Windows available for free download. Note that it is only the Windows version, and not the Mac version. Virtual PC is a virtualization suite, which allows user to run multiple instances of operating system at the same time.
jEdit is a Java based text editor, released under the GNU GPL. It is designed to be a programmer’s editor. Some of the features I enjoy the most include:
Multiple editor buffers of the same file
This is very useful when you are editing a large file and need references from other parts of the same file, or need to keep other file buffers available.
Java regular expression search and replace
Strut validation wipes file upload field workaround
Fri, 2006-04-14 09:33 in- 2 comments
- Read more
- 2484 reads
Given a struts action form that contains file upload field and server side validation is turned on. If the form does not pass the validation test and is returned back to the inputting jsp page, the upload file field will no longer contain the value that the user had inputted. This can be frustrating for the user. (In my situation, I had a few file upload fields and user had to re-enter all of them if the form does not pass the validation test, even if the error is not on the upload fields)
After searching on the web, I found that the upload field itself is does not take any default value. And because of security reason, values can not be force into the upload field by javascript.
Workaround:
In my action form, I added another FormFile variable and a String for storing the filename.
protected FormFile uploadFile;
protected FormFile uploadFilePrev;
protected String uploadFilenamePrev;
public void setUploadFile (FormFile uploadFile) {
this. uploadFile = uploadFile;
if (uploadFile.getFileSize() > 0) {
this. uploadFile Prev = uploadFile;
}
if (this.uploadFilePrev != null) {
this. uploadFilenamePrev = this. uploadFilePrev.getFileName();
}
}
In the jsp:
<c:out value="${myActionForm. uploadFilenamePrev }" />
<html:file property=" uploadFile "/>
With this, the file previously selected is saved and the filename can be displayed in the jsp. Note that you need to account for the previously selected file in your validation code.
less is a command line utility for viewing text files in Unix and Unix-like system (i.e. Linux). It is similar to more (another viewing utility), but with extended capability, including the ability to scroll up and down, and searching.
Searching in less:
First open the file using command: less [filename]
Type: /[pattern] to search forward and ?[pattern] to search backward, and press ‘n’ for next result, and ‘N’ for previous result.
Quick bracket matching:
If the top line you are currently viewing contain a left bracket, type that left bracket will quickly jump to its matching right bracket, and vise-verse. It works for both curly and square brackets and parentheses.
Viewing multiple files:
You can open and view multiple files: less [filename1 filename2 …]
Or use wildcard: less [*.java]
Press ‘:n’ to jump to the next file and ‘:p’ to previous file
There are many more functions less offers. You can take a look at its manual by typing ‘man less’ in a command prompt. Or any other utility with man [utility name]
Many of you have problably heard this before: ‘Don’t throw away your
old computer, simply install Linux on it and make it a [web, FTP, file,
DNS, etc.] server’. Given the many distributions available, that is
great advice if you have the time to learn them but, what if you just want to (easily) make your old computer do some useful work again?
NASLite is
a distribution of Linux that is customized to make a (perhaps, old)
computer run as a NAS (Network Attached Storage) device. It can be
installed using floppy disks and the basic system requirements are: