Wednesday, February 19, 2014

Fear and Loathing in KDE Land?

Full disclosure: My only contributions to KDE project are several bug reports and perhaps a few new users. So my qualifications to comment on the issue is of course almost non-existent. But hey, I've been a faithful KDE user for all these years, and so I think I have some right to make comments at least from a user's perspective.

There's been some discussions on KDE land regarding replacing Nepomuk (or Nepomuk-KDE for the politically correct) with a new project named Baloo.

The Baloo project is headed by KDE developer Vishesh Handa, who apparently was very much involved in Nepomuk as well. Baloo wasn't announced officially to the 'public' till now, but thanks to recent Phoronix articles, it's been gaining some attention. The article titled "KDE's Nepomuk Doesn't Seem To Have A Future" went on to say:

"It appears there isn't much of a future left to KDE's Nepomuk framework that was developed at a cost of 17 million Euros... It's going to be replaced going forward in the KDE land."

The tone of the article hasn't pleased everybody. Now there's some storm on KDE promo mailing list with KDE guru Aaron Seigo suggesting that the new project should've been branded as just another version of Nepomuk. Many members, and especially Vishesh Handa, the project maintainer are opposed to this idea and want Baloo to remain as a new project, one that replaces Nepomuk.

I've been a moderate fan of Seigo, but reading through the mailing list, I couldn't stand the stink of his PR bullshit.

Some things that everybody (even Seigo) seem to agree on:
  • Nepomuk wasn't the greatest piece of software
  • It hasn't got any love from users
  • The 'semantic features' introduced by Nepomuk had few users
  • Baloo is significantly better and faster than Nepomuk ever was

As for me, the very news that Nepomuk is going to be removed is reason to rejoice. Nepomuk was a f**ked-up useless piece of bloat-ware. For some reason, its proponents were pushing the idea that 'rating and tagging your files' was the next big thing that users want to do. Then there was this desktop indexing/search that would suck the juice out of your desktop experience - something Java does to your online experience.
In fact, disabling desktop search and Nepomuk is the first thing I do after a fresh installation of Fedora. I wonder if Nepomuk had as many happy users as it had developers and PR dudes!

Seigo seems to think that Nepomuk-KDE (and KDE's association with Europian Union project) is something to boast about and he apparently fears that the PR team would lose this if they are to switch to Baloo. He proposes to brand Baloo as Nepomuk v2 (or v3 or whatever) so that the awkward situation of accepting Nepomuk's failure can be avoided or at least soothed.

I'd say that a press release announcing the death of Nepomuk-KDE would only evoke positive emotions from users. One may hide behind euphemisms and other PR tricks, but the facts of the case are undisputed.

Read the mailing list entries:

Saturday, November 23, 2013

My very first self-made wine!

Today I tasted the result of our first ever home-made wine experiment - and it was awesome. The wine turned out to be sweet and reasonably strong.

I followed the popular instructions from Kosukadi. We used only common ingredients - regular dark grapes and yeast. Didn't look for any fancy grape varieties or special yeast.

The only deviation from the recipe was that I didn't add any egg white. And perhaps I slightly overdosed on the wheat too. Don't know if that has any effect anyway.

I followed the instructions thoroughly. The ingredients were mixed in a sterilized glass jar. As instructed, for the first 21 days, I opened it regularly and mixed the contents with a clean spoon. I might have missed a day or two, though. On the 21st day, the contents were filtered and the solid residue was removed. The filtered brew was stored back in the jar for about another 40 days (no daily stirring required).

And today, I siphoned off the clear liquid from the top in to glass bottles using a clean plastic tube. The wine turned out to be both sweet and strong. We loved it. I'm not a seasoned wine taster, so I can't make an educated comment on its quality. But for me, the experiment is a resounding success and inspiration to try out more variations and recipes :-)

For those wanting to try wine making, I'd strongly recommend Kosukadi's recipe. Its simple, cheap and gets great results.

Once we're done with this batch, I think I should try pineapples. He he..

Monday, November 11, 2013

Philips and the Monkey Pen - Movie Review

