Archive

Archive for the ‘mac os’ Category

Setting up a free C64 emulator for retro game fun

August 8, 2018 Leave a comment

I just installed the C64 emulator VICE on an old Windows laptop and set it up with shortcuts for some old time games that I used to play in the 80s.

My 6 year old son really likes Donald Duck’s Playground where you do odd jobs as Donald to earn cents and dollars to buy playground equipment for your nephews and let them play:

Setting up the game required the download of a zip archive containing a *.d64 image file that can be autostarted by VICE. I created a desktop shortcut to the x64.exe file in VICE with the path of the d64 file as command line parameter. That gives you a shortcut that will start VICE and autostart the game right away. Add the -fullscreen option to start the emulator in fullscreen mode.

I had to enable keyboard mapping for Joystick 2 as shown on the WinVice c64-Wiki.

VICE is a cool emulator that runs on Unix, MS-DOS, Win32, OS/2, BeOS, QNX 4.x, QNX 6.x, Amiga, Syllable or Mac OS.

Games I might try next include Spy vs Spy, Aztec Tomb, Q-Bert and I few others. :)

Advertisements

Recursively compare content of two directories

August 31, 2017 Leave a comment

Command line

This requires the diff and vim packages.

diff --recursive /dir/ect/ory1 /dir/ect/ory2 > 1_vs_2.diff
vimdiff 1_vs_2.diff

Potentially useful diff options:

--ignore-all-space
--exclude=.svn

GUI

Install Intellij CE.

Then either Run IntelliJ Diff from the command-line.

Or from within a running Intellij window:

  • Open a common parent directory as a project
  • Select the two directories to compare
  • Right-click – Compare Directories

Alternatives

I often see the GPL-licensed WinMerge tool recommended, But it works only on Windows, last release was 2013 and navigation into sub-directories and file diffs is a bit clunkier than in Intellij.

Determine which Tomcat version is running

August 6, 2016 7 comments

Determine process id

First we determine the process id(s) of the running Tomcat instance(s).

We can grep the running process list for ‘catalina.home’:

pgrep -f 'catalina.home'

This might yield more than one pid.

Or we can search by port (8080 is the default, adjust if necessary). The following commands will likely require root privileges:

lsof -t -i :8080

Alternatively, for example if lsof is not installed:

fuser 8080/tcp

Or yet another way, using netstat (or its “ss” replacement):

netstat -nlp | grep 8080
ss -nlp | grep 8080

Determine catalina.home

For the process id(s) determined above, we look at process details:

ps -o pid,uid,cmd -p [pidlist] | cat

For each specified pid, this shows the uid (system user) and the full command line of the process.

Typically the command line will contain something like “-Dcatalina.home=[path]” and that path is the catalina.home system property of the Java process.

Alternatively – with Java 7 and later – we can use the JDK command “jcmd” to query the JVM process for its system properties:

sudo -u [uid] jcmd [pid] VM.system_properties \
   | grep '^catalina.home' \
   | cut -f2 -d'='

Determine version

Now we can finally determine which Tomcat version is installed under the catalina.home path:

[catalina.home]/bin/catalina.sh version \
   | grep '^Server number:'

Note: Please replace [catalina.home] with the path you determined above.

The final output should be something like this:

Server number: 7.0.56.0

Compare two Tomcat installations using rsync

May 5, 2016 Leave a comment

Lets assume you manage multiple servers that host Java web applications using the Tomcat web server.

To quickly compare the Tomcat installations on host1 and host2, we can use the “dry-run” mode of the rsync command.

In the following example, we assume that you have ssh access to both of your Tomcat hosts, the installations are in /opt/tomcat and the “tomcat” system user has read access to all relevant files and directories of the installation:

ssh tomcat@host1
rsync --archive --checksum --dry-run --verbose --delete \
      --exclude temp --exclude work --exclude logs --exclude webapps \
      /opt/tomcat/ tomcat@host2:/opt/tomcat/

This will list

  • All files that differ in checksum
  • All files that only exist on host2 (look for ‘deleting [filename]’)

Run the same commands with host1 and host2 switched, to also see the files that only exist on host1.

We excluded the temp, work and logs directories because they are variable in nature.
We also excluded the webapps directory because we only wanted to compare the base installation.

Categories: bash, coding, cygwin, debian, linux, mac os

Zulu – Certified OpenJDK 8 builds for all operating systems

May 5, 2015 1 comment

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)

Using sipgate.de on Linux with Linphone SIP client

March 17, 2015 4 comments

Note: This is a follow-up blog entry to yesterday’s post about using the Zoiper SIP client on Linux. Linphone works comparably well so far and if I won’t come across any issues, I will recommend Linphone, since it is fully Open Source, which future-proofs is existence and allows others to contribute and improve the software better than for a closed-source product like Zoiper.

Linphone is a GPL licensed SIP client (“softphone”). It has been around since 2001 and is actively developed by the French company Belledonne Communications.

As the name suggests, the software was first developed for Linux but has gradually become truly cross-platform, now supporting Windows, MacOS, Linux, Android, iOS, Windows Phone 8 and most recently a web edition. For most operating systems, simply visit linphone.org and follow the download and installation steps indicated there.

Users of GNU/Linux distributions like Debian, Ubuntu, etc, install the distribution package through their favorite package manager. On my Debian stable (“wheezy”) I did this today:

sudo apt-get install linphone

Then I started up Linphone from the XFCE Start menu, where it is listed in the “Internet” submenu. I canceled the account setup wizard because it didn’t seem to work for me, disabled Video in the Options menu because I am not planning to use it yet, then selected Options – Preferences – Manage SIP accounts and configured my sipgate.de account like this:

Your SIP identity: sip:3998984@sipgate.de
SIP Proxy address: sip:sipgate.de

Screenshot

linphone-sipgate-account

Note that “3998984” is my sipgate.de SIP account name, so you have to substitute it with yours, but note that it is usually not the same as your sipgate.de web login username.

After this initial setup, I successfully tested the account and my headset by calling the sipgate.de test number 10005, which works very similarly to the Skype test call feature.

For personalized config information you can log in at sipgate.de and consult the “Konfigurationshilfe“, selecting one of the Linphone entries from the softphone device lists. I have a sipgate.de basic account, so if you are on a different plan, details may vary slightly.

If this blog post was helpful and/or if something seems inaccurate, please leave a comment. Happy telephoning …

Categories: bash, debian, linux, mac os Tags: , , , ,

Human readable timestamp for filenames

November 13, 2014 Leave a comment

I use this bash alias (should work in Linux, Cygwin, probably MacOS, maybe other Unixes):

alias timestamp="date --rfc-3339=ns | tr ' '  '_'"

Then use it like this for example to archive a file:

mv somefile somefile_$(timestamp)

You should see something like

`somefile' -> `somefile_2014-11-13_11:45:46.980175800-04:00'

If you don’t like colons in file names, change tr ' ' to tr ' :'.