Now blogging at diego's weblog. See you over there!

@ foo!

Got to Foo Camp relatively late, around 8:30 pm, after picking up Drew Endy in SF (he was at a conference there, and since I was on the way north, I gave him a ride up to Foo Camp. Drew (and those in his lab at MIT) are doing mind-blowing stuff in trying to figure out how to code DNA to make it do what they want. "DNA on Rails". So even though we got here late, that unique part of Foo had already started, at least for me (maybe not so much for Drew, since I basically pestered him with questions the whole time). I was thinking that what I'd like to do from the top down (make software behave more like organisms) is what they're working on doing from the bottom up (figure out how to code to the software that organisms already have). From one end it's getting the black box and tries to figure out how to make it do what you want. From the other, it's trying to emulate the external behavior of the black box and make other things do what the black box does. Box are way too interesting to make them justice at midnight after an exhausting day. :)

I did miss Tim's kickoff presentation, which was incredibly interesting when I saw it at EuroFoo last year.

All rooms have been taken and I couldn't get a hotel, so I'll be sleeping in the car. Since I won't be sleeping much, I don't anticipate it will be too bad. :)

Categories: technology
Posted by diego on August 19, 2005 at 11:35 PM

how to install comcast high speed internet: a quick guide

I would generally not post about something as specific as this, but after seeing the vast amounts of confusion and misinformation that's out there on the topic I felt that my 2c in this case would be worthwhile.

Today I got cable along with Internet service from Comcast, and one of the potential that I wondered about was the setup. I've got a Linksys WRT54G for both wired and wireless routing. Most of the comments out there mentioned a process that usually included first connecting the computer directly to the cable modem, then registering it, then disconnecting it, then connecting the router configured to spoof the MAC address to that of the computer.

However, this didn't seem to make a lot of sense. While the MAC address of the cable modem does need to be registered with comcast, it seems less obvious why they would need the MAC address of the PC itself. Maybe at some point it was necessary, but as I discovered today that's no longer the case. )As a sidenote, the cable guy that did the install of the line also said that the "pc first, router later" process was a requirement... so maybe that's how this got started).

To make sure this remains a quick guide, here's what I did (as far as I can tell the procedure would be the same anywhere in the US for a Comcast high speed Internet install):

  • First, I got my own cablemodem, a Linksys BEFCMU10 since the price was equivalent pretty much to a year of renting whatever Comcast was going to give me, it seemed like a good investment. I don't think this makes a difference though.
  • Once the connection was complete and running, I connected the Coaxial cable to the modem, then connected the modem via ethernet to the WRT54G's WAN input, and the PC to one of the ethernet ports of the WRT54G, then I powered up both the cable modem and the router. (The router must be set in DHCP mode).
  • After a bit of waiting, the router directly obtained a dynamic IP and all seemed well. Loading up any browser page in the computer redirected me to a comcast page which included a link to download the software that comes with the Comcast self-install kit. I don't even need to insert a CD!
  • Downloaded the software, then executed it. It turns out it's basically a specialized IE window, doing HTTPS requests to Comcast in the background. Here they actually activate routing for your cable modem, but at the same time they're assuming that the PC is connected directly to it, and so they seem to reconfigure the modem to talk to the PC's network card (which isn't connected directly to it). When the registration and configuration is done, they reboot the modem automatically, at which point nothing works.
  • Aha! The reboot seemed to be key.
  • So, I did a hard restart on both the cable modem and the router (first disconnected the router, then reset the modem, then reset the router, then reconnected the router) at which point the cable modem seemed to find the router agreeable once more.
  • And that's it!
From what I gather the modem does attach itself to one MAC address, but that is reset when it reboots, so spoofing the MAC address (which sounded like a weird requirement in the first place) doesn't appear to be an actual requirement. The MAC address of the cable modem itself is registered with Comcast, so you'll need to let them know if you get it replaced.

After all that, speeds are pretty great, 3 Mbps down, 768 Kbps up (or more), and it's working well so far, keyword here being so far since there were some signal strength issues that made installation more tedious than it should have been, and those gremlins have a way of showing up again...

PS: I also got HDTV with Dolby Digital. Not that many channels, but one word: Wow.

Categories: technology
Posted by diego on August 16, 2005 at 11:47 PM

back to PST!

I just realized that the weblog was still "on" GMT (where I have spent most of the last 4 years) but now it's time to switch that, too. And done!

Sure that was easy. But I wonder, now. MT seemed to be intent on rebuilding all entries based on the new target time, but that was just appearances. It offered a rebuild but did nothing of the sort. No changes. All the dates that were wrong are still wrong. I wonder if there's a button to push somewhere. Has the timezone info been lost?

And what's the right etiquette? Plus, the timezone in itself contains some interesting information (for me at least), but only if it's accurate. Accuracy there would be hard to guarantee though, the browser can obtain some of that information from the OS, but that's not even accurate sometimes... Hm. Now if a GPS was permanently connected and feeding data into the system permanently and seamlessly...

