Friday, December 17, 2021

Proluxury PDE001060 dehumidifier will not turn on!

This is the second dehumidifier that won't turn on for me. The first one was a busted tactile switch. I am prettier sure of that because I opened up the dehumidifier to access the circuit board. I was able to short circuit across the switch and the dehumidifier will turn on. First time round, as a spoiled developed-world brat, I just bought another dehumidifier, a Proluxury pde001060 dehumidifier.


This time I also opened up the dehumidifier. Long and behold, another busted tactile switch. I short circuit across the switch pins, and the device turn on.

Took out the circuit board of the dehumidifier.

It actually locked burnt out!

"Not again!?", as my daughter will put it. And as an engineer, this is totally not acceptable, so I go about my journey to fix it. Time for some Googling.

First off, Google Lens. Yup, found images of the switch, but none of the linked sites tell me the model or where to buy it.

Good thing my google-fu is up to snuff. Measure the size of the switch, let's try "6mm tactile switch". 

Is that 5 or 6mm? as I squint to try and red the tape measurer. Good thing digital zoom on phone camera are awesome these days.

Mouser did some excellent SEO, and they are one of the first site to show up. 4 pages worth of 6mm switches. After looking through a few switches, I narrowed it down to the FSM12JH model and it is only HK$1.28! Great! Add to cart, checkout.

Wait a minute, HK$125 for shipping!?

Wait a minute, HK$125 for shipping? Err... That is why Taobao is your friend. CNY 0.5 per switch HK$ 12.31 shipped to Hong Kong. In fact, it was so cheap I am worried that they won't bother with my order, or have some hidden MOQ. I double check with the seller to see whether they are okay to just ship 4 pcs to Hong Kong, and they are okay with that. I end up buy 10pcs, don't know why....

Buy and shipping from Taobao to Hong Kong is so affordable!

Ordered on Sunday 12/12, goods arrived on Friday 12/15. I ordered way more than just the switches, from shops across China, so the shipping took a little longer than if I just ordered the switches. This is expected.
Hohoho! I went a little nuts with the 12/12 discounts.

Busted out by soldering and de-soldering skills.

Fixed!
   
It will be a lot easier to just by a new dehumidifier, but what a waste for just a busted switch. I am glad I gave it a try and managed to fix it.

Monday, November 15, 2021

The infamous Razer laptop battery swelling / bulging

The infamous Razer laptop battery swelling / bulging problem

The infamous Razer laptop battery swelling / bulging. Yes. I got it too. I have own more than 10+ laptop of various brands - Apple, Lenovo, Dell, HP, Gateway, etc., and my first Razer is the only one that I got a swelling/bulging battery problem.

Is it just my luck or razer's quality problem?

Is it a battery quality problem, or just the laptop design will kill any battery?


Swelling battery vs replacement battery


I got a replacement from a TMall Taobao store, which has the most review. I scanned through the reviews and they are look all positive, diverse and genuine. It is definitely not the cheapest, but I do not think going for the cheapest replacement here is a good idea. 

Let's see how long this last and whether I will get a battery swelling problem again.

Saturday, September 11, 2021

Smallest Java hello world web application

  • Requires no dependencies other the Java runtime itself. 
  • Since JDK 11+, you can run the file directly

Monday, May 24, 2021

Withholding tax by country of major markets

Withholding tax by country of major financial markets

Australia30%
Canada25%
China (Mainland Incorporated)10%
China (Offsohore Incorporated)0%
Hong Kong0%
Japan20.42%
Singpaore0%
Singapore REITs10%
U.K.0%
U.K. REITs20%
U.S.30%

Source: https://www.spglobal.com/spdji/en/documents/additional-material/withholding-tax-index-values.pdf

Sunday, May 23, 2021

Most stock pickers loses to the index? Just buy the index. Does this advice work in Hong Kong?

If you invest in the Hong Kong stock market, Tracker Fund (2800) is one of the bigger and better-known funds. Does just buy the index work?

