Blog 1

Random Talk on Random Thoughts

Jekyll Serve Error

| Comments |

Background

I updated the Jekyll-Bootstrap source code for Blog 2.

Problem

Then, I wanted to preview it.

[owner@localhost ~/blog2]$ jekyll serve
/home/owner/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.5/lib/bundler/resolver.
rb:357:in `resolve': Could not find gem 'jekyll (~> 3.1) ruby' in the gems avail
able on this machine. (Bundler::GemNotFound)
        from /home/owner/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.5/lib/bund
ler/resolver.rb:164:in `start'
        from /home/owner/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.5/lib/bund
ler/resolver.rb:129:in `resolve'
        from /home/owner/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.5/lib/bund
ler/definition.rb:203:in `resolve'
        from /home/owner/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.5/lib/bund
ler/definition.rb:133:in `specs'
        from /home/owner/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.5/lib/bund
ler/definition.rb:178:in `specs_for'
        from /home/owner/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.5/lib/bund
ler/definition.rb:167:in `requested_specs'
        from /home/owner/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.5/lib/bund
ler/environment.rb:18:in `requested_specs'
        from /home/owner/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.5/lib/bund
ler/runtime.rb:13:in `setup'
        from /home/owner/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.5/lib/bund
ler.rb:120:in `setup'
        from /home/owner/.rvm/gems/ruby-2.1.2/gems/jekyll-2.5.3/lib/jekyll/plugi
