Thursday, October 27, 2011

The way to connect Kindle to Peer to Peer or Adhoc network, Read This!!!

If you are looking for the solution for “Kindle does not connect to enterprise or ad-hoc Wi-Fi networks”, this will be the correct page you are looking for. I think Amazon might limit this function due to they prefer you to buy a 3G version.

As kindle does not support to connect to your ad-hoc network, you will have to install a thirdparty software namely connectify which you can download a lite(free) version from

This software will turn to your laptop/pc into an access point that can be used for Kindle. To set it up, just remove the existing adhoc network or the network bridge on your laptop/pc, set the Internet connection & password & connect it with your Kindle

Have pleasant 😀

Sunday, October 16, 2011

API Hook Engine for Delphi 2

This is the updated version of this post.

Download links: Mirror1
Please view original post to find unpack password.

Tuesday, September 27, 2011

Run Heroes of Might and Magic III on Android

This old classic PC game – Heroes of Might & Magic III has brought to Android platform by an open source project VCMI, its development team has done a remarkable work to make it running on an Android tablet.

How to install:

1. Download VCMI from the Android market from

2. Run VCMI once, it will create the directories on your /sdcard/app-data

3. Install a full version of Heroes of Might & Magic ||| on your PC, you can buy it from , currently VCMI only support english version, you can find out more in their wiki

4. After install the heroes of might & magic III you will need to install WOG, download from here

5. Unzip WOG(files with install.exe) to Heroes of Might & Magic |||/UPDATE/ folder & run install.exe, this installation will take a while, please be patient.

