#Google Analytic Tracker


Mar 20, 2007

Some Danger of Refactoring using ReSharper

No doubt, ReSharper (2.5 specific) had helpped me a lot when coding in C#. Particularly I like its Reformat code feature which it removes redundancy in the code.

For example

private void DoSomething(object sender, EventArgs e)

private DoStuff(EventArgs e)

Resharper will suggest to remove the parameters "sender"

However, what if your function looks like the following:

private void DoSomething(object sender, EventArgs e)
    if (this.m_oLogGridView.InvokeRequired)
this.Invoke(new EventHandler(DoSomething), new object[] {this, new object()});

Resharper will suggest you to remove the parameter "sender". However, if you remove the sender parameter without fixing "this.Invoke(method target, parameters)" function, you will run into runtime error. That's because the number of parameter we are passing using the this.Invoke() doesn't match the method parameter.

So, be careful when use refactoring.

Mar 11, 2007

ASUS WL-500gP Custom Firmware Setup Experience

Introduction(In construction)

When I was traveling in Hong Kong, I know that computer hardwares are cheaper than in Canada. I knew that I need a better router than my crappy old 4 ports non-wireless router. After some research I found ASUS WL-500gP Multi-Functional Router.

WL-500gP Spec

Here are specs for all chips:
Under the big metal cover
BROADCOM BCM4704KPBG CT0542 P11 757088 M5
HYNIX 540 A HY5DU281622ETP-5 KOR H6CC9718TQ2

on the motherboard uncovered
BROADCOM BCM5325EKQMG RD0604 P11 765129A 5
VIA VT6212L G 0552CD TAIWAN 23B7005400
DELTA LFE8731 0548
DELTA LFE8505 0549W

on the Mini-PCI board
BROADCOM BCM4318EKFBG HS0547 P20 760839 N1
SIG 2521A6 5336E


Short Coming of the ASUS Firmware

I have tried using WL-500gP firmware ver and Although is an up to date version (up to the point I am typing this), seems to work better. The major issue I have with is the network connection speed access to my external harddrive was down to about 300kB/s instead of the usual 3MB/s. So, I went back to In addition, Download Master (DM) doesn't properly and report of Bit Torrent status is confusing. (i.e. when BT is downloading, DM would say it is queue). Multiple BT doesn't seem to work at the same.

Custom Firmware for the Router

Installing Oleg WL500gp-

There are 2 useful posts that had help me install the Custom Firmware

Tutorial by marcnesium on http://wl500g.info/
Follow up of the above tutorial

Basically I found that the follow up instruction is much clear on what you need to do. However, you are still require to have some Linux command-line skills and some basic understanding of the Linux OS in general.

Here is the summary of what I did by following their instruction
  1. Set your WL-500gP into recover mode
    • Power off your router
    • Use a paper clip to whole the Reset button behind your router, then plug the power back on, hold this button for 5 sec to make sure it goes into recovery mode
    • You will see the Power light blinks slowly if your router is in recover mode,

  2. Use the ASUS Utility to upload the trx file to your router
    • Make sure your firewall is off, otherwise the ASUS may give you a Invalid IP error

I am using Fujitsu 100GB External harddrive (2.5" size), which seems to work very well. I don't need any power adapter for the harddrive because the power is supplied by the router via USB port.

Make Partition to your harddrive using Linux fdisk command

part1 - Win95 partition -- "I don't know what Partition magic did"
part2 - Linux swap partition
part3 - Linux data ext2 partition -- mount to /opt
part5 - Linux old_data ext2 partition

Note: Busybox seems to do automount, and a process call stupid-ftp cause me lot able to write the system table to the harddrive. It turns out that I have to disable FTP Server though the ASUS configuration

One good thing with ipkg is that is has an update function which update the list of available pkg online.

dropbear Setup
for some reason I have 2 dropbear initialization code written on the post-

Samba Setup
Your router must have a LAN HOSTNAME, you can set it up thought the ASUS Web Interface.
Not too sure why, I have the following setup in the post-boot file, but it doesn't seems to take affect:

#Set hostname
hostname your.host.name

Reference: http://samba.org/samba/docs/man/Samba-HOWTO-Collection/

Install (c)Torrent
ipkg install ctorrent
ipkg install torrent

Follow marcnesium's ctorrent installation step

In the "/opt/etc/torrent.conf", set the source and target to the share drive as your samba for easier access to the torrent files.

Notice that if you just install ctorrent, you

ipkg install libstdc++
ipkg install ctorrent
ipkg install torrent

If you follow marcnesium, it seems like the post-mount script never gets run.

Tips and Things that Learn about Linux Embedded System

Useful configuration paths to know:
post boot script : "/usr/local/sbin/post-boot"
samba-config-file: "/opt/etc/samba/smb.conf"
cgi-script: httpd configuration file: "/usr/local/root/httpd.conf"
http daemon start-scripts: "/usr/local/sbin/post-mount"
ctorrent configuration: "/opt/etc/torrent.conf"

Useful Log file paths:
DHCP log: "/tmp/dnsmasq.log"
Samba log: "/var/log/smb", ""/var/log/nmb"

Here is my smb.conf setting: (Note, you need to have an LAN Hostname, I didn't have it and I have lot of trouble of setting Samba to work. I pretty much turn off the security for now. Then I will start tuning the parameters

Samba Reference

Samba Reference 2

workgroup = home
netbios name = WL-500gP_Computer
server string = WL-500gP
security = share
browseable = yes
local master = no
guest ok = yes
guest only = no
log level = 1
max log size = 100
public = yes

comment = WL500gP share folder
path = /opt/smbshare
public = yes
writeable = yes
guest ok = yes

Create these directory for your torrent

mkdir /opt/share/torrent
mkdir /opt/share/torrent/source
mkdir /opt/share/torrent/work
mkdir /opt/share/torrent/target


Isn't it cool you have a embedded Linux System running as a router for your home or office! I have been using Windows all of my life, expect during University year where I have to play around with Linux and Unix system. Most often I installed Linux on a dual boot system, but I rarely do anything with my Linux system because I do most of my work on a Window System due to software compatibility that I comfortable of using.