Tuesday, April 15, 2008

Remove repeated lines

Unix command:
$ uniq input.txt > result.txt
or
(sorted output)
$ sort -u input.txt > result.txt

Perl:
open (FH,$ARGV[0]) or die ("No input file\n");
read (FH,$file,-s $ARGV[0]);
$file =~ s/^(.*[\n\r]+)\1+/$1/mg;
print $file;


or
cat a.txt | perl -ne 'print unless($s{$_}++)'

Monday, March 31, 2008

Two useful VC2005 add-on

From Visual Studio stuff.
VSFileFinder2005 can add a file listing box and a filter text field for you to find files in solution quickly and then know where the file is located (in which project and in which directory)

VSTabs is also a good utility but it only works for VC2003. I do not find related free add-on for VC2005.

BTW, Visual Assist X - an add-in for Visual Studio by Whole Tomato Software is the best add-on I have ever used. But it is not for free.

Monday, October 29, 2007

Googe Doc small bug

google_doc_bug.jpg
1. Login to Google Doc and open a spreadsheet with multiple sheets
2. Open another window to other google page using the same browser
3. Click "Logout" in the other google page
4. Go back to the spreadsheet page and select another sheet
Result: the spreadsheet shows the google login page BUT the left upper corner shows "Loading" and twinkling

Monday, October 22, 2007

iGoogle Bug?

A simple way to make your iGoogle page blocked

1. Login to iGoogle, and select any gadget's option menu: Share this gadget.
a.jpg

2. Before the next page loading completely, press "Cancel" quickly.
b.jpg

3.Now, the darken screen remains on screen and nothing you can do. (OK. you still can reload this page)
c.jpg

4. If you do not do this under a max screen size window, you can resize the screen, and a interesting screen shows up. you can still click anything outside the darken screen.
d.jpg

m...... This bug happens just because we do not let Google to load the page done. But Google still can prevent this happens. :p

Tuesday, September 18, 2007

high-performance networking

Usually used in Cluster/Super Computer

Quadrics - QsNet

Myricom - Myrinet

InfiniBand (from ServerNet、FIO、NGIO)

Cray - RapidArray(for XD1 Supercomputer)

Fibre Channel/PCI Express/Serial ATA

Ref: (Trad. Chinese) http://tech.digitimes.com.tw/ShowNews.aspx?zCatId=134&zNotesDocId=79821739FC1238FF482570A000490A38

Thursday, June 07, 2007

User Postgresql SERIAL field type in Hibernate

If you meet the following exception when trying to use SERIAL type with Hibernate.

ERROR JDBCExceptionReporter:78 - ERROR: relation "hibernate_sequence" does not exist
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not get next sequence value


Tey to use the following generator setting:

<id name="id" column="id" type="java.lang.Integer">
<generator class="sequence">
<param name="sequence">account_id_seq<param>
</generator>
</id>


Ref: http://forum.hibernate.org/viewtopic.php?t=968817&highlight=postgresql+serial

Sunday, October 15, 2006

jUploadr 1.1.1 win32 installer

jUploadr is written by Java, you need to install JDK(or JRE) before using it.
But the win32 version of jUploadr use a batch file to start jUploadr, the batch file require REG.exe (which is included in WinXP by default no in Win2000).

You can get reg.exe from the following links:
http://www.petri.co.il/download_free_reskit_tools.htm

In my environment (Win2000), there is still some problem in the batch file to start jUploadr. Thus, I have packaged the jUplaodr using InstallAnywhere. The installer will help you to install jUploadr and help you execute jUploadr more easily. (no more DOS command window)

jUploadr_1.1.1_setup.exe (Without JVM)

(You still need to install JDK first)