Tuesday, August 09, 2005

JavaScript Datepicker Test

I've been looking for a good javascript calendar to use as a date picker. It's hard to find one that is as easy to implement as this one.

This calendar holds true to the "plug-n-play" mentality.

Wednesday, August 03, 2005

Why Projects Fail


  1. It takes one woman nine months to have a baby. It cannot be done in one month by impregnating nine women.

  2. Nothing is impossible for the person who doesn't have to do it.

  3. You can con a sucker into committing to an impossible deadline, but you cannot con him into meeting it.

  4. At the heart of every large project is a small project trying to get out.

  5. The more desperate the situation the more optimistic the situatee.

  6. A problem shared is a buck passed.

  7. A change freeze is like the abominable snowman: it is a myth and would anyway melt when heat is applied.

  8. A user will tell you anything you ask, but nothing more.

  9. Of several possible interpretations of a communication, the least convenient is the correct one.

  10. What you don't know hurts you

  11. There's never enough time to do it right first time but there's always enough time to go back and do it again.

  12. The bitterness of poor quality lasts long after the sweetness of making a date is forgotten.

  13. I know that you believe that you understand what you think I said, but I am not sure you realise that what you heard is not what I meant.

  14. What is not on paper has not been said.

  15. A little risk management saves a lot of fan cleaning.

  16. If you can keep your head while all about you are losing theirs, you haven't understood the plan.

  17. If at first you don't succeed, remove all evidence you ever tried.

  18. Feather and down are padding, changes and contingencies will be real events.

  19. There are no good project managers - only lucky ones.

  20. The more you plan the luckier you get.

  21. A project is one small step for the project sponsor, one giant leap for the project manager.

  22. Good project management is not so much knowing what to do and when, as knowing what excuses to give and when.

  23. If everything is going exactly to plan, something somewhere is going massively wrong.

  24. Everyone asks for a strong project manger - when they get them they don't want them.

  25. Overtime is a figment of the naïve project manager's imagination.

  26. Quantitative project management is for predicting cost and schedule overruns well in advance.

  27. The sooner you begin coding the later you finish.

  28. Metrics are learned men's excuses.

  29. For a project manager overruns are as certain as death and taxes.

  30. Some project finish on time in spite of project management best practices.

  31. Fast - cheap - good - you can have any two.

  32. There is such a thing as an unrealistic timescale.

  33. The project would not have been started if the truth had been told about the cost and timescale.

  34. A two-year project will take three years, a three year project will never finish.

  35. When the weight of the project paperwork equals the weight of the project itself, the project can be considered complete.

  36. A badly planned project will take three times longer than expected - A well planned project only twice as long as expected.

  37. Warning: dates in a calendar are closer than they appear to be.

  38. Anything that can be changed will be changed until there is no time left to change anything.

  39. There is no such thing as scope creep, only scope gallop.

  40. A project gets a year late one day at a time.

  41. If you're 6 months late on a milestone due next week but really believe you can make it, you're a project manager.

  42. No project has ever finished on time, within budget, to requirement

  43. Yours won't be the first to.

  44. Activity is not achievement.

  45. Managing IT people is like herding cats.

  46. If you don't know how to do a task, start it, then ten people who know less than you will tell you how to do it.

  47. If you don't plan, it doesn't work. If you do plan, it doesn't work either. Why plan!

  48. The person who says it will take the longest and cost the most is the only one with a clue how to do the job.

  49. The sooner you get behind schedule, the more time you have to make it up.

  50. The nice thing about not planning is that failure comes as a complete surprise rather than being preceded by a period of worry and depression.

  51. Good control reveals problems early - which only mean you'll have longer to worry about them.

Tuesday, August 02, 2005

Abbott & Costello's Purchase a Computer

Costello Wants to buy a Computer from Abbott and phones his store:

ABBOTT: Super Duper computer store. Can I help you?
COSTELLO: Thanks. I'm setting up an office in my den, and I'm thinking about buying a computer.

ABBOTT: Mac?
COSTELLO: No, the names Lou.

ABBOTT: Your computer?
COSTELLO: I don't own a computer. I want to buy one.

ABBOTT: Mac?
COSTELLO: I told you, my names Lou.

ABBOTT: What about Windows?
COSTELLO: Why? Will it get stuffy in here?

ABBOTT: Do you want a computer with windows?
COSTELLO: I don't know. What will I see when I look in the windows?

