Archive for February, 2006

Confusing Langosta Time Bug Fixed!

Monday, February 20th, 2006

I’ve finally fixed an incredibly annoying bug related to my handling of the UNIX timestamps used to store dates (such as those on entries and comments) in Langosta. For those who have no idea what a UNIX timestamp is, it is a ten-digit number representing the number of seconds from midnight on January 1, 1970 to the current time. Having a single date to which all timestamps are anchored allows programmers to record dates without having to worry about timezones, daylight savings time, and other difficult problems. Instead, most applications store dates as UNIX timestamps and then convert the timestamps to something human readable when the date needs to be displayed.

PHP has a good selection of date- and time-related functions, but unfortunately most of them are not well-documented and can be difficult to understand. Getting a current UNIX timestamp and formatting it is simple when using the time() and date() functions, but things get much harder when you need to make sure that those timestamps are the same no matter what kind of server they are calculated on.

In a perfect world, every computer would report the same timestamp if you asked each for its timestamp at the same time. Unfortunately, this is not the case. Computers running the Windows family of operating systems (90% of desktops and about half of all servers) normally store the current time in the computer’s current locale in the BIOS memory on the motherboard. Most other computers, which run a UNIX-based operating system such as Linux, Mac OS X, or FreeBSD, store the current GMT time, which does not depend on where the computer is located, in the BIOS memory. I did not take this fact into account when designing Langosta’s timestamp handling functions, and, as it seems, nor did the PHP developers. So when I was writing code on my development machine, the time functions would appear to work perfectly, but everything would break when the code was uploaded to my web server (which runs on FreeBSD). I solved the problem by simply detecting the current operating system using the PHP_OS built-in constant, and, if the OS turned out to be Windows, adjusting the Langosta internal timestamp (used when storing entries and such) from a copy of PHP’s internal timestamp to a custom one (the PHP timestamp + the current number between the current local time and GMT [21600]).

Now that this bug is finally out of the way, I can move on to adding more personalization settings for Langosta users, such as the ability to type in the current time in your locale in order to have Langosta intelligently detect your timezone and adjust all the times site-wide to your locale. This will probably come in version 1.3 (scheduled for May 1, 2006) or version 1.3.1 (scheduled for June 1, 2006, but could be a bugfix release pushed out sooner). And no, I haven’t abandoned Langosta…a new release will be finished eventually - I just haven’t had nearly as much time to work on it lately. With the new version of Langosta will come Sangre, which is a version of the Langosta core libraries reorganized so that other applications can be built with them. Not that we really need another framework or anything….

A Departure from Dormancy

Monday, February 13th, 2006

So yeah, that little New Year’s resolution of mine didn’t last long. Back when I made it, I was mainly blogging as a way of not doing what I should have been doing at the time, so I guess I kind of overestimated the amount of time that I’d actually have to devote to writing. I actually did try to write several times, but I would usually end up having to stop mid-entry to do something else. Then I’d forget to go back and finish it, and by the time I did remember, the entry would be out-of-date. Still, though I don’t like leaving Organon to languish in the darkness, at least my time is being taken up by more constructive things. In other words, I’m not being lazy - I’m just busy. I’m not even going to try to write about every single little thing that I’ve wanted to write about in the last month, but I’ll at least try to summarize some of it so that you have an idea of what’s been going on.

To put it nicely, January was not a happy month for me. There were times when I wanted to post a long-winded rant about how everything sucked so badly and I wanted to die, but I’ll spare you the vivid descriptions of my pessimism this time around. At this point I think I’ve reached a stage where, rather than complain about it, I’ve been trying to make the most of the free moments when I could do something to take my mind off of school. In the past few days, I’ve been reading a book that - for once - wasn’t assigned for English class. It’s a good one that I’ve read before, and it’s nice to be able to disappear into it for a few minutes at a time every once in a while. After so reading many horribly depressing novels for English in the past few months (Death of a Salesman, Cat on a Hot Tin Roof, A Doll House, Blood Wedding, The Crucible, The Stranger), I had almost forgotten what it was like to read a book that I truly enjoyed.

