Feeds:
Posts
Comments

I have a project at work where we’re looking to present a user with an edit message if they’ve changed anything within a web page and haven’t saved the form before closing the page to stop them from losing changes.  The following example works with IE 6 (which is our corporate browser).  It does not seem to work with firefox, and I haven’t checked with any other browser since our need is isolated to IE.

<html>
<body>
<script type=”text/javascript”>
document.write(“Hello World!”);
var needToConfirm = false;
//Call this function if some changes is made to the web page and requires an alert
//you could call this is Keypress event of a text box or so…
function setDirtyFlag()
{
needToConfirm = true;
}

//this could be called when save button is clicked
function releaseDirtyFlag()
{
needToConfirm = false; //Call this function if dosent requires an alert.
}
window.onbeforeunload = confirmExit;
function confirmExit()
{
if (needToConfirm)
return “You have attempted to leave this page. If you have made any changes to the fields without clicking the Save button, your changes will be lost. Are you sure you want to exit this page?”;
}
</script>
</body>
</html>

Advertisements

The game was back and forth for a while. Then in the top of the last inning, the Braves scored 8 runs to go ahead 23-16. The A’s determined not to give up answered with 8 runs of their own to win the game.  It was a great come from behind victory to end an exciting game.

We’ve heard blood curling screams following a big loud crash enough from the boys that we don’t tend to overreact anymore, but something in the scream this morning sounded a little more convincing. All three boys have been wearing their brand new Crocs around the house which they tend to do when they get new clothes or shoes. Tooling around in nothing but underwear and Crocs is a sight to behold.

So we’re eating breakfast, and Jake gets up to go to the bathroom. He takes off down the hall like he just broke through a gaping hole off-tackle and somewhere in between juking the wall and stiff-arming the door, his Croc stuck to the floor and he got tripped up and and landed chin first on top of the toilet. Loud crash followed immediately by horrific scream.

I wish I took the picture anyway, but he wasn’t interested in documenting the gash for posterity. It was the shape of a football and as deep a wound as I’ve ever seen. I’m pretty sure I could see his chin bone through the blood. After sending Braden and Logan to the neighbor’s to play, we took a trip to the emergency room. An hour and a half and 9 stitches later, we’re back to getting ready for our baseball game.

This isn’t the first time we’ve had issues where running with Crocs on has produced a boy-on-floor scenario, but is the first time where a toilet got in the way. I guess toilets are a lot like middle linebackers – you’re better off avoiding them than trying to take them head on.

One of the projects I’m working on requires the securing of all the servers and transports used in a message flow involving a JEE/Websphere MQ/Lotus Notes SMTP server infrastructure.  The javamail portion is a standalone java app running on Solaris which is triggered by MQ (not running within Websphere).  The message flow looks something like this:

Webapp running on websphere 5.1 -> MQ -> Transformation (MQ triggered standalone java app on Solaris) -> MQ -> Javamail (MQ triggered standalone java app on Solaris) -> SMTP -> external

The Javamail to SMTP server hop is secured via TLS (Transport Layer Security) using the SSLv3 protocol.

At first it seemed fairly straightforward. The documentation for javamail states that it does support SSL and TLS, however another developer on my team spent 2 days trying to get it to work, we discovered how poorly javamail is documented, in particular getting a secured connection using TLS and SSLv3 to work. Several websites found via google searches discuss it, but none seem to have a working example. One site talks about creating a custom SSLSocketFactory (not needed), and a couple others simply recommend reading the Javamail FAQ and SSLNOTES.txt that come with the javamail download. I found the SSLNOTES.txt to be most helpful, but did not provide working examples or the detail necessary to allow for a quick implementation. It still took a lot of tweaking to get a working solution, so I am posting it here for future reference as well as to help others who need to provide similar capabilities.

The key was setting the correct properties and specifying the correct protocols to use.


/**
* This method sends an email using TLS
*
* @param strTo To Addresses
* @param strCc CC Addresses
* @param strFrom From Address
* @param strSub Subject
* @param strMsg Message
*
* @throws IOException Description
*/
public void SendMailTLS(String strTo, String strCc, String strFrom,
String strSub, String strMsg)
throws IOException
{

//Set the properties required for TLS/SSL handshake
Properties props = new Properties();
System.setProperty(“javax.net.debug”, “ssl,handshake”);
props.put(“mail.smtp.host”, “<put your smtp server here>”);
props.put(“mail.smtp.starttls.enable”, “true”);
props.put(“mail.smtp.ssl.protocols”,”SSLv3 TLSv1″);

Session session = Session.getInstance(props);

session.setDebug(true);

//start sending the messages
try
{
//Instantiate new mime message and fill it with the required info
Message msg = new MimeMessage(session);

//set From
msg.setFrom(new InternetAddress(strFrom.trim()));

//set To
InternetAddress address[] = { new InternetAddress(strTo.trim()) };
msg.setRecipients(Message.RecipientType.TO, address); //To Recipients
msg.reply(false);

//set CC
if (!strCc.equals(“”))
{
InternetAddress address1[] = { new InternetAddress(strCc) };
msg.setRecipients(Message.RecipientType.CC, address1); //CC Recipients
}

//set Subject
msg.setSubject(strSub);

//setDate
msg.setSentDate(new java.util.Date());

//set Text
msg.setContent(strMsg, “text/html”);

// hand the message for delivery
Transport.send(msg);

}
catch (MessagingException mex)
{
System.out.println(“Mail Couldn’t Send to : ” + strTo + “ERROR: ” + mex.toString());
mex.printStackTrace();
}
}

Texas Caviar

This is one of my all time favorite party dishes. Easy to make and easy to eat.

1 can of each (drained and rinsed):

Black eyed peas
Black beans
Pinto beans
White or shoepeg corn

1 medium onion chopped

1 cup red or green pepper

Jalapeno pepper if desired (need 2 or 3 in order to taste it)

Combine the above ingredients

3/4 cup cider vinegar

1/2 cup sugar

1/2 cup veg oil

In a small sauce pan, heat vinegar and sugar until sugar dissolves. Cool, then add oil.

Pour cider mix over bean mixture and chill for at least two hours.

Try not to eat the whole thing in 1 sitting 🙂

<Update Friday 4/4>: I’ve uploaded the practice/game schedule.  Click here to view.

What a hectic day. With Tasha gone on business until Wednesday night, it was another day to play Mr. Mom. These days just fly when there’s stuff to do. We had our first baseball practice tonight at 4:30. That was just early enough to rush us through after-school snacks and get half of our homework done and make it a sprint after practice to finish homework, eat, read, nebulize, and play DS before bedtime. Practice was good though. The boys had fun. Their coach seems nice. He stressed having fun and seemed to be very good with the kids. We’re looking forward to a good season.
The 2008 Baird baseball roster:

Logan – #6
Braden – #1
Jake – #5

Most of you who know us have heard of the horrific experience we had with mold in our house and the arbitration settlement with Town and Country Homes where the arbitrating judge ruled that the mold (which covered half of the floor joists in our basement) was caused by faulty construction, but that because Town and Country’s warranty document didn’t explicitly cover mold, T&C was not liable for covering the cleanup costs, leaving us with a clean up bill in the neighborhood of $18,000. I hope everyone reads that part – they caused it, but we paid for it literally. Yes, I’m still bitter.

The furnace was the next thing we had to deal with. Within 2 years our furnace motor went kaput. I replaced it myself voiding any warranty on the motor, but saving myself around $200 in labor and it’s worked fine since. My neighbor who is a plumber took the motor and blasted it with an air compressor, and you should have seen the small chunchs of drywall and all the dust that came out.  This appeared to be another casualty of the construction process.

Recently, however, every time the fan runs, there’s extremely loud noise coming from the motor/squirrel cage assembly that sounds like grinding metal. It’s loud enough where we have to turn the volume up on the tv another 10dB. Very annoying. So today I decided to take it apart again and see if I could find what was making all the noise. Thought it might be something loose, metal on metal vibrating or something. After pulling the squirrel cage out and tightening the screws that hold the motor to the casing, I tested it. Here’s where the fun starts…remember, I manage software developers. I can do some handy work, but am no professional. In order to get the cage out, I had to unhook the capacitor that gets the fan past the low gear torque. After pulling off the wires, I forgot them and let them hang resting on the cage…which is all metal. I flipped on the power switch and hit the door switch (that stops the furnace when the bottom door is off). Right hand holding the cage. Left hand on the metal furnace casing. As the motor started to spin, a large amount of voltage proceeded to pass from the capacitor wires into the cage, into one hand, through my chest, and out the other hand. This wasn’t a real pleasant experience as you can imagine. I let out a bit of a yell and was thrown backwards luckily so that was disconnected from the circuit.  In the process of getting electrocuted, the combination of the way my right arm was extended and the forcible contraction of every muscle located between my two hands caused my right shoulder to sublux. This happened many times when I played football in high school and college, so I’m familiar with it. Looking back on it, I would have loved to have been video taping it. Knowing I’m not seriously injured, I bet it looked hilarious.

I ended up tinkering with it for a while longer after recovering my wits, but couldn’t figure out the cause of the noise. At this point, I’ve conceded to calling a professional and letting them to their job. At some point, the money saved doing something yourself isn’t worth the risk, trouble, and frustration of trying to do it yourself.

After getting the furnace fixed (the fan blower was trashed) I had pain in my shoulder for s out 2 weeks before I decided to go see the doctor.  Usually the pain goes away the next day.  Turns out the the way my shoulder was wrenched caused a mild sprain.  It’ not bad enough for an x-ray, but the doctor figures I probably tore some muscle fibers.  He prescribed advil and rotator cuff exercises.  Sometimes it’s best to just let the pros do the jobs that they’re paid to do.