Thursday, January 31, 2008

Learning Perl, 4th Edition Notes 0x1

Learning Perl, 4th Edition Notes 0x1 by DaNmarner * Perl computes with double-precision floating-point values. * Octal (base 8) is leaded by 0, while hexadecimal leaded by 0x and binary 0b. * For clarity, underscore within integer literals is available. So is for non-decimal literals. * Use perl string to create, scan, and manipulate raw binary data. * Unlike in double quote, any characters other than a single quote or a backslash between the single quote marks stands for itself inside a string. * Numeric Operater: +-*/% String Operater: .x * Using Build-In Warnings Turn on in command line:
$perl -w program
or, for more details:
$perl -Mdiagnostics ./program
Request on #! line:
#!/usr/bin/perl use progma
#!/usr/bin/perl use warnings;
or, for more details:
#!/usr/bin/perl use digonostics;
* Output with print
print list;
list is a series of scalars seperated by commas. * Double-quoted string literal is subject to variable interpolation. Curly braces can be used as the delimiter of variable names. For instance:
print "This is $whats"; #print the value of $whats print "This is ${what}s" #print the value of $what
* Perl has the same precedence and associativity as C. * Numeric and string comparison operators: == eq (equel) != ne (not equel) <> gt (greater than) <= le (less or equel) >= ge (greater or equel) * For boolean values, 0 or empty string means false, other number or string means true; * reads the next complete text line from standard input. New line included. * Use chomp to remove the newline character from a string, common used like this: chomp ($line=); * The value undef exists in those unassigned variables. returns undef is there's no more input is there(end-of-file or Ctrl+D).

Learning Perl, 4th Edition Notes 0x0

Learning Perl, 4th Edition Notes 0x0 by DaNmarner This series, hopefully will last for a while, is the notes that I take down from the book Learning Perl, 4th Edition, by Randal L. Schwartz, Tom Phoenix, and Brian D Foy. I've known C for several years and I'm starting learning perl, about which people say that it is a powerful and efficient tool for many uses. My study environment is Ubuntu Linux 7.10, bash, perl 5.8.8. The notes will follow the sequence of the chapters in the book. It will contain the main knowledge points in the book that is new to me. Thus, those stuff that is similar to C will probably be ignored. I hope these notes will benefit somebody besides me. Suggestions, criticisms, additions, corrections and discussions are welcomed anytime!

Monday, January 28, 2008

QQ 1.0 for Mac Preview 1 Released


Tencent released its first QQ Mac version -- QQ 1.0 Preview 1 (for Mac) today. And downloading link is provided on Tencent's official website.


This Preview version works on Tiger or higher Version of Mac.The installation process follows the typical routine for Mac application.


As a preview version, QQ 1.0 for Mac provides only some basic function, such as text chatting, facial expression, groups, etc. And it does NOT support some other basic functions such as changing user information, file transfer, etc.

It has English and Chinese interface at the same time.

Sunday, January 20, 2008

3D Ubuntu 7.10 with Compiz, AWN and Screenlets

1 Get Funky 3D Effect From Compiz Fusion 1.1 Install Compiz
sudo apt-get update & sudo apt-get dist-upgrade sudo apt-get install compiz compiz-gnome compiz-fusion-* compizconfig-settings-manager libcompizconfig-backend-gconf
1.2 Set Compiz Fusion Effects
System-Preference-Advanced Desktop Effects Settings
2 Install Avant Window Navigator - the Nice And Efficient Dock 2.1 Edit /etc/apt/sources.list Add following lines into /etc/apt/sources.list
deb http://download.tuxfamily.org/syzygy42 gutsy avant-window-navigator deb-src http://download.tuxfamily.org/syzygy42 gutsy avant-window-navigator
2.2 Install Avant Window Navigator (AWN) Use following command:
wget http://download.tuxfamily.org/syzygy42/reacocard.asc sudo apt-key add reacocard.asc rm reacocard.asc sudo apt-get update sudo apt-get install avant-window-navigator-bzr awn-core-applets-bzr
2.3 Make AWN Run When Login Go to
System-Preference-Sessions
Click
Add
Fill The Table as
Name: AWN Command: avant-window-navigator Comment: Run Avant Window Navigator (or anything)
2.4 Add launchers into the dock Go to
System-Preference-AWN Manager-Applets
Pick up the launchers you like,click the left arrow to add it into the list in the left.Drag them with mouse to whatever order you want.If you know python, you can write your own, with the help of the included example.
3 Install Screenlets - Cute Mini-desktop-apps. 3.1 Install screenlets via apt
sudo apt-get install screenlets
3.2 Add screenlets to your desktop Go to
System-Preference-Screenlets
Choose a Application and tick
Enable/Disable
to run it. Tick
Automatically start on login
if you like. Here's what you get:

