Obtaining version information for Flash (.SWF) files

In my post about embedding video content in (X)HTML this morning, I mentioned that I didn’t know the correct codebase attribute to use when embedding Flash video clips from online resources in my web pages… well, now I do!

It seems that every Flash (.SWF) file includes a header which includes the Flash version number in the 4th byte.

OK… great… but how do I view the header?

First, I found a forum thread discussing a method for testing the minimum version of Flash player is required to display a .SWF. however, trying to write some ActionScript in MX Studio 2004 blew my mind (I don’t know anything about Flash development). A bit more googling led to another thread on .SWF header-only parsing, including some Java code (unfortunately I don’t know how to use a Java class either!).

Now what? Realising that I’m an operating-system-and-infrastructure-kind-of-guy and not a programmer, I started to think about the command line… what if I get hold of a .SWF file and type head filename.swf? Lots of beeps and unintelligible ASCII characters, that’s what! Hang on… that started with CWS? Flash file headers always begin with CWS or FWS… getting warmer… how can I read that 4th byte… think back to hacking school computers with the MS-DOS debugger 20 years ago… think hexadecimal… a hex editor – that’s the answer!

As I was working on Mac (i.e. no debug.exe available), I needed to download a free hex editor. HexEdit looked like it should do the trick but there is not a universal binary version available yet (only 68000 and PowerPC). Then I found a link to 0xED (nice name for a hex editor guys!) on the Apple development tools download site. I opened a .SWF file and… 43 (C)… 57 (W) … 53 (S)… 07… Flash Player 7 required. Sorted. Repeating for a few more files, I found FWS4 and FWS5… this was looking good, now what about the iFilm and YouTube links in my post this morning? As they don’t expose the content directly (even when you dig about in the HTML), I thought of using something like TubeSock to rip the content but realised that wouldn’t help in this case as it also performs a file format conversion. Then I noticed that the websites use their own Flash players to access the video content – 0xED can also open by path – and after entering the required URL (http://www.ifilm.com/efp or http://youtube.com/player2.swf), I found the information I needed – YouTube content needs Flash Player 7 or later and iFilm content needs Flash Player 8 or later.

.SWF file viewed in 0xED

Now I can go back and edit those codebase attributes to the correct minimum player version!

Embedding video content in (X)HTML

Yesterday’s Mac vs. PC post should have been straightforward, except that it contained three video clips, each of which I wanted to embed in a standards-compliant way whilst maintaining maximum browser compatibility (i.e. ignoring the official advice from Adobe on embedding Flash content and Apple’s advice for embedding QuickTime content by avoiding the non-standard <embed> element and just using the <object> and <param> elements)… what a task that turned out to be.

To be honest, a lot of the problems probably came down to me not thinking my code was working because the preview function in my content management system (Blogger) failed to display the videos in one browser or another so, after another late night, I decided to publish and be damned. The resulting code seems to work for the Flash content on most the the browser/operating system combinations I have tried (Mozilla 1.7.13 and Firefox 1.5.06 on Linux; Internet Explorer 7.0.5730.11 on Windows XP, Safari 2.0.4 and Firefox 2.0.0.1 on Mac OS X – Intel), although I was using Adobe Flash Player 9 (I’m not sure which version is needed for the clips I used so I didn’t update the codebase attribute to reflect it – older player versions will not automatically update until I fix this) and I’m aware that there may still be some issues with the QuickTime clip (it does seem to be working on Firefox and IE though).

So, how should this be done?

Firstly, the valid Flash, video, and audio embed (object) markup post at the Web Standards Project links to some great articles which should be read, namely:

These give the background to why the <embed> element shouldn’t be used, as well as demonstrating the use of conditional comments to force certain browsers into compliance. I actually used another variation on this theme – David Grudl’s how to correctly insert Flash into XHTML – ironically this uses a negated version of Internet Explorer-specific conditional comments to force IE into ignoring code intended for other browsers!

Then, there is the issue of the changes made to the behaviour of ActiveX content in Internet Explorer, following the Eolas patent suit, as described by Robert Nyman. In my case, it doesn’t really matter if you need to activate a control to view a video clip on my blog; however there are some workarounds. Most use JavaScript (indeed Adobe recommends a JavaScript-based workaround to the changes made in Internet Explorer) and one popular alternative is to use document.write in an external JavaScript function to dynamically re-write the object embedding code. Alternatives include Geoff Stearns’ SWFObject (formerly known as FlashObject) and Bobby van der Sluis’ unobtrusive flash objects (UFO). I plumped for a version I found in a comment by Karl Rudd the Robert Nyman post that I linked earlier (Fix It uses a similar concept, also advocated by David Grudl in his post on how to avoid activation of ActiveX in IE).

After spending most of yesterday working on the object embedding, and a good part of this morning writing about it here, I think I’ll leave that one alone now, unless anyone has any better ideas to fix my code (note that the <br /> tags scattered through it were added by Blogger – not by me).

Mac vs. PC


PC guy - Mac guy

A few months back, I commented that Apple’s Mac vs. PC ads were amusing but it still strikes me as odd that a company with a brand as strong as Apple’s would drop to what is effectively bragging. Anyway, despite the rumours of Mac guy Justin Long being replaced (which he appears to deny on his website), new ads are running and they are still amusing… even if they do sometimes sail a little close to the wind (more on that in a moment).

The ads have grabbed the public attention so much that there are even spoof ads:
Even Microsoft seem to be getting in on the act, and although the original source of the Zune vs. iPod clip below is unclear, it was reported to have been shown at a Microsoft event (I can believe that):

Meanwhile, the United States’ campaign has been so successful that it is now being rolled out in other parts of the world – David Mitchell and Robert Webb have been brought in as PC guy and Mac guy for the UK ads and it seems to work well (my favourites so far are definitely “Restarting” and “Virus“).

I said that Apple are sailing close to the wind here and this is why… I have to restart my Mac far more often than my Windows XP or Windows Server 2003 PCs – so that’s one of the UK ads that’s a blatant lie then. I’ll accept that view is a little subjective, so let’s objectively consider the new “Security” ad in the US which pokes fun at Windows Vista’s user access control:

…and here’s a screen shot from my Mac, after I change the default behaviour which allows me to run as an administrator although admittedly not as root (and with the client firewall turned off):

OS X authentication

I know the ads are largely about fun but isn’t this a case of the pot calling the kettle black?

Clearer vision with iSight

When I originally bought my Mac, I avoided buying an Apple iSight camera, as I figured they were a little expensive; however more recently I’ve been convinced of the need to buy a decent webcam. Unfortunately, getting hold of an external iSight now is very difficult as they have been withdrawn from sale in the US and Europe (if not worldwide) – I had to pay over the odds on eBay to secure mine (until then I’d been using a DV camcorder on a firewire cable) – but even so, I thought I’d publish a couple of links that might be useful for iChat AV users thinking about their choice of webcam:

iSight image in iChat AV

This screen shot was captured earlier this evening using the external iSight camera and even though it was taken in a dark room under a mixture of compact fluorescent and halogen light sources, the camera has done a pretty good job of both the exposure and the focus… although by the look of the bags under my eyes, I need more sleep!

Freecycle

RecyclingLast week, I wrote about my dilemma as to whether or not to retain my old technical notes or to recycle them. After this my loft-and-garage-cleansing-clear-out continued but, even after recycling everything that could be considered household waste (apparently the bin men were a little surprised by the huge stack of recycling sacks at the end of our drive yesterday), I was left with a pile of old computers, 802.11b wireless LAN kit, network cards/modems, a broken UPS and a broken lawnmower.

The thing is that all this stuff must have some value to someone and to let it end up as landfill (or, even worse, being recycled in an exploitative manner) was just wrong. After a lot of googling, I discovered that my computers were too old even for charities (the Donate a PC service has published some general advice) and that the WEEE regulations have massively limited the options for disposal of such equipment; however, I did find a list of UK computer recyclers and refurbishers courtesy of Waste Online. Then, I discovered Freecycle.

FreecycleBuilt around the Yahoo! Groups system, Freecycle is a place to give or receive what you have and don’t need or what you need and don’t have – a free cycle of giving which keeps stuff out of landfills (note that it is not intended as a place to just go get free stuff for nothing). I joined my local group (in order to do that, I needed to register for a Yahoo! account) and offered my unwanted items. What amazed me is, once my post had been moderated, just how quickly I received a stack of responses for equipment which I considered to be junk. Of course, I’d been a bit stupid and hadn’t realised that those responses were going to a new Yahoo! Mail account that had been set up for me (doh!) but once I sussed that, I was able to arrange collection/delivery and feel that I’d helped someone at the same time as doing a little bit to preserve the environment (of course, cutting down on the original production of waste would be far more effective).

It is often said that one man’s trash is another man’s treasure and I was only to pleased to let my old kit go to someone who could make good use of it. Next time you want to get rid of something that won’t sell on eBay (or are feeling benevolent enough to just give it away instead of selling it), check out your local Freecycle network.

Improving search engine placement (without breaking the rules)

Search engine optimisation (SEO) has a bad reputation. That’s tough for SEOs but unfortunately it’s a side-effect of black hat SEO techniques.

I haven’t knowingly used any SEO techniques as this blog is really just a hobby of mine. I enjoy writing for it, find it a good place to store my notes for future reference (hence why sometimes there is detail here that would not be useful to anyone else!) and like the feedback I get when someone else finds my content useful. I’m pleased with my site’s ranking (considering I’ve done very little to boost it, other than to write lots of posts) and although the advertising revenue will not let me give up my day job yet, it does at least cover the hosting costs. Even so, I’ve been intrigued when reading SEO articles in .net magazine (it seems that SEO is not a black art – just common sense really) and recently I’ve been checking out a few tools and methods which should help anyone to increase the placement of their site (it seems that I’ve been using much of this advice purely by chance):

There are also a few more links that might be useful in some of my previous posts:

New earphones for my iPod

The standard Apple iPod earphones are okay… but they are basic. I’m no audiophile (some would say audiophiles wouldn’t listen to MP3s) but I find them uncomfortable, the foam covers fall off and get lost, they fall out of my ears and I have to turn up the volume to the maximum whenever I’m listening to a podcast in a noisy environment (like on the tube). Oh yes, and the bass on my iPod Mini “blew” the right earbud within days of purchase.

As I’m increasingly using my iPod, either on the parts of my commute which don’t allow me to sit on the train and write for this blog or on the stress-busting walks which often take me out into the Buckinghamshire countryside, I figured I’d get some new earphones. My criteria were simple:

  • Inexpensive (i.e. less than £30);
  • White (to match the iPod);
  • Comfortable;
  • Reduce impact of ambient noise (noting that noise-cancelling headphones were unlikely to meet my first criterion – i.e that of being inexpensive).

Some basic research led me to find that there are some excellent ear-canal phones available (like the Shure E4Cs) but they will also cost me many of my hard-earned pounds, so I decided to buy the white Sennheiser CX300 ear-canal phones which were on offer at the Apple Store and also received great reviews.

Sennheiser CX300 (white)They only arrived on Saturday (so haven’t been used much yet) but so far I’m impressed. I’m still working out which of the three supplied ear adapters is the best fit but they are definitely more comfortable and they stay in place, even whilst lying in bed taking a pzizz. I’ve also found that I can turn the volume way down, hopefully reducing the damage that I’d doing to my hearing, and the in-ear placement really does cut out a lot of ambient noise (haven’t tried them on the tube yet though). Of course, they will work with any audio device that uses a standard 3.5mm headphone jack, not just an iPod.

Now, the more discerning reader will notice that the link above is to Amazon and not Apple. That’s because I’ve found out that, whilst I spent £29.99 on mine (and they are back up to £39.99 now), they are only £17.80 at Amazon (and even less if you plump for black or silver). So, if you want some, please buy yours using this link and earn me some commission (albeit expressed in pence, not pounds) to pay me back for my complete lack of pre-purchase price comparison!

Manually removing entries from Windows’ add/remove programs list

Earlier today, I was clearing down an old PC in preparation to donate it to a worthy cause. I remembered that installing Windows XP on it had been a long process, so I just removed the data (nothing sensitive, so no need to securely delete anything), uninstalled the applications and hacked the registry to change the registered owner/company (look for RegOwner and RegCompany string values for various products throughout the registry but the main ones I wanted to change were the RegisteredOrganization and RegisteredOwner string values in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion as these are the ones shown in the system properties – the easiest way to find them is to look up the registered to values in the system properties and search the registry for the appropriate string).

Although various installers had left behind subdirectories which needed to be removed manually, there was one application for which the uninstall failed but repeated attempts resulted in an error – leaving behind an entry in the Add or Remove Programs Control Panel applet. I needed to know how to remove this entry and found the answer in Microsoft knowledge base article 247501 – it involved more registry hacking to find the appropriate entry in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall but it did the trick.

Video conferencing using iChat AV on a Mac and AIM on a Windows PC

A few weeks ago, my buddy Alex and I got iChat AV working through our firewall routers (with some caveats) but more recently, he mentioned that he’d been videoconferencing with a PC user via Skype but was not entirely happy with the video quality. I was pretty sure it would be possible to get iChat AV videoconferencing with a PC user via AOL Instant Messenger (AIM) and I’m pleased to report that it is… sort of.

The information I needed can all be found in MVL Design’s video conference tutorial for iChat and AIM but it may also be useful to know that Ralph Johns has also republished some information from EZ Jim on Mac video chat with PCs and has contributed to an Apple discussions post about video and audio chats with PCs.

Bearing in mind that Alex and I already had the required firewall ports open from our previous iChat AV conversations, I installed Windows XP on a spare PC with a webcam and loaded AIM 5.9.3861 (electing not to install AOL Explorer or the AOL Toolbar for Internet Explorer, choosing United Kingdom GB as my location and electing not to make AOL my homepage). After this, I was able to log in using my ICQ ID as my screenname and once I’d told the Windows XP firewall to unblock AIM (when prompted) and edited my preferences to set up the camera in the live video options, Alex and I could successfully video conference. It’s worth noting that, although the frame rate was fine at the default settings, there was a slight issue with a delay between speaking and the communication being received (similar to satellite delay on an international phone call) and if I cranked up the image quality then the result was a much-reduced frame rate.

iChat AV conversation with AIM user

This image looks slightly better as it has been reduced to 50% of the original image size (note cheesy grins as the image Alex took mid-conversation made us look completely gormless).

So that’s the good news – it works. The bad news is that it won’t work soon.

As we were testing this, I received a pop-up which said:

You are currently running the following out-of-date version of AOL Instant Messenger:

5.9.3861

This version will soon be blocked. Please upgrade now to ensure uninterrupted access to AIM.

You will be upgraded to the following version:

Final Release Version 6.0.28.3

I decided to see if this all worked with AIM version 6 and it seems it doesn’t. The first problem was that AIM 6 would not accept my ICQ number as a screen name:

Invalid Screen Name or Password.

After registering for an AOL screen name I could log in but we couldn’t initiate a video chat as my buddy appeared to be offline (even though I could communicate with him using another PC!)… some more digging required I suspect. If anyone has any ideas as to what the problem might be, please leave a comment on this post.

Retain or recycle?

Recycle nowIn a few months time, I’m hoping that we will be able to convert our loft to a new guest room/my office (den); however that means that I need to do some serious rationalisation of the amount of “stuff” we have accumulated. I did sort out a lot when my second son was born and my wife and I started sharing an office but there are so many things I’ve been keeping “just in case I need them”. For example, old text books from ‘uni – with the rapid pace of development in IT it seems highly unlikely that they will be relevant today but it seems a shame to let them go.

I have started to move in the right direction as, this morning, a whole load of course notes from Microsoft official curriculum courses went into recycling sacks based on the fact that they date back to the mid-late 90s and relate to unsupported technologies:

  • 687C – Supporting Microsoft Windows NT core technologies;
  • 688C – Internetworking with Microsoft TCP/IP in Microsoft Windows NT 4.0;
  • 730C – Fundamentals of Microsoft Exchange Server 4.0;
  • 758C – Supporting Microsoft Internet Information Server 2.0;
  • 973C – Microsoft Exchange Server 5.5 series – design and implementation;
  • 1100B – Upgrading to Microsoft Windows NT 5.0;
  • 1267B – Planning and implementing Active Directory;
  • 1560A – Updating support skills from Microsoft Windows NT 4.0 to Microsoft Windows 2000;
  • 1561A – Designing a Microsoft Windows 2000 directory services infrastructure;
  • 1562A – Designing a Windows 2000 networking services infrastructure;
  • 1563A – Designing a change and configuration management infrastructure for Microsoft Windows 2000 professional;
  • 1579A – Accelerated training for updating support skills and designing a directory services infrastructure for Microsoft Windows 2000.

It feels good to have such a clearout but what if I need those notes? Sure, the likelihood of me implementing NT 4.0/Exchange 4.0 or even Windows 2000/Exchange 5.5 these days is pretty slim (and they’ve all been stored in boxes in the loft since 2001), but I just might want to look back at what Microsoft were recommending in those days! I’m in a bit of a dilemma here – am I throwing away a piece of IT history, or just reversing a dangerous tendency to hoard? As there is no-where at work for me to store this stuff, the only other option is to buy a bigger house!