It works with a callback function that takes index/key and value as parameters. This callback function is executed for every item in the collection passed.
The benefit of using this is that you have very readable code; most programmers will intuitively know how it works because of the familiar collection, index and value interface.
Here’s a quick list of those that I’m aware of—in no particular order.
This post is mostly as a reference, so I don’t need to look up all the options (no pun intended) every time this situation arises. I hope it can help you quickly select (pun definitely intended this time) which one’s best for you.
Although you may not see any difference, this site is now hosted elsewhere. It’s taken over a week to get all the administration dealt with, but now it seems to work all okay.
Michhimself.com used to be hosted by one.com, the first web host I ever paid for, which I registered with in 2009. Back then, the simple PHP/MySQL hosting with FTP access was great, but I’ve since moved on. Since it was so-called ‘shared hosting’, it meant that multiple websites would run on the same server; meaning that the performance of my site would depend on the load caused by others.
Now I’ve moved on to a VPS (Virtual Private Server) at linode.com, where I get full root access over the machine. You know what that means: a LOT more freedom to play with. I got to install the web server software myself, as well as PHP, MySQL and a bunch of other things. I’m even running an IRC bot on the thing. Needless to say, I no longer need to use FTP to access the files on this server; I just use SSH, which is more secure, and seemingly faster as well. Have I mentioned that Linode is fabulous?
Something that I may not have mentioned here is that one of my hobbies is photography. I got a little more seriously into it after buying a friend’s Nikon Coolpix 8700 back in 2010. That camera was a pretty good one, even though it wasn’t a DSLR or anything fancy, it gave me quite a bit of freedom to play, compared to your regular little compact camera.
Last week however, I purchased my first DSLR after trying and getting outbid on ebay for about a week. I now have a Nikon D40 with the kit 18-55mm lens, and I’m loving it. Compared to the Coolpix 8700, it is orders of magnitude better at guessing settings for correct exposures. Since it doesn’t have to move out a lens on start-up, it’s instantly ready to shoot, and doesn’t waste energy on motors (other than the auto-focus motor in the lens). I love how it takes your photo the moment you press the shutter button down, rather than half a second after. It makes me feel much more confident to go for certain shots than I normally would be.
The camera automatically goes in stand-by mode if you’re idle for a while, but is instantly ready to go for it again. This makes it fun to walk through the city with the camera just on all the time, ready to shoot anything you see.
In conclusion, it seems like I’m going to have a lot of fun experimenting with what this camera will let me do. Eventually I’ll most likely try some other lenses as well, which is something I’ve been looking forward to with this kind of cameras.
Here’s a little set of photos I’ve taken around Southampton, by day and by night.
Just a simple front-end technique I thought to be worth sharing:
Form fields can usually do with some more information on what you are supposed to fill in. Examples include valid user name rules, desired date/time format.
On one hand, you want your users to know what they’re supposed to do, as confusing your visitors easily leads to a dramatically decreased conversion rate. On the other hand, you want your forms to look clean and minimal, so your visitors are not bombarded with information. If you show information by every field on your form, it quickly gets cluttered, and that’s exactly what we want to avoid.
Simply hide the elements containing the help text until they are needed. When a user focuses on a field, the relevant information shows up. This may sound like something you would solve with the onfocus and onblur events, but you can actually accomplish it with CSS.