Happy 20th Birthday Java! What’s your Java story?

I started learning Java in 1996, from the book ‘Learn Java in 21 Days’, published by SAMS. For some reason I even still have the same book:wpid-20150521_081822.jpg

At the time I was working for Royal Sun Alliance and we were doing OS/2 client/server development using Application Manager, against a CICS/COBOL backend. One of the guys I was working with, Mike, said I should take a look at this new language called Java because it can run on any platform. At that time developing on OS/2 and seeing demand slowing for OS/2 AM developers, the promise of a development language not tied to a specific platform seemed an attractive offer, and a potential ticket to move away from OS/2.

I started working through the exercises in the book, building my first Applets – I think one of the first applets I built was a lottery ticket number generator that I had on my webpage at the time. In 1996 it was pretty cool to have interactive content on your web site! Even though this turned out to not be Java’s strong point (most Java development is arguably server side now days), it was where it all got started.

Although I continued to play with Java in my own time, it wasn’t until I changed jobs in 1997 and moved to TSW/Indus, a software house developing Enterprise Asset Manager software, that I had the opportunity to start Java development ‘on the job’. At the time the company had a Powerbuilder/Oracle PL/SQL based client/server product, and while in that first year I cross trained to Powerbuilder, we started prototypes of building a web-based replacement for the Powerbuilder client, against a Java backend. At the time this was using a ‘Java Cartridge’ on Oracle Application Server (I think it was called), and the Java code was invoked CGI-BIN style using HTTP GET query string parameters that were passed into Java code on the server.

At some point pretty soon after these first prototypes the Servlet API came along, and then EJB1.x came along… looking back which was an absolute nightmare from a developer productivity point of view. Somewhere in there I also dabbled with some CORBA based backend running on a server that I think was called IONA (although those memories are long gone now).

I’ve seen a lot of incredible changes in the Java space, and 19 years later from where I started, I’m still coding Java and it’s still going strong!

Calling C printf from ARM ASM

A while back I started to learn some ARM assembly on the Raspberry Pi. In my previous snippets, I was using SWI to do a system call to write to stdout, but it appears syscall 4 to write to stdout only writes Strings – if you have a byte value, this approach doesn’t work (without converting to a String first?)

From this question here, it appears you can call C functions like printf, which seems like cheating a bit, but I guess it gets the job done.

Here’s a quick snippet to add two numbers, and then print the result using printf with a string containing %d to substitute the result into the String:

[code]
.global main
.extern printf
main:
push {ip, lr}
mov r3, #1 /* move 1 to r3 */
mov r4, #2 /* move 2 to r4 */
add r4, r3, r4 /* r4 = r3 + r4 */
_ouput:
ldr r0,=output /* load address of output string */
mov r1, r4 /* move r4 result to r1 to include as param in string */
bl printf /* call printf */
_exit:
MOV R1, #0
MOV R7, #1
SWI 0
.data
output:
.asciz "Result: %d\n"
[/code]

Where previously I was compiling and linking in two steps with as and ld, it seems this doesn’t work if you are referencing C functions too, so for this example, compile with: ‘gcc add.s -o add’

This snippet and a few others I’ve started to collect I’ve shared in a github repo here: https://github.com/kevinhooke/learning-arm-asm

Enjoy your additional ‘leap second’ on June 30th 2015

This year on June 30th at 23:59:59 UTC, rather than the 59th second ticking to 00, there is an additional second added so clocks will tick to 60 before going to 00.

If this sounds rather odd, check out a more detailed explanation here on Wikipedia.

So what does this mean for us as software developers? Well, for Java JVMs, you can use the provided tzupdater tool (updates described here, and usage described here), download the updated timezone file and apply the update. For other platforms and operating systems, check release notes and updates from your vendors (e.g. For RHEL, check here).

Should you be worried about the impact to your systems? Well that depends on how sensitive your system is to the date/time and synchronization with other systems that you integrate with. For example, the ICE futures exchange have announced they are taking their systems down for an hour overlapping with 23:59:59 on June 30th to avoid any unexpected issues. Whether you have to go that far depends on your system.

 

node.js process.cwd() “no such file or directory” starting http-server

When starting the node.js http-server, I got this error:

[code]Error: ENOENT, no such file or directory
at Error (native)
at Function.startup.resolveArgv0 (node.js:720:23)
at startup (node.js:63:13)
at node.js:814:3[/code]

From the post here, it seems this error can occur if you attempt to start the server in a dir that’s already been deleted. In my case I had renamed a folder that contained the folder where I was attempting to start the server. cd’d up a couple and into the new/renamed folder, and problem solved.