Setup locales in Ubuntu

In a fresh Ubuntu, not having the locales setup, it shows warning every time while installing any software/library and while stopping/restarting as well.
You can setup the required locales easily.
The following example shows the simple steps to setup the en_IN UTF-8 locale.

Step 1

Edit or Create the file /var/lib/locales/supported.d/local and add the required local in the file as follows

  en_IN UTF-8

you can add more locales in new lines.

Step 2

reconfigure your system’s locales by issuing the command

  dpkg-reconfigure locales

Thats done!

Filed in: locales, ubuntu

by: sur

No Comments

Installing SVN with ra_dav support for http and https protocols

I was not able to setup the SVN on the suse linux as easy as on Ubuntu. In Ubuntu I think its simply by apt-get install subversion, but here even after compiling the source I was not able to enable the support of ra_dav module for http and https protocol. Later on after all the research I finally did by properly installing neon with required configuration options needed by SVN for ra_dav and thought to consolidate them all as a blog post. So here it is…

Pre-requisites

  • tzdata
  • expat
  • apr
  • apr-util
  • neon

First, install all the tzdata and expat with legacy commands 1) ./configure 2) make and 3) make install. without any specific conguration.

Install the apr(Apache Portable Runtime) like above as well.
Now install the apr-util by specifying your apr

./configure --with-apr=/usr/local/apr
make
make install

The apr usually resides at /usr/local/apr if its not there in your machine, first find the directory using
find / -type d -name apr
then mention the apr in the apr-util configuration.

Now, its better and more configurable to install neon as a separate library and then to configure subversion accordingly.
Configure and install neon from the neon source

./configure --with-ssl --with-pic --enable-shared
make
make installl

after installing neon check the configuration of neon from the executable file neon-config(which usually goes in /usr/local/bin/neon-config) by issuing the command neon-config. This will show the configuration options for neon. The configuration for –prefix shows the default(/usr/local) include path of installed neon library. For configuring the subversion we need to use this default include path or the path(–prefix) if you have mentioned while installing neon.

Now configure and install the subversion as

./configure --with-ssl --with-apr=/usr/local/apr --with-apr-uitl=/usr/local/apr  --with-neon=/usr/local
make
make install

Now check the ra_dav support by issuing
svn –version
it will show the supported modules.

Filed in: ra_dav, svn

by: sur

8 Comments

Rails-Tip : Use Capture to wrap a part of View in a variable

The view helper method capture provides this functionality to wrap a section of the view template in a variable and can be used multiple times in the view.

Usage :

<% @message = capture do %>
  You can earn a lot, if you use your brain!
  <%= link_to "Click here", earning_url %> to know more!
<% end %>

Advantage:

If its needed to render a section of template code, we usually go with partials. Capture is specifically useful when partial is only going to be used in just one view template. As there will be this variable available throughout the template, we can use it as many times as needed instead of partial.

Filed in: rails, rails-tip, rubyonrails

by: sur

3 Comments

Defining function inside a function using def

The function(s) defined within a function works fine with any hierarchy only within the main object but gives NoMethodError inside a class.

Lets exemplify it!

Here are the example of both main object and inside a class…

[source:ruby]
def person
def author
p “I am author”
end
def reader
p “I am reader”
end
def publisher
def authorized
p “I am a authorized publisher”
end
end
end

person.author # => I am author
person.reader # => I am reader
person.publisher.authorized # => I am authorized publisher

class Person
def publisher
def authorized
p “I am a authorized publisher”
end
end
end

Person.new.publisher.authorized # => NoMethodError
[/source]

Its an unexpected behavior in the main object. I don’t know whether its a bug or the feature. But as Matz says it will be removed in the future version of ruby, might be in 2.0

Filed in: ruby

by: sur

1 Comment

Simple Captcha : Update

After getting loads of emails, I’ve put the RMagick back in the plugin simple_captcha to provide various image styles and different level of distortions. The main reason for including it back is that people found it was hard for to apply their own styles.
Still the filesystem is not used in the plugin, neither for the secret code nor for the images. The generated image is directly rendered on the web page instead of storing on the server so that there won’t be any trouble for the distributed environment with clustered servers.

