Category: Technology

  • Buying Mobile Phones in Singapore

    There’s been a piece of news recently where a Vietnamese tourist who made only $200/month had to kneel down to beg on his knees to get a refund of his money for an iPhone 6.

    I think a lot of people still do not understand the ins-and-outs of this trade. Being a victim of similar scams at mobile phone stores in the old days, I subsequently started a business of my own to prove that it is possible to make an honest living.

    There are few very common tricks that people fall into. The simple ones are these: –

    • Adding taxes to list price after the deal is made. Such sellers usually add an additional 7% GST to the listed price, but sometimes the seller is not a GST-registered business.
    • Missing parts, such as charger and earpiece, requiring a top up. This is the scam I fell for.
    • Not getting the device you wanted, i.e. a fake, or a used item instead of a new one.

    The more complex scams is seen in the news above, where a hidden contractual clause would require you to purchase additional items. There’s also another type of scam known as the swap-bait, where you would purchase a device, then test it and realise it is faulty, but have no choice but to pay extra for an upgrade because the faulty item was the “last piece”.

    How to avoid being scammed?

    Be sure to ask for nett pricing, i.e. tax inclusive price. Be sure to ask if all the items are included in the box, such as charger and earpiece. Also be sure to check the lifetime call timer on the item to ensure that it is 100% brand new (if you are buying a new device). Test the device before making payment. Finally, read any agreement carefully before you sign.

    Sometimes the products may not be sealed, and that is OK because it is common for mobile phone stores to buy from a consumer who has re-contracted with a telco (this is called “buy-back”), then resell it. These devices are still considered “brand new in box” (BNIB), but may have a lapsed warranty of several days. This is how these stores are able to offer good prices well below the recommended retail price (RRP).

    The Vietnamese tourist was unfortunate. These are definitely not normal business practices in Singapore. There are many stores around that make an honest living, and I suggest that people do their own research and go to stores that publish open pricing and have a large social following. The top two such independent stores in Singapore are WhyMobile and Mobile Square.

  • Why status fields must die

    I’m sure we have seen this happen: A programmer forgets to add a status = 1 condition/check to an SQL query and the app disintegrates.

    Status fields can be useful in some ways especially if the range of values are large, e.g. to track order status. But the most common use I’ve seen is data retention, i.e. keeping a deleted record. The status field is an ancient way of archiving a record, and this design exists in almost every application I’ve seen, because back in those days schools told us to normalize tables. Some companies even make it a mandatory design requirement to have this field in every table — even in many-to-many join tables.

    We should avoid designing tables with record deletion status fields. Why? There’s many reasons why, and the common accidental omission of the status check is one of those reasons. There are also different data types being used, sometimes highly inefficient for indexing — for example INT, a 32-bit signed integer is very commonly used for storing values 0 and 1. The ambiguity is also a common problem: What does 0, 1 and 2 stand for? Where are these defined? In constants, or cross-referenced to another table? The status check is also an additional condition that the database needs index/filter. What’s worse is that sometimes the check is done at the model layer, while other times the check is done at the controller layer… or maybe both… or maybe none.

    So what’s a better way of dealing with record archival? If there’s really no reason to keep the record, delete it.

    If the record should be kept for some reason, archive it into another table, a technique known as partitioning. It would also be more efficient to search a table containing only records you need to query.

    Partitioning also allows you to tier by storage performance, e.g. place “live” tables on high performance storage, and “archive” tables on slower storage devices. You can also tweak indexing to cater to different search patterns on both sets of data.

    Archiving data is very easy, and is not much more complicated than a delete: If the two tables are identical (in column definition), simply use INSERT INTO … SELECT, then DELETE.

    If you are worried about deletes being I/O intensive, then consider batching the deletes or having a cache. This will depend on how your application is designed.

    (Side note: MySQL 5.1 has a new partition feature that can be used to automagically partition tables, but that is more for performance purposes. This article is discussing a design issue to remove common errors in programming.)

    Edit: Updated Oct 19. Friend asked about status fields that may have a large range of values, such as transaction statuses. These are OK to remain as fields. I was primarily targeting record archival.

  • The truth about power banks

    The truth about power banks

    Ever wondered why your 4,000mAh may not even charge your 1,570mAh iPhone 5S twice? Here’s why: –

    Devices consume power (“P”) and that is measured in watts. To derive watts, we need to multiply the amperage (“I”) by voltage (“V”).

    P = I x V

    * Also note: 1A = 1,000mA

    The 4,000mAh rating of the power bank refers to the charge capacity of Lithium-ion cells in the power bank, and that is different from what comes out of the USB port because both operate at different voltages.

    Lithium-ion batteries operate between 3.2-4.2V (stable at 3.7V) while USB devices operate at 5V.

    This means that: –

    • The power bank can only deliver 4Ah x 3.7V = 14.8Wh
    • It will only charge a 5V USB device to 14.8Wh / 5V = 2.96Ah or 2,960Ah

    Now, you must be thinking: “Hey, my phone also uses a lithium-ion cell, so it should convert (back) to the same”.

    It is partially correct to assume that, but power reduction process will likely result in losses (usually in the form of heat) so it is not a 100% efficient process.

    The power bank itself would also be stepping down (or stepping up, depending on  design) its voltage. If it’s cells are wired in 2 series, it would need to step down from 3.7V x 2 = 7.4V to the USB output voltage of 5V before you can use it to charge your phone.

    With two devices stepping down power (Power bank > USB > Phone > Phone Battery) the efficiency can be as low as 64% (80% x 80%).

    So as an example, to charge a 1,570mAh battery in the iPhone 5S, we will need a constant 1.57A x 4.2V (charging voltage of li-ion) = 6.594 watts.

    Assuming both the power bank and phone are only 80% efficient at converting the power, this would mean that the power bank must deliver at least:

    6.594W x 1/(0.8 x 0.8) = 10.3W

    10.3W / 3.7V = 2,784mAh power bank is required to charge an iPhone 5S

    Also remember that while charging your phone, the phone is likely to consume some power during the process even if it is completely powered off because it has to regulate the charging process, alternating between charging and measuring the charge state of the battery. This is required to protect the battery in your phone from over-charging.

    Another thing to know about is charge rate (“C”). The higher the charge rate, the faster it charges. At 1C, a battery will be fully charged in an hour. At 2C, it will be charged in half an hour.

    Most phones are designed to charge between 0.5C to 1C to ensure maximum lifespan of the battery. This means it will take between 1 to 2 hours to charge. Charging lithium-ion batteries above 1C may shorten its lifespan (and that’s why you should not use cheap docking chargers or avoid “quick” chargers.)

    Why should you care since the phone is already regulating the charge rate for you? That’s because the charge rate affects the current draw on the power bank.

    If a 4,000mAh power bank claims to provide a 1A USB charging port, it means it should deliver 1A x 5V = 10W of power constantly.

    To charge an iPhone 5S @ 1C would require at least 1.57A x 4.2V = 6.59W (before efficiency losses). If we factor in efficiency losses @ 80% for both the power bank and the phone then 6.59W / (0.8 x 0.8) = 10.3W. That’s approximately 1A!

    For a bigger device like a Samsung Note 3 with a 3,200mAh battery, it is likely to be charged at 0.5C. Quick calculation yields (3.2A x 4.2V x 0.5C) / (0.8 x 0.8) = 10.5W which is also just above 1A.

    As you can see most devices require around 1A to charge, but if you are going to be using your phone while charging then the current draw may well exceed 1A and you will need a power bank capable of delivering more. If you use an underrated power bank you may damage (overheat) its internal voltage regulators.

    Lastly, if you are charging your phone, try not to use it at the same time as doing so might also put too much current through the phone’s voltage regulator causing it to fail prematurely. This is especially common on bigger phones. If you feel your phone getting hot, it’s a sign to stop. Depending on phone design, you may have to change the entire logic board.

  • What to do with old computers

    What to do with old computers

    The staffs in the office got new laptops last year (thanks to the government’s PIC grant) but the stockpile of old hardware became an eyesore. What should I do with them?

    I found out that one of my friend’s a volunteer worker and needed computers for needy families, so I decided to spend my NDP weekend sorting out them out. I thought it was going to be an easy job, but turned out it burned my entire weekend.

    Me and my wife started late Saturday afternoon and missed the National Day Parade. We worked till 12:30am and decided to continue again on Sunday (today), and it’s still not yet done. There’s still two more computers in the queue.

    donation1
    Piecing together parts from an old “beige box” 2U server and desktop to make a working computer.

    The problem was that the computers left sitting started to degrade — CD/DVD drives, hard drives, motherboards, graphic cards all started to fail. So the tip here is that if you have a computer you do not want any more, wipe it ASAP and donate. Some of these computers are over 10 years old (Pentium 3!), so it was amazing to see them still working.

    The inside of a 14 year old HP desktop (manufactured in 2000). Not a speck of rust.
    The inside of a 14 year old HP desktop (manufactured in 2000). Not a speck of rust.

    I was also impressed by how well the old HP desktops held up after 14 years. These thick, sturdy steel cases must have been galvanized because there’s not a single speck of rust on them. Machines (including servers) these days are no longer made to such high standards and feel flimsy.

    There were also old networking equipment up for grabs, but I could not see how a needy family would need a 24-port switch, so I found another friend who might have a use for it by sending it to schools in Cambodia.

    Old 3Com Superstack switches, hopefully to be donated to schools in Cambodia.
    Old 3Com Superstack switches, hopefully to be donated to schools in Cambodia.

    The last problem I need to solve would be to get working software into these machines. Some of the PCs had OEM Windows XP (luckily we kept all the original CDs).

    Update: The list of hardware to be donated have been distributed and they have been collected, albeit slowly. But it definitely feels good to know that it is going to somebody who needs it, rather than a karang-guni man who will probably just scrap it for parts.

  • Building another Joomla or WordPress site?

    Looking to build a website for your business? You have been warned.

    Somebody I know had her company’s site done by one of those companies selling Joomla or WordPress ‘packages’. When she saw the end result, she face-palmed. When I saw it, my reaction was pretty much the same. The site was riddled with horrid mix of serif and sans-serif font, bad alignment, varying font sizes, etc.

    For about $2,000-$3,000 dollars you can have these people build you a Joomla or WordPress site, but you really pay only about $800 for it because the government is helping you pay the other 60%, or about $1,200 via the Productivity and Innovation Credit (PIC).

    No, this is not a blog entry to advertise the PIC. There’s rampant abuse of the PIC scheme, and it has actually created a lot of crappy work (and IMHO, crappy jobs). Not to mention photocopiers selling for $15,000 with “cashback”.

    A lot of these web “design” companies are selling you nothing but pre-built templates reused over and over again. No surprise all their client’s websites look pretty much the same. With some changes to color and images, bingo! They’ve transformed the template into your website.

    But wait… it still looks like crap. Why?

    A lot of ‘designers’ are really just ‘developers’. Designers come from art school. Developers come from IT school. A lot of these designer-developers don’t even understand basic typography, let alone color theory, or help you with illustration or photography. And if they aren’t good in English, expect your site to be riddled with grammatical and spelling errors.

    When you engage a proper web design firm you actually are paying for a lot of things. A good company will actually advise you on the kind of content or site structure you should have, and also be able to provide additional services like copywriting, photography, illustration, etc. A proper design firm needs to hire both designers and developers, and they’ll also need somebody to manage these two very different groups of people and ensure they don’t kill each other.

    If you are really looking for a cheap solution you can actually buy beautiful templates off sites like Template Monster for a fraction of the money, then engage a freelancer to help you add content and deploy it to a hosting provider.

    You’ll want to choose a template with the similar color theme and typography as your corporate brand. You don’t want to mess with colors or fonts — that’s a job for designers.

    Nowadays the first impression people have of your company is through your website. Don’t underestimate the impact a website might have on your business. Messing a website up is as good as messing with the signboard and interior design of a retail shop.

    One final word of advise — make sure you get a company that can support you through upgrades and security patches of the CMS you use (WordPress, Joomla, Drupal, etc.) preferably one that provides hosting service as part of the package. Most people with Joomla sites built a few years back would have had their site ‘hacked’ by now due to security issues (I’ve dealt with a lot of these cases). If you must, choose WordPress. It’s better than Joomla in terms of security.

    It’s really 一分钱一分货.

  • Peer to peer car sharing in Singapore – is it really working?

    I’ve always wanted to make car sharing possible – there are two ways to go about it.

    First method: I would announce my travel plans and pick somebody going the same way as I am. In return I will get paid a token sum to ferry my passengers. I call this “Taxi style”.

    Second method: I rent my car out for profit. In short, it’s plain old private car rental. This is actually working in the US, see RelayRides.

    One problem with private car rental in Singapore is legislative restriction. At present, private car rental is only allowed on weekends or public holidays.

    The other problem is insurance coverage. Both methods of car sharing I described are classified as using the car for hire or reward. Hire/reward is explicitly prohibited on almost, if not all, private car insurance policies.

    Believe it or not, I called almost every insurance company in Singapore trying to see if rental coverage was possible. The answer was NO. Some did cover rental fleets, but the fleet size had to be considerable and it had to be a business.

    iCarsclub collaborated with DirectAsia to get the insurance problem resolved, so it is really very interesting.

    I decided to conduct an experiment.

    I signed up as a car owner. I did some research, and listed my car up at a very reasonable rate – $7 per hour, or $55 per day.

    My friend wanted to rent my car for the weekend, so he had it for 3 days on this long weekend (May 24 to May 26).

    The catch is this – fuel costs are borne by the car owner. iCarsclub in return charges the renter for mileage ($0.30/km). The renter also needs to pay for insurance coverage ($0.40/km).

    At the end of the rental, the bill came up to $326.83. The breakdown as follows:

    • Mileage traveled: 232 km
    • Booking fee: $2.00
    • Rental fee: $165.00 ($55/day x 3)
    • Mileage charges: $69.60
    • Insurance: $86.80
    • GST: $3.43

    iCarsclub takes a 20% commission from the rental fee.

    Insurance premiums are paid to DirectAsia.

    As a car owner I would only receive rental + mileage = $201.60.

    I also had to pay for the fuel, estimated to be about $60.

    On top of that, I have to pay for the SIM card in my car tracking device. That costs $39/mth.

    The result?

    • Car owner earns: $102.60 (31%)
    • Petrol company earns: $60.00 (18%)
    • Telco company earns: $39.00 (12%)
    • Insurance company earns: $86.80 (27%)
    • iCarsclub earns: $35.00 (11%)
    • Government earns: $3.43 (1%)

    It seems like businesses are the ultimate winners here. The owner actually receives less than a third of the amount.

    As a renter, there’s no price advantage. My car is already priced very low. My friend could have rented a similar car from a rental company for equal or less without worrying about the mileage based charges killing him.

    And because of the fixed mileage charges, it gives the renter no incentive to save fuel. He could go full throttle on the car all the time, or even abuse the fuel card.

    As a car owner, I am not sure if the amount risks I expose myself to would justify the $100+.

    Every car owner would have to sign a 2-year contract with iCarsclub, so my car would remain in their inventory for another 2 years. There is also a refundable deposit of $300 I had to pay. Breaking the contract would forfeit my deposit.

    Right now I think the pricing scheme needs to be tweaked. I am trying to get in touch with them to see how it can be improved. I am also hoping LTA’s announcement to liberalize private car rental on weekdays would come true.

    I am not discouraged yet and will continue to rent my car out to see how this whole scheme works out.