Tuesday, December 16, 2014

Removed user draining battery in Android 5.0 Lollipop

After you try the guest user mode in Android 5.0 Lollipop and delete it to return your own user profile, you may notice that in the battery usage, there is one item on the top, "Removed user", and the battery usage percentage is increasing.

To solve this problem, the following step may help.
  1. First make sure the use details of the removed user actually do NOT change over time (click on the "Removed user" in the battery status page to see use details). Note that, the battery usage percentage may still be increasing. If the use details change, try to enter into guest mode again, and delete.
  2. When your phone or tablet asks you to recharge, turn off your device, and recharge it.
  3. When the battery is full, turn on your device and the removed user should be gone.

Wednesday, November 19, 2014

Default reminder not working in Thunderbird Lightning calendar

You may encounter the problem that the default reminder does not work any more if you access the Google calendar through Provider for Google Calendar in Thunderbird Lightning. Whenever you create a event and use the Default Reminder, it does not work. If you edit that event, you will find the reminder option is set to No reminder. However, in Options --> Calendar --> Alarms, Reminders are set to on for events.  Thus it should add a reminder by default. In about:config, you may find similar entries like
and the value is set to [].

Why the Alarms setting does not work on the Google calendar? This problem occurs because you have NOT set a reminder in Google calendar settings through web interface, and it is inherited to your local computer. To solve the problem, follow the steps below.
  1. Log in to Google Calendar web interface (https://www.google.com/calendar);
  2. Go to Settings -->Calendars and find out the calendars you would like to add a default reminder.
  3. On the right side of the calendar name, click on Edit notifications.
  4. In the Event notifications, add a pop-up notification.
  5. Quit Thunderbird and restart it.

Monday, November 17, 2014

MATLAB: use 'save' in 'parfor' loop

In the Parallel Computing Toolbox of MATLAB, parfor plays a significant role to speed up the MATLAB simulation. It is not uncommon that we need to save something at the end of each loop. While you want to use save, MATLB will kindly remind you that "SAVE cannot be called in a PARFOR loop". To fix this issue, the save command should be used in a function instead of being called directly in your parfor loop. For example,
parfor m =1:100
 (your code here...)
 save_parfor(mat_file, var1, var2)

 The mat_file is where the variable data will be saved, and var1, var2 are simply the variables themselves (not their names). Inside the save_parfor function, the save command is called. The complete save_parfor function is given below.
function save_parfor(name_mat, varargin)
% save_parfor 
%   Inputs: name_mat: where the .mat will be saved, absolute path is
%                     recommended.
%           varargin: the variables will be saved, don't pass on the names of
%                     the variables, i.e, strings.
%   Outputs: 
% Wenbin, 11-Nov-2014
% History:
% Ver. 11-Nov-2014  1st ed.

num_vars =nargin-1;
name_input =cell(1, num_vars);
for m = 1:num_vars
   name_input{m} =inputname(1+m);
   eval([name_input{m} '=varargin{m};']);

save(name_mat, name_input{:});