Blog 1

Random Talk on Random Thoughts

Updated VIMRC for Vundle

| Comments |

Background

Three days ago, I made a change in my VIMRC on *nix due to Vundle’s interface change a year ago.12

With the following Vim editor command, the replacement was done quickly.

:%s/\(Plugin \)\@<="\([^"]*\)"/'\2'/

Problem

I got some errors when I opened Vim again.

Error detected while processing /home/owner/.vimrc:
line   38:
E471: Argument required: Plugin 
line   39:
E471: Argument required: Plugin 
line   40:
E471: Argument required: Plugin 
line   42:
E471: Argument required: Plugin 
line   45:
E471: Argument required: Plugin 
line   46:
E471: Argument required: Plugin 
line   47:
E471: Argument required: Plugin 
line   48:
E471: Argument required: Plugin 
Press ENTER or type command to continue

Read a Proof of Existence of Algebraic Closure

| Comments |

Background

In this Chinese New Year holiday, I read E. Artin’s proof of the existence of algebraic closure, which could be found online.1

Problem

Two days ago, I was stuck at the point where the ideal $I$ of $F[\dots,X_f,\dots]$ was defined. I mistakenly thought that one needed to fix an arbitrary polynomial $f$ in the polynomial ring $F[X]$ first because the goal of this theorem is to show the existence of an algebraic field extension $E$ of $F$ so that $E$ is algebraically closed, and for any nonconstant polynomial $f$ in $F[X]$, $f$ has a root (a.k.a. zero) in $E$.

Resolution

This noon, I finally saw “indexed by $f$”, and I found I should interpret “the ideal generated by $f(X_f)$” in this way:

\[ I := \left\{\sum_{m = 1}^n g_m (\dots,X_f,\dots) f_m (X_{f_m}) : n \in \Z_{>0}, f_i \in F[X], g_i (\dots,X_f,\dots) \forall i \in \{1,\dots,n\}\right\}, \]

instead of viewing $f(X)$ as a fixed polynomial in $F[X]$.


  1. Milne, J.S. (2014). Fields and Galois Theory (v4.50) (pp. 87). Available at http://www.jmilne.org/math/ 

Switch Tmux Panes and Vim-$\rm \LaTeX$

| Comments |

Background

I use Byobu with Tmux backend.1

Problem

  • Moving across panes is inconvenient.
  • If I have a Vim vertical/horizontal split in a Tmux pane, I need to use two different sets of key bindings to navigate the adjacent panes.
  • In the copy mode, it’s great that most of the key bindings follow from those of Vim, but not the most important two:
    • start selection
    • copy

Solution

I find two articles on Giant Robots very useful.

  1. Seamlessly Navigate Vim and tmux Splits
  2. Tmux Copy & Paste on OS X: A Better Future

Therefore, I followed the steps in the first blog post, and installed Vim Tmux Navigator.

Another problem

After the installation of the Vim plugin, I got another problem while editing my VIMRC: The {Down-Mapping} didn’t work. Vim-$\rm \LaTeX$ should know the reason. I found an article describing a similar problem.2 However, I wouldn’t like to change ~/.vim/bundle/vim-latex/plugin/imaps.vim, so I got stuck at this point for hours. I tried to substitute {Down-Mapping} with <C-a>j in VIMRC, but it didn’t work.

Lessons Learnt

  1. Accept simple ways to do things

    Even though I can’t set {Down-Mapping} to <C-j>, the Vim editor command :TmuxNavigateDown isn’t so hard to type. I failed to realise that typing :tm<Tab> will do, and wasted time on that. Now I accept the use of two different sets of keystrokes for switching to the Tmux pane/Vim buffer below. We can look at this problem from another angle.

  2. Store a list of windows in a file

    A sample file can be found on Super User.3 I found that if I had run Byobu before, a session 0 would also be created on top of tmuxs. To avoid this problem, remove the first line in the sample window list and type byobu attach -t 0 starting from the second time of opening Byobu.


Let TTY Remember SSH Passphrase

| Comments |

Problem

After I’ve written posts for this blog, I would like to publish them by rake deploy, but I was prompted to type my passphrase for ~/.ssh/id_rsa for multiple times in Linux text mode.1 (In GNOME shell, this won’t be a problem.)

In fact, this problem can be generalised to the following one: What can be done so that the terminal only asks for the SSH passphrase for the first Git push to a remote server?

Code Blocks in Octopress Atom Feeds

| Comments |

