All posts by admin

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.

SME loans at 4% p.a.

I have heard a lot about credit available to SMEs at 4% p.a. News also reported that our finance minister Lim Guan Eng urges banks to give cheaper loans to SMEs. But didn’t know how to get that kind of rate.

I recently found out that in order to qualify for that rate, my company needs to get at least a two-star rating from SME Corp‘s  SME Competitiveness Rating for Enhancement (SCORE). You can apply to be assessed online. Just need to fill in the assessment form, and they will try to arrange for a visit to your premise on an agreed date and time.

I’m currently still in the process, waiting for their visit. I guess that is when they will come check all the information that I put in in the assessment form. So remember to get all the supporting documents ready. After the visit, they will have a rating for your business within a week(?). Armed with the rating (at least two-star), you can then approach SME Bank to apply SME loan under Business Accelerator Programme.

Okay, business is turning to the worse this year, with the Wuhan coronavirus affecting travel, F&B businesses and whatnot in Malaysia. Definitely need some working capital to keep our business afloat this time. Serious.

More businesses packing up in Ipoh

It just reflects the tough economic times we are having that more businesses, those that I have had some remote interests in, are packing up.

The Secret Garden, which is located just around the corner after KPJ Hospital has closed, presumably looking for buyer. Earlier last month they claimed that they were closed for renovation, and would be reopened again early December 2019. That did not happen. Let’s see if they reopen for Chinese New Year in 2020.

Peninsula Cafe, which is located on Jalan Gopeng, Taman Chateau’s side, is up for sale too. They are currently still operating, but I saw an advert on my Facebook news feed recently that they are trying to sell their business for RM150,000. The advert seems to have been put up since last month.

Peninsula Cafe for sale
Both businesses are set in a bungalow, with ample of space around. The Secret Garden has been around for ages. The business they run there is certainly more sound than Peninsula Cafe. They try to serve fine dining type food. It is a nice place for a drink in the evening, with live singing as well sometimes. They can do big functions, like wedding. Peninsula Cafe positions itself to be more like a children friendly cafe, but classy enough for adults. They often have birthday events going on there, because they offer some decorations for the occasions. It is a neat value added service, but it is not easy to run a business this way, with tiny tiny parties for couples and all. Rental for bungalow like The Secret Garden is apparently only around RM4k a month the last time I heard few years ago. Still it is difficult to sustain such business. Think wages for workers is the killer, easily in the range of RM20k and above?

Bubble tea businesses are another one that we will see more of them struggling. One I am aware of is trying to be offloaded for about RM100k, after probably 6 months in business? Many predicted the frenzy will die down very quickly. Yet the sentiment did not deter more bubble tea shops from propping up in Ipoh.

My business can barely hold up to last year’s level, which was already nothing to shout about. In a way it is not as bad as some businesses are experiencing. We had a strong second half to thank for, luckily. But having said that this December is the worst December we had so far.. So it is another tough year ahead, again. Happy New Year!!

 

Haagen Dazs has pulled out from Ipoh

Noticed the Haagen Dazs signage had gone missing the other day I went to De Garden. Someone told me that they are renovating, rather than closed as I initially thought. I found it odd that they would take the signage away though if that was the case.

Haagen Dazs De Garden Ipoh

But later heard that Haagen Dazs has completely pulled out from Ipoh. They didn’t relocate to Ipoh Parade, which again turned out to be fake news. My wife actually brought the children to Ipoh Parade hoping to find Haagen Dazs there after someone told her they have moved there! It is unbelievable what some people can come up with.

We are very disappointed that Haagen Dazs decided to pull out from Ipoh, or in fact the whole of Perak. We love the Haagen Dazs ice cream. Much preferred over Inside Scoop also located in De Garden. No comparison for us to be honest, in terms of the quality and also the blend of taste their ice cream. We can keep eating and eating and eating..

When we were in KL, we brought our children to their outlet too. But turns out that the one in Bukit Bintang, by the roadside, is no longer there either. We went to the one in Mid Valley shopping mall. We used to be a member, and thought we are still a member. But for some reasons after they closed down the outlet in Ipoh, they took out members associated to that outlet from their system too!

Can’t believe a city like Ipoh could not sustain a  Haagen Dazs outlet. They had been around in De Garden for so many years. But to be honest their business did seem to have dwindled, and there is more competition in the form of Inside Scoop as well within De Garden itself. But at least they should have just moved to another location, rather than completely closing the only outlet in Ipoh! Argh!!

 

 

 

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.

Nam Heong Soho closed?

You see we Ipoh people very kepoh one. Heard that Nam Heong in Soho Ipoh is no longer opened for business. People are wondering whether it is closed permanently or it is relocating. If you look at their Facebook page https://www.facebook.com/namheongsoho/ it is no longer maintained and previous posts have been removed too. Perhaps like their iMiirage, they are closing it permanently, even though they claim that it is merely relocating.

But having said that, I have also heard that the owners (the bunch who founded Old Town White Coffee?) have acquired a piece of real estate next to Ipoh Parade (opposite MBI) from the boss of Weil Hotel. Apparently they are going to build another M Boutique hotel. So it is likely that this Nam Heong is going to be given a new lease of life in Ipoh again there. Or maybe even the iMiirage too lol Both have been launched with great fanfare in Ipoh, but unable to live up to expectation they set themselves. The robot waitresses with celebrity names did not manage to pull in crowds once the novelty wore off. Not sure about iMiirage. Perhaps not enough customers who want to pay top dollars for rather mediocre fine dining food. Soho on the other hand has defied odds and is now full of bubble tea shops, attracting lots of crowds in the evening. Perhaps it is this crowd that is crowding out business from Nam Heong lol There are not a lot of parking spaces to start with anyway. So I am sure the bubble tea phenomenon is having an impact of some sort on Nam Heong’s business. On top of that there are also other F&B businesses like Texas Chicken, Lanna Thai etc.

Soho

Okay we’ll see in a year or two if Nam Heong is appearing in Ipoh again.