May 03
My Sites: My Blog | My Tech Blog | Follow me on Twitter
—-

GLib - An Introduction:

GLib is a utility library for C, which augments the standard C library in several purposeful ways to make your life that much easier while programming. GLib has the following things to offer you:

1. Portability: The main issue that haunts any C developer is the portability of code. One cannot rely on the standard C library for this as you may find many functions that work differently under different platforms are aren’t there at all sometimes. GLib ensures that the all the functionality exposed by it remains consistent across platforms, so that you can rest assured that your code will work the way its supposed to work irrespective of the Operating System it’s being used for (Of course, this assumes that you have ensured about portability aspects of your non-GLib related source code). Moreover, GLib is available for a vast array of contemporary Operating Systems including GNU/Linux, Microsoft Windows and Mac OS X.

2. Security: Though you still need to be careful about things like freeing allocated memories properly, etc but GLib does ensure that all its functionality is secure. Moreover, GLib has a policy of ensuring that all its functions are threadsafe. This saves you from a lot of checks and balances and locks and scheduling considerations if you had written all this yourself.

3. Useful Data Types: GLib exposes a lot of data types. Some are very basic that maintain portability across OS’s and 32-bit and 64-bit systems. e.g. you can rest assured that gint32 will always be 32 bit and gint64 will always be 64 bit data types.

Apart from this, it also provides a lot of derived data types e.g. singly linked lists, doubly linked lists, hash tables, stacks, queues, trees, and much more. It’d basically cover most of you data structure needs that you’d have otherwise had to implement yourselves. And it also provides helper functions that makes working with them so much more easier. If you have ever used Perl, and have wished that C programming could be a bit faster like it, you will be pleasantly surprised.

4. Utility Functions: GLib also provides various utility functions to ease out your manipulation of data. Some of the functions are meant as more secure and portable replacements for those provided with standard C library, while rest are meant to provide other useful functionality which you earlier had to implement in your code. Some of the major areas covered by GLib’s utility functions are String manipulation, character set manipulation and conversion (including unicode and base64), using regular expressions, file manipulation, shell functions, config file parsing (my favourite), etc.

End Note: I can understand that there would be a lot of people who believe that use of GLib is dumbing down programming in C. After all, we take pride being in control of our code and this is why we love progrmming in C because we have options to do things in our own way. Yes, that is all true but there comes a time where you’d like to spend more time in developing the core functionality of your app, or focus more on giving a rapid shape to your new idea, rather than reinventing the wheel and fumbling around with writing the helper functions. So, keeping that in mind I believe GLib is wonderful piece of code that has enabled me to churn out new apps that much faster.


—-
If you liked this post, then you can Subscribe to my feed
Quote of the day: Homer: Kids, you tried your best and you failed miserably. The lesson is, never try.

written by Shantanu Goel \\ tags: , , , , , , , , ,

Apr 28
My Sites: My Blog | My Tech Blog | Follow me on Twitter
—-

Some of you might know that I was in the hunt for a decent mspaint alternative recently. Note that I didn’t go for GIMP / Inkscape etc because they were overkill for what I wanted to do. Many a times, I just wanted to touch up a screenshot or make a simple flow image by drawing a few boxes, use a few pointing arrows, and add some text here and there. All this could be done with the previous mentioned programs as well but took a bit more steps than I wanted (stroking the selections / paths for lines, boxes, circles, and even then, no arrows). I didn’t find an adequate replacement at the time but got it now, so thought of writing about it. Basically I came across 4 apps: tuxpaint, gpaint, kolourpaint and mtpaint. Won’t discuss tuxpaint here cuz I found it a little too kiddish.

  • gpaint: (Available in Ubuntu repositories) gpaint is a very simplistic program that has a mspaint look and feel but feels a bit lacking. It can do basic procedures like basic shape selections, lines, boxes but that’s it. No polygon selections, brush, color picker, etc, and yeah no arrows. Moreover, it saves only in pngs.

gpaint screenshot

  • kolourpaint: (Available in Ubuntu Repositories) kolourpaint is very close to mspaint. Infact it does a bit more than mspaint. It has all the things that I mentioned as missing in gpaint, plus has basic image manipulation effects as well. I liked it quite a bit, but it had 2 drawbacks for me, still no arrows, and it depends on KDE/Qt libraries.

kolourpaint screenshot

  • mtpaint: (Available in Ubuntu Repositories from Gutsy onwards. Rest of the folks can search for a package on net, or find a suitable package or source here) This is the software that got me most excited. It is actually a kind of lower-intermediate package that lies somewhere between mspaint and a very basic, poor man’s GIMP. It has all the features ok kolourpaint, (plus arrows at last :-) ), a small smattering of basic effects (gaussian, edge detection, blur, embossing), can work with gifs also (handles transparency and animation quite well). So, this is the one I would be sticking to for now.

mtpaint screenshot

I am using mtpaint now for my basic needs. Hope the article benefitted you as well. If I missed out on some package, then do let me know.


—-
If you liked this post, then you can Subscribe to my feed
Quote of the day: “Inspiration is wonderful when it happens, but the writer must develop an approach for the rest of the time… The wait is simply too long.” - Leonard Bernstein

written by Shantanu Goel \\ tags: , , , , , , , , , , , ,

Apr 26
My Sites: My Blog | My Tech Blog | Follow me on Twitter
----

I’ve known about ImageMagick tools for quite some time now but never dabbled with it. A couple of weeks ago I played with it for some time (notice the new cascaded polaroid pics header above) and was amazed even more. Few of its shining features:

  • It has almost unlimited features to manipulate your images through its tools like convert, montage, mogrify etc and their long list of options.
  • It is available for Windows, Linux and Mac as well.
  • Runs on web servers also (most of those nifty image sites use it for run time image manipulation)
  • It is amazingly fast.
  • Runs on the command line, which means batching of operations can be done and is also good for butter fingered people like me who are clumsy with GUI based image manipulation programs
  • Has modules for interfacing with C, perl, php, C++, C#, java, etc. So, you can create your own applications around it.
  • It’s FREE (as in speech and as in beer)
  • It has an amazing documentation over at imagemagick.org and also a very thriving community, so help is just a few clicks away.

As a very rudimentary sample of what it can do for you, take a look at my blog’s header above. I just gave it a few pics and ran a command, and it resized them, turned them into polaroid pics, rotated them at random angles, made the background transparent, strung them together to make a webpage header/banner.

Since the command was specific for the number and names of images, I made a simple perl script to automate the command making process so you can also download this script (link at the end of post) and run it to create your own header. (You might want to tweak the $w and $h variables in the script to specify your header’s width and height). Running it would be like

