Wednesday, December 30, 2009

Approaching the End of the Decade

Did 10 years really just went by?!? I still remember when we were gearing up to tackle Y2K and we're now approaching the end of the first decade of the millennium.

Sunday, December 27, 2009

Restoring RPM and YUM on Fedora after an accidental yum remove rpm

By default there is nothing that prevents an user from accidentally removing both yum and rpm from a Fedora system and once removed it is very painful to try to put them back. If only yum was removed it would be a little easier to restore. Yum can be reinstalled through rpm using the yum-*.rpm package downloaded from Fedora or the install disc. Without RPM, it's like a chicken-and-the-egg problem. The packages from Fedora and install discs (including the rpm package itself) are .rpm files and needs rpm to install.

Today I found myself in the situation where both YUM and RPM got removed by accident. I was following Fedora's instructions on finding and removing orphaned packages after upgrading and had yum remove some Fedora 11 packages that was left over. Being distracted by other things at the time, I noticed too late that removing those F11 orphaned packages also led yum to remove a bunch of F12 packages including rpm and yum.

So, what does one do in this situation besides "backup and reinstall? which I wanted to avoid if at all possible. It took me awhile to figure out but I was get rpm back on my system and restore it to its earlier state. Here are the steps I took.

My first inclination was to try to compile RPM. However, this was a FAIL since it required additional packages that I didn't have installed and I didn't have a package management system... Instead, I downloaded the rpm-*.rpm package from Fedora and was hoping to extract the files so I can use them to reinstall rpm and yum. To extract files out of an RPM package requires... rpm! Oh, the irony. There is a rpm2cpio program that will do that but that is available in . . . the rpm-build-*.rpm package! Fortunately, there are a lot of scripts available that will do it including some shell scripts. The Fedora RPM docs included some scripts and I downloaded the bash script version but it didn't work. After a little more digging, I found out that Fedora changed the compression scheme it uses in F12 from gzip to xz, so I modified the shell script as follows:


#!/bin/sh

pkg=$1
if [ "$pkg" = "" -o ! -e "$pkg" ]; then
echo "no package supplied" 1>&2
exit 1
fi
leadsize=96
o=`expr $leadsize + 8`
set `od -j $o -N 8 -t u1 $pkg`
il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
# echo "sig il: $il dl: $dl"
sigsize=`expr 8 + 16 \* $il + $dl`
o=`expr $o + $sigsize + \( 8 - \( $sigsize \% 8 \) \) \% 8 + 8`
set `od -j $o -N 8 -t u1 $pkg`
il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
# echo "hdr il: $il dl: $dl"
hdrsize=`expr 8 + 16 \* $il + $dl`
o=`expr $o + $hdrsize`
dd if=$pkg ibs=$o skip=1 2>/dev/null | xz -d


With this script, I extracted the rpm (rpm, rpm-build, rpm-libs, rpm-devel, rpm-python) files to a temp directory and install the files manually:


rpm2cpio.sh rpm-*.rpm | cpio -d -i
tar cf - ./usr ./etc ./bin ./var | (cd /; tar xvf -)


This installs the files onto the system but doesn't update the rpm databases, so I did a 'rpm -ivh rpm*.rpm' in addition to the dependent packages they needed.

With RPM installed, I was able to install YUM . I had kept a list of all the files that got removed earlier so I had yum reinstall all those packages and my system is now restored.

Upgrading to Fedora 12 (part 2)

It took awhile but Fedora upgraded itself and booted in to the GUI without a hitch. Everything seems to be running even with both the LCD TV and monitor hooked up (past upgrades would forget which was the primary display). Then I noticed that there was no audio. My first thought was that somehow Fedora 12 didn't configure the audio correctly (uh oh) which wouldn't be the first time that a piece of hardware worked in a previous version but not the upgraded version. Fortunately, I thought to just double check the volume setting and noticed that the upgrade set the audio-out to MUTE for some reason. Unchecking that re-enabled the sound.

Upgrading to Fedora 12 (part 1)

I decided to take the time off from the holidays to upgrade from Fedora 11 to Fedora 12. My past few upgrades of Fedora have all hit some sort of snag some of which I felt were real obstacles that the typical computer user would find it very difficult to overcome.

