Monthly Archives: September 2013

Change gedit embedded terminal colors

For Ubuntu only:

  1. install dconf-tools and gconf-editor
  2. in gconf-editor, navigate to apps → gnome-terminal → profiles → Default
  3. in dconf-tools, navigate to org → gnome → gedit → plugins → terminal
  4. uncheck “use-theme-colors”
  5. copy values of “background-color“, “foreground-color“, and “palette“, from gconf-editor to dconf-tools

Install Gnuplot 4.6 with PDF on Ubuntu

It is always hard to install gnuplot manually on Ubuntu, especially if you want to plot diagram in PDF, JPEG, or PNG formats. This short 101 article describes one way to install gnuplot with PDF on Ubuntu.

  1. download pdflib-light and extract to $PDFLIB
  2. compile and install pdflib-light

    cd $PDFLIB
    ./configure  
    make  
    sudo make install
    
  3. refresh lib cache: sudo ldconfig

  4. download gunplot and extract to $GNUPLOT

  5. compile and install gnuplot

    cd $GNUPLOT  
    ./configure --with-pdf  
    make  
    sudo make install  
    

Note: other packages which can be installed via apt-get read more

The best way to place figures side-by-side in Latex

There are different way of placing figures side by side in Latex, subcaption, subfig, subfigure, or even minipage. This post will tell you which one is the best.

subcaption

A useful extension is the subcaption package (the subfigure and subfig packages are deprecated and shouldn’t be used any more), which uses subfloats within a single float. This gives the author the ability to have subfigures within figures, or subtables within table floats. Subfloats have their own caption, and an optional global caption. An example will best illustrate the usage of this package:

\usepackage{subcaption} 
... 
\begin{figure}
  \begin{subfigure}[b]{0.4\textwidth}
    \includegraphics[width=\textwidth]{1.png}
    \caption{Picture 1}
    \label{fig:1}
  \end{subfigure}
  %
  \begin{subfigure}[b]{0.4\textwidth}
    \includegraphics[width=\textwidth]{2.png}
    \caption{Picture 2}
    \label{fig:2}
  \end{subfigure}
\end{figure}

minipage

The minipage can be used to place figures side-by-side too. But it is not a floating environment, thus has to be placed in a figure environment. Another disadvantage of minipage is that it does not align fi gures. Therefore, subcaption is still the best package you should use.

\begin{figure} \begin{minipage}[b]{0.4\textwidth} \includegraphics[width=\textwidth]{1.png} \caption{Picture 1} \label{fig:1} \end{minipage} \begin{minipage}[b]{0.4\textwidth} includegraphics[width=textwidth]{2.png} \caption{Picture 2} \label{fig:2} \end{minipage} \end{figure} read more

函数式编程的另类指南(4)

The following part is not maintained anymore. Please go to 函数式程序设计的另类指南 for the whole translation.

以下内容不再更新,浏览全部翻译,请访问 函数式程序设计的另类指南

原文链接:Functional Programming For The Rest of Us
原文作者:Vyacheslav Akhmechet

函数式编程

函数式程序设计是对阿隆左·丘奇思想的一种实现。但并非所有的lambda演算都被实现了,因为lambda演算原本不是为有物理限制的计算机设计的。因此,函数式像面向对象程序设计一样,只是一系列理念,而不是严格的使用手册。如今有很多种函数式编程语言,它们各自采用了不同的方法。在本文中,我将使用Java来编写函数式程序,并且解释函数式语言的常用特性(的确,如果你有受虐倾向,你可以用Java写函数式程序)。在下面几章中,我将会对Java稍作修改,以使其成为一个可用的函数式编程语言。那我们开始吧。 read more

函数式编程的另类指南(3)

The following part is not maintained anymore. Please go to 函数式程序设计的另类指南 for the whole translation.

以下内容不再更新,浏览全部翻译,请访问 函数式程序设计的另类指南

原文链接:Functional Programming For The Rest of Us
原文作者:Vyacheslav Akhmechet

历史一瞥

再次启动时间机器,这次我们回到二十世纪30年代。大萧条正在蹂躏着那个新旧交替的时代。空前的经济下滑影响着几乎所有阶层的家庭。只有少数人还能够保持着饥谨危机前的安逸,比如普林斯顿大学的数学家们。 read more

函数式编程的另类指南(2)

The following part is not maintained anymore. Please go to 函数式程序设计的另类指南 for the whole translation.

以下内容不再更新,浏览全部翻译,请访问 函数式程序设计的另类指南

原文链接:Functional Programming For The Rest of Us
原文作者:Vyacheslav Akhmechet

信步游园

启动时间机器,我们来到两千多年前的一个公园里。具体时间大约是公元前380年的一个春光明媚的周日。在雅典城外的橄榄树树荫里,柏拉图(Plato)和一个英俊的奴隶小男孩正朝着学院走去。那天天气很好,晚饭也不错。他们边走边讨论一个哲学问题。 read more

函数式编程的另类指南(1)

The following part is not maintained anymore. Please go to 函数式程序设计的另类指南 for the whole translation.

以下内容不再更新,浏览全部翻译,请访问 函数式程序设计的另类指南

原文链接:Functional Programming For The Rest of Us
原文作者:Vyacheslav Akhmechet

简介

程序员拖沓成性,每天到了办公室以后,泡泡咖啡、查查邮箱、读读RSS上的回复,看看新闻,到技术站点查阅一下最新的文章,然后在编程论坛的相关版面浏览公共讨论区,并一次次地刷新以免漏掉任何一条留言。接着是午饭,回来后盯着IDE没几分钟,就再次检查邮箱,冲一杯新的咖啡。最后在不知不觉中,结束了一天。 read more

Scale, Standardize, and Normalize Data

Note: Contents and examples in this article are partially from Scikit-learn-Preprocessing data and faqs.org-Should I normalize/standardize/rescale the data

Scaling

Scaling a vector means to add/substract a constant, then multiply/divide by another constant, so the features can lie between given minimum and maximum values. The motivation to use this scaling include robustness to very small standard deviations of features and preserving zero entries in sparse data. Normally, the given range is [0,1]

For example, if we have a dataset like below, read more