What is the difference between :ssh: and :ext:?

Both these protocols normally use the SSH (Secure Shell) protocol to communicate with the CVS server, meaning that your passwords and data are safe from eavesdroppers (although :ext: can be configured to use other protocols as well).

The difference is that :ssh: uses an SSH client built into CVSNT, while :ext: relies on an external SSH client. If you use CVS from the command line, :ssh: has the advantage that you do not need any other software. Since TortoiseCVS already comes with its own SSH client, there is nothing gained from preferring :ssh:. Additionally, at least some versions of CVSNT have problems communicating with non-CVSNT servers, such as those used on the majority of UNIX servers.

Another important point is that it is not possible to configure :ssh: to use another port etc. in the Preferences dialog of TortoiseCVS. That dialog applies only to :ext:. Therefore, we recommend that you always use :ext: instead of :ssh:.

How do I tell if my computer can run a 64-bit version of Windows?

How do I tell if my computer can run a 64-bit version of Windows?

To run a 64-bit version of Windows, your computer must have a 64-bit-capable processor. To find out if your processor is 64-bit-capable, do the following:
  1. Open Performance Information and Tools by clicking the Start button Picture of the Start button, clickingControl Panel, clicking System and Maintenance, and then clickingPerformance Information and Tools.
  2. Click View and print details.
  3. In the System section, you can see what type of operating system you're currently running under System type. Under 64-bit capable, you can see whether you can run a 64-bit version of Windows. (If your computer is already running a 64-bit version of Windows, you won't see the 64-bit capable listing.)

How to make a bootable Windows 7 USB installer with CMD:

How to make a bootable Windows 7 USB installer with CMD:
  1. Open and run CMD as Administrator.
  2. Type Diskpart, press Enter.
  3. Type List Disk, press Enter.
  4. Type Select Disk # (where # is the number your USB drive shows up as), press Enter.
  5. Type Clean, press Enter.
  6. Type Create Partition Primary, press Enter.
  7. Type Active, press Enter.
  8. Type Format Quick FS=FAT32, press Enter.
  9. Type Assign, press Enter.
  10. Type Exit, press Enter.
  11. Copy everything from the Windows 7 installation DVD onto the USB key (a simple drag and drop will do; if you have an .iso extract or mount first).

ThinkPad T400S, hit F1 enter BIOS.

Make sure put USB HDD as the first priority of start up.

Base 64 Encoidng and Decoding

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import org.apache.commons.codec.binary.Base64;

String strTobeEncoded = "This is message body which will be 64 encoded";
String strTobeDecoded = "VGhpcyBpcyBtZXNzYWdlIGJvZHkgd2hpY2ggd2lsbCBiZSA2NCBlbmNvZGVk";

String encodedResult = "";
String decodedResult = "";

try
{
 // encoding using sun.misc.BASE64Encoder;
 BASE64Encoder encoder = new BASE64Encoder();
 encodedResult = encoder.encode(strTobeEncoded.getBytes());
 System.out.println("Encoded by Sun's encoder: " + encodedResult);

 // decoding using sun.misc.BASE64Encoder;
 BASE64Decoder decoder = new BASE64Decoder();
 decodedResult = new String(decoder.decodeBuffer(strTobeDecoded));
 System.out.println("Decoded by Sun's decoder: " + decodedResult);

 // encoding using org.apache.commons.codec.binary.Base64;
 encodedResult = new String(Base64.encodeBase64(strTobeEncoded.getBytes()));
 System.out.println("Encoded by Apache's encoder: " + encodedResult);

 // encoding using org.apache.commons.codec.binary.Base64;
 decodedResult = new String(Base64.decodeBase64(strTobeDecoded.getBytes()));
 System.out.println("Decoded by Apache's decoder: " + decodedResult);
}
catch (Exception e)
{
}

Target runtime SpringSource tc Server Developer Edition (Runtime) v2.1 is not defined.

Solutions:

1. Delete the server
2. Recreate the server: create new instance, choose template insight.
3. Right click the project, find "Targeted Runtimes", removed the old one.

Eclipse SSH and extssh

A couple of days ago, I found I could not use Tortoise CVS to work with CVS repository, after I replacing all "extssh" with "ext" in all Root, it's working.

Today, I found Eclipse is not working with CVS repository, and here is the fix:

Preferences->Team->CVS->Ext connection Method->Choose "Use another connection method type to connect", and select Connection type as "extssh".

Using DropBox to Host Your Code

I wrote some Flex applications, and would like to post them into my Blog. First, I tried to use Google Docs, there is no problem to upload the folder, but Google Docs seems not let you have the link to the file. Then I tried DropBox's Public folder, wow, it's unbelievably easy, just drag and drop the release version of the Flex application to Public folder, then select the main html file, and right click, DropBox->Copy Public Link, now you have the web link to that file.

Next, just copy the following to my blog, and I am all set.

EZFixedFormatReader

Get Lapsed Time in Java

long startTime = System.currentTimeMillis();
System.out.println("start getting super session: " + startTime);

