This is the Unix philosophy

Write programs that do one thing and do it well.
Write programs to work together.
Write programs to handle text streams,
because that is a universal interface.

— Doug McIlroy
Read the rest of this entry »


A Hackintosh for The Faint of Heart

I just finished building my first real “hackintosh” computer. As someone who has used a MacBook Pro for the past four years, I have really taken for granted how many things “just work” in Mac OS X. I was considering making my new computer a Mac Mini, but its underpowered laptop-grade components just can’t compare to a good ol’ tower PC.

Since I last booted Tiger on a 32-bit Pentium M laptop (my aged ThinkPad T41) many things have changed (for the better) in the world of OSX86. New bootloaders and better driver support, as well as easy install wizards, have reshaped the rocky world of running the beautiful Mac OS X on standard PC hardware. Of course, a hefty amount of research is still required before getting started to avoid getting burned along the way.

The tutorial I followed was tonymacx86′s iBoot + MultiBeast tutorial. At time of writing, iBoot + MultiBeast is pretty much the preferred method of installing and configuring the Chameleon bootloader/PC-EFI, your kernel extensions (kexts), and various tweaks.

Here is a summary of the hardware used in my new “dream machine” build (all purchased from NewEgg, total was $931). Read the rest of this entry »


Restrict a User to Only SFTP Access

If you are running an OpenSSH server on a Linux machine and you want to restrict a specific user to only SFTP (secure file transfer protocol) access, you can do this by setting their login shell to /usr/lib/sftp-server using the command chsh username.

This will prevent them from bring able to gain an interactive prompt and thus executing programs or system commands. Keep in mind however that this does not lock them out entirely as there are still other ways they can invoke executables (one example is via CGI scripts) and the user can still modify dotfiles in their home directory (unless you put them in a chroot jail).


Seeed Studio DSO Nano Mini-Review

DSO Nano and BoxI recently got my Seeedstudio DSO Nano, a digital storage oscilloscope, a few weeks ago (for my birthday) and I finally got around to actually using it.

I have to say I’m very impressed with it in many ways, although there were are few things I didn’t like. The first part everyone always notices is how bright and vivid the screen is. Truly impressive. The device feels very solid overall, the buttons are a little weak but I don’t mind. One thing I didn’t like was having to use the yellow tape to put the metal back on. I thought that was not very professional – the back should snap into place. The included probes are also a little fragile, but people have reported that you can make your own with an adapter so not a big deal. There are also very many review videos on Youtube of the DSO. I even recorded my own short one.

The initial software that the DSO came with was alright but a little glitchy. I had 2.01 when I turned it on. I thought the interface was not very friendly and some kind folk on the forum pointed me to the Paul firmware (screenshot) which improved things. That is the power of open source (one of the reasons I got the DSO). I wouldn’t recommend the DSO for serious analyzing because its save feature can only take a single snapshot (not good for logic analyzing). However, this might change in the future. The reason I bought it though was to do debugging on simple mostly-digital circuits I build – and for those cases this is just the device!

The cheap price point compared to other oscilloscopes along with the fairly active forums are really a nice touch. Most other digital oscilloscopes are either too expensive or not portable enough. All in all, I am very happy with my purchase.

Oh, and in case you haven’t seen, there is a Google Code project with some additional documentation. I hope to see more documentation for unique uses and customizations in the future.

Update 6/5/2010: I’ve learned that the firmware currently does not support microSD cards larger than 1GB. I originally tried to use a brand new 2GB card without any luck and ended up returning it for a 512MB one. Not a big problem since the save files are only a couple of KB, but it will become harder to find small supported cards in the future.


Cool Blue Background (1600×1200)

Here is a cool blue wallpaper/background image (image resolution is 1600×1200 pixels) that I made in Adobe Photoshop CS3 by following a tutorial I found online. I am releasing this image in the public domain. Hope you enjoy it! Download (PNG).


Tip for Debugging in Python

Traces/breakpoints are useful for debugging and are very powerful in Python. You can start an interactive shell in the middle of execution which allows for powerful introspection and manipulation of runtime objects. Add this line of code where you want to insert a breakpoint.

import pdb; pdb.Pdb().set_trace()


