< February 2007 >
     1 2 3
4 5 6 7 8 910
Tue, 27 Feb 2007:

After a roller coaster career, my first php extension has hit php cvs, with all the memory leaks settled, nearly all the features done and all promises kept. Hidef, as it was originally known acquires a new and improved slogan "Constants for real" as well as a place in the PECL packages. If you want to install the module, just run this simple command and have the binary built & dropped into your php install - except for the extension=hidef.so line.

bash# pecl install "channel://pecl.php.net/hidef-0.1.0"

If this actually makes a significant difference in your code's performance, I'd say that you've done a wonderful job otherwise. Most of the code is stolen off a template Rasmus had and packaging was thanks to Pierre ... which leaves me with a distinct feeling of having put a few legos together - but to my credit, at least the peices fit.

We demand rigidly defined areas of doubt and uncertainty!
                -- Vroomfondel, H2G2

posted at: 01:27 | path: /php | permalink | Tags: , ,

Mon, 26 Feb 2007:

APC released version 3.0.13. The last couple of months haven't produced too much code from me, so most of the changes in there are due to the efforts of shire & rasmus. But I've left a couple of booby traps in there for invalid free() calls, which should reduce a decent number of those random memory corruptions into a more decent error report.

I've been unsuccessful in making the Real World go away for long enough to actually rewrite the shm allocator - not even a patch job with a linked list, rather than the mythical lockless allocator I've been promising for three months.

I feel guilty, but there's so much to be done and I'm only ... *counts* ... one man.

After months of careful refrigeration, Debian 2.0 is finally cool enough to release.
          -- topic on #debian

posted at: 02:27 | path: /php | permalink | Tags: , ,

Wed, 14 Feb 2007:

*DRUMROLL* I'm proud to announce the first commercial product to use dotgnu Portable.NET in a big way. Trumpf.de have brought out a pulse laser cutting tool which uses dotgnu. The embedded control device runs linux and uses dotgnu to power its control UI, running a Windows.Forms application on the touch screen. Here's how the embedded appliance looks like - isn't it purty ?

It is one of those days that you live for - when you can stand back and marvel at what has become of bits you twiddled. And congratulations to klausT, avd and radekp for supporting Trumpf. Of course, much heartier thanks to Trumpf for believing in our code, being a good customer and investing a good ten thousand dollars or more into the project, even more when you consider the number of patches from them directly. That kind of customer focus has essentially revived pnet from the ashes of its past into a new good groove of embedded goodness.

If want, you can take a look at the official brochure, but which doesn't mention anything about linux or dotgnu, sadly. There's more related stuff upcoming - I'm trying to get ARM support resurrected with the help of Pengutronix folks.

A solid year's worth of work has gone into pnet thanks to this and the next stable release is only four days away. This is the first release to include libjit support - adding a full x86 JIT to the engine core. The twin team of Klaus and Alesky have reworked the engine so much that I've been having trouble jumping back into the project without asking too many stupid questions. So, look out world, here comes 0.8.0.

Been a good five years - looking back.

You know, I have one simple request. And that is to have sharks with frickin' laser beams attached to their heads!
                -- Dr Evil, Austin Powers

posted at: 09:14 | path: /dotgnu | permalink | Tags: , ,

Tue, 13 Feb 2007:

You've got to hand it to Steve Jobs. Moves he in mysterious ways, his wonders to perform. I've ranked him as a master of mystery and hype for years, but never realizing what other depths of talent he might posses. I'm still digesting the lessons I learned off Machiavelli's classics (Art of War, lies at my desk, bookmark a few pages in), but it doesn't take a genius to marvel at the Machiavellian motions of this spin doctor.

Let's get our facts straight first. Steve Jobs is the CEO of one Apple "fruit company" Inc. His company makes and sells the iPod, which nearly monopolizes the digital audio player market. Now, in a very loose-laced attempt to follow the Gillette Razor Blade approach to customers, they have a nice little store which sells songs to any customer who might wish buy them.

Now, to curb piracy and pacify the rabid record industry watch-dogs (popularly known as the MAFIAA), Apple introduced a DRM solution named FairPlay. The system works and is lenient enough to keep people from breaking it accidentally, which lets the average joe ignore the fact that it exists. The iTunes Music Store however, has protections clauses in its contracts with the recording industry, which render the contract null & void if the DRM is broken and Apple can't fix it within a specified period (a fortnight).

