Category: Mac OSX
Hacking Ubiquity for better Identi.ca/Twitter usage
By Chee Ming on Mar 1, 2009 | In Random Thoughts, Technical, Exoweb, Mac OSX | 2 feedbacks »
I've been using Ubiquity plugin with Firefox for quite a while, mostly for Tinyurl-ing and Identi.ca-ing/Twitter-ing.
For those who don't know what it is: it is a Quicksilver-ish clone but for Firefox and it allows you to create shortcuts for a lot of the web related tasks that you might normally perform. For example: converting a URL to tinyurl, you just need to hit a shortcut, type a command and voila, its done. No need to copy and paste or click on some button. Or send a quick tweet; no need to switch application or create a new tab and login to twitter.com.
And for those who don't know what is Quicksilver: its a very cool program launcher for the OSX and it actually does a lot more than a simple program launcher, although I don't use much of the other, more powerful functions.
Ubiquity is a pretty good idea and quite good to use, minus the bug #19 (broken growl notification) that drives me crazy, but I am getting used to it.

Since I am a programmer I guess I should hack on more code to make my life easier (Hmmm, maybe I should fix that bug #19). I've been using Identi.ca to post my tweets and because I was lazy I wanted to do it in Ubiquity and I got a Ubiquity script from the Ubiquity Firefox Google Groups that would do the trick.
I've been using it for quite a while and realised I have the tendency to make a mistake when replying to tweets (using @nickname) in Ubiquity. So I thought that it would be useful to change the script to make the experience slightly better.
Before I start, I would like to just talk about my micro-blog setup: I have setup my Identi.ca to post my tweets to Twitter. And my normal use case is to tweet using Identi.ca and then check the feed with all those that I following in Twitter since I have more activity there. So if I see anything interesting that I would like to reply to or retweet I can just type in the username in my status message. But the problem I have is that I might type wrongly so I just wanted a way to make it less error prone.
So what I did was to hack the original Identi.ca script and added a simple check when I type the @ symbol in my message. It will extract all the Twitter usernames from the current active webpage when I activated the Ubiquity command prompt and then display in the Ubiquity preview panel as a list of candidates.

As I slowly complete the nickname, it will drill down the list of candidates based on the character by character matching. If I make a typo, then there would be no candidate names in the list. Its just a very simple hack but I think it would make my replying a bit less error prone. The next step would be to have an easy way to match the reply to the correct tweet. I wonder if there is a way to do it in my case, since I am using Identi.ca. I haven't really explored the API at all.
Because of this small itch I managed to learn a bit about hacking Ubiquity and I have to say that its really straightforward and the fact that I can use jQuery makes programming in Javascript almost fun. I would rather code in Python but I think I can live with this.
So if anyone wants to try out the hack I made, the code is hosted as a Gist in GitHub. Do give me some feedback, whether you find it useful or useless.
Configuring NAT and X11 for VMWare Fusion running Debian Etch
By Chee Ming on Jul 6, 2008 | In Technical, Exoweb, Mac OSX | 1 feedback »
It would be so much easier to use "bridged" networking but sometimes it doesn't work properly with some wireless setups and we have to use NAT instead. But one problem I had was to configure the setup so that the host machine can access the guest machine easily.
I don't do this very often and I remember that I have to spend quite a bit of time searching the web to find the answers I am looking for. So I am going to write a bit about this so that it might help someone (or even myself) in the future.
At Exoweb, we do a lot of our development on the Debian distro so I have a VMWare Fusion virtual machine running Debian Etch. I want ssh access to the machine but how am I going to connect to it? You need to configure the natd that is running on your host machine, (in my case its the Macbook Pro) so that you can connect (ssh) to the guest machine that is connected to a virtual network created by VMWare Fusion.
Run the following command in Terminal, and you should get some similar output:
silviana:~ cheeming$ ps aux | grep vmnet-natd
cheeming 43558 0.2 0.0 75492 392 s001 R+ 12:54PM 0:00.00 grep vmnet-natd
root 38501 0.0 0.0 75924 312 ?? Ss Fri05PM 0:04.05 /Library/Application Support/VMware Fusion/vmnet-natd -c /Library/Application Support/VMware Fusion/vmnet8/nat.conf -m /Library/Application Support/VMware Fusion/vmnet8/nat.mac -d /var/run/vmnet-natd-vmnet8.pid vmnet8
You need to edit the configuration file that is used by vmnet-natd and in my machine its /Library/Application Support/VMware Fusion/vmnet8/nat.conf. Open the file in your favourite editor and check the [incomingtcp] section. There should be some comments about SSH, you can add a line that looks like the following:
... [incomingtcp] ... # lots of comments ... 8889 = 192.168.102.128:22 ...
What is config means is that for port 8889 on host machine point it to IP address 192.168.102.128 (insert your guest machine IP address here) at port 22. Save the file and then restart the VMWare networking stuff with the following command:
silviana:~ cheeming$ sudo "/Library/Application Support/VMWare Fusion/boot.sh" --restart
Once that is done, try the following:
silviana:~ cheeming$ ssh -p 8889 -X localhost
And you should be able to access to your guest machine from your host machine's terminal.
You'd notice that I included a "-X" option because I wanted to run some GUI apps as well. I also had some issues with it and initially thought it was due to the firewall but it wasn't.
After I posted this article, Martin, a fellow Exomate, wrote an e-mail to me explaining a proper way to do this and after that I did a few more experiments and realised that I didn't need to configure anything at all. I don't know what I did earlier to fix it but I am pretty sure I had problems the first time around. Instead of using ssh's -X command line. Its better to use -Y as such ssh -p 8889 -Y localhost. Here are some tips that Martin gave me: Before connecting to the remote host, try and run xlogo. It should work.
If it doesn't check the DISPLAY environment variable. On my machine it looks something like this: /tmp/launch-7t2bMS/:0. So then ssh into the remote machine as indicated before and then try and run xlogo again. And again it should work. If it doesn't then something is up, try checking the DISPLAY environment variable. It will look something like this: localhost:10.0.
Also, the method that I outlined below is not encrypted and should be avoided unless you know what you're doing. Many thanks Martin for clearing this up. But I am still not sure what happened to my setup earlier. Why didn't it work before?
The following section till the end has been deprecated:
I've been playing around with git and wanted to run gitk in VMWare Fusion but I got the following error:
cheeming@ccmdebianetch:~/trunk-git$ gitk
Application initialization failed: no display name and no $DISPLAY environment variable
Error in startup script: invalid command name "image"
while executing
"image create bitmap tri-rt -background black -foreground blue -data {
#define tri-rt_width 13
#define tri-rt_height 13
static unsigned cha..."
(file "/usr/bin/gitk" line 1185)
I am not too familiar with X11 configs but I remember from attending an ExoForum that Russell had to run some commands to make things work properly and that memory actually helped me configured things quite easily with out needing to RTFM.
First, I had to set the DISPLAY environment variable to my host machines' IP (this it the IP address as seen by the guest machine in the virtual network created by VMWare, check ifconfig and look for vmnet8 device) like this:
cheeming@ccmdebianetch:~/trunk-git$ export DISPLAY=192.168.102.1:0
cheeming@ccmdebianetch:~/trunk-git$ gitk
Xlib: connection to "192.168.102.1:0.0" refused by server
Xlib: No protocol specified
Application initialization failed: couldn't connect to display "192.168.102.1:0"
Error in startup script: invalid command name "image"
while executing
"image create bitmap tri-rt -background black -foreground blue -data {
#define tri-rt_width 13
#define tri-rt_height 13
static unsigned cha..."
(file "/usr/bin/gitk" line 1185)
Hmm, something is still up. And I did the following (on the host machine), again based on what I remembered from ExoForum, but this time had to use the man a bit.
silviana:~ cheeming$ xhost 192.168.102.128 192.168.102.128 being added to access control list
I tried running gitk again and it worked. Hope this has been helpful.
Converting WMA to MP4 on Mac OSX
By Chee Ming on Jun 17, 2008 | In Technical, Exoweb, Mac OSX | Send feedback »
I don't know why I am so dumb that I spent so much time scouring the Web to look for a utility to convert between different audio file formats. In fact my favourite video player, VLC can do it right under its hood.
Why would I want to do this conversion business? Because I have a bunch of WMA files which I can't import into my iTunes (but it works on M$ Windows though).
The weird thing is that I didn't manage to coerce VLC to convert it to MP3 for me so in the end I just did MP4 anyway since iTunes support it.
Here are the steps that you need to take:
- Start up VLC
- Click File and select "Streaming/Exporting Wizard..."
- Select "Transcode/Save to file", click "Next"
- Select a file and click "Next"
- Check the "Transcode audio", and select "MPEG 4 Audio", select the bitrate that you want and click "Next"
- Select "MPEG 4/ MP4" and click "Next"
- Choose a filename and path to store the new file and click "Next"
- Click "Finish"
- Wait for it to be done
You can also choose other audio file formats and its pretty easy. Although I wish there is a better interface for this.
I also provide some screen shots to describe in detail
.
SIMBL + TerminalColours in Leopard
By Chee Ming on May 2, 2008 | In Technical, Exoweb, Mac OSX | Send feedback »
I am finally fed up with the bright blue colour in Terminal and decided to change it. I guess I was able to tolerate this stupidity for quite a while. I remember Wang Chun tried this before.
But his tip is not complete for Leopard.
I found a tip here that made it work.
In summary:
- Download and install SIMBL. I used this version and didn't need to configure anything.
- Download and extract TerminalColours in to the right folder
~/Library/Application Support/SIMBL/Plugins - You might still get an error message, which is invoked by the previous installation, I deleted it from
/Library/Application Support/SIMBL/Plugins/TerminalColors.bundle - Open Terminal, under Settings -> Text, choose "More..." and remove that irritating blue and select a colour of your choice
- There might be other problems, check the comments section of that blog entry to learn more of what others went through
Working Remotely
By Chee Ming on Apr 21, 2007 | In Technical, Exoweb, Ubuntu, Mac OSX | Send feedback »
For the month in March, I've been mostly away from the office because I was in Tallinn, Estonia on business. Due to that, I've experienced working remotely a.k.a telecommuting. Its not as nice as being in the office with dual monitors, free soft drinks, familiar people around and etc but its pretty much the same, in terms of getting the work done, as long as you have a good Internet broadband connection and the right tools setup.
I've tried working remotely on a MacBook running OSX, Thinkpad running Windows and finally my own Dell Inspiron also running Windows. I would say that the MacBook gave me the most pleasant user experience, but overall it was pretty much the same. This was due to the fact that most of the work I was doing involved the command line and editing text with Vim.
For any *nix type of environment, having ssh was good enough, since everything else was already on the machine that you are connecting to. But when I was in Estonia, the connection back to China would be a tad too slow to do that. So for the MacBook, I was using Parallels to setup a Debian virtual machine for my development work. Due to the new Intel dual core chips, the virtual machine was running smoothly.
The other applications that I used on the OSX were Firefox, Thunderbird, Adium (for MSN), Colloquy (for IRC).
When I switched to the Thinkpad, due to dead hard disk on the MacBook, I had the problem of not having all the small but powerful command-line tools that were easily available on the *nix environment; I am so dependent on find, grep, awk, head, tail and less. I used Parallels to run a Debian virtual machine. Since I had Debian, that solve the problem of not having those tools on the native operating system. On Windows, I was also using Firefox, Thunderbird and Gaim, but now its know as Pidgin (for MSN & IRC). The Thinkpad was pretty speedy, so no problems running the virtual machine. Actually, I think it wasn't that fast until I shutdown and disabled about 15 small little programs, that came with the standard install. Not sure what most of them do, but they sure take up a lot of memory and CPU, to the point that Windows wasn't shutting down properly. Once that was done, I could even use the hibernate feature and it worked almost as well as the OSX's Sleep.
My Dell Inspiron is a bit too old for this virtual machine business and since I was using it mainly at home I didn't need to setup a full development environment for it. I could dual-boot and setup something on Ubuntu with chroot. But anyway, all I needed was a ssh clone in Windows. So I found PuTTY. Putty also supports ssh-agent features with Pagent, but it needs to use a different ssh key format, which can be converted using PuTTYgen.
So thats a recap of my experience when working remotely. I found it surprisingly easy. Not much reconfiguration, although mostly with Vim, since I am pretty used to the defaults. Of course I had to install Debian, but a stock install was good enough and I could get it up and running pretty quickly and for those software packages that weren't in stock install, apt-get would work well. And last but not least, all that comes without a fee and most of them will give you the freedom to modify it in whatever way you want. Absolutely cool!
How would working remotely differ if you are using Microsoft Visual Studio and suddenly your machine crashed and burned? What was your experience like? And how about other GUI-based tools, like Eclipse?
