Docear on macOS: Navigating the Apple Java Nightmare

So this blog post will be brief, as I suppress my disdain for Apple’s attitude towards Java, now that they no longer need it to survive due to their App Store ecosystem.

This blog post documents how I was able to get the Docear Mindmapping software working on OSX El Capitan (10.11).

Sadly, many Java applications which should ‘run anywhere’ simply don’t anymore on the Mac.  Apple abandoned their own internal version of the JRE and bundling with the OS, and deferred said support to the author of Java, now Oracle.  Oracle, too have contributed to the nightmare in providing little assistance in making the transition seamless.

After installing Docear on my mac, I attempted to start it with the icon in the Applications folder in the usual way only to find it bounce in the dock once, and disappear.  How rude I thought.  So I resorted to the command line (gotta love UNIX-like desktops).  When I attempted to start it there, I was presented with the ugly error message:

$ /Applications/Docear.app/Contents/MacOS/FreeplaneJavaApplicationStub
JavaVM: Failed to load JVM: /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bundle/Libraries/libserver.dylib
JavaVM: Failed to load JVM: /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bundle/Libraries/libserver.dylib
JavaVM FATAL: Failed to load the jvm library.
[JavaAppLauncher Error] JNI_CreateJavaVM() failed, error: -1

Just lovely.  I actually thought I was running Java JRE 1.8 that I downloaded from Oracle.  Seems there are other versions lurking on my system.

I’ll spare you all the drudgery of diagnosing this issue and coming up with a solution.  I will tip my hat to Oliver Dowling and his blog post which eventually lead me to the solution below.  One thing I did learn is that creating a symbolic link for libserver.dylib did not work for me.  I had to instead create a hard link.  I suspect the JRE stub FreeplanJavaApplicationStubJavaVM binary was checking for the existence of a ‘normal’ file rather than ‘a’ file.

Anyway, here are the goods to make Docear work on OSX10.11 (and hopefully other versions).  Be sure to substitute the Java version numbers in the file paths with your version of Java installed.

$ cd /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home
$ sudo ln -s jre/lib bundle
$ cd bundle
$ sudo mkdir Libraries
$ sudo ln /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre/lib/server/libjvm.dylib libserver.dylib

Hopefully after executing these commands, you will be able to use Docear.  Good luck!

Being BAD at task management

I have co-authored a paper with a colleague, David Jones which was published at the ASCILITE2014 conference being held in Dunedin New Zealand.  The paper was titled Breaking BAD to bridge the reality/rhetoric chasm.  The reality/rhetoric chasm is best expressed through the following metaphor, in the words of Professor Mark Brown:

E-learning’s a bit like teenage sex.  Everyone says they’re doing it but not many people really are and those that are doing it are doing it very poorly. (Laxon, 2013, n.p).

A central tenet of the paper is the following argument about this chasm:

Our argument is that the set of implicit assumptions that underpin the practice of institutional e-learning within universities (which we’ll summarise under the acronym SET) leads to a digital and material environment that contributes significantly to the reality/rhetoric chasm. The argument is that while this mindset underpins how universities go about the task of institutional e-learning, they won’t be able to bridge the chasm.

Instead, we argue that another mindset needs to play a larger role in institutional practice. How much we don’t know. We’ll summarise this mindset under the acronym “BAD”.

A comparison of SET and BAD is provided in the following table:

Component SET  BAD
What work gets done? Strategy – following a global plan intended to achieve a pre-identified desired future state Bricolage – local piecemeal action responding to emerging contingencies
How ICT is perceived? Established – ICT is a hard technology and cannot be changed. People and their practices must be modified to fit the fixed functionality of the technology. Affordances – ICT is a soft technology that can be modified to meet the needs of its users, their context, and what they would like to achieve.
How you see the world? Tree-like – the world is relatively stable and predictable. It can be understood through logical decomposition into a hierarchy of distinct black boxes. Distributed – the world is complex, dynamic, and consists of interdependent assemblages of diverse actors (human and not) connected via complex networks.

The paper uses the establishment of the Moodle Activity Viewer (MAV) at my institution as an example of using BAD principles to improve e-learning.  However, this is not the focus of this blog post.  As a means of improving my own conceptions of BAD, SET and their interplay, I have begun reflecting on how I have unwittingly applied BAD principles to my other endeavours.  A recent example relates to my use of task management software which is detailed in a recent post, but for which I’ll summarise here for brevity.

I recently switched to a new task management system called Omnifocus.  Omnifocus provides the ability to select what it calls perspectives to show your tasks in different ways according to your workflows and context.  One such perspective new to their recently released OSX version is called the Forecast Perspective.  This perspective for the coming days, shows what tasks are due to be started (deferred to a later date when entered) and what tasks are due to be completed.  This information is then augmented with appointments found in your OSX calendar application.  Its a lovely way to see what you need to do, along side what existing time-based commitments you have to help plan to get things done.  But there was a problem.  Any deferred tasks that were not completed on the date they were deferred to, would not shift to the next day in the Forecast perspective.  Instead, they simply disappear from the perspective entirely until their due date.  Through an online search to see if I had mis-configured my database or if anyone else was as baffled as I was, I came across the following entry on the Omnifocus discussion boards:

I’m going to submit this as a feature as well, but I figure I’ll post it here to see whether it can get more traction. My issue is this:

If I have Deferred something to a start date in the future, odds are I probably think it’s pretty important that it starts on that day.

However, what happens if that day comes and goes and I didn’t start the item? In Forecast, the item disappears. That doesn’t make any sense to me. Forecast shouldn’t only be showing me the “past due” things I assigned dates to, but things I didn’t touch that I was supposed to.

Seems I was not alone in my frustration.  The forum continued with discussion of various work-arounds, none of which I found particularly suitable to my context.  So I sought other possibilities to resolve my problem.

Omnifocus makes use of the OSX Applescript frameworks which provide a high-level scripting language that can be used to customise behaviour and automate tasks to make things work in ways not originally conceived by software creators.  A handful of applescript contributors exist that have created some very useful Applescripts for Omnifocus.  One such contributor Curt Clifton has created a script that identifies projects where there is no next action to perform, suggesting that the project may have stalled.

The significance of this script is that I have been able to adapt it to solve my problem with deferred tasks disappearing from the Forecast view when they are not completed on the defer date.

Returning to the principles of BAD, there are some alignments undertaken by the Omnigroup company to allow customers to ‘break bad’ by customising their Omnifocus product to yield to their ends.  In the absence of the Applescript integration in Omnifocus, there would be little hope other than waiting for Omnigroup to implement a feature to address the limitation.

The integration of the Applescript framework into Omnifocus allows Bricolage to occur.  It offers Affordances such that I and others are able to solve problems locally and contextually according to our own specific needs and wants.  The creation and use of this bricolage is distributed – Omnifocus do not have direct control or management over the extensions that can be applied.  Things can be developed and/or shared in a Distributed fashion according to the needs of individuals.

While the use of the Applescript framework won’t solve everyone’s issues and challenges, like many products that do integrate an Applescript Dictionary, it does shift away from the traditional SET mindset of software development.

How to Install Backintime Backup Software on CentOS/RHEL/Scientific Linux 7

Introduction

Hopefully the title of this post is explanation enough.

Backintime is a neat backup solution that mimics in some ways, the abilities of OSX’ Timemachine backup system.  At predetermined time intervals, Backintime will sweep configured directories on your computer, and only backup the differences since the last sweep.  It results in an efficient use of storage resources on your backup destination drive by hard linking identical files.  Unlike the OSX Timemachine solution, it does not hard link directories, as only Apple’s HFS+ filesystem supports hard-linked directories.  This makes Backintime portable to Unix-based Operating Systems using a variety of filesystems.

The reason for this post is to document some trickery necessary to make Backintime work on our favourite North American Linux vendor’s enterprise operating system, the derivative on which that I use being CentOS 7.  CentOS 7 like its other cousins in the Red Hat family only includes Python interpreter version 2.  While Backintime is written in Python 3.  I have had only a little experience with Python, and it does have some great features (built in multi-threading), however making the two versions incompatible is such a nuisance.  Whinge over, the trick to allowing Backintime to work on CentOS 7 is to install a 3rd party Python 3 interpreter.  The following instructions achieve this end.

Instructions

Download Backintime from their website, and follow the installation instructions from the README file.

Next, you will need to install a 3rd-party YUM Repository called softwarecollections.org


yum localinstall https://www.softwarecollections.org/en/scls/rhscl/python33/epel-7-x86_64/download/rhscl-python33-epel-7-x86_64.noarch.rpm
yum install python33

Then create a script file to execute the python3 interpreter with the command python3 by creating the following shell script as the file /usr/local/bin/python3


#!/bin/sh
scl enable python33 -- python $@

Then compile and install Backintime from the downloaded


./configure --python3 && make && make install

