ubuntu uk logo

Planet ubuntu-uk

This page contains feeds from ubuntu-uk member's blogs

For more info please see the planet wiki page The Feed url for this planet is http://planet.ubuntu-uk.org/atom.xml .

The views expressed here do not represent the views of ubuntu, canonical or ubuntu-uk

February 16, 2012

Ubuntu Accomplishments Update

The last time I posted about my little project I shared a video demo of the work so far. I am pleased to report that I have made some further progress.

A key part of the design of the accomplishments system is that it supports two types of accomplishment:

Local – these are things you can achieve on your computer. Examples of this could include: sending your first email in Thunderbird, configuring your chat client, changing your wallpaper etc). I have a small library applications can use for this. Machine Verifiable – these are things you can accomplish within the context of a community (e.g. becoming an Ubuntu Member, filing your first bug etc). These achievements are verified by a third party server to avoid people faking their trophies.

Although support for the former works, I have been really focusing on the latter Machine Verifiable accomplishments. I am pleased to report that this works fully end-to-end now. It works like this:

When you start the app we ask for your permission (as we are syncing data to a third-party machine). When you agree to this the app creates your trophies directory, creates an Ubuntu One share and syncs it with the server. I have written some scripts for the server that scans the shares and approves them. The app then runs the different accomplishments scripts and when you achieve something it is synced to the server, verified and then returned. It then appears in your list of trophies.

With the exception of some loose edges, this is all basically working, and even runs on someone else’s machine than mine. :-)

To get this rolling I wrote a bunch of additional accomplishments that use launchpadlib to give you a trophy if you have certain roles in the community (currently, Ubuntu Member, MOTU, core-dev, and a member of a LoCo Team).

A pretty cool feature here is that these accomplishments have dependencies. As an example, you need to complete the Register a Launchpad Account accomplishment before you can complete the File a Bug accomplishment (as you need a Launchpad account to file a bug). As such, accomplishments that you can’t access yet are listed as locked and unlocked when you have satisfied their dependencies. This helps us to develop a journey for how people learn new experiences and participate in the community.

You can now filter available opportunities by locked or unlocked – this makes it easier to see what you can do right now. I also prettified the interface somewhat and ripped out some of the clunky pieces of my very first implementation. With the addition of the extra accomplishments you can also see the additional categories.

This is how it looks so far:

[image]

I am hoping to release a video demo of this soon.

I will also be opening up a call for testing and accomplishment contributions when I nail a few final bugs. Stay tuned, folks!

Thanks to William Grant for his launchpadlib help recently.

February 15, 2012

Ambilight clone – Software

This is part 2 of this post

I have decided to write this up as a seperate post, due to length.

 

There are 2 pieces of software required to get an Ambilight working; The program to run on the arduino and Boblight.

Arduino

The code that runs on the Arduino was found here: https://github.com/michaelficarra/ambilight/blob/master/ambilight.ino

It can be run pretty much as-is, with one minor modification. To run with more than 32 LEDs, or faster than 30fps, the line

#define serialRate 38400

should be changed to

#define serialRate 115200

Here are the instructions on how to set up the required library (assuming you have the Arduino environment already installed)


$ SKETCHBOOK_PATH=$(grep ^sketchbook.path ~/.arduino/preferences.txt | cut -d = -f 2)
$ mkdir -p "$SKETCHBOOK_PATH/libraries"
$ cd /tmp
$ git clone git://github.com/arduino/Arduino.git arduino
$ mv arduino/libraries/SPI "$SKETCHBOOK_PATH/libraries"
$ rm -rf arduino
$ cd "$SKETCHBOOK_PATH/libraries"
$ git clone git://github.com/adafruit/WS2801-Library.git WS2801

This should install the SPI and WS2801 libraries required for the arduino code to run.

 

Boblight

The boblight project page can be found here: http://code.google.com/p/boblight/

And the instructions for installation are as follows (taken from the Compiling guide on google code)


$ sudo apt-get install libx11-dev libgl1-mesa-dev libxrender-dev libxext-dev portaudio19-dev libavcodec-dev libavformat-dev libswscale-dev libavdevice-dev
$ cd ~
$ svn checkout http://boblight.googlecode.com/svn/trunk/ boblight-read-only
$ cd boblight-read-only
$ ./configure
$ make
$ sudo make install

This should be all the software that is required to get an ambilight clone functioning. Boblight is made up of two components; The boblightd server which communicates with the Arduino and boblight clients which actually provide the colour data.

Boblightd requires a config file at /etc/boblight.conf and I have uploaded mine here

[global]
interface 127.0.0.1
port 19333

This defines which IP address and port boblightd listens on for clients.

[device]
name arduino
output /dev/ttyUSB0
channels 196
type momo
interval 16600
rate 115200
prefix 55 AA 55 AA 55 AA 55 AA
allowsync yes
#arduino bootloader runs when opening the serial port for the first time
#delay transmission one second after opening so we don't send shit to the bootloader
delayafteropen 1000000

