Wednesday, December 30, 2009

Random ideas for XINS and Logdoc

Here's a random list of possible enhancements to XINS.

First, a couple of changes that would make it much easier to configure an IDE (such as Eclipse or NetBeans) to work with XINS:

  • Move all Java source code to src/java/; currently it is spread out over src/java-common, src/java-client-framework and src/java-server-framework. Still, the JAR files can remain the same.
  • Put the generated Java source files also under src/java/, such as the Log and TranslationBundle classes.
  • Put all generated class files under build/classes/.
  • Make the Library classes detect the XINS version at runtime, instead of using a text replacement technique to modify the source code before compiling it.
Then some ideas on Logdoc:
  • Split out Logdoc from XINS. It's not needed inside XINS, all it needs is a JAR file and some Ant tasks for generating some stuff (like the Java source files and the documentation).
  • Make it easy to plug in a different logging library. Currently, Logdoc generates Log4J code, but it should be fairly simple to make it generate code for other logging libraries. It doesn't mean Logdoc should actually implement this, but it would at least facilitate it.
To be continued.

Monday, December 28, 2009

XINS 3.0-alpha1 tagged (fork at Github)

Just now I've created a tag for XINS 3.0-alpha1 in my XINS-fork at GitHub:
From a runtime-stability point of view, I expect this release just works, even if it is tagged as an alpha-release. At least for me this branch has been running in production for a couple of years now.

However, do note that from a development perspective, a lot of things may change before this goes into (or becomes) an official XINS 3 release. This requires agreement with other involved parties, especially Anthony Goubard (official XINS maintainer) and Online (copyright owner of most of the code).

Some of the things still high on my TODO-list:
  • get rid of all deprecation warnings by either resolving or suppressing them, depending on what is more appropriate
  • further change the code to use type-safe collections where possible, using generics
  • merge with official XINS 2.x changes

Command line input in Java


Today, someone introduced me to Spring Roo, which has quite some similarities with XINS at first glance. I really like the command line shell interface Roo has, featuring unbuffered text input, completion and fancy colors. I know it's not even close to a rich IDE like NetBeans or Eclipse, but I love command line tools for their productivity and simpicity.

Looking at some documentation, the text-based shell interface is implemented using these technologies:

  • JLine - Library for handling console from Java, unbuffered.
  • JAnsi - Library for using ANSI escape sequences to format console output.
  • JNA - Windows-specific library for displaying colored output on Windows-systems.

Both libraries work on Windows, Mac OS X and Linux/UNIX-systems. Definitely worth considering in case you want to implement a console application in Java.

PS. Upon further inspection, Roo is very different from XINS, though. Roo is an aspect-oriented build-time code generator/manager that generates JSPs, Spring code, Java plumbing code (such as toString() methods), while XINS is an RPC-oriented component technology framework that also has (optional) runtime components (both client- and server-side, if you wish).

Thursday, October 1, 2009

XINS 3.0 fork at Github

Just recently, I've made our internal XINS fork available via:
The version is currently set at 3.0-alpha1-dev. This may become the official XINS 3.0 release at some point, or (some or all) changes may go into an official XINS release.

The most important changes in compared to mainstream XINS are:
  • Java 5-features, such as generics and foreach-loops (hence Java 5+ is required)
  • lots of utility functions are added, to simplify programming with XINS
  • various libraries are updated, such as Saxon (from 8 to 9) , JUnit (from 3 to 4), Xerces, etc.
  • a couple of previously deprecated members and classes are removed, most notably FastStringBuffer and FastStringWriter
  • deprecated various classes and members, such as the ElementBuilder class
  • upgraded from XSLT 1.0 to 2.0
  • the Element class now supports mixed content (PCDATA and child elements), an add(String) method has been added
This branch of XINS has been used in production for almost 3 years now, but you are not advised to use this code in production, as it has not gone through all the testing that is typically done for an official XINS release, across various platforms and Java versions.
Also note that not all of the changes in XINS 2.2/2.3 have been incorporated (yet).

The following things are still on my list of things to be done:
  1. clean the code up further
  2. get rid of all deprecation warnings by either resolving or suppressing them (whatever is more appropriate)
  3. further changing the code to use type-safe collections where possible, using generics
  4. possibly adding Commons Lang as a dependency, so that various utility methods, like TextUtils.isEmpty(String) can be deprecated (and later removed)
  5. change HttpClient (which is deprecated) based code with HttpComponents HttpClient based code
  6. get rid of Jakarta ORO, just use the J2SE regular expression-support that is available since J2SE 1.4
