tekrat

Archive for the ‘personal’ Category

Kabuki Reserved Seats

Wednesday
Sep 3,2008

I finally got to go to Kabuki theatre since they’ve remodeled specifically for the purpose of trying out their reserved seating.  The theatre looks fantastic, and the staff is great too.  They have automated ticket machines where you can reserve your seat, or you can reserve them online before you go to the theatre.  There’s a nice bar upstairs, a coffee bar, and seating to lounge around in until the appointed time of your movie arrives.

I didn’t try the bar this time, (gotta save something for next time), but I think it’s definitely worth the drive to go to a theatre like this.  There’s a sur-charge for the assigned seating in addition to standard movie prices, but I’m tired of paying high prices to wait in lines and fight for seats, aren’t you?

Back and Forth

Wednesday
Aug 20,2008

The doors on the muni wouldn’t open today, so we where all trapped inside.  Whenever something like this happens there always has to be one person that just doesn’t understand and will continually shout: “I need to get off, I need to get off, open the doors, open the doors….”, even though it’s quite clear this isn’t going to happen right away and everyone is well aware of this very obvious situation.  Note to self: if there’s ever a *real* disaster, make sure you kill off these people first as they’ll just end up getting sane people hurt.

Once the doors opened I opted to wait out the muni fallout due to backed up trains, and went to Reverie for a cup of tea.  Here I found the plethera of wifi spots that is san francisco, my two favorites:

The first is a movie reference, I’ve included the youtube clip to give it the right context.

and this one just makes you want to waste all day trying to hack in:

Monday
Aug 11,2008

Browsing through the referral list of my web logs I discovered that I’m on the wrong side of the Gummy Bear Rights movement. I have some moments in my past where I probably wasn’t the kindest or best friend to our little gummy friends, and now I’ve been listed as examples of gummy bear torture on the “Save the Gummy Bears” page.  I’d like to publicily applogoize for my actions, and hope that the world will someday forgive me.

Roomba eats metal.

Tuesday
Jul 22,2008

I have some misc. hardware hacks going on at home, and I made the mistake of leaving some thumb screws laying around.  Apparently roomba decided it could eat these without too much trouble so I found them while emptying it’s poop drawer.  Pretty impresive for a little cleaning robot.

Where’s George?

Tuesday
Jun 10,2008

After 4 Years and 179 days WheresGeorge.com has finally come through and notified me of my wondering bills status.  I always thought it would be funny to distribute some dollar bills at a strip club all marked with wheresgeorge.com and a nice description of where I dropped them off at.

after the longjmp….

Sunday
May 4,2008

I swear the machines are just fucking with me sometimes:

Breakpoint 3, _zend_bailout (filename=0x4089c8
"/Users/shire/data/php/git/php/Zend/zend_alloc.c", lineno=1693) at
/Users/shire/data/php/git/php/Zend/zend.c:787
787             longjmp(*EG(bailout), FAILURE);
(gdb) n

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;!!!!!!!!!!!!!!!!!!!!;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;!!!!!!!!!!!!!!!!!!!/////////!!!!!!!!!!!;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;!!!!!!!!!!!!!!!!!!//////>)!*)>>/////!!!!!!!!!!;;;;;;;;;;
;;;;;;;;;;;;;;;!!!!!!!!!!!!!!!!!!////////>>))&H.I%)>>/////!!!!!!!!!!;;;;;;;
;;;;;;;;;;;!!!!!!!!!!!!!!!!!!/////////>>>))|&I,..H&))>>//////!!!!!!!!;;;;;;
;;;;;;;;!!!!!!!!!!!!!!!!/////////>>>>>)))|&H;))))>;I|))>>>>////!!!!!!!!;;;;
;;;;;!!!!!!!!!!!!!!///////////>>>)|&&%&&IIH%.)))),#HII&|))|.)>///!!!!!!!;;;
;;;!!!!!!!!!!!!//////////>>>>>>))|&*!!/:H))))))))))))):**H.%.)>///!!!!!!!;;
!!!!!!!!!!!!/////>>>>>>>>>>))))|&I,*;))))))))))))))))))))):*|)>>///!!!!!!!;
!!!!!!!!!//////>>)IH||||&||||||&H#,))))))))))))))))))))))))#HH)>///!!!!!!!!
!!!!!!//////>>>>)|&%:;>* /#:HHH%|)))))))))))

