Kamaelia for P2P streaming ?

February 11, 2007 at 02:22 PM | categories: python, oldblog | View Comments

There was another post on comp.lang.python which asked essentially:

> I am 3 months old to python and I have done some small projects. I
> want to build a Peer to Peer streaming client

I wrote a reply back to the person directly and cc'd the kamaelia list, but the core of the reply is that the core of this relatively simple in Kamaelia, so I thought it worth posting here. The core of an actual peer looks like this:

Backplane("AUDIO").activate()

Pipeline( TCPClient( source_IP, source_port),
          PublishTo("AUDIO"),
).activate()

def PassOnAudio(): return SubscribeTo("AUDIO")

SimpleServer(protocol=PassOnAudio,port=source_port).run()

Whilst this clearly needs a source, and the core of that looks like this:
from Kamaelia.Audio.PyMedia.Input import Input  as _SoundInput

Backplane("SOURCE").activate()
Pipeline(
    _SoundInput( channels=1, sample_rate=8000, format="S16_LE" ),
    PublishTo("SOURCE"),
).activate()
def ServeSource(): return SubscribeTo("SOURCE")

SimpleServer(protocol=ServeSource,port=source_port).run()

Clearly there's lot's more to this, but that's the basic core you need. You can build QoS, buffering and multiple sources ontop of this.

The original reply is on sourceforge's archive, or will be when the archives update :)

Read and Post Comments

Things I need to look up

February 11, 2007 at 01:36 PM | categories: python, oldblog | View Comments

Two things struck me eye from comp.lang.python.announce that I need to look up at some point:
  • Shed Skin by Mark Dufur has a new release with initial support for iterators and generators. This strikes me as a really exciting, since it may mean that we can write a simple version of Kamaelia - ie a miniaxon - that works with shed skin. That opens up some really interesting options! I'll report back in the comments to this post the results of my experiments :)  (I need to reinstall dependencies first)
  • The other was Partial 1.0 by Martin v. Löwis which allows you to define a single class across multiple files. Whilst this probably looks odd I can see all sorts of interesting uses for this from the perspective of exogenous connectors. (Or put another for plugins)

Read and Post Comments

The Mikado - In the style of Bollywood -)

February 10, 2007 at 09:13 PM | categories: python, oldblog | View Comments

I'd like to invite anyone reading thing to come next week (its an ideal valentines day out :) and see a Bollywood inspired version of "The Mikado" at the Royal Northern College of Music (map). It's being put on by the award winning MUGSS society, and tickets start at a piffling £5 for concessions or start at £8 for the rest of us :) (more after the fold :)

Why would you want to see it?

It's going to be FANTASTIC, with a chorus of dozens and dancing numbers that just don't end. You'll never have seen The Mikado done this way nor never again. Where else can you see a giant elephant on stage in a light opera set in Japan? You can come and laugh at me on stage (I'm in the chorus) :) You will enjoy it, and anyone else you bring will too :)

When is it ?

From Valentine's day until the end of the week - Feb 14th - Feb 17th, at 7:30pm, also with a  matinee on the 17th at 2:30, so you can bring
the kids, who are bound to love it :)

The matinee will also feature BSL signing.

Where can I get tickets?

Well, it's probably too late for you to get them from me now (not necessarily though:) or book online using the RNCM's website.(or just turn up on the day). More info:

What's it about?

Well, The Mikado does have one of the more cogent plots of G&S, and its essentially a love story of hope, despair, and courage. More info:

Not interested? Please pass this on to someone who will be :)

Read and Post Comments

Upgrade to OpenSuSE 10.2, Topology Visualiser Fixed

February 10, 2007 at 04:54 PM | categories: python, oldblog | View Comments

Well, I recently upgrade from SuSE 10.1 to Open SuSE 10.2. The problem with this is the reason I normally use SuSE is because I personally want to focus on writing code, documents, etc. Well, what broke? Well, most of my video players had their libraries removed by the installer, and also firmware support for my wireless card was removed. That's not really any fun, but resolvable. Now I remember why I buy a distribution instead! Anyway, it's been useful for testing with python 2.5 (deprecation of string exceptions) and with updated packages. (Pygame has some minor behavioural differences meaning some minor bugfixes have been needed - this especially impacted the TopologyVisualiser. I've now fixed these issues :-)

The upgrade to python 2.5 has had a number of knockons. One of the minor ones being that raising string exceptions now causes deprecation warnings to be printed. For convenience, a number of subsystems have used string exceptions, for various reasons which now need revamping (generally old code BTW). This doesn't cause any major problems though, though it does encourage good practice prior to python 3.0.
Upgrading has overall been a good idea.

It also showed up an interesting problem to do with the topology visualiser. This is now a relatively old component and as a result uses pygame in a slightly unusual way. It as made before the PygameDisplay subsystem, which meant it accessed pygame directly. During 0.5.0, this was changed to use the PygameDisplay properly, but it still accessed the mixer. In earlier versions of pygame this problem was masked because it either failed silently or succeeded. However now it fails (which is useful to know!)

However, due to the work done in 0.5.0, this is a simple fix - we just remove the pygame.mixer.quit call from the TopologyViewer :-)

As a result that's now fixed. I'm planning on a doing a small screen cast demoing Compose as a result :) This also means that there will be a new point release coming shortly dealing with this.

Read and Post Comments

Glow in the Dark Dalek Stickers

February 02, 2007 at 11:56 PM | categories: python, oldblog | View Comments

Last year at OSCON I was lambasted. Was it my talk was bad? No. Was it because the demo broke? No, I recovered from that (I showed something else cool instead :). What was the piece of sacrilege I did? I had glow in the dark stickers of K9, a TARDIS, a Dalek and Cyberman on my laptop and I had been so thoughtless not to bring some for everyone. OK, the fact that I'd had the stickers on my laptop for months didn't wash. The fact they were freebies off the cover of Dr Who Adventures didn't wash either.

Anyway, in order to make up for it, here's a public service announcement: Dr Who Adventures magazine this week has glow in the dark DALEK!!! stickers on the front. Yes, all new glow in the dark stickers. They're even brighter than last years by the looks of things. (OK, there's also a very shiny K9 and a really large shiny Dalek Zek and a whole load of other stickers too, but I know it's the glow in the dark ones we all really wanted :-) ) Now to try and find out how to get a large supply of these for the next conference....

Read and Post Comments

The Issue with DRM

January 30, 2007 at 01:43 AM | categories: python, oldblog | View Comments

It's just struck me that there is an issue with DRM that goes to the core of the way the open source and free software movements run, but not in the way that you might expect. In the following, please read DRM to mean "digital restrictions enforcement", since that's largely all the people who say they need DRM are really thinking about. And whilst we're at it, what should a public broadcaster's policy be? (article is relatively long, so most of it is after the fold)

Essentially, there are two schools of thought with regard to copy protection:
  • Let the user act responsibly. Apply a license to the content, but expect the user to be good and adhere to the spirit of copy protection and not to make copies. Sites like emusic and a growing number of others essentially work this way. It seems also to be a model kinda applied in myspace, where music is littered everywhere, but some musicians do seem to be able to use this as a way to promote their music - as an enabler for creating income. Is content copied? By definition it will be, perhaps even by accident, largely because it's so easy to accidentally copy content.
  • The other school of thought assumes that there are a sufficient number of malicious users out there able to lead the good user astray. That content needs to have a mechanism to enforce its protection.
Which is right? Altruistic people tend to think/hope the majority of people are in the first camp. The less altruistic amongst us would be pessimistic and think the world is generally in camp 2. Now if you allow people to choose between these two you will get a preference for one or the other. Zipf distributions of everything prove that. However, if there isn't choice involved, and its something inherent, you can expect a bell curve. Essentially you have a bell curve of likelihood of the average user to engage in an activity that is not necessarily directly financially beneficial to the originator.

Before carrying on though, lets step to the next stage regarding the equivalent with open source and free software. There are two basic premises in the open source and free software world.

  • One school of thought is to trust the developer. Release your code under a license that allows the recipient to do almost whatever they want with it, but trust them to do the same, or something equivalent. It tends to be used by developers for a number of different reasons, but among them two commons ones jump out: a) "I don't want to go chasing people for infringement, since there's enough out there already anyway" b) "I believe that developers should have the freedom to choose the license for their own code". This school of thinking is typified by the BSD style licenses and similar that actually power much of the code that runs web.
  • The other school of though essentially says "the choice of being able to license code under a non-free license is not an acceptable choice". In this scenario, the most common example is this: if you create derivative works of this code, then your code must also be licensed under the same license as this code. Essentially this says that developers cannot, generally speaking, be trusted, and must be co-erced into releasing their code as free. That's a very gross way of stating it and massively simplifies the issue, and might not be how you view it, but it is essentially how this works in practice.

    There are some more subtle versions of this as well, which aren't quite as restrictive, but fall into this camp. The most prevalent license of this type is the GPL. Sometimes the choice of using the GPL comes from the fear that some unknown developer will come along, take their code, close it and make a fortune, without sharing either code or even revenue.

Essentially the same question arises - which group is right ? Well unlike the world of unprotected content, we've found after 30 years of BSD-stye open source and free software. One thing we do find is there is a bias here. In both groups the spirit and letter of the license gets broken. In the case of the GPL it's more often the letter, in the case of BSD it's more often the spirit (even then with a BSD license it's a general spirit of hoping for rather than requiring collaboration rather than closing code).

ie at the end of the day, people generally appear to want to do the right thing by those who gave them something. ie People can generally be trusted. This personally gives me some hope for the future, and also the GPL/BSD issue also points to me to a future.

  • There will always be people who believe that those who recieve their content must be forced to follow the license or the spirit of the license. In the case of code, this means the free software movement appear to believe that developers should be compelled to release their code and compelled by a license given the weight of law. I have a certain sympathy towards this group. In the case of non-code content (eg music, video, audio) there will always be those who believe that they have to use mechanisms that actively prevent the recipient from breaching the license using some for of restrictions enforcement. (I wonder if I'll get lynched for putting DRM & the GPL in a similar place due to neither group really trusting the recipients to "do the right thing"... whatever that means)
  • There will however also be those who believe that recipients of their content can largely be trusted to follow the license and the spirit of the license. In the case of code, this means that the BSD-style open source developer will give their code out freely, largely unrestricted, and trust that the recipient will treat that with respect. In the case of non-code-content, this is the scenario where you release the content as is, or perhaps tagged or watermarked with its license, but nonetheless restriction free.
An interesting sidepoint here is that the strongest proponents for a "trust the consumer" model, is actually the same group that has the strongest proponents for the "we can't trust the developer" model. However, last time I looked developers and consumers are the same people, and can either be trusted or they can't which is it?

The real point though is that in the end content falls into 2 sets of 2 camps:

  • Stuff you want to enjoy and everything else
  • Stuff that is (and I suspect will continue to be) DRMd and everything else.
Unfortunately these are never likely to be clean sets. You can almost guarantee that many members of the audience will be interested in Stuff they really want but is also DRMd. And yes, on average, people only put up with any restriction, until it becomes too irksome. If the restriction becomes too irksome, then people will tend to seek something in the more trusting camp. The same applies with open source/free software vs proprietary software as well. If the restrictions are too irksome people seek something more trusting. You even see BSD people reimplementing from scratch systems that perform the same function as a GPL one simply to avoid the GPL licence restrictions.

Furthermore, even people implementing DRM systems for Vista seem to understand this. They realise that it is too irksome to require everyone upgrade their monitors merely to watch content. As a result they merely require the OS to downgrade the content for playback. Is this sufficiently non-irksome? We're about to find out.

Given this, we have a problem. Unlike software where you can find something that performs the same function, it is very difficult to find a replacement for certain things. There will only ever be one Superman Returns (aside from various edits). There will only ever be one Spiderman 2. There will only ever be one version of Superman IV: The Quest for Peace (thank heavens). Those things exist. They are enjoyed.

Whilst we can expect people to use open source and free software versions of applications they know and love (after all there's good reason to do so), you can't expect everyone to give up the next Harry Potter or One Night at the Museum, and so on. If the restrictions of use placed on the media are too odious then people simply will not buy, but if they're light touch, and people can use them on their OS of choice, then people will buy.

This is a hard thing for many people to listen to: restrictions enforcement will not go away until it is no longer economically viable to keep technically and legally (as in enforcing legally things like anti-circumvention laws) viable.

So the harder thing is this: unless people can enjoy such content on free and open source operating systems, like Ubuntu, then Ubuntu's number one bug will likely never be quashed by free and open source software - in the same way not all software is GPL. (Apple might achieve it though, given long enough). For example, do you know of a DVD player for Linux that is legally licensed? Yes, you can play back DVDs you've bought in the shop on Linux, but do you know of a legally licensed DVD player? No? Just how old are DVDs again? (Wikipedia claims 1995)

Also, whilst I might personally prefer it to be signifcantly sooner, I suspect DRM (or rather DRE) will not actually completely disappear for up to 2, maybe even 3 decades... What then - how do you explain to a 2 year old why their copy of Happy Feet won't play on your system?

So, how should a public broadcaster deal with this issue - especially when facing the lack of a cross platform restrictions enforcement system? Tough question. (Note, I don't set any policy, I can have an opinion, and provide options, but I don't set any policy. I am curious as to people's thoughts however!

Read and Post Comments

Procrastination

January 28, 2007 at 12:28 AM | categories: python, oldblog | View Comments

I've been doing some reading recently on how to deal with procrastination, in an attempt to deal with my own procrastination better. Along the way I've discovered a few interesting things which I'm finding useful, so I thought its worth blogging about. The post is longer than anticipated so the content is after the fold, if you're willing to spend 5 minutes on it :)

OK, the things I've found out:
  • Firstly, it seems there's a theory that states it's related to the "fight", "flight" and "freeze" strategies that some animals use when faced with a predator. Specifically it's thought that it's related to the "freeze" strategy of when faced with something frightening, some animals just freeze and play dead.

    The thought is specifically when faced with what we percieve as too much to do - either too many options or something too large -that we simply shy away and do something else instead - effectively freeze.

    Clearly not everyone acts that way, and some people thrive on having too much, and perhaps that's an element of a fight response, but what turns that into a freeze? Either way it's a useful idea.

    It suggests that the very act of taking on too much can lead to not being able to function, which is a useful thought. (It certainly rings bells with what you hear about stress). The idea that it can cause you to fall into "bad" behaviours like procrastination though is intriguing.

    After all, it suggests that by taking on less at a time you will actually achieve more.

  • The second thing I picked up was related. How many times have you known what you should do next, but haven't. You've put it off by doing X for 10 minutes, another thing for 1/2 hour, then gone off and helped someone else with their thing for 2 hours, and several hours (let's pick a random number - 6) later you get back to what you should have done originally and realise you haven't even spent 5 minutes on the task?

    What if you recognised in yourself you'd taken on too much, were overloaded, and were likely to do this? What if you said to yourself - "I'll do 5 minutes on it now". There's some consequences about this - you're accepting that you do procrastinate, and that the chances are unless you spend 5 minutes on it now you'll go several hours without doing anything on it, and just feel guilty about it.

    However, if you spend 5 minutes on it now, and still follow through the same behaviour, you'll've done at least 5 minutes on it. And its true, you might still end up spending 5 minutes on that task - but it will be more time than you would have spent anyway.

    Also, it breaks a major problem - getting started. Getting started with a 5 minute task is conceptually easier than a task that mighttake 8 hours. However, there is something we all know - once we get started, often its very easy to keep going. The very act of picking *something* to work on for 5 minutes helps you get started.

  • Finally there's a really nice thing - procrastination can be good. Rather than check your email constantly, or look to check your intray,how about procrastinating that? If you're in the middle of a task and you get the urge to check your email (a typical thing that happens), procrastinating that check can actually be useful.

    After all, if something is urgent, people can always phone you, right? (or instant message you if it really is that urgent)

    Furthermore if you switch of interval mail checking, what do you lose? You can actually use procrastination of email checking to make yourself more productive (and more importantly, I think it reduces stress).

    About 6 months ago I dropped my mail auto check time to once every 2 hours. These days its now back on manual check, and I think it's made a big difference. However if I combine it with this trick, I find I'm much more effective. "No, I'll check it in 5 minutes after I finish this".
All this said, it's also made me wonder about something like climate change. It's a huge problem, probably the largest humanity has every faced - will we procrastinate and find something else to do? Will we bomb our neighbours because it's easier than solving global warming? Will we discuss the ins and outs of celebrity big brother because its easier?
Read and Post Comments

Your favourite RSS writing library?

January 21, 2007 at 09:23 PM | categories: python, oldblog | View Comments

Looking around to find a good rss writing library, I can't find one that I like. I can fund several functional ones, but I'm curious to hear of any suggestions anyone has...
Read and Post Comments

Who am I?

January 19, 2007 at 09:06 PM | categories: python, oldblog | View Comments

I don't know about anyone else, but I find this relatively scary - Zoominfo trawl the web to find out who you are, collate all the information and put it on the web - all completely automatically. I came across my entry by mistake, and personally I find it relatively disturbing. I know it's one of those things that can't be avoided, but it's really quite an unpleasant thing to see, and makes a complete mockery of privacy laws. On the other hand, it's really quite impressive.

Probably one of the more scary/cool aspects is the way I was tagged by the system - at Foo Camp, I was manually tagged based on the results that Tim O'Reilly and friends could find out about me by searching - zoominfo's tags are actually, in my opinion, more accurate (though still not how I'd tag myself. (Sorry Tim, I couldn't help linking to your zoominfo!)

Read and Post Comments

Apple TV vs Mac Mini

January 17, 2007 at 10:28 AM | categories: python, oldblog | View Comments

Brady has a post asking what people think about the apple TV vs Mac Mini. I started writing a reply there, but it grew massively in length, so I've posted it here instead. (most of the post below the cut!) Why the long reply? I've got a Mac Mini plugged into the TV video the composite video connector and can see arguments both ways. At the end of the day though, my take is a Mini rather than Apple TV - I prefer a computer to be a computer rather than an appliance (Actually I'm very tempted by a Dreambox 7020, but can't justify it right now).

Last week Apple didn't just release the iPhone. They also released Apple TV, a single use appliance that allows you to play music, watch movies and view your pictures from your home PCs or Macs. ... Both are small, both have iTunes -- what are the exact trade-offs? ... Of course, I wouldn't make my choice just between these two devices. Microsoft's Media Center or Ubuntu on a Shuttle PC would have to be considered as well.

The original reply I was posting:

I've got a Mac Mini in my living room, but suspect that the Apple TV box would make for a better TV only appliance, however it is a computer dressed up as an appliance - what if you want a computer?

Whilst the Apple Blog mentions, for example, "S-Video and composite video with optional adapter", the video quality is extremely saturated I've found, and whilst you can make it a bit better, it's less than ideal. The positioning of the traditional mac menu also means that you can't use overscan sensibly, which results in greater flicker (qualitatively). As a result you *can* watch things like DVD's and so on using a normal TV using the video adapter, but you'd probably prefer to use a DVD player. Due to the quality of video output, I've found that even at the lowest line res (480 lines), the quality still isn't really good enough for day to day use. (Which makes sense, PAL isn't really fields of 625 lines anymore than than NTSC is fields of 525 lines. Being visually reminded of this is a pain though)

It's certainly fine for occasional use though, and the filtering caused by the less than ideal video output (IMO) actually can mask some low bit rate video codec's problems which can make watching (for example) video trailers off the net nicer on the TV than on a laptop screen. (Which makes sense really - if you consider TV quality is really 625/2 lines or 525/2 lines for a stable/crisp image (if you're happy with less stable, you can treat it as 625 & 525 :-).

By comparison, plugging the Mini's DVI-out into a DVI-input or VGA input into a flatscreen TV is obviously a lot better and really quite nice.

However, the lack of an HDMI connector means that certain plans for HD content distribution simply won't be enabled by default. As a result I'd expect the Mini to be less useful in the general HDTV arena. (Simply because of the lack of the trusted display)

Personally, I think that's a pity, since the Mini is a really nice machine, *and* it's quieter than my PVR or DVD player (even when playing DVDs).

It's a pity really that the colour conversion (despite playing with the colour/display settings) to compositive video is through the Mini is as bad as it is.

At the end of the day, I'd suspect the question is really: what's your use case for it - sit back or lean forward? If the former (you can use a laptop for the latter), then Apple TV makes sense. If you're thinking of a useful machine (eg as a server & running apps) then a Mini makes more sense *if* you have a TV with DVI or VGA in, or your own DVI/VGA to video converter.

These area all minor hardware issues though. The real change is from a general purpose computer where the software is upgradeable to machines where you can't change the software. In the words of Ratchet from the film "Robots" "upgrades, not parts!".

Incidentally if you haven't seen it, you should see Robots. You might think the part of the film where the new shiny, brushed metal, robots are being talked about, keynote style, is rather reminiscient of certain styles of tech keynote talks.

Read and Post Comments

« Previous Page -- Next Page »