RSS Feed Proxy - Finally one data format to parse all feeds
July 12th, 2008
Hey guys! I discovered two feed proxies.
- http://www.netvibes.com/proxy/feedProxy.php?test=1&url=__FEED_URL__
- http://my.live.com/cfw/news.aspx?fetchurl=__FEED_URL__
Replace the __FEED_URL__ with the feed URL of your choice. Of the two feed proxies above, I like Netvibe’s proxy as the best because of the following reasons:
- Feed output is JSON. This means that, netvibes has done all the necessary work to convert feeds of any type (RSS, ATOM, RDF etc.) into JSON.
- If you are writing a script to examine feeds from various sites, you have only one data structure to deal with
- Almost all programming languages support JSON. Refer to www.json.org for JSON libraries available for various programming languages.
- JSON by itself is very lightweight and eliminates most of the overhead of XML, thereby preserving bandwidth.
- A simple program in VB.NET to parse a JSON structure and get the required feed data in a Dictionary datatype is only about 9 lines of code. In Ruby, it will be even lesser. Compare the same with XML output. Even though feed parsers are available, you have to create your own wrapper above everything to get everything to work out properly. Reuse what you already have (DRY Principle). Netvibes has already done the bull work to convert all kinds of feeds into a common format.
- Best of all, no authentication is necessary to access these links :D
Live.com’s feed proxy returns the actual feed output. So, if the feed you are referring to gives RSS output, this proxy returns that. The same happens with ATOM, RDF etc. Keep watching this space. I will update the post with other feed proxy URLs that I encounter. If you go across any, please mention them in the comments section.
An ode to Ruby
June 21st, 2008
One of my juniors in college named Satish has written this small wonderful piece on Ruby (programming language).
Ruby makes a programmer smile
even when he’s using while
all the if’ and else’ and do’
reduces the work you do
kernel methods work like charm
conventions make work a form
all the while you reap the fruits
everyone gives java the boots!
Cool ! Ain’t it? ![]()
How To: Open a root terminal in Ubuntu
June 10th, 2008
I was playing around with Ubuntu & installing a few stuff from the terminal. One problem that quickly became a pain in the rear is that, I had to `sudo` everytime and give a password whenever a command that required admin privileges had to be run. Since, I was installing a few stuff, almost all commands required admin rights. So, without much ado, here’s how to open a terminal with permanent root privileges.
- Press Alt+F2. The “Run Application” dialog will pop up.
- Type “gnome-terminal” in the dialog and press “Enter”. This will open a new terminal window without admin rights.
- Now, in the new terminal window, type “sudo gnome-terminal”. You will be asked for your password. Give your password and press “Enter”. A separate terminal window with root privileges will open now. This is immediately visible because the usual “$” prompt changes to a “#” prompt.
There you go,
three cool steps to have your terminal with admin rights. If you press “Ctrl+Shift+N” from this new terminal, it will open another terminal window, which also has root privileges.
NTFS, Gmail Keyboard Shortcuts
April 18th, 2008
Two things today:
Few days ago, I was searching for information on NTFS and found 2 amazing articles from the good old MSJ (Microsoft Systems Journal). The links are below. Do go through them when you find time. Even though the articles are old, they offer a wealth of information.
- Windows NT 5.0 File System - http://www.microsoft.com/msj/1198/ntfs/ntfs.aspx
- NTFS Change Journal - http://www.microsoft.com/msj/0999/journal/journal.aspx
There are lot more articles available. I will post the links as and when I read them. Nice stuff !
As you already know, I have enabled keyboard shortcuts on my gmail account. Gmail actually shows you the list of available shortcuts right inside your mailbox, without us having to visit the keyboard shortcuts page. To access the list of keyboard shortcuts, you need to press “?” key, which is “Shift + /“. You will get the translucent black popup as shown in the below screenshot. You can press any key to close it.
Click the image to see a larger version.
Blog Subdomains
January 21st, 2008
Hey friends, lots of people have been asking me why I have two separate blogs (tech and non-tech), while I could have them both in the same place. I would like to answer that in 2 ways:
- Both the blogs are in the same place. All the posts in the proper order can be viewed at http://www.aswinanand.com/blog.
- Subdomains such as http://blog.aswinanand.com/ and http://tech.aswinanand.com/ exist for backward compatibility.
Long back, when I started blogging, while many readers enjoyed reading my blog, some of them didn’t like the tech content in between. Hence, I moved the tech content to another blog. Finally, when blogger for domains came in, my tech and non-tech blogs became available at the links mentioned above. Hence, for those users who had subscribed to this blog, I didn’t want them to lose out.
So, the actual blog url is http://www.aswinanand.com/blog and the tech and non-tech blog show contents from the space, just separated by tags. This, along with the magic of htaccess and 1 php file, many things can be changed so that the permalinks will be available in a better fashion. Moreover, when I want to do a post in both the tech and non-tech blogs (like this one), I can just add the 2 tags to this post and they are available in both the blogs. Change the post once and the change is visible in both the blogs (if you visit them separately). Configuring a mobile client for the same is very easy and all this can be done in a single space
When this blog pings certain links after an update is made (like technorati etc.), the blog url goes as http://www.aswinanand.com/blog and not blog.aswinanand.com or tech.aswinanand.com. Therefore, when someone is redirected by search engine results, they will just visit the full blog and not the other ones
How’s that?
When template is changed, the change is visible all throughout
and looks very uniform. So…. that’s the reason for both the blogs being “virtually separate” hehe…
Server Side Validation - Importance
January 5th, 2008
Time and again, there are countless number of articles written on not to trust user input and do a server side validation of all input. There are quite a lot of libraries in all imaginable languagues that make server side validation very easy.
But time and again, every other site pops up that have only client side validation. One such site is http://www.cinetickets.in/. The site has a registration page. The first field required is called “user id” and we have to give our phone number. What crap!
On firefox, there is a superb toolbar called the Web Developer toolbar. Once installed, you can play with all components of the page, including cookies, headers, scripts … anything. That “user id” field accepts only numbers. Hence, I disabled all javascripts on the page, entered some text, filled up the rest of the page and clicked on Submit. Guess what? The page registered perfectly. With scripts disabled, I’m able to login also.
I went back to the registration page again (with all javascript disabled ofcourse!) and clicked on Submit without giving any data. The site throws an error message saying that the user is already registered. LMAO.
With such crappy validation schemes, I’m pretty sure that there are no server side validations being done as well. They are just taking data from the client and pushing them into a database (most probably MySql) without sensitive data being encrypted (they accept credit card details etc.). Assuming I’m a hacker, the site can be brought down within a few minutes! Looks like the CineTickets website is programmed by a company called EvinceTech.com. Don’t ever outsource your website development there. It’s very easy to conclude that they are a shit load of programmers.
Anyways, I found an awesome PHP script some days ago that filters out dangerous tags from strings. The script is available here. I encourage everyone to use it, if you can’t/don’t-want-to write one on your own.
Java ME - OTA Problems
December 7th, 2007
OTA means “Over The Air provisioning” - which also means downloading a Java ME app directly on your mobile phone. Therefore, OTA means, just plain downloading. That’s all!
But there are some problems. I developed a simple application using netbeans 6 and wanted to do a OTA deployment of the application. Hence, both the JAD & JAR files were uploaded to the web server. Now, I opened the web browser on my mobile and typed out the url of the JAD file. Usually, there is a property called on the JAD file called MIDlet-Jar-URL. It contains the link to the jar file. E.g. If suppose the JAD is located at http://aswinanand.com/app.jad, the MIDlet-Jar-URL in the JAD file will contain related properties of the JAR file including its download link.
Hence, when a mobile identifies a JAD file, it will search for MIDlet-Jar-URL property, fetch the download link & download and install the application on your phone. What happened here was that, even though the JAD file was in perfect condition, it just got rendered as plain text on the mobile’s browser. The JAR was not downloaded and installed. Soon, I found out that the MIME type of JAD was different and that, for JAD files, “Content-Type” HTTP header has to be set to “text/vnd.sun.j2me.app-descriptor“. For JAR files, the “Content-Type” HTTP header has to be set to “application/java-archive“.
My web server runs apache. Hence, I just created a .htaccess file with the following entries:
AddType text/vnd.sun.j2me.app-descriptor .jadAddType application/java-archive .jar
Now the JAD file was recognized perfectly by the phone :-). The JAR was downloaded and installed properly :D. More info on OTA can be obtained from here.
Easter Egg in Gmail - The ‘.’ Keyboard shortcut
November 22nd, 2007
Hi guys, I happened to discover this cool new keyboard shortcut in the new gmail interface. This shortcut will work only if you have enabled keyboard shortcuts.
After logging in, press the ‘J’ key just to make sure that keyboard shortcuts are working. Once done with that, press ‘.’ (dot) key. The “More Actions” combo box will now expand. Use the standard arrow keys to move among the list of labels and actions. To move out of the combo box, press Escape key.
Example Uses:
- Use the ‘x’ key to select a few messages/conversations.
- Press ‘.’ (dot) to expand the “More Actions” box.
- Select a label and press ‘Enter’.
- The label will now be applied to the selected conversations.
That said, the “More Actions” drop down is not an actual combo box. It’s done using DIVs and CSS.
P.S.: To enable keyboard shortcuts, first login to gmail. Then click “Settings” at the top right corner of the window. Now click “Keyboard shortcuts on” and click on “Save Changes” button at the bottom.
Gotchas in installation of Apache, MySQL and PHP
September 23rd, 2007
Yesterday, I configured apache 2.2.3, php 5.2 and mysql 5.0.18. Alright, I know that’s not a big deal. But here are a few things that you must do in order for them to work seamlessly.
httpd.conf:
Add the following 4 lines to httpd.conf so that php will work correctly.
- LoadModule php5_module /path/to/php/php5apache2_2.dll
- PHPIniDir /path/to/php.ini (E.g. PHPIniDir “C:/PHP”. Note that the the path doesn’t end with “/php.ini”).
- AddType application/x-httpd-php .php - This tells apache to handle PHP requests. If you want to add more extensions for php, E.g. say you want to process “.abc” files as PHP, then add “AddType application/x-httpd-php .abc”.
- Find this line in your httpd.conf “DirectoryIndex index.html” and replace it with “DirectoryIndex index.html index.php”.
php.ini:
Go to the folder where you installed PHP. Open php.ini in your favourite text editor and find the line that says extension_dir = “./”. Replace that line with extension_dir = “/path/to/ext/folder”. Note that, there should be no trailing slash to the value of extension_dir.
my.ini:
Now go to the folder where you installed MySql. Try to start the MySQL daemon. I’m assuming that you haven’t installed MySQL as a service. If the mysql daemon (mysqld.exe) is running, try connecting to it by issuing the command on the command prompt.
“mysql -u <user_name>”
If you get an error like this “ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)”, open your my.ini file. Find the line that says “port=3306″. Replace it with a port number of your choice. There will be 2 such lines in my.ini. One is for server and the other is for client. Now try connecting again.
To run the mysql server in verbose mode, instead of just double clicking on mysqld.exe, open command prompt and type “mysqld –console“. This will give you a quick overview of what is happening.
When you run your php scripts that connects to mysql, you should now specify the port number also (if it is not 3306). E.g. $con = mysql_connect(”localhost:4000“, “user”, “password”);
After all these changes, don’t forget to restart your apache server. When you get an error dialog that says that some PHP extensions cannot be loaded, make a note of those extension names first. Now, open your php.ini. Search for “extension=php_”. Above the first extension line, add the missing extension DLLs. E.g. extension=php_pdo.dll etc.
These are some of the gotchas that I faced
Next I have to try and configure a Mongrel cluster for apache for running ruby on rails apps.
Import Blogger Blogs to Wordpress - Problem Resolved
September 2nd, 2007
Hi guys, wordpress 2.2.2 has a problem of importing blogger blogs to wordpress. It happens when you get an error saying, “We were not able to gain access to your account. Try starting over.“
This problem can be resolved only in custom wordpress installations i.e. you have your own domain on which you have installed wordpress (downloaded from http://www.wordpress.org/).
After login through FTP (Example FTP client is filezilla) to your web hosting provider, locate the folder where you have installed wordpress. In my case, I have installed it in a folder called “blog”.
Locate the folder “wp-admin”. Inside wp-admin, select a folder called “import”. Open the “import” folder. There’s a file called “blogger.php”. Download the file to your computer. Open the file in any of the popular text editors and go to line number 87. It looks like the first screenshot.
[Click the image for a bigger screenshot]
Line number 87 is highlighted in blue. Change “www2.blogger.com” to “www.blogger.com” (Refer to screenshot below). Save the file and upload it to the same folder from where you downloaded it.
[Click the image for a bigger screenshot]
Have fun! ![]()

