Alsuren

November 19, 2008

Dance Pointers

I might have called this post “Dance Philosophy”, or “Best Practices”, but that would imply that I have checked it for self-consistency and so-forth. This is a set of beliefs/observations that I have about leading, and I am completely happy if other people don’t hold the same beliefs, but I will defend my beliefs if attacked (maybe “Dance Theology” would be more appropriate). I make no comments about which bits apply to following as well.

1) If you are having trouble dancing with a follow (of any ability), then a good solution is *always* to become a better lead.

1.1) Telling a follow that she’s doing something “wrong” is *always* the wrong thing to do.
1.1.1) In most cases, she can feel that something’s wrong, and so doesn’t need to be told.
1.1.2) You will (in most cases) be incapable of explaining it in words.
1.1.3) In most cases, it’s because you’re doing it wrong yourself.
1.1.4) If you can lead the difference between doing it “wrong”, and doing it “right”, then it will be more effective than words (see point 1).
1.1.5) Telling someone that they should *not* do something is dangerous.
1.1.5.1) What you want someone not to do may be exactly what someone else wants them to do in some situation.
1.1.5.2) If you can show people alternatives, and let them pick for themselves, this will reduce the number of people doing the “wrong” thing, without removing their ability to do so if the need arises.

1.2) If you find yourself wanting to “know” more “moves”, then this is a sign that your understanding of the things you already “know” is not strong enough.
1.2.1) It is more enjoyable to play with the subtleties of a few moves than a lot of different moves done in the same way.
1.2.2) If there are 7 independent layers of lead/follow (ask Andrew Sutton for a list and he will consistently produce at least that many (though they may not always be the same 7)) then you have at least 2^7=128 variations on each move. If you get bored with 2^7, then try 3^7 and so on.

1.3) If you are getting a lot of awkward moments, then you need to go back to basics.
1.3.1) If your connection is broken, you will be impossible to follow.
1.3.1.1) If your frame is too weak then your follow will not be able to feel what you want her to do.
1.3.1.2) If your frame is too rigid/jerky, it will break your follow’s frame. Similarly, if you break your frame by doing an awkward arm lead, then it will break your follow’s frame.
1.3.1.3) If you have too little tension, your follow may not know when you want her to move (especially problematic with fast music).
1.3.1.4) If you have too much tension, then your follow will feel too forced, and have no freedom to do her own thing (especially in slow music, and music she knows well). This is often referred to as a lack of responsiveness.
1.3.1.5) All of the above things affect all of the above things
1.3.2) Having “just enough” control to reliably lead what you want is ideal.
1.3.2.1) It is important to find out what “just enough” is for every follow.
1.3.3) If you are doing a lot of different “moves” then you both need to “know” them and get them “right” in order to avoid conflicts.
1.3.4) If you are doing lots of subtle variations on basic moves, then there will be no conflict if your follow ignores them.
1.3.4.1) If there is a conflict, then your “subtle variation” is not a subtle variation.

To be continued, I suspect.

If someone wants to expand this onto a wiki somewhere, please do so. I’m thinking that each of the points should be the title of a page, with each page being a stub with a “Consider first” link pointing to its parent, “Consider also” links pointing to its siblings, and “Consider next” pointing to its children. It would then be possible to flesh out each page with an “Examples” section.

November 17, 2008

209 Radio

Filed under: Uncategorized — Tags: , — alsuren @ 1:13 am

