Efficient working

Efficient communication is the key.

Software is build to resolve a problem.

The most hard part is define the problem.

Second hard part is turn idea into a software product.

Third hard part is keep information up to date and keep every team member on same page.

Mature programming

1. Code is document and with necessary external document ( Which clearly defined problem, and how to resolve problem)

2. Clear skeleton, package, module, interface definition. Road map. Design for keep evolving.

( Limit risk into small modules, and make modules replaceable )

3. Test driven and behavior driven, test facilities.

4. Necessary logging and exception handling

5. Build script and continuous integration environment.

6. Handle stress, distribution, memory leak, crash, hang etc

7. The right people on the team.

Debugger is not a daily work tool


Are Debuggers Wasteful Timesinks? Martin thinks so


This is something I've often felt, but was never sure about because it seemed so contrarian to the "common" view. What do you guys think? People scoff at good ol' print statements, but they've always done wonders for me and are often faster than using debuggers.

I guess the lesson as always is dogmatism is bad...generally.

Friday, December 05, 2003

Couldn't disagree more. I was going to suggest the debugger as the single greatest innovation in the "axe and knife" thread.

Friday, December 05, 2003

Linus Torvalds also thinks debuggers are evil. Patches exist to add kernel debuggers into the Linux kernel, but Linus refuses to merge them into his official tree. He actively discourages their use.

The general idea is that if you need a debugger to stare at memory dumps and thread stacks, then your code is too complicated and should be rewritten.

Xcode command line tool on 10.9

If you see some error of configure, like " fatal error: 'stdio.h' file not found"

Its because of header files are removed in MacOS 10.9.

And also you can't found the option in XCode to install the command line tools as before.

You need run a command

xcode-select --install

See discussion here: https://discussions.apple.com/message/23497911#23497911

Using array column in postgresql database

Assume your table like this

| user_id |        tag []  |
| 1  |  cloud, happy, shoe |
| 2  | love, rabbit  |
| 3  | what's up, dock  |
  1. How to normalize  array column to a flat table
    select unnest(adwords_labels) as label, product_id from products
  2. How to group by array column
    with flat as (select unnest(tag) as tag, user_id from user_tag)
    select count(distinct user_id), tag from flat group by tag

Build fasm on mac osx

1. download fasm package for Unix http://flatassembler.net/download.php
2. download objconv from http://www.agner.org/optimize/
3. Unzip objconv.zip
4. Goto objconv folder, unzip source.zip
5. Goto source folder, run


6. Copy objconv to your /usr/bin
7. Run

objconv -fmacho -nu fasm.o fasm1.o

8. Run

gcc -arch i386 fasm1.o

9. Rename a.out to fasm, and copy to /usr/bin
10. Enjoy!

There's an "Out of Memory" issue, solution refer to this forum thread

For your convenient, I put a fixed "fasm" executable file for Mac OSX here.

Clang compile with windows SDK

Using clang compile a minimal windows c program success.

clang -fcxx-exceptions -fdelayed-template-parsing -fms-extensions -I"c:\studio\projects\binlib\win32\v7.1A\Include" -I"c:\studio\projects\binlib\win32\vc11\include" -I"c:\studio\projects\binlib\win32\vc11\atlmfc\include" -Wno-invalid-token-paste -D_MSC_VER=1600  -nobuiltininc -DSECURITY_WIN32 -DWIN32 -DWSMAN_API_VERSION_1_0 -w -D_MSC_FULL_VER=160040219 -D_MSC_EXTENSIONS -D_NATIVE_NULLPTR_SUPPORTED -D_MT -fno-operator-names -fms-compatibility -luser32.lib -x c++ test.c

Mount Samba File Sharing on Mac OSX

Script to mount

sudo -u username mount_smbfs -f0777 -d0777 //username:password@my-samba-server/share /opt/share

Firewall rules on server

-A RH-Firewall-1-INPUT -p udp -m udp --dport 137 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 138 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT

Super Moon 2013-06-23

Shoot with PowerSeeker 70AZ and Lumix G3


Gradle GWT devmode set JSP version to 1.5

I'm using gradle to compile and debug GWT project. But this project is using JSP1.5.

This script can switch the GWT devmode server to JSP1.5.

Java source code

import org.apache.tools.ant.taskdefs.Javac;
import org.eclipse.jdt.core.JDTCompilerAdapter;

public final class JDTCompiler15 extends JDTCompilerAdapter {
  public void setJavac(Javac attributes) {
    if (attributes.getTarget() == null) {
    if (attributes.getSource() == null) {

The Gradle script