Which process is locking a file on Windows ?

List processes locking a file by file path sub-string:

Command line

  1. Install the handle tool from the Sysinternals suite
  2. Run handle -u [file path sub-string] in a cmd.exe window

The -u option includes the user owning the process.

Example:

handle -u "some.pdf"
AcroRd32.exe   pid: 11208  type: File  localnet\oliver 
244: C:\Users\Public\Documents\some-folder\some.pdf

GUI

  1. Download Sysinternals Process Explorer
  2. Menu : Find – “Find Handle or DLL …”

process-explorer_find-handle-or-dll

process-explorer_search-handle-or-dll_dialog

Set the X cursor theme in XFCE 4.10

After upgrading to Debian Jessie and XFCE 4.10, I set the default cursor theme in XFCE main menu – Settings – Mouse and Touchpad – Theme tab.

But this seemed to affect only a few applications.

To consistently set the theme for all applications and the desktop I had to run this:

oliver@debian:~$ sudo update-alternatives --config x-cursor-theme
There are 3 choices for the alternative x-cursor-theme (providing /usr/share/icons/default/index.theme).

  Selection    Path                                    Priority   Status
------------------------------------------------------------
  0            /usr/share/icons/Adwaita/cursor.theme     90        auto mode
  1            /usr/share/icons/Adwaita/cursor.theme     90        manual mode
  2            /usr/share/icons/DMZ-Black/cursor.theme   30        manual mode
* 3            /usr/share/icons/DMZ-White/cursor.theme   50        manual mode

Press enter to keep the current choice[*], or type selection number:

Select the desired theme from the listed options and make sure it is the same as the one you selected in the XFCE settings.

Configure Intellij to use default Eclipse Java import layout

Eclipse and Intellij use different default layouts of Java imports. If used on the same project, Eclipse’s “Organize Imports” will compete with Intellij’s “Optimize Imports“.

To avoid distracting back-and-forth code changes, Intellij can be configured to match the default Eclipse behavior:

Go to File – Settings – Editor – Code Style – Java – Imports tab

Prevent on-demand imports (i.e. wildcards) by settings high count limits:
intellij-java-imports-no-wildcards

Define the imports layout (i.e. grouping and order) like this:
intellij-java-imports-layout

Fix Eclipse installation after Cygwin unzip

I used Cygwin’s unzip on Windows 7 to unpack freshly downloaded Eclipse zip packages. When trying to start eclipse.exe, I was getting weird error messages:

For Luna (4.4):

eclipse-luna-error-after-cygwin-unzip

For Mars (4.5):

eclipse-mars-error-after-cygwin-unzip

It turned out that after unzipping, the executable permission was not set on ‘exe’ and ‘dll’ files, so I had to fix it like this:

find eclipse \( -name '*.dll' -or -name '*.exe' \) -exec chmod +x {} \;

“Lidar News” publishes uninformed (L)GPL rant

In its “Random Points” column, the June 2015 issue (Vol.5 #4) of Lidar News, recently renamed LidarMag, contains an opinion piece called “Open Source Mania” (PDF) by Lewis Graham, a director of the board with ASPRS, the organization that defines the LAS file format.

The article contains grains of interesting and potentially relevant comments on the LGPL, but without properly spelling things out: The LGPL – if not amended with a static linking exception as in the LASzip license – has “copyleft” implications when the library code is statically linked, which is somewhat similar to but not as strict as the “strong copyleft” nature of the GPL. I recommend reading the LGPL section of the “Copyleft Guide” or a good article on the Open Source “risks” and considerations during corporate acquisitions and mergers.

Having said that, Lewis Graham’s piece contains many inaccuracies and unfair judgements:

1) The author underhandedly attacks Martin Isenburg’s broadly supported attempts to have the LGPL-licensed de-facto standard LASzip accepted as an Open Standard and then goes into a rant about the GPL, while lumping both licenses together as “viral”. The LGPL – not the GPL – explicitly allows the use as dynamically linked library without any licensing impact on the main program. Combining the attack on the LASzip community with a rant against GPL while ignoring the main difference between LGPL and GPL is unfair to say the least.

Lewis also fails to mention that the LASzip license is actually LGPL with an additional clause that explicitly allows even static linking without licensing impact on the main program.

2) He falsely claims that “Open Source” was never defined but fails to mention the Open Source Initiative (OSI) who coined the term and provided exactly that Open Source definition.

3) The article misleadingly mentions the Free Software Foundation as the “anchor organization” of Open Source, repeats the old misunderstanding that “Free Software” should not cost money and fails to mention the “Free Software” definition by the FSF.

4) The author spreads long debunked FUD (fear, uncertainty, doubt) about the GPL, claiming that all “code [that] touches GPL code in any manner [..] is now GPL”. In particular he makes false claims that the following uses of GPL code would be “viral”:

  • Executing a GPL licensed program from a script via process execution (“Unix fork”) explicitly does not impose any licensing restrictions on that script, as per GPL FAQ
  • Derived works that incorporate GPL licensed code, do not automatically become GPL licensed. Only when the derived work is distributed the following applies (quoting GPLv2, section 6): “Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions.”

5) The author repeatedly refers to an “Open Software Foundation”. He seems to confuse or conflate Open Source Initiative (OSI) and Free Software Foundation (FSF). The actual “Open Software Foundation” – later merged into “The Open Group” – has not much to do with either OSI, FSF or software licenses.

6) The author keeps calling the GPL “toxic”, while in fact the GPL is a widely known and court-proven license in the software industry that many companies use successfully as part of their business models, for example Redhat (Linux), Oracle (MySQL), etc. Especially Dual Licensing based business models actually benefit from the relatively restrictive nature of the GPL.

7) The author praises the MIT license as “reasonable” because of its permissive nature (i.e. not imposing any significant licensing restrictions on derived works). As he makes that judgement he takes only the perspective of companies that want to use Open Source libraries in their proprietary closed-source products. He ignores the perspective of Open Source developers, communities and companies who want to protect their work from embrace and extend and other hostile take-over strategies and deliberately use copyleft licenses like the GPL to protect their software.

8) Overall, the author fails to accept that it is the copyright holders freedom to chose a license that suits their needs and intentions.

Zulu – Certified OpenJDK 8 builds for all operating systems

You might have heard that Java is Open Source. And then you noticed that the Java SE downloads from the Oracle website are not actually Open Source. Maybe you also heard about OpenJDK.

So how does this fit together?

OpenJDK is an Open Source implementation of Java and Oracle Java engineers do work on Java with the OpenJDK community and and within the OpenJDK projects.

But source code needs to be compiled into executable binaries to be useful for end users. And that’s where things get dicey …

Where to find OpenJDK builds

For a long time there has been no reliable source for certified, well-supported builds of OpenJDK for all platforms.

The various GNU/Linux distributions, like Fedora, Debian, etc, have provided OpenJDK builds for a quite a while now, but for Windows and MacOS there were only some unofficial, often outdated hobby projects without reliable security updates.

Zulu – Open JDK builds

zulu-duke

This changed within the last 2 years: JVM vendor Azul Systems first released their “Zulu” line of free OpenJDK builds in September 2013, mainly targeting Windows Servers and the Microsoft Azure cloud. In 2014 they added support for Linux, MacOS and Java 8, as well as Docker images. All Zulu builds are certified against the official Java SE TCK. The focus is on the JDK and servers, without browser plugin or webstart.

The Azul website does not clearly state their security update policy for their free builds, but they offer deb and rpm package repositories that seem to contain latest builds of OpenJDK that match the current Oracle JDK update versions. Also, their engineers participate in the community and allegedly contribute back to OpenJDK.

Zulu – OpenJDK 8 for Debian stable

For Debian stable (Wheezy or Jessie), Azul is a convenient way to install OpenJDK 8, since the Debian openjdk-8 package is currently only available in Debian unstable and hasn’t even made it into the Debian testing yet.

Here is how I set up the Azul deb repo and installed their OpenJDK 8:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x219BD9C9
apt_source='deb http://repos.azulsystems.com/debian stable main'
apt_list='/etc/apt/sources.list.d/zulu.list'
echo "$apt_source" | sudo tee "$apt_list" > /dev/null
sudo apt-get update
sudo apt-get install zulu-8

