Monday, December 27, 2010

CTM 3G modem settings in OSX

Just arrived in Macau. Friend passed me his CTM (a mobile service provider I reckoned) 3G dongle to use during my stay. Googled around and found the correct APN + username + password settings.

Telephone Number: *99#
Account Name: guest
Password: guest

Under "Advanced", use

Vendor: Generic
Model: GPRS (GSM/3G)
APN: ctm-mobile

Thursday, December 23, 2010

Diffing tables in Cucumber

Then /^I should see the following within "([^"]*)" area:$/ do |selector, table|
actual_table = tableish("table#{selector} tr", "td,th" ).to_a


Sunday, December 19, 2010

Transition to HTML using HTML5 tags as CSS classes

So instead of

Difference between l10n & i18n

On Wed, Mar 29, 2000 at 11:39:22PM +0200, Antonio Larrosa wrote:
> David Faure wrote:
> >
> > > Hi,
> > >
> > > I just wondered why the directories are called i10n in
> > > kdebase, and what the difference to i18n is....
> >
> > l10n = localization (country-specific settings such as how to represent
> > numbers, dates, money, ...)
> > i18n = internationalization (translations)
> Btw, does anybody knows why are they called with those names ?
> I've been wondering for a long time :-)

Hehe, yes.
Count the number of letters between the starting and the ending
letter, in both words ;-)


Friday, December 17, 2010

Debugging: Show the webpage after a cucumber step

# Example
Scenario: Signing in
When I go to the home page
And I fill in "username" with "john"
And I fill in "password" with "john"
Then show me the page

# Actual implementation
# Uses webrat's method
Then /^show me the page$/ do

Suppress NOTICE messages from Postgresql when running rake cucumber

# Notice messages spewed
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index ...

# Fix
# Add to database config in config/database.yml
min_messages: WARNING;;

Thursday, December 16, 2010

Stop rvm from complaining about world writable /usr/local/bin

# Error message
/Users/velvetpd/.rvm/gems/ruby-1.9.2-p0@babylon/gems/bundler-1.0.7/lib/bundler.rb:199: warning: Insecure world writable dir /usr/local in PATH, mode 040777

# Fix
# This was probably caused by instructions to install Homebrew
chmod o-w /usr/local/bin
chmod o-w /usr/local

Wednesday, December 15, 2010

Git completion for git installed via Homebrew in OSX

# In .bashrc

if [[ -s "/usr/local/Cellar/git/" ]]; then
source "/usr/local/Cellar/git/"

Monday, December 13, 2010

get forward (alt-f) and backward (alt-b) word working in OSX terminal

Under "Preferences > Keyboard" check "Use Option as Meta key"

Installing Nokogiri on CentOS

sudo yum install -y libxml2 libxml2-devel libxslt libxslt-devel
sudo gem install nokogiri

Installing postgresql on CentOS

sudo yum install postgresql postgresql-devel postgresql-server

mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data

sudo su
su postgres

/usr/bin/initdb -D /usr/local/pgsql/data

createuser OR
psql -c "create role ROLE with superuser"

Installing rvm on CentOS

sudo yum install git
bash < <( curl ) # issue "rvm notes" and follow instructions on dependencies

Sunday, December 12, 2010

Install postgresql using homebrew on OSX

If there's existing postgres install,

brew rm postgresql --force


brew update
brew install postgres

Then follow instructions on printed by homebrew

initdb /usr/local/var/postgres
cp /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

Installing rvm on OSX

brew install readline
brew install most
sudo gem install rvm #install rvm
rvm install 1.8.7 -C --enable-shared,--with-readline-dir=/usr/local
rvm install 1.9.1 -C --enable-shared,--with-readline-dir=/usr/local
rvm install 1.9.2 -C --enable-shared,--with-readline-dir=/usr/local
rvm 1.8.7 --default


Installing Homebrew on OSX

sudo chown -R $USER:staff /usr/local

curl -Lsf | tar xvz -C/usr/local --strip 1

brew install git

git clone /tmp/homebrew
mv /tmp/homebrew/.git /usr/local/
rm -rf /tmp/homebrew


Difference between staff and wheel groups in OSX

User admin belongs to "staff" group while User root (the only one) belongs "wheel" group.


List groups in osx

more /etc/group

Tuesday, December 7, 2010

Using gnome-mplayer to play embedded mpeg videos in Firefox

sudo apt-get install gnome-mplayer mozilla-mplayer

# Remember right click on the video in Firefox and configure video output to be X11.

Sunday, December 5, 2010

Upgrading my Samsung Galaxy S to Froyo

I went through the ordeal of installing Samsung Kies, their mobile/player manager and getting it to recognize my phone, only to find out that the custom firmware on my phone installed during a visit to Samsung Service Center couldn't offer an upgrade through Kies.

But thanks to the wonderful internet, there're other ways to flash the ROM to the latest and greatest. The links below provide a very clear step by step instructions.

Flashing to Froyo:

Upgrading Kernel for lagfix:

Wednesday, December 1, 2010

Finding source location for a rail method

# Eg. if you want to find source location for DateTime.tomorrow

irb(main):001:0> DateTime.method(:tomorrow).source_location

Blog Archive