For this upgrade, I was ambitious and decided to try the live upgrade feature that was introduced in Fedora 10. By running "preupgrade", Fedora will download all the packages needed to upgrade to the new version in the background so the system can still be used. When everything is downloaded, the system will reboot, install the packages and then the system will be updated. That's the theory at least. This method of upgrading should be faster since it only downloads the packages needed instead of every package. Given my complaint from the last post where I downloaded the entire DVD iso then having to download nearly another DVD worth of packages on the first 'yum update', this method would address that since it will bypass the first part.

The instructions for using using Preupgrade is on the Fedora wiki. Essentially, it is suppose to just be running the command 'preupgrade' and everything else is taken care of automatically. That was kind of accurate. I ran the command and immediately ran into the most common bug with F12 upgrade. I used method 1 to work around it, but I didn't have any extra kernels so it was the tunefs that got me the extra space I needed. Seriously does the Fedora team really think that consumers would be comfortable having to do this in order to upgrade an OS? What Fedora did very well is that it warned me about the problem and none of it effected the current OS and as it promised, I was able to continue to use the system.

Okay, with that out of the way, it completed the download and it was now time to reboot. This is the stage where the system is not able to be used as it install the downloaded packages. However, at reboot, the system just hanged with the monitor showing "GRUB" and a blinking cursor... The upgrade corrupted GRUB and in order to fix it would require re-installing GRUB. The existing linux system is still there unharmed, the boot process just never made it that far. The irony of this bug is that "preupgrade" was meant to avoid having to create a bootable Fedora disc, but a bootable disc is needed to reinstall GRUB. I dug out my Fedora 11 install disc and booted into rescue mode. The following will install GRUB back to the system:


chroot /mnt/sysimage
grub-install /dev/sda # change /dev/sda to the drive you have your /boot


Rebooting after this, the system booted back into Fedora 11...?!? I guess I was able to confirm that so far my F11 instance is still completed unharmed, but this is suppose to be an automated upgrade to F12. I looked at the grub.conf file and it was suppose to give me the option to do a F12 Upgrade. So I rebooted again and made sure that I selected that option in GRUB before it booted back to F11.

Now the system is installing the package so let's see how it goes. I took a bigger chance this time by keeping both my LCD TV and USB drive connected. In the past, I already had to disconnection in order to upgrade successfully, so let's see what happen this time.

Tuesday, December 22, 2009

Upgraded to Thunderbird 3

With most of the attention on the Google Chrome browser release for OSX and Linux, the release of Thunderbird 3 got overshadowed. While some feel that stand-alone email readers are becoming obsolete, I still believe that a dedicate email client is very useful especially for power users. That said, the convenience and advancements of browser-based email such as GMail have come such a long way that we're not far from the time (if we're not already there) when email clients compliments the web version rather then the other way around.

Upgrading from TB2 to TB3 was painless. Just install the application and it handled all the upgrades. It asks whether you want to switch to using some of the new interface features or stick with the previous ones and then it will start to create the search index for all your email. Search was definitely one of the weaknesses of previous TBs especially when you compare it to Gmail's search, but that seems to be one of the areas that TB3 really tries to improve on in this release. I think TB3 also took the right steps in keeping itself relevant by integrating better with web-based mail system. The one shortcoming is that it still doesn't integrate directly with online contacts that you might have with Yahoo or Google. TB3's interface is also a little more Firefox-like. Desktop clients have some advantages of running on the OS so I still feel that they should continue to use that advantage. It isn't a radical change, though, so it might be that good balance between the bringing users some familiarity with browsers while still exposing email features.

I need to play with it more but so far I tip my hat to the team for this nice release.

Thursday, December 10, 2009

Programmatically authenticating to Google App Engine with Python

Even before joining Google, I was already a fan of two of its services: Google App Engine and Google Apps for Domains. Apps itself brings a lot of value and combined with app engine, it's especially powerful for small business and start-ups. Apps provides the most essential IT pieces for a business (email, office suite, calendaring) and Google App Engine (GAE) allows the business to build their own software on Google's infrastructure without the heavy initial investment in hardware and IT infrastructure. This post focuses on just GAE specifically how you can programmatically access app engine from a python script.

