Friday, June 8, 2012

rss-motor v0.0.4 ~ a rubygem to ease up your RSS interactions

started a new rubygem project 'rss-motor' (http://rubygems.org/gems/rss-motor) to aid all RSS consuming code by providing the entire (or filtered as per choice) of feeds as Array of Hash values per Feed Item.
===============================================
 ||}}  //\  //\ _ ||\/|| ||@|| ~++~ ||@|| ||))
 ||\\ _\\  _\\    ||  || ||_||  ||  ||_|| ||\\
===============================================

I tried it in a new project 'rss-fanatic' (https://github.com/abhishekkr/rss-fanatic) making to help out RSS Feed fanatics collecting required content without pain of browsing/saving/downloading. Though RSS-Fanatic project is just started and shall be usable in some time soon.



Here is just a mini HowTo easily power you code with rss-motor:

First, obviously you'll need to install the gem
$  gem install rss-motor
or if luckily you already have a Gemfile usage, add following lines to it
source "http://rubygems.org" gem 'rss-motor'

Now, currently available engines from the rss-motor
  • simple way of getting all the items as array of key=value
    puts Rss::Motor.rss_items 'http://news.ycombinator.com/rss'

  • get an array of items filtered by one or more keywords
    puts "#{Rss::Motor.rss_grep 'http://news.ycombinator.com/rss', ['ruby', 'android']}"

  • to filter even the data of content available at >link/< field present in item plus normal filter
    puts "#{Rss::Motor.rss_grep_link 'http://news.ycombinator.com/rss', ['ruby', 'android']}"

now go on, ride your own rss-bikes.....

Wednesday, June 6, 2012

Get Set Go Lang ~ part#1

Get Set GO Lang
part# 1
_________________________

What Is Go Lang?
(in case you just came here while curious web surfing)


Go is an OpenSource programming platform developed by Google (and contributors) to be expressive and efficient at the same point.
It's distributed under BSD-style License
It's a concurrency favoring, statically typed, compiler-based language. Though it declares to be giving ease like dynamically typed interpreted code.
_________________________

On your mark, Get Set GO
(getting started with the quick boost usage)

To directly start playing with Go Lang, visit http://play.golang.org/,
where you can directly type/paste in your go-lang code in an online editor and run to get output.

Just a small ++HelluvaWorld code-piece
package main 
import ("fmt"
        "time"
        "os"
        "math" )
func main() {
  fmt.Println("Today is ", time.Now().Weekday())
  fmt.Println("env as ", os.Environ())


  fmt.Println("A Pi on Ceil looks like ",
               math.Ceil(math.Pi), 
      " and a Pie on Floor looks like", 
      math.Floor(math.Pi))
}
[] Installing it for local & full-flown development practice http://golang.org/doc/install would guide you getting 'go' working on your Linux, FreeBSD, OSX & Win platforms.
_________________________

Rewind before the Start Line and take your First Leap
(first useful step to starting use of Go Lang)

[] quickie at variables and constants, a look at GO's declaration style
// var used to declare variable with type at end
var a, b, c int
// direct initialization doesn't require providing type
var x, y, z = 1, true, "yes"
// constants just require a 'const' keyword
const newconst = 10
func tellvar() {
a, b, c = newconst + 1, newconst + 2, newconst + 3
// inside a function, even := construct
// could be used to assign and not use 'var'
clang, java, ruby := "dRitchie", "jGosling", "Matz"
fmt.Println(a, b, c, x, y, z, clang, ruby, java)
}
now, you also know '//' is to comment as in C/C++ and more.

[] mobilizing functions
just an emulation of 'math' libraries 'pow' method (also a look at using for loop)
package main 
import "fmt" 
func pow(x int, y int) int {
  a := 1
  for i := 0; i < y; i++ {
    a = a * x
  }
  return a
}
 
func main() {
  fmt.Println( "2 to the power of 5 is ", pow(2, 5) )
}

[] some function parameters style, the pow above is same as
func pow(x, y int) int { ... }

[] function returning multiple values
dream come true of how a function can return any number of values (also use of if condition)
func plusminus(a, b int) (int, int) { 
     if a > b {return a+b, a-b} 
     return a+b, b-a
}
  or could be like
func plusminus(a, b int) (plus, minus int) { 
     plus = a + b 
    if a > b {   
                   minus = a - b  
     } else {    
       minus = b - a  
     }   
     return
   }

usage:
plus, minus := plusminus(1, 2)
fmt.Println("Plus: ", plus,
            "\nMinus: ", minus)

[] more to go..... in more to come


_________________________

Shops to Go
(other fine links to Go, until next part of this tutorial comes)
_________________________