Tuesday, June 28, 2011

Mark your drawing using Mozilla Firefox markup



Go to:
https://markup.mozilla.org
You can draw your 'mark' on the screen. Mozilla Firefox Mark Up is, an interactive online project which allows visitors to sign their name in support of the open Web. Anyone can contribute a mark, which are connected and visualized in an interactive HTML 5 experience.
Video: Mark Up -- How to make your mark
The Web belongs to all of us. This video shows you how to make your mark in support for the world's largest public resource.

Sunday, June 26, 2011

Multi web server configuration in one computer


Below is an example to host an extra web server in port 8081 in localhost.
Add following lines in conf/httpd.conf in Apache:
---------------------------------------------------------------------------
# testserver website
<VirtualHost *:8081>
ServerName egps.localhost:8081
DocumentRoot C:/Users/jiansen/Desktop/testserver/htdocs
    <Directory />
Options FollowSymLinks
AllowOverride None
DirectoryIndex index.php
php_value include_path ".;C:/Users/jiansen/Desktop/testserver/etc/"
Order allow,deny
Allow from all
 
  <IfModule rewrite_module>
#RewriteEngine On
#RewriteRule !maintenance_msg\.php$ /maintenance_msg.php [R,L]

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://localhost/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://192.168.1.52/.*$ [NC]
RewriteRule .*\.(jpe?g|png|gif|bmp|swf|flv) - [NC,F,L]
       </IfModule>   
     </Directory>
</VirtualHost>
----------------------------------------------------------------------------------------------------------

Explanation:
The extra web server port is 8081 in localhost, the document root is
C:/Users/jiansen/Desktop/testserver/htdocs, load index.php by default,
php include path is: C:/Users/jiansen/Desktop/testserver/etc/

php include path can also set in php.ini, for example in my php.ini:
include_path = ".;c:\php\includes;c:\php\PEAR\pear;c:\php\PEAR\Mail-1.2.0\Mail"

Thursday, June 23, 2011

Several Interesting free PHP Books in freeopenbook.com


There are several  interesting  free PHP books (PHP HacksPHP 5 for Dummies) in
http://www.freeopenbook.com/

There are also some other useful books:

 

 

 


Wednesday, June 22, 2011

Select from multi tables in MySQL



I have two tables cesei_members and cesei_committee_status which both use member_id as
primary key. I want to select elements from cesei_members based on the condition on cesei_committee_status, below is MySQL command:
SELECT A.member_id, A.first_name, A.last_name, A.phone, A.email, A.city, A.country, A.prefix FROM cesei_members A, cesei_committee_status B where A.member_id=B.member_id AND B.$comm_status>4;

Below is the PHP function using this MySQL query:
function get_member_list1()
{
global $db;
$member_list = array();

$comm_status='c1_status';

$sql = "SELECT A.member_id, A.first_name, A.last_name, A.phone, A.email, A.city, A.country, A.prefix FROM cesei_members A, cesei_committee_status B where A.member_id=B.member_id AND B.$comm_status>4";

$result = mysql_query($sql, $db);
while ($row = mysql_fetch_assoc($result)){
$member_list[$row['member_id']] = $row;
}
return $member_list;
}

Monday, June 20, 2011

Display Chinese in Windows




One way is:
Control Panel->language, add east language. You may need Windows CD.

If you lose your Windows CD, you can download
Office XP tools simplified Chinese package from
http://www.microsoft.com/download/en/details.aspx?id=4194

Incorrect string value Error in MySQL


When I typed following SQL command for Chinese input:
use cesei_cn;
INSERT INTO cesei_committee VALUES (1,'¹ËÎÊ','Advisor_Board.php');
It is returned with an error message:
Error 1366 (HY000) at line 2: Incorrect string value '\xB9\xCB\xCE\xCA' for 'committee_name' at row 1
This is due to the limitation of utf8
To fix this program, go to
C:\Program File\MySQL\MySQL Server 5.0\my.ini
change
default-character-set=utf-8
to
default-character-set=latin1
Restart MySQL service

Monday, June 13, 2011

Free backup software - EASEUS Todo Backup


You can download EASEUS Todo free backup software from:
http://www.todo-backup.com/
EASEUS Todo Backup Free is the world's first all-in-one backup & system disaster recovery software special for business users. It enables users to perform complete backup & recovery with multi-ways, such as restoring system to dissimilar hardware without reinstallation, incremental disk and partition backup, network shared file backup, and automated schedule backup, etc.

Add a network location in Windows 7



1. Click Start ->Computer

2. Right click mouse, select add a network location

3. Welcome to add Network location Wizard popup, click next

4. click choose a custom network location
choose Internet or network address such as \\192.168.1.73\jiansen

5. click next and finish

6. Your new network location will be shown under Network Location in My Computer

Sunday, June 12, 2011

Map Network drive in Windows 7


1. Click Start ->Computer
2. Click Map Network Drive, you will see below popup:
3. Input your network drive location such as: \\192.168.1.73\
4. click finish

Tuesday, June 7, 2011

PHP, count the total number of files in all directories



<?php

function s_glob($dir){
$files = array();
if(is_dir($dir)){
    if($dh=opendir($dir)){
    while((($file = readdir($dh)) !== false)){
    if ($file == '.' || $file == '..') {
          continue; }
        $files[]=$dir.$file;
    }}
}
return $files;
}
?>



<?php
$my_dir='/LMS/file_repository/proposals/committee/';
  echo  count(s_glob($my_dir));
?>