RSS Feed

Author Archives: Allen Choong

Dell Vostro 5459 hibernation


In the previous post (1 year ago), I mentioned the hibernation issue. I believed that it was related to the NVidia graphic card. Related forum can be found here.

But these few days, I notice that whenever I shut down the laptop, it will show the systemd messages. Previously, if I did suspend my laptop, then resume, then shut down will show only black blank screen, until the power off. I believe that the graphic card issue is being fixed with the recent update.

I am now using linux-lts 4.9.13-1 and nvidia-dkms 378.13-2

A brief comparison of GTK+ and Qt


I used to like C language, because it is a basic of programming, and it is portable, and it is low-level. When writing program with C language, it is just like showing off your advanced programming skill, how you manage the memory, how you manage the pointers and creating the linked list. However, in terms of efficiency, C++ is much more powerful, because of object-oriented and the syntax.

Because I like C language, so I chose GTK+ over Qt for long time ago. Not only that, I am also fond of GTK+ desktop environments like GNOME, Xfce4, LXDE, Cinnamon, but not Mate. I feel that KDE is heavy weight.

One of my personal projects, Med, which was written with GTK+, had some issues with multi-threading. I believe that my engine part does not have any problem. As a result, the suspicious part is the GTK+. The program crash without symptoms, and difficult to reproduce. Therefore, I decided to re-write the UI with Qt. If, Qt also produces the same problem, meaning my algorithm is problematic.

In my opinion, GTK+ is straight forward, because of procedural paradigm. Therefore, it is easy to learn and implement. The UI can be design with Glade. But I feel that it is still lack of something, such as button click callback function. Besides that, though there is gtkmm (C++ interface of GTK+), the library like WebKitGTK+ does not have the documentation for gtkmm (I believe still can work). In summary, GTK+ is slower as writing the code in C language.

On the other hand, Qt is more complicated. To use it, better to use qmake project file to generate the Makefile, or use the CMake, so that we can include the necessary headers and link with necessary libraries. And we also need to use some macro. This makes me feel that the coding is very Qt-oriented, not just a C++ language. However, in terms of design, I feel that Qt Designer is much easier. But GTK+ and Qt layout uses different concept.

Though GTK+ and Qt are both object oriented, GTK+ is in the library level yet Qt is in the language level. It is easier to write inherited classes in Qt, and easily make changes at the language level.

As a conclusion, Qt is better than GTK+ for development as C++ is better than C.

Heading, anchor, and bookmarking


Sometimes I read online articles, and these articles are usually long pages and have outlines at the beginning. These outlines are the hyperlinks to the subtopics headings. Technically, you click the outline hyperlink, your browser will browse to the “anchor”, the URL will append with hash (#). Therefore, it is useful for bookmarking, so that you can share the URL target on the topic to someone else, or re-visit your bookmark.

Thus, I wrote a script as bookmarklet to solve this issue, so that I can click the headings when I am reading the article. You can create the bookmark with the following URL:

javascript:var elems=document.querySelectorAll("h1[id],h2[id],h3[id],h4[id],h5[id],h6[id],h1>*[id],h2>*[id],h3>*[id],h4>*[id],h5>*[id],h6>*[id],a[name]:not([href])");var array=Array.from(elems);array.forEach(function(elem){elem.style.cursor="pointer";elem.setAttribute("title","anchor:"+(elem.id?elem.id:elem.name));elem.innerHTML+=" *";elem.addEventListener("click",function(el){location.hash=el.target.id?el.target.id:el.target.name})});

(Yes, it starts with javascript: instead of http://. Sadly WordPress.com doesn’t allow to create bookmarklet in the post. Moreover, I was actually using ⚓ instead of asterisk *, but WordPress.com auto convert it to emoji, consequently cannot use it in the script above.)

You can try any Wikipedia page to test it. It also works on Stackoverflow, so that you can share the URL to a certain answer to others.

Lecturer, researcher, hobbyist, and software developer


I am cognitive science student. That is why I learnt AI, computational linguistic, machine learning, expert system, etc. 

Since I was a researcher on Augmented Reality, then I applied my computing skills. After this, I became a non-computer related lecturer, and spent my time doing programming as a hobbyist. Then later I became computer science lecturer, yet still had to do programming as a hobbyist. Now as a software developer, I know what are the differences of these roles: lecturer, researcher, hobbyist, and a true software developer. 

A lecturer, as long as they know how to bluff, they are considered good in programming skill.

A researcher, whether they are good in programming skill is totally not important. Because the focus is the research. As a researcher, you do not need to write programs  or scripts. Though these may help, they are not required. As long as your research methodology is correct, that is the core element of the research.

As a hobbyist, you can learn any programming language and write any program. You can write the code that you yourself think it is elegant. You can write any powerful function and use a simple but accurate solution to solve your own problem. You can share your code and publish your project. You can have very strong knowledge to write wondrous algorithm and solve the problem effectively and efficiently. BUT, you are still lacked of industrial experience. 

An actual software developer who works in industrial, what you need is to produce stable products. Yes. Stable. In order to produce stable products, you need to have your products fully tested. Hire a tester can only perform black box testing. They test only as an end user perspective. But the problem is, the bugs are found after you have written the dependent codes on the bugs. So, it would be best to test before these, during the development level. As a developer, writing test cases becomes exhaustive. That is why, Test Driven Development comes in. A stable product is the actual thing that the customers want. They paid the money to get the product, or specifically, the customers hire you to develop a product to them. That is why your products must be stable. Unlike the commercial products, the government projects usually have no clear objective. As long as you deliver a prototype, you can get the money. That is why, the products standards are very different, the developers quality is also very different.

As a lecturer, you talk.

As a researcher, you do experiments.

As a hobbyist, you learn and write.

As an actual software developer, you write and test.

Bye-bye Xiaomi Mi 3


Prelude

Last weekend was a long story, that I my Xiaomi Mi 3 is screwed! It happened like this.

I was in the car, using the phone to surf net and go through the social networks. Then suddenly, it popped up a notification saying that my phone is too hot, asked me to cool down, with a system button “Cool Down”. I cannot guarantee that this is not a virus, but I believe that my phone doesn’t have virus. (I can hardly find the Cool Down feature online, this is the only one.) So, I pressed the Cool Down button. With this press, sorry my phone. You got a stroke, and never overcome. Bye-bye!

Recovering

Because of that one press, my phone fell into the bootloop. When I went home, I searched for some possible solutions online. And found that, the possible solution is to flash the stock ROM. I downloaded everything I needed. Moreover, the most important thing is to get all my data especially photos, which I didn’t make any backup recently.

So, I followed the steps in this wonderful page for how to perform a flash. WARNING: This will flash everything, meaning, you will loss your data, including everything in the internal storage, such as photos. So, before I flash the stock ROM, I followed this forum to learn how to restore the data.

Summary:

  1. Get all the necessary drivers and software. Actually can be found in the official site. Important software are: MiFlash. It also requires drivers which can be found here. So that you can use “fastboot” command (and also “adb” command) and detect the phone when USB connected.
  2. Get the stock ROM and recovery ROM. I used TWRP.
  3. Boot into fastboot mode (read the instruction from the “wonderful page” mentioned above).
  4. Use command-line “fastboot” to flash the recovery ROM TWRP. And boot into the recovery mode.
  5. Once successfully boot, your computer can detect the phone (as MTP), then you can access the internal storage and copy all the files.

The luckiness within the unluckiness (不幸中的大幸), I managed to boot into recovery mode. Immediately copied everything from the phone to the computer. After this, I tried to flash the stock ROM. But failed. Tried various times, but none of them work. Even wanted to boot into the TWRP recovery mode was very difficult. But luckily, I got all the photos from the phone before these.

Searched for the solution again, I found this forum. Probably my battery got serious problem.

Yet, because my phone was bought through the mobile phone shop, not from Xiaomi official website. The phone is actually from Taiwan. And there is no nearest Xiaomi service centre at my area (and never will be). So, I can only say “bye-bye” to my phone. It is the time to “let it go”.

Epilogue

Most important thing is data. As long as you have the data, put it in any phone, then that is your phone. Just like your soul and spirit resides in any body, make it you yourself!

Linux no sound after boot into Windows


Just now was trying to boot into Windows, by plugged in the HDMI cable, which supports for video only. But then, I rebooted into Linux without plugged out the HDMI cable. Then, it caused no sound in Linux.

Try 1: I killed the pulseaudio, then delete the ~/.config/pulse, and rebooted Linux. Failed.

Try 2: Run alsamixer, turned on everything, and do Try 1 again. Failed.

Then I guessed it was caused by the HDMI cable, which the Windows may assume there is audio, then caused my computer somehow ouptut the audio through the HDMI, even I rebooted into Linux.

Try 3: Plugged out the HDMI, booted into Windows. I checked the audio in Windows. It plays well. Then rebooted into Linux without plugged in HDMI. Yeah! It works. Passed.

Next level

Then I found that, though the sound works fine, my headphones doesn’t work. Tried out many methods as I asked in forum.

At the end, it is solved by shutdown, and boot again.

Arch Linux update issue


Today, when I updated Arch Linux as usual, then suddenly it brought me to the TTY, which didn’t allow me to change to other TTY (due to NVIDIA graphic card issue which has been attached with my laptop for quite a long time.)

Because I could do nothing, and not sure whether the upgrade was completed, so I made a hard reset.

Then I boot with fallback initrmfs just in case has any error. Luckily, there was no problem to boot.

Then I did a quick check on the database. And found that it was locked. Meaning, I had restarted without finishing the update. This is serious if it happened when upgrading the kernel.

Reading the /var/log/pacman.log, I found that some packages were not updated. Then I just simply did a pacman command, and I got these message,

ldconfig: File /usr/lib/libqca.so is empty, not checked.
ldconfig: File /usr/lib/libQt5QuickTest.so is empty, not checked.
ldconfig: File /usr/lib/libQt5QuickParticles.so is empty, not checked.
...

Read the forum, the solution to re-install the packages that own these files. So I used pkgfile to search fo the owner of these files. Then, re-installed each packages found.

Then I just made sure all the packages were installed properly with

pacman -Dk #previously is testdb