Tag Archives: Microsoft

The TV Frame Game

Through another one of the numerous techie competing standards stories, (the TL;DR summary being that NTSC TV standard was considered a bit rubbish on this side of the pond and as a result in Europe we developed two alternative standards PAL and SECAM) in the UK and the USA we ended up with two somewhat incompatible TV systems. In the USA they had TV pictures with a vertical resolution of 480 lines, playing at a frame rate of 30 frames per second, whilst on this side of the Atlantic we were watching a  higher resolution 576 line picture, but playing at a frame rate of 25 frames per second. The TV companies had ways of converting pictures between the two standards, and eventually we got to home video recorders being able to play tapes recorded in the other standard, and TV’s that could cope with both, indeed these days in the UK you’ll find most DVD or BluRay players and TV’s will quite happily switch between European 50Hz standards and the North American 60Hz, whatever the standard of the material that was put into the machine.

When the HD standards came around there seemed to be general agreement across the world, and everybody settled on 720 lines or 1080 lines for high definition pictures and all seemed right with the world… Or maybe not…

That brings us to me watching a video last night which involved a number of shots of trains going left to right or right to left across the screen, and a really annoying judder as the trains went past. I was watching from an HD video file playing back on our Apple TV through Plex. Thinking it was a problem with the Apple TV I tried it through Plex on our Xbox One – same problem, and watching the raw file on the desktop, same problem again. Looking at the file it had come from a UK production company and was encoded in 1080p with a frame rate of 25 frames per second, perfectly standard UK file. So I took a look at the Apple TV. Digging into the settings I had the picture standard set to Auto, further down it said it had automatically set itself to 1080p 60Hz. There was also an option to specify which picture format to use, with a 1080p 50Hz option, so I switched that over, watched the file again, and away went the judder, switch back to auto and the Apple TV would decide to switch to 1080p 60Hz.

The basic problem seems to be that unlike the DVD Players, video recorders or BluRay players the latest generation of devices like the Apple TV or Xbox, even though many are capable of switching the resolution, automatically go for 1080p 60Hz and then behave as if the TV they’re connected to is a dumb panel that can’t cope with any other standard, as a result they then try to convert video at another frame rate in software. The judder I could see on the video is a result of the Apple TV or Xbox trying to show 25 frames per second on a device that is wanting 30 frames per second, so on smooth movements you get the judder because 20% of the frames in any one second of video are being shown twice. Knowing my TV is a European model that can cope with a 50Hz picture I can switch the Apple TV over and it works fine (not so for the Xbox incidentally) but then if I watch a North American video at 30 frames per second the Apple TV is locked in 50Hz and has much the same problem trying to handle showing 30 frames in the period when it only has 25 frames.

At this point the cinema purists are going to point out that there is another very common frame rate, with is 24 frames per second, which is the frame rate that most movies are made at, and many BluRays are now released as that standard because again a lot of TV sets these days will cope with the frame rate. So what do the Apple TV, Xbox and other TV streamer boxes do? They try and show those 24 frames in whatever frame rate the box is currently set to, and have exactly the same problem.

Going through my digital videos I have a real mixed bag. Most of the UK stuff is 25 frames per second, some where it has come off film is 24 frames per second, US stuff mostly 30 frames per second. Looking at home videos I have the same mixed bag, primarily because even though they’re all UK bought devices the cameras and phones I’ve had over the years don’t always produce UK standard video, for example iPhones using the standard camera software will consistently record in 60Hz standards – you have to resort to apps like Filmic to get the phone to record in European 50Hz standards, or even 24 frames per second if you want to work with cinema standards.

So even though world has agreed the size of a picture, there is still no agreement over how many of those pictures are shown per second. Most of our digital streaming boxes either will only work at the US 60Hz standard (the earliest Sky Now boxes were stuck on 60Hz) or are switchable but thanks to the software are difficult to switch across – the Apple TV you have to go rummaging in the settings, on the Xbox you effectively have to con the Xbox into thinking your TV can only do 50Hz pictures before it will switch – with the devices doing a second rate job when your TV is quite often perfectly capable of playing things back correctly.

