Note of baking calculator project – number 4
Today, learnt more of Perl/Tk and worte a small tool for the project.
Note of baking calculator project – number 3
I'm continuously learning Perl/Tk by reading the book O'Reilly Mastering Perl/Tk, I finished the second chapter today which talks about the Geometry Management and 'pack' method. The key notes are as follow:
Perl and Unicode
I continued reviewing Perl this morning; more and more things came back. I read the Chapter 15 Unicode of O'Reeilly Programming Perl and found some useful links. The main concept of Perl Unicode is that from version 5.6, Perl thinks in character instead of byte. The biggest effected function is regular expression, the most powerful tool of Perl. Also, I read articles from ISO 10646, which is a big5+Hongkong charset. I tried a software convert between different charset, the software called ConvFairy (difficult to find it, you'd better try search by yourself since the links are always broken). The articles from Unicode Consortium are also very good and recommended to have a look.
白米蝦 燕皮餛飩 朝鮮冷麵 白煮小豌豆 菠菜燕皮餛飩湯
It is really cold today, the horrible weather in shanghai. Lara and I went to the food market almost 11:30 am, I did cooking again.
清蒸仔魚 油燜筍 蘇式爆鱔 面拖蟹 糯米塞藕 蟬翼黃瓜
Today, Lara and I went to the food market. Later on, I did cooking.
Note of baking calculator project – number 2
This morning, I did a quick and dirty review of the Perl by reading the famous Johan Vromans' Perl Quick Reference Guide. Perl is great for me; I felt that after read the 31 pages reference. Afternoon, I firstly read Steve Lidie's Getting Started With Perl/Tk and the book of O'Reilly Master Perl/Tk, designed the version and about windows for the application.
Apache httpd upgraded and re-configured
The website is running under httpd 1.3.29 for a long time, and these days it became slower and slower, I decided to upgrade it to httpd 2.0.48.
I downloaded it, configured it and did make, make install. Everything looked ok but I can't find any information in the PID. Actually it automatically quit the process immediately.
I checked the error log, it said as follow:
[Fri Feb 20 20:41:17 2004] [alert] (22)Invalid argument: setgid: unable to set
group id to Group 4294967295
[Fri Feb 20 20:41:18 2004] [alert] Child 15144 returned a Fatal error...
Apache is exiting!
Fatal error, the biggest problem under linux is always the most difficult problem. I read manual and found that "Group #-1" wasn't accepted by the server, I changed it into "Group root", done.
Another problem I got was that the IE browser can't automatically arecognize the charset of the pages. I changed all my Chinese pages information from tp . The only difference is that the letter case. Even THML document is case insensitive, but I read some articles say that has to be upper case.
One more step, I added following lines into httpd.conf:
AddDefaultCharset off
AddCharset GB2312 .GB2312 .GB2312
Wow, the problem solved.
Note of baking calculator project – number 1
The concept and brief idea of the Baking Calculator
Basically, the programming will use Windows 2000 environment to implement and since the tools I use are all Linux/Unix tools Win32 ports. So, ideally, the project can be easily moved to Linux/Unix system.
Tools:
1. Perl, main coding language for this project
2. mySQL, the database server for store data, use DBI:mysql to perform with perl
3. Apache, the httpd server for web
4. Tk, the GUI implementation, use Perl:Tk module to perform with perl
Ideal functionality:
1. Store recipes
2. Calculate depend on serves
3. Weight/temperature convert
4. New recipes
5. Search by materials/categories
6. Cross category function
7. Cookbook generate
I decided to stop learning Tcl
I decided to stop learning the Tcl coding language because I found it is too simple. Originally, the reason why I picked Tcl is that I want to use Tk and eventually I found there is a good module Perl:Tk under perl. I played perl very well, and then why not use perl to do the visual Tk part? I will keep learning Tk and wrote note for how to design a cooking calculator, and share my experience with my friends.
I started learning Tcl/Tk for a cooking calculator
Last night, almost in the dream, I decided to learn Tcl/Tk. I bought a set of training course two years, or three years, before from amazon.com. The training course called The Complete Tcl/Tk Training Course (2nd edtion).
Now it is already the forth edition. The set had already been translated into Chinese version, you can find it here.
Today, I finished first half part of the Tcl, including the code grouping, substitution, math expression and other key terms.
This time, I learn it under Windows environment. The version I selected is ActiveState Tcl from http://www.activestate.com, I used their Perl from the first version.
The biggest reason why I did decide to learn it is that I want to design a cooking calculator for Sam, let's wait and see how do I create it step by step.
Site statistic added
I added statistic to both main website and weblog. The backend system which I selected is AWStats.
牛肉拉條子 酸辣羊肚 酸甜黃瓜
It was the dinner engaged half month before when we was still in Gansu province. I promised Geneva, Robin and his wife that I will cook a western Chinese dinner fro them. I found a Muslim food court at the food market which only sells beef and goat. The pitchman gave me his home phone and cell phone number; let me inform him in advance for special order – like lamb. In Shanghai, people only eat goat instead of lamb in western China.
I called the pitchman at Feb. 13, Friday and asked him to prepare 3 kg beef, 2.5 kg lamb and one set of lamb tripe. Saturday morning at 10:30, Lara and I went to the food market and got the meat by 103 RMB ($12.5).
Later on, our maid clean the meat and we went out. Lara followed Xiao Xiao back so we got the chance to buy two big boilers at IKEA by 300 RMB ($37.5). We went home around 6:00 pm and started cooking quickly. I boiled both beef and lamb for five hours until 11:30 pm.
Saturday, I got up around 9:00 am and cut four small pieces of lamb stripe for testing cook. I found the stripe was too hard to be cooked well, so I also boiled it more almost three hours.
Geneva, Robin and his wife came to my home around 11:00 am. I let the maid go out to buy some pre-maid Lan Zhou elongated noodle (Lan Zhou La Mian) from a restaurant crosses the road. The restaurant asked for 25 RMB ($3) which is pretty expensive price, so Robin decided to make the noodle from flour at home. He did the job really good.
Zhu Qi came around 12:30 pm with Xiao Xiao and Lara, the dinner started. We had lamb, beef soup noodles, lamb soup, sour-and-spicy lamb stripe and sweet-and-sour cucumber. Of course, Chinese alcohol (Bai Jiu) was the must-have.
Let MT weblog accept and display Chinese
The easiest way to do it is that modify the mt.cfg file under cgi-bin folder. There are two things need to be set up:
1. set NoHTMLEntities to 1
2. set PublishCharset to UTF-8
The reason set the publish character set to UTF-8 instead of GB2312 is that you can enable both Simplify Chinese and Traditional Chinese. Also, even Japanese and Korean can be accepted by the system.
weblog rebuilt
After almost 3 months suck of lacking the functionalities of the weblog, I successfully rebuilt it this morning. I had to move my website from Shanghai Linux association server to the current server at last early December, the weblog stopped for a while since the new server doesn't support Berkeley DB, mySQL and other database. Later on, I created a simulation server at home runs Berkerley DB and modified the weblog at home and uploaded to the server. The problem there was that the weblog can't have the comment function.
This morning, I successfully installed DBD:SQLite and DBI on the server, which is also the last possibility to run weblog on that server. Fortunately, it works very well. So, now the weblog is back and welcome my friends.
Website connetion speed problem solved
Today, I successfully solved the problem of my own personal website connection speed problem. I had moved my website www.yuleshow.com from Linux Association server to my friend Worm Wang's server. After that, I found that the server was really slow, it always took 5 to 20 seconds to load the homepage. I checked the server today and found that the first line of virtual server was set as asterisk instead of real IP address. I changed it and the server works well.
Movable Type blog research and study – set the test server
Environment: newly installed Windows 2000 with Service Pack 4. The computer is Dell OptiPlex G1 with 7.9 G harddisk, 392 Mb RAM and running under Pentium II 500. The first partition is 4G for the Windows 2000 system and the rest is set as drive I: for this test project. Two folders are created for the purpose, i:blogblogtest.yuleshow.com and i:bloglogs.
1. httpd for Win32
The web server which I select is Apache httpd server from its official website. The version is 2.0.48 (February 6, 2004). httpd has been installed into i:bloghttpd with default function, the following lines has been added to httpd.conf which create a VirtualHost.
<VirtualHost 192.168.19.33>
ServerAdmin yuleshow@yahoo.com
ServerName blogtest.yuleshow.com
DocumentRoot i:/blog/blogtest.yuleshow.com
ErrorLog i:/blog/logs/blogtest.yuleshow.com-error_log
TransferLog i:/blog/logs/blogtest.yuleshow.com-access_log
ScriptAlias /cgi-bin/ i:/blog/blogtest.yuleshow.com/cgi-bin/
<Directory i:/blog/blogtest.yuleshow.com/cgi-bin>
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
2. Perl for Win32
The Perl which I select for this project is ActiveState Perl. I use this Perl parser from 1998 to 2002, and really think it is the best Perl parser under Windows environment. By the date February 6, the version I got from http://www.activestate.com is 5.8.2 build 808. Perl has been installed into i:blogperl with default function.
Defaultly without DB_File module or DBD::mysql, use PPM to install it, commands as follow:
install DB_File
install DBD-mysql
3. ftpd for Win32
I select RaidenFTPD as the ftpd server. The version is 2.4 build 1159 (February 9, 2004) from http://www.raidenftpd.com. ftpd had been installed into i:blogftpd.
1. extract MT-2.661-full-lib.tar.gz.
2. create a folder called mt-static under web root as well as cgi-bin, same leavl.
3. create a folder called db under cgi-bin
4. copy the folders docs, images and file styles.css into mt-static.
5. copy the folders extlib, lib, schemas, search_templates, tmpl and files *.cgi, mt.cfg into cgi-bin.
6. open i:blogblogtest.yuleshow.comcgi-binmt.cgi, change the first line to
#!i:/blog/perl/bin/perl.exe -w
so for the other cgi files except mt-db-pass.cgi.
7. modify the mt.cfg file, set
CGIPath http://blogtest.yuleshow.com/cgi-bin/
StaticWebPath /mt-static/
8. check http://blogtest.yuleshow.com/cgi-bin/mt-check.cgi from client to see if the system reach the requirement of MT.
9. load http://blogtest.yuleshow.com/cgi-bin/mt-load.cgi, then delete i:blogblogtest.yuleshow.comcgi-binmt-load.cgi.
10. use http://blogtest.yuleshow.com/cgi-bin/mt.cgi with the user name Melody and password Nelson to config the MT.
11. Click the name Melody at the top right corner, change to Yule Show and set the other information.
12. Go to weblog config to set the corresponding information.
Some good MT resources
Wiki and oddmuse.
Chieftain's BLOG (triditional Chinese).
Anders Jackbsen's blog - very good for new users.
QinYu's Weblog - a very good Chinese blog in grey style.