source: charts created from https://www.tradingview.com/

If you invested in 2800 10 years ago (2011-05-16 to 2021-05-17), in the course of this 10 years, you are looking at about 23% capital appreciation. Assuming inflation at 2% p.a., it barely tracks inflation of ~22%. The good news is there is a dividend, and you would have collected 8.01 HKD per share, and this doesn't look too bad.

source: http://www.aastocks.com/en/stocks/analysis/company-fundamental/dividend-history?symbol=02800

Let's look at trading view says when we click the "adj" - adjust data for dividends, and we are looking at about 70% return.

source: charts created from https://www.tradingview.com/

However, if you look at VTI and DIA in US, you can see 2800 really lacks behind:
  • VTI rose 210.92% for the same period
  • DIA rose 173.96% for the same period
source: charts created from https://www.tradingview.com/

Although, past performance is not indicative of future results, given this observation, should we bother with investing in the Tracker fund (2800)? Or any Hong Kong index fund / ETFs at all?

Wednesday, May 19, 2021

Is Kotlin still a good choice for JVM based backend today?

It has been while since I start a new JVM project. I needed to build something quick and dirty, e.g., within a day or two, so I went with something I was most familiar with, Spring Boot, to get the project up and running.

It has been a while, but Kotlin has been the crazy a few years back and I had used it a few times with my previous employer. It is now a choice among the JVM languages. I have been away from the JVM space for more than a year (and boy, do I miss it), so it was either Java or Kotlin for me. I went with Kotlin just to keep it interesting.

I went with the Spring Initializr, picked my poison and got my project up in no time. It is a simple Web-MVC application, with one simple page with a form, some REST API call out to other services, and read only to database. Picking Gradle for build and Kotlin for language, the project generated a Kotlin base build file build.gradle.kts. This is new to me, but the script is still very readable, so no extra learning curve here.

Last time I used Spring Boot with Kotlin, I recalled there are little things here and there that we need to "tweak" to get Spring Boot feature to work properly with Kotlin. These "tweaks" feel like some inherent mismatch between Spring Boot and Kotlin. For my new recent project, it appears all these “mismatch” still exist.

For example, to use Kotlin data class as @ConfigurationProperties object, we need to add this @ConstructorBinding annotation to the class and add “kapt” plugin to the project. This feels like some sort of workaround for some incompatibility between Kotlin data class and how Spring Boot @ConfigurationProperties works.

Next adding spring-data-jpa support with Kotlin, we need to add another slew of plugins “plugin.allopen”, “plugin.noarg”, “plugin.jpa”, and some custom extra gradle configuration:

allOpen {
    annotation("javax.persistence.Entity")
    annotation("javax.persistence.Embeddable")
    annotation("javax.persistence.MappedSuperclass")
}

These little problems are often the reason why many “experienced” developers still refuse to adopt higher order frameworks such as Spring Boot and Ruby and Rails, and prefer to keep rolling their own, copy-and-pasting from past projects, because when the magic works, it is awesome, but if it doesn’t, trying to find the problem on your own is like trying to find a needle in a haystack. This is the size of the ecosystem matters, and the good old Spring Boot and its "Google-able-bility" is still top notch.

The target deployment environment is Kubernetes and I had experience using Docker and Dockerfile to build image, but Spring Boot simplified this for me and all I need is run gradlew bootBuildImage. With a little bit more work to setup the Gitlab pipeline to use kustomize and kubectl to push to EKS, the application was up in a day.

This got me thinking: Is Kotlin still a good choice for JVM based backend today?

With Java 17 LTS fast approaching, and many awesome language features added since the last LTS, such as java records in Java 16, it appears the language level gap between Kotlin and Java has shrunk. So, does it still justify using Kotlin, knowing that all these little incompatibility between the language and other frameworks? I think I found my answer in a comment by rzwitserloot in r/java.