Archive for the 'Programming' Category


PHP - Top Ten Security Vulnerabilities

These vulnerabilities can, of course, exist in PHP applications. Here are some tips on how to avoid them. I’ve included related links and references where relevant.

read more | digg story

October 12th, 2006 in Programming | 5 comments


A Programmer’s Reference for Excuses

Private Function getProgrammerExcuse() As String

Dim myExcuses(1 to 21) As String

October 11th, 2006 in Programming | 5 comments


TIOBE Programming Community Index

October,2006,程序员所使用的编程语言的排名统计(数据来自TIOBE),比较有意思的是PHP排名第四的位置没有改变,而C#比去年同期跌了一位。

October 6th, 2006 in Programming | No comments yet


Sorting Algorithms Source Code and Performance

This is a great resource for source code for different sorting algorithms. It also graphs performance of each algorithm to help you choose the best one to use. The code is all in C.

read more | digg story

October 6th, 2006 in Programming | No comments yet


Five common PHP design patterns

This article explains five widely used design patterns in PHP with sample code to demonstrate each pattern. Intermediate level.

read more

October 6th, 2006 in Programming | 3 comments


Download OpenSSL for windows

openssl-for-windows,host on google code,is an clean and lightweight OpenSSL library for windows(both 32bit and x64 version).

all versions are compiled in the assembly language routines with Microsoft Visual Studio 2005 and Microsoft MASM as “Multithreaded(/MT)”,you can using it with any version of MSVC.

October 3rd, 2006 in Programming | 75 comments


Convert Unicode To UTF8

char* __stdcall UnicodeToUtf8( const WCHAR* wstr )
{
    const WCHAR* w;
    // Convert unicode to utf8
    int len = 0;
    for ( w = wstr; *w; w++ ) {

        if ( *w < 0×0080 ) len++;
        else if ( *w < 0×0800 ) len += 2;
        else len += 3;
    }

September 24th, 2006 in Programming | 24 comments


Jenkins hash算法。

Jenkins hash,可能是目前能看到的最好的hash算法之一,可以产生很好的分布,缺点是相比其他常见的hash算法更耗时。可以考虑用于hash表的open addressing实现上。如果想了解细节的话,可以去Bob Jenkins的站点看一看。

July 26th, 2006 in Programming | 2 comments


Hash table collision resolution

最近需要一个高性能的hash实现,对比了很多实现hash表的源代码,主要区别在于冲突检测的实现方式。

关于冲突检测的两种方式的对比(chaining and open addressing):

http://www.absoluteastronomy.com/enc1/hash_table

Google有一个高效的实现Open addressing hash 的开源项目

http://goog-sparsehash.sourceforge.net/

Open addressing的性能可能会更好些,但是前提是需要一个非常好的hash生成算法。如果使用Chaining方式,加上一个非常高效的memory pool管理,减少cache失效时间,平均性能应该和Open addressing差不多。

顺便了解下judy:
A Performance Comparison of Judy to Hash Tables

June 5th, 2006 in Programming | No comments yet


A fast memory Pool used by LogMicroscope@35

As you know, new/delete operations take a lot of CPU time. If you work with servers, CPU time is important. If additional memory is added to the server, then the servers’ available memory size will grow in a linear fashion.
So Log Microscope has it’s own efficient memory management system. CFastMemoryPool is the one of them for LogMicroscope@35. because I never need to delete the instance,so a single call to Shrink() will free all memory allocated.it’s extreme fast,enjoy it!

June 3rd, 2006 in Programming | 1 comment


谁制造了混乱

网上看到一篇笑话,描述软件开发过程的:

1. 程序员写出自认为没有Bug的代码。
2. 软件测试,发现了20个Bug。
3. 程序员修改了10个Bug,并告诉测试组另外10个不是Bug。
4. 测试组发现其中5个改动根本无法工作,同时又发现了15个新Bug。
5. 重复3次步骤3和步骤4。
6. 鉴于市场方面的压力,为了配合当初制定的过分乐观的发布时间表,产品终于上市了。
7. 用户发现了137个新Bug。
8. 已经领了项目奖金的程序员不知跑到哪里去了。
9. 新组建的项目组修正了差不多全部137个Bug,但又发现了456个新Bug。
10. 最初那个程序员从斐济给饱受拖欠工资之苦的测试组寄来了一张明信片。整个测试
组集体辞职。
11. 公司被竞争对手恶意收购。收购时,软件的最终版本包含783个Bug。
12. 新CEO走马上任。公司雇了一名新程序员重写该软件。
13. 程序员写出自认为没有Bug的代码。

March 16th, 2006 in Programming | 3 comments