I've been trying for about 6 months now to expand my horizons beyond my day to day coding. I've learned most of PHP and JavaScript of which I need to do my job (and then some), and had decided I needed to branch into other languages (mainly for my own knowledge).
I picked up the basics of C, C++, Objective C and Python, but I'm still here tonight answering PHP / JavaScript questions on Stack Overflow. It would seem I lost the will to keep learning the new language after a while.
I would do a crash course of a new language over a week or so, learning basic syntax and idioms, and then I realise (or maybe I knew all along) that I wouldn't even be close to how comfortable I am with PHP / JavaScript that I would just give up, and go back to what it was that makes me feel safe (and fuzzy).
Maybe it is because I need to be well versed with PHP / JavaScript to be a paid web developer, which puts food on my table. My personal quest to learn more languages at this stage simply won't lead to me any more choices professionally, at least not for a while. I hardly think I could switch our shop from PHP to Python.
Has anyone else felt this sort of thing before?
Ecommerce with PHP is a funny thing. There are a few open source packages out there, but there is no one true package.
I've developed a number of sites in osCommerce, and I'm sure I do not need to tell you just how painful that is. I've even converted an osCommerce site from table to CSS based layout. Dreary days those were. Do you know how osCommerce adds a border to a table? With the border attribute perhaps? Oh no, not even close. They nest a table within another, with a padding of 1px and set the outer table's background. Ingenious! There had to be a more modern solution.
Magento came around and everyone was excited. They promised so much, and at the start they seemed to deliver. Then came the realisation that Magento was slower than a rug on valium on any shared host. After banging your head on the wall about that, the second painful thing was the templating. Magento uses a clever XML based layout system. Need I say more? Obviously for a small store Magento was massive overkill.
PrestaShop is a fairly modern ecommerce system utilising PHP & MySQL. Whilst I have only had the chance to spend a few days with it, I'm mostly liking it so far. The theming is generally pretty sane, using Smarty to render the dynamic data in .tpl files. The template files don't offer much in the way of customising the markup, most of it has to be done within the modules folder, which is not tied to any theme. So modifying a product layout will affect all templates. There is a little niggle in the back of my mind that there should be an easier way to edit an individual module's view file and have it tied to a template. Perhaps they could use a cascading file system like Kohana.
There is one more cart I'd like to mention, OpenCart, of which I have had no hands-on experience with. I have found it interesting to read the lead developer's interactions with other people. One thing that has turned me off the project is the lack of care for security, or more specifically, CSRF. Update: This appears to be fixed in the new demo.
I quickly grew tired of clicking the small next button on the xkcd site, whilst trying to view every comic from the start, in order. I thought "hey, why don't I check out that Greasemonkey thing! This sounds like a perfect excuse."
I knocked up a small Greasemonkey script that turns the comic into the next link, so you can just click the comic to view the next, just like FaceBook and Lightbox variants.
At first, I was tempted to add jQuery and put it together that way. After all, I use jQuery for 99% of DOM manipulation, as it is just that damn easy. But for this, I decided to use the standard DOM API, as I am only coding for Firefox (had I need to support IE, it may have been a different story).
Another thing that was a bit janky is how prone the script is to breaking; but that will mostly be the case when coding something up for a third party site that doesn't provide an API. Since I started reading xkcd in 2007, I can't recall any major site updates. Please drop me a line if it is ever breaks!
So download it, and start viewing xkcd from the begininng! Some of the earlier ones are quite different to his recent work, so grab a beer and put your feet up!
About 6 months ago, I decided to prefix my jQuery objects with the dollar sign ($). I did this because I had seen it in the wild and it looked like a good idea at the time. Looking back now, I'm not sure if it is the best idea, or if I will continue to do it.
var $headerImages = $('#header img');
The ECMAScript specification also states used to state (thanks to Brian McKenna for the update) that the $ should only be used with machine generated code. Perhaps the proliferation of JavaScript libraries using the $ made the specification change to suit.
Pre-pending a dollar sign to all variables looks a lot like Hungarian Notation, or more specifically Systems Hungarian. Personally, I find this style of naming very ugly, and not very helpful. Some people think all variables should be prefixed with their type, but since JavaScript is loosely typed, it doesn't make much sense. Other programmers make good arguments against using Hungarian Notation in JavaScript.
The last thing that really irks me with the $ prefix is that it makes JavaScript variables look like PHP variables (or Perl).
I think I will forego the prefix for now, because it is non standardised and ugly. I'd like to hear your thoughts.
I have always wanted to have my own host, so I've decided to do something about it. You are now viewing my site hosted at Dreamhost.
Throughout my reading on the web, Dreamhost has popped up numerous times as a recommended server, so I thought I would give them a try. Despite their popularity, there are also a few worrying articles lying around a mandatory "product name sucks" Google search, but I've decided to let my own experiences guide me.
So far, support has been quick, and everything seems to be good. It does however seem a little slower to get going than Hostgator (my old host), having to allocate a subdomain of dreamhosters.com before I can view my site before a domain has the nameserver record. Hostgator allowed a /~username style viewing, which was available as soon as the account was setup.
It's far too early to give any recommendations on Dreamhost, but once I've settled in, I'll write a more thorough report of my experiences.