The code to authenticate against the production instance of GAE is actually fairly well documented by Google on the GAE site. The issue I ran into is that before I push my code live, I wanted to test it on a development instance. GAE makes setting up a development server easy and comes with its own web server and datastore (database), but the one area where the development environment is different from production is how authentication is handled. The development server doesn't do real authentication. It just sets the right cookie that simulate that you've already logged in. I wanted to write my code with minimal differences between how it calls production and how it calls the localhost. Authentication to your application on production means that you need to get a token from the Google servers, but this doesn't exists on the dev environment. Looking at how the developer instance handled the login screen, I was able to do the following:



#!/usr/bin/python

import cookielib
import urllib
import urllib2

# Setup to be able to get the needed cookies that GAE returns
cookiejar = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar))
urllib2.install_opener(opener)

# Set 'prod' based on how your system determines whether to connect to prod or localhost.
if prod:
# This is the setup to construct the login URL for authentication on prod.
authreq_data = urllib.urlencode({'Email': '',
'Passwd': '',
'service': 'ah',
'source': '',
'accountType': 'HOSTED_OR_GOOGLE'})

# Authentication server
token_uri = 'https://www.google.com/accounts/ClientLogin'

# This is where you want to go after log in. Replace:
target_uri = 'http://auth_example.appspot.com/home'
## Get an AuthToken from Google Accounts
auth_req = urllib2.Request(token_uri, data=authreq_data)
auth_resp = opener.open(auth_req)
auth_resp_body = auth_resp.read()
auth_resp_dict = dict(x.split('=')
for x in auth_resp_body.split('\n') if x)
authtoken = auth_resp_dict['Auth']

authreq_data = urllib.urlencode({'continue': target_uri,
'auth': authtoken})
login_uri = ('http:///_ah/login?%s'
% authreq_data)
else: # authenticate against the local dev server
target_uri = 'http://localhost:8080/home'
authreq_data = urllib.urlencode({'email': 'test@example.com',
'continue': target_uri,
'action': 'Login'})
login_uri = ('http://localhost:8080/_ah/login?%s' % authreq_data)

# Okay, we're done at this point with the difference. From this point everything else
# should be the same for either prod or dev.

# Do the actual login and getting cookies.
serv_req = urllib2.Request(login_uri)
opener.open(serv_req)

# Rest of code here.


That all there is to it!

.vimrc

I've been trying to set up my VIM environment to be more comfortable for me so I can be more productive. It's getting better although I still miss having a shell inside the editor that EMACS provide. Here is my current .vimrc:


" Enable loading filetype and indentation plugins
filetype plugin on
filetype indent on

" Turn on syntax highlighting
syntax on

" Global settings
set autowrite

" Allow backspacing over everything
set backspace=indent,eol,start

" Insert mode completion
set completeopt=menu,longest,preview

" Use UTF-8 as the default buffer encoding
set enc=utf-8

" Remember up to 100 'colon' commmands and search patterns
set history=100

" Enable incremental search
set incsearch

" Always show status line, even for one window
set laststatus=2

" Jump to matching bracket for 2/10th of a second (works with showmatch)
set matchtime=2

" Don't highlight results of a search
set nohlsearch

" Enable CTRL-A/CTRL-X to work on octal and hex numbers, as well as characters
set nrformats=octal,hex,alpha

"Show line, column number, and relative position within a file in status line
set ruler

" Show matching brackets
set showmatch

" Show line numbers
set number
" case-insensitive search
set ignorecase

" Code folding
set foldenable
set foldmethod=indent
set foldlevel=100

" Have VIM recursively search upward for tag file
set tags=tags;/

" Toggle tag list
nmap :TlistToggle
" Builds tags for current directory
nmap :!/usr/bin/ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .

" Bufexplorer plugin toggle
nmap \be

" Change to directory of current working file
au BufEnter * lcd %:p:h



I use 2 plugins: TagList and Bufexplorer along with Exuberant-Ctags to make moving around the code easier.

Sunday, November 29, 2009

One script with different script names.

Sometimes I want to have my bash script behave differently based on how I call it without having to set up different parameter inputs. For example, I might have a script that can sync a file from a local server to one of two remote servers. I can make my script to take in parameters so I can call it using 'syncfiles -h serverA; syncfiles -h serverB', but sometimes I forget what my params are and it's easier to remember 'syncToA' or 'syncToB'.

To do this is pretty simple, yet I always have to look it up each time so I'm writing this as note to myself.


