Kenny's Two Pennies

...and that's just about what it's worth
  Home |  Contact |   |  Login

Saturday, July 05, 2008

My first Silverlight App

Here is my first published Silverlight App: http://sudoku.kenhales.com.  It solves Sudoku puzzles. It isn't a finished product by a long shot.  Here is my take on Silverlight so far:

  • It is better than ASP.NET by quite a ways, but there is going to a learning curve I still need to get past.
  • I think I will be doing a lot more line-of-business work in Silverlight, including an inventory module for my company's Field Service system (at http://poolcarepro.com).
  • I hope it becomes a popular dev and execution environment -- I do not want to end up with legacy code that is out of the mainstream -- like Delphi or PowerBuilder.
  • I love c#, and definitely relish the idea of providing a rich user experience over a browser, but without having to use JavaScript.

My plans for this Sudoku solver program include:

  • Provide a better way of entering values.  I am thinking some kind of specialized combo box.  One that has an animation to expand a pop-up to show a 3x3 grid of the numbers 1-9, plus a 'clear' button.
  • Ability to save and load existing puzzles.
  • Experiement with Expression Blend (I simply did bare-bones XAML on this so far) to give it more pizzaz.

If anyone has any comments or suggestions, I'm all ears.

posted @ Saturday, July 05, 2008 9:45 AM | Feedback (0) |

Saturday, September 29, 2007

Regex problem / solution

My brother gave me a list of zip codes and their cities.  I needed this list to construct a query that gives revenue information by city, given a couple of tables -- one with account numbers and their zip code, and another with account numbers and revenue.

The revenue information query was easy.  The harder part was getting the danged list of zip codes / city pairs into a table.

Here is what I had to work with:

91605 Los Angeles
91606 Los Angeles
91607 Los Angeles
91630 Thousand Oaks
93115 Fillmore
93552 Palmdale
(etc)

There were only about 60 lines of this stuff, and I figured the easy way would be paste the list into SQL Server's Management Studio query window, do a search and replace to convert the list into a bunch of INSERT statments, and then execute, to actually insert the pairs into a table I already had in place.

Piece o' cake, huh?

I thought I had regular expressions down.  Turns out I pretty much did, but it was the replace string that kicked my butt.  Here was my matching string:

^{[0-9]+}:b+{.*}

It basically says, from the start of a line, match up a string of 1 or more digits and "tag" them for replacement.  Then expect 1 or more spaces or tabs, and then a string of character up to the end of the line.  Tag the string of characters as well.

And here is the replacement string:

insert into zipcities(zipcode, city) values('\1', '\2')

This creates a list of my "insert" commands.  the \1 substitutes the first "tagged" data (the 1 or more digits), and the \2 does the same with the city names.

Here is the result:

insert into zipcities(zipcode, city) values('91606', 'Los Angeles')
insert into zipcities(zipcode, city) values('91605', 'Los Angeles')
insert into zipcities(zipcode, city) values('91607', 'Los Angeles')
insert into zipcities(zipcode, city) values('91630', 'Thousand Oaks')
insert into zipcities(zipcode, city) values('93115', 'Fillmore')
insert into zipcities(zipcode, city) values('93552', 'Palmdale')

Nifty, huh?

