YouTube is Co-Hosting a Presidential Debate

This may not be news to some avid YouTube followers, but YouTube is hosting presidential debates with CNN on July 23rd (Democrats) and September 17th (Republicans). They are asking that people submit video questions that will be shown, live, during the debates to the presidential candidates.

This is what I am talking about! Rather than being a “website where TV content is shown”, YouTube is now a “TV channel” where, unlike regular TV, viewers will be invited to participate. This is something that no other network can replicate. It also underscores YouTube’s true vision, which is often misunderstood as a massive haven for copyright infringement.

One of the more interesting dynamics that arise from this is the use of visual cues during the video questions. For example, people can show pictures of loved ones or the rundown state of a building to illustrate their points. Not only does this force candidates to address issues they might not have otherwise ignored, but there is a potential to shift public perceptions if a video is really exceptional.

I’m expecting a whole lot of Iraq questions during the Republican debate (YouTube users are liberal leaning, after all), but maybe that’s just me.

Steve Wasn’t Kidding. Safari IS Fast.

I finally get why Apple chose Safari for the iPhone. It’s because Safari does content rendering amazingly fast: especially AJAX. This should have been more evident when the iPhone was first revealed and a customized Google Maps application showed the little red pin dropping on the map a smooth animated way. I’ve included the video below.

Watch the animations carefully and remind yourself that Google Maps is running inside a browser on a phone:

At work, I am writing an application that does some AJAX event handling. The scripts I use fire up as soon as the page finishes loading, and takes linearly more time to initialize as the page size increases.

  • In IE, the page will freeze up for about 1 second while the JavaScript fires up.
  • In Firefox, this same freeze time is about 1/2 a second. 
  • In Safari, I can’t notice the load up time. And I’m really paying attention.

On the iPhone, this will be a Godsend. I say that because sometimes I load up a website on my Blackberry, and occasionally things freeze up for 10 seconds while it tells me “running JavaScript…” (stupid CNN.com)

The very first time I launched Safari, it was slow as pudding — probably doing updates or something behind the scenes. But after the third or fourth start up, it was amazingly fast. I mean really fast. Firefox and IE both take a few sounds to launch. Safari is probably twice as fast (as advertised!). I don’t know how they do it, especially since the entire application has a visual skin, but they did it.

Another interesting aspect of the Safari browser is memory usage. Many people have probably noticed it is a beast when it is being actively used. And it is. But it is actually very smart in how it manages your memory. Observe:

  1. I have a blank window of Safari open and it is using 22 megs of memory.
  2. I visit Google.com and it goes up to 29 megs.
  3. I open a tab and visit Digg.com. It is now up to 43 megs.
  4. I minimize it. It is now using 1.2 megs.

Now that was unexpected. Clearly Safari only uses memory it knows is freely available, and then releases it back as soon as it recognizes it is no longer needed. In a limited environment such as the iPhone, I can see why this sort of streamlined memory management is ideal.

So despite there being a few hiccups in the (still Beta) browser, I am, overall, very impressed with its quality.

Why a Digg Review Section is a Dumb Idea

A few weeks ago, Digg announced its intentions to move into restaurant and product reviews. Cashmore was optimistic about Digg changing its demographic, citing Facebook as an example of how that is possible. But I would first point at Netscape. Netscape, under the leadership of ex-CEO Calacanis, tried to take mainstream people and throw them into social media. The (terrible) results speak for themselves.

Check out the graph to the right. Netscape getting ownedIf you take that graph and go back another six months (when the switch was made), Netscape has lost nearly half of its daily page views and has dropped 200 points in the site rankings.

Netscape’s experiment shows that regular people may not be interested in interactive news in the way geeks are. I think it makes sense: how many times have you heard someone gloss over your explanation of something and say, “I don’t care, I just want to use it.” Regular consumers want to consume, not contribute, even if it is as little as clicking a button. This means that even with more readers, Digg’s stories would stay heavily technology oriented, eventually pushing mainstream readers away again.

Also, Digg isn’t Facebook. Facebook can introduce stuff nobody likes and get away with it because hey have the stickiness of a social network. Just look at Myspace and its garbage user interface, friend spamming, and ugly profiles. It doesn’t matter. Besides, Facebook expanded its audience in such a way as to not impact the current core functionality or site experience – another key reason why the expansion was a success.

There are other factors that worry me about Digg’s model being applied to products and restaurants:

  1. Digg is highly anti-commercial. Articles are buried (rejected) for merely being blogs due to suspected “blog spam” (making money from the ads). How would that mix with reviews?
  2. Restaurants are extremely local in nature. Digg is global. Even 20 miles is too far to make a review relevant most of the time.
  3. Fanaticism would run rampant. Anybody could vote up a product review without actually having or used the product. This means simple fan-boy-ism could boost an otherwise crappy product to the top spot without a single person ever even seeing the item in person.
  4. Who is qualified to vote up a review on a restaurant they’ve never been to? Maybe the entire staff at the place? (see next point)
  5. The system introduces a huge incentive for commercial postings. 
  6. The surge of commercial postings creates an reason for users to bury reviews very defensively.
  7. Defensive burying is a problem because genuine reviews require a lot of effort. Unlike news postings, a good review (commercial or not) would take hours to compile. It would be a strong deterrent for first time reviewers if their first submission was rejected for being “too commercial” simply for having ads on their blog.

I think Digg would be making a mistake by entering these markets. Review sites already exist for various products and are well indexed. Digg would, in the very best scenario, be spammed up with links to these sites. In the worst case, Digg would have wasted months trying to go “mainstream” only to further alienate users.

Digg already does social news well, and it needs to focus on doing that better. Digg should really focus on enhanced personalization so that each account gets its own customized list of “top” news items — this was another prong of the original announcement and I think they are dead on there.

How the iPhone Will Save Web Standards

Today, Apple has announced the beta release of Safari for Windows – the browser that will be shipped with every iPhone.

safari

This is great on multiple levels:

  1. Developers can finally run tests against the Safari browser without having a Mac (usually these tests simply didn’t happen). This was the reason many sites broke on Macs.
  2. Safari has a strong track record from Mac enthusiasts, which is a mostly separate crowd from Firefox enthusiasts. Thus, this may help further increase adoption of non-IE browsers.
  3. Applications can be tested against the iPhone without an actual iPhone in hand.

That last point is crucial. Right now, everything targets IE, and this is a pain for web development because IE bastardized web standards such as HTML and JavaScript. This meant anything you programmed had a chance to break in IE even if it worked in every other browser on the planet. 

The iPhone may be the best thing to have happened to the Internet since Firefox was born.

If the iPhone becomes the new target platform, standards become truly relevant. Why? Because for the first time in history, hordes of regular Joe consumers will have web access in the palm of their hand, and no company wants their website to completely break when viewed through the iPhone. This is especially true as more and more people begin to consume information strictly through their handheld devices and stop visiting web sites that don’t work on their phones. As a personal example, even though I read lots of news sources when on a desktop, on my Blackberry, I only read a select few sources that are built to handle mobile browsers.

The point is: web publishers can no longer choose to target IE. And as many analysts predict, with or without Apple, the mobile web will match or over take desktop web usage in the near future. Just take a look over at Japan to see what I mean.

So as a developer, I would like to thank the iPhone for making my life better. 🙂

Second Life – Cash Cow or Pipe Dream 2.0?

I found an article devoted to discussing the slow (but existent) virtual store economy in Second Life.

Second Life gains its appeal from its virtual economies and businesses. Since its meager days, Second Life has continued to draw attention from the mainstream media. Most people know Second Life from the virtual land grab that is taking place. Even the article I linked above talks about spending “millions” to “develop” a piece of virtual land. While it is unclear if they meant virtual millions, the current exchange rate would still put that past 10 thousand dollars.

