RSS feed
  • Script to center the current window (linux)

    (0)
    Posted on November 7th, 2008dwielscript

    Just remembered that I hadn't published this script that I use fairly often which centers the currently active window on the screen using wmctrl (requires the patch provided)

    wmctrl-patch

    center_active_window.py

    , , , , ,
  • Obama spam

    (1)
    Posted on October 30th, 2008dwielPolitics, axpress

    I keep getting emails asking to please visit this website and vote for Obama, or sign up to this Obama facebook group.  I like Obama and I plan on voting for him, I really do.  I like showing my support for him and letting anyone who is interested know what I think.  However, I could spend every hour of the day joining Obama facebook groups and voting for him in various polls.  This is not a productive use of my time.  I want to publish the fact that I support Obama, and be done with it.  Let this be the informal declaration.  I hope to have a framework which would allow people to make declarations of this type, which could then be read and understood by computers, and then analyzed and viewed by anyone and everyone who is interested.  There could even be a facebook/myspace app. *sigh* Say it once, have it published, and moveon.

    , , , , , , , ,
  • List of bound variables in Python (excluding variables from modules)

    (0)
    Posted on October 28th, 2008dwielCode

    I've heard multiple people ask for a way to see a list of locally bound variables in python.  It would be especially useful for use in the interactive prompt. They like the interface that matlab gave them and this is one of the features they miss the most.  I'm not sure what the best way to accomplish this is, but I've coded together one solution.  Here is an example use case:

     
    from boundvars import boundvars
    def test() :
             a = 1
             b = 2
             print 'test1:', boundvars(vars())
             import urllib
             print 'test2:', boundvars(vars())
     
    x = 1
    y = 2
    boundvars(vars())
    = {'y': 2, 'x': 1, 'test': }
    from urllib import *
    boundvars(vars())
    = {'test': , 'x': 1, 'y': 2}
     
    test()
    printed: "test1: {'a': 1, 'b': 2}"
    printed: "test1: {'a': 1, 'b': 2}"
     

    As you can see, boundvars is called with vars() as a parameter which then returns a dictionary of locally bound variables. If boundvars.ignore_external_functions is set to False, the first two calls which show x and y bound would also show the variable boundvars. If it is set to True, then all values which are functions not defined in the __main__ module are excluded from the output dictionary. The latest code can be downloaded below. Installation is as simple as:

    $ wget http://dwiel.net/wp-content/uploads/2008/10/boundvars.tar.gz
    $ tar -xvf boundvars.tar.gz
    $ cd boundvars
    $ sudo python setup.py install

    Its not big enough to warrant a project at a code hosting service so its just provided here. If you know of any way that this module could be improved (or avoided by some cool function I don't know about) please, let me know!

    boundvars.tar.gz (version 0.1)

    , , ,
  • The psychology of the Blue Man Group

    (0)
    Posted on October 23rd, 2008dwielUncategorized

    There is a great video over at edge about how talking about old age make people walk slower and asking people to nod yes or no while demoing headphones influences their opinions on the headphones' quality.  I think the Blue Man Group was ahead of their time.

  • Clustering items by tag

    (3)
    Posted on October 16th, 2008dwielData Exploration

    I write notes in axpress, my still private web front end to a triple store.  The notes have a body and a set of tags.  Most notes are thoughts about problems I encounter while programming, explanations of design decisions.  They have come in handy as a reference a few times, but the information in them is often hard to find, even with tags.  I also find writing tags tedious.  I've decided to look through the various set of tagged items, my notes and my bookmarks to start, to see what kind of patterns I can find.

    I used graphviz to get a quick visualization of the relationships between each tag.  Each tag is a node.  Each node is labeled by the tag name and the number of notes it appears in.  The closer two nodes, the more often they occurred in the same notes.  Only tags which were connected to more than 1 other tag were included in the visualization to reduce the complexity.

    graph of tags with more than 1 connection

    graph of tags with more than 1 connection

    From here, some basic patterns can be seen.some basic subgraphs can be seen.  "trade", "local" and "books" all stem from "economy" only.  "economy" is probably a good tag to classify that group of notes where "trade", "local" and "books" are sub tags.  A similar pattern can be seen coming from the express tag (which is the old name of this project).  Coming from it are some tags which I don't seem to note any more.

    caption

    graph of tags with more than 3 connections

    Only visualizing pairs of tags which occurred more than 3 times, show which (common) tags are used with which other (common) tags, but not how often. It is interesting to see which tags are independent of others. "axpress" and "express" do not occur together often. It might be possible to use this type of graph to find a set of tags which partition the entire set of notes efficiently. This, hopefully small, set of tags could be used as a starting point for drilling down to find a note you are looking for.

    graph of tags with more than 2 connections with labels on the edges showing the number of connections

    graph of tags with more than 2 connections with labels on the edges showing the number of connections

    For this next graph I wanted to see how 'thick' the connections between each node was.  That is, from "axpress" how many links are there to "case"?  How many to "design"?  Are there any tags which occur with nearly every instance of "axpress" or are they uniformly distributed?  The darker a node is, the more occurences of that tag there are (color corresponds linearly to number in the label).  The color on the end of each link correspond to the relative number of connections represented by that link.  For example coming from "code" is a dark green node to "axpress" and a lighter cyan to "case".  This is because there are twice as many connections from "code" to "axpress" as to "case".  From most tags, it seems that there is a relatively uniform number of connections to each other tag.

    This set is rather limited, so I am considering a few different next steps.  I could use the text of the note in a similar kind of analysis - increasing the number of tags, leaving the number of tagged items alone.  Or I could use data from delicious (either my own, or a small set of users) to increase the number of tagged items while leacing the number of tags relatively small.  What would you like to see done next?  Something else entirely?

    , , , , ,
  • Hello World

    (0)
    Posted on October 15th, 2008dwielUncategorized

    Here is my obligatory Hello World post.  I've been working on a web project which I have been hoping would have a facet facing the web as my blog.  In the meantime, this conventionally coded and maintained blog is running wordpress.

    ,