Monday, January 25, 2010

Movies do well while music suffers - How to prevent piracy

Last year (2009) saw the movie industry breaking records at the box office left, right and center. From the smash-hit Avatar really making a big splash, to record-number turn outs at the cinemas making the movie industry a bucket load of cash. And yet movie piracy is still on the increase.

2009 also saw sales on the traditional music CD dropping and profits dipping for record labels. While artists revenue has increased some have commented that this is simply because artists have been working harder with schedules more stuffed with live performances than ever before.

So why is it that the movie industry is still making huge profits, even though both entertainment industries are suffering from piracy? To me, I see this as a perfect example of the value proposition that each industry's products represent to the average Joe.

When you pirate an album what do you lose out on compared to buying the original CD? Well, you lose the cover art but you can download that online too. The lyrics potentially but again, easily downloaded. Ummmmm.... You do however, depending on the record label, GAIN from piracy because you no longer need to deal with potentially draconian DRM measures that make your life difficult.

Lets look at the movie industry. What do you lose when pirating a movie as opposed to going to the cinema? Well, in short ... you don't get to go to the cinema! Sure, you can download the movie, then gather your friends at your place to watch it together. But you don't get to "go out" to the cinema! You don't get to share the mob excitement of watching this new movie. Shuffling into your seat in this vast space with other like-minded people. Have your eyes bedazzled by the enormous big screen in front of you and even experience 3D. Have a top of the range surround sound system that would cause the police to come knocking at your door due to noise complaints if you tried that volume at home. In essence, the experience of going to the movies is something substantial and meaningful to miss by just pirating to watch at home. Sure, its a LOT cheaper to just copy that movie over peer-to-peer networks than for each person to have to pay for a seat, but we pay it anyway because the experience is just not possible to duplicate. And besides, the guys who will download and not go the movies probably cannot afford the ticket prices. However, they get to watch it anyway, spread the word on awesome they thought it was, and potentially push more people to go to the cinema.

A pirated MP3 on my MP3 player sounds just the same as the original CD. So why should I shell out a lot of money for something I can essentially get for free. There is some good news, however, on the music front. A new technology called MusicDNA has been touted as the new replacement for MP3 and aims to add more to the experience of a genuinely purchased music file from valid commercial sources by embedding new content into a music file as well as meta-information that can get updated over time. This would be the right thinking amongst the record labels.

The only irreplaceable aspect of the music industry right now for customers is the live performance. You cannot download the excitement and feeling of connection with your favorite band or singer a live performance gives you by downloading it. This, in my opinion, is why artists are making more from live performances. And as I said before, people are attributing this to the fact that artists are now working harder doing more live performances. Well, of course, the only way to fulfill demand for more live shows (apart from doubling the sizes of concert venues) is to have more shows. If you have a lot more people wanting to go to the live show, you're going to schedule more of them. Totally logical. And why are there suddenly more people wanting to go to live shows? Perhaps because piracy of music has meant artists are actually getting more exposure than before because their music is being so widely distributed. An audience is being generated where previously there was no traction due to the relatively high cost of buying genuine media.

The movie industry is still breaking box office records because the cinema-going experience cannot be replicated (at least not all that easily) by piracy, whereas the music industry is essentially stuck offering the exact same thing people can get for nothing. MusicDNA is a good idea that has some merit in trying to do what the movie industry has done; create an experience people are willing to pay for that can't be replaced that easily. In addition, the music industry needs to re-invent itself around the live performance which is the closest corollary to "going to the movies" they have, as this is what people are willing to pay for.

Monday, November 23, 2009

Chrome OS: The big misunderstanding

For some reason people are mistakenly calling Chrome OS a Windows killer. The more I read the comments that come with articles on Google's newly open-sourced Chrome OS, the more I realise people don't actually read the articles. Some people will comment that they believe Chrome OS will be a replacement and actually beat other desktop operating systems like Windows or the Linux operating systems. If people actually read what Chrome OS is and what it does they would realise this is simply not the case.

Google stated pretty blatantly that Chrome OS is basically a web browser built as an operating system. It is being designed to be installed on netbook computers and will only give access to the Internet and the associated applications. Files will not be stored on the local file system as we know it today. The only local storage will be as a cache. All files are permanently stored on the cloud.

The devices that will have Chrome OS installed on them will be, according to Google, companion devices. Most people will have their traditional, full-blown desktop machine or laptop and a Chrome OS netbook. The netbook will be useful for the times you are out and about and want to quickly access your email, Twitter, Google Apps, etc.

There is a good reason for this, again according to Google. They want to create an experience with the device whereby if you happen to lose it, it breaks or gets stolen you can just pick up a new device, login and all that data is still available. Also, with no local applications they can also make the OS more secure. If there is an application running that shouldn't be there, and by default there should be no apps apart from what is included on purchase, then Chrome OS can reset the entire device. Again, all your data is stored remotely, so you lose nothing with a reset, just a local cached copy.

These features, while a great idea, mean that Chrome OS is by no means a replacement for your current desktop operating system. There are just too many things that need a desktop application that the cloud does not yet provide for. But if you're an online connected kind of person you will find use for it.

What Chrome OS may do, however, is start to push people toward the cloud a bit more. If you use a Chrome OS device, you will need to make sure your documents are stored somewhere that would be available to you over the Internet. And, if you do start storing and even working on all your documents and work over the Internet from your desktop machine, only then will Chrome OS look like a viable alternative to your current desktop OS.

This is a very clever tactic by Google, because, while the world isn't ready for running everything off the Internet right now, Google's business is the Internet, and by releasing an operating system that starts pushing people towards trusting and utilising the cloud for everything, they are inexorably increasing their reach and possibility for providing web based services to .... well everyone. Extend that a little further and this means big money potentially for the Internet giant.

Monday, October 26, 2009

Jaunty was Canonical's Vista

Jaunty Jackelope, compared to the Karmic Koala Beta I recently installed, seems to have been to Canonical what Windows Vista was to Microsoft. And both Jaunty and Vista suffered problems for the same reason; the OS's included too many new and "improved" features that hardware and software vendors just weren't ready for.

What really was the major issue with Jaunty was a newer version of the X server that eschewed the proven track record of using xorg.conf files for the auto-generated X configurations. Great idea but didn't work so well, especially for folks forced to use older graphics drivers or even anyone using ATI graphics cards and ATI's proprietary drivers. For myself, with an ATI card installed at home, it meant I had to do some rather tedious work arounds to get my graphics card working on Jaunty.

Another issue was the switch to Pulse audio being the default sound sub-system in Jaunty. Again, Pulse is great technology but people just weren't fully prepared for it. To this day I still have sound issues with my USB sound card "dongle" for my headphones, as well as issues with sound from Flash video in Firefox.

With Karmic, it looks as if the Ubuntu developers have not messed around with systems so dependant on outside support such as the graphics and sound systems. Massive improvements to the startup systems though have meant I have boot times of around 5 to 10 seconds (yes you read that right).

Jaunty was, however never an out and out disaster like Vista was for Microsoft. It had its issues, but with a 6 month release cycle, as opposed to Microsoft's years of development, things can get back on track very quickly, and Karmic sure seems to show that they are.

One of the big advantages of agile, open source development that Canonical has over Microsoft.

Wednesday, October 14, 2009

PHP Session write locking and how to deal with it in symfony

It has been a while since I last posted to my blog. My personal life has seen a lot of upheaval recently with a house move, a hiatus from Synaq, then back to Synaq, and the release of Pinpoint 2 to Synaq customers all playing a major role in eating into my personal time.

So as my comeback article I thought I would write on an issue that was plaguing us in development of Pinpoint and how, thanks to help from the great symfony community at the symfony users mailing list, we got it resolved.

The problem

With Pinpoint 2, a symfony based application we have developed here at Synaq, we employ quite a lot of Ajax requests in order to make the interface more responsive and less bandwidth hungry; why reload an entire page when you really only want a small sub-set of that page to change? A problem came about when we had an Ajax request running, and while this request was waiting for a response from the server, if a user clicked another link, that link would not "process" until the previous Ajax request had completed. What this meant to us was that it seemed that our requests were "queuing" instead of working asynchronously as they should.

On one particular section of Pinpoint, we have a number of Ajax requests loading at once, each one interrogating the database for data. Each of those requests "queued" behind each other, and any attempt by the user to go to another module resulted in waiting for each of these queued requests to complete before the browser would process the users interaction.

The cause

After going through all sorts of different possible fixes, none of which worked, I eventually submitted the above problem to the symfony users mailing list. The response that came back was that it probably had something to do with PHP session-write locking.

PHP manages sessions, this anyone who codes in PHP knows, and in order to ensure that session data does not become corrupted between requests, PHP will lock write access to the session files for a user while it is processing a request. This results in the following process if you have multiple requests coming through:

