Displaying posts written by

Zhanshan Dong

who has written 93 posts for 太阳帆数据 Sunfine Data.

Mar
3
2010
Feb
16
2010

Fix PHP unknown Error 324

When I debugged an PHP application, an mystery error message show up. Google Chrome shows the following message:
This webpage is not available.
The webpage at XXXXXX might be temporarily down or it may have moved permanently to a new web address.
More information on this error
After click the plus sign at the last sentence, I got the [...]

Jan
11
2010

Fetch files from remote server automatically in PHP

PHP provides multiple ways to download and upload files to remote servers, such as fopen, fsockopen, cURL library, and other methods. fopen is the simplest but not the best. A while ago I wrote a function to fetch remote file by using fsockopen. However, I found a lot of problems when I use it. Then [...]

Jan
3
2010

Tips for website development

I have encountered surprised issues when I developed Bookmark Manager 2.0. They were solved successfully after I spent a significant amount of time. To share my ideas and thought with friends, I summarized the processes and generated a list of a good practices as the following.
HTML/XHTML validation
It will always be a good practice to [...]

Jan
1
2010

A PHP class for manipulation of dates

The following PHP code includes a simple class that can manipulate dates, such as date subtraction, adding days and subtracting days to the current date. It is very useful because my PHP server does not support the latest DateTime function yet.

<?php

class Dt
{
private $day;
private $month;
private $year;
private $seconds=86400;

function __construct()
{
$this->day=date(“j”);
$this->month=date(“n”);
$this->year=date(“Y”);
}

function now_diff($by,$bm,$bd)
{
$bm=preg_replace(“/[0](.+)/is”,”\\1″,$bm);
$bd=preg_replace(“/[0](.+)/is”,”\\1″,$bd);
$bt=mktime(0,0,0,$bm,$bd,$by);
$nt=mktime(0,0,0,$this->month,$this->day,$this->year);
$df=$nt-$bt;
$dn=$df/$this->seconds;
return [...]

Jan
1
2010

A PHP class for generating tag clouds

The following PHP code is a simple class that can generate tag cloud in any web pages.

<?php

class TagCloud
{
private $_counts = array();
private $_tags = array();
private $_urls = array();
private $_levels = array();
private $__level = 10;

function __construct()
{
}

function add($tag,$count,$url)
{
$this->_counts[$tag] = “$count”;
$this->_tags[$tag] = “$tag”;
$this->_urls[$tag] = “$url”;
}

function css()
{
$css = “#htmltagcloud { text-align: center; line-height: 1; }\n”;
for ($l=0; $l<$this->__level; $l++)
{
$font [...]

Dec
30
2009

Database migration: MS Access to MySQL server

The Problem
Recently I solved a database migration problem: migrate MS Access database encoded in GB2312 to MySQL server encoded in UTF-8. I’d like to share what I did and hope it is useful to help you solve your problem.
I had a lot of useful data in an MS Access database. They were collected through [...]

Dec
23
2009

Fix network configuration problem

The problem
I have a couple of computers with identical hardware configuration. I used one of them to install Ubuntu server to new hard drives. After I completed the preparation of all hard drives and installed the m to other machines. The problem came. Everything works fine except the network. eth0 has problem.
The solution
This solution [...]

Dec
23
2009

VBA function for multiple comparison

In SAS, lsmeans treatment /pdiff of PROC mixed or GLM output mean values and a matrix of probability values of all pair wise comparison. However, we have to create the traditional comparison table by ourselves. In order to automate the process, I developed a VBA function to do the job. The source code is the [...]

Dec
5
2009

Useful applications for Windows Mobile 6.1

Recently I upgraded my Verizon Wireless mobile phone to Windows Mobile Smartphone XV6800. I like it very much because I can do a lot of things on it. The most useful function of this phone is accessing WiFi hotspot. Here I’d like to summarize how I configure it to connect to my home WLAN, access [...]