There is very little future in being right when your boss is wrong.

2008-08-25

Symfony 1.1 framework — Control flow

Filed under: framework, php — LiQiang @ 21:46:45

Symfony is a php web framework following MVC pattern.

Follow image is a general analysis how symfony process  url request .  If you directly following code to analysis how it process a request , it will be very difficult , because symfony using many config generated code ,and it use many specific feature/mechanism : event dispatch , class mixin ,autoload .  These features and mechanisms make the framework very powerful ,and by the while makes itself difficult to catch up.

symfony 1.1 architecture- control flow

2008-07-20

*nix distribution on Ibook

Filed under: mac — LiQiang @ 23:08:43

Netbsd:

  1. booting
    using open firmware boot : hd:4,\ofwboot.xcf  hd:10,/netbsd
    hd:4 is a Mac partition ,  ofwboot.xcf is a netbsd provide file ,need copy to the mac partition.
    hd:10 is the netbsd installed patition .
  2. feature
    The default terminal is not acceptable , the default font is big , and the whole screen background color is gray. X11 is not installed by default , and pkg_src not installed by default.

Freebsd:
0.install
Need partition before installtion (use ubuntu mac-fdik) ,the installer can’t create new partition.
1.booting
Using Open Firmware boot : hd:4,\loader hd:10,/boot/kernel
2.feature
The default terminal compared to netbsd is really good . Ports can be installed manually.X11 I had’t try yet.
My Iboot cpu is 1.3G , but install ports is really slow (port package configure and compile) , it’s just like a 300MHz cpu machine.
The inner keyboard can’t be recogonized , can only be used with a external keyboard. Wireless network card can’t be recogonized by default.

Ubuntu:
1.booting
Using yaboot , the utility is really good , similar to lilo or grub . If you already installed ubuntu 6 on ibook ,then you can config yaboot to boot from hard disk ubuntu 8 installation.
2.feature
Hardware support is very well, wireless network and screen brightness and volume control is all function well .Gnome is default installed , KDE and xfce4 I have tryed no problem.

Fedore Core 7:
Read my previous article :
wireless Fedora core linux 7 on ibook

2008-07-12

IPod touch firmware 2.0 update

Filed under: iphone — LiQiang @ 21:33:02

Today Apple released firmware 2.0 for ipod touch , the update needs $9.95 to download the firmware via itunes. To take advantage of firmware 2.0 , it needs itunes to update to version 7.7 . Then just plug in ipod touch usb table, and itunes shows the firmware update avaiable (after purchase).

It takes about an hour(ADSL 150Kbps) to download  the firmware , the version number is 5A347.And file size is 222.6MB , much bigger than 5A225C version. After finish download firmware then press upgrade ipod touch button in itunes ,  the update process is straightforward, just wait ipod touch update finish ,and reboot ,it takes about 10 minutes.

First impressions:

AppStore rocks : Both ITunes and Ipod touch can download application from AppStore. And there’s many free application avaiable. The AppStore is much better then Installer.app , every application has it’s infomation,screenshot, web site . It’s full featured web shopping item.

Remote.app is awesome , just open Remote.app on ipod touch , add itunes library ,and put the 4-digit passcode on itunes ,  then ipod touch can fully control itunes on Mac/Windows. And the interface is the same as music control on ipod touch.

2008-06-22

using awk to process stock quote data

Filed under: linux — LiQiang @ 18:45:24

在论坛上看到一则awk的题目,有股票数据文件:
quote.dat:
20080525|0600|758836152.12
20080525|0602|609000.00
20080525|0603|2666746080.44
20080525|0604|1400500000.00
20080525|0605|380000000.00
20080525|0606|356894829.48
20080526|0603|2666746080.42
20080526|0602|609000.05
20080526|0604|1400500000.07
20080526|0605|380000000.09
20080526|0606|356894829.41
要求按照格式输出股票报价,使用awk实现。
输出格式:
quote 0600 0602 0603 0604 0605 0606
20080525 758836152.12 609000.00 2666746080.44 1400500000.00 380000000.00 356894829.48
20080526 NAN 609000.05 2666746080.42 1400500000.07 380000000.09 356894829.41

