Matthew Daly's Blog

I'm a web developer in Norfolk. This is my blog...

15th May 2010 5:27 pm

Is Dreamweaver the Best Choice for Developing Your First Website?

If someone asks you to name an application for creating web pages, the chances are that one of the first things you’ll think of is Adobe Dreamweaver. While it may not have quite as much mindshare as its Creative Suite stablemate Photoshop, it’s still regarded as the premier application for creating web pages.

However, that status leads to many novice developers, or ordinary people who just want to set up one website, thinking that they need to use it, and that’s completely wrong. At work we have an intranet with a discussion forum, and someone with no experience of creating web pages was asking for advice on the best application to use to create a website, and of course someone suggested Dreamweaver, something I strongly disagree with.

So, if you’re wanting to build a basic website, and are thinking Dreamweaver might be the way forward, you might want to bear these points in mind:

  1. HTML was intended right from the start to be reasonably easy to use, so why not just write HTML? I learned the basics in a weekend, and there’s plenty of good resources around, so rather than shell out for a copy of Dreamweaver, just get a book about it and work through that. It’s a useful skill to know and it costs a lot less, and the resulting web page will be easy to maintain. Granted it may not be that impressive to start with, but there’s nothing stopping you refining it over time.

  2. You probably don’t need to mark up web pages yourself at all. There are many excellent content management systems that make it easy to build a website yourself without having to write any HTML or CSS at all. Wordpress is capable of static pages and blogs, is easy to theme, and can be extended with plugins. Drupal or Joomla are also possibilities, so the chances are it’s not necessary to hand-code the page at all.

  3. If you’re only after a basic site and you don’t have any interest in creating any other web pages, but you want something that looks professional, then forget Dreamweaver and hire a freelance web designer to create the page for you. For a small site they’ll probably cost less than buying a copy of Dreamweaver, they’ll be able to create a much more professional-looking result and they’ll be able to help you with other issues that arise.

  4. Is it the most cost-effective WYSIWYG editor for what you want? The world is full of WYSIWYG HTML editors, many of which are free, others of which are a lot cheaper than Dreamweaver. Okay, you could just use a trial version of Dreamweaver for free, but what about if you want to edit your site later on after your trial has expired? And yes, you probably could use a pirate copy, but is it really worth the bother when something else will probably do the trick? Some great alternative HTML editors include:

There are many more cheap or free HTML editors around, which make great alternatives to Dreamweaver for inexperienced users.

  1. Dreamweaver is a powerful tool, but it’s not a magic bullet - it won’t make you able to create a great website, any more than a copy of Microsoft Word will make you a great writer. Dreamweaver’s a professional application, with a price tag to match, and it takes experience to use it properly. In the hands of an experienced web professional, Dreamweaver can create a great website, but in unskilled hands the results are going to be less than satisfactory.

What do you think? Is Dreamweaver a good choice for making your first (or indeed only) website, or not?

10th May 2010 8:15 pm

Why You Should Try Vim

I’m a huge fan of the Vim text editor. I have the key bindings burned so deep into my head I keep reaching for the Escape key at work when I want to move around in a document in Microsoft Word, or hitting J to try and move down. In short, I’m incurably hooked on this wonderfully powerful text editor, and if you’re still using something like gedit, TextEdit, or (god forbid!) Notepad, then I want to get you to think hard about switching to Vim!

I first started using Vim nearly two years ago. At the time, I had a fair grasp of HTML, but hadn’t really gotten into programming as such. I had my Eee PC 2G Surf with me most of the time, but didn’t have regular access to the Internet, and didn’t have a full-sized laptop available for much of the time. The main text editor I’d used to date was Kate in KDE3.5.

One day I decided that, for lack of anything else to do, I was going to run through the Vim tutorial (accessed by entering vimtutor) in a terminal on my Eee PC. It was weird to start with, but I soon got used to the unusual-seeming key bindings. As a touch-typist, Vim worked really well for me since it meant I didn’t have to move my hands off the keyboard at all, and the arcane-sounding keys soon became second nature. When I started work on the Site Development Foundations part of my CIW Foundation course, naturally I used Vim, and it worked well for both HTML and CSS documents, and of course the more I used it the more proficient at it I became.

Then when I first started learning Python, Vim really came into its own. The syntax highlighting is a real help, it’s extremely fast to move around in and edit a document, and the autocompletion, while perhaps not quite as good as that in a language-specific IDE, was good enough for most purposes. I’ve since used Vim for coding in HTML, CSS, Python, JavaScript and C, as well as editing configuration files in various Unix-like operating systems, and it’s been an excellent editor for all of these. I’ve barely scratched the surface of what it can do, and I already couldn’t imagine using anything else.

So, why should you use Vim? Here are just a few of the reasons.

Vim is everywhere

If you’re running Mac OS X, a CLI-only version of Vim is included, and you can get a graphical version called MacVim as well if you need it. Most Linux distributions include either Vim or another vi clone by default, and if not it’s available from your distribution’s repositories. If you’re running another Unix flavour, again you almost certainly have Vim or another vi clone, and if not you can get one. And if you’re on Windows you can grab a copy too. If you use a text editor like Kate, gedit, or so on, then you can’t guarantee you can get it on other platforms. With Vim you can.

Also, the fact that Vim is a CLI application means that even if you have to edit something via SSH or Telnet, you still have access to a text editor you know well and can work just as well as you would with a GUI.

Vim is flexible

If you’re using Vim, you can rely on it to edit files in virtually any programming or markup language you like, making it easy to adapt. Learning Ruby? You can do it in Vim. Now you want to learn Java? Again, Vim will do the job. By allowing you to use a familiar environment for virtually any programming language you may want to learn, Vim means you’ll be productive quicker in a new language than you would be if you had to use a different text editor to the one you’ve used before.

Vim is fast

If you know how much faster touch-typing is than hunt-and-peck typing, then you’ll have some idea of why Vim is faster than regular typing. Because Vim uses the home row for navigation, and in general is designed so you move your fingers as little as possible, it’s faster than just about any other text editor you can name. The key bindings are deceptively simple to remember for the most part, as it’s your fingers that need to remember them, not you brain.

Vim doesn’t require the use of a mouse to navigate, nor does it require you to move your hand to the cursor keys. It also allows you to jump through a document as many times as you want - for instance, to go down 9 lines, you just enter 9j. And it’s easy to search for specific words and navigate to them.

Vim is easy to customise

By editing your .vimrc configuration file, you can easily modify how Vim works for your own needs. You can easily change settings to suit your working habits better, such as setting it to work with a mouse, add line numbers, change the colour scheme for syntax highlighting, change the key bindings etc. Vim can also be extend by use of scripts and plugins. Once you have it set up the way you want, it’s easy to move all your settings to another computer.

Vim always has a way to make things easier

One of the best things about Vim is that, because it’s a solid, mature product, someone’s usually thought of a way to do whatever you want to do, quickly and easily. For instance, recently I was writing a JavaScript function to rate passwords for security, and I decided to get a list of bad passwords off the Web. I soon found one, but it was in excess of three thousand entries long, and I had to edit it to put them all into an array as individual strings, enclosed by quotes and separated by commas, ideally each on a line by themselves. This would have been an incredibly tedious task if I had to do it manually, so I did a little digging and discovered how to create a macro in Vim. This made it trivial to perform this task with only a few keypresses.

Vim is tightly integrated with the command line

Vim makes it easy to run other shell commands without leaving, by entering :!, followed by the command you want to run from the shell. This means it’s easy to run or compile a program you’ve just written without leaving Vim, so you don’t lose your place. When you’re done, you’re sent straight back into Vim, exactly where you left off.

Vim behaves like a GUI application

Yes, Vim may normally be a command-line application, but it still manages to pack in many of the niceties of graphical applications. You can split the screen horizontally or vertically, or open new files in new tabs. It’s even possible to use it with a mouse in most cases.

These are just a few of the reasons why I love Vim, and if you haven’t already tried it, or if you’re still using a less-powerful text editor, then I urge you to give it a go. Yes, the learning curve can be a bit steep, but it’s well worth it in terms of boosting your productivity. It works well for hand-coding HTML and CSS, or for programming in almost any language you can think of. You can get started today - if you’re using Linux or Mac OS X, it’s almost certainly already there waiting for you, and on Windows it’s just a download away. Try launching the tutorial by entering vimtutor in the shell, and work through it, and you’ll find yourself getting used to it surprisingly quickly. Or why not try Cream, essentially a preconfigured version of Vim that has a shallower learning curve? If you use a text editor at all, you really should give Vim a try.

10th May 2010 12:52 am