Philips and the Monkey Pen is a children's film that showcases the innocence of childhood. The central character is Ryan Philips (played by Sanoop, actress Sanusha's brother), a mischievous school boy who has a special dread for Mathematics. His parents (played by Jayasurya & Remya Nambisan) are good folks who love him and generally let him do whatever it is that he does.

Ryan is exceptionally bad at mathematics. He is terrified of the subject and hates the teacher (played by Vijay Babu) who regularly mocks and canes him for not doing his homework. Ryan's quest for a solution to his maths homework chores first takes him to his love interest - Joan. After that route fails, he stumbles up on a magic pen - The Monkey Pen, from his grand father's (Joy Mathew) antique collection. The pen is believed to have magical powers and had even helped Robert Bristow to build Kochi's Willingdon island. The rest of the story is about how Ryan's days are transformed by the pen and the magic it does to his life.

Sanoop as Ryan Philips has delivered a decent performance although some of his lines seemed to be artificial and forced.  Jayasurya has done a fair though not spectacular job while Remya Nambisan didn't have to do much with her role. Vijay Babu as the mathematics teacher was convincing while Mukesh's character as the school principle wasn't specifically noteworthy.

Overall I find the film only slightly above average. The film is notable for its great visuals and good performances by the child actors. However the script and direction weren't up to the mark and the story telling left a lot to be desired. The movie wanders off track in several places and the makers seem to be confused about the correct dosage of preaching to be stuffed in the movie.

When Ryan went to work at the school with his magic pen, I couldn't help but recollect Haley Joel Osment's performance in the movie Pay It Forward (just another kid-in-a-school story, no plagiarism accusations please).

PS: I wonder how they come up with the kids' names! Ryan Philips is perhaps one of those stylish (read western) christian names that have become popular these days (along with the likes of Rex, Max etc.). His friends have Amar-Akbar-Antony names, making it look like they want to maintain cultural balance in their panel for winning the next elections! The class topper is named Decimal! What's next, Binary?

PPS: മങ്കി പെന്‍, മങ്കിപ്പെന്‍, മണ്ടിപ്പെണ്ണ്..  ആ..യെന്ത്? ഛെ ഛെ..

Saturday, October 26, 2013

Wishbone - Restaurant

Wishbone is a relatively new restaurant at Kuravankonam Junction (just beside Cafe Mojo) offering healthy and/or tasty dining to the city folks.
The restaurant is overseen by Ms. Lalitha Appukkutan, a nutritionist who occasionally appears on TV shows (related to diets).

The restaurant almost exclusively focuses on chicken, besides its choice of vegetarian dishes. They have two menus - Ultimate Wish & Heavenly Wish. The Ultimate menu is for the calorie conscious and the Heavenly one is for those who wish to honour their taste buds. Both menus have veg & non-veg dishes, but I found the Heavenly menu more attractive because it had more chicken dishes :-)

The restaurant is very well furnished and give off a comfy ambience. The place is not very big and sometimes it does feel a bit crowded and noisy depending on who your neighbours are. But the food is really good. All curries are served steaming hot and have a distinct freshness about them. Serving quantity is medium and even low for some dishes. All items are very reasonably priced - about Rs. 90-140.

I found all dishes (I mean the ones we had, of course) to be excellent, except for 'Irachi Puttu' which was a let down. The dessert menu is also quite limited. I tried the Coffee Vanilla pudding and Coconut pudding. Both were quite okay.

I wouldn't use the word exquisite, but it was the best dinner I had in recent times. So if you crave for some good food, do checkout Wishbone.

Sunday, October 20, 2013

ഇടുക്കി ഗോള്‍ഡ് - Movie Review

ആഷിക് അബുവിന്റെ പുതിയ സംരംഭം 'ഇടുക്കി ഗോള്‍ഡ്' പ്രദര്‍ശനം തുടങ്ങിയിട്ട് ഇപ്പോള്‍ ഏതാനും ആഴ്ചകളായിരിക്കുന്നു. പ്രതാപ് പോത്തന്‍, രവീന്ദ്രന്‍, മണിയന്‍പിള്ള രാജു, ബാബു ആന്റണി, വിജയരാഘവന്‍ എന്നിവര്‍ മുഖ്യകഥാപത്രങ്ങളെ അവതരിപ്പിക്കുന്നു. സജിത മഠത്തില്‍, ജോയ് മാത്യു, രവി വള്ളത്തോള്‍ എന്നിവര്‍ അത്ര പ്രധാനമല്ലാത്ത റോളുകളില്‍ ഉണ്ട്.

