Tuesday, August 23, 2011

Fishtank Update

Aquarium Update:
Every one of my friends (whether I interact with him/her on a very regular basis or irregular) have asked me over the past few months about the fishtank.  And their intent was to genuinely know about it, not just general chit-chat.  Most know about experiments in my life more through my blog than they speak to me (yes, I know that is sad, but not as much as nobody caring at all!). Lack of updates in posts here had got them concerned, I suspect.
So I thought I owe an update on my fishtanks to all you friends who regularly skim through here (irrespective of what draws you here: genuine curiosity, boredom, ample free time to kill or sheer friendship!). .
Thanks for asking, they are doing good!  ~~~touchwood~~~

There are a few enhancements I was wanting to do over this summer on my tank (mainly: upgrading to a better dirt and rearranging the plants), but I couldn't spare enough time.  The tank looks good, but I wanted to take it a notch higher. Guess it will have to wait for a while now  ~~~sigh~~~
I up'ed this video a while ago, but never got around posting it here (what a lazy a$$)!  
So here you go, my 30G (110 liters) fresh water planted aquarium.  I have shot the video of my smaller (10G) tank too, but haven't gotten around uploading it yet.  It had grown a beautiful carpet of Pearl Weed. Which I took down last week as it had a lot of Java Moss intertwined in it, which had started poaching on my pearl weed.  So I cleaned most of the surface and replanted them. Waiting to see how that goes.

Freshwater Planted Aquarium:


Some tips I have come to believe will help budding aquarium enthusiasts.

  1. Regular water change
  2. I underestimated the importance of this for a long time and did water changes only once in 2 or 3 weeks without much consistency. Now I have moved to a strict once-a-week 20% water change policy. And about 50% once in 4 weeks. With every water change, I add a few drops of liquid fertilizer (API Leaf Zone). I have noticed marked difference. Advantage: Lesser fluctuation in water quality, meaning much stabler chemistry, which all-in-all brings in a lot of goodness within it: healthier fishes & lush green plants being but a few.
  3. Lighting
  4. I wanted to move to a fancier T5HO lighting, but it costs a bomb (I have an expensive 65W CoralLife AquaLight that I got on a discount but it is just too powerful for my tank, I started getting a lot of algae), so I just switched out my aging CFL and put in a new cheap 15W CFL (Phillips, 5100K), which I keep on for about 8 hrs a day. And results were quite satisfactory. I might, now on, keep replacing my CFL every year till the time I can afford fancier lighting. There are talks in the community that effectiveness (notably wavelength and Kelvin temperature) degrades with age of the tube (unlike natural sunlight). Haven't spent too much time validating the claims, but I think it might be true and won't hurt my pocket too much to follow it.

Anyways, hope you enjoyed the video.

Thursday, August 18, 2011

Designing Good Interfaces: Function Names, Arguments & Their Actions

Wanted to share an interesting (and very oftenly overlooked) programming practice.  It is a very bright idea, intuitive, almost, I would argue, to have function names describe their actions and/or intentions:
  create_stack(), destroy_stack(), walk_stack(), kill_process().
What these functions might do is almost self explanatory from their names.
This simple (often untold) rule has helped legions of programmers maintain their sanity (at least of whatever is left), because they know that when they call create_stack() it will create stack, NOT destroy it.  And if it does, then there is something obviously wrong with the function.  Easy-Beezee.  Basic programming principle, correct?

So imagine yourself working at the famous LHC and you want to excite an electron!  Luckily for you, you are a programmer! So the herculean task of exciting an electron is reduced to writing a few lines of code for you!
Now say, you are onto writing a subroutine to excite an electron, naturally you will be tempted call your's as some variation of: excite_electron().

Everything excited, has to eventually come down to a ground state, so you want a complimentary function to bring that electron back to the ground state.  You can go with unexcite_electron().  Or you can pass in a TRUE/FALSE argument to the same excite_electron() function and let it decide whether to excite or undo the excitement (pull it to ground state, unexcite).
(Note: Yes, in most cases we programmers couldn't care less if unexcite is not a valid English word, as long as it unambiguously conveys the functionality).

No big deal. Trivial. Programming looks so easy, you say!
Well, then why the hell do so many programmers look eternally grim with unkempt premature white/gray hair? Here's one reason why...
I bet there are many ways to come up with good function name(s), excite/unexcite pair being one (even if they sound so unexciting!).
But here's particularly one sure-shot way to earn the wrath of your fellow-programmers who have to maintain your code and use your (dreaded!) APIs...
 void excite_electron (void* electron, boolean undo_excite)  
 {  
   if (undo_excite) {  
     decrement( electron->energy );  
   } else {  
     increment( electron->energy );  
   }  
 }  
What! Don't see the problem yet!  Wait till you have to invoke that interface to do something:
   // Excite an electron
   excite_electron( &hydrogen_electron, FALSE );  
   
   // Do your fancy experiments  
   
   // Now bring it back to ground state
   excite_electron( &hydrogen_electron, TRUE );  
@#$! Yes, that was my reaction too!  See the problem NOW!
Nothing wrong with the function in itself, but put into larger perspective and it looks dreadful.  NEVER EVER have a function name with one verb/action (excite in this case) and a totally opposite action/verb in the arguments (unexcite).  Not even for obfuscated code!  In my opinion this is plain wrong, not obfuscated.

Just for the kicks... if you want to make it worse, you can go with:
 excite_electron_2 (void* electron, boolean undo_excite)  
 {  
   if (undo_excite != FALSE) {  
     decrement( electron->energy );  
   } else {  
     increment( electron->energy );  
   }  
 }  
- OR -
 excite_electron_2 (void* electron, boolean undo_excite)  
 {  
   if (!undo_excite) {  
     increment( electron->energy );  
   } else {  
     decrement( electron->energy );  
   }  
 }  

If you still haven't evoked the wrath of that seasoned programmer who has, say, assimilated the essence of zen into himself, you can take it a notch higher by declaring the prototype in a header file as:
 // Function prototype to excite an electron, that is bound to get you killed!  
 void excite_electron (void* , boolean);  

And let the caller be totally surprised of what happens next! :)
Exact same function and exact same outcome, but you have just made it a little harder for reader to decode its workings.  Make sure you are not around after you checkin this kind of sh!t into the code repository!

This is NOT out of my figment of imagination, this sh!t happens for real!

Moral:
0. Law of least astonishment: Please use consistent verbs for function names and arguments. This would be the correct function declaration:
     excite_electron( void* electron, boolean excite );  
Now the following invocation tells me intuitively without any ambiguity that I am trying to excite an hydrogen electron even without looking at function prototype or its definition.
     excite_electron( &hydrogen_electron, TRUE );
1. Avoid double negation:
     if (dont_remove != FALSE) { ... }   // not too readable, DON'T do it  
     if (dont_remove == TRUE)  { ... }   // much readable now!  
     if (dont_remove)          { ... }   // not only readable but also elegant!  
2. Designing good usable interfaces is a non-trivial task! Programming is NOT just about churning out lines of code.  It is way more than that! That is why some of us believe programming is not just a science, it is an art!

Sunday, August 14, 2011

THEY Want...

THEY want you to cry...
THEY want you to rejoice...
THEY want you to be crushed from the juggernaut cycle of joy-n-sorrow
THEY want you to be unhappy...
THEY want you to be jealous...
THEY want you to be restless, frightened, terrorized...
THEY want you to be trapped...
THEY want you to be sick (but of course NOT die, O! how thoughtful of them!)...
THEY want you to be discontent... distraught... to be dissatisfied...
THEY want you to be careless... and to be reckless...
THEY want you to rob, wage wars, stir unrest, kill...
THEY want you to drink to stupor, smoke weed and such...
THEY want you to buy, beg, borrow and steal...
THEY want you to fall...

THEY want you to want MORE...
THEY want you to be in constant search of peace...
But...
What they DON'T want is for you to attain the peace within yourself, never reach out to that ever illusive  inner peace...
So that THEY can run their own agenda unhindered while you are too busy untangling your own mess!
Simply, because, if everybody finds his or her zen or connection to the core or victory over their minds-and-bodies the whole of socio-politico-economic machinery as we know of today will ~~bham~~~ come to an abrupt end!
Would that be so bad, after all?  THEY don't want you to know that!
What?  You are lost! So was I, until this epiphany dawned upon me ~~~beaming with newly earned uselessly dangerous knowledge~~~ Frankly, I'm still lost, but at least I now know where: a place from where I seem to see no escape.

