Saturday, February 20, 2010

C++: Forgotten Syntax

Well I do realized this post is later than my usual time (I usually have a post done Thursday or Friday, and schedule to post it at 3:00PM on Saturday.. In case you weren't aware, that's what I do) But I will still post nonetheless. This week I'll be giving a couple tips on C++, although you can't really depend on MY tips unless you yourself are more of a beginner than me. Personally, I've been with C++ for almost a year now, I took a class at a junior college, and I've been going through C++ Primer in my spare time. You can at least trust my opinions because I have more experience than about 50% of the other C++ newbies who learn how to write a hello world program and call it genius.

I want to call attention to a few things in C++ that personally annoy me, the things you and I, and millions of other C++ programmers commonly forget, resulting in a million compile-time errors. First of all, the ever-so-beloved semi-colon. Who would have thought that one small semi-colon has the power to completely change the output of a program? Secondly, brackets. It is common to forget the ending bracket, but how many times have you forgotten both the beginning AND ending brackets? Also, what are the unseen consequences of forgetting a "delete" command?

Well, the most common problem is probably forgetting semi-colons. This is usually quite easy to do, especially after typing out a long statement, but with practice, it'll begin to be similar to a second nature. There's really not much I can say about semi-colons.

In my opinion, the most annoying problem, and second most common (to semi-colons) problem is forgetting brackets. Every once in a while, I think, "You know, I don't need brackets here, it's just one line." But later I go back to that for loop or if statement or whatever, and I add a couple extra lines for some reason, but I forget those damn brackets!


The above picture is a good example of being able to write an if..else statement without the use of brackets. Now notice the difference the number of lines makes:

This code looks right doesn't it? Wrong, it is tricky to tell because of the indention (which I had to add myself, the editor wouldn't for me). A lot of times, if you are sure you are going to be typing in more than one line, and probably most of the time no matter what, you are in a habit of adding brackets, but when you go back to add a line or two, you totally forget about the brackets. Again, with practice, most people get better at remembering these things.

The third, and most important, and least noticeable problem is forgetting to deallocate memory, which is why you really shouldn't allocate pointers and that crap in the first place unless you absolutely have to. Has anyone here every ran a program, and then ran it again later without restarting... and then ran it again later, and again, without restarting? Well after doing so, did you notice your computer was extremely slow? So you open up task manager and kill every last process you can think of, and then you are down to 25 processes yet your memory usage is still at 93%. What's happened is called a memory leak, and in short... using new without using delete causes this. And even larger, using a million news without deletes causes this in a large scale.

Let's suppose you do remember your delete statements, you allocate memory for a bunch of arrays, array1, array2, array3, etc. and then you make absolutely sure you remember to delete them, so you have delete array1; delete array2; delete array3;. Well sorry to break it to you, but that's not gonna cut it. That's going to delete the starting pointer (the pointer pointing to array1[0], and array2[0], and the rest) but it won't delete the entire array. To fix this you must use delete [] array1;

So there you have it, now you will be extra careful to remember those semi-colons and brackets. And hopefully you don't have to think about deallocating too many memory slots.. Besides, allocating them in the first place is already some fairly advanced stuff that you really don't need to be fooling with unless you know what you are doing. Typically I don't even think of allocating memory except for as a last resort... which means I haven't ever actually done it in my own project where I'm not following a guide that tells me to use new and delete!

Have fun!

Saturday, February 13, 2010

Mass Effect review

The latest game I've played has been like a revelation for me! I am a science fiction fan, and also a fan of role-playing games, and guess what game has both of those elements? Mass Effect was created by BioWare, the same guys that made Neverwinter Nights, Star Wars: Knights of the Old Republic, and most recently, Dragon Age: Origins (and Mass Effect 2) After I realized how much I had played Mass Effect (I beat the game THREE TIMES and then this morning I caught myself about a third of the way through the fourth) I knew that it was it. Mass Effect was totally the game I've always been looking for. When I bought it, it sounded vaguely familiar, and for a month after I got it (caught it on sale for $14.99 by-the-way :p I wish I could catch Mass Effect 2 on sale for even $34.99) it was just like every other game I buy, I spend up to $20 and get a game that sits on my virtual shelf until I decide it's taking up too much space and delete it (only to be downloaded again a week later)

Well, anyways, the thing about Mass Effect that I really enjoy is the fact that you play it once, and you are like "heh that was pretty good" then you play it a second time and alter the settings just a tad bit, and then you find yourself thinking, "I don't remember this part!" and then a few familiar things happen, then you get some crazy achievement, and you go like "wow how did I not get that achievement the first time!" This is obviously, though, a feature that most role-playing games have, called re-playability.