最近正好常用awk,自己实现了一下,代码如下:

function echo_result(date,NUM,QUOTE){
	printf "n%-15s",date;
	for(i=0 ; i<length(NUM) ;i+=1 ){
		qu=QUOTE[NUM[i]];
		if(qu>0)
			printf "%-15.2f ",qu;
		else
			printf "%-16s","NAN";
	}
}

begin{
	c=0;
}	

{
	if($1==date || NR==1)
	{
		if(c==0){
			NUM[NR-1]=$2;
		}
	}else{
		c++;
		if(c==1){
			printf "%-15s","quote";
			for(i=0 ; i<length(NUM) ;i+=1 ){
				printf "%-15s ",NUM[i];
			}
		}
		echo_result(date,NUM,QUOTE);
		delete QUOTE;

	}
	QUOTE[$2]=$3;
	date=$1;
}	

END{
		echo_result(date,NUM,QUOTE);
}

执行:
awk -F’\’ -f quote.awk quote.dat

2008-06-02

阿拉蕾回忆

Filed under: 生活 — LiQiang @ 13:18:38

2008-05-27

try solaris 10

Filed under: linux — LiQiang @ 22:39:29

Today I installed Solaris 10 on Mac Parallels. The version is solaris 10 express developer editon , the install screen is much beter then Freebsd ,it takes 8G hard disk space,and the install process is very slow.
After install the network card is not installed automatically. I google it , and found two answer:
1. In Parallels installation disk it contains a little tools to setup the network .
2 .Install realtek 8029 manually at page http://homepage2.nifty.com/mrym3/taiyodo/eng/ .
I used method 2 setup the network properly.  Just first trying.

2008-05-10

Beginning freebsd-1

Filed under: linux — LiQiang @ 19:46:21

freebsdToday I installed freebsd 6.2.It’s has 2 cd-rom disk and 1 document disk. The install process is very straitforward , there’s no fantasic GUI like FedoraCore installation , only simple text and ncurses simple ui controls . First it will format disk , and install the kernel system .Then the many option softwares and configuration is opened automaticly , and these can be reopened at any time by command sysinstall.

I first install a version in Parallels on leopard , then another version in VMware on windows xp . It’s all installed ok and network is configed automaticly. The vmware version I forget to install port collection, and absense the source code , so there’s a chance to run sysinstall and install port in the running os . The sysinstall process is simple ,but it erase some my config ,include my network config ,inet service config and /usr/bin/vi symbol link. This maybe because when installing port software collection, it made a ‘make install clean’ and clear my previous config.

Freebsd has the proc filesystem ,and /proc directory is the mount point , but it’s not mount automaticly , need to run ‘ mount_procfs procfs /proc’ as root.

A running freebsd system for a programer need setup a programming enviroment. First the shell , the default shell is /bin/sh , we need change to bash , use the command chsh to change current user shell config , or just type bash to enter bash. Then setup bash config file: .bashrc and .bash_profile , a demo config as follow:
export CLICOLOR=xterm
export ll=’ls -l’
export SVN_EDITOR=vim

Then setup vi editor , a demo config file .vimrc as follow:freebsd logo
syntax on
filetype on
set fdm=syntax
set sw=4
set tabstop=4
set autoindent
set laststatus=2
set stl=%F\ %l,%v
set numer

That’s it , then we can beginning programming on the little Freebsd daemon.

2008-04-27

Movie

Filed under: 图片 picture — LiQiang @ 20:58:35

   

2008-04-22

try google app engine

Filed under: python — LiQiang @ 13:33:09

google 的app engine上周开放了,现在似乎在逐步增加用户,我的上周六申请通过,简单试用了一下,主要有下面这些功能:

可以建立3个app应用程序:

应用程序监控:

google的数据库支持:

共享开发:

2008-03-11

Enchanted - a lovely story

Filed under: movie — LiQiang @ 23:35:39

 enchanted  enchanted

Next Page »

EMail:liqiang@xuecs.com