Backspaces

October 1, 2004

NetLogo: Cruising Model

Filed under: Hacks — backspaces @ 7:28 pm

I’ve got an initial version of a NetLogo model with cars cruising on a map of Santa Fe, NM. This was done as a proof of concept with summer students working in the RedfishGroup.

Their project included working with the Santa Fe police on understanding the dynamics of cruising around the plaza, a center of Santa Fe activities.

This model is somewhat unusual due to using tiny patches: 2×2 pixels each! Generally the patch size is considerably larger. The challenge was to use a GIS generated map of the downtown area, and to import this into NetLogo so that the patches gave a feel of a map image. This has been pushed to 1 pixel patches with no difficulty other than the time needed to import the image.

The jpg image was processed by converting it into the PPM image (portable pix map) text graphics format, then using the NetLogo rgb primitive to convert that image to a format NetLogo could use. It was then written back out to a data file consisting of only the NetLogo integer color values used by the model’s patches.

The final hack was to literally cut & paste the data file into the NetLogo program file (.nlogo file) as an array! This avoided some Java security problems concerning file access that will go away with the current NetLogo beta. But it works so well, we may just keep it for a bit.

Textpattern 1.0rc1: Boy, that was easy!

Filed under: Hacks — backspaces @ 5:34 pm

Being new to textpattern, I was delighted to see how easy it was to update from g1.19 to 1.0rc1. Deanload the bundle, unpack it, move the old …/textpattern to the side, replacing it with the deanload, and copy in my prior config.php file.

That’s it! I keep a mirror of the site on my laptop, and both upgrades were that simple.

The new system has some sweet features such as separating the edit articles page from the articles themselves, making it easier to manage existing articles. Also can specify how many articles show on a page .. nice for modem users I suspect.

September 29, 2004

Textile, Textpattern, and the Meaning of Life

Filed under: Hacks — backspaces @ 12:24 pm

Overview

So what is all this. First of all, recall from our earlier presentations, the New Web looks like:

  1. XHTML and CSS
  2. PHP and MySql
  3. Site Management

Textile and Textpattern address the third area.

Installation

.. lets take a test drive!

Links

Code Fragments

First, here’s my modified index.php file. This is the index file for anyone beaming into http://backspaces.net/. It uses php to redirect folks to the http://complexityworkshop.com/ site and any other sites I co-host. The last segment is the default php for textpattern itself.

// -------------------------------------------------------------
<?php
    $server = $_SERVER['HTTP_HOST'];

    if (eregi("complexity", $server)) {
        header("Location: /cw/");
    } elseif (eregi("wireless", $server)) {
        header("Location: /sites/acequia/");
    } else {
        include 'textpattern/config.php';
        include $txpcfg['txpath'].'/publish.php';
        textpattern();
    }
?>

Next, this is an example of the implementation of a Textpattern tag, in this case the
<txp:linklist category="xxx" />
tag used for displaying links like those in my default sidebars.

// -------------------------------------------------------------
    function linklist($atts) // possible atts: form, sort, category, limit, label
    {
        if(is_array($atts)) extract($atts);
        if(!isset($form)) $form = 'plainlinks';
        if(!isset($sort)) $sort = 'linksort';
        $Form = fetch('Form','txp_form','name',$form);
        $wraptag = (empty($wraptag)) ? '' : $wraptag;

        $qparts = array(
            (!empty($category)) ? "category='$category'" : '1',
            "order by",
            $sort,
            (!empty($limit)) ? "limit $limit" : ''
        );

        $rs = safe_rows("*","txp_link",join(' ',$qparts));

        if ($rs) {
            $outlist = (!empty($label)) ? $label : '';

            foreach ($rs as $a) {
                extract($a);
                $linkname = str_replace("& ","&#38; ", $linkname);
                $link = '<a href="'.$url.'">'.$linkname.'</a>';
                $linkdesctitle = '<a href="'.$url.
                    '" title="'.$description.'">'.$linkname.'</a>';

                $out = str_replace("<txp:link />", $link, $Form);
                $out = str_replace("<txp:linkdesctitle />", $linkdesctitle, $out);
                $out = str_replace("<txp:link_description />", $description, $out);

                $outlist .= $out;
            }
        return ($wraptag) ? tag($outlist,$wraptag) : $outlist;
        }
        return false;
    }

Here is an example of the Textpattern utilities available to plugin developers.

// -------------------------------------------------------------
    function safe_query($q='',$debug='',$unbuf='')
    {
        global $DB,$txpcfg;
        $method = (!$unbuf) ? 'mysql_query' : 'mysql_unbuffered_query';
        if (!$q) return false;
        if ($debug) {
            dmp($q);
            dmp(mysql_error());
        }
        $result = $method($q,$DB->link);

        if(!$result) return false;
        return $result;
    }
// -------------------------------------------------------------

September 18, 2004

Welcome!

Filed under: About — backspaces @ 11:30 pm

Hi folks. This is a redesign of my website using modern xhtml/css design techniques, and with the Textpattern site management system. Check out the about page for more information.

First pass, the site is using a blog-like article structure, each entry pointing to a page that existed on the initial site.

Here’s the earlier index page to the old site. I’ll keep it about while the site’s under construction. Here’s the same page imported into textpattern

August 18, 2004

NetLogo Models

Filed under: Hacks — backspaces @ 12:00 pm

Our hacks section contains several NetLogo models. We’ll expand on the newer ones, explaining what we’re up to.

In the mean time, click on the links to the models and you’ll find the netlogo standard page with the model in java applet form, followed by links to the netlogo site and the source code, and an explaination of the model.

August 10, 2004

Talks

Filed under: Talks — backspaces @ 12:00 pm

This section has talks and papers I’ve given. The sidebar has pointers to several of these, and we’ll begin filling out this section with more detailed discussions of the papers and events leading to them.

April 20, 2004

Self-*

Filed under: Talks — backspaces @ 12:00 pm

The Self-* workshop was held the end of May in Bertinoro, Italy. It was held in an absolutely fabulous facility owned and operated by the University of Bologna in this gorgeous hilltown.

The purpose of the workshop was to look at a wide range of self-xxx ideas: self organization, management, healing, deploying etc.

My paper was on the BeerGame investigation done earlier with the Santa Fe Institute’s business network.

January 4, 2004

O’Reilly

Filed under: Talks — backspaces @ 12:00 am

I publish articles at the O’Reilly site now and again. In the future, I’ll write more detailed entries here about them, but for now, here’s a list of the past ones:

On the Wave/Particle Duality of Random Events
Java Scripting: Half the Size, Half the Time
NetLogo 2.0: Graphs, Nodes, and Edges
Harmony Internet Remote
Java Geography: OpenMap
Beyond Crypto: Adaptive Security
Domain Maddness!
NetLogo: Experimental Worlds in Silico
Math: The Next Big Thing

December 8, 2003

Spring Layout Model

Filed under: Hacks — backspaces @ 12:00 pm

This is a NetLogo dynamic graph layout model using springs and repulsion forces to create a pleasing layout.

The purpose of the model is to let a graph evolve into a usable layout naturally. You can grab the nodes and move them to help the system along!

As always, you can read more detailed notes in the model’s documentation included with the applet, and can read the source code there as well.

August 10, 2003

Bio

Filed under: Life — backspaces @ 12:00 pm

Got a spiffy Bio page together today as part of joining a VC team as a technical advisor. Don’t laugh. VC’s are puffy folks.

This short bio is a bit less over the top.

« Newer PostsOlder Posts »

Powered by WordPress