4月 12, 2021

Java Paths.get() cross platform issue

 Original code:


This would work on Unix platform, the returned path is "/home/..../xyz.xml"


However on Windows, it would return "invalid" path "/C:/.../xyz.xml", which is causing Exception from the get().


Solution in bugtracker suggested

1. Use toURI() method to convert getResource() result to URI, then use Paths.get()

2. Use Legacy File class.

https://bugs.openjdk.java.net/browse/JDK-8197918


Msys2 mount fasttab

 https://gythialy.github.io/msys2-config/

4月 02, 2021

Jakarta EE, tomcat 10, intellij Idea template debug 日記

是咁的,小弟今日第一次上手Java EE tomcat server. 

 無奈就搞足半日都入唔到 hello World servlet.

一時話noclassdefFound, 一時話helloServlet is not a servlet xxxx...., HelloServlet cannot be cast to class jakarta.servlet.Servlet...


最後慢慢google 先知原來係因為Tomcat 10 不再使用 javax 做servlet包, 而改用 jakarta [好難串...]

而由於Intellij Idea 過了半年都未修復這個問題,新建project範本用的是舊版。

所以就所有import都不會work!!!

【不需要跟我註釋化走呢句,只是debug用】

解決方法:
- 用 Java EE 8 版本的Tomcat

- 替換所有有關的 J2EE class 為jakarta 開頭。同時要在gradle/maven處理!



搞完半日,成功!




Ref:

https://youtrack.jetbrains.com/issue/IDEA-249016

https://youtrack.jetbrains.com/issue/IDEA-260177

2月 12, 2021

BIP01 browser improvement program

 I have used Brave for a while now.  One of the most annoying things to me is the laggy tab switch, let alone the common scrolling lags.

Today I found a remedy for the problem.  By enabling tab grid mode, it allows the switcher to be opened at minimal latency.  


However, the recovery animation from switcher to the tab(scaling animation) is laggy as hell.


luckily, there's another option in flags to disable the annoying scaling.  this replicate the iOS behavior, turning animation into fades.  This improved UX on mid range phones a lot.




A straight forward alternative is to use the now disabled(removed flag) minimal tab list.  I am not confident about the performance impact of turning on the accessibility kits though.

keywords:

responsiveness, android, web browser, chrome, brave, tab switcher.

10月 20, 2020

wireshark and windows10

 I first installed wireshark with chocolatey, realized it did not come with a packet capturing driver upon opening.  So I was going to install "WinCap" according to the top google suggestion.  After trying the compatibility mode suggestion in vain.


However, I was worried when I see WinCap is discontinued on its project site.  Thus, I started looking for alternative.


Once I installed pcap, problem was solved.  Although I also see some other with success with the option win10cap(lucky for me).

However, it turns out that npcap is broken on my windows10 install (I have virtualbox host-only interface coexisting, but doesn't seem relevant).

When I suspend my computer, it would make my PC ip become 169.xxx.xxx.xxx, which is crap.  I would have to disable and enable the ethernet connection (agtain and again) to  restore normal network activity.

I have to try other option, and luckily for me, win10cap would just work.


If that don't work, I guess I would have to uninstall the driver and only install when I need it.  That would be silly and boring.

8月 13, 2020

Windows 10 Chinese Pinyin Issue

Microsoft Pinyin on Windows 10 is the goto choice to type Chinese Trad by pinyin over Chinese(TW) Bopomofo because it has cloud suggestions mainly. 

However, common characters like (囘、閙)are not  the correct one, they are  異體字(Variant Chinese character), the correct ones are 回家、鬧市 instead.

This problem have bothered me for years, may please investigate. 

https://aka.ms/AA99gf0

 



7月 15, 2020

[hassle] SSD migration, windows 10

I bought an SSD recently and tried to migrate my system.  However, no matter which tools I used(Clonezilla, DiskGenius), they both failed to boot, with a black screen only have an spinning cursor on it.

After a day of hassle, I found the solution.

Just ignore any advice to use bootrec, we can now use the bcdboot command which is more automatic and trouble-free.

1. Get to winre, run regedit
2. select hklm anyfolder, open hive -> c:\windows\system32\config\system, type any name
3. use diskpart to assign correct drive letters
4. delete all driver letters under the hive, except the one you need
5. copy value of dosdevice* from hklm->system->mounted volume to the hive of same subfolder

Now, the drive letter problem is fixed.  Let's fix boot.

6. assign letter to the efi partition
7. do bcdboot /help, follow the instructions

8.  finally can re-enter windows now.