The part that kicked my butt?  I naturally assumed that the replacement string followed regular expression rules (the parentheses needed to be escaped with a leading '\' character).  Turns out the replacement string does  not use any regular expression syntax at all.  It just uses the \1, \2, etc. for repacements.  I think this replacement syntax is not universal -- Management Studio does it this way but other engines may use another replacement syntax.  I'm not sure about that though.

There, I have documented this for future reference!

posted @ Saturday, September 29, 2007 9:42 AM | Feedback (0) |

Quote of the day...

So you've got a problem, and you want to use Regular Expressions to solve it. Now you've got two problems.

posted @ Saturday, September 29, 2007 9:02 AM | Feedback (0) |

Monday, September 24, 2007

Forever Seeking Software Architecture Nirvana

I consider myself a pretty experienced software developer -- I have been at it for over 30 years.

All along the way, I have found myself encountering new products and tools, and new ways of organizing code.  One of the (neat) aspects of software development is that there is always something new to learn.

And so now I find myself again immersing myself into new concepts that I had not been familiar with before.  Funny thing is, some of these concepts are not new.  They have been around since I first started programming.  Oh how I wish I had paid more attention to the PARC people!

My latest topics are these:

Throw in some data access stuff (LINQ and NHibernate), and I have a lot to think about.  I'll post some of my thinking on all this later.

btw I'm listening to Tom Harrell's new album "Light On".  Over and over.

posted @ Monday, September 24, 2007 5:33 PM | Feedback (1) |

Sunday, July 15, 2007

A whole new level...

After upgrading from the old .Text blog engine to its replacement SubText, I contacted Kent Chen to see if he planned on upgrading his .Text skin files.  He was unaware of SubText as well, and after switching to it, he sent me the upgraded skin.  Thanks Kent!

SmartCarOnSteroids

On Kent's blog he mentioned Live Writer, which I hadn't heard of before.  I downloaded and installed it, and, wow!  Now creating posts is a lot easier.

Plus, now I can insert pictures.  And wrap text to the side of it.  No, the car isn't mine.  I don't even wish it was.  I just found the picture to be screaming for a snide remark.  Like, who says you can't have fun while saving the planet by driving a Smart Car?

posted @ Sunday, July 15, 2007 9:20 AM | Feedback (0) |

Saturday, July 07, 2007

Finally back...

It has been a crazy several months.

This site was put on hold, for several reasons.  One of the main ones is described in my previous post.  I finally found out that the blog engine I use (DotText), which I thought was becoming obsolete, is in fact alive and well under a new name (SubText).  Woohoo!  I have upgraded, and was able to migrate my old posts with (almost) no problem.  I am hoping that as a result, I will not be getting spam comments.

Another reason is also descibed on a previous post -- the World of Warcraft MMO game.  I cannot belive how much time I put into that game.  It has been very fun, but I am finally just recently getting out of addiction mode.  Shiblon is at level 70, which is as high as you can go.  I have several other "toons", but I am slowing down a lot.  I have actually gone for a day or two at a time without even logging on at all!

I still am wanting to do more technical (software development) posts.  I am wondering if I should create a separate blog for them.  Actually I am thinking I could use four blogs -- Family, Software, Music, and Politics.  But that seems like too much.  Not sure yet.

Anyway, I am back, and plan on posting more often.

posted @ Saturday, July 07, 2007 10:37 PM | Feedback (0) |

Monday, January 08, 2007

I'm not happy

Some blankety-blank idotic programmer, probably being paid by some blankety-blank idiotic blankety-blank etc. has figured out how to bypass the security image when posting feedback so as to spam me.

I had to delete more than 50 feedback items that were links to porn sites.

Plus there were links to online gambling sites.

It really sucks, when you put measures in place that obviously mean “I don't want your spam-crap”, and people get around it anyway.  It's like the cat-and-mouse game played by email spammers, where they try to circumvent spam-blocking software, and the spam-blockers have to implement new measures to circumvent the circumventing.  Why don't they just get the idea in their puny little pin-heads that the reason people install spam-blockers is that they DONT WANT THEIR SPAM?  Do they really think that it is profitable for them to continue to try to circumvent?  I can just see it -- “gee, I don't want spam, but THIS spam is for a product that I want to buy!”.  *NOT*.

The blog software I am using (DotText) has a flag to prevent any feedback, but I can't seem to get it to set.  I may have to just shut down the site, as I refuse to be a promoter of porn sites, or any other products.  I am going to start looking at other blogging software.  DotText is pretty much deprecated anyway, from what I can tell.

posted @ Monday, January 08, 2007 4:26 PM | Feedback (0) |

Monday, November 20, 2006

One Day at a Time

Based on my post from Saturday, you would think that my eye surgery was a slam-dunk.

Well it wasn't.

Saturday afternoon and evening I played on my computer (you can guess what I was playing!), until my vision was too hazy and I couldn't see well enough anymore.  I fugured that I had overdone it and dried out my temporary contact lenses.  I would just lay off until Sunday.  Well, it turns out that Sunday my vision was still so hazy I could barely see.  My eyes teared up easily and they were light sensitive.  I spent most of the day laying around "watching" TV.  Actually I had my eyes closed much of the time, opening them every so often so I could tell what was going on.  Actually that's not a bad way to watch an Arizona Cardinal's football game...

The doctor called twice on Saturday to see how things were going.  I told him they were going great.  If he had called Sunday I would have had a much diferrent story to tell.  He never called -- and I figured that since there was no real pain involved I would just hold off on talking to him until he called -- or until our next appointment.  That will be on Wednesday, when I get the contact lenses removed.

Today has been somewhat better.  I am still light sensitive.  There is still a lot of haze too.  I had my son Nathan pick me up and take me to work.  I stopped at the drugstore and got some +2.50 reading glasses.  I am at least able to get some work done, even though my eyes are not 100%.

I looked on the internet and found that haze is normal for LASEK and may take a few months before it goes away.  I also found that it is normal for vision to be good after the first 24 hours of surgery and then to deteriorate before getting better.  Probably due to the healing process of the eye surface.  Knowing that all of this is normal has calmed me down a bit.  I do have moments where I can tell that my vision is much better than before -- even with glasses.  It will just take a while for everything to clear up and settle down I guess.

posted @ Monday, November 20, 2006 2:21 PM | Feedback (2) |

Saturday, November 18, 2006

Modern Day Miracles

Yesterday I had eye surgery.  The procedure is called LASEK.  There is another procedure called LASIK (with an I instead of E) that many people are familiar with.  In LASIK, a laser creates a flap on the cornea, peels it up, and reshapes the cornea to correct near sightedness, far sightedness, or astigmatism.  Then the flap is but back in place.

LASEK is similar, but instead of creating a flap, the doctor puts an alcohol solution on the eye which softens the top layer of cells of the cornea.  Then he slides the layer aside, the laser reshapes, and then the doctor moves the layer back in place.  Sounds awful, huh?  Then they put a water-based contact lens on the eye until everything heals up.  This is done in cases where the suface of the corneais not thick enough, or, in my case, the surface is not smooth enough.

About 13 years ago I had an eye operation called Radial Keratotomy (RK), which was supposed to correct my near-sightedness and astigmatism -- I had em both.  Back in those days, they used a glass-cutter style knife and actually cut a star pattern on the eye.  This flattened the cornea to correct vision.  It did not work near as well as I had hoped.  Within a couple of years I was wearing glasses again.  Over time my vision became worse.  My eyes had been over-corrected and now I was far-sighted.  I still had astigmatism.  And now I had deformities (actually scars) on the eye surface because of the RK.  That's what I get for always wanting to be on the leading edge (or should I say bleeding edge?) of technology. 
Because of the RK problems, my right eye could not be corrected to 20/20 vision, even with glasses.

Laser eye surgery has been around for quite a while now.  Dr. Cassidy, of Moretsky & Cassidy in Phoenix, was pretty confident that he could correct my eyes and remove much of the problems caused by the RK I had in the past.  So I went for it.

The procedure was a lot different than the RK.  I layed under the laser and, since I had anesthesia drops in my eyes (and I was given some Valium) I didn't feel much as I literally watched the whole thing.  When the laser did its work I had to stare at red dot in the middle of a white halo light.  If I stared and didn't move my eyes then the laser would do the rest.  The doctor and his assistant praised me for doing a good job of holding still.  They seemed pleased with the result.  The procedure took about 15 minutes.

On the way home from the operation (my wife drove), I could already notice an improvement.  I was reading street signs and license plates without glasses, even through the medicated contact lenses, sun glasses, and plastic shields that were taped over my eyes.  I was supposed to rest and keep my eyes closed most of the day yesterday.  I did watch a little TV in the afternoon, but otherwise did as I was supposed to.

I remember that for a few months after the RK procedure I had a lot of discomfort.  Plus I had to use drops in my eyes that constricted the pupils to little dots, and that too was painful.  This time is different.  I have 3 types of medicated drops plus some wetting drops I need to use, but they are not uncomfortable at all.  Even the contacts I am wearing are comfortable -- I don't even know they are there.  That in itself is weird because I have always had a terrible time wearing contacts.  I do feel a bit of a scratchy sensation on the eyes but it it not too bad.

The best part is that I can see pretty good.  There is some haze, but that is normal until the contacts are removed by the doctor (which will be done next Wednesday).  It will take a couple of months before my vision is stablilized.  But I am really encouraged by the results so far.  I can read better now than I could with my glasses before.  I'll keep you posted on how it goes.

posted @ Saturday, November 18, 2006 10:52 AM | Feedback (1) |

Wow!

So much has been going on lately -- it will take more than one post to catch up.  I will do two today and go from there.

First of all, Shiblon.  He isn't a rogue, like I said in my last post.  He is a warrior.  Big difference.  I think I said rogue becuase that is what I originally chose but then I changed my mind at the last moment.

It turns out that starting to play World of Warcraft is like taking the red pill.  I had no idea how deep the rabbit hole went.  Holy cow!

I started playing for two reasons.  One is that I finally got tired of playing solitaire.  I had gotten pretty good at Spider, I could win about 1 of every 4 or 5 deals at the most difficult level.  Each game took at least 15 minutes to play.  Also I was getting good at Freecell too.  I could win up to 25 to 30 games in a row before losing.  After losing a game I woud reset the win stats and start again -- trying to hit 100 games in a row.  Wat a waste of time!  I figured that as long as I was wasting time, I may as well waste it on a different game becuase Solitaire was getting old.

The second reason is because some ex-coworkers that I enjoy hanging around with are playing the game also.  And my two younger sons (by younger, they are 20 and 23) play the game.  By playing too, I would have more in common to talk about.  And it seemed mildly interesting.  I hadn't played much of other games since the Neverhood (about 7 yrs ago), and Space Quest (about 14 yrs ago).  I wanted to see how much games had progressed.

Turns out, this game is like nothing I had ever imagined.  Your character starts out pretty weak.  You have him move around the world using your mouse or cursor keys.  It is like you are moving around inside a cartoon world, where the cartoon graphics are very sophisticated.  Like a Pixar movie type of world.  You walk (or trot) around the country, talking to other characters that are part of the game.  These characters give you quests.  Things like “deliver this letter to so and so”, or “kill 8 troggs”.  Over time you gain experience points and after you get enough you are raised to a new level.  This makes you stronger.  You get to “loot” the things you kill and get money or items.  You get more armor, better weapons, etc. as you loot, or you can buy them with your money.  Pretty cool.

But then, there is a whole nuther dimension to this game, which totally blew me away.  My first night in the game, I was walking down a road and came across a group of characters sitting around a campfire.  I was not familiar enought with the game to know if they were computer generated or not.  I walked up and typed "/say Hi there".  The /say command puts a comic strip style bubble over your character's head with the words in it.  One of the guys at the campfire said hi, and started introducing the others.  I thought this was pretty good AI, so I wanted to see just how good it was.  I said "Are you real or are you Memorex?".  One of them said "Memem...".  Another said "Huh?".  Then I said "Oh that's from a TV commercial that played in the 80's".  One of them said "I was born in the 80's".  Whoa!!!  These were real people.  I said that this was my first night on the game and I was off to find some Troggs.  They said bye and good luck.

Amazing!  I know this game was a Massively Multiplayer Online Role Playing Game (or MMORPG for short).  But I didn't realize how significant this was.  This is a social game.  As you are running around you see other people running, jumping, dancing, whatever.  They are controlled by real people sitting at their keyboards in another part of the city, state, country, or world.  You can interact with anybody.  You can team up to work together on a quest.  You can challenge them to a duel.  You can trade with them, ask for or give advice, whatever.  Most of the people are friendly.  Some are jerks.  You can set up a friends list and converse with those friends whenever they are online.  Eventually you may make friends with them in real life.

So you enter the game and you are carried into another world -- kind of like the Matrix.  It is a meta-verse.  You join a guild, they help you along.  You join parties where you pool your strengths to beat common enemies.  More about this later.

So far I have spent at least 150 hours in this game in the past 3 1/2 weeks.  And when I am not in the game I think about it a lot, and I discuss it with my friends and kids.  There have been some news reports about people who obsess with the game, and spend most of the day in it.  Some kids have dropped out of school, lost girlfriends, etc.  I can see why.  People who are prone to obsessing with anything (such as golf, bars, etc.) can be dragged into this as well.

I have been careful not to neglect my real world duties.  I think I am going to be with this game for a long time, but I am not going to let it take over my life.  It is just a diversion.  I will cut back on hours in it after the newness wears off.

I have a lot more to discuss regarding WoW, but I will save it for future posts.

-- Shibby (that's what my frinds call Shiblon in the game)

posted @ Saturday, November 18, 2006 10:15 AM | Feedback (1) |