Thanks Vancouver!

Thursday
Apr 17,2008

I just got back from the OpenWeb conference in Vancouver, and I thought it was well run and enjoyable.  As with most conferences it’s difficult to make the wireless internet support so many users, not to mention with the restrictions and prices I hear some locations charge coferences.  (I also think electric outlets should be in much wider abundance).  But it’s really all auxillary anyways, and there where plenty of good talks to listen to.

All the talks where video recorded so I’m looking forward to looking over anything I missed as soon as they are up on the site (like the Google Gears talk).  It was refreshing to attend some other talks of interest such as mobile technologies and open source project research

As always you can find my talks in PDF format on my “talks” page.

Tricky Tricky Refcounts….

Monday
Apr 7,2008

Occasionally a PHP engineer reports this prolem:

Example Code:
————-
$my_arr = array(1,2,3);
foreach ($my_arr as &$val) {
    var_dump($val);
}
foreach ($my_arr as $val) {
    var_dump($val);
}


Expected Output:
———
int(1)
int(2)
int(3)
int(1)
int(2)
int(3)

Actual Output:
——-
int(1)
int(2)
int(3)
int(1)
int(2)
int(2)

The confusion comes from the expectation that the second loop will print the last element of the array as int(3) rather than int(2).  The initial reaction is usally “this is a PHP bug”, but it really isn’t.  There are two key aspects to this code to watch out for; 1) The scope of foreach variables is not limited to the foreach block. 2) Foreach loops do not unset foreach variables at the start of the block.

With this in mind we can see that at the end of the first loop, $val is a reference to the last element of $my_arr.  Each iteration over the foreach loop can be thought of as an assignment operation, in this case by reference:

$val = &$my_arr[0]
$val = &$my_arr[1]
$val = &$my_arr[2]  
// last iteration $val is a reference to $my_arr[2]


As we step through each iteration of the second foreach loop we see the assignments of $val to each element of the $my_arr (assigned by value this time).

$val = $my_arr[0]
$val = $my_arr[1]
$val = $my_arr[2]

But if we you recall $val is really a reference to the last element of $my_arr because it carries over from the first foreach loop, so the actual assignment looks more like:

$my_arr[2] = $my_arr[0]
$my_arr[2] = $my_arr[1]
$my_arr[2] = $my_arr[2]

Thus we end up with $my_array being set as such on each iteration:

// (array(1,2,1))  first element is set to value of last
$my_arr[2] = $my_arr[0] 

// (array(1,2,2))  second element is set to value of last
$my_arr[2] = $my_arr[1] 

// (array(1,2,2))  last element is set to value of itself

$my_arr[2] = $my_arr[2] 

Note that the last assignment is really assigning the last element to itself!

Because PHP5 handles variables with a copy on write algorithm, it’s typically not necessary to do any assignmnents by reference with performance gains in mind (as was the case with a lot of PHP4 code).  The above code can be made to function as the expected case by placing an unset($var) between the foreach loops, or not iterating over references and instead assigning the values of $my_arr explicitly by index or key values.  References should be used by care  and only when necessary.  When code like this is present in global scope or large functions it may affect future code in seemingly unpredictable ways. 

Tags: , , ,

Delivery Date Rescheduled…

Wednesday
Mar 19,2008

I love UPS tracking, but I’ve never really seen anything go wrong either…. until now…..  my package has been marked as rescheduled for two days later than expected.  Not too bad considering:

UPS: Tracking Information

日本へ行きます!

Thursday
Sep 20,2007

My first really long vacation in two years since working at facebook will be hapening this October as I spend the time exploring Japan. I will be doing some work, which hopefully means I’ll get to get some ground on the things I’ve been wanting to do. This also marks my graduation from my beginning Japanese course into intermediate classes!