New Hosting

I’ve now gone and switched to paid hosting, and have dumped the old static site in favour of a Wordpress-powered blog on my own domain. I’ve found Wordpress to be an extremely flexible and powerful solution, far superior to Blogger, and I’m really excited about the possibilities of a self-hosted blog, so I’m really looking forward to establishing myself here! At some point I intend to create a custom theme of my own, but for now this one will do fine!

As I mentioned previously, I’ve changed the emphasis of the blog towards web development. I’ve also now made a number of other improvements - comments are now powered by Disqus, to facilitate easier sharing of posts and making it easier for people to reply to me via blog posts of their own.

Enjoy!

3rd May 2010 6:23 pm

Passcrunch

As an exercise to teach myself the basics of regular expressions in JavaScript I decided to implement a small function I called passCrunch to check how secure a password is. I implemented it based on the following principles:

  • First of all, check for a list of well-known easy to break passwords to foil a dictionary attack, and reject it if it’s there.
  • Then check that it’s at least 8 characters, and reject it if it’s not.
  • Then implement a counter to measure how secure it is by various checks.
  • Then add to the rating if it’s more than 12 characters.
  • Add to the rating if it contains lowercase letters.
  • Add to the rating if it contains uppercase letters.
  • Add to the rating if it contains numbers.
  • Add to the rating if it contains nonalphanumeric characters.
  • Finally, convert the result to a percentage score and return it as an integer.

The finished article’s available here as a .zip file if you’d like to use it, or just take a look at the code. Be warned, it’s quite long due to the fact that the list of insecure passwords I used had in excess of 3,000 entries in it! It includes a very simple HTML form which will allow you to submit a function and will return a score for it via an alert() dialogue. Feel free to use it if you wish!

3rd May 2010 5:29 pm

Learning Javascript

Having recently completed the Database Design Methodology part of my course, I’ve now moved onto the next part, which is JavaScript Fundamentals. It’s quite an interesting topic since unlike HTML and CSS, JavaScript is a proper programming language (OK, technically it’s a scripting language, but it’s not merely a markup language like HTML), so I’m quite enjoying it.

However, I’m a little disappointed with the quality of the training materials for the course (CIW JavaScript Fundamentals). It was published in 2003, and recommends the use of Windows ME or Windows 2000, and Internet Explorer 5.5 or later, or Netscape Navigator 4.0 or later. Now, IE5.5 was released in July 2000, making it a few months shy of a decade old, a staggering length of time for the web. Netscape Navigator is even older, dating back to June 1997! Of those two browsers, IE5.5 now has a miniscule market share, and Netscape Navigator isn’t actively developed at all anymore (although Mozilla Firefox is built off the same code base).

Given that in the last few years Internet Explorer has been rapidly losing market share, and developers are doing things with JavaScript that we couldn’t dream of five years ago, you’d hope the course would cover the more interesting and powerful things we can do with JavaScript today, such as AJAX, Greasemonkey scripts or third-party libraries such as jQuery. Instead, I’m stuck with form validation (OK, fair enough, need to learn that), manipulating frames (seriously, frames? When was the last time you even saw a framed website? They’re ugly and a pain to use) and pop-up windows.

Personally I’m more than willing to take up the slack myself by studying independently, but I’m sure there are plenty of people who wouldn’t do so until they reach the workplace. Admittedly, the fundamentals of the language haven’t changed, but there’s plenty of stuff that’s of very little use today that I’ve had to learn when I could be learning something more useful.

So surely these texts are long overdue for a refresh? I would hope that a newer release would cover at least some of the following:

  • At least one third-party JavaScript library, such as script.aculo.us or jQuery.

  • Writing Greasemonkey scripts (which is a very good way of learning more about JavaScript).

  • Creating a simple AJAX application.

  • Using a JavaScript debugger such as Firebug.

I really don’t think there’s any excuse for the training materials being that outdated when some of their other CIW training materials are much more current.

Recent Posts

Better Strings in PHP

Forcing SSL in Codeigniter

Logging to the ELK Stack With Laravel

Full-text Search With Mariadb

Building a Letter Classifier in PHP With Tesseract OCR and PHP ML

About me

I'm a web and mobile app developer based in Norfolk. My skillset includes Python, PHP and Javascript, and I have extensive experience working with CodeIgniter, Laravel, Django, Phonegap and Angular.js.