Archive for the ‘Programming’ Category

File Under: Humor, Programming

Jokes for Nerds: Wat Moments in Programming

If you ever doubt your nerdery, head on over to Destroy All Software and watch the video of programmer Gary Bernhardt’s Wat talk. If you find yourself laughing, rest assured, you’re a nerd.

The talk comes from CodeMash 2012, where Bernhardt took a few moments to highlight a few WAT? (link NSFW) moments in some of the web’s favorite languages like Ruby and JavaScript.

Seriously JavaScript, what’s up with this:

> [] + {}
[object Object]
> {} + []

Protest SOPA: Black Out Your Website the Google-Friendly Way

On Wednesday Jan. 18, Reddit, Wikipedia and many other websites will black out their content in protest of the Stop Online Piracy Act (SOPA), the Protect Intellectual Property Act (PIPA) and the Online Protection and Enforcement of Digital Trade Act (OPEN). Organizers of the SOPA Strike are asking interested sites to black out their content for 12 hours and display a message encouraging users to contact their congressional representatives and urge them to oppose the legislation.

Although it was rumored that Google might join in the protest, that does not appear to be the case. The search giant does, however, have some advice for anyone who would like to black out their site and ensure that doing so doesn’t harm their Google search rank or indexed content. [Update: It appears Google will be participating in some fashion. A Google spokesperson tells Ars Technica that “tomorrow [Google] will be joining many other tech companies to highlight this issue on our U.S. home page.” WordPress and Scribd will also be participating. You can read the full story on Ars Technica.]

Writing on Google+, Google’s Pierre Far offers some practical tips in a post entitled, “Website Outages and Blackouts the Right Way.” The advice mirrors Google’s previous best practices for planned downtime, but warrants a closer look from anyone thinking of taking their site offline to protest the SOPA/PIPA/OPEN legislation.

Far’s main advice is to make sure that any URLs participating in the blackout return a HTTP 503 header. The 503 header will tell Google’s crawlers that your site is temporarily unavailable. That way your protest and blacked out website won’t affect your Google ranking nor will any protest content be indexed as part of your site. If you use Google’s Webmaster tools you will see crawler errors, but that’s what you want — your site to be unavailable, causing an error.

Implementing a 503 header page isn’t too difficult, though the details will vary according to which technologies power your site. If you’re using WordPress there’s a SOPA Blackout plugin available that can handle the blackout for you. It’s also pretty easy to create a 503 redirect at the server level. If you use Apache ensure that you have the Rewrite module installed and then add something like the following code to your root .htaccess file:

    RewriteRule .* /path/to/file/myerror503page.php

That will redirect your entire website to the 503 error page. Now just make sure that your myerror503page.php page returns a 503 error. Assuming you’re using PHP, something like this will do the trick:

    header('HTTP/1.1 503 Service Temporarily Unavailable');
    header('Retry-After: Thu, 19 Jan 2012 00:00:00 GMT');

For more details, be sure to read up on the HTTP 503 header and see the rest of Far’s Google+ post to learn how to handle robots.txt and a few things you should definitely not do (like change your robots.txt file to block Google for the day, which could mean Google will stay away for far more than just a day). Even if you aren’t planning to participate in the anti-SOPA blackout tomorrow, Far’s advice holds true any time you need to take some or all of your site offline — whether it’s routine server maintenance, rolling out an upgrade or as part of a political protest.

[Image by]

File Under: Programming

Help NASA Code Its Way Through Space

If you’d like to work on software projects that might one day send your code to Mars or on a deep space mission, NASA has some code for you to hack on. The Space Agency recently unveiled a new website,, to provide a home for NASA’s various open source software projects.

The new website isn’t the first open source effort from NASA, in fact the increasingly popular OpenStack cloud software stack grew out of a NASA project. If you go further back into history, the Beowulf cluster — forerunner of most of today’s Linux clusters — was also a NASA project.

Unfortunately for outside developers NASA’s past open source efforts have not been very well organized, nor has there been an easy way to contribute code to the various projects. The new code website is designed to change that. According to its homepage the site’s mission is to “surface existing projects, provide a forum for discussing projects and processes, and guide internal and external groups in open development, release, and contribution.”

For the initial release the focus seems to be primarily on the first item in the list, while the forums and discussion aspects are still listed as “coming soon.”

While the community aspects may still be in the works, NASA has already made it considerably easier for developers to contribute by hosting its code at GitHub. So far there are five projects on GitHub (licensed under NASA’s Open Source Agreement).

Not all of the projects involve space, but if you’d like to try your hand at some code that tweaks images from Mars rovers or creates 3D interactive worlds, head on over to Github and grab a copy of NASA’s code.

File Under: Browsers, Programming

An Overview of Firefox’s Coming Developer Tools

Using the 3-D Page Inspector tool, coming soon to a Firefox near you.

Firefox is poised to deliver some new tools for web developers. When Firefox 10 is released in early 2012 it will add HTML and CSS inspectors designed to help web developers inspect and debug their code. Later releases will add more features, like a 3-D page inspector and even a built-in code editor.

Eventually Mozilla believes the built-in tools will replace the popular Firebug extension for most users, though it will likely be some time before that happens. In the meantime, if you’d like to see the new built-in developer panel in action, grab a copy of the Nightly builds, which all have the new tools in various stages of completion.

It’s worth noting from the start that these tools are not intended to replace the popular Firebug extension for those that need Firebug’s power user features. As Mozilla’s Kevin Dangoor wrote when the project was first announced: “we think Firebug is awesome… that’s why we invest so heavily in it already, more so than for any other add-on. We also want to explore new approaches to developer tools.” In other words devoted Firebug fans need not fret, the popular extension isn’t going away. The coming built-in developer tools are designed to supplement, not replace Firebug for the power user.

That said, the new developer tools will provide many of the basic features web developers require and will likely make Firebug unnecessary for many users.

Although they aren’t yet nicely integrated into a single panel like Firebug offers, by the time Firefox 12 hits prime time the browser will offer a web console, an element inspector with HTML and CSS info, Scratchpad for JavaScript development, a CSS style editor and an error console. Firefox’s view source will also add line numbers, closing a seven-year-old feature request.

The newest of these features is the page element inspector, which is now available in the beta channel. The basic layout of Firefox’s element inspector is a little different than what you’ll find in Chrome or Opera.

When you select “inspect element” Firefox will bring up a breadcrumb-style menu bar at the bottom of the page. To see the actual HTML or CSS applied to that element you need to click the corresponding buttons in the toolbar (or use the keyboard shortcuts). It’s an unusual design decision given that inspecting the element generally means seeing the HTML (at least that’s how every other browser does it), and it means there’s an extra click necessary to get to the same information that’s just one click away in WebKit and Opera.

The element inspector also dims out everything but the currently selected element — the visual opposite of what you’ll find in other browser’s inspectors, which color the currently selected element and leave the rest of the page as is. It’s not a deal breaker by any means, but it can be somewhat jarring when you’re used to opposite look.

On the plus side Mozilla has started work that will integrate the very handy Tilt add-on, which we reviewed a while back, into the inspect panel. The integrated Tilt option is only available in the Nightly channel at the moment, though of course you can just install the Tilt add-on if you want to use it today.

Look for the 3D inspector tools to arrive in Firefox 12 if all goes according to plan. Mozilla also plans to add a themeable Code Editor (so you can edit CSS files, or write JavaScript right in the browser).

While Firefox’s new developer tools are improving (and will be much more useful when the element inspector arrives in Firefox 10), there are still plenty of reasons to prefer Firebug or the WebKit tools. For example, if you open Firefox’s HTML inspector, style inspector and web console all at the same time there’s almost no screen space left for the actual page content. Firebug, WebKit and Opera all save considerable screen real estate by consolidating their tools into a single tabbed panel.

For more details on the new Page Inspector coming in Firefox 10, here’s Mozilla’s screencast overview:

Archive Your Social-Network Life With ThinkUp 1.0

A few of the things ThinkUp can do for your social-network life

ThinkUp, the web-based data-liberation and analytics application from former Lifehacker editor Gina Trapani, has just released version 1.0.

Social networking is often very ephemeral: You post something, a few people respond, and then the conversation just evaporates, disappearing into the ether. One of ThinkUp’s goals is the give your social-network posts a longer life and ensure that you’ll have a way to refer back to those conversations years later.

ThinkUp is a web-based app that pulls your data out of social silos like Facebook or Twitter and stores it on your own server. You control your own data, and have a record of your conversations potentially long after Facebook, Twitter and the rest have become mere footnotes in the history of the web.

“The conversations you have online are worth capturing, keeping, and referring back to over time,” writes Trapani on her Smarterware blog. “In fact, the things you share and the conversations you have about them gain weight, perspective, and importance over time, not just the moment you post them.”

The backup and archiving features alone would make ThinkUp a worthwhile app to have, but the real analytical power of ThinkUp comes after it has a local copy of your data. That’s when ThinkUp starts slicing, dicing and pulling together your data to reveal things about your online activity that you’ve never considered before.

For example ThinkUp can pull conversations together, plot them on a map, reveal which of your posts are the most popular, which are the most replied to and even track all the links your friends have ever sent you.

We took a detailed look at the software back when the beta was first released. Now ThinkUp is out of beta and ready for prime time with a 1.0 release.

The first step to using ThinkUp is installing the app on your server. The requirements are modest and installation is automated — if you can install WordPress, you can install ThinkUp. Of course not everyone is comfortable installing WordPress so ThinkUp takes a page from Dave Winer and offers a ThinkUp instance running on Amazon EC2. Just follow the link, sign in to your Amazon account and you’ll have ThinkUp running in no time (the first year is free for new EC2 users, $15/ month for the rest).

Once ThinkUp is installed you need to point it to your accounts. I tested it with Twitter and Google+ and had no problems importing data. One nice touch that’s been added since the beta release is a secret RSS feed for running the ThinkUp updater. Sure, you can add a cron job if you know what you’re doing, but for novice users the RSS feed is an ingenious tool — just add it to your favorite RSS reader (for example, Google Reader) and the reader will periodically scrape the feed, triggering the update.

The Twitter Dashboard in ThinkUp

Because ThinkUp pulls in your raw data it can show you useful stuff you won’t find on the social networks themselves. This is particularly noticeable with Twitter, which really shows very little beyond the most recent few tweets from your friends. ThinkUp takes the same data Twitter has and actually puts it to good use, showing, for example, your most replied-to posts, your most re-tweeted posts and, my personal favorite, conversations you have with other Twitter users. It also tracks everything your followers do as well. For example, ThinkUp catalogs all the links your followers have posted, displaying them all in one place. There’s also an excellent search function for tracking down old tweets.

While ThinkUp puts a tremendous amount of data at your fingertips, it manages to keep the interface simple enough that the data is never overwhelming.

ThinkUp also now makes it possible to host your conversations at a permalink on your site. It’s a feature that’s particularly useful if you frequently ask your Twitter followers for advice or suggestions. For example, here’s a page where Trapani asks her followers which iPad apps they recommend.

ThinkUp is already in use on several popular Twitter accounts, like, for example The White House (Steve Martin is also a fan) and in my testing it worked without a hitch. If you’re comfortable setting up basic software like WordPress, installing ThinkUp should be a snap and if you’re not confident around a server there’s always the Amazon-based version.

If you’d like to see more of what ThinkUp has to offer, check out the video below:

See Also: