Showing posts with label Technical. Show all posts
Showing posts with label Technical. Show all posts

Safe and Secure


Many years ago, I got a book called The Hacker's Handbook for my birthday. It was full of rather vague suggestions - presumably highly censored - about breaking passwords, finding backdoors, and exploiting common weaknesses in the human element of computing.

Have you ever used one of these as your password?

  • 12345 (or some variation)
  • 111111 (or some variation)
  • Stonehenge
  • Hypodermic
  • God (yes, "God" is an amazingly common password - though I've never heard of "Jesus" being used)
  • Sex (hah)
  • Fred (four letters next to each other on the QWERTY keyboard)
  • Secret (a common default password)
  • Password / Pass (another common default)
  • Blank / Empty
  • LetMeIn
  • [An actual empty password] (I did use this one once, but only by accident)
  • [Your pet's name]
  • [Your significant other's name]
  • [Your mother's maiden name] (some people think they're being really crafty with this one)
  • [Your mother-in-law's name] (very common, for some bizarre psychological reason)
  • [Your own fucking name] (I've seen seasoned professionals do this)


If the answer's yes, I hope you're not in charge of any computer security.

Anyway, one message came across loud and clear from that little book: Perfect security may be impossible, but you can get as close as humanly possible by:

(1) Avoiding obvious passwords
(2) Not having computers unnecessary networked
(3) Proper physical security - a strong lock and a single key with you at all times saves a lot of trouble, and finally...
(4) A team of highly trained, highly paid computer security experts, working in shifts so someone's there at all times.

Guess which of these get treated by banks as "unnecessary expense"...until they get hacked?

Oh, and there's one other measure you can take - something so obvious only a professional consultant could miss it. Don't write anything down unless you really have to. Use your memory.

The British government may think it's okay to leave state secrets in taxis and lose CDs of everyone's personal details with the access codes written on the disc several times a year...but you don't have to.

Now, for the single user, or even the small business, security comes down to firewalls, virus scans...and, yes, passwords. And if you're anything like this single user, you've been using the same set of passwords for years - because they're the ones you first thought of, you're used to them now, you can't think of new ones, and you reckon no one else could guess them anyway. Although they probably have.

And because it's a lot of bother to change them. I changed all my passwords last night - Ten email addresses, five forums, ebay and (the typically unhelpful) paypal. It took three solid hours, none of which were remotely enjoyable.

The now replaced passwords were, amongst others:

  • A numerical character from my favourite TV show
  • A lovely band I once did a remix for
  • A screaming painting by Francis Bacon
  • A character from a James Bond movie - played by Lotte Lenya
  • The inevitable drugs reference
  • The registration number of a car my father used to own


The new ones are alphanumeric, longish, in three languages, and...ah, erm...

...I haven't memorised them yet. Which is why they're on a post-it note stuck to the laptop.

Join the Pod People


Have you ever thought of trying podcasting? You've got your blog at Blogger.com, and you'd like to include audio - commentary, music, interviews, or you just prefer to speak rather than type.

If the answer's yes, this post may help. To podcast, you will need:

(1) A microphone
(2) A voice
(3) Some audio software
(4) Something to say
(5) A place on the net to store the sound files, and
(6) A way of getting them to stream from that place through your blog

I can't help you with the first five, but might be able to reduce your headaches about the sixth.

There's two basic approaches:
(1) Embed a player into posts as and when you need to.

This is the better way if you're going to post infrequently or irregularly - for instance, when you've recorded a new song.

It's also advisable if you're going to post long audio - for instance, an interview that lasts an hour - because embedded players are easier to pause, rewind and fastforward.

(2) Set up your blog template to treat any and all URLs of audio files as streamable.

This is better if you're going to post lots of audio - for instance, whole albums at a time, or long recordings cut up into managable bits.

Google provide one audio player. To use it, just paste this code into your blog post...

<iframe style="border: 1px solid rgb(170, 170, 170); width:400px; height: 27px;" id="musicPlayer" src="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=[URL:audio]"> </iframe>

...replacing [URL:audio] with the full address of the audio you want to stream, eg. http://sites.google.com/site/kapdemos/Home/Demo_1.mp3. The result looks like this:



Click play and It'll stream.

A different player is provided by Odeo. They're a podcast host themselves, but helpfully you can stream stuff not held on their servers with their player.

This is the code...

<embed src= "http://www.odeo.com/flash/audio_player_standard_gray.swf" quality="high" width="300" height="52" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" flashvars= "valid_sample_rate=true&external_url=[URL:audio]" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>


...and this is the result:



Yahoo also provide a player.

Code...

<embed src="http://webjay.org/flash/dark_player" width="400" height="40" wmode="transparent" flashVars="playlist_url=[URL:audio]&skin_color_1=-145,-89,-4,5&skin_color_2=-141,20,0,0" type="application/x-shockwave-flash"></embed>


...and result:



That's the first approach. What about the second?

Log into Blogger, go to the Dashboard, then Layout, and Edit HTML. You'll be presented with the CSS code of your blog template.

Scroll down till you find the </head> tag, insert a new empty line immidiately before that, and paste the javascript code - which I'll get to in a moment - into that space. Click Save Template.

Now when you make a post to your blog, you can include links to your audio files like this...

<a href="http://sites.google.com/site/kapdemos/Home/Demo_1.mp3">Demo 1</a>
<a href="http://sites.google.com/site/kapdemos/Home/Demo_2.mp3">Demo 2</a>


...and the result will look like this:



If you click on the underlined text, you can download the file. If you click on the arrow next to it, it'll stream to you. I haven't actually set up my blog to stream in this way, which is why there's only a picture, not a real link.

So what's the code you paste into the template? You can use the Yahoo media player (not the same as their embedded player) with this code:

<script src="http://mediaplayer.yahoo.com/js" type="text/javascript"></script>

This will also create an unfoldable track selecter and player at the bottom left of your browser screen. I don't like that, but it's a matter of personal taste.



Delicious also have a player, and this is the code:

<script src="http://del.icio.us/js/playtagger" type="text/javascript"></script>

It works in exactly the same way, but there's no selecter and the buttons are square. You can, if you really want to, use the Yahoo and Delicious streamers together, and each file will get two streaming buttons - though I'm not sure why you'd want to do it.

But hang on a minute, you say. These corporations could withdraw support at any time, or start charging. I've got a little webspace of my own, so why can't I store my own player there?

You can indeed do just that, and the method is something of a cross between the two I've been describing.

Probably the most common self-hosted player, is from 1PixelOut, and is downloadable here. Unzip the two files - "audio-player.js" and "player.swf" - and place them somewhere convenient in your webspace - such as a folder of their own.

In your Blogger template, just above the </head> tag, insert this...

<script language="JavaScript" src="[URL:audio-player.js]"></script>

...replacing [URL:audio-player.js] with the actual address of the "audio-player.js" file.

The following code then goes into your blog post, at the point you want the player to be displayed...

<object type="application/x-shockwave-flash" data="[URL:player.swf]" id="audioplayer1" height="24" width="290">
<param name="movie" value="[URL:player.swf]">
<param name="FlashVars" value="playerID=1&soundFile=[URL:audio]">
<param name="quality" value="high">
<param name="menu" value="false">
<param name="wmode" value="transparent">
</object>


...substituting for [URL:player.swf] and [URL:audio] the locations of the "player.swf" file and your audio file, respectively.

The result looks like this:



Wouldn't it be easier to store these tiny files on Blogger? Yes it would, but Blogger won't provide a means for you to do so, and they're not alone. Google Sites, where I've been storing the example MP3s, also don't allow you to store javascript files on "your" webspace.

Are there other self-host players? Undoubtedly - I just haven't found any yet.

But hopefully this post has made starting podcasting a little less daunting for you.

The Checks, Files


File under "Incredibly annoying things which I've lived with for so long it doesn't occur to me most of the time there might be a way around them". Or if you prefer, "irritations".

Most computers use CRCs - Cyclic Redundancy Checks - when reading and writing data. It's a way of both detecting and fixing errors in the data stream, and good thing too, because there's too many ways files can get easily corrupted. They're like children and politicians in that respect.

Unfortunately, in a bit of thuddingly bad design on the part of Microsoft, if you try to copy (or unpack) a file with just one single error that the CRC system can't fix...the whole file is deemed unreadable. This is a bit like being forced to throw away a book because a single misprint on one page makes it impossible to guess what the word should be.

Sometimes the data isn't really corrupt at all - it's just been misread by the CD drive. If you've got a dodgy drive, you might attempt the copy the file twenty times, and each time a different part of the file is misread, and you have to start again.

Now, file under "So astonishingly simple and useful I can't imagine how I ever managed to live without it and I'm so grateful to the inventor I'd bear his babies". Or "nice", if you like.

The application at this humble site. It's a Java application, which means you'll probably run it from your web browser. At least you will if you're like me.

Download the file "JFileRecovery.jar", and drag it into your browser window. The program will run, asking you for source and destination locations. Then get a cup of tea (or coffee, seeing as it's Java) and wait while this tiny little program copies what it can of the file, and skips what it can't.

And then goes back and tries to fill in the blanks. Even if it can't you've still got the great majority, which should be bearable for films or music.

Now I just need a small, useful program that'll scan every disc in the room and tell me what I should keep, what's obsolete, what's duplicated and what I'll never use even though it seemed like a good idea at the time.

Make It So, Mr Data


Videotape lasts about 50 years. A commercially pressed DVD is supposed to last twice that. Paper documents can last centuries.

A DVDR lasts...maybe five years. That is, if you don't write on it, and you keep it out of sunlight, and, erm, don't use it.

I only mention it because I spent last night burning fifteen DVDRs of backup data, plus there'll be a similar number tonight, and it would be nice if they were more...well, permanent.

People who advise about these things professionally say you should make backups of your backups and store them in a dark, dry, clean space. Which might make sense if I were IBM, but not if I were, um, me.

Incidentally, if you think 30 DVDRs is a lot, I've spent the last month going through about 150, weeding out obsolete, duplicated or useless files.

So, how can I protect my files without

(1) spending the whole week doing nothing but burning backups

(2) spending all the money I don't have on expensive DVDRs that may or may not be less corruptible

(3) winding up with a suitcasefull of redundant copies after spending a month removing redundant copies

...?

My solution is to wrap each DVDR in a homemade paper insert, inside the usual clear plastic wallet. The insert protects the surface from sunlight, provides some extra padding, and gives me something on which to write a description of the disc's contents - instead of the disc itself.

The small irony is, years ago before clear plastic CD/DVD wallets were common, I made hundreds of them from A4 sheets of paper. They were practical, protective, and you could write on them. Then I threw them away when plastic wallets and CD pens became common.

Boxes in Boxes


So, can I put Reason and Reaper into one portable installation? And do they work together? Yes.

Can I do the same with Firefox and Orbit Downloader? Oh yes.

Can I bundle Firefox, Orbit, Flash, Java, Quicktime Alternative, Real Alternative, Shockwave and Firefox's Windows Media Player Plugin? I can indeed, though some details need working out.

Now, Can I make a portable installation of a virtual machine - specifically, the one I use to make portable installations? Um, no. The makers seem to have fixed it so you can't.

The advantage of bundling Firefox with all those plugins, or bundling WinAmp with a load of audio and video codecs, is that I can transfer the whole bundle from one computer to another and it should work fine, without having to install a load of stuff on someone else's computer just so I can use one bit of software for a while.

The disadvantage...is that to update any part of the bundle, I have to make it again from scratch.

I'll have to sleep on that one.

The Big Picture


"Now watch what you say, or they'll be calling you a Technical,
a practical, academical, pedagogical."
- Not quite Supertramp, The Logical Song

YouTube sound is shit.

It's 64kbps (so grainy), 22.05KHz (so muffled) and 1ch (so mono). In 2007 it was possible to encode your video to certain setting in FLV (Flash Video) format, and YouTube's conversion (or reconversion) into it's native FLV settings would be bypassed. The video quality was really rubbish, but the sound was at least stereo. It was a bug, and they "fixed" it.

Now if you upload high resolution files, you're given the option to encode to high resolution FLV, and sometimes the stereo signal stays stereo. And sometimes it doesn't. And sometimes it plays stereo when played in Internet Explorer but not other browsers.

It gets weirder. When you upload a stereo file, it gets recoded and stored on one or another of YouTube's servers - it seems to be random which server is chosen. Now, some servers recode your audio to mono, while others actually recode it to stereo, but stream it as mono...unless you add "&fmt=18" or "&fmt=22" to the end of the URL.

Or maybe this "bug" has now been "fixed", because I've spent the afternoon experimenting with uploading different formats - FLV and DivX for video, PCM and MP3 for audio, and no matter what I do, the result is mono and crummy.

There's no good reason for YouTube to stick to this policy. Their settings are adequate for speech, but YouTube is used extensively for music. Settings of 128kbps 44.1KHz 2ch are routinely used by internet radio stations, so bandwidth just isn't the issue it was when YouTube started out. But sticking to it they are, like shit to your shoe.

Here's what I found while researching the above.

If you want to minimise the amount of video you have to upload with your audio, the smallest resolution that most video making/converting programs can handle is 8x8. However, the FLV standard seems to have a lower limit of 160x120. I haven't done extensive tests to find just how low a resolution YouTube can convert from, but it chokes on 8x8 and is fine with 160x120.

Amazingly though, the difference between a minute of 8x8 black screen and one at 160x120, coded to either FLV or DivX, is a few dozen kilobytes. So, don't worry about it. And if the technology obliges you to use a resolution high enough to put a logo on, I'd say put a logo on it.

This is assuming the video is encoded at one frame per second - though there's no great reason why the framerate can't go even lower. There's obviously no reason to deinterlace a black screen, and FLV is happy with a video bitrate of 1kbps. YouTube was happy with DivX at 125kbps, but not at 1.

Did you know you can schedule blogger posts? Just set the timestamp for a time/date in the future, and blogger will wait until that time to post them. I found this by accident - after spending half a day unsuccessfully searching for a simple way to schedule email sending.

So I think I'll try using it. Instead of blocking three or four topics into one post every two or three days, there'll be smaller posts more often, staggered over the same period.

This will:
(a) make me look more prolific and
(b) make me seem to be posting from my computer at times when I'm actually somewhere completely different. Or more likely, in front of a different computer.

In the meantime, this post marks the start of a new label: Technical.

Video Killed


One of the oddities of Blogger is, it will host video for you, but not audio. So you can vlog but not podcast. If you want Blogger to host audio, you have to give it a video track.

Of course it doesn't have to be much of a video track - you could use a slideshow of photos, a logo, or just a blank screen. But it's not very elegant to have a redundant non-video staring at you while your music, poetry or commentary plays. There should be some way to at least make the video window invisible, leaving just the playback bar - and there is.

When you upload your video to Blogger, it recodes what you send to flash format, and embeds a display window in your post. The HTML code looks something like this:

<object id="BLOG_video-41b6eee4fd64c73b" class="BLOG_video_class" contentid="41b6eee4fd64c73b" height="240" width="320"></object>


Unless you're pasting from the source code of another blog, in which case it'll look something like this:

<embed width="320" height="266" src="http://www.blogger.com/img/videoplayer.swf?videoUrl=http%3A%2F%2Fvp.video.google.com%2Fvideodownload%3Fversion%3D0%26secureurl%3DqAAAAOF-u9WtopylwZ9XHAqIS4Q8mMCKxx25CeJq8bZBiPr6Lw1nPt3Mzuy4dAHiTdzlJdTM7R5C4A8yULlJcCGk46syEW7Wkg_D7V8QgTWwr-HGf1tvwnESv5Uz2E9E7wL5Ce4fg3BdxWEVOmlQ1z-PDH480M4DbkLsn6npmDomUJiai-I7XKyv_b2OZ_QnsOVpAr_T0XVce-X10Sy6q7FESf6NIerYRfXjTmzBMH8TG0aC%26sigh%3D7BraJLEO2xG_ZgceHKNZLuRXVY0%26begin%3D0%26len%3D86400000%26docid%3D0&nogvlm=1&thumbnailUrl=http%3A%2F%2Fvideo.google.com%2FThumbnailServer2%3Fapp%3Dblogger%26contentid%3D9c3e5d0d5c086378%26offsetms%3D5000%26itag%3Dw320%26sigh%3DqlhWps1wzO-wxaMVRD9NQowWIKI&messagesUrl=video.google.com%2FFlashUiStrings.xlb%3Fframe%3Dflashstrings%26hl%3Den" type="application/x-shockwave-flash"></embed>
<a href="rtsp://rtsp-youtube.l.google.com/video.3gp?app=blogger&fmt=13&cid=9c3e5d0d5c086378" type="video/3gpp"><img width="320" height="266" alt="video" src="http://video.google.com/ThumbnailServer2?app=blogger&contentid=9c3e5d0d5c086378&offsetms=5000&itag=w320&sigh=qlhWps1wzO-wxaMVRD9NQowWIKI" class="BLOG_mobile_video_class" id="BLOG_mobile_video-9c3e5d0d5c086378"></a>


A bit daunting isn't it. This example is a fifteen second clip of a firework display, from the blog of David's Tangled Thoughts. Hi David, I hope you don't mind I've used code from your page as an example.

If you're pasting code like the latter, you can edit out everything from "<a href="rtsp" onwards, and everything from &nogvlm=1& until ""</embed>", leaving you with:

<embed width="320" height="266" src="http://www.blogger.com/img/videoplayer.swf?videoUrl=http%3A%2F%2Fvp.video.google.com%2Fvideodownload%3Fversion%3D0%26secureurl%3DqAAAAOF-u9WtopylwZ9XHAqIS4Q8mMCKxx25CeJq8bZBiPr6Lw1nPt3Mzuy4dAHiTdzlJdTM7R5C4A8yULlJcCGk46syEW7Wkg_D7V8QgTWwr-HGf1tvwnESv5Uz2E9E7wL5Ce4fg3BdxWEVOmlQ1z-PDH480M4DbkLsn6npmDomUJiai-I7XKyv_b2OZ_QnsOVpAr_T0XVce-X10Sy6q7FESf6NIerYRfXjTmzBMH8TG0aC%26sigh%3D7BraJLEO2xG_ZgceHKNZLuRXVY0%26begin%3D0%26len%3D86400000%26docid%3D0"</embed>


...and it'll work just fine. Either way, replace the "height" number with "27". That's it. Now your blank video won't display, and you're (kind of) podcasting from inside Blogger.

Here's my experiment in non-video, which is also an introduction to the drumkit I've been working on for the past week. Unfortunately, Blogger sound isn't great, and is only mono.



You might (just possibly) want to do this with YouTube videos. Here's the embed code for a video chosen almost at random.

<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/VSUX9byu6NY&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/VSUX9byu6NY&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>


...and here's the video. It's a killer.



It turns out you need almost none of the code. This snippet is all you absolutely need, though the video won't be resized, and there'll be no fullscreen option:

<embed src="http://www.youtube.com/v/VSUX9byu6NY&hl=en&fs=1"></embed>


To crop out the video window, leaving only the tracking bar underneath, put the width and height parameters back in, with the height set to 25. Personally, I prefer a width of 320. The code now looks like this:

<embed src="http://www.youtube.com/v/VSUX9byu6NY&hl=en&fs=1" width="320" height="25"></embed>


...and the clip now looks like this:


The video is still there, and still being streamed. It's just not being displayed.

One small detail - the volume icon still works, and you can mute playback, but the vertical slider you use to adjust the volume is now cropped out of view. So in effect, there's no volume control.

You can perform similar surgery on MTVMusic.Com videos, turning this...

<embed src="http://media.mtvnservices.com/mgid:uma:video:mtvmusic.com:18123" width="320" height="271" type="application/x-shockwave-flash" flashVars="dist=http://www.mtvmusic.com" allowFullScreen="true" AllowScriptAccess="never"></embed> <div style="margin:0; text-align:center; width:320px;font-family:Arial,sans-serif;font-size:10px;"><a style="color:#000000;" href="http://www.mtvmusic.com/buggles">The Buggles</a> |<a style="color:#000000;" href="http://www.mtvmusic.com/">MTV Music</a></div>


...into this...

<embed src="http://media.mtvnservices.com/mgid:uma:video:mtvmusic.com:18123" width="320" height="25"></embed>


...which gives you this:



Unfortunately it won't work on Daily Motion embed codes - it crops out the tracking bar. LiveVideo fails a little differently, and changing the size parameters changes the size of the whole box, including the playback controls.

BoobTube


I've been looking at the technical details of optimising video for putting on YouTube.

If you know something about computer video, this post may be useful to you. If you don't...it'll be roughly as interesting as a brochure of granite samples.

When you upload your videos to YouTube, you can use many possible formats for the video and audio streams. The video stream can be in MPEG1, MPEG2, DivX, XviD, WMV and several others, but not FLV.

The audio stream can be in WAV, AIFF, MP3, MP2 or the built in format used by WMV. It can be stereo or mono, and any of the common samplerates - 22KHz, 44.1, 48 etc.

However, YouTube will always recode what you upload into FLV - Flash Video, which uses MP3 for sound. The MP3 is always 22KHz, mono, and at a variable bitrate between 32kbps and 64 - okay for speech, but not great for music.

This means if the sound track of your upload is in MP3, it will be recoded into another MP3, a process which sometimes throws the sound out of synchronisation with the video.

It also means that if you upload a stereo file, you should be aware that changing it to mono can change the loudness of sounds that are panned left or right. If you're uploading a song, the vocals might become significantly quieter, or the mix different.

So, mix your song down to mono, and make sure it sounds okay before uploading. I'm not sure, but I think if your upload soundtrack is in MP3 at 22KHz, in mono at (say) 256kbps, this should reduce sound drift, and it'll sounds as good as it's going to get after recoding.

I think the video bitrate Youtube recodes to is constant, but I don't know what it is.


The file you upload can be anything up to 100MB, and up to ten minutes long.

Whatever video resolution you use, YouTube will recode it to 320x240, so it's a good idea for your upload to be 320x240 too. That way (a) you don't waste bandwidth uploading pixels that won't appear onscreen. (b) you have to wait less time for YouTube to process your upload and most importantly (c) you can use your megabytes to encode your 320x240 film at a very high bitrate, making it nearly lossless, meaning the degradation caused by YouTube recoding it to FLV will be minimised.

That is, if you give YouTube the best picture quality you can, it will look better when they've finished with it. If you're encoding to an MPEG4 format (probably DivX or XviD), 2000kbps CBR is as high as you need to go. You can go higher, but bitrates above 3000 can make the picture worse by carefully encoding visual noise in the picture, which lower bitrates would ignore.

Incidentally, Google Video can accept videos at 640x480. I'm not certain what bitrates are best, but personally I think 2000 is fine here too.

All YouTube videos are 320x240 pixels. However, when you embed one in your blog, the default size is 425x350, and they display at the same size on YouTube's own site. This means:

(1) The video is displayed scaled up by an awkward proportion, which has the effect of reducing picture quality.

(2) The right hand side of the video will be cut off on a Blogger blog, because the space allowed for blog entries is slightly narrower than the width of the video.

It looks like this:



See how the right hand side is cut off? And no, that is not me singing,

Why does YouTube choose do this? I have no idea.

However, you can change the display size, either to make it fill up the width of your blog without cropping, or to display in best picture quality without resizing.

The code to embed a video is provided by YouTube on each video's page for cutting and pasting, and looks like this:

<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/LOO67TPIsdY"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/LOO67TPIsdY" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>


See that there are two mentions of width being 425 and height being 350? The first time refers to the dimensions of the "box" which contains the player for the video clip. The second gives the size of the player.

To make the clip as large as the blog column, change both widths to 400 and both heights to 300. This will also make the video display slightly better, because the scaling factors are "neater" - 400 is 320*1.25 and 300 is 240*1.25. You're making the video window larger by a quarter, instead of the default of almost-but-not-quite a third.

Like this:


To make the clip display with the best quality, set to the widths and heights to the dimensions of the FLV file - 320x240.

Like this:


If you're posting YouTube clips somewhere that doesn't have Blogger's narrow columns, you might consider making the width 640 and the height 480 - double in both direction. This will make bad quality video look worse, but will give you a nice big window.