Please note, that the package installation automatically sets the Java related system alternatives to the Zulu ones. So right after zulu-8 installation the java version in your system path will be something like this:

oliver@basement:~$ java -version
openjdk version "1.8.0_45"
OpenJDK Runtime Environment (Zulu 8.7.0.5-linux64) (build 1.8.0_45-b14)
OpenJDK 64-Bit Server VM (Zulu 8.7.0.5-linux64) (build 25.45-b02, mixed mode)

Viewport meta tag for better page rank in mobile Google search

Algorithm changes are rolled out to Google’s data centres to let mobile-friendly web pages get higher ranking on Google Search. Some sensationalist news outlets call this “mobilegeddon“. I think it is much ado about very little.

Google provides a mobile-friendly test and at first odoepner.github.io did not pass.

So I learned about the viewport meta tag and after adding the following to the head section of my html pages they now pass the test:

<meta name="viewport" 
      content="width=device-width, initial-scale=1.0, user-scalable=yes"/>

About the viewport meta tag

180x130_viewport-meta-tag

The “viewport” meta tag is not part of the official HTML standard, but the validator at the W3C will still accept your pages as valid.

The tag was initially introduced by Apple Safari, but is now widely supported by most mobile web browser. As of spring 2015 Microsoft IE for Windows Mobile is the main exception: It requires some vendor-specific CSS.

Non-mobile web browsers typically just ignore the tag, which is fine because the whole “viewport” concept only makes sense for the relatively small screens of mobile devices.

Lacking a standard definition, for now the best specs are the respective web developer pages at Apple, Mozilla and Google.

Responsive accessible web design

Please note: Passing the Google test is nice for your page ratings, but truly “responsive” web design that works well on all browsing devices requires more effort, as this article on html5rocks.com explains quite well.

And of course, all supporters of an open, inclusive web should always ensure the accessibility of their site, for everyone regardless of disability.

OSGeo Open Letter for Open Formats of LiDAR data

A widely unnoticed revolution is going on in the field of capturing landscapes for mapping and other geographic purposes, and it is laser based:

LiDAR is the technology that uses lasers on small airplanes to literally scan in whole geographic regions and turns them into 3d point clouds. In many ways, especially for high-resolution 3D elevation data, LiDAR is already replacing traditional satellite based approaches, and enables a plethora of applications in many fields of science and business.

So far, the de-facto standard file formats for storing these “point clouds” are LAS and its compressed variant LASzip (Open Source, LGPL, developed by the German software engineering firm rapidlasso).

But recently ESRI, the market leader for Geographic Information System (GIS) software, has stepped into the arena with a closed source compression format, deceptively called “Optimized LAS” (aka *.zlas), and is positioning it as a direct competitor to the widely used Open Source LASzip format.

The closed-ness of the ESRI file format and the resulting fragmentation of the LiDAR community and its data stores, has now lead to a concerted “Open Letter of the Need for Open Standards in LiDAR“, signed by many representatives from LiDAR related companies, research institutions and the wider geo-informatics community.

I hope that this is a step towards protecting the LAS format from “hostile takeover” by ESRI and I have added my name to the signature list today.

In the very least the Open Letter will raise awareness of the importance of Open Standards and Open Source in the essential field of geographic data, data about our planet, about the world we all live in, which should be Open Data, available to all via Open Standards via Open Source tools, not locked away in vendor-proprietary binary formats that can only be read and processed using that single vendor’s tools.

How to use Oracle Java 8 plugin in Iceweasel on Debian wheezy

Download the JRE from Oracle website.

Then perform the following steps (adjust the tar.gz filename according to what you downloaded, and replace “jre1.8.0_40” with the directory of your extracted tar.gz):

cd /opt
sudo tar xvzf ~/Downloads/jre-8u40-linux-x64.tar.gz
sudo chown -R root.root jre1.8.0_40
sudo ln -s jre1.8.0_40 jre
sudo update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jre/lib/amd64/libnpjp2.so 1000
sudo update-alternatives --set mozilla-javaplugin.so /opt/jre/lib/amd64/libnpjp2.so