Always Get Better

Archive for March, 2009

Facebook Breaks, But Photos Not Lost

Monday, March 9th, 2009

Over the weekend Facebook suffered a multiple hardware failure that caused its photo service to fail. Up to 15% of the site’s multiple-billion photos displayed as nothing more than a question mark on Sunday night.

Facebook is already in the process of cleaning up the mess and restoring the lost files, but the failure is just another example highlighting the importance of making backups of our own data rather than relying on “the cloud” for permanence.

Flex 3: Downloading URL after Clicking on Button

Tuesday, March 3rd, 2009

Suppose you have a button in your Flex program. When the user clicks on your button, they are prompted to choose where they would like to download a file. But… the file never comes:

[source:javascript]
protected function buttonClick():void
{
var mpRequest:URLRequest = new URLRequest(“soundbyte.mp3”);
var localRef:FileReference = new FileReference();

try
{
// Prompt and downlod file
localRef.download(mpRequest);
}
catch (error:Error)
{
trace(“Unable to download file.”);
}
}
[/source]

The reason the file never downloads is because as soon as the function completes, it goes out of scope. As far as I know, this has to do with the event model using weak referencing by default when triggered by clicking on the button.

The simplest solution is to simply move the variables outside the button:

[source:javascript]
protected var mpRequest:URLRequest;
protected var localRef:FileReference;

protected function buttonClick():void
{
mpRequest = new URLRequest(“soundbyte.mp3”);
localRef = new FileReference();

try
{
// Prompt and downlod file
localRef.download(mpRequest);
}
catch (error:Error)
{
trace(“Unable to download file.”);
}
}
[/source]

The Fragile World Internet

Sunday, March 1st, 2009
internet
Creative Commons License photo credit: kalleboo

In December 2008, a “fault” in three of the undersea cables under the Mediterranean Sea denied Internet service to thousands of subscribers in Egypt, India and the Middle East.

It’s hard to explain to people how the Internet connects together, especially to users in North America who have a hard time understanding about the world beyond our own shores. Communications don’t happen by magic – there are cables laid all around the world by commercial interests. Since much of the worldwide traffic is routed through hubs in the United States, American users rarely notice cable-induced outages.

Across the ocean, however, the Internet is more susceptible to damage. Regional links are expensive to maintain when much of the outgoing traffic is bound for North America anyway. The result is a small number of backbone connections servicing major routes across the Atlantic and Pacific oceans.