Monday, 31 October 2011

Phew. Finished "How the World Works"

Sort of mirrors my rants after a bottle of Wild Turkey and watching an Adam Curtis documentary.
Except for one minor point.
I don't have any solutions to corporate greed.
At least Noam Chomsky presents some solutions and examples of working solutions.
I know. I know. He's a sophi...
No. I just can't say that with a straight face.
He's not really a Sophist.
Not by todays definition.
But he *is* by the ancient greek definition.
To quote wikipedia:

"In ancient Greece, sophists were a category of teachers who specialized in using the tools of philosophy and rhetoric for the purpose of teaching aretĂȘ — excellence, or virtue — predominantly to young statesmen and nobility"

Yeah. That seems to fit better.
Not that I'm saying I'm young, stately or noble.
I'm exactly none of those things.
But he knows his subject and can navigate through a response to a question in a way that teaches.
Not in a specious way.
Not in a deceptive way.
If you have eyes to see...
Then you can see the Rhetoric and see past it to the underlying truisms.

Anyway, I'm about to start Sam Harris's "The Moral Landscape."
Let's see how that goes.

I will get back to Christopher Hitchens... :-)

Saturday, 29 October 2011

An Original Grumpy Old Man

Sadly, I don't get much time to read.
But I'm forcing myself to put time aside to do so.
I started with Christopher Hitchens "Arguably."
Love it but I'm finding it a bit of a chore.
Apart from the fact that the paperback is, like, 6 inches thick, his writing seems so...
Trans atlantic intellectual.
By that I mean that group of writers who seem to be competing to see how many words like inchoate and frisson they can pack into a sentence and how many obscure references to Marcel Prousts work they can make.
But I did learn a lot.
Like, you know the marines song?
"From the halls of Montezuma to the shores of Tripoli..."
No why would a marine force founded in the 1800's mention Tripoli?
Because they fought there in 1801 and again in 1815.
The first American war in the middle east.
Called the "Barbary Wars."

So I put it down and picked up Noam Chomskys "How the World Works."
What a hoot! Love this guy. I really do.
The book can be summed up like this:
"Bloody banks! Bloody corporations! Bloody governments! Bloody politicians! I told you! You didn't listen! Bastards."
Now don't get me wrong.
After half a bottle of wine I tend to rant too.
In most cases about the same things that Chomsky does actually.
Curious that when you get past 40 or so, the "Rant Gene" kicks in.

Wednesday, 26 October 2011

Holy Magazines Batman! Young Earth Creationists have their own publication!

Stunned I was.
Since borders vanished (woe! gnashing of teeth) I've had to get my mag fix from news-agents.
Most are rubbish and don't have the kind of weird stuff I like.
Anyway, I went into a large one near where I work and went to the "Science" section.
And there, embedded between Scientific American, New Scientist, Cosmos, Fortean Times, Nature and Skeptic...
Odd, I thought - then I picked it out and opened it.
I was mind buggered in an instant.
Almost every article is about why the Earth (and the universe in general) is 6,000 years old.
Why the Giraffe is impossible by accident and could only come about by design.
Why aliens are impossible.
And so on.
The general flow of each 'article' is this:
a) find two 'scientists' who appear to have differing views,
b) take their comments out of context,
c) use a 'argument from incredulity' (WTF),
d) comment that the bible says that everything is 6,000 years old,
e) state the conclusion.
The conclusion is always along the line:
"We know it's not evolution - but creation!"
"Flat earth people should have stuck to the bible!"
"We are not smothered by darwinistic fog!"
"Man was directly created by God and not in the likeness of an ape!"
"Only God could have created the giraffe!"
Wait. What?
Apart from the complete lack of understanding of how science works...
Now don't get me wrong.
I have no beef with what people believe in their own homes.
It's when the illusion of 'doing science' is promoted to people in this manner I get a tad miffed.
I was particularly annoyed by the article specifically targeting kids about how there is no evidence to say humans and apes have a common ancestor.
Rant over.

Tuesday, 18 October 2011

Jetty8 Snow Leopard org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP

I have a dinky app with an index.jsp.
Create a war and deploy to Tomcat on Snow Leopord.
No problem.
Create a war and deploy to Tomcat on Ubuntu.
No problem.
Deploy to GF3 on Snow Leopard.
No problem.
Deploy to GF3 on Ubuntu.
No problem.
Deploy to Jetty7 or Jetty8 on Ubuntu.
No problem.
Deploy to Jetty7 or Jetty 8 on Snow Leopard and:

Oct 17, 2011 5:37:49 PM org.apache.jasper.compiler.Compiler generateClass
SEVERE: Error compiling file: /private/var/folders/dd/dd3VsetWHLuS+PT+sxCe+k+++TI/-Tmp-/jetty-
424497 [qtp1681653767-16] WARN org.eclipse.jetty.servlet.ServletHandler - /com.myapp/
org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP

PWC6199: Generated servlet error:
string:/// package com.myapp does not exist

PWC6199: Generated servlet error:
string:/// package com.myapp does not exist

PWC6197: An error occurred at line: 10 in the jsp file: /index.jsp
PWC6199: Generated servlet error:
string:/// cannot find symbol
symbol : class SomeProperties
location: class org.apache.jsp.index_jsp

PWC6197: An error occurred at line: 10 in the jsp file: /index.jsp
PWC6199: Generated servlet error:
string:/// cannot find symbol
symbol : variable AResource
location: class org.apache.jsp.index_jsp

at org.apache.jasper.compiler.DefaultErrorHandler.javacError(
at org.apache.jasper.compiler.ErrorDispatcher.javacError(
at org.apache.jasper.compiler.Compiler.generateClass(

The thing that should ring alarm bells is that /private/var/folders... stuff.
The trick is to:

cd [your jetty install]
mkdir work

That's it.
It's that retar... er... *unique* /tmp folder that seems to be causing the problem.
You could set the to something meaningful as well.

See: for more information.

Configuring a context root different from war file name to deploy to Jetty

<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/myapp</Set>
<Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/com.mycompany.web.myapp.war</Set>
<Set name="extractWAR">true</Set>
<Set name="copyWebDir">false</Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>

ant clean dist
cp dist/com.mycompany.web.myapp.war /[your_path_to_jetty_install]/webapps

Monday, 17 October 2011

Three little words... (by B)

I’m not a programmer... not anymore...
I used to cut code all the time but circumstances have conspired to push me towards managing other programmers and so now I only code when I have spare time (which is never) or when something goes wrong (which is rare :). However, I do help the programmers sort things out sometimes, even if it’s just by listening to them work through their problems.
Watching other people code is an exercise in self control for anyone who knows how to program, especially if they have different styles.
Most of the time this is not too bad, all of my guys are solid developers and I often end up learning new tracks as I go, but every once in a while I watch someone junior, someone with a lot of energy...
They bounce around code like a jack rabbit, writing a bit of code here and a bit there, they copy code into the buffer, delete it from the page, stop to make a few other non-related changes, and finally paste the buffer back into a new function - then they have to go back and debug 5 things at once.
It’s button mashing... (same way I play call of duty).
Worst of all, it’s all programming by impulse - “I’m facing this problem right now so I’ll code the first solution that comes to mind”.
Then later if they find themselves writing the same sort of code for the fifth time they might go back and try to make a function or a method.
There is almost no sense of planning and it results in code that is duplicated and complex.
Which is why I felt it important to write the 3 most important words in programming on the white board in my office:


All you guys who had this stuff kicked into you when you were young developers can stop reading now - you know what I’m going to say and don’t need the lecture.
Anyone who thinks I’ve just described something you do at a party after one too many drinks, read on - you need this bad.

DRY - Don’t Repeat Yourself
Seriously, if you find yourself writing the same bit of code that you know you’ve already written then you should have put its generic form into a function to begin with. When I see large chunks of repeated code it makes it really clear that the programmer didn’t recognise common activities in the process. This tells me he didn’t understand the process before he started programing... or that he’s just not very bright.
I have to stress that not knowing the full solution when you start coding is OK after all hind sight is always 20:20, we do proof of concept work specifically to find out what we don’t know or haven’t spotted.
But the same process repeated in multiple locations in release code a maintenance nightmare - COPY AND PASTE IS NOT YOUR FRIEND - If you do the same thing twice consider a function or a method. You may decide that the two blocks of code are likely to diverge as more details get added (perfectly valid when doing RAD work) in which case drop in a comment, that way you can check it later in the development process and see if you were right.
Duplicating code without a damn good reason (and if it’s that good, it should be in the comments) is a bad idea, your code gets bloated and difficult to navigate. Even if you know every part of the code by heart right now the next person wont - and the next person could be you in 12 months after working on another project and forgetting how ugly this project really was.
Happy debugging...

YAGNI - Ya Aint Gonna Need It
Obviously you can go too far the other way, you can over plan and over architect, and it’s almost as bad as not thinking ahead at all. Don’t build factories until you need the product, don’t build generic function based versions of complex code until you are sure you’re actually going to call it from more than one location.
Finally, while I am a great fan of stubbing out functions until you get to them, don’t create stubs for functions until you are fairly sure that you’re going to get back to actually putting something in them - Your better of using comments again.
Unused code is just chum in the water stopping people from seeing the important stuff.  Empty and unnecessary wrapper functions just lay down a maze of code that’s easy to get lost in, and amplifies the maintenance overheads.

KISS - Keep It Simple Stupid
If you need this one explained then stop.
Right now.
Go to your employer, apologise and tell them you are too stupid to work as a programmer and only just realised it.
We’ve all heard the KISS acronym, there is a reason it keeps getting repeated - The simplest solution that meets your needs IS the best.
Full stop
End of discussion.
Every argument I have ever heard amounts to someone claiming some special condition, that should have been considered a need if it was that important. Think about what you actually need (or will reasonably need in the future) and what you don’t need (or are very unlikely to need in the future) and check you solutions against it.
This system works really well, you can plan and draw the most complex system you want, but when it comes to implementing - do what you need and plan for what you will need - stay focused and you will stay productive.

Most programmers already know these rules, but everyone needs to be reminded from time to time. While we all like to call ourselves “hackers” it can be hard to own up to some of the bigger and cruder "hack" jobs we create every now and again. Whether it's enthusiasm or just time pressures, we all slip into some bad habits that we know are just going to cause problems later on. Thats when we need to review the basics.

I'm a programmer not an engineer (by K)

I started in the IT industry in April '77.
Wait. What? Oh I already did that.
Is it someone's birthday?
In the old days ("When dinosaurs ruled the Earth!" as my hubbie likes to say) programming was fun.
It was tough and weird and awkward and you had to do things like "Mel" did, but it was fun.
Then the Computer Science and Enterprise mob got involved.
Now we have Factories and Builders and Decorators and Facades and Commands and Observers and what not.
Wait. What?
Working in factories as a builder and decorating a facade under command while being observed isn't fun.
Programming seems to have stopped being fun.
It's all been tele-tubbied - like XP I guess.
And now if you call yourself a "programmer" it has this air about it that sounds small.
"No," they say, "You're an Engineer!"
No I'm not.
I program - ergo I'm a programmer.
Just because we have these consensual ideas with engineering names doesn't make a program as 'real' as a Factory.
And don't start with the "If you unplug a factory it becomes just as useless as an unplugged computer" stuff.
I've had to use the moniker "Engineer" because if my title was "Programmer" then my job prospects are lower than having "Engineer" in the title.
Regardless of the fact that I've been doing this for 34 years.
Having said that, configuring Eclipse often requires engineering skills...
And so now many programmers call themselves engineers.
Why? You don't build bridges!
You get paid to think and find out how to get a bunch of pixels to run around a screen in ways that make money for your bosses.
And it's supposed to be fun - at least in my view.
I see programming as creative and imaginative and fun.
It seems to not be as fun now.
For example, Harry Potter waves his wand and utters some incantations and makes something out of nothing.
Programmers do the same.
You wouldn't call a wizard an engineer would you?
Would J.K.Rowling have written this:

  WizardManager wizard =;
  ApplianceFactory applianceFactory = wizard.getApplianceFactory();
  Wand wand = applianceFactory.getWand(BasicWand.Type);
  SpellFactory spellFactory = wizard.getSpellFactory();
  Spell spell = spellFactory.getSpell(Charm.Accio);
  Incantation incantation = wizard.join(wand, spell);;

Just to have Harry pick up a box?
You've gotta be joking.
But we ARE wizards (and witches) in a way.
The wands are our laptops and desktops and our incantations are the code we bring into being through force of will.
We face an empty IDE and produce marvellous pieces of software out of nothing.
We're not builders.
We're not factory workers.
We're programmers and wizards and witches.
Think I'll change my title to "Senior Software Enchantress"

Thursday, 13 October 2011

Signs Don't Work! And a solution to one case... (by K)

Over the last 40yrs I've been relatively sentient, I have noticed a gradual but continual rise in the number of signs telling us not to do things.
You know what I mean:

  • "Smoking is addictive" - no sh*t - Ah damn. Too late.
  • "No user serviceable parts inside" - Hmm. Sounds like a challenge to me.
  • "Emergency access only" - with no alarm it'll just be ignored.

And I see very little evidence that they work.
After seeing them the first and second times, they just ignore them.

Example 1 - Emergency Doors
In the building where I work there is 1 single, slow, tiny elevator servicing 2 floors of businesses.
Most people going down to the car-park use the emergency stair well.
And almost all the smokers use it to get to the "Designated Smoking Area."
At the base of the set of stairs is a single door leading outside to the DSA.
And they 'chock' the door open while they have a smoke.
They could walk the extra 30 feet round through the main entrance, but it's easier to 'chock' the door.
And they forget to 'un-chock' it occasionally.
This means the door to the outside world stays 'open' all night - a violation of security and safety.
The safety dudes have installed cameras, placed GIGANTIC signs saying "NOT TO BE USED EXCEPT DURING EMERGENCIES" and repeatedly adjusted that auto-shut lever thingey to force the door to shut.
The problem is that humans are inventive little buggers.
With a new supposedly un-chock proof door in place, everybody figured out, within a day, how to fiddle with the latch thing to chock the door open.
So to avoid a 30' walk, they simply ignore the cameras, ignore the sign, open the door and click in that little thing next to the latch so the door can't shut.
The safety dudes then plastered the door with "THIS DOOR IS ALARMED".
But even the average person can easily see there is no reed switch, so they ignore it.
All to save a 30' walk.

Example 2 - The Coffee Machine
We have a rather expensive Swiss coffee machine in our lobby.
Every couple of hours it does a 'rinse'.
This involves spewing out hot water and milk into the drip tray.
That design choice may seem silly, but the machines aren't meant to spend their lives in an empty un-manned area and used all day.
They would normally be in an area which would have someone to watch over it and empty the drip tray.
Er. Got side tracked.
The point is that since the machine is un-manned most of the time, and the rinse cycle happens relatively frequently, the drip tray overflows and causes a massive mess.
To make matters worse, most of our staff are "young men".
By that I mean: "lazy grubs who are only just getting used to not having their mother to clean up after them."
So we have a plastic beaker that is supposed to be placed under the spout so that the rinse cycle spews into it, instead of all over the floor.
And over the last few months emails and chats and standup announcements have failed to get across the message "FOR PITIES SAKE, PUT THE BLOODY BEAKER BACK UNDER THE SPOUT WHEN YOU'VE GOT YOUR COFFEE."
Signs have been made.
And ignored.

A Proposed Solution:
We have Arduino.
We have Kinect.
We have Speakers.
We have Cattle Prods.
We have Tesla Coils.
We have Lasers.
Can't someone just make a project that detects if the beaker isn't back under the spout as the person starts to leave and give the little buggers a load "OI! PUT THE BLOODY BEAKER BACK" and give their ass a jolt?

Wednesday, 12 October 2011

Stumbled on this and it needs support (by K)

Like Task Focused Interfaces like Mylyn in Eclipse, but using NetBeans?
Check out this project which I noticed in issue 508 of NetBeans Weekly News.

Task Focused Interface for NetBeans IDE

May have issues with anything less than NB 7.1 beta, but I tend to go bleeding edge...
Love it.

Detecting if Mongo is running in your app (by K)

We use MongoDB for a load of stuff.
One thing that is a problem is that, in the dev environment, the mongo service needs to be restarted.
(In production we have different mechanisms of course)
So for a period of time while developing an app, Mongo may not be running.
And if you make any call to it in your app you get a shed load of exceptions that, for some reason, can't be caught.

This kind of thing:

[#|2011-10-11T17:44:58.420+1000|WARNING|glassfish3.1.1|com.mongodb.tcp|_ThreadID=27;_ThreadName=Thread-3;|Exception determining maxBSON size using0 couldn't connect to [] Connection refused
at com.mongodb.DBPort._open(
at com.mongodb.DBPort.go(
at com.mongodb.DBPort.go(
at com.mongodb.DBPort.findOne(
at com.mongodb.DBPort.runCommand(
at com.mongodb.DBTCPConnector.fetchMaxBsonObjectSize(
at com.mongodb.DBTCPConnector.checkMaster(
at com.mongodb.DBApiLayer$MyCollection.__find(
at com.mongodb.DBCollection.findOne(
at com.mongodb.DBCollection.findOne(

So I did some digging to find out what's going on and how to programmatically checking if the service is available.
I found this:

And made my own version which is called before any persistent action.
Here are the bones of it so you can modify it to suit your needs.

boolean mongoRunning = false;
ServerAddress serverAddress = new ServerAddress(dbHost);  // dbHost is the mongo host name
DBPortPool pool = mongo.getConnector().getDBPortPool(serverAddress); // mongo is the instance
DBPort port = pool.get();
try {
  mongoRunning = true;
} catch (IOException e) {
  // Uh oh. Mongo not running. Do something meaningful...
  log.error("MongoDB isn't running on [" + dbHost + "][" + dbPort + "]"); // or just log it
} finally {
  port.close(); // should do try/catch here...

It's overkill of course, but it does help.
Just to help out.

Tuesday, 11 October 2011

I'm a dinosaur (by K)

I started in the IT industry in April '77.
I was completely broke and met a friend of mine who was doing a "Diploma in Computer Programming."
Sitting with him working at RPG and COBOL I thought "This is easy."
So I asked him how much he would make a year when he finished.
After picking myself up off the floor, I thought "I have to learn this!"
Problem was, I was broke, unemployed and definitely couldn't afford to take 2 years to get that piece of paper.
Worse, I had got woeful scores in High School, so I'd have to do a raft of courses before I could even start.
So I just walked around the various business districts asking to speak to the local IT person and tried to get a job.
It took 2 weeks but I got in.
An accountant who was building a computerised accounting system was mildly interested.
It was a tad embarrassing for both of us...
Him: "Do you know what RAM is?"
Me: "Male sheep?"
But he hired me.
For the princely sum of $75 a week.
I lived in an condemned, abandoned house which was falling down and crawling with cockroaches.
I made and ate Pea with Ham soup for a month.
But after 6 months I was in charge of a product.
I had learnt Assembler, de-compiled CP/M, located and fixed a dud memory chip on a SuperBrain and wrote a new screen driver.
I also rewrote the Report Writer component for the system.
I discovered a bug in the integer handling code for the MBasic compiler and sent a fix to Redmond.
So my career started.
Since then I've used just about every language invented - yes, I even used APL once.
I was instrumental in creating a new language and was a paper millionaire for a while.
1,000,000 lines of K&R C.
Even have the "executive" pins given to me by AT&T and others.
I was even in contact with ESR with fixes for Sendmail, Prof J Ousterhout, Al Stevens and so on.
I wrote a self-published manual for Systems Administration on SunOS.
I used VisualAge.
I have my name on a MAN page.
Now I'm 55.
And I did an ego-search.
Now that's depressing.
And now I'm surrounded by kids.
Kids who don't understand stuff.
Kids who don't have a clue about DRY or YAGNI or were all this stuff they use comes from.
And they don't seem to care.
They assume Factories and Builders and Adapters are the way it's always been.
They've never heard of "Mel."
They get entranced with a specific technology and when all you have is a hammer...
So they lumber along crashing about like drunk Elks at a pool party missing the point at every turn.
Because they don't seem to care about why things are they way they are.
They just seem to twiddle knobs, mash buttons and pull levers until magically it works.
And if you try to explain, it seems like they're just waiting for you to finish so they can continue twiddling, mashing and pulling.
So much for the Scientific Approach.
Sure, they're passionate and committed and excited.
But you can't tell them squat.
They waste hours and build rubbish that will lurch along, become un-maintainable while they move onto the next exciting technology.
Now I know that the worlds changed.
I know that the old idea of a job that you went to each day and did what your boss said is fading.
I know that everyone with a laptop and inspiration is essentially the same as a factory of yesteryear.
I'm not talking about the "Death of the Job."
It's just the lack of care and responsibility.
I'm guess I've been EOL'd and become surplus to requirements.
Might as well go and eat worms.

Monday, 10 October 2011

Todays Interesting News

New telescope takes image of galaxies colliding
Lung cancer secret solved by scientists
Qu8k Rockets Above the Balloons
LHSee - Large Hadron Collider app - Big bang science in your pocket
Western fast food, waistlines surge in India
New theories emerge to disprove OPERA faster-than-light neutrinos claim

Chrome extension enables remote control
EU approves Microsoft's Skype takeover
Atlassian buys SourceTree, makes it free
Computer Virus Hits U.S. Drone Fleet & Predator Drone 'Virus' Could Be Military's Own Monitoring
Oracle's Ambitious Plan For Client-Side Java
Google puts MySQL in App Engine Cloud with Google Cloud SQL
Puppet vs Chef, Fight
A reboot of PHP: keep the philosophy, improve the syntax with the jvm

Three women win Nobel Peace Prize
Scott McNealy's new venture
Flying Monsters' Pterosaurs Soar With Avatar-Style 3-D
Insert Coin: Romo, the smartphone robot (video)
CLASH is an adorable, cloth-climbing roach-bot (video)
Watch A Pilot Cooly, Calmly Ditch His Plane In The Pacific Ocean

Don't they ever learn?
Incomplete PDF Redaction Leaks Data From UK MoD

Patients' lists exceed population
California pot crackdown
Homeland Security starts Pre-Crime
German government accused of spying on citizens with state-sponsored Trojan
UN Bigwig: The Web Should Have Been Patented and Licensed
Florida School District Begins Fingerprinting Students
FBI Plans Nationwide Face-Recognition Trials In 2012
Painful Neck? YOU May Be Suffering From Text Neck!
Women who violate headscarf law should be stripped of passports: Iranian lawmaker

UK banks hit by Moody's downgrade
Groupon steps back as LivingSocial issues $143 million in stock
Lack of cash claim 'hilarious': Groupon
Oil May Be Finite, But U.S. Production Is Ramping Up
Clamping Down on High-Speed Stock Trades: US, Canada, European regulators
eBay En Route To $4B In Gross Mobile Sales
9 Reasons Why Online Video Advertising Has Failed to Meet Previous Forecasts

You know what I like? Throwing code away.

I had a hard look today at some of the coding being done in one of the apps I'm involved with.
A maven project with dozens of sub-projects each having different versions of dependencies in their POMs.
Many of the sub-projects have dependencies on other sub-projects and the web is immense.
I did a "mvn dependency:tree" - HA! That should be "mvn dependency:omg".
Two minutes of tree screaming past (or was that me?).
Boy oh boy.
What a load of...
And there was more...
One class will package up a bunch of data into a DTO to pass it to another project which then picks it apart to make another DTO to pass it...
This is silly.
I tried to do a plain old "mvn clean install" on one of the sub-projects and it looked like an explosion in a stack trace factory.
Pages and pages of gumpf roaring up the screen.
How would you ever know if anything was out of whack?
I'm not talking about unit tests.
You wouldn't know if the dto->data->dto->data->dto stuff is going on.
Acres of jars in the .m2 folders.
Builds taking forever.
This is silly.
So I took one of the projects and tore it to pieces.
I broke it down into single units of work.
So I have a load of little dinky jars that don't change from build to build and do exactly one thing.
For example, one project has dozens and dozens of try/catch->log.error() stuff going on.
You know what I mean, methodA throws the Exception to caller methodB which throws the Exception all the way up to this:

    try {
      // call methodZ
    } catch (SomeException) {
      // Uh oh. What's the context? Oh well...
      // Do we continue? Or die?
      // Oh well... Just keep on Truckin' Hope it works...

So I created a jar project that makes a RESTful call asynchronously to a web site to report exceptions.
It looks for a config file of the same name as the jar which tells it what to do (including time outs, distributed whatever).
It doesn't care what the site(s) does with the exception, it just sends a bunch of basic information and the stack trace to where it's told to.
But this jar now has exactly one class.
And it's as dumb as a box of hammers.
So now, any project anywhere can do something like this:

    try {
      // something that might break
    } catch (SomeException ex) {
      // do anything that may be needed in the project context
      new ReportException("ServerName","Module","SubModule",ex).send();
      // crash, burn, rethrow, use a default, use a config option, continue - whatever

And exception handling becomes easy enough that programmers won't do this:

    try {
      // something that might break
    } catch (SomeException ex) {}

Because it's now easy to report it.
And that exception is sent to a central (or distributed depending on the config file) site(s).
That site is another dinky project that does one thing.
It has one Resource which responds to PUT on one path.
It has a simple Config file which tells it whether to log to MongoDB, send email, post to an IssueTracker or whatever.
It depends on several small project jars that do one thing each: log to MongoDB, SendEmail, PostToBugZilla and so on.
So now we have several tiny jars and 1 tiny war that don't change.
And tons and tons of Exception handling in multiple sub-projects can be thrown away and better monitored.
Moreover, the store where the exceptions are saved (MongoDB, MySQL, Cassandra whatever) can now be monitored by Nagios.
And all those sub-projects have a load of dependencies reduced.
And the app-build is quicker.
I like(+1) throwing code away.

Friday, 7 October 2011

7th October randomness (By K)




6th of October randomness (by K)

Wednesday, 5 October 2011

5th of October Randomness

Tuesday, 4 October 2011

4th of October Randomness

Man rips out eyeballs during Mass