Free video tutorials for C, Java, PHP, HTML5, Python, MySQL and more …

I just came across the new boston video tutorial series. I’ve watched 20 of the PHP videos and am hooked. The production quality is great, and the content is really, really good! Once I finish the 200 PHP videos I plan to watch their MySQL and HTML5 videos. Can’t recommend these videos enough, and the fact that they’re free makes them even better! Nice!

Website re-design gotchas, and how to avoid them!

I recently re-designed my main website, and learned quite a bit about CSS and XHTML in the process. I also learned that there are a number of things you should do before re-designing a site, and thought I would list them here for folks who are looking to change their site layout:

1. Validate your documents with a free validator

2. See how your site loads in various browsers

3. Sketch out how you want thing to look before you start coding

4. Make sure to design with the future in mind (this especially applies to associating CSS classes with tags)

5. Make sure you consult best practices

6. Read a good CSS reference before you begin

7. Make sure you integrate USEFUL ads into your website (this will help cover hosting costs, which aren’t free)

8. Ask an expert what they like and dislike about your site

9. Verify that your site doesn’t have broken links

10. Implement things iteratively (there is no need to do everything at once)

Keeping these things in mind will made re-designing your site quite a bit easier, and may even turn up some surprises that you weren’t aware of.

Easily encoding documents prior to publishing them to the web

While reviewing the command lines on commandlinefu, I came across this nifty little gem:

$ perl -MHTML::Entities -ne ‘print encode_entities($_)’ FILETOENCODE

This command line snippet takes a file as an argument, and escapes all of the characters that can’t be directly published on the web (i.e., it will convert a right bracket to & gt). This is super useful, and is a welcome addition to the nifty tidy utility!

Cleaning up HTML files with tidy

I have read a number of documents on correctly using CSS and XHTML over the past month, and have learned about a number of common mistakes people make when creating content that uses these technologies. Most of the articles discussed ways to structure web content to avoid these pitfalls, which got me wondering if anyone had taken these recommendations and created a tool to analyze content for errors. After a bit of googling, I came across the W3C content validation site, as well as the tidy utility.

The W3C website is super easy to use, and it provides extremely useful feedback that you can use to improve your content. The tidy utility provides similar capabilities, but has options to actually correct errors it finds in the files it analyzes. Tidy can be downloaded from sourceforge, or installed with your favorite package utility (the CentOS repositories contain tidy, so it’s a yum install way). Once tidy is installed, you can pass the name of one or more files to analyze as arguments:

$ tidy –indent index.html
line 8 column 1 – Warning: <link> isn’t allowed in elements
line 3 column 1 – Info: <html> previously mentioned
line 74 column 28 – Warning: unescaped & which should be written as &
line 74 column 29 – Warning: unescaped & which should be written as &
line 191 column 15 – Warning: discarding unexpected </h2>
line 181 column 9 – Warning: <a> escaping malformed URI reference
Info: Doctype given is “-//W3C//DTD XHTML 1.0 Strict//EN”
Info: Document content looks like XHTML 1.0 Transitional
5 warnings, 0 errors were found!

<HTML FILE CONTENTS WITH FIXES APPLIED>

The tidy output will contain the list of errors it detected as well as the corrected HTML code. This is amazingly cool, and it has tipped me off to a few issues with some of the XHTML files that I am using to support my website. Tidy and the W3C validation site are incredibly useful which will hopefully enhance the experience for individuals who access W3C validated content.