Monthly Archive for May, 2008

Initial evas-gl-quartz Patch!

I’m throwing this up here just for fun… it doesn’t work entirely, but the general gist of things works. I feel much more comfortable with the Evas source code now than I did at the beginning of the week, but this is really just a start (considering this really isn’t related at all to my final project).

Also, unless you, yourself, put the test app in an application bundle, moving and focusing the window won’t work. I’ll make that automatic sometime soon…

A patch!

Comments

LifeSaver

Here’s my (slow, naïve, resource hungry, stupid) implementation of Conway’s Game of Life in a Mac OS X screensaver. Source here.

Don’t use it on a laptop - it’ll suck your battery dry. Don’t use it on big displays (it works on my 1440×900 MacBook Pro on battery power just fine, but heats up one of the cores almost completely), it’ll be slow. Basically, I’m just posting it here … for fun. I know there’s a billion better ways to do Life. Maybe someday, but not today!

Comments

Evas-OpenGL-Quartz Status Report

I’ve gotten quite a bit further along with my first deliverable, the evas-gl-quartz port (using Carbon). Focus works now (though it needs to be wrapped in an application bundle - apparently this is a requirement). Keyboard input works, text drawing works (I’d accidentally commented out a bit too much!), the code is much cleaner. I haven’t done mouse input yet. Things I’ve learned:

All this code (keyboard input, bundle making, mouse input, etc.) goes in Ecore. The test program (e17/libs/test/orig/evas/) doesn’t use Ecore, because it’s just an Evas test, so I’ve had to write all of that code directly into the test program. I’ve been doing that, because it will make writing Ecore_Carbon and/or Ecore_Cocoa (I still haven’t exactly determined what’s up here, nor talked to the people I need to talk to to get this working) much easier!

Performance is great! Just as smooth (which is, to say, perfect) as the OpenGL-X11 port, though the complete smoothness isn’t apparent in the video.

Comments

iTunes Library Size, Over Time

I’ve recently been merging a few different music libraries together into my iTunes library on my laptop, so I was interested to see what sort of growth my library’s had, over time. I whipped up a quick Perl script (which you can grab yourself, here - though you’ll definitely have to modify it to work on Windows). I plotted the data from my library with Mathematica, and got this:

There’s now a cleaner-but-less-succinct Objective-C version, and its source. The built version (first link) will run and then just disappear, having created ‘music-chart.csv’ in your home directory, which is a CSV of: (UNIX date, iTunes Library Count) pairs. You can chart it with anything that can chart pairs… Mathematica works (ListLinePlot[Import["/Users/hortont/music-chart.csv"], PlotStyle->Thick]); Numbers might, but I’ve seen it do nasty things (you have to manually set minimum and maximum X values, or something…); gnuplot will definitely work…

Comment

OpenGL Success!

YAY! Here’s EVAS drawing to OpenGL-on-Quartz!

I have some issues…

1) I can’t drag/resize/focus the window. At all. I don’t know why.

2) I’m currently using Carbon to create the window. That’s kind of awkward because of the semi-deprecated state of Carbon in Leopard… that would prevent us from ever having a 64-bit Evas-on-OS-X application. I would like to use Cocoa, of course. For one, that would greatly reduce the amount of code required; secondly, it would probably fix #1 without any fuss; thirdly, it would fix the 64-bit problem, and be much more forward-compatible. However, I really can’t fight with Autotools any more today, so I won’t be getting Objective-C into the mix today, so… no Cocoa! Perhaps tomorrow. Or next week. Or something!

3) No input. This might be because I can’t give it focus, but I think the fact that I don’t handle input is also why I can’t focus the window. Catch-22!

Comments

Autolocate Maths

I mentioned yesterday that I made up some random math for Autolocate. The exact thoughts behind this escape me at this point - I had been awake for well over 24 hours when I found myself in Commons (our dining hall) with my computer and a bunch of printouts on Bayes’ theorem (?!? I don’t think this applied in the end, and might not have been related at all!)… and a preliminary version of the following equation:

p=\frac{\sum i\cdot e^{-\frac{(c-i)^{2}}{.03}}}{\sum i}

Where i is the ideal network strength, c is the current network strength, and you sum over the set of networks. I think I came up with 0.03 (it’s the factor that changes the width of the bell curve) by playing around with stuff in Mathematica until the curves looked right (who knows what that means!)