Having one standard is never going to work as we’ll still have vast amounts of archive content at the older frame rates, so for the moment it would really help if the digital streamer manufacturers actually started acknowledging that there are a variety of standards – even your average US consumer who doesn’t have any 50Hz content is going to notice glitching if they watch a movie. We’ve had DVD and Video Recorders that could switch for years, why is it that the new tech seems to have taken such a massive step backwards?

Featured image old tv stuff by Gustavo Devito

Windows 8 sales figures point to sluggish start

Microsoft were looking for the arrival of Windows 8 to turn around the ongoing decline in PC sales, with the first sales numbers released, it looks like the hoped for turnaround hasn’t occurred…

Since the launch of Windows 8, sales of Windows devices in the US have dropped 21 per cent compared to the same time period last year, NPD said. Notebook sales dropped 24 per cent, but desktop sales fared a bit better with a smaller 9 per cent decline.

“After just four weeks on the market, it’s still early to place blame on Windows 8 for the ongoing weakness in the PC market,” Stephen Baker, vice president of industry analysis at NPD, said in a statement. “We still have the whole holiday selling season ahead of us, but clearly Windows 8 did not prove to be the impetus for a sales turnaround some had hoped for.”

Keeping Track of SQL Statements in an Entity Framework Code First Project

One of the more annoying omissions from the Microsoft Entity Framework is the out of the box ability to easily trace the SQL statements produced by the framework. In the past we’ve got around that using Community Entity Framework Provider Wrappers which includes EFTracingProvider that can log the generated SQL statements to the console or to a file.

However in our most recent project where we are trying Code First, it runs into a bit of a problem as the EFTracingProvider uses the ObjectContext whereas Code First is based on the newer DBContext. A trawl around the Internet can find various posts about how to get the providers to work this post being probably the most complete example. The big issue though is that they all require some degree of extra code to con the provider into working with the DBContext, and they all ran into various issues with our Code First solution, most often related to the parts where the solution generated the initial SQLServer Compact database.

However with some more digging I came across a solution in the form of the Clutch Diagnostics EntityFramework package on Nuget. The package wraps up another project, the excellent (and free) MiniProfiler which whilst it is designed for use in web projects is adaptable enough to be used in other ways. The Clutch Diagnostics EntityFramework only needs a couple of additional lines in the start up code for the application, and then an implementation of IDBTracingListener to send the traces somewhere. There are several of these available, but for our purposes it was really easy to write our own. The big advantage is that there is no need to make any changes to the DBContext, so the code can be easily and automatically removed for releases.

For an example of how to implement IDBTracingListener, check out my answer on Stack Overflow.

Microsoft Take On the iPad

Last night Microsoft announced their new tablet, the Surface. There is a good summary of the key points here: .

However it is an interesting move, as the article above says, this is a big change for Microsoft who aside from the XBox haven’t ever built hardware – you’ll never have seen a PC actually made by Microsoft for example. This however is how Apple have made their money and built their platform by tightly controlling everything.

There is still more we need to find out though, Microsoft haven’t talked prices, although we can take a fair guess that the price points will be competitive, and the release dates are a bit vague.

The other thing that may well cause confusion is that what they’ve announced is actually two machines, one is an ARM based iPad rival, the other is an Intel based PC that will be able to run normal Windows applications. Whilst you could say that Apple do the same with the MacBook Air which is a similarly portable computer, Apple clearly delineates the Air from the iPad.

Despite all the trumpeting, this is going to be a difficult sell for Microsoft, they are a long way behind, and maybe more so than in the phone market, iPad is synonymous with tablet, indeed much as people refer to vacuum cleaners as a Hoover, people refer to all brands of tablet as an iPad.

However it will certainly be a positive move if Apple has some serious competition, and whilst only time will tell whether this will be the tablet to really compete, this certainly seems to me to have a better chance as unlike Android and iOS devices there is a level of compatibility already with what is in use in corporate environments.

Replace the Replace

I grabbed this screenshot during an online conversation about some of the more bizarre coding people have seen that came about as a result of the ongoing nasty surprises Phil Winstanley (@plip) keeps turning up in his current work.

Replace the ReplaceThis picture however shows some code that used to be in one of our systems, but was swiftly coded out when we found it. It was written by a contractor who amongst other things claimed to have worked with Microsoft writing parts of the .Net Framework.

Looking at this, if you’re a .Net Framework user you’d be forgiven for thinking that he didn’t have anything to do with the string classes, however one of his other regular complaints was how inefficient parts of the .Net Framework were, hence why he needed to spend time rewriting stuff that was already there! We could find no evidence to indicate that this function was any faster than the built in string.Replace, and since having this was a confusion and maintenance overhead it was removed.

Aside from the function being unnecessary there are a couple of other things I wouldn’t do. First up is the use of “” rather than string.Empty – Brad Abrams explains why on this short blog post. Secondly the whole routine uses systems Hungarian notation which is explicitly discouraged by the Microsoft naming conventions – ironic as it was their programmers that created systems Hungarian notation in the first place. Joel Spolsky (@spolsky) has an excellent blog post here that amongst other things discusses Hungarian notation. The third thing, which is more a matter of my personal taste is that there is a single line if statement which I would usually surround with {}, partly to make it clear, and also to help with maintenance – I’ve come across one or two difficult to spot bugs caused by missing braces, so I tend to think it’s better to use them all the time.

Late to the Party – Windows Phone 7 Series

Yesterday afternoon the internet was buzzing with details of the launch of Microsoft Windows Phone 7 Series in Barcelona. Only it wasn’t really a launch, it was more a demonstration of a preview version of the platform. It’s predecessor was only launched last autumn, and this pretty well complete rewrite of the Microsoft mobile phone platform isn’t going to be available to buy until around the same time this year.

Whilst it certainly seems to have innovative features – a user interface that does things rather differently from the current favoured multiple pages of icon design that is almost ubiquitous, along with an XBox Live tie up to link your mobile and console gaming – it does seem a pretty brave move to show your rivals what you’ve got planned months and months before anything is going to be released. Even when you take into account that Microsoft are often much more open about showing preview releases of upcoming products than Apple for example, it still seems very early to be showing.

However, when you think about it, if Microsoft wants any part of the rapidly growing mobile applications market, it had to do something.

Microsoft, just like Nokia, Sony/Ericsson and all the rest were caught massively on the hop three years ago by the launch of the iPhone. Smart phones were very much of a niche market, and most regular consumers used a phone to make calls. It was possible to add applications onto smart phones, but again it wasn’t something that many people did.

Roll forward three years and the iPhone has really gone mainstream, it still surprises me how many people have them, and who they are. Many of them, even relatively non-technical are comfortable with the idea of adding applications, reading e-mail, browsing the web and playing games from a phone handset. On top of this Google has moved in on the market making waves with it’s Android operating system. Established players like Nokia have found their market share falling after years of failing to ignite the smart phone market.

Then we get to Microsoft.

They had a niche in corporate markets, and certainly I’d come across techies from time to time using (and more often than not cursing) their Windows Mobile handsets. The ability to program applications in the same languages as desktop applications certainly helped adoption. However they largely dropped the ball. Whilst they have carried on releasing updated versions of their platform they’ve largely been left behind, giving the impression – intentionally or not – that they weren’t interested, that they were happy to relinquish their market share to Apple and Google. In the corporate space Blackberry has grown, certainly in our company those users who are issued with a smart phone are issued with a Blackberry, and many of the executives ask for one by name. Any mobile applications would have to be developed for Blackberry, not Windows Mobile now, and Blackberry provide the tools to do that.

As I’ve said, the iPhone seems to have really gone mainstream, introducing a growing range of people to a smart phone, and the techie space seems to be being filled by Google Android. The iPhone is selling by the million, and producing billions of application downloads.

What Microsoft were showing looks interesting, and if they can sort out the reliability and stability problems that established wisdom say plagued previous versions it would be a good platform, but it would be a good platform if the phones were on the market now. Between now and release Apple, Google and the rest will certainly be releasing updated and new versions of their phones and software. The Microsoft gamble is that having seen the show yesterday, people will be willing to wait, and that come the autumn they will be willing to put aside the previous reputation for being buggy, put down their iPhones, Blackberry and Android phones, write off the money they’ve spent on apps for those platforms – or in the corporate environment infrastructure, and switch over to a Microsoft phone. I’m sure there will be a good few techies who will do so, but the average consumer or the corporate user? It remains to be seen.