On Software and Game Copyright and Second Hand sales.


This morning I got into a little twitter spat with a local game developer Matt Johnston. Basically he is arguing against companies like GameStop because they do not provide any revenue back to the original developers of the game. As he is a game developer, he is very obviously on the side of the games companies.

Matt made a blog article and very nicely quoted me in the article – one of the tweets during the to-and-fro conversation. Well as much as 140 characters allows.

Matt makes several points, one of which is that if we allow* a second hand market, then DRM will happen; and we don’t want DRM, so we shouldn’t have a second hand market.

(* note that it is not the right of the games companies to allow or ban it in the first place).

DRM is a red herring and not at the heart of the issue. DRM may be the games companies answer to the problem it perceives – but at the end of the day, DRM only hurts those people who actually pay for the game.

I could go onto many underground sites and find the latest games “for free”. Who wins there?

I don’t as I do believe the game should be paid for. I have a large collection of both Wii originals, and a large Steam archive.

Having said that, morally, I have a real objection to the games companies thinking they can ride roughshod over consumer rights and long established principles and doctrine of first sale.

The second hand market is both legal in the physical works *and* in the digital world. And thankfully we now have case law to back this up.

Last month, in the EU, Oracle lost a case (Oracle vs UsedSoft) trying to prevent resale of licenses to its software.

The court wrote:
“A rightholder who has marketed a copy in the territory of a Member State of the EU thus loses the right to rely on his monopoly of exploitation in order to oppose the resale of that copy.”

Further, Oracle, and Matt here, opposes further distribution based on licensing terms. The court also rejected this view, thus:
‘The principle of exhaustion of the distribution right applies not only where the copyright holder markets copies of his software on a material medium (CD-ROM or DVD) but also where he distributes them by means of downloads from his website. Where the copyright holder makes available to his customer a copy – tangible or intangible – and at the same time concludes, in return form payment of a fee, a licence agreement granting the customer the right to use that copy for an unlimited period, that rightholder sells the copy to the customer and thus exhausts his exclusive distribution right. Such a transaction involves a transfer of the right of ownership of the copy.
‘Therefore, even if the licence agreement prohibits a further transfer, the rightholder can no longer oppose the resale of that copy.’


In summary, as a gaming company, you would love to make income on the second hand sales of your games, who wouldn’t.  However, morally it is wrong.

Would you like the government to charge VAT on second hand goods? No? – they already got their cut, as have you in your first sale.

Thankfully, the law agrees with me.


Image: http://www.stockvault.net/photo/106338/video-game-controller

Borland, Farewell my sweet.

Today, May 6 2009, marks the day that Borland, that once great master of all software development has finally recognised there was no other recourse but to up and sell itself off in order to survive.

Back when I was a teenager, in the early 80s and personal computing was coming to the fore – I, and many others, aspired to work for that great company Borland. It was the pinnacle of language development and development tools and we wanted to work there. However, based in Ireland it was never to be.

Also, once upon a time I happened to be working for a very promising young company with a fantastic product line called Segue Software, based in Boston, MA.  Segue also had its troubles but a new CEO saw its fortunes turn and it was climbing to success. This success was noticed by the aforementioned Borland as it tried to re-invent itself as an Application Lifecycle Management (ALM) company.  The same day it was announced that Borland was acquiring Segue, it also announced it was selling its developer tools division (that’s Delphi, JBuilder, and later Delphi for PHP, 3rd Rail line of products).

This was such a bitter-sweet time for many.  I was overjoyed that I was going to work for Borland (childhood dream) – it didn’t matter I wasn’t going to work with the developer tools, working for “Borland” would just be cool.  Sadness also because our little 200-man company was being consumed by a 1200-man behemoth (relatively) and no-matter which way you looked at it, people were going to lose their jobs.  Pretty much the entire US East Coast staff (Segue Head Office) lost their jobs and the office was closed.  Product development labs and Technical Support survived, simply by virtue that it was the product and product skills that were purchased, not the G&A functions – they could go.

I ‘lived the dream’ for the next 2.5 years in the IT department. Despite being remote, I loved working with the rest of the Borland teams as I was intimately involved in the merging/migration of Segue’s systems into Borland’s. I also had the pleasure of working with several departments to architect and deploy several new platforms (such as product downloads and licensing via Intraware, and the companies Salesforce.com, SFDC, deployment).  I’ll treasure the time I spent at Borland.

Of course there were several WTF moments. Most significantly, for me, was the company “hanging its hat” on BMS (Business Management Solutions) which ultimately proved to be a hatstand made of jello. Very few, outside of management and that product team, believed in it.  Another significant WTF for Borland was, If you plan to be the Application LIFECYCLE Management company – why divest yourself (for a paltry $27m) of two of the world’s major AppDev toolsets (Delphi and JBuilder). You’ve just removed the feeder market and upsell opportunity into your ALM business. Finally, and internal WTF to get off my chest, on what planet does the IT department belong as a subdivision of the HR department?

Borland will live on in the hearts of many of us who knew what she used to be. I think I left Borland a better place than I found it (as long as you don’t look at the stock price ;), and I made some good friends. At the end of the day, there isn’t much more you can ask from your tenure.
It is sad that today if you ask a typical Software Engineer if they know who Borland is, they’ll respond “Who?” which typifies the company’s slide into obscurity.

I wish the best of luck to my former colleagues, who I’m sure, will be wondering what is to happen next. I also hope that the new owners, Micro Focus International (who?), have good fortune with their ALM drive. Perhaps the Borland name might live on as a brand for a suite of ALM products – who knows what they’ll do.

In the immortal words of Dr. Seuss “Don’t cry because it’s over. Smile because it happened.”

String Case Conversion in PHP

Occasionally I read through some comments on the PHP Manual, sometimes to get ideas on different methods of doing things, other times just to try to keep current with some of the vast array of functions available.

Sometimes, I see things that really scare me – code that is written and published with the best will in the world from the author – but yet displays a lack of a deeper understanding of how to solve a problem.  One such case was the invert_case() and rand_case() functions which basically looped through each character in a string doing whatever it had to do to each character as it went.  Highly inefficient.

Remember, the only difference in ASCII between an uppercase letter and a lowercase letter is a single bit that is 0 for uppercase and 1 for lowercase.

This brief tutorial is based on code available at:
and you can see example output at:

Surely it would be possible to write some code that would simply flip this bit in each character to the value you want:
– AND with 0 to force uppercase
– OR with 1 to force lowercase
– XOR with 1 to invert the case
– randomly set it to 1 or 0 to set random case.

There are two methods to achieving this, the first makes a simple character mask and performs a bitwise operation on the string as a whole to change it as required.  This method is designed to help teach how this works.  The second method uses the power of the PCRE engine by using a regex to calculate the changes and apply them in one simple step.

Both solutions are, I believe, elegant and are presented here for you.

Solution #1:


// Code that will invert the case of every character in $input
    // The solution is to flip the value of 3rd bit in each character
    // if the character is a letter. This is done with XOR against a space (hex 32)
    $stringmask = preg_replace("/[^a-z]/i", chr(0), $input); // replace nonstrings with NULL
    $stringmask = preg_replace("/[a-z]/i", ' ', $stringmask); // replace strings with space
    return $input ^ $stringmask;

The method here is to generate a string mask, in two stages, that will act as a bitmask to XOR the 3rd bit of every letter in the string.  Stage 1 is to replace all non-letters will a NULL byte (all zeros) and Stage 2 is to replace all letters with a space (ASCII 32) which just happens to be a byte with just the 3rd bit set to 1 i.e. 00100000
All we have to do then is XOR our input with the string mask and magically the case of all letters in the entire string are flipped.

Solution #2:



return preg_replace('/[a-z]+/ie', ''$0' ^ str_pad('', strlen('$0'), ' ')', $input);

Much more compact and works by using a regex looking for letters and using the i (case insensitive) modifier and most importantly the e (evaluate) modifier so we can replace by executing php code.  In this case, we look for batches of letters and replace them with itself XORed with a string of spaces (of the same length).

Similar principles apply to the random case example, but we complicate this slightly by adding and invert mask (to the solution 1 method). This invert mask is created by taking a random amount of spaces (between 0 and the size of the input string). We then pad this out to the size of the original string with NULL bytes and finally randomise the order with str_shuffle().  We then bitwise AND the stringmask and the invertmask so we create a new mask where randomly letters in the mask have spaces or NULLs.  We then XOR this to the original string as before and before you know it you have a randomly capitalised string.
The Solution 2 version requires you to remove the + so that we only match a single letter at a time (or else our randomly chosen case would apply to words at a time), and we use a termary to randomly decide on using a space or a NULL:



return preg_replace('/[a-z]/ie', '(rand(0,1) ? '$0' ^ ' ' : '$0')', $input);

I hope this has been a worthwhile read and I would certainly welcome feedback on this article.

All content © Paul Gregg, 1994 - 2024
This site http://pgregg.com has been online since 5th October 2000
Previous websites live at various URLs since 1994