Showing posts with label Computers. Show all posts
Showing posts with label Computers. Show all posts

Tuesday, 18 May 2010

Trust your car's computer system?

Then get ready to be hacked.
The Center for Automotive Embedded Systems Security will present a study at the IEEE Symposium on Security and Privacy tomorrow to show vulnerabilities in the electronic control units which drive modern cars.

Says the BBC:
"The researchers showed how to kill a car engine remotely, turn off the brakes so the car would not stop and make instruments give false readings".
Currently such attacks need direct access to the car's communications ports which could be by a mechanic or a deliberate break-in. But as cars become increasingly internet connected, remote access will be a looming threat.

Firewalls and AV software for your car, whatever next? Grow into these trousers... >>

Saturday, 27 March 2010

Disturbingly creepy

But hauntingly beautiful...

"Resonant Chamber" - Animusic.com [4:27]

---------------------------
Via Grrlscientist. Grow into these trousers... >>

Tuesday, 23 March 2010

Colour is complicated - Part 1

[Takes a deep breath]

When I posted Colours, files and compression on Saturday I knew I was going into a subject which few people would understand or even think about. FFS I don't really understand it :)

In no way was I dissing JPEG. For holiday snapshots and internet posts it's perfect, but it is the mp3 of photography and I'm advocating care and awareness when editing. How would it be if you opened a text document and 1 in 100 random words were subtly misspelt? Or 1 in 1000? Where is the tolerance threshold?

In that last post I tried to explain a bit about how colours are stored on your computer, but I only intimated that the same information is used to activate the glowing pixels on your monitor (or a TV). Each pixel on the screen has a red, a green and a blue light-emitting segment; the mixture makes the colour of the pixel. Get a magnifying glass and look at your monitor screen.

Red, green and blue (RGB) I called 'primary colours' and Jill asked
"I was an art major so I know the three primary colors are red, yellow and blue, but your example replaced yellow with green. Please explain. Thanks!"
You're correct Jill, everyone who has done any kind of art class knows the primary colours are red, yellow and blue.

So WTF Holroyd? Well, anyone who has done any kind of physics class knows the primary colours are red, green and blue.

Note, and I'm not being smug, in Saturday's post I was careful to say "...this is coloured light, NOT paint" and therein is a world of difference.

The truth is Jill and myself are both right, but to get the full picture we have to think about additive primary colours and subtractive primary colours.

To do that we need to know a bit about light and a bit about how paint interacts with light, but most importantly we have to consider how our eyes and brain decide which colour is which. It may take some time to get to a discussion of the colour 'yellow'.

So to start "What is light?" Well, if you want waves vs photons then it's neither, but that’s another post. I'll choose waves as a good model because they are familiar but, unlike water waves, the crests of all light waves are at the same height. They differ only by the distance between the crests of the waves - the wavelength. Red light has the longest wavelength, then green and then blue with the shortest.
This is a simplistic drawing but you may see there are 4 peaks of blue, 3 of green and 2 of red as wavelength increases. Where is yellow? At about 2½ on this scale (Arggg! I won't try to plot yellow it because the whole diagram is silly). The message is colour = wavelength. A consequence of physics is that short wavelength blue light carries more energy than long wavelength red light. This is the distinction, colour = wavelength = energy, which gives the beauty of a rainbow or indeed, the colour of anything.

I'm tired and can't concentrate no more.

To be continued... Grow into these trousers... >>

Saturday, 20 March 2010

Colours, files and compression

I was commenting the other day at Elemental, my dear about Just Jill's photographs and I wondered what file formats Jill used when editing her fine images.

I humbly realised that many people won't know about file formats, compression, or even colour so I thought I'd do a serious post for a change.

I am no photography expert by any means, but I've done enough image processing to know it's a potential minefield.

I worked for a time using extremely low level fluorescence microscopy with a camera cooled by liquid nitrogen to minimise thermal effects. I was shut in the dark, in a tiny black painted room with a double door 'airlock' to keep out all stray light, and I sat there for hours listening to the radio, taking maybe 15 min exposures when all I could see was a faint, red glow from the laser illuminating the sample. Later I'd try to pick out the faintest of faint detail in the images. It became a skill, but limited to that type of image. However I had to know what the information in the image meant, in computer terms, so I could manipulate it without losing anything or, even worse, introducing an artefact that was not there in the original data.

This brings me to colour depth and file formats. Not all file formats are the same, some are 'lossy' meaning they really do lose data when you save your image. When you open the file again it 'recreates' the original as best as it can, but it is not the same. JPEG is the prime example and a good analogy is with mp3 audio files. Mp3 tricks the ear by removing things the brain won't miss using a psychoacoustic model. JPEG tricks the eye with strange, Fourier transform-like mathematics, which is very efficient in saving space but rarely unfolds back to an exact copy. I'll show examples of this later and, because you have a computer, I bet you've seen these artefacts before.

For these examples I'm using an old, free version of Paint Shop Pro, because it's basic, simple, it works and I like it, and I'm using 24 bit colour. Now, what does that mean? Think of the three primary colours red, green and blue (RGB), all bright and saturated. Now mix them together remembering this is coloured light, NOT paint. You can make yellow, cyan, magenta and white. You can make black too, just turn the lights off.

24 bit colour assigns 8 bits to each primary colour, and in binary 28 = 256. This gives 256 brightness levels to each colour with zero being off/none/black and 255 being saturated. Think R,G,B (a triplet of numbers separated by commas) then bright red = 255,0,0. Similarly green = 0,255,0 and blue = 0,0,255. Black is 0,0,0.

Red + green gives yellow = 255,255,0 and I can make any darker yellow by mixing lower, but equal amounts, of red and green, this is 200, 200,0.

How to get a paler yellow? Well, 255,255,255 = white so you have to add some blue. The background colour on this page is 255,255,238.

When red=green=blue you get a grey. This = 200,200,200. Note there can only be 256 greys in a greyscale image including black and white.

How many colours in total?
256 x 256 x 256 = 28 x 28 x 28 = 224 = 16,777,216

And that is what we get unless you spend a lot of money on a dedicated Macintosh or Silicon Graphics workstation, then you can get to 30 bit colour which gives 210 (1024) shades to each primary colour for a total of more than a billion colours. I doubt the human eye can discriminate so finely but scientific data is different. If you see it advertised as 32 bit colour it's bullshit, it will be 24 or 30 bit with layers and transparency.

So how do we save over 16 million colours in a file? Think of a tiny 100 by 100 pixel image; that's 10,000 pixels, every one with 8 bits of data each for red, green and blue. 8 bits = 1 byte so it takes 3 bytes per pixel to store the colour data, or 30 kilobytes for the file. Then there will be some identification tag so the system knows WTF the file is, and basic stuff like height and width. I just saved a 100x100 px pure white image in different formats and Windows reports the file sizes to be:

Windows bitmap (*.bmp) = 29.3 KB
About what I predicted if you strictly save all 24 bits of data.

JPEG (*.jpg) = 823 bytes
Quite a saving! Plus it displays perfectly, not a blemish. This is not always the case with JPEGs though as I will show.

PNG (*.png) = 289 bytes
The compression of PNG can be amazing. In this case it will just record the fact that "everything's white" and that's all you need. PNG will however faithfully recreate the correct 24 bit RGB colour data for every pixel. The payback is that the file sizes soon exceed JPEG for complicated images.

TIFF (*.tif=1.31 KB) and TARGA (*.tga=418 bytes) both have good compression and again will keep full 24 bit colour.

GIF (*.gif) only has 256 colours in a defined pallet and you can't mix them. It's not a fair comparison (so I won't), but GIF is good for greyscale because there are only 256 shades of grey you can display (8 bits). Having said that, be careful with converting to GIF from 24 bits as there are many ways to interpret the darkness or shade of a colour. GIF is good for drawings, cartoons, charts etc which have a strictly limited number of colours. GIF also supports simple, frame to frame, animations and was the internet favourite before the full colour Flash.

To continue I'll concentrate on PNG and JEPG because both are 24 bit and fully internet supported. I'll show the differences by doing three edits of an image and I have chosen the colours deliberately because I know it will f**k up JPEG. The same will be happening in any image you repeatedly edit, you just may not be able to visually discriminate it.

I started a new image and made a smooth colour gradient from red (255,0,0) to blue (0,0,255) and then drew a green (0,255,0) line. Then I saved it as a PNG (left). The same colour data was still on the screen so I saved a copy as JPEG (right), just using the default settings. Then I closed my original image and opened the two new ones. Here they are!








Look carefully at the JPEG image on the right. There are clearly colour distortions. If you don't believe me, save them both and blow them up yourself (or, if you use Firefox, then right click on an image, hold down the Ctrl key and left click 'View Image', on the new tab hold down Ctrl again and spin the mousewheel to zoom).

My three edits will only add three words of white text to each image. Nothing fancy, and with no antialias so the edges of the text should be blocky and sharp. The PNG I will save as PNG, the JPEG I'll save as JPEG. Each time I add text I will save the file, close it and reopen it for the next edit.

First edit







If you can't see the distortions of the JPEG by now get a better monitor or spectacles.

Second edit







Third edit







And all I did was open-edit-save-close, open-edit-save-close... Look at the white text in the final JPEG, its not all white! But it's roughly acceptable to the eye for a blog post. This happens subtly to all colour boundaries in JPEG so it's not good for photography; you need to preserve exactly what you have on the screen when you save and JPEG will not do that. If this were an mp3 you would be moaning about scratchy, poppy distorted sound, but our eyes are more forgiving. Beware!

I know most digital cameras spit out JPEGs, and this is to conserve memory, but you may have an option for some kind of 'raw' format which, though it will absorb all the camera's memory in just a few shots, will give a bitmap (*.bmp) in some way. Save and edit that and then, finally, make your masterpiece into a cheap and nasty JPEG for the punters.

If you have to start with a JPEG then save a copy as PNG and work with that. Do the edits, and the last thing is to save a final copy as a JPEG again. Look at the file sizes though, the tradeoff between quality and file size may sometimes make PNG the better file to post.

I hope some of this makes sense. I've been up all night, the birds are singing outside, it's been raining and one of my cats just came in soaking wet. She jumped on my lap and gave a shake of drips everywhere. Thank you Titch but the mackerel for breakfast is mine. Goodnight/day to all :) Grow into these trousers... >>

Thursday, 28 January 2010

Thoughts on anonymity

Blogospheratician Delicate Flower has posted an interesting question. Go read Change is in the air.

I cannot answer this conundrum of privacy vs professional exposure. I can only tell my own story…

Coming out, so to speak, as your real self online must be your own decision. I know this and you all should know it too; it is potentially dangerous. Young people take note - what is online about you now will probably remain there, somewhere, for the rest of your life and beyond. In the olden days it may just have been a newspaper report in the local rag that no one but a historian in a library archive would ever see again. Now we have Google.

I debated with myself for a long time before I set up Trousers and the blog name itself I chose as an expression of my learning process. I have been around the internet since before there was one. When I first got an email address I only knew two other people online and we were all in the same Department. It was quicker to wait till coffee break and talk to them in person.

Times changed though; newsgroups and forums (fora?) became my home for many years under a range of pseudonyms. Though what I posted under an alias was always really as myself, my own thoughts and feelings and doings. Of course I got hammered and flamed but I never assumed different personalities with the different names; I doubt I am capable of such a thing, it's hard enough just being me.

So what changed? Strangely I think the main reason was Facebook. I'd been following various blogs for ages when a family member enticed me to start a Facebook account, which I did in my own name. Very soon I began posting 'notes' or whatever in a bloggy sort of way and quickly realised that Facebook is not a medium for that kind of expression (not to me anyway). I had to move on, Trousers was born and I wanted to continue being me. I was/am prepared (by experience, I hope) for any backlash, I am sometimes very outspoken about religion for example, but so far the worst I get is Japanese porn site spam. Trousers could have evolved very differently given a different response.

Interweaved with the above is another reason for my non-anonymity. I'm getting older and I'm happy being me. Oh I've just as many failings as anyone else, more perhaps or it often feels that way, but I have come this far and there are things I have learned which I would like to share with others. Where I have my name on a scientific publication I am proud of it, I was there, I helped do that work over months or years sometimes. That was me! Anonymity was unthinkable. Similarly, when I post video clips nowadays, that's what I have been watching. When I am outspoken, that's me, it's what I think. I hope I'm strong enough for my own honesty, if not I will learn. I don't deliberately aim to be provocative (er, well, maybe sometimes) but if someone disagrees that's fine, let's discuss the point and maybe we can both learn something new.

The final reason is that we should be able to be ourselves, in all circumstances, should we wish it. If ever a Big Brother scenario comes to be it will surely involve our own compliance at some level. It may loom over all our shoulders sometimes, so turn around and beat it over the head with your keyboard. You need not be anonymous...

Stand up, speak out, be yourself - when you want to or need to.
Be Excellent to each other! - all the time. Grow into these trousers... >>

Friday, 11 September 2009

Gordon Brown apologises for past treatment of gays.

Hot on the heels of my earlier post, The Prime Minister has issued an apology to Alan Turing and countless other gays victimised by the backward laws of the last century.
"Thousands of people have come together to demand justice for Alan Turing and recognition of the appalling way he was treated. While Turing was dealt with under the law of the time and we can’t put the clock back, his treatment was of course utterly unfair and I am pleased to have the chance to say how deeply sorry I and we all are for what happened to him. Alan and the many thousands of other gay men who were convicted as he was convicted under homophobic laws were treated terribly. Over the years millions more lived in fear of conviction".

"I am proud that those days are gone and that in the last 12 years this government has done so much to make life fairer and more equal for our LGBT community. This recognition of Alan’s status as one of Britain’s most famous victims of homophobia is another step towards equality and long overdue".
Long overdue, but welcome. Read the full statement here. Grow into these trousers... >>

Tuesday, 8 September 2009

A call for an apology to Alan Turing

In 1952, World War II code-breaking hero and the father of computing Alan Turing was convicted of that most heinous of crimes, being born a homosexual.

Following Turing's prosecution he was further humiliated by having his security privileges withdrawn and by being chemically castrated, then an experimental "treatment", for his non-existent illness. Turing committed suicide in 1954.

There is an online petition to the Prime Minister calling for an apology to Turing and a posthumous pardon. There are currently 30,327 signatories, including myself. The petition reads:
"Alan Turing was the greatest computer scientist ever born in Britain. He laid the foundations of computing, helped break the Nazi Enigma code and told us how to tell whether a machine could think.

He was also gay. He was prosecuted for being gay, chemically castrated as a 'cure', and took his own life, aged 41.

The British Government should apologize to Alan Turing for his treatment and recognize that his work created much of the world we live in and saved us from Nazi Germany. And an apology would recognize the tragic consequences of prejudice that ended this man's life and career".
Please take a moment to go and sign the petition and reflect on Turing's impact on our modern world. That man should have had a knighthood at least, not persecution. Grow into these trousers... >>

Wednesday, 26 August 2009

Convince your friends they are psychic

This is a cool, computer age, magic trick from Barry and Stuart. I have only found this on BBCthree as yet, so it won't embed, but have a look and fool your mates.


The actual video you play is here. Watch it, if you want to get a feel for what happens. Otherwise skip to...



...the explanation.

I'm sure going to pull a jolly jape tomorrow.

The question is 'who's it going to be'?

Someone computer savvy and not usually gullible. Hmmm...

------------------------
Thanks to Richard Wiseman's Blog for the links, and Richard interviews Barry and Stuart too. Grow into these trousers... >>

Saturday, 25 April 2009

Indus script, language or not?

The Indus script, dating from around 2500 to 1900 BC, has long been thought not to be a true written language. Just mere imagery relating to religion and/or politics.

The Indus Valley Civilization (think modern Pakistan) was very formative in the development of humankind. At that period they were unprecedented in making measurements, particularly of weight and scale. This leads me to guess they were trading widely and were very shrewd in business deals. Their spoken language however, is unknown. As are any writings other than a few symbols, often just 4 or 5 (the longest has 26), grouped together.

But a new study reveals tantalising hints of a true written language. Rajesh Rao et al from the University of Washington in Seattle, compared the Indus script to known languages and non linguistic forms with a computer analysis of randomness, or as they call it, 'conditional entropy'. This relies on the fact that the positioning of letters in words, or words in phrases, has an underlying structure. ie in English the letter 't' can be followed by the vowels plus some letters like 'h' or 'r' but not 'b' or 'd'. Similarly, in a short phrase, 'the cat sat on the...' could be followed by 'mat' or 'wall' but never 'learn'. It's nonsensical ('the cat sat on the green' made me think though).

Rao's analysis also included DNA and protein sequences, the computer language FORTRAN and simulated scripts for controls; one totally random, one totally ordered.

As you may have expected FORTRAN code was very highly ordered, it's got to be unambiguous. Known languages had more disorder, whilst DNA and protein had the highest randomness.

The Indus script fell into line with other languages.

No translations yet, no Rosetta stone, just more evidence that our ancient cousins were not the illiterate barbarians many people imagine. Grow into these trousers... >>

Friday, 17 April 2009

Pirate Bay founders get jail

A year in jail and a fine for doing nothing wrong. No copyright material was ever posted on their servers. All they provided were links in the same way as Google, Yahoo and thousands of other search facilities.

This comes less than 4 years after Sony Music Entertainment, one of the companies claiming copyright infringement, were themselves guilty of infecting millions of computers with a rootkit. That's a technique often used by virus writers to embed a piece of code into a computer's system files to monitor activity. Sony were constantly using your own processor power, just to see if you were playing a Sony CD or not. I know, I was infected and it took ages get rid of their intrusion short of a complete re-install.

Peter Sunde of The Pirate Bay said they would refuse to pay the £3m fine for 'damages':
"We can't pay and we wouldn't pay. Even if I had the money I would rather burn everything I owned, and I wouldn't even give them the ashes."
This is not about criminality, it's about media control of your computers, your minds and your cash. Beware! Grow into these trousers... >>

Saturday, 28 March 2009

Ping

Read on at Abstruse Goose. Grow into these trousers... >>

Thursday, 19 March 2009

!k me - it's work

Google Street View is now in the UK. See BBC news for a write-up and the list of cities covered so far. Here's where I work:


No kidding. These photos are very recent, if you click the link and spin round 180° some of that scaffolding is still there. If you zoom out - well I'm not sure who is in the car parked on double yellows, and the image is Google distorted. But if I wanted to (I don't) I bet I could find out. Does this raise privacy problems? You bet it does.

A few steps East and South shows the Civic hall clock. Ten minutes later and I probably would be on the street below.

Though time is relative as Leeds Town Hall clock clearly demonstrates.
Grow into these trousers... >>

Tuesday, 17 March 2009

Online image editing/painting application

Surprisingly, this was in a 'Learning and Teaching' circular I get at work. <Growl> a regular, dead tree copy, in magazine quality sent to all the xxxx's of staff, most of who will 'recycle' it unread. Why don't they spend the money on 'Learning and Teaching'?</Growl>.

The link is worth passing on though.

Need a decent image editing application but want it free? Try SUMO Paint. An online, fully featured, Flash based tool that's quick to load up and seems to have all the functions you might expect from paid for software.

As you can probably tell I'm no artist (except in the p*ss department), but there's a gallery from the more talented on their home page.

Have a play! Grow into these trousers... >>

Wednesday, 4 February 2009

OK - one more Testing

A quick update on mp3 player embedding. For me the Yahoo mp3 player works spot on every time. So I'm going to try it again. The player is OK but there's no volume control (just mute) and the colour skinning is limited to say the best, see below.

Just so I don't use up all my free bandwidth on one track here's us guys again:

ABandinUrHead, with our take of the old Animals classic.

You can play it dark


You can have light


Or you can add a bit of fancy to light


