Category: Technology

  • Oppa PHP Style

    It’s been some time ever since I’ve done much serious coding and decided to get myself updated… with Korean music.

    Just joking.

    I’ve been doing some research on PHP frameworks. My primary requirements were that the framework supported MVC (most do), is capable of friendly URLs, is simple/easy to use, provides basic wrappers around security (such as XSS and SQL Injection) and most importantly it must have good online support and resources.

    I pay particular attention to documentation as it plays an important part to help developers quickly learn/adopt a new framework.

    I spent many hours over the weekend reading documentation, installation guides and watching tutorials and eventually settled for CodeIgniter. I found it quite complete and particularly easy to learn. It is well documented, has a good tutorials and did not require that I learn a new template syntax. Above all it deploys really quickly with minimal configuration.

    I would like to bring your attention to the Style Guide in the CodeIgniter User Guide. It is very detailed and contains a lot of good coding practices, especially on how braces should be (opening on a new line instead of on the same line) and how PHP tags should be opened (and not necessarily closed). I suggest that PHP developers follow this style guide.

    There’s also an add-on to CodeIgniter that I would recommend and that is Grocery CRUD (Create, Retrieve, Update, Delete). Grocery CRUD makes it extremely easy to create a simple maintenance screen for back-end data, especially for short-term projects. It’s certainly better than sending users to phpMyAdmin.

    Finally, just to share, here’s my version of .htaccess file that I use to remove index.php from the URL. It is largely similar to the example by CodeIgniter with an additional exception for CSS and JavaScript files.

    RewriteEngine on
    RewriteCond $1 !^(index\.php|images|user_guide|robots\.txt|(.*)\.css|(.*)\.js)
    RewriteRule ^(.*)$ /projects/ci201210/index.php/$1 [L]

    That said, I have only done research and not actually used the framework on a full project yet. I’d love to hear any comments and/or recommendations you have.

  • Power Hungry

    Somebody once told me: Once you’ve driven a more powerful car, you won’t turn back. I guess thats really quite true.

    I’ve gone from my first car — a Nissan March (Micra in other countries) 1.0L to a new 1.5L Nissan and then to my current 2.0L BMW. I also used to drive my dad’s 2.4L Volvo when I first got my driving license. Power was never enough.

    The feeling of a vehicle with power on the tap is hard to describe. Many who have not driven a more powerful car may not understand and relate power with the need for speed. Of course I’m not talking about a Ferrari or a Bugatti but a normal road vehicle with sufficient power pulls you away safely in situations when you need it. In general, my personal figure is at least 100hp/tonne or more.

    I was in Melbourne a few years earlier where I rented a Holden SV6 3.6L V6 to drive up the Great Ocean Road. There were four of us and a boot full of luggages easily adding up to about 400 kilos but the car was still simply amazing to drive. It goes around the mountain roads effortlessly and merges with freeway traffic with ease.

    I specifically remember an exit from a farm road to the main freeway where I had to make a right turn (RHD in AU — which means I had to go across one direction of traffic before merging with the other). There was no way I could have waited for the right time to get on the freeway if I had been driving a 1.6L Toyota as there was simply too much traffic going at 100kph on the freeway. I waited for several minutes and found an opportunity where there was a gap in the traffic caused by a slow moving truck. I simply got on the gas and the car went right off and made the turn to merge with the traffic.

    I’ve had the opportunity to drive serveral new cars recently, namely the Audi A4 1.8T, VW Scirocco 1.4T, VW Polo 1.2T, Mini Cooper S 1.6T and the BMW 320i (F30) 2.0T. These are all amazing cars with turbocharged engines and they have loads of torque almost immediately off idle and are such a joy to drive even in our city traffic. In my opinion, there’s no reason not to consider these modern TC engines over the NA ones except for long-term reliability.

    Given the power improvements AND fuel economy, these turbo engines will be the future until a more efficient energy source after fossil fuel is found. At this point we have squeezed almost every bit of energy from gasoline and diesel. Hybrid or pure EV cars aren’t very practical yet IMHO. The need to wait a considerable amount of time to charge a battery makes it pointless. Some may argue: that’s nature and nature takes time to regenate (just like land for growing crops), but I am not at all convinced that electrical power generation is efficient given that most parts of the world still rely on some form of fossil fuel for electrical energy and the carbon footprint of setting up the entire electrical distribution infrastructure isn’t likely “CO2 friendly” either.

    Speaking of long-term reliability, modern NA engines are made of lightweight aluminium or magnesium alloys and they tend to give way under stress and heat. Weight plays a critical part in fuel economy since basic physics defines Force = Mass x Acceleration. There’s only so much force a gallon of fuel can provide and apart from reducing any frictional losses, the next step is to reduce the weight (mass) of a car. The engine is sometimes the heaviest thing in a car after the passengers (LOL) so auto manufactuers do put considable effort into reducing weight.

    The good news is that some of these modern TC engine blocks (especially VW/Audi) are still made from traditional cast iron and that might help them last longer. I am not entirely sure at this point but it seems that the BMW N20 2.0 TC engine found in 20i and 28i models of 2012 BMW vehicles (possibly also Mini Cooper S “Prince” engine) seem to be made of aluminium alloy. If that’s the case then that may be bad news given the history of the aluminium N46 engines developing gasket leaks past 60,000 kms.

    Nevertheless, most people don’t really keep their car past 5 years so auto manufacturers don’t emphasize on long term reliability like they used to in the good old 80s. Long term reliability is quite different from short term reliability. A simple example would be a transmission that could withstand loads of torque (short term) but rusts and leaks after some time (long term).

    Sometimes I wonder if all the talk about green technology gets defeated by consumerism.

    That said, one of my dream car is an old 1987+ BMW E30 320i. If I had time and money, I would almost certainly buy one and have it nicely done up. Unfortunately the car would be frowned upon by my government and I will be slapped with a 50% increase in annual road tax. Given the current COE prices, looks like I may never get to buy one unless maybe… I move out!

  • Real World Technology

    I’m leaving for Sydney later tonight and will be flying on the Airbus A380. I know we’ve heard about wing cracks on the A380 and wifey was just getting a little paranoid that we’re going to fly in a potentially cracking aircraft tonight.

    So wife’s paranoia* got me reading up on the cracks.

    * I’ll have to convince her it’s safe to fly or she’ll squeeze my arms so hard on take-off that blood just stops flowing.

    Anyway just to quickly summarize, the cracks were small hair-line cracks in the feet of ribs in the wings. This was a result of using newer, lightweight materials to save weight and improve fuel economy.

    If you make an aircraft bigger, it gets heavier so you’ll need to make the wings bigger and the engine more powerful. It’s only natural that fuel economy takes a hit.

    The automotive industry works similarly – the easier way was to make things more aerodynamic and lighter so that fuel economy improves, but with newer safety standards this is starting to become a challenge. Making an engine do more work with less fuel was the difficult part.

    The aircraft turbofan is already very efficient (at cruising speeds) but automotive fuel-saving technologies still has some ways to go. Nevertheless, the automotive industry has seen some pretty awesome new technologies in the past decade, which explains why I am such a fan of them.

    But I’m not going to talk about cars today. This brings me to another point: What drives technology?

    Technology is an integral part of our evolution and my belief is that real world needs are the main drivers of good technology. Unfortunately for the folks who would like to believe everything new is good, I do not believe its true. Good technology is not just any new technology, but technology that works to solve a real world problem – hence my love for automotive technology. In fact, old technology can sometimes be better than new technology.

    I think that aviation and automotive industries are two of the major drivers of technology; if not for space flight and aviation, we wouldn’t have GPS, accelerometers and gyroscopes in the iPhone today.

    In the recent years the automotive industry has gained a lot of traction. We’ve seen new engine technologies that improve both power and fuel efficiency, reduced emissions and new gadgets that improve safety. These are technologies put to real-world tests in everyday use, and these technologies are what I believe where the real money should be.

    Not social networking. Not group buying. Not building some iPhone app.

    Of course, these are just my personal opinions.

    In today’s fast-paced environment we are distracted by the Internet. Our thoughts are becoming more and more shallow and short-sighted. Most new technologies are built around dreams and desires rather than real needs.

    I’m not downplaying the importance of dreams but I my worry is that many are headed towards building dream/desire and we’ll soon be starved of real talents to serve our needs – and I think it’s already happening right now in our society.

    If you’re thinking of building the next big thing, give a few minutes to think about what I just wrote here.

  • MP4 videos on my bedroom TV!

    Just found out that the (not so) new 32″ Panasonic LCD TV (Japanese technology!) in our bedroom plays MP4 videos from a USB flash drive flawlessly! I wasn’t able to play AVI videos with all sorts of weird video codecs in them – usually DivX.

    I find the new LED TVs too bright and contrasty. Colors didn’t appear natural and I got this “old technology” LCD TV for $399 a few months back. It’s awesome and in fact very ideal for bedroom use as the lights in a bedroom are usually dimmer. Please grab them before Apple starts making TVs with iTunes built in that costs $1,488 or something like that.

  • Screw you, PayPal. You are off my list.

    I am absolutely pissed. If I’m an ass I can basically go and reverse any PayPal purchases I’ve made and I’ll get away scott-free thanks to their “consumer protection” policy.

    I’ve had customers who received their orders, signed on the SingPost consignment note and then later did a charge back on their cards. Not only did PayPal honor the payment reversal, they still charged us the payment processing fee.

    This means if the transaction was $1,000, I not only lose $1,000, I’ll still have to pay PayPal ~$40 (~4%) for payment processing. What kind of logic is this?

  • Why is everybody building an iPhone app?

    I’ve had many many self proclaimed wannabe entrepreneurs approaching me with “compelling” iPhone app ideas, and oh, it’s top secret – before they breathe a single word about it I’ll have to sign a 3,112 page NDA so in an event that somebody else has the same idea I can be brought to court and made to compensate billions.

    What is it with iPhone apps, really? Even SMRT released an app and had a press release for it. For what? Can’t they just post disruptions on Twitter and Facebook – which I think they already do? Why build an app? They think my grandmother has an iPhone? An app is not the solution. A proper announcement system and staff training is.

    The phone and mobile apps are just technologies and delivery mediums. Building a product around a technology is a wrong start. Technology should be built around a product instead. A lot of “app” pitches I’ve heard have no real value. Technology alone does not sell a single cent. It must solve a real world problem. Would you buy an app because it could, for example, switch on your microwave at home? Has remotely switching on a microwave been a need for housewives?

    If you’re reading this and thinking of building an app, please look at the product as a whole. If it’s just another one of those apps, I think you may be better off spending your time and money (app developers charge a really crazy sum BTW, just because it’s HOT) building a real product with a HTML5 site that will truly scale when the need arises… at a fraction of the price. If you are a business owner, don’t derail your core business by focusing on apps and whatever technology trend that comes along.

    Sometimes no technology is the best technology.