Monthly Archives: June 2007

Convert Windows Journal notes to Silverlight

The Mobile team is at it again. They have written a converter to take Journal notes and convert them into an interactive Silverlight page. You can read about it on the Mobile dev center and download the converter application. There are two live demos of it here on my own website where I have hosted their sample and one of my own. (Click on the images below to go to the samples.) Note that mine seems to have stretched a bit because I created it on a lower resolution computer.

VS2005 Windows Forms DataSource/TableAdapter Wizard wierdness

I recently whipped together a small tool for a client and because it was so small (and for only one person to use), I used some simple drag n’ drop wizardry for the form. I created a datasource pointing to a table in the SQL Server 2005 database on my develpment machine then dragged that datasource onto a form to create a navigation toolbar and a screenfull of text boxes and checkboxes.

When I finished it up and pointed it to the live SQL Server 2000 database I was having some strange issues with inserts and updates. Specifically, SQL Server was throwing this error: “Error converting data type varchar to bit.”

A little digging showed me that the TSQL being sent to the databse was passing “True” and “False” to the bit fields rather than 0 and 1.

SQL Server 2005 didn’t seem to mind this, but SS2000 sure did!

I looked at the dataset that was created by the wizard and the bit fields were properly identified as booleans.

But when I looked at the parameters collections of the Insert and Update statements that the wizard had built, I could see that the properties of my boolean values was set to DbType=AnsiString.

So even though I prefered to know why I was seeing a difference between SS2005 and SS2000, I modified the auto-generated Insert & Update statements to make the DbType “Boolean” which passed 0’s and 1’s up to the database and everyone was happy. Changint the DbType to Boolean automatically changed the ProviderType to “Bit”. 

I have seen a few threads where people pointed out this problem but never saw any suggest my solution or provide a reason for SS2000 rejecting it. If this wizard is meant to be used by newbies, I don’t know how they would deal with a problem like this.

 

Vermont IT Jobs: Full Time Analyst/.NET Programmer Jobs in Montpelier

Union Mutual of Vermont Companies

Analyst/Programmer Positions Available

Would you like to work for an established local company with a down to earth, employee oriented work environment?

Are you a creative, analytical individual with solid programming and communications skills?

Union Mutual may have a place for you…

We are on the search for two enthusiastic developers with that rare mix of programming and people skills to join our .NET/web development team. As a part of the team, your responsibilities would include maintaining and supporting our existing environment, as well as working with end-users to develop solutions to business problems.

Our ideal candidates will thrive in an environment where they balance several tasks of varying priority while working with a number of different languages and systems. Professionalism, a positive work ethic and a keen attention to detail are paramount.

Desirable skills and experience include (but are not limited to):

·       Strong analysis and communication skills       

·       Thrives on projects both independently; and in a collaborative team-based environment

·       Profession or educational experience developing solutions using:

o       Object-oriented analysis and design methodologies

o       Microsoft .NET Framework (C# – ASP.NET/Web Services)

o       SQL/XPATH query

o       Source control (CSV or VSS)

·       A passion for learning new skills and languages

Additional exposure to the following would also be of benefit: 

·       Project management experience

·       Aptitude for web and graphical user interface design

·       Knowledge of application development security best practices

·       Best-practice testing methodologies (Test-Driven-Design; NUnit; JUnit; etc.)

·       Prior experience in the property/casualty insurance industry

We offer a competitive salary and excellent benefits including pension and 401K plans.

Qualified candidates are encouraged to submit, in strict confidence, a resume and cover letter to:

Union Mutual of Vermont Companies
Director of Human Resources
PO Box 158
Montpelier, Vermont 05601-0158


or submit to
Resume2007@umfic.com

SQL Server Service Broker at VTSQL meeting tomorrow night

VTSQL is having their June meeting tomorrow, June 20th.

Our pal, Jean-Rene Roy is coming down from Montreal to do a presentation on SQL Server Service Broker. This is one of those topics I found myself having to learn so that I could understand how Query Notification works in ADO.NET 2.0. But there’s a whole lot more to leverage from it besides what I’m getting from ADO.NET.

More meeting info here.

Patterns & Practices: Designing for Operations

INETA sent Keith Pleas to speak to the grateful Vermont.NET User Group last night. Keith presented the Designing for Operations project that PAG is working on. It was eye opening to many of us who have not spent a lot of time thinking about having our applications provide useful information to those who have to keep users happy and a joy for some who have had to write this stuff themselves in the past. Read more here…

[A New DevLife post]

It’s summer? When did that happen?

I think eating lettuce that came from my garden last night really drove it home. Summer is really truly here.

More evidence is that the lupine in field in front of my house is about at it’s peak. It’s pretty hard to share the real view but here is a composite picture and a few others…

click on the composite to see a larger size…

Login control website spam – fix some of it with regex

Recently, the VTdotNET website has been getting hit by some robot entering hyperlinks into the password text box of the login form.

ASP.NET catches this on the server side and pushes out this error:

System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (ctl00$ContentPlaceHolder1$LoginView1$Login1$Password=”<A href=http://…”).

Since I have errors emailed to me, I’m getting a LOT of these emails every day which was annoying.

So, I wanted to trap this on the client side using a validator.

While they may appear to be, login controls are not totally locked up. One of the smart tag options is to “Convert to Template”. Once you do this, you can edit the control all you want.

So I added a RegularExpressionValidator control and entered the following regex for the ValidationExpression:

^((?!href|http).)+$

which won’t allow strings that href or http. Then tied it to the password control and to the ValidationGroup for the whole login control. That way I get the validation during data entry AND when the user hits the login button.

I did the same for the User Name control.

This solved part of the problem. If you went to the actual login page, it was no longer possible to enter hyperlinks and postback. But the spam kept coming. I changed the name of the controls and put some more details in the error handler and saw that the name of the control reported in the error didn’t change and that it wasn’t even coming from the login page. But it was the ONLY login control in the entire website.

Then I got a little education from some who are less naive than I about the evil ways of spammers. Ryan Trudelle-Shwarz, Adam Sills and Dave Wanta filled out the picture for me. It’s a nasty type of comment spam where a robot collects the postback info from your site and no longer needs to return there to do the actual entry and postback. There is still some mystery here for me since there never was a login control on the home page, but as Ryan suggested, the simplest thing to do is just filter out those errors so that I don’t have to get them in my email box and forget about them.

ASP.NET Forum user keanxsoul has done some detective work along these lines and offers an interesting explanation about how the spammers are actually doing this.

 

Story of a Mac Powerbook that got run over by a truck on the highway and survived

No, this isn’t “I used a Mac and survived”, but a great story about my neighbor’sMac powerbook that went through hell and survived.  I should qualify “neighbor”. He lives nearby, though I don’t think we’ve ever met. But he is a blacksmith who’s beautiful work you can see here on his site

He left it on top of his truck when he left his house last week and didn’t realize it until he arrived at his destination about 50 miles away. It had fallen off the car while he was driving down the road and yes, got run over. He posted a message on the local FrontPorchForum in case anyone saw it. I even called my husband to ask him to keep an eye on it on the way home.

Amazingly, some very nice person found it and brought it to Small Dog Electronics in Burlington who was able to track Jim down. More amazingly, it still works!

Jim blogged about this on Small Dog’s website. You can read a Jim’s story here and check out the bent up but still functioning powerbook.