Pages

Tuesday, June 9, 2009

Former ATT chief tapped to head GM

Well here we are expecting a leaner meaner GM to come out of bankruptcy and who do the pick as the new Chairman? Why Ed Whitacre of SBC/ATT fame.

http://www.computerworld.com/action/article.do?command=viewArticleBasic&articleId=9134143&intsrc=news_ts_head

How is GM supposed to get smaller when you hire this guy to lead? He resurrected ATT from the ashes of MaBell. His resume is built around putting humpty dumpty back together again, Is that what we need? Don't get me wrong Ed is a sharp business man, however, he does not have the right set of skills or perspective for this task. Why do I care? Mr. Obama has made me an owner.

Who knows, maybe Pontiac is not dead yet after all... or Nash, American, or Pierce-Arrow.

Thursday, June 4, 2009

Java Unicode Regex

Working on an internationalized application has it's challenges. As we accept data from each country we need to validate the inputs. Regex is a great tool for this and Java's ability to do unicode regex is excellent.

Here are some details. Java takes the POSIX concept from Perl and groups unicode characters together based on purpose. Here are some of the base groups.

Numbers
\\p{N}
Alpha characters (all languages)
\\p{L}
Symbol characters (all languages)
\\p{S}
Punctuation characters (all languages)
\\p{P}
Spacing characters (all languages)
\\p{Z}
Mark characters (all languages)
\\p{M}

You can also use the '\\P' to xor the condition. So \\P{N} means not numbers.

These groups also have sub groups, for example \\p{Lu} would represent Uppercase letters. Lowercase would be \\p{Ll}

Java also has some flags that control the evaluation of the regex. I use the following flags when I create my pattern.
Pattern.CANON_EQ          This allows the regex to accept a suitable substitute char, for example a for à.
Pattern.CASE_INSENSITIVE  This allows the regex to ignore case
Pattern.UNICODE_CASE      This allows the regex to ignore unicode case.

Below is a code snippet showing how to use these for AlphaNumeric, Numeric and Alpha.
/**
* A regex for valid UTF-8 characters.
*
* Numbers  and notNumbers
*    \\p{N}           \\P{N}
* Alpha characters (all languages)
*    \\p{A}
* Symbol characters (all languages)
*    \\p{S}
* Punctuation characters (all languages)
*    \\p{P}
* Spacing characters (all languages)
*    \\p{Z}
* Mark characters (all languages)
*    \\p{M}
*/
private static final String ALPHANUMERIC_CHARS = "[\\p{N}\\p{P}\\p{Z}\\p{L}\\p{M}*]+";
private static final String NUMERIC_CHARS = "[\\p{N}*]+";
private static final String ALPHA_CHARS = "^[\\p{L}*]+";

/**
* Tests for alphanumeric characters in the string.  This also allows comma, period, space, dash and ampersand.
* @param testString
* @return
*/
private Boolean isAlphaNumeric(String testString) {       
Pattern p = Pattern.compile(ALPHANUMERIC_CHARS, Pattern.CANON_EQ |
Pattern.CASE_INSENSITIVE |
Pattern.UNICODE_CASE);
Matcher m = p.matcher(testString);
return m.matches();
}

/**
* Tests to make sure only alpha characters are in the string.
* @param testString
* @return
*/
private Boolean isAlpha(String testString) {
Pattern p = Pattern.compile(ALPHA_CHARS, Pattern.CANON_EQ |
Pattern.CASE_INSENSITIVE |
Pattern.UNICODE_CASE);
Matcher m = p.matcher(testString);
return m.matches();           
}

Note: With in the code the regex is java escaped. If you are testing this in a regex tester the regex would look like this:
[\p{N}\p{P}\p{Z}\p{L}\p{M}*]+

Excellent resources on this are here http://icu-project.org/docs/papers/iuc26_regexp.pdf
and here http://www.regular-expressions.info/unicode.html

Monday, June 1, 2009

Enema of the state

Well we've spent billions upon billions of dollars, GM has become Government Motors, and our retirements are out the window. This is the enema of the state.

GM has been in trouble for years. Their inept management compounded by the unions stranglehold ensured that they would be bankrupt. The government is playing the white knight and riding to the rescue. This is what is keeping this bankruptcy from being a liquidation and not a reorganization. But think hard about this all you that are cheering... This is the same government that can't make Amtrack, or the postal service work. Why do we think this will be any different?

So whose to blame? The unions sucked on the blood of GM until they were fat as ticks. Don't get me wrong, the unions had their place in the the development of labor within this country. Their early efforts were about insuring work place safety, and rightfully so, the rail and stock yards were incredibly dangerous places to work, and the company barons did not care. Then after the safety issues were alleviated, they moved from hours and pay to benefits to job security. As they moved through all of these legislation was written that ensured the protections and limits they were fighting for. But they did not realize that they no longer had a purpose. They did not go away. They stuck around. The union dues gravy train was here...

Combine the strangulation of the company by the unions with the incredibly shortsighted management of GM, and this result was inevitable. Now we have the most laughable of situations, the biggest spending organization in the world is going to ensure that GM is successful. By the way the biggest spending organization is powered by you and I the taxpayers. I can only hope the administration will take a hands off approach. If not we will surely be driving electric versions of the Yugo (You heard it here first).

Oddly enough several banks that initially wanted money have said they do not want it any more
http://www.foxnews.com/politics/2009/06/09/report-allow-banks-repay-tarp-money/. They have discovered that public knowledge of having taken the TARP funds is a "Scarlet letter". Ford who was wise enough to refuse government money has determined that this period is a time to make significant inroads in market share and will increase their output 10%. http://www.autoblog.com/2009/06/01/ford-to-increase-production-by-10-in-third-quarter/ They were wise enough to understand that having the government as a business partner is the equivalent of tying a rock to their ankle and jumping off the deep end. Kudos to Ford for understanding that when all others zig you should zag.

The economy is coming back. Knee jerk legislation is not what saved it. Bad fiscal policy is not what saved it. The free market righted itself. Most of the money yet to be distributed as aid to companies will be wasted. This is the government doing what it does best... Now bend over and bear down...

If you think spin distorts your news I have references from several different sources on where the money is or was, and where it should go.

http://projects.nytimes.com/creditcrisis/recipients/table
http://money.cnn.com/news/storysupplement/economy/bailouttracker/
http://bailout.propublica.org/
http://www.grailresearch.com/PDF/ContenPodsPdf/Global_Bailout_Tracker.pdf



If the government wanted to do something helpful it could setup a clearing house that would aid in the classification of all the unknown debt out there. This is not a crisis of liquidity. This is a crisis of transparency. The banks balance sheets need to be understood for the unknown risk they contain. This needs to be quantified. Then and only then will credit flow properly again.

By they way... get your refi now. In 3 -5 years we will be at 10%.... or more. As this debt gets quantified rates are going to jump significantly.