It is possible to make money selling characters on World of Warcraft. It is possible to make money selling items in Lineage II. But to hear someone (in this case, a company) investing several thousand dollars into a game is insane. If their goal is product exposure to a highly targeted demographic, they may have an argument, but they are interested in e-sales of regular products.

When I shop on Amazon, I can compare prices, lookup other retailers using Google, and see pictures and reviews from hundreds of sources. And I feel safer knowing my credit card is being securely transferred. This is a good consumer experience, which is why Internet sales have been skyrocketing in recent years.

But what about in Second Life? None of that is guaranteed. On the merchant’s side, you have all of the overhead in creating an online store front, plus the need to have “trained staff” on-site and ready to make sales… via chat. What a waste of resources. The barriers to entry are higher than a regular website, the audience is smaller, and the experience is confined to a game.

I’ve never fully understood why Second Life gets so much press. It currently has just over 4 million accounts, but nobody (except Linden Research, Inc., the creators) is able to verify how many of those come from repeat users. Meanwhile, World of Warcraft has over 8 million unique users. When is the last time you saw them in the mainstream press?

I wanted to close this by dismissing the value of “limited” resources in Second Life. This stuff is obvious to people like you and I, but there are clearly a few million people who think otherwise:

  1. In real-life real estate, there is only a certain amount of land. Even then, land is not always a guaranteed bet.
  2. Domain names on the Internet are unlimited. However, all English dictionary words are registered for the .com extension – these are clearly limited by the English languish itself. However, all other extensions (.biz, .name, .info, etc.) languish in popularity. The only way domains LOSE value is if the Internet ceases to exist (or they were over valued to begin with).
  3. Real estate in Second Life disappears if the company goes bankrupt. You will not get a refund on your purchase.

Facebook Gets Videos, but It Sucks (a Lot)

video-pageFacebook introduced a new video section of their site recently (found at http://www.facebook.com/video/). As with all things Facebook, the section contains an extremely simple interface — a little too simple (more on that later). The whole thing smells like it was rushed. Overall, the Facebook Video section brings a few positive things to the table, and just plain sucks overall.

When you hit the site, it asks you to add the application to your profile. As with all new features, this is an “application.” After you add it, you are able to view videos. Immediately, a few things stand out:

  • Videos can be tagged with your friends, and you can search for videos tagged of you.
  • Video browsing emphasizes friends. Videos by strangers are nowhere to be found. Odd.
  • There is no video search (perhaps it will be part of the main search later)
  • Videos can be browsed by “latest”, “of you” and “tagged by friends.” That’s it. No other sort or filter options are available.

Once the application is installed, you are able to upload videos. Some (of the only good) highlights emerge:

  • Videos can be uploaded from your phone (cool!)
  • Videos can be directly recorded from the site (see picture below)
  • Video max length: 10 minutes.

video-types

That’s about the only good things I have to say about Facebook Videos. The video player has a few standard Facebook features such as its own wall, a list of people who are tagged in the video, its length, and a pause button. But this is where it got ugly. Where do I begin? Study the screen shot below.

lacking-interface

  • Their player is missing volume controls!
  • Where is the mute!! (I need to mention volume twice because that’s just stupid)
  • There is no embed link (not going viral, I see)
  • No full screen mode
  • No rating system
  • No favorites or book marking
  • No view counts
  • No tags or categories
  • No related videos (this is stupid)

I waited until the end of the video to see if I was presented with related videos. Instead, I got this:

end-button

When I clicked on Next Video, it took me to the next video made by that author. Complete rubbish! Worse, when you play all of an author’s videos, you only get a Play Again button! This is worse than YouTube’s first iteration.

The problem here is that Facebook is treating videos like photos. But videos are different from photos in that they require a greater investment of time, creating a desire to only view the “good stuff.” The lack of tags, categories, ratings, and favorites means browsing for quality videos becomes next to impossible; in fact, it is likely that quality gets drowned out in crappy-video noise.

Facebook Video sucks. Facebook is definitely catering to the home-made audience with its video site by integrating people-tagging, but its misunderstanding of what makes a good video site will be Facebook Video’s downfall. While they have undoubtedly made uploading a straight forward process, browsing videos is an unenjoyable and often painful experience.

I think this is all part of an elaborate (and stupidly executed) plan to get a higher bid offer from Yahoo. In fact, the pair were back in the headlines after rumors broke of buyout talks being renewed. A successful entry into the video market might push Facebook to a $2 billion price (that’s how much they want), since YouTube went for $1.6 billion. But with garbage like this, gaining market share is complete fiction.

Without serious enhancements – and soon – this video site will languish in obscurity as people realize it’s a piece of garbage. Just doing the research to write this article made me want to tear my eyes out and mute the speakers.

No, seriously.

IE Redirect Bug with Dynamic Location Hash

I discovered the most obscure bug today in IE. For those of you paying attention, this bug is the reason I haven’t been updating — it ate up all my god-damned time. People who aren’t programmers can stop reading here.

What Happens

The browser is redirected when it shouldn’t be after modifying the URL hash (the stuff after #).

Scope

The bug exists on IE7, possibly 6 (why not, right?).

Steps to Reproduce

Assume you are on page A and want to redirect to page B.

  • Go to page A.
  • From page A, do a header redirect to page B in PHP/ASP/whatever. As in, header(‘location: $pageB’);
  • On page B, using JavaScript, modify the document.location.hash variable.

What Should Happen

The anchor text in the address bar should change. As in, http://www.michiknows.com/#someanchor changes to http://www.michiknows.com/#newanchor. This should happen without the page refreshing.

What Actually Happens

The browser refreshes. @#%!*(&$!

Solution / Fixes

On page A, rather than redirect using headers, use JavaScript:

<script>
// if page A was http://www.michiknows.com
document.location.href = 'http://www.michiknows.com/';
</script>
<a href="http://www.michiknows.com">go to page A</a>

For some dumb reason, this fixes the problem.

Damn you, Microsoft!

Five Tips for (total) PHP Beginners

Someone asked me to write this a long time ago, so here’s my list. I make the basic assumption that you at least know some SQL.

1. Use EzSQL.

It is an open source library that does database abstraction. “Database Abstraction” is a fancy term for “making the database more developer-friendly.” It well help you grasp concepts like rows vs columns, how to manage multiple results, and escaping data. See their examples. While it is (in my opinion) a lacking solution for experts, it is awesome for newbies. I used this way back when I first started. Use it if you’re new to PHP.

2. DON’T Rely on Magic Quotes.

Magic Quotes is a retarded feature that tries to sanitize your data in an automated fashion. “Sanitize” is a programming term for “making data safe.” As in, without sanitizing data, hackers can do mean things to your database.

Some may argue turning this off is *unsafe* for beginners, but it also trains beginners to be less cautious about sanitizing data. This is a problem since the majority of corporate PHP servers (as in, the real world) have Magic Quotes off.  For example, let’s assume $name is equal to michi. Some programmers might try:

DELETE FROM users WHERE name='$name'; 
— thus: DELETE FROM users WHERE name='michi'

But what if a hacker managed to make $name equal to michi’ OR TRUE. What does the query end up looking like? If Magic Quotes is relied on, you would have been protected:

DELETE FROM users WHERE name='michi\' OR TRUE'; 
-- result: no such user; no harm, no foul

So it tries to find a user called michi’ OR TRUE, which is clearly not going to be found. In this case, Magic Quotes looks like a good thing. However, if you got used to Magic Quotes and then got a job, you might forget that it isn’t enabled in the Real World, and this is what happens:

DELETE FROM users WHERE name='michi' OR TRUE; 
-- (hint: it deletes all your users!)

Fired!

Just pretend like Magic Quotes is always off and use EzSQL’s escape() method or my solution (both solutions work regardless if magic quotes is on or off).

3. Always use require_once.

You will eventually see when include, require, or include_once is the better choice over require_once, but that time will come much later. As a rule of thumb for beginners, the last thing you probably expect is a silent “oops we couldn’t find the file so we’ll just continue on as if nothing happened…” bug.

4. Don’t display (echo) errors when a function has an error. 

Instead, store the errors in a class/global variable or return the error (neither of these are good practices for novice developers who should be throwing exceptions). The reason is that you never know in what context a function gets called; displaying errors could be disastrous in some situations. For example, if you were in the middle of writing a CSV file (comma delimited data file), you don’t want random unformatted error text appearing inside it saying “Error, invalid name!”. As in (notice the extra comma that got inserted in):

Charlie, Abigail, 31, California
Bob, Smith, 29, New York
Patrick, O'NeilError, invalid name!, 22, Washington
#check it out, a random extra comma got tossed in

Even if the script terminated at that point (which I assumed), the file may have been written to. Frankly, as a beginner, you or I can’t expect you to remember to *always* check if there was an error so it’s better to be defensive and just not randomly display stuff (which is why throwing exceptions is the ideal solution).

For those of you wondering why an echo statement might modify a file, note that for things like downloads in a browser, you will output the file in the browser and then change the header file-type to reflect what the user should do (i.e., download it). Thus, in this context, yes, you would echo out the entire file whether its XML, a Word document, a zip, a PDF, or HTML and then the user would be prompted to save it.

5. Use ob_start().

Put ob_start() at the beginning of your script before everything else.

<?php
ob_start();
// the rest of your script
?>

This will save you lots of time when you get advanced enough to do redirection or understand what it does. The syntax for browser redirection is:

// this is a side note on redirection; don’t put this in your script 😛
header("location: another_file.php");
die;
// always call die directly after a redirect!

Redirection means that the page should stop (if the redirection was successful) and the user never sees any output from that page. They are then immediately redirected to another page. Since they aren’t supposed to see any output, showing them output before a redirection ruins the redirect. This is often very confusing and difficult to fix for a beginner. ob_start() fixes that issue (it’s magical like that).

Note that if ob_start() is used, you don’t need to do anything else special. There is no need to use the other functions like ob_flush(), ob_end_clean(), etc. You’ll get to those later (probably a few months) once you fully understand what ob_start() does.

iPhone – June 29th

Over the weekend, it became official that the release date for the iPhone is June 29th.

As others have begun to wonder, is there too much hype for the iPhone? Consumers are amazingly critical of gadgets that have an explicit utilitarian value. If the iPhone does wrong any one of the half dozen things users expect on their cell phone, it could fail to meet expectations. With over a million inquiries about the iPhone, and it barely being publicized off of the Internet (until this weekend), that alone is rather amazing. Some of its most likely buyers are people who are not computer savvy, but those that are simply – uh – rich.

Of course, if anybody has been paying attention during water-cooler talks, it’s clear that the first wave of buyers are trend setters and those in the social elite. Just as with the iPod, the iPhone is all about style and status. I honestly don’t think the first wave of buyers will care about the phone’s capabilities, so long as it’s good enough; they are happy with the overwhelming attention they’ll receive at every single social gathering for the next three months.

Is there such a thing as having too much hype over the next big fashion item? I don’t think status symbols works like that. We’ll find out on June 29th.

On a personal note: no, I won’t be getting one of these. My company provides me with a Blackberry, and those run on T-Mobile (which is not AT&T).

Why Being Hard to Replace is Bad

I read something I’ve always followed without realizing exactly why:

Don’t be irreplaceable; if you can’t be replaced, you can’t be promoted.

I once worked with two programmers who told me they purposely wrote convoluted code. When I asked why they would do that, they replied, “Job security.” I always wondered why that company let its employees do that despite the impending likelihood that they would eventually quit and leave their mess for someone else to clean up.

Ever since then, I’ve always advocated for strict adherence to coding standards and frequent code ownership swapping. I’d like to add to the advice:

Nobody will choose to promote an individual who screws the company over – on purpose – on a daily basis.

I thought that was a neat tip to share on a Friday. 🙂