RSS feed [root] /weblog /languages




login:

password:

title search:




 


Sat Oct 15 11:40:51 HKT 2011

languages



(google search) (amazon search)
second
download zip of files only

Tue Jan 24 23:56:36 HKT 2012 From /weblog/languages/c

memory issue


Personal memo about C++ memory management, from a Java developer, contain some rule of thumb tips - http://karussell.wordpress.com[..]c-trying-to-understand-memory-mangement/

Tutorial of valgrind - http://www.thegeekstuff.com/2011/11/valgrind-memcheck/

Disucssion of GC in C++ - http://herbsutter.com[..]10/25/garbage-collection-synopsis-and-c/

Core dump with few variable declaration removed - http://techblog.rosedu.org/c-extern-internals.html

Tracking memory allocation - http://jfdube.wordpress.com[..]-management-part-2-allocations-tracking/

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)


Mon Jan 16 22:17:35 HKT 2012 From /weblog/languages/c

concurrency


Lightweight thread, actually a simple greem thread - http://www.sics.se/~adam/pt/index.html http://www.sics.se/~adam/pt/pt-1.4-refman/ http://drdobbs.com[..]int?articleId=229601338&siteSectionName=

How Fork work - http://stackoverflow.com[..]1/how-is-fork-working-when-children-fork

Comparing OpenMP and Intel TBB - http://www.ddj.com[..]UQSNDLPCKHSCJUNN2JVN?articleID=214303519

Tutorial about TBB - http://software.intel.com[..]es-with-intel-threading-building-blocks/

Multi-thread optimzated malloc - http://groups.google.com[..]wse_thread/thread/c1ec1fa08c744a8c?hl=en

Introduction to 2 static analysis tool to check OpenMP potential issue, like racing condition - http://software.intel.com[..]tudio-vivamp-and-intel-cc-parallel-lint/

Light weigth lock provide by Linux kernal - http://lwn.net/Articles/360699/

http://software.intel.com[..]uilding-blocks-openmp-or-native-threads/

OpenMP vs. POSIX - http://www.dalkescientific.com[..]/2012/01/13/openmp_vs_posix_threads.html

(google search) (amazon search)


Wed Dec 21 22:12:32 HKT 2011 From /weblog/languages/c

misc


The state of C - http://drdobbs.com[..]int?articleId=223000089&siteSectionName=

Reference of C libraries - http://programmers.stackexchange.com[..]out-there-that-include-the-gnu-c-library

Reflection for C - http://altdevblogaday.com[..]/25/reflection-in-c-part-1-introduction/

Interesting idea, integrate C and lisp - http://voodoo-slide.blogspot.com/2010/01/amplifying-c.html

How to prevent code duplication in C - http://groups.google.com[..]read/thread/b4d029524579944e?hl=en&pli=1

Why need header - http://stackoverflow.com[..]7/why-does-c-need-a-separate-header-file

How to monitor file usage - http://www.thegeekstuff.com/2010/04/inotify-c-program-example

C programming questions - http://stevenkobes.com/ctest.html

Taking input for compilation - http://susam.in/blog/compiler-taking-input-while-compiling/

Understand lvalues and rvalues - http://eli.thegreenplace.net[..]standing-lvalues-and-rvalues-in-c-and-c/

(google search) (amazon search)


Fri Nov 04 23:27:55 HKT 2011 From /weblog/languages/c

cpp


Element of Modern C++ Style, new language feature of C++11 - http://www.herbsutter.com/elements-of-modern-c-style/ , complete tutorial of C++11 - http://www2.research.att.com/~bs/C++0xFAQ.html . And also list of document - http://punchcard.wordpress.com/2011/11/01/c11-c0x-documentation/

How to embed script in C++ - http://dobbscodetalk.com[..]ing-Language-in-CPlusPlus.html&Itemid=29

Is CPP that crap? http://lwn.net/Articles/249460/

lint for c++ - http://groups.google.com[..]wse_thread/thread/b895a69d84ff909d?pli=1

http://www.ddj.com/cpp/archives.jhtml

Namespace tutorial - http://www.dreamincode.net/forums/showtopic59841.htm

http://loadcode.blogspot.com/2009/11/advantages-of-c-over-c.html

Delete a pointer in iterator - http://groups.google.com[..]wse_thread/thread/cfff42bf0c8a569c?hl=en