6. Connect your tablet to your PC with USB cable & copy all files under your installation of Heroes of Might & Magic |||/* to /sdcard/app-data/eu.vcmi/

7. Run VCMI again after copy is finished & enjoy your game 🙂

NOTE: Currently only hotseat mode is enabled, you need to select multiple player -> hotseat as the AI engine is not completed yet
You can moreover download latest build of VCMI project from





Friday, September 16, 2011

Hook ntdll!NtDeviceIoControlFile to capture network packets

unit uNtDeviceIoControl;interfaceuses  SysUtils, Windows;const  AFD_RECV = $12017;  AFD_SEND = $1201f;  HTTP_GET: AnsiString = 'GET ';  HTTP_POST: AnsiString = 'POST ';  HTTP_RESPONSE: AnsiString = 'HTTP';type  NTSTATUS = DWORD;  PVOID = Pointer;  _AFD_WSABUF = record    len: DWORD;    buf: PAnsiChar;  end;  TAFD_WSABUF = _AFD_WSABUF;  PAFD_WSABUF = ^TAFD_WSABUF;  _AFD_INFO = record    BufferArray: PAFD_WSABUF;    BufferCount: DWORD;    AfdFlags: DWORD;    TdiFlags: DWORD;  end;  TAFD_INFO = _AFD_INFO;  PAFD_INFO = ^TAFD_INFO;  _IO_STATUS_BLOCK = record    //union {    Status: NTSTATUS;    //    PVOID Pointer;    //}    Information: ULONG_PTR;  end;  IO_STATUS_BLOCK = _IO_STATUS_BLOCK;  PIO_STATUS_BLOCK = ^IO_STATUS_BLOCK;  TIoStatusBlock = IO_STATUS_BLOCK;  PIoStatusBlock = ^TIoStatusBlock;  PIO_APC_ROUTINE = procedure(ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; Reserved: ULONG); stdcall;  PIMAGE_IMPORT_DESCRIPTOR = ^_IMAGE_IMPORT_DESCRIPTOR;  PImageImportDescriptor = PIMAGE_IMPORT_DESCRIPTOR;  _IMAGE_IMPORT_DESCRIPTOR = packed record    CharacteristicsOrOriginalFirstThunk: DWord;    TimeDateStamp: DWord;    ForwarderChain: DWord;    Name: DWord;    FirstThunk: DWord;  end;  PIMAGE_THUNK_DATA = ^_IMAGE_THUNK_DATA;  PImageThunkData = PIMAGE_THUNK_DATA;  _IMAGE_THUNK_DATA = packed record    case Integer of      0 : (ForwarderString: DWord);      1 : (Function_: DWord);      2 : (Ordinal: DWord);      3 : (AddressOfData: DWord);  end;function NT_SUCCESS(Status: NTSTATUS): BOOL;{$EXTERNALSYM NT_SUCCESS}var  OldNtDeviceIoControl: DWORD;procedure SuperHookDeviceIoControl();implementationfunction NT_SUCCESS(Status: NTSTATUS): BOOL;begin  //Result := Status >= 0;  Result := Status < $80000000;end;//////////////////////////////////////////////////////////////////////////////// LookupSendPacket////// Check Send Packets/// Currently implements filter http requests(GET AND POST)/////////////////////////////////////////////////////////////////////////////function LookupSendPacket(Buffer: Pointer; Len: DWORD): Boolean;begin  Result := False;  // drop small packets  if (Len < 10) then Exit;  // check if it is GET or POST.  if ( CompareMem(Buffer, @HTTP_GET[1], 4)    or CompareMem(Buffer, @HTTP_POST[1], 4) ) then  begin    Result := True;  end;end;//////////////////////////////////////////////////////////////////////////////// LookupRecvPacket////// Check Recv Packets/// Currently implements filter http response packets./////////////////////////////////////////////////////////////////////////////////function LookupRecvPacket(Buffer: Pointer; Len: DWORD): Boolean;begin  Result := False;  if (Len < 10) then Exit;  if ( CompareMem(Buffer, @HTTP_RESPONSE[1], 4) ) then  begin    Result := True;  end;end;{ HOOK functions }//////////////////////////////////////////////////////////////////////////////// The hooked NtDeviceIoControlFile function./// "send" & "recv" functions in ws2_32.dll finally will call functions in mswsock.dll,/// & mswsock.dll will call NtDeviceIoControl to send "send" or "recv" commands to TDI Client driver./// So if we hook it here, we can filter all tcp packets.//////////////////////////////////////////////////////////////////////////////// Compatibility: NT3, NT4, W2K, WXP, 2K3function NewNtDeviceIoControlFile(    FileHandle : THANDLE;    Event : THANDLE;    ApcRoutine : PIO_APC_ROUTINE;    ApcContext : PVOID;    IoStatusBlock : PIO_STATUS_BLOCK;    IoControlCode : ULONG;    InputBuffer : PVOID;    InputBufferLength : ULONG;    OutputBuffer : PVOID;    OutputBufferLength : ULONG  ): NTSTATUS; stdcall;var  AfdInfo: PAFD_INFO;  Buffer: PAnsiChar;  Len: DWORD;begin  // call the original function first.  asm    push  OutputBufferLength    push  OutputBuffer    push  InputBufferLength    push  InputBuffer    push  IoControlCode    push  IoStatusBlock    push  ApcContext    push  ApcRoutine    push  Event    push  FileHandle    call  OldNtDeviceIoControl    mov   Result, eax  end;  // if original function failed  if (Not NT_SUCCESS(Result)) then  begin    Exit;  end;  // check whether it is TCP send or recv.  if (IoControlCode <> AFD_SEND)    & (IoControlCode <> AFD_RECV) then  begin    Exit;  end;  try    // obtain Buffer & Len from InputBuffer    AfdInfo := PAFD_INFO(InputBuffer);    Buffer := AfdInfo.BufferArray.buf;    Len := AfdInfo.BufferArray.len;    case IoControlCode of      AFD_SEND:        if ( LookupSendPacket(Buffer, Len) ) then        begin          // output packet content.          OutputDebugString(PChar(Format('[HTTP Send] Length = %d', [Len])));          OutputDebugString(PChar(Format('%s', [StrPas(Buffer)])));        end;      AFD_RECV:        if ( LookupRecvPacket(Buffer, Len) ) then        begin          // output packet content.          OutputDebugString(PChar(Format('[HTTP Recv] Length = %d', [Len])));          OutputDebugString(PChar(Format('%s', [StrPas(Buffer)])));        end;    end;  except  end;end;////////////////////////////////////////////////////////////////////////////////  Setup hook to Ntdll!NtDeviceIoControlFile in mswsock.dll import table/////////////////////////////////////////////////////////////////////////////procedure SuperHookDeviceIoControl();var  hMod: HMODULE;  pDosHeader: PImageDosHeader;  pNtHeaders: PImageNtHeaders;  ImportDescriptor: PImageImportDescriptor;  ThunkData: PImageThunkData;  dll_name, func_name: PAnsiChar;  iNum: Integer;  lpAddr: Pointer;  myaddr, btw: DWORD;begin  hMod := LoadLibrary('mswsock.dll');  if (hMod = 0) then  begin    OutputDebugString(PChar(Format('LoadLibrary(%s)失败!', ['mswsock.dll'])));    Exit;  end;  // obtain DOS header  pDosHeader := PImageDosHeader(hMod);  if ( pDosHeader^.e_magic <> IMAGE_DOS_SIGNATURE ) then  begin    Exit;  end;  // obtain NT header  pNtHeaders := PImageNtHeaders(hMod + DWORD(pDosHeader^._lfanew));  if ( pNtHeaders^.Signature <> IMAGE_NT_SIGNATURE ) then  begin    Exit;  end;  if (pNtHeaders^.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress = 0)    or (pNtHeaders^.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size = 0) then  begin    Exit;  end;  ImportDescriptor := PImageImportDescriptor(hMod + pNtHeaders^.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);  while (ImportDescriptor^.FirstThunk <> 0) do  begin    dll_name := PAnsiChar(hMod + ImportDescriptor^.Name);    if (StrIComp(dll_name, 'ntdll.dll') <> 0) then    begin      ImportDescriptor := PImageImportDescriptor(DWORD(ImportDescriptor) + SizeOf(_IMAGE_IMPORT_DESCRIPTOR));      Continue;    end;    ThunkData := PImageThunkData(hMod + ImportDescriptor^.CharacteristicsOrOriginalFirstThunk);    iNum := 1;    while (ThunkData^.Function_ <> 0) do    begin      func_name := PAnsiChar(hMod + ThunkData^.AddressOfData + 2);      //OutputDebugString(PChar(Format('[HOOK] find API: %s', [StrPas(func_name)])));      if (StrIComp(func_name , 'NtDeviceIoControlFile') = 0) then      begin        OutputDebugString(PChar(Format('[HOOK] Lock "%s" for HOOK.', [StrPas(func_name)])));        //        // if found NtDeviceIoControlFile, save original function address.        // then setup our hook function address.        //        // ID	 RVA	 Offset  Name        //   9A  D8E3  CCE3      NtDeviceIoControlFile        myaddr := DWORD(@NewNtDeviceIoControlFile);        lpAddr := Pointer(hMod + ImportDescriptor^.FirstThunk + DWORD(iNum-1)*4);        OldNtDeviceIoControl := PDWORD(lpAddr)^;        OutputDebugString(PChar(Format('[HOOK] Base=%0.8X, Thunk=%0.8X, ID=%X', [hMod, ImportDescriptor^.FirstThunk, iNum-1])));        OutputDebugString(PChar(Format('[HOOK] Orign[0x%0.8X]=0x%0.8X, new Addr=0x%0.8X', [DWORD(lpAddr), PDWORD(lpAddr)^, myaddr])));        WriteProcessMemory(GetCurrentProcess(), lpAddr, @myaddr, 4, btw);        Exit;      end;      Inc(iNum);      ThunkData := PImageThunkData(DWORD(ThunkData) + SizeOf(_IMAGE_THUNK_DATA));    end;    Inc(ImportDescriptor);  end;end;end.

API Hook Engine for Delphi

This is an Windows NT API hook engine for Delphi, built with Delphi XE. I think it can be compiled under other Delphi versions.

libHttpHook.7z: This is the hook engine & demo dll, it hooked winsock 2.0 send & recv funcs. If you inject the dll into a process, you can use any debug viewer to see its network packets.
DllInjector.7z: This is a simple dll injector. Use it to test libHttpHook.dll.

Wish you like!

DllInjector.7z: Mirror 1
libHttpHook.7z: Mirror 1
Unpack password:

Some comments were written in Chinese. If you received any problem, please contact me on “xmacmail [at]”


Wednesday, August 24, 2011

HP Touch Pad Price Slash, may rebirth webOS

All HP Touch Pad had been sold out in 48 hours after HP launches it price slash, this is a surprise of the market reaction, I believe the webOS would be reborn along the increment of users.

The popularity of Pad depends on operation system + number of applications
Number of applications  is depends on number of developers in the world who do development on the OS
Number of developers depends on the demand of device & the profit they can get

It is a very satisfactory tactics to slash the price to dominate the market to bring more users, then more programmers will join & more application there will be.

webOS may rebirth

Saturday, August 20, 2011

Let your computer say hello

CreateObject("SAPI.SpVoice").Speak "Hello"

Output into a .wav file

set x = createobject("SAPI.SpVoice")set ofs = createobject("SAPI.SpFileStream")ofs.Open "msg.wav", 3, vbFalseset x.AudioOutputStream = ofsx.Speak "Try me"

Output what you input

Dim message, sapimessage=InputBox(“Enter the text you want spoken”,”Speak This”)Set sapi=CreateObject(“sapi.spvoice”)sapi.Speak message

Saturday, August 13, 2011

Http Download with Python

Simple download

import urlliburllib.urlretrieve ("", "mp3.mp3")

Download with progress

 import urllib2url = ""file_name = url.split('/')[-1]u = urllib2.urlopen(url)f = open(file_name, 'wb')meta = = int(meta.getheaders("Content-Length")[0])print "Downloading: %s Bytes: %s" % (file_name, file_size)file_size_dl = 0block_sz = 8192while True:    buffer =    if not buffer:        break    file_size_dl += len(buffer)    f.write(buffer)    status = r"%10d  [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size)    status = status + chr(8)*(len(status)+1)    print status,f.close()

Friday, August 12, 2011

Best web browser for old computer

If you have a old computer like mine (1.6GHZ, 512 Memory & 30GB) & looking for a decent web browser. I strongly recommend Opera 11, this version is much faster than any modern browser, firefox 5, ie 9, google chrome even safari.

This was really surprised me yet after test all those browsers on my computer, Opera is the fastest web browser that I have tested.

Thursday, August 11, 2011

Recursive syntax check with php command line

find . -name \*.php -exec php -l “{}” \;

.Net Assembly Redirection

Sometimes, we need redirect an assembly to a different version, we can do it like this:

<?xml version="1.0" encoding="utf-8" ?><configuration>    <runtime>        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">            <probing privatePath="libs"/>            <dependentAssembly>                <assemblyIdentity name="MathLibrary"                    publicKeyToken="8210BDCE54DAB3C2"/>                <bindingRedirect oldVersion=""                    newVersion=""/>            </dependentAssembly>        </assemblyBinding>    </runtime></configuration>


In element “probing, “privatePath” is additional seraching path for assemblies.

In element “assemblyIdentity“, “name” is the assmebly you want to redirect, “publicKeyToken” is its public key. So the assembly must be strong-named to make a redirection.

After set the assembly, you can make your redirection. In element “bindingRedirect“, use “oldVersion” & “newVersion” to redirect it.


Friday, August 5, 2011

Connect to mysql database using python with MySQLdb cursor

import sysimport MySQLdbimport MySQLdb.cursorsconn = MySQLdb.Connect(    host='localhost', user='vroom',    passwd='vroom', db='vroom',compress=1,    cursorclass=MySQLdb.cursors.DictCursor)cursor = conn.cursor()cursor.execute("SELECT * FROM posts")rows = cursor.fetchall()cursor.close()conn.close()for row in rows:    print row['title'], row['create_date']

Tuesday, August 2, 2011

Execute PHP script in background mode in Windows

Create a .vbs file

Dim objshellSET objshell = WScript.CreateObject ("WScript.Shell") "c:\php5\php.exe YourPHP.php", 0SET objshell=Nothing

And execute this vbs file in windows schedule task manager

Wednesday, May 18, 2011

How to make phone calls from your android application

It is very simple to make a phone call from your android application.

1. add user permission to AndroidManifest.xml file

2. Use following coding to make the call

try {        Intent callIntent = new Intent(Intent.ACTION_CALL);        callIntent.setData(Uri.parse("tel:111111111"));        startActivity(callIntent);} catch (ActivityNotFoundException e) {        Log.e("Android Call", "Call failed", e);}

Tested with Android 1.5(version 3) or above

How to use an SD card as the root file system

How to use an SD card as the root file system (Source URL:

This is the procedure I followed in order to use an SD card, rather than the internal NAND flash, as the root file system. My reasons to do this are in order to have a bigger root FS (I’m using 8GB), in order to avoid hammering the internal flash & wearing it out, & to make it effortless to make duplicate plugs, by simply by duplicating the SD card. It moreover seems to run quite a bit faster, though I haven’t measured anything.

I did this with a very early sheevaPlug, running u-boot 1.1.4, & the built-in debian/ubuntu.
How to test the read & write speed of your SD card

Type in the following command to write a file to the SD card that is 1GB big.

>dd bs=1024 count=1M if=/dev/zero of=/path/to/sdcard/speedtest.txt

if you want a smaller file like 50MB to be written then just alter it to

>dd bs=1024 count=50K if=/dev/zero of=/path/to/sdcard/speedtest.txt

count determines the size of the file you are going to write.

After the command is finished it should print out the write speed like this (mine is very slow by the way)

>892108+0 records in>892108+0 records out>104857600 bytes (105 MB) copied, 48.0403 s, 2.2 MB/s

To test the read speed run this command on the file you just created

>dd if=/mnt/sdcard/speedtest.txt of=/dev/null

It should donate you a print out like this

>204800+0 records in>204800+0 records out>104857600 bytes (105 MB) copied, 0.857745 s, 122 MB/s

Now you will know if your SD card is swift enough to run a file system from.
Create a bootable file system on the SD card

The first step is to make a bootable file system on the SD card. Insert the card into the slot of a running plug. Enter the following commands:

>fdisk /dev/mmcblk0	press "o"  / delete the existing (FAT) partition table	press "n"  / create a new partition	press "p"  / it's a primary partition	press "1"  / partition #1	press enter / default first cylinder	press enter / default last cylinder	press "a"  / set the boot flag	press "1" / ... for partition #1	press "w" / save changes	>mkfs -t ext2 (or ext3, if you wish) /dev/mmcblk0p1>mkdir /mnt/sdcard>mount /dev/mmcblk0p1 /mnt/sdcard>df

You’ve now received an empty file system mounted on /mnt/sdcard. The df that you just typed should show you something like the following. Note the last line, which is the new SD file system. This one is an 8GB card, & because it’s an ext3 journaling file system, a bunch of it is already set aside for directories, journals & such.

Filesystem           1K-blocks      Used Available Use% Mounted onrootfs                  519168    185612    333556  36% /tmpfs                   257816         0    257816   0% /lib/init/rwvarrun                  257816       260    257556   1% /var/runvarlock                 257816         0    257816   0% /var/lockudev                    257816        12    257804   1% /devtmpfs                   257816         0    257816   0% /dev/shmtmpfs                   257816     21824    235992   9% /var/cache/apt/dev/mmcblk0p1         7707056    148400   7167156   3% /mnt/sdcard

Now copy your existing nand file system onto the sd card. The second cp of /dev is required because the first cp doesn’t populate the new /dev directory. The first cp takes 10–15 minutes, so relax for a bit.

If you are like me, & you want to see that there is something going on, add a “v” to the commands below, if not, exclude it.

>cp -axv / /mnt/sdcard # takes 13 minutes>cp -av /dev /mnt/sdcard

The SD card should now mirror your internal nand flash, which you can confirm with df -h, etc. On my system, df -h now shows:

Filesystem           1K-blocks      Used Available Use% Mounted onrootfs                  519168    185612    333556  36% /tmpfs                   257816         0    257816   0% /lib/init/rwvarrun                  257816       260    257556   1% /var/runvarlock                 257816         0    257816   0% /var/lockudev                    257816        12    257804   1% /devtmpfs                   257816         0    257816   0% /dev/shmtmpfs                   257816     21824    235992   9% /var/cache/apt/dev/mmcblk0p1         7707056    516216   6799340   8% /mnt/sdcard

Congrats, your SD card now has a bootable system. The next step is to boot it.
Booting from the SD Card

You need to interact with u-boot now. You must do this from a program talking to the usb-serial port, not from an ssh shell (duh). I use minicom, from an ubuntu system.

>shutdown -r now

When u-boot appears, stop it by typing ENTER a few times, to stop it from booting automatically.

Marvell>> printenv bootargsbootargs=console=ttyS0,115200 mtdparts=nand_mtd:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mtdblock1 rw ip=

This is the line that you’ll need to change. Copy everything after the first “=”, & paste it into a text editor. Edit the line to alter “root=/dev/mtdblock1” to “root=/dev/mmcblk0p1”. Optionally, you can moreover obtain rid of the mtdparts stuff. So, the new line (at least on my plug) is

console=ttyS0,115200 root=/dev/mmcblk0p1 rw ip=

Add, at the beginning of the line “setenv bootargs”. The line is now:

setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p1 rw ip=

Copy it. Paste that line into u-boot as a command, then proceed as follows:

Marvell>> setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p1 rw ip=>> printenv bootargs (if you like, just to confirm that you did it right)Marvell>> boot

With any luck, the system will now boot. If you watch the boot text scrolling by, you should see something like this. If you formatted with ext2 instead of ext3, it will be different of course.

EXT3 FS on mmcblk0p1, internal journalEXT3-fs: mounted filesystem with ordered data mode.VFS: Mounted root (ext3 filesystem).

When the system comes up, log in & type “df”. You should see something like this, with a much bigger root fs than you had before.

> dfFilesystem           1K-blocks      Used Available Use% Mounted onrootfs                 7707056    516388   6799168   8% /tmpfs                   257816         0    257816   0% /lib/init/rwvarrun                  257816       260    257556   1% /var/runvarlock                 257816         0    257816   0% /var/lockudev                    257816        12    257804   1% /devtmpfs                   257816         0    257816   0% /dev/shmtmpfs                   257816         0    257816   0% /var/cache/apt/dev/mtdblock2          521216    202120    319096  39% /mnt/nand

Note that on this display, the rootfs is the new SD file system, & is much bigger. The last line is the internal nand flash. You won’t see that unless you mount it, as follows. The -r on the mount command mounts the nand read-only. Leave it off, if you like.

mkdir /mnt/nandmount -r /dev/mtdblock2 /mnt/nand -t jffs2	 # takes 1–2 minutes

Write u-boot environment to flash if desired.

The changes you made to the boot environment (setenv) don’t persist across a reboot. You’ll need to do that every time, unless you explicitly write your changes to internal flash. You do so by inserting “saveenv” after the setenv.

Marvell>> setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p1 rw ip=>> printenv bootargs (if you like, just to confirm that you did it right)Marvell>> saveenvMarvell>> boot

I DON’T suggest you do this the first time. Try it first and, if it works, reboot with the saveenv. Once you’ve done this, it will automatically boot from the SD card after a power-up, reboot, or reset.
Changes for Alpha6 Beta

This tutorial doesn’t quite work out of the box for the Alpha6 system. Namely, the printenv bootargs will not work, & will say variable not found. Instead you can see:

 printenv bootargs_root bootargs_root=ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs

it seems to work for me if you alter this bootargs_root variable to be the following:

 setenv bootargs_root root=b301

This seems to work- for more information see the thread at:

Ensure that you power cycle (at the wall) to ensure that the configuration works. Should you end up with a message like this:

VFS: Cannot open root device “b301” or unknown-block(179,1)
Please append a correct “root=” boot option; here are the available partitions:

 1f00            4096 mtdblock0 (driver?) 1f01          519168 mtdblock1 (driver?) Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1) [] (unwind_backtrace+0x0/0xe0) from [] (panic+0x50/0x120) [] (panic+0x50/0x120) from [] (mount_block_root+0x1d4/0x214) [] (mount_block_root+0x1d4/0x214) from [] (prepare_namespace+0x16c/0x1c4) [] (prepare_namespace+0x16c/0x1c4) from [] (kernel_init+0xc0/0xec) [] (kernel_init+0xc0/0xec) from [] (do_exit+0x0/0x6ac)

Then setting the following may work around the problem:

 setenv bootcmd 'mmcinit; setenv bootargs $(bootargs_console) $(mtdpartitions) $(bootargs_root); nand read.e 0x00800000 0x00100000 0x00400000; bootm 0x00800000'


If you just type “printenv” into u-boot, you’ll see lots of environment variables, including:

bootargs_root=root=/dev/mtdblock2 ro


x_bootargs_root= ....   (if you have a guruplug)

Have a look a the uboot manual .. & at the rest of the environment variables. You will find one with

.... ${x_bootargs_root} ....

wich will be replaced by the content of the x_bootargs_root variable, like in any shell ….
Where Credit is Due

As I tried to obtain this working, I returned frequently to plugforum ( where I received a lot of assist from karurosu, sethlans, wb6ymh & cbxbiker61. They’re smart.

Thursday, May 12, 2011

The Greate Firewall rocks!!! China say "good bye" to Internet

Chinese users are facing huge problem of accessing any website outside China due to the Greate Firewall blocks 80+ connection that is trying to access the Internet outside of China. This is because the government treat all information from outside as “unsafed” & needs to be monitored. The Greate Filewall could be the most “hard working” in the world as it is watching 400 millions people’s internet access & filter everything from “outside”, which can be only done by super computers. This consequence is serious because this policy will finally let the civilization & the gorvernment lose the trust between each other, people will start to consider if the government has hidden something behind them. Buidling an intranet in an entire country in order to block information is not a wise decision & only make things worse, & make the government itself more & more untrustable, I hope the leader of China can really consider approximately this basic right for Chinese internet user & make the government more transparent.

Friday, April 8, 2011

Install Sphinx as Service on Redhat/CentOS

Thanks Steve Kamerman

Create this searchd script under /etc/init.d, & alter the SUDO_USER & BASEPATH to fit your environment.

#!/bin/bash## Init file for searchd## chkconfig: 2345 55 25## description: searchd ## USE "chkconfig --add searchd" to configure Sphinx searchd service## by Steve Kamerman April 14, 2010# public domainSUDO_USER=sphinxBASE_PATH=/usr/local/sphinxPID_FILE=$BASE_PATH/var/log/searchd.pidCONFIG_FILE=$BASE_PATH/etc/sphinx.confEXEC_PATH=$BASE_PATH/binLOG_PATH=$BASE_PATH/var/logDATA_PATH=$BASE_PATH/var/dataRETVAL=0prog="searchd"do_config() {	chown -R $SUDO_USER $EXEC_PATH	chown -R $SUDO_USER $CONFIG_FILE	chown -R $SUDO_USER $DATA_PATH	chown -R $SUDO_USER $LOG_PATH	chmod 600 $CONFIG_FILE	chmod u+rwx $EXEC_PATH/*	chmod -R u+rw,go-rwx $DATA_PATH	chmod -R u+rw,go-rwx $LOG_PATH}do_start() {	echo "Starting $prog"	sudo -u $SUDO_USER $EXEC_PATH/$prog --config $CONFIG_FILE	RETVAL=$?	echo	return $RETVAL}do_stop() {	echo "Stopping $prog"	if [ -e $PID_FILE ] ; then		sudo -u $SUDO_USER $EXEC_PATH/$prog --stop		sleep 2		if [ -e $PID_FILE ] ; then			echo "WARNING: searchd may still be alive: $PID_FILE"		fi	fi	RETVAL=$?	echo	return $RETVAL}do_status() {	RETVAL=$?	if [ -e $PID_FILE ] ; then 		sudo -u $SUDO_USER $EXEC_PATH/$prog --status		echo "---"		echo "$prog is running (`cat $PID_FILE`)"	else		echo "$prog is not running"	fi	return $RETVAL}do_reindex() {	echo "Reindexing all $prog indices"	if [ -e $PID_FILE ] ; then		sudo -u $SUDO_USER $EXEC_PATH/indexer --all --rotate	else		sudo -u $SUDO_USER $EXEC_PATH/indexer --all	fi	echo "done."	echo	RETVAL=$?	return $RETVAL}case $* inconfig)	do_config	;;start)	do_start	;;stop)	do_stop	;;status)	do_status	;;reindex)	do_reindex	;;*)	echo "usage: $0 {start|stop|config|status|reindex}" >&2	exit 1	;;esacexit $RETVAL

Then alter the permission to make it executable.

chown root:root /etc/init.d/searchdchmod 755 /etc/init.d/searchd

Finalise, make it automatically start on system boot

chkconfig --level 345 searchd on

Now you can use

service searchd start/stop/status

to control the sphinx service

Wednesday, February 23, 2011

Awesome new feature - sql_attr_string in sphinx search 1.10

Sphinx search engine 1.10 brings a new attribute sql_attr_string which allows sorting the search result by string rather than integer before. This extremely helpful in my current project, however, this version of sphinx is still in beta, hope they can release the stable version soon.

Live Messenger 100% CPU usage? Abandon it!!!

Once Live Messenger is running, the CPU usage will be high especially it’s stupid embedded ad system play the flash content. Yes, abandon live messenger!!!!! Use sth else instead, I personally recommend Amsn or Pidgin, they are both open source, free to use & NO FLASH AD.

Friday, February 18, 2011

Apache reverse proxy on windows

At moment, we to use apache reverse proxy to handle HTTP request to different server in LAN with a single IP address, there is the configuration
in http.conf, enable following modules add your virtual host:ServerName example.comProxyPass / / "d:/apache_cache/" CacheEnable disk /images/CacheDirLevels 2CacheDirLength 1

You will need to edit your host file for “” to your LAN IP address.