ABBOTT: Wallpaper.
COSTELLO: Never mind the windows. I need a computer and software.

ABBOTT: Software for windows?
COSTELLO: No. On the computer! I need something I can use to write proposals, track expenses and run my business. What have you got?

ABBOTT: Office.
COSTELLO: Yeah, for my office. Can you recommend anything?

ABBOTT: I just did.
COSTELLO: You just did what?

ABBOTT: Recommend something.
COSTELLO: You recommended something?

ABBOTT: Yes.
COSTELLO: For my office?

ABBOTT: Yes.
COSTELLO: OK, what did you recommend for my office?

ABBOTT: Office.
COSTELLO: Yes, for my office!

ABBOTT: I recommend office with windows.
COSTELLO: I already have an office and it has windows! OK, lets just say,I'm sitting at my computer and I want to type a proposal. What do I need?

ABBOTT: Word.
COSTELLO: What word?

ABBOTT: Word in Office.
COSTELLO: The only word in office is office.

ABBOTT: The Word in Office for Windows.
COSTELLO: Which word in office for windows?

ABBOTT: The Word you get when you click the blue "W."
COSTELLO: I'm going to click your blue "w" if you don't start with some straight answers. OK, forget that. Can I watch movies on the Internet?

ABBOTT: Yes, you want Real One.
COSTELLO: Maybe a real one, maybe a cartoon. What I watch is none of your business. Just tell me what I need!

ABBOTT: Real One.
COSTELLO: If its a long movie I also want to see reel 2, 3 & 4. Can I watch them?

ABBOTT: Of course.
COSTELLO: Great, with what?

ABBOTT: Real One.
COSTELLO; OK, I'm at my computer and I want to watch a movie. What do I do?

ABBOTT: You click the blue "1."
COSTELLO: I click the blue one what?

ABBOTT: The blue "1."
COSTELLO: Is that different from the blue w?

ABBOTT: The blue 1 is Real One and the blue W is Word.
COSTELLO: What word?

ABBOTT: The Word in Office for Windows.
COSTELLO: But there's three words in "office for windows"!

ABBOTT: No, just one. but its the most popular Word in the world.
COSTELLO: It is?

ABBOTT: Yes, but to be fair, there aren't many other Words left. It pretty much wiped out all the other Words out there.
COSTELLO: And that word is real one?

ABBOTT: Real One has nothing to do with Word. Real One isn't even part of Office.
COSTELLO: Stop! Don't start that again. What about financial bookkeeping you have anything I can track my money with?

ABBOTT: Money.
COSTELLO: That's right. What do you have?

ABBOTT: Money.
COSTELLO: I need money to track my money?

ABBOTT: It comes bundled with your computer.
COSTELLO: What's bundled to my computer?

ABBOTT: Money.
COSTELLO: Money comes with my computer?

ABBOTT: Yes. No extra charge.
COSTELLO: I get a bundle of money with my computer? How much?

ABBOTT: One copy.
COSTELLO: Isn't it illegal to copy money?

ABBOTT: Microsoft gave us a license to copy money.
COSTELLO: They can give you a license to copy money?

ABBOTT: Why not? THEY OWN IT!

(LATER ON)

COSTELLO: How do I turn my computer off??
ABBOTT: Click on "START"..........

Wednesday, June 29, 2005

Selecting specific objects on a Hibernate Query Join

I ran into a problem when I was trying to select specific columns from multiple tables in a join. I was having trouble casting the returned fields into an object type.

I thought that I would share the two different solutions that I came up with when I found in the Hibernate documentation.

Let me know if you have questions...since I just found this, I may or may not be able to answer it, but I'll try.

Queries may return multiple objects and/or properties as an array of type Object[]

select mother, offspr, mate
from eg.DomesticCat as mother
inner join mother.mate as mate
left outer join mother.kittens as offspr


When this is done, you have to iterate over the Object array and cast it back into the object type that each one is and call the constructor of
the item you are using.

for (Iterator lIterator=lFamilyList.iterator();
lIterator.hasNext();)
{
Object[] lObjectArray = (Object[]) lIterator.next();
Family lFamily = new Family((String) lObjectArray [0],
(String) lObjectArray [1],
(String) lObjectArray [2]);
System.out.println("Mother: " + lFamily.getMother());
System.out.println("Mate: " + lFamily.getMate());
System.out.println("Offspr: " + lFamily.getOffspr());
}

or as an actual typesafe Java object

select new Family(mother, mate, offspr)
from eg.DomesticCat as mother
join mother.mate as mate
left join mother.kittens as offspr


When this is done, you just have to cast it back to it's appropriate class when you iterate.

   for (Iterator lIterator = lFamilyList.iterator();
lIterator.hasNext();)
{
Family lFamily = (Family) lIterator.next();
System.out.println("Mother: " + lFamily.getMother());
System.out.println("Mate: " + lFamily.getMate());
System.out.println("Offspr: " + lFamily.getOffspr());
}

assuming that the class Family has an appropriate constructor.

Wednesday, June 08, 2005

EL OR LA COMPUTER

A Spanish teacher was explaining to her class that in Spanish, unlike English, nouns are designated as either masculine or feminine.

"House" for instance, is feminine: "la casa."

"Pencil," however, is masculine: "el lapiz."

A student asked, "What gender is 'computer'?"

Instead of giving the answer, the teacher split the class into two groups, male and female, and asked them to decide for themselves whether "computer" should be a masculine or a feminine noun.

Each group was asked to give four reasons for its recommendation.

The men's group decided that "computer" should definitely be of the feminine gender ("la computadora"), because:

  1. No one but their creator understands their internal logic

  2. The native language they use to communicate with "other computers" is incomprehensible to everyone else

  3. Even the smallest mistakes are stored in long term memory for retrieval later

  4. As soon as you make a commitment to one, you find yourself being changed by them "for the better".


The women's group, however, concluded that computers should be Masculine ("el computador"), because:

  1. In order to do anything with them, you have to first get their attention, and then turn them on

  2. They have a lot of data but still can't think for themselves

  3. They are supposed to help you solve problems, but half the time they ARE the problem

  4. As soon as you commit to one, you realize that if you had waited a little longer, you could have gotten a better model.


The women won.

Thursday, February 17, 2005

Limiting Characters entered in an html text field Part 2

This is another version of the checkKey() method in the previous posting. It is also usable on IE or Netscape. This function goes about comparing the current key to a string of allowed characters. If it is allowed, it returns true. Otherwise, it returns false. This function is allowing a-z, A-Z, 0-9, -, *, and a space. (Also the Home, End, Delete, and Arrow Keys.)

<script type="text/javascript">
function isValidKey(pEvent)
{
var key;
var keychar;
var lAllowedChars = "abcdefghijklmnopqrstuvwxyz0123456789-*' ";

if (window.event)
key = window.event.keyCode;
else if (pEvent)
key = pEvent.which;
else
return true;

keychar = String.fromCharCode(key).toLowerCase();

// control keys
if ((key==null) (key==0) (key==8)
(key==9) (key==13) (key==27))
return true;

// alphas, numbers, and allow characters
else if (((lAllowedChars).indexOf(keychar) > -1))
return true;
else
return false;
}
</script>

Limiting Characters entered in an html text field Part 1

This script allows numeric, & decimal. You also have to filter out the Home, End, & Arrow keys so they can be used. When you call the function, you must be sure to pass the event. The event to call when filtering keys is the onkeypress event. Notice that the function returns a true or false; and the onkeypress event in the html returns this value so that the body knows whether to allow the key or not. This function filters on IE or Netscape. The "evt.which" statement is the Netscape equivalent to IE's "evt.keyCode."

This is the script that should go in your <head></head>:

<script type="text/javascript">
//Allows only 0-9 & .(decimal)
//The Home, End, & Arrow Keys had to be filtered as well
function checkKey(evt)
{
evt = (evt) ? evt : event;
var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0));
if (evt.shiftKey)
{
return false;
}
if (charCode > 31 && (charCode < 48 charCode > 57))
{
if (charCode == 110 charCode == 190 charCode == 46 (charCode >= 35 && charCode <= 39))
{/*Do nothing...we want these characters allowed.*/}
else if (charCode < 96 charCode > 106)
{
return false;
}
}
return true;
}
</script>


This is an example of the html that should go in your <body></body>:

<body>
<input type="text" onkeypress="return checkKey(event);" id="number"/>
</body>


NOTE: The JavaScript used above uses the single line if-statement. Please see my posting about the single line if-statement for an explanation on how to use this.

Accessing an Access Db using JavaScript

<SCRIPT LANGUAGE="javascript">
var conn = new ActiveXObject("ADODB.Connection");
var connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:/sabe/Sabe.mdb; Persist Security Info=False";

conn.Open(connectionstring);

