Tuesday, May 27, 2008

Ubuntu installation

Ubuntu provides a very user-friendly interface. I will recommend it for desktops and laptops. However, since the installation media is a CD-ROM, the preinstalled softwares are limited. Here are procedures for additional softwares:

1) add a Medibuntu repository, including many commerical softwares which ubuntu cannot include in their own repositories, such as acroread, skype, mplayer. Check the method here. For instance, for 8.0.4(hardy),
  • Ubuntu 8.04 "Hardy Heron":

    sudo wget http://www.medibuntu.org/sources.list.d/hardy.list -O /etc/apt/sources.list.d/medibuntu.list

Then, add the GPG Key:

sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update

then you can use "sudo apt-get install acroread" to install the adobe acrobat reader, as well as its mozilla plugin.
2) install LaTeX
sudo apt-get install tetex-base tetex-bin tetex-extra

3) install emacs, gnuplot, grace ....,

Some problems:
1) for nvidia graphical cards, the system will prompt you to install an enhanced driver nvidia-glx. However, there's a bug which messes up with your LCD monitor refresh rate. A temporary solution is to edit /etc/X11/xorg.conf, in Device section, add
Option "DynamicTwinView" "false"

Sunday, May 25, 2008

Leopard: how to fix the pdf fonts problem in preview

It appears to be the problem with the corrupted font cache. To clean/fix the corrupted cache,

To delete the ATS cache folder for the current user:

sudo rm -rf `lsof | grep com.apple.ATS/annex.aux \
| grep Finder | cut -c 66-139`

To delete the ATS cache folder for all users:

sudo rm -rf /private/var/folders/*/*/-Caches-/com.apple.ATS

After running this script, the machine should be restarted so that the caches can rebuild.



This solution is from http://www.macosxhints.com/article.php?story=20071026081555971

Tuesday, May 20, 2008

Computer Deals

If you want to buy a computer or PC parts, these are the places I will research on at first.

Convert a fat32 partition into ntfs

Windows comes with a utility called "convert" with which you can convert a fat32 partition into a ntfs file system.

  • open a terminal (command prompt) from "Run"->"cmd"
  • let's say, drive D is in fat32 format and you want to convert it. Use "vol d:" to check the volume name.
  • Use "convert d: /fs:ntfs" to convert. You will be asked for a volume name: you can either use the old name or pick a new name.
  • Wait for the conversion to be completed.
  • Although it's usually flawless (without losing any files) for this procedure, you are advised to back up your data in that drive before the conversion for secure purposes.

Friday, May 16, 2008

Upgrade your hard drive: procedures and problems

There are many cases you might want to upgrade your hard drive: 1) you are running out of space on your laptop or PC; 2) when you buy new PCs, manufacturers usually charge higher for hard drive upgrade and you want to purchase with the lowest configuration and upgrade by yourself.

The question here is how you can make a "TRUE COPY" of your old hard drive to the new drive.

I will share my experience in upgrading a Lenovo Thinkpad T61 with Windows XP installed.

1) Buy a new hard drive.

You have to figure out the exact model that your computer supports. For instance, interface (EIDE or SATA), size (2.5", 3.5" ...).

For T61 or most current-day laptops, find a 2.5" SATA drive. Actually, I purchased a portable external drive (for instance, Maxtor OneTouch 4 mini). The benefits of the external drive are: a) you can firstly plugin to copy the hard drive; b) after switching drives, you can still use the old drive as an external storage.

2) Hard drive copy: copy all partitions in the old drive to the new one.

Method: a) direct partition to partition copy; 2) backup your drive into an image and then restore the image to the new drive.

Software: there are many commercial products, such as partition magic, Norton Ghost, ... I picked a free software called Disk Copy (Supports IDE, SATAI, SATAII, SCSI, Firewire(IEEE1394) and USB drives). Another software I want to mention is Gparted, which is included in the Ubuntu installation and live CD.

