Archive of July 2008

July 30

Remembering CTY’s traditions, it’s sacred things that can’t be explained, it’s not hard to imagine how religion arises.

11:48 AM | 0 Comments
July 28

[Anonymous is] the first internet-based superconsciousness. Anonymous is a group, in the sense that a flock of birds is a group. How do you know they’re a group? Because they’re travelling in the same direction. At any given moment, more birds could join, leave, peel off in another direction entirely.

Chris Landers, via Wikipedia. I <3 the Internet so much.

09:58 PM | 0 Comments
ac1.jpg

What comes out of Tom de Smedt’s Percolator script when “terrorism” is put in.

The script Googles the inputted word and follows links to news sites, extracting frequently used words with Nodebox‘s Keywords library. The script then uses the Photobjects image database to gather images depicting these “important” words, and places them on a canvas with the PhotoBot library.

Pretty cool, although I’m not sure it’s really artificial creativity.

10:41 AM | 0 Comments
July 26

The Work of Jonathan Harris

These projects are all very insightful, not to mention impressive code-wise. Super cool.

09:01 PM | 0 Comments

GithubTwitter

You can set a Github repo to POST commit information as JSON to a certain URL when you commit. This no-nonsense Sinatra app parses that JSON and sends it to Twitter‘s API. Huzzah!

08:39 PM | 0 Comments

Hello World in Sinatra

require "rubygems" 
require "sinatra" 
 
get '/' do
 "Hello World" 
end
 
# that's about as short as it can get, folks...
08:13 PM | 0 Comments
0727-nat-READING-web.jpg

Comparison of reading websites and books, from the New York Times

08:09 PM | 0 Comments

So I Signed Up for Twitter

We’ll see if I keep up with it.

04:08 PM | 0 Comments
July 25

Python Blog with CherryPy

import cherrypy, jinja2, database
 
env = jinja2.Environment(loader=jinja2.FileSystemLoader('templates'))
 
def redirect(url):
  cherrypy.response.status = 302
  cherrypy.response.headers['Location'] = url
 
def connect(thread_index):
  cherrypy.thread_data.db = database.connect('blog')
 
cherrypy.engine.subscribe('start_thread',connect)
 
def render_template(template,**context):
  global env
  template = env.get_template(template+'.jinja')
  return template.render(context)
 
class Blog:
 
  @cherrypy.expose()
  def index(self):
    result = cherrypy.thread_data.db.posts.all()
    result.reverse()
    posts = []
    for post in result:
      posts.append({
        'id': post[0],
        'title': post[1],
        'body': post[2]
      })
    return render_template('index',posts=posts)
 
  @cherrypy.expose()
  def view(self,id):
    result = cherrypy.thread_data.db.posts.find(id)[0]
    post = {
      'id': result[0],
      'title': result[1],
      'body': result[2]
    }
    return render_template('view',post=post)
 
  @cherrypy.expose()
  def save(self,title,body):
    db = cherrypy.thread_data.db
    db.posts.append(title=title,body=body)
    redirect('/')
 
cherrypy.quickstart(Blog())
03:59 PM | 0 Comments
July 24

Alter reality — and see what new results you get. Which is precisely what sci-fi does. Its authors rewrite one or two basic rules about society and then examine how humanity responds — so we can learn more about ourselves.

08:53 PM | 0 Comments
July 20

The human brain is complex beyond anybody’s imagining, let alone comprehension. We are not a few miles down a long road; we are a few inches down the long road. All the rest is literature.

Jose Delgado, as quoted in the Tom Wolfe + Michael Gazzaniga Seed Salon

09:54 PM | 2 Comments

BQL is Now Graph

Braindump used to access the database through a (very flaky) Object-Relational Mapper that I wrote from scratch, called DatabaseObject. I then wrote BQL, a simple query language that could perform operations on braindump data with simple statements like “get color of apple” or “set color of apple to red”, mainly for kicks — it would be cool to ‘talk’ to the system, perhaps from the command line, in something reminiscent of english.

Then I realized how useful BQL would be inside the braindump web application itself, so I replaced the entire ORM layer (and all its bugs and complexity) with BQL as the application’s main interface to the database. But embedding variables in query strings all over the place, like this, is annoying (plus ‘of’ and ‘to’ in the actual property or page name would confuse it):

BQL::query("set $property of $page_name to $value");

so I reorganized the code so each operation was in its own method, making usages look more like this (the original query language parser is still there):

BQL::set($page_name,$property,$value);

…Much better. In version 0.3, BQL also includes sorting logic:

BQL::_list(); // returns all pages
BQL::_list(‘color is red’); // only pages w/ color: red
// the _ is because PHP stupidly has a built in function called list so I can’t redefine it.
// the built in one isn’t even useful.

Anyway, in light of the actual query language not being very important (it was originally just a diversion), it’s renamed in 0.3 to Graph. Maybe GraphStore. Also, who knows, maybe this API will be useful outside of braindump.

04:00 PM | 0 Comments

I'm Porting Braindump to Python

I realized the biggest reason I was sticking to PHP was that it is so common on web hosts — write an app in PHP (like Wordpress, MediaWiki, or PHPBB) and anyone can run it! But no one is running braindump anyway, so sticking to PHP and missing out on all python’s awesome libraries and stuff just wasn’t worth it — it’s time to move on. Why python?

  • Tons of awesome libraries — linguistics, XMPP, syntax highlighting, and everything else
  • Cleaner syntax — python is about as good as it gets.
  • Better design — python was designed from the ground up, PHP was evolved from its beginnings as just a couple of little functions. It shows.
  • Standalone Server — it would be easy to write a standalone server program in python so anyone with python installed could download braindump and immediately run it on their computer, simply by typing python braindump/server.py into the command line and going to http://localhost:8080/ or whatever. (Right now you need a webserver and PHP — it can take a while to set up)

I’ve made a lot of changes in the PHP version since the last release (0.2), so I’ll probably release 0.3 in PHP before beginning the port in earnest.

I’ve been reading up on python web development techniques — WSGI, frameworks, templating engines, etc. Right now I’m thinking I’m gonna use Pylons as the basic framework (in turn a cobbling-together of Paste for WSGI and Routes for URL mapping), Jinja for templating, and plain SQLite for the database. (No ORM is needed because everything goes through the Graph (formerly BQL) API.

This means I can’t even run braindump on thinking-chair’s current hosting. Oh well, I wasn’t using it anyway. We could always get new hosting (although it would probably be more expensive) and then there’s always Google App Engine (w00t!).

So yeah. I’m excited.

print ‘hello python!’

03:25 PM | 0 Comments
July 19

Wikipedia: Births & Deaths in 2007

It’s funny how the Deaths section is all of these famous and influential people, but the Births section is just people destined to be monarchs—because who knows what people who will be influential and famous in the future were born this year!

11:26 AM | 0 Comments

Human Universals

This is a list of characteristics universal to all human societies, compiled by the anthropologist Donald E. Brown. I think focusing on universal human nature is a lot more important than focusing on how we’re all so unique, as the schools love to pound into us…

10:28 AM | 0 Comments
July 18

The strongest knowledge—that of the total unfreedom of the human will—is nonetheless the poorest in successess, for it always has the strongest opponent: human vanity.

— Nietzsche

10:46 PM | 0 Comments

09:55 PM | 0 Comments
fSymsOGXObenzxbpUyO9KFj9500.gif

From Garfield Minus Garfield — makes Jon look neurotic.

09:22 PM | 1 Comment
fountain.jpg

The water mane is a chalk drawing, the guy is real. His name is Julian Beever, and he draws these on sidewalks all over the place. Awesome.

09:18 PM | 0 Comments

oh shnap!

09:10 PM | 0 Comments
Next → Page 1 of 2