New Updates

With the introduction of several Alanaktion web site features comes an incredible new update for all of our services: Single-Sign-On!

Single Sign On is a system that will allow you to sign in once to this site, and automatically signed in to all of our other services!  We will also be introducing signup through other services such as Facebook and Google, with the possibility of support for full OpenID authentication on all of our web sites.  Existing accounts across our entire network will be merged with global accounts over the next few weeks, and the new SSO system will be ready for use then.  For anyone who has already registered for a blog account here, but has not yet logged in to another site through their Alanaktion ID, we will be creating one based on any existing accounts, and will notify you when this occurs.

Web Comics

There are a lot of disappointments with most web comics, since it’s a relatively easy hobby to get into, but every now and then someone makes one that’s simply incredible.  I’ve spent the last few years getting into reading them, and I’ve got a nice list of my favorites I’d like to share.

Least I Could Do

Currently written by Ryan Sohmer and Lar Desouza, this is one of the most incredibly well-written comics I’ve ever seen.  It certainly has some inappropriate themes, but if you want a unique, intriguing, and simply hilarious comic to read, this is it.

xkcd

A largely-followed comic written by Randall Munroe, updated mondays, wednesdays, and fridays.  It’s primary focus is on math and science, specifically technology and programming.  If you’re a geek like me, you’ll learn to love xkcd.

Girls with Slingshots

Written by Danielle Corsetto, Girls with Slingshots is updated weekdays, and features a cast of mainly young-adult girls.  It’s certainly the type of comic where certain types of people will really appreciate it, but I love it and am glad to say I’ve read the entire archive more than once.

Questionable Content

Updated weekdays by Jeph Jacques, QC has a huge following, and has an amazingly written plot.  The story circles around Marten Reed, a young adult who’s life is turned around by a girl he meets in a bar.  In my opinion, the name is quite misleading, as, for the most part, the comic is really quite clean.  It’s not one that you expect to get laughs out of each day, but the story is one that will make you never want Jeph to stop writing.

There are plenty of others that I read daily, or that I used to read, or am just getting into that I didn’t write full descriptions for, but they’re certainly worth checking out.  Wigu, Treading Ground (complete), Anders Loves Maria (complete, wow), Dumbing of Age, Overcompensating, and Bunny are a few that come to mind.

MySQL Game

This is the most awesome, and yet most strange thing I think I have ever found. I tried to search on Google for MySQL on AppSpot, and the result I got was called “mysqlgame.” Of course out of curiosity I had to try it. Turns out it’s a MMO game where there is no UI, you have direct, live views of all of the queries on the database.

This is the text from the main page:

Are you tired of browser-based games that are thinly veiled interfaces for databases? Finally, there’s a game that just is a database!
THRILL as you insert your very own row in the “rows” table!
With careful selection of SQL queries, you will soon have three or even four-digit numbers in some of the fields in your row! Other queries may allow you to use those numbers to subtract from rows entered by other players — all while pushing the numbers in your own row even higher!
As you master the game, you may find that you have inserted not just one row into the game, but several! Log in on the right to get started.

Play mysqlgame

Using .NET 2.0 in Visual Studio 2010

Microsoft .NET Framework 4 introduces some nice new options, but if you want to more easily distribute your software, .NET 2.0 is the most widely used, as any computer running Windows XP Service Pack 3 or later will have it installed.  Changing an existing project or creating a new one uses the same method.

In the Solution Explorer, right click your project, and click Properties.  In the Compile tab, click Advanced Compile Options at the bottom.  In the window that opens, switch .NET Framework 4.0 to the desired framework version.

Existing projects may require some small code modifications in order to build correctly, but it is very beneficial to build your software on a more widely available framework.

Removing the Google Search Virus

I’ve seen this one a lot lately.  Basically, it shows a fake version of the Google and Yahoo! search engines in the attempt to track all of your personal information that you enter into those sites. Even if you don’t care about your information getting stolen, it prevents you from using Google Apps services such as Gmail, Google Voice, and in many situations, even the basic Google search engine will not work at all.