But though the depressing English novels continue with no end in sight, I’m happy to say that school has improved greatly for me since the end of the first semester (January 20th). In the three weeks between my last blog entry and that day, I had:

  • Researched, written, and edited an English essay on idealism vs. realism in Blood Wedding - the first one that would be turned in and graded by the infamous IB gods
  • Researched and presented information on the relgious connections between The Crucible and Arthur Miller’s personal religious beliefs for a major assessment grade
  • Suffered through the compilation and laying out of yet another issue of the Cooney Crier, our school newspaper
  • Somehow managed not to bomb any tests
  • Fought hard to preserve my teetering A in physics
  • Continued to work on websites for my usual employer
  • Managed somehow to make sweeping improvements to Langosta’s core libraries (not online yet pending some showstopper bug fixes)
  • Finished my unbelievably boring driving class

I was quite understandably exhausted and ready for a change. However, because of the rigidity of the IB program, the only class that would change was pre-calculus, which was switching to IB Biology. I was happy about this (no more math for three terms!), but at the same time I realized that IB Biology would bring with it more work that I wouldn’t have time for. So, I finally did what I had considered doing at the beginning of the year: I dropped newspaper in favor of a study hall. I’m still going to earn IB CAS hours by working on the layout of the newspaper anyway, but I won’t have to write articles for it. My articles were never bad, but they were usually long and rather rushed, and I found quickly that my inability to be very concise in my writing meant that I was not really cut out for newspaper writing.

Freeing myself of newspaper was also a good thing for another reason - doing so allowed me to change from the first-hour English class to the second-hour class. I didn’t want to do this because I didn’t like the first-hour class, but rather because the second-hour class simply sounded better for me. In the first semester, I got a D- grade in the homework category (which counts for 20% of my overall grade) because I rarely participated in discussions. Sometimes I would, but usually I simply felt overpowered by the others in the class because the discussions were so informal. I’m just too quiet to be able to easily get a word in when there are eighteen other people (all smart, talkative, opinionated girls except one other boy) who are all ready to jump in before me. There were sometimes moments when I might have said something, but then I’d be out of substantial things to say. I’m the sort of person who only talks when there’s something worth saying, not the type that moves the discussion along with rather obvious and barely original statements like some do.

So far, I have really, really enjoyed myself in the new English class. Though there really is no such thing as a dumb IB kid and the separation between us in terms of intelligence is negligible, the kids in this class score much higher on average on papers than the other class. Also, some of them are much more argumentative in a funny way, so our discussions are a bit more personal and actually fun to take part in. When I’m with them I sometimes remember the feeling of being among an elite group of kids that I had in AP European History last year at CSHS. I like it.

Having the study hall has been a huge boon for me as well. For once, I don’t have to do every bit of homework the night before it’s due. Now I have a whole hour before school and another half-hour at lunch to get things done, and it’s made a big difference in the amount of sleep I get (though it still is never enough). And, since IB History of the Americas and IB Spanish are both classes that I can pretend to be listening in while doing something else, I get an extra 90 minutes there to finish things up or work on homework for the next night.

However, even with the extra time from the study hall, I remain a complete and utter dumbass when it comes to finishing projects on time. I still finish them, but I often only start them on the night before they’re due and end up working until three in the morning, wondering if that night would be the first time I would pull an all-nighter. Take, for example, my IB History of the Americas World War II assessment last week, for which I could do anything that demonstrated that I had learned something about World War II and answered one of the eight prompts provided on the assignment sheet. I ended up spending about six hours frantically typing fake letters (backed up with research) between between major Allied leaders (Roosevelt, Stalin, Churchill) to show the stresses in their alliance as the war went on. I think, quite frankly, that it sucked. But then again I think that about all of my writing, until I get it back with a wonderful little A+ on the front. I’m really depending on the fact that the IB HotA teacher is an incredibly easy grader in order to survive with this assessment.

Being up until three in the morning never has a good effect on me, and it was even worse this time around. I utterly bombed a physics test the next day (I literally left things blank because I simply had no idea what the answer was) and almost fell asleep during a video that we were watching. I was having the usual suicidal thoughts brought on by sleep deprivation, but now that I’m used to them I simply mellowed out and fell into a drug-induced-but-not-really stupor. I fell asleep on the couch about an hour after getting home from school, got made fun of by my parents a bit for it, and then went over the basic workings of the ACT so that I would be ready to take it the next day (last Saturday). I read some of my highly-addictive book, went to bed at 11:30 like a good little boy, and woke up at 6:30 for the sixth day in a row (it felt so weird!) to take the ACT. I was feeling groggy yet energetic, as if I had just run a marathon and somehow managed to get through it without vomiting on anyone from exhaustion. I was feeling, for once in a long while, optimistic. The physics thing weighed on me (and still does - I haven’t gotten my F back yet), but I was able to push it to the back of my mind and focus on the task at hand.

And I performed admirably. I seriously think that I scored somewhere between a 95% and a perfect score on the English and math problems. I really surprised myself on the math portion; historically that’s been my weak spot when it comes to tests. But the good feelings were quickly replaced with horror in the next part of the test, the reading portion. The proctor gave us 35 minutes to do it, but I read in the test booklet that we were supposed to have 45 minutes, so I wrongly assumed that the proctor had made a mistake in his addition and written the wrong stop time on the whiteboard. I took the time to read through the first two readings and answer the questions carefully, but then I realized that we really weren’t going to get any more time. I moved quickly in the last five minutes to finish the third reading and its questions and most of the fourth reading, but I still left six questions blank. I felt stupid, horrified that I had somehow allowed myself to do that poorly. I decided that I just had to hope that the questions that I had answered were right.

The amount of time was misprinted on the last multiple-choice test (science) too, but this time I was not fooled. I didn’t even try to read all the experiments; I simply scanned them for the data I needed and answered the questions. Still, some of the questions were difficult to understand without reading the experiments, and this made it difficult to figure out what exactly was being asked. The last part was the incredibly easy writing test, but I still have a feeling that I’ll get back the results only to see that I got near-perfect scores on the first two parts and shitty ones on the second two, leaving me with a rather dismal 25 or 28 rather than the 32-36 that I had been hoping for. Luckily, you can take the test as many times as you want, so I’ll probably just sign up for the April examination and retake it if my score is relatively sucky.

After the ACT I rested at home for a while, contemplating writing a blog entry that never materialized, and then it was off to my church that I never actually attend so that I could help the youth group that I am not really a member of raise money for a mission trip that I might not even be able to go on. It sounds pointless, but it means seven CAS hours for me, so yay for that. The fundraiser this time was Valentine’s Day babysitting, and boy I had fun with it! Or not. It really wasn’t that bad; I’m just not a very kid-friendly person. However, things improved toward the end of the night - I was able to get two of the kids I was watching to wash their hands after they had decorated and eaten their cookies sprinkle-covered lumps of frosting.

