optimise for faster navigation

According to what Nielsen says, the average size of web sites have gone up making them fatter and fatter in the last few years. On the other hand, people’s response times have come down to 2.3 seconds per page.

Still he feels that half of the world doesn’t have faster broadband access and hence web sites need to be slimmer, simpler and easier to browse through, and such websites will get more attention than fatter but slower websites. We need to achieve a response time of 1.0 seconds for an optimal user experience.

As we all know, once the inter web was filled with web sites containing big images which rather distracted us. It has moved to a web2.0 era and been replaced with widgets. This hasn’t improved things anyway, still the web sites are slower and distractive a lot. The only way to attain the ultimate interactivity is to have sites which load up faster and are more easier to navigate around. If the user has to search on how to reach the next page or the previous, especially in his first encounter, he rarely returns back to the site again.

if you are in a mailing list

Still I remember the day I joined my first ever mailing list, with a warning from my mentor not to immediately jump into mailing the list. It was followed by 3/4 months of observation period where I just kept reading mails, queries and replies. I was asked to learn how people ask questions, how people answer questions and how you shouldn’t ask/answer a question. It also helped me understand the entire idea about mailing list. I also learned about flaming and when did people landed in the middle of one. The monthly reminders on Net-etiquette where quite useful and kept me reminded on what I shouldn’t do. Still there were certain instances where my butt got burnt a little, but its quite normal.

Of late I got an additional responsibility in the ubuntu-in team, as a moderator for mailing list. Since then I have been seeing the inner world of mailing list, only known to the mail admins, about spams, over-the-limit mails, etc. That’s why I decided to write this post, of what not to do and what to do when you are in a mailing list.

  1. Read the mailing list guidelines, otherwise called as netiquettes, and follow them.
  2. Try to improve your linguistic skills, so that you can ask better understandable questions and offer clear replies.
  3. Observe the mailing list before you take active participation. This helps in knowing the unwritten rules followed within the list community and understand better the common participants in the list.
  4. Observe the common participants and pick up a mailing style, while still following the list guidelines such as “do not top post”, “do not over quote”, “crop unwanted text” etc.
  5. Most mailing lists are enabled with “reply-to munging”, which means when you press the reply-to option in your mail client it automatically selects the list mail address as the reply-to address. Be careful, especially when you trying to mail the OP offline and do not want the list to know about it ;)
  6. Please do not indulge in personal duel. Mailing list is also a community and has people who differ in their way of life, profession, experience, expertise, ideologies etc. If you are not ok with anyone’s idea, just state you do not agree, place your points. If the conversation seems to digress somewhere, please remind silent so your butt is not burnt.
  7.  Please answer things which you are very sure of. Try to understand what the conversation or query is actually about before trying to post a reply. Its quite embarrassing to be pointed out that you misunderstood and gave some crap as a reply.
  8. Do not repeat points already posted by others. If you want to second on a posted opinion use “+1″ to mark you support the idea.
  9. There might be a lot of discussions happening in the list. No one tries to participate in everything, though you might follow them up. Please think twice before venturing into unknown lands.
  10. Please stick to the purpose of the list and do not digress. Though many list allow off-topic posting with a “[OT]” tag, that doesn’t mean you can ask anything under the sun.
  11. I seriously advice to use a separate mail account for mailing list subscriptions. This is not just to manage the huge amount of mails you get, but to prevent unknowingly sending personal stuffs, forwards and spam mails to the list.
  12. Those who send “join me in foobar social networking service” are considered to be the worst type of spammers and the list administrator might resolve to kick such people out from the list. Beware!
  13. If the mailing list doesn’t welcome wishes and greeting mails, like “Happy New year!”, please refrain from sending one to the list.
  14. Do not talk about food, religion or politics in a mailing list. These are topics where people have their own preferences and are quite strong in them. Indulging so might lead to people’s sentiments getting hurt and you getting flamed at the end.
  15. Even when pointing others about their mistakes, please be polite. Do not make fun of other’s innocence or negligence. If you are proved wrong, just accept your mistake and learn from it.
  16. New members of the list will be quite enthusiastic (may be they didn’t read a post like this ;) ). Please understand it, give them time and support to learn. Flaming their butt will just create fear and they might leave the list calling it to be unfriendly or egoistic.

