The computer on the shelf in WarGames

I’ve just finished reading the first 3 chapters of Fire in the Valley, a history of the development of the PC. These first chapters were history prior to development of the Altair (which was before my time, but I’m familiar with the history), and centered on IMSAI and development of their 8080 computer.

Not having any personal experience with an IMSAI these first chapters were rather dry and slow going, but on the last page of chapter 3 it mentions IMSAI’s one and possibly only claim to fame was that an IMSAI 8080 was used as a prop in the background of WarGames when Matthew Broderick’s character was seen using his computer at home. Given that WarGames is one of my favorite films, this suddenly brought some conext and interest to this first part of the book. I always though that was an Altair on the shelf in the background, but apparently it’s an IMSAI 8080. More info on their site here.

(Page views: 36)

Java Posse Podcast – now officially ended!

If you spotted this post on the Java Posse’s Google Group, then you might have already seen this link to a photo on Twitter from Devoxx 2014. If you were at Devoxx 2014 and attended the live Java Posse session, then you already know this too. Of course, if you regularly listen to the podcasts then you would have noticed that the regular podcast sessions dropped off noticeably last year.

The Java Posse’s final podcast session (#461), recorded from Devoxx 2014 is now live on their feed.

I’ve listened to the majority of their podcasts (and the early Javacast episodes) since the first sessions in 2005, it’s definitely the Java related technology podcast that I’ve listened to and followed the most, and so it’s sad that the guys have finally decided to call it quits and not continue the series any more.

Thanks to the guys for producing the session all these years, you’ll be missed!

So where are they now?

What am I listening too now? I’ve listened to a couple of episodes of the Java Pub House, which is ok, and on my todo list is Java Enterprise Newscast. But I don’t think you can replace The Java Posse. Thanks again guys, and good luck in your other endeavors.

(Page views: 89)

Upgrading OS/2 Warp 4 to the latest fixpack14 (and other useful stuff)

Windows 10 is on the way. So I spent the weekend installing and configuring OS/2. :-)

Since OS/2 was recently released into the public domain, you can pick up copies of the install disk images from archive.org. As you work through the install, at some point you realize you need to convert or find out how to use the floppy disk image files. When installing to a VirtualBox VM, I found I couldn’t get the disk images to work from archive.org, but the ones in the format from WinWorld here work flawlessly.

WinWorld has iso images for 4.0 and 4.5x but I could only get 4.0 to install to a VM disk. That’s not an issue as you can download and install FixPack15 with takes you to the latest (and last) version of OS/2.

Most of the updates I found I needed were covered in the extensive instructions on this site here. I found I didn’t need everything though (I skipped the USB mouse drivers as it seems running in VirtualBox takes care of making sure the guest OS sees the touchpad and keyboard on my MacBook).

Along the way there are a few utils that you need to gather to help with the install of the other steps, in particular:

  • diunpack (used to unpack the fixt144.dsk disk image in MPTS8620)
  • dskxtrct (used to extract all other .dsk images for the MPTS fixpacks)
  • unzip utils, most would work but I used this one, unzip 5.51
  • fastkick141 – I used this to install MPTS8620 – more below

So here was the list I narrowed down to:

  • Fixpack 15 – can be found in other places, but this zip on Hobbes contains everything ready to go. Unzip and run install.cmd
  • gengradd drivers for supporting higher display resolutions. I used gradd083.exe from here, Unzip it by running it and passing options ‘-dir -over’ to preserve the subdirs. Then start the install with: ‘setup gen’
  • MPTS8610 – fixpack for network driver stack. Prereq for 8620. Use dskxtrct to extract all the .dsk images to a temp dir and then run service.
  • MPTS8620 – this provides TCPIP32.dll that is needed for most of the more common browser releases (Firefox, Seamonkey etc) and other network tools. This one didn’t have a script to self-install. Use dskxtrct to extract all the .dsk images to a temp dir, apart from fixt141.dsk which I found would only uncompress using diunpack. To install, fastkick141 into the same dir as all the uncompressed disks, and then run (I think) fix.cmd.
  • A number of later apps, Firefox and Seamonkey, require a version of LIBC (you’ll get an error saying LIBC065 missing if you try to run without it).You can pick up a zip with just the DLLs from here, click the ‘just kLIBC’ link to get the zip. Copy the *.DLLs to c:\os2\dll
  • There are two additional dependencies for the latest browsers linked from the top of the page here – fntcfg and pthread. Download and copy the DLLs to c:\os2\dll

At this point I think you’ll be setup to run most of the more recent apps, including latest versions of Firefox and Seamonkey built for OS/2.  Enjoy!

(Page views: 95)

Mounting iso disk images on an OS/2 guest running on Virtual Box

After installing OS/2 Warp 4 I never did get round to installing the latest Fixpack15 or the updated gradd display driver. I’ve just been playing around with it this evening though and made some progress.

First, the version I installed had a default UK keyboard layout which got in the way of trying to type any path locations as I couldn’t find where the backslash was :-) I fixed this by editing config.sys and changing this line:

DEVINFO=KBD,UK166,C:\OS2\KEYBOARD.DCP

to this:

DEVINFO=KBD,US,C:\OS2\KEYBOARD.DCP

I then worked out a way of creating iso disk images of the files I wanted to transfer across, mount them as as CD image in VirtualBox, and then access the files from the OS/2 guest.

On my Mac, I used Disk Utility to create a new disk image with the following settings:

diskimage for os2

After creating the image it is automatically mounted in Finder. Once done, unmount it, and then from Terminal, convert it to a .iso with:

hdiutil makehybrid -iso -joliet -o [filename].iso [filename].cdr

I got this from this post. I also found this works if you create the first disk image as a Mac DMG image too. I suspect you still need to create it with the correct CD size and FAT format though.

From this point I started working through the steps here, and got FP5 installed ok using the SimplyFix41 utility, and next I’m going to jump up to FP15 and also install the gradd display drivers. Also will be trying out the last version of Netscape for OS/2 and see if that works ok. Fun times!

(Page views: 87)

Using Hibernate OGM to persist objects to MongoDB (deploying to Wildfly 8.2)

For storing data when you’re less concerned about relationships between your data but more interested in entities (documents) and their attributes, a document-based datastore like MongoDB makes a lot of sense. MongoDB’s Java Driver API though is rather clunky in it’s usage pattern.

So I started looking for alternatives. The MongoDB Java ecosystem page has a good collection of some libraries to consider. Initially I took a quick look at MongoJack, which looked like an interesting approach to map between Java POJOs to json data representations (using the Jackson api). I remember reading a while back at Morphia, and was interested what a JPA based approach to interacting with MongoDB would look like. Somewhere I stumbled across the Hibernate OGA project – being a fan of ORM approaches popularized by Hibernate, I wanted to take a look.

The current Hibernate OGM docs (4.1) are here.

For deploying on JBoss/WildFly, OGM is supplied as modules in a zip that you can unzip directly into the modules dir on the server. See here more more details.

Deploying to OpenShift, as for most cartridges, your configuration values are defined in environment variables. Instead of hardcoding the properties and values in your persistence.xml, you can have them passed to your server at startup by adding them to a JAVA_OPTS_EXT file like this (do this one time to create the file):

echo "-Dhibernate.ogm.datastore.host=$OPENSHIFT_MONGODB_DB_HOST \
    -Dhibernate.ogm.datastore.port=$OPENSHIFT_MONGODB_DB_PORT \
    -Dhibernate.ogm.datastore.username=$OPENSHIFT_MONGODB_DB_USERNAME \
    -Dhibernate.ogm.datastore.password=$OPENSHIFT_MONGODB_DB_PASSWORD" \
    > .env/user_vars/JAVA_OPTS_EXT

Mapping your Entities and Id properties

At some point support for the ObjectId MongoDB id type was added. In the current docs don’t use the uuid id generator, use the ‘objectid’ type described here instead:

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Type(type = "objectid")

 

JPA Persistence.xml

Here’s what my persistence.xml looks like:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
             version="2.0">

    <persistence-unit name="HibernateOGM_PU" transaction-type="JTA">
        
        <!-- Hibernate OGM provider -->
        <provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
		<class>if entities not in same jar, list here</class>
        
        <properties>
            <property name="hibernate.transaction.jta.platform"
                      value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />
            <property name="hibernate.ogm.datastore.provider" value="mongodb" /> 

			<!-- this property is required, and not hibernate.ogm.mongodb.database per docs -->
         	<property name="hibernate.ogm.datastore.database" value="dbname"/>
            <!-- <property name="hibernate.ogm.mongodb.database" value="dbname"/> -->
 
 			<!-- host, port, userid and password are from env vars on OpenShift
 			See example config here https://github.com/hibernate/hibernate-demos/tree/master/hibernate-ogm/hiking-demo
        	<property name="hibernate.ogm.mongodb.host" value="127.0.0.1"/>
            <property name="hibernate.ogm.mongodb.port" value="27017"/>
            -->
        </properties>
    </persistence-unit>
</persistence>

(Page views: 298)

OutOfMemoryError initializing HornetQ on OpenShift WildFly 8.2

Saw this error starting up my JMS queue on WildFly 8.2 running on OpenShift:

2015-01-02 21:03:46,417 WARN  [org.hornetq.ra] (default-threads - 1) HQ152005: Failure in HornetQ activation org.hornetq.ra.inflow.HornetQActivationSpec(ra=org.hornetq.ra.HornetQResourceAdapter@b1dce2 destination=jms/queue/spot destinationType=javax.jms.Queue ack=Auto-acknowledge durable=false clientID=null user=null maxSession=15): java.lang.OutOfMemoryError: unable to create new native thread
        at java.lang.Thread.start0(Native Method) [rt.jar:1.8.0_05]

Based on this thread, a suggestions was to reduce the JMS thread pool – my current config (possibly carried over from my prior deployment on WildFly 8.1)

<subsystem xmlns="urn:jboss:domain:messaging:2.0">            <hornetq-server>
   <journal-file-size>102400</journal-file-size>
   <thread-pool-max-size>${messaging.thread.pool.max.size}</thread-pool-max-size>
   <scheduled-thread-pool-max-size>${messaging.scheduled.thread.pool.max.size}</scheduled-thread-pool-max-size>

So based on the recommendation in the linked post above, I set thread-pool-max-size and scheduled-thread-pool-max-size to 20 and this fixed my OutOfMemory issue.

(Page views: 217)

JAX-WS endpoint deployment issue on OpenShift WildFly 8.2

When attempting to deploy an app with a JAX-WS endpoint to WildFly on OpenShift, attempting to hit the ?wsdl url to check the generated wsdl gives this error:

22:49:49,502 ERROR [io.undertow.request] (default task-3) UT005023: Exception handling request to /ExampleEndpoint: javax.xml.ws.WebServiceException: JBWS024032: Cannot obtain endpoint jboss.ws:context=,endpoint=example.endpoint.ExampleEndpoint at org.jboss.wsf.stack.cxf.transport.ServletHelper.initServiceEndpoint(ServletHelper.java:82)

From some Googling, it appears this issue is related to the fact that on OpenShift your app is deployed as the root context and so you need to add a jboss-web.xml to define that your app is deployed at the root context (and not at /ROOT/, since the deployed app is ROOT.war) so your wsdl can be found at the expected url.

(Page views: 201)

Updating the endpoint URL for a generated JAX-WS client

When you generate a JAX-WS client from a locally deployed service, the URL for the endpoint and the WSDL are hardcoded into the generated client code. If you redeploy the service elsewhere (i.e. moving from a local development environment to a test or production environment), then you could regenerate against the new URL for the service, but the JAX-WS api does allow you to programmatically specify the endpoint and wsdl locations.

From this post, the key is to use the BindingProvider to specify a new value for BindingProvider.ENDPOINT_ADDRESS_PROPERTY:

BindingProvider bp = (BindingProvider)port;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://your_url/ws/sample");

By itself though, this gave me an additional exception as it appears the client it still attempting to locate the WSDL. To work around this, you can also pass the new WSDL url location when you instantiate the generated client (this is discussed here). Before using the BindingProvider snippet above, pass the updated urls into the client like this:

EndpointService service = new EndpointService(
    new URL("http://your-url-to-endpoint/Endpoint?wsdl"),
    new QName("http://namespace-of-endpoint-from-wsdl/",
						"EndpointService"));

SpotCollectorEndpoint endpoint = service.getSpotCollectorEndpointPort();

 

(Page views: 159)

Adding dependent jars to your OpenShift Maven repo – take 2

Looking at my last post when I last did this, it’s been a year since I last deployed something to OpenShift with my own custom dependent jars :-) And looks like some of the paths might have changed since last time, but the approach is still the same.

What worked for me this time:

mvn install:install-file -DgeneratePom=true 
  -Dfile=../../jar-file-name-inc-version-number.jar 
  -DgroupId=your-group-id -DartifactId=artifact-name 
  -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar

Looks like the relative path to where the jar gets copied to in your remote account changed slightly since last time.

The odd thing is I still ran into issues with my prebuild script file losing it’s executable flag, and it never seems to run as part of my build, but I can run it manually my ssh’ing into my account and just running it by hand.

(Page views: 144)

Wiring an Adafruit i2c LCD Pi Plate to an Arduino

I have an Adafruit i2c 2 line LCD Pi Plate that I’ve used for projects with my Raspberry Pi. It has a block of header pins that slot down onto the GPIO pins on the Pi. It seems that it’s pretty similar to other LCDs for the Arduino, so with some reading around and experimenting, it does wire up and work perfectly with the Arduino too. This post gave the me starting point for what pins wired to where.

In summary, this is how I wired it up – the Raspberry Pi pin references are the pin names that the Pi Plate would normally connect to, and which Arduino pins I connected them to:

Pi Plate Pin -> Arduino Pin

Pin2 -> 5v

Pin6/grnd -> grnd

Pin3 -> A4/SDA

Pin5 -> A5/SCL

The Adafruit LCD Arduino library works with the LCD Pi Plate without any other changes.

(Page views: 172)