Categories: technology
Posted by diego on August 15, 2005 at 11:42 PM

php's simplexml

One of my favorite features of PHP 5 is SimpleXML. In brief, it maps the structure of an XML document to as variables within PHP, with subnodes as variables within the root object (recursively) and the text value of a node (as you'd expect) to the value of the variable. For example, the code in PHP 5 to parse RSS 2.0 and Atom 0.3 feeds (maintaining a relatively clean structure, and just parsing for the basics) is super straightforward.

Observe!

<?php

  //each individual entry in the feed
  class FeedEntry {
    public $title;
    public $summary;
    public $content;
    public $created;
    public $modified;
    public $issued;
    public $id;
    public $link;
  	
    final function __construct() {
    }
  }

  //the feed (including simpleXML parsing)
  class Feed {
    public $xmlContent;
    //the resulting parsed entries
    public $entries = array();
	
    //the document information
    public $title;
    public $link;
    public $description;
    public $author;
    public $created;
    public $modified;
    public $issued;
		 
    final function __construct($xmlcontent) {
      $this->xmlContent = $xmlcontent;
    }
		 
    function parse()
    {
      $xml = simplexml_load_string($this->xmlContent);
      if ($xml['version'] == '2.0') { //rss 2.0
        $this->parseRSSFeed($xml);
      }
      else if ($xml['version'] == '0.3') { //atom  0.3
        $this->parseAtomFeed($xml);
      }
    }
		 
    function parseRSSFeed($xml) {
      $this->created = $xml->channel->lastBuildDate;
      $this->issued = $xml->channel->lastBuildDate;
      $this->modified = $xml->channel->lastBuildDate;
      $this->title = $xml->channel->title;
      $this->description = $xml->channel->description;
      $this->link = $xml->channel->link;
      foreach ($xml->channel->item as $item) {
       $this->parseRSSEntry($item);
      }
    }
		 
    function parseRSSEntry($entryToParse) {
      $entry = new FeedEntry();
      if ($entryToParse->description == '' &&
                  $entryToParse->title == '') {
        return;
      }
      if ($entryToParse->description !== '' &&
            $entryToParse->title == '') {
        $title = substr(strip_tags($entryToParse->description), 0, 50) . '...';
      }
      else { 
        $title = $entryToParse->title;
      }

      $entry->title = $title;
      $entry->summary = $entryToParse->description;
      $entry->content = $entryToParse->description;
	      
      $entry->created = $entryToParse->pubDate;
      $entry->issued = $entryToParse->pubDate;
      $entry->modified = $entryToParse->pubDate;
	      
      $entry->link =  $entryToParse->link;
      $entry->id = $entryToParse->guid;
		 		
      array_push($this->entries, $entry);
    }
		 
    function parseAtomFeed($xml) {
      $this->created = $xml->created;
      $this->issued = $xml->issued;
      $this->modified = $xml->modified;
      $this->title = $xml->title;
      $this->link = $xml->link;
      $this->description = $xml->tagline;
		 		
      foreach ($xml->entry as $entry) {
        $this->parseAtomEntry($entry);
      }
    }


    function parseAtomEntry($entryToParse) {
      $entry = new FeedEntry();

      $entry->title = $entryToParse->title;
      $entry->summary = $entryToParse->summary;
      $entry->content = $entryToParse->content;
	      
      $entry->created = $entryToParse->created;
      $entry->issued = $entryToParse->issued;
      $entry->modified = $entryToParse->modified;
	      
      $entry->link =  $entryToParse->link;
      $entry->id = $entryToParse->id;
		 		
      array_push($this->entries, $entry);
    }
  }

?>

This code can then be used as follows:

  $feed = new Feed($xmlcontent);
  $feed->parse();

  //print the title of each feed entry
  foreach ($feed->entries as $entry) {
    echo $entry->title;
  }

Where $xmlcontent is obtained through, say, a curl call:

  $ch = curl_init();

  curl_setopt($ch, CURLOPT_HTTPGET, 1);
  curl_setopt($ch, CURLOPT_URL,"http://www.dynamicobjects.com/d2r/index.xml");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  $xmlcontent = curl_exec ($ch);

  curl_close($ch);

All of which amounts to quite a lot of interesting functionality in a small set of easy-to-understand code.

Does it have limitations? Sure. Is it enough for many XML parsing jobs? Yes.

This is why, btw, PHP is so appropriate for building web stuff where there's so many user-driven elements and "point solutions" (taken to the extreme, one per page in a website).

Who needs reuse when (re)coding is so easy? :)

PS: I would like to read the following statement which I am making of my own free will and without being coerced in any (ouch!) way: Reuse is good, particularly with Java, and no one should ever say that it's not, lest they find themselves in the depths of hell, or possibly a Standards Body terminology & rules meeting. In summary: Java, good. PHP, bad. (Ruby, great.)

