Marques Johansson's Blog a' Cola

The personal ramblings of an early participant in meaningless online rambling. Family (especially children), PHP, Linux, and occasionally PS3 games are discussed.

The worst that can happen

With all the disaster in the air, I was wondering "what's the worst that could happen?"  I Googled it, and the results were disappointing.  Videos, songs, blah blah blah.  Where's the gloom and doom?!

With respect to Hurricane Irene, I propose that the worst that can happen, to me, is the destruction of my newly constructed house.  Insurance should cover that (but I'd better check).

People aren't going to die on my watch unless a house crashes on them.  We aren't in any flood-able area, there are no Atlantic tsunamis to speak of.  That's it.  I've been through a few Florida hurricane seasons, so I feel pretty confident that this is the worst that can happen.

Earthquakes they are another story.  I don't feel like I can control those at all.  It was nice meeting you the other day, now please stay away!

My final thought on this is that there ought to be a web site that lets people submit the worst thing that can happen based on the multitude of variations of improbable disasters.  Such a site could be a real tool in the event of an actual emergency.  The site could also relate real life stories (blogs, videos, etc) based on those circumstances and outcomes.

I know there are many sob stories out there about horrible things that happened to wonderful people.  Don't take it personally.


The Zuck and Brin beat me

Seriously?  Google Plus just got games like yesterday, and in my first toss I got an Angry Birds shot that places me in a top list with the CEO of Google and Facebook?  I realize that the score list is probably limited to the people that I circled, but ... How cool is that?

If you still need an invite click here: http://goo.gl/hjIdO


Javascript Scope Resolution

I ran into some problems understanding a script that I was refactoring and hit Google up for "Javascript Scope Resolution".  The search  results were very bad, many were not even related to Javascript.

Please allow me to inject some more appropriate results:

- Entry level examples - local and global scope
- Inner function scope and how to transfer scope through closures
- Changing context with the function methods apply() and call():
- Simple examples that show how context changes depending on instantiation, this, and var usage
- Prototype .bind(), ExtJs() .createDelegate(), Mootools .create(), jquery .proxy()
- A lengthy bit on closures
[Release Update - I didn't see any value in posting this, so it remained a draft.  I just checked again and the majority of search results are C and PHP related.  Blogs away! ]

Begging for a Google Reader Offline mode for Android

I don't get cell reception while the train is running through tunnels. Please please please give us an HTML5 based offline mode for Google Reader on Android phones.

I work around this by setting my feed size really high (100 items) but then I have to use "Mark all as read" (or not) against a much larger list when I have a few items that I would like to dismiss but maybe check out later. (with 10 items at a time I would just skip that page and come back to it after I read or mark as read the remaining blocks of 10)
in reference to:
"Of course, we know that offline access is important to some of you, and with the wide range of third party clients that sync with Google Reader, you don’t need to give it up. Depending on your operating system"
- Official Google Reader Blog: Spring Cleaning: Comments, offline, and older browser support (view on Google Sidewiki)

[Update 2010-12-01 Finally! http://googlereader.blogspot.com/2010/11/android-google-reader-app-is-here.html ]

People in PicasaWeb are linked to their PicasaWebs (sort of)

What's going on here?  Is Picasa going to start linking my tagged people to their Picasa Web Albums (finally?)

If that's the plan there seems to be a minor snafu.  Every contact (wether or not I have a gmail address for them) currently links to http://picasaweb.google.com/null.  [Sigh]

Google Voice Transcribes Baby Talk


The transcription for this message was "Hello Marques, Hello, hope all's well." That's incredible!

a function for breaking two strings by their overlapping / run-in parts


<?php /**
 * split two strings based on their overlapping portion. The expectation
 * is that string 1 ends with something that can also be found in string 2.
 * Returns an array with indexes 0, 1, and 2 indicating the pre-overlap(0),
 * overlap(1), and post-overlap(2) portions of the two strings
 *
 * @example splitByOverlap("ABCD", "CDEF") // array("AB", "CD", "EF")
 * @param string $str1
 * @param string $str2
 * @return array (0) str1 before overlapping segment, (1) overlap, (2) str2 after the overlapping segment
 */
function splitByOverlap($str1, $str2) {
  $matches = array();
  $results = preg_match('/(.*?)(.+)•\2(.*)/', $str1.'•'.$str2, $matches);

  if ($results) {
    unset($matches[0]);
    return array_merge($matches);
  }
  return false;
}