Update: It’s a reminder… Fatal LaTeX error occurred when I tried to compile the guide file.

Preparations

  • Get TeX: Install MacTeX
  • Editor: Sublime Text and (optional) plugin LaTeXTools (Install Guide, see 11th))
  • Bibliography manager: BibDesk (included in MacTeX)
  • Purpose: Generalise the use of LaTeX for coursework of UK universities
  • More posts

Example 1: Econometrics essay

Highlights

  • Inline maths
  • Display mode maths
  • Choose a maths font
  • Draw a coordinate system
    • Produce from a table
  • Use tables to report results
    • Export from Stata
    • Table notes

Example 2: Politics (multidisciplinary) master dissertation

Highlights

  • Design dissertation layout
    • Header
  • Abbreviations / acronyms
  • Quote beside chapter title
  • Footnote counting
  • Chronologic table footnotes
  • Include Gephi graph
  • Pie chart
  • Chinese characters and pinyin
  • Divide references / bibliography in sections
  • Reference management

The deadline is coming closer but I’m so tired struggling with semiotic concepts…

Contents

Read more

sudo pip install mysql-python
# EnvironmentError: mysql_config not found

I need to add /usr/local/mysql/bin to $PATH, so in terminal I zshconfig, find export PATH=" and add /usr/local/mysql/bin. Now it becomes this,

export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$HOME/bin:/usr/texbin:/usr/local/mysql/bin"

and sudo pip install mysql-python works.

Then, when I try to use MySQLdb to connect MySQL, in terminal I get Library not loaded: libmysqlclient.18.dylib. To solve this, run the following in terminal,

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

Read more

Read more

Install RMySQL on Mavericks

> install.packages("RMySQL")
# package ‘RMySQL’ is available as a source package but not as a binary
> install.packages('RMySQL', type='source')
/*
...
Configuration error:
  could not find the MySQL installation include and/or library
  directories.  Manually specify the location of the MySQL
  libraries and the header files and re-run R CMD INSTALL.

INSTRUCTIONS:

1. Define and export the 2 shell variables PKG_CPPFLAGS and
   PKG_LIBS to include the directory for header files (*.h)
   and libraries, for example (using Bourne shell syntax):

      export PKG_CPPFLAGS="-I<MySQL-include-dir>"
      export PKG_LIBS="-L<MySQL-lib-dir> -lmysqlclient"

   Re-run the R INSTALL command:

      R CMD INSTALL RMySQL_<version>.tar.gz
...
*/
> Sys.setenv(PKG_CPPFLAGS = "-I/usr/local/mysql-5.6.20-osx10.8-x86_64/include/")
> Sys.setenv(PKG_LIBS = "-L/usr/local/mysql-5.6.20-osx10.8-x86_64/lib -lmysqlclient")
> install.packages("RMySQL", type = "source")
/*
...
Error : .onLoad failed in loadNamespace() for 'RMySQL', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RMySQL/libs/RMySQL.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RMySQL/libs/RMySQL.so, 6): Library not loaded: libmysqlclient.18.dylib
...
*/

Now in iTerm 2,

echo "R.home()" | Rscript  /dev/stdin
# [1] "/Library/Frameworks/R.framework/Resources"
fgrep MYSQL_HOME /Library/Frameworks/R.framework/Versions/3.1/Resources/etc/Renviron
# nothing return
echo 'MYSQL_HOME="/usr/local/mysql-5.6.20-osx10.8-x86_64"' >> /Library/Frameworks/R.framework/Versions/3.1/Resources/etc/Renviron
ln -s /usr/local/mysql-5.6.20-osx10.8-x86_64/lib/libmysqlclient.18.dylib /Library/Frameworks/R.framework/Resources/lib

Next in RStudio,

> install.packages("RMySQL", type = "source")
# ...
# * DONE (RMySQL)
# ...

About

Based on unchanged hpstr-jekyll-theme-master.zip from GitHub at 2014-08-07 16:44:14 whose features include animated navigation, images, table rules and buttons. Jekyll use Liquid markup language so you will see many {% something %}. Besides, I just discovered MathJax is easy to set up and renders LaTeX nicely.

Highlights

Contents

Read more

I just don’t get it. Why should I manually set ‘url’ in Jekyll’s _config.yml to http://localhost:4000 when I’m coding and previewing locally (jekyll serve --watch) for the first place?

Luckily, I can have sed do this for me :)

cd ~/GitHub/lsfalimis.github.io &&\
sed -i.bak 's,url: http://localhost:4000,url: http://lsfalimis.github.io,g' _config.yml &&\
git add . -A && git commit -m "update" &&\
git push -u origin master &&\
sed -i.bak 's,url: http://lsfalimis.github.io,url: http://localhost:4000,g' _config.yml

I declare an alias for this in ~/.zshrc.

Contents

About

The free course is LFS101x: Introduction to Linux.

Read more

Set up subl in zsh

# Create a symbolic link (instead of a hard link) by using ln -s
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl
vim ~/.zshrc

耐心拉到底,到export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"这行,在最后括号前加:$HOME/bin,然后:wq