Jul 16

Remember to COMMIT to the SQLPlus gods

Tech 275 Comments »

I have recently been working with two databases in one architecture: PostgreSQL and Oracle.

I had one terminal open with psql, and another with sqlplus.

I was fixing some data…. and didn’t understand why my groovy script wasn’t seeing the newly fixed data from the Oracle side.

Then it hit me. DUH! The *I* in ACID!

One COMMIT; later and everyone was happy.

Jul 16

Generic type parameter naming A.K.A Line Noise :)

Tech 36 Comments »

Eric Gunnerson has said why the C# team migrated to single character names for generic type parameters.

E.g.

From:

class Dictionary<Key, Value>

to:

class Dictionary<K, V>

The confusion comes in when you see:

public void Process(Key k)

Why didn’t Microsoft using some form of Hungarian and have gtKey (generic type Key)? :)

There is the same issue with Java generics. You look at the JavaDoc for Java 5 and you see lovely things like:

Set<Map.Entry<K,V>>

Yum :) Is this mess really worth it for generics?

I would much rather play with this dense noise:

for (order in customers.findAll { it.location.code == “CO” }.orders)
{
println(”order ${order.id} has value ${order.value}”)
}

Giddy up!

Jul 16

Apply Design by Contract to Java software development with AspectJ

AOP, Tech No Comments »

Are you an Eiffel fan that wishes this Design By Contract stuff was available in Java?

There are a few tools out there to help, such as iContract: Design by Contract in Java.

AOP offers a nice way of working with these anal pre and post conditions ;)

Your Java code often needs to interact with external components when you develop enterprise software. Whether your application must communicate with a legacy application, an external business system, or a third-party library, using components you don’t control introduces the risk of unexpected results. IBM IT Specialist Filippo Diotalevi shows how aspect-oriented programming (AOP) can mitigate this risk by helping you design and define clear contracts between components while keeping your code clean and flexible.

Read Apply Design by Contract to Java software development with AspectJ

Jul 16

Finite State Machine in ASP.NET

Tech No Comments »

I found Finite State Machines, Wizards, and the Web by Michele Leroux Bustamante (ASP.NET guru).

Via a tool, and some trusty XML you can build a nice finite state machine for your web tier (something we have been doing a long time on the web).

It often amazes me how many sites do not use this, OR a workflow system. I think there is a lot of room for exploration there.

Jul 15

Women caused someone to crash into me!

Personal No Comments »

I was sitting at a stop light in Boulder, Colorado. Minding my own business.

Then.

BANG!

I was hit from behind by a “dude” in an SUV.

It was a tame crash, and his car had more damage than mine (thanks to the trailer hitch on my car which sticks out).

The reason for the crash?

“I was staring at those college chicks. What can you do”

*sigh* now I have to deal with insurance :/

Jul 15

Spring Aspect Container with AspectWerkz too

AOP, Java, Lightweight Containers, Tech 1 Comment »

The Spring Framework seems to play nice. They have their own MVC framework, yet you can plugin any that you may wish (WebWork, Tapestry, Struts [sorry], etc).

There is a similar story with AOP. Spring has its own AOP, and an intro article was just published: An Introduction to Aspect-Oriented Programming with the Spring Framework, Part 1.

However you aren’t stuck with the one AOP alternative (Spring AOP). There has been a lot of thought put into integrating with other AOP implementations.

Here Rod talks about this and AspectJ integration:

“Having said that, I believe that AspectJ is going to become increasingly important as we come to understand the full implications of AOP. So one of the major features in Spring 1.1 is AspectJ integration. This will allow AspectJ aspects to be configured by the Spring IoC container using Dependency Injection, which brings similar benefits to applying DI for classes. Both Adrian Colyer and I are very excited about this, and both Spring and AspectJ teams are working together. Support for the core AspectJ integration is already in Spring CVS and will be released with Spring 1.1 RC1 (probably end of next week). I’m also working on some samples, which will probably be released separately slightly later. The Spring/AspectJ integration opens up some interesting possibilities. Beyond that, we’re looking at using AspectJ pointcuts to target Spring AOP advice. This relies on AspectJ changes–they are going to expose an API for Spring and other tools to use at runtime. Another interesting area is implementing Spring services as “native” AspectJ aspects. Thus we’ll provide a transaction aspect, probably in the Spring 1.2 timeframe, although I might release it with the samples.”

Well, there is also support for AspectWerkz AOP with Spring via the Spring Aspect Container

