I decided late last year that if I wanted to get into version control, it would have to be in my own time. Armed with zero knowledge (but hungry), I went hunting for information.
I picked up Pragmatic Version Control Using Git by Travis Swicegood a month or so ago, and have been reading it carefully and slowly.
I chose Git basically because I thought GitHub looked cool, plus Kohana uses it :). I pushed my latest project to it tonight, which is a massive update to my inputLabel project.
My inputLabel jQuery plugin was a bit dodgy in that it replaced the actual value of the input elements with its label. This made a few things a nightmare, such as validating the input fields using existing libraries.
My new version (2.0) does away with these problems, or it passed all the tests I could think of at 1am. I hope to be using it in all new projects requiring the use of this functionality.
I have a new jQuery plugin available that helps a few issues, most notably WebKit returning incorrect element dimensions on DOM ready because it hasn't calculated the dimensions of descendent images yet. I call it waitForImages.
;(function($) {
$.fn.waitForImages = function(callback) {
if (typeof callback != 'function') {
throw 'Not a valid callback';
};
return $(this).each(function() {
var obj = $(this),
imgs = obj.find('img'),
imgsLength = imgs.length,
imgsLoaded = 0;
if (imgsLength == 0) {
return;
};
imgs.each(function() {
var image = new Image();
image.onload = function() {
imgsLoaded++;
if (imgsLoaded == imgsLength) {
callback.call(obj);
};
};
image.src = this.src;
});
});
};
})(jQuery);
Usage is simple...
$(function() {
$('#something').waitForImages(function() {
alert('Images have loaded.');
});
});
Update
I've just been getting the hang of GitHub, and I've taken the project source there.
I will be moving it to its own project page soon enough. It will probably coincide with a site update. I plan on a new site design and dropping the articles section and the WordPress/Kohana marriage (which is now on the rocks :P).
Decisions...
I recently invested in two Dell U2311H monitors. I had wanted two identical monitors for a while now, and had decided an IPS panel was the way to go. I figured whilst I was investing in monitors, I may as well also invest in multiple monitor arms.
The Dell monitor stands are actually pretty good out of the box - they can tilt, swivel, raise and rotate. But I was chasing the ultimate experience after reading Jeff Atwood's blog on multiple monitors.
I deliberated for a month or so before settling on the Atdec Visidec Focus Double. My decision came down to price, requirements and helpful advice received from Atdec via email.
Putting it all together
After a short period, both the monitors and stand were at my house and ready to be integrated. The process was relatively simple. The mount offers a choice of clamp or bolt through (requiring drilling through the table). I chose to clamp for now, because I couldn't bring myself to drill a hole in my 3 week old table.
Mounting the monitors themselves were relatively simple - the arms end with a mount that can accommodate 75mm or 100mm VESA brackets. The monitors I had were of the 100mm variety, so I simply extended the tabs and screwed them together.
The cable routing is very handy, now that there is no visible stand beneath the monitor, as dangling cables would ruin the prestige of having two floating monitors. The power and DVI-D cable fitted fine, but adding the Dell's USB cable (necessary for the hub) did not quite work so well - it did fit, but the exerting pressure caused the plastic tabs to pop out (and probably lead to the entire plastic insert falling off down the track). This was not a huge drama - I just wrapped the USB cables around the arms themselves.
Using the monitors
My first gotcha was realising that the monitor arms were not independent with regards to height - I'm sure I realised this from looking at the Flash video online, but I had somehow forgotten. This means, to rotate one of the monitors 90° for portrait viewing, the other monitor had to be of sufficient height to allow the diagonal of the monitor to clear the desk. The height of the landscape monitor felt a bit uncomfortable, so I stuck with both of them in the landscape orientation.
My second little issue was aligning the monitors with themselves - I'm not sure if I did something wrong, but I had a bit of a frustrating experience with getting both monitors to align - they seemed to be sitting at different levels, despite the monitors being identical. I purchased a level however, and played around with them for a few days and now I am happy with their positions in regard to each other.
So...?
The monitor arms are great! They free up a lot of room beneath them, and allow easy one arm changing of their position (although not of height - that is a two hand, or maybe even two person job)! They also look really awesome!
If I could offer any advice to the Atdec engineers, it would be this - the monitors can rotate on the arms a few degrees to the left and 90° to the right. This is great, but I could not find any easy way to determine when they were back to level, i.e. 0°. Perhaps a little notch could be useful, so when the monitor has returned to neutral, it can be felt that this notch locks it in, and gives just enough resistance at that point so the user knows it is level.
I reckon if you are chasing monitor arms for two monitors - the Atdec Visidec Focus Double is a great choice.
Sometimes, we want the place suffix for a number, e.g. when we pass a function 2, we expect nd. Perfect little C function!
char *getPlaceSuffix(int number) {
static char *suffixes[] = {"th", "st", "nd", "rd"};
if (number >= 11 && number <= 13) {
return suffixes[0];
} else {
number %= 10;
if (number >= 1 && number <= 3) {
return suffixes[number];
} else {
return suffixes[0];
}
}
I've updated my original version - after getting a decent night's sleep and some feedback from Stack Overflow.
I noticed the numbers 11-13 inclusive don't follow the usual convention (well at least not when I say them aloud). I allowed (ha!) for this.
That completes another remotely useful C function!
Have you ever encountered people on the web who TyPe LiKe ThIs?. Unfortunately, I think we all have.
Well I was bored with C, so I put together this evil function.
#define UCASE 1
#define LCASE 0
void altCaps(const char *str, char *t) {
int state = UCASE;
while (*str) {
char c = *str++;
if (state == UCASE) {
if (c >= 'a' && c <= 'z') {
c = 'A' + (c - 'a');
}
state = LCASE;
} else {
if (c >= 'A' && c <= 'Z') {
c = 'a' + (c - 'A');
}
state = UCASE;
}
*t++ = c;
}
*t = '\0';
}
Pure evil! For fun, take your friend's assignments and run them through this function :)