Another great thing is the controls. You can assign abilities to certain hot-keys, and it's got a quick-save feature! Plus it has an instant pause you can use during combat to assess the situation a little bit, and you can also switch weapons and use abilities from that screen. One annoying thing is the automatic cover system. You'll want to be careful when walking up close to walls and things or you'll turn around and duck... while your enemy is in a critical position and it'll just take 3 shots to down him, and now you are stuck up against this stupid wall! The cover is sometimes useful when you are facing a ton of enemies, your shields go down or your weapon overheats so you take cover and use some first aid or wait for your weapon/tech/biotic abilities to recharge. It would be a lot better if there was a hotkey to do this though, instead of automatic.



My absolute favorite part of this game was definitely the storyline! Drew Karpyshyn was even good enough to write books that extend the storyline for you and really make you feel like part of the action! I don't want to give you too many details on the storyline, to avoid spoilers and mad people, but I will say that it's an awesome storyline. You can start out as a male or female, you can select your background (but that only changes one sidequest and gives you a couple extra renegade/paragon points) and you can select your class. The class part is the best, I first played as a soldier... that was pretty fun, then I played as an infiltrator, that was ALSO pretty fun, but I couldn't use assault rifle/shotgun :( (you can after unlocking an achievement like making 250 kills with a shotgun or assault rifle, the same with sniper rifle) My favorite, was the sentinel. It combines biotic and tech powers, so no weapons (unless you get that achievement I mentioned above) but biotic/tech is like pwnage!

Mass Effect was a great game, AWESOME voice acting (well female shepherd was awesome, but male shepherd was kind of dull. Everything else was also pretty good but I didn't hear it during EVERY single conversation so I can't put my finger on anything else.) great storyline, great re-playability. The graphics weren't exactly up to par, but the biotic/tech animations were still some pretty great stuff! I give Mass Effect a 9.5!

Saturday, February 6, 2010

Synergy (software) review

Well last weekend I found this cool stuff called Synergy, and so I decided I'd write a review on it. It's really a great piece of software if you have more than one computer; it allows you to control multiple computers with one mouse. If you know me, you might know that I have a laptop with it's screen plus a second monitor, and I also have a desktop with a nice monitor, and I'm a bit of a multi-tasker in the sense that as I write this review, I also have a browser open with about three other reviews on this specific software, I've got Trillian open, I've got MedieMonkey open playing music, I've got Notepad++--which is the best notepad replacement ever (next software review?)--with 6 documents open and I've also got Gmail and Google Calendar open. For some reason I have an English paper and two other OpenOffice documents (including this one) and I've got a virus scan running on my laptop.. You know? When I put it in words, it seems like I've got every program installed on my computer open right now, but anyways, the point is: I'm kind of a multitasker.
Well multitasking, as most people is hard without one of two things: Alt-Tab and multiple monitors. The multiple monitors part is different, but it makes things a whole lot easier, because at one time, I can see this document, my calendar, and in a tab a thing that tells me I have one unread message (wonder who that's from.. oh well I'll check it after this) and I also have a quick play/pause button for my music. When I'm writing research papers, it sucks having to alt-tab between browser, read a little, alt-tab back, type a little, etc.--It's nice when I can just turn my head a little, read a little, turn my head BACK, type a little.
Well now that I have three total monitors, it also means I have two keyboards and two mice (mouses?) and half the time, I'll start typing on one keyboard and then I realize I'm typing on THE WRONG KEYBOARD! Yes, once I even shut down the wrong computer using keyboard shortcuts and ended up losing about half an hour's worth of work opening all the applications I was planning to use! <--That's actually an exaggeration. With Synergy I have solutions to every problem every presented in this universe, in fact I considered nicknaming it 42. You know, the answer to the universe and everything... oh whatever it was a joke, anyways, with Synergy, I can move my mouse from my desktop to my laptop AND BACK!!! That part totally blew my mind away. Then I realized I could copy-and-paste from one computer and back (goodbye netpaste, you are no longer needed) and I could move DOCUMENTS from ONE COMPUTER and back!!! Wait let me test that, just a second.. ok you can't move documents from one computer and back, and that is why you use shared folders. But I thought, this is the sickest thing ever to happen to my desktop and laptop, it's like they've become married, they have joined souls and become one. Well now I have seen a problem: I can't use alt-tab to switch between firefox on my laptop and openoffice on my desktop. Well simple, Synergy has shortcuts which let you switch the keyboard/mouse between computers, and problem solved.
Well Synergy is a really great piece of software, it's been very helpful. I'd give it a 5/5 easily. I think you can connect more than just two machines together too, you could probably have 5 or even 10 computers together :D Oh and the cool thing, do you have two computers because you like Linux and Windows? Well no problem, or maybe you like Mac and Linux (such a Windows-hater!) well no problem! Synergy works across multiple operating systems at the same time :) So in conclusion: do you have two computers? Good, get Synergy. Bye.

