First Camera :)

I've finally got my very first digital camera ever... that is if you don't count the one on my phone. It's a Canon PowerShot A460. Not really high spec at 5 Mega pixels, but a great acquisition for a small wage man like me ;)

So I fired up this beauty and clicked a few shots, around the house. Time to move it to the system, so I plugged it into USB and wallah!!

No, it didn't auto-load as a USB drive as I expected it to (force of habit, since my phone loads that way). I tried all ways to get it to load that way, including playing around with udev rules, but to no avail. After a bit of searching I chanced upon the term 'PTP' or Picture Transfer Protocol and I realized that I was probably barking up the wrong tree.

A bit more searching got me to gphoto2 and I found that all I had to do was plug in the camera and from console type:

  gphoto2 -P

And all photos were downloaded to the current directory. Mission accomplished... erm... almost ;)

I couldn't believe that there was no UI method for getting these photos out, so out of mere curiosity I fired up gThumb and there, in the File menu, I found the magic option 'Import Photos'. Clicked on it and all the photos on camera were instantly visible. I happily imported all of them and felt like a fool for the rest of the day for missing it ;)


Weekend came... and went

Phew! I thought I could find some time to hack this weekend. Wedding shopping meant that the days came and went like a storm and now it'll be Monday in another 25 minutes now. I think I'll have more time on weekdays rather than weekends now ;)

We're probably going to give animated smileys a shot for ayttm soon. I tinkered around with gifs on gtk for a while on Friday and was able to at least load them. They're still not smooth enough though; WIP. Moreover, we don't really have animated smileys yet.

I'll probably move image loading to a completely different layer so that we can abstract loading of smiley files in various formats (gif, jpg, png, xpm, etc.). Tall plans; hopefully I'll be able to finish something before I go on a longish break in December/January.


The End of Time

I had an interesting encounter with the end of time at work today. There are times when our Unix based application deliberately sets a date value to the end (19-Jan-2038) to signify some special scenario. We never passed on this value to our Windows based front end program ever, until today, by accident. And yes, Hell most certainly did break loose. Luckily for us, not in production, just in our Analysts environment.

The issue was that our VC++ made Windows program refused to see 19-Jan-2038 as the end. It saw 18th Jan 2038 as the end and hence mktime() would return with an error for 19-Jan-2038. But this was not the funny bit; read on.

So as I was saying, when I assigned my struct tm as follows:

        t.tm_mday = 19;
        t.tm_mon = 0;
        t.tm_year = 2038 - 1900;
        t.tm_hour = 0;
        t.tm_min = 0;
        t.tm_sec = 0;

and used mktime() on it, the result would be mktime() returning an error status (-1). So next, I assigned my struct as:

        t.tm_mday = 18;
        t.tm_mon = 0;
        t.tm_year = 2038 - 1900;
        t.tm_hour = 23;
        t.tm_min = 59;
        t.tm_sec = 60;

Bingo, a subsequent call to mktime with this struct gave me 19-Jan-2038 00:00:00. Then I did the first one again and it worked this time -- magic!

I kept incrementing the seconds till I came up to the actual End of Time with:

        t.tm_mday = 19;
        t.tm_mon = 0;
        t.tm_year = 2038 - 1900;
        t.tm_hour = 3;
        t.tm_min = 14;
        t.tm_sec = 7;

and it would not go any further than that. Whats more, 2^31 actually comes up to 19-Jan-2038 08:44:07 IST (UTC+5:30), which is where our Unix time ends as well. Windows doesn't get there with mktime().

So finally I did this as well, just to confirm:

         j = 0x7ffffffe; /* This is 2^31 */

         t2 = *localtime (&j);
         if (mktime (&t2) == -1)
                 perror ("Even this fails");
         else
                 printf ("High Time: %s\n", asctime (&t2));

And it worked, showing 19-Jan-2038 08:44:07.

Hence, mktime() in Windows XP SP2 is probably buggy. Hopefully it has been patched in Windows update. Either ways, we're staying away from the End for now :^)


Chatty windows

Chat windows in ayttm have given me a bit of a headache for the past couple of nights. There was an innocuous bug that caused a crash when a user had chat windows open and then decided to switch to tabbed chat, opened and then closed the tabbed chat window. It was quite easy to see at first why that happened -- window closure was done based on the tabbed chat preference, and once you have both tabbed and un-tabbed chat windows, it becomes a bit of a mess.

So I finally decided to change the logic behind it all and decided that windows would close based on whether they had a notebook at all. That stopped the original crash case but introduced ten new ones. That was when I found that the smiley window was being deleted twice, the window close signal was attached only to tabbed windows and all new chat windows were added to the chat window list on creation, but only tabbed chat windows were deleted on closure (phew!)

So finally tonight, we've got the finished stuff (hopefully) where all the above issues were taken care of. Gotta love this stuff :)


Jabberin'

Decided to give Jabber a spin on ayttm with jabber.com and ran into a bit of a wall. It somehow seems like Jabber support is more or less broken in ayttm; I couldn't even get it to log in, or at least quit with an error message. It just kept 'loggin in'. Ayttm does work for gtalk though, so it's probably got something to do situations where SSL is not involved.

I've just got hold of the XMPP Protocol RFC and XMPP extensions and hopefully will have time to compare with our implementation over the weekend.

Update 4th Nov 2007: Heh, looks like I didn't need all that. A couple of lines was all it took to get it all to work.


Back to Hack...

... once again. It's been a long sabbatical away from hacking; almost a month and a half. Coding at working just isn't the same; you have to do more talking and less coding, which can get really boring at times. Also, the challenges and constraints are mostly artificial (must use this toolchain, must use that framework, must not reduce bloat because some dev long ago believed that it was a performance tweak -- don't ask).

Anyways, I've put in a tray icon for ayttm. I was going through the gtk APIs for some possible tweaks to GtkTreeView (I'm still not very happy with how the main status window looks) and I stumbled upon GtkStatusIcon, the tray icon widget. Since it was so easy to implement (have to compliment the gtk devels for this) I went for it right away. It's already checked into cvs, Kartik may release a deb for Debian soon if it all goes well.

Oh, and I was going at the tray icon, I also gave the ayttm icon a drop shadow. Thought it looked quite neat.


Ayttm Release

It's been more than a week since the first ayttm release after 3 years, and only one bug report filed in as of today. That bug report too is not much of a bug really; it's more of a support request since the user was not able to compile. Since he's not responded, it looks like he's either given up or managed to compile but not cared to come back and tell us.

So only one bug in over a week could mean one of two things -- either the release is essentially bug-free or nobody's really using it ;)


Phew!!

That's one job done :) I've finally managed to do an Ayttm release. This release even taught me how to build an RPM; something I was never really inclined to do in the first place. The only way I could test the RPM was to convert it into a deb using alien and installing. It did work that way, so it should work alright with the RPM as well.

I also realized while installing that ayttmrc actually installs in /usr/etc instead of /etc. I guess we need to do something about it in the next release.


Love thy bugs

There was a time when I would feel apologetic, guilty and ashamed for having missed a bug in my software. Somehow lately, it's no longer the case. Complex software will always have bugs. Instead of wasting time kicking myself for it, it's best to just sit down and think of the best way to fix it. Also, I've probably gotten used to fixing bugs in stuff I write by now ;)

Someday I'll be a decent programmer. Until then, I'll keep trying.


Back... again...

Finally over with the painting and tiling at home so we can now get back to business. I found out that we have hardcoded mozilla as the default browser command in ayttm. Spent 5 minutes finding a solution for it and then 1/2 hour trying to make the messages look pretty. In the end the configure script now looks for any one from a set of installed browsers (mozilla, firefox, iceweasel, opera, etc.)

We need to get a release for ayttm out soon; it's been long enough already. Philip hasn't come back with any bugs for some time now, so it could mean one of two things -- either he's busy with something else or ayttm is ready for release.


Comments are closed.