var rs = new ActiveXObject("ADODB.Recordset");

rs.Open("SELECT [itemname] FROM item", conn);

while(!rs.eof)
{
alert(rs(0));
rs.movenext;
}

rs.close;
conn.close;
</SCRIPT>

Thursday, February 10, 2005

Date Validation with JavaScript

This is a small bit of html to show you how you can use JavaScript to validate dates. This is also leap year compliant.



<html>
<head>
<script type="text/javascript">
function isValidDate(dateStr)
{
if (dateStr == "MM/DD/YYYY")
{
return false;
}

// dateStr must be of format month day year with either slashes
// or dashes separating the parts. Some minor changes would have
// to be made to use day month year or another format.
// This function returns True if the date is valid.
var slash1 = dateStr.indexOf("/");

if (slash1 == -1)
{
slash1 = dateStr.indexOf("-");
}

// if no slashes or dashes, invalid date
if (slash1 == -1)
{
return false;
}

var dateMonth = dateStr.substring(0, slash1)
var dateMonthAndYear = dateStr.substring(slash1+1, dateStr.length);
var slash2 = dateMonthAndYear.indexOf("/");

if (slash2 == -1)
{
slash2 = dateMonthAndYear.indexOf("-");
}

// if not a second slash or dash, invalid date
if (slash2 == -1)
{
return false;
}

var dateDay = dateMonthAndYear.substring(0, slash2);
var dateYear = dateMonthAndYear.substring(slash2+1, dateMonthAndYear.length);

if ( (dateMonth == "") (dateDay == "") (dateYear == "") )
{
return false;
}

// if any non-digits in the month, invalid date
for (var x=0; x < dateMonth.length; x++)
{
var digit = dateMonth.substring(x, x+1);

if ((digit < "0") (digit > "9"))
{
return false;
}
}

// convert the text month to a number
var numMonth = 0;

for (var x=0; x < dateMonth.length; x++)
{
digit = dateMonth.substring(x, x+1);
numMonth *= 10;
numMonth += parseInt(digit);
}

if ((numMonth <= 0) (numMonth > 12))
{
return false;
}

// if any non-digits in the day, invalid date
for (var x=0; x < dateDay.length; x++)
{
digit = dateDay.substring(x, x+1);
if ((digit < "0") (digit > "9"))
{
return false;
}
}

// convert the text day to a number
var numDay = 0;

for (var x=0; x < dateDay.length; x++)
{
digit = dateDay.substring(x, x+1);
numDay *= 10;
numDay += parseInt(digit);
}

if ((numDay <= 0) (numDay > 31))
{
return false;
}

// February can't be greater than 29 (leap year calculation comes later)
if ((numMonth == 2) && (numDay > 29)) { return false; }

// check for months with only 30 days
if ((numMonth == 4) (numMonth == 6) (numMonth == 9) (numMonth == 11))
{
if (numDay > 30)
{
return false;
}
}

// if any non-digits in the year, invalid date
for (var x=0; x < dateYear.length; x++)
{
digit = dateYear.substring(x, x+1);

if ((digit < "0") (digit > "9"))
{
return false;
}
}

// convert the text year to a number
var numYear = 0;

for (var x=0; x < dateYear.length; x++)
{
digit = dateYear.substring(x, x+1);
numYear *= 10;
numYear += parseInt(digit);
}

// Year must be a 2-digit year or a 4-digit year
if ( dateYear.length != 4 )
{
return false;
}

// check for leap year if the month and day is Feb 29
if ((numMonth == 2) && (numDay == 29))
{
var div4 = numYear % 4;
var div100 = numYear % 100;
var div400 = numYear % 400;

// if not divisible by 4, then not a leap year so Feb 29 is invalid
if (div4 != 0)
{
return false;
}

// at this point, year is divisible by 4. So if year is divisible by
// 100 and not 400, then its not a leap year so Feb 29 is invalid
if ((div100 == 0) && (div400 != 0))
{
return false;
}
}

// date is valid
return true;
}
</script>
</head>

<body>
<form name="aForm" id="aForm">
<input type="text" name="aDate" id="aDate" value="MM/DD/YYYY"/>
<input type="button" value="Check Date" onclick="alert(isValidDate(document.aForm.aDate.value));"/>
</form>
</body>
</html>

Friday, February 04, 2005

A lazy Day.


It's just one of those days when you feel like doing nothing.


My Wife & Cat
Uploaded by vermule.