ഇടുക്കിയിലെ ഒരു ചെറിയ സ്കൂളില്‍ പണ്ട് ഒന്നിച്ച് പഠിച്ച അഞ്ച് കൂട്ടുകാര്‍ വര്‍ഷങ്ങള്‍ക്ക് ശേഷം (അതായത് അവര്‍ പ്രതാപ് പോത്തന്റേയും, വിജയരാഘവന്റേയുമൊക്കെ പ്രായമായപ്പോള്‍) ഒത്തുകൂടുന്നതും  ഓര്‍മ്മകള്‍ അയവിറക്കാന്‍ ഇടുക്കിയിലേക്ക് നടത്തുന്ന യാത്രയുമാണ് കഥാവൃത്തം. ഭൂതവും വര്‍ത്തമാനവും ഇടകലര്‍ത്തിയാണ് സിനിമ പുരോഗമിക്കുന്നത് (പേടിക്കണ്ട, Memento പോലെ വട്ടാക്കുന്ന ഫ്ലാഷ്-ബാക്കുകളൊന്നുമല്ല).

ഇടുക്കിയിലെ മലനിരകളില്‍ വളരുന്ന കഞ്ചാവാണത്രേ ഈ 'ഇടുക്കി ഗോള്‍ഡ്'. "ശിവന്‍ മുതല്‍ ചെഗുവേര വരെ" വലിച്ചിരുന്ന നീലപ്പുക എന്ന് ചിത്രം അവകാശപ്പെടുന്നു. ഈ കഞ്ചാവ് ചിത്രത്തിലെ കഥാപാത്രങ്ങള്‍ക്ക് ഒരു പ്രധാന മോട്ടിവേറ്ററാണ്. പഴയകാലം ഓര്‍ക്കുക മാത്രമല്ല, ഇടുക്കി ഗോള്‍ഡ് ഒന്ന് പുകയ്ക്കുക കൂടിയാണ് ഇവരുടെ യാത്രയുടെ ഉദ്ദേശ്യം. കഞ്ചാവിനെ ഗ്ലോറിഫൈ ചെയ്യുകയാണീ സിനിമ എന്ന് വ്യാപകമായ വിമര്‍ശം ഉണ്ടല്ലോ. എന്തായാലും Marijuana കേന്ദ്രീകരിച്ചുള്ള എത്രയോ ഇംഗ്ലീഷ് stoner comedy സിനിമകള്‍ നാം കണ്ടാസ്വദിച്ചിരിക്കുന്നു. അതിനൊന്നുമില്ലാത്ത പ്രശ്നമൊന്നും ഈ ചിത്രത്തിനുമില്ല. പിന്നെ, ഈ കാരണം കൊണ്ട് ഇതൊരു "കുടുംബ ചിത്രം" അല്ലായിരിക്കാം. ഇറങ്ങുന്ന ചിത്രങ്ങളെല്ലാം ദിലീപിന്റെ വളിപ്പുകള്‍ പോലെ "കുടുംബ ചിത്രം" എന്ന ബാനറില്‍ വേണമെന്നില്ലല്ലോ. എല്ലാ തരം ചിത്രങ്ങളും ഉണ്ടാകട്ടെ.

