Category Archives: Fixed problems

reduce macOS Finder memory usage

How to Reduce macOS Finder Memory Usage

If you are experiencing slow performance on memory on macOS (OS X), chances are your memory is running low. While Chrome is notorious for taking up large amount of memory, another culprit is actually the macOS’s own app Finder, which can use up huge amount of RAM. This post will show you how to reduce macOS Finder memory usage from almost a 1GB:

reduce macOS Finder memory usage

Down to a mere 50MB:

Continue reading

letsencrypt Apache vhost

letsencrypt Apache vhost config on Ubuntu

Solving letsencrypt Apache vhost config issues

Setting up letsencrypt can be tricky with different variations of apache vhost configs. Here is how to set up letsencrypt Apache vhost config correctly:

(Note: letsencrypt is now certbot. The environment I am using is apache2 by DigitalOcean for Ubuntu/Wordpress VPS, single domain name)
Continue reading

Sony Z3 Top Speaker Noise

[Solved]Sony Z3 Top Speaker Noise Problem

I have recently purchased a Sony Xperia Z3. There seems to be a strange problem with the Sony Z3 top speaker. Most of the time it produces a static background noise when I run any applications that has sound. The noise can still be heard even if I have muted the media volume. But there are occasions where the noise does not occur.

I searched online and found out this a common problem for Sony Z3, the solutions they suggested on the forums(tuning the equalizer settings) did not help me. I have also contacted Sony customer service and they responded that “It happens when you use applications that access Internet.” That seems logical enough first but I soon realized that sometimes the noise does not occur even when I am using the applications that access Internet.

When I tracked down the cases where the noise did not occur, I found out the root cause of it: The Alarm Volume. 

sony z3 sound setting

Alarm volume setting in Sony Z3 sound and notification setting

This is totally strange but it is indeed the cause of the noise. Whenever I lower the alarm volume to below about 60% and reopen the applications, the noise disappears. The alarm volume is not supposed to be related to the sound inside the applications but it seems that Sony Z3 has a software bug that caused them to be linked.

Also note that the global alarm volume in the sound settings will be overwritten by individual alarm volumes that you set in the alarm application.

sony z3 alarm setting

Alarm volume setting in Sony Z3 Alarm app

So in order to make sure the noise does not come back, you need to set both the global alarm volume and individual alarm volumes to below about 60%.

[Solved] onDataChanged not called, Android Wearable

I was doing a school project on Android Wearable for the past few days. A strange bug happened.

I used  Wearable.DataApi.putDataItem(mGoogleApiClient, putDataReq)for triggering  onDataChanged in WearableListenerService. However, I noticed that sometimes  onDataChanged is not called even though the putDataItem method has fired.

The strange thing is this bug only happens on the first call, subsequently the calls trigger normally. More interestingly, the bug only happens sometimes, once in a while, the first call will trigger normally.

Aftering debugging and getting nowhere, I decided to get help from stackoverflow. I found an answer that was relevant:

http://stackoverflow.com/a/24697312/1472186

The answer suggests adding a time field into the DataMap  so that the data is really changed every time. I did not think that was the cause of the problem, because I followed the online tutorial and had a count value in my DataMap, which increments every time. This should have caused the data to change every time.

However, after I added the time field into the DataMap, the bug disappeared. So it was true that my old implementation was not causing any changes. The count value did not work. After thinking through the process again, I figured out why.

The count did increase after each call, from 0 to 1, 2, 3, … However, those values are stored in the DataMap within the wearable device, not on the phone. So it was possible that wearable device already has a DataMap in which there is a data with count 0, although my phone app does not have the DataMap yet. When I send a new DataMap with count 0 from phone to the wearable, that DataMap is already present on the wearable, and hence no change will be detected and onDataChanged will not be triggered.

For time, since the current time is unique and always increasing, there would not be a case where the time in DataMap on the phone already exists on the wearable, hence always triggering onDataChanged.

[Solved]Get back Grub in Windows 8.1

I was using grub to dual boot my Lenovo Y410P with Windows 8 and Ubuntu 14.04.

Recently I finally decided to upgrade my Windows 8 to Windows 8.1 considering it should be pretty stable by now. However, to my horror(or rather not surprisingly), my default bootloader has been changed to Windows Bootloader which means I could not access my Ubuntu 14.04.

Usually this takes a while to fix, involving repairing grub/BCD and tend to be tedious. However, I managed to found a much simpler and direct solution to this.

With the new UEFI specification, we can actually choose the default boot manager instead of replacing one with another. All it takes is to go to UEFI Firmware settings and change the order of boot managers. Which means grub and Windows boot manager can co-exist somewhere in the hard disk and we can choose which one to use in the BIOS UEFI settings.

Accessing UEFI settings in Windows 8.1 is a bit different from what happens in Windows 8, you can follow these links:

http://www.thewindowsclub.com/access-uefi-firmware-settings-windows-8-1

http://acer-au.custhelp.com/app/answers/detail/a_id/32048/~/accessing-uefi-in-windows-8.1

The menu is something like this:

UEFI Settings

UEFI Settings

One you are in the UEFI boot priority settings, you can simply change the position of Ubuntu to the top so that grub will load when the PC is turned on:

UEFI Boot order priority setting

UEFI Boot order priority setting

(All photos taken by me)

 

 

[Solved]Lag issue with meteor and stuck at loading

Meteor is the web framework that I have been learning for past few weeks. It is powerful and easy to learn but some functions are still under-developed hence some bugs.

When playing with the Todo List example, I discovered a bug in the example. The example has a function to display a “loading text” in item panel when the user selects a new list and the corresponding items are being loaded from database. However, if the user switches between the lists very fast and selects the next list before the current list is loaded, the item panel will be forever stuck at loading. This may not be a issue when running on a local server but it would be much more serious if the Internet connection to server is slow.

I am not entirely sure of the cause of this problem but it has to do with how DOM elements are updated when the variables get changed. For some reason, if the Meteor.subscribe() method does not return before the next execution, the DOM elements will not be updated.

I solved this issue by using a session variable, which is altered when new list is selected. In this way, a selection of new list will always trigger the change in session variable and hence update DOM accordingly. Below is the relevant code modified by me:

This technique is related to meteor’s reactivity, here is the reference on Reactivity for meteor.