I had been plagued by a nagging question while developing a PHP application: how do I calculate the difference between two timestamps, to check whether the timestamps are within x minutes of each other?
My initial solution wasn't at all perfect, although it was still better than developing an algorithm from scratch to decipher timestamps into hour/minute/second objects and coding math.
Solution 1: MySQL's TIMESTAMPDIFF()
My first solution was to use a function native to MySQL, TIMESTAMPDIFF(). This function takes in three parameters: the unit of time in which the return value will be, and two datetime expressions.
To query whether a given timestamp was within 15 minutes (either +/-) of the current UTC timestamp, I used this statement:
SELECT ABS(TIMESTAMPDIFF(MINUTE, *********, UTC_TIMESTAMP())) < 15
It worked, but I wasn't satisfied with having an extra query just to verify a timestamp. Besides, I was concerned about speed; that one query takes about 0.004 seconds to execute, which was too much for me.
Then I discovered the native Date/Time extension, built-in on PHP 5.2 and above.
See the better solution after the jump »« Read how it all started in Part 1.
Synopsis
While the initial controversy about the Thesis-not-being-under-GPL issue was focused on themes and derivative works, an unclear area that probably needs to be resolved in court, it seems there is a far sounder reason why Thesis has to be released under the GPL: it blatantly copies WordPress code.
It all started with this tweet by Andy Peatling (@apeatling):
Not a clear GPL violation, because it’s extending WordPress classes, which, in effect, copies WordPress functionality into Thesis.
Code analyses
Andrew Nacin (@nacin) started going through the code of Thesis and started to make some encouraging/discouraging tweets:
I just found a line of code I wrote for #WordPress, but in #thesiswp. Funny, when I wrote it, it was under the GPL. #
And then, an initially uncorroborated claim:
This is really pissing me off. I’m up to a few hundred lines directly lifted from WP. A part of me is crushed. #thesiswp #
And then Drew Blas (@drewblas) did an automated analysis (like I suggested
) and found clear evidence of copied WordPress code:
Impact
At this point, it seems clear: Thesis isn’t merely building on top of WordPress, it literally incorporates WordPress code through copy-paste.
That makes Chris Pearson liable to fulfill his obligations under the GPL and distribute GPL derivatives under the GPL.
Most damning
Andrew Nacin eventually found this in Thesis:
* This function is mostly copy pasta from WP (wp-includes/media.php), * but with minor alteration to play more nicely with our styling.
GPL test case? YES.
Chris Pearson indicated during his interview that he is fundamentally opposed to the GPL and will absolutely refuse to license Thesis under the GPL. By the end of the dialogue, he was practically saying “sue me”.
Matt Mullenweg responded:
Matt: Are you saying you want to be a test case for the GPL? You want us to sue you? I mean, that would break my heart. I’d rather you be part of the family.
While the themes = derivatives basis might have been shaky for a legal trial, I think the fact that there’s copied code clearly indicates one outcome in the end, in favour of the GPL.
Temporarily back to the case for themes = derivatives
WordPress isn’t the first community to issue the directive that extensions (themes, plugins) are derivatives. Joomla! did so a few years ago (I recall because I used Joomla! before finding WordPress) and Drupal makes it extremely clear.
If this matter can’t be determined by the GPL’s applicability to themes/plugins, maybe WordPress should just re-license, starting with a future version, with GPLv3 and add a specific requirement that themes/plugins are licensed under GPL.
Twitter erupted into argument last night in a fairly important battle for open source, the GPL, and WordPress. At the centre of the issue is a theme framework called Thesis which plugs into WordPress, sold with a restrictive license that does not permit redistribution.
Background
To provide some background, WordPress is a blogging platform licensed under the GPLv2, which specifically forces all copies of a work licensed under GPL, as well as derivative works, to be licensed under the GPL:
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
The Free Software Foundation explicitly addresses plugins in its FAQ, making it clear that plugins that share data structures with the main program and make function calls to each other are derivative works to which the GPL also applies.
Themes were an uncertain matter prior to last year’s legal opinion from the Software Freedom Law Center, because these works from third parties certainly build on top of the WordPress platform, but often extend it with original artwork and programming. The analysis states clearly that:
… it is our opinion that the themes … contain elements that are derivative works of the WordPress software as well as elements that are potentially separate works. Specifically, the CSS files and material contained in the images directory of the “default” theme are works separate from the WordPress code. On the other hand, the PHP and HTML code that is intermingled with and operated on by PHP the code derives from the WordPress code.
Though almost all of the other theme foundries have adopted the GPL license for their PHP code, Chris Pearson stands nearly alone in asserting the GPL’s viral clause is inapplicable to him.
Initial controversy
On a live webcast with both Chris Pearson, the developer of Thesis, and Matt Mullenweg, the founder of Automattic and the WordPress project, Chris expressed his personal belief that the viral nature of the GPL goes against his personal freedoms and rights as a developer:
Chris: One, it would require me to make a concession about something that I don’t think that I need to concede to. Why should I change? I’m protected right now. My work is protected, which it should naturally be. I want to retain that right. If I go GPL then I am ceding that right. The number one issue for me is the personal concession that I would be making. Not of any real impact to my business. I don’t want to make that personal concession, because I don’t have to. Okay?
Note: it is possible, in terms of the GPL’s legality, that Chris never had the right to prevent users from redistributing his code; if the GPL applies, a developer cannot restrict redistribution.
Matt, on the other hand, debates to defend the applicability of the GPL to themes and plugins:
Matt: … If you build a module for Drupal or a module for WordPress or a theme for WordPress or anything like that, the license says that you do have to follow the GPL. I think that it’s just a matter of choosing the platform. If you disagree with the GPL, just use a platform that doesn’t have the GPL.
I listened to all of the long back-and-forth encounter, which was interesting until Chris began to assert his importance in the community:
Chris: I’ve done great things with WordPress since 2006. I have been arguably one of the top three most important figures in the history of WordPress. You, Mark Jaquith, and myself, are the three people that I am talking about.
Wait, what? A developer whose theme accounts for such a small fraction of WordPress’s usage puts himself in the top three figures in WordPress history? Jane Wells had a similar encounter with his ego.
» See the top 10 figures in WordPress history.
Analysis of this part of the controversy
The crux of the controversy is summarized by Chris’s sentences here:
Chris: I think the license, the GPL, is at odds with how I want to distribute my software and what I want it to be. I don’t think that it necessarily should inherit WordPress’ license when over 99% of the code within Thesis is Thesis code based on the actual process of building a website.
As someone who also contributes to open source software, I can certainly understand his sentiments on the ‘infectious’ nature of the GPL, which forces derivatives to inherit the GPL. It’s pretty hard to release projects under even more permissive licenses (for example, the Apache License), or in Chris’s case, extremely restrictive proprietary licenses, when so many open source projects enforce the GPL.
That really is, though, the purpose of the GPL: to keep open source open by prohibiting its inclusion in fully closed-source or proprietary (and restrictively-distributed) projects.
Are themes derivative works?
A lot of the open source advocates and lawyers seem to think so. After all, themes do things like:
<?php if ( get_comment_pages_count() > 1 && get_option( ‘page_comments’ ) ) : // Are there comments to navigate through? ?>
and
<?php if ( $wp_query->max_num_pages > 1 ) : ?>
which show clear integration with WordPress core functionality, much like a program in C would use the MySQL library with
mysql_real_connect()
Granted, the MySQL developers explicitly allow derivatives to use non-GPL licenses even though MySQL is GPL, through an additional license exception. The reason such an exception is necessary is that they understood that works which link to library code are derivatives.
The biggest problem is that the GPL was written with compiled code in mind, where derivatives would have to bundle the libraries (e.g. DLLs or SOs) in their releases. It’s sort of unclear for interpreted languages like PHP; is it an indication of derivation if one piece of code makes a function call to another?
It’s a bit unfortunate WordPress wasn’t licensed under GPLv3, because version 3 is much clearer about what it means to make a “modified version” or a work “based on” another work. It would also make for a better court case.
Caleb Jenkins (@CalebJenkins) iterates an interesting point: dependent != derivative. While I can see this being an interesting legal argument, it would have a lot of implications for open source in general, completely contrary to the way things have been operating.
If using a dependency is not being a derivative of that work, then it is conceivable that one can produce a C application which links to a GPL library (for example, the FOSS-licensed version of the MySQL client library) without bundling it and is released commercially under a closed-source, restrictive license. It is conceivable that a PHP program might require() WordPress to use its functionality, but simply not bundle WordPress, and would then avoid classification as a derivative.
I’m afraid I can’t entirely lend my support to that argument.
People have argued that making function calls to WordPress is akin to making system calls to the underlying operating system. Unfortunately, only GPLv3 is clear about distinguishing the system and compiler libraries from other general code; of course it doesn’t make sense that every application on the GPL Linux kernel must be open source. It’s a valid argument.
However, I agree more completely with Matt’s contention that a dependency = derivation when it gets to the point that a WordPress theme without WordPress will not work (just try loading any theme’s index.php in a browser) while WordPress without any themes will still function — it won’t show anything, but its backend is still fully functional.
Chris Pearson is wrong when he says “I think that what I’ve done stands alone outside of WordPress completely.” Interestingly, read the context of this quote:
Chris: How is that? I think that what I’ve done stands alone outside of WordPress completely. Why should I respect that? It’s not that I don’t respect WordPress. I do. I only build on WordPress and push people in its direction…
» Now here: Part 2 of Tracking the #thesiswp matter.
» Also read: Why WordPress Themes are Derivative of WordPress by Mark Jaquith (@markjaquith), a lead developer.
Note: this is being posted from Windows Live Writer Beta, so please forgive any layout or text issues; if there are any, they speak to the interoperability of Windows Live Writer Beta and WordPress 3.0.
I’ve been using a subset of the new Essentials suite (beta) for the past few days. There are good things, and there are bad things. In this post, I’m only going to focus on the new Windows Live Messenger, about which I have numerous complaints.
Overall UI
Messenger has been cleaned up a lot since the previous version. The look is brighter and simpler — I dare say, cleaner. Microsoft went with a simple, bright white look instead of the faint blue gradient that was featured in Wave 3.
Full (social) view
The default look in Messenger is a large window showing contacts on the right and a wall of updates on the left relating to status messages and social networks. Windows Live profiles can now aggregate content from Facebook, Twitter, Digg, other networks, and even RSS feeds, and this full view seems to support Facebook and Myspace.
I dislike this view a lot, because in my mentality, Windows Live Messenger is an instant messaging application; I could care less about status updates. Certainly, I do not want status updates to take up more of my screen real estate than my contact list. Of course, if you link WLM to Facebook, you get a slightly more useful updates as follows:
As a result, I use the compact view. There is a button in the main window to switch between the two views.
Compact view
This look is more akin to the old-fashioned contact list we’re familiar with. The view here, of course, is customized to my liking. While I appreciate the no-nonsense look here, the ads at the bottom are just slightly distracting and annoying.
One of my minor complaints about the new look is the coloured ring around the display pictures of contacts. In previous versions of Messenger, they were bright and distinguishable. Now, it’s rather difficult to distinguish the green of ‘online’ from the blue of ‘offline’ and the orange of ‘away/idle’ from the red of ‘busy’.
Syncing files across computer has never been easier. Dropbox is one of the leading services in this field, with 2 million users and growing.
Free 2GB cloud storage
As a free user, you get 2 GB of space to start, and files in those 2 GB will be synced not only to your other computers, but also to the cloud. You can access those files anywhere you can open up a browser to the Dropbox Web site, and you can even share links to files in your Public folder to help collaboration with others.
PCs, Macs, Linux and the iPhone
The desktop software works on PCs, Macs and Linux machines; updates with great improvements come out often. For example, some of the recent versions of the software added LAN syncing, which speeds up the sharing of files between computers on the same network by connecting directly to one another instead of uploading and downloading from their servers in the cloud. Moreover, there’s now a Dropbox app for the iPhone that syncs your files on the go.
Free extra 250 MB
Try it out for free; there’s no cost to getting started. You can get a free account (2 GB) with 250 MB as a gift from me for signing up. Reliable sync and backup has never been easier.
I absolutely give up on writing about the Technical Preview for Office 2010. I’ve simply had way too many problems with it over the past two months of testing. Word’s typographic features are admirable, but I’ve seen a TON of the issues; anything from Word taking the content from a text box and showing/printing it in a different text box, and random crashes that occur when moving shapes around. Strangely, too, a Word 2010 document with an embedded font loses about 30% of its file size when re-saved in Word 2007.
There is reasonable hype about Office 2010, but I don’t recommend using pre-release versions — at least until a new one comes out — and I will also be uninstalling and going back to Office 2007. (I’ll note, of course, that I’m usually a bleeding edge software user who ignores the warnings that “pre-release software is unsafe for production use”. Windows 7 RC is my main machine’s operating system, I’m using the dev channel of Google Chrome, and I use pre-release versions of Firefox.)
In short, I’m not going to write any more about my experiences with the Technical Preview.
See Part 1 if you haven’t read it for some background. In this post:
- Interface improvements
- Aero Glass
- Ribbon
- Backstage
- Animations tab
I’ve had about 4 days now to play with the Office 2010 Technical Preview, which, according to Ars Technica, is actually a slightly older build than the most current one, and for which testers were “hand-picked”.
I did end up installing both the 32-bit and the 64-bit editions of the software, realizing that I wanted to see whether 64-bit was stable (and it seems to be). When I discovered that Office 2010′s PDF export functionality is terribly inferior to Adobe Acrobat (more on that later), I went back to 32-bit so that the Acrobat add-in would work, but discovered to my horror that it crashes Word (but more on that later).
Let’s get started with some fresh content about interface improvements. LOW-BANDWIDTH WARNING: there are a LOT of screenshots.
Interface improvements
Indeed, Office 2010 is even prettier than Office 2007, at least in my opinion. The splash screens are now animated, as demonstrated below.
Please enable Javascript and Flash to view this Flash video.On Windows 7, the titlebar blends seamlessly into the application, taking the Office 2007 look a bit further by merging it with Aero Glass. It’s a nice change.
Tip: on my blog, you can click on any image that links to the picture to see a larger version.
Some people don’t like how the colour is now white, but I don’t mind it at all. I just wish the colour schemes were actually available. In Office 2007 there was a choice between Blue, Black and Silver.
Ribbon, Ribbon Everywhere
The ribbon (also known as the Fluent UI) is now extended to Outlook and Publisher as well. (In Outlook 2007, messages and composing would take place in a window with the ribbon, but the application itself was ribbonless.)
Unfortunately, the ribbon seems to complicate Publisher, allocating valuable screen space (of which people have tons these days) to tools that will be used once or twice in the life of the workflow.
More follows the jump.
Continue reading »
This is the first part of my posts about Office 2010. Last night, I received an invitation to the Office 2010 Technical Preview, and today, I am attempting to install it on my Windows 7 RC machine.
Legal notice: since this isn’t a private beta, I am allowed to discuss the preview and my experiences with it. However, I am not allowed to share product keys, installer files, and documents to which I have access by virtue of the invitation. The contract that binds me with reference to the technical documentation quotes as follows:
You […] agree: (a) to refrain from disclosing or distributing the Confidential Information to any third party for five (5) years from the date of disclosure of the Confidential Information by Microsoft to Company/You; (b) to refrain from reproducing or summarizing the Confidential Information…
Thankfully, there’s a public pressroom for Office 2010 information, from which I was able to get equivalents of the stuff in the confidential documents. Here’s some information for you.
System Requirements
Office 2010 is designed to work on computers with very limited resources; after all, many businesses were concerned that they would once again need to upgrade their hardware. Office hasn’t really necessitated hardware upgrades in the past; Office 2003 ran very well on old Dell OptiPlex machines on Windows 2000, and Office 2007 ran quite well on older XP laptops.
The specific details are in the FAQs document.
The installers are rather compact; the Technical Preview 32-bit/64-bit installers for Office 2010 Professional are no more than 600 MB each.
64-bit editions
I’m currently on Windows 7 RC 64-bit edition, but I resolved ultimately to install the 32-bit edition of Office 2010. This is due to the following reasons:
- The 64-bit edition of Office 2010 does not support most add-ins.
Users of software with add-ins in Office programs will find that most of them do not work with the 64-bit edition of Office 2010. Software vendors are expected to release newer 64-bit add-ins, but users must use the 32-bit edition for compatibility with older add-ins. - One cannot upgrade Office 2007 to Office 2010 64-bit.
According to the technical documentation, “2007 Office system cannot be upgraded to native Office 2010 64-bit.“ - I don’t work with spreadsheets greater than 2 GB in size.
The documentation listed a number of benefits of using the 64-bit edition. The central point was being able to open large Excel spreadsheets. Since I don’t do this, the benefits of the 64-bit architecture are insignificant when it comes to Office 2010.
Screenshots of my installation will come in the next installment of these posts. That is, after I manage to install it. At the moment I’m getting the following error with the 32-bit installer, after customizing the install and even going through a few minutes of the installation progress bar.
If this persists with the 32-bit installer, I may have no choice but to try the 64-bit installation.
Update: the installer has now succeeded. More will be coming!
Update: Part 2 is here, with screenshots and commentary on interface improvements!













