Packt Author Award 2009 – Vote for my book!

It’s a year to the month since I published my first book – Ruby on Rails Web Mashup Projects. I didn’t even realise it — time really does fly. Just got a mail from my publisher announcing that they’re having an award for the best author of the year. If you’re one of my readers, or if you enjoyed reading this blog please consider voting for my book.

Here’s the link – http://authors.packtpub.com/content/packt-author-award-2009. Just click on Vote Now! and select Ruby on Rails Web Mashup Projects in the list of books to vote for. Thanks!

Advertisements

Using the Yahoo Address Book APIs with Rails

I’ve recently taken up contributing my technical blog posts that involve Yahoo! technology on the YDN blog. This is my first post to the blog. I’m not repeating it here since you can read  it all in YDN, so if you’re interested in the Yahoo Address Book API, I would encourage you to drop by.

Book published!

I haven’t written up anything recently because things has been moving at a dizzying pace both at work and with my other activities. The good news is finally published! After so many months of hard work nailing down those chapters and correcting and fine-tuning them, it’s finally done! I’m the proud author of a new book and it has been the fulfillment of a long-time dream.

You can get a copy of it from my publisher or from Amazon or from the other online bookstores mentioned here.

City360

I wrote this mashup application for my book originally but extended it during the Easter holiday weekend, spruced it up and made it more user-friendly (I hope) and changed it name to City360. The whole idea behind this app is to provide everything that you want to know about a city (hence 360 degree view on the city — corny name, I know).

So far what it can do is:

  1. Locate for you in an online map where the city is
  2. Give you information on nearby places of interest (click on the link and it will be shown on the map!)
  3. Tells you about the available hotels in the vicinity of the city
  4. Forecasts today’s and the next few day’s weather in that city
  5. Shows a mosaic of pictures taken by people on the Web, associated with this city (click on the picture to popup a bigger pic)
  6. Lets you convert your local currency to the city’s currency
  7. Tells you the current time at the city and compares it with your current location

Check it out at http://city360.saush.net

Let me know what else you think can improve this app!

Ruby-PayPal

I did a simple Ruby gem to allow easy access to PayPal’s NVP APIs recently. It isn’t much at this point in time, though both the Direct Payment and Express Checkout has been coded, only Direct Payment has really been tested. Here’s the writeup directly from the project site at http://ruby-paypal.rubyforge.org.

Installing Ruby-PayPal

A lightweight ruby wrapper for PayPal NVP APIs. To install type the following at the command line:

$ gem install ruby-paypal

Using Ruby-PayPal

It‘s critical that you understand how PayPal works and how the PayPal NVP API works. You should be relatively well-versed in the NVP API Developer Guide and Reference. You should also visit and register yourself with the PayPal Developer Network and get a Sandbox account with in the PayPal Development Central.

Note that this library only supports the API signature method of securing the API credentials.

Direct Payment

To use credit card payment through PayPal, you need to use the DoDirectPayment APIs:

username = <PayPal API username>
password = <PayPal API password>
signature = <PayPal API signature>

ipaddress = '192.168.1.1' # can be any IP address
amount = '100.00' # amount paid
card_type = 'VISA' # can be Visa, Mastercard, Amex etc
card_no = '4512345678901234' # credit card number
exp_date = '022010' # expiry date of the credit card
first_name = 'Sau Sheong'
last_name = 'Chang'

paypal = Paypal.new(username, password, signature) # uses the PayPal sandbox
response = paypal.do_direct_payment_sale(ipaddress, amount, card_type, card_no, exp_date, first_name, last_name)

if response.ack == 'Success' then
   # do your thing
end

The above code is for a final sale only.

Note that the credit card number is checked against a modulo-10 algorithm (Luhn check) as well as a simple credit card type check. For more information please refer to http://en.wikipedia.org/wiki/Luhn_algorithm and http://en.wikipedia.org/wiki/Credit_card_number

Facebook application/Ruby on Rails mashup

Been busy fiddling around with Facebook application development, came up with one for my upcoming Ruby on Rails mashup book.

http://apps.facebook.com/job_board

This application allows you (as the Facebook user) to search for jobs (currently using Indeed.com) using information from your work history, education history and current location. The list of jobs can then be displayed on an online map (Google Maps) and news (from DayLife) and blog entries (from Technorati) can be displayed about the company that posted the job. The application is written with Ruby on Rails using RFacebook.

If you want to know how I wrote this application, remember to check out my book when it comes out!