Remember, these aren’t rules but just some tips I learnt through the experience of participating in various mailing list for the past few years. Hope it does some help people who are venturing into the new world of Mailing Lists. Good Luck! :)

Sitting in the end user’s chair

Every programmer or rather every application developer, let it be a simple web app or a GUI, needs to design his application not sitting in a developers’ chair but from the end users’ chair. If he starts developing it from his very own PoV as a developer, things get geeky as well as too technical that the usability of the app is going to suck big time when put into real use. This is because, unless he does his work from the end users’ PoV he is not going to understand how his app should interact with the end user as well as his app is not going to give back something which the end user wishes when using his app.

I have heard this point being stressed a lot of times, especially by people who have guided me till now in various projects. You don’t assume yourself to be intelligent, neither the end user to be stupid, but you have to assume yourself to
be intelligent very similar to your intended end user. Why am I writing this all of a sudden is, I and my colleague were developing a simple user log mechanism and we had to start thinking about how the end user, how is going to be very much a non-technical person, can interact  with and use our interface. This helped us find some small small things which we had overlooked, but would have otherwise messed up our entire application itself. We had to think of ways to make it easy for the user to give us data, which is also easier for us to process and give him the service he wants.

Thus, all of a sudden I realized the importance of sitting in the end users’ chair if I want to develop products with good end user usability.

5 Types of FOSSites

I and HereBeDragon were discussing about the various kinds of people we have in the Indian FOSS community, when he started listing the different types of FOSSians.

Here’s a 5-point classification of FOSSites. What type are you?

a)The DiehardsThey are firm believers in FOSS philosophy and will not accept anything other than FOSS and sometimes feared to be fanatics too.

b)The DedicatedThey are dedicated to FOSS and are also believers of FOSS philosophy, but are not fanatical. Though they personally advocate and follow FOSS, they leave the choice to others to decide for themselves.

c)The DidacticsThey are one who make a lot of noise about FOSS but have little to contribute or mostly they themselves do not follow FOSS.

d)The PragmatistsThey are very practical in nature. They give the importance to solving issues than sticking on to philosophies. Though they are admirers or followers of FOSS, if they seem to have a better solution in non-FOSS they do not feel bad in implementing them.

e)The OpportunistsThey do not have real interest in FOSS philosophy, but consider it as a means of gaining something or moving higher up in their professional ladder. They neither advocate FOSS nor contribute.

What Am I ? Hmm… /me is (b + d) :) What about you ? :-/

Biscuits, Songs and Free Software’s Philosophy Explained

G0SUB has forwarded an interesting mail regarding Ubuntu, giving it Free and how about making money with it. As the guy who posted the original query did not have any idea of philosophies associated to Free/Open Source Software, I decided to write a enlightening reply to him. A couple of years of performing GNU/Linux advocacy, especially to the student community, has made me a really good story teller which will be evident from my reply to the OP. Here is the query and the reply of mine.

OP’s Question..

> Hello, i am shailendra patidar doing engineering in the mechanical
> stream (in 2nd yr) from indore (m.p.).and recently i got a PC eddition
> cd for linux from my friend. and i want to know about what is ubuntu ,
> and the main thing is that is there any thing in the world which is free
> of cost or they give us for his publicity. or they are using us and can
> they do something for you or me. i can make a lot of users which will
> use the linux.Because i know that it is easy for me and the other reason
> is that the i know very people who want some changes in their computer
> operating system and the linux can make this.but is their any financial
> help to me from ubuntu because nothing is free today. so i am waiting
> for some useful tips or some help from you .and if u can forward this
> request ,then this is too good for me.i am waiting for your response .

And here comes my l00ng reply :D

First, there are some things in this world which is available as *free as
in free of cost* as well as something which should be rendered so. One
such thing is *humanity*, i.e. helping another fellow human without
expecting something in return. For example, when an old woman tries
getting into or out of the bus, you go and help her but you do not
charge her for doing so? Your neighbor’s kid is not able to solve a math
problem, (considering that you can solve the problem) you help the kid
with solving the problem as a gesture of humanity or friendship. But,
you do not go to his/her mother and get money for the help (This is not
about taking tution classes to the kid!).

Second, consider you and me. You have a biscuit and I have a pappad in
our hands. You give me half of the biscuit and I give you half of the
pappad, we both get some biscuit and pappad but only half of them. Similarly, consider that you know a Hindi song and I know an English song. I teach you to sing the English song and you teach me the Hindi song. Now we both know both of the songs but we did not lose our original knowledge (as in biscuit, we did not end up knowing half the Hindi song and half the English song!).

The reason for the latter comparison leading to gain of something from
other, without losing something which we have, is possible only when the
thing being shared is *knowledge* and not in any other cases.

Now, coming to another reality which is very close to our subject of
actual discussion is, we have been seeing Software as a product. I should
rather say you see it wholly as a product, but we the FOSS community
see the Software as Knowledge. Taking the essence of the above
comparison, since Software is considered as Knowledge, it should be
*freely* sharable. The problem is people have been used to charging for
any service did to the society as well as considering Software as a mere
product which is sold in the market, similar to biscuits, electronic
gadgets and what not.

Software is an idea of getting a job done. Software has this capability
that you can create 100s of copies of it without incurring much cost.
For example, for making 100 monitors and distributing them you incur
heavy monetary cost, you make a voluminous investment and hence, you
charge the customer for each monitor (which is completely justified).

But software is not so. You create a software and for giving it to
100 people you just need to burn them in CDs. The cost you incur is for
creating of the software first time (which is very small compared to
come out with a monitor model) and then cost of 100 CDs.

Another point to remember is “Software is knowledge”. If you can convert
and idea into a software, I have equal chance of converting the same or
similar idea into a software. Also, for your idea to become better and
your software to grow into a high quality one, what you need is
feedbacks from the users, additional ideas from people, encouragement
for you to continue with the software and make it better. This is what
we call it as collaborative development and community participation.

This is how Linux kernel grew into what it is now, from what it was as a
college project. Its all because Linux Torvalds went ahead of just making
money; he shared the kernel code he created, he welcomed people to send
in feedbacks, criticisms, bug reports; he allowed people to participate
with him; he allowed people to contribute in bits and pieces as well as
large features; and important of all, he gave equal respect and
importance to every individual who was ready and tried to help
him, as well as considered every contributing individual as a
co-developer. He never charged any one for using his code and he never
gave money to any one sending bug reports, patches, new codes etc. As a result, more people (in thousands?) took participation, contributed
as much as they can and you now see its result as a Linux Kernel having been wholly
evolved out. This is how things work in FOSS world.

Our philosophy is “share the knowledge you have, you will experience that
you gain many times more than what you gave”. This philosophy, adding to
the humanity concept I told in the beginning, is what Ubuntu follows. We
have a Linux Kernel or rather a GNU/Linux OS around. We have the
ability to use GNU/Linux, add freely available packages around to it and
make a bundle of it called as *Linux distribution*, naming it as Ubuntu
to remind our actual philosophy behind all these is *humanity* and we
finally share it with Humans. This is why we have a tag line “Linux for
Human Beings”.

We are giving it free of cost because we ourselves have been getting
these things free of cost. So, we are ready to share it free, we are
ready to put in a bit more effort and making GNU/Linux suitable for
being used by ordinary household desktop users. We think we are doing a
service to our own society in the way we know. Though we are software
people, we are proving the humanity within us by sharing our capability
to create down-to-earth GNU/Linux distribution and share it with our own
fellow Humans.

And before closing this mail (which is already too big), that what we
mean as *Free* generally is *Free as in freedom*, freedom to share
things with others without anybody preventing or prohibiting us to do
so. We give it *Free as in Free food* as well because, we got it for
*free cost* and we do not want to do injustice.

Tired of reading ? Have some *Free* biscuits ;)

(Thanks to Barkha for helping me with a suitable title for this weblog post :) )

(Python) Decorators

Decorators in Python are bit confusing concept to understand. It is not a standard feature generally explained in many of the Beginners’ books on Python. But, understanding the basic idea of decorators will help us in making a very good use of it. As the rule always goes, there are certain situations where decorators are highly useful but not always.