I think I'll go with dark after all, and I like the rounded corners. Damn, I'll have to make another download button now!. Grow into these trousers... >>

Testing - Testing - Again

After posting my idea for an 'in blog' mp3 player I found it doesn't work reliably in Internet Explorer (it works fine when I preview but when it's posted it fails). Also my free upload was very short lived. If I had my own domain name I guess things would be easier. Anyway, I will try to solve the IE problem otherwise it spoils a good idea. Damn the browser wars!

For hosting this time I'm using FileDen, you have to register but it's free.

I had also missed something else important, a download link, so I made a button, or should I say a clickable image 'coz it's not animated yet. Clicking it should give you the option to save the mp3 (If you want to of course, can't blame you if not).

So let's try out some ideas, and I'd really appreciate some feedback. What works or doesn't for you, what browser are you using (Firefox 3.0.5 for me) etc.

Ok, here's where we were last time. The track is Heaven's Fool, first using the Google Reader player. I like this the best, I think it looks slick and it has a volume control. But if it doesn't work then boot it!




This is the Odeo player - IE6 doesn't display this for me, it's fine in Firefox.


Yahoo player - This works for me in both Firefox and IE6 so I still have hope. The colours are a bit dark, but it seems you can change them, and there's no volume control. Bummer.


So let's see what happens when I post this. Grow into these trousers... >>

Sunday, 1 February 2009

Testing - Testing

This could be fun.
I've been playing around trying to embed an mp3 player in the blog and I think I may have sussed it. It's dead easy, if it works...

Here's Heaven's Fool by ABandinUrHead featuring yours truly on bass:



Now if that plays for you we are on a winner! Here's how it works.

I uploaded HeavensFool.mp3 to Upload-MP3.com and noted the URL.
Upload MP3 is a free hosting service and I didn't register, so this upload may be short lived. Just testing the idea.

So you have the URL ie: http://foo.bar.com/yoursong.mp3 copy the code below and paste it into your blog as text/html, not forgetting to update the address.
<embed type="application/x-shockwave-flash" src="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=http://foo.bar.com/yoursong.mp3" width="400" height="27" allowscriptaccess="never" quality="best" bgcolor="#ffffff" wmode="window" flashvars="playerMode=embedded" />
Let me know if it works for you. Anyone fancy a podcast? Grow into these trousers... >>

Friday, 23 January 2009

Here's an interesting observation


Windows 7 beta is out performing both Vista and XP.

See this ZDNet report for the test conditions and the results.


----------------
Cheers to Daniel's space for the link. Grow into these trousers... >>