Yak Shaving

just me

Archive for the ‘python’ Category

Problem 3

with one comment

#!/usr/bin/python

def prime(n, start):
    factors = []
    while (n % start != 0):
        start = start + 1

    factors.append(start)

    if n > start:
        factors.extend(prime(n/start, start))

    return factors

print max(prime(600851475143, 71))

Written by channam

November 6th, 2008 at 12:48 am

Posted in code,project euler,python

Tagged with ,

Problem 2

without comments

#!/usr/bin/python

counter = 0

def fib(n):
    result = 0
    a, b = 0, 1
    for i in range(n):
        a, b = b, a + b
	if a < 4000000:
            if a%2 == 0:
                result += a
        else:
            return result

print fib(100000)

Written by channam

November 6th, 2008 at 12:48 am

Posted in project euler,python

Tagged with ,

Problem 1

without comments

#!/usr/bin/python

result = 0

for i in range (1, 1000):
	if i % 3 == 0 or i % 5 == 0:
		result += i 

print result

Written by channam

November 6th, 2008 at 12:44 am

Posted in code,project euler,python

Tagged with ,

GWT on Ubuntu

without comments

Had a hard job getting this to work. But as usual the solution is quite simple:

  1. Download and unzip http://google-web-toolkit.googlecode.com/svn/tools/redist/mozilla/mozilla-1.7.13.tar.gz
  2. Add $INSTALLED_MOZILLA (e.g. /code/mozilla-1.7.13) to mozilla-hosted-browser.conf in the GWT
  3. Add $INSTALLED_MOZILLA (e.g. /code/mozilla-1.7.13) to /etc/ld.so.conf.d/libc.conf (can be any file in that dir ending in conf)
  4. run ldconfig
  5. Start your app and have fun!

If you see gwt-linux-1.5.2/libgwt-ll.so: undefined symbol: JS_PropertyStub then your mozilla-hosted-browser.conf needs to be set to the downloaded mozilla from set 1. Looks like the newer Firefox and Seamonkey dont have this symbol.

Written by channam

September 19th, 2008 at 12:49 am

w00t for Conduit

with one comment

Well yeah not immediately great.

I thought I`d start small by synchronizing Tomboy with a directory. Fail. Running Conduit from the command line revealed the answer – Incompatible Tomboy version. Aha thinks me I`ll upgrade Tomboy – there is bug about the version thing logged on launchpad currently. So, download the current version 0.11 the bleeding edge development one.

Building it fails everytime complaining with: Mono.Cairo.dll missing. Now I wasn’t able to fix this on purpose. I ran

sudo apt-get build-dep tomboy

Which did the right thing fixing the strange missing but installed dll.

Back to Conduit. Now running the spanking new Tomboy I fired up the sync again.

Fail.

Same error this time. So its not Tomboy thats the issue. So as I`m planning to hack around with this anyway I checkout the latest code from subversion using the following instructions: Build Instructions. As its prebuilt from subversion you can just run it without compiling. It all works a treat now. Now for playing.

Thanks John Carr for your speech at LUG Radio for pointing this cool bit of kit out.

Written by channam

July 21st, 2008 at 9:47 pm

Posted in gnome,LUG Radio,python

Tagged with , ,