Sunday was uneventful and not worth talking about except for two things. First, I finally caught up on the sleep that I had missed at the end of last week (there was an English presentation in there too that I stayed up late to prepare for, so I actually went to bed at three in the morning two nights in a row). Second, I wrote a rather good leyenda for Spanish, using some bits of information about a real Inca legend that I had found on Wikipedia. It was one of the best things I’d ever written in Spanish, and an affirmation of the fact that I do not belong in IB Spanish. My frustration level with that class was so high that I was able to convert it into an outburst of creative passion of a magnitude that I hadn’t seen for months. Now I just don’t know what to do. There are no other IB Spanish classes, but I absolutely loathe the feeling of being underchallenged, especially in a subject that is among my favorites. Attempts at giving me special projects have failed for several reasons: 1) I lack the time to work on them, 2) I don’t like the feeling of being alienated from the rest of the class just because I’m further along in my learning, and 3) the promised time to work on these projects in class is a contributor to that alienation and never really comes up anyway because I still have to meet all of the IBO’s objectives while doing other things. If there is any major flaw in the IB program it is its tendency to be a great equalizer of minds, turning out uniform robot-children who are all perfectly well-rounded, at the same level of education, and devoid of any souls.

That basically brings me to today. Looking forward, the next few weeks don’t seem to be nearly as bad as the last month has been. I have to continue to accumulate CAS hours in order to have at least 75 documented hours by March 1st, but currently I’m not really worried about that because I have at least that many already that only need signatures and written reflections to become part of my records. CAS seems to be one of the things that kids worry about most with IB, but if I can earn one-fifth of my hours just by making a website, then there’s no reason why others shouldn’t be able to figure out ways to make their own talents profitable in that sense.

I recognize that this entry is suffering from a dearth of the usual pasión emocional that has been my trademark in past entries, so I’ll end it with a small dose of thoughtfulness. Lately, I’ve been feeling an incredible desire to write something. Not just a typo-ridden blog entry or a late-night essay, but something really good. I want to break out of the normal cycle of boring papers and unleash the creative juices that have boiled inside me for so long. The Spanish story showed me that the pressure was building; it was the explosion of ash and dust acting as a precursor for the fiery eruption to come. Ideas bounce around in my head whenever I’m not dead-tired or overworked (so not very often), and plots and characters begin to come together. I feel like I’m on the edge of writing something better than anything that I’ve ever written, in any language.

Yet at the same time I am afraid. I am afraid that I will flame out early, that I will allow the eruption to come too soon and end up with nothing but an incoherent dust plume and a devastated Roman village covered in pumice. I am afraid that I lack the confidance, the experience, and the talent to turn my ideas into anything real and worth reading. I fear failure.

For this would not be the first time that I have tried to write something brilliant only to come up short and feeling frustrated. The problem is, the kind of feeling that I have right now only comes along every six months or so. Even though I know it will return, I don’t want to waste this chance. I want to at least end up with something complete, something tangible - not a false start or a rambling group of contradictory sentences. So I’m being patient, utilizing the same methods that I employed to keep Langosta alive even during slow periods of development: planning, prudence, and care. To rush into this would mean almost certain failure, yet I am very tempted to do so.

For now, I’ll wait, though I won’t like it. I’ll devote some time each day to thinking about the story inside me, even if it’s only ten minutes in the shower or fifteen minutes on the bus ride to school. I’ll make it a priority, because for some reason I keep having this crazy, naïve feeling that maybe it is important.

It’s 10:00, and I haven’t done any homework because I know that I can do it in study hall tomorrow. I know it’s not a good idea to use my little gift from the IB gods to procrastinate even more than I already do, but I simply can’t write blog entries by hand (takes way too long). It’s funny - in Arizona we didn’t even have study halls, or if we did I simply never took notice. I always thought I’d never need one, just like I dumbly thought that good grades meant intelligence and study halls were for dumb people. Now reality has become slightly less fuzzy, and I’ve begun to see things more as they truly are, bit by bit. You can be a genius and end up in a dead-end desk job, and you can be a jackass and become the CEO of a major corporation. We don’t have control over our fates, but this doesn’t mean we should simply give up in a kind of existentialist withdrawal. We just have to try. I just have to try. I just have to keep fighting, even when I feel as if I’ve given all that I could. And I just have to cut down on the melodrama.

Update (2/27/2006): Wow, don’t I feel smart. A glaring typo in the title of all places. My brain must have been having a “depature” of its own that day.