Browsing All Posts filed under »Programming«

Latexmk + GVim + SumatraPDF (WINE) On Linux

July 23, 2014

0

OK. I admit they are an awkward combination. It is just for me to get rid of ugly evince red box for forward search. I hope this post can help those who want some other awkward combination. Basic I am a daily user of GVim, some time for coding and some time for writing. Latex […]

Add vim key bindings for IPython 1.0.0

October 4, 2013

12

I am a fun of vim and work a lot with IPython Notebook recently. It would be cool to combine the two. Not like emacs having a great plugin supporting IPython protocol, vim is just not good at interacting with external processes. Luckily, I found CodeMirror, the rich editor js lib used by IPython Notebook, […]

Overriding in class inheriting

June 4, 2013

0

As Python is a dynamic language, there are a lot you can play with. However, it also produces a lot of confusion. As one of those, inheriting (or extending) of classes is sometimes different from expected. The following snippet shows a case. The purpose was to extend the the original class meanwhile fixing the implementation […]

Adding table markdown to IPython

April 14, 2013

2

IPython (0.13.2) uses pagedown as Markdown backend, specifically Markdown.Converter.js. Thus the extra feature provided by pagedown-extra can be plugged in, which enables a flavor of Markdown supporting tables. The first thing to do is replacing the integrated Markdown.Converter.js (pagedown) with the latest one, which implements some hooks pagedown-extra required. Download and put the Markdown.Extr.js (pagedown-extra) next […]

Iterators, Generators and yield

May 10, 2011

0

Python is really a great programming language as not only does it provide simple access to text and data but also does it facilitate simple method to boost batch processing. In python programmers can easily use for ... in ... to iterate over a collection. Moreover, they can simply make their objects iterable by generators […]

Long string in source code

May 9, 2011

0

It is annoying to have a long string in source code, but sometimes it is hard to get rid of it from your source code. But for python it is suggested that to have 79 chars per line in source code. Here comes a trick from [1]. OR Do REMEMBER that commas are not allowed […]

Magic Asterisk

May 9, 2011

0

In python, programmers can use *-operator to unpack a list or tuple as a set of parameters to a function. It is quite tricky to pass multiple arguments to a function with this operator. For keyword arguments, programmers can use **-operator.

The extern in C

July 19, 2007

1

I have been confused by the keyword extern for a long time, until I read about the article here (http://publications.gbdirect.co.uk/c_book/chapter4/linkage.html).The C language have two types of objects in a program ( maybe contain several files ), the internal objects and external objects. All the objects in global scope is external objects, such as functions and […]

C++中public,protected,private继承的语意

November 27, 2006

0

今天看了一些关于C++中继承的文章,总结一下:   对于一个父类(基类), 如果声明一个成员为private,就说明这个东东使我的,不能让其他人用,包括子孙。 如果是protected,我就会告诉我的子孙,你们要小心的用,但绝对不能让外人使用。 如果说是public,那就是说,这个东东大家随便用吧。   对于一个子类(从基类继承而来的), private是一个吝啬的继承者,他将从祖辈继承下来的东西统统藏起来,不让别人碰触(包括自己的子孙)。(当然他也只能使用祖辈授予其的权力,即只能使用祖辈中的protected和public)。 protected是一个有保护意识的继承者,他将从祖辈继承下来的东西,只允许自己的子孙使用(即使以前祖辈的东西是公众都可以使用的public)。 public是一个循规守据,他不关心祖辈的东西,原来是什么规矩就是什么规矩,祖辈让用(public)那么大家就可以使用,祖辈说只能子孙使用(protected)那就留给子孙,祖辈自己用的,我也就不过问了。