Saturday, April 16, 2011

The biggest PR clanger in the history of the WWF

We will, wherever possible, seek dialogue and avoid confrontation.
We will record and respond to criticisms we receive, in order to learn from, and avoid repeating mistakes.

From: WWF Code of Ethics

In the past, the WWF has had its fair share of controversies. Condoning and even promoting animal testing and hunting (the former chairman of the WWF, the late Prince Bernard of the Netherlands, was known to take a shot every once in a while himself), interfering in the internal affairs of sovereign states, deporting indigenous peoples, neo-colonialism, collaborating with large companies like Coca Cola, Microsoft, Proctor & Gamble, Hewlett-Packard and Eneco in order to - you won't believe it - "protect the environment", not being so green all of a sudden when it comes to raising cash, supporting genetically modified crops, manipulating scientific research, and finally: making not very tasteful adds.

With a list of controversies like that you start to wonder how they survived. Well, very easy: by having a very good PR department. Whenever a controversy pops up WWF acts like a turtle. It minimizes communication as much as possible and hopes the whole thing blows over. It tries to silence, marginalize or intimidate its critics, but in such a clever way that it doesn't make too many waves. Disputes between its chapters are kept indoors as much as possible. Bluntly lying - if required - is an accepted practice.

Being one of the opponents in their latest controversy - the infamous WWF format - I experienced these tactics first hand. This is my story.

When the "Save as WWF" campaign was launched, WWF Germany created a Facebook page. I guess they never expected that it would cause so much controversy, because critics like me could vent their objections freely and add all the links and pictures we wanted.

The first indication that something fishy was going on came on December 21st when Jon Fenell reported that some contributions were missing. WWF denied everything, saying that were not censoring the site. They had just changed the settings.

In short, only the contributions of "Save As WWF" were shown by default, which meant that each time you had clicked a link, you would have to reset it again. It made browsing, let's say, a little uncomfortable. WWF pulled off that trick several times, changing layout and settings with some bizarre defaults, although - admittedly - Facebook made changes to the page in the meanwhile as well. The first thing going (of course) was the "links" section.

In the first week of January I released the .wwf toolkit, which the WWF initially seemed to applaud. Maybe later they realized that this terribly simple piece of software allowed conversion both ways or maybe it was because they had tried to make their audience believe that supporting Linux was incredibly complex, I don't know. Anyway, after that everything changed.

Sabine Schikorra-Känder tried to convince me that is was all about cuddly panda bears - and who is against that. Of course, I didn't buy that and repeated my arguments again. Note that my objective was to get the WWF around the table and discuss their actions. Despite the many letters and invitations from various organizations and individuals that never happened, but at that moment I was still optimistic. Sabine Schikorra-Känder remained polite, which could not be said of Romy Mlinzk. She called me a troll and despite my efforts to discuss the issue at hand, she persisted in her behavior.

So I set out to find who Romy Mlinzk was. After working my way through many uninteresting personal pages with many flagrant spelling errors, I found out that she was in fact a professional. Not a very good one though, because she should know as a self-proclaimed "social media expert" that it is not wise to leave so many intimate personal details lingering in cyberspace. But I also found the smoking gun: at the time she was working for Dederichs Reinecke & Partner, the company that handles the social media for "Save as WWF". If that isn't enough evidence for you, here is a message she left admitting she was directly involved with the "Save as WWF" campaign.

There even is a presentation of her on the internet, where she describes her experiences with this campaign in detail and has the nerve to call me her "favorite troll" - obviously miss Mlinzk has neither a clue of what the definition of a troll is nor of what "social media" (her so-called "expertise") are all about: interaction. Even with those who don't agree with you.

As if insulting me wasn't enough, "Save as WWF" threatened me the very same day to kick me off their Facebook page. Things were getting ugly. In the final weeks of January I was cranking out new releases of the .wwf toolkit by the minute, getting lots of feedback of obviously satisfied users.

In the meanwhile, the paper industry had launched their own "green initiative" which was a direct response to the "Save as WWF" campaign. WWF Italy started a collaboration with forest managers to "develop awareness on the issues of sustainable management of forest resources" and "promote (..) the purchase of forest products"!

I was quietly hacking .wwf tools to make them work under Windows as one of my users had requested. Since "Save as WWF" had initially shown so much enthusiasm for my initiative, I decided to post several links and pictures at their site - just to see that they disappeared almost instantly! Wow.. I thought they didn't censor or was I being a bit too naive?

So I decided to take my business elsewhere and complain at a site which another user accurately described as "the place where WWF complaints go to die". This is where the WWF channels all criticism. You are kindly treated by a spin doctor who gives you a lot of credit for your remarks, let's you blow off some steam and that's it. I'd rather be talking to ELIZA, she's a much better listener. To give you some idea of how this works, here is a little sample:
Thanks for the heads up on this. We're in the process of correcting it to give credit where credit is definitely due. Apologies for the oversight.

I see you have also posted your comments there. Many thanks for doing that. It is good to have your point of view in there.

But it is great that you air these opinions and get the opposite point of view across. We link to Get Satisfaction from every page on our site - so people can find this string and weigh up the arguments for themselves.

