Tag Archives: code

The ‘X Character Finder’ Crapfest

So, Java, huh?

It’s not so bad, actually.

As a first language, Java is okay – especially when it is taught right (inside joke there).

Anyway, hot on the heels (somewhat cold, actually), of the Windows Shutdown Crapfest, comes the X Character Finder crapfest, courtesy of yours truly.

First, a little background to this – at Uni I’m doing a subject called programming and problem solving. It involves Java.

Our first assignment was to calculate some variable. Or something. Anyway – one of the things we had to do was find out if the user’s name had the ‘x’ character in it – in either upper or lower case.

This is what I managed to come up with – I’ve commented the code so you understand what it does. I’ve also used Pastie to embed the code, because this is the one time WordPress has failed me. Right, everything seems to be failing hard on me tonight, so I’ve just linked the Pastie… 🙁

If you don’t really get what’s going on, I wouldn’t worry. Here’s the english explanation: Get a username. Count the letters in that username. Look at the first character – if it’s an X or an x, then we have an x in the username. If it’s not an X or an x, then we look at the next character in the username, and perform the same “Is it an X or and x check” again. We keep doing this until we either find an X, or we’ve run out of characters in the username. If you just want to know why this is the X Character Finder crapfest, well, it’s just because I’m re-inventing the wheel here, man – there’s a heaps easier way to find if a particular word/string has a particular character in it, and that’s via use of methods.

The real code that I submitted looks like this. Thanks again to Pastie. 🙂

See? Much easier.

This was the X Character Finder Crapfest, brought to you by Benny Ling.

Comments below.

The Konami Code – Contra Speed Run on NES

↑ ↑ ↓ ↓ ← → ← → B A

via YouTube – Contra Speed Run NES.

The konami code seems to have swept the internet lately, and I blame Facebook for starting it.

Konami Code Sites lists all the websites that you can preform the konami code on – but first, you have to preform the Konami Code on the website itself…

Good times. 🙂

Windows 2000 Source Code

Several days ago, two files containing Microsoft source code began circulating on the Internet. One contains a majority of the NT4 source code: this is not discussed here. The other contains a fraction of the Windows 2000 source code, reportedly about 15% of the total. This includes some networking code including winsock and inet; as well as some shell code. Some other familiar items include the event log, and some of the default screensavers.

There has been some speculation that while the bulk of the source is genuine, some of the comments have been tampered with to embarrass Microsoft. This is difficult to disprove, but I find it implausible. The embarrassing comments occur on thousands of lines, in realistic places. Furthermore, if someone had done that, it would have been easy to make the comments far more incriminating.

In the struggle to meet deadlines, I think pretty much all programmers have put in comments they might later regret, including swearwords and acerbic comments about other code or requirements. Also, any conscientious coder will put in prominent comments warning others about the trickier parts of the code. Comments like “UGLY TERRIBLE HACK” tend to indicate good code rather than bad: in bad code ugly terrible hacks are considered par for the course. It would therefore be both hypocritical and meaningless to go through the comments looking for embarrassments. But also fun, so let’s go.

via We Are Morons: a quick look at the Win2k source || kuro5hin.org.

Up, Up, Down, Down, Left, Right, Left, Right, B, A

If you’re a gamer and haven’t heard of this famous button sequence, you likely fall into one of two categories: one, you’ve got a problem with lying, or two, you’ve got some sort of amnesia going on… and you might want to get that checked out. Or maybe you’re just really good at Contra.

via Up, Up, Down, Down, Left, Right, Left, Right, B, A.

…obviously, I’m not a gamer.

When I saw this, I seriously had no idea what it meant…

However, one interpid Digg commentator pointed out that inputting the above code will automagically expand all Digg comments, and by golly, it did too!

I was amazed.

#349916 – Pastie

Zune Source Code FAIL

via #349916 – Pastie.

The offending function from the source code of Zune’s that caused the huge, epic Zune failure.

For those of you that don’t know how it managed to fail (myself included), see this Digg explanation for more:

Ouch.

For anyone who is wondering or just doesn’t want to figure it out, Dec. 31 qualified as being greater than day 365 (obviously, because it was day 366) but it got caught where the program says to look at (days > 365). The problem is that there was no code for what to do if the day *equals* 366, only if days is *greater* than 366. So, there was no way to break out of the (days > 365) loop until today (day 367) when the program would reset days to 1, thereby breaking the loop.

Whoops. It’s amazing what one bad “if” statement can do.

Heh. Amateur mistake, I know…