Omnifocus2 – A tale of the disappearing deferred tasks

Sadly due to work commitments, I have neglected my blog over the past 2 years.  I plan to reinvigorate things again, starting with this post that I wrote back in August 2014, but never actually pressed the ‘Publish’ button.

I have recently switched from my existing Mac-based task management software Things, to a new product called Omnifocus.  Without getting into the details that have lead to this switch, suffice it to say that Things development moves at a slower pace than I am satisfied with.  I have been trialling Omnifocus for about a month, and while it does have some extra features over Things, it of course has limitations.

Understandably, creating task management software that will yield to the demands of a diverse user base is nigh impossible.  Omnifocus is no exception. One demand of the software that I have is to be able to better plan/schedule my projects and tasks into a calendar.  Omnifocus includes what is called a Forecast Perspective on your projects and tasks.  It is a way to see in a somewhat calendar type view when tasks are scheduled to begin (deferred), and when they are due, along-side my daily appointments as gleened from my Mac OSX Calendar.

This I thought was wonderful as I could then plan out my days and weeks according to what was in my calendar in terms of appointments, and what tasks I had to complete.  But then a problem arose that was unforeseen, and that afflicted more than just myself as explained in this forum post excerpt on the Omnigroup discussion forums:

I’m going to submit this as a feature as well, but I figure I’ll post it here to see whether it can get more traction. My issue is this: If I have Deferred something to a start date in the future, odds are I probably think it’s pretty important that it starts on that day. However, what happens if that day comes and goes and I didn’t start the item? In Forecast, the item disappears. That doesn’t make any sense to me. Forecast shouldn’t only be showing me the “past due” things I assigned dates to, but things I didn’t touch that I was supposed to.

If a deferred task is not done on the day it was deferred to, the following day it would simply disappear from the forecast view altogether.  Not very helpful when forecasting. The discussion thread continues with contributors arguing the merits of changing the software to overcome this limitation, along with a swathe of work-arounds, none of which I found particularly satisfactory to my needs and context. This got me thinking… what if each morning, there was a way that I could select all tasks that were incomplete and had a defer date earlier than today?  I could then update the defer date on all these tasks to be today, and voila, they reappear in my Forecast Perspective.

But how would I do this? Omnifocus makes use of the OSX Applescript frameworks which provide a high-level scripting language that can be used to customise behaviour and automate tasks to make things work in ways not originally conceived by software creators.  A handful of applescript contributors exist that have created some very useful Applescripts for Omnifocus.  One such contributor Curt Clifton has created a script that identifies projects where there is no next action to perform, suggesting that the project may have stalled. The significance of this script is that I have been able to adapt it to solve my problem with deferred tasks disappearing from the Forecast view when they are not completed on the defer date.

If you are frustrated with this limitation of Omnifocus, and you don’t mind losing your originally specified defer date for your tasks, then my DeferOldToNow Applescript might be of use to you.  What the script does is, recursively traverse all of your active projects, looking for incomplete tasks that have a defer date that is older than the present date.  On finding each task, it then sets the defer date to the present. If you are interested in the Applescript code, or would like to contribute updates, the source is available on github.

When the script completes, visiting your Forecast Perspective will once again reveal all tasks that were past their deferred date, and incomplete.  They appear under “today”.  Once they reappear here, you can then defer them again to some time in the future if you need to, but at least they are visible and you are reminded that they haven’t been done. I hope this Applescript proves useful to other users of Omnifocus.  If it does, give me a shout out in the comments section.  Happy Omnifocussing!

Damo.

Arrow key scroll in Mac Excel

Ever been using Microsoft Excel on the Mac and found that when you use the arrow keys on the keyboard to move from one cell to the next, instead the whole worksheet scrolls?

This is actually a feature of Microsoft Excel carried over from the Windows version on which you press the Scroll lock key to enable or disable.  Older Macintosh computers had the F14 key mapped to the Scroll lock key of PC keyboard, so it was quite easy to enable or disable.  However newer Macintoshes no longer have a F14 key.

This makes disabling this feature tricky to say the least.

In the past I have attached an older Mac keyboard to my 2010 Macbook Pro and pressed the F14 key.  However for those of you who do not have ready access to such legacy keyboards, you can use a simple applescript application that I have written called Excel Scroll Lock.

What it does is “send” a Shift-F14 key press to Microsoft Excel as if you pressed the Scroll lock key, thus toggling on or off this function within Excel.

To use, simply download the application, unzip, and drag the application into your Applications folder.  Then run it.  You can alternatively download a disk image version of the application, and run without installing into your Applications folder.

For those interested in the applescript, it is shown below, and also included in the downloaded application bundle under the Contents/Resources/Scripts folder.  The script is also available on github – contributions welcome.

--Applescript to fix scroll-lock problem with Microsoft Excel on Mac OS
--Written by Damien Clark (https://damosworld.wordpress.com)
--Licenced under GPLv2 (http://www.gnu.org/licenses/gpl-2.0.html)
--18th of June, 2012

--From time to time you may find that using the cursor keys in MS Excel for Mac will 
--scroll the worksheet, but not shift the selected cell.  This is a feature of Excel 
--that is enabled by pressing the Scroll Lock key.  On Macintosh computers once upon 
--a time, F14 was the equivalent key to Scroll lock on the PC.  Modern Macintosh 
--computers are no longer furnished with an F14 key, and while I am sure there is a 
--keyboard combination to emulate F14, I have yet to find it.  As a result, you can 
--find yourself stuck with this special scroll lock mode of Excel and it is very 
--frustrating.  This script effectively "sends" an F14 keypress to Microsoft Excel, 
--thus turning on or off this scroll lock feature.  So if you find yourself in this 
--situation, you can execute this program to toggle the feature on and off as 
--necessary.  Simply run the application and click OK.  

set returnedItems to (display dialog "Press OK to send scroll lock keypress to Microsoft Excel or press Quit" with title "Excel Scroll-lock Fix" buttons {"Quit", "OK"} default button 2)
set buttonPressed to the button returned of returnedItems

if buttonPressed is "OK" then
    tell application "Microsoft Excel"
        activate --Make it the active application to receive System keyboard events
    end tell
    tell application "System Events"
        key code 107 using {shift down} --Send the F14 key which is scroll-lock on Mac keyboards
    end tell
    activate
    display dialog "Scroll Lock key sent to Microsoft Excel" with title "Mac Excel Scroll-lock Fix" buttons {"OK"}
end if

Remote Debugging of PHP with Komodo IDE on Mac OS X

I am doing development on Mac OS X 10.7, with Komodo IDE 6.1.3 using PHP and Apache, both installed from Macports.

I want to enable remote debugging of my PHP scripts running under Apache using Komodo.  Following instructions from Activestate’s website, I have configured my system as shown below to make it work.

I have already installed Apache and PHP using Macports, so I only needed to install php5-xdebug using the following command:

sudo port install php5-xdebug

I then added the following to the /opt/local/etc/php5/php.ini file:

;xdebug config
;the .so file is loaded under /opt/local/var/db/php5/xdebug.ini
;zend_extension=no-debug-non-zts-20090626/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
;xdebug.idekey=<idekey>

Then in Komodo IDE, set the tcp port to listen for debugging connection as shown below:

When I wish to debug a script, I just add the following query to the end of the browser url for the script, and xdebug sets a browser cookie that turns on debugging for all scripts from that point forwards.  The query string to add is:

?XDEBUG_SESSION_START=1

To disable the debugging again, you just need to delete the cookie from your browser.  Using Firefox, go to the Privacy settings under preferences:

Then click on the “remove individual cookies” link, and type in “localhost” as the search criteria for the cookie.  This will show all cookies for the localhost where you are debugging, and you will see the XDEBUG cookie as shown below.

Simply click on the Remove Cookie button, and debugging is turned off again.

Installing DBD::Oracle on RHEL6 with Oracle Instant Client 11.2 rpm

To install the Perl DBD::Oracle module on RHEL6, with the oracle instant client rpms installed, you need to type the following sequence of commands. Keep in mind that 11.2 can be exchanged for your version of Oracle, and that client64 can be exchanged for just client if you are using 32bit linux. From a shell prompt as root (or using sudo):


cpan
install DBD::Oracle

This will likely fail but leave you with a cpan prompt.  When it does, type:


look DBD::Oracle

export ORACLE_HOME=/usr/lib/oracle/11.2/client64/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME

The above will drop you at a shell prompt at the directory where the DBD::Oracle source code has been extracted, and configures the environment for the compile/install. Now you can do the compile and install process with:


perl Makefile.PL -V 11.2
make

If all is good, then you can go ahead and do the install:


sudo make install

The LD_LIBRARY_PATH environment variable must be set as given above for any user who will be using DBD::Oracle, so be sure to set the path permanently through a simple script added to the /etc/profile.d directory.