Warning: include_once(/home/nullvoid/blog.mikezhang.com/wp-content/plugins/wordpress-support/wordpress-support.php): failed to open stream: Permission denied in /home/nullvoid/blog.mikezhang.com/wp-settings.php on line 217

Warning: include_once(): Failed opening '/home/nullvoid/blog.mikezhang.com/wp-content/plugins/wordpress-support/wordpress-support.php' for inclusion (include_path='.:/usr/local/lib/php:/usr/local/php5/lib/pear') in /home/nullvoid/blog.mikezhang.com/wp-settings.php on line 217
NullVoid » 2007 » November NullVoid » 2007 » November

Archive for November, 2007

Why My Daughters’ Names Start with A

Wednesday, November 28th, 2007 -- By ET

From this paper by Nelson and Simmons.

In five studies, we [Nelson and Simmons] found that people like their names enough to unconsciously pursue consciously avoided outcomes that resemble their names. Baseball players avoid strikeouts, but players whose names begin with the strikeout-signifying letter K strike out more than others (Study 1). All students want As, but students whose names begin with letters associated with poorer performance (C and D) achieve lower grade point averages (GPAs) than do students whose names begin with A and B (Study 2), especially if they like their initials (Study 3). Because lower GPAs lead to lesser graduate schools, students whose names begin with the letters C and D attend lower-ranked law schools than students whose names begin with A and B (Study 4). Finally, in an experimental study, we manipulated congruence between participants’ initials and the labels of prizes and found that participants solve fewer anagrams when a consolation prize shares their first initial than when it does not (Study 5). These findings provide striking evidence that unconsciously desiring negative name-resembling performance outcomes can insidiously undermine the more conscious pursuit of positive outcomes.

This figure on GPA says it all.

initials.png

Read Your Mind

Tuesday, November 20th, 2007 -- By ET

CrystalballThis is interesting. The old man can read your mind. Just click on the picture and follow the instructions.

Basically, it will ask you to look at one number and sum up the two digits, and subtract the sum from the number. If you have 31 in mind, the sum is 4, so the final number is 27. Now just click on the ball, it will show the symbol represented by number 27.

This only works when you really think hard, the man can either capture your brainwave or track the direction of your eye sight to figure out the number in your mind.

If you can figure out what is happening, leave a comment. :-)

[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"; }'

Missuse of Statistics

Monday, November 12th, 2007 -- By ET

200604191943-pix1.gif

In Discovery Travel channel, there is a program called “Miami Ink”, it tells many stories about people getting tattoos.    Despite the way they tried to make it sound like fun and cool, I still don’t see any meaning of getting a tattoo.  I don’t think anyone I know has a tattoo, too.

 

The figure above is an ad for body piercing.  It shows that the risk of body piercing is very very low, compared to many other risks we face everyday.   That small number really is insignificant.  However, there is a fatal logical flaw in it. If you put the death as a result of body piercing on top of the human population as the denominator, you get such results.

 

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:

Yak Shaving

Sunday, November 4th, 2007 -- By ET

A lot of work we do everyday are “Yak Shaving” jobs.

yak.jpg

yak shaving [MIT AI Lab, after 2000: orig. probably from a Ren & Stimpy episode.] Any seemingly pointless activity which is actually necessary to solve a problem which solves a problem which, several levels of recursion later, solves the real problem you’re working on.

In programming, some subroutines can be seen as yak shaving. Looking at my time in the office, a lot of time got spent on yak shaving. Some of them necessary, and many of them unnecessary. Unfortunately, before you do it, you don’t know whether a particular job is necessary or not necessary.

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-2020. All rights reserved.
All trademarks property of their owners.