n_manager.rb:37:in `require_from_bundler'
        from /home/owner/.rvm/gems/ruby-2.1.2/gems/jekyll-2.5.3/bin/jekyll:16:in
 `<top (required)>'
        from /home/owner/.rvm/gems/ruby-2.1.2/bin/jekyll:23:in `load'
        from /home/owner/.rvm/gems/ruby-2.1.2/bin/jekyll:23:in `<main>'
        from /home/owner/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `e
val'
        from /home/owner/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<
main>'

How can it be previewed?

Fixed Jekyll-Bootstrap Asset Path (2)

| Comments |

Background

I attempted to manually fix a problem in the first post in this series half a year ago.

Problem

I have just updated the Jekyll source code for Blog 2.

[owner@localhost ~/blog2]$ git pull jekyll master
remote: Counting objects: 37, done.
remote: Total 37 (delta 10), reused 10 (delta 10), pack-reused 27
Unpacking objects: 100% (37/37), done.
From github.com:plusjade/jekyll-bootstrap
 * branch            master     -> FETCH_HEAD
   3a34785..8193869  master     -> jekyll/master
Removing sitemap.txt
Auto-merging _includes/JB/setup
CONFLICT (content): Merge conflict in _includes/JB/setup
Auto-merging _config.yml
Automatic merge failed; fix conflicts and then commit the result.

How to repair this failed merge?

Restore Corrupt Git Repository

| Comments |

Background

I hadn’t used Vim on my GNU/Linux desktop for a month. When I used it again, an error message was shown on the screen.

[owner@localhost ~]$ vi
Error detected while processing
/home/owner/.vim/bundle/nerdtree/plugin/NERD_tree.vim:
line  153:
E117: Unknown function: nerdtree#ui_glue#setupCommands
Error detected while processing function nerdtree#postSourceActions:
line    2:
E117: Unknown function: nerdtree#ui_glue#createDefaultBindings
Press ENTER or type command to continue

Since I was occupied with another blog, thinking that the problem would be quickly fixed by an update of the NERD tree, a Vim plugin for showing a file tree in a sidebar, I didn’t want to find out the cause.

Problem

During this Vundle update, an exclamation mark with red background was displayed on the LHS of the item Plugin 'scrooloose/nerdtree' in the list contained in the status bar. I then checked Vundle’s update log.

[2016-08-12 15:18:40] Plugin scrooloose/nerdtree
[2016-08-12 15:18:40] $ cd '/home/owner/.vim/bundle/nerdtree' && git pull && git submodule update --init --recursive
[2016-08-12 15:18:40] > error: object file .git/objects/2e/2b649232d6ae4d02d74793e5da0ee08480ad8d is empty
[2016-08-12 15:18:40] > error: object file .git/objects/2e/2b649232d6ae4d02d74793e5da0ee08480ad8d is empty
[2016-08-12 15:18:40] > fatal: loose object 2e2b649232d6ae4d02d74793e5da0ee08480ad8d (stored in .git/objects/2e/2b649232d6ae4d02d74793e5da0ee08480ad8d) is corrupt
[2016-08-12 15:18:40] > fatal: The remote end hung up unexpectedly
[2016-08-12 15:18:40] > 

While I was trying to update this plugin manually by typing in Git commands in bash, the electricity supply of my desktop went off suddenly. After it had been switched on again, I tried typing in the commands again, and I got the same error.

How can the Git repository be restored to its previous state, so that it’s intact?

$\rm \LaTeX$ French Letter Template

| Comments |

I just include the files here for future references. Since the code are universal, I assume that the source file and the linked PDF file below are in public domain, despite the CC-BY-SA licence at the bottom of this page.

Sample French $\rm \LaTeX$ letter (ltr.tex) download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
\documentclass[12pt]{lettre}
\usepackage{fontspec}
\usepackage[frenchb]{babel}

\begin{document}
\begin{letter}{
    Nom de destinataire \\
    4, boulevard de la Paix, \\
    12345 Nom de ville
}

  \name{Votre NOM}
  \address{
    Votre NOM\\
    23, rue à votre ville \\
    23456 Nom de votre ville
  }
  \lieu{Votre ville}
  \telephone{01 02 03 04 05}
  \nofax

  \def\concname{Objet :~}
  \conc{Saisir votre objet}
  \opening{Madame, Monsieur,}

  Un exemple d'une lettre $\rm \LaTeX$ faite par \LaTeX.  Le faux
  texte ci-dessous est généré par le plugin Lorem Ipsum pour Vim.

% lorem{{{
  Curabitur eget nisi at lectus placerat gravida. Vivamus nulla. Donec
  luctus. Sed quis tellus. Quisque lobortis faucibus mi. Aenean vitae
  risus ut arcu malesuada ornare. Maecenas.

  Amet, rhoncus in, ipsum. Mauris rhoncus, lacus eu convallis sagittis,
  quam magna placerat est, vitae imperdiet mauris arcu ac dui. In ac
  urna non justo posuere mattis. Suspendisse egestas bibendum nulla. In
  erat nunc, posuere sed, auctor quis, pulvinar quis, mi. Mauris at est.
  Phasellus lacinia eros in arcu. Maecenas lobortis, tellus vel gravida
  tincidunt, elit erat suscipit arcu, in varius erat risus vel magna.
  Fusce nec ante quis dolor vestibulum bibendum. Pellentesque sit amet
  urna.
% lorem}}}

  \closing{Veuillez d'agréer, Madame, Monsieur, mes salutations les
  meilleures.}

\end{letter}
\end{document}

You may view the output PDF before downloading the above sample.

Writting Letter With Bibliography

| Comments |

Background

Recently, I need to write letters. Get the formatting for addressee and sender automatically done, I choose $\rm \LaTeX$. I cite a book in my letter, and try to add a bibliography at the end of the letter.

Problem

During the compilation for the following letter, an error was thrown.

A failed $\rm \LaTeX$ letter (noltrbib.tex) download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
\documentclass[12pt]{lettre}
\usepackage{fontspec}
\usepackage[frenchb]{babel}
\usepackage[backend=biber]{biblatex}
\addbibresource{ltrbib.bib}
\usepackage{csquotes}

\begin{document}
\begin{letter}{
    Nom de destinataire \\
    4, boulevard de la Paix, \\
    12345 Nom de ville
}

  \name{Votre NOM}
  \address{
    Votre NOM\\
    23, rue à votre ville \\
    23456 Nom de votre ville
  }
  \lieu{Votre ville}
  \telephone{01 02 03 04 05}
  \nofax

  \def\concname{Objet :~}
  \conc{Saisir votre objet}
  \opening{Madame, Monsieur,}

  Un exemple de citation dans un document $\rm \LaTeX$.  \cite{serre}
  Le faux texte ci-dessous est généré par le plugin Lorem Ipsum pour
  Vim.

% lorem{{{
  Curabitur eget nisi at lectus placerat gravida. Vivamus nulla. Donec
  luctus. Sed quis tellus. Quisque lobortis faucibus mi. Aenean vitae
  risus ut arcu malesuada ornare. Maecenas.

  Amet, rhoncus in, ipsum. Mauris rhoncus, lacus eu convallis sagittis,
  quam magna placerat est, vitae imperdiet mauris arcu ac dui. In ac
  urna non justo posuere mattis. Suspendisse egestas bibendum nulla. In
  erat nunc, posuere sed, auctor quis, pulvinar quis, mi. Mauris at est.
  Phasellus lacinia eros in arcu. Maecenas lobortis, tellus vel gravida
  tincidunt, elit erat suscipit arcu, in varius erat risus vel magna.
  Fusce nec ante quis dolor vestibulum bibendum. Pellentesque sit amet
  urna.
% lorem}}}

  \closing{Veuillez d'agréer, Madame, Monsieur, mes salutations les
  meilleures.}

  \printbibliography
\end{letter}
\end{document}
A sample Bib$\rm \LaTeX$ file (ltrbib.bib) download
1
2
3
4
5
6
7
8
9
@BOOK{serre,
    author = {Serre, J. P.},
    title = {Cours d'arithmétique},
    publisher = {Presse Universitaire de France},
    year = {1970},
    edition = {1ère ed.},
    address = {Paris, France},
    pages = {103--106},
}

Here’s my compilation procedure.

$ xelatex noltrbib.tex
$ biber noltrbib
$ xelatex noltrbib.tex
This is XeTeX, Version 3.1415926-2.5-0.9999.3 (TeX Live 2013/Debian)
 restricted \write18 enabled.
...
! Undefined control sequence.
\\blx@head@bibliography [#1]->\section 
                                       *{#1}\markboth {\MakeUppercase {#1}}{...
l.52 \end
         {letter}
?
...

I type <Enter> at ?, and get a PDF that seems OK. You may read the log file for this file to know more about this error. However, each time I use $\rm \LaTeX$-Suite to compile the document inside Vim, a quickfix window pops up. This is quite inconvenient: I need to use <C-w>k to switch to the original buffer or ZQ to close the quickfix window. Therefore, I am motivated to find out a solution for this error.

I-Search and Reverse I-Search

| Comments |

One knows that long commands can be retrieved by <C-r>. If the search fails, one may cancel it by <C-g>. However, how can one search forward through the command history instead of backword?

The answer is simple: add stty -ixon to your BASHRC.

$\rm \LaTeX$-Suite in Portable Git

| Comments |

Background

A year ago, I was using msysgit on M$ Win* 7. Its support for Unicode characters isn’t so good, and I can’t write a text file with accents like “café” in the Vim editor that shipped with msysgit. As a result, I needed GVim for editing my $\rm \LaTeX$ documents.

Unluckily, unlike Linux, the GVim can never have forward control. Therefore, I needed to switch windows between GVim and Git Bash.

More importantly, if I want to apply the Linux skills and the tools on M$ Win*, I need portable programs excutable on a USB unless I carry my laptop.

Luckily, the bash shell in Git for Windows has improved a lot. The accents are well supported. Then, I have switched from GVim to the embedded Vim in Git for Windows. Luckily, the setup of Vundle was smooth. Most of the installed plugins work fine in terminal Vim.

Problem 1

In the post Git Portable Home Path, a BAT file is included so that the home folder and the HOMEDRIVE environment are automatically set. Since the same Git repository can be shared among multiple devices, such as my Linux desktop, my M$ Win* 7 laptop, and my USB stick, a bare repository is needed for efficient pulling and pushing of Git commits. Since I work outside home, I place a bare Git repo in my USB stick. However, for each local Git repository stored in the USB stick (under ~/local_repo, a.k.a. $HOMEDRIVE/PortableGit/home/owner/local_repo), I need to run the following command for each time I use Git Bash.

Problem 2

After making some changes on a $\rm \TeX$ file, I compiled the file using Mik$\rm \TeX$ Portable.

  1. Browse the folder $HOMEDRIVE/MikTeXPortable/.
  2. Double-click on miktex-portable.cmd.
  3. In the Command Prompt popped up, switch to $HOMEDRIVE/PortableGit/home/owner/local_repo.
  4. Type pdflatex file.tex.

This sounds really slow. The goal is to find a more efficient $\rm \LaTeX$ editing workflow.

That’s not the end. Another bad news came from eu1lmr.fd. I’ve got error similar to fengbaobao6’s. The compilation was stuck at ...\tex\latex\euenc\eu1lmr.fd. Then an error was shown: “Fontconfig error: Cannot load config file”.

Can't Visit WordPress.com

| Comments |

Background

While removing the “here”’s in the hyperlink text, I clicked on a link to my old blog on WordPress.com. Unfortunately, after 15 seconds, I couldn’t see the output.

More errors

I suspect that it was a problem of the server of WordPress.com. I think the following screenshot confirm my guess.

</source> Address NOT found

Remarks

This justifies the migration from WordPress to Octopress of this blog.