Filed in: simple_captcha

by: sur

Comments Off

Seriously Hurt!!

If all that happened to one of the greatest living programmer, its really hurting and I am seriously hurt!! Zed is an exceptionally great techei. The Author of the Mongrel Web Server who deserves to be honored with the salutes of all we guys who are running their business on the top of Rails by deploying the web applications on Mongrel with a pride.

Zed Shaw - The Man ranked #1 on WorkingWithRails. God!! Still hard to believe that the guys have treated him like this… For me(and I think for every human being) its quite natural to have respect for a person/company if I am benefiting out of his work. Moreover, the work is free to use!!
I respect Matz, Nobuyoshi, DHH, Zed, Jamis, Rick and all the great guys who writes/contributes plugins/snippets/libs for ruby/rails/mongrel as I am using Ruby/Rails/Mongrel for my benefits.

ZED, my hearty thanks to you for providing the Mongrel web server.

Filed in: zed

by: sur

2 Comments

Simple Captcha : Update

Finally after long wait, the next stable release of the fun-du, simple and useful plugin SimpleCaptcha is here!. Major changes have been incorporated to the plugin in this release 1.2.0 of the plugin.

Which includes…

  • Removal of RMagick
  • Removal of using FileSystem
  • Compatible with distributed environment with multiple clustered servers
  • Complete hassles free plugin!! No issue while integrating with capistrano

And many more things which makes this plugin even more lighter and easier to use. Read here for more details. I’ve moved the plugin’s details on the separate page( http://expressica.com/simple_captcha.) for info, discussions and comments.

It will be good to alias the SimpleCaptcha with Zero Dependency Captcha.

Do not forget to Recommend Me if you’ve liked the plugin.

Wanna say something ? Drop your comment on this page

Filed in: simple_captcha

by: sur

No Comments

BarCamp Delhi 3 : Less Ruby

barcampdelhi3

I presented on Ruby Tricks in BarcampDelhi3, I had much more things to present but due to shortage of time I got chance to show very few of them. I got some good feedbacks of the session, anyone who loved ruby, liked the session… PHP guys are still finding it hard to accept the Ruby, Rails.
Manik and Akhil presented Amazon EC2 services, also there was quite a useful session by the Amazon’s Jitesh on Amazon Web Services S3 and EC2. Greg presented good usability stuffs.

There wasn’t any other session related to Ruby or Rails… I was missing Ruby there. Also after the BarCamp, many guys asked me if there can be more Ruby/Rails related stuffs.

Good News! We are planning ruby related events as RubyCamp which will mainly related to Ruby and RubyOnRails.

Join the group rubycamp@googlegroups.com for the information about upcoming Ruby events.

Filed in: barcamp

by: sur

2 Comments

BarCamp Delhi 3

Everything is set to have a great geeks’ gathering here at BarCamp Delhi 3. There gonna be some useful sessions. Its a good kick start of this winter in Delhi.
This is my second BarCamp, in the first one.. the BarCamp Delhi 2 I didn’t get a chance to present there but this time am presenting a session on Ruby Insights.
Over this year a lot of things have been changed on myside… I am more into business now along with keeping the pace of upcoming technologies, ruby, rails and all what a geek loves to have.
If you have something to talk about a new Web startup Business, Ruby, Rails, Technology, it will be my pleasure to talk to you.

Filed in: barcamp

by: sur

2 Comments

Simple Captcha reloaded

Hi all,

After really long time, I have started the further development for enhancements on the plugin Simple Captcha. Keep an eye here… You will gonna find nice things. I have some really required, useful and cool things to implement and get it to the version 2.0 with all things incorporated in that. There are a lot of things to be committed by the version 2.0… meanwhile there will be 1.x versions with one-two features added in each version.

I am also planning to move the homepage as a separate page from a simple blog post… So, that it can be a centralized page for the reference.

Filed in: simple_captcha

by: sur

8 Comments