Macha

Programming Books

August 21, 2010 | categories: Programming

It used to be the case that when I wanted to learn more about programming, I would go down to the book store, buy a book about the language I was using and read it through. However, the problem with these books is that after a while, you only really want the last 5 or so chapters, detailing the bits of the standard library you are going to use. The language docs are usually a pretty good explanation of the syntax. You definitely don't need a full chapter devoted to if statements and loops, for the fiftieth time.

What you need on if statements after the first language is just a small paragraph like:

Python if statements are done like so:

if condition:
    doStuff()
elif other_condition:
    doOtherStuff()
else:
    doOtherOtherStuff()

Seven lines, not a whole chapter. Oh look, the language docs do that. Never mind then. Those chapters are now totally redundant. Spending €40+ for the last 5 chapters really doesn't make sense.

The other problem is one of quality. Several books promise to teach you everything about something, yet obviously fall far short of it. An extreme case can be seen in the two books I bought around 2-3 years ago, when I was first learning PHP.

1300 page long "Beginning PHP and MySQL", 200 page long "How to do everything with PHP & MySQL"

Which title do you think is more accurate?

Even apart from the amount of extra information in the Apress book, the quality of that information is far better. The smaller book doesn't even mention how to create a class. And it would have you believe that the only way to interact with a database is through the old mysql library, using functions like mysql_fetch_assoc(). Oh, and to really rub it in, it does actually mention MySQLi, but basically as a slightly faster version of the MySQL functions that needs to you put an i in your function calls, and nothing else. The example code in it always mixes code and markup, and then you wonder why PHP has such a bad reputation, when there are so many books like this floating around.

The problem is, many people will look at these books, and see the Apress book looking much more formal, and presume that's it's full of unnecessary detail. I did at first (hey, I was just starting out), which is why I initially bought the second book, then had to go back and buy the other one when I finished the first one, and realised I could of learned the same amount of stuff from 2 hours and an internet connection.

Of course, eventually, every programmer moves on from these books to more general ones about coding in general, rather than specific technologies and languages. The problem is, many book stores don't bother selling anything more advanced. And the only computer shop where I live, PC World, has an even more pathetic collection. So you have to wait ages for something to turn up. Or have someone recommend a book, and then buy it online. You can't browse through books, flicking through a chapter of each to see which looks better, on eBay or Amazon unfortunately, which rather limits the options for just looking around for something good.

Moving on to better books, like this one.

The first proper programming book I got was Code Complete, second edition, which I bought roughly a year ago. I'd heard a few people recommend it before, but hadn't went to buy it. I was amazed when one day, among all the copies of Excel for Dummies and iPhone for Seniors, there was a copy of Code Complete in the book store. I presume someone had ordered it in, and the store had just got a few of them, because it's sadly not the kind of book they usually get. I suppose they rather books that don't require the customer to have some knowledge already. (Which is odd, because surely they'd be able to sell two books with an offer like "Buy this book to learn how to program, and this book to learn how to program better.")

Unfortunately, even when you know what book you want, the book stores don't do themselves any favours. Around this February, I had €30 in book vouchers for the local bookstore left from Christmas, and decided to buy Design Patterns with them. I had the PDF version, but I still read best from dead trees, so I had a look. Unsurprisingly, they didn't have it there, as most of their books are of the Language x for dummies/Buzzword y in 24 hours variety. Oh, and they have Code Complete again as well, but I already have that. So, as I had expected, they would need to order it in. I had checked beforehand, and the book was €30 delivered from Amazon. I expected it might be maybe €40 in the bookshop, cheaper once you factored in the vouchers I already had. It wasn't €40. It was €82. I don't know what planet they are on in the bookstore, but needless to say it's led to Amazon being €30 richer.

A welcome development is the trend towards free online books. Examples such as Dive Into Python, Programming Ruby, Dive into HTML5 and Real World Haskell do help with their respective languages. And the fact that they tend to be more concise than the usual books on the shelf (I know they come on dead trees too, but nowhere near me sells any of them) also makes them more useful, even despite my preference for reading from a physical book.

EVE, Introversion Pack and Left 4 Dead

August 03, 2010 | categories: Gaming

I've been on a bit of a buying spree with games lately. Firstly I bought EVE Online. I played the trial of that on the recommendation of two friends who have been playing the game for about a year. After about 6 days into the trial, the game was looking fun, so I bought it, and began to play it. I got most of the tutorial missions done and the combat ones in particular were quite enjoyable. So I bought the full version for a month, which cost me €20 just to start with, much to my annoyance when Steam put it on sale for €2 a week later. I then joined the corporation (for anyone who hasn't played EVE, these are the guilds/clans ingame) my friends were in.

The first impressive thing about EVE is that it is big. Very big. It's also very empty. Both of these were pretty much a given the space setting, but it's still impressive to see it. The emptiness is cancelled out by the Warp Drive, meaning you aren't spending ages staring at black space, yet because you need to use gates to go between systems, the sheer size is still obvious.

The possible routes there are for EVE seem to be these:

  • Trading: Buying stuff cheap, selling it dear. Easy to explain, hard to do well.
  • Mining: Resource gathering. Is there anywhere this isn't boring?
  • Manufacturing: Making stuff. Get x, y and the blueprints, wait some time. Might be OK for some, not for me.
  • Combat: The highlight of the game. This is really quite fun, and well done, as you control all the various weapons/defenses on your ship. Of course, being a noob, I'm still at the sucking and dying stage, so haven't done any PvP yet.

A nice feature in game is that skill training takes place in real time, and continues when you are not online, meaning you don't have to play obsessively to get anything useful. I was a bit confused over what to do after the first few days because my two friends who played it went on holidays, but I managed to work my way through it. Learning the game could certainly be easier, but it's not as bad as some people make it out to be. A few things were confusing, but even when my friends were gone, I still didn't find anywhere where I was going "What am I supposed to do now?"

However, MMOs really aren't my thing, and while EVE was a good game, I am unwilling to give out €15 a month for it. If it was a game that cost €45 once, and that was it, I'd jump for it. But at over €100 a year, it just isn't worth it. It's a good game, but fails on the area of value for money. Which is something a lot of gaming sites don't always take into consideration. That €15 a month could be spent on getting a new game every 2 or 3 months, rather than just keeping an old game.

Introversion Complete Pack

Another recent purchase was the Introversion Complete Pack, which I bought during the Steam sale for €5. The pack contains 4 games - Darwinia, it's multiplayer successor Multiwinia, DEFCON, and Uplink. The one I've played most was Uplink.

Unlike EVE, which struggled to prove its value for money, Uplink alone is worth more than the €5 I payed for the set on Steam. Uplink is a game about hacking (of the script kiddy variety seemingly), where you have to break into various systems by using the right tools. The gameplay was simple, and the game's soundtrack was good, in a retro way.

The other one of the set I've played is DEFCON, a RTS based around nuclear warfare. The game starts slowly, as you build up your units and stockpiles, then move them into position, until the timer reaches DEFCON 1, and the nukes start flying. Again, it was quite enjoyable, even if I wasn't that good at it. Though from what I've seen from comments by other people who have played the game, the AI is quite hard to defeat at first.

Darwinia, and Multiwinia? I haven't got around to playing those two yet, but the other two have already paid for themselves several times over, so these two should be good as well.

Left 4 Dead

The final games I bought recently were Left 4 Dead 1 & 2. Again, I got these in the Steam sales, and given the price reductions, I bought the 4 pack of Left 4 Dead 1 so I could play games with friends when they were over. The co-op element is really fun, and most of the online community is luckily as good as Team Fortress 2, as opposed to the likes of Xbox Live and Counter Strike.

I know I'm rather late to the party with this one, but it is still a fun game. The zombies like the Charger and the Tank add the need for extra strategy than the "Get a good weapon and keep shooting while hiding in the corner until they are dead" of my other favorite zombie game, Nazi Zombies mode in COD5 (which was the only reason to play COD5 once you cleared the campaign).

The matchmaking system also works very well - I've found myself in matches with players of comparable skill most of the time, rather than being stuck ruining someone else's game by being a noob, or being stuck with people who are even worse at games than I am.

Playing locally with friends on Left 4 Dead 1 is fun as well, so the 4 pack was well worth it. The one problem I did encounter, is that the multiplayer element in Left 4 Dead 1 is rather unbalanced in Versus mode if you don't have 8 players, as there are no AI special infected, unlike in Left 4 Dead 2 which had this feature added in a patch. Oh, and the lack of melee weapons is also a bit disappointing.

Customer Service

July 28, 2010 | categories: Me, Technology

Recently, Linode upped the RAM on all their packages by an average of 42%. My own VPS went from 360mb to 512mb. And yet, the first I heard about it was a RT on Twitter. Considering it's quite a considerable upgrade, almost doubling the RAM, you'd expect them to be shouting it from the rooftops. Most other hosts I have had before this sure would have. Yet I didn't even get emailed about it, so finding out was a pleasant surprise.

This reminds me of a contrasting experience I had on a budget shared host. They were using Apache 1.3.37 and PHP 4.4.7. In early 2010. This host was on a website belonging to a client, and it predated me, so moving them to a new host wasn't an option. "If it ain't broke, don't fix it", was their reasoning. And obviously non-technical people don't quite see the problems with having outdated software.

Looking through the knowledge base for the host, as they made it really hard to talk to a real person, found that there was a process to get PHP5. So I emailed tech support. They said that it may take some time as the client was on a "Legacy Web Hosting" package. They also strongly hinted that new customers get Apache 2 and PHP5. But old customers? They already have those, so why would they upgrade them? The total opposite to Linode's attitude of "Oh, hello, we've just upgraded your RAM for free."