THEY are the ones who own you and yet make you feel you are free,
THEY are the ones who siphon riches out while you toil away and pay your taxes, it is
THEY who reap the benefits of most of your material hard work,
THEY are the ones who control when you feel and what you feel,
THEY tell you what to read, write and hear...
THEY tell you what to do and how to do it, while making you believe you have a free (~~stifled chuckles~~, free???) free will,
THEY are the ones who own you, worse, they own your souls!
There is only THEY, not you or me.
All your base are belong to THEM. 
This my friends, is nothing but a progression towards Dystopian world (1984?)! And...
This my friend, is an illusion of Democracy! A hallucination of highest degree, if you will! And...
THEY don't want you to know that! 
Because, you, like a respectably good populace, are too busy earning your bread, paying your bills, rentals, loans on time, living (as much as possible!) a lawful life and spending the rest of your energies loving your loved ones, turning a blind eye to everything else.  You are not like this because of your own will or (laughably your) destiny... you are what you are only because THEY want you to be like this!  At least most of you are, there are always mavericks(???) amongst us, and THEY hate (read: eliminate!) them.
THEY choose who becomes what, how and when... Not you...
THIS my dear friend, is THEIR machinery and THEIR victory, not ours! At least for now and some more decades to come!
If you understand this (which I highly doubt ~~huh~~~  Not because you are not smart, but only because of its vagueness and lack of a head-or-a-tail) but if you do understand then you will know that this is a universal fact which knows no personal, political, geographical, social or economical boundaries.  The only thing that varies is how sophisticated this machinery of THEIR's can get.  But the machinery is omnipresent ~~sigh~~

But, the point I wanted to say was,
this started out as a random thought (#33), but I figured it won't be too bad to call it my very own Independence Day Special! (Independence? ~~~chuckles chuckles~~~ I know I know and I agree with you on this, a very laughable illusion, Independence, indeed!). I found it too apt to pass it otherwise.
Of course, my fellow Indian friends...
Happy Independence Day!
And here's a sincere hoping that you don't see what I do in the above lines!
P.S.: An annoyingly deliberate emphasis on THEY is to signify the power THEY possess over your lives.  And so you must reflect it while you read it by putting extra emphasis whenever you encounter THEY.  Out of respect, you ask?  Lol! Hell NO!!!

Thursday, August 04, 2011

Better Way To Live?

Most of you know that I'm a potpourri of random thoughts and epiphanies.  What? You didn't! Well...Well...Well! _Now_ you know! :)
So here's one from my bag of random thoughts...
Random Thought #29 (contrary to the theme, the number 29 itself, btw, is not random):
I often yearn for the much awaited weekends, times of week when I can do whatever (ok, _almost_ whatever) I want to do.  Of course, within the realms of other duties like weekly chores of cleaning, washing clothes, catching up with buddies, etc.
But the most importantly, I get some time for myself and do things that don't have a direct calculated invest-and-returns benefits, I can do things that just make be feel happy, no strings attached.  From what I know, a lot of us mortals yearn for that.  At least a lot of mortals that I know do.  Which makes me wonder if there HAS to exist a better way to live than just yearn for those 2 coveted days of a 7-day week!  There ought to be!
It seems so hand-to-mouth existence:
Solving only immediate or maybe near-future problems.  The smarter amongst us anticipates future problems and acts proactively.  But still, most of our time goes in either yearning for something too distant in the future (this is slightly different than dreaming).  Or we are working just too hard to earn our daily breads and ensure enough provisional safety net for the rainy days.
I am not particularly unhappy, neither do I keep yearning for weekends every day of the week, but today's life style (if it can be called one! and I doubt it could!) in my opinion begs this question: Is there a better to live other than to (however occasionally) yearn for the weekends?  I know there is one, but don't know anything beyond that.  Or is it just in human nature to yearn!
What's your secret?  Care to share?

Seed for thought:  Just came to me while replying a friend's email who insisted on looking up to the weekend.

p.s.: Live every moment as it if it were your last, is total rat-crap and I don't buy it!  Living in the present, is slightly palatable form, though.  But that's a matter for totally different post(s), or is it!