Archive for Uncategorized

Double check your error settings

If you’re a company that offers web products & services, you should really make sure your potential customers NEVER see this page, its quite bad for business.

Errorclipped

Best way to ensure processes are followed

We’re constantly tweaking and improving our processes at work when we see an opportunity to grow.  We leverage Sharepoint a lot because its readily available and easy to setup.  We have policies around how we work on projects as far as how we document projects, source control, issue management, etc. with most of these policies involving Sharepoint at some level.

Our process works well – when we follow through on it. Its sometimes difficult to find the discipline to always follow the letter of the law. For instance, I may see something wrong in a project, so I’ll go and fix it, check the change in, and its done.  What I should do is open a new issue, document it, and link my code checkin to the issue so we know what was done to fix the problem.

For processes to be most effective, they need to be followed by everyone on the team consistently, which can be a struggle.  Its especially hard if the processes you want to implement are a pain in the ass for the developers.  Consider a hypothetical scenario where in order to fix a bug you were required to walk around to every developer in your company and tell them verbally that you were fixing a bug, what you were going to do, etc.  It would never happen, its such a waste of time that people would just fix the bug and get on with life.

The best process is one that can’t be circumvented.  In the above scenario, I can choose to not go to every developer, I can just fix the bug. Since that policy has ways of getting around it, you run the risk of some people following it, some people who “kind of” follow it, and some people who flat out ignore the policy.  Instead, if there was some way to guarantee that everyone follows the same procedures, you’ll get the most consistent results and accurate data.  The way you guarantee that everyone is doing the same thing, is to latch on to something that eveyone is already doing.  If there was some action that you know everyone already does and you can somehow associate your process with that action, you can ensure that everyone does it. I think the pressure point that can fulfill this requirement is your source control.

Every developer needs to checkout code from the repository, and they need to check it back in after they’ve made their changes.  Its unavoidable, and everyone is already doing it. If you can inject policies into the code checkin, people have no choice but to complete the necessary actions.  If you require that they’ve entered the bug or feature into your bug/feature tracking application by forcing them to put the issue number in the checkin comments, then you have a good start on getting everyone on the same page.  You can even extend it past that.  You could have them enter the number of hours spent, the estimated hours, etc. and by doing all this as part of a checkin, its going to get done, because it will have to, it can’t be circumvented.

I haven’t research many source control tools to see what kind of existing functionality they have in this space.  I’d be willing to bet that Vault has some sort of policies that can be applied. Not sure about SVN, CVS, or Source Safe.  I do know that SVN has the concept of hooks so that you can write custom apps that intercept the checkin and do whatever you want.  This is something that really interests me, so I’m going to be doing some more research to see whats currently out there.  I think you could have a really streamlined, lightweight process that still generates plenty of useful project data by collecting the data on checkins.

(This entire post assumes that you embrace a process-driven environment, which I believe is not advocated by some of the agile/scrum community, I think they focus more on the people rather than the process, correct me if I’m wrong here.)

ClickOnce is harder than it seems

We’re using ClickOnce to deploy the windows forms client that I’m currently working on.  ClickOnce is sweet, its awesome to not have to worry about updating your users’ applications, knowing they will get updated the next time they run them, but thats not to say that it doesn’t have its drawbacks.

One problem I ran into was the issue of .config files.  In our app we have some settings stored in the app.config file.  We want to have different settings for our development environments from the production environments.  The problem is that once you’ve created a ClickOnce deployment, you can’t modify the files, otherwise the hash codes won’t match anymore and ClickOnce will refuse to install the application.  After doing some digging and not finding much, we just have separate .config files for development vs. deployment, which is usually the case, but using ClickOnce basically means that you can’t modify the files once they’re deployed, or so it seems.  You can’t just build from Visual Studio and put the files out there, you really need to have a separate build environment setup.  I think I’m going to setup an automated build that will generate the ClickOnce deployment files so that we can alleviate this problem. (I know, I know, we should be doing this anyways I’m just pointing out that its got some barrier to entry sometimes).

One thing that is nice about ClickOnce is the portability of the deployment files.  You have several publishing options, File System, Web Site, FTP site, etc. Since the files need to go from our environment to the client’s environment behind a VPN and firewall, we can’t simply publish the files right out there, we have to publish them locally, then copy the files over to their web server.  Its nice that you can simply copy the files over and it just works, no extra steps neccessary.

