Category Archives: Own Creations

Why can’t Vista be consistent?

We have an internal server based uploader that handles uploading of Zip files. The app checks for the type of the file uploaded and then decides what to do with it.

When that app was initially tested, I found a strange bug where ‘certain’ zip files from Vista were failing to upload. I later found out that a regular zip file (read as in XP or Winzip) has a type ‘application/zip’. But the zip files created on Vista (by ‘sending’ them to compressed folder) had the type ‘application/x-zip-compressed’. Why? I wondered, but was happy to resolve the bug.

I started having the same problem on Vista again since day before yesterday. XP uploads are fine. It occurred to me that it might be a similar problem. I checked the file type and indeed that was the problem. Now, Vista’s compressed folders have type ‘application/binary’. WTH? I tried zipping up the files on XP and then copying it over to Vista and got the same result. I then tried to upload the file from XP over the network (shared folder) and again got the exact same result. I believe, Vista (or even other OSes) copy file locally from the shared network and then send it for upload. Finally tried to upload the file using XP….and it worked.

I updated my Vista box a couple of days ago with the regular updates from MSFT, I think that’s what caused the change in the type. Now, I need to find if zipping the files with 7-zip has the same effect as ‘compressed folders’.

I wonder who and why that change was authorized/implemented?

Update: Seems like after a few updates it is fixed now. May be was a bug.


I read about Zookoda at problogger. I investigate more about RSS 2 Email services and found this helpful link. I think I would have liked Yutter too, but I already had signed up w/ Zookoda, so I used it for one of my upcoming blogs.

I had another idea of “contextual” email subscription since a few weeks, but wasn’t sure how to handle a bulk of emails. Now, I think Zookoda might have a solution for me. Below is the message that I sent to them.


I like the service so far. It is really simple and powerful.

I wanted to build a subscription system for my another website, but I think it will take up a lot of resources. Here is what I wanted and would love to see in Zookoda:

I have a feed with News articles and each article is tagged with a few tags. I wanted to have a tag based subscription. Ex: If I subscribe for the newsletter for the tag ‘ipod’, then I should receive an email (instantaneous or a digest) for all the News articles that are tagged with ‘ipod’.

I can easily send the tag to Zookoda, when the user submits the form with his/her email address. Zookoda should be able match that tag with what is in the feed and thus send the relevant post(s) to the subscriber. This system should also be able to handle multiple tag subscription and hence aa subscription manager (page) for the subscriber.

Please let me know if this is something you can provide.

Thanks, Gaurav

Initially, I wasn’t thinking of writing this application using feeds, but my internal db. Mapping the subscribers to the tags is hardly an issue with me. The only problem I have is handling such a huge amount of processing and email sending. My problem is that, I will have to create a custom newsletter for each of the subscriber and then email it to them. If there are only a few subscribers (less than a hundered), it should be OK, but if there are a several 100 subscribers, some kind of system would be required to send emails in batches.

Does anybody know of any software/service that can handle a huge number of distinct emails for each subscriber? How does the mailing list softwares handle the email sending?

Object Oriented PHP

I have had a strange relationship with Object Oriented Programming. I always wanted to program in OO, but for one reason or the other did not (or shall, I say could not.) I first started OOP with C++ while studying. The whole concept of OOP appeared to be complex and I could not see much use for it. I was happy with the good ‘ol functions and random code snippets. I wrote code in OOP for homework where it was must.

Then, I learned PHP from here and there. I forgot functions and started writing random code. If I had to reuse some code/functionality, I preferred copy pasting the 10 – 15 lines of code rather than writing a function. This was the time when I was learning PHP and trying to write “fun” scripts, which would echo viewer’s IP Address, play around with strings, etc.

Once I started taking apart some serious applications such as CMSes, Buletin boards, etc. I realized the importance of functions. It was so easy to change one line of code (in a function) in a 150 line script (which was one of 30 or so files) and see the change wherever that function was called. I realized how important was ‘include()’ in PHP.

After this, there was a time in my life when I started writing my own code and developing some applications/web sites completely by myself. I was happy with the functions but wanted to venture out with the new OOP PHP.