Discussing about using standard container without copy constructor - http://groups.google.com[..]wse_thread/thread/50e174f87d0261cd?hl=en

(google search) (amazon search)


Sun Oct 30 02:44:15 HKT 2011 From /weblog/languages/c

network


Sample code of flooding network with raw socket - http://www.lainoox.com/c-syn-flood-raw-socket/

C99 socket programming - http://gustedt.wordpress.com[..]m/2011/10/24/socket-programming-and-c99/

(google search) (amazon search)


Sun Oct 23 01:41:00 HKT 2011 From /weblog/languages/c

optimization


Optimizing Pixomatic for x86 Processors part II

http://www.ddj.com/architect/184405765
http://www.ddj.com/184405807
http://www.ddj.com/184405848
http://www.home.comcast.net[..]tom_forsyth/papers/pixomatic_gdc2004.ppt

Fast way to add null after each char from a string - http://groups.google.com[..]wse_thread/thread/51d0f84dd22ad734?hl=en

Move 80 bytes asap - http://codereview.stackexchange.com[..]520/copying-80-bytes-as-fast-as-possible

(google search) (amazon search)


Thu Oct 20 23:30:54 HKT 2011 From /weblog/languages/c

ide


http://programmers.stackexchange.com[..]-lightweight-c-editor-or-ide-for-windows

(google search) (amazon search)


Wed Oct 19 20:19:33 HKT 2011 From /weblog/languages/c

compiler


Template variable name lookup explain - http://groups.google.com[..]+/browse_thread/thread/e8755b9cb8f0fd61#

How link work, and how to debug if thing doesn't work - http://www.thegeekstuff.com/2011/10/gcc-linking

How to create static / dynamic library - http://www.lainoox.com/c-shared-libraries-static-dynamic/

(google search) (amazon search)


Sat Oct 15 11:40:51 HKT 2011 From /weblog/languages

scala


Prevent NPE from scala - http://gabrielsw.blogspot.com[..]es-virginia-scala-can-save-you-from.html

(google search) (amazon search)


Sat Oct 15 11:37:46 HKT 2011 From /weblog/languages/c

bug


incorrect comparison of 64bit pointers - http://www.azulsystems.com[..]/2011-08-28-just-fixed-a-20-year-old-bug

(google search) (amazon search)


Wed Oct 05 12:47:41 HKT 2011 From /weblog/languages

function


Pointer of using function languages like OPML in finance industry - http://beautifulcode.oreillynet.com/2008/03/edge_extension_1.php http://queue.acm.org/detail.cfm?id=2038036

(google search) (amazon search)


Mon Oct 03 23:45:59 HKT 2011 From /weblog/languages/c

cuda


Using CUDA with Java - http://www.javacodegeeks.com/2011/09/gpgpu-java-programming.html

C library that allow programmer use the power of NVIDIA GPUs

http://www.nvidia.com/object/cuda_home.html
http://www.ddj.com[..]articleID=207200659&dept_url=/architect/
http://www.ddj.com[..]ept_url=/hpc-high-performance-computing/
http://www.ddj.com[..]ept_url=/hpc-high-performance-computing/

CUDA Data Parallel Primitives Library - http://www.ddj.com[..]ept_url=/hpc-high-performance-computing/

CUDA tutorial - http://www.ddj.com/architect/207200659



(google search) (amazon search)


Mon Sep 26 23:59:58 HKT 2011 From /weblog/languages/c

gui


Example of using DBus - http://brunogirin.blogspot.com[..]m/2011/01/d-bus-experiments-in-vala.html

(google search) (amazon search)


Sat Aug 06 00:35:30 HKT 2011 From /weblog/languages/c

string


One big problem of strncpy, it doesn't allow you control the behaviour when overflow... http://blog.liw.fi/posts/strncpy/

Problem of atoi - http://www.lainoox.com/ascii-to-integer-atoi-in-c/

(google search) (amazon search)


Tue May 03 15:05:59 HKT 2011 From /weblog/languages

Erlang


Overview of Erlang memory model, per thread heap and low thread footprint - http://www.javacodegeeks.com[..]/erlang-vs-java-memory-architecture.html

Concurrency is an area where Erlang shines - http://www.sics.se/~joe/apachevsyaws.html http://www.cincomsmalltalk.com[..]gView?showComments=true&entry=3364027251

