Kamaelia for P2P streaming ?
February 11, 2007 at 02:22 PM | categories: python, oldblog | View Comments> 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()Whilst this clearly needs a source, and the core of that looks like this:Pipeline( TCPClient( source_IP, source_port),
PublishTo("AUDIO"),
).activate()def PassOnAudio(): return SubscribeTo("AUDIO")
SimpleServer(protocol=PassOnAudio,port=source_port).run()
from Kamaelia.Audio.PyMedia.Input import Input as _SoundInputClearly 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.
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()
The original reply is on sourceforge's archive, or will be when the archives update :)
Things I need to look up
February 11, 2007 at 01:36 PM | categories: python, oldblog | View Comments- 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)
The Mikado - In the style of Bollywood -)
February 10, 2007 at 09:13 PM | categories: python, oldblog | View CommentsWhy 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 bringthe 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 :)
Upgrade to OpenSuSE 10.2, Topology Visualiser Fixed
February 10, 2007 at 04:54 PM | categories: python, oldblog | View CommentsThe 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.
Glow in the Dark Dalek Stickers
February 02, 2007 at 11:56 PM | categories: python, oldblog | View CommentsAnyway, 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....
The Issue with DRM
January 30, 2007 at 01:43 AM | categories: python, oldblog | View CommentsEssentially, 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.
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.
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.
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.
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!
Procrastination
January 28, 2007 at 12:28 AM | categories: python, oldblog | View CommentsOK, 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".
Your favourite RSS writing library?
January 21, 2007 at 09:23 PM | categories: python, oldblog | View CommentsWho am I?
January 19, 2007 at 09:06 PM | categories: python, oldblog | View CommentsProbably 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!)
Apple TV vs Mac Mini
January 17, 2007 at 10:28 AM | categories: python, oldblog | View CommentsLast 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.
« Previous Page -- Next Page »