If you have any changes you would like to incorporate into (this branch of) XINS, fork the project at github. Using git, it is quite easy to merge different forks.

To be continued.

Tuesday, September 22, 2009

Weird error while executing LessCSS

This is really odd: I got the following output while running lessc on some .less files from an Apache Ant task:
-lesscss:
[003:221] MagicCam 0: Current process: java, Flash is loaded: no
[003:221] Error(magiccammac.cc:276): MagicCam 0: MagicCamOpen: Not an allowed process!
[000:002] MagicCam 0: Current process: java, Flash is loaded: no
[000:002] Error(magiccammac.cc:276): MagicCam 0: MagicCamOpen: Not an allowed process!
[000:001] MagicCam 1: Current process: java, Flash is loaded: no
[000:001] Error(magiccammac.cc:276): MagicCam 1: MagicCamOpen: Not an allowed process!
[000:002] MagicCam 1: Current process: java, Flash is loaded: no
[000:002] Error(magiccammac.cc:276): MagicCam 1: MagicCamOpen: Not an allowed process!
[lesscss] 0 file(s) transformed in 4 ms; 7 unmodified file(s) skipped.
Now I had it at a different point in the build process:
do-generate-headings:
Warning: Reference saxon.classpath has not been set at runtime, but was found during
build file parsing, attempting to resolve. Future versions of Ant may support
referencing ids defined in non-executed targets.
[xslt] Processing /Users/ernst/albizia/build/contentdb/pfizer/content/PreprocessedSite.xml to /Users/ernst/albizia/build/contentdb/pfizer/content/PageHeadings.ErigeronStrings.xml
[xslt] Loading stylesheet /Users/ernst/albizia/src/build-xslt/GeneratePageHeadings.xslt
[xmlvalidate2] 1 file(s) have been successfully validated.
[000:224] MagicCam 0: Current process: java, Flash is loaded: no
[000:224] Error(magiccammac.cc:276): MagicCam 0: MagicCamOpen: Not an allowed process!
[000:003] MagicCam 0: Current process: java, Flash is loaded: no
[000:003] Error(magiccammac.cc:276): MagicCam 0: MagicCamOpen: Not an allowed process!
[000:000] MagicCam 1: Current process: java, Flash is loaded: no
[000:001] Error(magiccammac.cc:276): MagicCam 1: MagicCamOpen: Not an allowed process!
[000:002] MagicCam 1: Current process: java, Flash is loaded: no
[000:002] Error(magiccammac.cc:276): MagicCam 1: MagicCamOpen: Not an allowed process!
There is a tiny bit of information here:

Tuesday, September 8, 2009

OptiPNG Ant task

OptiPNG is a tool for optimizing PNG images. And now, there's an Ant task for executing it from an Ant build file:
Mini-HOWTO for Linux/UNIX/Mac OS X systems, assuming you already have Apache Ant installed:
  1. download OptiPNG source code from SourceForge (TAR GZ file)
  2. execute: ./configure
  3. execute: make
  4. execute: sudo make install
    (enter your password if required); the command optipng is now installed in /usr/local/bin/
  5. download the optipng-ant-task source code from http://github.com/znerd/optipng-ant-task/downloads - take the latest version available (you can choose between a ZIP and a TAR GZ file)
  6. unpack the download file, this will create a new directory with an odd name like: znerd-optipng-ant-task-604de975b4cc4a1a2766e385c91b749318af038e (you may want to rename it to optipng-ant-task or so)
  7. in that directory, execute: ant
    this will compile the classes, run the available unit test and build the JAR file
Then you can use the Ant task from your own build file, for example as follows:
<taskdef name="optipng" classname="com.pensioenpage.jynx.optipng.OptiPNGTask" classpath="lib/optipng-ant-task.jar" />
<optipng dir="src/htdocs" todir="build/htdocs" />

Thursday, September 3, 2009

Java language: referencing current class from static context

Currently, in Java SE 6, to reference the current class from a static context the name of the class is needed. For example:
public class Foo {
public static final valueOf(String s) {
if (s == null) {
return null;
} else if (s.startsWith(Foo.class.getName() + ':')) {
...
} else {
...
}
}
}
However, if this code would be copied to another class, or if the class is renamed, then that code will cause issues, possibly even causing hard-to-find bugs.

