Wednesday, August 15, 2007

Teachers...

So, I realize that I have a different view on things...

I suppose I always have and probably always will.  I'm okay with that, however it does seem to cause the occasional friction or concern that no one else has but me. 

Today someone put in their 2 weeks notice here at work.  Many people were quite happy that he did, not me though.  Admittedly this fellow  is very hard to work with, he does not hesitate to interrupt conversations, refuses to follow the development process we have in place, and doesn't ask for help when he doesn't know what to do. 

However, he really cared about the quality of his work and would argue his point until you were forced to listen, but would eventually concede when/if the case was lost.

We were at odds a lot of times and I think that I'm the only one who had any respect for him at all.  I did (usually) like him as a developer and a person.  

Not that I didn't get frustrated and occasionally angry with him.  I just can't help but think of the Buddhist teaching that tells us to be thankful for the people in our lives that we struggle to get along.  It is through them that we learn compassion, patience and wisdom...

 

So, see you later V. P. I hope your next job treats you better...

-A

Wednesday, August 01, 2007

I always wondered how to do that!

So, have you ever been writing code and new there was a probability an exception was going to get thrown. For whatever reason you want to do something with the stack trace kind of unusual, and you want more than just the exception.getMessage() in fact you want the whole stack trace.

Now I never claimed to be a rocket scientist. Some days I don't even claim to be clever. Today I took the time to figure out how to catch the exception and turn the complete stack trace into a String that you can do whatever you want to with. Here is the snippet I used.

catch (Exception e){
confirmMessageButton.setText("Exit");
OutputStream os = new ByteArrayOutputStream();
PrintWriter writer= new PrintWriter(os);

e.printStackTrace(writer);
writer.flush();
String myMessage = new String(
((ByteArrayOutputStream)os).toByteArray());
//do something with the string
}


So, like I said it's not rocket science but it is something I always wondered how to do.


-Aaron