Technology

Firefox Download Day: World Record

Tuesday, June 17th, 2008 -- By ET

Download Day 2008

2008-June 17 (Tuesday)

certificate

Some Interesting Trends

Saturday, May 31st, 2008 -- By ET

Which segment are you in?

Looks like we should go to the creative class that represent less than 1/3 work force, but gets 1/2 the total money.

screen-capture2.png

X-ray Photography

Wednesday, April 16th, 2008 -- By ET

I like photography, and I like photos that view this world from different angles.

Nothing compares to the following photograph which was taken with an X-ray enabled camera.

xray2pa1304_468x734.jpg

It shows an office building, you can even see someone kneeling there to fix a copier.

While I like this photo.  I think the photographer is crazy.  If I were in the building, I’d surely sue this redneck photographer.

HKUST Library at night

Thursday, March 20th, 2008 -- By ET

Our library is a very beautiful building. Here is a picture I took yesterday.

Click on the image to get a bigger version.

librarytower2.jpg

Worst Captcha

Monday, March 17th, 2008 -- By ET

Captcha has been around for a while.

 

It is used to make sure that the reader is indeed a human. Although there are some algorithms to crack captcha, none of them is working well.

 

Here are some examples:

 

ob-ab313_captch_20060524170113.gif

 

The worst one I saw (or should I say the “best one”?) is the following:

 

capcha.jpg

 

If you can get it right, you are not only human, but also a rare human. :-)

Add Ports to Windows Firewall

Friday, January 25th, 2008 -- By ET

To add a range of ports to Windows Firewall from the Command Line

  1. Start Command Line
  2. Type in the following where the range is specified in ( ) and the name of the firewall entry is in ” “.
    FOR /L %I IN (5001,1,5010) DO netsh firewall add portopening TCP %I “PassiveFTP”%I
  3. Each port in the range will be added with an “OK” confirmation.

[Mac Tip] Home/End Keys and “Recent Applications/Documents”

Tuesday, November 20th, 2007 -- By ET

The default key bindings for the home and end keys in Mac OS X are different to any other operating system I’ve ever used. By default, they seem to be bound to the viewport, rather than the line of text you are editing. In a multi-line document, the Home key scrolls up to the top of the document, and the End key scrolls down to the bottom. In each case the caret stays where it was.

As a programmer I find this behaviour to be just plain wrong— I want Home and End to move to the start and end of the current line.

I have found a way to “fix” this problem by editing the default keybindings file, ~/Library/KeyBindings/DefaultKeyBinding.dict. Create the directory and / or the file if they’re not already there, and make it look like this:

{

        /* Remap Home / End to be correct :-) */

        "\UF729"  = "moveToBeginningOfLine:";                   /* Home         */

        "\UF72B"  = "moveToEndOfLine:";                         /* End          */

        "$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */

        "$\UF72B" = "moveToEndOfLineAndModifySelection:";       /* Shift + End  */

}

If there are already entries in DefaultKeyBinding.dict, just add the 4 new mappings above to the main section of your file.

Add the following line to get a “recent applictions/documents folder” on the dock.

defaults write com.apple.dock persistent-others -array-add '{"tile-data" = {"list-type" = 1;}; "tile-type" = "recents-tile"; }'

Installing MATLAB in Mac OSX with CrossOver

Friday, November 9th, 2007 -- By ET

screen-capture-2.jpg

I have my MATLAB installed in Parallel Desktops for Mac. Since I do majority of my work in Mac now, I hate to open Parallel Desktops very often. So I’m thinking about porting some important packages to use in Mac OS natively.

CrossOver is a good package, I managed to port my BaKoMa TeX into Mac OS, it works fine. MATLAB turned out to be hard. When I install it within CrossOver, it gives an error:”Can not install OLE server”. It is related to Database, so I cleaned up all the extra toolboxes, and only install MATLAB itself. The error message still comes up.

Then I zipped the MATLAB from Parallel Desktop and unzipped the files to the “Drive_C” in CrossOver. Running MATLAB gives an error “License Manager Error -9.”. Checking MATLAB website, it seems that even if I have the serial number, I still need to reinstall, but in CrossOver, I simply can not install.

Here is the solution. Just open %CrossOver_Drive_C/MATLAB7/bin/win32/license.dat, and look for something like this: “HOSTID=DISK_SERIAL_NUM=d8682dc9 PLATFORMS=i86_n SN=0″.

Go to %CrossOver_Drive_C and create a file “.windows-serial” and “echo d8682dc9 > .windows-serial”.

Everything will be fine.

As soon as I can port SAS into CrossOver, I can delete Parallel Desktops and save me 30G hard drive space.

UPDATE: I forgot to mention that I installed the latest JRE in CrossOver before I copy MATLAB.

Full version of MATLAB 2006 for Windows. Java GUI included (_without_ -nojvm).

The new Java Runtime Environment Version 5.0 Update 6 for windows (jre-1_5_0_06-windows-i586-p.exe) must be downloaded from: http://www.java.com/en/download/windows_manual.jsp.

JRE must be installed either in windows or through wine.

Then the jre folder in matlab (../Program Files/MATLAB/R2006a/sys/java/jre/win32/jre) directory must replaced by the newly generated jre1.5.0_06 in ../Program Files/Java/.

After that the ../Program Files/MATLAB/R2006a/sys/java/jre/win32/jre.cfg file must be edited to contain a single line withe: 1.5.0_06

After that, MATLAB 2006a will be fully functional (as far as know). You can either use the windows installed version or copy the whole MATLAB folder to ~/.wine/drive_c/Program Files/ (that way you won’t need the windows partition anymore).

[Mac Tip] Quickly Copy Files from Local to Remote Machine through SSH