So, as of date, iTMS cannot sell songs which would play on one of my MP3 players. Nor, can they relicense their FairPlay codecs to other vendors - because they are liable for all disclosures - accidental or not. So let us sprinkle some iMagic sparkles and see what happens.

The Pledge: Steve Jobs goes out there and proclaims - I wish for a world without DRM - really, that's what most reports about his open letter convey. Now, why would a man who has benifited the most from the status quo advocate such a step which might break his own monopoly ? The cynic in me, suggests - because he could profit more and in the short term, too. But selling un-DRM'd songs to users of other mp3 players doesn't look like something worth risking your credibility, like this - especially not when the iPod is the king.

The Turn: The Music Industry will NOT say yes. Warner music has already said that Mr Jobs' proposal is "without logic and merit". It would be idiotic of His Steveness to assume the industry would suddenly develop a conscience overnight. But they too want iTunes to sell more songs, even to people who don't have iPods - as it turns out this thought was spelled out in the open letter - because that's what Steve really wants too. Mysteriously, suddenly all the executives smell money in the air and they want it !

The Prestige: The open letter details another alternative - licensing FairPlay to current and future competitors, which isn't technically impossible but rendered practically impossible due to the protection clauses in the contracts with the music publishers. Having led their greed to this obvious alternative, when they suggest it (as their choice) I suspect Apple is about to ask them to rewrite that bit of the contract.

If Steve Jobs had asked the MAFIAA to reconsider their contracts in January, they'd have definitely smiled (like the smile that follows seals and has a fin attached) and asked for a cut off every iPod sold. But February is much warmer for Apple - where they are in a win-win situation. If the industry doesn't let Apple go drm-less (a near impossibility, that) - Apple come crying back to us, "They never let us have any fun !". If they rewrite the contract, letting Apple hawk their DRM, more money for Steve - oh, much much much more money than the extra DRM-free iTMS purchases would fetch. And just in case, they manage to go DRM-free, they'll have a new crowd knocking at their door - not to mention all the kudos for fighting those evil corporations for our rights.

All those options are good for Apple - but for anybody who buys from iTMS, only the last option is any good - Apple: 3, you: 1. But you've got to appreciate style, precision and direction of this so called "attack on DRM". After all, a best defence is a good offence.

Some lesson in negotiation that, woohoo. *But* - if it was that transparent to me - could it still work with RIAA ?

"No" is often the first word in every negotiation.

posted at: 06:46 | path: /observations | permalink | Tags: , ,

Sun, 11 Feb 2007:

Oh, how often has that tired old line been repeated. But now, there are a lucky few in Yahoo! who can back it up with a certificate, which looks something like this.

The card is given out once you take a trust fall, where the other guy/gal catches you while you fall and push you onto the soft padding. The card, on the flip side, has more content and it goes like this.

I've got the expertise to make the right decision here. So let me. 

Once you accept this card, you agree to avoid second-guessing me, 
escalating the situation, or switching on the blamethrower. 

If it works out, great. If not, I agree to take a fall.

Oh, and it says on the bottom - may not be transferred, sold or substituted for U.S dollars - maybe I should try paying it with some real geek money, like pizzas, beers or t-shirts.

Cheesy, cheap and corporate - but the designers had their hearts in the right place. And If you liked it, take a look at Yahoo! Bangalore's campus brochure.

Who does not trust enough will not be trusted.
                -- Lao Tsu

posted at: 09:52 | path: /yblr | permalink | Tags: , ,

Divisiveness is never something to be encouraged in any community - online or offline. Regionalism is one of those toys for those first crude attempts of Salami Tactics. The introduction of imaginary lines, dividing where no division existed, pulling in foreign boundaries into an otherwise level ground is one of the first seeds of discord that you can seed a community with - especially where physical meetups occur out of band. People who've met each other physically generally interact better and this can be easily misinterpreted as a regional or language bias.