Instead it would be nice if the enclosing class could be referenced without using the name. A possible syntax that does not introduce new language keywords could just be:
class
The previous example would then become:
public class Foo {
public static final valueOf(String s) {
if (s == null) {
return null;
} else if (s.startsWith(class.getName() + ':')) {
...
} else {
...
}
}
}
Of course, this construct should also be allowed in non-static code.

One open question is how to deal with inner classes and referencing a certain outer class. I would not mind keeping that out of scope, so the feature only allows referencing the direct enclosing class.

Another issue is subclassing. Would the class statement reference the current class (in case of a non-static context) or the one the method is defined in?

Improving Ant output

Ant is a very popular build tool in Java environments. Numerous tasks have been developed for it that allow integration with various services and products quite easy.

One area Ant could improve in is output. Running a typical build file produces a lot of output that is not really relevant to the user. Also, when an error occurs, it would be nice to have a stack trace giving more information, but then you need to rerun Ant with the -verbose option, which enables verbose output for all tasks, not just the failing one.

And note that there may be situations in which rerunning the task is suboptimal:
  • the error does not occur again (but it may come back to hunt you later on)
  • executing the build takes a lot of time
Here are some guidelines I propose for improving Ant output:
  1. keep output to stdout very limited;
  2. after completion of the build run, provide access to more output, including the stacktrace, without rerunning the task
Here's an example of some Ant output:
-init-properties:

-init-site-properties:

check-questions:

transform-questions-xml:
[xmlvalidate2] 10 file(s) have been successfully validated.
[xslt] Transforming into /Users/ernst/albizia/build/contentdbsrc/xsite/content
[xslt] Processing /Users/ernst/albizia/build/contentdbsrc/xsite/content/AOW.QuestionsCategory.xml to /Users/ernst/albizia/build/contentdbsrc/xsite/content/Vragen_AOW.SourcePage.xml
[xslt] Loading stylesheet /Users/ernst/albizia/src/build-xslt/PreprocessQuestions.xslt
[xslt] Processing /Users/ernst/albizia/build/contentdbsrc/xsite/content/Berekenen.QuestionsCategory.xml to /Users/ernst/albizia/build/contentdbsrc/xsite/content/Vragen_Berekenen.SourcePage.xml
The output from the xmlvalidate2 task is very brief. That's nice. In fact the question is whether the output should be shown at all. The output from the xslt task, however, is quite verbose. Instead of listing all files being processed, it could just give a summary of what it did. When -verbose is passed, it could output what is currently output.

Here are some possible options for achieving the goals I stated above:
  1. When a certain Ant option is enabled (which could at some point be enabled by default), send all verbose output to a file on the file system, for example build.log or .build.log. This file can be examined by the user after the build is finished (or cancelled).
  2. When using the default output mode for stdout, do not output the names of tasks that are not actually run (depending on the if and unless attributes).
  3. By default make all tasks just output a single line with a summary of what it did.
  4. Do not put an empty line between each executed task.
  5. When using this mode, use fixed-width output for the target names, and put the task output behind that. Target and task names may have to be cropped for that. For example:
    -init-prope.:
    -init-site-.:
    check-quest.:
    transform-q.:xmlvali.: 10 file(s) validated.
       xslt: 15 file(s) processed, 0 unmodified file(s) skipped.
Note that the output Ant 1.7.1 currently produces when running Ant with the -verbose option is always available after the build run, so the reduction of initial output is not limiting the investigation options for the user, but is in fact extending those.

What do you think of this? Do you consider the current Ant output too verbose or just fine? Have you every had issues examining why an Ant build failed and you wish you would have passed -verbose in the first place? And what do you think of the suggested changes?

Converting ODS to CSV

Recently I've released an ODS (OpenDocument Spreadsheet) to CSV (Comma-Separated Values) converter. It's available from GitHub:
The current version (0.1) is not perfect, I've documented some issues, mainly related to empty fields/records being output. After releasing version 0.1 I created some unit tests; once they pass, these issues should be resolved.

During development, it turned out it's really easy to parse an ODS file, since it's just a ZIP file with the contents contained in simple XML file inside it.

The converter uses SAX to parse the XML inside it, to minimize memory usage. It comes with a Java library, a command line program and an Apache Ant task. And there are no external dependencies other than a Java runtime environment (version 1.5 or up).

Monday, August 24, 2009

Weirdest user agent string (updated)

Investigating a reported bug with one of our PensioenPage websites (IE 8 being detected as IE6) I found out the cause of the issue: An IE8 instance returning the following user agent string:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SIMBAR={B81922DF-CABA-4976-8A80-B27BE01CAC7C}; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; Creative ZENcast v2.01.01)
Note that there's both MSIE 8.0 and MSIE 6.0 in the string! This is the weirdest user agent string I've ever seen.

