Installing django on bluehost in 2013

Posted in Uncategorized | Comments Off

Random numbers in Python

In order to generate a random number in python I had to import the random library.

import random

This gives a random float between 0.0 and 1.0

I need a list of random numbers.  Here was a suggestion for javascript:

int myarray[] = new int [10];

 for (int i = 0 ; i < 10 ; i++)
 myarray [i] = (int) (Math.random () * 10);

In order to use pi in python you must import the math module.

import math

 the_constant_pi = math.pi

I needed to iterate over two lists in parallel (link):

for f, b in zip(foo, bar): print(f, b)

But of course, that doesn’t work in the template!  The following does not work! :(

{% for (each, r) in zip(tree, randoms) %}

When number variables are passed to the template, they need to be converted to from strings to numbers.  In processing.js this is achieved by prefixing a plus sign.  The code below adds the second element of an list called “randoms” to ten and then displays at the coordinates x = 50, y = 50.

text(+"{{ randoms.1 }}"+10, 50, 50)
Posted in Uncategorized | Comments Off

Django template variables with Processing.js

I am trying to integrate processing.js within a site I have created using django. The reason I am integrating the two is because I made an app using processing (not processing.js) that I am hoping to develop further. I want to place on the web for any user to interact with and I want to allow the app to interact with a database.

The original app accepted text input from a user. The words were plugged into a tree structure visualization. The data from inputting words was never stored and the user needed to start with a blank visualization whenever the app was reopened.

With django I have created a database that stores any previously entered text entered by a user. The problem is that I am having trouble accessing the database items in an efficient way. Django has template tags which allow me to pass variables from the database (using into the webpage (an html template stored in the templates folder). But within the html page the variables do not behave the way I want them to.

def assembleTree(firstWord, x):
    set = firstWord.word_set.all()
    lenSet = len(set)

    if lenSet > 0:
        for each in set:
            assembleTree(each, x)
    return x

Here are some things that I want to do in the html but I can’t:

{{ len(x.word_set.all()) }}

I cant use the len command within the html template.

I searched “html template django len” and visited this site, which seemed to give a hint that length can be accessed in a different way.  It can!  This is the proper syntax:

{{ x.word_set.all|length }}

Notice also that even though the dot syntax can be used just like in, the .all() method loses it’s parentheses.

Also by searching “html template django indexing” and through this site I found out that django templates also support indexing!  Which I did not know before.  Again, the syntax is unexpected.

I would expect to use

{{ x.word_set.all[1]}

but instead it is

{{ x.word_set.all.1 }}

More text


Posted in Uncategorized | Comments Off

Creativity Interviews: Proof of Concept Prototype Videos

Below are two videos recently produced as part of this project. The first interview with Anthony Ptak, theraminist, artist, and educator. The second is an interview with Samwell Freeman, physicist, programmer and artist. In each video, we explore the definition of creativity, how to move past creative blocks and we perform a creative exercise.

Posted in Uncategorized | Comments Off

Creativity and Mental Illness.

Posted in Uncategorized | Comments Off


Click and drag inside this box. Press ‘c’ for clear, ‘s’ for save.

Posted in Uncategorized | Comments Off

Word Pen.

Click and drag inside this box.

Posted in Uncategorized | Comments Off

Simple Semi-Random Tree.

Each refresh gives a slightly unique little tree.

Posted in Uncategorized | Comments Off

Chain-Link Letters.

Posted in Uncategorized | Comments Off

Circling Circles.

Click and drag inside this box.

Posted in Uncategorized | 1 Comment