The biggest problem with repairing this virus is that it is technically not so much a virus as a setting. There is no malicious software causing it, no secret tracking cookie, no browser extension. It is simply caused by a Windows setting, not in the Internet Options, the Windows Registry, it is not found in the Control Panel, or even in the Network and Sharing Center or the Computer Management. Therefore no anti-virus software or registry cleaner will ever find it.

Diagnosing the Problem

Obviously you need to see if you actually have this problem before trying to remove it. The easiest way to see the problem is to look at the Google Home Page. Check the copyright date at the bottom of the page. If the year is incorrect, you probably have the virus. Another method of checking it is to go to Gmail. If the page returns a 404, 403, or 500 error, you’ve got the virus.

Repairing the Problem

Windows Vista/7

Open the Start Menu, click “All Programs”, click Accessories, then right-click Notepad, and click Run As Administrator.
Allow access if a confirmation message is shown.
In Notepad, click File, then Open…, then type %SystemRoot%\system32\drivers\etc\hosts and click Open.

Remove any lines from the file containing google or yahoo and save the file. The virus should now be repaired!

Windows NT/2000/XP

Open the Start Menu, click “All Programs”, click Accessories, then right-click Notepad, and click Run As… and select Administrator or a user account with administrative privileges.
Allow access if a confirmation message is shown.
In Notepad, click File, then Open…, then type %SystemRoot%\system32\drivers\etc\hosts and click Open.

Remove any lines from the file containing google or yahoo and save the file. The virus should now be repaired!

Mac OS X

Open /private/etc/ in Finder and open the hosts file in a text editor.

Remove any lines from the file containing google or yahoo and save the file. The virus should now be repaired!

Other UNIX/Linux

Using a text editor as root, open /etc/hosts.

Remove any lines from the file containing google or yahoo and save the file. The virus should now be repaired!

Android OS

Using a text editor as open /system/etc/hosts.

Remove any lines from the file containing google or yahoo and save the file. The virus should now be repaired!

To verify that it worked, open a web browser and go to Google and follow the Diagnosing the Problem section of this guide.

iPhone Web Apps

If you’ve got a Mac, making iPhone apps is easy, but if not, you’re out of luck. Kind of. Thanks to the wonders of HTML5, you can create a full offline application using just web pages, and actually install it on any iPhone, iPod touch or iPad’s home screen just like any other app.

Rather than put together a lengthy tutorial, I though it would be better to build a basic sample application that makes use of all of the standard WebClip features on the iPhone.

This sample application is a single-page simple recreation of the iPhone settings app.  It demonstrates enabling WebClip app mode, settings the status bar mode, configuring an icon, enabling a custom start-up image, correcting screen scaling, imageless top bar gradients, and list views.

Apple has a nice guide on the iOS Developer Library to using the standard WebClip features.  HTML 5 Rocks has a good guide on Application Caching (offline mode).

Download the WebClip Demo App

View on your device at alanaktion.com/webclipdemo 

Speed Up Your Web Site

Both simple and complex web sites have the potential to be fast, although they are often quite slow.  In this post, I will list some of the primary ways that you can increase the loading and rendering speed of your web site.

Minimize HTTP Requests

Combine Files

Rather than using multiple StyleSheets and JavaScript files, keep each one together in a single file, giving you your HTML file, a single StyleSheet, and a single JavaScript file.

CSS Sprites

To make css background images load more quickly, combine multiple images into a single file, and use background-position to select which section of the image you want to display.  A thorough guide is available on A List Apart.

Image Maps

Though less often used in modern pages due to CSS, Image Maps use a single image file with clickable areas of the image defined in the HTML.  See the official W3C documentation for information on how to use these.

Use a Content Delivery Network

