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 [...]
16
2010
Fix PHP unknown Error 324
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 [...]
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 [...]
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 [...]
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 [...]
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 [...]
26
2009
Display stock charts on your own website
Plain stock chart
In searching an easy way to display stock charts on a web page hosted in a web server, two useful scripts were found on the internet:
1. Easy Yahoo stock chart ASP.NET Page
2. Displaying a daily chart for a ticker symbol
Even the scripts were written in different languages, they use a common idea that [...]
8
2009
Matlab Toolbox: Fuzzy Clustering and Data Analysis Toolbox
I googled “fuzzy clustering and matlab” and wanted to find some tools for data clustering today. I came across a very good MATLAB toolbox at http://www.fmt.vein.hu/softcomp/fclusttoolbox/. In the web page, you can find source code and a detailed documentation that describes several popular clustering methods and validation methods, too. The Toolbox is a collection of [...]
26
2009
Online Notetaker – an ASP web application
I use internet a lot. You might be, too. Do you have a need to write something down when you are online and want to access it later on? I do. That is why that I wrote this web application. I call it Online NoteTaker because it is running under Web server IIS 4.0/5.0. Although [...]
26
2009
A PERL script to get Twitter user information
If you are a Twitter user and do business on Twitter, you probably think about how I can target to a group of Twitter users, such as living in certain region or having similar interests. Can we screen Twitter users and target to a given population of Twitter users? Answer is absolutely positive: yes, we [...]