snoofle

After surviving 35 years, dozens of languages, hundreds of projects, thousands of meetings and millions of LOC, I now teach the basics to the computer-phobic

Sep 2013

But...It's Reading One Row at a Time!

by in CodeSOD on

We've all written a DAO:

  Connection        con  = ...;
  PreparedStatement ps   = con.prepareStatement("select ...");
  ResultSet         rs   = ps.executeQuery();
  List<YourEntity>  list = new ArrayList<YourEntity>();
  while (rs.next()) {
    // extract individual column values
    YourEntity entity = new YourEntity(...);
    list.add(entity);
  }
  rs.close();
  ps.close();
  con.close();
  return list;

The Key to the City

by in CodeSOD on

In New York City, especially after September 11, they take security seriously. There are numerous police officers patrolling around in high-priority places. There are armed military personnel with assault weapons in-hand in heavily travelled areas. They even make you use electronic key cards to access public bicycles. Multiple levels of picture identification and key card access are required for most major institutions.

Bruce K. found this snippet of code to destroy stuff. There is no form with a password field that calls this method. It's just out there. Unprotected. Waiting for someone to figure out how to call it...


Daylight Failing Time

by in CodeSOD on

A. Dev had just inherited a C# project to finish and maintain. The application was so infested with WTFs that the stench overpowered any working code. The story behind the application was very simple: the customer originally let the CTO's nephew develop the application as a consultant. The nephew then disappeared and upper management got worried. The CTO told management that his plan was to outsource the rest of the development of the application in order to ensure good-quality code.

Once A. Dev discovered blocks like the following, he realized that they had been not assigned with "completing the development of the application" but rather a full rewrite:


The Cape Caper

by in Feature Articles on

As a profession, we have the perfect scam for our customers. Every time technology marches far enough ahead, and support for the old technology wanes, we convince management to allow us to rewrite the widget, or better yet start over from scratch. Over 30 years. I personally have rewritten the same Mortgage Backed Securities (or equities, or Corporate Bonds, or Treasuries) trading system for a variety of customers in C, C++, Java 1.2, Java 1.4, Java 1.5 and Java 1.6. Oh, they ask for a new feature here and there, but the bulk of the functionality never changes; they just keep paying us to do what is essentially the same work over and over. It's an unintended scam truly worthy of the descriptor: caper!

Capes are cool. They create an aura of mystery. Who doesn't feel it when they see Batman swooping in? Or Superman leaping tall buildings in a single bound? Capes are even more awesome when worn by someone that embodies evil. For example, Count Dracula. Or Doctor Doom. Of course, not all capes inspire awe; some inspire fear, dread and despair...