To change a default Eclipse project to an Eclipse Java project you can follow the steps below.
Example:
Original .project file
<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>A project</name>
Sometimes you want to replace one piece of text with another in all files in a whole directory tree.
*nix and sed to the rescue.
find ./ -type f -exec sed -i ’s/queryString/replaceString/g’ {} \;
We all know that Java is a memory hog. This page aims to give you an idea how much it actually hogs without using a profiler.
Primitive types
A reference to an object is in this listing also considered to be a primitive type.
Objects
Each Java object uses the following:
To print from the command line with Firefox, you need to install an extension. One such extension is
Command Line Print by torisugari.
This extension allows you to print URLs immediately, without user interaction. This can be useful to convert html pages to PDF for example.
You first have to install the extension from http://torisugari.googlepages.com/commandlineprint2
After you've properly installed the extension, you can start using Firefox as command line printer.
Usage:
$>firefox -print http://www.example.com/index.html
To include only a set of files with tar, you can use the following one liner. This example will tar all files with the java extension in the archive with the name test.
find . -name '*.java' | tar czvf test.tar.gz --files-from -
This tutorials shows how to restore all tabs that were open when you closed Firefox.
Go to about:config, this should be typed in the address bar.
Go to the section with that starts with browser.sessionstore and set the values to the whatever you like.
For some applications it is useful to determine the uncompressed size of a file that has been compressed by the gzip algorithm. From the command line this can be done by using the -l option of the gzip program. But this is less straightforward using the Java API's. The GZIPInputStream class does not provide a method to query the original file size. However the information is present in the GZIP file for files that were originally smaller than 4 Gb and can be extracted.
To create a table in latex one can use the tabular environment and surround it with a table block to add a caption and make it floating.
The table below starts with a column that is left-aligned, then there is a a column that will be in bold and is centered and finally there is an italic column that is right-aligned.
\begin{table}
\begin{tabular}{l>{\bfseries}c>{\italic}r}
apple & red & round\\
melon & green & round\\
cookie & brown & square\\
\end{tabular}
\caption{Some objects, their color and their shape.}
\end{table}
When writing new software or implementing new algorithms it is always nice to know how long it takes to process a certain data set. Alternatively it is just good to know how much time a program consumed when you let it run overnight. Did it take till 7 am in the morning or was it finished five minutes after you left your desk.
Linux has a very straighforward way to time your applications. The command is simply called time.
Simply put time in front of your program or script when calling in and you well get some information regarding the runtime it took.
This tutorial explains how to rename all files in a directory and its subdirectories. Or just how to rename multiple files at once in Linux.
This can be done with one very simple command:
rename some other `find . -name '.*'`
This will replaces all occurences of 'some' in file names with 'other'.
A simple example: rename all htm files to html.
rename htm html `find . -name '*.html'`
The rename command takes 3 arguments: