Tuesday, June 29, 2010

how to get perl module version

An easy way to do it is to use cpan:

$ cpan -D module_name

For example:

$ cpan -D HTML::Template::Extension

Sunday, June 27, 2010

debian repository

I can't remember since when that default debian repository became:

http://cdn.debian.net/debian/

For example (from grml_2009.10):

/etc/apt/sources.list.d/debian.list

deb     http://cdn.debian.net/debian/ sid main contrib non-free
deb-src http://cdn.debian.net/debian/ sid main contrib non-free

This "cdn.debian.net" seems to be a kind of load balanced servers.  Theoretically, it should be good.  But, not for me.  I don't really know why I always have problem with "cdn.debian.net".  Maybe, my dns servers are not good?  I tried with my local ISP's dns servers, Google Public DNS servers and OpenDNS.  All of them have the same "not found" problem.

Anyway, I just always change it to:

ftp://ftp.debian.org/debian/

instead so my debian.list becomes:

deb     ftp://ftp.debian.org/debian unstable main contrib non-free
deb-src ftp://ftp.debian.org/debian unstable main contrib non-free

and all the "not found" problems are gone!

checking information on battery status

On your notebook computer, you can use:

acpitool

to check the status of the battery.  And here is a sample result:

unsigned_nerd@vaiosucks ~ % acpitool
Battery #1     : discharging, 99.82%, 03:20:37
AC adapter     : off-line
Thermal zone 1 : ok, 51 C

It seems there are many other useful functionalities which I will consult its manpage for more options to play with my vaio.

how to use our custom dns servers with dhcp

You know when you use dhcp and some times by default it receives dns servers from dhcp server which override what you want.  An easy way to overcome this is to add the line below into /etc/dhcp3/dhclient.conf:

prepend domain-name-servers 8.8.8.8, 8.8.4.4;

This will prepend your favourite domain nameservers first before the ones from dhcp server.  (8.8.8.8 and 8.8.4.4 are Google's public dnd servers which I use as an example.)

Tested on Grml 2009.10 (Debian based).

Saturday, June 26, 2010

search for music using your voice by singing or humming

http://www.midomi.com/

I successfully searched for "how do i live" with my voice but it was like 3rd attempt as my English speaking skill is below average.

My purpose was actually to search for "Guantanamera".  I couldn't find it from googling as I thought it was "guan-ga-ta-me-ra".  I tried midomi with my voice and failed all the time too.

Finally, I found a trick by opening the music with speaker and I pointed the microphone to it.  Yes, it worked!

Friday, June 25, 2010

grayscale monitor in macosx

I had been looking for a way to have an e-ink-like monitor that I can use with my computer.  The closest technology I had found was iLiad, an e-book reader which is well-known for its openness for hacking.  Of course, it is a linux-based. People have been able to run x window, xclock and etc on it together with using keyboard remotely.  Yes, it looked promising.

However, just today, I happened to find out Pixel Qi's hybrid monitor!  You can search it from Google.  There are many stories about it.  Rumour has it that this special monitor will be shipped around September to December this year (2010).  What is cool about its monitor?  It is the same quality as e-ink!  Its refresh rate is a lot higher than those e-ink out there like Amazon kindle or Sony Digital Reader that I am using.  It even supports colour (still e-ink!).

I will buy it for sure.  But, meanwhile, I have also found a way to turn everything on my screen to be grayscale by going to:
  • System Preferences
  • Universal Access
  • Display
references

Tuesday, June 22, 2010

how to eject an iPod under Linux

Just say it in short:

You need to send an ALLOW_MEDIUM_REMOVAL to the usb device.
The easiest way is with eject.
references:

% ps auxww

"% ps auxww" is what we should use to list all processes (for unlimited width)

Notice we specify "w" twice.

Sunday, June 20, 2010

firefox custom search

Today I wanted to add a custom search to my Firefox.  It is the search box on the top right corner of Firefox.  By default, I saw:
  • Google
  • Yahoo
  • Amazon
  • ...
But what I wanted is urbandictionary.com.  It's so easy to add a custom search in Firefox.  I opened Terminal, login as root, then:

vi /Applications/Firefox.app/Contents/MacOS/searchplugins/urbandictionary.src

I then entered xml code below:

<search
  name="urbandictionary"
  method="GET"
  action="http://www.urbandictionary.com/define.php"
  queryCharset="utf-8">

  <input name="term" user />
</search>

I tested it with MacOSX.  An example here is urbandictionary.com.

Thursday, June 10, 2010

How to hibernate a mac

With new mac (current year is 2010), we can hibernate our macintosh computers by manipulating power management settings via this command:


$ sudo pmset hibernatemode 1

Then, the next time you "sleep" your mac, it will hibernate instead.  Make sure you wait until the white LED turns off which is when you can unplug the power cord.

I can confirm that this method works with MacBook Pro and MacMini (current year is 2010).

Note that this is not a hack as "pmset" is an official tool which you can read its manpage on your system via:

$ man pmset

You only need to set this property just one time and it will be set forever until you set it to something else later.

For those who hates UNIX's way of doing things for some reason (even though you are running MacOSX which is a UNIX system), you can try this:


And get a D from me.

Thursday, June 3, 2010

tircd - url shortening

In tricd, a cool twitter client, if you want to use the url shortening feature, you need to make sure you have Perl module:

  URI::Find

One possible way to install this Perl module is by:

  perl -MCPAN -e 'install URI::Find'

This module is used by tircd to parse URLs from our tweets.