Tag: technology

Helpful tip for anyone trying to build collection objects in PHP using the IteratorAggregate

If anyone out there is trying to build a collection object in PHP using the IteratorAggregate, here’s a tip that will save you hours of debugging and online searching:

Return an ArrayObject from getIterator()!

What finally worked for me looks something like this:

class Collection implements IteratorAggregate
private $items = array();
private $count = 0;

public function getIterator()
return new ArrayObject($this->items);

public function add($value)
$this->items[$this->count++] = $value;

public function count()
return $this->count;	

All of the documentation I could find online seemed to indicate that the object returned from getIterator() should be the class itself (e.g. Collection), but that didn’t work. So through some searching and a lot of trial and error, I finally figured it out. And it only took me a couple of hours to figure that out!

Kitchen juggling and other miscellaneous stuff

Happy March!

Last night I prepared the most complex meal I’ve ever done so far. It was not complex in terms of ingredients or anything light that. I made ravioli with pasta sauce, and steamed broccoli, which I suppose is fairly simple. But I had three burners on the stove going at the same time, and managed to plan it well enough so that all three finished cooking at about the same time. (And while doing this, I was also checking some work email.) It was the perfect amount of ravioli, enough for a bowl full for me and for Kelly. And the sauce was a spicy sauce with just a bit of a kick to it. It was very good, and I was pleased with my ability to juggle multiple tasks in the kitchen.

For the second time in a couple of weeks, I accidentally texted he11o_sunshine in response to a text from someone at work. I’m not exactly sure how I manage to do this. I can only suppose that so much of my concentration is taken up by other things that I simply don’t pay attention to what I’m doing. Fortunately, Jen has been through this before and takes it patiently and with good humor.

We watched The Martian Child on DVD last night. The movie (starring John Cusack) is based on David Gerrold’s Hugo and Nebula award-winning novelette of the same title. We both enjoyed it, despite it being sad at times.

This evening we are heading over to A.J. and Denisse’s for a Peruvian dinner, which should be fun. We’ll probably end up playing some games too. Denisse asked me to bring Apples to Apples with me for that very purpose.

I have to work tomorrow. Since I am a fast writer, I agreed to write a significant portion of the user documentation for an application that we’ve been developing for a while and is close to a beta release. It will probably take me several hours tomorrow afternoon, but at least I can do it from home.

Website and reading list updates!

I’ve spend the last couple of nights revamping my website and my reading list pages. They are finally at a point where I have once again made them public. So what has changed?


  • Transformed to simple HTML
  • Reorganized content
  • Brought content up-to-date

Reading List

  • Complete rewrite using PHP and MySQL
  • Simple HTML
  • Dynamic queries to the database
  • Improved summary page
  • Dynamic list pages
  • Search capabilities
  • Progress/pace for current reading

There’s still more to do. In the not too distant future there will be links to LibraryThing, RSS feeds, and advanced search capabilities. In the meantime, after about a year of manually maintaining my reading list and associated statistics, the site is once again automated.


My brain is chock full of object classes, inheritance, polymorphism, data collections, assertions, loop invariants, capital-I interfaces, generics, sessions, caching and hashing and no more will fit. I’ve literally filled up that portion of my brain that thinks in programming terms. Nothing new will go in. And I’m not really sure what to do, so I’m going to do what I always do when this happens.

Something else.

I’m stylin’!

Last night was another early-to-bed evening. I think I was in bed sometime after 6 PM, but read until just about 8 PM. (At present I’m 516 pages into Our Oriental Heritage, deeply immersed in Hinduism.) I fell into a deep sleep until nearly 2 AM. Then I felt like I was wide awake, so I read for about an hour before going back to sleep. As usual, I was up before my alarm went off at 4:19 AM.

The temperature stayed above freezing last night so there was no ice to scrape from my car; even some of the snow had receded. Between 4:30 and 4:45 AM I finally figured out how to alter the base-styles in LiveJournal in order to customize then. (Simple styles can be put into one of the preference screens). I made a custom style for <blockquote>’s so that they appear a bit more nicely formatted on my pages

Like this one!

Small successes like these seem to get me on a roll. I made some excellent progress on my ASP.NET application this morning. I’m wrapping things up. All but two of the logged bugs have been fixed. Things are looking good. I even figured out why some of the post-back code was behaving oddly. (It wasn’t; it was my understanding of how post-backs work. Go figure.)

For some reason, I had the theme song to The Love Boat in my head for nearly an hour this morning. I couldn’t figure out why until I projected back to a conversation I overheard at the local sandwich shop last night. Two women were talking about old TV shows and one of them mentioned The Love Boat. Am I that suggestible?