And then, note the flatness of Erlang CPU-time curves and decent C (coroutine) performance compared to abysmal Java 6 and C++ (Pthreads) data in this benchmark - http://shootout.alioth.debian.org[..]ge&p1=hipe-2&p2=gpp-2&p3=gcc-2&p4=java-0

Another article about Erlang, contains pointers to useful site and reference large scale project - http://www.ddj.com[..]201001928?cid=RSSfeed_DDJ_ArchitectDebug http://www.infoq.com[..]2007/08/erlang-java-for-concurrent-futur http://www.ddj.com[..]og/archives/2007/10/functional_prog.html

Mnesia , DBMS powered by Erlang - http://www.infoq.com/news/2007/08/mnesia

Comment of OO from Joe Armstrong, http://www.sics.se/~joe/bluetail/vol1/v1_oo.html , that tell why Erlang look like this, and why me and my college feel uncomfortable with it....

Some issues of Erlang - http://www.artima.com/forums/flat.jsp?forum=276&thread=226786

Map reduce at Erlang - http://horicky.blogspot.com[..]/06/exploring-erlang-with-mapreduce.html

(google search) (amazon search)


Wed Apr 06 01:20:22 HKT 2011 From /weblog/languages

system


Quick look at the Rust Programming Language - http://www.bluishcoder.co.nz[..]ok-at-the-rust-programming-language.html

(google search) (amazon search)


Wed Mar 23 15:25:33 HKT 2011 From /weblog/languages

other languages


Map scala function to java - http://blogs.sun.com[..]rarajan/entry/scala_for_java_programmers
Examples to show good points of Scala - http://edouard.decastro.name/notes/view/1608

a lot of quick start cookbooks of various languages - http://pleac.sourceforge.net/ and here is video tutorials - http://freescienceonline.blogspot.com[..]ucation-lectures.html?search=programming

Yet other JVM base language, it is very erlang like - http://clojure.sourceforge.net/ http://groups.google.com[..]vuI1Vhhmpjq_tXqhHSmIzvYz_Xjy5kXSYlvYYdgY

(google search) (amazon search)


Mon Jan 24 10:59:59 HKT 2011 From /weblog/languages

general


Sites that rate popularity of difference computer language

http://www.tiobe.com/tpci.htm
http://dada.perl.it/shootout/
http://www.99-bottles-of-beer.net/

How loop generate GOTO statement - http://www.abhisheksur.com[..]01/internals-of-loops-while-for-and.html


(google search) (amazon search)


Wed Jan 19 14:27:04 HKT 2011 From /weblog/languages/c

system


Give hint to kernal about how use swap memory - http://linux.die.net/man/2/madvise

Recursive ls - http://synesis.com.au/software/recls/

Socket programming tutorial - http://www.codedanger.com/caglar/?p=210 http://simplestcodings.com/2011/01/18/ping/

Discussion about making flush() reliable - http://groups.google.com[..]wse_thread/thread/71da1187ec3b0445?hl=en

(google search) (amazon search)


Sat Jan 15 10:08:41 HKT 2011 From /weblog/languages/c

io


First Disk Seek on multi-core system - http://www.1024cores.net/home/scalable-architecture/wide-finder-2

(google search) (amazon search)


Fri Dec 31 00:50:32 HKT 2010 From /weblog/languages

go


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/

A presentation - http://wh3rd.net/practical-go/

(google search) (amazon search)


Fri Oct 29 02:11:41 HKT 2010 From /weblog/languages

html


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/ http://blog.codetastrophe.com[..]2009/03/tic-tac-toe-game-for-kindle.html

(google search) (amazon search)


Mon Sep 06 02:21:19 HKT 2010 From /weblog/languages

assembly


Introduction to x64 Assembly - http://software.intel.com[..]us/articles/introduction-to-x64-assembly

(google search) (amazon search)


Mon Nov 23 13:14:40 HKT 2009 From /weblog/languages

smalltalk


Free tutorial - http://www.iam.unibe.ch/~ducasse/FreeBooks.html http://squeak.preeminent.org/tut2007/html/index.html

History - http://users.ipa.net[..]/design_principles_behind_smalltalk.html

VirualBox image for smalltalk collection of software - http://www.schrievkrom.de/blog/?p=667

(google search) (amazon search)


Fri Sep 11 00:26:57 HKT 2009 From /weblog/languages

haskell


http://donsbot.wordpress.com[..]l-programming-in-haskell-a-reading-list/

(google search) (amazon search)