Monday, November 5th, 2007 -- By ET

Note the beautiful title bars you see in this blog.


They are on top of the blog, each time you reload the page, you get a different title bar.

I may write a post about these title bars and the stories behind them later, but today, I’d like to record how I can copy them quickly to the title bar directory from my Mac.

There are a few steps:

  1. Create publickey authentication on the remote server, in this case: mikezhang.com
    • Type “ssh-keygen -d” on the local server
    • Then, typ “ssh -l username mikezhang.com ‘test -d .ssh || mkdir -m 0700 .ssh ; cat >> .ssh/authorized_keys && chmod 0600 .ssh/*’ < ~/.ssh/id_dsa.pub”, this creates a new directory on the remote server called .ssh and paste the public key into the file “authorized_keys”
    • Make sure the .ssh created on the remote server is chmod to 0700
    • test if we can directly go there by “ssh -l username mikezhang.com” without typing the password
  2. Create a new directory on the local machine:
    • and a new file at ~/Library/Application Support/Quicksilver/Actions/Copy To Server.sh
    • the content of the file will be
      #!/bin/sh
      #
      infile=`echo $1|tr '"' '\"'`;
      filename=`basename "$infile"`;
      `/usr/bin/scp "$infile" username@mikezhang.com:/home/username/mikezhang.com/wp-content/themes/aura/headerimg/`;
      base="http://mikezhang.com/wp-content/themes/aura/headerimg/";
      echo "$base$filename" | perl -ne 's/ /%20/g; print';

  3. That’s all

To use the shortcut, select the newly created title bars, invoke QS, type “Current Selection..”, then “TAB”, then “Copy to”, the option called “Copy to Server” will show up, press Enter. It’s done.

Here is the newest addition:

Installing Ubuntu Beryl on Compaq EVO N600C with ATI Radeon Mobility M6 YL

Saturday, November 3rd, 2007 -- By ET

screenshot.png

It is very hard to install the nice visual effects in Ubuntu Gutsy 7.10/Compiz+Beryl on Compaq EVO N600C due to the driver issues related to ATI Radeon cards.

I tried a few times, all ended up getting x server dead. Now I’d like to record what I’ve done right along the way.

After successful installation, modify the original /etc/X11/xorg.conf file:

xorgoriginal.conf

To the following file:

xorg3dworking.conf

Press Ctrl-Alt-BackSpace to reload the xserver. (or give the command: # sudo /etc/init.d/gdm restart) Then glxinfo gives the right output for “direct rendering”. It seems that something called Envy can do the trick, I haven’t tried it yet. More information can be found here. Evy can be downloaded here.

If go to System->Preferences->Appearance-> Special Effects, and click the highest level, there is a box saying Desktop Effects can not be enabled.

When I tried to ” sudo apt-get install compizconfig-settings-manager”, it tells me that the file is not found. Go to System->Admin->Software Sources. On the first tab check universe is ticked. Then it installs fine.

To solve the “Desktop Effects” problem, one needs to solve the compiz driver problem.

compiz wouldn’t start untill /usr/bin/compiz modified and lines starting from 228 in function check_texture_size()
are commented out.

#if [ $VRES -gt $TEXTURE_LIMIT ] || [ $HRES -gt $TEXTURE_LIMIT ];

then
# verbose “Failed.\n”
# return 1;
#fi
#verbose “Passed.\n”

I then installed all related packages:

compiz
compizconfig-settings-manager
compiz-core
compiz-dev
compiz-fusion-plugins-extra
compiz-fusion-plugins-main
compiz-gnome
compiz-plugins
libcompizconfig0
libcompizconfig0-dev
libcompizconfig-backend-gconf
libdecoration0
python-compizconfig

This does not solve the problem though. The XGL service seems to be running now due to installing the missing packages. I tried to install it by “sudo apt-get install xserver-xgl”, it gave me a crash.

Finally, I found a note on the Beryl website, saying that we should add one line in the Device section of the xorg.conf file.

The final file is here:

xorgfinally.conf

It works not bad, but you can see artifacts on the screen. I’ll try to figure it out next time.

UPDATE:

It is completely working now. Having all the effects I wanted, and the system is quite stable. I even applied some Mac themes to it. Excellent system indeed. On this laptop, it would be extremely hard to install Vista as it is a Pentium III CPU with 512M memory. The video card is not very good, but Compiz-Beryl works amazingly well on it. If I hadn’t had my new real Mac, I’d be using this system on all my machines.

What about Windows-only programs I need to run? There are very good virtualization packages, such as “Virtualbox”, “CrossOver”. The first one is totally free. The second one is non-free, but you don’t have to install Windows, everything is integrated in the hosting system, very cool.

It took me two days (not full time, of course) to get everything up and running, compared to Mac, it is still a bit too much. For those who desperately look for hacked versions of Mac OS X Leopard, installing free Linux can be a good alternative.

Oh, this laptop is known for the clicking noise from the HDD. It is related to Head Parking of the HDD. It’s acpi power save which do this “clicks”. Did the following :

hdparm -S 4 /dev/sda
hdparm -B 255 /dev/sda

to stop it, you can do

/etc/init.d/laptop-mode stop
hdparm -S 0 /dev/sda
hdparm -B 255 /dev/sda

This command disable totally hard disk spin down.

To do this permanent, I did:

rm /etc/rc2.d/S99laptop-mode

and in /etc/hdparm.conf file add:

command_line {
hdparm -q -m16 -q -W0 -q -d1 -S 20 -B 255 /dev/sda
}


BlogTimer
You are visitor number several since September 1, 2001

Copyright Xiaoquan (Michael) Zhang, 2004-2007. All rights reserved.
All trademarks property of their owners.