Update (August 25, 2009): And I'm not the only one seeing this kind of agent strings, I just noticed a FancyBox mailing list posting with a similar one:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; InfoPath.2)
And if you search for "Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0;" on Google, you can find a lot of similar ones. It's a strange world.

Thursday, August 20, 2009

Vim syntax highlighting for lesscss

Here's a quick HOWTO for enabling vim syntax highlighting for .less (lesscss) files:
  1. Create the directory ~/.vim/syntax/ if it does not exist yet.
  2. Download the vim syntax file less.vim into that directory, e.g. with the command:
    wget http://leafo.net/lessphp/vim/less.vim
  3. Make sure the following statements are in your ~/.vimrc:
    syntax on
    au BufNewFile,BufRead *.less set filetype=less
That's all.

Update (Sept. 25, 2009): Here's a screenshot:

Ant task for invoking lesscss (updated)

Update (August 26, 2009): I've polished the Ant task for LessCSS files quite a bit and implemented support for both lessc and plessc (the LessPHP alternative).

Features:
  • converts .less files to .css
  • supports both lessc and plessc (at least one is required)
  • supports time-outs
  • only processes changed files
  • supports separate source/target directories, with include/exclude patterns
It's available under de BSD-license for download from github: http://github.com/znerd/lesscss-ant-task/.

Notes:
  • for lessc (tested lessc v1.1.13) to work to fail properly when lesscs fails, a minor change to one of the lessc files is required, this may be resolved in an upcoming version of the task and/or an upcoming version of lessc
  • plessc v0.1.6 works well with the task, but has a rather annoying bug related to negative background positions.
Below is the original blog post.

Here's some sample code for implementating an Apache Ant task for invoking lesscss:
import java.io.File;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.taskdefs.MatchingTask;

public final class LesscssTask extends MatchingTask {
public LesscssTask() {
setIncludes("*.less");
}

private File _sourceDir;
private File _destDir;

public void setDir(File dir) {
_sourceDir = dir;
}

public void setToDir(File dir) {
_destDir = dir;
}

@Override
protected void execute() throws BuildException {
for (String inFileName : getDirectoryScanner(_sourceDir).getIncludedFiles()) {
File inFile = new File(_sourceDir, inFileName);
String outFileName = inFile.getName().replaceFirst("\\.less$", ".css");
String outFilePath = new File(_destDir, outFileName).getPath();
String inFilePath = inFile.getPath();

log("lesscss: From \"" + inFilePath + "\" to \"" + outFilePath + "\".");

Execute.runCommand(this, new String[] { "lessc", inFilePath, outFilePath });
}
}
}
After defining the lesscss task in your build file (using a taskdef) invoking it is as simple as:
<lesscss dir="src/htdocs" todir="build/htdocs" />

Installing lesscss on Gentoo Linux

Here's a short HOWTO on installing lesscss on Gentoo. As root, execute:
  1. emerge --sync (or skip this if you know you are relatively up-to-date)
  2. emerge rubygems
  3. gem install less
That's all.

Friday, August 14, 2009

Prefetching files using jQuery

Since years, Gecko-based browsers have supported link prefetching, while other browsers (notably Internet Explorer) are lacking this function.

Here's a simple JavaScript-based work-around based on jQuery:
$(document).ready(function() {

// Prefetch all files referenced in [LINK rel="prefetch" href="xyz"] tags...
var $prefetchTags = $('HEAD LINK[rel=prefetch][href]');

// ...starting with the ones that can be done asynchronously via AJAX...
$prefetchTags.filter('[href$=.txt],[href$=.js],[href$=.html]')
.each(function() {
$.ajax({url: this.href, dataType: 'text'});
});

// ...followed by all referenced images,
$prefetchTags.filter('[href$=.png],[href$=.jpg],[href$=.jpeg],[href$=.gif]')
.each(function() {
new Image().src = this.href;
});
It looks for all LINK tags in the HEAD section of the HTML document that have rel="prefetch" set.

Then it processes all HREF attributes, but treating text files and images differently, since text files can easily be downloaded using asynchronous HTTP requests (a.k.a. XMLHttpRequest or AJAX), while this method is not well-suited for fetching binary files.

This approach may be a bit rough on the edges, since I've only done limited testing, on Fireefox 3.0/Mac and MSIE 8.0/WinXP.

Wednesday, July 15, 2009

Reducing IE 6 support

It's well known that IE 6 is causing a lot of grief for Web Developers. Recently, Digg announced they will reduce support for IE 6.

Now, Youtube is also announcing they are reducing IE 6 support. They are actively advising IE 6 users to upgrade to either IE 8, Google Chrome (of course) or Firefox 3.5.

See this image:
In my opinion, this is an excellent development. End users as well as system admins should be pushed to migrate to more standards-compliant browsers. I realize this will have a significant impact on some companies, especially with IE6-specific intranet sites.

Wednesday, July 1, 2009

Advanced testing for equality in Java unit tests

Testing the equals method
When testing Java classes, a common requirement is that the equals(Object) method works properly. When using JUnit, this can be as simple as:
import static org.junit.Assert.*;
:
assertEquals(a, b);
However, you may want to test that not only a considers itself equal to b but also vice versa. With a single assertEquals call this won't work, so you add:
assertEquals(b, a);
Perfect, right?

Possibly. What if the test fails? How do you determine what the equals method actually considers a difference? The comparison algorithm can be quite complex, involving several instance fields, including collections, maps and XML snippets.

Differences for humans
It would help if the class would describe the differences in a human-readable manner. Here's how: Declare an interface VerboseDiff (or whatever better name you can come up with) with just one method that describes the differences between this object and the specified argument. It returns null if there are no differences:
public interface VerboseDiff {
String describeDifferences(Object obj);
}
Then change your implementation classes to implement this interface and implement the equals method as follows:
@Override
public boolean equals(Object obj) {
return describeDifferences(obj) == null;
}
Your describeDifferences method could be implemented as follows:
public String describeDifferences(Object obj) {
if (obj == null)) {
return "obj == null";
} else if (! (obj instanceof ThisClass)) {
return "obj is not an instance of ThisClass, but an instance of class " + obj;
}

ThisClass that = (ThisClass) obj;

if (that._baseValue != _baseValue) {
return "baseValue of this object (" + _baseValue + ") is different from base value of argument (" + baseValue + ')';
}

return null;
}
Now your unit tests can look like this:
assertEquals(null, a.describeDifferences(b));
assertEquals(null, b.describeDifferences(a));
Further reading
A final tip: Implementing a good comparison algorithm that is in line with the contract of the equals method is typically not straight-forward, especially if you need to deal with subclasses. The article How to Write an Equality Method in Java (at artima.com) covers the topic excellently.

Tuesday, June 30, 2009

More CSS with Less

The people at Sitepoint send me a 'Tech Times' newsletter every now and then. I tend to ignore newsletters from most other companies, but this one is different, it is surprisingly interesting, most of the times.

Today's Tech Times (issue 246) informed me about Less, an improvement over regular CSS that adds variables, mixins, operations and nested rules to regular CSS. It's backwards compatible and compiles to regular CSS before you serve it to your favorite user agent. Wow.

This is definitely something I intend to integrate into the work flow for the PensioenPage technology, right before optimizing the (normal) CSS using the YUI Compressor.

Firefox 3.5 released

If you didn't know already, Firefox 3.5 was released today (June 30, 2009).

Of course, the PensioenPage technology is ready for it, even detecting the version properly, check out the source code:
www.pensioenpage.com/?_indent=true
Note that the _indent=true enables indentation in the source code.

Tuesday, June 23, 2009

Combining CSS and user agent sniffing

Avoid sniffing if you can
User agent sniffing is bad and that's known. So avoid it if you can.

However, in some cases a browser is just acting weird and you cannot ignore that, it needs some specific CSS instructions. Internet Explorer 6 and 7 are prime examples here.

The old days: CSS hacks
In the past, this was resolved with odd CSS filters (better known as hacks), constructs that were known to work in some browsers and be ignored in some other browsers. To do this well, you need to know about the quirks of all browsers. This is not scalable, with new browsers coming out all the time.

Alternative: Sniffing and CSS classes
Here's an alternative: Use server-side agent sniffing and put the results in a class attribute in the HTML. This allows you to write CSS rules like:
.Browser-Opera ul.ModList li {display:block}
or even:
.BrowserOS-MacOS-10.Browser-Firefox-3-5 li.FooBar {margin-left:2px}
To see this in action, have a look at the source code of the PensioenPage site:
www.pensioenpage.com
or, with indentation enabled in the source code:
www.pensioenpage.com/?_indent=true
Note that the user agent sniffing we implemented has more than 160 unit tests, detecting (Mobile) Internet Explorer, Opera Desktop/Mobile/Mini, Firefox, the old Netscape browsers, Chrome, Safari, Maxthon, etc.

Operating systems detected include Mac OS X, various Windows versions, BSD variants, Solaris, Linux, the iPhone OS, etc.

Finally, the browser engine is also detected, allowing rules like this one:
.BrowserEngine-Trident div.Tip {padding:0}

Wednesday, June 3, 2009

The new OS challenge: data integration and synchronization

Today's OS challenge
In the past, operating systems had a limited function, synchronizing access to internal and external hardware, file systems, memory, processes, etc.

Nowadays, user's demands far exceed these 'simple' requirements, expecting data integration and synchronization. People use different (portable) machines, applications and different (online) storage realms, and these all need to integrate in a customer-focused manner.

Examples: image manipulation, bookmarks, data exchange
For example, on Mac OS X images can be manipulated with all sorts of relatively cheap programs these days (e.g. Skitch, LittleSnapper, Acorn, Pixelmator, Picturesque, etc.) All these programs have a different focus and provide different functions, with some overlap. However, when you try combining the functions of these programs, you are facing a real challenge. What format do you use for data exchange? PNG is a good choice for one-way image manipulation, but then don't try changing something in the middle of your process.

This challenge becomes even larger when you try exchanging vector images between multiple applications, like Keynote, Pages, NeoOffice, Novamind, Microsoft Office, etc. Both SVG and OpenDocument are formally standards, but they are currently far from practical for inter-application data exchange. On the Mac platform, EPS and PDF are typically the best bets. An established practical standard is lacking.

Another example is your bookmarks. How do you synchronize your bookmarks between Firefox, Safari, Opera and Internet Explorer? Each vendor starts to deploy his own web-based synchronization service (MobileMe, Opera Link, etc.) and there are some that go a bit further already (XMarks, Delicious) but we need one solution for all browsers that integrates with different operating systems.

Finally, notice how online data exchange services have started to emerge. For example Quicksnapper, Skitch.com, MobileMe, Flickr, YouTube, etc. These services make it easy to share data over the internet, but they are typically focused on one type of data (images or video, for example) and fail to integrate with different sorts of applications. Their focus is typically limited.

Dropbox is a positive exception here, providing a generic data exchange experience that is seamless across Mac OS X and Windows platforms, transparently working with all sorts of applications and providing limited history/backup/versioning support. However, optimally, applications should be adjusted so they recognize and support this platform.

And what if you want to view and edit your files on the fly from your mobile device, like an iPhone?

Network computer?
In the past, companies like Sun MicroSystems attempted to resolve these issues with a largely closed environment: the network computer, sporting a central server for sharing all applications and data. Although there are still (business) environments where this is an excellent solution, the majority of the customers requires more choice and an open system.

Operating system support
This is where an operating system like Mac OS X can make a big difference. OS X is already much appreciated for the system-wide services it provides, like spell checking, hyphenation, speech, etc. But these don't go far enough.

For application interoperability, Apple should extend their vision, provide a platform and produce some guidelines. These should enable application developers to write interoperable programs that support tomorrow's applications, collaboration and synchronization tools and data exchange methods, including versioning support.

This may require a strategic shift, as Apple is currently trying to make money off MobileMe, which is a closed and proprietary platform that has limited features and is based on an expensive yearly subscription model. Such a model is hardly suitable for large groups of customers that will look elsewhere for their data exchange requirements.

Monday, April 27, 2009

Failed to install Parallels Tools 4.0 in Kubuntu Linux 9.0.4 (updated)

I tried to install Parallels Tools 4.0 inside a fresh Kubuntu Linux 9.04 installation, but it failed. The log tail is:
make[1]: Leaving directory `/usr/src/linux-headers-2.6.28-11-generic'
Installation of kernel modules was finished successfully
Start installation of user space modules
X server: xorg, v1.6.0
Install X modules from directory: .1.6
System X modules are placed in /usr/lib/xorg/modules
Error: there is no X modules for this version of X server
Error: failed to install user space applications and drivers
Any suggestions?

Update (April 28, 2009): This is a known issue, see these posts at the Parallels forum:

Favourite Mac OS X feature requests (updated)

Here are some of my favourite Mac OS X feature requests, just aimed at improving my efficiency when using the Mac:
  • when replying to a sent email from Mail, make sure the To:/CC: addresses are the same as the original (currently, in Mac OS X 10.5.6, the To: address is set to my own address);
  • make the Finder allow me to show folders first;
  • allow me to put mount points in the Locations bar in the Finder (currently only folders below the mount points can be put in there);
  • make Cmd-` work while dragging from a Finder window, inside the Finder (perhaps this is even a bug on my system?);
  • allow me to configure Dashboard widgets are pre-started before I activate the Dashboard, this saves me quite some time;
  • resize windows from any corner - at least make this an option;
  • in the Finder, have a Go-back keyboard shortcut for going back to the previous location (like Cmd-LeftArrow in Safari and Firefox).

Wednesday, April 22, 2009

Idea: Phasing out Office documents per e-mail

Currently, Microsoft Office files, in various incarnations, are still the dominant format for mailing documents. Although everybody (including Microsoft) agrees these formats are not standards-based en hence (at least in theory) not future-proof, this is a situation that is not easy to change.

Try sending an ODT* file to a colleague. Chances are she will have no idea what to do with it. But since everybody knows Word, Excel and Powerpoint, the situation will remain for a while.

Here's a wild idea for improving the situation: when sending an email, most mail clients support a standard for sending both text and HTML email as alternative formats in the same mail. Perhaps a similar approach could also be applied to DOC/XLS/PPT attachments: For example: every time a user sends an ODT file, a corresponding DOC file is automatically attached as well, and vice versa.

* ODT = OpenDocument Text, an ISO standard format for text documents.

Decrypting multiple files with GnuPG

Here's a simple UNIX/Linux script that asks for a password and then decrypts a batch of files using that password, using GnuPG:

#!/bin/bash

echo -n "Enter password: "
stty -echo
read password
stty echo

for encrypted in *.gpg; do
decrypted=`echo ${encrypted} | sed s/.gpg\$//`
echo -n ${decrypted}
echo "${password}" | gpg --passphrase-fd 0 -o "${decrypted}" -d "${encrypted}" > /dev/null 2> /dev/null
if [ "$?" = "0" ]; then
chmod 600 "${decrypted}"
echo " [ DONE ]"
else
echo " [ FAILED ]"
fi
done

Tuesday, April 21, 2009

Favourite browser features

Here's an overview of what I appreciate in a browser. This table only considers browsers available on Mac OS X, since that's my desktop environment. Note that most of this is very subjective, it's just my personal preferences.

In Firefox, I've installed the following add-ons:

  • Web Developer
  • Firebug
  • Google Page Speed
The bold items are my favourites.

Firefox 3.0Safari 4.0Opera 10 (beta)
Startup timePretty badVery goodVery good
Ability to immediately edit the address in the address bar after startupOKBad: there is a delayOK
Shows plain XML in a nice treeYesNo
Yes
Recognizes a port number, even when no protocol (e.g. "http") is specifiedYesYesYes
OS X look-and-feelNiceNiceNot very nice
New tab pageFast, but emptyTop sites: useful and very attractiveSpeed dial, quite nice
Search Google from address barYes
NoYes
Find in pageToolbar at bottom is OK, but far from optimal
Result highlighting: very nice and polishedBad: separate dialog window
Progress of downloads visible in OS (e.g. in Stacks)NoYesNo
Web development toolsCombination of Firebug, Web Developer and Google Page Speed works like a charm"Inspect Element" is very nice and integrated
Developer tool is not very intuitive
Login form autocompletionExcellent, supporting multiple accountsOKOK
Browser can be configured to have just one window with tabs, even when a link is pressed in an external applicationYesYesYes
Link targets can show in a tooltip (e.g. at the window bottom, like Google Chrome) and do not require a status bar to displayNoNoNo
Activity monitor
NoYesNo
Number of clicks in the address bar needed to select all textOneThreeOne
Prompt to store login detailsUnobtrusive and non-blocking bar at the topBlocking dialog window (very bad)Obtrusive dialog window, but non-blocking
Supported by XMarksYesOfficially only Safari 3 is supported, but in practice it works with version 4
No


Updated on June 9, 2009, for Safari 4 final release and Opera 10.00 beta. Updated and added criteria.

Wednesday, April 8, 2009

Espresso - first impressions (updated x2)

As part of the MacHeist 3 bundle, I purchased Espresso, a neat little code editor for Mac OS X. It looks simple and intuitive and works well overall. For a code editor, the functionality is fairly limited, though.

It supports plugins, which Espresso calls sugars.

After using Espresso for just a couple of hours, here are some of the things I would suggest as improvements:
  • show that a line is wrapped by placing a special line wrap symbol at the end of the line that's being wrapped;
  • support find in files instead of only supporting find in file names (which only works inside the current project);
  • when a search operation wraps (inside the current file) around, then have a clear visual signal indicating this, I currently have to take care that I watch the line numbers on the left;
  • allow opening new files in tabs by default, now I have to drag the tab to the main window every time;
  • allow tabs/spaces configuration per file type: I'd like to use tabs in XML files while using spaces in programming code (such as Java code);
  • include more themes in the distribution, instead of just a single one, for example one that looks like vim on a black background with syntax highlighting enabled;
  • on the theme website, show visual theme examples;
  • support theme import/translation from existing themes from other programs (e.g. Eclipse, NetBeans, vim, etc.) to Espresso;
  • make the file modified indicator stand out more (inside the tab header);
  • use common keyboard shortcuts for switching tabs, e.g. Alt-Shift-arrows (like Safari) or Cmd-Alt-arrows (like Firefox);
  • have keyboard shortcuts for moving tabs to the left or the right;
  • add Java support, including syntax highlighting and navigator-support;
  • support localization and provide support for the Dutch locale;
  • integrate visual CSS editing;
  • double-clicking on a folder in the project should open that folder;
  • workspace folders: it would be nice if a folder could be added in the workspace, for quick access;
  • MobileMe-support for publish servers would be nice to have;
  • have an option to remove trailing whitespace when saving files; in my opinion this could even be a global option for any file type, since I'd enable it for all; currently Espresso automatically inserts whitespace (to keep the indentation level) but it does not remove it;
  • when deleting an element/comment from the navigator, also delete the newline at the end - hence, if a comment occupies a line and there is nothing else on it, then the whole line should be removed;
These are things I consider bugs:
  • while searching, when I add or delete some text, the occurrence counter is not updated;
  • there are no small icon version of the "Action" and "Tools" icons, hence using the "Small icons" variant of the toolbar hardly increases the available screen estate;
  • while hovering over the icons in the toolbar, no icon title/description is shown, even if only icons are shown in the toolbar (without text below them);
  • when I click on Help -> Get Espresso Sugars the Coffee House website I'm sent to displays all sorts of errors (this is fixed as of April 9, 2009);
  • when the Settings button is clicked in the toolbar, the caption of the button changes to "Hide Settings", moving the icon, instead the button should -in my opinion- just be visualized as depressed.
These features make Espresso stand out:
  • excellent Mac citizen: it's fast, stable and integrates nicely in the Mac OS X environment;
  • the find/replace feature (inside a single file) works like the search feature in Safari, highlighting occurrences, while dimming the rest of the text: awesome;
  • dragging tabs between windows looks and works very nicely;
  • you can create a rectangular text selection using Cmd-Alt-mouseclick/-movement, which is very practical in some situations;
  • automatic XML ending tag completion - when you want to close an open XML element, just press the smaller-than-sign and the slash and Espresso will append the rest;
  • easy element/comment deletion: just select the tag or comment in the navigator and select Backspace - gone.
Note: Updated on April 9 and April 10, 2009, to add more details.

Friday, March 13, 2009

Browser news updates

Some recent browser news updates:
Another thing worth noting: Peter-Paul Koch is currently testing mobile browser compatiblity, paid by Vodafone.

Wednesday, February 11, 2009

iTerm suggested improvements

iTerm is the best terminal emulator on the Mac, IMHO. It's more customizable than the Leopard Terminal application and supports transparency, tabs, select-to-copy, middle-button-paste, a full-screen mode (with Cmd-Enter), etc.

Here are some suggestions for bringing iTerm closer to perfection, in order of (subjective) importance:
  • bug: scrolling a view while more output is added (for example when monitoring an active log file) does not work reliably, the view constantly jumps to the end of the output;
  • feature: have an option to briefly show tab titles while switching tabs; this is especially useful in full-screen mode, since the tabs are then not visible;
  • feature: have a keyboard shortcut for moving tabs to the left or to the right;
  • bug: when changing monitors (e.g. disconnect an external monitor), while iTerm is in full-screen mode, iTerm does seem to notice the resolution change, causing iTerm to show as an odd borderless window;
  • bug: if iTerm is active and you switch from the current Space to another and back, then iTerm is no longer on the foreground, but the Finder is;
  • bug: when switching to full-screen mode and a tab other than the first is active, then the contents of the first tab are briefly (~1 second) shown before the contents of the active tab are shown again.

Friday, February 6, 2009

Browser news updates

Here are some browser news updates: