Here you will find a collection of things I've worked on or found interesting and worthwhile to post. There is some poetry and other written works, as well as projects and programming thoughts/ideas/tips.

Block the 'Delete goes back' action in Firefox

QUOTED FROM: http://www.macosxhints.com/article.php?story=20070511123925218
Mon, May 14 2007 at 7:30AM PDT • Submitted by cdimara

Python Tip: Tricks for Dict(ionarie)s

Okay, so things everyone should know about dictionaries, they are in the python manual but I still didn't know them until today. First off creating a dictionary in the code (ie hardcoded)

d = dict(one=2, two=3)

This is a simpler way of doing things, and it sure beats having to rember all your quotes when doing:

d = {'one': 2, 'two': 3}

Granted the second way looks cooler! But we have to make compromises. Another cool thing, is taking a list of keys and list of values and turning them into a dictionary:

Python Tip: Swapping Two Objects

So I wanted to swap to objects, and I prefer to write short clean code, especially to carry out simple processes. The idea was that I have two objects, in this case treeA and treeB and I wanted treeA to be the deeper of the two trees. Now the long way would look something like this:

if treeA.depth < treeB.depth:
    tree = treeA
    treeA = treeB
    treeB = tree

Which is a little ugly, 4 lines to reorder something, so there neat trick is that if you want to swap two objects a and b simply use:

a,b = b,a

So the above code becomes:

Writing Test Cases

I've found out a couple of things while trying to write my test cases for SimpleTest:
  • You can debug the POSTs and GETs using <code>drupal_set_message($this->_content);</code> which will display the page as a message.
  •  

Tests List

This is a list of automated tests that are run so far. There are four kinds of users that are used in the testing

Automated Testing and Requirements Testing

Thanks to Kiam who posted a bug at http://drupal.org/node/292242 I learned a way to properly do requirements testing to make sure the core Blog module is disabled before EveryBlog is installed.

Automated testing looks like its the way to go to help reduce the number of bugs that show up in releases. Drupal's SimpleTest module looks like it should be pretty straight forward, and it has plenty of helper functions to make my life easier as I code up the tests.

EveryBlog 2.0 Announced

The new version of the module promises lots of changes.

Development Goals:

  • Add another node-type for Blog, make two node types, Blog and Blog Entry.
    • Helps with keeping taxonomy per blog
    • Allows CCK fields per blog
  • Rework categorization to use taxonomies properly
  • Automated testing to reduce the number of bugs that make it into releases

And much more. Check back here for more details and development updates. There is a forum for talking about EveryBlog at http://drupal.org/node/288813

High-Res Picture

Nothing new, just a high-res picture.

Caustics

Search Radius and Irradiance Estimation

Up until now I have just been using the original search radius from the kd-tree searching to use in the irradiance estimation steps. But someone mentioned and flaw in the images, the dark edges along boxes, and I thought that perhaps the radius was wrong. For reference here is an image with that uses the search radius in the irradiance estimation.

Pages

Subscribe to  Glimpses RSS