name is a unique name for this boblight device output is the where the Arduino connection can be found channels is the number of LEDs * number of colours. In my case this is 64 * 3 type is the protocol used to communicate colour data, and should be left as ‘momo’ interval is how often updates are sent to the Arduino (in uS). 16600 is ~60 fps rate is the number of bits per second to send over the link to the Arduino. This must match the #define serialRate set in the arduino code. prefix is a string of bits sent between each frame of data allowsync enables real-time updating of the colour data. This means a quicker response time of the LEDs but will also lead to the LEDs being out of sync if the data rate to the Arduino isn’t high enough

Next, the colours of the LEDs are defined:
[color]
name red
rgb FF0000
adjust 1.0
blacklevel 0.01

‘name’ and ‘rgb’ are fairly self-explanatory. ‘adjust’ is a value between 0.0 and 1.0 which allows the intensity of each colour to be calibrated. ‘blacklevel’ is the minimum brightness to be displayed on this channel; if the incoming colour is darker than this then display this brightness.

[light]
name light00
color red arduino 1
color green arduino 2
color blue arduino 3
vscan 94 100
hscan 94 100

This defines which area of the screen is assigned to which LED. The name is a unique name for each LED. The three colour lines define which colours the LED can display, which device the LED is attached to and the order of each colour component in the chain.

vscan and hscan define which area of the screen to average for that LED. 100% for the vscan is the bottom of the screen, and 100% for hscan is the right of the screen. In this case, the LED is matching the bottom right corner of the screen.

 

Testing it out

At this point, it should be possible to test out the ambilight system! The first test is displaying constant colours, using the boblight-constant client, which takes one argument. This is a hex string representing the RGB colour value to display.

First, start the boblight server

$ boblightd &

Then try each of these commands in turn (ctrl+c to quit)

$ boblight-constant FF0000

$ boblight-constant 00FF00

$ boblight-constant 0000FF

If you run these commands in order the LED strip should turn red, then blue, then green. Lastly

$ boblight-constant FFFFFF

should be pure white. If all of these work, it is time to test the screen-following client. This is called boblight-x11. A test command line is:
$ DISPLAY=:0.0 boblight-x11 -i v1 -o value=1.5 -o speed=100

If you’ve done everything correctly (and the planets are aligned just right), the LED lights should be following the edges of the screen. You can play with the config options to see what looks best for you (speed controls how long the averaging window the client uses is, value is a brightness multiplier, and adding -o saturation=x makes the colours more vivid).

I use VDPAU with MythTV and found that I needed to start it up with the environment variable VDPAU_NVIDIA_NO_OVERLAY=1 set. This makes boblight work with MythTV but sadly causes quite a bit of tearing. If anyone knows of a solution to this problem, I would be very grateful.

A little more control

This basic system works well when just watching TV, but I felt that there were a few improvements to be made. For instance, when you pause the TV and the screen goes blank, you lose the lights. Often you pause the TV because you want to get up and do something so leaving you in the dark isn’t ideal. To get around this problem, I wrote some software which allowed me to control which boblight client was running by echoing values to a file. This allowed central process management to keep track of which client is running and make it easy for various applications to interact with it.

The source for this system can be found here and it is compiled with the command

$ gcc boblight_notify.c -o boblight_notify

To run it, move the executable to a directory that allows the current user to create new files then run the executable. For example:

$ mkdir ~/boblight_manager

$ mv boblight_notify ~/boblight_manager

$ cd boblight_manager

$ DISPLAY=:0.0 ./boblight_notify &

To test that this is working, open a new terminal and run

$ echo 95 > ~/boblight_manager/tv

This should start screen-follow mode, with the speed set to 95. The other commands that should work with your current setup are:

$ echo [hex RGB colour] >~/boblight_manager/static

$ echo 1 > ~/boblight_manager/lock Forces the lights to stay in the current mode

$ echo 0 > ~/boblight_manager/lock Allows the lights to change mode again

$ echo off > ~/boblight_manager/off Kills all clients currently running

$ echo [text] > ~/boblight_manager/warn Makes the lights flash brightly 5 times while displaying text on the screen with notify-send (this seems to be buggy right now – I’ll try to fix it)

The other commands supported in the source file work with a client that I wrote, which I hope to be able to release the source for shortly.

I have used this control system with MythTV’s system events, so that whenever playback is started, stopped, paused or unpaused the appropriate command is executed to either start tv mode, or display a static white colour. I have also developed a web interface to allow control of the lights remotely. This requires a working apache+PHP install, and the source can be found here

Still using Ubuntu 10.04? You may find this info about backports of newer kernels very useful.

If you're still running "Lucid", 10.04, and are having driver problems or something, there are now 3 different newer kernels available.

The kernel contains wifi drivers and so on. The only main class of driver it doesn't contain are graphics drivers for X.org - X contains its own. However, some newer proprietary graphics drivers, e.g. from nVidia, may require a newer kernel than Lucid's 2.6.32 to install and work correctly. These kernels are thus a considerable boon for quite a lot of reasons and may help 10.04 to remain useful for some time to come yet. For instance, they are great if you don't like Unity and are waiting for GNOME Shell to become a bit more mature, say. They aren't just for servers.

They newer kernels are backported from 10.10 ("Maverick"), 11.04 ("Natty") and 11.10 ("Oneiric").

There are 3 different kernels in each family: one generic, one generic with PAE support for 32-bit machines with 4GB or more of RAM, and one for servers.

If you look in Synaptic (or the package manager of your choice), you should see (for example):

linux-image-generic-lts-backport-natty

and the matching linux-image-generic-pae-backport-natty and linux-image-server-backport-natty.

There are also families ending -oneiric and -maverick.

From memory, the standard 10.04 kernel is version 2.6.32-xx where -xx is the current build.

The Maverick series are 2.6.35-xx, Natty ones are 2.6.38-xx and the Oneiric series are 3.0.0-xx.

If you install (say) linux-image-generic-lts-backport-natty, you will get the current build of 2.6.38-xx and it will be updated as newer builds are sent out. You don't need to install a specific version - if you do so, it will *not* be updated.

I have found that the PAE kernel will not boot on some Celeron machines which have the PAE functionality disabled, so I recommend against using it unless you know you will need support for >= 4GB RAM.

I have resolved quite a few problems with these, including machines that hang on shutdown rather than switch off, getting newer WLAN chipsets going that did not work with the standard 10.04 kernel, and supporting some Sony Vaio machines that will not boot older kernels successfully.

The same kernels are also available in Mint 9, as it is based on Ubuntu 10.04.

February 14, 2012

Ubuntu Accomplishments Lens

[image]Click here for full size.

Thanks to the always amazing David Callé who has created this lens for the Ubuntu Accomplishments system. David was also the first person to brave running the Ubuntu Accomplishments system other than me (complete with the server verification pieces). It worked!

This week I expect to have another update on Ubuntu Accomplishments. My evenings have been tied up with finishing The Art of Community but the deadline for that is tomorrow.

Stay tuned!

12.04 Feature Freeze This Week

This week is feature freeze in Ubuntu land and the Kubuntu community have been working hard to get in as many as possible before the deadline.

[image]
Telepathy-KDE is working nicely. We're still deciding if it's better to go with the new-but-not-much-tested Telepathy-KDE or the old-but-unmaintained Kopete by default.

[image]
LightDM Plasma Theme, not likely to replace KDM yet for lack of testing but a promising way to get a login manager with all the features

[image]
Oxygen-GTK3 theme, so your GTK apps fit in with the Plasma desktop.

[image]
Calligra office suite featuring Krita the world's best painting app. Handy for updating hackergotchis. MS Office file import/export is reported to be better than LibreOffice because of the top work by KO GMBH. Not the default yet but the signs are good for fixing the "we don't have a KDE office suite by default" bug in the next year.

[image]
Rekonq 0.9 and Owncloud 3.0 are both in progress.

[image]
Plasma Active! Could a Kubuntu Active remix be around the corner? We'd be the first distro with a free software tablet UI if we can get it done.

If you want to know how my health is doing see my personal blog entry Recovery from Severe Traumatic Head Injury.

Warning! Shameless plug enclosed.

Fb-Button

Those who have been following my posts already know that I am running a commercial venture to promote the use of Linux in the home and small business markets. For those who haven’t I shall provide a brief recap:

So far we have learned that the end user doesn’t really want desktops any more, suppliers charge entirely too much, laptops seem to sell for more trade than I am willing to pay retail!(?) Also it appears that Linux use is far more prevailant in the wild than you might otherwise think, specifically Ubuntu appears to be on track to take over the universe before the end of the decade!

Over the past three months I have come into this with a degree of presumption which has been completely smashed and have now begun to evolve my project making improvements as and when the need becomes apparent. We now buy in broken laptops which are repaired if possible then sold at the computer fairs. Those which can’t be repaired using the spares at my disposal are broken down into individual parts and added to the spares.

We all know it’s a bad idea to put all your eggs in one basket, multiple income streams adds security and the odds of all of them having a bad month at the same decreases as the number of projects increases. We now PAT test, offer IT support, and of course the computer fairs. However there is one more piece to the puzzle, the list of laptops in our inventory is rapidly growing and of course is quite valuable, some screens fetching over £100. It doesn’t make sense to keep clinging to this stuff in the hope a suitable ‘patient’ will turn up.

So this new stock can be sold in online auctions, reaching a wider audience and subsidising the infant Linux promoting project. It is crucial that this can be made profitable as the whole business model hinges around being able to efficiently process these machines in quantity. We all know there is one big name player in the auction arena however they charge a fortune and the customer service would probably be better if they didn’t have any at all! Working with that website is constantly hard work and costing 40p every 30 days for each listing it doesn’t take long before a less popular part becomes a liability.

It is for that reason I would like to invite my readers to look at eBid. An alternative to the big name brand which shows a lot of promise. The costs for a seller are much more reasonable and that means small businesses can thrive! Their stance on support is that the customer is always right, they are on hand at the end of a phone to talk with customers who need help and rumor has it that even the CEO is actively involved in dealing with the customers! Take a browse over to our eBid shop and show your support for a better way of doing things. It’s just laptop parts today but I’m sure given time we will expand the shop to cover our other products too.

http://clifton-test-services.ebid.net/

Fb-Button

Music Of Ubuntu

OK, fun little meme time. Simple question:

Which songs remind you of Ubuntu?

Think about the music…the vibe…the rhythm…what it makes you feel when you listen to the song. Which ones make you think of our goals of bringing Free Software to the world with Ubuntu?

Reply using your blog, Google+, Facebook, Twitter or wherever else (use the #musicofubuntu hashtag) and lets see what music gets our Ubuntu blood flowing. :-)

I have a few I want to present via the wonderful medium of embedded YouTube videos. What are yours?!

Queen: Don’t Stop Me Now

Can’t see it? Watch it here!

Twisted Sister: We’re Not Gonna Take It

Can’t see it? Watch it here!

AC/DC: Shoot To Thrill

Can’t see it? Watch it here!

Airbourne: Runnin’ Wild

Can’t see it? Watch it here!

Rush: Virtuality

Can’t see it? Watch it here!

Grave Digger: Rebellion (The Clans Are Marching)

Can’t see it? Watch it here!

Rage Against the Machine: Renegades of Funk

Can’t see it? Watch it here!

Bomfunk MC’s: Freestyler

Can’t see it? Watch it here!

Canonical Community Team Weekly Meetings

Just a reminder…every Tuesday at 8am Pacific / 11am Eastern / 4pm UTC on #ubuntu-community-team on freenode IRC.

Everyone runs through a a list of the work they have been doing over the last week and you can ask questions. Feel free to join us; everyone is welcome!

February 12, 2012

A man, a cupcake, a photobooth

Photobooth photos from Marry Me in Somerset birthday tweetup

“You have to have your photograph taken in the photobooth, so it can go in the album.” Those were the instructions from Abi and Lisa, the two lovely ladies behind Marry Me in Somerset. The website’s first birthday was this week and to celebrate they organised a tweetup at The Manor near Taunton, a splendid 13th Century Grade II* listed building.

Although quite a way from home I decided to go along and I’m so glad I did. Everyone was very welcoming and I got a fascinating history of the house from Fiona, one of the owners. I can’t wait to go back and see it in the daylight – it was a bit too dark to see the acres of formal gardens! The rooms were fantastic and each with their own character. Food was laid on by Le Frog, and there was a great deal of chatter. Normally a bit reticent in crowds of strangers, I threw myself into the occasion and met a load of awesome people as a result. A massive thank you to Abi and Lisa for organising the event, and please invite me to the next one!

And the cupcake? The good people at Cake Couture Bristol provided special “Marry Me” cupcakes for the evening. I had one in my hand when I went into the photobooth. I think I exhausted my range of facial expressions but it seemed to go down well.

Thanks to the party photo booth people for the print out. :)

Tottenham Court Road/Bracknell 11/12th February 2012

Fb-Button

This should be a rather tricky report tonight, full of promise and frustration both at the same time. I’m not sure if it’s the weather, or the economy, or something else entirely, but this weekend has been extremely hard going and I know that I am not the only trader who has struggled to turn any profit at all! However I can’t really complain since I spent the majority of this week’s takings on buying a laptop from a customer, which in turn I should be able to profit from.

Trading in London went quite well although I am being held by by the fact that most of the items on my stall are smaller items and smaller value, this is a temporary situation which should be resolved in the next week or two. I really do think this weekend was a landmark, several customers made a point of seeking me out because they have seen me at a previous fair. Perhaps not to buy but certainly to chat, this of course is the first hurdle, they need to know you are there, and they need to know you are glad to see them. This is proof that all the right bridges are being formed and people are taking notice. I even managed to sell my framed 8″ floppy disk, this is good because it sold, but bad because I am no longer the owner of a really cool 8″ floppy disk! It went to a couple of guys I must have spent the best part of an hour debating all things Ubuntu with so at least I know it went to a good home. Another notable customer was a non-tech savvy Ubuntu user who wants a hardware upgrade and is intending to bring his machine in to me next week.

So although the numbers may not be huge I’m seeing the start of a loyal customer base here, what happens next is crucial in keeping them.

Bracknell was equally interesting including an in depth discussion with a person who doesn’t use Linux because it ‘broke my hard disk’. This is a case of installing, wiping, installing Windows and finding out that Grub won’t play nicely. He seemed rather shocked that I would offer to restore his disk to a working state at no charge, I explained how using the Wubi installer would avoid a repeat of this and that I’m not going to convert many users if their first experience of Linux with me is a bill! So he left with instructions to bring me his drive and he claims that he may give Ubuntu a second chance.

The topic of discussion this weekend seems to have been Unity, good or bad? I’ve heard a fair few words against it, usually in a sentence involving the word Mint. However that’s the beauty of Linux, you can choose! Lots of good words too but as of now should you chance upon my stall and fancy that nifty little notebook but the only thing putting you off is the lack of Windows then no problem. I’ll throw in a Windows authenticity code and you can choose what OS you want.

Fb-Button

A standalone java/jar application from Scala sources using Proguard

After about an hour of digging around and looking for a way to package a simulation I wrote in Scala for a coleague, I came across this process of doing it. I have reduced it down to a bash script which will be at the bottom of this post but I thought I should go through the steps a bit as the script makes certain assumptions.

The first assumption is that you have the necessary libraries and such to run it they are as follows:

Scala Library (That goes without saying if you’re going to be writing Scala code) I have a custom path for mine as I want to manually sync my libraries, compilers and so on with the latest versions. I have extracted my copy to ~/Bin/Scala-2.9.1.final this will be the path my bash script will assume, you must change this to your path if it’s different. Proguard: I am using version 4.7, version 4.4 comes with ubuntu but, seeing as I like to keep it at the latest and I am impatient my proguard lives in ~/Bin/Proguard4.7 Java (This also goes without saying. You will probably need the JDK as well as the JRE so install them both) Proguard uses the java libraries extensively so you need that.

My simulation is in the following directory structure
engine
| – src
| — | —  Engine.scala
| – build-app.sh
| – scala-config.pro

The engine->src->Engine.scala is my scala application with the object Engine defined as my entry point this is important for the MANIFEST.MF file the script will be creating

Now the steps

First we can create a little folder to hold the output of the scala compiler so we create  a folder called bin inside of the engine folder itself so that the folder structure now looks like this
engine
| – src
| — | — Engine.scala
bin
build-app.sh
scala-config.pro
by running
mkdir bin

then run the following while you’re inside engine which from now on I will refer to as root

scalac -sourcepath src -d bin src/Engine.scala

this will compile the Engine.scala code into java classes inside of the bin folder

This completes the scala bit, everything else following is run with Java so we need a MANIFEST.MF file to compile a jar
echo "Main-Class: Engine" > MANIFEST.MF

this will do it for you. Bear in mind you are still at the root level

Now at this point we change directory to the bin folder where scalac has created our classes and compile our jar using the manifest we have just created so this should do it:

cd bin
jar -cfm ../engine-no-scala.jar ../MANIFEST.MF *.*

You can obviously do this a different way by staying in the root and making sure your path is correct, personally I found this easier.

This above code will create our engine called engine-no-scala.jar with the MANIFEST.MF file
bear in mind at this point if you ran java -jar engine-no-scala.jar it may fail if your scala code required the scala library to run
mine does so now I need to package this WITH the scala library into a complete self-contained java application
now earlier I did say that my scala home was in a custom location so we need to keep that in mind for the next section PROGUARD

Not only does proguard include the required libraries and so on, it also obfuscates and discards any unused classes and packages
this is very nifty for distribution as it cuts down by orders of magnitude the size of your application.When I did this without proguard my application was over 8 MB because the entire scala library was in my jar
after I finished with proguear I am looking at an 8 KB application, and I think I can even get it smaller if I optimise my code a little bit more
but that’s for another timeProguard however needs a configuration file to work properly in my case, I went to their site and downloaded a sample scala-config file (click on the Scala link) I just made the following changes to the vanilla one they provided
-injars engine-no-scala.jar
-injars /home/kwabena/Bin/scala-2.9.1.final/lib/scala-library.jar
-outjars engine.jar
-libraryjars <java.home>/lib/rt.jar

-dontwarn scala.**
-verbose

I just changed the path to my jar file and my scala library and I also turned on verbosity (I like to know what’s going on) my build script now has the following lines

cd ../
echo "Adding Scala library, obfuscating..."
#proguard
proguard.sh @scala-config.pro

after that you can remove any side effects from the script with

rm -rf bin MANIFEST.MF engine-no-scala.jar

bear in mind that we changed the our current workind directory to the root level
after a few minutes of compiling, obfuscating, optimisation and shrinking you should have a nice
jar to run by itself on a computer with ONLY the JRE installed

the complete script follows you can just copy this, save it into a file called “build-app.sh” as it is in my folder structure change the permissions to execute with

chmod +x build-app.sh

and run it

#!/bin/bash

echo "Creating required directories"
mkdir bin

echo "Compiling scala sources"
scalac -sourcepath src -d bin src/Engine.scala

echo "Creating Manifest"
#build manifest
echo "Main-Class: Engine" > MANIFEST.MF

echo "Building java archive from scala classes"
#create jar
cd bin
jar -cfm ../engine-no-scala.jar ../MANIFEST.MF *.*

cd ../

echo "Adding Scala library, obfuscating..."
#proguard
proguard.sh @scala-config.pro

#remove fluff
echo "Removing fluff..."
rm -rf bin MANIFEST.MF engine-no-scala.jar

I hope you find it as useful as I would have should this have been available earlier.

February 11, 2012

Ambilight Clone

Ambilight “ generates light effects around the TV that correspond to the video content”. It was developed by Phillips around 2002. Simply put, the system takes the colours at the edge of the TV screen, and re-projects the colours on the wall behind.

Ambilight-3

 (not my TV/picture)

Previously I had found that watching television in a dark room could cause some eye strain due to the contrast between the bright television and the almost black wall behind it. My first solution to this was to place a desk lamp behind the TV, pointing at the wall behind it. This improved the eye strain, but wasn’t always best suited to the content being displayed on the TV. First, it was at a constant brightness. While the TV may have been displaying a very dark scene the back lighting would drown out the image. Secondly, it was a fixed warm-white colour, which didn’t really match what was playing unless the program was set outside in the daytime with good weather .

As a solution to this, I decided to build an Ambilight clone. This allows the back-lighting to match the content displayed on the TV in both colour and brightness, reducing eye strain and improving immersion (at least, that is what I hoped). As the majority of the content I play on the TV comes from my MythTV frontend and intercepting and decoding a HDMI signal is non-trivial, I decided to look for a method that would allow me to grab the framebuffer from the frontend and send data from that to the LED lights.

 

Hardware

The hardware requirements for the system I built are relatively modest. Due to the ease of setup/lack of wiring required, I decided to use a WS2801-based LED strip, which allows the colour of each RGB LED in the strip to be independently set using only two wires from an arduino. The strips I went with were these:

 

(available from here in the US)

I ordered two strips (2m, 64 RGB LED clusters), which came with enough connectors to join them together and to wire up to the Arduino / power without any soldering required. 2m is about the perfect length to cover the sides and top of  a 42″ TV, and 64 RGB LEDs is starting to approach the limit for how quickly you can pipe data to the Arduino @ 60 fps. These strips can be cut every 10cm or so to allow for smaller dimensions, although this requires some soldering ability, a sharp knife and some extra wiring and/or connectors.

I used an Arduino I had lying around to drive the LEDs. It was an ATmega328p-based  Duemilanove . An Arduino like this would be the ‘modern’ equivalent.

The LED strips I used required about 1.8A/m @ 5V (so 3.6A total). I ordered this power supply to power the LED strips (the Arduino pulls power from the USB connection).

 

Putting it together

Attaching the strips to the TV. I found that for my size of TV (42″), 2m of LED strips almost exactly fills 3 sides of the screen (I didn’t place any LEDs along the bottom because they would be hidden by the stand). Luckily, the strips are flexible enough that I could bend them through 90° so that each strip covers one side and half of the top of the screen. Make note of the direction of the arrows on the strip, and place the start of the arrow closest to where the Arduino will be placed. The strips do have a sticky backing, but I decided not to use this and use sellotape instead, to allow for easier repositioning of the strips if required.

Connecting the strips to the Arduino. As the power for the strips is coming from a different source than the power to the Arduino, I connected the ground (black) wire from the 4-pin connector on the strip to the ground on the Arduino to tie the two together. I attached the red lead from the cable to pin 2 of the Arduino, and the green lead to pin 4. I did not connect the +5v (blue) wire to anything.

Power to the strip. This is done via the 2-pin connector. You can safely power 2m of strips without having to re-inject power at the start of the second strip, but it may be necessary to investigate more power wiring for longer strips.

Connect the Arduino to the MythTV frontend via USB.

The total cost of these components was somewhere in the region of £120 (not including delivery). I did by some crimps/longer wiring in anticipation of having to splice strips together and make my own cables, but a couple of spare connectors were provided in the box which were all I needed to connect everything together.

A word of warningthe PSU I chose doesn’t guard the live mains power connections particularly well. While it shouldn’t be possible to give yourself an electric shock without a small amount of fiddling/poking (there is a plastic cover over the mains wire connection), it would be advisable to find an alternative housing for the project if there is any chance of pets/children getting anywhere near it. Any suggestions for a project housing which would require minimal/no cutting or drilling would be appreciated.

Software

Written up here

The finished product

I have an early video of my Ambilight clone, just after it was initially set up. At this stage there was a bug in the setup which meant there was a lag in updating the RGB lights. I also hadn’t finished implementing all of the modes in my boblight client, and the saturation / brightness were set higher than I have them today. Another thing to note is that cameras do not cope well with the dynamic range required of them to take video of bright LEDs in a dark room; the lighting is more subtle in-person.

February 10, 2012

Ubuntu Accomplishments Video Demo

Recently I have been blogging about a project I have been hacking on called Ubuntu Accomplishments.

This is an accomplishments system that can be used to identify when people have accomplished various things in the Ubuntu project and reward them with trophies. The plan also makes additional skills and accomplishments more discoverable and provides better help for people to get started. While designed for Ubuntu, the system can be used for other projects and also for local applications (e.g. completing Level 1 on a game). Accomplishments in community projects are verified for their integrity so people can’t fake their trophies.

I wanted to present a video demo of the system working so far:

Can’t see it? See the video here!

You can find out more about the project here and the code is available in the following branches:

lp:ubuntuaccomplishments – contains the main trophy viewer app, the daemon, and the libaccomplishments Python module. lp:~jonobacon/ubuntuaccomplishments/ubuntu-community – a collection of Ubuntu accomplishments for different things you can accomplish in the Ubuntu project. There are only two accomplishments right now – can you help write more?. lp:~jonobacon/ubuntuaccomplishments/validation-service – the server-side verification service that runs on an Ubuntu One headless machine.

Now, this is really early in the stages of development. If you grab the code you will find various bits that are not yet implemented, but the core idea works.

Things we need to do next:

Generate the user’s trophy directory and share it with Ubuntu One. I have the code written to do this, I just need to merge it in. Add a Getting Started page which asks the user if they want to use verified trophies that use Ubuntu One. Fix support for machine-verifiable trophies that are dependent on others. Actually sign the trophies. Implement the categories filter in the My Trophies view.

I plan on writing a longer blog entry about how the system works later for those who are interested in contributing.

February 09, 2012

On vendor prefixes in CSS and vendors implementing them

On Monday at the CSS Working Group, Microsoft, Mozilla and Opera announced that each are considering supporting some -webkit- prefixed CSS properties.

I include here Bruce Lawson's excellent summary:

Lots of developers, despite evidence to the contrary, have assumed that mobile Web = WebKit browsers, because that’s the rendering engine in Android and iThings. Suppose the site was made a while ago and used the experimental, pre-standardised code -webkit-border-radius and didn’t use the cross-browser future-proof method. The real CSS property border-radius has been long been standardised and supported without prefixes in all the major browsers. But the -webkit- prefixed version still lingers on in Safari and Chrome, so that legacy code looks fine in the webkit browsers, but broken in Opera, Firefox and Internet Explorer.

We've been through this fight before. A few years back, Internet Explorer proposed the X-UA-Compatible header, which would mean that IE8 would act like IE7 unless you specifically told it to act like IE8. The proposed solutions back then were similar to what we're seeing today in response to -webkit-* CSS in non-WebKit browsers: developers shouldn't be lazy; developers should do it right; sites should break if they use WebKit-only CSS in order to punish the developer; use this library to help you do it right (LESS for CSS pre-processing on the server side, prefixfree on the client-side); WebKit should stop supporting a prefixed CSS property once it supports the unprefixed version; vendor prefixes are a broken concept and should be abandoned.

None of these approaches will work.

Expecting developers to just Do It Right To Begin Withâ„¢ is a noble goal, but it doesn't work like that. Everyone has deadline pressures; most people are not on the bleeding edge of the web standards community; the tension between "make it work today" and "make it right for the future" is never going to go away, no matter that we wish it would. The way to success is to align the right way to do it with the easiest way to do it; the way to success is to make correctness the path of least resistance. This is what informs the HTML5 "pave the cowpaths" approach, and it's that way for a reason; if correctness requires extra work, then at least some people will be incorrect through lack of time or lack of knowledge.

Breaking websites, by having WebKit deliberately stop supporting a -webkit property once it supports the unprefixed property, is not going to happen. The WebKit team have explicitly stated that they won't do that, for "backwards compatibility reasons". Also, frankly, expecting them to is naive; they should make websites break just in order to teach developers the Right Way To Do Things, when those websites currently work? Remember, it's not developers who are punished by this; it's the users of the sites, because those users get a new phone or a phone OS upgrade and suddenly half the sites they use don't work. This hurts them, and they're who we're doing this for. The WebKit team are looking out for WebKit, but they can't be blamed for that; stuff works for them, after all.

There's an argument that users who find their sites broken will blame the sites, and then the site developers will fix the problem. I disagree. If I decide to try Opera Mobile or Firefox on my phone and half the sites I use don't work, I'll say: oh well, can't move to that, then, and I'll go back to the built-in browser. This is the Microsoft argument: one broken program will prevent an upgrade, and they're right. What we get is de-facto lock-in, just the same as all those businesses which couldn't migrate away from IE6 because of their intranet.

