Matthew Daly's Blog

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

16th August 2010 9:50 pm

Perl After Python

I’m currently studying for the CIW Web Developer qualification, and having passed the exams for database design and JavaScript, I’m now on to the third component, Perl. I figured that having already picked up a reasonable grasp of another scripting language (namely Python), that I would have no trouble picking up Perl quickly, as happened when I learned JavaScript.

Unfortunately, it hasn’t quite worked out as well as I’d hoped so far, and in a number of ways. First of all, it doesn’t seem to “fit your brain” quite as easily as Python does - I find that the significant number of non-alphanumeric characters used makes it less intuitive than Python, at least for me. I’m also not a great fan of the syntax - in particular, I really am not keen on the syntax used for object-oriented programming. In general I’m finding it a struggle to pick up many things I learned quite quickly in Python.

That said, Perl has plenty of awesome features. CPAN has a staggering number of modules available, and makes it very easy to install them. And of course, its support for regular expressions is second to none. Don’t get me wrong, it’s a language I really want to know better and be able to use well, but I am finding it quite hard going compared to Python.

I strongly suspect, however, that it may well be, at least in part, because I learned Python first and my brain is used to the Pythonic way of doing things, therefore I’m having to unlearn those habits for Perl. Has anyone else learned Python first and then struggled to pick up Perl, or is it just me? Does learning Python first predispose you to finding Perl more difficult?

8th August 2010 12:47 am

Moving Away from OS X

I bought my MacBook two years ago, and at first I was cynical about how I would find it compared to Ubuntu, but over time I found myself using it more and more. While I have never considered myself a Mac user (I’ve always thought of myself as a Linux user who owns a Mac), I did grow to appreciate the combination of a solid Unix base with a well thought-out GUI, and it worked out well for me.

Yet now I’m finding myself slowly moving back to Linux. I’m running Slackware 13.1 on an old Inspiron I’ve had since 2004, and my recently purchased Dell Studio 15 dual-boots Windows 7 and Ubuntu. But the one I’m using by far the most is my Mini Inspiron, which dual-boots Windows XP and Ubuntu Netbook Edition, and XP almost never gets used.

Part of the reason is that the Mini itself is just such a handy machine to have around - it’s small enough to be portable, and it’s convenient to use it anywhere at home too, but at the same time it’s big enough to use without any issues (which is more than I can say about my old Eee PC, which has now been passed on to my sister). OK, not everyone likes Dell’s products, but I’ve always found them to be very good value basic computers, and they really have gotten the whole netbook idea and produced an excellent product.

Also, Ubuntu Netbook Edition is really great - the newly revamped user interface works really well on the netbook form factor, and it’s an excellent experience for the most part. Performance is more than acceptable, and most applications start very quickly (Chrome is noticeably faster than on OS X).

But the thing that I’m really starting to appreciate more than anything else is just how much more powerful and flexible it is under the bonnet than OS X. For starters, a package manager like apt-get makes it incredibly easy to install new software. In particular, this is useful for installing useful Python modules, as so far as I’m aware Python doesn’t have anything like Perl’s CPAN or Ruby’s rubygem system. Yes, I guess I could use MacPorts or something like that, but personally I’ve never liked the idea of installing a new package manager yourself rather than using one that’s a fundamental part of the OS.

This also means I have to compile many Python modules from source on OS X. This has taught me an interesting lesson about usability - namely that it’s not an absolute. For many tasks Ubuntu is actually considerably easier to use than OS X, since Synaptic offers users the opportunity to install a lot of software from a GUI that on OS X would need to be compiled from source, although for installation of desktop applications OS X is probably marginally easier.

Also, byobu is an excellent tool - it really helps to make GNU screen more useful and accessible. I have it set up to launch screen in any new terminal sessions and I’m beginning to wonder how I ever coped without it.

Finally, Snow Leopard seems to have broken a lot of things I liked in OS X. I used to use the Terminator terminal emulator in Leopard and it worked well, but in Snow Leopard, Spotlight can’t find it (I think it’s something to do with the Java bridge being deprecated, as Terminator is written in Java), so I had to change to iTerm instead, which I don’t like so much. Snow Leopard also seems to refuse to open browser bookmarks via Spotlight in anything but Safari, which really gets on my nerves as I hate Safari.

I’m not planning to get rid of my MacBook anytime soon, but I am increasingly finding it’s less appropriate to my needs, less productive, and less powerful compared to Ubuntu.

10th July 2010 1:21 am

Staying Productive in Summer

Unless you live in the southern hemisphere, summer’s here. Right now it’s gone midnight but it’s still very hot, and being in the UK, where home air conditioning is not common, there’s little way to alleviate the heat besides opening the window (which you don’t want to do because people are continually having barbecues).

