DLink DIR 665 as an Access Point

I am in process of setting up my home network.  I just recently got a new computer and wanted to turn my older linux box into a router/firewall/server.  I have a DLink DIR 665 router which I use to connect my notebooks to the home network.

Now that I have a dedicated server with DHCP address assignment, I didn’t want the 665 to run as a router.  It would have created its own subnet (which its not really capable of doing unless the uplink is a WAN link) which could have complicated things.  I wanted all my computers on a single subnet.  Getting a different router was not really an option because DIR 665 is awesome IMO.

I therefore wanted the 665 to run as a wireless Access Point (AP).  After digging around on the internet for a while I found that the support for this router as AP was dropped in firmware version 1.04 (the current version is 1.21 btw).  However, there is a way to get this router to work as an Access Point:

In the router’s Admin web interface change the router’s internal IP to a valid static IP (this is the IP where you’d be accessing the router admin web interface; or not change it if there’s no conflict) and disable DHCP.  Then, reset all firewall/nat rules.  Once this is done, plug your 665 into your home network’s switch.  Important thing to note here is that when you plug your router in, plug the wire into one of the switch ports on the 665 and NOT the WAN port.  Leave the WAN port un-plugged. 

That should do it!

Now try renewing your IP lease on one of your wireless devices (if you’re using a mac, just restart it) and you should get the IP assigned to you by the DHCP server on your network and not the 665.  You can now ping the server, access the internet etc.  You’ve essentially turned your DIR 665 into an Access Point.



New found interest

So I went to BestBuy last night and got myself a Nikon D40.  We need it to take pictures of the new member of our family who is going to make an appearance soon :).  I couldn’t wait for the morning all night, so the first thing I did this morning was to run out and shoot a few pictures.  The two images below are the ones I liked, hope you like them too.  I can’t wait to get out of the house and take some more, would probably drive up to the lake and shoot some there. Thanks to Arvind for his suggestions and recommendations.  The D40 was his suggestion, and I think it was great one! .. Check out his work: http://blog.rvvind.com/. I think its amazing!

I am looking for a plugin for wordpress that will help me integrate my pictures with this blog. If you have any suggestions, let me know.


XML-RPC for Silverlight updates

I just finished uploading the source for the XmlRpc library for Silverlight.  You can access it at the google code page for xml-rpc for silverlight.  Its work in progress but I believe the library will mature with time. 

I have included some documentation on the Usage wiki page.


XML-RPC for Silverlight

I have been looking for a nice implementation of XML-RPC for silverlight for a while now. There are a few good resources out there such as XML-RPC.NET, but they don’t really work on Silverlight.

Silverlight is different, that it only has asynchronous network calls and you can’t really imitate sync calls, which makes the use of a RPC a little weird.

I have written a small XML-RPC library for Silverlight. Actually its just a single C# file which users can just drag and drop into their projects. The library is still under development, presently I am hacking together a parser, making sure it works with the most common scenarios.

Here is what the usage of this library looks like. You instantiate a service class, and then instantiate query requests as shown below:

XmlRpcService service
            = new XmlRpcService ("http://betty.userland.com/RPC2");
XmlRpcRequest req
            = new XmlRpcRequest (service, "examples.getStateName",
                     new object [] { 10 });
            += new XmlRpcCallComplete (req_XmlRpcCallCompleteHandler);

req.Execute (null);

Once your call completes or some error occurs, your event handler is invoked (Here I am just assuming that the call succeeded):

