Wednesday, April 30, 2008

Working as A Webmaster

My database teacher bought web hosting today. I have uploaded all the files and set the database so that it has started to work. The site consists of a main body and a forum. I found there are lots of things to do, much are dirty work. So I'm considering about how to reduce my tiredness...

I'm the webmaster. My work is to maintain the website and the forum. Maybe sometimes I have to modify the program of the website. Luckily it is written in PHP. Last night he asked me how much do you want, I answerd: 2^8. Surprisedly he opened his mouth. Then quickly laughed. 256 yuan (RMB) per month is acceptable. I think it is the value of my work, also.

I plan to use the money which I'll earn to build my real website. I hope that my dream will come true. I need a web space.

Monday, April 28, 2008

Windows Live Mail is Good

This morning I downloaded Windows Live Mail, an Email client software. Since I received an Email from Microsoft that told me Outlook Express wouldn't support Hotmail in June a few days ago, I decided to try Windows Live Mail. Here is the interface, very beautiful:
Windows_Live_Mail

Beyond my expectations, I feel this software is very good. When I added a 163.com Email accounts, I needn't to set the POP and SMTP server even! The design of the interface is also very friendly to users, at least much better than Outlook Express.

Do you want to try it? Click here to learn more.

PS: It is my 20th birthday today. Happy Birthday to me!

Sunday, April 27, 2008

Using PHPMailer of WordPress to Send Email

In PHP langauge, the usage of the mail() function is too complex. Besides, when you are working on Windows operating system, it is diffcult to find an appropriate "sendmail" program. But if you work on Linux or Unix, mail() function may work better, althought its arguments are too complex.

I read the source code of WordPress this afternoon and found two classes for sending mail -- PHPMailer and SMTP. WordPress uses PHPMailer to send new password when you lost your password. Moreover, PHPMailer supports multiple sending method, such as PHP function main(), Qmail, remote SMTP server or other "sendmail" programs. Especially SMTP server. So far, there are fewer and fewer anonymous SMTP servers on the Internet, most of them need authentication. SMTP class make these things simple and easy. When you let PHPMailer use remote SMTP server to send Email, PHPMailer will use SMTP to connect to the remote server to accomplish the task.

Now let's see how to use PHPMailer to send your Email.

Firstly, you need to copy class-phpmailer.php and class-smtp.php from wp-includes directory of WordPress to your working directory. Then make a new PHP file in your working directory to enter codes. See below:

<?php
include ('class-phpmailer.php');
include ('class-smtp.php');

$mail=new PHPMailer();

// Let PHPMailer use remote SMTP Server to send Email
$mail->IsSMTP();

// Set the charactor set. The default is 'UTF-8'
$mail->CharSet='UTF-8';

// Add an recipients. You can add more recipients
// by using this method repeatedly.
$mail->AddAddress('xxxxxxx@gmail.com');

// Set the body of the Email.
$message='This Email is sent by PHPMailer of WordPress';
$mail->Body=$message;

// Set "From" segment of header.
// For 163.com Email service, it must be the same
// with your account.
$mail->From='xxxxxxx@163.com';

// Set addresser's name
$mail->FromName='Wang Jinbo';

// Set the title
$mail->Subject='Test Mail';

// Set the SMTP server.
$mail->Host='smtp.163.com';

// Set "need authentication".
$mail->SMTPAuth=true;

// Set your username and password.
$mail->Username='xxxxxx';
$mail->Password='xxxxxx';

// Send Email.
$mail->Send();
?>


Here I described how to use PHPMailer to send Email. Of course, there are other options in PHPMailer class. You can understand the usage of it by reading the source code and trying it in person.

A Good Programming Forum

Last night I found a good programming forum, CodeCall Programming Forum. I feel all the people there are friendly and enthusiastic. There are many topics on all programming languages almost, from C++ to web development. I think I can learn more on that forum and help more people. I like the atmosphere of the forum. So I have introduced it to my friends, I hope she will enjoy the atmosphere.

By the way, introduce myself. I'm a college student learning software technology. I took part in some algorithm contest in high school. So far, I have learned some programming languages such as Pascal, C, C++, Java and PHP. I think C is simple but C++ is too complex. Now I'm interested in web development. So I'm learing PHP and Jave EE. Maybe PHP is my favorite. I had developed a software using PHP -- an online judge, which can be used for programming contest. I think I can provide some help to those who is learning PHP.

Postscript: I like the avatar of Jordan, the administrator. It's really lovely.

Saturday, April 26, 2008

Blogger.com or WordPress?

I am considering that which is better, Blogger.com or WordPress? Here, "WordPress" doesn't mean wordpress.com, it is the program. In fact, I think that WordPress is the best program for blogging. Besides, Blogger.com is the best BSP. There are lots of plugins for WordPress, so I can extend functions of WordPress easily. Also, maybe I can write some plugin for WordPress to accomplish my goal.

The only bad thing about WordPress is that there are few good free WordPress hosting websites. Almost all WordPress BSPs doesn't support uploading your own plugins. I like WordPress just because of lots of plugins. Otherwise, wordpress.com doesn't put your advertisements such as Google Adsense. But Blogger.com even encourages to use Google Adsense.

Does Google like Blogger.com? I found Google robot visits this blog after a few hours when I publish the first post. That's very soon. Probably, articles on Blogger.com are found more easily than those on other BSPs.

Using '<' Operator to Compare

In C++ Standard Template Library (STL), some algorithms such as sorting, need to compare two elements. STL uses less operator '<' to accomplish the purpose. When you need to apply those algorithms to your custom data structure, you must overload less operator '<'. But sometimes, you need '!=', '>', etc. How to use '<' to implement all the operators?

For example, if you have a<b, then:
  • if you need a>b, just write 'b<a';
  • if you need a!=b, use 'a<b||b<a';
  • if you need a==b, use '!(a<b||b<a)';
  • if you need a>=b, use '!(a<b)';
  • the last, if you need a<=b, use '!(b<a)'.
So, all comparison operators can be implemented by less operator '<'.

Friday, April 25, 2008

My English Blog

Hi, everyone! This is my first English blog. Some sentences may be laughable because English is not my native language. I'm from China. My hobby is computer programming and listening classical music. Sometimes I take photos also. I want to write some notes about learning. So I think the subject of this blog is software and programming, etc.

Another thought is: I want to make friends with people who have similar interests all over the world through this blog. Welcome!

Wikipedia for those with little English

Just now I found an interesting website -- Simple English Wikipedia. It is a special language edition of English Wikipedia for those with little English words. Now it is mucher smaller than English Wikipedia. There are only 27,816 articles right now. They claim that: "We only use very simple English words and simple ways of writing here".

I think it is very proper for many non-English people, like me. At least to me, it is more readable than many other English websites.