Java Stream Methods and Unix Pipeline Commands: A Dictionary
While preparing my class notes for functional programming in Java I was struck between the neat correspondence between many Java
Continue reading "Java Stream Methods and Unix Pipeline Commands: A Dictionary"
Stream methods and Unix commands. I decided to organize the most common of these in a dictionary form that allows the mapping between the two. I'd very much welcome comments regarding common patterns that I've missed.
Programming Languages vs. Fat Fingers
A substitution of a comma with a period in project Mercury's working Fortran code compromised the accuracy of the results, rendering them unsuitable for longer orbital missions.
How probable are such events and how does a programming language's design affect their likelihood and severity?
In a paper I recently presented at the
4th Annual International Workshop on Evaluation and Usability of Programming Languages and Tools
I showed results obtained by randomly perturbing similar programs written in
diverse languages to see whether the compiler or run-time system
would detect those changes as errors,
or whether these would end-up generating incorrect output.
Continue reading "Programming Languages vs. Fat Fingers"
Why are AWS Command-Line Tools so Slow?
Amazon's Elastic Compute Cloud command-line tools are useful building
blocks for creating more complex shell scripts.
They allow you to start and stop instances, get their status,
add tags, manage storage, IP addresses, and so on.
They have one big disadvantage: they take a long time to run.
For instance, running ec2-describe-instances for six instances
takes 19 seconds on an m1.small AWS Linux instance.
One answer given,
is that this is caused by JVM startup overhead.
I found that hard to believe,
because on the same machine a Java "hello world" program executes in 120ms,
and running ec2-describe-instances --help takes just 321ms.
So I set out to investigate, and, using multiple tracing tools and techniques,
this is what I found.
Continue reading "Why are AWS Command-Line Tools so Slow?"
How to Decrypt "Secrets for Android" Files
Secrets for Android
is a nifty Android application that allows you to securely store
passwords and other sensitive data on your Android phone.
Your data are encoded with your supplied password using strong
cryptography and are therefore protected if your phone gets stolen.
Although the application offers a backup and an export facility,
I found both wanting in terms of the availability and confidentiality
associated with their use.
Continue reading "How to Decrypt "Secrets for Android" Files"
A Tiny Review of Scala
Earlier today I finished reading the
Programming in Scala book.
My review of the book should appear soon in the
reviews.com site and the
ACM Computing Reviews.
Here I outline briefly my view of the
Continue reading "A Tiny Review of Scala"
Greek Numerals in OpenOffice.org
doesn't support Greek numerals,
and this is a problem for its Greek localization,
because such numerals are often used for section and list numbering.
As an exercise in large scale
code reading and in the
writing of code I'm supposed to teach to undergraduate students,
I decided to contribute an implementation to OpenOffice.org.
Continue reading "Greek Numerals in OpenOffice.org"
Fixing the Orientation of JPEG Photographs
I used to fix the orientation of my photographs through an application
that would transpose the compressed JPEG blocks.
This had the advantage of avoiding the image degradation of a
decompression and a subsequent compression.
Continue reading "Fixing the Orientation of JPEG Photographs"
A Tiling Demo
Over the past (too many) days I've been preparing my presentation for the
At one point I wanted to show how loop tiling increases locality of reference
and therefore cache hits.
Surprisingly, I could not find a demo on the web, so I built one from scratch.
Here are two applets demonstrating memory accesses during a matrix raise to the
power of two operation.
Continue reading "A Tiling Demo"
UMLGraph Version 5.1
Over the summer two articles presented
UMLGraph to the masses.
Paul Duvall wrote on IBM developerWorks an article titled
Automation for the people: Pushbutton documentation, and
Meera Subbarao published on DZone Javalobby another piece on how to
reverse-engineer source code into UML diagrams.
In addition, I received a number of interesting patches and contributions.
As a result I decided it was time to release UMLGraph version 5.1.
Continue reading "UMLGraph Version 5.1"
The Mysterious TreeMap Type Signature
For my lecture notes on file handling
I wrote a small Java program to display the number of characters
that fall in each
and got bitten by an unexpected
a wizard of Java Generics, kindly provided me with an explanation
of the JDK design,
which I'd like to share.
Continue reading "The Mysterious TreeMap Type Signature"
Curing MIDlet Bluetooth Disconnects
Over the last few days I've been writing a
to collect GPS coordinates and cell identifiers.
I'm doing this
in an effort to look at what algorithms might be needed
in order to implement something similar to Google's
Here is a Google Earth example of the data I'm collecting.
I reached a point where I was collecting all the information I needed,
but the program was often plagued by random disconnections of the Bluetooth
link to the GPS.
Continue reading "Curing MIDlet Bluetooth Disconnects"
An Update on UMLGraph
Today I released version 5.0 of UMLGraph.
This release contains a couple of important changes: six new shapes
(components, nodes, collaborations, use cases, notes, and active classes),
a facility for adding notes, and the hosting and packaging under its
own domain name
Continue reading "An Update on UMLGraph"
Using the Open-Sourced Java Platform
Having access to a system's source code is liberating.
I've felt this since I first laid my eyes on the source code of the
9th Edition Unix in 1988, and I saw this again as I used the freshly
open-sourced Java platform
to implement a UMLGraph
feature that has been bugging me for more than a month.
Continue reading "Using the Open-Sourced Java Platform"
Make vs Ant: Observability
I've long felt uncomfortable with ant
as a build management tool.
I thought that my uneasiness stemmed from the verbose XML used for
describing tasks, and the lack of default dependency resolution.
Today, email from a UMLGraph user
struggling with a complex ant task
made me realize another problem:
lack of observability.
Continue reading "Make vs Ant: Observability"
The Verbosity of Object-Oriented Code
As I refactored a piece of code from an imperative to an
object-oriented style I increased its clarity and reusability,
but I also trippled its size.
This worries me.
Continue reading "The Verbosity of Object-Oriented Code"
Code Quality: The Open Source Perspective
My new book
Code Quality: The Open Source Perspective
three years after I started writing it.
The book owes more to open source software than any of the books
dealing with Linux, PHP, Apache, Perl or any other book covering
a specific technology.
Continue reading "Code Quality: The Open Source Perspective"
Efficiency Will Always Matter
Many claim that today's fast CPUs and large memory capacities make
time-proven technologies that efficiently harness a computer's power irrelevant.
I beg to differ, and my experience in the last three days demonstrated
that technologies that originated in the 70s still have their place today.
Continue reading "Efficiency Will Always Matter"
Supporting Java's Foreach Construct
Java 1.5 supports a new
construct for iterating over collections.
The construct can be used on arrays and on all classes in Java's Collection
I searched the internet for an example on how to make my own
classes iterable with this construct, but could not find an example.
Continue reading "Supporting Java's Foreach Construct"
Warum einfach, wenns auch kompliziert geht?
(Why make it simple, when you can also make it complicated?)
Consider the task of associating code with specific data
Using a multi-way conditional can be error-prone, because
the data values become separated by the code.
It can also be inefficient in the cases where we have to use cascading
Continue reading "Warum einfach, wenns auch kompliziert geht?"
else if statements, instead of a
which the compiler can optimize into a hash table.
In C I would use an array containing values and function pointers.
My understanding is that the Java approach involves using the
Strategy pattern: a separate class for each case,
and an interface "to rule them all".
Java Makes Scripting Languages Irrelevant?
Simplicity does not precede complexity, but follows it.
— Alan J. Perlis
In computing we often solve a complex problem by adding another level of indirection. As an example, on Unix file systems an index node, or inode, data structure allows files to be allocated concurrently and sparsely, and yet still provide an efficient random access capability. When we want to customize large and complex systems or express fluid and rapidly changing requirements a common tool we employ is to add a scripting layer on top of the corresponding system. An early instance of this approach was employed in Dan Murphy's TECO editor developed on the DEC PDP-1 computer in 1962–63: its command language also doubled as an arcane (to put it politely) macro language.
Continue reading "Java Makes Scripting Languages Irrelevant?"
I have updated the UMLGraph program to
run under Java 1.5.
Continue reading "UMLGraph Update"
The Efficiency of Java and C++, Revisited
A number of people worked on replicating the results and optimizing
the programs I listed in my earlier blog entry.
Continue reading "The Efficiency of Java and C++, Revisited"
An Open Source Java Metrics Toolset Is Hard to Find
I spent many hours looking for a stand-alone open source metrics toolset
for Java programs.
Unfortunately, I was not able to find a single tool that would
fit my (relatively modest) requiremets.
Continue reading "An Open Source Java Metrics Toolset Is Hard to Find"
The Efficiency of Java and C++
I seem to have trouble convincing my neo-Turk students that Java's design makes
it inherently less efficient than C++.
The arguments often and up in an exchange of comments like:
Continue reading "The Efficiency of Java and C++"
— This (micro) benchmark executes with the same speed when written in Java and C.
— Yes, but a realistic application, like Eclipse takes ages to start up.
— You are only complaining about the cost of the runtime startup
costs and JIT compilation, which are quickly amortized, and, anyway,
Eclipse offers many more features than other IDEs.
and so on.
I therefore wrote a small program to demonstrate the exact problems of
Java's design decisions.
Java: the New Straightjacket
I first learned to program on a home computer in Basic. At first
it was fun, but after a point it became frustrating, when I realized
that I was living inside a walled garden. Many interesting programs,
such as those interfacing with the display controller, simply could
not be written in standard Basic. Luckily, this limitation forced me
to move to Pascal, assembly code, and C.
Continue reading "Java: the New Straightjacket"
Computer Languages Form an Ecosystem
(This is a copy of an
article I posted on
slashdot on March 15th,
in response to a discussion titled
C Alive and Well Thanks to Portable.NET.
Many posters argued that the C language is dead.
I add my response here, because one month after its original slashdot submission,
I am still getting web site hits from it.)
Continue reading "Computer Languages Form an Ecosystem"