Mon Nov 23 13:09:32 HKT 2009
From
/weblog/languages
How go utilizing-multi-core
package main
import "runtime"
func calc()
{
sum := 0;
for i := 0; ; i++ {
sum += i;
}
}
func main()
{
runtime.GOMAXPROCS(4);
go calc();
go calc();
go calc();
go calc();
go calc();
go calc();
go calc();
calc();
}
http://kzk9.net[..]g-multi-core-in-go-programming-language/
(google search)
(amazon search)
Tue Feb 17 10:29:23 HKT 2009
From
/weblog/languages/c
We have a process running fine for several years and recently have core dump everytime starting it up. here is the stacktrace:
(gdb) backtrace
#0 0xfe34251c in realfree () from /lib/libc.so.1
#1 0xfe342e28 in cleanfree () from /lib/libc.so.1
#2 0xfe341f5c in _malloc_unlocked () from /lib/libc.so.1
#3 0xfe341e50 in malloc () from /lib/libc.so.1
#4 0xfe38f534 in _findbuf () from /lib/libc.so.1
#5 0xfe384f38 in _doprnt () from /lib/libc.so.1
#6 0xfe3886fc in fprintf () from /lib/libc.so.1
#7 0x164f64 in _ZN7LogBook8WriteLogEPcS0_i (this=
, pType=0x5c00e8 "INFO",
pMsg=0x6b0b14 "main. Database=XXXXXX. Performing Login to XXXX. user=SYSTEM.", nFile=0) at Util.cpp:164
#8 0x164e28 in _ZN7LogBook9PromptLogEPciS0_i (this=, pType=0x5c00e8 "INFO",
nType=3, pMsg=0x0, nFile=0) at Util.cpp:136
#9 0x14a364 in main (argc=3, argv=0xffbef5bc) at XXXX.cpp:385
(gdb)
Eventaully we found out the reason is the class LogBook is singleton, and it reuse few char* buffer internally, without delete and new in between, after adding delete and new for transaction, the process run correctly, as a rule of thumb, singleton is evil for most of the cases.
(google search)
(amazon search)
Thu Jan 31 12:13:58 HKT 2008
From
/weblog/languages
We can use pure HTTP request as finite state machine and implement some logic in pure webserver -
http://blog.beef.de/2008/01/16/html-game/
(google search)
(amazon search)
Thu Aug 09 11:59:07 HKT 2007
From
/weblog/languages
Case study of using schema in web application -
http://blog.plt-scheme.org[..]erience-report-scheme-in-commercial.html I would wonder how the commercial firm found ppl to support the application if they don't support it...
(google search)
(amazon search)