#!/bin/sh

echo $0

if echo $0 | grep "syncToA" > /dev/null
then
# do stuff
elif echo$0 | grep "syncToB" > /dev/null
then
# do stuff
fi


Next, create symlinks to the original source files with the names you chose (i.e. 'symlink syncToA syncfiles').

GNU Screen and Bash

As pretty as GUIs are, sometimes it is most efficient to work in a text console which is why I find myself using GNU Screen. However, Screen's command starts with CTRL-A which is also Bash's move to start of line command. To have it work, use 'ctrl-a a'.

Also, screen sets the value of TERM to be screen so if you have any settings based on the TERM value, update it appropriately.

One thing about using screen is that you lose your terminal's scroll buffer so as line scroll past your view you can't just use the scrollbar to move up to see what you missed. Instead, screen has it's own scroll buffer that you can use. You can set the buffer size using 'defscrollback #' (where # is the number of lines) in your .screenrc or in the screen command line (ctrl-a). You can switch to the buffer with 'ctrl-a [' (and exit buffer mode with ESC). Navigation follows normal VI keys.

Finally, I noticed that hitting the delete key didn't send backspace as expected with using the OSX terminal. To correct that, add the following to your .screenrc:


termcapinfo xterm-color kD=\E[3~


This tip came from here.

How Bad Are the Chicago Bears?

The only thing that Bears fan can look forward to is for the Bears to continue to be humiliated so badly that the coaching staff and team management are forced to face reality and start making some changes. It's pretty sickening to hear them talk when they are 4-6 about how they're still in post-season chase. Give the fans some credit! I love the Bears and I cheer for them even when they lose, but please show some effort! Every week, it team looks dejected and seems like they are just trying to get home. It would be nice to see some emotion and passion from somebody. As you listen to the broadcaster in each game, they language they use to describe the team is the language used about a rebuilding team. Essentially, they've stopped talking about the current team and can only find positive things to say on which young players have the POTENTIAL to some day be a good player.

The Bears were so bad that on a nationally televised game Fox actually switched away to another game because the Bears played so badly. Nearly every week a team play the Bears and come away with some sort of record. Last week it seems like it was the first time in a long time that I saw the Bears have the lead even if it was short lived. Against the Vikings, Minnesota scored on 8 of 9 possessions. They are not even competitive anymore.

Saturday, November 28, 2009

My VIM cheatsheet

To help me learn VIM keys, I put together a cheat sheet which I load onto my desktop much like how I handle my calendar/todo.

I'm not sure how much this cheat sheet will help others because I left out the commands that I already know well and left the commands that I'm currently learning. I expect that I'll update the list as I get more familiar with VIM.


---- BUFFER ----
:e set buffer
:b goto buffer (next|prev)
:sp new window/file above
:vs new window left
:q close current window
:qa quit all windows
ctrl-w move to window
ctrl+w = autosize window
:ls list buffer
:bd buffer delete
:sav save-as
u undo
ctrl-r redo
. repeat
ESC ctrl-[

---- NAVIGATION -----
gg goto start of file
G goto end of file
:54 goto line
80| goto column
ctrl-g show file info
ctrl-e scroll up
ctrl-y scoll down
ctrl-b page up
ctrl-f page down
zt scoll line to top
w next word (ctrl+right)
b previous word (ctrl+left)
zi toggle folding

---- SELECTION ----
v visual select
shft-v line select
ctrl-v column select
y copy selection
p paste selection
= reindent
> indent
< unindent
:set list! toggle visible whitespace
xp transpose
r replace
s substitue
x delete char

Thursday, November 26, 2009

Trying to switch to VIM.

I've always been an EMACS user on UNIX and it sometimes seems like it can do EVERYTHING. The one problem with EMACS is that a lot of production systems (and even many non-prod) won't install it which means that when I'd have to use vi/vim and I'm just not as fluent with it. Especially since when I'm on those systems means that I'm trying to do fast debugging and navigation, being slowed down by my lack of experience with the editor is really frustrating.

I've decided to try to switch to VI/VIM to be the primary editor for awhile to force me to learn. There is no need to tell me that EMACS kicks butt (I agree), but unless you can get emacs installed everywhere, this is really more a decision based on my current situation.

Being Thankful

With all that has been going around, I'm very thankful of having my family and the friends who have helped us get through everything.

Happy Thanksgiving, Everyone!

Wednesday, November 25, 2009

Nice font for terminal and code editing

Terminus is a very nice looking font that is well suited for programming editors and terminals.

terminus font

It is an open source font and many linux distributions have it available. I haven't tried any for OSX, but you can compile for xterm on OSX/X11 from macports.

Pretty printing source code

Sometimes it is just more comfortable reading source code on paper, but printing directly from a text editor often gives an output that is ugly and wasteful. Just try opening up your source code in notepad, textmate, etc. and print. It might look very nice on your screen but on paper the fonts are big with lots of white space.

Printing source code is a different beast then printing narrative text and has some special requirements. The first is to include line numbers for easier reference. Different languages have different formatting and sometimes you want to print with color syntax to help find what you're looking for. It can also be helpful to print two pages on one sheet so you can see more of the code and reduce paper waste.

On Windows/DOS, programmer editors usually have features for handling these types of pretty source code printing. Strangely, none of the editors I've seen on OSX have it (TextMate, Eclipse, Smultron, etc.) and since I've been dealing with code more I wanted a solution.

Fortunately, OSX's UNIX underpinning allows me to use the classic enscript tool to handle this.


enscript -2 -q -C -Ec --color -f Courier8 -r -p OUTPUTFILE SOURCEFILE


This generates a Postscript file (default), with 2 columns (2), quiet mode (-q), line numbers (-C) , using C syntax (-Ec), in color with Courier 8 pt font (-f), in landscape mode (-r) to a file called OUTPUTFILE (-p) from SOURCEFILE.

You can find different language syntax available for the -E option with "enscript --help-highlight" and you can set different output formats besides PostScript with the -W option (i.e. html).

"-p -" will tell enscript to print to stdout so you can pipe it to lpr.

Friday, November 6, 2009

Fedora install needs to be quicker.

Upgrading my system from Fedora 8 to something more recent has been on my todo list for awhile and last night I finally took the plunge. I had already downloaded iso images for Fedora 10 and 11 so I was ready to do the install from the DVDs. I couldn't go straight from 8 to 11 because there has been some significant changes in the distribution so I had to first upgrade to 10 first.

The upgrade to 10 was pretty smooth but as with my previous experience, I had to manually clean up some dependency issues before I can do the first 'yum update'. I expected the upgrade from 10 to 11 to be smooth but I actually ran into more issues. Firstly, there was some problems on the first reboot where Fedora couldn't start X. It didn't tell me there was a problem and instead just hung on a blinking cursor. Booting into level 3 ('init 3') allowed me to get a command prompt where I could fix the various dependency issues again and do a 'yum update'.

While the hung screen is pretty serious (an average user might not be able to figure out the work-around), what annoyed me the most is how long it takes to do the first 'yum update'. That's because it updates EVERYTHING. First there was the 2 GB of download then the time to calculate dependency issues before it actually starts the update. What's the point of doing a DVD install if it is going to download everything again?

It would be nicer if there was an option of first download the system updates and then do application level updates in the background once the system is already up.

Friday, October 30, 2009

Moving on from Yahoo.

Well, the time has come for me to say goodbye to Yahoo! There are definitely some things I'll miss, but it is time to move on. I had a great experience here and learned a helluva lot. Now I'm looking forward to applying those skills I've developed at my next job. I'm not going far. Just up to the street to Google.

Friday, September 4, 2009

Upgraded to Snow Leopard (OSX 10.6)

Got Snow Leopard today and decided to upgrade. Install went smoothly and took about 30 minutes. The only glitch was after it was done I got that strange blue tinge screen, but a reboot corrected that. Here are the steps to upgrade:

Insert DVD and run the Upgrade installer.
Once upgrade, go to www.adobe.com to install the latest flash player since the one with Snow Leopard has a security hole.

--- The next are optional ---
Install XCode from the installer disc.
Install macport 1.8 for Snow Leopard
Follow the instructions to update macport packages: https://trac.macports.org/wiki/Migration

Tracking status of macports on Snow Leopard: http://trac.macports.org/wiki/snc/snowleopard

Saturday, August 29, 2009

Using ctrl-c/v/x on OSX for copy/paste/cut

Three very common keyboard function that I use is to copy/paste/cut. For my hands, I found it more comfortable to use the CTRL key instead of the COMMAND (apple) key along with c/v/x. To change the key binding:

create/modify the file: ~/Library/KeyBindings/DefaultKeyBinding.dict

with the following:

/* ~/Library/KeyBindings/DefaultKeyBinding.dict */
{
"^z" = "undo:";
"^x" = "cut:";
"^v" = "paste:";
"^c" = "copy:";
"^a" = "selectAll:";
"\UF729" = "moveToBeginningOfLine:"; /* Home */
"\UF72B" = "moveToEndOfLine:"; /* End */
"\UF72C" = "pageUp:"; /* PageUp */
"\UF72D" = "pageDown:"; /* PageDown */

}


Applications that uses the Cocoa AppKit text edit objects (i.e. TextEdit). However, not every application will necessarily support this. I noticed that Firefox does not which is very annoying.

For more details, http://xahlee.org/emacs/osx_keybinding.html is very useful.

To swap ctrl and command in Firefox/Thunderbird edit 'ui.key.accelKey' to 17 (about:config in Firefox, advance config in Thunderbird). Specifically, you can use one of the following:

17 Control (windows style)
18 Alt (unix style)
224 Meta (Mac OS command).

Thursday, July 2, 2009

Tuesday, June 30, 2009

Firefox 3.5 icon with version number

4965

Download the image here.

Firefox 3.5 is out and since those of us working on the web usually have multiple versions of the browser installed, having an icon with the version number on it makes it easier to identify the instance we're loading.

This is inspired by http://browserversionicons.com/firefox/

With the icon from Mozilla.

Instructions for running multiple instances of Firefox are here.

Tuesday, June 16, 2009

Red Cooked Pork

Found original recipe here: http://www.redcook.net/2008/01/18/hong-shao-rou-red-cooked-pork/

Ingredients:

* 1 1/2 lb. pork belly meat cut into two inch cubes
* 2 tablespoons sugar
* 3 cloves of garlic peeled
* 1-2 whole star anise
* 2 tablespoons soy sauce (老抽)
* 1/4 cup rice wine (紹興酒)
* 1 1/2 cups water

Preparation:

* Melt the sugar with some water in a small pot over medium high heat. Continue heating until the sugar is slightly brown.
* Brown the cubed pork in the pot
* Add brown it with the caramelized sugar. About 8 minutes.
* Put the garlic, star anise,soy sauce, rice wine and clear stock into the pot. Cover the pot and simmer over low heat. Cook for about 40 minutes. Stir the meat every 10 minutes to make sure the bottom of the pot does not get burnt. Remove the cover and turn the heat to medium high. Cook the meat for another 10 minutes until the sauce reduces to a smooth consistency.
* This dish, like most stew dishes, is better if left overnight and reheated the next day.

Sweet Green Bean Soup

This is a popular Chinese summer time treat.

1.5 cup green beans (mung beans)
10 cups water.
5 T sugar.

Wash the beans.
Bring water to boil.
Add beans and simmer at low heat for 45 minutes or until bean is soft.
Add sugar and stir.

Can be served hot or cold.

Monday, June 15, 2009

2009 NBA Champion: LA Lakers!!!

Every post-game interview last night asked how this championship is different from the 3 Shaq-Kobe ones. As a fan, this one was different then those three since this one came after a loss in the previous finals that led to an entire season where the focus is just on winning the championship. Maintaining the focus throughout an entire season must be so difficult that it should set this one apart from the others.

Thursday, June 11, 2009

Lakers vs Magic Game 4

A couple of observations from Game 4.

Beyond D-Fish's clutch 3s was how much energy and effort he brought to the game. He out hustled everyone in that 3rd quarter. Everyone, go watch him again. That's heart.

Kobe showed a little frustration when Howard had his arms wrapped around him during a foul, but it was through a complaint to the ref. He must have the patience of a saint because to have people draped over him on every play like that would piss most everyone off. I would guess that most players would've retaliated under that kind of foul and harassment.

A company is the people who work for it.

I ran across this article through Hacker News by an entrepreneur who had sold his previous company and realized that he needed to start a new company. The author definitely has that entrepreneur spirit of wanting to take action on ideas, but a few of his statements are also examples of the negatives views adopted by many who are in management and leadership positions.

"I hated having 85 employees. It had become a little hell. I needed to get away and clear my mind."


How sad to hear from their leader that he hated having to deal with them. Being in management and leadership positions means having a degree of power over the employees, but it also comes with a responsibility for those employees. Employees are people and not just pawns to fulfill the manager's whims.

Before accepting the job of a manager, think about what that position means because it can be very different from what your existing role is.

Tuesday, June 9, 2009

Google Apps for Business

I've been using Google Apps for Domains (don't confuse it with just apps I.e. Docs) and it is excellent. It is a great solution for small businesses or start-ups especially those with limited IT budgets.

Recently Google added support with Blackberry and with today's announcement that they are adding Outlook sync, the barriers to business adoption continue to fall.

Sunday, May 24, 2009

G1 Android

I've done an unsual amount of traveling (for me) this past month. I spent two weeks in Taiwan and after returning to the states for a week I traveled to Seattle. These trips allowed me to test my travel gears including the Android G1 phone and the iPhone.

I have had the G1 for awhile but no phone service for it. Since it is unlocked I decided to get a SIM card for it in Taiwan and use it while I was there. Getting and installing the card was super simple and I did it at a 7-11 store. It was a matter of putting the card in and turning it on.

As a phone device I found it to be excellent. Sound was clear and it was easy to use. The screen was sharp and overall responsive. One annoyance was that it accidentally dial too easily unless you lock the touch screen. The other annoyance was that the contact list was not easy to navigate and search. I am not sure why Google struggles with contacts on both its site and the phone.

The camera on the G1 is super especially compared to the iPhone. With 3MP and autofocus, it is a real camera. Its excellent intergration with Google means that it can hold its own as a PIM. Add to it the wifi and browser capabilities and you have a nice portable computer that fits into your pocket. For traveling, the G1 is very well suited.

The screen can be a bit larger as it's current size limits its use as a portable dock reader. The UI of its apps are not as uniform, and Android is not as polished as the iPhone. Its marketplace needs to be improved so more apps get built. Battery life is short and needs improvement for it to be a true road warrior.

The experience of using the G1 vs IPhone is like using a PC vs Mac. The advantage of a open platfom is variety but initially a less polished user experience.

Friday, April 3, 2009

Banana bread recipe

3 large or 4 regular size over ripe bananas
1.25 C sugar

0.5 lb (1 stick) unsalted butter, melted and slightly cooled
2 eggs, room temp
1 tsp vanilla

1.5 C all purpose flour
0.5 tsp kosher salt
1.5 tsp baking soda
0.5 C chopped toasted walnut (optional)

1. Preheat 325. 9"x5"x3" loaf pan.
2. Melt butter then let slightly cool.
3. Whip bananas and sugar in mixer.
4. Mix butter, eggs, vanilla together.
5. Mix flour, salt, baking soda, nuts
6. Whip (4) well and scrape down sides of bowl.
7. Add (5) to bowl and mix
8. Pour into pan and bake for ~1 hour.

(muffin pan: 16-20 mins)
(4 small loaf: ~20mins)

Saturday, March 21, 2009

I don't get Facebook

I'm not a heavy Facebook user which is probably why I didn't even really noticed that they changed their design to be more like Twitter. It doesn't matter to me what the page looked like 'cause I can click on the "profile" link and see my profile and see the friends list (yes, I know I can click on the friend list at the top).

The first time I really tried using Facebook was when I heard they were making themselves a "platform". People can write apps that other people can access through Facebook. That could be cool, but I always had a hard time finding apps unless I saw it on someone's profile. I eventually was able to find it, but don't ask me how. With the new design, I got lost again.

Eventually I found it it at the bottom of the page (Applications > Find More). So I found an app and I guess I "installed" it, but now have no idea how to put it on my profile page like other people do.

I'm guessing that if I bothered to spend 5 minutes understanding how Facebook work that I'd be able to figure it out, but given how people have been talking about design and using Google as a poster child for suppressing it, I'm asking "Why aren't people accusing Facebook of destroying design?" Google might not be "pretty" but it's design is simple and very functional.

3 pixels vs 4 pixels

Doug Bowman's post on leaving Google had a quote that has gotten picked up by many bloggers as representative of what is wrong with the engineering culture:

"I had a recent debate over whether a border should be 3, 4 or 5 pixels wide, and was asked to prove my case."


He doesn't give much more context about this debate, but it reminded me of some of my own experiences where I got involved with almost the exact same debate. In my case, the cause of the debate was almost always because there were multiple designers. Either it was two more more designers arguing about the width or it was after a product launch that the next designer decide that the width decision should be thrown out.

What drove engineers nuts was that because decisions are so arbitrary anyone can override the design at any time. Maybe Google is on the extreme end to demand numerical metrics to back up any decision, but for most engineers it was mainly that they wanted to understand the reasoning for a change. Otherwise, engineers would spend their entire lives changing the size of borders.

Designer's post overblown.

Apparently one of Google's visual designers decided to leave Google and wrote a blog post on why he is leaving. While he has all the right to tell the world his personal opinion on why the job wasn't good for him, I think the reactions to his post are way overblown. Unlike art or print media, software is very much about function.

Is Google destroying design?!? Why don't they ask the question," Are designers destroying engineering?"

Sunday, March 8, 2009

The value of Google Chrome

A friend of mine recently posted his thoughts on the "Chrome's overinflated importance". If viewed only as a web browser then it is just another entry in the various browsers that exists out there. However, I believe the true value of Chrome will be if it can change the way people and developers look at web applications.

In many ways, advancement in web development is hindered because developers and businesses have not been able to really think outside of limits imposed by the "WWW" of 10 years ago. Another way to say is that the world wants to move to using the Internet as a platform but we are still stuck on using the WWW as the platform instead.

There has been many attempts to try to break out of that mentality. The unfortunate term "Web 2.0" was one attempt (I think) although it never clearly articulated what it really meant and is now just a overused marketing term. In some ways, "Cloud" seems to be another way to break out from the mindset of "web development" to building applications on the Internet.

Chrome's importance to me is whether it can open up the developer's mind to new possibilities by providing them a tool that goes beyond building web sites and web applications. I hope that someday the "web" will move beyond being viewed as an interactive magazine or at least let the "web" be the interactive magazine while we're also using applications on the Internet.

Sunday, March 1, 2009

Installing pysvn on OSX Leopard

Here are the steps I took to install pysvn, a python module for subversion, from source on OSX Leopard.

Assuming you're using macports:

sudo port install python26 (follow any instructions it has)
sudo port install subversion (1.5.6 at time of my install)
sudo port install db43 (whichever version of Berkeley DB you installed, updated the sed line below pointing to the right directory).

Download the pysvn source code.

tar -xzvf [file you downloaded]
cd [directory where you uncompressed the file to]

python setup.py configure

sed -i .backup -e "14s@\(.*\) /opt/local/lib/libsvn_ra_dav-1.a \(.*\)/opt/local/lib/libdb-4.3.a \(.*\)@\1 \2 \3 /opt/local/lib/libsvn_ra_neon-1.a /opt/local/lib/libsvn_ra_serf-1.a /opt/local/lib/libserf-0.a /opt/local/lib/libsvn_fs_util-1.a /opt/local/lib/db43/libdb-4.3.a -lsasl2@" Makefile

make

sudo cp -r pysvn /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages

(sed line taken from here: http://ice.usq.edu.au/instructions/osx/developers_installation_guide.htm#id3)

Monday, February 9, 2009

Google Web Toolkit

I've been thinking about whether web development has gotten to the point where hand crafting web front-ends by hand is offering diminishing returns. The argument is that directly writing JavaScript, HTML and CSS will produce the most elegant and efficient code and I don't disagree with that although I have to wonder how many web developers really build such good code?

I started thinking about the argument that to really optimize one has to write in assembly. Eventually, though, compilers got so good that it produce better and faster code then most developers. Even if the code is not as optimized, the growing complexity of applications made it such that the amount of extra time it takes to code in assembly just doesn't seem to be worth such small gains.

GWT seems to be Google's answer to this. I want to take some time playing with this and see how it is. My only reluctance is diving back into Java.

Sunday, February 1, 2009

Starting a New Lunar Year

Last week marked the start of the new lunar year (Chinese New Year). The previous year was suppose to be a year of misfortune because it encompassed a double winter, and looking back at all that has happened in 2008 around the world that it seemed to fit.

I'm going into 2009 with a little more optimism and being thankful for all the good things in my life.