Work in progress....

Antena 1 2 3 Podcasts

Posted: May 18th, 2008 | Author: lrei | Filed under: Uncategorized | Tags: , , | Comments Off

The Portuguese public broadcast service, RTP (the Portuguese BBC) has podcasts for some of its radio shows.

Thanks, kudos/props/wtv for the people (person?) responsible for this. I hope more of Antena’s 2 (music) shows get added soon.

Sadly, it seems that, at least at the moment, it’s only low quality samples (for SOMDESCAPE which is the only show, among those available, that I’m interested in).

PS: what’s up with using WMA and Real instead of making stuff available in (high quality) mp3? That’s lame.


UbuntuWebServer Virtual Appliance V1.4

Posted: May 15th, 2008 | Author: lrei | Filed under: Uncategorized | Tags: , , | Comments Off

This is probably the last version of my ubuntu web server VM that will use Ubuntu 7.10.

UbuntuWebServer

Direct Download Link

REVISION LOG:

1.4 – added phppgadmin and some php stuff
1.3 – added FTP Server
1.2 – added JDK+Tomcat5.5 and PostegreSQL
1.1 – added OpenSSL and demo apache configuration (commented)
1.0 – initial release


friendsnippets.com

Posted: May 11th, 2008 | Author: lrei | Filed under: Programming | Tags: , , | Comments Off

friendsnippets.com is for code what del.icio.us is for bookmarks. Just found it and fell in love with it.

link to my account.


reihttpd – a basic web server in C

Posted: May 11th, 2008 | Author: lrei | Filed under: Programming | Tags: , , | Comments Off

My “Computer Networks” (Redes de Computadores) assignment is writing an HTTP server that implements GET and conditional (if-modified-since) GET with persistent connections.

Here’s the code – Obviously, no guarantees.


MNUM – SimpsonCsv

Posted: May 10th, 2008 | Author: lrei | Filed under: Programming, Python | Tags: , , , | Comments Off

This one instead reads the values from a CSV file containing experimental data.
Link to my previous implementation of Simspson’s rule.


import csv

class simpsonCsv:
    def __init__(self, filename):
        reader = csv.reader(open(filename, "rb"))

        xlist = []
        ylist = []
       
        for row in reader:
            try:
               x = float(row[0])
               y = float(row[1])
            except TypeError:
                continue
            except ValueError:
                continue
            xlist.append(float(x))
            ylist.append(float(y))
       
        self.len = len(xlist) - 1
        self.xstart = xlist[0]
        self.xend = xlist[self.len]
        self.interval = self.xend / self.len
       
        self.data = map(None, xlist, ylist)
   
    def f(self, x):
        for (u,v) in self.data:
            if u == x:
                return v
               
        print "Bad x value (probably bad n): %s" % (x)
        return None
       
       
   
    def simpson(self, n):
        "Approximate the definite integral of f from a to b by Simpson's rule."

        if self.len % n != 0:
            print "Error: %d mod %d is not zero but should be." % (self.len, n)
            return -1
       
       
        h  = float(self.xend - self.xstart)/n
       
   
        si = 0.0
        sp = 0.0
        xk = 0.0
   
        for i in range(1, n, 2):
            xk = self.xstart + i*h
            si += self.f(xk)
   
        for i in range(2, n, 2):
            xk = self.xstart + i*h
            sp += self.f(xk)
       
       
        s = 2*sp + 4*si + self.f(self.xstart) + self.f(self.xend)

        return (h/3)*s
   

filename = "integral_tabela_CO2_csv.csv"
s = simpsonCsv(filename)

print s.simpson(20)
print s.simpson(40)
print s.simpson(60)
print s.simpson(100)
print s.simpson(300)
print s.simpson(600)
print s.simpson(900)
print s.simpson(1800)