The year is 1986 and it is a hot and humid April morning. I was lying around in hospital bed feeling bored beyond imagination. My parents were still trying to plan for my sister who would be born in a few day's time. I was past the sick phase and quickly moving into the hyperactive run-around stage that is often the bounce back of the sickness.Amidst all the turmoil, someone presented me with a book - a simple twenty page book of poetry. I could barely read malayalam at that point, I could read the letters but not fast enough to actually read out.
That book was Kunjunni Kavithakal. I read them more from boredom than actual interest - but I was hooked. At first glance the words were simple, but now that I look back they meant a lot more than a dictionary would reveal. But even to a literal minded child the poems were entertaining and even more importantly easy to remember. I still remember some of the lines I read twenty years ago.
More vividly, I remember meeting O N V Kurup on a train to cochin, a month or so later. We are distantly related by someone on my mother's side and my maternal grand parents, who were with me on the train, knew him. He was basically taken aback when I said - " I don't know about your poetry, but kunjunni mash's poetry is Poetry ". Of course, after ten more years of learning malayalam (and maybe ten more of ignoring it), I still haven't changed too much in opinion - which may not be a good thing, but that it.
Oru mayilpeeli undente ullil, Oru valapottundente kayyil, Virasas nimishangal sarasamakan-iva dharalamam-an-enikke
Maybe that's what I miss of childhood, to enjoy the simple pleasures of life - paper boats in the rain water, raw mangoes with salt and hide 'n seek at the tharavad. Hearing of his death brings back memories of other things lost and certain smile at a paradox of pokkamillayma aaNente pokkam.
Kunjunni Master - (1927-2006)
--In this world, nothing is certain but death and taxes.
-- Benjamin Franklin
You see all these links around with ymsgr: in them. Well, I was tired of cut pasting those and then removing all the url and SendIM crap. gaim-remote supports AIM urls out of the box, mostly. I wondered how hard Yahoo! would be - it turned out to be a peice of cake.
You can find my patch - remote.c.patch. It is basically something any idiot could've written. Here's most of the code :-
/* ymsgr:SendIM?*/ else if (!g_ascii_strncasecmp(uri, "ymsgr:SendIM?", strlen("ymsgr:SendIM?"))) { char *who; char *msg; GaimConversation *c; uri = uri + strlen("ymsgr:SendIM?"); who = g_strdup(uri); /* we don't want to implement messages, dude */ if((msg = strchr(who, '&')) != NULL) { *msg = '\0'; } c = gaim_conversation_new(GAIM_CONV_IM, gc->account, who); g_free(who); }
Was that simple or what ? Sadly the gaim-remote plugin is no longer in cvs. So there's no point in submitting a patch upstream.
firefox/thunderbird support: . First you need to add two entries to your about:config. The first is a string entry network.protocol-handler.app.ymsgr and it contains /usr/local/bin/ymsgr-launch and the other one is a boolean entry named network.protocol-handler.expose.ymsgr with true. The ymsgr-launch is basically an executable shell script with the following.
#!/bin/sh gaim-remote uri $1
At this point, both the ymsgr:SendIM and ymsgr:AddFriend work nicely. Click, click and click.
--I waited and waited and when no message came I knew it must be from you.
I've come to love php. No, not really - but some of their fan generated advertisements literally kill me. To quote Rasmus about what's happening out there :-
Being an open source project, we don't have an HR nor a marketing department to bug us about political correctness. Nobody can get fired. Anybody can do whatever they want.
There are many such pics that are floating around the web with PHP splashed all over. There are a lot of other projects like firefox which have outrageous posters. Amidst all that, here's one that quite caught my attention - feel free to guess why.
Projects aren't really about code, they are about communities. Technical issues get solved in commercial companies as well, but FOSS communities take the rest of the being together, building together thing to the next level. Basically, writing code isn't the only way to have fun.
Do what's fun.
--If God had meant for us to be naked, we would have been born that way.
I had a lot of fun in Calicut. In fact, I totally went crazy in Calicut as even casual observers would have noted. But there was a method to this madness. Away from the student masses and the bustle of the city, there is a beach. It is far far away from the NIT itself - so we got a cab to travel to the beach and possibly, hopefully see the sunset. We were standing around in campus watching the sun go down and further down slowly, waiting for the cab to arrive.
We had to drop premshree's cousin and were going slightly roundabout towards the beach. So when we dropped her off, he too went to push back all his laptop and bags at the house, while we all idled around. Finally we got to the beach with barely a minute of the sunset left, but we enjoyed it anyway.
That's when the madness started in earnest. I hadn't been to a beach in over a year - the last time I went was to the Cherai Beach with my cousins. But this time around, I wasn't the responsible one - I could literally let my hair down and enjoy. Well, so did almost everybody.
I had brought a pair of shorts along with me in the jeep. But before I jumped out onto the beach, I had forgotten to actually change, what with the sunset and the timing. Anyway, since the tide was headed in the waves were pretty awesome and I started by wading waist deep in the water. Quite an amazing feeling when a big wave comes along and hits you square on the chest.
That day ended when I trudged back up the beach in wet Levis and changed into the shorts. I had to face the slight embarrasment of people staring at my knees - they got a lot of unwanted attention from the paparazzi as well.
The next evening saw us standing around near the event hall with nothing to do. There were some people playing in the basketball court nearby and philip said let's play. The last time I played basketball was in 2002 in college. I sucked badly at the game, especially blocking bluesmoon's passes to shreyas. To top all that, I was so stiff from the acrobatics the other day that my turn was more of fifteen degrees than the full ninety. If it weren't for shres's loose pants, we'd have got our asses kicked.
After this, we headed out to a valley nearby called the sunset point. Basically you can see a long way out from the hilltop and there is a lot of bird life around. We basically sat there for a while and then got back to the guesthouse to pack and leave for Bangalore.
Ah, good fun.
--Bing's Rule:
Don't try to stem the tide -- move the beach.
This is not an admission that's going to cost me much - I love xterms. If you peek into my desktop at any random time, you'll find a bunch of xterms all ssh-ed into different boxes. And you'd notice one thing, they are all black and with green text scrolling down it. For some Matrix fans here, that'd sound like the only way to watch compiling code scroll by. Other than the nostalgic rush of blinking green monochrome monitors, there is a more pragmatic reason behind this. I just find it easier to read green than white text - it seems to have more contrast than white on black, as strange as that might sound.
So all my xterms are green on black, but that's because the shortcut configured spawns them with xterm -fg green -bg black. But I've got a few scripts which spawn xterms in a loop and I really didn't want to pass these args there directly. Before I go deep into xterm land, let me explain why exactly you'd need that.
APACHE_CHILDREN=`ps fax | grep "\_ /usr/sbin/httpd" | cut -f 2 -d' '` for pid in $APACHE_CHILDREN; do xterm -e "gdb --pid=$pid -x c.gdb" & done
That is what I use to debug multiple apache children for APC. It is a pretty straight forward script, except that I run it on different boxes. Now, I want to make the background and foreground colour configured per user+box rather than hard-code it in a script. The man page has absolutely no information on this particular subject - merely mentions that /usr/lib/X11/app-defaults/XTerm-color is where the system wide configuration lives.
A further read through shows that all such X resources defined can be overriden using ~/.Xdefaults file. But that didn't work. This is exactly where users stop and developers continue probing. One of my favourite tools for finding configuration files read by an app is strace.
[gopal@phoenix ~]$ strace -e open xterm 2>&1 | grep "gopal" open("/home/gopal/.Xauthority", O_RDONLY) = 4 open("/home/gopal/.Xdefaults-phoenix", O_RDONLY) = -1 ENOENT ....
So in this version of xterm, the code hits the ~/.Xdefaults-hostname file to pick up the configuration values and then it all pretty much fell into place - here's what that file had to contain.
*VT100*foreground: green *VT100*background: black
Now, to go and play around with a few more interesting xterm configuration parameters - *saveLines and *VT100.utf8Fonts.font. I'm probably reinventing a lot of wheels and documentation here, but as long as it is fun ...
--He is a man capable of turning any colour into grey.
-- John LeCarre
The organization of FOSS @ NITC surprised me, compared to what I'd seen at other similar conferences. Compared to what went on at GNUnify, these guys are a lot more decentralized in organization and had quite a feel of a student run tech fest. I hardly saw any faculty running around, except for Amarjeet. The faculty was more of facilitiating the event rather than running the event and their pulls on the event was not quite obvious, if any. Quite heartening indeed from my point of view.
When we stopped the narrative last, I'd just reached NIT. We were put up in an AC room in the guesthouse on campus, with carpeting. After a cold bath and basic dressing, we headed out into the canteen for breakfast. Sadly, no appams or idiyappams were on the menu. After a strong coffee inside, we headed out towards the auditorium which was already fairly packed.
Fox2mike was delayed at the station and Pradeepto got the first slot of the day for the mere fact that he'd got there the day before. While pradeepto was trying to teach these kids how to use Qt and KDevelop, I was sitting outside with Premshree and his cousin building pnet on a borrowed laptop. It wasn't a very warm day, but the humidity was uncomfortable for someone from Bangalore. Despite the fact that I was sweating like a pig, I got the builds and presentation functional before I actually walked into the hall to talk.
My presentation had barely any technical content at all. It was basically about the history of dotgnu and how a few basic things in it are built. All that mixed with a few of the interesting incidents that all FOSS projects invariable end up having. People from various places just helping and keeping the project ahead of the curve - that kind of thing.
After that, we sort of hung around the corridors while fox2mike was preaching gentoo from up on the stage. I think except for a few ya maga or something like that at ti22, the rest of it was all in English. Out in the corridor, we got to see premshree talk to his cousin in malayalam. To put it mildly, if I hadn't laughed I'd have choked.
There were students from everywhere - I even found a group who had come all the way up from Trivandrum to attend this event. During lunch, I met a couple of CS students from my college. The point to be noted is that Trivandrum is further away from Calicut than Bangalore is.
After all that, we were treated with bluesmoon's Creative Commons talk. It basically had the flickr creative commons movie and a few walkthroughs in the creativecommons.org. Of course, the moves were amusing if not outrightly funny.
After that, there was a delay while the quake demos were being setup. We spent that time doing a sort of BoF with questions and a bit of interactive demo'ing. We did a bunch of stuff that was basically eyecandy, but made a good impact with the crowd. Shreyas demo'd out his collection of firefox extensions, including the one that makes those tabs come out in pretty colours. Bluesmoon played around with some of his javascript code and dragged around a few divs in a few pages. We all did our extra bit demos till the next presentation was ready.
Basically, that's where the first day at the conference ended. Then we all rushed off to the beach to see the sunset and basically loosen up. And loosen up I did. I'll write about it later, so let's head onto the next day of the conference.
day 2: I woke up late on Sunday and reached the conference centre late. Premshree had already finished his talks and Kalyan's talk was in progress when I walked in. Quite near to where I was sitting, I found a guy from chengannur engineering college trying to break through the cyber-roam security system in the crowd. He has got a fair idea of how MAC address spoofing works now.
Coming back to Kallu's demos, I have never talked on stage about exploiting any system, especially among a crowd of enthusiastic kids. I've sort of tried to stay away from the l33t h4x0r image as far as possible. Considering that was how I came into the world of FOSS, it maybe ironic that I do not actually want these new kids on the block to take that path. The temptation to stray is too high and the opportunities to exploit are higher than it was in 1999. You can happily talk about buffer overflows and cracking binaries, but actually breaking a website when you're in the same legal jurisdiction is just stupid. I'm afraid some kids might actually try some of these tricks, despite being told Kids, don't try this at home. I don't want the guilt of having spoiled some kid's career because he tried to copy my stunts online. So what Kalyan showed at NITC, viz breaking rediff.com's payment system, sort of left me uneasy. But as someone remarked rather sarcastically, if everyone wrote secure code, Kallu would be out of business.
Fox2mike was breaking the college's keyword restriction on the keyword babes using ssh and there were people who were quite interested in knowing how. My answer to all of them is man ssh has enough info - read, learn, understand and use.
We were planning to demo Kororaa which is a live CD based on Gentoo which includes XGL and all associated eye candy. To download that, we went to the college CS labs - there were Fedora login screens as far as you could see. And then the debian workshop started.
And finally, it was time for the day's last talk - Shreyas' FOSS foundry. That was basically a sort of rush through of why you should be helping FOSS and why people aren't already. He made the mistake of asking the audience what he should do and I am almost reflexively replied Dance. Anyway, his talk was basically about Something, something and everything, not to forget the zen of something something. Basically, the idea was to show these kids what they could actually do to get started - report bugs, write docs etc. After all, if it isn't fun, it isn't worth doing.
We borrowed one of the student's souped up boxes and went through a bunch of reboot cycles of Kororaa with increasing amounts of RAM till it worked smoothly. We basically stripped all nearby machines of their RAM to get this one box upto smoking fast and silk smooth operation. On that, we demo'd XGL and all the compiz features we could. It took quite some effort to actually drag ti22 away from the box to give the rest of the audience a chance to even try the basic bits.
After that and a quick awards ceremony we all split up and went on our seperate ways. Our bus was at 9:15 and it was only 5:40 at that point. We spent the rest of the time playing basketball and watching the sunset. We had dinner (idiyappams and ishtu) and headed out on the bus.
--People who go to conferences to talk are the ones who shouldn't.
posted at: 12:23 | path: /conferences | permalink |
I am not the most organized traveller around, but this time it wasn't my fault that the plans were a mess. When shres and me planned out a trip to Calicut, it involved a day time drive through Wayanad and two extra days for the drives. But what came to be was a final and hasty booking on an AC bus from madiwala. We can take the rough with the smooth and we were prepared for a rough trip. We had got the seats 27 and 28, which are right above the rear tyres of the bus. If that wasn't enough someone else had already booked those seats from Kalasipalayam due to some mixup with the ticketing. We got the seats re-allocated to 21-22. But the guys who had got ours weren't really particular about sitting anywhere and we managed to hold on to the seats.
Shreyas slept on, while I was listening to Zeppelin and singing along. And at around 2 AM, the bus broke down. There was some problem with shifting gears and the guy managed to drag it to a nearby hotel. When I walked into the hotel, I was surprised to find someone sitting at the far end in a Yahoo! T-shirt. It turned out to be Jemshad, who was headed for Lakshadweep. We had tea and went our seperate ways, forever more.
In an hour, another bus coming in the opposite direction was flagged down and we swapped buses. By about 4 AM, we hit the ghat section of the road. Intially till we got to Muthanga, the road was pretty flat and minor gradients round the hills. After we got into Wayanad for real, the hairpins started. At around 5, we started our descent from the hills and towards kalpatta.
Because of our delays, we saw the hills of wayanad in the light of the rising sun. The camera had almost run out of batteries and the road was very bumpy - half the photos I took of the dawn are blurry and wavy lines of sun. But the hills looked ethereal in the morning mists. The curves of mist around the foothills, the bright glow of the sun behind the big ones - so beautiful.
We had a bit of early morning confusion about where we were supposed to get down. Since both our phones were unreachable, by the time I got into coverage, there was a huge number of SMS messages about where we are and all that. We were told that we could get down at Kunnamangalam, which around 8 Kms away from the NIT. I called up the reception party about that, who first said "no, come straight to calicut" and called back to check if we could get down there after we were about 2-3 kms beyond the circle. Finally, we got to Palayam, where they picked up us and took us about the same way we came for 20kms to get back to the NIT.
The time - quarter to nine.
--When you ascend the hill of prosperity may you not meet a friend.
-- Mark Twain
I'm off to calicut to talk at FOSS @ NITC and for once, I get a talk slot before lunch. I'll be talking about DotGNU and a few bits of core technology sprinkled in. Well, read the schedule item for yourself.
Most people actually kid around when they say that I shall watch your career with interest. But ever since I watched Coupling, I've sort of peeked around for overflow of the cast into other shows. The latest among those is NBC's Teachers. This has our very own Susan (Sarah Alexander) in it and even more interestingly she seems to be dressed to please :)
This bears watching ... quite close watching indeed. Somebody watch this and tell me if it's any good :)
--Time is a great teacher, but unfortunately it kills all its pupils.
There is a fundamental question that is to be asked for any salaried employee - What is it that gets you out of bed every morning, ready to face the slings and arrrows of daily fortune ? For the last two years, I had a good answer for this question. I want to do things, I wanted to make a difference, in fact I wanted to validate my existance by leaving at least a blot, if not golden letters, on the pages. I never worked for the money, but for this thrill that at the end of it all - something was created, something was born out of all your blood, sweat and tears. Something that would be useful, be appreciated and of course, in course of time arrive at your masterpeice of work, where excellence is a step below perfection.
Some people might consider attaching a label to my irrepressible self - self-motivated. I did things because I can and often because I was the only one around who could. I flitted from task to task and technology to technology like a butterfly on a marathon, sipping my fill and flying on till I felt hungry again. I always felt hungry for more - the more I'd already had, the more I'd want when it was done.
In the last few months, life has not been so rewarding. I went through a couple of depressions in the dark days of winter, but I pulled myself out of it quickly enough to prepare for that much awaited trip to New Zealand. But on returning, the emptiness striked back. A sort of intellectual rot, which sets in because there is nothing for the mind to do but take itself apart and see how it works. Except, it missed a trick on how to put it all back together. Intellectual boredom begins to eat into your mind, body and soul - I crave stimuli, something new, something I can solve, something I can fix. Imagine self-motivation working itself away, finding around it dunes that it gets tired of climbing because it knows there is no way out - sooner or later it has to give up ( by the way, read The Woman in the Dunes, if you get a chance).
All this precipitates as a sort of apathy to the rest of the world which protects you from yourself by diverting you in amusing (also to yourself) directions. The sort of stupid hehe, this is funny way of looking at the world and going along with rather than grabbing your destiny where the hair is short and pulling back onto the quite bent and narrow path to success. Right now I am quite content to show up at work, do whatever's on the table and go home. Exactly the attitude I had come to despise in the average worker whose ultimate and final goal is the paycheck of the month and possibly a slightly bigger one next review.
I have nothing to complain about, yet I do not feel happy. Now, is that what they call experience ?
Pinky, are you pondering what I am pondering ?
--In order to live free and happily, you must sacrifice boredom.
It is not always an easy sacrifice.
I admit it, my eyes are a bit more sensitive to dust. But mostly on my left eye, which got hit with an infection couple of years back and still carries the blood shot look which makes me look like a dope pusher of uncertain sobrierity. But my right eye, that was in perfect condition. At least till, something from someone's holi celeberation found its way in. I don't live in a very upmarket location, few cheap accomodations are, and the crowd throwing gulal at each other hardly would understand what the term carcinogen meant. But that is not their fault, it is completely due to an ivory tower form of education that seems to persist here.
Anyway, so something got into my eye and I did not actually stop to wonder what the irritant might be. Automatically you reach up and rub it across your entire eyeball. You rush back to your house and try to insert the right key into the door - but it just won't be found. At last having got through the key in a door puzzle, you wash your eyes under the shower. Pain abates, only to be replaced with the mild irritation whenever you blink. So I should probably head off and see a doctor. Anyway let's say that I wasted an entire day like that.
Though I am not going to go into a typical adult " I could've lost an eye" rants, but this practically has cost me a sleepless night and still feels a bit sore. Oh, how things have changed since the first gulal was thrown at holi, now you can rest assured it was impure talc coloured in heavy metal colours.
--TV is chewing gum for the eyes.
-- Frank Lloyd Wright
the problem: If you are a C programmer and I mean a really serious C programmer, you must've had to debug at least one memory leak bug in your life. Unless you built something like a CGI script which got torn down after seconds of existence, your patience must've cracked trying to figure out what is exactly slowly eating into your memory space. Even worse, after you found the exact chunk size that was leaking periodically, you might have no way of actually debugging where it leaked. Sooner or later, you learnt about electricfence and more importantly dmalloc. And of course, of valgrind - the holy grail of memory overwrite debugging.
less data, more info: These tools show a big picture view of the process, which meant that you got to see all the leaks everywhere. If you are debugging something huge like evolution, thunderbird or firefox - you don't want to see the entire leak listing because the data structures needed to keep that info outside the process itself is huge. Plan for a couple of GBs if you want to properly run valgrind on such a codebase. The other solution is to put macros everywhere to relay your file name and line numbers to your data structure classes so that you can figure out that the leak apparently in hash.c or string.c is really in prepare_for_cache_premature_optimisation.c.
recompile all strategies: This strategy also fails when you start passing around function pointers. Unless your function pointer prototype changes along with the debug mode, you cannot use that. If you are building a small extension to a big project like php, you do not have the luxury of testing out some two thousand lines of your code on production with a debug mode. That is when you try to figure out how to pass data without adding extra parameters to your function signatures. Using global variables like FFCall trampolines do is not quite the thread safe way.
gcc local functions: There are functions which are local to another function. Try compiling the following code in your gcc.
typedef int (*intfun)(int i); intfun make_adder(int i) { int add(int k) { return (i+k); } return add; } int main() { intfun foo; foo = make_adder(2); printf("%d\n", foo(3)); return 0; }
no, not that way: Even though it might look like a closure to the inexperienced eye, a quick run of the code will tell you that it doesn't work the way you'd have expected it to work. So I decided to quickly hack up a simple closure wrapper for a function by dynamically generating code.
With the help of x86_codegen.h and a rough understanding of x86 call frames, I started to hack this out. This is how the first cut looked like.
malloc_fun_t make_closure(malloc_fun_t original, const char * filename, int line) { byte * code = malloc(4096); byte * method = code; x86_push_reg(code, X86_EBP); x86_mov_reg_reg(code, X86_EBP, X86_ESP, 4); /* add 8 (two words) to size */ x86_alu_membase_imm(code, X86_ADD, X86_EBP, 8, 8); /* frame for next function */ x86_alu_reg_imm(code, X86_SUB, X86_ESP, 12); /* push size */ x86_push_membase(code, X86_EBP, 0x8); x86_call_code(code, original); /* pop frame */ x86_alu_reg_imm(code, X86_ADD, X86_ESP, 12); /* return value in eax, push in data */ x86_mov_membase_imm(code, X86_EAX, 0, (int )filename, 4); x86_mov_membase_imm(code, X86_EAX, 4, (int)line, 4); x86_alu_reg_imm(code, X86_ADD, X86_EAX, 8); x86_leave(code); x86_ret(code); return method; }
But very quickly, I realized that this code segvs on some libc versions while running perfectly fine on all the others. Turns out that with security patches turned on, you cannot run code off memory you allocated using malloc. But it proved to have a simple work around - mmap();
void *allocate_executable_mem(size_t size) { static int zero_fd = -1; void * addr; if(zero_fd == -1) { /* thread safety is for another day */ zero_fd = open("/dev/zero", O_RDWR, 0); } addr = mmap(NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_SHARED | MAP_ANON, zero_fd, 0); return addr; }
That PROT_EXEC did the trick and the memory was now writeable and executable from userland. Then I added a couple more lines of code to ensure that I can distinguish a closure wrapped call from a standard gcc compiled code with a signature magic embedded in the binary code. And wrote some code to jump over it while executing the method.
target = code; x86_jump8(code, 0); /* magic to identify closures */ *(code++) = 0x42; *(code++) = 0x13; *(code++) = 0x37; *(code++) = 0x42; x86_patch(target, code);
Now, I had a function which looked like malloc for anyone calling it, but could relay information about its source line and file in -1 and -2 offsets from start of the returned block. Look at asm-cl.c.
73 malloc_fun_t f = make_closure(malloc, __FILE__, __LINE__); (gdb) x/8i f 0xf1a000: push %ebp 0xf1a001: mov %esp,%ebp 0xf1a003: jmp 0xf1a009 0xf1a005: 0xf1a006: 0xf1a008: 0xf1a009: addl $0x8,0x8(%ebp) 0xf1a00d: sub $0xc,%esp 0xf1a010: pushl 0x8(%ebp) (gdb) c Continuing. 0x8a9f010 traced to asm-cl.c:73 0x8a9f028 traced to asm-cl.c:74
People under-estimate what can be done with C when they say that " I know C ". I'm sad to say that there are whole cookie cutter assembly lines of colleges churning out students who won't appreciate such hacks which subvert the entire meaning of function pointers and take them a step closer to understanding what really happens. The urge to take things apart and see what they are made of is a basic enough human trait. Too little of it bubbles through all the exams and internals into real appreciation for the inner wheels of such otherwise useless magic tricks.
There's only one word to describe the above code - CRAZY. I can't believe I sat down and wrote this.
--You may be right, I may be crazy,
But it just may be a lunatic you're looking for!
Ever since November, I've read through over 18 Terry Pratchett novels. Recently, I've pushed my way through The Monstrous Regiment. It is a pretty nice book which touches the gender discrimination topic, pushed up to a social crisis like a war. There is also a slightly atheistic touch to the theme with a prohibitive God. Even through it all, there are still the jokes, like the vampire who is addicted to coffee. There is still a small thread of believability to the story that makes Pratchett's fantasy enjoyable.
Read through the Night Watch as well. That proved to be a much different story. Except for the villain and the revolution the entire story is just artificial. Though as much as I'd like the Trousers of Time explanation to multiple presents, the story is littered with platitudes such as - It is right, because I'm doing it. But readable and gripping anyway.
Also got my hands on the Bromeliad Trilogy - truckers, diggers, wings
from f3ew. That is more of a child fantasy story which I'd rank below,
much below something like the Carpet People. The clan names in the
store make for some amusement, but you're not likely to read the book
again for it. Though I must say I read the last sentence in
Interesting Times and Maskerade proved to be good reading. The reintroduction of Twoflower from Light Fantastic, sort of brings closure to where the Wizzard chronicles ended up as far as the tourist is concerned. Also parodies of imperial china in terms of names (Lord Hong) as well as the Forbidden City were pushed in late, because the original TwoFlower was never hinted as being such. Also the terracotta soliders rising out of the ground, sort of reminds you of the Qin Terracotta Soldiers. Maskerade had some good ideas, like the fact that people identify the ghost by the mask and that there could be more than one mask wearer. Also it is quite interesting to see why the Three Witches works out - Maiden, Mother and Crone covers women of all ages except for about nine months somewhere in the middle. Not to mention the birth of Perdita who in Carpe Jugulum is the variable X. Inside every fat woman, there's a thin girl trying to escape - thus Agnes had Perdita.
Also, while browsing in Landmark's book piles I noticed two books which had cover images which looked the same. It could be a coincidence, because I was looking for the second book and was taken aback when I recognized the cover as something I read a while back.
I guess good artwork is getting harder to find :)
--It's hard to be religious when certain people aren't incinerated by lightning from above.
So there, I go from nobody to being lead developer of APC - it's official, there's no escape. As the commit message clearly says - the folks I have tricked into helping out. By the way, APC 3.0.10 was just released a few hours ago. Imagine two releases in the space of barely 7 days - 3.0.9 was on 4th.
Anyway, I tried to commit something today morning. Basically, it is a fix to the default arg array problems that I've run into twice. Still don't have a reliable test case, but a long drawn chase with gdb showed what was actually the segv'ing data structure. The zval in the constant array was being pulled around and modified in the php engine land. Somewhere the multiple modifications of the shared memory with no locks was ending up in an inconsistent state and the whole shebang goes for a toss. Fix was to just chuck the dangerous bits into the local memory and just let the engine do what it wants.
**** Access denied: insufficient karma (gopalv|pecl/apc) cvs commit: Pre-commit check failed
Anyway, that was quickly resolved on irc and I got some karma (whatever that really means) and I was able to push in a huge merged patch (+832, -316) from HEAD into INH_FIX branch of apc. Thus, my first commit rolls into CVS - #5423. And hopefully that should break a few things here and there - can't make an omlette without breaking eggs.
--"But the important thing is persistence."
-- Calvin trying to juggle eggs
Last night, was an all nighter. I stayed up to hack out some javascript code for yahoo!. In the middle of all that, something new came up - bug #7070. You can read the bug report or you could see what happened on IRC. All this is leading up to something very important, at least to me, so read on.
<edink> Rasmus: commenting out my_fetch_global_vars() and having auto_globals_jit = off makes apc work on windows <Rasmus> edink: could you add that to the test case? <Rasmus> I'm busy breaking apc further <edink> I'll add comment to #7070 <Rasmus> thanks <Rasmus> g0pz: edink updated bug 7070 <edink> g0pz: seems that calling zend_is_auto_global() with any value from apc_copy_function_for_execution() crashes the thing on windows
Ok, so I had a good long long look at the code and started guessing what went wrong. There's one thing I still don't understand about Zend engine - how does the TSRM stuff works. So following the path of ancestors, who relied on the dark and mysterious and of course, mostly unknown powers of evil to explain bad things happening to good people, I too blamed the unknown.
<g0pz> edink: reall weird <edink> g0pz: yeah <g0pz> has something to do with tsrm ? <edink> g0pz: i cannot tell if its tsrm related <g0pz> because that looks like a bad address there in the tsrm ptr ? <g0pz> 0x00d5b3f6 seems to be a little on the low side <g0pz> sort of makes sense <g0pz> as the apc_copy_function_for_execution_ex is passed as ht_copy_fun_t to copy_hashtable <g0pz> which just calls the apc_copy_function_for_execution_ex with 4 args <g0pz> apc_compile.c:926 needs to be fixed to pass the thread safety macros ? <g0pz> *but* I cannot test anything I fix and neither do I have any idea what any TSRM macro means <g0pz> so help !!! :) <Rasmus> TSRM just wraps all the globals in a struct <edink> g0pz: its just passing void ***tsrm_ls around <g0pz> so just a TSRMLS_FETCH() in scope is enough ? <SaraMG> g0pz: You don't need to understand TSRM.... TSRM understands you <g0pz> SaraMG: in soviet russia ... <SaraMG> >exactly< <SaraMG> Now you're getting it <g0pz> edink: as much as I'd like to help you, this thing needs a professional :) <g0pz> ok, here's how you fix it :) <Rasmus> ctrl-alt-del <insert Ubuntu cd> <g0pz> remove the TSRMLS_DC in apc_copy_function_for_execution_ex <edink> so your func arglist should have TSRMLS_D (no other args) or TSRMLS_DC (other args) in function definition and TSRMLS_C or TSRMLS_CC when calling it <g0pz> and add a TSRMLS_FETCH(); as the first statment in that function <g0pz> now rebuild and hope it works <SaraMG> *ick* <edink> g0pz: TSRMLS_FETCH(); cannot be used if you have TSRMLS_D(C) in function declaration <g0pz> according to a significant proportion of my brain cells, that is how that could be fixed :) <g0pz> remove the declaration <g0pz> you're anyway passing stack junk there <g0pz> the pointer you got was the apc_php_malloc in place of tsrm_ls <SaraMG> Ah, yes <SaraMG> Didn't realize that proto had to conform to a callback definition <g0pz> SaraMG: the shocking part is that it doesn't <SaraMG> The callback typedef being (Bucket*,va_list) <g0pz> that's the check, if I'm not wrong ? <SaraMG> (void*, void*, apc_malloc_t, apc_free_t) <Rasmus> hey hey, no peeking under the skirts unless you are going to dig in and fix stuff <SaraMG> apc_copy_function_for_execution_ex looks NOTHING like the callback's typdef <SaraMG> Like, not even close <Rasmus> details ;) <edink> :)
So, finally I still need to get the other guy to build and test it. Of course, the correctness of the patch has been verified in theory - it was still upto someone to figure out whether that was the only problem in the mix.
<g0pz> edink: don't just stand there, make the changes and rebuild :) <edink> g0pz: made too many changes to my sources :) <g0pz> this is just one more :) <SaraMG> g0pz: So yeah, nix the _DC, use _FETCH, but also add some dummies to that declaration so it fits the calling semantics <g0pz> SaraMG: I haven't got commits <SaraMG> oh.... who are you again? <edink> Rasmus: just make him an accout :) <Rasmus> gah, just fill in your username and password <Rasmus> and garbage in the description field <Rasmus> those warnings don't apply to people who understand the guts of the engine <g0pz> tinker with != understand <Rasmus> close enough
As usualy, we get into optimisations and all that... before it is actually tested.
<edink> g0pz: are you not checking every var if it's an autoglobal? <g0pz> edink: if there's a better way, I'd love to know about it :) <g0pz> because that's what the fetch_simple_variable_ex in zend_compile.c does <g0pz> of course, I could optimize easily <g0pz> with an if(name[0] == '_') :) <edink> g0pz: is the sole purpose of it to load superglobals when jit is on? <g0pz> yes
Finally, the bug is closed - in less than a couple of hours after I saw the bug report.
<g0pz> edink: with that fix, does APC work ? <edink> g0pz: yeah, like a charm <edink> let's see what Rasmus broke :) <edink> well, it compiles :) <Rasmus> everything most likely
End result was that I got commit access to PHP CVS. I am now gopalv of the php - Resistance is Futile. I am yet to be marked as the maintainer of anything, so I'm still in the zone where everything's convenient but nothing really bugs you. Haven't checked in anything yet. That's for a day when I am actually sane and not hopped up on coffee.
Look ma, I'm a php dev :)
--It is not doing the thing we like to do, but liking the thing we have to do, that makes life blessed.
-- Goethe
I used to work on a mobile phone product. Once you start sitting down and reading through the various specs around, you start to realize that most basic designs for mobile phone protocols were built more like the internet was. If you've read The Art of Deception which talks about something called Speakeasy security. The concept dates from the prohibition era in the US, where if you showed up at the right place and spoke the right lingo, you were in. So let's apply the same theories here (no code here).
the place: SMSc numbers aren't that hard to find. In fact, they are published and exchanged between the cellphone companies for routing. For example, Airtel Karnataka's SMSc would be 98450 870xx *. You can easily check it with a simple AT command.
> AT+CSCA? < +CSCA="+9198450870xx",145 < OK
secret knock: you need to see if this allows you to call up directly. To send an SMS with a fake sender, you need to be able to access it using the EMI/UCP protocol. The specification has provision for login operations, but few SMSC's actually enable strict authentication.
right lingo: You could mess around with Net::EMI::Client perl script to generate all your PDU data. Otherwise that protocol is just padding hell to generate easily. Technically it is child's play to actually dial out to the SMSc push out the PDU you want and then just wait for people to get messages with *interesting* sender numbers (42-31337-31337, anyone ?).
All this is common knowledge in the GSM services world. You just need to know what to look for and then a few bits & peices on how to use it with a desktop.
--The reader this message encounters not failing to understand is cursed.