3) Procedure:
  • download Disk Copy from here, and burn it into a CD.
  • keep the old drive your laptop and plugin the external hard drive (USB).
  • boot the Disk Copy CD.
  • You have the optional for "Disk Copy" or "Partition Copy". I pick Partition Copy
  • Pick the source(from the old drive) and the destination(from the new drive) partition. If you pick the destination in an existing partition in the new drive, the existing parition will be deleted and a new partition will be created with the same size as the source partition ( the rest will be left as unallocated space. If you pick the destination from a unallocated space, then a new partition is created.
  • Copy ....... The speed of copying is 800MB/Min ( I guess it's limited by the USB connection speed). Since it does a sector to sector copy, a 80GB partition will cost around 100 mins.
  • Repeat the above procedures for all partitions you want to copy.
  • Shutdown the computer, switch the hard drive.
  • Turn on the computer with the new drive, cross your fingers ......

PROBLEM

All right, my copy of the Windows XP doesn't boot normally; it hanged on the booting screen with Microsoft Windows XP logo.

Problem: I reinserted the new hard drive into the enclosure and read the boot log from another computer; discovered that the device drivers are loaded OK but then the computer tried to load files from "E:\Windows" instead of "C:\windows". OK, I realize that XP "thinks" the new drive as another drive.

Solution: change the drive letters. This can be done by changing the registry table "HKLM\System\MountedDevices\DosDevices\C:".

How can you edit the registry table without being able to boot into the system?

I found one tool named Offline NT password and registry editor. It's a bootable CD which boots into a program in a Linux envoinment. The problem allows you to change certains things on your Windows 2000/XP/NT systems, such as registry table, passwords(!).

Procedure to fix my problem: the registry table editor in ntpasswd works prefectly on HKLM\Software, but not always on HKLM\System. For instance, I cannot write back as "/Windows/System32/Config/System is read-only".
  • create the ntpasswd CD.
  • boot the CD with the new drive in the laptop and an external drive (for instance, a USB pen drive).
  • follow the prompt of the CD, pick "system" and use option "9-registry editor"
  • use "?" to find a list commands in the editor. you can "ls" to list; "cd xx" to enter a subkey.
  • ok, I use "cd MountedDeives". but then i cannot edit the value for "\DosDevices\C:". So i deleted all of \DosDevices. the idea is that i cleared all the drive letter assignments, in the next boot, XP will try to reassign drive letters, and hopefull get it right(indeed it worked !). The command to delete a key is "dv xxx".
  • all right, press q to quit and quit. It then prompted you to write the modified registry table back. But it failed as I mentioned "/Windows/System32/Config/System is read-only".
  • after the failure, the ntpasswd exited to a linux prompt.
  • mount the USB drive, for instance "mount -t vfat /dev/sdb1 /mnt".
  • the modified registry file is in "/tmp". So, "cp /tmp/system /mnt".
  • shutdown the computer.
  • put the (new) hard drive into the enclosure and plug into another (bootable) computer together with the pen drive. Now copy the "system" file in your pen drive to the (new) hard drive "Windows(or Winnt)\System32\Config", replace the old "system" file(you can make a copy).
  • Now, insert the (new) hard drive back into the computer. Boot up, .... magic happens|
COMMENT: Windows IS STUXXX!!!

Saturday, May 10, 2008

LaTeX resources

LaTeXing in Microsoft Windows

  • TeX system:
    • MikTeX, a free LaTeX system, recommended
    • The teTeX system contained in Cygwin, a Linux-like environment for Windows.
  • Editor:
    • WinEdt, pretty good but not free
    • Texmaker, similar to WinEdt and is free, recommended
    • Emacs for Windows
    • Lyx, TeXmacs, two free WYSIWYG-tyle editors. They are developed for Linux systems, but now also available for Windows through Cygwin. You can either install Cygwin or download separate packages including cygwin utilities.
  • Bib manager:
    • Endnote, commercial product, compatable with BibTeX using certain filters
    • Jabref, a Java bibtex manager, support pushing references to WinEdt, just as pushing references in Endnote to Microsoft Word, recommended
  • TeX for Powerpoint:
    • Tex4PPT, good for inserting equations
    • TeXPPT, good for inserting inline math

LaTeXing in Mac OS

There are already many helpful websites about installing TeX on Mac OS X, for example,

my preferences are

Friday, May 2, 2008

Linux Clustering softwares

The open sources version I would recommend:
which I have tested.

Of course, they are a lot of commercial versions, such as
Some useful links

Deals on Lenovo computers from Contractor Purchase Program

Note Added: the passcode is no longer valid! 

If you are interested in buying a lenovo computer ( I think the thinkpad notebooks are the best built notebooks available), you can try to order one from
http://www.lenovo.com/cpp with passcode 556655.


The R61 series start from $455.79.
The T61 series start from $631.74.
The X61 series start from $870.18,
as listed today. They are 10-40% cheaper than the regular lenovo website.

Thursday, May 1, 2008

Some useful sites for scientific computation

MacOS/WinXP dual system clock errors

When you have both Mac OSX and Windows XP/Vista on your computer, you will notice that the clock will change when you switch between two systems. This is due to that Mac treats the hardware clock(shown in BIOS) as GMT time while windows treats that as local time. The solution is then to make them agree with each other.

To make Windows take GMT time
Create a file, for instance, clockfix.reg, as

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation] "RealTimeIsUniversal"=dword:00000001

and run it (by double-clicking).

To make Mac OSX use local time
First you'll need to add a line to /etc/rc.local:

date `date -u +%m%d%H%M%Y`

And to /etc/rc.shutdown.local you'll need to add this:

date -u `date +%m%d%H%M%Y`

Update: for leopard (10.5.x), the above method doesn't work. Please follow the instruction in this link.