void req_XmlRpcCallCompleteHandler (XmlRpcResponse response, object userState) {
    string result = (string)response.TryCast (typeof (string));
    System.Diagnostics.Debug.WriteLine ("Result: " + result);

You try to cast the response into a string, if it cannot be casted you get back a null or the default value for value types. TryCast is pretty powerful, you can declare a class and have TryCast map the returned struct (associative array) to that class. E.g. lets say we have this fault class:

public class Fault {
    public int FaultCode;
    public string FaultString;

    public override string  ToString() {
                 return "Fault Code: " + FaultCode.ToString ()
                     + ", Fault String: " + FaultString;

You can use TryCast to map a fault response to this class. Note that, the names of the members here actually match with those returned when a fault occurs (see XML-RPC spec), case is not important though. You can use your own classes to map with struct returned as XML-RPC responses, this should be pretty handy. I will include more details when I actually release the library.

So a more fault tolerant event handler would look something like this:

Fault f = (Fault)response.TryCast (typeof (Fault));
if (f != null) {
    Debug.WriteLine ("Fault occured: " + f.ToString ());
    if (f.FaultCode == -1) {
        Debug.WriteLine ("OMG! -1 ERROR!");
else {
    string result = (string)response.TryCast (typeof (string));
    Debug.WriteLine ("Result: " + result);

I am still working on a few things with this library, I will post it up here as soon as I am done, I promise!

Stay tuned!


Mac OS X Port Forwarding with Internet Connection Sharing

I have a very peculiar network setup at my home.  

I have my router plugged into my cable modem downstairs in my basement, where it is hooked up to my PC.  Our notebooks and my Mac Mini connect to the network using WiFi.  I use Internet Network Sharing on my Mac Mini to forward my WiFi network to its ethernet interface which is then routed to a switch to which my devices in the living room connect (e.g. my Xbox).  

The problem is that for Xbox and similar devices to work flawlessly they need to be able to accept connections from the internet (my particular problem was with Xbox Live).  A simple resolution to this problem is NAT.  However,  Mac OS X Network and Security configuration doesn’t allow us to configure any NAT options at all.  So you have to go low level with Terminal and tweak the BSD guts of Mac.  

To solve this problem we’ll use natd to configure our port forwarding.  I will use my Xbox example here.  Xbox Live service requires ports 88 and 3074 on UDP and 3074 on TCP to be open.  I first configured my router to forward these ports to my Mac.  On my Mac Mini’s Terminal, I then killed any running instances of natd (Network Sharing does instantiate an instance for its purposes).

$ sudo killall natd

I then issued a command to setup port forwarding:

$ sudo natd -interface en1 \
     -redirect_port tcp 3074  \
     -redirect_port udp 88 \
     -redirect_port udp 3074

Here en1 is the WiFi interface on the Mac Mini. is my Xbox’s IP address.

Once you issue this command, go to your Xbox system settings and test your Xbox Live connection. You should not get any warnings about your NAT configuration.



Hard Moon – Sound.C & Omni Vista

So here’s a new track I started working on very recently.  Instead of trying to fit vocals into my own compositions, this time I tried to compose around the vocals.  Also, this was the first time I was experimenting with string instruments.  I am pretty happy with the results since I spent very little time on it.  I will upload the Logic Pro project for this track as soon as time permits (which should within the next week).

Thanks to Omni Vista for the vocals and ccMixter for providing them.  Since this track uses samples from ccMixter, its licensed under a noncommercial attribution license.

You can use the player to the right to listen to the track.

Hope you like it.

In case the playlist on the player doesn’t update for you, use the direct link:

Hard Moon – Sound.C & Omni Vista


Danceradio.gr – Progressive Stream

This channel has been my favorite for a while now.  The station usually plays euro-progressive.  If you listen to it long enough though, you’d find that the station does play ambient/psy progressive and ambient/progressive house and hosts several amazing artists.  Give it a listen.

The radio station is also available in iTunes under the electronic genre.




East River – Sound.C & Kirsten Hersh

Alright, so here it is. The newest of my tracks. Its a euro-progressive mix with emphasis on psychedelic basslines. You can use the player to the right to listen to the track.

As promised, you can download the whole arrangement and mastering package here (or the link at the bottom).

I used Kirsten Hersh’s Fortune from ccMixter for vocals in one of the parts of the track.
Hope you like it!

Because I used content from ccMixter, this mix is licensed under a Attribution Noncommercial (3.0) license.

Logic Pro package

Seems like certain browsers are having problems loading the new playlist.  Here is the direct link to the track in case the player isn’t showing the new track:

East River

Music Projects Giveaway

Starting with my next music project I will start giving away the logic pro projects I work on through my website.  Everyone will be able to download my projects and see how I made a particular track. I am expecting it to be a learning experience for me as well as any new composers who are starting to learn logic or trance composition in general.  Hopefully more experienced composers will provide their feedback and help me learn and become a better composer.

I am working on a euro-psy-progressive trance kind of a mix these days and its coming out to be pretty nice so far. Stay tuned!

Interprocess Synchronization in Python/Linux

I had been looking for a way to synchronize my python cgi scripts (several, or several instances of one) so that only one of them could access a particular table in a database at one time.  I looked around on the internet but didn’t find a concrete class that could do this.  I was writing my scripts for a linux based apache server, so portability didn’t matter. So here it is.

import os
import fcntl

class lock:
        def __init__(self):
                self.lockf = 0
                self.file = 0

        def lock(self):
                self.lockf = open ('/tmp/mytmpfilename.1001', 'a')
                fcntl.flock (self.lockf, fcntl.LOCK_EX)
                self.file = open ('/tmp/mytmpfilename.1001','w')

        def unlock(self):
                self.file.close ()
                self.lockf.close ()


If you know of a better way of synchronizing processes, please let me know.


Here is more specifically what my scripts do. Perhaps, this post makes more sense in the correct context. The description below was taken from one of my comments.

All instances of my cgi script perform a read operation followed by a delete operation. Essentially, my script reads the top row from the database. Right after the information is retrieved that particular row is deleted. In other words, I am using my database as a FIFO buffer. Now if several instances of my scripts are running, more than one of them could access the first row (read it), thereby letting two different processes fetch the same element from a FIFO. One but all of them then fails with the deletion operation. The whole idea behind this locking mechanism was to avoid this. All instances of my script should always fetch a different item.