Skip to content

Monthly Archives: November 2009

Senior Project Update and a Decent Media Manager

26-Nov-09

Okay! This update is a bit late (by ~1.5 weeks), but we now have full audio output from a single glove. The contact sensors are pretty finicky, though, and improving them is our next goal. We have a few ideas about how to do this. First, we may sew a pattern into the conductive fabric using conductive thread. This plan works on the assumption that the conductive thread has more exposed metal than the conductive fabric, and thus will make more reliable connections. We don't know this for sure, but we need conductive thread anyway, so we'll probably try it out. The second idea was brought to us by Nate's mom. Apparently she has access to some sort of thin metal-coated plastic sheet. I don't remember the intended use of this material, but we'll be trying it out for our contact sensors.

After we achieve reliable contact sensors, we'll move on to inter-glove communication, then finally add the accelerometers, essentially completing the instrument.

In other news, I finally found an audio player / manager that I actually like: Quod Libet. I'll talk more about this later (I'll probably make a post about it when I finish the plugins I'm thinking about).

Please excuse the content-light nature of this post; I only really made it for the Senior Project update.

Things That Have Happened, Things That Have Not, and Senior Project Status

12-Nov-09

As of the time of posting, I have ten Google Wave invites. I've been playing with Wave a bit, and it is pretty neat, but not extremely impressive. I have seen real-time collaborative document editing before. Using Wave for chat is fairly cumbersome (no send on Enter). I have also gotten a few crashes, and it isn't incredibly snappy.

All that aside, it is very cool and I do see how it can be useful. Even if just discussing a random topic, the fact that you can reply to related comments and have the whole discussion appear in a tree promotes organization. I am using a neat LaTeX extension that allows me to embed editable LaTeX markup which is automatically rendered and displayed inline. Related to this, I am using Wave with the math teacher to plan for my third trimester class "Seminar in Independent Mathematical Research" (I'm very excited, I might post about my topic ideas later).

I started learning Go recently. For practice, I'm re-writing my Python solutions for Project Euler in Go. Here is Problem 259:

package main
 
import (
    "fmt";
    "strconv";
    "strings";
    "./fraction";
    "time";
)
 
func simplify(nums []*fraction.Fraction) map[string]*fraction.Fraction {
	out := make(map[string]*fraction.Fraction);
	var r *fraction.Fraction;
	if len(nums) == 1 {
		out[nums[0].String()] = nums[0];
		return out;
	}
	for offset := 1; offset < len(nums); offset++ {
		lefts := simplify(nums[0:offset]);
		rights := simplify(nums[offset:len(nums)]);
		for _, left := range lefts {
			for _, right := range rights {
				r = left.Add(right);
				out[r.String()] = r;
				r = left.Sub(right);
				out[r.String()] = r;
				r = left.Mul(right);
				out[r.String()] = r;
				if right.IsZero() != true {
					r = left.Quo(right);
					out[r.String()] = r;
				}
			}
		}
	}
	return out;
}
 
func groups(symbols string) ([]string, int) {
	out := new([512]string);
	out[0] = symbols;
	c := 1;
	for i := 1; i < len(symbols); i++ {
		gout, gcount := groups(symbols[i:len(symbols)]);
		for g := 0; g < gcount; g++ {
			group := gout[g];
			out[c] = symbols[0:i] + "|" + group;
			c += 1;
		}
	}
	return out, c
}
 
func numlist(s string) []*fraction.Fraction {
	vals := strings.Split(s, "|", 0);
	out := make([]*fraction.Fraction, len(vals));
	for i := 0; i < len(vals); i++ {
		t, _ := strconv.Atoi64(vals[i]);
		out[i] = fraction.New(t, 1);
	}
	return out;
}
 
func simplify_nums(nums string) map[string]*fraction.Fraction {
	return simplify(numlist(nums));
}
 
/*
func simplify_nums(nums string, out chan map[string]*fraction.Fraction) {
	out <- simplify(numlist(nums));
}
*/
func main() {
	start := time.Seconds();
	reachable := make(map[uint64]bool);
	seqs, nseqs := groups("123456789");
	for i := 0; i < nseqs; i++ {
		reps := simplify_nums(seqs[i]);
		for _, k := range reps {
			if k.IsPos() && k.IsInt() {
				reachable[uint64(k.Num())] = false;
			}
		}
	}
	/*
	channels := make([]chan map[string]*fraction.Fraction, nseqs);
	for i := 0; i < nseqs; i++ {
		channels[i] = make(chan map[string]*fraction.Fraction);
		go simplify_nums(seqs[i], channels[i]);
	}
	for i := 0; i < nseqs; i++ {
		reps := <-channels[i];
		for _, k := range reps {
			if k.IsPos() && k.IsInt() {
				reachable[uint64(k.Num())] = false;
			}
		}
	}
	*/
	var total uint64 = 0;
	for k, _ := range reachable {
		total += k;
	}
	fmt.Printf("Sum: %d\n", total);
	fmt.Printf("Total Time: %d\n", time.Seconds() - start);
}

If anyone wants "fraction.go", I can upload it.
I tried using goroutines (commented in the code above) to speed things up via concurrency, but it didn't seem to have any effect on the speed (though memory usage increased) and CPU usage only spiked on one core. Not sure what the deal is with that; I'll look into it later.

So far as I have played with it, I like the language. Go has a respectable standard library, which is something many new programming languages (that I have seen) lack. If I code anything interesting enough, I'll make a post about it.

About my Application Launcher: I'll be splitting it up into a daemon process and a GUI process which will communicate using D-Bus (probably, haven't decided yet). I will be adding filesystem searching using Glimpse and locate. Glimpse is pretty damn impressive. It provides very fast searching of file contents, support for fuzzy matching, and the index is quite small (for everything under my home directory the index is ~34 MB).

Related to this, I am going to be looking into Fuzzy Matching once more (see music on the command line). Already existing for Python, I found this. Haven't tested it yet. I downloaded a few papers on Damerau-Levenshtein distance and Levenshtein automata, but probably won't start implementing anything for the next week or two.

Finally, my Senior Project. By the end of this trimester (~1 week) Nate and I plan to have audible note output using data from the contact sensors. We will integrate the accelerometers next trimester, and should have plenty of time to debug and test afterwards. At the moment, though, due to a combination of college applications, homework, and sickness, we are a bit rushed. I don't expect it to be an issue: a good, solid work day this weekend should be enough to catch up.

As a last note, I'll mention the album I've been listening to while writing this up: "Suzumiya Haruhi no Gensou". Orchestral versions of many songs from Suzumiya Haruhi no Yuutsu. Surprisingly good.