How to Root a Samsung Fascinate Android Phone with Ubuntu Linux


These are the steps I took to root my Samsung Fascinate. Rooting gives the following abilities and more:

  • Install custom ROMs with ROM Manager (I have not tried this yet)
  • Backup your phone with Titanium Backup
  • Block unwanted calls and messages with Mr. Number Call Block
  • Give other applications root access if needed
  • Have total control of your phone
  • Remove Bing and replace it with Google

This article assumes you have already installed the Android SDK. I also assume that you have the platform-tools directory as part of your path. If not, you will need to specify the full path whenever you see the adb command used, like ~/android-sdk/platform-tools/adb.

The first step is to get your computer to recognize the phone. I followed the instructions on the Android developer site that explain how to do it. I'll summarize the steps for Ubuntu.

First make sure your phone is setup for development by performing the following steps:

  • From the Home screen, press the Menu button, then Settings
  • Select Applications
  • Make sure 'Unknown sources' is checked
  • Select Development
  • Make sure 'USB debugging' and 'Allow mock locations' are checked

Connect your phone to the computer using the USB cable that came with the phone. Now your phone should appear in the list of usb devices:

Bus 002 Device 006: ID 04e8:681c Samsung Electronics Co., Ltd Galaxy Portal/Spica Android Phone

As root, edit /etc/udev/rules.d/51-android.rules so it looks like:

SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"

