http://andrewleigh.com/?p=2132

I like the one about coin flipping.

http://andrewleigh.com/?p=2132

I like the one about coin flipping.

Ok here’s the problem. I need to produce fast documents with images, and I want to control the layout of the images.

Word is a pain for this. So is Lyx. Obviously this is not a job for straight Latex. Neither is the restructured text I use for most of my day to day notes good for this either.

So, I’m giving Scribus a spin.

Macports compiles it just fine. Took about an hour or so, I think a fair chunk of that was compiling qt3. Hmm, qt3. Is the macports version an old one?

UPDATE: would you know, I gave up, and just used Powerpoint…

So my proxy server doesn’t seem to be working. Looks like a lot of peeps are on the bandwagon now – this is good.

Austinheap has guides on his blog for setting up servers. Most recent advice is to use new ports as the usual ones (e.g. 3128) are blocked.

one proxy server coming up let’s hope the good guys get to it…

I am in the middle of the Kingdom of Loathing literacy test and I have to say that it is awesome. It can be found at http://www7.kingdomofloathing.com/main.html.

I’m trying out Cython to see if it the answer for making fast nbody systems with python. What follows is code for computing the covariance of two vectors. This is not optimised cython, it’s purely my first attempt at getting a cython program to compile and run. I recommend The Cython Numpy tutorial as a nice place to start.

Did I mention installation? Just download and then run setup.py, I didn’t need to do anything special.

#covar.pyx# import numpy as np def cov(a,b): # Computes the covariance between the n element vectors a and b # c is the output array indexed by x,y if len(a.shape) != 1: raise ValueError("Array must be one dimensional.") if a.shape != b.shape: raise ValueError("arrays must be the same shape") n = a.shape[0] c = 0 # Perform the calculation for i in range(n): c += (a[i]-np.mean(a[:]) ) * (b[i] - np.mean(b[:]) )/n return c

#test_covar.py# """ Covariance with Cython. """ import numpy as np import covar n = 50 a = length*np.random.random((n)) b = length*np.random.random((n)) print "Covariance of two numpy random vectors",covar.cov(a,b) print "Covariance of a vector with itself.",covar.cov(a,a) print "Covariance of a vector with its sine.",covar.cov(a,np.sin(a))

And the build script. I got frustrated trying to figure out the compiler flags, and ended up using distutils to do it for me. I will post a cython nbody system soon which will use disutils to compile.

build_covar.sh #!/bin/ksh # TRANSLATE cython -a covar.pyx # COMPILE gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c covar.c -o covar.o gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup covar.o -o covar.so # TEST python test_covar.py

Enjoy.