long endTime = System.currentTimeMillis();
System.out.println("end getting super session: " + endTime);
System.out.println("time taken in seconds: " + (endTime - startTime)/1000);
System.out.println("time taken in mill seconds: " + (endTime - startTime));

SimpleDateFormat


LetterDate or Time ComponentPresentationExamples
GEra designatorTextAD
yYearYear199696
MMonth in yearMonthJulyJul07
wWeek in yearNumber27
WWeek in monthNumber2
DDay in yearNumber189
dDay in monthNumber10
FDay of week in monthNumber2
EDay in weekTextTuesdayTue
aAm/pm markerTextPM
HHour in day (0-23)Number0
kHour in day (1-24)Number24
KHour in am/pm (0-11)Number0
hHour in am/pm (1-12)Number12
mMinute in hourNumber30
sSecond in minuteNumber55
SMillisecondNumber978
zTime zoneGeneral time zonePacific Standard TimePSTGMT-08:00
ZTime zoneRFC 822 time zone-0800

must override a superclass method

I just did an update from Mercurial, and I found one of the class having compilation error on one of the method.

XXXXX must override a superclass method

I do notice that method has an annotation called "@Override". A quick search, I found that's because my Eclipse's compilation level is set as 1.5.

Preferences->Java->Compiler
Make sure Compiler compliance level set as 1.6

DropBox + Mercurial: A perfect solution for code development

Ever had the problem copying codes over from one machine to another, most likely, home vs work? DropBox solved the problem syncing the codes between different machines, while Mercurial (without Push) provides version control abilities.

Changes between different Java JDK

Last week, one of my colleague told me that there is some compilation error in his project, while I checked mine, I have no problem, then quickly I found the problem: I am using JDK 1.6, while he is using 1.5. The culprit is a method from String class isEmpty(), which is a total new method at JDK 1.6, this incident prompts me to think if there is way to quickly find out the changes between different JDK.

I found this link , which shows differences between between 5.0 fcs and 6 Beta.

1.6
1.7

DBVisualizer

I just found something that I didn't know about DBVisualizer

 1. For selected table, we could sort the order of columns by clicking "Grid Column Chooser", and we could also customized which columns to be visible or not. And the customized columns will be kept until we close DBVisualizer, it would be really nice if the customized columns could be saved even if we close the application.

2. DBVisualizer also provides type as search function in many aspects.

3. We could also filter on table name in DBVisualizer, but it would be really nice if this is could be done by type as search.

Get current user name in Flex

package
{
    import flash.filesystem.File;

    public class UserUtil
    {
        public static function get currentOSUser():String
        {
            var userDir:String = File.userDirectory.nativePath;
            var userName:String = userDir.substr(userDir.lastIndexOf(File.separator) + 1);
            return userName;
        }
    }
}

Get current user name and machine name in Java

    System.out.println(System.getProperty("user.name"));
    java.net.InetAddress localMachine = java.net.InetAddress.getLocalHost();
    System.out.println(localMachine.getHostName());

Cannot load 64-bit SWT libraries on 32-bit JVM in Eclipse

Let's end this once for all.

You got this problem is because you are using 64bits Eclipse, but your ant target is using 32bit JDK.

It's OK to use 32bit JDK in Eclipse, but you'll have problem when your ant need some GUI prompt, at this point, it will call Eclipse to generate this GUI prompt which is 64 bits, and now we'll have problem.

Solutions:
1. Use 32bit Eclipse
2. For those ant targets which require GUI prompt, change JRE to 64bits JDK.

XStream Notes

Using xstream-1.4.2.jar, and got the following problem:

Exception in thread "main" java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPullParserException
at com.thoughtworks.xstream.XStream.<init>(XStream.java:336)
at com.hempire.xstream.Writer.main(Writer.java:22)

The XML Pull Parser API defines an own mechanism to load the factory for the available XPP (XML Pull Parser) implementation. XStream's XppDriver never used this lookup mechanism automatically before version 1.4, now it will. Therefore you will have to add a dependency to xmlpull if the XPP implementation does not deliver the classes on its own. This dependency is necessary for Xpp3 in contrast to kXML2 that contains the classes. Use the Xpp3Driver or the KXml2Driver if you want to select one of the directly supported XPP implementation on your own without using the XPP factory. Note, that the minimal version of kXML2 does not support the XPP factory, but can be used by the KXml2Driver.

I honestly don't understand what the above means, but the bottom line is if we include any of the following jars, you should be fine:

kxml2-2.3.0.jar
kxml2-min-2.3.0.jar
xmlpull-1.1.3.1.jar
xpp3_min-1.1.4c.jar

kXML2 is recommend for use as it will greatly improve the performance of XStream.

Supported XML parsers and packages:

Get to Jira (or any web) quick from cygwin

1. Put the following in .bashrc:
export jira="https://jira.dovetail.net/browse/BUG-"
2. Make it effective:
source .bashrc
3. under /home/hliu/bin,  create file named as "jira":
cygstart "$jira$1"
4. Make it executable:
dos2unix jira
chmod 755 jira
5. Now from cygwin, you could type: