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
table.diff!(actual_table)
end


references:
https://github.com/aslakhellesoy/cucumber/wiki/multiline-step-arguments
http://railscasts.com/episodes/186-pickle-with-cucumber

Sunday, December 19, 2010

Transition to HTML using HTML5 tags as CSS classes

So instead of
...
Use
...

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 ;-)

referece: http://lists.kde.org/?l=kde-devel&m=95436660012782&w=2

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
save_and_open_page
end

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
#
test:
...
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
# http://objectliteral.blogspot.com/2010/12/installing-homebrew-on-osx.html
#
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/1.7.3.3/etc/bash_completion.d/git-completion.bash" ]]; then
source "/usr/local/Cellar/git/1.7.3.3/etc/bash_completion.d/git-completion.bash"
fi

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 http://rvm.beginrescueend.com/releases/rvm-install-head ) # 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

Else

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
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


reference: http://www.blog.bridgeutopiaweb.com/post/how-to-install-rvm-and-rails-3-on-snow-leopard/

Installing Homebrew on OSX


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

curl -Lsf http://github.com/mxcl/homebrew/tarball/master | tar xvz -C/usr/local --strip 1

brew install git

git clone http://github.com/mxcl/homebrew.git /tmp/homebrew
mv /tmp/homebrew/.git /usr/local/
rm -rf /tmp/homebrew


references: http://userprimary.net/posts/2010/08/19/installing-homebrew-for-OSX/

Difference between staff and wheel groups in OSX

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

reference: http://superuser.com/questions/20420/difference-between-default-groups-on-mac-osx

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:
http://touristinparadise.blogspot.com/2010/11/samsung-galaxy-s-how-to-install-froyo.html

Upgrading Kernel for lagfix:
http://touristinparadise.blogspot.com/2010/11/samsung-galaxy-s-how-to-install.html

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