Home

Archive for the ‘Web Development’ Category

Innovative new look for CTV.ca

Friday, October 9th, 2009

Wow, CTV.ca has really gone in a new direction with their home page. Look how much information they are able to fit on a single page. That really is a timesaver when it comes to navigation. I even see a few full articles on there. It looks like they are going for some sort of 3D effect too, by layering content on top of other content.

Time will tell if the public embraces this new innovative look, but one thing’s for certain, this definitely reflects the spirit of that company.

CTV home page

IE6 Splash Pages: I hate you 2002!

Monday, March 23rd, 2009

It’s always fun to openly mock people with old web-browsers :) Of course, in reality, they probably work on a very locked-down computer in a bank or something, but saucy developers don’t care. We are a bitter bunch, hopped up on caffeine and cookies. That’s why we’re a devil with the ladies ;)

Overly Judgemental IE6 Splash Pages
IE6 Splash page
(via Jay)

The MTV.ca home page is now 6.25MB in size!

Monday, March 23rd, 2009

The MTV.ca home page is now 6.25MB in size! I remember the days when I would cut large images into separate pieces to save on bandwidth :)

MTV.ca

Varnish HTTP Accelerator + ASP.NET + IIS

Sunday, February 1st, 2009

For the past couple of days I’ve been trying to figure out the best way to run an HTTP accelerator on the front-end of ScribbleLive. To handle the really spiky loads (20,000 GET/s) we get around large events, we do a lot of memory caching using .NET static variables and memcached for the bigger items that need to be distributed. But we’re still limited by IIS’s ability to serve the requests, which adds on a lot of WindowsAuth, OutputCaching, etc. overhead that really isn’t needed if we’re just serving static files. And it would be great to use something running on Linux (cheaper licensing and servers) on Amazon EC2 (easier to add new servers when we need them).

I’ve known about high performance servers like lighttpd that have been around for a while, and the new up-and-comer Nginx. I tried them out and they are amazing at serving-up content (PHP, Perl, mono, Rails) but their proxy abilities are still in their infancy. For example, Nginx when acting as a proxy has a Memcached Module which can check Memcached for an object, before going back to the origin/upstream server. However, you have to load your cached items into Memcached yourself, so it’s very useful yet. (Sidenote: the Nginx project is very impressive and I’m definitely going to watch them over the next year). Squid is the obvious choice when it comes to “proxy” and “caching”, but the other projects seem to perform much better under stress; not to mention, Squid configuration for a reverse-proxy is horrible.

After a lot of messing around in /etc config files, I stumbled on Varnish. Varnish isn’t a proxy product or a server like the others. It was built from-the-ground-up to be an HTTP accelerator, and it shows. Configuration is very straight-forward if you’ve used a CDN before, and it can do a lot of URL rewriting, managing cookies, edge-server includes (ESI), backend health polling, and support for inline C. The docs leave a lot to be desired, but you can’t have everything ;)

I got Varnish running on a Fedora virtual machine in Amazon EC2 with ./configure && make && make install. Then you just have to set-up a configuration via /usr/local/etc/varnish/default.vcl and launch the daemon.

On ScribbleLive, we use an ASP.NET session (stored in Memcached, with SQL 2005 failover) to keep track of your login. But until you login, we don’t use the session for anything. So my caching strategy is this: cache everything (images, stylesheets, etc) including ASPX files without any Set-Cookie headers until you login, then don’t cache ASPX files. Logging in is done via an HTTP POST, so I just told Varnish to not cache POSTs, and strip all cookies from cached responses unless an “ASP.NET_SessionId” cookie was sent in the request.

Here’s the configuration file I’m using which seems to work great. It remains to be seen if I actually roll this out into Production sometime soon, but using it myself in our Staging environment, it gives a massive improvement in page loads and origin offload, so I wouldn’t be surprised if someday soon when you visit ScribbleLive, you’ll be going through Varnish ;)

Funny Facebook Favicon

Sunday, January 11th, 2009

I was playing around with my profile picture on Facebook today. They are all served from http://profile.ak.facebook.com. I noticed something a little strange: check out the favicon for that server. WTF is that?! Some football/soccer player with some woman?! I think one of their web-developers was having a little fun ;)

Facebook favicon

.NET: Monitoring Windows processes from ASPX webpage

Saturday, January 3rd, 2009

I was recently working on some ScribbleLive features that require asynchronous processes to be running in the background on Windows. Since I want to make sure they keep running, I wanted Pingdom to be able to monitor (and alert) on them.

I was happy to find that in .NET, a web application can access the processes running on the host server. I whipped up this little bit of C# (which will be on an ASPX page) to check for the processes, and report if they are “UP” or “DOWN”. Pingdom will then check for the word “DOWN” on a request to the page and let me know if it finds one.

Here are the using statements that you have to have for this code to run:

using System.Diagnostics;
using System.Collections.ObjectModel;

Then here’s the bulk of it:

Collection<string> RunningProcesses = new Collection<string>();
RunningProcesses.Add( "Program1" );
RunningProcesses.Add( "Program2" );

Response.ContentType = "text/plain";

foreach ( Process proc in Process.GetProcesses() )
{
    if ( RunningProcesses.Contains( proc.ProcessName ) )
    {
        Response.Write( proc.ProcessName + ": UP" + System.Environment.NewLine );
        RunningProcesses.Remove( proc.ProcessName );
    }
}

foreach ( string s in RunningProcesses )
{
    Response.Write( s + ": DOWN" + System.Environment.NewLine );
}

When I have a bit more time, I’m going to add a call to Process.Start(…) to restart and processes that have gone down. You know, at some point this code will probably make me unnecessary :)

Brightness Theme Wordpress 2.7 Patch

Saturday, December 20th, 2008

I’ve been using the Brightness Theme on my blog for the past few months. It’s been great and a lot of people have complimented me on it. But it looks like the creator of the theme has gotten screwed by a domain-squatter. His site was DailyWP.com which is now just a link-farm page. It’s a shame because a lot of people are linking to that URL to get the Brightness Theme.

I have a copy of the theme files which I may post if they don’t come back soon, but for all those people already running the Brightness Theme, there are some issues if you upgrade your site to Wordpress 2.7. I’ve written this patch to fix the problems and get you up and running. There were just some minor problems with the setting screens and the “news sections” on the home page. Just drag these files into your /wp-content/themes/Brightness Theme/ directory and it should fix everything.

I hope those theme-ers at DailyWP.com come back some day; they did good work ;)

UPDATE 12/26: I’ve gotten a few requests for the full theme, so I’ve included it below with the patch applied.

DOWNLOAD PATCH
DOWNLOAD FULL THEME

Brightcove.TV switches itself off

Friday, December 19th, 2008

This week Brightcove.tv seems to have shut it’s doors to, “focus all our energy on our white-label, online video platform.” I guess they decided to quit trying to be YouTube and go the way of Feedroom and Maven. I can’t remember the last time someone sent me a video to a Brightcove video, but I’m sure someone will be upset over losing their content. From the sounds of their FAQ it looks like if you had a video on Brightcove (or embedded on your site) it’s just *poof* gone. Free-service FTW! ;)

brightcove

ASPX: Don’t put UserControls inside of code blocks

Sunday, November 30th, 2008

I was trying to figure out why an ASPX page was taking so long to render. I put time markers all through my code, but the slowdown was happening between the end of the Page_Load execution, and the beginning of the page render. There were no exceptions or anything.

Finally, by a painful process of elimination, it turned out to be a block of code like this in the ASPX file. At render, it was deciding whether to include a custom UserControl. While the code executed properly, the only hint of a problem was iistrace showing “IISISAPI: ISAPI_END – IIS ends processing an ISAPI Request” taking a long time.

<% if( IsSomething ) { %>

    <%@ Register src="~/Sidebar.ascx" tagname="SiteSidebar" tagprefix="MySite" %>
    <MySite:SiteSidebar runat="server" />

<% } %>

If you want to save yourself hours of grief, don’t do this :D I wonder if this is the problem with a certain video player ;)

When NOT to start an online store

Friday, November 21st, 2008

Today I was asked by a client how to start an e-commerce store on their website. I’ve shown them the Wordpress e-commerce plugin in the past. Having a brand-new website, they are excited to start doing more with the web and want to start selling online. I wouldn’t mind doing the contract work to get them selling, but first they need to take the time to do a thorough examination of what benefit it will have to their business. I’ve seen a lot of people put up e-commerce stores with the thought that “if I put it up, people will come” which isn’t true. An online store requires constant exposure to search engines, mailing lists, advertising, phone support, tech support, etc. It can become (at least one) full-time job.

If you’re thinking about starting an e-commerce store, the first thing I would do is estimate how many visits to your site would convert to a sale. Say 1 in 10,000 visitors decide to buy something, especially if you’re selling products that are available elsewhere. To generate that one sale, did you have to spend $5,000 ($0.50/Google Adword) in advertising dollars? How many hours of your/employee work did it take on top of that?

As you see, an e-commerce store without a proper strategy will just end-up soaking up time, money, etc. that could be better spent growing a non-e-commerce website into a destination which will be easy to monetize later. My advice is always, if you don’t have a fully-flushed out strategy for making money online, DON’T! :D