Going out for beers tonight after work. Tomorrow, Kelly and I are going to hit some of the art museums off the Mall. Next weekend, we head up to New York City.

Switched to Mac at work

I officially switched to my new MacBook Pro at work. I hadn’t planned to make the switch this morning, but I was having problems with my PC and after spending more than an hour trying to get things working, I said screw it and I switched. I now have 2 monitor setup: On the MacBook (which is the primary monitor) I have my email and other Mac applications. On the external monitor I have Parallels running Windows XP full-screen. We’ll see how it goes today.

A practical time machine

Over two years ago, at the rehearsal dinner for he11o_sunshine and stubiebrother wedding, they gave me the Complete New Yorker on DVD. Since that time, it has sat on a self in my office, unopened. This is not because I wasn’t interested in it. I am very interested. But other things took over my time and I just never got to it.

Until last night.

When I should have been going to bed, I finally decided to crack the seal on the package. I installed the software on my MacBook and spent nearly an hour browsing through the earliest complete issues of the New Yorker. The earliest issue goes back to February 1925. My Grandpa would not yet be 5 years old. Skimming through the pages was like an adventure back in time. The writing styles, the sense of humor, and the contemporary references were fascinating. And on top of that, there were the advertisements. It really is like a kind of practical time machine.

It’s also highly addictive. I spent an hour browsing (and I wasn’t reading, just browsing) and I could have kept going, save the fact that my battery was getting low and I had to get up at 4:20 this morning. I foresee a lot of future enjoyment from those DVDs.

Video iChat

I did a video iChat with Jim this morning. We used to do these more frequently but today was the first Sunday in quite a while that we’ve done it. You know what, it hasn’t lost it’s novelty yet. Jim lives in Ventura County, north of L.A. and it’s pretty cool to be able to sit for 20 minutes and talk, and be able to see each other. I don’t know why we don’t do this more often. Too bad more of my friends don’t have iChat and iSight cameras.

Paperless offices

I might have touched on this before, but I was thinking about paperless offices again this morning (having cleaned up much of the paper in my office earlier today). I am convinced that the move to a “paperless” office will be a very difficult one to achieve. In fact, it may be close to impossible (although I’d love for someone to prove me wrong.)

Another term for a “paperless” office is a “digital” one; that is, one in which all paper is replaced by digital represntations of the information contained on the paper. We have all sorts of technologies that allow for the digitization of information. But I still think it will be difficult to replace paper.

I have tried numerous handheld devices for capturing information. Palm Pilots, BlackBerries, etc. There are notebook computers that try and immitate literal pads of paper. There are at least two disadvantages to all of these devices as I see it: 1) I have not yet come across an interface that makes it easy to write free-form text as a piece of paper; 2) each of these devices requires some kind of power source, be it a battery or an AC adapter.

All of these devices seem to be attempting to mimic paper in an electronic form. As I see it, there are only two advantages for mimicking paper in electronic form: 1) space: data storage takes infinitely less physical space than the physical storage of paper; 2) searches: it is easier to allow a computer to search through text than to scramble through mounds of notebook paper on your own.

Aside from these advantages, I see very little gain in using electronic “paper” versus physical paper for common tasks such as note-taking, lists, etc. And when we speak of a paperless office, we are speaking of everything, I assume, notes and lists in addition to memos and briefings (which are more easily captured in electronic form).

Perhaps a better distinction is formal vs. informal “paper”. Clearly, a step in the right direction would be the elimination of “formal” paper from the office. Electronic mail has gone a long way to doing this. Memos are mostly electronic, whether written in Microsoft Word or some other word processor. PowerPoint briefings have replaced transparancies. Software like TeX or LaTex has made technical documentation easier to capture electronically. I can foresee a time when all formal paper is eliminated and converted to electronic media.

Informal paper is another story. I scribble notes in a notebook. I have my own shorthand, developed over a period of 16 years of notetaking. I don’t depend on batteries or AC adapters or network connections. And quite frankly, I can take notes faster on paper than I can on the computer. Lists seem much easier to maintain on paper. Pull out a small notepad in the bookstore and jot down the title of the book you want to buy later. It takes 2 seconds. It most certainly takes longer with your PDA. The tough nut to crack will be informal paper.

Electronic devices like PDAs and notebook computers try to immitate the virtues of paper and combine them with the virtues of electronic storage. As they say, however, immitation is the highest form of flattery. The reason these products try to immitate paper is because paper works so well. It is for this reason, the simplicity of capturing informal documents, that I see a converstion to a full paperless office to be a long and difficult challenge.