Learning C++

August 26, 2009 | categories: Programming

As usual, I'm falling behind on blogging. One of the reasons for that is I am currently learning C++.

A while back, I had a brief exploration into C++, and learnt the basic syntax, then moved on and didn't do anything related to it for 6 months. The majority of my programming has been done in Javascript, Java or PHP, though I have looked into other languages. Since Java and C++ are quite similar in some respects, and I did learn the basics beforehand, I'm not starting from scratch completely, though in some ways it would be beneficial if I was. An example is this:

int array[somevar]

Perfectly legal, and quite common in Java. In C++, this shouldn't work. Except it did for me, because it is a g++ extension. Someone with no programming experience would not have tried this. This is something I hadn't expected. I had expected C++ to be more like Java, and PHP where there was one standard of the language (and the only differences were between new and old), but it seems, like Javascript, there are a few variations per implementation.

Another thing that surprised me was the small size of the standard library. Compared to the Java API, and the .NET Framework, the C++ Standard Library is tiny. No GUI code, no threads, no networking functions.

The final hurdle I encountered is there is so little information about C++ online. On the one hand, I should of expected this, as the origins of C++ predate the internet, and it's not a web language, but it means I have a lot of difficulty finding material. My local book store has only 3 shelves of computer books, with the programming catalogue nearly entirely taken up by C#, Java and PHP. As well as that, the books I found in the library are quite old and mostly aimed at people coming from C or Pascal, or a variety of other older languages.

I'm wondering what other people's experience of learning C++ is.

The Wii virus

August 09, 2009 | categories: Gaming

You play the wii for a month, show two of your friends, get bored, then they buy wiis and show two friends each and the patter continues

The Wii. A console that half the world 's gamers love, and the other half think is a waste of money. Having outsold every console ever, many declare Nintendo the ultimate success but how many people still play it after buying it? Nearly everyone I know has a Wii. Only one of them still uses it. My Wii is slowly gathering dust, even when my 360 was out of action.

So if no-one enjoys the Wii, how has it managed to sell so well? It happens like this.

  1. You buy a Wii
  2. You play it for a while and show it to a few friends.
  3. You get bored of the Wii
  4. Your friends buy Wiis
  5. They show their friends.
  6. They get bored.
  7. Their friends buy Wiis.

And on it goes. This hasn't been helped by the amount of games sold for the Wii, with no considerations given to replayibility. Don't get me wrong, there are some great games for the Wii, but the majority of the games aren't good for anyone except the most casual gamers.

I know I'm not the only who thinks this. The President of Epic Games (the company who created the Unreal Engine which is used in many games and the games Unreal Tournament and Gears of War) described the Wii as a virus.

Weird song listings

July 30, 2009 | categories: Gadgets

My iPod Touch is a great music player. But one of the most annoying inconsistencies in the UI is that it is capable of sorting The Black Parade under "B", but it cannot tell that Minutes to Midnight and Minutes To Midnight refer to the same album. I mean, even my mobile phone (a Sony Ericsson k800i) was able to tell that they are the same album. (And my old mp3 player, and that managed to have album listings including "Nirvana {19}").

This irks me because they put all this effort into designing the listings, to the point of stripping out words like A and The for the sort order, yet that can't handle a difference in case. It seems like someone was doing a bit of a half assed job there.

Windows does partitions wrong, but so does Linux

July 28, 2009 | categories: Pcs

Back when I first installed Linux, when I had said I had a 60GB partition to use, the advice I got was: Match your swap partiton to your RAM, use 10GB for /, and the rest for /home .

Yesterday, I started getting errors everywhere. So I turned it off and on again. When that didn't work, I actually read the errors. "No Space Remaining". I go "WTF, I only used about 12GB".

So after spending a while looking at the disc usage program, I notice something. It lists / as full with 9GB/9GB used. Then I realise the problem: My / partition is full. (which is presumably also the location of /tmp , hence the errors).

Luckily my swap partition was in between my / and /home partitions, so I've deleted that and recreated it at the end of the disc. (which took a bloody long time, and required finding that LiveCD again).

This makes me wonder: Is Windows' system of drive letters rather than a defined purpose (which is often a point of criticism) such a bad idea? When on Windows, my C: drive filled up, I just needed to move files en masse to my D: drive. Still slow, but doesn't require even a reboot, much less depending on where my swap partition just so happened to be because of the order that I used when installing the system.

For those of you wondering how my programs and system data are significantly larger than my files, here's the amount of file storage I've used on programming:

  • Eclipse: 130 mb
  • Eclipse plugins: at least 20mb, possibly as high as another 100mb
  • jdk/jre: ~30mb
  • Apache/PHP/MySQL: ~100mb
  • Many other programming tools
  • Actual programs I'm writing now: < 20mb (Older ones are stored on a network drive)

Representing partitions as drive letters is clearly wrong, because the file system is supposed to be abstracting the actual physical hard drives out of it, but representing them for one use is also wrong. How can I predict when I get a new computer that I'll need x gb for data and y gb for programs?

An ideal OS would abstract all of this away, so you just have storage and don't have to deal with the actual drives you have, what partition a file goes in, predicting your disk usage, which partition is on which drive etc.

First serious Java programming project

July 27, 2009 | categories: Programming

I've done a good bit of programming in PHP and Javascript, but up until recently, my desktop programming experience has been limted to calculators and other similar simple programs. However, that is changing as my current programming project is an IM client and server written in Java. The name is Machat (hey, I'm not very inventive) and the source code is under the GPL and available at my new github account.

Currently it is in a VERY rough state (in fact it doesn't even send messages) and I don't really expect it ever to be succesful, but it's still an interesting project to learn about GUIs, threading and network programming (3 things you don't do a lot of in PHP).

« Previous Page -- Next Page »