just a reminder of a very useful set of tips to effectively use vim to edit python files:
http://henry.precheur.org/2008/4/18/Indenting%20Python%20with%20VIM.html
just a reminder of a very useful set of tips to effectively use vim to edit python files:
http://henry.precheur.org/2008/4/18/Indenting%20Python%20with%20VIM.html
if you work in a company with a too restrictive firewall, but you still need to access a cvs repository like sourceforge, you can bypass it using the program connect.c.
from here:
connect.c is the simple relaying command to make network connection via SOCKS and https proxy. It is mainly intended to be used as proxy command of OpenSSH.
just download it and compile it (for windows users there is a precompiled connect.exe). then, if you want to use the SOCKS server “socks.local.net” to access the internet, add these two lines to your .ssh/config:
Host remote.outside.net ProxyCommand connect -S socks.local.net %h %p
in my case, I use an http proxy to access the internet, instead of the SOCSK, and I do not
want to use connect.exe for internal repositories. hence, my .ssh/config file is:
Host empy.cvs.sourceforge.net ProxyCommand connect -H proxy.company.net:80 %h %p
enjoy!
recently, from a discussion on the scipy-user group I discovered a very elegant way to code a function with memory.
let’s state the problem. suppose you need a function that remembers, for each time it has been called, the input parameters and its output. this can be very useful in many different situations:
the function’s memory can be as long as the program’s running time, or it can be ‘permament’ if hard-coded in a file.
starting from here I’ve put together a couple of useful classes in python that can be used as decorators. they are use as follow:
# function to memoize def f(x): return x**2 # memoized function memoized_f = memoize(f) # memoized function on a file memoized_persistent_f = memoize_persistent(f)
decorators can be used:
# function to memoize @memoize # or @memoize_persistent def f(x): return x**2
which is equivalent to: f = memoize(f).
you can download the code here.
enjoy!
for you, Python lover, who always needs Matlab functions: boundary value problems are not a problem anymore.
Googling for a bvp4c clone, I ended up here:
This is a Python wrapper for a modified version of the COLNEW boundary value problem solver by U. Ascher and G. Bader. Modifications made include vectorization over mesh points and better compatibility with Python.
there are little differences in the usage, though. I tried to reproduce the examples in this tutorial, to clarify things. You can download the first two examples here.
enjoy!