I have successfully installed the MySQL driver for Ruby on Windows and Mac OS X but I had not installed it on Ubuntu until today.
I am assuming that you have already installed the MySQL server. I am using MySQL 5.1.
$ sudo apt-get install mysql-server
Install the MySQL database client library. I am not certain of this but I believe that the number '15' in 'libmysqlclient15-dev' indicates the version. This is apparently the most current one and the default version on Ubuntu 10.4 as of today.
$ sudo apt-get install libmysqlclient15-dev
Install RubyGems if you have not done so already. I am using Ruby 1.9.1.
$ sudo apt-get install rubygems1.9
If everything was successfuly, then you should be able to use the mysql RubyGem in your Ruby scripts.
Friday, August 20, 2010
Installing Windows 7 Professional on HP Pavilion tx2000
Yesterday, I did a clean install of Windows 7 (32-bit) on my HP Pavilion tx2000 computer. I was very surprised and glad that I did not need to install much in order to get the computer to work. I feared that I would need to install many more drivers, for instance, the tablet driver.
Additional drivers installed from the HP support website:
I hope this helps somebody somehow.
Additional drivers installed from the HP support website:
- Realtek High Definition Audio
- Enables the mute button to change color to red when volume is muted.
- Source: http://h10025.www1.hp.com/ewfrf/wc/softwareDownloadIndex?softwareitem=ob-75992-4&lc=en&dlc=en&cc=us&os=4062&product=3744020&sw_lang=
- HP Quick Launch Buttons
- Enables most of the quick launch buttons on the screen border
- rotate, settings, media (prev, play, next, stop)
- Auto-rotates screen when you convert the laptop to a tablet
- Source: http://h10025.www1.hp.com/ewfrf/wc/softwareDownloadIndex?softwareitem=ob-78740-1&lc=en&dlc=en&cc=us&product=3744020&sw_lang=&os=4062
- DVD Quick Play button on the border of the screen
- I am not going to fix this. I thought it was annoying anyways. I kept on pressing it accidentally.
- Startup time is now 57 seconds.
- From being powered off to displaying the google homepage.
- Shutdown time is now 10 seconds
- With Vista it would literally get too hot for your lap. Now it always stays cool. I would dare to say that it stays cooler than my 13" Macbook.
I hope this helps somebody somehow.
Thursday, August 12, 2010
Formatting Hex Strings in Ruby
This method converts a 1 or 2 character string representing a hex number into a 2 character string representing a hex number.
Usage examples:
Implementation:
Usage examples:
irb(main):001:0>format("a")
=> "0A"
irb(main):002:0>format("2D")
=> "2D"
Implementation:
def format_hex_string(byte)
byte.upcase
byte.to_i(16) >= 16 ? byte : "0" + byte
end
Cartesian Product in Lisp
One of the things I do quite often is calculate the Cartesian product of two lists. Here is my solution to problem in Lisp.
Usage Example:
Implementation:
Usage Example:
> (product '() '())
NIL
> (product '(1 2) '(1 2 3))
((1 1) (1 2) (1 3) (2 1) (2 2) (2 3))
Implementation:
(defun product (list1 list2)
(let (templist '())
;;iterate through the first list
(dolist (item1 list1)
;;iterate through the second list
(dolist (item2 list2)
;;create a list from the current items and push it onto the temporary list;;
(push (list item1 item2) templist)
)
)
;;reverse the temporary list to display it correctly
(nreverse templist)
)
)
Subscribe to:
Posts (Atom)