Roshan Book

My Tech Notebook

Category Archives: Blog

Learning Ruby Part 10 Decision Making

== –> It compares values

!= – > If not equal to

< – > less than

<= – > less than equal to

> = –> greater than equal to

> –> greater than

&& – > When you want to test more than one conditions


Learning Ruby Part 9 Expressions





It gives 9

Assigning value of variable to variable



Now if we change value of d to 3, f still has value 33.





Same thing could be written as


Same thing could be done with –, *, /

Learning Ruby Part 8–Variables

We can create Methods that don’t belong to any class.

Declaring a common method

def crap

puts “I am a crappy crap”


Calling Method directly



Adding value to variable



Few things to keep in mind

A variable should start with letters or _ .

No spaces allowed

No symbols like %

Variables are case sensitive

Learning Ruby Part 7–Strings

String means bunch of text like “my name is manish”


Declaring a string

My name is Manish

Methods of Strings

.length  – >Returns number of characters. It includes space

.upcase –> Converts everything to uppercase

+ –> It adds two strings

.reverse-> It reverse the strings

.reverse.upcae – > Here we added two methods for a string. It will reverse and change string to uppercase

Full list of string methods can be found here

Learning Ruby Part 6–Argument

Learning Ruby Part 5–More on Objects

In Ruby every thing is an Object.

When we write 12, it is actually an object of class called FixNum.

To find out what class objects belong to, use




Kernel methods are common methods,which any class can used.

Some examples of Kernel methods



For kernel methods, we can directly write it, without mentioning class.

Learning Ruby Part 4–Methods

Methods are something which Objects do.

Defining a Method

class Manish
def talk
puts "Hi, my name is Manish"


Notice the two ends. One end , ends method and other one ends class. Now we have a class Manish having a Method Talk.


Calling Method

Objects are characteristics of Class and Methods are what Classes do.

Learning Ruby Part 3 – Inheritance

Inheritance is simply copying all the attributes from a base class to new class. It will save you lots of typing.


class Animal

attr_accessor :name, :age , :trait


This is how we declare a base class

class Dog < Animal


And this is how Dog class copies attributes from base class Animal. Now Dog has same attributes as Animal.

Adding Additional Attributes

Suppose you want to add extra attribute called type, declare Dog class like below

class Dog < Animal

attr_accessor :type


And now we have added attribute to Dog class, which is not in Base class “Animal”


Add complete read write access in Ubuntu

What is the Remote Posting URL

Windows live writer is a great tool to publish on wordpress/typepad/blogger etc. While configuring windows live writer for my wordpress site, a point came when they asked for

Remote Posting URL in the format http://<hostname>/<wp_path>/xmlrpc.php


Now to get passed that you need to follow two steps


Step 1. Go to wordpress cms>>Settings>>Writing and enable Atom publishing protocol and XML-RPC

Step 2. For remote posting url , use following format

If wordpress is at root. Add folder location after if that wordpress is installed in a folder.


%d bloggers like this: