My WWDC app wall (2010 version)

In case anyone still want it.

Pre-compiled versions (Windows and OSX)

Source code

August 24, 2010 at 12:31 pm Leave a comment

A Search Engine for Python Source Code

Nullege.com finds python examples by name.

February 1, 2010 at 11:51 pm Leave a comment

python2.6, email and py2exe

To make email module work with py2exe:

1. Use new lower case module names, not old ones. For example, email.mime.image.MIMEImage, instead of email.MIMEImage.MIMEImage.

2. import email.iterators, email.generator, and other staff that your exe complained missing.

July 2, 2009 at 7:28 pm 1 comment

My own app wall

Download and run your own App Wall.

Continue Reading June 24, 2009 at 6:10 am 7 comments

Build Mame with Visual Studio

The official document is a little out-dated. I met several problems during build. Here is how I eventually got a debug build:

Install Mame build package & DirectX SDK
Open a Visual Studio Command Prompt (Start->All Programs->Microsoft Visual Studio 200x->Visual Studio Tools->Visual Studio 200x Command Prompt)
cd /mame_src/
set path=%PATH%;/path/to/mingw/bin
“c:\Program Files\Microsoft DirectX SDK (March 2009)\Utilities\bin\dx_setenv.cmd” x86
mingw32-make MSVC_BUILD=1 DEBUG=1 SYMBOLS=1 DIRECTINPUT=8 DIRECT3D=9
Open vmamed.exe for debug

June 8, 2009 at 11:35 pm Leave a comment

Notes on gzip and DEFLATE format

Explain gzip format with samples.

Continue Reading June 4, 2009 at 5:59 am 3 comments

Openfire and Jwchat on Ubuntu

I spent a whole afternoon to install onpenfire and jwchat. This post works for me. But to apply it on Ubuntu, you need to do a little bit more.

1) install apache2, jdk, etc.
2) install openfire. I didn’t use ubuntu package since I want to do some development later. Download it and extract to any folder would work.
3) sudo a2enmod proxy; sudo a2enmod proxy_http
4) enable and setup mod_proxy. Add the following code to your <VirtualHost>. I use /etc/apache2/site-available/default
<VirtualHost *>
….
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
AddDefaultCharset UTF-8
ProxyPass /http-bind/ http://yoursite.com:7070/http-bind/
</VirtualHost>
Note: Don’t try to access yoursite.com:7070 from browser, you will get 400 or 404. This is fine.

5) Disable SASL in Jwchat.
In jsjac.js, change the following line:
var JSJACHBC_USE_BOSH_VERĀ  = true; // change it to false

In jwchat.html, insert
oArg.authtype = ‘nonsasl’;
before
con.connect(oArg);

6) Log into openfire console and add the following 2 server properties.
xmpp.httpbind.client.requests.polling = 0
xmpp.httpbind.client.requests.wait = 10

7) Restart openfire and run /etc/init.d/apache2 force-reload

May 1, 2009 at 1:28 am 2 comments

Thread Building Block test drive

After reading the TBB book, I spent half day on playing the lib. My test is simple. Having 2 1000-element arrays, do some math on one array, store the result in the other, swap the arrays and do it again. Run this a few million times. I tried this program on my 2-core machine, the result is just as we expected:

Loop Signal Thread TBB on 2 cores
1,000,000 36.235s 18.418s
3,000,000 106.257 54.638s

In this case, the small change of code worth it well. If this library was available when I was working on my last ray-tracing engine, my life would have been much easier. I wish someday, a similar library would be available on GPU.

I found another interesting thing during my test drive:

unsigned a, b = b0;
unsigned n = <a number you like>;
for(int i = 0; i < LOOP; ++i) {
a = b * b + n;
b = a * a + n;
}
No matter what b0 is, a and b will fall into a pair of fixed numbers (s1, s2), which only depend on value of n; If n is a odd number, then a != b. Otherwise, a = b = one of s1 and s2. I can’t prove it in math but I’ve verified b0=[0, 1024) and n=(0, 1024].

April 28, 2009 at 12:01 am 1 comment

Porting C++ code to Linux kernel

Notes and sample code on porting existing C++ kernel code to Linux

Continue Reading April 5, 2009 at 1:01 am 7 comments

Object in Javascript, a C++ programmer’s point of view

Explain Javascript OOP, which can be confusing for C++ users.

Continue Reading March 20, 2009 at 4:59 am 1 comment

Older Posts


Categories

  • Blogroll

  • Feeds