To add insult to injury, that upgrade to PHP5 on the old host took over a month, in which time the ticket was closed incorrectly twice and it was twice hinted that new customers get PHP 5 as standard. Finally, the version of PHP 5 I finally got? 5.1.2. Weren't we all supposed to be using PHP 5.2+ since 2008 anyway?

I guess the old saying of "You get what you pay for" is alive and well and definitely applies here.

Simplicity

June 22, 2010 | categories: Pcs

I was talking to Sirupsen on MSN on the subject of simplicity a few days ago. We both agreed that we liked simplicity, yet when we were giving examples, it became clear that we certainly didn't even have the same definition of simple.

The biggest contrast came when we discussed Linux distros. I used Ubuntu as an example of simplicity, while he used Arch. Two very different distros both in their aims and their implementation. One of Arch's main stated goals is even simplicity. Yet Arch certainly wouldn't count as simple under my definition. And Ubuntu wouldn't count as simple under his.

So, what exactly are these two different, often conflicting, views of simplicity? They're technical simplicity, and usability simplicity. Arch's, technical, simplicity, involves having less. Less done for you, less to install, less to go wrong. But this doesn't nessecarily lead to a simpler user experience. Some of the things they cut out, drivers for certain wireless cards, a GUI, etc are now going to need to be manually installed. Perfect for people wanting total control, not very good as far as an easy install goes.

Arch's simplistic plain website
Even their website shows minimalist simplicity.

Ubuntu on the other hand is aimed around user simplicity. It's as close to "Press the big buttons" as Linux gets. However, all this user simplicity involves a compromise on the technical simplicity. While it's much easier for the user, the average Ubuntu install has quite a bit more in it that the average Arch install. Some of it is the stuff that you would install anyway - the GUI, a browser, etc. However, it also has three package managers - one GUI, two CLI. The average user won't know about the two CLI ones until they are told about them, so they don't bloat the user experience, but to the technical simplicity crowd, this must seem very wasteful, especially one compared to one on Arch (just pacman). Other things, like the network settings, are done using GUI config tools. And sure, CLIs are normally more efficient, but anyone who says editing wpa_supplicant is easier than the settings panel of wicd or NetworkManager is just bluffing.

This article probably shows that I do prefer the Ubuntu emphasis on simplicity of use, rather than technical simplicity. It is possible to have both, but for the most part, that magic of "it just works" takes away from the technical simplicity. Sometimes they align: Twitter is a good example of something that everyone agrees is simple. But other times, like the Linux distros, they don't. So, which do you prefer?

[EDIT: Arch vs. Ubuntu is just an example. I'm not deliberately picking on Arch again (unlike last two times), but it just happened to be an easy example]

OpenTTD, OpenTTD and more OpenTTD

May 16, 2010 | categories: Gaming

If you've read my blog for a while, you may have noticed that I have mentioned OpenTTD a few times. It's one of my favorite games, and it's well worth playing. If you haven't played it, you can get it from the official website. It used to be a case that you needed a copy of the original TTD game to play it, but with OpenGFX, that is no longer true.

There is a tutorial for the game on the offical wiki to get you started. Once you've read through it and understood it, you are ready to play the game. After a while, you'll probably want a few, more in-depth tricks to the game. So here's a few basic ones:

  • Coal -> Power and long distance passenger travel by air are the easiest ways to make money early on.
  • Pay close attention to your slopes and curves. Although the game will allow it, making sharp turns and going up long hills straight away will slow you down, just like real trains.
  • You can grow towns with a few bus stations and buses going around within a turn, which will produce more available passengers.
  • Put signals close together so trains don't keep stopping and starting because of a train loads of tiles down the line. (You can hold ctrl, then click and drag to make signals all along a section of track)

If you want to learn how to play the game really well, I suggest you spectate or play a few games on #openttdcoop. They are very advanced, so if you don't understand what they are up to, don't worry. It is kind of a case of learning in the deep end there, but it does help a lot. While I'm still barely a newbie compared to what they build, most of my friends think I'm really good at the game. Don't ask me why. I certainly don't think so. The official wiki, and the openttdcoop wiki also provide a good few tips.

#openttdcoop built this. Insane, but mostly simple ideas scaled up.

The game has a multiplayer mode, (which is how #openttdcoop build such huge things), which can be played co-operatively or against each other. It's great for LAN games, provided you have a bit of time on your hands. For internet play, you can find loads of servers to play against other people. If you want to just play against your friends over the internet, without joining someone else's server, it can get a bit tricky since someone needs to host it, and firewalls and NATs and all the other issues you normally have do cause problems, because one of you need to host it. I managed to get around it by running it on my VPS a while back, but that's still kind of complicated. I may post a guide for how to do this in a few days.

« Previous Page -- Next Page »