PS2: Those that can quote something else from the Simpsons episode which the previous PS is spoofing get extra credit.

PS3: Those who react to PS1 above without knowing the context of the Simpsons episode should refrain from commenting. There's a fine line between good and bad references, a fine line indeed, and while it's never hard to know when it's been crossed, I'd rather not be made aware of the distance traveled since.
Categories: soft.dev
Posted by diego on August 15, 2005 at 11:40 PM

the dog days of summer

While normally this would mean (cue dictionary) "a period of stagnation or inactivity," in this case it means that I can't seem to get off the ground blogging with any regularity again. Lots of work (enjoying it like crazy, btw), and about 6 posts (yes, six) that remain half-written or almost-done but never quite get there, and loom larger in my mind than they should. Which convinces me, as if I needed any convincing, that you post when you write, or you never post. Unless you're focused on getting something written, posts don't just happen over weeks--at least not for me.

At least I seem to be getting much better at my "blogging about not blogging" posts. Heh.

Categories: personal
Posted by diego on August 14, 2005 at 7:41 PM

quote of the day

"What I really need is minions." -- Russ.

Categories: technology
Posted by diego on August 14, 2005 at 7:39 PM

geography, software, and context

While I've been sort of away from blogging (and keeping up with blogs as well, I'm now beginning to catch up) as always I've spent time running around looking at the new apps and ideas that are thrown out there all the time. Of these, I've spent a fair amount of time thinking about mapping applications, for one reason: they puzzled me.

All that follows is probably obvious to many people, but hey, I won't mind that much for arriving late at the party and just be happy I showed up at all. :)

The puzzle was the sudden explosion of use and why it had caught me blindsided. Blindsided, in the sense that they'd be so popular. I've been looking at geolocation apps for a while now (the wireless ad hoc research community, where I spent some time during my thesis research, has been babbling about geoloc for quite a while now). But it had never caught my attention all that much. Partially the blinders that come from focusing on one topic are responsible, but on the other hand I found it hard to see them as more than niche applications. GPS: useful if you're traveling but most of us don't spend our lives in the car or train, and usually quickly develop enough knowledge of our transportation paths that a GPS can become redundant quickly when a route is coupled with habit. This is less true in the US, given that there's higher mobility and greater distance between places, but still you can't see using geolocation as something more than something that would be use ocassionally at best. And so on.

Geolocation is cool, I thought, but it's not massive, as say an RJ-11 plug is massive or as the Internet is massive. True, there is value is niches, and we could start yet another socratic discourse on the long tail, but...

When I started thinking about this, I began by questioning whether these apps where actually niche apps. In the end I realized that the apps are niche apps, but not just any kind: they connect meatspace with cyberspace.

That is, they provide context. Many people (me included) enjoy the geography of the virtual. We can see the towering structures, or as Gibson put it on Neuromancer, "lines of light ranged in the non-space of the mind, clusters and constellations of data. Like city lights, receding..." But that's only one half of the story.

If there's anything truly unique to pervasive computing, sensor networks, clothing with embedded circuitry, and a million other things that are going on right now, it is that they seek to provide a seamless bridge between the real and the virtual. Not a one-way connection mind you, but bidirectional. The ability to interlock devices with what's around us in a way that creates something that neither alone can provide. Example: object geotagging. Leave a marker using a webservice, automatically labeled with your Long/Lat, and others that walk by can find it. Have your clothes keep track of your movements and of who you meet, and let your shirt buzz softly against your skin when it realizes that you have an appointment in 30 minutes across town and you are still at a cafe, sitting still, with someone you know nearby ("someone you know" being defined in quick and dirty fashion as the same marker showing up in your travel history for the last 6 months, which makes it likely you won't just get up and leave that easily).

It's all about context, and it's not just geography--geography is just what we've suddenly got a critical mass of data on and the APIs to go with it). Geolocation is the tip of the iceberg. In itself, it's interesting, yes, and useful to varying degrees depending on your habits. But it's way more interesting for what it portends: finally, the emergence of real-world applications of context to software, and of software to the real world.

Categories: technology
Posted by diego on August 7, 2005 at 5:09 PM

three and a half weeks

Nearly settled now after my arrival in mid-July, I'm starting to regain my balance. Now I've got a house, a desk, the ability to make coffee, and the rest of the things that make it possible to, well, write. Work continues apace of course, but for some reason this kind of moving around consistently throws my writing off-balance. Moving as in moving from one life to the next, those moves that feel perennial even though nothing is.

I finally got a car yesterday, and even though now there are a couple of things missing (landline, cable) it's starting to feel more stable now. Doing it all in less than a month ain't bad either. Full speed ahead!

Categories: personal
Posted by diego on August 7, 2005 at 4:57 PM

Copyright © Diego Doval 2002-2011.