കഞ്ചാവ് വിവാദങ്ങള്‍ക്കപ്പുറം, തരക്കേടില്ലാത്ത ഒരു സിനിമയാണ് ഇടുക്കി ഗോള്‍ഡ്. കൊള്ളാവുന്ന ഒരുപാട് തമാശകളും, ഉഗ്രന്‍ വിഷ്വല്‍സും, നല്ല ഏഡിറ്റിങ്ങും, ഗാനങ്ങളും ചിത്രത്തിന്റെ മുക്കാല്‍ ഭാഗം വരെ നന്നാക്കിയിട്ടുണ്ട്. എന്നാല്‍ സിനിമയുടെ അവസാനം സാമാന്യം ബോറാണ്. ഇതെങ്ങിനെയും കൊണ്ടൊന്ന് തീര്‍ക്കണമല്ലോ എന്ന മട്ടിലാണ് ക്ലൈമാക്സ്.

കഥാപാത്രങ്ങളുടെ ബാല്യകാലം അഭിനയിച്ച പിള്ളേരെല്ലാം നന്നായിരുന്നു. രവീന്ദ്രന്‍ (പഴയ ഡിസ്കോ രവീന്ദ്രന്‍) കലക്കിയപ്പോള്‍, ബാബു ആന്റണി, മണിയന്‍പിള്ള രാജു, പ്രതാപ് പോത്തന്‍ എന്നിവര്‍ ശരാശരി നിലവാരം പുലര്‍ത്തി. ബാബു ആന്റണിയെ ചിത്രത്തില്‍ കാസ്റ്റ് ചെയ്തത് എനിക്കിഷ്ടപ്പെട്ടു. എന്നാല്‍ വിജയരാഘവന്‍ അത്ര ശരിയായോ എന്ന് ഒരു സംശയം. ജോയ് മാത്യുവിനെ ഇറക്കിയത് നന്നായെങ്കിലും സജിത മഠത്തിലിന്റെ അപ്പിയറന്‍സ് വെറുതേയായിപ്പോയി.

സിനിമ പൊതുവേ ഒരു തമാശ ലൈനാണ്. അവസാനത്തെ ഏതാണ്ട് അര മണിക്കൂറൊഴിച്ചാല്‍. ഈ അര മണിക്കൂര്‍ തന്നെയാണ് ചിത്രത്തിന്റെ പ്രധാന ന്യൂനതയും. ഒരു കാട്ടാന ജീപ്പിനെ ആക്രമിക്കുന്ന രംഗമുണ്ട്. ന്യൂ ജെന്‍ സ്റ്റൈലില്‍ പറഞ്ഞാല്‍ വന്‍ ഡെസ്പ്! കുറച്ചുകൂടി നന്നായിട്ടഭിനയിക്കുന്ന മറ്റേതെങ്കിലും പ്രതിമ ആനയെന്ന് പറഞ്ഞ് കൊണ്ടുവയ്ക്കാമായിരുന്നു.
പിന്നെ ചിത്രത്തിന്റെ ക്ലൈമാക്സും അത്ര സുഖം പോര. കൂടുതല്‍ പറഞ്ഞാല്‍ സ്പോയിലര്‍ ആകും എന്നതിനാല്‍ ഒന്നും എഴുതുന്നില്ല.

ചിത്രത്തെക്കുറിച്ച് വിമര്‍ശനങ്ങളും വഴക്കുകളും വരെ സോഷ്യല്‍ മീഡിയകളിലും മറ്റ് സൈറ്റുകളിലും സജീവമാണ്. കുറ്റം പറയുന്നവരെ പ്രതാപ് പോത്തന്‍ ഫെയ്സ്‌ബുക്കില്‍ തെറിവിളിക്കുകയും ചെയ്തിരിക്കുന്നു. ഇടുക്കി ഗോള്‍ഡ് ശരാശരിയിലും ഭേദപ്പെട്ട ഒരു സിനിമയാണെന്നാണ് എന്റെ അഭിപ്രായം. പക്ഷെ ഇത് ആഷിക് അബുവിന്റെ ഫാന്‍സും പ്രതാപ് പോത്തനും വിശ്വസിക്കാനാഗ്രഹിക്കുന്നത് പോലെ മഹത്തായ കലാ സൃഷ്ടിയോ ബ്രില്ല്യന്റ് സിനിമയോ ഒന്നുമല്ല. മലയാളത്തിലെ ആദ്യ stoner movie എന്ന് പറയാം. അതിനെന്തായാലും ഈ ചിത്രത്തിന്റെ ശില്പികള്‍ അഭിനന്ദനമര്‍ഹിക്കുന്നു.

Saturday, October 19, 2013

Fun with arrays in C & C++ - Part2

In Part-1, we saw a couple of examples on array indexing and pointer arithmetic.

Lets dive a little deeper in to array types.

Arrays & pointers

An array is a series of contiguous values in memory and the array name gives us a handle to this list. In C and C++, a pointer refers to (or points to) another object in memory. Since arrays are guaranteed to be contiguous, if we have a pointer to the first element in the array, we can access the whole array (as long as we know how bit it is)

Assigning the address of the first element to a pointer:
int a[100];
int *p = a; //p  now points to a[0]

Here p is a pointer to int and we are simply using the array name for assignment. The array name is said to freely decay to a pointer to the object's type. i.e. if a is an array of objects of type T, then it can be seamlessly converted to a pointer to T (i.e. to a T*).

This is what happens when you pass an array's name to a function that takes a pointer as argument.
For example:
char str[] = "hello %d";
printf(str, 123);

The first argument to printf is actually a char* (well, const char* restrict, to be precise) but we're passing an array instead. This works alright without casts because the array type gets converted to pointer type.
(Note that explicitly specifying array size is optional when it is initialized to some value).

Type of an array
Since arrays get converted to pointers quite easily, people make the mistake of thinking they are the same, but they really aren't.
The type of a when declared as:
    int a[100];
    int [100]

It gets converted to int* easily, but its native type is int[100]. In many contexts, this distinction makes quite a difference.

Multi-dimensional arrays

Consider this so called 2D array:
int a[3][5];

Most people think of it as a two dimensional array - one that has 3 rows and 5 columns. We can index all 15 elements (3x5) by using double subscripts:
a[0][0] gets us the first row, first column element and a[2][4] gets us the last row, last column element. Right?
Although the row-and-column way of thinking works, it doesn't scale well when the number of dimensions are more. With three dimensions, we can still visualize the array in 3D space but beyond that, all hell breaks loose for most people.

A more convenient way to understand multi-dimensional arrays is to think of them as array of arrays. Actually, more than being convenient, it possibly is a more correct way.
In this approach, this is how you interpret an array declaration:
  1. Identify the array name
  2. The number that immediately follows the array name is the array length
  3. Whatever remains is the array object type
Using the above method, let's interpret:
int a[3][5];
  1. The array name is: a
  2. The length of the array is: 3
  3. The type of each object in the array is: int[5]
Therefore: a is an array of length 3, and each element of a is an int[5]. i.e. a is an array of three arrays, each 5 int's long.
a[0] now gets the first element in the array - i.e. the first int[5]. a[1] gets us the next int[5] and a[2] the last int[5].

Pointer conversions

Continuing with the above example of int a[3][5], what should be some-type for the following assignment to work?

some-type p = a;

It is common for people to try int** p; When that doesn't work, they try to get around it by doing an explicit type-cast of a. This obviously is the wrong thing to do.

To answer the question, remember that the array name can convert to pointer to array object's type. In our example, each element in the array is of type int[5]. So a should seamlessly convert to pointer to int[5]. Right?
How do we declare a 'pointer to int[5]'? Here it is:

int (*p)[5];
p = a;

The parentheses around 'p' is needed as without it, the declarion would read:
int *p[5];
which declares an array of pointers (to int) rather than a pointer to an array.

Now, how about this:
some-type p = a[1];

What is some-type? Again, we know that a[1] has type int[5]. So p should also have the same type, right? However, int[5] is an array type and C (or C++) doesn't allow arrays to be assigned to each other. So p couldn't be an int[5]. But it can be something that an int[5] gets freely converted to. Using the knowledge that an array type can convert to a pointer to object type, it must be an int*.

int *p = a[1];
*p     = 5;    //writes to a[1][0]
p[2]   = 9;    //writes to a[1][2]

The advantage of this method is that it easily scales to higher dimensions.

int a[3][5][9];

a is an array of length 3, each element of which is an int[5][9].

Some sample pointer conversions follow:

int (*p1)[5][9] = a;
int (*p2)[9]    = a[0];
int *p3         = a[0][0];
int x           = a[0][0][0];

a[0][0][0]      = 5;
p2              = p1[0];
p3              = p2[0];

x               = p3[0]; //x becomes 5


  • Be aware that an array and a pointer are not identical
  • The type of array is different from a pointer to the element type
  • Interpret a multi-dimensional array as an array of arrays
  • Use the correct pointer types to access multi-dimensional arrays and avoid incorrect type-casts

Wednesday, October 16, 2013

Fun with arrays in C & C++ - Part1

I was explaining some stuff about arrays and pointers to a colleague and thought I should do a post about this. So here goes..

Declare 'a' as an array of 100 int objects:
int a[100];

Set the 10th element to the value 1000:
a[9] = 1000;

The square brackets we used in the above expression is called the subscript operator. We use the index value 9 to access the 10th element because arrays in C and C++ are indexed from 0.

So far so good. Now, what if that statement is slightly modified to:
9[a] = 1000;

If that looks weird and possibly wrong to you, be assured that it is perfectly legal C/C++ code! Moreover, it is identical to the statement: a[9] = 1000.
If this is news to you, then you need to read on..

The subscript operator

The subscript operator works like this:
The expression E1[E2] is equivalent to *(E1+E2); where E1 and E2 are expressions themselves. i.e.

E1[E2] = *(E1+E2) = *(E2+E1) = E2[E1]

(keep in mind that we've not yet discussed operator overloading in C++, so the above explanation involving symmetry of + operator remains valid for basic data types)

That explains why:
a[9] = *(a+9) = *(9+a) = 9[a]

For E1[E2] to work, (E1+E2) should have an address type so that the dereferencing operator * can be applied to it. That requires one of E1 & E2 to be of pointer type and the other be of integral type.

Pointer Arithmetic

The result of adding an integer 'n' to a pointer is an address that is 'n' objects (and not bytes) away from the original address; but only if the original address and the resulting address are in the same array.

For the example array declared above, the expression (a+99) yields a pointer to the last element of the array: a[99]. But it is illegal to evaluate (a+200) since the array is not large enough for the resulting address to be valid. Evaluating such an expression leads to undefined behaviour (demons flying out of your nose and things like that). One subtle exception is that you're allowed to evaluate such expressions if the addresses involved point to one past the last element of the array. i.e. it is OK to do (a+100) even though a[100] is invalid. However, you are not allowed to dereference such an address and that is why evaluating a[100] is not legal (that involves applying * to the address one past the last element).

Another side effect of the definition of pointer arithmetic is that you can add integer values only to pointers that point to elements in an array. Other expressions will compile fine (since the compiler does not have any mechanism to determine where the pointer is going to point to at runtime) but result in undefined behaviour.

Note that we said objects and not bytes in the definition of pointer addition. Adding an integer value to an address always advances that address by that many elements, irrespective of the size of one element. On a 32-bit machine where int is 4 bytes long, adding 10 to an int* actually advances it by 40 bytes. Adding the same value to a double* will advance it by 80 bytes since a double is 64-bits wide. That is why a[10] which is *(a+10) always gets the 10th element in the array, irrespective of the type of elements in the array.

The result of subtracting an integer from a pointer works in a similar way. Both the operand address and the resulting address must be within the same array (or at most one past the last element of an array).

Unlike addition, you are allowed to subtract two pointers. This works as long as both are pointers to elements (or one past the last element) in the same array. The result is an integer and is equal to the number of elements between the two addresses.
i.e. (a+50) - (a+10) yields 40.

  • a[b] = *(a+b) = *(b+a) = b[a]
  • You can add or subtract an integer to/from a pointer to get a pointer as result
  • But you can't add two pointers since that doesn't make sense
  • But you can subtract two pointers to get an integer result
  • In all pointer arithmetic, the operand address and the resulting address must point to elements within the same array or at most one past the last element of an array
  • (a+n) gets you the address of a[n]. i.e. it is equivalent to &a[n].

Food for thought

What does the following expression mean?