I have to admit to just not being a summer person - I don’t really like hot weather or outdoor pursuits in general. I’m happier in spring and autumn when it’s cool, but not cold, and I can wear my favourite Animal hoodie if it does turn chillier. When it gets hot I find it extremely difficult to get anything done unless I can do so in a fully air-conditioned environment, and have a lot of trouble sleeping at night, exacerbating the problem due to tiredness. Unfortunately, I’m now having to learn Perl from scratch during this time (a fairly daunting prospect at the best of times!), and it’s a bit of a nightmare trying to actually sit down and learn regular expressions properly when it’s hot and stuffy and you can’t think straight.

I’ll have to try going to a nice cool air-conditioned cafe with my Dell Mini, get a cold drink and see if I can get some work done that way. But I’m curious to know if anyone else has any good tips for remaining productive at learning a new programming language during hot weather that they’d like to pass on?

5th July 2010 8:01 pm

Five Things You Should Consider Including on Your Website

If you’re creating your first website, it’s tempting to think that once you’ve got the site looking the way you want it, and added some content, then that’s all you need to do. In reality, it’s extremely unlikely that this is the case. It’s fairly obvious with something like a blog that it needs regular care and attention, but even a static brochure site may need some additional resources to get the best out of it. Nowadays, there are loads of great resources around that you can use to enhance your websites, either for yourself or your readers (or both!) and knowing how to make the most of them can really make a difference in how well your site fulfills its intended role.

So here’s a list of five things you should consider including when you set up your first website that are easy to overlook, but can offer real benefits to both you and your users. Note that there’s more than a few Google tools here - this isn’t deliberate, it’s just that Google are so omnipresent in this area that it’s hard to get away from them.

  1. A way to record visitor’s details - With most web hosts you can just look at the log files, but that doesn’t provide very much information at all, nor does it present it in a way that makes it easy to see the information you need. A much better idea is to use a dedicated web analytics service. I’ve used StatCounter in the past, but my favourite has to be Google Analytics. Both give you access to a great deal of useful information about your website. For instance, you can see how many people view the site in Internet Explorer 6, so you can figure out for yourself whether it’s worth bothering to adjust for IE6 when you redesign the site next. Or you could see how many people view the site in a mobile browser. You can also see what pages are popular, how long people remain on your site, and how they got there in the first place. All this is extremely useful information that can give you good ideas as to how to improve your site.
  1. A comment system- OK, this is blog-specific, but comments mean you can gauge reader interest levels, and encourage more reader participation, so having a good comment system is essential. Most blogging engines have an OK comment system, but there are a few dedicated comment systems you can install on your blog that offer a lot more features than the default system. For instance, my blog uses Disqus in preference to the default WordPress comment system, because I find it’s far more flexible and powerful. It offers threaded comments, as well as support for readers logging in via Twitter, Facebook, Yahoo!, OpenID or Disqus, which means they can use an existing account to submit their comment rather than having to go through the rigmarole of signing up, which can dissuade people from commenting. Also, it offers fine-grained control of moderation and spam, such as allowing you to blacklist or whitelist commenters, automatically accept comments unless they include a link (very handy for tackling spam comments), and many other useful tools. I’ve also heard good things about IntenseDebate.
  1. RSS feed management - If your site has an RSS feed, you should seriously consider using Feedburner. It’s a great tool that allows you to present your site’s RSS feed in an extremely pleasant way that makes it extremely easy for readers to subscribe using whatever feed reader they like, or by email (always worth having because it’s ideal for people who don’t know what an RSS feed is). It also allows you to add easy ways for users to share your content from within the feed, or for you to add Google AdSense to the feed itself if you wish.
  1. A way to share content - Again, this is more blog-specific than something suitable for a static site, but you should make it easy for people to share posts they like with friends or submit them to social bookmarking sites. It’s probably to your benefit to do so since this will not only send more traffic to your site, but will mean you gain additional links to your site, improving its ranking in Google searches. Some WordPress themes include a way to share content, but other themes, or different blogging engines, may not offer this so an alternative way to share is helpful. In particular, I can recommend AddThis as a good choice.
  1. AdWords- If your site is something you’re hoping to make money from (such as an e-commerce site, or you’re hoping to attract people there to hire your services), then it makes sense to advertise. While I don’t wish to sound like one of those self-appointed “social media experts” who haunt Twitter, you do need to make an effort to get your name out there, and Google AdWords is a really great way to do that cheaply and easily. You only need to pay when someone clicks on an ad, and they only show up in relevant places.

What other services would you recommend using with a new website?

23rd June 2010 1:41 pm

Moving on to Perl

I’m glad to report that today I passed my CIW JavaScript Fundamentals exam with 98%! I was a bit concerned about this as some of the questions on the practice exam were downright wrong (as in the supposedly correct answers were in fact wrong), but thankfully this turned out not to be the case for the actual exam.

Next step is learning Perl. I’m particularly interested to learn more about Perl because it’s something you can get a lot of use out of - it can be used for regular expressions, general Unix scripting and web development, and I’m interested to see how it compares to Python.

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.