Over the years as a Web Developer, I've learnt a lot and written many lines of code. Not every line is unique though, thanks to code re-use and the adaptability of websites.
I've accumulated a small pile of code snippets, in the form of text files, bookmarks and scraps of paper. However, finding that method for checking NULL values in C# or the syntax for a cursor in SQL can prove to be time consuming - resorting to a Google Search yet again.
So, I decided to finally put all of the snippets in the one place, for referencing during my day to day work as a Developer. Behold: snippets.slickhouse.com
There's already a few on there in various languages that I've dealt with in the past (and continue to). The site is also powered by SlickCMS - with several adaptions to fit the style, such as simplified Post listings and custom URLs to allow for the same named snippet, but differing Languages.
The style is also inspired by the excellent stackoverflow.com - itself a vital source of information for a Developer. I did plan to make the site open to the public, so that you too could add your own snippets - but I felt that you'd either prefer to roll your own (go ahead and download SlickCMS to get yourself started) - or to use an established service, such as snipplr.
Let me know what you think as always - and feel free to keep checking the snippets site, as I'll be adding many more over the next few days.
Take a look to the right and you'll see 5 lots of Novembers in the Archive:
Which makes this blog 4 years old! A lot has happened in the past 4 years, including 2 jobs (with a slight career change); visiting Africa twice; becoming a Dad; getting married; becoming a Dad again.
Hopefully I'll be looking back in another 4 years stating that slickhouse.com is 8 years old. Over the coming months into 2010, I plan to make a few strategic changes to the site and increase its popularity. I've learnt a wealth of knowledge working as a Web Developer since May 2007, so I'd like to publish a few articles along those lines too. And my side-project SlickCMS has been rolled out to several sites, so I figure it's now time I bite the bullet and switch from WordPress. There's a bit more functionality still to add, such as RSS feeds and Archives - but once they're done Slickhouse will be powered by SlickCMS.
Don't get me wrong: WordPress is a fantastic piece of Web Publishing Software, it's just that after 4 years I feel it's time to put what I've learnt from using it to good use and develop my own. Besides, I'm an ASP.NET/SQL Developer and my PHP knowledge is dwindling in comparison.
Inspired by a few articles I came across recently, namely:
- http://css-tricks.com/images-on-a-subdomain/ (Chris' move to a separate domain)
- http://developer.yahoo.com/performance/rules.html#cookie_free (rules for improving performance)
- http://sstatic.net/ (Stackoverflow's static site)
- Increasing the number of simultaneous requests
- Reducing the size of the requests/responses to and from the server(s)
2) is achieved in the same way, by switching off cookies on slickhouse.co.uk - which in turn, can help reduce the request/response sizes and thus the page load times.
My initial testing has shown a noticeable improvement, though I don't have any metrics to share. I used Microsoft's Fiddler tool to profile the load times and was surprised how much external content the site uses, from 3rd parties. The twitter feed on the right is 2 requests alone and the Google Map that was tucked away in the site's footer added a further 20 or so. This gave a sluggish feel to the site as each page loaded.
So I updated the theme files and removed some of the excess requests, to bring it down to ~14 for the homepage. It's still high and could be improved further using CSS sprites. But I'll save that for the next version.
To summarise, splitting your static content from the dynamic pages helps increase page load times. It also allows for future expandability, as the static content could be hosted on a separate server, or even on a cloud/CDN solution.
A few months back my (now) sister-in-law was looking through our DVD collection to find a few to rent, when she suggested I should have a list of them all - as it would be easier to find.
So, I decided to make a simple web application that would store all of the DVDs and games within a database, allowing friends and family to browse the catalogue and to 'rent' any they wished. The application itself was easy to create, the time consuming part was entering all 321 items into the database! It took Anneka and I about 8 hours spread over several evenings. The result is:
Have a look, filter the collection and view the individual DVDs/games. Let me know if you find any issues too - as it's still in development. I plan to add several more features including:
- A count of the results (after filtering)
- Advanced searching including keywords
- User registration
- Valid XHTML
Apologies if you've tried to visit this site over the past week or two and have encountered an error of sorts. The servers that slickhouse is hosted on have been down several times, due to human errors, for once!
The first time, I had setup a new virtual server (2003), equipped with Active Directory and DNS. After testing AD locally on my workstation, I decided to roll it out by connecting each server in turn to the domain. Unfortunately, I forgot about Windows Update, which proceeded to install updates on each server in turn - which was the first stage of the downtime. Once the main host server had restarted, it then performed a chkdisk that I had scheduled some months ago (to begin on the next restart). This took the whole night!
As the host server is a single core affair, the start-up of each virtual server takes a good 30 minutes, to ensure everything is back up and running as before. So that added more downtime, to the already growing 12+ hours.
The second set of downtime was last night - I had moved the anti virus (Symantec AV) from the host server itself, to one of the virtuals. Bad mistake. When the scheduled scan kicked in at 3am, it brought the whole platform down, 4 virtuals and the host. So that was another 18+ hours!
I've since switched the anti virus back to the host server and have opted for Clamwin, a great Open Source program, that works on Windows workstation and server operating systems. If all goes to plan, it will do its stuff tonight without a blip of performance loss.
So, the moral of the story? There are several in this instance:
- Regularly install updates on servers, so that when it comes to a shutdown/restart they won't interfere with things
- Plan downtime a good few hours before you go to bed, in case anything goes wrong in the process
- Use chkdisk startup scans with caution - and remember when you've scheduled them
- Don't break something if it already works, such as moving anti virus duties from a host server to a virtual, when the host was scanning them fine for the past 2 years without a hiccup
- Don't port forward RDP to a virtual server, so that when the platform goes down, you cannot connect externally to restart it all
Be patient if you experience downtime in the near future - at least now you know it's most likely due to a human error on my behalf!