May 10, 2007
I'm very proud of my performance on today's TopCoder Single Round Match 348. First place in my room, and 7th overall in Division 2! How I wish today's match had cash at stake...

I would've ranked higher (at least 3rd overall, in fact!) if I hadn't resubmitted for the 1000-point problem, which got me a huge deduction. I had to recheck my solution because I noticed that the return type was long and my code only counted ints. And it later turns out that none of the system tests had a return value that exceeded int's capacity...
After dipping down to Division 2 for the past three matches, I'm now back to Division 1 with a blue rating! The competition is going to be tougher but at least I can really feel that I'm improving and that I'm more prepared for the harder problems.

I would've ranked higher (at least 3rd overall, in fact!) if I hadn't resubmitted for the 1000-point problem, which got me a huge deduction. I had to recheck my solution because I noticed that the return type was long and my code only counted ints. And it later turns out that none of the system tests had a return value that exceeded int's capacity...
After dipping down to Division 2 for the past three matches, I'm now back to Division 1 with a blue rating! The competition is going to be tougher but at least I can really feel that I'm improving and that I'm more prepared for the harder problems.
Labels: :D, contests, programming, TopCoder
April 15, 2007
Well, my run at the 2007 TopCoder Open has come to an end.
Algorithm Competition: To say that my performance in Online Round 1 was disappointing would be an understatement. I submitted to the two easiest problems, but one got successfully challenged and the other failed the system test. If I had just gotten one of them correct, I could've made Round 2. Looks like I'll need a lot more experience (and practice) if I want to get far in TopCoder. Next step: Work my way back up to a blue rating, and hopefully win some cash!
Marathon Match Competition: I didn't pass Online Round 3 (placed 91st, top 50 qualify to Round 4), but I definitely had loads more fun with this competition. I think I did better with the marathon matches because they encourage a lot of experimentation by trying out different approaches. Next step: Get a yellow rating (I'm very near!), and place in the top 20 in the next marathon match.
Hurrah! I've won two shirts!
(On a side note: This will be the last of my TopCoder Open posts. Until next year.)
Algorithm Competition: To say that my performance in Online Round 1 was disappointing would be an understatement. I submitted to the two easiest problems, but one got successfully challenged and the other failed the system test. If I had just gotten one of them correct, I could've made Round 2. Looks like I'll need a lot more experience (and practice) if I want to get far in TopCoder. Next step: Work my way back up to a blue rating, and hopefully win some cash!
Marathon Match Competition: I didn't pass Online Round 3 (placed 91st, top 50 qualify to Round 4), but I definitely had loads more fun with this competition. I think I did better with the marathon matches because they encourage a lot of experimentation by trying out different approaches. Next step: Get a yellow rating (I'm very near!), and place in the top 20 in the next marathon match.
Hurrah! I've won two shirts!
(On a side note: This will be the last of my TopCoder Open posts. Until next year.)
Labels: contests, programming, TopCoder
April 07, 2007
First, the good news: I made it into the Online Round 1 (see list of qualifiers here)! The last qualifying round was a relative push-over (I ranked a respectable 105) because all the geniuses had already qualified in the first two rounds. Still, can't complain about the result... and I've already won a shirt!
Here's the bad news: Because of my indicated preference (you choose from three time slots for Online Round 1), I've been grouped with the heavy-hitters in TopCoder: Petr, ACRush, kalinov, and the lot. Which basically means that my chances of advancing to the next round are nil. I'm not being pessimistic, just realistic. But on the bright side, like I said... I've already won a shirt!
(I knew shouldn't have picked the time slot that falls on a weekend. It was the one that most people would pick first, and since those with higher rankings are prioritized, it makes sense that all the big names would be assigned there.)
Here's the bad news: Because of my indicated preference (you choose from three time slots for Online Round 1), I've been grouped with the heavy-hitters in TopCoder: Petr, ACRush, kalinov, and the lot. Which basically means that my chances of advancing to the next round are nil. I'm not being pessimistic, just realistic. But on the bright side, like I said... I've already won a shirt!
(I knew shouldn't have picked the time slot that falls on a weekend. It was the one that most people would pick first, and since those with higher rankings are prioritized, it makes sense that all the big names would be assigned there.)
Labels: contests, programming, TopCoder
April 03, 2007
I've qualified for Online Round 3 of the 2007 TopCoder Open Marathon Match Competition! Take a look at the standings here. I dropped from my provisional rank of 85 to my final rank of 105 (the top 200 qualify). Still, not bad!

After coasting into Round 2, I found myself hard-pressed to survive the cut this time. The objective of this Marathon Match (see problem statement) was to create a player AI for a poker-like game; the rules are similar to five-card draw except that there's only two cards, the card values are only from 0 to 4, and there's an infinite number of each value in the "deck".
I made submission after submission, fine-tuning my algorithm to improve my score. At some point, I found the key to getting a good score: fold when your hand sucks... which is what you're supposed to do in real poker anyway. Being a poker player really helped!
My next objective is to make it to Round 4 (duh!) and to get a yellow rating (currently at blue). The competition will be much tougher next time and the race to get into the top 50 will be very tight.

After coasting into Round 2, I found myself hard-pressed to survive the cut this time. The objective of this Marathon Match (see problem statement) was to create a player AI for a poker-like game; the rules are similar to five-card draw except that there's only two cards, the card values are only from 0 to 4, and there's an infinite number of each value in the "deck".
I made submission after submission, fine-tuning my algorithm to improve my score. At some point, I found the key to getting a good score: fold when your hand sucks... which is what you're supposed to do in real poker anyway. Being a poker player really helped!
My next objective is to make it to Round 4 (duh!) and to get a yellow rating (currently at blue). The competition will be much tougher next time and the race to get into the top 50 will be very tight.
Labels: :D, contests, programming, TopCoder
March 29, 2007
There are three qualifying rounds for the 2007 TopCoder Open Algorithm Competition, and if you place in the top 550 in one of them, you qualify for the next round (Online Round 1). And the results from tonight's qualifiers were... discouraging, to say the least:

I ranked 705; I didn't qualify. I feel very fortunate though that I've still got two more qualifying rounds where I could redeem myself.
The best way to describe my performance today would be: I sucked. To be honest, I expected to qualify today. The problems weren't all that hard. The difficult problem was too tough for me and I never bothered with it, but the easy and moderate problems were a cinch... or so they were supposed to be.
(The following narration won't make much sense unless you know the rules.)
I got fixated on a messed-up and error-prone approach for the easy problem which I couldn't even get to work properly (runtime errors). Then I panicked, opened the moderate problem, thought it was too difficult, then went back to the easy problem. I finally managed to submit a a solution which didn't have any runtime errors.
The moderate problem turned out to be not as hard as I thought. I hastily submitted a working solution, but I lost a lot of points because the timer started ticking as soon as I opened it. After that, I reviewed my solution to the easy problem and found a bug. I fixed it and submitted it again, which merited a 10-percent penalty for resubmitting. Later on, despite all my efforts, it would fail the system test because the whole approach was just plain wrong.
Discouraged, I didn't bother with the difficult problem and simply waited out the rest of the Coding Phase. The Challenge Phase did not turn out well for me either. I made one unsuccessful challenge, and got beaten to the punch to three would-be successful challenges by a matter of seconds! Argh!
(Edit: I missed the second qualifying round today... One last chance on Wednesday!)

I ranked 705; I didn't qualify. I feel very fortunate though that I've still got two more qualifying rounds where I could redeem myself.
The best way to describe my performance today would be: I sucked. To be honest, I expected to qualify today. The problems weren't all that hard. The difficult problem was too tough for me and I never bothered with it, but the easy and moderate problems were a cinch... or so they were supposed to be.
(The following narration won't make much sense unless you know the rules.)
I got fixated on a messed-up and error-prone approach for the easy problem which I couldn't even get to work properly (runtime errors). Then I panicked, opened the moderate problem, thought it was too difficult, then went back to the easy problem. I finally managed to submit a a solution which didn't have any runtime errors.
The moderate problem turned out to be not as hard as I thought. I hastily submitted a working solution, but I lost a lot of points because the timer started ticking as soon as I opened it. After that, I reviewed my solution to the easy problem and found a bug. I fixed it and submitted it again, which merited a 10-percent penalty for resubmitting. Later on, despite all my efforts, it would fail the system test because the whole approach was just plain wrong.
Discouraged, I didn't bother with the difficult problem and simply waited out the rest of the Coding Phase. The Challenge Phase did not turn out well for me either. I made one unsuccessful challenge, and got beaten to the punch to three would-be successful challenges by a matter of seconds! Argh!
(Edit: I missed the second qualifying round today... One last chance on Wednesday!)
Labels: :(, contests, programming, TopCoder
March 22, 2007
I've qualified for Online Round 2 of the 2007 TopCoder Open Marathon Match Competition! Take a look at the standings here.

Well, that wasn't so hard. All you had to do was make a submission that compiled and you'd make it to the next round because the cut-off score was zero to become one of the top 500 advancers. Awesome achievement, huh? Well, I did score 2523.80 (and ranked 186) so I guess I actually earned my ticket to round 2... and a limited edition 2007 TopCoder Open t-shirt!

Well, that wasn't so hard. All you had to do was make a submission that compiled and you'd make it to the next round because the cut-off score was zero to become one of the top 500 advancers. Awesome achievement, huh? Well, I did score 2523.80 (and ranked 186) so I guess I actually earned my ticket to round 2... and a limited edition 2007 TopCoder Open t-shirt!
Labels: :D, contests, programming, TopCoder
March 12, 2007
Wish me luck, friends. I'm going to test my coding skills at the 2007 TopCoder Open. Aside from the lure of fame and fortune, I had this nagging problem solving itch that I felt compelled to scratch.
I'll be joining the traditional Algorithm Competition and I'll also be trying out the Marathon Match Competition for the first time. The Marathon Match Competition doesn't have the same nerve-wracking time pressure as the Algorithm Competition, which is good since I have responsibilities at work that I can't just drop.
Registration is closed for the Marathon Match but it's not too late to register for the other three events (Algorithm, Component Design and Development, Studio Design). What are you waiting for?
I'll be joining the traditional Algorithm Competition and I'll also be trying out the Marathon Match Competition for the first time. The Marathon Match Competition doesn't have the same nerve-wracking time pressure as the Algorithm Competition, which is good since I have responsibilities at work that I can't just drop.
Registration is closed for the Marathon Match but it's not too late to register for the other three events (Algorithm, Component Design and Development, Studio Design). What are you waiting for?
Labels: contests, programming, TopCoder
January 28, 2007
I've mentioned before that I'm terribly hooked to Yahoo Fantasy NBA. I tune into the Yahoo NBA boxscores every morning to see the stats of my players (and I have four teams to check up on!). But I find it annoying to have to open the boxscore page of every game and collate the stats of my players just to see how my team is doing. Yeah, I could wait until the end of the day, but I'm afraid my level of addiction can't afford me that much patience.
I've had enough of doing this so I came up with a solution: create my own tool to gather the stats of my players in real-time and put them all on one page. So I've been spending my spare time the past two weeks not blogging and instead working on my pet project. And here's the finished product: Fantasy Sports Live!
Fantasy Sports Live! (a.k.a. "FSLive") lets you see your fantasy team's stats as the day's games are being played, without having to pay for "premium" services like Yahoo's StatTracker. It's completely free to use and it's pretty fast too! I use it every day, of course. It's only for Yahoo Fantasy NBA players right now. If you're a Yahoo fantasy baller, check it out and let me know what you think.
Whether FSLive ends up as a commercial success or not, I've certainly had a lot of fun just working on it. This project has allowed me to merge two of my biggest passions: fantasy NBA and programming. And it's also helped me learn a ton of new things along the way. Here's a partial list of the technologies and techniques that FSLive is built upon:
Before I end this entry, I'd like to thank Borgy for helping me test, promote, and improve FSLive. FSLive is already getting hits from people around the world thanks to Borgy's effort in spreading the word. If you'd like to help promote FSLive, find out how. FSLive for teh win, baby!
I've had enough of doing this so I came up with a solution: create my own tool to gather the stats of my players in real-time and put them all on one page. So I've been spending my spare time the past two weeks not blogging and instead working on my pet project. And here's the finished product: Fantasy Sports Live!
Fantasy Sports Live! (a.k.a. "FSLive") lets you see your fantasy team's stats as the day's games are being played, without having to pay for "premium" services like Yahoo's StatTracker. It's completely free to use and it's pretty fast too! I use it every day, of course. It's only for Yahoo Fantasy NBA players right now. If you're a Yahoo fantasy baller, check it out and let me know what you think.
Whether FSLive ends up as a commercial success or not, I've certainly had a lot of fun just working on it. This project has allowed me to merge two of my biggest passions: fantasy NBA and programming. And it's also helped me learn a ton of new things along the way. Here's a partial list of the technologies and techniques that FSLive is built upon:
- C#
- ASP.NET 2.0
- ASP.NET AJAX 1.0 (formerly Codename "Atlas")
- The big three: HTML, CSS, JavaScript
- Screen scraping techniques
- A heavy dose of regular expressions
- A small dose of ASP.NET caching
- RSA encryption in .NET and in JavaScript (learn how!)
Before I end this entry, I'd like to thank Borgy for helping me test, promote, and improve FSLive. FSLive is already getting hits from people around the world thanks to Borgy's effort in spreading the word. If you'd like to help promote FSLive, find out how. FSLive for teh win, baby!
Labels: AJAX, ASP.NET, basketball, fantasy sports, FSLive, geek, NBA, programming, projects
December 17, 2006
Last Thursday night, Simon's team had a Christmas party (#3 in my marathon) at Simon's house. We had agreed at the previous week's team meeting that we'd do an exchange gift at the party.
Being the total geek that I am, I volunteered to write a program to generate the exchange gift assignments. I fired up Visual Studio 2005 and coughed up a C# exchange gift program in less than 15 minutes, whose source code you can download free of charge. Granted, automating the process is not as fun as drawing names from a jar, but it does have its advantages:
Being the total geek that I am, I volunteered to write a program to generate the exchange gift assignments. I fired up Visual Studio 2005 and coughed up a C# exchange gift program in less than 15 minutes, whose source code you can download free of charge. Granted, automating the process is not as fun as drawing names from a jar, but it does have its advantages:
- It doesn't require everyone to be physically present at the assignment drawing.
- It's faster than the manual process.
- By allowing the user input of a seed for the random, the assignments can be recreated in the future.
- I had much more fun than if we had drawn names from a jar.
Labels: .NET, C#, Christmas, exchange gift, geek, gifts, programming
September 16, 2006
I'm out. It's over for me. Here's the list of advancers to Round 2.
I just can't seem to get past Round 1 of Google Code Jam. Nevertheless, this year's result was better from last year's Code Jam. In Round 1, there are three problems worth 250, 500, and 1000 points each (as opposed to the qualifiers with just two problems: 250 and 1000). In 2005, I was only able to submit a solution for the 250-pointer, and it didn't make it past the Challenge Phase. (See the rules for more info; it's a 15-minute round where you can challenge the solutions of other people and make them fail.)
This year, I was only able to submit for the 250-pointer as well, but it was a solution solid enough not to get challenged. I did make a mistake though in unsuccessfully attempting to challenge, which got me a 25 point reduction. Still, I was able to submit my solution fast enough (208.61 points) so I netted 183.61 points in all. It would've been enough to advance (the "passing" score was 174.60) but my solution failed the System Testing Phase.
Tip for Code Jam 2007 participants: All you need to pass the Qualifying Round and Round 1 is a quick and correct submission for the 250-pointer.
The 250-point problem was like this: given a fraction in the form of n/d (where d and n are integers and d is positive) and a positive integer maxDenom, find a fraction n2/d2 such that d2 is less than or equal to maxDenom, d2 is positive, and the absolute difference between n/d and n2/d2 is as small as possible. If there are candidate ties, take the one with smaller d2; if the numerators are equal, take the one with smaller n2. My solution seemed correct, but my waterloo was floating-point number precision. Given that I was using C#, I should've used the decimal data type insted of double.
I just needed to do a find and replace from "double" to "decimal"! Argh!!! (pounds head in frustration)
Well, that's that. What really sucks is that I have to wait another year for the next Code Jam. But hey, at least I've got a shirt from last year!
I just can't seem to get past Round 1 of Google Code Jam. Nevertheless, this year's result was better from last year's Code Jam. In Round 1, there are three problems worth 250, 500, and 1000 points each (as opposed to the qualifiers with just two problems: 250 and 1000). In 2005, I was only able to submit a solution for the 250-pointer, and it didn't make it past the Challenge Phase. (See the rules for more info; it's a 15-minute round where you can challenge the solutions of other people and make them fail.)
This year, I was only able to submit for the 250-pointer as well, but it was a solution solid enough not to get challenged. I did make a mistake though in unsuccessfully attempting to challenge, which got me a 25 point reduction. Still, I was able to submit my solution fast enough (208.61 points) so I netted 183.61 points in all. It would've been enough to advance (the "passing" score was 174.60) but my solution failed the System Testing Phase.
Tip for Code Jam 2007 participants: All you need to pass the Qualifying Round and Round 1 is a quick and correct submission for the 250-pointer.
The 250-point problem was like this: given a fraction in the form of n/d (where d and n are integers and d is positive) and a positive integer maxDenom, find a fraction n2/d2 such that d2 is less than or equal to maxDenom, d2 is positive, and the absolute difference between n/d and n2/d2 is as small as possible. If there are candidate ties, take the one with smaller d2; if the numerators are equal, take the one with smaller n2. My solution seemed correct, but my waterloo was floating-point number precision. Given that I was using C#, I should've used the decimal data type insted of double.
I just needed to do a find and replace from "double" to "decimal"! Argh!!! (pounds head in frustration)
Well, that's that. What really sucks is that I have to wait another year for the next Code Jam. But hey, at least I've got a shirt from last year!
September 14, 2006
In case you didn't know yet, I made Round 1 of Google Code Jam 2006. I just registered for it officially via the Competition Arena. The coding phase begins at 10 PM local time, which gives me less than three hours to eat dinner and get rid of the nervous feeling in my gut. I'm going up against 999 of the world's best coders and it won't be any easier than last year, when I failed to advance past Round 1.
I'm the only representative from the Philippines to make it to Round 1 this year. I want to at least make it to Round 2 this time around. Maybe I can get national press coverage if that happens.
Nah...
I'm the only representative from the Philippines to make it to Round 1 this year. I want to at least make it to Round 2 this time around. Maybe I can get national press coverage if that happens.
Nah...
Labels: Code Jam, contests, Google, programming
September 08, 2006
I advanced to Round 1 of Google Code Jam 2006! Woohoo!
I am officially one of the top 1000 coders in the world (if we use Code Jam as a benchmark). Also, I'm the only contestant from the Philippines who was able to advance so I've been given the opportunity to solely represent my motherland (I'm equally proud and dismayed). The complete list of qualifiers can be found here; look for "punzki".
The elimination round for Code Jam was held last Wednesday, starting 12 AM (local time) and ending 24 hours later (Thursday midnight). I came home terribly exhausted from work on Tuesday night, and was ready to sleep (at 11:59 PM) when Akie messaged me on YM to remind me that the elimination round was starting a minute later. I really wanted to go to bed but I might not have even less energy if I take it Wednesday night so I went ahead and took it.
The elimination round had five sets of problems; I was assigned to Set 1. Each set had two problems: one worth 250, and a harder one worth 750. The faster you submit a solution to a problem, the more points you get, but if it fails the system test, you get no points for it (detailed rules here). I was able to do the 250-point problem very quickly and got 236.12 points, but the second problem (a variant of Little Bishops, except that there are some unusable squares) proved much more difficult. I had a correct solution, but it was too slow and exceeded the two-second time limit no matter how many times I tried to optimize it. I'll have to take a look at the solutions of those who got it correct to see where I went wrong.
Here are some quick statistics that may help those who are aspiring to get past the elimination round for Code Jam 2007:
That's the only advice I can provide; I wasn't able to get past Round 1 last year, though I did get a free Code Jam 2005 shirt. Unfortunately, this year, they'll only be sending shirts to the top 250 from Round 2. Well, I guess that means that I'll just have to make the top 250 this year, right? Wish me luck!
I am officially one of the top 1000 coders in the world (if we use Code Jam as a benchmark). Also, I'm the only contestant from the Philippines who was able to advance so I've been given the opportunity to solely represent my motherland (I'm equally proud and dismayed). The complete list of qualifiers can be found here; look for "punzki".
The elimination round for Code Jam was held last Wednesday, starting 12 AM (local time) and ending 24 hours later (Thursday midnight). I came home terribly exhausted from work on Tuesday night, and was ready to sleep (at 11:59 PM) when Akie messaged me on YM to remind me that the elimination round was starting a minute later. I really wanted to go to bed but I might not have even less energy if I take it Wednesday night so I went ahead and took it.
The elimination round had five sets of problems; I was assigned to Set 1. Each set had two problems: one worth 250, and a harder one worth 750. The faster you submit a solution to a problem, the more points you get, but if it fails the system test, you get no points for it (detailed rules here). I was able to do the 250-point problem very quickly and got 236.12 points, but the second problem (a variant of Little Bishops, except that there are some unusable squares) proved much more difficult. I had a correct solution, but it was too slow and exceeded the two-second time limit no matter how many times I tried to optimize it. I'll have to take a look at the solutions of those who got it correct to see where I went wrong.
Here are some quick statistics that may help those who are aspiring to get past the elimination round for Code Jam 2007:
- The lowest score that was able to qualify for Round 1 was a paltry 104.64. This was from Set 4, which had many qualifying scores in the low 100's.
- For Set 1 (my set), the lowest qualifying score (rank 200) was 201.86. I got 236.12, which was enough to rank me 76th in Set 1.
- For Set 1, only 27 were able to solve both problems. Four (ranked 28-31) got only the 750-point problem. All the rest (rank 32-200) were only able to solve the 250-pointer.
That's the only advice I can provide; I wasn't able to get past Round 1 last year, though I did get a free Code Jam 2005 shirt. Unfortunately, this year, they'll only be sending shirts to the top 250 from Round 2. Well, I guess that means that I'll just have to make the top 250 this year, right? Wish me luck!
September 02, 2006
This afternoon, I served as a judge for the second CompSAt Inter-University Programming Competition (IUPC). The IUPC as an ACM-ICPC-style contest organized by CompSAt that serves as a "warmup" contest for the ACM-ICPC Manila Regional Contest in October, hosted by Ateneo de Manila University. This year, the IUPC was participated by 14 teams from five schools.
Organizer Neill Li asked me to be a judge a few months back and I was glad to oblige. As a battle-hardened veteran of the ICPC (four regionals, two world finals), I figured it was going to be a cinch to come up with two or three problems. But I put off the task until a few days before the contest and to make things worse, solving problems takes only half the effort that it takes to make them. It's tough enough to formulate a challenging problem and then have to solve it to make sure it's solvable. Nevertheless, I was able to get the job done and I was able to come up with three interesting problems:
BTW, the top three finishers in the contest were:
P.S. Can anyone recommend an free online file storage service that'll let me publicly share files? It's sad that I have to resort to using my GeoCities account.
Organizer Neill Li asked me to be a judge a few months back and I was glad to oblige. As a battle-hardened veteran of the ICPC (four regionals, two world finals), I figured it was going to be a cinch to come up with two or three problems. But I put off the task until a few days before the contest and to make things worse, solving problems takes only half the effort that it takes to make them. It's tough enough to formulate a challenging problem and then have to solve it to make sure it's solvable. Nevertheless, I was able to get the job done and I was able to come up with three interesting problems:
- Bored Dots - Inspired by the Flash game Bored Dots, which I got so frustrated with, I made a program to give me the solutions. Not-so-difficult search problem. Just do a brute-force search for the solution. No one in the IUPC was able to solve this but one team did at least try.
- Roman Nvmerals - Determine if a string is a valid Roman numeral or not. It's simple enough to do, and there are many ways to solve it. The most straightforward solution is to write a program to generate the Roman numerals from I to MMMCMXCIX (1 to 3999); that'll give you all the valid Roman numerals and it's easy enough to do a search. Two teams were able to solve the problem.
- l33t H4xX0r5 - Inspired by the l33t esoteric programming language. It looks very hard but really, it's not. The problem statement is just troublesome to read (i.e., discouraging, intimidating) but everything you need to solve the problem is in there. Unsurprisingly, not a single team gave it a try.
BTW, the top three finishers in the contest were:
- De La Salle University (4 problems solved and they were only two in their team!)
- FEU-East Asia College (also 4 problems solved, but slower)
- Ateneo de Manila University (fastest to solve 3 problems)
P.S. Can anyone recommend an free online file storage service that'll let me publicly share files? It's sad that I have to resort to using my GeoCities account.
Labels: Ateneo, CompSAt, contests, IUPC, problem solving, programming
August 19, 2006
Question: How do you declare a constant/finalized/unmodifiable C-style string in C/C++?
If you answered
then you are dead wrong. Just try adding
and get WTF'd. If you tried it out and got stumped by the result, you're not alone. I thought I was a C/C++ hotshot myself until I read about const-correctness. Digest the following, please:
Working in C/C++ can be such a pain at times. There's just too much mental wrestling involved. You would think that just by saying "const" that it'd be obvious to the compiler that you don't want it to be modifiable. The language doesn't make it easy to express what you want to express. Maybe that's why I'm trying to learn Ruby.
(Many thanks to Miguel who was WTF'd by "const char * const" and challenged me to find an explanation for it.)
If you answered
const char * s = "I AM CONSTANT";then you are dead wrong. Just try adding
s = "DEAD wrong i tell ya";and get WTF'd. If you tried it out and got stumped by the result, you're not alone. I thought I was a C/C++ hotshot myself until I read about const-correctness. Digest the following, please:
// changeable pointer to a constant string
const char * s1 = "i am a constant string";
s1 = "not really"; // legal - literal strings return a char *
s1[2] = '!'; // illegal - s1's contents are read-only
// constant pointer to a changeable string
char * const s2 = "Let's try this again";
s2 = "sure that works"; // illegal - s2 itself is read-only
s2[2] = '!'; // legal - DANGER! will crash program
// constant pointer to a constant string
const char * const s3 = "i am teh ultimate constant string!";
s3 = "yep"; // illegal - s3 itself is read-only
s3[2] = '!'; // illegal - s3's contents are read-onlyWorking in C/C++ can be such a pain at times. There's just too much mental wrestling involved. You would think that just by saying "const" that it'd be obvious to the compiler that you don't want it to be modifiable. The language doesn't make it easy to express what you want to express. Maybe that's why I'm trying to learn Ruby.
(Many thanks to Miguel who was WTF'd by "const char * const" and challenged me to find an explanation for it.)
Labels: C, C++, programming, WTF
August 09, 2006
Last Saturday, I had a chat/interview with Joey Gurango, Microsoft Solutions Architect MVP, CEO of Gurango Software, and also CEO of WEBWORKS OS, where I worked as a software developer intern for two months last year. I was interested in what's been happening at WWOS since I left the company, but more importantly, I was interested in an entry-level position.
It turns out that after my stint, WWOS had transitioned from being a consulting/outsourcing firm to one that focused on product development (and they massively cut down on the number of their employees in the process). I was wondering what the difference was when Joey mentioned that there were essentially three kinds of software development jobs:
I'm sure that there are people out there who are looking for a first job in software development but don't know what options are available for them. This blog entry is for you guys and gals who "just want a programming job". I'm not an expert on the subject by any means (anyone know of a Type-4?). But I hope I was still able to help out. Good luck (to us)!
It turns out that after my stint, WWOS had transitioned from being a consulting/outsourcing firm to one that focused on product development (and they massively cut down on the number of their employees in the process). I was wondering what the difference was when Joey mentioned that there were essentially three kinds of software development jobs:
- In-house software development. You'll be working to develop software for your employer, just for internal use or for providing services to their customers. If you work for an "I.T. department/group", then this is probably the kind of software development job you have. Basically, the company isn't really a software company and instead of having some consulting firm address their needs, they decide to do things on their own. One obvious disadvantage of this kind of job is that the software development process will most likely be very informal; the software might not even be subjected to any QA work at all! Because of this, project lifecycles tend to be short. Of course, this depends on the project; if the system will be used by customers, it will have to undergo rigorous testing before it goes into production. But chances are that you will probably not learn much about processes and methodologies even after a year.
If you are serious about learning the craft of software engineering, you really have to think about the experience you will gain from working for a Type-1 company. Examples of Type-1 companies in the Philippines: Smart, Globe, any bank, any organization that's not a software company. - Consulting/outsourcing. Your company addresses the I.T. needs of other companies. Therefore, the quality of the software you produce determines your company's reputation, and hence the number of future projects will you get from your clients and from referrals. Quality is given more emphasis than in a Type-1 company so the processes and methodologies used are well-documented and strictly followed. QA work is a must and the painful steps of requirements gathering and system analysis are given much thought. The source code is usually turned over along with the finished product. As opposed to Type-3 companies (see below), Type-2 companies tend to become bigger and bigger over time in order to be able to handle more projects. Because they need to get as many minds as possible, their hiring standards are relatively low (but this is definitely not a rule).
You'll gain experience with software development, but the amount of experience points you'll get depends on the reputation of the company and the potential for growth within the company. It's possible that you'll just be a coder for years without getting an opportunity to participate in design and planning. Examples of Type-2 companies in the Philippines: Accenture, HP (does consulting for P&G), Soluziona, Orange&Bronze, tons of companies out there with "Solutions" or "Consulting" in their name. - Product development. The experience with a Type-3 job is very similar to the one you'll get with a Type-2, but Type-3 companies develop software (usually proprietary) that is ready for customers to use. As a rule, the software is of the highest quality because one small bug will cause headaches for all your customers and for your tech support team. Much of your work will revolve around a few product lines, and depending on the maturity of the product, you'll either be working on the initial release, fixing bugs, or upgrading the product. Very few Type-3 companies in the Philippines develop software that is sold off-the-shelf; they are usually sold directly to customers.
Type-3 jobs are great opportunities to pick up experience. However, there are very few Type-3 jobs available here in the Philippines. Examples of Type-3 companies in the Philippines: Navitaire, WEBWORKS OS, Lakeside Technologies, can anyone name others?
I'm sure that there are people out there who are looking for a first job in software development but don't know what options are available for them. This blog entry is for you guys and gals who "just want a programming job". I'm not an expert on the subject by any means (anyone know of a Type-4?). But I hope I was still able to help out. Good luck (to us)!
Labels: employment, programming, tips, work