Public domain Netstrings encoder/decoder class for Java

According to D. J. Bernstein, who created the simplistic protocol in 1997, a netstring “is a self-delimiting encoding of a string. Netstrings are very easy to generate and to parse. Any string may be encoded as a netstring; there are no restrictions on length or on allowed bytes. Another virtue of a netstring is that it declares the string size up front. Thus an application can check in advance whether it has enough space to store the entire string.” (More information on Wikipedia.)

Netstrings are great for when you are writing a network program that needs a simple protocol to communicate data between client and server (or client/client). Because of this, it has been my choice for small pieces of software that I write. I was sad to find, however, that Java does not have built-in netstrings capabilities — so I decided to write my own. The source code to my minimalistic yet functional implementation is below.

// Public domain Netstrings encoder/decoder class for Java

public class Netstrings {

    public static String encode(String message) {
        int length = message.length();
        message = new String(length + ":" + message + ",");
        return message;
    }
    
    public static String decode(String original) {
        String result = original.split(":", 2)[1];
        if(result.length()-1 != Integer.parseInt(original.split(":")[0])) {
            System.out.println("Netstring integrity error: Expected length " + original.split(":")[0] + " but got length " + (result.length()-1) );
            return null;
        } else {
        	return result.substring(0, result.length()-1);
        }
    }
    
}


Nokia N900: I love this phone

Nokia N900 stock imageI just bought a Nokia N900 which runs Maemo Linux 5 and after three days I would like to share my initial impression of the device.

Pros: Phone is very well built and comparable to my old iPhone 3G in every way. The 5MP camera is absolutely amazing, I will probably use this as my primary camera for normal photos and bits of video. The Maemo platform in use by the phone is super responsive and feels faster than anything I have ever used. Things open instantly and the multitasking is very smooth. The Linux OS underneath is impressive and I can run emulators for games, although the OpenGL ES 2.0-enabled accelerometer-based 3D game it comes with (Bounce, it is called) is really impressive. I hope this phone lives up to its potential.

Cons: Most apps are in landscape mode only. Also, physical keyboards are overrated. Can’t figure out how to use FM Radio yet. Not a lot of apps out, although there is a huge community around the OS so I expect this to change quickly. T-Mobile 3.5G service is not available everywhere and this phone depends on a fast data connection. Battery life could be better. I wish it took a regular SD card instead of a microSD. Also, where is Ovi sync, Nokia?

Other Thoughts: An expensive device, even after rebates and promo codes. The Maemo forums are very active and you should join them.

This is the second Nokia product I have purchased that runs the Maemo operating system, the first being the now-defunct Nokia N800 Internet Tablet, which I blogged about a while back when I first got it.


T-Mobile MMS Settings for Unlocked iPhone 3G

I recently unlocked my iPhone 3G using the free blackra1n jailbreak and blacksn0w unlock in order to use it on T-Mobile’s service. After you do this, you will not be able to send or receive multimedia messages (MMS) without the correct MMSC and proxy settings. To enter these settings, go to Settings, then tap General > Network > Cellular Data Network, and scroll to the second (MMS) section.

APN: wap.voicestream.com
MMS Proxy: 216.155.165.050:8080
MMSC: http://216.155.174.84/servlets/mms

All other fields should be blank. If you have problems receiving messages, you might also want to enter:

Max Message Size: 1048576
MMS UA Prof URL: www.apple.com/mms/uaprof.rdf

Now reboot your phone and enjoy.

After contacting T-Mobile I was given an alternate set of instructions that also seems to work.

APN: epc.tmobile.com
MMS Proxy: (leave blank)
MMSC: mms.msg.eng.t-mobile.com/mms/wapenc

Hopefully this should resolve any issues that arise, although if you still have problems I suggest giving T-Mobile a call as the tier-3 tech who helped me out was very knowledgeable.


New Project Launched: MicroCart

Recently I have launched a new open-source project called MicroCart (μCart). MicroCart is a lightweight eCommerce system. Essentially it is a very small shopping cart system written using PHP and MySQL. Here is a link to its Sourceforge project webpage.


Follow

Get every new post delivered to your Inbox.

Join 45 other followers