Ajit K

March 27, 2007

Why is PDF so popular for online publishing?

Filed under: Media, Publishing, Internet, Ideas, Trend, Design — AjitK @ 6:58 pm

Some pros and cons about it (a cons actually might be a pros, depending on the perspective).
+ points:

Portability.

Allows protection of intellectual property (IP).

Support for publishing scientific media (mathematical notations etc.).

Efficient packaging of content (less memory and high quality).

- points:

Difficult to edit and add comments without installing Acrobat Professional.

Difficult to Copy & Paste ;)

Difficult for collaborative editing and publishing. It is more like an end product rather than a material to be worked upon. Probably, PDF wasn’t meant to be for this purpose at all.

References:
http://weblog.404creative.com/index.php/2007/02/24/a-few-reasons-not-to-send-files-in-micorosft-word-format/
http://wordprocessing.about.com/od/choosingsoftware/a/pdfsharing.htm
http://www.afb.org/afbpress/pub.asp?DocID=aw060604
http://www.its.monash.edu.au/staff/web/slideshows/accessibility-pdfformat/

March 25, 2007

Path to Perfection

Filed under: Programming, Ideas, Design — AjitK @ 6:28 pm

As the writer, adventurer, artist, and aeronautical engineer Antoine de Saint-Exupry once put it, writing about the design of airplanes:

La perfection est atteinte non quand il ne reste rien ajouter, mais quand il ne reste rien enlever.

It means: “Perfection is attained not when there is nothing more to add, but when there is nothing more to remove”.

Taken from ESR’s writing available here.

March 24, 2007

A bit of pythonic humor

Filed under: Food for thought, Programming, Design — AjitK @ 12:18 pm

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one–and preferably only one–obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea–let’s do more of those!
–Tim Peters, “The Zen of Python”

March 23, 2007

India is in turmoils - the great Indian batting collapse is back

Filed under: Uncategorized — AjitK @ 8:39 pm

:(

Update: and India lost miserably but rightfully to Sri Lanka. India face elimination from the World Cup, unless Bermuda defeats Bangladesh! A highly unlikely proposition :|.

Sachin was out for DUCK :X We come to expect so much from our heroes, but when they fail at a time like this it hurts even more!

Waht is worng

Filed under: Food for thought — AjitK @ 8:36 pm

What is wrong with us (India and Indians)? Why do we have so few Nobel laureates (a general measure that shows our progress in various fields)? Why do we have only a handful of quality researchers in India? Why didnt I go for a PhD in Physics? Why are others quitting their PhD s? Aren’t we cut out to be a visionary? The same “us” when given an opportunity elsewhere (in US) have done exceptionally well! Why? Is it money, motivation, freedom, peer pressure or a “brain drain”?
Does a class-room learning aimed at securing “high marks/grades” lead us to be a learned individual? Does a “coached” study to get us admitted into *Institute Of* add anything worthy to us? There are two roads, one of certainty and other of uncertainty and possible hardships; which one would we pick? Does landing in a high paying job measure success? Is it “satisfying” ? Does our job get our passion? Does our cultural values allow us to be adventurous (against the option of choosing the safer option of earning)? … and the questions continue!
Waht is worng? How do we set it right? Do you have similar questions or have answers?

Ath Shri Sachin Chalisa (non-English)

Filed under: Uncategorized — AjitK @ 10:04 am

The song of praise about Sachin Tendulkar :) . Thanks to Abhinav for sending this piece of writing!

Sachin Chalisa

March 20, 2007

Regular expressions tutorials and howtos

Filed under: Programming, General — AjitK @ 6:52 am

Some links for self-study on regex (for python):

http://www.amk.ca/python/howto/regex/

http://www.xellsoft.com/regular_expression.html

http://it.metr.ou.edu/regex/

http://gnosis.cx/publish/programming/regular_expressions.html

http://www-128.ibm.com/developerworks/library/l-python5.html

March 15, 2007

Basics of the Unix Philosophy

Filed under: Linux — AjitK @ 8:31 pm

Recently I have started reading the book: “The Art of Unix Programming” by Eric Raymod. This is a great reading and I like it a lot! It is enlightening! Here is an excerpt from the Philosophy of Unix:

Doug McIlroy, the inventor of Unix pipes and one of the founders of the Unix tradition, had this to say at the time [McIlroy78]:

(i) Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new features.

(ii) Expect the output of every program to become the input to another, as yet unknown, program. Don’t clutter output with extraneous information. Avoid stringently columnar or binary input formats. Don’t insist on interactive input.

(iii) Design and build software, even operating systems, to be tried early, ideally within weeks. Don’t hesitate to throw away the clumsy parts and rebuild them.

(iv) Use tools in preference to unskilled help to lighten a programming task, even if you have to detour to build the tools and expect to throw some of them out after you’ve finished using them.

He later summarized it this way (quoted in A Quarter Century of Unix [Salus]):

This is the Unix philosophy: Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface.

Rob Pike, who became one of the great masters of C, offers a slightly different angle in Notes on C Programming [Pike]:

Rule 1. You can’t tell where a program is going to spend its time. Bottlenecks occur in surprising places, so don’t try to second guess and put in a speed hack until you’ve proven that’s where the bottleneck is.
Rule 2. Measure. Don’t tune for speed until you’ve measured, and even then don’t unless one part of the code overwhelms the rest.

Rule 3. Fancy algorithms are slow when n is small, and n is usually small. Fancy algorithms have big constants. Until you know that n is frequently going to be big, don’t get fancy. (Even if n does get big, use Rule 2 first.)

Rule 4. Fancy algorithms are buggier than simple ones, and they’re much harder to implement. Use simple algorithms as well as simple data structures.

Rule 5. Data dominates. If you’ve chosen the right data structures and organized things well, the algorithms will almost always be self-evident. Data structures, not algorithms, are central to programming.

Rule 6. There is no Rule 6.

Ken Thompson, the man who designed and implemented the first Unix, reinforced Pike’s rule 4 with a gnomic maxim worthy of a Zen patriarch:

When in doubt, use brute force.

More of the Unix philosophy was implied not by what these elders said but by what they did and the example Unix itself set. Looking at the whole, we can abstract the following ideas:

  1. Rule of Modularity: Write simple parts connected by clean interfaces.
  2. Rule of Clarity: Clarity is better than cleverness.
  3. Rule of Composition: Design programs to be connected to other programs.
  4. Rule of Separation: Separate policy from mechanism; separate interfaces from engines.
  5. Rule of Simplicity: Design for simplicity; add complexity only where you must.
  6. Rule of Parsimony: Write a big program only when it is clear by demonstration that nothing else will do.
  7. Rule of Transparency: Design for visibility to make inspection and debugging easier.
  8. Rule of Robustness: Robustness is the child of transparency and simplicity.
  9. Rule of Representation: Fold knowledge into data so program logic can be stupid and robust.
  10. Rule of Least Surprise: In interface design, always do the least surprising thing.
  11. Rule of Silence: When a program has nothing surprising to say, it should say nothing.
  12. Rule of Repair: When you must fail, fail noisily and as soon as possible.
  13. Rule of Economy: Programmer time is expensive; conserve it in preference to machine time.
  14. Rule of Generation: Avoid hand-hacking; write programs to write programs when you can.
  15. Rule of Optimization: Prototype before polishing. Get it working before you optimize it.
  16. Rule of Diversity: Distrust all claims for “one true way”.
  17. Rule of Extensibility: Design for the future, because it will be here sooner than you think.

Reading down the line, these had me on a roll :) . It is so true! I am sure most of the people involved in programming have experienced this. Note the comment about marketing fad ;):

Many pressures tend to make programs more complicated (and therefore more expensive and buggy). One such pressure is technical machismo. Programmers are bright people who are (often justly) proud of their ability to handle complexity and juggle abstractions. Often they compete with their peers to see who can build the most intricate and beautiful complexities. Just as often, their ability to design outstrips their ability to implement and debug, and the result is expensive failure.

Even more often (at least in the commercial software world) excessive complexity comes from project requirements that are based on the marketing fad of the month rather than the reality of what customers want or software can actually deliver. Many a good design has been smothered under marketing’s pile of “checklist features” — features that, often, no customer will ever use. And a vicious circle operates; the competition thinks it has to compete with chrome by adding more chrome. Pretty soon, massive bloat is the industry standard and everyone is using huge, buggy programs not even their developers can love.

This page is a real treasure-trove. Whenever you need a relook at your programming approach, do read this chapter about Philosophy of Unix. These principles can be applied to general software development as well (there’s nothing that says its unix only!). And it can be summarized by the “Kiss principle”:

The KISS Principle

I have become a fan of ESR.

March 14, 2007

VIM and vimrc resources

Filed under: Links — AjitK @ 9:41 am

Just started playing around with VIM. If you are looking for a quick start google can be your best friend. The vim tutorial is a good point to start with. To customize the behavior of VIM, I took help of the following resources to setup my vimrc:

http://www.semicomplete.com/misc/rcfiles/vimrc (A great site with some very good open source content.)

http://www.stripey.com/vim/vimrc.html

http://phuzz.org/vimrc.html

Search and replace in VIM at linux.com:

http://www.linux.com/article.pl?sid=06/06/26/1525255

March 12, 2007

Dependency injection

Filed under: Links — AjitK @ 7:20 pm

Man! there’s so much to learn. I hadn’t heard of dependency injection till today!

http://en.wikipedia.org/wiki/Dependency_injection

Dependency injection (DI) is a programming design pattern and architectural model, sometimes also referred to as inversion of control or IOC, although technically speaking, dependency injection specifically refers to an implementation of a particular form of IOC.
The basic idea is that if an object depends upon having an instance of some other object then the needed object is “injected” into the dependent object. For example, being passed a database connection as an argument to the constructor instead of creating one internally.
The term “Dependency injection” is a misnomer, since it is not a dependency that is injected, rather it is a provider of some capability or resource that is injected.

Looking for an implementation to learn more about it? Have a look at the external links section in the wikipedia entry. Some are:
Guice Intro by Crazy Bob
Home of Guice

Next Page »