God knows there have been wars fought over much less. And there was one on #linux-india because I got involved - with me getting most of the abuse. But here's some history behind the story - some idiot was spamming #linux-india in 2005 (*some names changed to protect the guilty (and/or innocents)).

**** Dec 13th 2005

*   vIkSiT has changed the topic to: crazy day at #linux-india the ban 
    list doubled in a matter of minutes || /bin/flame > /dev/chill

<lunatech>    vIkSiT: some people thought that the ops (i.e me) 
               were too leniant
<lunatech>    in not kicking people out at slightest provocation
<t3rmin4t0r>  slightest ?
<lunatech>    that was a major reason why I did not give ops to $culprit
<lunatech>    t3rmin4t0r: after the things spiralled out - he was 
              kicked out
<vIkSiT>      why?
<lunatech>    vIkSiT: why to which statement ?
<vIkSiT>      he was kicking people because they were flooding? :)
<lunatech>    no, he was asking for ops, but I did nit give it --
              he started ranting about how the channel was own3d 
              by north indians
<vIkSiT>      he actually SAID that?
<lunatech>    hehe - yes
<vIkSiT>      good god

Now, fast forward to present day - when things have not changed much, as the events would prove. But right now, it is quiet out in the west frontier.

** Chapter #1 - where tazz is a power hungry maniac ... NOT !

<tazz>         Lap_64, i would suggest you do a '/msg chanserv access 
               #linux-india list'
<techno_freak> tazz, for ?
<tazz>         for the good of the channel
<$culprit>     50 members - vow
<tazz>         so that you can see that my name is not in there and
               when the ops here ask woh wantes to be an op here 
               you can vote for me.
<tazz>         comeon Lap_64 i am just a power hungry maniac
<$culprit>     tazz are you from north of the vindhyas?
<tazz>         no i am from the west of the mumbais
<$culprit>     tazz: then you have no chance of becoming an op
<tazz>         hey i have dreams and hopes you know

Now, I've got a good memory - a very good memory. It is not like I've never been sour grapes about being denied anything - but sooner of later you've got to stop throwing tantrums and grow up. I'm nobody's personal shrink, but the above conversation drew a picture of someone pouring in tiny blue drops of bitterness (everyone knows jealousy comes in green) into the common well of wisdom (*narf*) that is #linux-india.

** Chapter #2 - t3rmin4t0r acquires magical op powers

*   ChanServ gives channel operator status to t3rmin4t0r
<tazz>        i wanna be op!, i wanna be op! :-S
*   t3rmin4t0r has kicked $culprit from #linux-india (I need to be born 
    exactly where ... ?)
*   t3rmin4t0r removes channel operator status from t3rmin4t0r
<brainless>   what did $culprit do ? !
<t3rmin4t0r>  heh, he said that you need to be born north of 
              the vindhyas to be an op here

There are a bunch of people in this world, whom you could respect, if only they'd shut up for a while - ESR comes to mind, immediately. These are people who are not only senior to you in age, but in terms of age in the community - people whom you expect to be calm, mature and mellowed. But there are often exceptions which prove the rule (or compensate for it) - even people twice my age.

** Chapter #3 - $culprit unleases his insults 

<techno_freak> omg, $culprit is saying he wont return back
<segphault>    techno_freak: I am damn sure he will

*   $culprit (n=$culprit@xxx.xxx.xxx.xxx) has joined #linux-india
<techno_freak> ahh
*   techno_freak grins at segphault

<$culprit>     t3rmin4t0r: in my opinion you are an immature rascal 
               unfit to be in this channel
<$culprit>     or any channel
<$culprit>     op is a priveldge given to people deemed to be mature 
               enough to protect a channel

*   segphault feels like nostradamus

<$culprit>     unfortunately at times ops are given to petty minded
               people with a chip on their shoulders who like to 
               flaunt their authority
<tazz>         t3rmin4t0r, was harsh in kicking $culprit out.
<$culprit>     not  harsh - a juvenile display of his unfitness to 
               be an op

<$culprit>     why the hell did they make a madrassi an op?
<segphault>    $culprit: t3rmin4t0r is a veg mallu - madrassis come in 
               different flavours -- like sambar
<brainless>    $culprit, well maybe they are not well represented in 
               the op clan ?
<segphault>    I propose a quota system to fix this issue of ops 
<$culprit>     but no more madrassis - and t3rmin4t0r should be de-opped

Funny, isn't it that the same man who was b*tching about people from south india not getting ops is complaining about some madrassi being an op. Yes, the thing I like about these conversations is their consistency of content. But either way, I'm at the pool table (@office) for the period of that conversation - which leaves enough room for other conversations.

** Chapter #4 - "I am codier than thou" quoth the raven

<$culprit>    that woman is a girl who has not contributed a line of code 
              to foss - like her friend empty_mind
<empty_mind>  $culprit, she has contributed far more to Creativecommons 
              than anyone else
*   floyd_n_milan doesn't understand why only `code' is considered as 

<empty_mind>  $culprit, <blank> is not a computer geek she is a writer
<$culprit>    empty_mind: tell her to stick to writing
<empty_mind>  $culprit, it is stupid people like you who piss away serious 
<empty_mind>  $culprit, she is sticking to writig and contributing more 
              than you have contributed
<$culprit>    what happened to that mallu  clown t3rmin4t0r ?

After the random quarter of the continent insults, it starts to get personal - so I'm putting that part off the RSS feed. Let those who want to dig into the steamy underside of IRC life in #linux-india click the link.

** Chapter #5 - insults get personal

<t3rmin4t0r>    what else can I talk about @ a college ?
<empty_mind>    t3rmin4t0r, loads of things
<t3rmin4t0r>    "Do as I say, not as I do" is so hypocritical
<$culprit>      $culprit kicks t3rmin4t0r
<$culprit>      t3rmin4t0r: is the ultimate hypocripte
<t3rmin4t0r>    $culprit: yeah, I took the Hypocrite's Oath
<t3rmin4t0r>    no run of the mill hypocrite, I am
<$culprit>      t3rmin4t0r: you are a cheap asshole
<t3rmin4t0r>    $culprit: exactly how am i an asshole ?
*   empty_mind watches $culprit's cheap rant again

<t3rmin4t0r>    for good, return good
<$culprit>      in every way
<t3rmin4t0r>    for evil, return justice
<t3rmin4t0r>    so if you think I'm a cheap asshole ... let me not be
                the one to judge
<empty_mind>    t3rmin4t0r, "return NULL " to $culprit
<t3rmin4t0r>    $culprit: I still don't understand what you've got against me 
                or anyone else in this channel
<t3rmin4t0r>    but what goes around, comes around 
<t3rmin4t0r>    if you can't deal with it, don't dish out and so on

*   HereBeDragon didn't get the feeling that $culprit has got anything 
    against anyone
<$culprit>      except that mallu asshhole
 *   empty_mind thinks $culprit forgets he is not in a court room
<$culprit>      t3rmin4t0r: why did you kick me from the channel?
<t3rmin4t0r>    because you said something idiotic about people's birth 
                places and channel ops
<t3rmin4t0r>    now, if you can't press /rejoin and take a joke ... I 
                don't know 
<t3rmin4t0r>    is your problem, I guess
<t3rmin4t0r>    drag politics into this channel and start saying 
                regionalistic things about "above the vindhyas"
<$culprit>      t3rmin4t0r: has licked bihari ass and got power and 
                showing it off
<t3rmin4t0r>    just to stir things up, I don't know what a decent ops 
                guy might do
<$culprit>      t3rmin4t0r: you are a sick son of a bitch
<HereBeDragon>  whoa $culprit, let's not be regionalistic
<t3rmin4t0r>    or personal ad hominem attacks
<Lap_64>        $culprit, may be he licked OldMonks arse

<HereBeDragon>  gawd

<HereBeDragon>  folks, no personal attacks or regionalism. Period. 
                That should be the rule.
<$culprit>      anyway i am leaving this channel - until that asshole 
                t3rmin4t0r  is kicked out