Although difficult financially for small web sites, a content delivery network (CDN) will drastically help your web site load faster by providing static content such as images, scripts, and stylesheets at a geographically closer location to your user.  Akamai Technologies and EdgeCast are good options.

Compress Code

If your server supports it, enabling GZip output compression will make your pages load much quicker as the content is greatly reduced in size.

Stylesheets at the top

 By placing the references to stylesheets in the head of your page, the page layout and formatting can load before the extra page content such as images and plugins.

Scripts at the end

Including scripts at the end of the body will cause the content of the page to load entirely before pausing to load scripts that can’t run until the whole page has been loaded anyway.

External JavaScript and CSS

By placing JavaScript and CSS in separate files from the HTML, the browser is able to cache this content to keep from having to load it again on each page.

Reduce DNS Lookups

Content should be accessed from no more than four separate domains (or subdomains) to reduce DNS lookups, but it should be loaded from more than one domain to allow static and dynamic content to load at the same time, as most browsers only allow two connections to the same host at a time.

Minify JavaScript and CSS

To reduce the file size of CSS and JavaScript files, remove the portions that don’t actually do anything.  This is done by removing any indentation, non-critical spaces, comments, new lines, and semicolons that aren’t required for the code to function correctly.  The YUI Compressor is a great automated tool that can be used to minify both CSS and JavaScript.

Avoid Redirects

Although this is better than loading a page with a link to another one, use redirects only when necessary as they require sending all of the browser information and cookies simply to take you somewhere else, where you have to send that information all over again.  If your redirect will always take you to the same page, use a 301 redirect to prevent the browser from having to load the same redirect page again later.

Remove Duplicate Scripts

This should be obvious, but I very frequently see multiple copies of the same JavaScript files being loaded in a page.  If you’ve already loaded the script, don’t load it again.  jQuery people, figure this out. (the users, not the developers)

Flush Buffer Early

By sending the head of the page while the rest is still being generated, you allow the browser to begin loading the external content while the server assembles and transmits the rest of the page.  The example below demonstrates how to do this in PHP.

  ... <!-- css, js -->
</head>
<?php flush(); ?>
<body>
  ... <!-- content -->

Use GET for AJAX Requests

Using AJAX to load content is significantly faster than loading an entire new page, but it can be sped up even more if GET is used instead of POST, as POST sends the HTTP headers in multiple packets.  This will not greatly affect the speed, but is recommended if you do not need a large amount of cookies sent through AJAX.

Load Page Components when Needed

With the use of simple JavaScript code, you can load page components when they are actually needed, rather than when the page first loads.  By delaying images from loading until the user has scrolled down to where they are, the main page can load far more quickly.  The YUI Image Loader is a good way to do this.

Minimize Iframe Use

Although using IFRAMEs can  increase page loading speeds, and often have great security benefits, only use them when they are necessary, as they can slow down the renderer in most browsers, and can cause issues with JavaScript page load triggers.

Use Cookie-free Domains for Components

Loading all of the static components for a page such as images and stylesheets from a separate domain with no cookies can greatly increase the loading speed if your web site uses a large amount of cookies.  This can be done by having your main web site on one domain (or a subdomain), and having your static content load from another domain or subdomain that does not use any cookies.

Optimize Images

In order to shrink image sizes, avoid use of palette-based formats such as GIF unless you save the image optimized for the specific colors that you are using in the image.  Never, ever use bitmap format, as it is horribly large in size, as it saves the exact color value of every pixel individually.  If you are using photographs, save them as compressed JPG/JPEG images, with a reasonably low quality value in order to optimize the size.  Always remember to resize your images to the actual size you need, rather than loading huge photos right from your camera.  When using any web graphics, unless animated, using PNG format will almost always result in the smallest file size.

Avoid Empty Image SRC

Although quite ridiculous, having an empty src attribute on img tags will cause most browsers to load the index page of the current directory.  Try to avoid it.  Really though, why would you ever have this?  It’s more common than it should be.