RLE (Run Length Encoding) to demonstrate basic compression + Implementation in C

I’ve been reading about basic compression techniques and RLE (Run Length Encoding) is as simple as it gets. I decided to write a whitepaper on the technique and also implement a working demo in C. Though RLE is not a great way to compress data, its an excellent start for anyone who wants to delve into compression schemes or just wants to understand the theory behind basic compression. If you want to use/modify the source code feel free just keep the original header intact. Click the link below to read the complete paper.
Click here to download the complete whitepaper in PDF format
CopyX v1.0 beta – File / Folder queue utility for Windows
I’ve continued developing in .NET and C# and have developed this small application called CopyX. I tried to make it as simple to use as possible.
When you want to copy multiple files / folders in Windows (even Windows 7!), explorer will open a new copy dialog for each operation. This will eventually slow down the copy process as you run multiple copy / move operations. I wanted some way to queue up files / folders to be copied like adding multiple jobs and processing them like a queue. I searched online and came across TerraCopy but for some reason it wasn’t stable on my system so I decided to write something of my own and release it for free ( as always
)
CopyX was born! Please use it, abuse it, do what you like with it! It comes with no warranty or support. If you have issues let me know but I’m not sure when I will release an update. Hope it helps someone out there the way it helped me.
Note: You need Microsoft DOT NET Framework 3.5 to run CopyX
Simpo v1.0 beta – The Simple Password Organizer
I’ve been a hardcore C++ buff right from the early days. Recently I decided to take up learning C# and .NET. Boy, was I in for a treat. I was blown away. Don’t get me wrong. C and C++ are still my favorite languages. But the simplicity and speed of C# and .NET reminded me of the Visual Basic days. Heck, they’ve even gone and made Visual Basic Object Oriented (VB.NET)
Anyways, I developed this nifty little application in my spare time (~ 3 days). Hope you guys find it useful. It basically maintains a list of all the sites and passwords that you enter in it so that you can keep track of all your passwords in one place. We all know how frustrating it is especially with multiple accounts and logins and not remembering the passwords at the right time.
The application even encrypts all the usernames/passwords/comments you store so that no one except you can have access to this sensitive information. Just make sure you don’t forget the password. There is no way to recover the master password and you will lose your data if you do. Lastly, this is hobby software and comes with no guarantee. Let me know if you find any bugs or if you can suggest some enhancements. This program needs .NET framework 3.5 installed on your machine.
Google search is now instant search
This morning when I launched Google (who doesn’t?), I noticed that links loaded as I typed my search query. This seemed really cool and just as I was about to say “What the…”, a small banner popped up below that said Google had launched Google instant and that it would be launched in the remaining parts of the world soon ( I am in Japan as of now )
Google say that it is going to revolutionize the way we search for information. I don’t know about revolutionize, but it is nifty as hell.
Google instant is basically predictive search. Google algorithms predict what you are about to type by matching commonly typed keywords and the search links start loading as you type. Not only is this faster and unique, it also gives you a peek into what sort of links are going to be returned by Google when you search for a particular phrase. This means you can avoid making mistakes since you see the links as you type. As I type “Apple iPod”, I see that I get links to generalized iPod articles but if I add “2010” , I immediately start seeing links to the new lineup of Apple’s iPods.
I am not sure right now how much time it will save you, but I can already see myself getting better at typing the right kind of search phrases. How useful this new feature is for the rest of the world, only time will tell.
Here’s a short video on Google instant -
Visual C++ intermediate files / folders cleaner
If you like me find it extremely frustrating
to manually clean intermediate files generated by Visual Studio while compiling projects, this is a great solution.
Visual C++ Cleaner is a small script written by me entirely in VBScript that automates the cleaning of intermediate files that are normally created when we compile Visual C++ projects.
Its features are -
- Clean the entire folder (with subdirectories) by entering only the path
- Clean by extension
- Clean by folder name (Debug, Release etc.)
- Built in logging support
- Current extensions which are cleaned -
pch,clw,aps,plg,opt,ncb,scc,ilk,htm,vss,pcx,bkp,bak,bsc,user,suo
Current folders which are cleaned -
debug, release
This script is extremely flexible and can be used even for system maintenance by making a small change to the script. You can include any extensions which you want cleaned from your system and the script will take care of the rest. This script is also a great way to learn the basics of the VBScript language.
- I’ve even created a small user manual if you are finding it difficult to use the script


