Tree

So, I was looking for a picture of a tree and found some nice pictures of fractal trees. That, I thought, would be interesting to code. Here are some of the results. This was coded in C#, each element ( a trunk/branch/twig ) is a fractal, a twig with a length < 3 aborts the […]

Continue Reading

Normalize URL path python

I had a problem with some URLs that we found on someones website. They looked like this: <a href=”http://example.com/../../../path/page.html”>, here is the same link: test. Notice that when you mouse over it, Firefox normalizes the URL so it looks correct. Using urlparse in Python: print urlparse.urljoin( ‘http://site.com/’, ‘/path/../path/.././path/./’ ) ‘http://site.com/path/../path/.././path/./’ How, poopy. So, we need to do better than that. The os module […]

Continue Reading

Beautiful soup findall CSS files

BeautifulSoup is a python class that takes HTML and returns a tree of objects. You can then search that tree to find HTML tags (which is pretty mega easy.) Here is a little example that downloads the msn.com web page, parses it using BS and grabs all the LINK tags that are linking to a CSS file: from BeautifulSoup import BeautifulSoup import urllib2url = “http://www.msn.com” request = urllib2.Request(url) […]

Continue Reading

Biffy Clyro Means

I like Puzzle, the new music from Biffy Clyro. I really like it. But what the feck does Biffy Clyro mean? They are from Scotland, so I thought maybe it was where they came from. Nope. I did a lot of searches but could find nowt. Eventually I took Trays advice and just asked google, […]

Continue Reading

Glass Shark Gig

Wow! Glass Shark at the Blue Bar on Saturday was freekin amazin. The band is made up of three dudes, one on lead guitar, on drummer and one bass. But for three guys they make a hell of a lot of noise . I like. I like a lot. They mostly played their own songs, but they also did […]

Continue Reading