Category: Technology

  • Apple’s new iPad

    While I really wished Apple didn’t name it iPad, it’s still too early to tell if this device would be any good. I was rather disappointed it didn’t run the regular MacOS X so I can have my favourite app – Terminal. Without Terminal, an Apple product is most likely useless to me.

    However the price point seems compelling starting at US$499, I’m estimating that to be SG$788 when it arrives.

    So what good is an oversized iPhone? It’s quite obvious Apple wanted the lock-in and screw developers around the App Store.

    I’m curious what Google has to offer as it seems I might be switching out of Apple to Android after the novelty of the iPhone wears off. I’d much prefer to develop in Java than having to pay for an ADC account just to write in a much more complicated Objective-C.

    On the books part, I’d gladly buy the Amazon Kindle. Unfortunately, I don’t have the luxury of time reading. I bought several books last year and about 80% of that is still sitting on my side table.

  • Little Code, But Still Complicated

    It seems like our app isn’t one that demands a lot of coding but is still quite complicated for a short development time span of two weeks.

    FYI, we are building an e-commerce app in Facebook with a different concept from Marketplace.

    Why do I say it’s complicated? Because it involves a lot of thinking and discussions to get the flow right. We have tiny bits of code here and there, each doing small little tasks. They don’t have much complicated code with maybe a few interesting SQL queries, but they are starting to add up to the overall complexity of the project.

    The other challenge is merging the 101 different technologies here. SQL, FQL, FBML, AJAX, PHP, REST, JSON… PIE, AYE, BKE, KPE, KJE, ECP… ayiah.

    Looks like we’re going to be spending more sleepless nights. Might have to forgo some features and the database tuning and indexing for now!

  • A Word On Amazon Web Services

    Today’s lecture was given by folks from Microsoft and Amazon. The Microsoft part was on the Imagine Cup 2010, a global student competition. I’m out of bounds already, so I won’t talk about that. πŸ˜›

    The most part was on Amazon Web Services (AWS). It’s pretty interesting how they had created a variety of products from technology and be able to monetize it, but I think the concept of utility computing is still at its infancy, or maybe early teens. The huge complexity here is the billing. Amazon bills for memory, CPU, disk, I/O bandwidth, etc. That’s a pretty exhaustive way to suck your money! I’d much prefer a billing scheme more like my mobile phone where I pay a flat rate a month and get billed some extras. While the aggressive billing ensures low contention on AWS, it is not economically viable for small companies to jump on it yet.

    There was a fair bit of discussion about pricing. Surely the sales folk looked uneasy and was all ready to stand up and defend himself, but let me add a few words in their defense – real bandwidth is expensive. A 1 Gbps “dedicated” link costs upstream providers like SingTel IX and StarHub IX an average of S$10,000 per month. We may find AWS slower here because of the latency we get transiting our Tier 2 providers (SingNet Broadband, StarHub MaxOnline) taking the cheapest (and thus longer) routing paths. We all think BGP is a distance algorithm, but in reality it can be easily manipulated using a technique called AS-prepend and policy-based routing.

    If you want to read about bandwidth, I wrote an old blog entry here.

    Most of our servers here load up slow in the US for this matter, so if you have a business that wants to reach millions around the world, you will probably not want to host it in Singapore, and when you start thinking of deploying overseas, manpower (or your time and air ticket) alone would make you think about switching to AWS instead.

    P.S. My angmor is getting from bad to worse. I didn’t realize I was writting terrible Engerish until I read some very old documents I wrote back during school days. This is what the working society does to you! Argh!@#!@

  • Good Old Games

    I was at the arcade in Bugis for a short while after dinner. I’m not exactly an arcade guy because the noise level at most arcades are on par with an idling Boeing 747, but I was there just to look around and made a few observations.

    The most popular games today are the musical ones – guitar, drum, DJ, dance. Some other popular ones are the car racing games like Initial D. Finally there’s a crowd at the corner with old-style arcade games like Street Fighter where you sit down with a joystick and 3 buttons. I call this crowd the one-token warriors, i.e. one token lasts them an entire day.

    Games come and go, some of them are hypes and go away after a while, some really sucked and didn’t even work out, but some good old classics remain. I asked myself, why?

    On top of that, I had two other questions. What was the game companies’ revenue model? Was it one-off, i.e. the sale of the arcade machine, or was it continuous, e.g. profit sharing. I have no answer for this yet.

    So to figure out an answer to my first question, I narrowed down some classic car racing games that I am familiar with.

    Daytona (the original) is really the best of its’ time. It was around since the mid 1990s – that makes the game more than 10 years old to date. This is quite obvious because it still uses the old fishbowl-shaped CRT tubes.

    Daytona 2 is the newer version released in 1998, but wasn’t very popular and slowly disappeared from some most arcades. There’s a version of the machine with motion simulation as well, making the game a little more fun – I think it’s still around in Cineleisure.

    Sega Rally was launched probably around the same time as Daytona but wasn’t very popular. The hardware is the same as the Daytona, but the game play is very different.

    So I asked myself, what makes Daytona so popular that it still exists in almost every arcade today?

    I think it’s simplicity in game play and moderate realism. Here’s where I think the other two games failed.

    Sega Rally was difficult to control and didn’t have the feeling of thrill – it was too realistic, too diffcult and felt slow.

    Daytona 2 had too many vehicles to choose from. While this sounds like a feature from a marketing perspective, this makes the learning curve steeper, requiring more experimentation from gamers to get it right, and of course more tokens which means the game became too expensive. On top of that, it had the speed realism of Sega Rally and also felt slow. The graphics in the background was also excessively distracting, often causing players to miss a turn.

    Daytona (the original) had only one car, two transmission modes and three stages. The car was easy to control and the graphics were clean and probably fantastic at its time an age. Sounds like a magical number sequence, doesn’t it? 1, 2, 3.

    I draw another observation from my visit to the arcade and the three games above – people love games that challenge their hand-eye co-ordination. Actually, that’s probably what most games really do. Thus it is true that if the game felt slow, it isn’t fun to play. Think about it – Counter Strike, Quake, Daytona, the ancient Snakes game in Nokia phones, the new music games in the arcade… they are all the same in this aspect.

    What do you think?

  • MVC Quick Hack in PHP, Tips on Web Development

    Unlike Java, PHP wasn’t designed with MVC in mind, but with bigger projects MVC becomes important to keep code clean and readable. I’m sure a lot of crazy people in the class would have figured out their own MVC quick hack, but I’ll just share mine here.

    • The Model shall remain as MySQL. I’m not going to spend waste time creating beans-like objects because I personally believe beans are inefficient things for retrieving even the simplest of things. In PHP, theΒ mysql_fetch_assoc() function is really all that you need. The web is a stateless thing, let’s keep it that way.
    • The Controller shall be the direct PHP file that gets called, i.e. your URL links to the controller, your form submits to the controller. The controller contains purely logic.
    • The View shall be a PHP file that sits in another directory and gets called using the include() or include_once() function and contains HTML/CSS/JS and some bits of PHP such as loops for displaying content.

    Also, here’s some of my personal tips when developing public-facing web applications.

    • Do create an error handling routine. You may implement this in any way you want, but I typically use an array and use the array_push() function to push errors into the array stack. If the array is empty, we know there’s no errors. But a simple array can be quite ugly, so you might want to create a data structure to take care of where exactly the error message shows.
    • Always end your files with .php. Don’t end it with .inc or .somethingelse because you will be vulnerable to expose your source code, unless you configured Apache to parse .inc files as PHP. Even so, I’d still advise to keep the suffix as .php in an event the files get deployed on another server with missing Apache config. The lesser moving parts, the better.
    • Always escape your string using mysql_escape_string() before querying the database to prevent SQL Injection.
    • Always take care of integer parsing. I like to use intval() because it doesn’t throw a fatal error. If it sees a string, it returns 0. This also prevents SQL Injection.
    • Always clean up output using htmlspecialchars() to prevent Cross-Site Scripting.
    • Never put filenames as parameters as you can be vulnerable to Path Traversal. Try to use other methods if you need to have filenames passed around, such as server-side sessions or constants.
  • The Second Lecture

    So the second lecture was on Software Engineering. Big word and unfortunately means big problem. The class was introduced to Agile/Scrum which is a newer methodology compared to the old waterfall/spiral SDLC model that I was taught in school.

    I used Agile/Scrum about two years ago in my previous job and my experiences were much similar to the ex-students who presented. I worked with teams from about 2 to 6 in size. Honestly, not many teams can get past 10 pax because of $$$. I must say 80 is an awesome huge group!

    So here’s my observations:

    • The common effort multiplier is between 2.5 to 3 not because people are slow or bad at estimating, but because they did not consider time taken for communication and other context switching overheads. However as the team gets better and better at estimating their effort this multiplier can go down to about 2. Don’t forget, Project Manager doesn’t do the actual work but still gets paid. πŸ™‚ So where does his effort go?
    • The biggest problem with estimating effort is with companies billing by the hour. I was constantly questioned for high estimates (thanks to my 3x multiplier) because it ballooned the cost of a project and I was pressurized to push it down, but guess what? It always overruns, i.e. the original high estimate was correct.
    • Agile works well with small projects too, just that you may not need to religiously hold the daily scrums, but the idea of having broken parts down into bite-sizes is the key to easing project management.

    Wei Man is right. Geeks are bad at estimating effort, but we have to know what it takes to do something so that we can manage ourselves. Time, energy and life are finite and therefore our efforts are finite as well. If you don’t learn the skill of estimating efforts I can 100% assure you that you’ll overrun your projects. This is from a personal experience from not getting paid and even almost being sued. πŸ™

    ***

    On the documentation part, Prof. Ben is right. There’s a job market out there with people writing documentation. This type of job is called Technical Writing. If you’re good with language, maybe this is a job you can pursue. There’s not many of these companies around and their clients are usually huge (Aerospace, Military, etc.) so you get paid pretty decent. Not to late to change courses now.