Replace "04e8" with the vendor id found in your lsusb output from the previous step (it's the first four characters after ID).

Now set the permissions on the file and restart udev to enable it.

sudo chmod a+r /etc/udev/rules.d/51-android.rules
sudo /etc/init.d/udev restart

Now run the adb command and check for devices:

adb devices
List of devices attached
I500cf846986    device

You should see your device listed. If you do not try restarting adb with:

sudo adb kill-server
sudo adb start-server

Assuming you have made it this far and adb can see your device, we can continue with the rooting process. The following instructions were taken from this Newbie Guide to Rooting the Fascinate.

Download and unzip root.zip into a new directory. You should have the following files:


Push the rageagainstthecage-arm5.bin file over to the phone:

adb push rageagainstthecage-arm5.bin /data/local/tmp/rageagainstthecage-arm5.bin

Shell into the phone and setup the next step:

adb shell
cd /data/local/tmp
chmod 0755 rageagainstthecage-arm5.bin

After the next step there will be a pause (for a few seconds) then you will be returned to the shell prompt. Then wait another 20 seconds or longer and you should be kicked out of the adb shell. If your phone locks up, nothing bad should happen, just try forcing a reboot by pressing and holding the power button, or removing the battery for a few seconds.


You should see the following then the command prompt again.

[*] CVE-2010-EASY Android local root exploit (C) 2010 by 743C

[*] checking NPROC limit ...
[+] RLIMIT_NPROC={3712, 3712}
[*] Searching for adb ...
[+] Found adb as PID 2200
[*] Spawning children. Dont type anything and wait for reset!
[*] If you like what we are doing you can send us PayPal money to
[*] 7-4-3-C@web.de so we can compensate time, effort and HW costs.
[*] If you are a company and feel like you profit from our work,
[*] we also accept donations > 1000 USD!
[*] adb connection will be reset. restart adb server on desktop and re-login.

After waiting until you are kicked out of the shell, restart the adb server and re-login:

sudo adb kill-server
sudo adb start-server
adb shell

You should now be at a root (pound symbol) prompt. Exit the shell:


Now to make the root permanent do the following:

adb push su /data/local/tmp/su
adb push busybox /data/local/tmp/busybox
adb shell
mount -t rfs -o remount,rw /dev/block/stl9 /system
cat /data/local/tmp/su > /system/xbin/su
cat /data/local/tmp/busybox > /system/xbin/busybox
chmod 4755 /system/xbin/su
chmod 4755 /system/xbin/busybox

Install the Android application that controls root access:

adb install Superuser.apk

After it installs you will see Success on your screen and the connection will hang. Press Ctrl-C and reboot your phone. You should now have permanent root.

The Library of Congress has specifically exempted rooting from the DMCA (Digital Millennium Copyright Act)… This means that it is now 100 percent legal to root your Android phone (or jailbreak your iPhone) whenever you want without fear of legal action taken against you.

David Wasserman, Android Phone Geek, "Rooting Your Phone Now 100% Legal", 2010-07-26


How to Install Android on Ubuntu Linux


Once again I've decided that I want to take a look at programming for the Android platform. One of the first things to do is to get an Android emulator and a programming environment setup. After searching around a few different sites to get the instructions I've compiled the steps to get an emulator working under Ubuntu Linux here.

Android SDK Manager

I followed the steps on the android site. Using the command line in Ubuntu, here are the steps to follow:

Install OpenJDK:

sudo apt-get install openjdk-6-jre

If you are running a 64-bit OS, then install the needed 32-bit libs:

sudo apt-get install ia32-libs

Download the latest SDK from the Android site (which, as I write this, is android-sdk_r07-linux_x86.tgz).

Uncompress the tarball into your home directory and rename it:

tar xfvz android-sdk_r07-linux_x86.tgz
mv android-sdk-linux_x86 android-sdk

Here are all of the above steps combined:

sudo apt-get -y install openjdk-6-jre
uname -m | grep -q "\(x86_64\|ia64\)" && sudo apt-get -y install ia32-libs
wget http://dl.google.com/android/android-sdk_r07-linux_x86.tgz
tar xfvz android-sdk_r07-linux_x86.tgz
[ -e android-sdk ] && mv android-sdk android-sdk.$(date +%y%m%d)
mv android-sdk-linux_x86 android-sdk

Optionally you may add the Android tools directories to your PATH by adding the following to your .bashrc file:

export PATH=${PATH}:${HOME}/android-sdk/tools:${HOME}/android-sdk/platform-tools

Now run the Android SDK and AVD Manager via:


Or, if you are running GNOME, make a custom application launcher, by either right-clicking a panel and selecting Add to panel… then adding a Custom Application Launcher, or by right-clicking the Main Menu and selecting Edit Menus then select Programming then New Item. The custom application launcher should have the following properties (substitute your $HOME directory for /home/USERNAME):

  • Type: Application
  • Name: Android SDK Manager
  • Command: /home/USERNAME/android-sdk/tools/android
  • Icon: gnome-robots.png

Now configure the Android Manager:

  • Click on Settings, then check Force https://… sources to be fetched using http://
  • Click on Installed Packages, then Update All…, then Accept All followed by Install on the window that comes up; it will take a while to download and install everything; when it finishes, close the window (and the application if prompted to do so)
  • Redo the above step until no more updates can be performed
  • Click on Virtual Devices, then New…, give it a Name and select a version of Android for Target, then optionally add an SD Card and Hardware as desired, finally click Create AVD

You can now run this virtual android image by clicking the Start… button. Or from the command line (replacing NAME with the name of the virtual you created):

~/android-sdk/tools/emulator @NAME

You can also create a custom application launcher with that command.

The next time you want to make sure your android installation is updated you can run:

~/android-sdk/tools/android update sdk


Android on VirtualBox

I followed the steps this article. Using the command line in Ubuntu, here are the steps to follow:

First, if you do not already have VirtualBox installed, you can install the open source edition with the following command:

sudo apt-get install virtualbox-ose

Now, under your Accessories menu you should see the VirtualBox OSE launcher. #+END_COMMENT

Eclipse IDE

Even though I prefer to code in Emacs whenever possible, the recommended method of programming for the Android platform is with the Eclipse IDE. So, I'm starting with that at least until I get more used to Android programming.

At first I tried to install Eclipse with apt-get like so:

sudo apt-get install eclipse

However, I could not get the Android Development Tools to install with that version of Eclipse (Galileo v3.5.2). So, like many others have, I decided to use the latest version from their web site. I downloaded the 64-bit Eclipse Classic (Helios v3.6.1) tarball from their download page. You should download the correct version for your architecture and uncompress it in your home directory.

tar zxvf eclipse-SDK-3.6.1-linux-gtk-x86_64.tar.gz

You might want to create a custom application launcher for it with these settings:

  • Type: Application
  • Name: Eclipse
  • Command: /home/USERNAME/eclipse/eclipse
  • Icon: /home/USERNAME/eclipse/icon.xpm

Now launch Eclipse. Then select Install New Software from the Help menu and add the following sites:

Install everything from each of them in the above order.

After that finishes, select Preferences from the Window menu. Select Android on the left and set the SDK Location to /home/USERNAME/android-sdk or wherever you installed the Android SDK. When you apply it you should see a list of Android target versions. OK the change.

Now when you create a new project, you can pick Android as a type.

James DeBragga [Windows Consumer Product Manager]: Android is "free like a puppy".

spark: "Free like a puppy" is certainly much, much better than an atrociously priced and uncontrollably incontinent, rabies-infected mad hound.


10 Specific Ways to Improve Your Productivity With Emacs


I was re-reading an old post by Steve Yegge about productivity tips for using Emacs, and I wanted to comment on a few of them, but I was not able to find a way to leave a comment or email him. That combined with the fact that I haven't done a blog entry in over a year, I thought I should blog my comments here.

If you use Emacs (and you should), you owe it to yourself to read his post. He does a very good job explaining why Emacs is better at certain [most] tasks and how to configure it for an even better experience.

10 Specific Ways to Improve Your Productivity With Emacs

As I read this I realized that I had incorporated a lot of his recommendations already. Some I had not implemented, others I had tried and reversed (as noted in my comments inside my dot-emacs files). I've listed his sections that I have comments about.

Item 1: Swap Caps-Lock and Control

This time I am going to try to stick with using Caps_Lock as Control. Since I mostly use Ubuntu Linux setting up my .xmodmap files was pretty simple to do. I will be sure to try his regedit trick on Windows when I get a chance.

Item 2: Invoke M-x without the Alt key

I had this switched off because I was using the C-xC-m key for starting Mingus, but I'm going to try the keybindings he recommends.

Item 3: Prefer backward-kill-word over Backspace

I find it hard to switch finger-memory modes when switching between Emacs' cut/copy/paste bindings and the standard CTRL-X/C/V ones that so many other applications use. Because of this, I use cua-mode. It allows me to keep the Emacs functionality of those keys while still being able to use them as needed. Having said this, I still want the original Emacs cut binding C-w to work as expected.

Since the kill-region command should only be called when a region has been selected, I wrote some code to solve this issue for me. Using the following code will do-the-right-thing when you press C-w:

(defun kill-region-or-word ()
  "Call `kill-region' or `backward-kill-word' depending on
whether or not a region is selected."
  (if (and transient-mark-mode mark-active)
      (kill-region (point) (mark))
    (backward-kill-word 1)))
(global-set-key "\C-w" 'kill-region-or-word)
Dialog Boxes: The Root of All Evil

Just had to say that I completely agree.

Item 7: Lose the UI

Being nitpicky here but when should be used instead of if in the following code:

(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))

Like so:

(when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(when (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(when (fboundp 'menu-bar-mode) (menu-bar-mode -1))
Keyboard Macros

As mentioned in the comments section, after you've created a keyboard macro with C-x( and finished it with C-x), and then used it once via C-xe, you can then repeat it by just pressing e.

That's about it for my comments. I hope Steve writes more articles on this topic and finishes his remaining 40 tips.

For more interesting Emacs sites see my previous blog entry about this topic.

If you don't use emacs, you're a pathetic, mewling, masochistic weakling and I can't be bothered to convert you.

-— Ron Echeverri


Rules for Writing Cross Platform Code


After reading this interesting blog about creating petabyte size storage servers I found this entry about rules to follow when writing cross platform code by Brian Wilson to be a good read for anyone doing cross platform coding in C/C++ (or any language for that matter).

The author works for Back Blaze which seems like a nice inexpensive backup service. I will probably subscribe to their services once they have a Linux client. It is a little hard to ignore the irony of the cross platform article when the Linux client is still missing, however, anyone that has worked for a software corporation knows there are often many other non-technical reasons for their product release decisions.

There are 10 types of people in the world: Those who understand ternary, those that don't, and those that confuse it with binary.


How to Get Started Learning Emacs


I do realize that I'm probably quite biased on the topic of editors, but be that as it may, Emacs is simply the best editor, IDE, environment, platform, lifestyle, etc. there is. And it's high time you learned how to use it.

First a quick aside… I used vi and vim for 10 years or so before I finally decided to bite the bullet and take the time to learn Emacs. It probably took me 6 months of playing with Emacs to really get comfortable with it. Hopefully these suggestions will help lessen that amount of time for others.

I'm assuming that you can figure out how to find and install Emacs for your system. You may read how to obtain Emacs from the GNU Emacs site.

Here are some good sites for more information about Emacs:

The problem with the GNU coding standards is they ASSUME that everyone in the world uses emacs. If that were the case, free software would die because we would all have wrist problems like RMS by now and no longer be able to code.

– Knghtbrd


Basics of the Unix Philosophy


Even though the title of this entry is Unix Philosophy, every programmer needs to read this if they are not familiar with it already. A while back I read a great book called The Art of UNIX Programming which may be read free online or purchased in paperback form. While the whole book is good and relevant for any programmer, one section really stood out in my mind.

In chapter 1 there is a section called Basics of the Unix Philosophy that lists a few different versions of programming rules by different authors. I feel that each of the lists are valid and should be considered by any software developer.

The first one is from "Doug McIlroy, the inventor of Unix pipes and one of the founders of the Unix tradition": [1]

  1. Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new features.
  2. Expect the output of every program to become the input to another, as yet unknown, program. Don't clutter output with extraneous information. Avoid stringently columnar or binary input formats. Don't insist on interactive input.
  3. Design and build software, even operating systems, to be tried early, ideally within weeks. Don't hesitate to throw away the clumsy parts and rebuild them.
  4. Use tools in preference to unskilled help to lighten a programming task, even if you have to detour to build the tools and expect to throw some of them out after you've finished using them.

These rules were also summarized as: [2]

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.

The next list of rules is from "Rob Pike, who became one of the great masters of C": [3]

  1. You can't tell where a program is going to spend its time. Bottlenecks occur in surprising places, so don't try to second guess and put in a speed hack until you've proven that's where the bottleneck is.
  2. Measure. Don't tune for speed until you've measured, and even then don't unless one part of the code overwhelms the rest.
  3. Fancy algorithms are slow when n is small, and n is usually small. Fancy algorithms have big constants. Until you know that n is frequently going to be big, don't get fancy. (Even if n does get big, use Rule 2 first.)
  4. Fancy algorithms are buggier than simple ones, and they're much harder to implement. Use simple algorithms as well as simple data structures.
  5. Data dominates. If you've chosen the right data structures and organized things well, the algorithms will almost always be self-evident. Data structures, not algorithms, are central to programming.
  6. There is no Rule 6.

"Ken Thompson, the man who designed and implemented the first Unix" adds:

When in doubt, use brute force.

Finally, the author, Eric S. Raymond, offers the following rules: [4]

  1. Rule of Modularity: Write simple parts connected by clean interfaces.
  2. Rule of Clarity: Clarity is better than cleverness.
  3. Rule of Composition: Design programs to be connected to other programs.
  4. Rule of Separation: Separate policy from mechanism; separate interfaces from engines.
  5. Rule of Simplicity: Design for simplicity; add complexity only where you must.
  6. Rule of Parsimony: Write a big program only when it is clear by demonstration that nothing else will do.
  7. Rule of Transparency: Design for visibility to make inspection and debugging easier.
  8. Rule of Robustness: Robustness is the child of transparency and simplicity.
  9. Rule of Representation: Fold knowledge into data so program logic can be stupid and robust.
  10. Rule of Least Surprise: In interface design, always do the least surprising thing.
  11. Rule of Silence: When a program has nothing surprising to say, it should say nothing.
  12. Rule of Repair: When you must fail, fail noisily and as soon as possible.
  13. Rule of Economy: Programmer time is expensive; conserve it in preference to machine time.
  14. Rule of Generation: Avoid hand-hacking; write programs to write programs when you can.
  15. Rule of Optimization: Prototype before polishing. Get it working before you optimize it.
  16. Rule of Diversity: Distrust all claims for "one true way".
  17. Rule of Extensibility: Design for the future, because it will be here sooner than you think.

Even though all of the rules are important some of the ones that have helped me a lot when programming are: (1) modularize your code and (2) write clean obvious code, or if you can't, make sure you document it well.

Rules that I see a lot of commercial programs fail to adhere to are: (10) they don't do what you expect them to do (like forget your preferences every time you upgrade) and (11) annoy you with pop-up dialog boxes when everything is fine (Success! Press OK to continue.). These issues often occur in Windows applications, however, I'm now noticing some KDE/GNOME applications that do the same thing.

Unix is very simple, but it takes a genius to understand the simplicity.

– Dennis Ritchie

[1] The Bell System Technical Journal. Bell Laboratories. M. D. McIlroy, E. N. Pinson, and B. A. Unix Time-Sharing System. 1978. 57 (6,part2). p.1902.

[2] Peter H. Salus. A Quarter-Century of Unix. Addison-Wesley. 1994. ISBN 0-201-54777-5.

[3] Rob Pike. Notes on Programming in C.

[4] Eric Steven Raymond. The Art of Unix Programming. Addison-Wesley.

  1. ISBN 0-131-42901-9. (ch1s6).


Project Euler Programming Problems


I've been working on the problems on the Project Euler site off and on for about a year now (as are some of my friends). They are a lot of fun for anyone who likes to program and has an interest in algorithm design and optimization. As their site says…

Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve.

I've been working the problems in order and (as I write this) I have completed 68 out of 159, or 43%. I've done each one using Common LISP because when I started I was interested in learning LISP and I thought it would be a great way to help me learn – and it has been.

It is usually not too hard to devise a brute force solution, but the idea is to find a more elegant solution that will run in under one minute. And when you accomplish this task it is very fulfilling.

Mathematicians have tried in vain to this day to discover some order in the sequence of prime numbers, and we have reason to believe that it is a mystery into which the human mind will never penetrate.

– Leonhard Euler


Embedded Twitter in your Web Site


Twitter is a pretty cool social application that allows friends to say current with what each other is doing on a daily basis. Recently I found out about their badges that allow you to embed Twitter content into your web pages.

Here are two examples and the code that produced them. Simply replace nullman with your Twitter username.

<div class="twitter">
  <h2 class="twitter-title">Twitter Flash</h2>
  <object type="application/x-shockwave-flash"
    <param name="movie"
           value="http://twitter.com/flash/twitter_badge.swf" />
    <param name="flashvars"
           value="color1=26112&amp;type=user&amp;id=nullman" />
    <param name="wmode" value="transparent" />
    <param name="allowScriptAccess="always" />
    <param name="pluginspage"
           value="http://www.macromedia.com/go/getflashplayer" />

You'll want to follow the instructions here to pick the color you want. However, I recommend using the above example code that I got from GIO's Blog instead of Twitter's because theirs is not XHTML compliant.