Wednesday, January 16, 2008

Tencent QQ for Mac OS is about to release.

Recently, the information that Tencent, whose IM software QQ has over 200 million registered users in China, is hiring Mac OS software engineer appeared on the Internet. Hopefully, to those who has been expecting official access to QQ on other Operating System, this will definitely be a great news. According to a post on the Chinese Forum MacFans, whose author claimed himself to be a Tencent member who is familiar with the process of the development of QQ for mac, QQ for Mac Preview 1 will be released in two weeks. Tencent QQ, generally referred to as QQ, is the most popular free instant messaging computer program in China, and the world’s third most popular IM service . The program is maintained by Tencent Holdings Limited, owned in part by Naspers. Since its entrance into Chinese households QQ quickly emerged as a modern cultural phenomenon, now being portrayed in popular culture. Aside from the chat program, QQ has also developed many subfeatures including games, pets, ringtone downloads, etc.

Tuesday, January 8, 2008

rtl8187b linux native driver works on Ubuntu

Update: This essay is really sort of outdated. Nevertheless I has not been keeping track on this native driver. One good approach to get things work is to use a more "wrapped" distro, where ndiswrapper + windows driver works. And then "upgrade" it into the original distro you desired by changing the repository settings or whatever. For those who desire Ubuntu, I recommend Linux Mint. I used to try getting rtl8187b wireless card work on ubuntu by using ndiswrapper,everything seemed fine with this method except that it WASN't ACTURALLY WORKING. What happened was, iwconfig said that there's a wlan0,iwlist scan did find several signal around -- but they never change.It seems that the wireless card only worked when the machine started up, when it discovered something by then and kept returning it to me later. Things were the same when I use the graphic interface, of course. I turned to #ubuntu@irc.ubuntu.org for help and met Word1983. He gave me a page from google, from which I traced to this modified driver for rtl8187b. Here're several steps to drive rtl8187b up with this driver: 1 downland the driver. 2 extract it to a folder.Since we will keep this folder,you'd better choose a good place for it.
tar xzvf rtl8187b-modified-dist.tar.gz -C GoooPlace/ cd GoodPlace
3 run the script makedrv with sudo.Don't panic on those compiler warnings,as long as you don't see anything like "error", the driver might not have been nice coded, but it will work.
sudo ./makedrv
4 run the other script wlan0up with sudo
sudo ./wlan0up
If nothing went wrong, you should find a wlanX in the result of iwconfig,in case you may have tried to get the rtl8187b wireless card worked, X varies from 0 to ?.
iwconfig
Then you may go
iwlist scan
The card will detect signals surrounded then.Which means that it started working properly. PS:You need to run sudo wlan0up everytime you need wireless.You may want to make a shortcut for it on your desktop or home folder.

Sunday, January 6, 2008

Mandriva added to my hard drive.

With the chainloading system set up, adding Mandriva became a easy & happy job. I installed it on hda6.So,to chainlaod it ,I chose to boot on hda6 when asked by installation progress. Reboot.The the new system won't appear on the boot menu.Boot the previous system.Edit the menu.list of the master GRUB,which is independent from any OS.Add
title Mandriva Linux root (hd0,5) chainloader +1
Reboot again,Mandriva Linux appears on boot menu.Installation finished.

Mandriva ROCKS on Gateway T1616

Bill told me that Mandriva 2008 get everything worked out of the box on Gateway T1616, so I gave it a shot.It turned out every thing is fine.I really love the KDE+Compiz combination inspite of that it might be a little slow on this machine. The only problem is that there's a continuous noise going on with the system on.It is solved by mutting CAPTURE 1 in alsamixer Wireless is easy to gain. Simply goes to Menu-Tools-System Tools-Configure Your Computer , choose Network & Internet-Set up a new network interface-wireless-Use a Windows driver .Then choose the driver for rtl8187b. Then the wireless startes working! UPDATE: If you still prefer to use Ubuntu with Gateway T1616, please check out Linux Mint, which, with some simple steps done, works even better than Mandriva.

Thursday, January 3, 2008

Read CHM file with Firefox in Linux

With several steps done,I made myself able to read chm files with Firefox in Ubuntu.
  1. Add the extension CHM Reader
  2. Save the following shell script as readchm.sh (or any other name you like) to /usr/local/bin (or any place you like).

    #!/bin/sh

    firefox "chm:file:///$1"

    exit 0

  3. Change the script to excutable file:
    chmod 755 /usr/local/bin/readchm.sh
  4. Right click a chm file,choose "Open with another Appication",click "Usa a custom command",type in
    /usr/local/bin/readchm.sh
  5. Click "Open".
Note:By default,you will find that the table of content is missing in firefox,you can get it by clicking View-Sidebar-CHM Reader.