14 Mar

apenwarr – Git is the next Unix

When Unix pipes were invented, suddenly it was trivially easy to do something that used to be really hard: connect the output of one program to the input of the next. Pipes were the fundamental insight that shaped the face of Unix. Programs didn’t have to be monolithic.

With git, we’ve invented a new world where revision history, checksums, and branches don’t make your filesystem slower: they make it faster. They don’t make your data bigger: they make it smaller. They don’t risk your data integrity; they guarantee integrity. They don’t centralize your data in a big database; they distribute it peer to peer.

Much like Unix itself, git’s actual software doesn’t matter; it’s the file format, the concepts, that change everything.

Whether they’re called git or not, some amazing things will come of this.

via apenwarr – Git is the next Unix. Git is a pretty cool piece technology.

02 Jan

Modern Thoughts On Open Source

All this points to one thing: Open source is an infrastructure. Just like the roads in the city that automobile manufacturers are interested in, software companies want access to existing infrastructure to build their own products upon and make money, instead of having to re-invent the wheel everytime. It’s a win-win situation for all companies. Paying Microsoft to get Windows to support their products can be an expensive affair. So making an operating system a commodity is in everyone’s interests (well, except Microsoft’s). The web browser is another example of a commodity today. Everyone’s interested in a good, conformant, open platform on which to develop their web applications on.

via Modern thoughts on open source | Artagnon’s Presence.

27 Jan

The Complex Made Simple

For work, I had a piece of code that needed to calculate if a certain date fell in between two other days. So I started out writing out this big long function to calculate if a date fell first within the same year as either of the two dates, and if so within the two months, and within the two days. It was ugly, inaccurate, complex and just plain stupid of me to do it that way.

I knew there had to be an easier way so off to PHP.net I went and sure enough there is strtotime. Strtotime converts a string into a Unix timestamp. Turning my function into this:

function in_between_two_dates($first_date, $second_date, $third_date)
{
if(strtotime($first_date) >= strtotime($second_date) && strtotime($first_date) <= strtotime($third_date) )
{ return true; }
else return false;
}

Remember when in doubt: KISS (Keep it simple stupid).