Using a server-side preprocessor or a client-side JS patch to turn some-property into -webkit-some-property, -moz-some-property, -o-some-property, -ms-some-property is a useful tool for developers who know what they're doing but can't be bothered to type it all in. Think about it: if I just use the unprefixed standardised property right now, then eventually (when the browsers all implement it) my site will work! I don't have to do anything to make that happen; I'm out in front and waiting for technology to catch up with me. It does not help the developers who are actually affected here, the ones building sites with only -webkit CSS properties in them, the sites that Bruce calls "legacy code" above. And it's those legacy sites which are compelling Mozilla and Microsoft and Opera to debate supporting that WebKit-only CSS.

So, then, smart-arse, what's the solution, if it's none of those?

Well, obviously, the evangelism efforts should continue. Progress is made. People do learn. It's slow, but we get there in the end. What we're talking about is an interim solution in addition to that.

I think @leaverou's prefixfree JS library has the right idea, it's just backwards. Prefixfree takes proper CSS (an unprefixed property) and turns it into all the vendor-specific prefixed properties, so that you write CSS-of-the-future and the library turns it into CSS-of-today. It's a polyfill. What's wanted here, I think, is something like prefixfree but which takes CSS-of-the-past (-webkit-some-property and turns it into CSS-of-today (-webkit-some-property, -moz-some-property, -o-some-property, -ms-some-property, some-property). This wouldn't be a hard polyfill to build (it's just prefixfree, tweaked), but then of course you have the problem that no-one knows about it. So here's the second part of the proposal: common JS libraries should do this sort of thing by default. Imagine if jQuery fixed this stuff for you. I think, without wishing to sound snobbish, that most reasonably-complex websites include some JS (progressively enhanced, ideally), and most of those use a library. The developers we're talking about (and this is the snobbish part), the people writing legacy WebKit-only code, will have that WebKit-only code automatically patched to work with all other browsers without having to know that it's even happening. The ones who are short of time get that time back; the ones short of knowledge can learn on their own time and are helped to not screw their users in the meantime.

This sort of view is problematic. I'm proposing giving a man a fish, not teaching a man to fish, and that's wrong. I agree. In this instance, given the choice between not educating a developer or not screwing some of his users, I'm choosing the users. I don't know a way to choose both. It's also problematic because I'm suggesting that library developers do all the work, and everyone using that library takes a performance hit even if they don't need to. So, I'm sure there will be other suggestions, and I'd love to hear them. I'd just like to stop hearing all the ones above that don't help the problem get fixed.

February 08, 2012

Blogging Tips

Today I had a call with another team at Canonical who were wanting to ask for guidance on (a) how to write good blog entries that people want to read and (b) how to regularly get into the habit of blogging and get more eyeballs on your posts.

I thought this could be of general interest to the community, so I figured I would write these things down into a blog entry. So meta. :-)

Some tips:

Keep it concise – your blog should get the point and talk through the topic you are presenting. Now…seasoned readers of my own work will know I tend to ramble from time to time, so I myself always need to try and keep this in check. Few people will want to commit to a huge block of text, so keep it concise. Format it – the web has many wonderful things, and this includes formatting such as italic, bold, code, different heading sizes and more. Use them to help add emphasis to your posts. Make it visual – pictures say a thousand words, and so do videos. Break up your content with images illustrating what you are discussing, or just amusing images to make a joke (example). If you want to display images, I recommend you upload them to Flickr and then link directly to the images. For videos you can usually embed them directly from YouTube or other video sharing sites, but aggregators such as Planet Ubuntu often strip out the embedded videos, so be sure to provide a direct link underneathe the embedded video (example). Link to interesting things – if you are discussing something online, always provide a link to it. This helps the user get access to the information quickly and easy. Be professional – always keep your posts professional and thorough. Ensure your writing is clear and that you have spell and grammar checked it. Be fun – being professional doesn’t mean you can’t be fun. Writing in a fun and amusing way is a great way to keep your readers interested. Invite discussion – if your blog has a comments feature, always end your posts and ask for input and opinions from your readers. This provides a wonderful way to trigger some discussion around your post.

In terms of blogging more and getting more eyeballs on your posts, here are some tips:

Get into the habit – to become a regular blogger you need to get into the habit of thinking “this is cool, I should blog about this“. This can take a while to get used to. If you are in a team, it is helpful to suggest to others when they should blog about something; this keeps us all regularly posting. If you are struggling with getting into the habit, put a reminder in your calendar to remind you. Ensure you are aggregated – if you are an Ubuntu Member, be sure to add your post to Planet Ubuntu. Add your post to other appropriate aggregators (e.g. Canonical staff should add their blogs to voices.canonical.com). Use social media – post a link to your post on Twitter, Google+, Facebook and other social media accounts.

I am sure there are plenty of other suggestions from you folks; please add them to the comments!


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser