Category archives: Snaking
Discussions of programming, particularly of programming Python
Brian's Brain as a brain-teaser...
Written by
on
in
Snaking.
Was just playing around with implementing "Brian's Brain" in Numpy/Pygame it's a "life" style automata where there are just 3 rules:
- if cell is dying, cell dies
- if cell is alive, cell starts dying
- if cell is dead and > 2 neighbours are on, cell becomes alive
there was a post about doing this in ...
TurboGears Doc Sprint
Written by
on
in
Snaking.
Spent almost the whole day today on the TurboGears 2.x documentation sprint. I wound up just wading in and focusing on bringing a single document "up to spec" as it were. I have an itch to sit down and try to restructure the whole hive of documents.
Along the way had to learn the basics ...
ToscaWidgets JQuery and TinyMCE (Tutorialish-ly)
Written by
on
in
Snaking.
So you've browsed the ToscaWidgets web-site and know that there's a JQuery Plugin and a TinyMCE (Rich-text-editor control) plugin... now how the heck do you use them? Not a lot of documentation for these two pieces, so I've tried to cobble together a minimal example. Fair warning, I'm piecing this together basically without any documentation ...
ToscaWidgets JQuery and Flot Plotting (Tutorialish-ly)
Written by
on
in
Snaking.
Continuing on from our previous tutorial, here's a quick example showing how to create a Flot plotting library plot using tw.jquery's FlotWidget class. In our root.py controller module, we'll import the widget and some support functions:
from tw.jquery import FlotWidget
from math import sin,cos
import simplejson
The FlotWidget is part of the core tw.jquery support, ...
Wrapping JQuery plugins for ToscaWidgets/TurboGears
Written by
on
in
Snaking.
Continuing my explorations of JQuery + TurboGears today, I started working on a simple RTE-light wrapper widget. RTE-light is an extremely small, simple analogue to TinyMCE, so I figured it would be easy to set it up with the tw.tinymce project as reference.
There's a paster script to auto-start a widget project, so that went ...
I forget how advanced TurboGears 2.0 is, sometimes
Written by
on
in
Snaking.
I wanted to code up a single-form application for updating/editing the PyGTA events. Since it runs on Vex and I didn't want to bother them with setting up per-user WSGIs or TurboGears for me (they do give me the space free, after all), I went with bald CGI.
Wow.
I've written very large CGI-only systems ...
First PyGTA Class Begins to Take Shape
Written by
on
in
Snaking.
We had a lively PyGTA this evening on the topic of concurrency. After which I put out a call for those who are interested in helping setup and teach (low-cost) courses on Python.
Our first course looks to be an Introduction to Django, likely on a Saturday in early November, taught by a consultant who ...
Hack to map Vertex Buffer Objects into Numpy arrays...
Written by
on
in
Snaking.
This post from the numpy list shows you how to turn a ctypes c_void_p into a numpy array. The glMapBuffer() function maps your currently-bound array into a void * which you can access directly... combining the two:
def map_buffer( vbo, access=GL_READ_WRITE ):
"""Map the given buffer into a numpy array..."""
func = ctypes.pythonapi.PyBuffer_FromMemory
func.restype = ...
easy_install no longer working with SourceForge-hosted projects?
Written by
on
in
Snaking.
It seems like all of the projects I host on SourceForge are no longer easy-installable. The only ones that can install are the ones that have been uploaded to PyPI, and then only the versions on PyPI install (i.e. a later version on SF doesn't install or prevent an earlier version from installing). I'm guessing ...
Reminder: Exceptional Conditions at PyGTA this evening!
Written by
on
in
Snaking.
We're going with a round-table discussion at PyGTA this evening. How do *you* deal with exceptional conditions in your code? 7:10pm at Linux Caffe.