It all happened with one of my first projects (I guess an year ago?) While planning for the project, I decided to use classes. The planning phase passed, I started coding. When I was almost done with the coding, I realized there wasn’t a single class in my 9 – 10 file big project. Defiantly there were a lot of functions.

After a few months, I had another idea and started working on it. I remembered the pain from copy pasting ‘mysql_fetch_array’ etc. So, I again decided to code using classes. This time I had some success. I at least wrote a couple of classes. One of them was an abstraction layer over mysql. It made my life much easier with all those queries. It was more like plug n play.

Now, I am working on another project and I (firmly) decided that I would write the whole application in OOP. So far I have had 95% success, there are about 3-4 classes. This is an extensive project, which might include well above 50 – 60 files. Creating classes for certain tasks might be an overkill, so I would refrain myself from doing so. I think the classes have made my life much easier this time. I can see that the coding for the front end would be a piece of cake and defiantly much cleaner.

If OOP made life easier (my teachers told me that too), then why do I keep going to the un-organized coding? I thought about it a bit and came up with the most likely reason. I and may be most of the other coders get ideas instantaneously. There are times when I am sitting in front of the computer at 1:30 in the night and suddenly some wicked feature for my site would strike me. Instead of waiting, noting it down, planning, I would straight away jump and start writing the code in the fastest way I can. The fastest way generally is to write the code in an un-organized fashion. I would write a few lines and then look at the application (and feel happy) and keep doing this recursively until I achieve the feature that struck me. If I get addon ideas, I would keep appending them to the code that I wrote and never revisit the code to “beautify” it as it is perfectly functional on the web site.

I am sure a lot of other programmers do the same. I think it is time to change the habit and be more planned about the addons/features as I am planned about the initial project.

BTW for those of you who don’t know much about PHP OOP, here are a couple of tutorials about OOPing in PHP.


PHP freaks

Why you should use Yahoo Publisher Network?

In my previous post, I suggested that Yahoo Publisher Network is evil due to its strange legal terms and the buggy code.

But now I am saying that you should use YPN atleast once, if you get approved. Why this change of heart? Does YPN pays a lot more than Adsense? Does it have a lot more contextuality to the content?

I haven’t been successful to use the Ads on my site yet, but I found the root cause of the issue. I was able to show Yahoo Publisher Network Ads on one of my test websites. Right now its just showing 0% APR for Credit Card and Ads, but I can’t blame Yahoo for that, as that site doesn’t have any content (just comment spam)

I haven’t even observed a single impression in the YPN reports yet, but when I see my Google Adsense reports, I see a rise in my CPM, as compared to September’s CPM. The Avg. CPM from Sep. 30 – Oct 2 is 33% more than September’s CPM. This doesn’t mean that I am claiming that Adsense has increased my CPM after I have started using YPN, but pointing that it can be a possibility.

I have had higher CPM in the past than what I got in the last 2-3 days, so I can’t claim anything right now. I would suggest people using Adsense to try YPN atleast once, just to check if it affects your numbers. I am planning to rotate my Adsense and YPN periodically and get stats. I am not sure how long should that period be? Should I run Adsense for 12 hours and YPN for other 12? or should it be longer periods such as a week or a month?

I believe this scenario can be compared to the situation a few months ago, when Gmail was launched. Most of the free email providers were reducing the mailbox size and as Gmail entered the market, Yahoo and MSN increased their mailbox sizes to match Gmail. This is the power of competition…..

Here is Yahoo’s (quick) response to the email that I sent to them, followed by my explanation of the problem.

Sep 30 2005 14:36 PT
> Hello Gaurav,
> Thank you for your inquiry.
> We would be more than happy to help you resolve any display issues you are
> experiencing. At this time, we feel that we can better assist you by
> speaking to you directly, in order to obtain more detailed information.
> Please feel free to call our Support Team at (866) 785-2636, Monday to
> Friday from 6:00 a.m. to 7:00 p.m. PDT, and from Saturday 7:00 a.m. to
> 4:00 p.m. PDT.



Sorry, I was unable to call you guys, but I did find the problem.

Here is the bug (actually a compatibility issue.) I add my YPN code in a
HTML file which is being “imploded” by a PHP file. Then slashes are added
using “addslashes($theVar)” which adds backslashes before the characters
(‘), (“), (\) and (NULL).

When the whole thing is “print”ed it shows something like \’ as compared to
‘ . However the ” (double quotes) are printed fine (without leading
backslashes.) I guess there is some kind of confusion going on with code
while it is printed.

Here is the code snippet:

$tmpl_file = “path-to-file/header.html”;
$thefile = implode(“”, file($tmpl_file));
$thefile = addslashes($thefile);
$thefile = “\$r_file=\””.$thefile.”\”;”;
print $r_file;

I’d suggest you guys to either give an option to the publisher to choose
between a single quote and a double quote, or just make it default as double

I am using Ads provided by * another company * and they do use double
quotes, which works fine for me. If you think it is fine for me to change
the single quotes in the code to double quotes manualy, then do let me know.


Is Rediff worth that much?

Its the time for Internet marketing….. after the success of Google’s Adsense and Adwords everybody seems to join the bandwagon. Freshlinks services add to successful SEO. Overture is a live example of the same. The yahoo owned company has made its mark in the field of keyword based advertising.

Indian companies have also started following this model. Not too long ago, rediff launched its blog service, which can help it to promote it’s domain selling business as well as create a huge base for its new Ad Service – P4C. Now I see every other blogger living in India is using Rediff Blogs.

I have used Overture and Google Adwords. Overture charges min. 10 cents per click while Adwords charges min. 5 cents per click. Now according to Pay4Click by Rediff, they charge Rs. 10 per click which is a bit more than 20 cents. Isn’t that too high for PPC? The target audience is Indians living in India and Indians living abroad. I agree that it is a very specific audience but I still think those Rs. 10 aren’t worth.

I was even surprised to know that doesn’t have a direct link to the P4C but had it. Which prolly means they are targeting Indian advertisers who want to market their products in India only. Not only this, their rates are in Rs. and they haven’t mentioned $ rates, which again means they are targeting Indians living in India. I am not sure about the value of Rs. 10 in India these days? I am not sure about the average Google and Overture PPC rates, but it would be certainly around 50 cents – $1 (or more?).

So, to get the solution to the problem, I’ll need to ask someone living in India.

My old Website

Finally I moved my old site (pure HTML) from to

The site is strictly for IE users and if you are using any other browser or older ver of IE then you can’t view it. I had to make it IE only coz it uses a lot of js which doesn’t work well with other browsers. The url is here.

Got a new fotolog

I completed the gallery on which I was working a few days ago. I was looking for some automatic mechanism which would make some directories password protected but it didn’t seem practical because of the way how I wanna file my pics.

So now I created two galleries one for family, which is pwd protected and has almost all the pics and the second is for everybody’s viewing and doesn’t contain any personal/family pic. Basically the first one is a superset of the second. The URI is here and it is also provided in the list of links on ur right.

What does the gallery code do?
– It presents the pictures saved in different directories named as that day’s date (it can be something else too).
– It creates the thumbnails in a seperate dir when the directory is viewed for the first time.
– I had high resolution pics from my digi cam ranging from 400k to 1 mb which would kill a dial up user. keeping them as it would take up lot of space as well as bandwidth and changing each pic’s resolution/size isn’t practical. So I wrote a script which would recreate the image as a low resolution/size image and overwrite the original image automatically when one views the image for the first time. It would save me lot of space, b/w and time.
– Added the descriptions which come from the filename.

I am not releasing the code as it is too much customized for myself and is not that userfriendly. I have to change various permissions (CHMOD), for the scripts to work automatically, whenever I upload images. If all the steps are not followed then, the site shows a bunch of error messages. But if someone needs the code for his/her own use or to incorporate parts of it in someother project then either drop a comment here or contact me.

Yahoo loves me!!

I created the site for the movie Sarkar cpl. of months back and I was eagerly waiting for google to index it. Google did include it in for the keywords “sarkar amitabh” but it is on 2nd page – 16th link. I also have the 19th link for Bollywood Mantra.

…but Yahoo really loves me. The site is at the top spot for the following keywords:
Sarkar Film
Sarkar Amitabh
Sarkar Abhishek
Sarkar Bachan
Sarkar Bachchan
Sarkar godfather
Sarkar Marlon
Sarkar Brando
Sarkar katrina kaif
Sarkar Al Pacino
Sarkar tanisha

….and may be many more!