Searching for updates in realtime
Google has a realtime search service that not many users are aware of – http://www.google.com/realtime
It is a service that lets you see realtime social updates, news, blog posts and other information while its hot.
For example, if you search for “apple ipod touch 2010” you will get Facebook updates, twitter updates, blog posts, news articles and all sorts of realtime information. It even shows a nifty bar graph by which you can determine at what point of time the buzz around what you are searching for was at its peak.
Here’s a video on how to use Google realtime -
You can customize the information updates via options like “Update with images”, “Customize location” etc. by using the navi-bar on the left. Its a great way to get up to date information for just about anything out there. Do give it a try.
Visual Studio – amazing macros
Typing repetitive text or executing repetitive commands can be a real chore while coding. One often overlooked feature of Visual Studio is macros.
For example, I found myself continuously typing my name and the date as a comment for every small change that I made to code I was reviewing code. This helped my team working at another location to see the changes I had made. Visual Studio macros to the rescue! I wrote a simple macro which helped me save some time (and frustration) -
Sub test()
Dim dtCurrDate As Date
dtCurrDate = Now
DTE.ActiveDocument.Selection.Text = "//Karan " + dtCurrDate.ToString()
End Sub
The output of the above macro will be //Karan 9/6/2010 11:06:47 PM. This is a great way to insert comments at the places where you make changes to code. The inserted time provides even more accuracy to the reader.
Some more examples of macros are -
Sub Cleaner()
DTE.ExecuteCommand("Build.BatchBuild")
DTE.ExecuteCommand("Build.RebuildSolution")
End Sub
What the above macro does is clean your current solution ( delete intermediate files ) and then rebuilds the solution.
Sub ifdefOut()
PoundDefOut(False)
End Sub
The above macro can be used to #ifdef / #endif out a section of code.
An easy way to create your macro if you don’t know how to write code in basic is to use the built in macro recorder. Use “Ctrl+Shift+R” to record your macro and “Ctrl+Shift+P” to play the macro back. If you want to save this macro then you can go to Tools –> Macros –> Save Macro. This will save the macro to a file and can be viewed using the Macro Explorer (View –> Other Windows –> Macro explorer).
If you are comfortable with coding in basic, then the best way is to create your own macros is to launch the Macro Editor (Tools –> Macros –> Macros IDE) or Alt+F11, then type your macro.
Another great idea is to assign your macro a shortcut, so that you can invoke your macro without digging through menus. To assign macro shortcuts, go to Tools –> Options. From the Dialog that launches go to Environment –> Keyboard and set your shortcut.
The above macros are really simple macros. Visual Studio 2008 comes with many pre-installed macros. Right click –> edit these to view their source code so that you learn from these great examples.
The above macros have been tested on Visual Studio 2008 but the basic idea should work for other versions as well. Let me know in the comments if you know or would like to share some of your own macros.
Top 5 Google Chrome extensions
Lately I have ditched Firefox completely to adopt Google Chrome. The reason? Speed! Firefox crawls even on a fairly modern system when a javascript/flash filled page is loaded. I am not saying Google Chrome is perfect but it it light as hell and the fastest browser on the planet as of now. Yes, it is faster than Opera.
The only reason why I completely switched to Chrome so late is because of poor Linux support and lack of extensions. All that has changed now and things are really beginning to heat up! The Linux and Mac versions are out of beta. What better time than now to write and article about my favorite Chrome extensions.
5. Adblock - Goto Adblock page
Adblock is a very nice extension to have. It is one of the most popular extensions for Firefox and is now available for Google Chrome. Block those pesky ads with support for whitelists, blacklists and filter lists. Another cool feature albeit in beta is the the ability to block ads in Youtube. I hate those pesky youtube ads. This extension runs in an unobtrusive manner so installing this extension is a no brainer.
4. StumbleUpon - Go to StumbleUpon page
StumbleUpon is known by almost every webjunkie out there. Find great webpages just by clicking the “Stumble!” button. StumbleUpon needs no introduction. If websurfing is your passion, then Stumble Upon should be in your arsenal.
3. Feedly - Goto Feedly page
Feedly organizes your favorite sources in a magazine-like start page. A very innovative way to read your RSS feeds in Google Reader. It feels like you have a fresh, well laid out magazine laid out in front of you each day. Trust me, once you read your feeds using Feedly, you will never go back.
2. ScribeFire – Goto ScribeFire page
ScribeFire is a full fledged blog poster/editor with support for the mainstream blog sites like blogger, wordpress etc. Installation and setup is a breeze and is fairly easy to get up and running. Give it a shot if you don’t want to install additional software on your machine or just want a quick and convenient way to post to your blog.
1. Chromed Bird (twitter) - Goto ChromedBird page
No top list is going to have twitter missing J This has got to be one of the nicest twitter clients out there. Just authorize the extension to access your twitter account and you are all set. Tweet, reply, retweet, direct reply all from a nice and easy to use interface. It’s not the best client out there but it is an extension and for that it does all you need.
Other honorable mentions –
Fireworks Photography

Fireworks
Fireworks photography can be a daunting experience. Here is a simple set of steps to follow while clicking night photos, especially fireworks.
1 Use a tripod (Important)
2 Manual exposure & set focus to “infinity”
3 Use “bulb” mode
4 Shutter speed can be between 2 to 10 seconds. Use a “remote” shutter release cable to minimize shake.
5 ISO between 100 or 200
6 Aperture between f/8 tof/16
7 Lens: Medium – wide angle focal length
8 No flash
9 No polarizing filter
10 White balance to”Tungsten”…”Daylight” gives great colors. Much better than using “Auto”
Usually, 4 sec. at f/8 and ISO 100 gives the best results.
Custom firmware for your devices
I got the idea to write this after reading an article on the maximumpc site. Instead of simply linking to the site and copy pasting what they have written, I thought I would write my own article about the topic, although I admit its based on their article. If you are wondering what the word firmware means, fret not, I will try and cover some basics here.
Firmware
Firmware are fixed, small programs that are used to control hardware like MP3 players, digital cameras, routers etc. The interface you see on your MP3 player to select songs, or the settings you adjust in your digital camera are all happening because of firmware.
Why does the question of hacking firmware come into the picture?
Simple – Manaufacturers protecting their own interests. This is the number one reason why factory firmware is limited. If basic digicams start coming with DSLR features like complete manual control, exposure control etc. manufacturers would lose a chunk of the DSLR market. Not the best example but you’re probably getting what I am trying to say.
Who hacks firmware and how is it done?
You can breathe easy, you need not do the modification yourself. There are a group of people who are consumers like you and I and want most from the devices they paid their hard earned money for. The normal routine is to obtain an official firmware update, reverse engineer and understand it and then add features that are possible. I am a programmer myself and know the kind of effort that goes into such activities, which is why I have nothing but respect for these individuals
What are the devices that can be hacked with custom firmware?
MP3 Players -. Custom firmware for MP3 players has existed for a while now. Features vary from better shuffle to album art support etc. Note that not all MP3 players can be flashed with custom firmware. Below is a list of efforts I am aware of -
![]()
1. iPod Linux – http://ipodlinuxinstl.sourceforge.net/
This is an effort to get linux running on your Apple iPod. Check out the site above for details like which models are supported.
2. Rockbox – http://www.rockbox.org/
Rockbox is an open source firmware for mp3 players, written from scratch. It runs on a wide range of players like Sandisk, Apple, Cowon, iRiver etc.
Game consoles - Gaming consoles like the XBOX, XBOX360, Sony PS2, Sony PSP can be hacked for running homebrew software, and supporting features which are otherwise locked.

1. XBOX Media Center – http://xbmc.org/
This is hands down the best media center software I have used. It started out as a dashboard replacement for the original Microsoft XBOX and has grown into a fine application which can now run on Windows, Linux and even the MAC! Highly recommended by me.
2. PSP Custom Firmware – http://www.dark-alex.org/
Once you load custom firmware on your PSP, you truly unleash its potential. You can run a variety of software like MP3 Players, Video Players, Games and applications like RSS Readers etc. on your PSP. Although used popularly for running game backups, the custom firmware truly has many applications that outweigh its misuse.
BIOS - Thats right, you can load your motherboard with custom BIOS firmware which could speed up boot times or add new features.
1. OpenBIOS – http://www.openfirmware.info/Welcome_to_OpenBIOS
2. Coreboot – http://www.coreboot.org/Welcome_to_coreboot
Routers - Now you can get sophisticated features like Bandwidth Management, FTP, HTTP servers etc. out of that cheap router you bought. No need to spend extra money for features which should have been present in the first place.
1. Tomato – http://www.polarcloud.com/tomato
Tomato is a small, lean and simple replacement firmware for Linksys’ WRT54G/GL/GS, Buffalo WHR-G54S/WHR-HP-G54 and other Broadcom-based routers. It features a new easy to use GUI, a new bandwidth usage monitor, more advanced QOS and access restrictions, enables new wireless features such as WDS and wireless client modes, raises the limits on maximum connections for P2P, allows you to run your custom scripts or telnet/ssh in and do all sorts of things like re-program the SES/AOSS button, adds wireless site survey to see your wifi neighbors, and more.
2. OpenWRT – http://openwrt.org/
OpenWrt is described as a Linux distribution for embedded devices.
Digital Cameras - Those petite Canon powershot digital cameras are not so petite when it comes to features once they are flashed with custom firmware. Full manual control and exposure becomes possible once these babies are loaded with custom firmware.

1. CHDK – http://chdk.wikia.com/wiki/CHDK
One of the best alternative firmware for Canon Powershot cameras, CHDK boasts an impressive feature set and supports a variety of models. The community is active and new firmware versions are released all the time.

2. Magic Lantern – http://magiclantern.wikia.com/wiki/Magic_Lantern_Firmware_Wiki
Magic Lantern is an open platform for developing enhancements to the amazing Canon 5D Mark II full frame digital SLR.
Digital media players - These enhance the feature set of digital media players.

1. WDLXTV – WDLXTV is a souped up unofficial firmware for the Western Digital WDTV. It is based off of the 1.02.10 firmware, but with many extra features.
Other devices - These are other devices whose firmware can be hacked to add additional features or improve speed etc.

1. NSLU2 – http://www.nslu2-linux.org/
Change your NSLU2 into a tiny Linux computer. After that, the sky is the limit. This is a great way to download using torrents without leaving your main PC switched on all the time. The applications are endless.
2. iPhone Jailbreak – http://lifehacker.com/398906/jailbreak-iphone-20-with-pwnagetool
Please let me know in comments if I have left something out. Also note that in a lot of countries installing custom firmware is considered illegal, so make sure you don’t break the law
Happy hacking!











