Skip to main content

Posts

Showing posts from 2018

Eclipse and Environment Variables in Mac OS X

After setting the environment variables for a user on a new Mac OS X machine (see post from 12 Oct 2018), I was surprised to see that Eclipse was unaffected by my changes to PATH. Some details: in my scenario, the development project uses Maven for its builds, but one step runs scripts in a bin folder. That folder has been added to my PATH. They run fine from the terminal, but from Eclipse the script steps always fail with an error something like "Cannot run xyz - No such file or directory". The reason turns out to be:  the PATH changes are made at the level of my user profile, but the Eclipse app does not refer to my individual user profile (when launched through the Finder or icon tray). A Google search turns up lots of suggested solutions. There are so many because the approach has changed over the years, and people have different thresholds of what solutions they are willing to use, how much mucking they are comfortable with or allowed to do by their organization.

PATH and Environment Variables in Mac OS X

I have been using Windows since the days of Windows 3.1, and I have become very comfortable mucking around in the guts of the Operating System. Then I was given a Mac OS X machine to configure for development recently. Setting it up with versions of Java, Ant, and other pieces necessary for development meant that I had to create some new environment variables (like ANT_HOME) and change others (like PATH). Which raised the question: how do I set environment variables for my account on a Mac? Here are the steps for OS X 10.13 High Sierra Open a Terminal window (Applications -> Utilities -> Terminal)  Check for a .profile file in your home directory $ ls -a  Use an editor like vim or emacs to open the .profile file if it exists, or create it if not. In vim, press "i" to enter "insert" mode and "Esc" to return to command mode. $ vim .profile  Add the new environment variables, using the "export" command, e.g. export ANT_HOME=/Users/Ste

Updating Oracle javapath symlinks on Windows

A Java-based application on my Windows 10 machine recently started prompting me to upgrade my version of Java. Since I wanted to control it myself, I declined the app's offer to upgrade for me, and downloaded and installed the latest Java 8 from Oracle. In my case, Java 1.8.0_171, 64-bit version. The upgrade went fine. But when I launched the app, it again said I needed to upgrade. Why was it still looking at the old location? I made the change using Settings, to change the JAVA_HOME environment variable to point to the location of the new upgrade. But no change, the app still insisted that I needed to upgrade. A little research into the app's execution path showed that it was using c:\ProgramData\Oracle\Java\javapath to find Java. When I looked in that folder, I found symbolic links to my old Java installation. Normally, this hidden bit of information gets updated automatically in the upgrade or installation process. I have read of cases where, when downg

A Trinity Sunday FizzBuzz Variation

Happy Trinity Sunday! For those not familiar, Trinity Sunday is the day in the Church liturgical calendar that celebrates the great mystery of the Holy Trinity, the doctrine that Christians worship a 3-in-1 God. God the Father. God the Son. God the Holy Spirit. Three Persons and One God. As introductions go, Wikipedia's is a bit heavy , but the whole doctrine is one of the great mysteries / paradoxes / intellectual conundrums of orthodox Christianity. This year, as Trinity Sunday approached, I was thinking thoughts related to job interviews. One of the classic entry-level programming tests for such interviews is the FizzBuzz challenge , in which one is challenged to print the numbers 1 to 100 but, if the number is a multiple of 3, print "Fizz", if a multiple of 5, print "Buzz", and if a multiple of both 3 and 5, print "FizzBuzz" I am not going to offer a solution to either FizzBuzz or my variation. A simple internet search will reveal implementat

Pentecost and the Gift of (Programming) Languages

Last Sunday was Pentecost Sunday, which is a big deal in my tradition (Anglican church in Canada). During the festive celebration, the preacher (full disclosure: it was my turn in the rotation) spoke about the coming of the Holy Spirit and the gift of languages, as the apostles spread the news of God's love and of the Jesus by miraculously speaking in a whole pile of new languages. There was a real risk that the early believers would turn into a local sect, a regional oddity within the larger Jewish religion. Then the Holy Spirit came and literally blew them out into the streets, where they told visitors from all the surrounding nations their great news. It was, in tech-jargon, saying "Hello, World!" in a dozen or more languages. Or, more specifically, their message was "Hello, World! God loves you and Jesus Christ died for you!" Hello World being the classic first-program in any new language. There are hundreds, nay thousands of programming languages, and I

Code Coverage in C#.NET Unit Tests - Setting up OpenCover

The purpose of this post is to be a brain-dump for how we set up and used OpenCover and ReportGenerator command-line tools for code coverage analysis and reporting in our projects. The documentation made some assumptions that took some digging to fully understand, so to save my (and maybe others') time and effort in the future, here are my notes. Our project, which I will call CEP for short, includes a handful of sub-projects within the same solution. They are a mix of Web APIs, ASP MVC applications and Class libraries. For Unit Tests, we chose to write them using the MSTest framework, along with the Moq mocking framework. As the various sub-projects evolved, we needed to know more about the coverage of our automated tests. What classes, methods and instructions had tests exercising them, and what ones did not? Code Coverage tools are conveniently built-in for Visual Studio 2017 Enterprise Edition, but not for our Professional Edition installations. Much less for any Commun

Why am I no longer authorized for TFS project?

Sometimes, seemingly out of the blue, I get an alert that I am unauthorized to access the .NET project in TFS that I had been working on a few weeks earlier. Here's what has gone wrong and how to fix it. Is it a network issue? Visual Studio appears able to connect. Yet I appear to suddenly be not authorized. Is it a credentials issue? If so, why? What's wrong?  It happens infrequently enough that it can take several minutes to work out just what caused the problem, yet is common enough that I am using this post as a way of saving myself some wasted time down the road. I currently work in an environment with a policy of frequent changes to your password for our  workstations. Whenever this happens, Visual Studio reports that I am not authorized to access the project in our Team Foundation Server. The reason for the error is that Visual Studio uses cached credentials, and these cached credentials are not automatically updated when the workstati

Computer Science or Software Engineering

This week I was reading the results of the annual Developer Survey from the excellent tech forum Stack Overflow (available here ).  I was struck by a chart about educational background, excerpted below. The top line gathers three different streams of technology education into one: Computer Science, Computer Engineering, and Software Engineering. There are profound similarities between the three, which is why they are grouped, yet also significant differences, in their approaches, assumptions and end goals. What struck me was the realization that, despite my strong formation in the Computer Science stream, over time I lean more and more to the Software Engineering stream now.

Fixing an Unfinished Mac OS-X Update

Windows famously had the Blue Screen of Death, when the computer was hopelessly frozen in an error state; Macs have the spinning Rainbow Wheel or Beach Ball that often also spells doom. I thought of those recently when I faced a dead computer interrupted mid-upgrade. While recently upgrading the operating system on my MacBook Pro, I got this screen: Nothing but a greyish-white backdrop and a darker grey circle-slash in the center. When I'd power down and back on, same thing. It was well and truly stuck mid-upgrade. How do you fix a Mac when an OS X upgrade fails in the middle of its upgrade?