Category Archives: Technology

Picasso and null path to image

Found something very odd when programming my Android mobile app today. I am aware that I should not provide a null path for Picasso to load. Hence defensive statements in my code to make sure that Picasso would not get to load a null path. But somehow my app was still crashing, with the following error:

    java.lang.IllegalArgumentException: Path must not be empty

And the error was pointing to the line where the Picasso call was located:

Picasso.get().load(“null image path”);

Even when this line would not be run, which I have checked, it was still giving me problem. Turns out that my defensive statement allowed non-null image path to happen first, as below:

if (imgPath != null || !(imgPath.isEmpty()) {
    Picasso.get().load(imgPath).into(imageView);
} else { 
    Picasso.get().load(placeholder).into(imageView);
}

If I swap the defensive statement around, such that imgPath == null is checked first, then my app will run okay. Very odd. Anyone kind enough to explain to me what was that about?

Adding data to Firebase using custom objects

I’m fairly new to using Firebase, and their nosql type databases. It did take me some time to understand how data is arranged, with collections and documents.  When developing my application, in Java, I created a class for storing data, a.k.a. POJO. What is unclear from the Firebase documentation is how the fields in a document will be named.

There is a line that says this: Each custom class must have a public constructor that takes no arguments. In addition, the class must include a public getter for each property.

I initially did not pay attention to this public getter, i.e. a get method for each property in my object. Of course it is good practice to always create all the methods when creating a class. I was lazy, thinking that I only add them when I need to use them. Then came the interesting bit, where even after all the properties in my object had been initialised, and added to the Firebase document, some properties went missing in the database. I found it very odd. I initially thought that the fields in a Firebase document would be added according to my Java class, and following the naming I used in my class. But that was not the case. Dug a bit deeper, and it follows that if my getter method is getImgPath(), then the field in my Firebase document will become imgPath (note the upper case for “I” becomes “i”).  And without a getter method for property, then you will have a missing field in your Firebase document!

Hope this helps for those who are wondering how a document in Firebase is populated using custom objects.

Migration of WordPress website to another web server

Okay, I have done this before, over 10 years ago. Here I am doing it again. There are plenty of guides around on the Internet that can help with this process. I am just making a note here:

  1. Zip up the whole document root directory. On CPanel’s File Manager, select all and then click on “Compress”.
  2. Export mysql database that corresponds to the WordPress website, and say you name the file as wp-db.sql. You can zip the file to make it smaller if you want.
  3. Transfer these two zip files to the new webserver, e.g. /var/www/html. You can use wget to copy the files from existing web server to the new web server.
  4. Unzip the files.
  5. At this point, you won’t be able to access your webpage yet. Because the mysql database records, from your website, need to be placed into the new mysql server. This requires that you create a new database on your mysql server. To do that run this command.mysql -u root -p

    Type the master password, then type the following command.

    CREATE USER ‘wordpress-user’@’localhost’ IDENTIFIED BY ‘your_password’;

    Here replace wordpress-user and your_password with your username and password. You can refer to wp-config.php for the username and password you have used for accessing your WordPress mysql database in the previous set up.

    Run this command to create a new database.

    CREATE DATABASE ‘wordpress-db’;

    Here replace wordpress-db with your database name, which again you can refer to wp-config.php in case you want to keep the same name.

    Now grant full privileges for your database to the WordPress user that you created earlier.

    GRANT ALL ON wordpress-db.* TO ‘wordpress-user’@‘localhost’;

    Now flush the database privileges.

    FLUSH PRIVILEGES;

    Exit mysql

    exit

  6. Import the mysql database, that you unzipped earlier, into the new mysql server’s wordpress-db database you just created.mysql -u root -p wordpress-db < wp-db.sql
  7. To allow WordPress to use permalinks and .htaccess file run this command.sudo nano /etc/httpd/conf/httpd.conf

    Find the section that starts with <Directory “/var/www/html”> using the scroll key of your keyboard.

    <Directory “/var/www/html”

    AllowOverride None

    ….

    </Directory>

    Here replace “None” with “All”

    AllowOverride All

    Then save and exit the editor.

  8. You should now be able to access your website by typing in the IP address of your new web server. Next the DNS name servers need to be updated to point to the location of your new web server.

Transferring web hosting service

It’s been a while since I last blogged. This time it’s about time to renew my web hosting service. At this current economic climate, USD200 for two years of service seems like a lot now. I have gone through web hosting service provider change for a number of times. But I still managed to get the DNS wrong, somehow. It should be a simple straightforward copy from the previous hosted zone file to the new service.

Okay, for my own record, as well as for others as well I guess, I have complete control over my web server now. I always have about two websites to manage. But as I figured out lately, it is called name-based virtual hosting that I have been using. So web access to my website will be based on domain name, not IP address. Because I have more than one websites hosted based on just the one IP address, accessing the IP address would not return me the desired webpage. The virtual host configuration is such that access, based on domain name, will get served documents from the document root as stated in the configuration. Okay this is clear to me now.

However, when managing my hosted zone, for domain name translation, I used a CNAME record for www (i.e. www.mylearningdiary.com) that pointed to the IP address of my web server.  That gave me a NXDOMAIN error, or non-existent domain error, everywhere. I initially thought that was to do with propagation delay after switching the DNS, at the registrar, to point to the new domain name servers. This is well known, so I patiently waited, and checked, and tested. But still couldn’t access my website. After a day or two, I trawled the Internet, and then started using dig, a network administration command-line tool for querying the DNS, which I have used before long time ago, to check what was going on. Dig is more helpful than nslookup, that it not only showed me the error, but it also showed me that I actually got the IP address returned when querying for the www CNAME record. That was useful enough for me to know that my DNS servers were responding to the CNAME query, just not good enough for me to reach my website. Instead of IP address, the domain name, i.e. mylearningdiary.com, should be used for the CNAME record.

Now the website is finally back up running again,  I need to try setting up the mail forwarding. Hopefully without me having to set a mail server.

Nam Heong is someway behind from 25 branches by 2020

Bumped into this news article dated back in 2017, where it was claimed by the owner of Nam Heong that he will be opening 25 branches by year 2020: Nam Heong to open 25 branches

Robot waitresses in Nam Heong
Image via Marcus Pheong / Malay Mail Online

Few months ago I noticed that the flagship Nam Heong in Ipoh was closed. Till today their website is still showing the shop on its store locator page.

Nam Heong Store Locator

Including this flagship, there are currently still only 10 branches in Malaysia. Someway away from the targeted 25 branches by year 2020. Are we going to see many more opening next year? It is already December 2019. And I have not seen robots taking over waitressing jobs in any of the Nam Heong shops, yet..

 

 

RHB login page looks like phishing page

Got very nervous yesterday trying to login for RHB online banking. Googled for “RHB login”, which many people do because the exact URL is difficult to remember, clicked on RHB Online Banking (see screenshot below) and I was presented with a login page.

RHB from Google search.

All very good, except that when I put in my username, the wrong secret word appeared! So does it mean I have landed on a phishing page, which I have been repeatedly warned by banks about such risk before?! For a moment I thought these scammers have taken over my browser! You see, I’m not the alone person using my PC at home. Who knows what other members of my family might have done that could lead to my browser getting compromised? So I went on to click for more information about the site URL. And it showed that I was indeed connected to the legitimate RHB banking site, owned by RHB Bank KL. So what was going on? I was still presented with the same wrong secret word however many times I tried.

rhbgroup.com site security information.

Then I remember that I have logon from rhb.com.my before. Used Google search and found this URL instead – https://logon.rhb.com.my. Again I was presented with a login page (see below or click to enlarge), that looked almost exactly the same as the one at https://rhbnow.rhbgroup.com/kh/ which I initially landed on. When I put in my username, the secret word I got was correct this time.

rhb.com.my login page.

I nearly wanted to report this to RHB. Clicked on the call button, to then realise that this damn page actually is for RHB bank users in Cambodia (see below or click to enlarge)!

RHB Cambodia login page.

It seems that RHB is trying to merge their sites to be all under rhbgroup.com. It is a logical idea, rather than having to keep maintaining different domain names for RHB in different countries. But trouble is, RHB has done poor job in linking the login page for users to logon to. I have no idea how I can be led to the Cambodia RHB login page. They need to sort this out quickly, otherwise they are bound to receive many calls about their “phishing page” lol.

Park@Perak how-to

Park@Perak is a e-parking coupon app developed to make it easier for Perakians to pay for their parking fare when they park their vehicles in designated space for parking. Before this, we need to buy books of parking coupons and keep them in the car so that we can use the coupon when we need it.

Okay, how is the Park@Perak app any good for us?

1. We don’t need to look for a shop that sells parking coupons when we run out of parking coupons.

2. The app will notify us 5 minutes (sometimes 15 minutes?) before the time is up for the e-parking coupon. Then we can purchase more e-parking coupon to top up our parking time without having to rush to our car to scratch more parking coupon(s).

3. No need to use any more paper parking coupons. Hence more environmentally friendly. And no need to throw used parking coupons away which can accumulate in our cars

4. In the event that a traffic warden mistakenly gave us a parking ticket, we have records of our parking coupons in our app to challenge the decision.

All good. The only downside as far as I can see is I seem to be paying more than I normally would when using the app. You see, sometimes I leave used parking coupons on the dashboard to try to get away from using any parking coupons, especially when I ran out of parking coupons, or when I just needed to make a short trip to the shops from my car. I guess I can still try my luck sometimes, but so far I very religiously use my parking credit after I’ve parked my car. Perhaps it’s fun to use the app, for now lol

The following is a simple how-to for the app. There is a manual in Bahasa Malaysia from the official app website. But I’ll briefly run it through here in English anyway:

  1. Registering when you use the app for the first time.

You’ll need to fill in personal details like name, IC number, telephone number, email address and password.

  • 2. Login to the app using the IC number and password that you have just provided in the previous step.
  • 3. Load credit to the app before you can pay for the e-parking coupon. You will need to have an online bank account, which you have access to, and put in at least RM10. The way to access your bank account is via FPX.
  • Do follow all the on-screen steps, and don’t abruptly exit any of the step to avoid money being taken away from your account but is not loaded to the app yet. This happened to me once when I clicked on “Done” at the bottom of my screen.
  • I was brought straight back to the app and the app didn’t like it as it interrupted the flow of the process. So money was taken from my account but it did not appear in my app. I had to complain using “Bantuan” available in the app.
  • 4. Add your car number plate for the first time.

  • The car number plate will be saved in the app so you just need to choose which car you want to purchase e-parking coupon for (you can have multiple car number plates saved in your app).
  • 5. Using the credit for parking.
  • You will need to choose the municipal you are in (the rate is unified across all municipals in Perak to be RM.30 for half an hour parking), the car and duration you want to pay for. Note that for half hour parking you need to choose 0 hour first because by default the app shows one hour duration to pay for. If your time is about to run out, don’t separately pay for another parking coupon using the steps above. Click on “Tambah masa” (see picture on the right above) instead. If not there will be overlap in time between your previous parking coupon and the one you just paid, thus losing out some parking time lol
  • Okay I think that’s about it about the app for now. Do chip in if you have any other useful advice.
  • Rubbish Maybank cash depositing machines

    Frustration! I have been checking my Maybank account for the past few days, because I have had a cheque deposited to my bank account, and I need the money. Banked in on Thursday, before 4pm. Everywhere on Maybank website it states the cheque will be cleared by the next business day if the cheque is deposited before 4pm. I was expecting money to appear on Friday, night. But nope. Perhaps my was deposited too close to 4pm. And their clock was rubbish. Gave them benefit of a doubt. But Thaipusam on Monday. So latest by Tuesday, surely. Nope, perhaps it really does bloody take 3 working days!

    Okay it is Wednesday today. Called them up. So there was no cheque floating in my account, at all. BTW this does not appear on their Maybank mobile app. Only desktop’s version of Maybank2u will it show. The customer service rep told me to call the local branch instead. Telling me that most likely the cheque was rejected. Okay called up my local branch. They didn’t know why too, and the cheque was physically not at the branch, because all cheques deposited into an ATM are sent to KL for processing. When a cheque is rejected, it will get sent back to the branch. So my cheque was caught out between KL and Ipoh and excitingly nobody knows why! I called up the main customer helpline, again, to ask for a number where I could find out the status of my cheque, in this case the KL cheque processing department. Called the number (03-20747956) nobody answered. Called the main helpline again, and was given three more numbers – 03-20748042, 03-20747338 and 03-20747068. Bloody hell, all four numbers, including the one was given earlier, no answer whatsoever. Maybank seriously screwed up here, even their people don’t know their numbers don’t work anyway.

    Okay the branch called back, I was told the cheque was back at the branch. The reason the cheque was rejected because my account number was not written on the back of the cheque. So they did not know which account to bank the cheque into. Alright, before you shoot me for silly mistake like this, I have never written any bank account number on cheques when I deposit cheque at Public Bank ATMs. I thought the reason we are required to key in a bank account number at the ATM machine is so the ATM will make a note of which account to bank the cheque in to. This is what the Public Bank ATM does. But not Maybank’s. In fact keying in a bank account number when you deposit a cheque at Maybank ATMs is just to syiok sendiri. It is just for your own record. Maybank don’t care if you key in a wrong account number. Because they don’t use information that you key in anyway. They might as well let customers drop their cheques into a box like ATM machines, like RHB bank, that do not require customers to do this redundant step of keying in an account number. I am shocked, seriously, at how poorly designed Maybank’s cheque depositing machines are. And criminally the poor design misled customers like me into thinking that cheques can be deposited the same way as depositing cheques at Public Bank’s ATMs. Do you think Maybank know how poor their cheques processing service is when compared to other banks (Public Bank and RHB Bank are already mentioned above)?

    Twenty4, South-East Asia’s first smart convenience store

    Just read a news report that there is this smart convenience store, called Twenty4, opened in Ipoh yesterday. It is apparently the first of its kind in South East Asia.

    From what I understand, it is smart in the sense that no one needs to man the convenience store. It is not quite as smart as the Amazon Go supermarket in Seattle where customers can walk in the shop and grab things out from the shelf without having to so much as going to a cashier or a self checkout till.

    Amazon Go, introducing you to the world’s most advanced shopping technology

     

    Basically Twenty4 is a shop filled with vending machines, so to speak. Instead of accepting cash, or coins, like the traditional vending machines we Malaysians are used to, these vending machines accept credit cards! LOL You can use PayWave to pay for items you want to buy, or maybe using your e-wallet too if you have one by scanning the QR code on the vending machine’s checkout display.

    It may sound like it is quite exciting, but actually to think about it, it is just a marketing gimmick. From one of the video I watched, it is not quicker to buy from one of these vending machines than say from a manned cashier in a typical convenience store. Perhaps the difference is there are multiple vending machines rather than just one cashier serving you, so queue forming is not as likely.

    Besides, their claims that they get advertising revenue, from displaying advertisements in their shop or vending machines, I believe, are just trying to give you the impression that the items you buy from their vending machines can potentially be subsidised and thus are cheaper than buying elsewhere. But I very much doubt it. Items sold in convenience stores are typically low value items and it is difficult to negotiate a good price if you are not moving products in volume. (These vending machines can’t store many items, to be honest.) And they don’t sell as many varieties as in a typical convenience store. Moreover, this Twenty4 even occupies a prime space, albeit quite a lousy one, in Ipoh Parade! (I said lousy because it is not connected to the inside of Ipoh Parade. People shopping in Ipoh Parade need to exit the nearest main entrance to get to the store. Not ideal at all.) Perhaps it is a concept store so they can afford to do that, initially. In the long run I believe it will be loss making. The area around there has not a dense enough population (in fact nowhere in Ipoh is dense enough LOL.) There are schools, a shopping mall, and a hotel next to it. But no high rise residential.

    For some reasons Ipoh, full of old folks, likes to get into “smart” technologies, with robot waitresses dishing out food in Nam Heong SOHO, and now smart convenience store with vending machines. Is Ipoh really a good place for testing out new technologies for businesses? Perhaps Ipoh just has more adventurous and loaded entrepreneurs than others.

    Beware of Viu and Digi

    I am so going to flame Digi for allowing services like Viu, which is a video content provider, to appear so easily on customer’s bill. To start with, I did not knowingly subscribe to Viu, which I had no idea what it is about until I checked my monthly bill. Because the amount I need to pay for my “all you can eat” type postpaid plan should be the same every month, so I was alarmed why I needed to pay slightly more end of last month. Then I found this item called “Viu subscription” under my Mobile Services section on my bill. I went to my Digi app, but could not locate this subscription. Phoned up Digi customer helpline today and I was kept in a loop after I chose English language. For some reasons the call just wouldn’t progress past this step to get to a customer representative. So went back to my Digi app, and tried Live Chat instead. Waited over 15 mins for an agent, but then I was told that she cannot unsubscribe me from the Viu subscription. I was told I can email ifoundanissue@vuclip.com or call this number 03-22422991 to unsubscribe. So I asked if she can bar third party services from ever getting subscribed to my mobile phone account in future and she said she can’t do that. Digi has become such a pimp hooking up customers to whores but is unable to stop billing customers even if they don’t want any whore in future ever again. Digi is very brave. Please continue to upset more customers. It will sure backfire on them. I still have no idea how I got this Viu subscription. Perhaps it is one of those SMS sent out by Digi with a link which I might have accidentally clicked on. But still I do not believe customers should so easily be hooked to such a monthly subscription, and it is on auto-renewal basis every month too whether or not you use the Viu service! I’ve emailed Viu using the email address I have been given by Digi above. Will see if they will refund me my RM5. Digi seems to disclaim any responsibility even though I actually settled the bill with Digi, not Viu. This is such a scam. Happened before in the UK with similar services stealthily billed to customers without them knowing how it happened, e.g. free trial of services for one month when customers take up a new contract with the mobile phone service providers but are then charged every month after the free trial period etc. But that was ten, fifteeen years ago. There really is no excuse. Digi is basically trying to scam its subscribers by partnering with such services and then put on teflon shoulder and put the blame back on subscribers for not being careful enough. Will update again tomorrow if I hear more from Viu. I need to know how to unsubscribe Viu quickly so I won’t be charged RM5 every month by Digi, and whether I can get a refund for last month’s subscription which I did not use!

    Update 6/9/2017:

    Turns out that if you manage to speak to a Digi customer representative on the phone, they can unsubscribe you from the Viu service, and they can do a refund on the monthly charge too! This is so different from the answers I was given by the Live Chat agent. There seems to be a serious gap in what the Live Chat agent can do compared to a customer rep on the phone. Think I will give Live Chat a miss from now on. And lastly remember to watch out for your Digi bill!

    Update 8/9/2017: Received a text message today telling me that the Viu subscription has been renewed! This is despite me having made complaints to both Digi and Viu. You see, once Viu sneaked into your bill, and on auto-renewal, it seems very difficult to get it removed! Now I have to make a call to Digi, again, to get them to take this subscription off my next bill. This is so bloody annoying!