May 17

How to solve URL encoded slash problem in Apache?

If you are using Apache and if you are passing encoded slashes in URL then Apache http web server immediately returns a “404 (Not Found)” error when it encounters URLencoded versions of path separators or slashes in URL (Uniform Resource Locator). These are %2F for forward slash (/) and %5C for back slash (\).

The server simply rejects the URL without invoking mod_proxy or mod_rewrite.

Continue reading “How to solve URL encoded slash problem in Apache?” »

Permanent link to this article: http://abhilashkumar.name/2012/05/17/solve-url-encoded-slash-problem-apache/

May 02

How to get query string from a URL in Ruby?

If you have a URL in a string then use URI and CGI to get query string from URL:

url = http://www.domain.extension/folder?schnoo=schnok&foo=bar
u = URI.parse('url ')
p = CGI.parse(u.query)
# p is now {"schnoo"=>["schnok"], "foo"=>["bar"]}

Permanent link to this article: http://abhilashkumar.name/2012/05/02/how-to-get-query-string-from-a-url-in-ruby/

Apr 26

How to connect to MS SQL Server from Rails 3?

Mentioned below are the steps to connect to MS SQL Server from Rails 3, from Ubuntu 11.04:

Install Unix ODBC and FreeTDS using following command:

sudo aptitude install unixodbc unixodbc-dev freetds-dev sqsh tdsodbc

Configure FreeTDS by editing freetds.conf and entering SQL Server details

$ cat /etc/freetds/freetds.conf
[servername]
  host = hostaname
  port = 1433
  tds version = 7.0

Continue reading “How to connect to MS SQL Server from Rails 3?” »

Permanent link to this article: http://abhilashkumar.name/2012/04/26/how-to-connect-to-ms-sql-server-from-rails-3/

Apr 26

How to install Ruby 1.9.3 from source on Ubuntu?

I have installed it on Ubuntu 11.04

First you need to install the dependencies for Ubuntu via apt-get:

sudo apt-get installĀ build-essential zlib1g-dev libssl-dev libreadline-dev libruby1.9

Create a downloads folder in your home directory:

cd ~; mkdir downloads; cd download

Continue reading “How to install Ruby 1.9.3 from source on Ubuntu?” »

Permanent link to this article: http://abhilashkumar.name/2012/04/26/hello-world/