I quickly implemented it, and created a small test application that I played around with for a few more days (this is the code I mentioned in the previous post)… here’s a partial implementation, which seems to work:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
+ (float)partialProbability:(float)c withOptimal:(float)i
{
	return powf(M_E,-(powf(c-i,2)/.03));
}
 
+ (float)locationProbability:(NSDictionary *)testLocation knownLocation:(NSDictionary *)knownLocation
{
	float totalProbability = 0;
	float count = 0;
 
	for(NSString * key in testLocation)
	{
		if([knownLocation objectForKey:key] == nil)
			continue;
 
		totalProbability += [ALController partialProbability:[[testLocation objectForKey:key] floatValue] withOptimal:[[knownLocation objectForKey:key] floatValue]] * [[knownLocation objectForKey:key] floatValue];
		count += [[knownLocation objectForKey:key] floatValue];
	}
 
	if(count == 0)
		return 0;
	else
		return totalProbability/count;
}

Full source (but don’t expect to be able to use it, it’s a complete mess…)

Comments

Introducing Carmen!

I’m happy to finally be to a point in development where I can’t really see myself giving up on this project, so I think that means it’s time to write a post about it! This is going to be very … freeform … and varied in technical detail throughout. More of a … launchpad for ideas and examples than a … press release!

Carmen is a Mac OS X application which watches for changes in your environment, and allows you to assign actions to particular environments. Taken most simply, this allows you to perform numerous different tasks when you, say, move your computer from your home to your office. However, the power of Carmen is made clear when you want to act upon more subtle changes - say, the presence of a device, of a power adapter, etc.

I was inspired to design and write Carmen after spending a few months with MarcoPolo. While MarcoPolo is wonderful, it’s GUI leaves something to be desired, and it’s missing a fundamental level of power that I couldn’t really see implementing within the existing codebase. I’m borrowing a LOT of code from MarcoPolo, mostly from their many excellent actions and evidence sources. MarcoPolo is GPL’d, and, unlike the other handful of less-powerful but more-’pretty’ alternatives, so is Carmen!

I’ve got lots of sketches and notes and things that I think I’m going to scan and post at some point, because I really don’t have a mockup that I feel willing to post anywhere at all at this point. I (surprisingly, for a project like this!) need a lot of art, and I’m either going to have to buckle down and do it myself, or convince someone else to help me (we’ll see!)… but that’s really a blocker on having a good mockup to show off!

Time for extremely contrived examples within a list of features:

Environments are hierarchical - you can, for example, have a ‘Home’ environment, which has sub-environments ‘Studio’ and ‘Kitchen’. Say, in the studio, you have a Bluetooth tablet, and you want your volume automatically muted so as not to disturb your creative juices. However, you take the same tablet to work, where you’re continually on conference calls, and need to keep your volume unmuted. A wireless network at home indicates that you’re in the ‘Home’ environment, and, combined with the connected tablet, Carmen realizes that it’s OK to mute your volume. If you’re connected to the VPN at work, it instead places you in the ‘Work’ environment, and doesn’t evaluate the actions for the ‘Studio’ context.

Cascading Actions - I haven’t thought about this much, but there’s fragments written about it in my notes. This would involve the ability to set an action on, say, the ‘Home’ environment, and have it execute even if you’re found to be in the ‘Home/Studio’ environment. This is not how hierarchical contexts work in MarcoPolo, but seems like a far more useful model to me!

Fuzzy Logic - when multiple rules are provided for an environment, the confidence that a particular rule gives to the whole is taken into account, giving extreme flexibility to the rule system. For example, if you have a dock for your phone on your desk at home, there’s a good chance you’re at your desk when your phone is attached to your computer, and you can add this as a rule with, say, 75% probability. However, if you’re at work and need to sync your bookmarks, the fact that you’re connected to the internal VPN can give, say, a 100% probability that you’re at work, meaning that you won’t get switched to your home context when you plug your phone in! Probabilities will be expressed in words, instead of percentages (unlike MarcoPolo’s somewhat confusing and random slider), but - you get the picture!

Autolocate - this feature appears to be unique to Carmen (also, it desperately needs a better name). Based on some completely random and wacky formula that I made up by playing around with stuff in Mathematica after having not slept for well over 24 hours (and will write about at some future point in time) it allows Carmen to collect data on the strengths of wireless networks at a particular location, and then later compare the current information to saved states, and determine, with reasonable accuracy, one’s location. What’s really cool about this is that - in preliminary tests - I was able to walk a few dozen feet down the hall, make a new ‘autolocate’ location, and the demo code consistently and repeatedly distinguished between them, even though, the whole time, I stayed connected to a single network (the normal, MarcoPolo way of differentiating between network contexts). Now, this was in a college dorm, with lots of networks (something like 9) to work with. When you’re talking about a single network, this really isn’t feasible, and you’ll have to rely on other sources (like the normal, MarcoPolo ‘what network am I connected to’ one)…

Plugins - Every action and rule is actually a full-blown plugin, allowing third parties to create plugins that enable Carmen actions on their software. The plugin system also allows for the development of a community around Carmen, updating actions and rules without the need for a new release of the entire package! An internet-based plugin update system similar to the one found in Quicksilver will be implemented in order to keep everyone’s systems up to date, and to allow simple acquisition of new plugins as they are created. (of course, plugins allowed into this system will be thoroughly reviewed by myself, and will need to be GPL’d as well). MarcoPolo currently ships with rule plugins for: Audio output device, Bluetooth devices, Bonjour services, Firewire and USB devices, Light level, IP address, Displays, connected network, running applications, time of day, and power source. Since I’m borrowing their code, I expect to support all of these in the first version of Carmen, plus the Autolocate plugin. Eventually I hope to expand this list to many more! Actions in MarcoPolo include: setting default printer, changing desktop background, setting Adium/iChat status, setting default outgoing mail server, mounting network drives, changing system audio volume, opening or closing an application, changing the timeout on the screensaver, running a shell script, toggling Bluetooth, WiFi, and any VPNs. Again, I expect to support all of these (and attempt to repair the ones that are currently somewhat broken, like setting the Adium status!) in the first shipping version of Carmen!

Guile-backed - (Power User Alert) This is where the crazy power of Carmen comes in! The probability of being in a particular location is actually the evaluated result of a Scheme s-expression. Something that looks like, say:

(context
	(list
		(rule (ambient-light-range 0.6 1.0) 0.7)
		(rule (usb-device-connected "Apple iPhone") 0.9)
		(rule (not (usb-device-connected "RMS")) 1.0)
	)
)

You have the complete power to edit this however you’d like, if you so wish. Adding any kind of complex logic - or anything else supported by the GNU Guile Scheme interpreter - is quite possible. More complex changes won’t show up in the Carmen UI (we wouldn’t need Scheme behind the scenes if we could specify everything everyone’s ever going to want in the GUI!), but a special ‘advanced user’ mode will toggle on, constantly providing a color-coded view of the Scheme source for each context, easily editable to match whatever your desires may be. I’m not even going to try to come up with an example for this section - there’s so many possibilities!

Small Things - Sparkle automatic updater support, Growl support, icons for contexts, certainly more I’m forgetting at the moment!

Comments

Post-Reload Syndrome

So I’ve just finally managed to get my machine up and running again! Took a few days to backup, reload (triple booting Leopard, Hardy, and XP), and copy stuff back down (that’s still going on, but I’ve got my music back so I’m happy!).

Odds and ends: Hardy is another level of spit and polish above previous releases, for sure. They’re not quite there yet, but it’s still wonderful compared to Windows! Year of the Linux desktop: 2 releases from now.

Robb seems to think that synchronizing releases of lots of Linux software to a unified release schedule (a la Mark Shuttleworth’s latest blog post) would be a really positive thing. I can see it, but we also discussed whether this would lead to an even lesser difference between distros (as we’ve been seeing anyway), and what the ‘distribution’ would actually come to mean in a world like that. Obviously per-distro patchsets won’t go away, though I wonder if maybe they wouldn’t decrease in size… everyone being coordinated, not just on a schedule, but also with more general communication, would almost certainly lead to lots more patches being pushed upstream (and probably, bad patches *ahem* being caught earlier)… 

We generally concluded that distributions would probably converge, but allow for competition, mostly in the areas of integration/artwork/customization/reasonable defaults… but would a bunch of distros, like we have today, manage to exist without really competing on legitimate technical merit?

I dunno :-)

Comments