Showing posts from July, 2012

ProxyPass issue

I was trying to ProxyPass the app to another server
But ran into a strange problem.

ProxyPass worked when I called but failed when any uri was added to root(

Like gave

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /login.

Reason: DNS lookup failure for:

Where we find the problem is:

Code for ProxyPass:

ProxyPass               /
ProxyPassReverse        /

Solution, I needed another slash at the final, so, it should be:


ProxyPass               /
ProxyPassReverse        /

Now it works \m/ .

rails migration like filename in linux

Creating files with date like rails migrations with datetime in file name in linux

Modulo operation in Ruby

Today I was stumped by a very simple yet awesome problem by my friend Sandip

What is the answer of  :  7 % -2 
and to the surprise ruby irb printed it as : -1 

After some research I what I found about this and why here is explanation and links

From Ruby Programming Language, O,really

Division, Modulo, and Negative Numbers

When one (but not both) of the operands is negative, Ruby performs the integer division and
modulo operations differently than languages like C, C++, and Java do (but the same as the
languages Python and Tcl). Consider the quotient -7/3. The floating-point result is –2.33. The
result of integer division must be an integer, however, so this number must be rounded. Ruby
rounds toward negative infinity and returns –3. C and related languages round toward zero
instead and return –2. (This is just one way to characterize the results; no floating-point division
is actually done, of course.)

An important corollary of Ruby's definition of integer division is that, in Ruby,…