The Spring Aspect Container in AWare will make it possible to manage your aspects using Spring, it let’s you treat the aspects just as any other Spring bean.
The container will read in a Spring configuration file called aware-config.xml, this file has to be on your classpath. In this file you can define your aspects, add parameters and data structures to them, pass in references to other components that is being used etc. This is for example documented briefly in the Role-Based Security section.

We are spoiled for choice :)

Jul 15

Dales “AspectJ in 2 paragraphs or less”

AOP, Tech 1 Comment »

Dale has put together AspectJ in Two Paragraphs.

In this instance, we are researching the use of aspects to assist debugging an existing Java application. It has several different sources of data access and no single place in which to place logging or parameter setting logic. As such, we have found it very labor intensive to reliably search out all of those points and cut-and-paste the same code to every one of them. AspectJ allows us to define “pointcuts”, or semantically well-defined places, where the existing object-oriented code can be prepended to, appended to, or wrapped by, “advice”. Pointcuts and advice will allow us to consistently log all (diversely implemented) database accesses using only one definition (the aspect file). The advised code will add an identifier to every SQL statement in the application before it is executed by DB2. The advised code will also set the necessary JDBC parameters on every connection to enable additional tracing information produced by DB2. Because there is no editing of the actual codebase, the chance of code drift and bug introductions can be minimized. The chance that side-effects will be introduced into the codebase is almost non-existent since aspects cannot be directly referenced by Java classes. Aspects exist outside of existing code and, if they do not contain application logic themselves, can be selectively added or omitted during the Ant build.

I expected to hear about some cool marriage of AspectJ and JINI :)

Of course, Adrian Colyer did a great job of explaining AOP without the buzzwords.

Jul 15

Glen Martin follows Josh’s lead and leaves Sun

Tech 5 Comments »

Glen Martin has just blogged that he has left Sun.

So the tally so far:

+ Tim Bray
- Josh Bloch
- Glen Martin
- Bill Joy

A lot of moving and shaking. However, Sun is a large company so we should expect a few people will come and go right?

Jul 14

Speech Accent Archive: Hear a ton of accents

Personal 5 Comments »

I love accents. I think it would be cool to be able to put one on at any time (just to play with people).

This may be due to the fact that I am a Brit living in the US (and my accent is fading… which is why I need to keep taking trips back home!).

The speech accent archive is a research project from George Mason University, and it allows you to play 351 speech samples of men and women from all over the world. So cool :)

Our Mission

Everyone who speaks a language, speaks it with an accent. A particular accent essentially reflects a person’s linguistic background. When people listen to someone speak with a different accent from their own, they notice the difference, and they may even make certain biased social judgments about the speaker.

The speech accent archive is established to uniformly exhibit a large set of speech accents from a variety of language backgrounds. Native and non-native speakers of English all read the same English paragraph and are carefully recorded. The archive is constructed as a teaching tool and as a research tool. It is meant to be used by linguists as well as other people who simply wish to listen to and compare the accents of different english speakers. It allows users to compare the demographic and linguistic backgrounds of the speakers in order to determine which variables are key predictors of each accent. The speech accent archive demonstrates that accents are systematic rather than merely mistaken speech.

All of the linguistic analyses of the accents are available for public scrutiny. We welcome comments on the accuracy of our transcriptions and analyses.

Jul 14

PHP 5.0 Released

Tech No Comments »

The PHP folks must be happy. They just caught up to Java 5 ;)

PHP 5.0

Some of the key features of PHP 5 include:

  • The Zend Engine II
    with a new object model and dozens of new features.
  • XML support has been completely redone in PHP 5, all extensions are now
    focused around the excellent libxml2 library
    (http://www.xmlsoft.org/).
  • A new SimpleXML extension for easily accessing and manipulating XML as
    PHP objects. It can also interface with the DOM extension and vice-versa.
  • A brand new built-in SOAP extension for interoperability with Web Services.
  • A new MySQL extension named MySQLi for developers using MySQL 4.1 and later.
    This new extension includes an object-oriented interface in addition to
    a traditional interface; as well as support for many of MySQL’s new features,
    such as prepared statements.
  • SQLite has been bundled with PHP. For more information on SQLite,
    please visit their website.
  • Streams have been greatly improved, including the ability to access
    low-level socket operations on streams.
  • And lots more…

For changes since Release Candidate 3, please consult the
ChangeLog.

Having seen the NightmareXML APIs that we often have to work with, “SimpleXML” sounds good to me!