About this blog

As the name of this blog, “知之为知之,不知为不知 (To know what you know and what you do not know, that is true knowledge. — by Confucius)”, this blog is basically a place for me to save the Q&A from Internet during my research and life. The majority of the posts are directly from the Internet, with the source links given. If you are the author of certain post, and not happy with my re-post, please let me know, and I will delete it.

Overall, I would like to share the knowledge I learned from the Internet; hopefully, it will also be useful for you.

Excel–Pasting into visible cells only


Here are some detailed instructions and a faster version of the above code that will not mess with your formatting and won’t paste formulas (ie: paste values ONLY):

1) Save your file as an XLSM file, so that you can run “macros” or VBA code.

2) In the Developer Ribbon ( www.google.ca/search?q=show+developer+ribbon ) click “View Code”

3) The VBA window opens up.  On the right, open up the Modules folder and double click on Module1 to open it.

4) Copy and Paste this code below into the main part of the window where the code goes, to the right:

Sub Copy_Filtered_Cells()
Set from = Selection
Set too = Application.InputBox(“Select range to copy selected cells to”, Type:=8)
Application.ScreenUpdating = False
For Each Cell In from
For Each thing In too
If thing.EntireRow.RowHeight > 0 Then
thing.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Set too = thing.Offset(1).Resize(too.Rows.Count)
Exit For
End If
End Sub

5)  If you want to copy more than JUST the values (such as formats or formulas), then remove the following part ONLY:

Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Be sure to LEAVE IN the “thing.PasteSpecial” part!

6) Save

7) Highlight / SELECT the single column of data that you want to copy, but don’t actually COPY it, just SELECT it.

8) Press ALT and F8 for bring up the Macros window.  Find “Copy_Filtered_Cells()”, click it, then click “Run”

9) Similar to step 7, go SELECT the cells where you want to paste into.  This is likely a column in a filtered list where some rows are hidden, and you only want to paste into the visible cells in that column. Be sure to SELECT the same number of cells to paste into as you selected to copy from.  If you only select say the first cell and run this, it’ll stop after only a few items.

10) Click OK or press ENTER.

11)  Wait.  The hourglass / circle on your mouse pointer will show you that Excel is working.

12) The macro takes you back to your copy selection when it’s done!

13) Close the Microsoft Visual Basic Window, Save your file.  If you like, you can remove the macro by saving it as XLSX now, or keep it as XLSM to use in future.

19 people found this helpful

ImageJ: overlay two images together

Sometimes, you need to compare the differences between two images in ImageJ; or you want to overlay the ROI mask on the original images. The easiest way to do is:

  1. make sure two images are in 8bit type (change them in Image > Type);
  2. Then, go to Image > Color > Merge Channels;
  3.  Use the original as Gray and the binary as one of the colors (green shows up well).



Recennt Tutorials for Deep learning, machine learning

1. Ruslan Salakhutdinov


1.1 deep learning on Aug. 2015



1.2 advanced machine learning class



2. an introduction to statistical learning


Click to access talk_Montreal_part1_pdf.pdf

Click to access talk_Montreal_part1_pdf.pdf

Click to access talk_Montreal_part1_pdf.pdf

Using an organisation name as an author in BibTeX



BibTeX is great in that it ensures all of the entries are output in the same style. The most noticeable formatting change is the Author field; John Smith becomes Smith, J for example. Useful, unless your author is not a normal name.

Let’s say that you’ve got an article written by the Reserve Bank of Australia. If you put this as the author, you’ll get something like Australia, R. B. of. which doesn’t make much sense. Luckily, there’s a way to get the author’s name printed verbatim – by surrounding it in "{...}"

For example:

... ,
author = "{Reserve Bank of Australia}",

will print out the author correctly.

ubuntu 14.04: no sound, HDMI as the default output


Sound problem is not new in Ubuntu. I have previously written on various ways to fix “no sound” issue in Ubuntu. But the soud issue I am going to discuss here is different than those mentioned in the other article.

So I installed Ubuntu 14.04, actually re-installed it. As always, I did all those things to do after a fresh install of Ubuntu 14.04. And than I realized that the system had no sound. While investigating the issue I found one strange thing. I checked alsamixer and it was in a weird state:

alsamixer set by default to HDMI

As you can see, HDMI is set by default in alsamixer. Which means by default HDMI output has been selected instead of the built in speakers. This is why I get no sound from the built in speakers in my system.

Use the following command to check the state of alsamixer:


If alsamixer is set by default to HDMI or some other audio output, continue this article to see how can we fix it.

Fixing no sound in Ubuntu when HDMI is set as default

Now to force Ubuntu to use analog output instead of HDMI by default, we need a little information. Open a terminal and use the following command:

aplay -l

This will list the devices, card number etc. Note down the card and device number for analog output. For me the output was like this:

alsamixer sound device list

Once you have the required card and device number, make a new configuration file like this:

sudo gedit /etc/asound.conf

The above command will also open the file. Add the following lines to it, replacing with your card and device number of course:

defaults.pcm.card 1
defaults.pcm.device 0

Save the file and restart the computer. You should hear the sound now. Just to mention, this will work for all the Linux distributions such as Linux Mint, Elementary OS, Fedora, Arch Linux etc. As I said previously, this “no sound fix” only works with the case where HDMI is set by default. For other cases, you can read this article about fixing no sound issue in Ubuntu and Linux Mint.

Feel free to use the comment section to let me know if it worked or not or if you have some better trick to handle this such issue.