Skip to content

My Cup of Tea

I figured that my blog needs a kickstart from the almost year long break. And what better way to end a seista, than with a cup of tea!

So I am dedicating this post to Tea. Given below is the recipe for making tea (All other recipes are wrong).
Recipe for the perfect Indian Tea

(serves 2 usually…  the limit of tea tends to zero as friends tend to infinity)

Ingredients

Water, Milk, Dried Black/Red Tea Leaves(I prefer ‘Brooke Bond’), Ginger and Sugar

Heat one and 1/3rd cups full of water (no more, no less). As soon as the water looks like it is going to boil, smash about an inch long piece of ginger and add it immediately to the water with two teaspoons of sugar. In exactly one minute, add about 2/3rds of a cup of milk (In case the milk is cold, you may need to heat it separately before adding it in… microwave it for 40 seconds or heat it for 5 minutes). As soon as the mixture starts to boil, add one heaped teaspoon of tea. Bring the mixture to a boil without spilling it, and then stir it once and simmer it for a minute. Strain the tea in two cups using a strainer. Drink it while it is hot in teaspoon sized sips with puckered lips while talking about politics, philosphy, arts, science, math, sports, or any other topic of your choice. Repeat at least twice daily for good mental health.

There are two additions one must make to the tea in the summer and in the rainy season. In the summer, one must add 1/5th of a teaspoon of powdered cardamom seeds along with the ginger to the tea every other day. In the rainy season, about ten lemon grass leaves folded and wound together in a tight bundle, must be added to the tea every day. Tea may be consumed only by individuals 10 years and older.

Advertisements

Using Gparted Live CD to partition a hard drive

Gparted livecd is one of the best ways one can partition an external hard drive. It is probably the safest way too. It is particularly useful in at least one scenario.(which I encountered interestingly) Consider that, you just received that flashy new external hard drive with Zillions of bytes of capacity on your office address (because you are single and don’t want to go to the UPS/FedEx “central customer center” to collect it). You wanna try it out right away. But it is not formatted so you decide to go about doing that. You plug it into your Win-do-do workstation and it never shows up. So you cannot format it. You go into My computer > Manage and you don’t have admin privileges… what are the odds of that!

Here is a brief walkthrough for using gparted.

1. The first step is downloading and writing the gparted live cd. Go here and download the gparted live cd iso. Then write it to a blank disc. (Such a cd can then become a permanent part of your computer utility cd stack)

2. The next thing to do is connect your external drive and boot from the live cd. Put in the Gparted livecd in. Shut down your computer. Connect your external hard drive to it. Restart your computer and go to the boot menu or bios to change the sequence in which you computer boots. Boot menu is usually triggered by f12 just when the computer starts.

3. Gparted Livecd(or rather debian) will ask you a couple of questions while booting such as keymaps, screen resolution and stuff. Keep all the default options (hopefully you wont have a lot of issues here) . Once you boot into gparted, it will detect your main hard drive and show the hard drive stats. Select the external hard drive in the dropdown menu. It should show up with all of its drive space unallocated. (At this point you make an instant choice between deleting your computer’s main drive and driving you boss mad and obviously resulting in you getting fired from the company, OR formating your external hard drive and everything stays the way it is. Assuming it is the latter choice, read on)

4. Now select the unallocated space for your external hard drive and make partitions. First set a disklabel, by selecting set disklabel from device the drop down. Just stay with the defaults. Next select a primary partition. this partition is necessary in case you want to boot from your hard drive later. Click on new and select primary partition in the menu. If you want just one partition for your entire drive, select the entire unallocated space. Else, modify the options accordingly. Specify a disk label if you want. If you want this drive to work well with windows select the drive format as NTFS. If you work with both linux and windows, most linux machines recognize NTFS so you should not have a problem, but you might want to consider FAT32. If you plan to use your hard drive with linux alone, go for ext2 or ext3. Don’t worry if you do not know any of these file systems. Just pick ntfs. You now should see a pending operation in the gparted status bar. Be warned though that there might be issues resizing NTFS partitions later, as gparted has its limitations.