Problem

After I re-generated this site, it is possible that the code blocks and the pictures in the RSS feeds are gone.

WRONG version of C/C++ category feedView Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<p>{% codeblock first_graphics_prog.cpp lang:cpp %}
// Author: David Yevick
// Source: A Short Course in Computational Science and Engineering
#include <iostream>
#include <dislin.h></dislin.h></iostream></p>

<p>using namespace std;</p>

<p>int main(int argc, const char *argv[])
{
    // Some code for defining variables
    // Omitted to avoid copyright problems
    // An example of using DISLIN methods
    qplot(array1,array2,numOfPts);
}
{% endcodeblock %}</p>

Remark: One can view the original file on GitHub by clicking “View Raw”.

Sometimes, I was unaware of this, especially after writing a simple post that could surely be correctly parsed by kramdown. When I saw something like what’s shown in the above code block in a category feed page in this blog on the Internet, this error had already published.

Use Tmux for Previewing Posts

| Comments |

Problem

After I finished an Octopress post, one may check if there’s any error by previewing the post. In GUI, it’s easy: just open a new window. How about in Linux text mode?

A so-called method

Add an ampersand ‘&’ behind the command for previewing the blog. However, while viewing the site in a browser, the contents would be covered by some lines.

127.0.0.1 - - [14/Feb/2015:13:46:08 +0800] "GET / HTTP/1.1" 200 39685 0.0024
127.0.0.1 - - [14/Feb/2015:13:46:14 +0800] "GET /blog/2015/02/14/tried-range-bas
ed-for-loop/ HTTP/1.1" 200 21821 0.0028
127.0.0.1 - - [14/Feb/2015:13:46:59 +0800] "GET /atom.xml HTTP/1.1" 200 131801 0
.0071

This can be an inconvenience. It isn’t hard to log on another TTY and open the browser there, but one has to type the password twice—this is still inconvenient.

Solution

I now use Byobu, which depends on Tmux, to preview the generated blog.1


  1. The screenshot of Tmux. 

Tried Range-based for Loop

| Comments |

Problem

I saw an example for range-based for loop in a Stack Overflow question and I compiled it in my own computer.1 Then I got an error.

$ g++ temp1.cpp
temp1.cpp: In function ‘int main()’:
temp1.cpp:9:18: error: range-based ‘for’ loops are not allowed in C++98 mode
    for (int i : bar) {
                  ^
temp1.cpp: In function ‘void foo(int (&)[3])’:
temp1.cpp:16:18: error: range-based ‘for’ loops are not allowed in C++98 mode
    for (int i : bar) {
                  ^

Subring of Ring With Unity

| Comments |

I’ve just read a statement which asserts that a subring isomorphic to $\Z$ or $\Z_n$ can be found in any ring $R$ with unity. The proof which is based on a ring homomorphism $\phi:\Z\to R$ defined by $\phi(m) = m\cdot 1$ isn’t difficult to read.

I used fifteen minutes to think of why one needs a subring inside the ring $R$ with unity, instead of $R$. After I’ve come up with $R=\langle1,\frac{1}{2}\rangle=\left\{\frac{a}{2^b} \,\middle|\, a \in \Z, b \in\Z_{\ge 0} \right\}$, I start this post.

Got a Win* Blue Screen

| Comments |

This afternoon, I got a BoD on M$ Win*, which couldn’t be captured by PrtSc. However, after I’ve rebooted my laptop, I got this dialog box.

</source> got a BoD

Then I wrote a post for that, and while I was writing this post, another dialog box popped up and disrupted my thoughts.

</source> got a BoD

I’m sure that I won’t get into these troubles on GNU/Linux.

Certificate Verify Failed During Gem Update

| Comments |

Background

I pull the Git commits from the origin of this blog to Git Bash on M$ Win*. The Gemfile has changed due to commit fbc3c0b.

Problem

I ran bundle install according to the official documentation, and got an unexpected error.1

Owner@OWNER-PC /c/github/vincenttam.github.io (source)
$ bundle install
DL is deprecated, please use Fiddle
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Bundler could not find compatible versions for gem "sass":
  In snapshot (Gemfile.lock):
    sass (3.2.19)

  In Gemfile:
    compass (~> 1.0.1) x64-mingw32 depends on
      sass (< 3.5, >= 3.3.13) x64-mingw32

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

Without updated gems, even though everything in the source folder is correct, one can’t generate an Octopress blog. How can one get the gems updated?