Saturday, January 30, 2010

February Anticipated Games

Since November, we have only seen a few nice game releases, including Dragon Age: Origins and CoD: Modern Warfare 2 of course. There was also James Cameron's Avatar: The Game and DiRT 2, and a couple of other games, but Christmas seems like a dead season for new games (but don't get me wrong, everything shows up in a big gulp right before Christmas) Well February seems to pick up the pace again. Mass Effect 2 is an amazing game (I have only read countless articles and watched tens of YouTube trailers) and probably to only notable game release of January 2010.

Well now we are in February, and if you are looking for a new game, you've come to the right place. Several games have been anticipated for a while, and are finally being released in February. These games include: Star Trek Online, Bioshock 2, Everquest II: Sentinel's Fate, Napoleon: Total War, and even though it is being released on March 2nd which is not in February, I have decided for the sake of this blog entry to also include Battlefield: Bad Company 2 because it is just that epic! I have not been following the release of games for very often, but in my own research, I have noted down that a lot of these are sequels, or expansions to existing games. Hopefully you were able to notice this too because, well... except for Star Trek Online and Napoleon: Total War, all of those games include a '2' or 'II', and in the case of Sentinel's Fate, it happens to be an add-on to a sequel!

Now notice that one of the games that doesn't include a 2 in it is Star Trek Online. That, however, is totally fine! I mean who wouldn't want to play a game called Star Trek after seeing the movie? Well not me because I'm not a huge fan of online games anymore: Either you want to keep doing the same thing over and over, or everyone else wants to do the same thing over and everyone else is really good AND you either suck at the game or you get addicted.. In other words, they are addictive. Anyways, Star Trek Online looks like a pretty sick game. As far as I can tell from previews, there is quite a bit of combat, and something I thought was really cool is the fact that you can create your own species!!! Wouldn't that be awesome? Create a species, and describe how you came into the galaxy (like you discovered some Mass Effect relay in the 22nd century... Wait that sounds like the humans in a game I like called "Mass Effect"!) Star Trek Online has revealed that the monthly cost will be $14.99, similar to several other popular MMOs. It was created by the same people that brought you City of Heroes, City of Villains and Champions Online so it should be an interesting game!

The other game that doesn't include a '2' in it is still a new addition to an ever-so-popular series, the Total War series. This is an awesome set of games, albeit strategy games (I haven't grown accustom to this genre of games, but it still looks awesome anyways!) A new feature present in Napoleon which wasn't included in the other Total War games is a new multiplayer mode. While I haven't played many strategy games, I certainly don't remember ever seeing a multiplayer strategy game before! It may just be because of my recluse-ness to those types of video games. Anyways Napoleon: Total War is enticing to me, just the fact that there are several gameplay modes and historic battles you can play through (my History class has turned me into a little bit of a history fanatic... Yes, I have started reading "U.S. History for Dummies")

Now we have two of those games out of the way, I'd like to talk about Bioshock.. TWO! Bioshock in my opinion was a really interesting sci-fi game. The website is a real treat to the eyes, but I'm almost certain the website is nothing compared to the game. The original Bioshock had some really great graphics, an interesting storyline and some unique features creating a gameplay which you couldn't experience twice. Now the sequel, Bioshock 2 claims to take you back to the underwater city of Rapture to re-experience the unique elements of the games setting. The game also features multiplayer modes, which obviously don't appeal to me because I suck at multiplayer BUT that's probably one of the best features in the game, I mean who doesn't enjoy shooting the crap out of other people online? 2K Games did a great job with the first and they sure got my attention in this sequel.

The other game worth mentioning is Everquest II: Sentinel's Fate. No, I didn't forget Battlefield: Bad Company 2, I am just not writing about it this month. That is for next month. Anyways, the Everquest game is a nice MMO for multiple audiences, it incorporates those nice fantasy features that everyone loves, and of course it's got a bazillion expansion packs. The only game I would ever pay monthly for is a game that is always being improved on. (Imagine paying even a dollar a month to play Half Life 2; it lasts for a while but after playing it for a year or 6 and only getting two new episodes, not to mention the multiplayer which gets old too unless you start modding) This happens to be the 6th expansion (9th if you count the three adventure packs) and it features a new level-cap, new dungeons, hundreds of new quests and thousands of new items, an plenty of new land to explore and quest on.

Now, my disclaimer, I haven't played more than about 5 hours each of the original BioShock, I've never played any Total War games (but I've watched plenty of previews of most of them) and I've never played any Everquest (well I got about an hour into a free trial and lost my password.... long long ago...) and I've only played small portions of City of Villains and Champions Online. Therefore, I am not the most knowledgeable on any of the above mentioned games BUT I can still give you my opinion and save you an hour or two of extra research (which you are likely to do anyways because of your curiosity :p)