Doing a talk at SQL Saturday #150 in Baton Rouge.   Here are the slides for 10 Things I Wish I Learned In College

10 Things I Wish I Learned In College2

Here’s a copy of my resume for people looking to copy a resume.   I suggest you just make it your own and plug your information where mine is.

WayneOdom2011-projectlead

 

It’s not exactly like it’s something that hasn’t been solved in the past but in my experience people usually solve it for a solution “not what we’ve been missing around the office”.   Here’s what we wanted it to do:

  1. Generate Microsoft Word documents programmatically.
  2. Generation is through a MVC 3/4(whatever) website.  Basically ASP.NET
  3. Generate without installing Office on the server which is a big no-no that people typically end up ignoring and gambling with.
  4. Do it in a way that you can teach someone else to support and reproduce easily.

Well I solved it through delegation.   By delegation I mean myself and the other developer lead had taken seperate 1-2 day stabs at the problem before we got overrun with business as usual and we finally got another resource we could delegate it to without his time getting consumed by some panicked manager worried about XYZ business owner on product ABC.   I handed him the problem with a few possible solutions such as Open XML, Infragistics, Telerik, Automation Factory and some others who’s memory I’ve probably already drank away by now.

Well after a week or so of research our guy came up with using this:

Open XML SDK 2.0 for Microsoft Office  (specifically the Open XML SDK Tool but yeah you probably want it all)

It works.   Essentially you template out whatever you’re trying to produce in Microsoft Word and then run it through this tool.   It will produce the C# code you need as a starting point to produce the documents you need.    It’s great and head and shoulders over the Open XML tutorials/examples I’ve seen out there that only show you how to self code a 4 line Word document.   You still have to doctor it some since it only produces code for the document you’ve templated out but it gives you an in depth starting point and really lays out some of the “layered” aspects of generating Word objects.

At a later date I hope to piece together an actual demo but for now this should help anyone with the same problem.

, ,

It’s not a complaint as I use WordPress myself on this site but sometimes I’m just surprised how many people come to me for something and they’ve got a WordPress install.    I’ve been working with a Baton Rouge Sign company who has a website that’s “just a website” and it runs WordPress. People seem to use it as a quick CMS of choice for just about any situation and it certainly does work well. Even Microsoft pushes WordPress in their web platform installer for developers to consider.

The bad side of this is often developers just setup and forget these installations. So a business owner calls me in and I’m facing a version of WordPress completely out of date with multiple out of date plugins installed. Most updates that come out are around security which means over time site owners become more and more susceptible to hacks.   So I guess if I could complain about WordPress it’d be that an automated mechanism for notifying an owner concerning updates would be nice and doable.   Heck it might exist as a plugin I just haven’t looked it up yet.

Ok mini rant/excuse to blog over.

, , ,

Software development is an insane business.   Truly.   The definition of insanity(as most know) is repeating the same thing over and over and expecting a different result.    And despite years and years of learning and hammering to make things “modular”, “decoupled”, “services” and “layered” developers still come in and continue to tightly couple applications to the point that I feel like I’m staring at a giant obelisk.    There’s no way to do anything with it beyond take it for what it is and start building another.

I feel like console applications are a way to prevent some of this especially in the phase of building domain, data and business layers.    In my experience developers get wrapped up in things like MVC, Silverlight, ASP.NET, WPF, Mobile and whatever the end goal interface is.    They want to go from bytes to complete functionality and press a button so badly that they rush through everything.

Writing a console  application is a chore to most of the undisciplined.    It takes focus away from the end result and allows you to focus on the business of what you’re writing.   It stops you from hanging up on some pointless JQuery subtleties for days when you’re supposed to be building an appropriate business logic functionality.   Hell short of standing behind a developer II with a gun I can’t get them to actually digest the purpose of a View Model because going around it is quicker and allows you to close a task in 10 hours when it’s scheduled for 40.

When a person who’s written several more applications to you in the specific enterprise you’re in schedules tasks for 40 hours and you finish them in 10 you should think perhaps you’ve worked with a bit too much haste. 

I came to the conclusion to write console applications for anything not so long ago after an interview in 2010.    A solutions architect came in to interview me and flipped a laptop open and asked me to write some functionality.    At that point I NEVER wrote console applications however I figured it out and he rather enjoyed the result.   I got to know this guy a little better and found that he wrote console applications for everything being that he worked in integrations and had zero care for interfaces.     It wasn’t important as he only wrote services.    I decided to try my hand at this on return rather than trying to bolt up functionality clumsily to whatever flavor of interface technology we were focusing on at the time.

The quality of code and the bug rates were noticeable to say the least.   Domain errors were reduced, business logic bugs were identified sooner and tests were run cleanly before a single fancy Telerik control hit a page.   There was no scrambling later and reproducing code in multiple places because you accidentally added business logic to view models in a Silverlight project that you needed in an export service later.    Further we were able to quickly produce those fancy client applications because we didn’t have to perform changes to a domain that crippled some aspect of your MVC application because you worked directly with your domain objects.

Kind of all over the place in this rant aren’t I?   The point is that when you use a console application to perform taste tests on your products you don’t make near the mess.    All the great products out there by Microsoft, 3rd party vendors and open source products are so enticing that they take focus away from creating quality software.     I think that if you’re in an environment with a lot of developer freedom you should go console application first while creating the ground work of an application.   It’s in my opinion the best way to stay focused on the right kind of interfaces and create sound software.

I’ll probably read this next week and disagree with a bit of it but hey take it for what it is.   A rant based on my experience.

My beautiful wife decided I deserved a Kindle Fire as a Christmas present this year.   I read a lot and have commented that book size often makes it difficult to read in the room.   Additionally she wants to sleep and I want to read so light can be an issue.    Being thoughtful she purchased this great little device for me which I was extremely happy to see.

The features for the price is awesome on the Kindle Fire.

This thing is truly awesome.  It comes with a one month free subscription to the Amazon Prime service which really makes it easy to hit the ground running with this toy.   I took the opportunity to read the first piece of 21st century fiction I’ve taken the time to read   I read “The Hunger Games” in about 3 days with this little device.   It makes reading so easy with it’s size, screen and feel.   With the Wifi option I could easily swap over and look up words, do a little Googling/Wikipedia time.   For my situation it’s a great device.

My Reading Speed Seems to Have Increased.

This is something I didn’t really anticipate when using one of these devices but I seem to be reading faster.   A book that previously took me a week can be read in about half that.   I’ve read a few books with the think now and it’s very noticeable.    I think the combination of the size along with the adjustable brightness to the screen make it far easier to read longer on a device such as the Kindle Fire.   Great for me because I digest the material much quicker.

Kindle Fire vs Ipad

Without dispute the Ipad is a superior device in all areas.(especially price)   The Fire is a great device if you want to read books and browse the internet.    I also watch WiFi  video and listen to music.      The question comes down to a few things you can honestly ask yourself.

  1. Do you need to use it for business?   –  If the answer is yes then you don’t want a Fire and likely want the very mature Ipad.
  2. Do you need the larger tablet screen?  – This really makes a difference.   I strongly encourage you to try out several pad sizes before purchasing.  I don’t need a large screen although it would be nice.   However for the cost I am happy with my Fire.
  3. Do you need more than Wifi?   –  Hasn’t been a big deal to me with the Fire.   I have Internet in 90% of the places I go.
  4. Do you needa gyroscope, camera, WAN module, Bluetooth, microphone, GPS, or micro-SD?   None of these things are in the Fire.   If you want a true gadget then buy a more expensive device.   You truly get what you pay for and Fire covers the needs of me and probably over half of users which makes it a great niche device.

 

, ,

I have the pleasure of being the lead developer in a ramp up of some new software we’re building. I have other experienced devs with me but none of them are experienced in Microsoft’s MVC and we have time to ramp them up while exploring MVC and available options for navigation, controls and other front end components that will be important and we don’t want to waste time on later. One of my devs is specifically working on a layout with a specific navigation criteria. We own Infragistics controls and are open to anything that gets the job smoothly so we tried both sets of MVC extensions.

Infragistics controls install via an installer. I’ve used their Silverlight controls for some existing applications and they worked great. Their MVC controls look very nice in the demos(although no menu control) but we tried them first to see what they had to offer. My developer had a seriously hard time getting the demo grid to work in his existing MVC application due to resource and path issues.

Telerik offers a larger variety of MVC controls. Infrigistic offers some of the same controls and some that Telerik doesn’t but we found that Telerik had a more complete suite for what’s important. Additionally the amount of time for our developer to get started using the controls was dramatically less. In fact when I suggested he use the controls it took him about an hour to get it working within the demo whereas he spent about a day fighting with Infragistics.

Based on our one day assessment I have leaned towards suggesting we purchase Telerik in addition to our existing Infragistics components. It’s been a smoother experience, my other lead developer is an Telerik fan and in my experience at Tech Ed and other Microsoft events Telerik gets more love. It’s an added bonus I don’t have to take heat for the original Infragistic purchase since the guy responsible for that isn’t any longer here.

I’ll post back with an update if my mind changes.

, , , , ,

Baton Rouge has a Windows Phone 7 User Group.   One of my favorite things about the Microsoft products is there seem to be several communities popping up concerning their technology.   I volunteered to talk about my experiences as relates to the development of Pocket Brewer so I’m doing that.   The slides and demo code as relates to this talk are at the links below for anyone interested in them.

DummyWP7App – Windows Phone 7 Demo App

Pocket Brewer Power Point

 

 

Here’s a fun little piece of code I scraped together today for an ongoing issue we’ve been having. Seems for years nobody can figure out how to locate whether a user(jodom for example) exists in our Active Directory and how to add them to a group via C#. A few people have tried but always given up and used a web service built by a consultant that no one knows what happened to the source code. The service is a pain because it dies silently whether the user exists or not and whether it succeeds or not.(really dude)

The code isn’t that difficult as you can see and I’m almost certain my peers came up with something similar on previous attempts. I’m almost certain their failure was the result of not being able to obtain appropriate DN because nobody even our network engineers had heard of LDP Tool for Querying Active Directory(LDAP) which will assist you in building LDAP queries in C#. There’s obviously a disconnect there in the developer community because I must of ran through a dozen HELP threads on various .NET boards concerning this topic.

So….code is below and should work fine to add/remove a user to a group that the userName/password provided has Management rights to. It first uses the DirectorySearcher to find the DN of the account and then uses that DN for the Add/Delete. There might be a simpler(mo better) way to do it but this hammer works so swing it.

string NTId = "jsmith";
bool IsAdding = true;
string userName = "UserWithManagementRightsToGroup";
string password = "Password";
var exists = this.ObjectContext.SomeEntitys.Where(p => p.EmployeeID == NTId);
DirectorySearcher userSearcher = new DirectorySearcher();
userSearcher.Filter = "(&(objectclass=user)(objectCategory=person)" + "(sAMAccountName=" + NTId + "))";
if (userSearcher != null)
{
userSearcher.PropertiesToLoad.Add("distinguishedName");
SearchResult searchResult = null;
using (SearchResultCollection src = userSearcher.FindAll())
{
if (src.Count > 0)
{
searchResult = src[0];
string DN = searchResult.Properties["distinguishedName"][0].ToString();
try
{
DirectoryEntry entry = new DirectoryEntry("LDAP://domain.com/" +
"CN=My_Users,OU=Security Groups,DC=domain,DC=com",
userName, password);
 
if (IsAdding == true && !entry.Properties["member"].Contains(DN))
entry.Properties["member"].Add(DN);
else if (IsAdding == false && entry.Properties["member"].Contains(DN))
entry.Properties["member"].Remove(DN);
else if (IsAdding == true && entry.Properties["member"].Contains(DN))
OnError(new DomainServiceErrorInfo(new CustomError("Attempted to add user that is already in group. : " + NTId)));
else if (IsAdding == false && !entry.Properties["member"].Contains(DN))
OnError(new DomainServiceErrorInfo(new CustomError("Could not remove because user was not in group. : " + NTId)));
 
entry.CommitChanges();
entry.Close();
}
catch (Exception uhoh)
{
}
}
}
}

I just implemented this IIS Compression article on some business applications we’re delivering over a low bandwidth connection and it reduced. Interesting enough if you simply enable IIS compression as explained by Microsoft and a couple hundred other sites then you do HTTP analysis on how your Siverlight Business App is performing you’re going to see zero improvements. As explained in the article I listed above the Siverlight Business App template with RIA Services will be sending data over the wire in binary by default so it’s already improved. However this type isn’t compressed by default when you enable IIS compression so you’ll need to add the appropriate MIME type to the application host configuration file. Namely you’ll have to add this dynamic type:

add mimeType=application/msbin1 enabled=true

I can’t express enough how much this improves the performance of the requests to the application. Our app made many requests that returned 50-100Kb of data. Shrinking that by 80-90% per request was huge for how the application responded in the field. Compression is a must if you’re going to use RIA Services in a similar situation.

, , , , , ,

I just read over an excellent series on using Elmah. If you’re unfamiliar with Elmah it’s a great tool for logging and debugging exceptions in an MVC # app. Unfortunately we got to the Elmah stage on our application at about the point the application was being piloted. However it’s been a big help in smoothing out some of the errors in teh app. This series was specifically useful to us in regards to getting Elmah to send exception emails. The exceptions weren’t making it past the MVC Error Handling to be handled by Elmah.

Joel’s Elmah Post Series