Thanks for giving your input. I know it may seem easy to say, but truly: it is valued and it is heard.

I had also pointed out on Facebook that most users didn't like the WWF drivers, so "Save as WWF" decided to spike the results by asking their friends to push "the green thumb" button, a method well known by the readers of the Dutch "Geen stijl" blog, who are known to sabotage just about every single poll in the Netherlands - and abroad if they get the chance. Not something you would expect of the respectable WWF, wouldn't you?

Until recently, most of the criticism came from information technology blogs and the paper industry. But even advertising agencies have started to pick up the "Save as WWF" debacle. Also the mainstream media are slicing and dicing the initiative, saying the people behind it "have an arrogance that doesn’t help their cause" and that "whole concept of unprintable files is ridiculous" in itself.

The latest scam of "Save as WWF" was exposed by Marco Fioretti who showed that WWF Germany is still frantically trying to save face by slightly modifying publications of WWF International. Still, the influx of "friends" at their Facebook page has been reduced to a trickle. Although "Save as WWF" have promised to come out with a new version shortly - as they have numerous times - the question is: will anybody remember or even care enough to make it worth the effort? Or does it even make it through the virus scanner?

It seems that what has been called "the biggest PR clanger in the history of the WWF" is slowly coming to an end. Finally. Rest in peace.

In the end, where was the FOSS all about, after over 12,000 Facebook friends and these "hundreds of thousands" of downloads? 394 documents. Yes, that's it: 394 documents. Count them.

And yeah, a handful of them are mine. Go figure..

Update: Even though the "Save as WWF" campaign was nominated twice it don't win any of these awards. I wonder why..

Update: Jung von Matt won the ADC Grand Prix 2011, I'm not going to deny that - nor attempt to hide my astonishment. I don't know where these people live, it must be a different planet.

Update: Still, the WWF won't go all the way to preserve forests:
In its first year of existence, the organisation's website netted over $100,000 for rain forest protection through the sale of paid memberships. In their first six months of existence the group received seed funding from the government of Norway. They are the world's first eco-porn organization. However, the organisation's unorthodox methods have made it difficult to distribute the money it makes. The Norwegian chapter of the Rainforest Foundation Fund as well as the WWF both in the Netherlands and in Norway have refused to accept donations from FFF. As a result, F**k for Forest is working on a project to work directly with indigenous communities in Costa Rica and the Brazilian Amazon rainforest.

At least the members of this organization are doing it to each other: not to their donors or indigenous people. The link is environmentally safe: it points to Wikipedia.

Update: Those who think I've simply thrown all the dirt I could find to the WWF, think again. Recently, the German WDR network released a documentary which proved I didn't even have to search that long. It caused a major embarrassment to the WWF in Germany, causing it to lose many donors. Try to print yourself out of that one!

Update: This comment was published here. It is allegedly written by someone working at Jung von Matt. Although I have been unable to confirm it, it gives a unique insight on how these marketing agencies think and operate:
(Disclaimer: This is an idea which originated in an advertising agency from Germany and was later brought forward to the WWF. I work for that agency, but had nothing to do with the project.)

WWF is available for Windows, but it's only prominently presented for OS/X on the website. Of course a roll-out covering all OS's would be great, but that's unfortunately not how advertising agencies work. While the idea is in it's core great for the planet, the motifs are mostly utilitarian. "Clever" ideas like this score high at award shows and push the agency up in the creative rankings. Therefore it's important for the agency to pump out projects like this onto the market, just developed enough to be regarded as a "real" product which can be entered into award shows.

But upon detailed inspection these ideas are often still lacking in execution. In this case it was important to launch as quickly as possible and just having an Mac version (which was easiest to produce) was good enough. Oftentimes that's where development stops and when the awards are won the projects will no longer be cared for. In the case of .wwf the agency had to provide a Windows version just because people demanded it and the WWF probably said so. That's why the layout for the website hasn't changed to accompany prominent buttons for both Mac and Windows versions, but just received a measly text-link update.

This of course is a pretty f**ked up way of seeing things and I totally disagree with it. I have always tried to put real meaning into the advertising I co-create, sometimes successfully, sometimes less so. The big and established advertising agencies have an insanely hard time to part with their (long gone) successes of showing the message on to the consumer. They just don't get that the Internet is a completely new way for people to communicate and that consumers want to be talked to like intelligent people with a will of their own.

But all is not bleak. There is a new generation of insanely talented and motivated people who see the need to change this old thinking really quickly, or risk a great fall.

Anyways, that's the reason why the project feels as if it's not completely thought through and will probably not grow any bigger. At least not as long as someone else than the agency is in charge.

Well.. That explains a lot! The WWF page, their Facebook page and the software themselves have never been updated after they collected their prizes - despite all their lofty promises. Again: as I predicted.

Update: LOL! I announced the minor update of the .wwf toolkit in the "Save as WWF" Facebook page, which hadn't been updated for months. Next day, the "Discussions" tab was removed. Obviously, nobody needs support anymore. You're on your own!

Update: It seems there are two winners here: the advertising industry and the printing industry. Losers are the WWF, who really took a beating last year and the poor users who believed an organization that never seriously considered to support them. Net result: lots of frustration and some broken machines. Pity.

Update: A list of over 50 incidents concerning WWF (German). When you're contemplating to give this rather murky organization another dime.. I wonder whether Doutzen Kroes is aware of that or whether she's just in it for the money.

Sunday, February 13, 2011

Using original WWF artwork on your Linux box

Disclaimer: This information is for educational purposes only. If you perform the procedure described here, you assume full responsibility for any and all consequences, including legal action from the copyright holder.

Of course you can create original artwork for .wwf on your Linux box, but wouldn't it be nice if you can use the professional artwork Matt von Jung created for this? But how do you obtain it? Very simple: use the OS/X package. First, download it. Then unzip it:
cd SAVE_AS_WWF_1.0.pkg/Contents

The next step is to decompress the .pax archive:
gzip -d Archive.pax.gz

This seems like a dead end, but it isn't. The .pax archive is simply a cpio file:
cpio -i < Archive.pax
cd 'SAVE AS'

We need the .icns files. That seems like a dead end as well, but not quite. We're almost ready. If you want to extract the icons on your own machine you have to install icns2png, which can be obtained here. Installing it is pretty straight forward:
tar -xzvf libicns-0.7.1.tar.gz
cd libicns-0.7.1
make install

It prefers you install Jasper or OpenJPEG, but I didn't have much luck with that. You don't need it either unless you want to extract the high resolution icons. After you've installed it, enter:
icns2png -x wwf.icns
Reading icns family from wwf.icns...
  Saved 'is32' element to wwf_16x16x32.png.
  Saved 'il32' element to wwf_32x32x32.png.
  Saved 'it32' element to wwf_128x128x32.png.

Done! You can also extract the icons online. It depends on what you prefer, the result is the same.

If you need still another format, use ImageMagick better known to some as convert. Now install the icons in the appropriate directory (that depends on your desktop environment) and you're done. Enjoy!

Monday, February 7, 2011

How to reheat 30 year old spaghetti

A long time ago, when I was still a student, I got my hands on a very fascinating book called "The effects of nuclear weapons" from the Atomic Energy Commission. It was filled with diagrams and tables and enabled you to calculate the effects of a nuclear attack. After five long hours, I got my first results. And it was 4 AM. I knew when I stayed on working and calculating, I was gonna lose a lot of sleep.

However, it was 1981 and at my college we had a highly modern machine: a real PDP-11 with a massive memory of 256 kB and two (floppy) disk drives. Those were the days of the NATO Double-Track Decision, which large parts of the Dutch population opposed. I decided this program was going to be my contribution to that discussion. I called it TEONW (The Effects Of Nuclear Weapons). It is full of cynic puns against the Reagan administration.

I spend nights digitizing the graphs in that book, and coding them in BASIC V10B-02. I had never heard of structured programming and to debug the program I needed a room as long as the listing. If the program said GOTO 5670 I really crawled to line 5670! I never got all the bugs ironed out.

After I had finished college I no longer had access to a computer, but I printed a listing which I entered line by line in the Sinclair ZX Spectrum. I also added some assembly to mimic the green-on-black terminal of the PDP-11.

When the Z80 Spectrum emulator of Gerton Lunter came out, I took the Betadisk, wrote BDDE (BetaDisk Dump Extractor) and transferred the program to a .Z80 file, which may still be found on the Internet. Ten years had gone by.

The .Z80 file was moved from MS-DOS to Linux. I extracted the code with FUSE-utils "listbasic" and made it run under "blassic". By then twenty years had passed.

In the meanwhile, I had been busy writing my 4tH compiler, which is a highly portable bytecode Forth compiler. A few years ago, I added floating point support. What had begun its life as a little toy was now powerful enough to run a program like TEONW. Thirty years later.

TEONW is a relatively small program, just 13 kB source, but it is such an awful mess that I was barely able to understand and code the entry of the basic parameters: yield, altitude and population density. If I ever wanted to convert this program I needed some help. Badly..

TEONW consists of about 500 lines, each with its own line number. Since it is written in Minimal BASIC, every IF-statement is followed by a GOTO. No ELSE, sorry. In order to expose the structure, I needed to get rid of all superfluous labels, i.e. the labels which were not jumped to by either a GOSUB or GOTO. For that I wrote a simple 4tH program, the "uBasic unlabeler" or ubulabel.4th for short. It parses the BASIC program, makes a list of all GOTO and GOSUB labels and then removes all unused labels. That reduced the number of labels to about 100.

But I had still very little insight in the structure of the overall program. Comment was scarce and terse. Instead of making a flow diagram myself, I decided to let the computer do that for me. If you talk about generating diagrams, you talk about Graphviz. This indispensable tool has saved my life more than once - and it would save it once again.

Generating Graphviz code is trivial. I had written Graphviz converters before and I didn't doubt for a moment that I could pull off this one. 4tH excels in parsing text and I didn't even need a full parser here. Just REM, GOSUB and GOTO. Since 4tH also features a conversion program template, all I needed to do was to fill in the blanks. ub2dot.4th was born.

It is basically a very simple 50-lines program. It keeps track of the line it is parsing and when it encounters a GOSUB or GOTO it generates a Graphviz line. Of course, if no GOSUB or GOTO is encountered, it simply executes the next line. That had to be taken into account as well. But this rule has an exception as well: if the last statement is a GOTO or RETURN, the next line will never be reached from that point.

I generated the diagram from the .DOT source, which resulted in this diagram. The black lines are jumps, the red ones are subroutine calls and the blue ones represent normal program flow.

That may not give you much insight at first glance, but when you look carefully, you see some patterns arise. E.g. the code to present the results of the calculation are at the bottom. You can clearly see the different sections for underground explosions and air blasts. At least it helped to chop up the code into manageable chunks.

Since the underground explosions took the least effort, I decided to code that one first. At least it allowed me to set up a basic structure for the program and test it. But first I had a few design decisions to make.

Since this was an all floating point program I decided to use the 4tH Preprocessor (pp4th). Floating point support is coded in high level 4tH, which is not supported by 4tH itself. This meant the code would be rather unreadable. The preprocessor however does offer special floating point facilities, like the entry of floating point numbers without tedious conversions.

4tH offers two floating point libraries. One is rather bulky and fast with a high precision and its own floating point stack, the other is lean and slow and uses the standard data stack. The latter stores the numbers on the stack in standard form, i.e. mantissa and exponent, which is easy to read - if you know what you're looking at. Another added advantage is that it is easier to convert to the dedicated floating point stack version than the other way around.

Forth is a language that is centered around a data stack. It is considered good style to use as few variables as possible. There are non-trivial Forth programs that use only one or two variables or even none at all! However, given the complexity of the task at hand, I decided to use the stack as little as possible and revert to the BASIC variables instead, 25 in all. I never regretted that decision.

Note I had digitized a lot of graphs and these now popped up as clusters of jump instructions, e.g.:
587 IF J2<=-5 THEN GO TO 2007
590 IF J2<=0 THEN GO TO 690
600 IF J2<=5 THEN GO TO 730
605 IF J2<=12.5 THEN GO TO 770
610 IF J2<=25 THEN GO TO 810
630 IF J2<=40 THEN GO TO 840
640 IF J2<=55 THEN GO TO 880
650 IF J2<=62 THEN GO TO 920
660 IF J2<=84 THEN GO TO 960

These were restored to their original table form:
create calc-under
  620 , ' under>62 ,
  550 , ' under>55 ,
  400 , ' under>40 ,
  250 , ' under>25 ,
  125 , ' under>12.5 ,
   50 , ' under>5 ,
    0 , ' under>0 ,
  -50 , ' under>-5 ,

:this calc-under does>
  >r begin fdup r@ @c s>f f% 10e f/ f<=
  while r> cell+ cell+ >r
  fdrop r> cell+ @c execute

The second entry in the table is a pointer to function, in short: a jump table. The greatest challenge however, was to recreate the spaghetti program flow in structured programming, e.g. from this:
1592 IF J2>=-5 THEN GO TO 1594
1593 GO TO 1596
1594 IF J2<=0 THEN GO TO 1980
1595 GO TO 1600
1596 IF -J5/(J1^.4)>200 THEN GO TO 1600
1597 IF M(1)>M(2) THEN GO TO 1980
1599 IF M(2)<200*(J1^(.4)) THEN GO TO 1980
1600 LET S5=INT ((((((M(2)/1000)*(M(2)/1000))*PI)-(S4/J3))*(J3*.75))+S4)

To this:
J2 f@ f% -5e f<
  height f@ fnegate yield f@ f% 0.4e f** f/ f% 200e f>
    S4 f@ density f@ fover fover f/
    1 m f@ f% 1000e f/ fdup f* pi f*
    fswap f- fswap f% 0.75e f* f* f+ ftrunc S5 f!
    1 m f@ 0 m f@ fover f> >r
    yield f@ f% 0.4e f** f% 200e f* f< r> or
    if casualty-corrections then
  J2 f@ f% 0e f>
    S4 f@ density f@ fover fover f/
    1 m f@ f% 1000e f/ fdup f* pi f*
    fswap f- fswap f% 0.75e f* f* f+ ftrunc S5 f!

I must admit, sometimes I was so desperate that I took refuse to some unconventional techniques in order to get an idea what for Petes sake I was trying to do - thirty years ago.

When I first ran it, it failed obviously. The tedious task of debugging was about to begin. I quickly decided that I would need some special debugging aids in order to complete this task, so I wrote a short routine in both BASIC and Forth that allowed me to examine the variables at certain stages of execution:
9000 PRINT "yield=";J1;" J2=";J2;" density=";J3;" J4=";J4
PRINT "height=";J5
PRINT "P1=";P1;" P2=";P2;" 210J=";R1;" 42J=";R2
PRINT "crater-radius=";S1
PRINT "crater-depth=";S2;" crater-rim=";S3;" S4=";S4;" S5=";S5
PRINT "V1=";V1
PRINT "V2=";V2;" V3=";V3;" V4=";V4;" V8=";V8
PRINT "W1=";W1
PRINT "W2=";W2;" W4=";W4;" Z1=";Z1;" Z2=";Z2
PRINT "Z4=";Z4
FOR N=1 TO 5: PRINT "M(";N;")=";M(N);" "; : NEXT N: PRINT: RETURN

Now you understand why I was so happy that I kept with the original variables instead of going for the full Forth conversion! All in all the basic conversion proved to be pretty good. Only one piece of code needed a full rewrite.

Am I finished yet? No, debugging takes a lot of time - but I'm not in a hurry. At some point in time I will have enough confidence to send it into the world. Hopefully, I will have given it another thirty years of useful life. Time, it wouldn't have had if I had left it in this state.

And that would have been a pity, because it is the oldest program of my hand that survived this long. The rest was left decaying on an ancient 8" floppy. Missing in action, presumably dead. But even if they had survived, would I be likely to repeat this exercise? No, probably not.

Reheating spaghetti takes a lot of time. It's better to cook some fresh pasta. ;-)

Thursday, February 3, 2011

Running shellscripts under Windows

Although many programmers look down on shell scripts, they can be an effective way to quickly realize the required functionality in a minimal amount of time. Especially if you want to tie several already available utilities together.

So when I set down to make a FOSS equivalent of the abysmal and closed source WWF drivers, shell scripts seemed the way to go. I already got PDFtk, Ghostscript and the Poppler utils, so all I needed was a bit of glue between them.

The people at the "Save as WWF" Facebook page wanted a GUI, so I had to throw one in. That wasn't much of a problem either, because we got KDialog, Zenity and Dialog, which cover pretty much all the desktop environments around. Starting with a skeleton script I had once posted I was able to release the first version at Freshmeat within a single day. Several releases followed after the first enhancement requests came in. Until that day..

A user asked me whether a Windows port was possible. Wow.. MS-DOS batchfiles are so crippled that converting them was not an option and I am unfamiliar with the newer Windows scripting facilities like PowerShell. Since I use Windows very little I didn't feel like learning that one. So I asked myself the question, can I run the scripts within Windows?

Running them within Windows means you have to fool them into thinking they're running in a Unix environment. Since it seemed pointless to let users install hundreds of megabytes just to run a couple of shellscripts I settled for MSYS. MSYS is just a few megabytes and offers almost all the Unix commands and facilities you're familiar with. Furthermore, it does a pretty good job of silent conversion between the Unix and Windows PATH conventions.

The next question was, can I get Windows ports of all the utilities required. The answer is yes, there are ports of Zenity, WGET, Poppler utilities, Ghostscript and the PDF toolkit. All bases are covered, now let's rock 'n roll!

To my surprise the installation script almost worked out of the box. The only thing was that whoami is not part of MSYS. I know that you use id -un nowadays, but that wasn't much help, because although id correctly returns my Windows login, I used whoami to see if the script was running with root privileges. I decided to make my own whoami in /usr/local/bin, doing a simple echo. That didn't seem like much of a problem, because if the Windows user in question wasn't running with admin privileges, he wouldn't come that far anyway.

The second thing I had to fix was the #!/bin/bash line. MSYS doesn't "have" bash, only sh. Since sh is simply a link to bash, I decided to change it to #!/bin/sh. A few unquoted environment variables posed another problem, but that was quickly fixed. Finally, Ghostscript comes with a whole lot of Unix shellscripts, which I decided to use. Unfortunately, there are two annoying problems:
  1. Ghostscript isn't added to the PATH;
  2. The Ghostscript shellscripts assume gs is installed, which isn't.
The first one was fixed by adding the lib directory of Ghostscript to the PATH and the second was fixed by scanning for the Windows executable and create a small gs shellscript in /usr/local/bin. Then it ran like a charm.. from the prompt!

The Windows version of Zenity is very good, installing it is a breeze. It adds the Zenity executable to the path automatically. But in order to make it run as advertised you have to wrap the whole thing in an MS-DOS batchfile. Since the shellscripts are installed in /usr/local/bin I needed that path in the PATH, which you achieve by adding the --login switch to sh.

I decided to generate all these tiny scripts and batchfiles from the Windows installation script and that was the moment I really stumbled into the annoyance of Windows backslashes. The backslash is Unix' escape character, which makes it particularly difficult to handle. To write a Windows batchfile I decided to use the following sequence:
echo -n "bg_start ..\..\bin\sh.exe --login -c wwf2pdf" > /usr/share/wwftk/bg_wwf2pdf.bat
echo -e "\r" >> /usr/share/wwftk/bg_wwf2pdf.bat

The -n switch suppresses the terminating linefeed, while the -e switch enables the expansion of special control sequences. Which in this case results in the familiar carriage return-linefeed sequence.

The BGstart utility is required to suppress the launching of the sh window, which is featured so prominently in some ported FOSS programs. A few shortcuts and we're done. The icons for the shortcuts were converted online. Quickly and painlessly. And then it ran. Or did it?

The backslashes were back with a vengeance. Zenity returns a Windows path, which is gracefully handled by MSYS, but when it was displayed all backslashes disappeared or made the messagebox look very queer.

I never wanted special Windows versions of the scripts, the idea was that one version runs anywhere. So, how could I transparently handle this one? The answer was one single line:
SHOW=`echo "$3" | sed 's|\\\\|/|g'`

This one converts any embedded backslashes to slashes. Why slashes, you may ask. Well, first it settles the matter once and for all and second, it reminds the Windows user he owes this functionality to a Unix script.

Of course, there are many things that could be improved. A true Windows installer may make it all much easier for the casual user, but again, I'm not prepared to put so much effort into a skill I rarely use. Furthermore, if people think it is important they will step up and solve it. Because this is FOSS.

I'm now looking for someone who does the port to OS/X, so we cover the entire spectrum. If only to prove that the community does a better and faster job than a closed source company..

Monday, January 31, 2011

Installing the .wwf toolkit under Windows

Converting a PDF file to .wwf is so trivial under Linux that a bunch of shell scripts is enough to perform that task. When a user asked me whether it could be ported to Windows I was bewildered. Running Unix shell scripts under Windows means you have to trick Windows in thinking it is running a Windows program and the shell scripts in thinking they're running in a Unix environment. But all components were available for Windows, so I decided to give it a try. Note I tried Win98 as well, but that didn't work. You will need WinXP at least.

First, you have to download all components:If you don't know what your Windows directory is issue this at the prompt:
echo %windir%

You can get a prompt by starting cmd.exe. I will refer to the Windows directory as C:\WINDOWS.

Installing WGET
Place the executable in C:\WINDOWS - or whatever your Windows directory may be.

Installing Poppler-utils
Unzip the archive and place all executables in C:\WINDOWS.

Installing PDFtk
Unzip the archive. You will only need the files in the bin directory. Place pdftk.exe in C:\WINDOWS and libiconv2.dll in C:\WINDOWS\SYSTEM32. Be sure not to overwrite previous versions!!

Installing Zenity
Simply accept all defaults, including the path. Install it on the C:-drive if you can, it will make your life much easier.

Installing BGstart
Simply accept all defaults, including the path. Install it on the C:-drive if you can, it will make your life much easier.

Installing MSYS
You may also take the newer 1.0.11, but note that version has packaging errors. Simply accept all defaults, including the path. Install it on the C:-drive if you can, it will make your life much easier.

Finally, a console will pop up, posing you two questions:
  1. Will you continue the postinstallation [YES]
  2. Have you installed MinGW? [UNLIKELY]
If you installed MinGW before (which is a C-compiler) you probably already have MSYS anyway.

Installing Ghostscript
Simply accept all defaults, including the path. Install it on the C:-drive if you can, it will make your life much easier.

The Windows-version of Ghostscript fortunately comes with Unix scripts of the major utilities. They are all located in the lib directory. You have to add this directory to the path so MSYS can find them. That's not very hard. Simply click the "My computer" icon, then click "Control Panel" and finally "System".

Choose the tab "Advanced" and click the button "Environment variables":

Choose "System variables", then "Path" and add the directory in question up front. Usually, this will be something like C:\Program files\gs\9.00\lib.

Installing .wwf toolkit
MSYS has left an icon on your desktop. Click it. Then navigate to the wwftk-1.7.tar.gz archive. You can use cd as usual, no need to change drives. Note backslashes become slashes and drives become directories, e.g. H:\download\wwftk-1.7.tar.gz becomes /h/download/wwftk-1.7.tar.gz. If the path contains embedded spaces, enclose it with double quotes. Assuming the archive is located at H:\download, issue:
cd /h/download
tar -xzvf wwftk-1.7.tar.gz
cd wwftk-1.7/Windows
sh c

If Ghostscript wasn't installed on the C:-drive adjust accordingly. If all goes well, you'll see the following screen:

After that, .wwf tools is installed.

Post installation
You probably want to start the .wwf tools from the screen. All you have to do is to make two shortcuts. First, click right on the desktop and select "Shortcut":

Second, choose "Browse" and navigate to C:\msys\1.0\share\wwftk\bg_pdf2wwf.bat.

Third, choose a name for this shortcut. I prefer PDF2wwf.

Basically, the shortcut has been created now, but it is not very attractive. Right click it and choose "Properties".

Click "Change icon" and "Browse".

Navigate to C:\msys\1.0\share\wwftk.

Select wwf128.ico.

Select the appropriate icon and press "Ok". Repeat the same procedure for wwf2pdf and you're done.

Wednesday, January 26, 2011

The WWF driver gets competition

A user on the "Save as WWF" Facebook page asked me whether I could port the .wwf toolkit to Windows. It took some research, because emulating a Unix environment on Windows is very quirky, but I did it. I posted some screenshots this morning, but they were not amused. Within hours they were taken offline, despite their promise not to censor. Obviously, they don't like the competition. And for good reason..

First, the .wwf tools allow you .pdf to .wwf conversion. And vice versa. That is by design. Second, you can choose whether you want that banner or not. The WWF driver always appends that free WWF advertisement to each and every document it processes.

And despite some rumors, it cannot be disabled. That is by design. Third, the .wwf tools produce much smaller files. Finally, it doesn't phone home. Feel free to examine the code.

In the meanwhile, the WWF have acknowledged they are violating the BSD license which comes with the OS/X PDF reader "Skim". They promised a new version. Yeah, right..

Their bug ridden Windows driver is still at v1.03. Release Candidate, that is. I'd rather use a beta of .wwf tools.. ;-)

Friday, January 14, 2011

The .wwf format in practice

This week I promised myself to put the .wwf format to the test. So, I sent a .wwf file to my girlfriend at work and I distributed all documents at work that I didn't find worth printing in the .wwf format. These were the reactions I got:
  1. My girlfriend wasn't even able to open it, because the MIME-type wasn't known in her Vista installation.
  2. I p*ssed off a very expensive consultant at work who ordered me to send a printable version or I'd have to look for another assignment.
  3. A colleague of mine who prints virtually everything sent it to another nerd colleague of mine who returned a printable version of the document using my "cracking" pages.
I asked them whether they had become more "aware" of the issue at hand. Most thought it was merely a nuisance, others said they would never donate a dime to the WWF anymore.

Update: For some reason unknown, WWF Italy is now collaborating with forest managers to "develop awareness on the issues of sustainable management of forest resources" and "promote (..) the purchase of forest products"!

Update: As I predicted, the WWF violates FOSS licenses.

Update: The WWF have promised to comply to the "Skim" BSD license. As always, I'm not holding my breath. Even with a buglist the size of your arm, their Windows driver is still the same old v1.03 Release Candidate.

Friday, January 7, 2011

How to use the .wwf toolkit

DISCLAIMER: This software does NOT originate from the WWF. It is neither supported nor approved by the WWF in any way, shape or form.

The .wwf toolkit is a very simple, but versatile piece of software. If you don't want to use a GUI, you can simply run it from the prompt:

Which is fine if you want to include it in another shell script or do some batch conversion. You can add the -n switch to override the default banner settings or -q if you go for the highest quality PDF possible. The flip side of using this option is that conversion is slower, it generates slightly larger files and worst of all: it may not always work for you.

If you want to integrate it in your GUI, you have to install either KDialog (included in KDE) or Zenity (Gnome). I'm (still) using KDE3, but I'm sure there are similar facilities in other desktop environments. The best way to run them from there is to include them in the menu:

Now the only thing you have to do is to select it:

You can also add .wwf as a mimetype and associate wwf2pdf with it:

Now open your filemanager and navigate to the .wwf file in question. Select wwf2pdf and click it:

wwf2pdf will start and create an unprotected PDF file on the fly, which you can open right away.

This way, converting those .wwf files into something useful will take only a split second of your life. Of course, you can do the same thing for pdf2wwf as well.

Legal stuff
A question I've been getting a lot lately is, "do I have to conform to the WWF "terms of use" when I produce a file with your toolkit?"

Well, first of all: I'm not a lawyer, this is NOT legal advise, so you better consult a professional before willfully violating the WWF terms. I can give you a few general guidelines, but the short answer is: yes.

The official WWF drivers for Windows and OS/X are copyrighted material, so if you use them you are bound to the WWF terms by default, because they are part of the license. It doesn't matter whether you agreed to the license or not - the license is the only thing that gives you the right to use the software. Period.

If you use the .wwf toolkit (with all its GPL components), you're obviously not bound to the WWF software license, but you may still be bound to the "terms of use", as I will explain later on.

The files the .wwf toolkit produces are industry standard PDF files. PDF files are an open standard (ISO/IEC 32000-1:2008) and even if the WWF driver would add some proprietary stuff to its files, it isn't included in the files the WWF toolkit creates.

Well, the WWF might argue that the combination of extension and PDF format is their invention and consequently proprietary, but that is a long stretch by any measure. As far as I know no patents have been filed.

The only part left is their copyrights and trademarks. Trademarks are the most troublesome thing here, because it's also the least tangible kind of intellectual property. Even engine sounds (Harley Davidson), smells or colors (BP, T-Mobile) can be trademarked.

As far as I know, there has never been issued a trademark or any other intellectual property protection for a file extension alone. Furthermore, the .wwf extension is already in use and has been in use for a long time:However, if you include any of their trademarks in your files, you're bound to their terms. That means, the panda bear, the "Save as WWF, save a tree" slogan or their "Save as WWF" tree icons. Note that even a simple uppercase "WWF" is protected, so choose your names carefully!

That is, if they exist. Neither a search with the Swiss trademark organization, nor the German trademark organization, nor the European trademark organization gave any hits for "Save as WWF". As a matter of fact, no trademarks have been entered after August 4th, 2010 for "One Planet MBA".

Matt von Jung, WWF's advertising agency in Germany, has applied for several figurative marks (3020100743719, 3020100743727, 3020100743735 and 3020100743743) on December 18th 2010 at the German Trademark Office (DPMA). Since they are still just applications, the trademarks itself are still unspecified.

Thus, the "terms of use" are in fact a license to use their trademarks. Nothing more, nothing less. The .wwf toolkit license (GPLv3) has nothing to do with it.

There is no © sign or "Copyright" text on their banner, which is required in some countries - but not the US. And here is where local legislation comes in, which makes this issue legally particularly fuzzy, especially when "moral right" is concerned. But again, it boils down to trademarks.

In those countries (where a © sign is required) you could probably get away with your own banner as long as you don't use any of their trademarks, so it is perfectly clear to a casual observer that:
  1. It doesn't originate from the WWF;
  2. The word ".wwf" is only used to identify the file type and its properties.
My advise? The WWF is known for aggressively defending its trademarks, so why take the risk? Most users will never produce files that remotely violate the "terms of use" stated. And if you do, simply don't add the banner. Or even better: make it a PDF. Same thing, different extension.

Admitted, it is rather scary that a company can decide what you can and may produce with their software. Imagine Microsoft, stating in its EULA that you cannot use Internet Explorer to surf to porn sites?

Fortunately, there is always FOSS between you and the proprietary world. And that is a comforting thought..

Thursday, January 6, 2011

What the WWF has to learn about FOSS

The WWF must have understood by now that you cannot enter the realm of software development without finding the FOSS community on your way. Where and when software is concerned, FOSS is a force to be reckoned with.

For example, the French April organization, dedicated to the promotion of FOSS and open standards, sent a letter to the WWF, voicing the same objections as Tracy Anne of LXer and other members of the FOSS community:
Re: request for a meeting concerning your campaign "Save as WWF, Save a Tree"

Madam President,

The April organization is dedicated to the development and promotion of free software. It tries to make people aware of the dangers of leaving certain information and knowledge in the hands of private enterprises. Free software - like GNU / Linux operating system and office suite - is designed to ensure that users have control over their own computer.

It was with some surprise that we learned of the WWF initiative to create a new file format, which is just a PDF using DRM to disable printing.

We understand the need of the WWF to draw attention to the ecological impact of computers and even support it. However, we regret the the WWF have resorted to DRM for this purpose. In effect, the WWF format is merely a PDF format with restricted functionality, designed to constrain the user.

DRM is not only ineffective but are also detrimental in many ways (technical, economical, cultural). These issues were recently addressed in an April publication, which I've included.

However, although the goals themselves are laudable, the form this initiative has taken is regrettable for several reasons. The fact that this format is based on DRM, a secret format locked by means of cryptography, makes it impossible to read with free software. Moreover, the WWF disregards users of free software, since the software in question is only available to proprietary systems like Apple MacOS X and has not been released under an Open Source license.

In addition, WWF should note that the lack of interoperability is a major contributor to obsolescence. Obsolescence is in the interest of the manufacturers, since it promotes consumerism, which causes many environmental problems if not properly controlled. This initiative is therefore catastrophic. For example, if I want to read a WWF file and I can not get the software required to read it, the only thing I can do is to buy a new computer that does. Because computers are so quickly outdated and consequently so quickly replaced, the ecological impact of these "gadgets" is particularly detrimental.

Finally, it is regrettable that WWF seeks to address social problems by means of coercive technology. Because DRM is primarily there to enable publishers to interfere with the privacy of their clients.

Because we really want to help you to make the public aware of the ecological impact of computer usage, I propose a meeting in order to discuss the subject. The WWF may approach the Free Software Foundation on an international level. Couchet Frederick, Executive, and the team at April are available for more information.

Madam President, I'm hoping to see you soon.

Yours truly,

Tangui Morlier
Chairman of April

The WWF have promised to publicly address these concerns, but don't hold your breath..

In the meanwhile, there is not much help from the industry either. Rick Brown, senior director, product management, Acrobat Solutions said: "Adobe Acrobat allows customers to create PDF with a range of security permissions, including the ability to disallow printing. The .wwf format is based on the PDF standard and it is great to see WWF leveraging PDF in creative ways. At this point, we don’t intend to support the .wwf file extension."

As if that is not enough, the software itself is giving the WWF headaches as well. In addition to their OS/X driver the WWF recently published their Windows driver. It features the following annoyances:

Consequently, as of January 5th an overwhelming majority of "Chip" readers dislike it. Note that the OS/X version has its problems too.

It seems it will be some time before the WWF will release a Linux version. But wait a minute: Linux is already supported! Yes, a set of simple bash scripts was able to fill the gap, simply because the FOSS ecosystem is very rich already. And it is performing very well.

In a test performed by Hermann Radeloff this file was printed using the WWF driver, which resulted in this file. The same file generated by the Linux .wwf toolkit resulted in this file. In short, a 104 KB file was bloated to a massive 686 KB file, while the Linux .wwf toolkit reduced it to a meager 95 KB. That is: with WWF banner.

So WWF, why not release the mess you made under a free license and let the FOSS community take care of it? Why not work together? Or would you rather persist in continuing this public relations disaster?

Update: Well, it's come to this: the WWF have threatened to kick me off their Facebook page. Obviously, I've gone on their nerves. For those who want to make up their own mind, here is the full thread.

Update: I've just released the .wwf toolkit manual as .wwf. FOSS style. ;-)

Update: Neither a search with the Swiss trademark organization, nor the German trademark organization, nor the European trademark organization gave any hits for "Save as WWF". As a matter of fact, no trademarks have been entered for the WWF after August 4th, 2010 for "One Planet MBA".

Matt von Jung, WWF's advertising agency in Germany, has applied for several figurative marks (3020100743719, 3020100743727, 3020100743735 and 3020100743743) on December 18th 2010 at the German Trademark Office (DPMA). Since they are still just applications, the trademarks itself are still unspecified.