<empty_mind>    t3rmin4t0r, kick $culprit again for personal abuse
<t3rmin4t0r>    empty_mind: nah, I don't really take irc that seriously
<Lap_64>        $culprit, chill out 
*   $culprit (n=$culprit@ has left #linux-india

The insults were so bad that we actually suspected whether it was $culprit himself or just someone else pretending to be him. The IP turned out the be a Bangalore IP, while last known location of $culprit was Chennai. Anyway, I don't really care whether it was the real one or an impostor, that kick was warranted as some conversation later proved - people pickup these biases quite easily.

** Chapter #6 - the influence remains 

<$kid>           Oldmonk is true bihari
<HereBeDragon>   $kid: what about Biharis?
<$kid>           HereBeDragon, lots of things
<HereBeDragon>   $kid: "no regionalism" you get it. Or else I'll 
                recommend you be banned.
<$kid>           HereBeDragon, can list them all here for a real example
                see any bihari talk to him for 5 mins and you will know

So that was friday on #linux-india. I hope I haven't made an enemy out of $culprit, he doesn't quite deserve my enimity - but just as a hint, mellow out, old timer. There are so many better things in life to do than mud sling my teflon coated soul - maybe get yourself a copy of the 70's Show DvD and watch The Cat Fight Club episode.

Why don't those stupid idiots let me in their crappy club for jerks?
            -- Homer Simpson (#2F09, "Homer The Great")

posted at: 06:42 | path: /rants | permalink | Tags: , ,

So as it turns out Linux Asia '07 was sponsored by Microsoft and Novell. Even before this was announced, the local LUG - ILUG-D decided that they would boycott the event, and they went through with that decision. But what was to follow is probably competing for the longest single flamefest ILUG-D has ever seen - no holds barred. But the IRC conversations are getting more and more interesting.

<OldMonk> spo0nman: i have very high regard for his intellect
<OldMonk> didn't you see the subtle and suave way in which he insulted me in this channel?
<spo0nman> OldMonk: you stink of sarcasm.

<sm|CPU> Feel the power, know the wisdom
<t3rmin4t0r> "sudo intellectual" (n):
<t3rmin4t0r>       intellecutal whose facts are true because of who he is (or his uid)

<OldMonk> t3rmin4t0r: it strenghthens your argument if you blast your own side first
<OldMonk> after that you can be as rude as you like and no once can take offense

IMHO, except for the lone exception of bluesmoon, there were no other Indian speakers of note amongs the speaker panel. I think bluesmoon could've made a stand in the situation - but LinuxAsia paid for his flights (heh, more miles) and there are enough people in Delhi to meet. Amidst all the flame wars, Sudev seems to keeping his head - being clear about his worries.

The thread has spread to other mailing lists - where opinions differ from Freedom (capital F) of participation to Freedom to boycott.

I'd given LinuxAsia a wide berth because it has a definite CxO trend to it and is really a media circus, run by real media companies, with a definite slant towards appeasing sponsors (alright, explain away the Google Maps Api talk on day 2).

I really wish Freedel was happening this year in Feb, like it was suggested amidst the heat of September, last year.

All diplomacy is a continuation of war by other means.
                -- Chou En Lai

posted at: 03:42 | path: /rants | permalink | Tags: , ,

Fri, 09 Feb 2007:

Consider the past year. Now consider UserFriendly.org's blatant MS bashing of past. And then take a look at the following cartoon.

In the past the Orbital Mind Control Ray could only have been an obvious reference to MSFT (as seen on slashdot). But today, we're making fun of Google - is the attitude towards GOOG changing as the company grows bigger and starts eating small companies for breakfast, lunch and dinner ? Which reminds of this conversation between Bart and Fat Tony from Simpsons 8F03.

Bart: Are you guys crooks?
Fat Tony: Bart.. uhm. Is it it wrong to steal a loaf of bread to feed 
          your starving family?
Bart:     No..
Fat Tony: Well suppose you got a large starving family. Is it wrong to 
          steal a truckload of bread to feed them?
Bart:     Nuh-uh
Fat Tony: And what if your family don't like bread. They like.. cigarettes.
Bart:     I guess that's okay.
Fat Tony: Now, what if instead of giving them away.. you sold them at a 
          price that was practically giving them away. Would that be a 
          crime, Bart?
Bart:     Hell no!

As someone else pointed out, when Microsoft came out, they were the hungry rebels who were freeing the public from the iron fisted data processing overlords, without the cutsey "Ribbons and Ponies" approach that Apple was taking. The big blue of old, which has now become a savior and hero for Linux, was the evil monopoly ?

How often does sides get switched, old rebels become new masters and acquire new allies from old enemies ?

No permanent friends or allies, only permanent interests.
          -- Lord Palmerston

posted at: 11:45 | path: /fun | permalink | Tags: , ,

I suppose it is my own damn fault for not participating. But unlike last year, the hackfest was during daytime, which severly limits my coding abilities. Like so many other people who started hacking during college, my peak hours of coding lie between 7 PM and 11 PM, with the extended version running upto 3 AM - and the muse of coding cannot just turn on & off, on demand. Not to mention my laptop was showing more bad sectors than a minefield in Cambodia.

But what *really* saddens me is the first question titled jail break. I'd discovered this design flaw in chroot() quite a while back and broken out of a real production chroot. On the other hand, I'd have never really made it with the image processing example.

Maybe there was a point - but Hindsight is always 20/20.

Given the choice between accomplishing something and just lying around, I'd rather lie around.
                              -- Eric Clapton

posted at: 10:53 | path: /conferences | permalink | Tags: , ,

Mon, 05 Feb 2007:

Finally got around to getting a debug build of libgphoto2. After a couple of hours of debugging, the problem turned to be one of design rather a real bug. I had to try a fair bit to trace the original error down to the data structure code. This is code from gphoto2-list.h.

#define MAX_ENTRIES 1024

struct _CameraList {
	int  count;
	struct {
		char name  [128];
		char value [128];
	} entry [MAX_ENTRIES];
	int ref_count;

And in the function gp_list_append(), there is no code which can handle possible spills. As it turns out, I had too many photos on my SD card - in one directory. The assumption that a directory contains only 1024 photos was proven to be untrue - for my SD450.

Breakpoint 3, file_list_func (fs=0x522a60, 
    folder=0x5a3660 "/store_00010001/DCIM/190CANON", list=0x2b11e6c38010, 
    data=0x521770, context=0x523d90) at library.c:3933

(gdb) p params->deviceinfo->Model
$2 = "Canon PowerShot SD450"
(gdb) p params->handles
$3 = {n = 1160, Handler = 0x528c90}

So, the code was exiting with a memory error because it ran out of 1024 slots in the folder listing code. When I explained my problems on the #gphoto channel, _Marcus_ immediately told me that I could probably rebuild my gphoto2 after changing MAX_ENTRIES to 2048 - I had already tried and failed with that. As it turns out there are two places which have MAX_ENTRIES defined and even otherwise, the libraries which use gphoto2 have various places which allocate CameraList on the stack with a struct CameraList list;, which introduces a large number of binary compatibility issues with this. But after I rebuilt libgphoto2 and gphoto2, I was able to successfully download all my photos onto my disk using the command line client, though in the process I completed b0rked gthumb.

And you've definitely gotta love the gphoto2 devs - look at this check-in about 15 minutes after my bug report.

The capacity to learn is a gift;
The ability to learn is a skill;
The willingness to learn is a choice.
              -- Swordmasters of Ginaz

posted at: 03:12 | path: /hacks | permalink | Tags: , ,

Sat, 03 Feb 2007:

After nearly a year of messing around with php extensions, I've finally sat down and written a full extension from scratch. I've used all the skeletons and ext_skel scripts, in the proper way to end up with a half-decent extension. It took me around 4 hours from an empty directory to end up with an extension which basically did what I wanted.

hidef: The define() call in php is slow. Previously the workaround to define a large chunk of constants was to use apc_load_constants, which pulled out stuff from the cache, but still had to define all constants for every one of the requests. Even beyond that the value replacement is at runtime, nearly as expensive as a $global['X']. A quick look with vld indicates the problem very clearly.

define('ANSWER', 42);
echo "The answer is ".ANSWER;

	line     #  op           operands
   2     0  SEND_VAL        'ANSWER'
         1  SEND_VAL        42
         2  DO_FCALL        'define', 0
   3     3  FETCH_CONSTANT  ~1, 'ANSWER'
         4  CONCAT          ~2, 'The+answer+is+', ~1
         5  ECHO            ~2

For a lot of code with a lot of defines(), this is a hell of a lot of CPU wasted just putting data in & reading it out, where a substitution would be much better. But first things first, I got a basic extension which would parse a .ini file and define the constant with some magic flags - this is what you'd put into the ini file.

float PIE = 3.14159;
int ANSWER = 42;

The extension reads this once when apache starts up and puts into the php's constants section. The constant is pushed in with the CONST_PERSISTENT flag which means that the constant lives across requests. Recently, Dmitry had put in a new bit into this mix - CONST_CT_SUBST which marks constants as canditates for compile time substitution.

After adding compile-time substitution into the extension code, the code generator replaces constants as & when it runs into them. And here's what the bytecode looks like.

echo "The answer is ".ANSWER;

line     #  op      operands
   2     0  CONCAT  ~0, 'The+answer+is+', 42
         1  ECHO    ~0

You don't need to be a genius to figure out which one would be faster. But the other gopal had done some benchmarks which didn't seem to show enough difference between constants and literals. So, I wrote a quick & dirty benchmark with 320 defines and adding them all up in the next line. Here is the before and after numbers.

Before After
380.785 fetches/sec 930.783 fetches/sec
14.2647 mean msecs/first-response 6.30279 mean msecs/first-response

But the true significance of these few hundred lines of code fades a bit when you pull in APC into the mix. With APC enabled I was still expecting a significant difference in performance and here it is.

Before After
976.29 fetches/sec 1519.38 fetches/sec
4.95603 mean msecs/first-response 3.15688 mean msecs/first-response

The numbers are seriously biased, because for most code the major bottleneck is their DB and therefore I/O bound. But if this small bit of code helps shave off a few microseconds of CPU time, for a few hours of my hacking time, it is pretty good when you consider the scale factor.

So, without further ado - here's hidef 0.0.1 - should build fine for both php5 and php4. And if you feel the urge to fix something in there or write documentation, go for it ! :)

If you don't know what procrastination is just look up the definition tomorrow.

posted at: 02:45 | path: /php | permalink | Tags: , ,

Fri, 02 Feb 2007:

Unlike my trip to LCA last year, which was blessed with some awesome photos, this year I've not put up too many photos yet. But this is not due to the lack of photos taken. I place the entire blame on one little library called libgphoto2 which is refusing to read my photos off my camera.

[gopalv@sirius photodump]$ gphoto2 -L

There are no files in folder '/'.                                              
There are no files in folder '/store_00010001'.
There are no files in folder '/store_00010001/DCIM'.
There are 99 files in folder '/store_00010001/DCIM/189CANON':

#1     IMG_9445.JPG  1982 KB 2592x1944 image/jpeg
#98    IMG_9981.JPG  1704 KB 2592x1944 image/jpeg
#99    IMG_9982.JPG  1705 KB 2592x1944 image/jpeg
*** Error (-3: 'Out of memory') ***       

For debugging messages, please use the --debug option.

From a quick glance, I think my photo collection has hit a unique boundary condition. The photo counter on my camera (which has been heavily used) has touched 10,000 and rolled back to img_0000.jpg into another folder, which is confusing gphoto2 totally.

Philosophy vs Pragmatism: I remember one of those common room conversations about laptops. There was a distinct proliferation of Macs in the room and this particular dilemma tradeoff was thrown into discussion. I think it was Arjen who commented that running Linux shouldn't be an apology for poor performance of hardware - while we were on the topic of OpenWRT and how the conference APs weren't auto-switching off congested RF channels.

I'm at the doorsteps of such a dilemma. One of my friends commented that, if something doesn't work, just drop it and use whatever works. But as a conscentious developer, I'm conflicted between fixing gphoto2 and plugging my camera into someone's Mac (windows ? what do you mean windows ?). I'm pretty sure that one of these weekends I'll pull gphoto2 off SVN and build myself a debug version. But I'm not likely to do that if I actually plug my camera into somebody's Mac and pull my photos out.

But I did manage to upload a few photos, grabbed off the other SD card. Here're the only ones I've managed to upload, so far.

Hmm... this may take a while.

The makers may make
and the users may use,
but the fixers must fix
with but minimal clues.

posted at: 09:29 | path: /hardware | permalink | Tags: , ,