CODE:
  1. ./pano.pl <imagenames>
  2.  
  3. e.g.
  4.  
  5. ./pano.pl myimages/*

After I made this script, I came across Stas Bekman’s photo gallery which has a much better and cool stack effect with photos. And he generously agreed to share his script (much more sophisticated than my my few lines) with me. His script is also attached below.

Polaroid web header Creation Script

Stas Bekman's Image Stacking script

Let me know if you use any of these scripts (as it is or after modifying them) to create any cool effects.


----
If you liked this post, then you can Subscribe to my feed
Quote of the day: Trust no one. Question Everything. - Deus Ex

written by Shantanu Goel \\ tags: , , , , , , , , , , , , , , ,

Apr 20
My Sites: My Blog | My Tech Blog | Follow me on Twitter
----

Disclaimer Notes:

  1. I wrote this because these things just came into my mind today while I was reading about the impending “Hardy Heron” release related things and saw that there is a lot of FUD being spread still. So, thought of jotting down my likes/dislikes and not making it a linux v/s windows campaign. Though at a few places, it might be necessary to compare the two just to put things into perspective.
  2. These are reasons why “I” like/dislike Linux and not why others might like/dislike it although you might find common patterns.
  3. Most of my recent experience is with Ubuntu these days, so most examples would be from it as well.
  4. These reasons are purely from an end-user’s perspective and not from a linux developer’s perspective. So, I’m not taking into factor that I can change the kernel (or most other things’) source code because “generally” I don’t.
  5. This post is quite long. And if you have a flame to send out my way (which you are most welcome to do), please read it in its entirety before doing so, because many things I say at some point have some caveats covered at another point.

5 Reasons why I like Linux:

These reasons aren’t listed in any particular order. All of them are quite important for me.

1. Light on Resources: I must say that Linux is what still keeps my more than 3 years old laptop running in a prim condition with the latest and greatest of everything from technology stand-point as well as eye-candy stuff. An example: With almost every effect of Compiz Fusion turned on, hordes of screenlets and AWN enabled, an Apache/MySQL/PHP based server running, and a dozen of other applications (firefox, nautilus, terminal, GIMP, RhythmBox, Open Office Word Processor, VLC player, etc) open, my setup consumes around 500 MB of RAM. While on the other hand, if I was using Vista, It’d have demanded atleast 1 GB of RAM just to run Aero, forget about the rest of the things.

2. Cost: This is a big factor for me. Almost everything is free or atleast has a free alternative available. Most of the times I’ve found these free software to be much better than commercial software in terms of feature sets as well as stability. But even otherwise, when there are cases where the free alternative a bit lagging as compared to the commercial one (e.g. GIMP v/s Photoshop), I haven’t felt that my needs have ever outgrown the free software.

3. Ease of Use: Doing “stuff” on linux is just so easy. By “stuff”, I mean everything from doing some normal day chores, downloading files, customizing things, automating routine tasks, etc. The backbone for this is “the terminal” (not the movie :P). I can do almost anything I want from the console. It not only saves me time and frustration in executing a program, waiting for the GUI to load and then go through a series of clicks but also allows me to batch up everything into one pretty little command. Moreover, every thing has so many options that I can configure to my liking. (More on the “options” later below)

4. Getting Software: Getting software couldn’t be more easy.

  • It generally involves typing in “sudo apt-get install <software>”, pressing enter, and that’s it. The latest version is ready to roll on your machine.
  • Reboots are minimal. Even after thinking for quite long, it’s very hard to recall any time when I had to “log-off” my system (let alone reboot) after installing a software (or even a driver)
  • Updates are automatic, and not just for the OS or a few core components, but for all the software that I installed through repositories (but not for the ones which I installed from my local deb’s or compilations, which is understandable of course)
  • The latest fixes/patches are available very quickly. Moreover, the revision cycle for most distros lies between 6–12 months and hence, even a complete desktop upgrade is quickly available as well (as compared to the 7 year period after which Vista came out). You can even “upgrade” to the latest distro revision without having to wipe everything, though I generally prefer a clean install.

5. Security:Now, I agree with everyone that the reason why we don’t see many viruses for linux is because the user base is very less as compared to other OS’s but I also believe that this is not the “only” reason.

  • The thing is that since most of the software is open source, so exploits are found quite quickly and patched and released rapidly. While in a closed source environments, even if a white hat reports it, the exploits go on un-noticed, un-worked upon by the developers (A good example is the recent falling of Vista during the “Pwn to Own” contest because of a known but unpatched vulnerability by Adobe, not a fault of Vista in this case though but you get my drift).
  • The security model otherwise is also quite tight and its very hard for someone to exploit it till the time you use common sense along with it. (A linux virus can easily wipe ur “/home” without acqurining root permissions).

5 Reasons why I dislike Linux

These reasons irk me the most but aren’t enough for to make me move away from Linux. I mention them because getting them right would make my Linux expereince that much more joyful and probably others feels the same too. Moreover, this is not a gripe and is not a command/order to “the Linux guys” out there to fix it, because linux is of, by and for the community. And being a part of this community, I share the burden of this equally and would like to help out in making it better in whatever ways possible, developing, testing, suggesting things.

1. Getting Software: I had mentioned about how easy it is to get software from most distros’ repositories with a single command. However, getting and installing software is also a challenge that many people face in linux. After sometime your particular version of the distro stops updating the software and will include only security fixes and such. Now, there are many good people who would backport software for your version but not all the time. You can download pacakges off the internet (debs’ for ubuntu) but they might not work because of too many inter-mingled dependencies. Compiling is another option but many times, it can spiral out of hand. I hope we can better softwares like GDebi that could make this much more easier.

2. Options: Earlier I listed having so many options as one of my reasons to like Linux. But, sometimes, too many options tend to get to my head. This gets even more difficult when you have too many choices but no clue about what means what and which one is the best. However, the community is continously trying to make this right. A lot of documentation projects are going on, and the mailing lists, IRC networks and other forums also give out a lot of information. Especially for Ubuntu, I find a huge community based support system which always helps me out. (PS – The Ubuntu Forums are the nicest forums you’ll ever come across. I am yet to come across a post that contains words like “RTFM” or “n00b”)

3. Ease Of Use: Some times, just some times, the lack of a GUI for common things irks me and I wish in respect of a few things (read wi-fi) that things could “just work”. But I guess this is a trade-off that I can live with, and moreover this situation is also improving especilly due to the efforts taken by Ubuntu, Mandriva, Fedora, GNOME and KDE. (Special thanks to nm-applet ;-) ). Moreover, Hardy Heron, b43 and the latest linux kernels promise to solve the wi-fi setup issues.

4. Browsing: The browsing experience on linux isn’t too great. But this is not a fault of Linux as such. This is due to companies providing adequate linux support (e.g. java plugins for 64 bit) and too many sites optimizing their code for IE. But again, there is hope for this as we can already run IE on linux (IEs4Linux) plus SUN has promised a 64 bit java firefox plugin with the next JRE.

5. Drivers: This is again due to companies not giving proper linux support for their hardware and not even releasing their hardware details for the OSS community to develop their own drivers. However, I can understand that giving out hardware details might not be an option for these companies considering the competition, and also proper software support might be a bit unfeasible due to a smaller consumer base. But again, more and more companies are seeing the light now and releasing proper drivers for linux, with Nvidia and ATi taking the lead (When will Creative listen?). And a special thanks to the OSS community for making working drivers despite all this.

So, this is it. After reading back through what I just wrote, I am dead sure that I will stick to Linux as the trade-offs are too meagre for me. Will you?


----
If you liked this post, then you can Subscribe to my feed
Quote of the day: "Human beings may not be perfect, but a computer program with language synthesis is hardly the answer to the world's problems." - JC Denton

written by Shantanu Goel \\ tags: , , , , , , , , , , , , , , , , , , , , , , ,

Mar 30
My Sites: My Blog | My Tech Blog | Follow me on Twitter
----

If you have ever needed to share files between your Linux and Windows computers, you have obviously used Samba, and have been quite happy with the way it seamlessly provides access to and from shared folders/files from Windows and Linux. However, many people complain that although their smb/Samba shares are accessible from Windows, they are not able to do the same with their Windows Mobile devices. e.g., using a tool called “Resco Explorer” on Windows Mobile, all they get while searching for their linux based Samba shares is the following screenshot:

Cannot Find Computer on Network

Well, there is no big magic trick to get an access to those shares, as they are already accessibly. You just need to do one more teeny little step to access them.

Continue reading »


----
If you liked this post, then you can Subscribe to my feed
Quote of the day: "You will be who you will be. We are our choices. And we can choose to lead humanity away from this... darkness." - Icarus/Helios

written by Shantanu Goel \\ tags: , , , , , , , , , , , ,

Mar 16
My Sites: My Blog | My Tech Blog | Follow me on Twitter
----

I’m sure you have copied/moved files on your computer from one place to another. And I’m sure often you have to do more than just “single-shot” copying that is copy a few files to one place, move a few to another, and copy yet some more to one more location. Well, I had to do this quite a few times (e.g. I ran out of disk space recently on a partition and had to empty out my “Movies” and “Songs” folders to move a few movies/songs each to all other partitions/disks according to the space available). Hence, I wrote this little command line program, which behaves like a basket.

You can put any number of files from any number of different locations into it in a single shot. It will store their locations and give them an ID. Now, you can copy/move those files to different destinations based on their IDs. What's even better is that your basket will remain intact even across reboots. So, you can continue working on the files in the basket even for days.

Do check it out at Shantz Copy Basket

Note: Packages for windows as well as linux have been uploaded. If you have perl, a perl script is also given that works in both platforms without change. I have tested it on Windows XP SP2 and Ubuntu Feisty Fawn 7.04.


----
If you liked this post, then you can Subscribe to my feed
Quote of the day: Homer: Kids, you tried your best and you failed miserably. The lesson is, never try.

written by Shantanu Goel \\ tags: , , , , , , , , ,

Feb 19
My Sites: My Blog | My Tech Blog | Follow me on Twitter
----

I came across this post on lifehacker today (original post and solution here), which talks about a method of retrieving files from a remote computer through e-mail. Pretty archaic, I know, but again, it is a very simple method and works behind all the firewalls and stuff . But, the catch is that it is only for mac’s. Thought of creating something similar for the PC and mashed together some code during lunch time at office to make our dear old outlook remote-file-sending-capable. So, here it is, head over to my project page “Remote File Access Through E-Mail” to read more about this and download it.


----
If you liked this post, then you can Subscribe to my feed
Quote of the day: Ralph: Me fail English? That's unpossible.

written by Shantanu Goel \\ tags: , , , , , , ,

Feb 19
My Sites: My Blog | My Tech Blog | Follow me on Twitter
----

download

Download: shantz-outlook-remote-file
Version: 0.1
Updated: April 23, 2008
Size: 1.19 KB
Hits: 977

Introduction:

This is a (proof-of-concept) outlook macro that you can use with an outlook rule to retrieve your files from your home/office PC by sending it a mail with a subject having a predefined special keyword and the body containing the names and paths of the files. The remote PC will then mail you the files on a predefined e-mail ID.

This project came into being after reading this post at lifehacker (original post and solution here). It listed a method to retrieve mails on your home/office PC by sending a "magic email" to it, but it was only for mac's. Seeing that people wanted it for windows as well, I thought of making something up during lunch time at office.

Usage:

1. Download the attached zip file (shantz-outlook-remote-file-access.zip) and unzip it. It has a VB module "shantz-outlook-remote-file-access.bas" (can be opened with any text editor)

2. Create a new macro in Outlook. Copy the code contained in Module1.bas to the main source file of the macro.

3. Edit the code to change the e-mail ID to which the files will be e-mailed. Save the macro.

4. Create a new rule in Outlook. Choose to run the rule when a specific word is found in the subject. e.g. use "SendMeMyFiles".

5. The action part of the rule should be "run a script". Here you can choose the macro that you just created from the list shown by Outlook.

6. Save the rule and you are done.

Now try, sending a mail to the account that your outlook is configured to receive mail for, with the special keyword in the subject and a list of files (with their complete absolute paths on the remote computer) separated by semicolons (";" without the quotes), and watch magic happen :).

e.g.: To: myemail@email.com

subject: SendMeMyFiles

Body: c:\path\of\files\file1;d:\second\path\file2

IMPORTANT NOTES:

  • For this thing to work, outlook has to be running on the remote PC as this depends on a "client-side" rule.
  • This is just a proof-of-concept as of now, so there is no error handling right now. Plus the e-mail body parsing is finicky and so the e-mail body should not have anything other than the file paths and names. This might change in future if I decide to update it.
  • Don't use it if your life depends on it. Use it for basic purposes and modify and improve it appropriately before you decide to use it seriously (You may submit your modifications here as well)
  • It has been tested only on Outlook 2003, but might work on others as well.

Let me know of any thoughts you may have about this.


----
If you liked this post, then you can Subscribe to my feed

written by Shantanu Goel \\ tags: , , , , , , , , , , , ,