Twitter Updates

    follow me on Twitter
    See all our photos at www.flickr.com/photos/fischco/
    Thursday
    Mar312011

    Ready for adventure with grandparents

    Kirin is off at my parent's house this week. The house is so quiet without her around! It's hard to see her grow up so fast!

    Saturday
    Mar262011

    PHP SoapServer, Objects, Arrays, and encoding 

    I ran into an bothersome problem with PHP’s SoapServer class this week. Here’s what I wanted as output from the server:

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP-ENV:Body>
          <locationCollection>
             <Location>
                <name>AME s438</name>
                <id>452</id>
                <latitude>32.236322</latitude>
                <longitude>-110.951614</longitude>
             </Location>
             <Location>
                <name>ECE 229</name>
                <id>45</id>
                <latitude>32.235069</latitude>
                <longitude>-110.953417</longitude>
             </Location>
          </locationCollection>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    

    However what I was getting instead was:

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP-ENV:Body>
          <locationCollection>
             <SOAP-ENC:Struct>
                <name>AME s438</name>
                <id>452</id>
                <latitude>32.236322</latitude>
                <longitude>-110.951614</longitude>
             </SOAP-ENC:Struct>
             <SOAP-ENC:Struct>
                <name>ECE 229</name>
                <id>45</id>
                <latitude>32.235069</latitude>
                <longitude>-110.953417</longitude>
             </SOAP-ENC:Struct>
          </locationCollection>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    

    Here was my original code for the server:

    <?php
    $wsdl = 'http://example.com/locations_service.wsdl';
    $service = new SoapServer($wsdl);
    
    $service->addFunction('getComputerLabs');
    $service->handle();
    
    function getComputerLabs($input) {
      $all_locations = resource::get_all(FALSE, 'location');
    
      $return_array = array();
    
      foreach ($all_locations as $l) {
    
        // Build a basic return object.
        $new_loc = new Location();
        $new_loc->name = $l->name;
        $new_loc->id = $l->resource_id;
        $new_loc->latitude = $l->getProperty('Latitude');
        $new_loc->longitude = $l->getProperty('Longitude');
    
        $return_array[] = $new_loc;
      }
    
      return $return_array;
    }
    
    class Location {
        public $name;
        public $id;
        public $description;
        public $url;
        public $buildingName;
        public $roomNumber;
        public $openStatus;
        public $latitude;
        public $longitude;
    }
    ?>
    

    Apparently the SOAP library really prefers that everything is an object. In php 5 they added an ArrayObject class. This coupled with a SoapVar call fixed my output for me.

    <?php
    function getComputerLabs($input) {
      $all_locations = resource::get_all(FALSE, 'location');
    
      /**
       * Use an ArrayObject instead of a plain array.
       */
      $return_array = new ArrayObject();
    
      foreach ($all_locations as $l) {
    
        // Build a basic return object.
        $new_loc = new Location();
        $new_loc->name = $l->name;
        $new_loc->id = $l->resource_id;
        $new_loc->latitude = $l->getProperty('Latitude');
        $new_loc->longitude = $l->getProperty('Longitude');
    
        /**
         * Encode each array element with SoapVar.  Parameter 5 is the name of the
         * XML element you want to use.  This only seems to work within
         * an ArrayObject.
         */
        $new_loc = new SoapVar($new_loc, SOAP_ENC_OBJECT, null, null, 'Location');
    
        $return_array->append($new_loc);
      }
    
      return $return_array;
    }
    ?>
    

    Note that with only the ArrayObject part, and before I figured out the SoapVar wrapper, I was getting this interesting BOGUS tag:

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP-ENV:Body>
          <locationCollection>
             <BOGUS>
                <name>AME s438</name>
                <id>452</id>
                <latitude>32.236322</latitude>
                <longitude>-110.951614</longitude>
             </BOGUS>
             <BOGUS>
                <name>ECE 229</name>
                <id>45</id>
                <latitude>32.235069</latitude>
                <longitude>-110.953417</longitude>
             </BOGUS>
          </locationCollection>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    
    Sunday
    Dec122010

    Gingerbread House


    GingerbreadHouse, originally uploaded by estranged42.

     

    Thursday
    Sep162010

    Tonight's Train Layout


    Tonight's Train Layout, originally uploaded by estranged42.

    Thursday
    Sep162010

    Pumpkin!


    Pumpkin!, originally uploaded by estranged42.

    First pumpkin of the season!

    Wednesday
    Jun232010

    My Girls


    IMG_3204, originally uploaded by estranged42.

    Wednesday
    Jun232010

    Darla


    IMG_3194, originally uploaded by estranged42.

    Guess what I got for Father's Day!

    Sunday
    Apr252010

    Reid Park


    Reid Park, originally uploaded by estranged42.

    Kirin and I wandered around Reid Park this Saturday. Couldn't pass up this shot!

    Tuesday
    Apr202010

    Kirin Turns 3


    IMG_3116, originally uploaded by estranged42.

    Kirin had her 3rd birthday party up in Phoenix this past weekend. Much fun was had by all!

    Saturday
    Apr102010

    UITS Circuit People - It Works!


    UITS Circuit People, originally uploaded by estranged42.

    Well, I populated the circuit board tonight, soldered up all the components, tossed in some batteries, and flipped the switch!

    And nothing happened.

    After ten minutes or so poking at the traces with my multimeter, I discovered that I have one trace out of place leading into the power switch. Fortunately a simple jumper from one pin to another on the switch was able to fix the problem. And it worked!

    I have to admit, this thing looks pretty damn good! Not too shabby for my first PCB layout and project. I think I started toying around with this design over a year ago, so it’s pretty cool to actually hold a real, physical, blinking thing in my hands.

     

    UITS Circuit People EAGLE Schematic Files

     

    Friday
    Apr092010

    First Printed Circuit Board!


    Fitting Parts, originally uploaded by estranged42.

    I got my first printed circuit board (PCB) design in the mail today. This is for a pretty simple blinking LED project.

    When UITS got its new logo, the dancing circuit people just screamed out to be made into a real PCB somehow. This is what I came up with. I realize using a full Arduino ATMega168 is a bit overkill for driving some LEDs, but I decided that I’d rather get a prototype working this year instead of deciphering datasheets for the smaller ATtiny series for the next 6 months.

    The basic idea is to just have the color changing LEDs fade between red and blue in various patterns. Pushing the button will cycle through a couple different blink patterns.

    I got these boards printed at BatchPCB. If you’re only wanting 1 or 2 small boards, they’re hard to beat for price. $45 for two boards, and they ended up sending me 4! Took about 20 days for them to get here, but they look great!

     

    UITS Circuit People EAGLE Schematic Files

    Monday
    Mar292010

    Painting!


    IMG_3062, originally uploaded by estranged42.

    We had a grand time painting this past weekend!

    Saturday
    Feb132010

    Kirin in Snow


    Kirin in Snow, originally uploaded by estranged42.

    We drove up on top of the rim near Sedona and gave Kirin her first taste of snow. We built quite a fine snowman that many people enjoyed. More pictures to come. You can see a qik video of us playing in the snow: http://qik.com/video/4908018

    Thursday
    Dec312009

    Starfield


    Starfield, originally uploaded by estranged42.

    After nearly a year, I finally finished up putting LED ‘stars’ onto our bedroom ceiling. See this earlier post where I talk about getting it started.

    After a lot of soldering and taping, I managed to tape 32 white LEDs to the ceiling of our bedroom, and get stars working.  I tried a bunch of different wiring ideas out before settling on simple bare buss wire.  I just put some white electrical tape to keep it in place, and tape over any place where the lines have to cross.  

    The affect is really pretty awesome with the room dark.  There are just enough stars lit at any one time to barely light the room, but not so bright that you can’t fall asleep with them twinkling.

    Nothing like blinking LEDs!

    Code: View or Download 

    LED Control Wire Connections

    Control Wires

    One Star

    Monday
    Dec282009

    Installing Bazaar (bzr) GUI Tools

    I’ve been trying out Bazaar, a version control system, lately.  One of the things that caught my eye is that the core team develops a cross platform GUI interface for the system.  Installing bzr itself was pretty straight forward, they even have a simple Mac OS X installer package for it.  Installing the GUI tools was… less intuitive.

    There’s some really basic instructions out there on how to do it, but the documentation is somewhat lacking in specifics.  Fortunately there’s a great project out there called macports that was able to do 98% of the work for me.

    The last 2% came down to two errors involving path info, or the lack there of.  The GUI parts are all written in Python, on top of Qt. Adding the following lines to my .profile file fixed several hours of frustration in terms of “Why won’t you work!”

    export DYLD_FRAMEWORK_PATH=/opt/local/Library/Frameworks:${DYLD_FRAMEWORK_PATH}
    export PYTHONPATH=/Library/Python/2.6/site-packages/:${PYTHONPATH}

    Gotta love free tools, but whew, they aren’t always the easiest things to install…