blog

Getting wired and wireless working on ubuntu 9.0.4

It might be the case that earlier wireless was working and then it stopped workingFollow the simple steps here....1. Restart networkingsudo /etc/init.d/networking restart2. Disable the "Support for Atheros 802.11 wireless LAN cards" on system/administration/Hardware Drivers, and reboot your box.3. Restart sudo rebootThat's it, Cheers!Still having problem follow the instructions here

Hpricot scraping in ruby

Include gems/library required before getting startedrequire 'hpricot'require 'net/http'require 'rio'# Pass website url to be scrapedurl = "www.funonrails.com"# Define filename to store file locallyfile = "temp.html"# Save page locallyrio(url) < rio (file)# Open page through hpricotdoc = Hpricot(open(file))Apply hpricot library to get right contentsdoc.at("div.pageTitle")doc/"div.pageTitle"doc.search("div.entry")doc//"div.pageTitle"Hpricot API Reference click here

Passing commandline parameter (arguments) to ruby file using optparser

Ruby file accepts from command prompt in the form of array.Passing parametersruby input.rb TOI DH TimesNewAccessing parameters # input.rb p ARGV # => ["TOI", "DH", "TimesNew"] p ARGV[0] # => "TOI" p ARGV[1] # => "DH"Optparser : parses commandline options in more effective way using OptParser class.and we can access options as hashed parameters.Passing parametersruby … Continue reading Passing commandline parameter (arguments) to ruby file using optparser