5. In case you did not select all of your drive space as a primary partition, the rest of your unallocated hard drive space can be formatted as an extended partition. For more information on partitioning terminology, look here. Select the remaining unallocated space and click new. Select extended partition in the options menu. Once you select an extended partion, the space will still be unallocated but it will be under the extended partition. So select this unallocated space and make as many logical partitions in it as you need. Once you are done, review and edit any options you want before you proceed further because in the next step you apply the partitions permanently.

6. Select apply all pending operations from the partition drop-down. If you have a big hard drive and a lot of partitions, this can take a while.  And once that is done, shut down gparted  and your computer, and you should have a formatted external hard drive hungry for data.

Note: disklabels can be easily added, modified, or deleted, so in case you forgot to add a disk label… you can go back to gparted and add it.

*Update: After partitioning your hard drive with an ext3 partition in linux, the permissions are tied to the root user. So normal users cannot use that partition. This can be easily corrected by using chmod.

eg. ‘sudo chmod a=w /media/<yourdisklabel>’

CAS in Ruby on Rails

Ruby on rails has its own implementations of the CAS client and CAS server thanks to Matt Zokowski. The rubycas-client is a Ruby client library for JA-SIG’s Central Authentication Service (CAS) protocol, while the server is an ultra-lightweight implementation of the CAS authentication server following the same protocol.

More information on the project and the download links can be found here – http://code.google.com/p/rubycas-client/ and here – http://rubyforge.org/projects/rubycas-client

This is a great single solution to all your CAS needs in ruby on rails. It works very well with linux so be sure to give it a try if you work with Linux. However, the sample code given in the project pages is not the best way to implement a CAS system for your ruby on rails application. I tried to refine the installation for Noobs such as me.

FOR THE RUBYCAS-SERVER

First thing to do is make sure that the CAS server for your organization is working. I case you don’t have one, try the handy rubycas-server gem. It is in version 0.6.0 but I tried the 0.5.1 when I started. The instructions here are pretty simple and straightforward so I am not repeating them. In case you run into problems, try editing the config.yml file because that is where one would usually go wrong. Some configuration options explained here
The important things to look out for are the database config such as sockets and ports, and the right port numbers to run the server.
a) server: select the server eg. webrick, mongrel and add server info such as port, ssl certificate locations
b) database: enter the database configuration this varies according to db used
c) authentication: setup table info, authentication type and settings here
d) look and feel: you can change this to suit your organization, this just involves adding a theme.css file to /themes
e) logging: set logging location and level
f) other: set the ticket expiry times

Now if you plan to use ssl (I do not recommend this for testing and again mongrel does not seem to support ssl) you can try to make a self signed certificate by following the steps here.  Also, make a table of users and passwords in the cas server’s database. So for example mysql is selected as the database, then according to the config.yml default options, there should be a ‘casserver ‘ database and there needs to be a table titled ‘users’ with the columns ‘username’ and ‘password’ in it.

Next would be to implement the CASClient in our application.

FOR THE RUBYCAS_CLIENT

The home page of the rubycas-client shows one way to implement it as a plugin. However, I was using the casclient as a gem. So that did not help me much. Besides I had started with an older version of 1.1.0 instead of the newer 2.0.1. Whichever option you choose, the CAS client is also simple to install and use. For installing it as a gem, do a ‘gem install rubycas-client’ first. You can also force the versions by specifying them. The ruby forge api mentions the simplest way to install the ‘CAS filter’ for your controller is to add the line ‘before_filter CASClient::Frameworks::Rails::Filter’ or ‘before_filter CAS::Filter’ to your controller depending on which version of casclient you have. Version 1.1.0 requires the latter command. However, as mentioned further in the api, it is not the most efficient way. A better way is to ask CAS once and store the authentication info in session. Given below are the methods I used to implement casclient on my app. To change the method to suit the latest casclient version, just change the lines to the latest casclient commands (casfilteruser is replaced by cas_user etc.). I had to verify that users were authenticated both by CAS and by the local database.

cas filter sample code

Hello World!

This is my first post on my shiny new wordpress blog.

I hope this blog is as helpful as the name sounds.

For those who are not so familiar with Marathi, Dandekarancha Salla stands for ‘Dandekar’s Advice’

In every post I would like to give people some advice on some topics of my interest.

And as my interests vary from time to time, I would probably cover a vast range of topics eventually.

So wish me luck!

And oh yes. Hello World!