Archive for category Programming

What’s in my bookshelf?

As always I’m pretty late in writing my book reviews. This time it’s been well over 6 months since I finished reading the book “Beginning Ruby” (first edition) by Peter Cooper. I have to say is this by far the best Ruby book that I’ve read so far. (This is out of a 13 book collection that I own on Ruby programming.) I’ve always been a fan of Apress “Beginning” title’s, and this book is definitely not the exception. Although this book is technically considered for beginning/intermediate programmers wanting to dive to the wonderful world of Ruby, I feel this book is perfect for all levels of programming expertise. The authors does a wonderful job explain the concepts of each chapter and slowly building you to what will be the next chapter. Like Apress’ “Beginning Perl” book help me tremendously in learning the language, I have to say this book taught how to program in Ruby.

I’ll definitely come back to this book and use as a reference. Anyone new or already experienced using Ruby, will definitely benefit from reading this book. I hope this book (all editions) gets the high praise from the Ruby community, which it deserves, as in my eyes this is a classic programming book and I see this title as the Llama/Camel book for the Ruby World.

Chapter 1: Let’s Get it Started: Installing Ruby
Chapter 2: Programming == Joy: A Whistle-Stop Tour of Ruby and Object Orientation
Chapter 3: Ruby’s Building Blocks: Data, Expressions and Flow Control
Chapter 4: Developing a Basic Ruby Application
Chapter 5: The Ruby Ecosystem
Chapter 6: Classes, Objects, and Modules
Chapter 7: Projects and Libraries
Chapter 8: Documentation, Error Handling, Debugging, and Testing
Chapter 9: Files and Databases
Chapter 10: Deploying Ruby Applications and Libraries
Chapter 11: Advance Ruby Features
Chapter 12: Tying it Together: Developing a Larger Ruby Application
Chapter 13: Ruby on Rails: Ruby’s Killer App
Chapter 14: Ruby and the Internet
Chapter 15: Networking, Sockets, and Daemons
Chapter 16: Useful Ruby Libraries and Gems

Beginning Ruby (2nd Edition)
5/5

Tags: ,

Ruby cli_mailer

After much nights of Ruby programming and many revisions, I finally manage to have an beta release of Ruby cli_mailer.

I originally planned on writing a full mail (Unix command line email client) like program in Ruby. Though I was able to have an almost identical console interface to mail’s reading, viewing, and deleting emails, using POP. I was having a really hard time, keeping the connection alive after a certain number of seconds after initiating the connection.

So instead of having the incoming POP email client like usage that mail provides, I instead wrote the application to only support the mail sending features almost similar to mailx.

I would think developers or anyone wanting to send email from a Linux/Unix server without the hassle of sendmail, postfix, exim, etc… may find this simple program useful. I know I do, since I always find myself wanting to easily send emails from the command line whenever I’m using or doing some sort of testing on a Virtual Machine.

If you’ve ever used mail on a Linux/Unix system to send email messages, Ruby cli_mailer is practically identical.

Basic Usage:
Will get prompt to write email message that gets sends to root@rubyninja.net and blinds copy ccemailaddress@rubyninja.org

rcli_mailer.rb -s 'Title of message' -c ccemailaddress@rubyninja.org root@rubyninja.net

Will email the contents of sendmail.cf to root@rubyninja.net

cat /etc/mail/sendmail.cf | rcli_mailer.rb -s 'God help me' root@rubyninja.net


rcli_mailer.rb -s "I'm so sorry" -c jrsysadmin@rubyninja.net root@rubyninja.net < /etc/postfix/main.cf

NOTE: Ctrl-D is NOT supported by Ruby cli_mailer at the moment, you'll need to use the '.' (dot) character
to send the email message.

I tried to make Ruby cli_mailer as moduler as possible, since I'm planning adding the project to github, and I already have in mind more features to add into it.

Enjoy :-)
rcli_mailer-01.tar.gz

Documentation
rdoc

Tags: ,

RDoc: Documenting Ruby scripts

RDoc makes documenting Ruby scripts be really simple. RDoc is fairly simple to use, as it has a straight forward SimpleMarkup syntax which the RDoc utility uses to traverse the entire Ruby script and automatically generate pretty html documentation pages.

Now I have documentation for the dead simple Ruby script that I wrote to encode videos for my iphone.
iphone_encode.rb documentation

Hacker humor

While reading the regex portion of Apress’s Beginning Perl Second Edition by James Lee, the following sample code totally made my day.


#!/usr/bin/perl -w
use strict;

$_ = "There are two major products that came out of Berkeley: LSD and UNIX";

s/(\w+)\s+(\w+)/$2 $1/;

$_ = ucfirst($_);
print $_, "?\n";

3 years and counting

It’s been three years since this blog came into existence and it doesn’t look like I’ll be posting any meaningful or relevant content to it anytime soon.

New domain name registered: perlninja.pl

I may not be a perl ninja (just yet) but the domain name kicks ass.

perlninja.pl

Goodbye Eclipse and hello vim

Apparently Apple doesn’t think its a good idea to ship vi with syntax highlighting turned on by default, giving how really easy it is to enable.

I simply had to edit the /usr/share/vim/vimrc file. Full instructions are in http://www.geekology.co.za/blog/2009/03/enable-syntax-highlighting-other-options-in-vim-mac-osx-leopard

Novice Programming

I started developing my very first web application from scratch earlier this week.  It will remain a secret as I will try to make some money from it. It will be written entirely in PHP and backed by MySQL. Hopefully I would have an alpha or yet even better a beta release by the end of the year. I’ve said enough.

Quest towards self-taught computer programming

After a three week hiatus I’ve got back againg reading my PHP and Bash shell programming books.

Bash

Writing shell scripts

I’m tired of writing shell scripts all night long. Tired but not feeling like sleeping yet.