Blog 1

Random Talk on Random Thoughts

Fixed a JavaScript TypeError

| Comments |

Background

I included an image with changeable size in a post written about two months ago.

How/Why does this work?

  • In brief: View /javascripts/svg-resize-bar.js.
  • For details: click the hyperlink above.

Problem

</source> FF throws TypeError

When I browsed any pages except that post which contains the changeable SVG image, the above TypeError was thrown.

Validate HTML Code for SVG Fallbacks to Text

| Comments |

Background

After I’d written Added W3C Validated Logos to Some Pages, I saw that in the site, there’s still two pages which hadn’t been checked by the W3C’s validators.

Problem

To allow SVG fallbacks to text, I viewed the source code for the SVG example from W3Schools. The fallback message was simply included inside a <svg> tag just like a <p> tag. I applied this technique to source/downloads/code/SVGViewBox/viewBox1.html.

Then I uploaded that HTML file to the W3C’s HTML validator, which complained such an inclusion of text.

Fixed Disqus Comments When Loaded With HTTPS

| Comments |

Background

  1. GitHub Pages now supports HTTPS.
  2. I saw that Google search showed the HTTP version of the hyperlinks.
  3. I want to convert add the existing “http://” to “https://”.

Problem

  1. I changed “http://…” to “https://…” in the Admin settings for the disqus site of this blog.
  2. The original comments disappeared!

How can I get back the original comments and correct the URLs of the links to my blog articles on Disqus?

Added W3C Validated Logos to Some Pages

| Comments |

Background

The web pages under /downloads/code/ don’t conform to the W3C’s standards. This afternoon, after I had rewritten the code and passed the HTML 4.01 Strict Test and CSS3 Test, I was given the code to embed the validation icons.1

HTML code for embedding the validation icon for HTML 4.01 Strict
1
2
3
4
5
<p>
  <a href="http://validator.w3.org/check?uri=referer"><img
    src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Strict"
    height="31" width="88"></a>
</p>

Problem

Unluckily, when I clicked on the icon for re-validation of the site, I got a 404 error.

</source> 404 not found

A Comparison of Similar Horizontal Paddings in $\rm \LaTeX$ Math Mode

| Comments |

Introduction

I prepared this little series of screenshots two years ago. When these pictures were made, I didn’t know anything about fancybox, so I just shared it using Ubuntu One, which is now dead.1

Now, with fancybox, the effects of these commands can be compared below. Click on the left and right arrows in the pop-up window to see the little difference in spacing.

Comparison and conclusion

</source> 1. Original equal sign </source> 2. "\quad" and "\," </source> 3. "\quad" and "\:" </source> 4. "\quad" and "\;"

One Use of Google Cache

| Comments |

Problem

This Thursday, I wanted to browse Evsseny’s article about setting up a Jekyll site using Jekyll-Bootstrap on a GitHub project page.1 Unluckily, this site had been blocked for the administrator.

</source> web site blocked

How can I view the contents of the page?

Concatenate Loop Variable's Value and a String in Bash

| Comments |

Motivation

While I was writing the post about a recent GitHub page build failure ten days ago, I prepared two screenshots of the email from GitHub.1 I would like to resize them to 300px wide so that they wouldn’t be too wide for mobile devices.

Problem

There’re 2 image files in a folder: fail1.png and fail2.png. I wanted to create a scaled-down version of both pictures, and name the smaller ones as fail1_300.png and fail2_300.png.

Failed attempt

$ file *
fail1.png: PNG image data, 467 x 243, 8-bit/color RGB, non-interlaced
fail2.png: PNG image data, 464 x 242, 8-bit/color RGB, non-interlaced
$ for i in {1..2}; do convert fail$i.png -resize 300 fail$i_300.png; done
$ ls
fail1.png  fail2.png  fail.png

Recent Vundle Plugin Update

| Comments |

Background

I use Vundle for managing my Vim plugins.1

Problem

I typed :PluginUpdate in Vim as usual for keeping all of the plugins up-to-date, and the system prompted me to supply my user name and password for GitHub.2 Initially, I refused to do so. Then Vundle skipped the first plugin and proceeded to another one. I was prompted again for the user name, and my response was still the same. This repeated for several times, and finally nothing was updated.

I quitted Vim and re-opened it again, and issued the same editor command for updating the plugins, and ran into the same trouble.

Result

Since I didn’t have much time, I finally input correctly the required account information in order to get the plugins updated. Luckily, this was needed for once only, instead of once for each plugin.

Lessons learnt

Never use vim-surround for code blocks

Vim-surround changes some whitespaces to tabs, which Google doesn’t recommend for indentation.3

Setting the font of a code block

Specifying the font-family of a <pre> tag is useless—change pre to code instead.


  1. For example, you may refer to the screenshot in a comment for my post Clang Complete on Ubuntu 14.04 on Blog 1

  2. The Vim screen that I actually saw

  3. Refer to the “General Formatting Rules” in Google HTML/CSS Style Guide Revision 2.23. 

GitHub Page Build Failure

| Comments |

Problem

I received two emails from GitHub today at 01:15. The emails says that a recent GitHub Page build failed.

fail build 1

fail build 2

Cause

In my YouTube videos about the use of Vim for efficient $\rm \LaTeX$ editing and APA citing, I shared the sample source files and the output PDFs using Ubuntu One, which is now dead.1

To fix this problem, I moved these files from ~/Ubuntu One/path/to/files to ~/octopress as well as ~/octopress/_deploy. Then I pushed my commits to GitHub, and received notifications of an unexpected error. Since I’ve other things to do, I won’t try to learn something from this problem.

Resolution

I just locally generated this site with Rake and deployed it to GitHub. Finally, the URLs for the sample files have been corrected.

Lessons learnt

One may open a text file on the Internet with the following editor command in Vim.

:e http://www.example.com/path/to/file.txt

  1. Shutting down Ubuntu One file services by Jane Silber on Canonical Blog