Decorators is a way of transforming functions and methods at the point where the code is declared. The point of transformation is placed just before the method’s own declaration.

To give a more clear idea, we generally put some code within a function, make use of it in other functions by calling it, performing some calculations or processing within the function’s body, and finally return some result or print some output.

Think of a situation where the attributes of the function get modified when the function is actually executed. That is, we start with feeding the function with specific arguments/parameters over which the function code operates. But, instead of directly passing over the input arguments to the function code, we rather try to do something with these arguments, modify them, process them and then pass it to the function as though they are untouched. Thus, we make the function feel as though it is receiving the input as it is but we are actually modifying them. The important point to note is these things happen at function execution time, just before the original function code executes.

The original proposal of Decorators as an enhancement and the discussion thereby are documented in PEP (Python Enhancement Proposal) 318. There are also few examples given to show how decorators can be implemented in general. But, for a newbie these examples are not easy to grasp.

I myself have to thank Siddhartha and Rajeev J Sebastian for helping me with additional examples and explanations respectively, for me to understand the concept and deliver my talk during FOSS.NITC 2007.

Let me start with Siddhartha’s simple example – Decorating a custom method with a decorator which prints text around the function call.

Example 1:

def decorate(fn):
    def _decorate():
        print "Before Calling"
        fn()
        print "After Calling"
    return _decorate

@decorate
def mymethod():
    print "Inside Function"

mymethod()

Output:

Before Calling
Inside Function
After Calling

Explanation:

A decorator is another object which expects to be fed with a function object. What the decorator does ? When the function is called, instead of allowing it to execute normally, if fetches the function object. It can modify the attributes of the function object or add new attributes, or it can just print some thing else and call the original function and execute it  within it as shown above. It prints the first text, calls the function which prints its own text, then it prints the text following the function call.

All of these happens at run time, when the function is actually called. Otherwise, its just a definition of another method. Thus, decorators jumps into action only when the function is actually called somewhere.

Another example might help us in understanding decorators much better. This time we will try to do something with the arguments passed to the function itself using the decorator and enjoy the fun.

Example 2:

def params(fn):
    def _inner(x):
        print "You called me with %d,
                but I rather called with %d" %(x,x+1)
        fn(x+1)
    return _inner

@params
def myfunc(x):
    print "myfunc: I got", x

myfunc(5)

Output:

You called me with 5, but I rather called with 6
myfunc: I got 6

Explanation:

The decorator params() is used to dynamically add 1 to the input argument and call the function myfunc() with the changed argument. Here, when we call the function with a value 5 for x, the decorators calls the function with a value 6. What the function expects is a input argument x and it prints it, but what is to be noted is that the decorator modified the parameter passed to the function and executed it with the modified parameter.

Ok, what else we can do ? We can pass a parameter to the decorator itself and use it to perform some operation on the function over which the decorator is applied. This example illustrates such an application of decorators.

Example 3:

def adapttoinput(str):
    def _multdecor(fn):
        def _inner(a,b):
            fn(a*b)
        return _inner
    def _adddecor(fn):
        def _inner(a,b):
            fn(a+b)
        return _inner
    if str == "*":
        return _multdecor
    else:
        return _adddecor

@adapttoinput("*")
def mymethod(a):
    print "The output is", a

mymethod(2,3)

Output:

The output is 6

Explanation:

Though the example looks ordinary, one interesting point needs to be noticed. The original function mymethod() accepts a single input argument a, but if you look at the function call it was mymethod(2,3). We passed 2 input arguments 2 and 3. But, it worked out! That is what the decorator magically did. It transformed the two input arguments into a single argument and passed it to the original function. Thus, even when the function was called with 2 arguments, when it was actually executed it was given only one argument as input. The decorator made use of the string passed to it to convert the 2 arguments in function call to one argument before giving it to the function. A “*” passed to the decorator results in addition of the input arguments and anything else results in addition of the input arguments.

These are very simple examples to demonstrate what a decorator can actually do. If you want to understand where decorator can be implemented in real time code, please check Siddhartha’s example on Guard Implementation using Python Decorators.

** Note: Spellos corrected and examples fixed on Feb 21, 2009.