Simple C# Command-Line Compiles

by fwhagen Tue, 29 September 2009

In the category of “So I don’t forget again”, here is how to compile a simple code.cs file to a console executable:

csc /t:exe NetDir.cs

Very simple, very easy.  To make it a Windows exe (console app with no console window, very useful for scheduled or batch processing), change the target (/t == /target) to winexe.


Filed Under: .NET

Book Review: Alas, Babylon - Pat Frank (1959)

by fwhagen Fri, 25 September 2009

Ok, last review was a little over the top.  I should have called it:  The 21st Century's Alas, Babylon.  This book is credited as inspiration to One Second After and with good reason.  Having never read it, I thought it was time.

"The Day" is the one when the bombs fall.  Although we meet our hero Randy Bragg, native of Central Florida (just north of Orlando), and his brother Mark, who serves in Intelligence for SAC, a few weeks before.  Mark warns Randy of an impending attack and sends his wife and kids to stay with him to weather the threat, giving them all some time to prepare.  The threat is realized when the morning skies are lit up in the direction of Tampa, then less so from Daytona and Miami.  And all doubt is erased when the nuclear strike on Orlando itself and the resulting mushroom cloud is unmistakable.  The rest of the book is the story of a small community fighting for survival in the Florida "Contaminated Zone".

Set in the late '50s, it has an interesting perspective for me, knowing Orlando 30 years later.  The references to McCoy Air Force Base (now Orlando International Airport), Pinecastle and the St. John's River are enjoyable and interesting landmarks.  This is also a well thought out and written book, although not as grim as One Second After, and the characters seemed a bit flat to me as well.  Both these comments, though, are to be expected for a book written 50 years ago.  I found some details, such as the abundance of food, and the town rallying behind the leadership of a man all felt previously to be a amusing playboy, to be disappointing.  But it was a very enjoyable read and was significant for its times, if not so much today.


Filed Under: Books

Book Review: One Second After - William R. Forstchen (2009)

by fwhagen Thu, 24 September 2009

And now, the book heralded across the Internet as a must read.  One that eclipses most other novels, and tainted my perception of previous reads (Sorry J.F.Lewis).  It was referenced by Techo-geeks, Military writers and SciFi fans.  How could I not read it?  I ended up getting a copy from the local library and consumed it in little over a week.

One Second After actually starts a couple days before.  Then suddenly, the power goes out, most cars stop, and all electronics go dead. And nobody knows why.  Retired USArmy Colonel John Matherson has a pretty good suspicion having to do with high-altitude EMP burst attacks over the United States, but with no communications with anyone in earshot, who can tell?  What follows is a chillingly realistic look at how devastating the total disruption of electricity would be to our country.  The entire novel is set around the people in a small North Carolina community struggling to survive in conditions 100 years gone.

This is one of the most disturbing book I have ever read.  At the same time, it was very well written and executed.  I felt for the characters, identified with them, feared for them.  I will be buying this book for myself later, it was so good.  I have recommended it to everyone into technology and anyone who feels "safe" from foreign threats.  This is "Red Dawn" of the 21st Century.


Filed Under: Books

Book Review: ReVamped - J. F. Lewis (2009)

by fwhagen Wed, 23 September 2009

I've gotten way behind and am having a hard time remembering what I've read. First up, though, is the sequel to Staked. Again, I bought this for the wife, but since I enjoyed it so much, I wanted to read ReVamped too.

ReVamped continues where Staked left off. Eric, a newly undead but powerful vampire with a bit of a memory problem, struggles to overcome the "Problems" incurred at the end of the first book and find answers to who and what he is. And find out who is responsible and exact some revenge. Definitely a fun story!

I was really impressed by Book 1, but not so much by this one. It's not that it wasn't good, because it was. Just not great. I came away feeling that it was a continuation of an ongoing story and didn't really resolve anything important. Maybe it was me and I had too high expectations. We'll see how the wife likes it...


Filed Under: Books

Book Review: Rules of Prey - John Sandford (1989)

