Archive for February, 2011

my nerdy family

There are those [weird] people who see being called a “nerd” as an insult. Then, there are those of us who [rightly so] see it as a complement. Never forget, without nerds, we’d all still be sittin’ in a cave somewhere suckin’ on rocks and gruntin’ at each other.

There are not words to describe the nerd pride I feel when I over hear my 8 year old discussing the Kuiper belt with his buddies, or when he comes up with some obscure/abstract way to solve a math problem that I had never though of. He’s truly a nerd-in-training.

But when my wife does something nerdy, it’s a whole different level of cool (and super hot). See, growing up, she was the cheerleader/beauty queen/popular girl … and, well, I’ve always been a nerd.  It’s no small miracle that she saw fit to marry me; I’m just super lucky really.  She’s always [secretly] had some nerd tendencies though; for example, she will sit down and read a 1,000 page book in a day … for fun … it’s crazy. But, sometimes she does or says something that’s just plain nerdy on anybody’s nerd scale.

Earlier this week, we were going over the boy’s spelling list for school. This week’s list focused on contractions (he insists on calling them “contraptions” instead of contractions). We were talking about the formality of saying things like “we have” instead of “we’ve”, when I mentioned that Data (of Star Trek fame) did not use contractions on a regular basis. Then, my awesome wife says this:

Yes, that’s how they knew it wasn’t Data in that one episode.

I was just super impressed that she had come up with some obscure Star Trek trivia off the top of her head; it was AMAZING.  The only thing that could have possibly made that statement any better is if she would have said:

Yes, in Episode 13 “Datalore”, Captian Picard knew that Lore was impersonating Data because he used a contraction.

It was awesome; I love my family.

*The super nerdy among us would point out that Data’s use of contractions is somewhat of a hot button topic (as evidenced here), but that’s really irrelevant to the point.

cub scouts in space

Last night in our weekly den meeting, we worked on our astronomy belt loop. I was pleasantly surprised at our discussion, and a have a [slightly] renewed faith in our public education system.

It’s very encouraging to listen to 3rd graders talk intelligently about black holes, stars, pulsars, galaxies, planets, etc. We had a debate about Pluto’s planetary status, and we drew models of the solar system (some included Pluto in their model and some didn’t). The discussion even drifted into Star Trek for a bit … AWESOME!

I think the highlight of the night for the boys was when we got the telescope out. It was super clear and we had a great view of Jupiter and the Galilean moons. It was an experience that most of the boys had never had before, and I was super honored to facilitate.

PHP HashTable implementation

Here’s a quick/dirty HashTable implementation for PHP (based on the Java Hashtable API).  There are probably better ones, but for what it’s worth … here ya go:

class CHashTable
{
  private $_arr = null;

  function __construct()
  {
    $this->_arr = array();
  }

  function clear()
  {
    unset( $this->_arr );
    $this->_arr = array();
  }

  function contains($value, $bStrict=false)
  {
    return in_array($value, $this->_arr, $bStrict);
  }

  function containsKey($key)
  {
    return array_key_exists($key, $this->_arr);
  }

  function containsValue($value, $bStrict=false)
  {
    return $this->contains($value, $bStrict);
  }

  function get($key)
  {
    $value = null;

    if( array_key_exists($key, $this->_arr) )
    {
      $value = $this->_arr[$key];
    }

    return $value;
  }

  function isEmpty()
  {
    return ($this->size()<=0);   }   function keys()   {     return array_keys($this->_arr);
  }

  function put($key, $value)
  {
    $this->_arr[$key] = $value;
  }

  function putAll($arr)
  {
    if( $arr!==null )
    {
      if( is_array($arr) )
      {
        $this->_arr = array_merge($this->_arr, $arr);
      }
      else if( $arr instanceof CHashTable )
      {
        $this->_arr = array_merge($this->_arr, $arr->_arr);
      }
    }
  }

  function remove($key)
  {
    unset( $this->_arr[$key] );
  }

  function size()
  {
    return count($this->_arr);
  }

  function toString()
  {
    return print_r($this->_arr, true);
  }

  function values()
  {
    return array_values($this->_arr);
  }
}

The term “hashtable” may be a little loose  here.  There is no hashing or indexing done to increase performance.  The purpose here was to have some PHP object class to mimic the behavior of a Java Hashtable; it is really use an API wrapper around some PHP associative array.  It makes my life easier when porting code.

There may be some issues here, I haven’t really put it through it’s paces yet.  I’m writing some database code and needed a base class for data objects that behaves like a Hashtable.

If you have any constructive comments/suggestions, let me know.  As always, the commenting rules apply…

Android Market Web Fail [updated]

The new Android Market web site looks to be impressive.

The “invalid request” error I get when I (and everyone else in the world) attempt to log in is not impressive.  Sigh…

I’ll try again later…  Good job Google.

[update]

Good job Google.

After the initial issues with logging in, I noticed a few small hiccups:

  • The apps I already had were not recognized as “INSTALLED”.  Each app in the market will tell you whether or not it is installed or can be installed.
  • When installing, I would get an error message telling me to try again later.  Then (even with the error), the app would begin installing on my phone.

But … with a bit of time (I’m guessing to sync somehow with my device).  All of my apps were detected, and I am not getting error messages any more.

I’m diggin’ the new market web site right now … I think mainly because I HATE using the market app on the phone.