1. Request comes into server, and PHP locks session files.
2. Another request comes in but cannot access the session files because they are locked.
3. The first request processes, running all SQL, processing results, etc.
4. Yet another request comes in but cannot process because session files are locked.
5. The first response is finally finished, sends its output back to the calling function and unlocks session files.
6. The second request begins processing, locks session files and continues to do what it needs to.
7. Request three is still waiting for session access.
8. Yet another request comes in but ..... I think you get the picture.

The solution

The only way to resolve this issue is to force the requests to unlock the session files as soon as possible. Thankfully symfony has its own user session storage classes that make this incredibly easy.

The one problem is that you cannot release the session lock until after you have saved data into session that needs to be saved. Our solution was that for each action that processes an Ajax request, write everything as soon as possible to session that needs it and then unlock session to allow any other request to begin processing.

We hit a roadbump. Using symfony's $this->getUser()->setAttribute() command to store session data, we then used PHP's session_write_close() to force PHP to let go of the lock and let the next request begin work. This did unlock session but we noticed that all the data allocated to session using $this->getUser()->setAttribute() was not saved.

After a little exploration of the symfony classes we noticed that when the setAttribute() method is used, in order to speed up processing, symfony does not immediately write to the global PHP $_SESSION variable. Instead it keeps those values in an array until the end of script execution and only then writes to session. Using PHP's session_write_lock() we pretty much made it impossible for symfony to do this because to prevent session data from losing concurrency, PHP does not allow a script to write to session if the session was unlocked.

We did, however, find another method: $this->getUser()->shutdown(). This forces symfony, when the shutdown() method is called, to write session data into $_SESSION and then it also runs session_write_close() itself.

The end result

We now have actions that process Ajax requests and once all data has been sent to session using $this->getUser()->setAttribute() we run the $this->getUser()->shutdown() method. The difference was incredible and has actually speeded up our entire application a ton.

One thing to be careful of however. You do need to be sure that you call that shutdown() command at the right time, because if you call it too early, session data will not get saved and PHP will just ignore it. We had to reshuffle some code so that all the database calls and data processing functions were run after shutdown() as well.

Thanks again to the symfony community for helping to point this out and hope this helps others who may have the same issue as well.

Wednesday, July 22, 2009

Warcraft Movie is going to ROCK!

I am sorry, but I absolutely HAD to blog about this. It is now confirmed that Sam Raimi will be directing the upcoming Warcraft movie based on Blizzard's Warcraft game franchise. For those not in the know, Warcraft has been around since 1994 in the form of a real-time strategy game with two sequels and a number of expansions. It then transformed into the now massive World of Warcraft, the worlds largest Massively Multiplayer Online game, with over 11 million subscribers.

How do I know its going to be amazing?

1. The franchise lore

The storyline that accompanies Warcraft and the events that play out in its plot all the way from the 1994 RTS game to the current WoW are a move makers delight. Full of action, intrigue, drama, wars, treachery and love stories.

2. Sam Raimi

When Blizzard first publicly expressed an interest back in 2007 about making a Warcraft movie, Uwe Boll approached Blizzard saying he could direct for them. With this directors serious lack of success at game to movie conversions (anyone remember Street Fighter?), Blizzard pretty much laughed him out and told him where he could stick his offer. They then went and selected, in my opinion, one of the industries finest action/fantasy directors. Pretty much anything Sam has directed has ended up golden.

3. Blizzards neurotic caution with its IP

Blizzard has a very big reputation for ensuring that the quality of anything related to its IP is stellar. For evidence, look at Starcraft Ghost, a game that was supposed to be an FPS based version of the Starcraft universe that was never launched because Blizzard thought it wasn't good enough. The expansions for World of Warcraft were also supposed to only take a year each and notoriously took a lot longer because Blizzard wanted to ensure a quality product. Starcraft 2 as well was supposed to be released last year but was delayed because again, Blizzard wanted it perfect.

I have no doubt they will employ the same tactic with the movie and not allow it to be released if it ends up being a load of crap.

There have also been numerous comments around by people who are not as in love with the Warcraft universe as I am, or the 11 million other players of WoW, and believe that only die-hard fans will watch it. Personally I don't think this is the case. The same was said about Harry Potter and yet more people have watched the movies than have read the books or even knew about the books. The lore and storyline that exists within the Warcraft universe is so broad and appealing that it should be a great movie to watch regardless of if you have ever seen or taken part in the games.

So come release day I will be at the front of the ticket buying queue and happily settle down in front of the big screen with popcorn and drink to be absorbed in a universe I have come to love.

Lok'tar Ogar!!!