Blog 1

Random Talk on Random Thoughts

Using Octopress on Another Device

| Comments |

Two days ago, my Linux desktop was down. As a result, I had to use a laptop that ran on Windows 7 to browse the web. I wasn’t sure how long it’d take to fix the desktop, so I tried installing Octopress on Windows 7.

I mainly followed the tutorial on Simple Tutorial Blog. If my blog consists merely of simple passages, the tutorial should have worked for me. Unluckily, if any page/post contains a code block, then Pygment, which depends on Python, is used. Tony Jan described how he solved the problem of RubyPython in details.1 I have no knowledge in Ruby and Python programming, so I don’t think that I can find out what’s wrong like him. Fortunately, I didn’t encounter his error.

However, when I was setting up Octopress on Windows 7, I’ve learned something that I’d like to write it down.

Fixing a Vim Error Caused by an UltraBlog.vim Upgrade

| Comments |

Yesterday, I upgraded the Vim plugins on my Ubuntu Desktop using Vundle. Among the upgraded plugins, Ultrablog.vim was the only one that didn’t run smoothly on my installed version of Vim.

Right after I issued the command vi on the terminal, I got the following error message.

$ vi
Error detected while processing /home/owner/.vim/bundle/UltraBlog.vim/plugin/UltraBlog.vim:
line  253:
Traceback (most recent call last):
  File "<string>", line 7, in <module>
  File "/home/owner/.vim/bundle/UltraBlog.vim/plugin/ultrablog/commands.py", line 8, in <module>
from db import *
  File "/home/owner/.vim/bundle/UltraBlog.vim/plugin/ultrablog/db.py", line 181, in <module>
u.ub_echoerr(msg)
  File "/home/owner/.vim/bundle/UltraBlog.vim/plugin/ultrablog/util.py", line 623, in ub_echoerr
vim.command(cmd)
vim.error: Vim(echoerr):Missing key 'xmlrpc_uri' in the settings list of UltraBlog.vim !
Press ENTER or type command to continue

Using MathJax in Category List Entries

| Comments |

(Added on SEP 14, 2014)

Since the update of Octopress source code, this post won’t make sense anymore. I can’t find a way to use MathJax in category list entries anymore because category in plugins/category_generator.rb and plugins/category_list_tag.rb have both been changed to lower case. I don’t know how to track the Ruby code to revert it.

Make Images With Transparent Background Using GIMP, and More ...

| Comments |

Getting an image with transparent background

An apple with white background

Downloaded from History of the Apple Logo.1

Thanks to Ruiz’s GIMP tutorial on Mbrsolution, I can remove the white background of the picture on the left.

Using GIMP

It’s a brief summary of the referenced tutorial. To save time, I won’t post screenshots here. You may refer to those in the tutorial.

  1. Use the Fuzzy Tool and click on the background.
  2. Click Layer → Transparency to check if an alpha channel has been added. If not, then add one.
  3. Produce a transparent background by Edit → Clear.
  4. Save it as a PNG file.
    • See the detailed instructions in the tutorial.
    • JPEG images can’t have transparent background.2

Octopress Category List

| Comments |

Yesterday, the category list of this blog was still like the one in Vigo’s Development Tips.1 However, I think that Watson’s Category List Plugin is more user-friendly because users can view the categories by scrolling, instead of clicking and waiting for another page to load.

I tried copying everything, and put them in the right places, but initially I failed. I quickly realized that I wrongly named the plugin file as category_list.rb, and rake preview still didn’t produce the desired list. Then I moved the HTML file that calls the plugin, namely the category_list.html, from /source/_includes/asides to /source/_includes/custom/asides, and changed _config.yml a little bit.2

Finally, I copied the contents from my working example (i.e. /source/_includes/custom/asides/about.html) first. As expected, I could see that the “About Me (Brief)” section was duplicated. I changed the code bit by bit, and I managed to include a list of categories.


  1. source/blog/categories/index.markdown at commit 94c7d97 

  2. _config.yml at commit 7dcf6b7 

$\rm \LaTeX$ Template for Chinese Essays

| Comments |

With this template, I believe that creating a Chinese article using $\rm \LaTeX$ should be a lot quicker and easier.

I’ve tried including a Gist in one of my posts. However, each line separates too much from another. Therefore, including a Gist in my post doesn’t seem to be a good idea.

I think that the default layout of the code list in Octopress is much prettier than Gist. I included the source code of my $\rm \LaTeX$ essay in my previous post on $\rm \LaTeX$. Unluckily, some of the functions in Octopress’s code block don’t work. As a result, I have to put the whole source file in that post.

In this post, I’ll just post the link to my $\rm \LaTeX$ Chinese template Gist, and the PDF file.


(Added on AUG 03, 2014)

Since I’ve copied the code for fixing the problem of embedded Gists in Octopress1, I will include the Gist in this post now.

Testing jQuery Image Popup

| Comments |

What’s below is a small picture. The words inside the screenshot can’t be displayed. Users may right-click on the picture and select “View Image”, if there’s a script that enables a magnified image to show up right after a user has clicked on the image, it’ll be more convenient for the user.

fig1

I tried following Clapper’s guide, but as I generate the site using rake, I got two errors. The first one was about CSS, while the second one was about one of the two required Ruby gems. (Namely, mini_magick and Erubis.)

Jump to $\rm \LaTeX$ Syntax Error

| Comments |

This post is written in response to a question of one of my video.

Vim-$\rm \LaTeX$ enables users to jump to a syntax error quickly. To show you how, I use a GIF “animation”, instead of a video, so that the file size is much smaller.

fig1

Explanation:

Error message: The equation* environment is “undefined”.
Cause of error: I forget to include the amsmath package in the preamble.

  • Figure 1: Compilation error occurs, so a quickfix window pops up.
  • Figure 2: I typed j to move the cursor down in the quickfix window by one line, and the window below showing the log file automatically scrolled down.
  • Figure 3: I typed k to go up one line, so the situation goes back to Figure 1.
  • Figure 4: I typed <Enter> to jump to the “error location”. (line 6)
  • Figure 5: I typed <C-w>j to go back to the quickfix window, and the situation goes back to Figure 1 again.
  • Figure 6: I typed j again, and the situation goes back to Figure 2.
  • Figure 7: I typed <Enter> again to jump to another “error location”.

P.S. As I’ve said in my “About” page, I mainly write in Markdown now, unless a teacher want me to submit homework with specific formatting requirements like 1-inch margin, 1.5 line spacing, etc. As you can see from the footer of this blog, this post is also written in Markdown.