Over the past few years, I haven’t been listening to much radio, because my music collection has been so large (especially since finding http://jazz-on-line.com/)

Recently though, since breaking my decent phone, I have been listening to the radio more. After a little channel-hopping, I have discovered 209 community radio. I’ve been listening to it today, and it has been made entirely of yay. This is likely to be because it’s the weekend, and therefore full of real people. If you look at the schedule then you will see that this is not always the case.

The website also has links to an archive, and all content is available as both mp3 and ogg. I suspect that this touch was an ad-lib by whichever linux geek set up the website. (It really does look like it’s become someone’s personal playground, with a mixture of cool features and questionable style)

November 14, 2008

Versioned Home Directory, and other Ideas for Projects.

I have started using version control (bzr) on my home directory. This hopes to eventually solve a few problems:

1) Sharing settings with other people. This is something that I’ve been looking for a solution to for a while (there are standard ways to share apps and themes (kde-apps.org and pals) but not configs. If everyone keeps their configs versioned, then it should be possible to cherry-pick changes more easily.

2) Creating consistant settings across many different linux machines (as discussed in my colourhash post. (side note relating to colourhash: many graph plotting programs have ways of automatically assigning distinct colours. I will look at that at some point too.)

3) As a backup framework: If I have all of my settings under distributed version control on 4 machines, then when I accidentally delete large chunks of my home directory (like the other day, when cmake created a folder called ‘$HOME’ which I wanted to delete…) then I don’t lose all of my rss feeds, proxy settings (which I stil haven’t managed to get working again, thanks to KDE’s incredibly fragile socks[lack-of] implementation/configuration) and email settings (resulting in me not being alerted about emails for 2 days(>20 emails))[/rant]

The progress so far is a ~/.bzrignore file as long as your arm ).

Eventually, I plan to host it on launchpad (as soon as I’ve verified that it doesn’t contain any security-critical information (I don’t think I have anything else that I would have a problem hosting on launchpad. Reading the content of my other posts might give you an idea of my views on privacy.))

==== Technobabble-filled braindump below this line ====

If anyone knows how to do nested repositories (eg. so I can get bzr to manage my ~/src as well, and so that I can have sensitive information like ~/.ssh and ~/.gpg versioned in some way that lets *me* merge them between computers, but doesn’t expose them on launchpad) give me a shout.

In other news, I taught myself a bit of perl last night, when trying to add sed-style text replacement to pidgin (by hacking apart script called replaceX.pl whose interface was arbitrarily horrible, and only allows output replacement). I’m currently fighting with pidgin’s settings management to get persistent rules. If anyone wants it, get in touch. Otherwise, it will be in launchpad under ~/.purple/sed.pl when I get my home directory on there :D.

If anyone wants to give me input on the interface, it would be muchly appreciated. Currently, we have:
/sed foo-to-bar s/foo/bar/g
(to add a replacement rule)
/sed foo-to-bar s///
(to replace the old rule with an existing rule)

I’m thinking something more like:
/sed s/foo/bar/g
(to add a rule; a number will be assigned to each rule as an identifier)
/sed -l
(to list all rules, and associated numbers)
/sed -d #number
(to delete rules)
/sed -o s/foo/bar/g
(to only correct outgoing text)
/sed -i s/foo/bar/g
(to only correct incoming text)

Unfortunately, perl is a *horrible* language (doesn’t even have a concept of named function arguments) so the resulting code is unlikely to be anything I’m proud of.

While I think about it, I also had a load of ideas for python-based projects:
A man-page parsing command-line completion handler for ipython (and possibly bash, but bash scripts take so much longer to debug, and I get the feeling I will soon be using ipython as my default shell anyway.)
Given that debian policy forces all commands to have a man page, this is a pretty reliable way to write a powerful tab-completer. Also, since you only ever read the man page when the tab completion doesn’t work, you might as well get the tab-completer to read the man page for you.

A callback/decorator library for creating command-line programs, with an interface along the lines of:

#!/usr/bin/python
@clargs.handles("-f", "--filename")
@clargs.arguments("FILENAME")
def input_filename(filename):
    """The filename you want to read."""
    global input = filename

@clargs.main
@clargs.arguments("REPEATS", int)
def main(repeats):
     """Reads FILENAME to stdout REPEATS times."""
    text = open(input).read()
    for i in xrange(repeats):
        print text

if __name__ == "__main__":
    clargs.go()

It should also auto-generate help and man pages using the information given. An even more fun thing to do (with python3000) would be to use nose-style runtime inspection to to detect a function of the form:

def handle_filename(name:str):
    "The filename you want to read."""
    global input = filename

and make that handle –filename input.txt (maybe with an @shortopt(‘f’) decorator.

A subclass of numpy.ndarray that has named axes, and user-specified ranges, so…

likelihoods = semantic_array( ('t', 1000), ('x', -100, 100), ('v', -10, 10) )
do_something_with(likelihoods) 
# sum over v, and preserve the x and t axes.
position_likelihoods = sum(likelihoods, axis='v')
# get the best guess of x for each time t.
maximum_likelihood_x_estimate = argmax(position_estimate_probs, axis='x') 


A delayed evaluation library (might end up stealing a lot of ideas from scipy and sympy, with a good chunk of twisted to boot)
An interesting feature of python is that it doesn't have an assignment operator is *purely* a pointer-update. When you say "x=y" it just makes x point to the same thing y points to. This means that if you get passed x into a function, you can safely write x = x*10, and it won't modify x in the code that called you. This lack of side-effects (and all manner of other things) makes many python libraries look like pure-functional libraries.

On the down-side, it won't let let you override the assignment operator, so when you're dealing with large amounts of data, you can't re-use arrays without jumping through hoops. If X is a 1000000x1000000 matrix, your choices are:
X = multiply(X,10) # The canonical form, but it creates a temporary variable for the return value which is alive at the same time as X (potentially taking up twice as much memory as needed)
multiply(X, 10, output=X) # The numpy interface (potentially does the multiplication in place)
X *= 10 # works in-place, and is all very good, but what if I want to do something that's not +=,-=,*= or /=?

Then there are the slightly more hacky options, which involve delayed evaluation:
X == multiply(X, 10) # Override the logical equals operator X.__eq__ (the sympy method for writing symbolic equations). This is the most horrible, because it stops you being able to do X = (X==Y)
context.X = multiply(context.X, 10) # Override the attribute assignment operator context.__setattr__
X[:] = multiply(X, 10) # Override the item assignment operator X.__setitem__  (or sometimes X.__setslice__, I think)
Note that this last one feels quite like fortran, but it might be the least horrible of all the interfaces.


So how would these things work? A simple sympy-style one looks like this:
def multiply(X, Y):
    def deferred_calculation(output):
        numpy.multiply(X, Y, output=output)
    return deferred_calculation

# In X's class definition:
def __eq__(self, deferred_calculation):
    deferred_calculation(output=self)

The problem is that if you accidentally do X = multiply(X,Y) then X is just the deferred_calcuation function. That’s not very useful. On the other hand, if the returned “deferred_calculation” object can be made to behave like a numpy array, then you’re in for a win.

The fun stuff will start to happen when you start using these “deferred_calculation” objects, and passing them in and out of other functions, so you have a massive chain of deferred calculations. If you then include an interface for inspecting chains of deferred objects, you can start to write deferred-to-$LANGUAGE compilers, which would let you write “say what you mean” algorithmic code in python.

A way of writing twisted applications in a blocking style (using generator expressions).
This idea is in some ways quite similar to the idea above. I’m sure I sketched an implementation up somewhere (possibly on the eee), but I don’t seem to have posted about it. The jist of it is as follows:

In the example below, unblockify (implementation omitted) acts like a filter in two ways:
From the caller’s point of view, some_generator produces a sequence, but only things that aren’t deferreds get let out of the filter to the caller.
From the generator’s point of view, “yield” acts like a filter (or in compsci terms, a “map”). Any “deferred” objects sent through it get turned into real objects, and any real objects sent through it disappear. I’m still deciding whether to do something magical when None gets yielded. We’ll see.

 
@unblockify
def some_generator():
    while True:
        result_of_deferred = yield function_which_returns_deferred()
        yield some_immediate_function(results_of_deferred)

for out in some_generator():
    print out

While this program appears to be blocking, it shouldn’t cause unresponsiveness in GUI applications. This is because filter passes control to the twisted reactor when it’s waiting for each deferred function.

If anyone is interested in any of these projects, please shout.

Create a free website or blog at WordPress.com.