Bluetooth devices

Due to previously reviving old Samsung Galaxy Tab, I bought a bluetooth gamepad/joystick (MOCUTE 053 Gamepad). Then I found that bluetooth technology is so wonderful, as I am not bound by wires.

Configurations

In Linux, to make Bluetooth to start on boot, need to edit /etc/bluetooth/main.conf and set AutoEnable to true. Furthermore, I have issue on the paired device. I also set AlwaysPairable to true.

Another issue I faced was the devices are not able to auto reconnect after resume from sleep. As a result, I created a custom “systemd unit file”,

[Unit]
Description=Restart bluetooth when resume from suspend
After=suspend.target

[Service]
Type=simple
ExecStart=/usr/bin/systemctl restart bluetooth.service

[Install]
WantedBy=suspend.target

Some good bluetooth devices

There are some bluetooth devices that I like.

  • iClever BK10 – keyboard
  • Logitech M590 – mouse
  • MOCUTE 053 Gamepad
  • Lenovo LP40 Pro – earphone

Migrating phone

I never know that migrating from one phone to another phone also spends a lot of time. One for the issue is transferring the photos. Previously I don’t need to transfer the photos.

One thing to note, WeChat, LINE, and WhatsApp only allow single device login. Transferring data from old phone to new phone on WeChat and LINE are simple. Do not logout on the old phone, generate QR code, sign -in in new phone, scan QR code, then wait for transferring.

But WhatsApp is troublesome. I keep doing login and logout to test the transferring, then it blocks sending SMS verification code, and I have to wait for 12 hours. The only solution is to backup to Google Drive, and it is slow. Slow like never ending, but it will end. Just leave your phone there and wait for the backup. After finish backup, login the new phone to restore from backup from Google Drive.

In fact, the worst case is you lost all the previous messages from these messaging apps if transferring data does not work, yet you are still able to use the same account.

Transferring files

Next problem I faced was the file transfer. I found that copying from laptop to the phone using USB (type-C) is slow. Furthermore, the file timestamp will be changed, which is bad. This is because viewing photos usually order by date. With the timestamp changed, the Album app will show your old photos as the latest photos.

I tried several alternative solutions. WiFi FTP server is not a good solution, as it doesn’t allow filename with whitespace. I also tried KDE Connect, but it cannot copy-paste easily. I didn’t try Bluetooth, as I don’t think it is fast enough to transfer files. Finally I found SimpleSSHD. That’s the best method I found as the date issue being solved.

Finally, I spent two days to complete migrating the phone.

Software engineer’s soft skills

As a software engineer, he/she needs to have the hard skills especially writing source code, debugging. He/she needs to know multiple programming languages (eg C, C++, C#, JavaScript, Python, etc). It will be even better if he/she can write tests, adopt TDD, write clean code, do refactoring, know how to implement various algorithms (search algorithm, sort algorithm, dynamic programming, etc), review code. These are all hard skills.

However, in order to perform well in the working environment, software developers are recommended to adopt several soft skills. These skills will help the team to improve the productivity.

Work estimations – Engineer needs to know how to do the estimations of the given tasks, so that the project manager can do estimation on when the features can be delivered or released. Based on the estimations, the project manager will decide the priority of the tasks.

Task break down – Engineer needs to know how to break down the tasks. A feature maybe too complex. Eg, a user story may say that, “As a user, I want to purchase a product online.” Though it is one sentence story, it can be break down into various sub-tasks, such as payment, user interface, validation, etc. It is necessary to know how to break down the tasks, then only can do better work estimations.

Foresee the issues – Sometimes the project manager or the client may want some feature. The engineer needs to think further in the technical perspective, because other users (project manager, end user, graphic designer) may not understand the possible issue. Once the engineer for see the issue, engineer should raise the issue, so that project manager can decide what to do next. By keeping silence, it will bring the feature to dead end at the end, and wasting the time and money.

Communication – Always communicate with the project manager, or other team member. Anything unclear, just ask, since this is the responsibility of the engineer. Without asking, nobody knows you don’t know. Sometimes it is the specifications not clear, because the project manager may not know as well. This will require more discussions.

Self-learning – Though communication is important, the engineer should know how to learn new things by him/herself. Technology is evolving, new technology is emerging everyday. Sometimes engineer will be assigned with task that involves to explore or experiment new technology, as a result, engineer needs to learn it.

Migrate to SSD

In my previous post, I mentioned I have boot issue. Then I asked in Arch Linux BBS, and I got some useful advice from other users. As a result, I contacted a computer shop in my town, in order to get a hard drive (HDD). However, the shop doesn’t have 7200 rpm HDD. Then he suggested SSD to me, which is 1T storage. The SSD now is much cheaper comparing to two years ago.

I remembered that SSD, requires some special configuration, due to “limited write-life” [1]. Spending around one week time, I searched for the recommended tweaks and modified the setup in order to cope my working environment.

The following is the summary of my SSD configurations:

  1. The partitions should be mounted with noatime option.
  2. When creating partition, should be aligned properly, which fdisk should handle it automatically. [2]
  3. Enable fstrim
  4. Do not use swap partition, as fstrim does not work on swap partition [3][4]. Though, “swap system has automatically supported TRIM capable devices” [5]
  5. 8G RAM is not enough for my working environment. I created swap file instead of swap partition
  6. Set swappiness [6]
  7. If 8G RAM is enough, then can use zram (using zram-generator).

[1] Dell, “Hard Drive – Why Do Solid State Devices (SSD) Wear Out,” Dell.com, Sep. 28, 2021. https://www.dell.com/support/kbdoc/en-my/000137999/hard-drive-why-do-solid-state-devices-ssd-wear-out. (accessed Apr. 14, 2022).

[2] “Should I align partitions on an SSD, if so how do I do it at install time?,” Ask Ubuntu, Dec. 26, 2010. https://askubuntu.com/questions/18900/should-i-align-partitions-on-an-ssd-if-so-how-do-i-do-it-at-install-time#18951 (accessed Apr. 16, 2022).

[3] “fstrim does not trim swap,” Unix & Linux Stack Exchange, Dec. 12, 2019. https://unix.stackexchange.com/questions/556805/fstrim-does-not-trim-swap#558223 (accessed Apr. 16, 2022).

[4] “why not use Swap file on SSDs instead of Swap partition?,” Ask Ubuntu, Nov. 11, 2016. https://askubuntu.com/questions/848230/why-not-use-swap-file-on-ssds-instead-of-swap-partition?noredirect=1&lq=1#1290562 (accessed Apr. 16, 2022).

[5] “SwapFaq – Community Help Wiki,” Ubuntu.com, 2022. https://help.ubuntu.com/community/SwapFaq (accessed Apr. 16, 2022).

[6] Why, “Why are swap partitions discouraged on SSD drives, are they harmful?,” Ask Ubuntu, Jul. 24, 2015. https://askubuntu.com/questions/652337/why-are-swap-partitions-discouraged-on-ssd-drives-are-they-harmful#964933 (accessed Apr. 16, 2022).


Not able to boot

Recently, I failed to boot into my laptop. I was shocked.

home contains a file system with errors, check forced.
home: Inode 12976129 seems to contain garbage.
home: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
        (i.e., without -a or -p options)
fsck failed with exit status 4.

Then not able to mount the home partition, I was prompted to login as root. However, I was too nervous, I forgot what is my root password.

Luckily, I always have an Arch Linux LiveUSB, though it was 2020 release. I boot into it. Then the screen is tearing, due to the graphic card issue (NVidia). I tried to remember how I did the installation previously. At the end, it involves BIOS to change the graphic card to non Discrete Graphic Card. Boot again, yes, success boot into LiveUSB.

The next thing is, I immediately run fsck to check the partition again. And auto fix all prompts.

During the fix, fsck shows me such frightening screen.

Luckily there is no read error caused by bad sector.

After finish running fsck, I reboot and no more issue to boot into Linux.

Backup! Backup! And always do backup! And I should remember my root password!

Godot Mono and tests

In my previous post, I mentioned about using C# for Godot Mono. However, recently I found that, due to MonoDevelop is inactive, it causes my personal project not able to be built. As a result, I have to change the build tool to dotnet CLI. This can be set through

Godot (Mono) > Editor > Editor Settings > Mono > Builds > Build Tool

Besides that, I also changed the External Editor from MonoDevelop to Visual Studio Code. Visual Studio Code is nice for the C# project. It has autocompletion and able to find function definition and function references.

Previously, because I was using MonoDevelop, the Nuget packages (similar to npm packages) is managed by MonoDevelop, which I can add new packages through GUI. But now, I migrate the project to dotnet CLI, there is no more GUI. Luckily, dotnet allows to add Nuget packages to my existing project. For example,

dotnet add package MathNet.Spatial
dotnet add package MathNet.Numerics
dotnet add package NewtonSoft.Json

This will update the .csproj file. NOTE: This csproj file can be generated by adding a C# script through Godot Mono.

Tests

The advantages of using C# comparing to GD script (Godot script) are

  1. inheritance
  2. lambda syntax
  3. tests!

I was using FluentAssertions and Machine.Specifications previously on MonoDevelop, by creating a library project (.dll). Then run the command for the tests. However, after migrating to dotnet, I failed to run the tests. I tried several solutions.

Dotnet official websites mentioned about xUnit and NUnit. I tried both, but I failed to make both work. I failed to run the tests with dotnet test.

At the end, I use back FluentAssertions and Machine.Specifications.

Firstly, add the two packages to the existing project, not as a separate project.

dotnet add package FluentAssertions
dotnet add package Machine.Specifications
dotnet add package Machine.Specifications.Runner.Console

The Machine.Specifications.Runner.Console is important. I found that both xUnit and NUnit have runner console packages as well. Probably I can run the tests without dotnet test for both solutions.

After adding the packages, then I run a script to invoke the tests.

#!/bin/sh

PROJECT_NAME=MyProject
export MONO_PATH=./.mono/assemblies/Debug
CMD="mono $HOME/.nuget/packages/machine.specifications.runner.console/1.0.0/tools/mspec.exe"
TARGET=".mono/temp/bin/Debug/${PROJECT_NAME}.dll"

if (( "$#" > 0 )) ; then
    $CMD $TARGET -i "$@"
else
    $CMD $TARGET
fi

Export MONO_PATH because it contains GodotSharp.dll and GodotSharpEditor.dll. GodotSharp.dll is necessary as our C# source code inherits the classes from Godot.

The shell script above will invoke mono mspec.exe, where mspec.exe locates at .nuget in our home directory (I am using Linux). mspec.exe is installed when adding the project Machine.Specifications.Runner.Console.

Finally, the script will run mspec.exe to test the MyProject.dll assembly. MyProject.dll is built through Godot Mono. Godot Mono will create the assembly file .dll based on our project name.

Yay! It works.

One drawback is that, I cannot separate the tests code fro the project. The ideal solution is to have MyProject.dll and MyProjectTest.dll. Our test code should be compiled and build the MyProjectTest.dll, and it depends on GodotSharp.dll and MyProject.dll. However, it is very troublesome, because Godot Mono is not able to add project like MonoDevelop. So, the fastest solution I have is to have the tests be compiled into one .dll.

Dell Vostro 5459 revive

I was using Dell Vostro 5459 previously. However, it has some hardware deficiencies. The battery capacity keeps dropping drastically within a year. That’s a very bad experience. Now, the fully charged battery is only 1% of the designed capacity. Then I purchased an external power bank from Dell. But that’s not an ideal design for a laptop that you need to bring extra gadget to everywhere, and charging external battery is too troublesome.

Since I mostly work from home, battery issue is still bearable. Then about 4 years of usage, the keyboard became weird. It will randomly fire some keys (I forgot which key) (related post). That’s truly unbearable because it affects my working experience. At the end I bought a new laptop, Lenovo Legion Y7000.

But recently, I have done some online shopping and I bought some useful tools, including (i) laptop opener pry tools, and (ii) compressed air. Both are super useful for DIY hardware cleaning. I use opener pry tools instead of screwdriver to avoid physical damage of the hardware cover. Moreover, taking out Dell Vostro 5459 keyboard becomes much easier. For compressed air, it allows me to clean out the dirt from laptop without disassembling the laptop. Disassembling the laptop for cleaning is too difficult for a noob like me.

Finally, I bought a Dell Vostro 5459 compatible keyboard replacement through online shopping. That’s wonderful thing, since the laptop keyboard is not purchasable from Dell official website. I replaced the keyboard with the pry tools I bought earlier, then clean the fans with compressed air. I haven’t spent time to verify whether the keyboard issue is totally solved, though I think it is solved.

Great online shopping!

Reviving Samsung Galaxy Tab 10.1 part 2

In my previous post, I mentioned about reviving old Samsung Galaxy Tab 10.1. Today continue some extra customization works.

Firstly, the problem of the headphone mode emerges again. I tried to clean with cotton, but it doesn’t help. At the end, I found a page recommends an app (Disable Headphone(Enable Speaker)). I tried to install the app, and it works. It really works. That solves the most critical problem of my tab.

Other than that, I have installed several useful apps. They are

(from F-Droid)

(not from F-Droid)

Therefore, the tab basically is functional enough: file operations, view image, watch video from internal storage, and surf net. And there is one more thing remain: gaming!

RetroArch

I tried to install RetroArch. The best to work on my tablet is the F-Droid version.

The modern games, especially mobile games, in my opinion, they are just wasting our time (converting our time to their money through ads). The use erotic drawings (yet not offending the terms and conditions), in-app purchase, and they usually require us to watch ads in order to recharge playing point (usually called “energy” in the game). These “free” apps is free without us to pay the money, but we are being used to earn the money without knowing it.

Instead of spending 30 seconds to watch an ad, it will be better we use the 30 seconds to implement “Kaizen”.

Back to RetroArch, the old school games are designed to play! The game design focuses on the gameplay, in order to achieve the sales. Modern game design (especially mobile games) focuses on earning money, in order to make the project sustain. To earn money, it requires to attract more users. As a result, erotic design of heroine is most attractive (in my opinion).

Back to RetroArch again, it contains various emulators. My favourites are GBA, NES, and SNES. Since I am born in 80s, NES games accompanied my childhood most. Though I played SNES games as well, that’s only when I was teenager and played through emulator as well.

After installed RetroArch, there is a zip extraction issue happened. I don’t know what is the exact solution, but I created temp folder in .retroarch. (this results .retroarch/temp to be created). Note that, there is another folder, RetroArch/temp exists. Then the zip extraction issue is solved.

I have tried RetroArch with some games. But tablet or mobile, the touch screen is worst for playing games. I have ordered a gamepad with bluetooth support, it is way to come. Will try on RetroArch with the gamepad. Hopefully this old tab will be a retro gaming “station”. 😊

Reviving Samsung Galaxy Tab 10.1 (GT-P7500)

I bought a Samsung Galaxy Tab 10.1 many many years ago. But recently, I am trying to revive it so that, it will be a possible solution to allow my son to watch cartoon on an old tablet, in future.

Reviving this Galaxy Tab (P7500) takes me so much time to try out those custom ROMs and the apps. But it is an interesting experience.

I tried several ROMs, flashed with TWRP.

  • Nameless ROM (Android 4.4.4 Kitkat) – Fast, but no MTP, I cannot transfer file.
  • AOSP 7.1.2 – Slow. Am not sure it is caused by gapps or what, it is slow and can’t run Firefox, Opera Mini or Brave. A device without a modern web browser is quite useless.
  • AOSP 5.1.1 – Flashed the ROM, but it doesn’t start. Not sure what’s the problem.
  • CyanogenMod – It is too old (Android 4.2.2 Jellybean). I flashed this ROM many many years ago.
  • AOSP 6 – Because AOSP 7 is too slow, I tried to downgrade. But I can’t find the P7500 related ROM to download.
  • Omni ROM – Also Android Kitkat. I installed, but I didn’t find the virtual keyboard (forgot to check the right-bottom corner), then I gave up.
  • AOKP – I think I tried this ROM before using Nameless ROM, but that’s many years before, not remember well.
  • /e/ (/e/ OS, eOS) – Lastly I tried this ROM. This is so far the best as it is based on Android 7.1.2, and the performance is good, far more better than AOSP.

/e/ OS (eOS)

I tries eOS, I am happy with it. But after I installed the ROM, I cannot install gapps , because not enough space. At the end I decided to continue Android without Google Apps (most importantly Google Play). This also means, I need an alternative app store.

I am currently using two app stores: F-Droid and Aptoide. F-Droid focuses on the free and open source apps. This is a good solution to exclude apps that contain ads, as ads are super distracting. Some useful apps can be installed from F-Droid:

Aptoide itself contains ads, but I still can bear it. I can find all the apps that I need in Aptoide.

Customization

There are several apps from eOS I have disabled them. Notably, eOS default web browser is Via. Then I tried FOSS Browser. It has built-in ads block, but it is lack of other features like remember last visit tabs. As a result, I tried Opera Mini again in eOS (failed to work on AOSP). And Opera Mini works good.

eOS default launcher is Bliss Launcher. It lacks features such as grouping, shortcut management, etc. Then I found a good alternative, and it is really good. Microsoft Launcher. It is ads free!!!!!!

Now I am using Simple File Manager and Astro File Manager. I am still looking for an ads free (I don’t mind In-App Purchase), with show hidden files feature. Looks like FX File Explorer can fit my requirement. By the way, those file managers/explorers naming are damn annoying: FX, ES, CX, FS, FE.

Video problem

After installing eOS, I tried to play movie. But found out it is choppy. Tried run with mpv, it is choppy; built-in Gallery, it has no sound; QuickPic has no sound as well.

At the end, I believe that it is due to the coder problem. So, I tried to use ffmpeg to convert the video into other format (mkv, m4v), and it works.

Besides that, I tried to use the Camera to record video, but then it crashed.

Audio hardware problem

Because the tablet was put on a rack for a long time. When I started trying it again, found that there is no audio, and the tablet thought that I have jacked in the earphone.

At the end, I found a forum discussed how to solve this. Yes, I tried with hair dryer. It didn’t fix immediately. But after few days, I tried again, the tablet sound works again!

MacBook Air again in 2021

Previously installed Arch Linux on my wife’s old MacBook Air. Then just recently, due to the need of using Zoom Meeting on a device, I tried to re-use this MacBook Air again.

Sadly, Mac OS X 10.6.8 is not supported anymore. I cannot install latest Google Chrome, latest Firefox, or Zoom. The only solution is running Linux on it.

First of all, I have to update Arch Linux. However, the last update was in November 2019. Due to WiFi driver issue (slow, damn slow!), I just remove all unnecessary packages, such as LibreOffice, Wine, SMPlayer, Audacious, etc, and do the upgrade according to this forum post.

There are two main problems in MacBook Air when running Arch Linux: (1) Wi-Fi and (2) graphic card.

For WiFi, at the end, I blacklist bcma. It is damn slow. For Internet connection, I just solve it by using Android phone USB tethering. That’s far more better than WiFi download speed, which is around 200 kilobytes per second.

The second problem is nvidia-380xx-dkms driver. Since it is old machine, I use linux-lts kernel, which can work smoothly with nvidia-380xx-dkms. However, I am not sure what’s the reason, if running glxgears, the OpenGL fails to work. OpenGL is required for Zoom to run. Luckily, I found that if I restart lightdm, then OpenGL will be able to work, so does Zoom.