Sunday, May 23, 2010

Undo git add


git reset HEAD PATH_TO_FILE

Friday, May 21, 2010

"No more PTYs. Sorry, could not find a PTY" error in GNU Screen

It's a /dev/ptmx file permission problem.

chmod a+w /dev/ptmx

No root user created for mysql in Ubuntu Hardy


/etc/init.d/mysql stop
mysqld --skip-grant-tables &
mysql -u root mysql
mysql> INSERT INTO user VALUES ('localhost','root',password('newpassword'),'Y','Y ','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y', 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','' ,'','','',0,0,0,0); 

Saturday, May 15, 2010

Turning on ALT keys in Mac OS X Terminal

Under Terminal "Preferences", make sure to check the ""Use options as meta key" in the "Keyboard" tab

Friday, May 14, 2010

Installing Hamachi on Mac OS X Snow Leopard

reference: http://www.command-tab.com/2008/08/29/how-to-run-hamachi-on-leopard/

Remember to download and install Tun/Tap package!

http://tuntaposx.sourceforge.net/

After that just download and install hamachi for Mac OS X

https://secure.logmein.com/products/hamachi/list.asp



cd /Users/you/Downloads/hamachi-0.9.9.9-20-osx
sudo ./install
hamachi-init
sudo /usr/sbin/tuncfg
hamachi start
hamachi login
hamachi join NETWORK
hamachi go-online NETWORK

Cannot pair up newly bought Aztech 109E with existing Aztech 110E + 110EW pair.

Aztech Homeplug models 108*, 109*, 110*, ie. 200mbps series, are supposed to be able to work with each other. Had trouble pairing up newly acquired Aztech 109E with already existing 110E* pair.

The solution was to reset the Private Network Name that the existing pair was using. This can be done by simply pressing the "Simple Connect" button for ALL the pairs for 10secs.

'BadAlloc (insufficient resources for operation)' errror message while playing mp4 using mplayer

Fixed this by specifying video driver as such

mplayer -vo x11 PATH_TO_VIDEO

Selecting GNU screen profile in Ubuntu Lucid Lynx

screen is now managed by byobu package

byobu-select-profile

Monday, May 10, 2010

Streaming radio using mplayer


mplayer -playlist RADIO_STREAM_URL

Tuesday, May 4, 2010

Finding uninvoiced fees in rails


# Models

Class InvoiceItem < ActiveRecord::Base
  belongs_to :fee
end

Class Fee < ActiveRecord::Base
  has_one :invoice_item
end

# Namedcope in Fee model

namedscope :uninvoiced, {
  :conditions => "fees.id NOT IN (SELECT fee_id FROM invoice_items)"
}