Microsoft Expression Web causes PHP error

I ran into a strange and surprising PHP error today. I’m working on a little PHP application which has a login page. The login script calls session_start() to start or resume a PHP session. It was working OK so I decided to decorate the page a little (I was working in Eclipse). I like to try a variety of tools, so I ran up Microsoft’s Expression Web, added an image, then re-ran the script to see how it looked.

The answer was not good, because I now had an error:

Warning: session_start(): Cannot send session cookie – headers already sent

I puzzled over this for some time. The error was in line 0 of my login page. I couldn’t see anything that was different from before, except the static image that meant nothing to PHP.

Eventually I worked it out. Eclipse (running on Windows) created the PHP files using ANSI. On saving, Expression Web silently changed them to UTF-8. That in itself was no bad thing – it’s usually a better choice – though I reckon it should ask. The bigger problem was that Expression also added a BOM (byte order mark) to the beginning of the file. This is actually optional for UTF-8, and most non-Windows editors do not add it. It happens to flummox PHP, which interprets them who-knows-how and sends some output to the browser, preventing session_start from working.

This is particularly painful to debug since most editors do not display the BOM; they simply use it to confirm the character set in use. So you can have file A which works, and file B which does not, and they are character-by-character identical.

One way to see and remove the BOM is to open it with Edit.com, which does not understand it at all:

I guess both Expression and PHP could do better here. The bit that puzzles me is that I can’t be the first to run into this. Doesn’t Microsoft know that its UTF-8 BOM breaks PHP files, at least on the two versions I tried (XAMPP on Windows and PHP 5.2.1 on Linux)? I can’t even see a preference in Expression that would prevent it being written. And if you remove it, and then re-edit in Expression, it carefully writes it back. Unlike Adobe’s Dreamweaver, which leaves well alone.

PS if you want to know all about BOMs, see here.

Update: See comments – apparently this was fixed in Expression Web 2.0. Tina Clarke discusses the problem here.

Office Ribbon in Silverlight – amazing stuff from divelements SandRibbon

I blinked when I tried the live demo of SandRibbon for Silverlight, from divelements. It looks remarkably like Office 2007:

The control is in beta, and promises:

All the commonly-used functionality of the Office 2007 UI is made available for you to use with this product, and most of the less common functionality too. Customers who have used SandRibbon for WPF will find the API familiar. The visual constructs used are compatible with all other Silverlight controls, both built-in and third-party.

The company already has a sandcontrol control for WPF. However, the Silverlight control shows how well you can replicate the look and feel of a desktop application in a cross-platform browser application. Now, put this together with the automatic online/offline synch in Live Mesh, and you could have a version of Office with seamless online and offline support. Microsoft may deliver something like this in the web versions of Office 14, though it is going to have one eye on its lucrative desktop sales and I doubt whether it will really exploit what is now possible.

DRM-protected epub a good buy?

Someone considering a Sony Reader from Waterstones (a UK bookseller) asked me what I thought.

I haven’t tried the Sony Reader yet – it would be an interesting thing to review and I’ve heard good reports of its usability and readability. The snag for me would be that I’m already device-laden when out and about, and the last thing I want is yet another one. In principle, I’d rather use a multifunctional device – the iPhone is apparently good for reading, or maybe a laptop or netbook. Battery life is an issue on laptops, but I can usually plug in on the train now.

But I digress. What about the content, is an epub from Waterstones a good buy? I took at look at the site. Waterstones has done a deal with Sony and gives the impression that you must buy a Reader (£224) in order to purchase and read its ebooks, though as far as I can tell you can read them on a PC or Mac without buying a Reader. The help page is a model of unclarity. It presumes I already have a Reader. Then it says I have to install Adobe Digital Editions and sign up for an Adobe ID. It seems rather convoluted, that to buy a book from WaterStones and read it on a Sony I have to sign up with Adobe.

It is all about DRM of course. I took at a look at Adobe Digital Editions. This is the software for reading an epub protected with DRM delivered by Adobe Content Server 4, which I presume is what Waterstones is using. I installed it and saw dialogs just like the ones I remember from the failed Microsoft Reader and its lit format:

I can “activate” up to six devices on which to read my ebooks. A few other things caught my eye. System requirements show Windows and Mac but not Linux. The faq says Digital Editions does not connect behind ISA server – that would hit me, as I use ISA, the Microsoft firewall – and explains bad scenarios. For example, if you don’t authorize your computer, maybe because you don’t want to give your personal details to Adobe, the books are locked forever to that one computer. I presume you couldn’t even transfer them to a Sony Reader.

Surprisingly, the faq says that the only supported device is Sony Reader PRS-505, though it adds:

Adobe is actively working to support other platforms and devices. Further developments will be announced when available.

No iPhone (Stanza). No Amazon Kindle. Won’t work on my Windows Mobile devices, or any phone as far as I can tell.

The reader itself worked fine. I downloaded a free book from Feedbooks and added it to the library – no DRM, phew.

As for Watersones ebooks, right now, there are several things to dislike. First, if I’m going to buy an ebook, I do want to be able to read it across all my devices – a specialist reader has its place, but other mobile devices are also important. I wouldn’t consider it without that. Second, the DRM is a nuisance. Third, the prices strike me as too high. For example, I can buy John Le Carre’s A Most Wanted Man for £13.99, which Waterstones tells me is a discount of £5.70 from the list price of £18.99. However, the same book is on offer in hardback for £12.50. So I am paying a premium to get the ebook.

Software books definitely have advantages. They are weightless, green, searchable, you can vary the type size. However they have disadvantages too. You need a device to read them; you can’t sell them on; you have no physical backup; there is no smart cover; and you don’t get the sensual pleasure of turning over crisp new pages. Further, the publisher is saving manufacturing cost, and the retailer is saving storage and carriage costs: shouldn’t those savings be passed on?

These factors, combined with the DRM nuisance and the format wars, would make me cautious about investing in Waterstones ebooks at the moment.

There is a political aspect to all this. Amazon is expected to launch Kindle in the UK at some point. It needs wireless support for direct content download, which may be holding it up. However, UK publishers seem solidly behind epub and Sony/Adobe. The Bookseller observes:

There may be a collective strategy about this: no-one—least of all Penguin, HarperCollins, Hachette, Macmillan or Random House—wants to see Amazon in possession of the dominant e-book device, and by consequence become the only e-book retailer.

Of course the publishers can support multiple formats. My guess is that Amazon will be a significant player with Kindle, even though it is late arriving.

Technorati tags: , , , ,

Microsoft Small Business Server 2008 too expensive for hardware, market

When Microsoft introduced Small Business Server 2008, it upped the price of the base package and reduced the cost of client access licenses.

That’s OK for the, umm, larger small business; but it’s made the product expensive for those tiny setups who only need 5 or 10 CALs.

RIght now, ebuyer.com is offering SBS 2008 Standard for 835.49+VAT and an OEM version for £535.55+VAT.

By contrast, you can get the old SBS 2003 Standard OEM for £275.90+VAT.

Suitable servers on the other hand are now at rock-bottom prices. If you are lucky you can pick up an HP ML110 for around £200+VAT (try Amazon). Of course you have to add some RAM and probably a second hard drive for RAID, but neither is particularly expensive.

The 2003 edition was better value. This has also made Linux more attractive for those with the skills to look after it, and businesses that are not saddled with Windows-only software that has to run on the server.

Technorati tags: , , ,

Want Google Earth in your browser? Don’t use Google Chrome.

I’ve been trying various mapping APIs and took a look at Google’s new Earth browser plug-in. It looked a bit odd in IE7 so I tried Google Chrome. Not supported:

Given that it now works in Safari on the Mac (which also uses Webkit) I’m a little surprised. No doubt the team will add it soon, but this sort of thing doesn’t help Chrome adoptiom.

Technorati tags: , , ,

10 steps to a well-behaved Windows application

I wrote a short summary of Microsoft’s latest (I think) guidelines for well-behaved Windows applications.

It is a significant topic. A large part of the thinking behind Vista’s contentious User Account Control (which is being continued in Windows 7) is to push app developers into writing applications that conform more closely to the guidelines, especially in respect of where they write data. If all applications conformed, there would be little need to log on as local administrator, and Windows would be more secure.

Richard Thompson at the Cambridge Corn Exchange

I saw Richard Thompson, accompanied by Judith Owen (vocals, piano) and Debra Dobkin (percussion, vocals), perform his 1000 Years of Popular Music set at the Corn Exchange in Cambridge (Friday January 16th).

This is a great atmospheric venue with good acoustics, but we arrived slightly after 7.30pm thanks to traffic and parking problems, to find that the show had started on the dot. We missed the first two songs and ended up in seats that weren’t the ones we’d booked, but they were good seats which is what counted.

The concept is that RT and his ensemble play songs from the ages – from Medieval to the present day. Why? A few reasons. Because he can, and few others could. Because he’s exploring his cultural history. Because he wants to introduce songs that are old but good to a new audience. Because he wants to pay tribute to the past. Because it’s a hoot. All of these.

It makes for an enjoyable evening, though it is inevitably uneven. I studied English Literature and knew some of the older songs as poems; it was good to hear them in a new context, especially with Thompson’s dry,witty introductions. I enjoyed his 19th century social comment songs, Blackleg Miner and I Live in Trafalgar Square. He caught the mood of the Kinks’ See My Friends brilliantly. His rendering of Abba’s Money Money Money is hilarious. I didn’t think he carried off the Beatles so well, though we saw some striking Beatlemania photos.

I was sorry he did not perform Oops! … I did it again (yes, the Britney Spears song) as this is one of my favourites on the CD, another ode to failed relationships.

The paradox of RT is that he is fascinated by mortality, decadence and despair, yet is among the most clean-living, disciplined and downright healthy artists out there; he is sixty this year but his voice is strong and physically he looks almost the same as he did twenty years ago, with his trademark beret.

He carries it off really well, but would I rather have heard 1952 Vincent Black Lightning, Wall of Death, and The Ghost of you Walks? I suppose I would; but at the same time kudos to RT for doing something different.

This is the set list from the day before in London (I didn’t go but it was posted to the discussion list); ours was very similar but I’ll update this post when I have the exact set list from last night.

Hevene Queen
3 Ravens
So Ben
False Knight
Pipe Shepherds Pipe
When I am Laid in The Earth
Remember Thou O Man
Shenandoah
Blackleg Miner
Trafalgar Square
Sally Gardens
When a Man Goes to Woe

Interval

Java jive
Night and Day/Something Wonderful
Wine Spo-Di-O-Di
All Right I’ll Sign the Papers
See My Friends
Friday on My Mind
Money, Money, Money
everybody’s Got to Learn sometime
Maneater
Encores
Ja Nuls Hom Pris
Cry Me a River
Beatle Medley

SQLite developer argues for quick bug disclosure and fixes, despite egg on face

SQLite developer D Richard Hipp has posted to his mailing list to announce a third release in the space of a few days, to fix bugs discovered in version 3.6.10:

Some concern has been expressed that we are releasing too frequently. (Three releases in one week is a lot!) The concern is that this creates the impression of volatility and unreliability. We have been told that we should delay releases in order to create the impression of stability. But the SQLite developers feel that truth is more important than perception, not the other way around. We think it is important to make the highest quality and most stable version of SQLite available to users at all times. This week has seen two important bugs being discovered shortly after a major release, and so we have issued two emergency patch releases after the regularly scheduled major release. This makes us look bad. This puts "egg on our face." We do not like that. But, three releases also ensures that the best quality SQLite code base is available available to you at all times.

He goes on to say that an extended beta period would be unlikely to reduce the risk of bugs found on release, because most bugs in SQLite are found by internal testing rather than by external users. He also argues against withholding releases until they “testing is finished”:

The fallacy there is that we never finish testing. We are constantly writing new test cases for SQLite and thinking of new ways to stress and potentially break the code. This is a continuous, never-ending, and on-going process. All existing tests pass before each release. But we will always be writing new tests the day after a release, regardless of how long we delay that release. And sometimes those new tests will uncover new problems.

Anyone who has ever developed an application will know that sinking feeling when problems are discovered in code that has been distributed. Thoroughly implemented unit testing, as in SQLite, improves quality greatly. When bugs are found though, full disclosure and prompt fixes are the best possible response, so I agree with Hipp’s general approach here.

Web app with Silverlight and Virtual Earth

I’m writing on mapping applications right now and came across this impressive example from Port Metro Vancouver. It uses Microsoft’s Silverlight and Virtual Earth. The bit you want is the interactive map on the home page. Wait for it to load, then click the uncaptioned button (to the right of Webcams Wall) for full screen mode, and try some of the menu options.

There is more about the app in this blog entry on the Virtual Earth for Public Sector blog.

Windows 7 beta image gallery

The Guardian has posted a gallery of screenshots I took from the Windows 7 beta.

It includes an actual Device Stage, for the Sansa Clip. I did actually use this to update the firmware, which is not something you can do from the generic device connection dialog. It wasn’t truly seamless though, involving a download and a separate setup application.

I also illustrated the Library feature with three screenshots. The third of these illustrates a wee snag with this feature – documents with the same name, but in different folders, can appear identical in some views.

You can get a similar effect in Vista. If you look in \users\public with hidden items showing, you’ll find a folder called Public Desktop. Items in this folder show on your desktop merged with items in your user desktop. Put an item here with the same name as one in your user desktop, and both appear without any indication that they are different. This is also the reason why desktop.ini appears twice on the desktop if you show hidden files.

I guess it’s something users won’t run into very often (it’s pretty hard to do by accident in Vista); but it would be good if Windows could detect this situation and indicate it in some way. Bad outcomes would be if you deleted one of them thinking it was a duplicate, and lost some data; or sent someone a draft thinking it was the final version.

Technorati tags: , ,