Posted on July 8th, 2008 by by Gubbi
Google released Protocol Buffers as an open source project today. It used to be an internal tool used by Google for passing serialized objects between applications. But frankly, reading through the introduction I don’t see what problem it tries to tackle that JSON can’t. I seriously doubt if PB is faster than JSON. Also, JSON is more generic and flexible than PB. Easier too. Perhaps PB as a project predates JSON. I see several having the same reactions as mine.
I am going to dig into documentations and discussions to make sense of the pros and cons of PB viz-a-viz JSON.
Tags: ProtocolBuffers, JSON, PB, Google
Posted on April 20th, 2008 by by Gubbi


Using gmail smtp server, JavaMail and Spring IOC, we can quickly put together a simple mail sending application, without any SMTP server installation. Check this out for a detailed description of using gmail as smtp server. Thanks to Enrico for blogging smtp spring configuration.
Assuming you have used Spring before, here is a short tutorial:
- Add mail.jar from JavaMail project to build path.
- In spring bean configuration file add:
1 <bean id=“mailSender” class=“org.springframework.mail.javamail.JavaMailSenderImpl”>
2 <property name=“host” value=“smtp.gmail.com”/>
3 <property name=“username” value=“${gmail_username}”/>
4 <property name=“password” value=“${gmail_password}”/>
5 <property name=“javaMailProperties”>
6 <props>
7 <prop key=“mail.smtp.auth”>true</prop>
8 <prop key=“mail.smtp.starttls.enable”>true</prop>
9 </props>
10 </property>
11 </bean>
12
13
14 <bean id=“templateMessage” class=“org.springframework.mail.SimpleMailMessage”>
15
16 <property name=“from” value=“notify@abcd-xyz.com”/>
17 <property name=“subject” value=“Mail Notification.”/>
18 </bean>
19
- Create a class MailNotifier where you send mails.
1 import org.springframework.mail.MailException;
2 import org.springframework.mail.MailSender;
3 import org.springframework.mail.SimpleMailMessage;
4
5 import com.abcd.beans.Member;
6
7
8
9 @author
10
11
12
13 public class MailNotifier {
14 private MailSender mMailSender;
15 private SimpleMailMessage mTemplateMessage;
16
17
18 public void sendNotification(Member pMember) {
19 SimpleMailMessage message = new SimpleMailMessage(mTemplateMessage);
20
21 message.setText("Dear " + pMember.getFirstName() + ",nSending test notification.");
22 message.setTo(pMember.getEmail());
23
24 try{
25 mMailSender.send(message);
26 }
27 catch(MailException ex) {
28 ex.printStackTrace();
29 }
30 }
31
32
33
34 @param pMailSender
35
36 public void setMailSender(MailSender pMailSender) {
37 mMailSender = pMailSender;
38 }
39
40
41
42 @param pTemplateMessage
43
44 public void setTemplateMessage(SimpleMailMessage pTemplateMessage) {
45 mTemplateMessage = pTemplateMessage;
46 }
47 }
48
- Add spring bean configuration for MailNotifier class:
1 <bean id="mailNotifier" class="com.abcd.modules.MailNotifier">
2 <property name="mailSender" ref="mailSender"/>
3 <property name="templateMessage" ref="templateMessage"/>
4 </bean>
5
- This is it
Check out Spring Reference for details about sending mails with attachments and using html templates for mail content. Let me know other methods of doing the same.
Posted on April 5th, 2008 by by Gubbi
Lets start with this:

I received Vista SP1 update. I have installed Vista on a 13 GB partition, and I had only around 700 MB left. After downloading the update, it said minimum 2GB required. So I set out to explore what is eating so much memory. Turned out Windows folder took a good 10.2 GB of it. And digging deeper the system32 folder took 4.17 GB and there was this other folder named winsxs which took another 4.78 GB. I deleted 1.23 GB promptly from the SoftwareDistribution/Download/ folder which has all the downloaded updates which it doesn’t delete after update installation. Now I wanted to see if I can get rid of this winsxs. And what turned out is quite hilarious and obnoxious.
It is a directory to solve the “dll hell” problem. Windows XP has this directory but much much lesser in size. But there is an innovation involved in Vista. They wanted to solve the “dll hell” problem by storing all the versions of dll that ever comes in through my updates and all versions of dlls that are required by the softwares I install. And when you un-install these software, their dlls remain, as they “could-be-shared”. They chose this method as a great way for giving some amount of backward compatibility. Well this is my frustrated explanation from my reading in the forums. Look here for the official explanation. The baseline is, you can’t delete it, can’t compress it meaningfully, can’t get rid of it in any way. However, there seems to be a way out of this as detailed here, but it cripples certain features.
I am in awe of the brilliant Microsoft crew who came up with this brilliant brute force algorithm for an operating system function. Vista is the first operating system I’ve used for which 13 GB is not enough. I have not installed any programs in the Vista drive. AppData takes up rest of the chunk. Clearing all browser cache and other unwanted data couldn’t help. I was left with 1.8 GB and the update wouldn’t install. How much more ridiculous can it get? And how could they ship such an OS? How could they take this part so lightly. I have seen people commenting about more than 6.5 GB for this winsxs folder. All for the sake of compatibility. Maybe MS employees have unlimited disk storage at their disposal, but who were they shipping this OS to? There were instances where after downloading some updates, there would be just 4MB left on my Vista installation drive…. and sometimes I would be like, “Wow, it can still run with just 4 MB of space left… cool.” But it was terribly slow and then I would restart it and look around to clearing browser caches and such. All in all it has been a constant headache. Oh, and I did good by searching for the “Hibernation File Cleaner” which appears during disk cleanup offering to free up .99 GB for me. And earlier before an update, “Per user queued reports” and “Per user archived reports” used to offer me a cool 2.5 GB of free space. But had I went around “cleaning” them up, my entire 13GB would have been cleaned for me. And cleaning Hibernation File Cleaner cripples the Hibernate feature. Were their testing teams having sex and getting drunk while testing this? Makes me wonder.
I now wish to “get away” from this installation asap and use something sane for the optimal use of my machine.
May Vista rest in peace.

Posted on April 3rd, 2008 by by Gubbi
Very few themes/styles are available for Movable Type 4 as of now. The nice themes over at The Style Archive do not yet work for MT4. However 3 of those themes have been ported and I’m using the Hemingway theme for my blog over at Gaa Gaa Gubbi.
Installing these themes is very easy. This is one of the things I liked in MT4 over WP2.5, although number of themes available for WP far outnumber MT4. No downloads required. Just point to a url, select preferred layout and you are done.

Steps for installing new themes on MT4:
- Open Design —> Styles.
- Click
beside the Categories heading.
- Enter the url of the site using the theme required.
- Select the preferred layout: “2 columns Wide, Thin”, “2 columns Thin, Wide”, etc.,
- Done !!
You can also see Live Demo of the themes by clicking on the theme links above.
Posted on April 2nd, 2008 by by Gubbi

I searched a lot for a free hosting service where I can test run a movable type 4 open source blog. You can access the installed blog here.
The problem I faced was file size limitation in most free web hosts, which is usually 300KB. After a lot of looking around I found this very good web host which provides free plan with lots of advanced features at x10hosting. This host has much higher file size limits, provides cPanel and Fantastico, CGI, PHP, 3 MySQL, 3 domains, 3 sub domains, and lots more.
Below are the steps I followed for installing the above blog. (Usual disclaimers apply. I do not guarantee that the below steps will apply for everyone. They are just what worked for me. Please keep a backup of all files somewhere. Read through the entire how-to before deciding to proceed with it or not.)
- Download MT4.11 nightly build and extract it.
- Create a MySQL DB on x10hosting and associate an user name with it.
- In the extracted folder, rename mt-config.cgi-original to mt-config.cgi.
- Open mt-config.cgi file in an editor and change the following lines:
CGIPath <URL>
Where <URL> is the url from where the movable type directory will be accessible. If you follow step 6-7 as mentioned, this url will be http://<domain_name>/cgi-bin/mt/. Also note the ‘/’ at the end. See step 6 to understand this better.
StaticWebPath <URL>
Where <URL> is the url from where the mt-static directory is accessible. Based on step 8, this url will be http://<domain_name>/mt-static. See step 8 for more details.
- Under MySQL section add the DB settings (database, user, password) appropriately based DB created in step 2. Delete all other DB sections.
- Open all .cgi files (except mt-config.cgi) one by one in an editor and just after this line
use strict;
Add
BEGIN { $ENV{'MT_HOME'} = '/home/<userID>/public_html/cgi-bin/mt/'; }
Where <userID> is the username taken at the hosting provider.
- X10hosting provides a home directory inside which there are these 2 directories: /public_html/cgi-bin and /www. Create
a directory called mt under /public_html/cgi-bin.
- Copy all the contents inside the extracted directory on your PC to /public_html/cgi-bin/mt. Now, mt directory will be accessible using http://<domain_name>/cgi-bin/mt/.
- Copy just the mt-static directory under /www directory. This mt-static directory will be accessible using http://<domain_name>/mt-static url.
- Change the permission of all .cgi files in /public_html/cgi-bin/mt/ to 755.
- Open the url http://<domain_name>/cgi-bin/mt/mt.cgi in browser. This should begin the Movable type blog installation.
After this, its all easy and simple to setup the blog. Let me know how it goes
Tags: movabletype4, mtos, movabletype open source, free hosting, hosting, x10hosting, installation