by fwhagen Wed, 03 June 2009

Some time ago, I came across my old friend Tom Cavanagh online and discovered he is a writer. I read his first 2 books and really enjoyed them both. I don't usually enjoy crime novels, but someone lent me this book, and because I enjoyed Tom's books so well, and because Sandford is the pseudonym of the Pulitzer Prize-winning journalist John Roswell Camp, I tried it out.

Lucas Davenport is a celebrated police detective in the Minneapolis area who is renowned for using his intellect and game building skills to crack cases. He is brought in to solve a series of seemingly unconnected murders that have all been "signed" by a single killer's messages to the cops. Davenport is forced to out-think a killer who obviously is familiar with forensics and police procedure in order to bring the killer in. What results is a good, rarely predictable investigation that pits mind against mind in a struggle to be top game master.

Ok, I'm still not a fan of crime novels. But I did enjoy this one. It was a mix of the TV shows CSI, Criminal Minds, and Psych. Actually, I couldn't get the image of Lassiter from Psych out of my mind during passages about Davenport, although his actions were more James Bond than Lassy. This was a good diversion, if not a great book. It remains to be seen if I read more of the series (19 books!).


Filed Under: Books

Book Review: Heechee Rendezvous - Frederik Pohl (1984)

by fwhagen Wed, 03 June 2009

Heechee Rendezvous is book 3 of the classic Heechee Saga of Frederik Pohl.  While Gateway is a very different read, the second of the saga was more mainstream than its predecessor.  And HR is good solid modern Science Fiction.

Again, we join Robinette Broadhead, the even richer billionaire of the Gateway saga. But this time, right from the start, we learn of the alien race known to the humans as Heechee. The main storyline begins with a down-and-out pilot on one of the Gateway planets who decides to work his way back to Earth on a transport ship after his young wife leaves him to go exploring with the castway Han from the 2nd book. On the voyage home, he discovers evidence that the Heechee are still around and can be found, so his plans change to confront Broadhead with a plan to do so. Meanwhile, Han has found the black hole that changed Robin's life so dramatically in the first book and rescued Robin's lost love as a consequence. Both these actions alert and trigger the emergence of the Heechee into Human space, along with a warning of the Assassins who may be awakened to return and destroy all life in the universe.

Final answers in the Heechee Saga are not answered here. We are obviously led up to a conclusion in the final book Annals of the Heechee. This was a good read and Pohl's grasp of science and technology is, again, very refreshing, especially this volumes examination of Artificial Intelligences and the question of storage of human intellect.  I am really enjoying reading this series and look forward to the final book.


Filed Under: Books

Star Wars For a New Generation

by fwhagen Mon, 01 June 2009

This past weekend, I sat down with my 6 year old daughter and watched Star Wars.  It was her first time, certainly not mine.  She really likes the Clone Wars series on Cartoon Network, so I thought it was time.  It was an interesting experience.

Star Wars came out when I was 7.  I never saw it in the theaters in its original release; my parents seldom took us to a theater, and then only for "kids" movies.  I did see it years later, but never the original cut.  My first exposure was a VHS tape that our uncle gave my father.  I watched that tape over and over until it wore out, literally.  I bought the trilogy on VHS when it was released as a boxed set later on, and again when it was remastered with THX sound.  And I got a copy when the whole set was reworked with new CGI content.  Oh, I have seen Star Wars a few times...

The version I showed my daughter was in HD.  Obviously the latest remastered, cleaned, reedited, Greedo shot first, equatorial shock wave edition.  It was beautiful.  After the attack on Leia's ship, I remarked to my wife, "I don't believe I have ever seen this movie look so good!".  Funny, the version I always remember was grainy and almost smoky; it was thick with atmosphere.  This version was crisp and clean, clear and sharp; it looked great, yet somehow lacked something.  She loved it. 

It's funny how 32 years has changed so much.  The impact the film had on me was dramatic, even life changing (OK, I was only 7).  Not so much for her.  That old tape was a treasure to be handled carefully and saved for the future.  The copy from this past weekend was just so many bits on our DVR.  It is marvelous to see the world through her new eyes, yet make my own feel that much older.


Filed Under: Life

Book Review: To Fly & Fight -- Memoirs of a Triple Ace - Clarence E. Anderson (1990)

by fwhagen Mon, 01 June 2009

I finished this book some time ago, but delayed the review of it because I was not sure how to do it properly.  Every once in a long while, I will read a book that is so good, so meaningful, that it can change perceptions.  This may very well be one of those books.  While watching an episode of Dogfights on the History Channel, I learned of Bud Anderson who flew the famous Old Crow P-51 Mustang in Europe during WWII.  So I looked him up online and discovered he had written a book.

I grew up believing, and well into adulthood, that Chuck Yeager was probably the greatest (American) pilot of all time.  But Yeager himself disagrees:  He names Bud Anderson that pilot.  He is the only combat pilot in WWII to achieve triple ace (17 kills) and never get hit.  His tour of Europe never included a scrubbed mission due to his ability or aircraft.  He was incredibly lucky and extremely skilled.  The story of Clarence E. "Bud" Anderson reads like a novel but yet contains great technical and tactical data.  He grew up a poor farmer, joined up at the opening of the war, flew combat in Europe with one the first squadrons to be outfitted with the Mustang, was a wingman of Chuck Yeager and flight leader as well, a test pilot during the glory days at Edwards, and even flew combat during Vietnam in F-105s.  The man is a hero, deserves to be a legend, and still lives today.

To Fly and Fight is written in a humble voice, quick to give credit where due, not afraid to call it like he saw it, and reluctant to believe he is the great hero that he so evidently is.  The problem with writing a review of a book such as this, is not to come off sounding ridiculous, but that is a difficult feat.  I truly enjoyed this book, and have made it part of my permanent collection.


Filed Under: Books

Converting Large (Random) Numbers to AlphaNumeric Strings

by fwhagen Thu, 07 May 2009

I have a need to take large random numbers (on the order of 20 digits) and encode them to easily typable strings.  I created a quick method to do this in C#.  This is the code:

private string ConvertToBase(ulong id)
    // Seed replacement characters for baseX values
    string NumericBaseData = "0123456789ABCDEFGHJKMNPRSTUVWXYZ"; // this string may be in any order as long as each char used only once
    ulong OutputBase = Convert.ToUInt64(NumericBaseData.Length); // baseX determined by number of unique chars in seed string
    string OutputValue = "";
    ulong In = id;
    while (In > 0)
        ulong tn = In % OutputBase;
        OutputValue = string.Concat(NumericBaseData.Substring(Convert.ToInt32(tn), 1), OutputValue);
        In = In - tn;
        In = (In / OutputBase);
    return OutputValue;
For simplicity, I used unsigned longs (64bit), since I am dealing with really big numbers.  Performance is reasonable, I am able to generate a large System.Random, mod it against an arbitrary number of DateTime.Now.Ticks, datestamp it, and convert it using the method above in under 9 ms each.  (I also have an algorithm to test for uniqueness against previously generated values, but the timings grow with greater sample size as expected.)  This method can be modified with any number of cipher characters as long as they are only used once.  This particular one uses all letters and numbers except 'O', 'Q', 'L', and 'I' to avoid confusion to end users and is URL freindly.

Keywords: ,

Filed Under: .NET | Programming

Looking for Oracle Developer Training for ASP.NET Developers

by fwhagen Fri, 20 March 2009

I am in the market for some quick, effective training in Oracle Development focused on consumption from a ASP.NET development point of view.  I don't need to know how to admin the Oracle server, just how to write effective, efficient queries, setup performant data models, optimize data access and fix our overabundance of foreign keys, indexes and CLOBs.  I am advanced in SQL Server development, but need to know the nuances that differ in Oracle.

Any recommendations?  Thanks in advance!

Keywords: ,

Filed Under: Oracle | Programming