Since we are developing a windows forms app, we are taking advantage of encrypting app settings that .net 2.0 introduces, but more on that later.

 

Busy, busy

Whew! I’ve been busy as hell at work lately, which means I get home and the last thing I want to do is sit down at my computer and write.  On top of my own project work, I’ve been helping others get up to speed, as well as other random stuff I’ve been tasked with.

My project at work is a pretty damn cool one though.  I’m converting an asp.net application into a Windows Forms application for one of our clients, using .net 2.0 deploying the app using ClickOnce.  This was an internal web site, so the deployment piece isn’t a huge deal, but its cool to be using the newest technologies, and I’m learning a ton about how databinding works in WinForms 2.0.

I got approval to use the Composite UI Application block to develop the application, so I furiously researched the CAB and did some of the hands-on labs and whatnot.  Doing the labs really helps you understand how the CAB works, as it can be pretty tough to wrap your mind around it.  I still don’t fully understand it, as I started developing the project, my code slowly morphed into a simpler MVP pattern, with only views and controllers, leaving the WorkItems to not really do much at all.  I’m still developing the modules as separate class libaries so that me and the others on the team can develop the modules independantly of each other, and I’m still using the CAB to dynamically load the interfaces into the workspaces at runtime, but I know that I’m not using the CAB to its full power.

The real benefit to the CAB seems to be that you can dynamically swap out interfaces, but I don’t really need that functionality, as the interfaces will always be a pre-defined set.  I am using this feature to swap out whole interfaces based on the user role (Admin, User, Guest, etc.) which makes it a lot easier to do authorization, because in my Admin views I can load all the info I want, in the User views, I only interact with data that is authorized for User’s; so rather than have a bunch of code that is always checking the role of the person who’s logged in, I can simply do the check once, load the appropriate interface, and that it.  Very slick.

Insert a Sharepoint list item from web services

I recently wanted to use Sharepoint’s web services to manipulate a list on one of our WSS sites.  I wanted to submit a list item from a remote location, so using the Lists web service (http://<server-url>/_vti_bin/lists.asmx) seemed to make sense.

There are many examples of inserting a list item in Sharepoint using the web services out there on google, and they are helpful.  They tell you how the Lists api works, because its not really intuitive, as the argument to the web service is an XmlNode object.  Basically, what you submit to the web service is a xml document that contains the values for the list fields that you want to add, something like this (lifted and modified from here):

string sBatch = string.Empty;
sBatch = “<Method ID=\”1\” Cmd=\”New\”>”;
sBatch += “<Field Name=\”ID\”>New</Field>”;
sBatch += “<Field Name=\”Title\”>My Title</Field>”;
sBatch += “<Field Name=\”EventDate\”>” + DateTime.Now + “</Field>”;
sBatch += “</Method>”;

This is one way to construct the xml document that you need to submit. This xml will add an item with a title of “My Title” and an Event Date of the current date/time.  This code works, theres nothing wrong with it.  Its just that this is the extent of the examples out there, I couldn’t find anything that was more complex, for instance, an example of inserting an item into a Sharepoint list where one of the fields in the list is a lookup to another Sharepoint list.

Consider a list where there is a Status column, which is a lookup to another list that has possible values of “Submitted”, “Approved”, “Rejected”, and “Completed”.  How do you specify the value for this field? I initially tried simply inserting the text value of what I wanted, so my xml would look like this:

<Method ID=”1″ Cmd=”New”>
     <Field Name=”ID”>New</Field>
     <Field Name=”Title”>My Title</Field>
     <Field Name=”EventDate”>3/25/2006 12:00 PM</Field>
     <Field Name=”Status”>Submitted</Field>
</Method>

But this doesn’t work.  After some more trial and error, I tried the index of the value that I wanted, in this case 0, because “Submitted” is the first item in the list, and presto! My item was inserted, all was good.  The downside that I see to this, is that if the indices of the items change, you have to change your xml. You could get around this by querying the lookup list and finding the index of the item dynamically each time, its your call.  So if you want to insert an item into Sharepoint with a field that is a lookup field, here is an example of what your xml should look like:

<Method ID=”1″ Cmd=”New”>
     <Field Name=”ID”>New</Field>
     <Field Name=”Title”>My Title</Field>
     <Field Name=”EventDate”>3/25/2006 12:00 PM</Field>
     <Field Name=”Status” Type=”Lookup”>0</Field>
</Method>

I hope this helps someone else who is scouring google for help :)

UPDATE: I forgot an important piece to the resulting xml. You need to include the Type attribute on the Field element, I have added it to the xml above in red, my apologies.

Looking for projects

I’ve been looking for a new project to work on outside of work for awhile now.  I’ve had some ideas, but they have been getting nixed for a variety of reasons, lack of interest on my part certainly being one of them.  I’m considering devoting some time to an open source projet, so myabe I’ll have a look around and see what interests me.  Theres no shortage of .net projects on sourceforge, so I should be able to find something that catches my fancy.

Been in kind of a blogging rut lately as well, so maybe this will inspire some more posts as well :)

If you know of any cool projects out there, don’t hesitate to let me know, thanks!

(As an aside, I only missed 5 games in the 1st round of the NCAA tournament (Iowa, Kansas, San Diego St., Marquette, Wisconsin) leaving me in first place after round 1)

Is your first agile project doomed?

People don’t generally get things right the first time. Remember the first time you tried to ride a bike, or the first time you drove a car? Chances are you fell off, or had a fender bender.  With this in mind, doesn’t it stand to reason that the first time you try to use some agile methods in your software projects, you’re going to get them wrong?

The problem is that when you fall off your bike, its not a big deal.  Screwing up a software project can cost big bucks though.  How many chances do you get to figure it out? Do you spend a bunch of money up front to get some agile consultants and training so that you can ensure you’re doing it right?  Doesn’t it also depend on everyone buying into the processes and methodologies?  If you have some developers who think agile is a bunch of hooey, I would think you’re screwed from the get-go.

I suppose this argument could be applied to anything, but agile in particular seems like a big step and one that requires a lot of discipline to follow procedures and trust the people around you.  What do you think, is your first agile project doomed?

More Origami

Ah, finally, some sensibility about the Origami hype:

There’s no way this thing is going to be able to meet the expectations of the hype being placed on it.”

And from the last place I would expect it.

Firing javascript events when textbox changes

Just a little heads up to anyone putting client code on a textbox.  If you want some  javascript to run when the text in a textbox changes, use OnKeyUp instead of the intuitive OnChange event.  OnChange will only fire after the textbox has lost focus, rather than as the keys are pressed in the textbox, whereas OnKeyUp will fire when, well, when a key comes up!

Of course, if you only want your code to run when the textbox loses focus anyways, then continue using OnChange :)

Four things………

My big sister tagged me with the “four things” stuff thats going around:

Four jobs I’ve had

  • McDonalds
  • Park Maintenance for the city of Lakeville
  • Waiter at Byerlys
  • Pizza delivery driver at Leaning Tower of Pizza

Four movies I can watch all the time

  • Rounders
  • Goodfellas
  • The Godfather Trilogy (kind of cheating here)
  • Bad Santa

Four places I’ve lived

  • Minneapolis, MN
  • Burnsville, MN
  • Lakeville, MN
  • St. Paul, MN

Four favorite TV shows

  • Greys Anatomy
  • The Family Guy
  • West Wing
  • 24 (just started watching it today actually)

Four places I’ve vacationed

  • Germany
  • London
  • Denver
  • Hawaii

Four of my favorite dishes

  • my own chili
  • that salad that mom makes
  • dads chicken wings
  • Erin’s dip for chips (she has a bunch, any of them will do)

Four sites I visit daily

  • bloglines.com
  • startribune.com
  • mail.google.com
  • msdn.microsoft.com

Four places I’d rather be right now

  • Vacationing in the mountains
  • Somewhere warm and with no responsibilities
  • London
  • In one of those cool “mens rooms” you see in movies and stuff where the guys get together in a room with big, ample leather chairs and they smoke cigars and drink booze and tell dirty jokes………….yeah, that’d be nice too

Four people I will tag (it’ll be interesting to see who finds themselves listed here, as this won’t be going on the main feed)