Posts Tagged Java

 

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 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.

Continue reading "Java Stream Methods and Unix Pipeline Commands: A Dictionary"

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 Scala language.

Continue reading "A Tiny Review of Scala"

Greek Numerals in OpenOffice.org

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 ACCU 2009 conference. 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 Unicode block, and got bitten by an unexpected runtime error. Angelika Langer, 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 MIDlet 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 My Location service. Here is a Google Earth example of the data I'm collecting. Yesterday, 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 umlgraph.org.

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 got published, 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 foreach construct for iterating over collections. The construct can be used on arrays and on all classes in Java's Collection framework. 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 values. 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 else if statements, instead of a switch, 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".

Continue reading "Warum einfach, wenns auch kompliziert geht?"

Java Makes Scripting Languages Irrelevant?

Simplicity does not precede complexity, but follows it.

— Alan J. Perlis

Continue reading "Java Makes Scripting Languages Irrelevant?"

UMLGraph Update

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:
— 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.

Continue reading "The Efficiency of Java and C++"

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"

Become a Unix command line wizard
edX MOOC on Unix Tools: Data, Software, and Production Engineering
Debug like a master
Book cover of Effective Debugging
Compute with style
Book cover of The Elements of Computing Style
Syndication
This blog is also available as an RSS feed:

Category Tags
AI (4)
AWS (4)
Android (2)
Apple (11)
C (21)
C++ (17)
Computers (58)
Databases (6)
Debugging (10)
Discussion (6)
Electronics (15)
Environment (1)
FreeBSD (26)
Funny (14)
GSIS (5)
Git (2)
Google (6)
Government (3)
Hacks (26)
Hardware (27)
History (13)
Information systems (1)
Internet (12)
Java (26)
JavaScript (1)
Linux (7)
Management (27)
Microsoft (11)
One Laptop Per Child (3)
Open source (58)
Opinion (30)
Parenting (11)
Perl (13)
Photos (13)
Politics (5)
Programming (110)
Python (3)
R (1)
Raspberry Pi (6)
Risks (7)
Scala (1)
Science (35)
Security (26)
Sights (19)
Smartphones (3)
Software (22)
Software engineering (93)
Standards (7)
System administration (46)
Teaching (9)
Technology (33)
Testing (3)
Tips (43)
Tools of the Trade (52)
Travel (9)
UML (6)
Unix (53)
Web (31)
Windows (17)
Writing (46)
XML (10)
vim (5)
Archive
Complete contents (382)
2024 (3)
2023 (5)
2022 (2)
2021 (3)
2020 (15)
2019 (4)
2018 (5)
2017 (20)
2016 (7)
2015 (6)
2014 (5)
2013 (13)
2012 (17)
2011 (14)
2010 (13)
2009 (40)
2008 (40)
2007 (41)
2006 (48)
2005 (44)
2004 (30)
2003 (7)

Last update: Wednesday, December 4, 2024 1:52 pm

Creative Commons Licence BY NC

Unless otherwise expressly stated, all original material on this page created by Diomidis Spinellis is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.