Archive for the '.NET' Category
March Community Calendar
Well, after a nice hiatus, the new Community season is underway! I’ve really been missing it, but starting this week we’ll be back in the swing of things. March is chock full of Community Goodness:
MSDN Roadshow
Microsoft Developer Evangelists Andrew Duthie, aka the Devhammer, and Dave Isbitski are hosting a series of MSDN Roadshows on Windows Azure. I will be attending this Wednesday, March 3rd, at the Richmond installment. Roadshows are a great way to learn about new technologies and network fellow developers and Microsoft professionals. Space is limited, so be sure to Register!
RVNUG
Roanoke Valley .NET User Group (RVNUG), will be meeting this Thursday, March 4th, from 6-8pm. Chris Hylton will be presenting on The Enterprise Library.
Roanoke Code Camp
March 13th will be the 4th Annual Roanoke Valley Code Camp, hosted by RVNUG and great group of contributors. I will be presenting a couple of sessions, Silverlight 4: Ready for Business and How I Develop WPF Applications. I’m really looking forward to it: I hate to play favorites, but if I could only go to one Code Camp, this would probably be the one. Fortunately, I don’t have to make such a horrible decision! Space is limited, so make sure you register today to reserve your seat!
CHODOTNET
March 18th I will be presenting Silverlight 4: Ready for Business at the Charlottesville .NET User Group. CHODOTNET is a growing, vibrant User Group, and if you are anywhere near there you should definitely check it out! Be sure to visit the website as the meeting location has recently changed.
Southern Maryland Give Camp
March 19-21 will be the Southern Maryland Give Camp, the first East Coast Give Camp ever! Give Camp is a charity coding event that promises to be challenging, rewarding, and lots of fun all at once! A bunch of developers, DBAs, and designers will all converge on St. Mary’s College of Maryland for a weekend of non-stop programming. The beneficiaries of this effort are a group of non-profit agencies who otherwise could not afford to hire professionals to develop these websites and applications.
And as if that doesn’t sound awesome enough in its own right, if we get 100+ developers to volunteer their time, Andrew Duthie will shave his head into a Mohawk! Come on gang, I’d just love to see that!
Don’t miss out!
With so many great opportunities, I sure hope to see you out in the Community! As always, be sure you say ‘Hi’!
1 commentMy Community Year in Review
Well, December is here and another Community Year is almost over. Fortunately for me, there are a high number of quality events and user groups within reasonable driving distance, so for 2009 I thought I could swing a presentation a month. It turns out I was mistaken: while I did not present in every month, I actually ended up speaking at 15 events!
- Feb: RVNUG – Using Blend and Visual Studio Together
- Mar: Roanoke Code Camp – Templating and Data Binding in Blend
- April: RVNUG – Styling a WPF/EF Application (with Tolga Balci)
- April: Richmond Code Camp 2009.1 – Using Blend and Visual Studio Together
- May: HRNUG – Using Blend and Visual Studio Together
- May: Nova Code Camp – Using Blend and Visual Studio Together
- June: Blue Ridge Community College – Application Design Careers for Graphic Artists
- August: CHODOTNET – Using Blend and Visual Studio Together
- September: Raleigh Code Camp – Using Blend and Visual Studio Together
- September: Richmond NUG – Using Blend and Visual Studio Together (unscheduled)
- October: Richmond Code Camp 2009.2 – Using Blend and Visual Studio Together & Data Binding in Blend (2 presentations)
- October: Philly Code Camp – Data Binding in Blend
- October: CapArea Silverlight SIG – Silverlight 3 & Blend 3 Launch
- November: CMAP Code Camp – Using Blend and Visual Studio Together & Data Binding in Blend (2 presentations)
- November: RVNUG – Silverlight 3 & Blend 3 Launch
I also had the chance to attend several other events, most for the first time:
- Spring: Roanoke MSDN Road Show
- July: CodeStock
- August: DevLink
- October: Richmond Java User Group (to see Andy Hunt speak)
- November: PDC09
- December: Roanoke MSDN Road Show
And of course, about 20 regular RVNUG and CHODOTNET User Group meetings. I’ve been taking it easy in December, but I’m already looking forward to hitting the road again next year. Here are events I already have on my calendar:
- Jan 12th: HRNUG – Presenting on Silverlight 4
- Jan 30th: Richmond SQL Saturday
- March 13th: Roanoke Code Camp
- March 18th: CHODOTNET (topic TBA)
- April 6th: CMAP NUG (topic TBA)
- May 22nd: Richmond Code Camp 2010.1
- May 19th: Innsbrook NUG (topic TBA)
- June 3rd: Richmond NUG (topic TBA)
- June 24-26: CodeStock
- October 2nd: Richmond Code Camp 2010.2
I’ll be adding more as the year goes. There are a bunch of great Code Camps I don’t have on here yet: Raliegh, NoVa, CMAP, Philly, and more. If you have a User Group and would like to schedule a presentation for the second half of the year, just email me (link is in the right hand sidebar) or hit me up on Twitter (@joelcochran).
No really, Thanks!
I want to say thanks to all of you out there, it’s been a great year for the for the community, and the people make it all worthwhile. Have a great holiday season, and I’ll see you next year!
No commentsYou know what they say about assuming
I had an experience I thought was worth sharing. As much as we all try to write reusable code, we still end up riding the Copy-Paste express more often than we care to admit. (Come on, admit it… you know you do it…) Of course, it helps if you do this with code that actually works…
The Copy-Paste Express
Several months ago, I write an application that required a custom Validation Rule for IP Address format validation. It worked great, and that project was the inspiration for my post on Custom Validation Rules. Now, 2 months later, I want the same functionality in a new application. While the ValidationRule class itself is reusable, the XAML code to implement it is not, so to add it to the new application, I copied the XAML over for the IPAddressTextBox. Much to my dismay, when I executed the program the validation did not work.
Knowing that Application 1 worked as desired, I pored over the code and logic, line by line, and they were the same. Since the XAML was a straight copy, they even used the same field and template names. I was pulling my hair out, so I finally went back and read my post, comparing it to the code I had in place. I was able then to find that some of the validation code was missing from the XAML. Now I was really confused: the code on both applications was missing the same critical piece, so how could Application 1 possibly work?
If you don’t see it coming yet, it turns out that Application 1 no longer worked either. I was testing the installed application and not the current copy of the code: when I ran it from Visual Studio, I experienced the same issue. It took me a while to figure out what happened, but in this case my reliance on Blend was the culprit. At some point I used Blend to update the Binding (I don’t remember why). Normally this wouldn’t be a problem, but Custom Validation rules have to be inserted into the XAML manually. By using Blend to update the binding, Blend removed all my custom validation logic.
Lesson Learned
The lesson here, of course, is not to make assumptions, but more importantly you need to test all changes to an application. In this case, testing the IPAddressTextBox and the Custom Validation had been completed a long time ago, and since the functionality was never intended to be changed, it was never tested after it was complete. And the working copies in the field were correct, so the bug would never have been reported, at least not until another release. Even then, this particular piece of the software is typically only used once when the user configures the application, so even subsequent releases of current installs would never have revealed the issue. Instead, it would have only shown up on a new install or a reconfiguration. Even worse, since this is purely for validation to prevent the user from entering erroneous data, a new user would never realize the functionality was missing: instead, they would just be able to enter any value for an IP Address. So who knows how long this bad code would have been out there, me all the while assuming it worked.
I’m still floundering in the Unit testing area, and I honestly don’t know if Unit testing would have caught this error or not since it was a GUI issue. It does indicate to me that I need to get a better grasp on all things testing: what if this had been a similar but far more serious bug? It also tells me I need to find more ways to get off the Copy-Paste Express. While we’ll never get away from it completely, if I had taken the time to develop a custom control for IPAddressTextBox that implemented the validation, I never would have had this issue. In any case, it really is the little issues that can teach you the most.
1 commentAnother Silverlight Centering Trick
Not too long ago, I posted about how to center a Silverlight Application within an HTML page. Last weekend, I was working on a Silverlight application and I wanted to stretch the background brush across the entire browser, but retain the content in a fixed space in the middle of the screen. I could have done this by creating a gradient and then applying it as the background in my HTML/CSS, but I wanted the ease of design and flexibility that I have within Silverlight. Here is what I did to accomplish the trick.
Sizing the UserControl
To begin with, we have to set the width and height properties of the UserControl so that the UserControl will stretch to fill all available space within the browser. We’ll start by setting Width and Height of our UserControl to Auto and the LayoutRoot container to a fixed size with a Background color so we can see it along with our Background work. This way we can tell what effect we are actually having.
[Note: click on the images for full size]
So far, it seems like we are centering, so all we should need to do is add a Background to the UserControl, right? Unfortunately, that will not do what we want. Adding a Background to the UserControl gives us the exact same results. Since the screen shot is the same, I won’t repeat it, but if you are following along at home try it and you should get the same result.
Also, not to be picky, but this is not actually centering: this is setting the HorizontalAlignment and VerticalAlignment properties to their default values of Stretch. The Grid is actually stretching to fill up the available space, but it is still limited to its fixed size, so it gives the appearance of centering. Not to worry, it’s a minor technicality.
Setting the Background
Our goal is for the Background, in this case a GradientBrush, to stretch across the entire surface of the browser window. Above we saw that fixing the LayoutRoot to the size of our desired content won’t allow this to happen. Instead, we’ll need to set the LayoutRoot Width and Height properties to Auto, and set the Background of the LayoutRoot element to the desired Gradient.
Running the application at this point will show our Background filling the entire browser space.
And here is the XAML:
Centering the Content
Now that we have our Background properly visible across the entire surface of the browser, we need to center the Content inside our LayoutRoot Grid. This is easily done by adding another Container to the LayoutRoot to act as a wrapper for our fixed size content. This example shows a Grid, but I initially did it with a Canvas. I’ve added a Black Background color so you can see the content Grid.
Now set the HorizontalAlignment to Center. I think the default VerticalAlignment value of Top looks best, but of course you could center it or add some Margin around the content Grid to suit your preference.
Now just add your content to the internal Grid, and you will have an automatically sized Silverlight page with centered, fixed size content.
Adding a Clipping Region
One last thing you should be aware of: if you are doing any animations with content off screen, using this method will make them visible outside the bounds of your content. While this has some interesting potential, it is probably not the behavior you want.
To correct this, you need to add a Clipping Region to your content Grid. This will ensure that child elements of that Grid are only visible inside its visual boundaries. Since you can’t do this visually, you’ll need to edit the XAML directly. The key here is to set the Clipping geometry, in this case a Rectangle, to be the same width and height as the content Grid.
Conclusion
It’s important to note that since we are letting Silverlight do all the work, you do NOT want to use the HTML and CSS from the previous Centering post. Doing so will result in only the width defined in the CSS being displayed. Instead, just use the default HTML and CSS settings.
I like this approach better since it gives my application an integrated background. It gives me more creative options and more control. Let me know how it works for you!
2 commentsWrox Silverlight 3 Programmer’s Reference Book Review
In July, I was offered the opportunity to review Wrox Publishing’s newly released “Professional Silverlight 3”, a massive full-color book covering nearly ever aspect of Silverlight 3. I’ve long been a Wrox fan and as a WPF developer with a web background I have a keen interest in all things Silverlight, so naturally I jumped at the chance to review this new book. Unfortunately, life did what it always does and prevented me from completing the review until now.
NOTE: I finalized this article while attending PDC09, where Scott Guthrie announced Silverlight 4. This release interval for Silverlight has been unprecedented: only three months after the official Silverlight 3 launch! I am confident though that you will still find this book timely and valuable.
As expected, Wrox does not disappoint. Authors J. Ambrose Little, Jason Beres, Grant Hinkson, Devin Rader, and Joseph Croney, all from Infragistics, have provided a wonderful edition that should capture the attention of both fledgling and experienced Silverlight developers. In fact, the introduction and first four chapters should be mandatory reading: they provide the perfect overview to this game changing technology all .Net professionals should understand whether or not their particular interests run towards Silverlight.
If you have never read a full color technical book, you’ll quickly find this is wonderful addition. The numerous graphics and screen shots jump off the page, making the material easily consumable. In addition, all code and XAML samples are in full color as well, mimicking the default IntelliSense color scheme. This is perhaps the best part of having a .NET volume printed in full color because it allows us to read code on the page in the same manner in which we are used to reading it on screen. I’ve always found it a bit unpalatable to read code on the printed page, but this feature makes the code imminently more readable.
The book itself is very well written and easy to follow. The style of the authors reveals their mastery of the material without being overbearing. This is an extremely accessible book to those new to Silverlight but contains plenty of material for the more experienced developer. While the text is clear and concise, in no way is this a light read. Silverlight is a very large topic and any book that attempts to do it justice needs to be sized to the task. That being said, I would not attempt this book, or many like it, cover to cover. While none of the chapters is superfluous, if you are new to Silverlight or WPF, beyond the requisite 4 chapters mentioned above, I would begin with chapters 7, 8, 12 and 14. I would tackle the rest of the chapters on an as needed basis.
Another item I really appreciated in this book was the frequent inclusion of Microsoft Expression Blend. Blend is an invaluable tool for developing WPF and Silverlight applications and yet I find it frequently passed over in technical publications. Going forward, the more complex XAML based applications become, the more imperative it is going to be for developers to learn Blend, so it is nice to see a Silverlight book give Blend the attention it deserves.
On a scale of 1-5, I give this book 4.5 stars. This book is exactly what it needs to be, a great reference aimed at professional developers. I know that as I get more serious about my Silverlight development efforts, I will be reaching for this book frequently.
2 commentsIBM iSeries .NET Managed Provider ObjectDisposedException problem SOLVED
I can’t believe how remiss I’ve been: this has been a big problem for me since early 2007, and we finally got it solved a couple of months ago, and I can’t believe I never blogged about it!
Two things to fix this:
1) Install iSeries Client Access V5R4. Be sure to install the .NET Managed Provider if it is not already installed. A full install will NOT do this, you must check the box to include it.
2) Install SI35287 on any PC that is connecting to the 400. This is essentially V5R4 SP1 and will finally solve this little issue.
I do not know what the status of this bug on V6R1 is, but I will say that once I installed the SP this problem finally stopped.
1 commentFall Community Calendar
I was just going over my calendar and there are some great events coming up. Here are the events I am attending or speaking at (that I know of at this time):
- Aug 12-16th DevLink – I’ll be going to DevLink for the first time this year. The slate of presentations looks great and is full of a bunch of our finest community members. Should be a great time!
- Aug 20th CHODOTNET – I will be presenting on using Visual Studio and Blend together to develop WPF applications. This is an entry level presentation intended to get developers over that initial hump of learning Blend and setting up WPF applications. Meeting starts at 6:00.
- Sep 10th MSDN Roadshow in Roanoke – I’ll be there with bells on to see presentations from Microsoft about Silverlight 3, Expression 3, Prism, MVVM, and RIA Services. If you can’t make this one, there are many others close by on the list.
- Sep 10th RVNUG – What a deal! Two for one! After the Roadshow, G. Andrew Duthie, Microsoft Developer Evangelist extraordinaire will be presenting on lessons learned in developing real Silverlight applications.
- Sep 17th CHODOTNET – Monthly meeting of the Charlottesville .NET User Group. I haven’t heard yet what the presentation is, but I plan to be there regardless.
- Sep 19th Raleigh Code Camp – I’ve submitted several presentations, so I hope to be speaking.
- Oct 3rd Richmond Code Camp 2009.2 – I’m hoping to have something special for this event: I’ll keep you posted.
The only other item I have on my calendar is Philly Code Camp Oct 17 (no details out yet), but I don’t think I’ll be able to attend. Just too many great events to choose from!
Of course you can always find more events all over the country at Community Megaphone, so do yourself a favor and get yourself to an event! I hope to see you around the community this fall.
1 commentRants and Raves #5
Back in form this week with both Rants and Raves…
Rants
CodeRush
I wrote last week about how much I love ReSharper and what a benefit it has been. I also said that I was installing DevExpress’s CodeRush and would report back. Unfortunately, my report is not good.
My biggest beef is that I just plain didn’t like it. I especially disliked how it had a tendency to prevent IntelliSense from doing what I wanted. In particular, it removed my ability to hit Tab to insert the highlighted element. And when I tried to hit Enter, it inserted non-selected text. I just couldn’t intuitively get the hang of it.
In fact, I had installed the entire DevExpress DXperience suite of products. If you think loading the ToolBox in Visual Studio is bad natively, try doing it with a ton of third party controls along for the ride. And it seemed my overall VS experience was significantly slowed down. That plus my dislike of CodeRush meant it was actually more of a hindrance than a help, so I uninstalled it.
Enter my next issue. When I went to uninstall it, the DevExpress software was listed in my programs as three separate products. This was fine, because I really only wanted to uninstall CodeRush at the time because I hadn’t had a chance to try out any of the WPF Controls. When I uninstalled the CodeRush part, it uninstalled the entire DXperience family of apps. Uninstall Fail. I have not reinstalled any of the software, and I don’t know if I will.
I only tried it for a few days. I’m sure an experienced user may know how to work around my issues, most likely via configuration. Perhaps I’ve been spoiled by ReSharper, but for productivity tools, I don’t think I should have to make a lot of effort to be productive. Maybe I’m being unfair, but this is a Rant so I’m entitled.
Windows Live Writer
If you blog and are still using your blog software editor to add and edit posts, please hold your hand in your front of your face, palm facing you, and slap yourself in the forehead. That’s what I did once I finally used Windows Live Writer: it is definitely a “coulda had a V8” moment (or a Homeresque “D’Oh!”).
Live Writer is an excellent desktop application that allows you to write posts and pages and submit them to your blog. The great thing about it is that it downloads your theme and executes it in the editor so you can actually see what your post will look like once published. There is also a full preview tab so you can view the entire page, and of course you can modify the HTML directly.
Live Writer stores drafts and posts locally, so you can also work on them whether or not you are connected to the Internet. It also supports plug-ins such as Twitter Notify, which will automatically send a tweet when you publish something new.
Naturally, the editor is complete with all the WYSIWYG goodies, text editing tools, hyperlink and image inserters, spell checker and more. And you can connect to multiple blogs. This one is going in my list of “can’t do without” software.
2 commentsRants and Raves #4
It is very difficult for me to come to terms with this, but I have nothing to Rant about. I don’t know, maybe I’m sick or something, but nothing has really gotten under my skin this week. Don’t worry, I’m sure I’ll be feeling better next time. For now, I hope you enjoy this Rant-free entry.
Raves
More Pomodoro: GMail Tasks and an online Timer
I raved last week about Pomodoro, and I’m still raving. This is quickly becoming a mainstay of my development, and so far with great results. This week’s rave is about some of the tools I’m using to help me along.
I’m not sure when it happened, but sometime recently a new item showed up in my GMail: “Tasks”. Now, obviously the idea of a task list is hardly revolutionary, but given my recent adventures with Pomodoro it was a very well timed discovery.
A Pomodoro purist would insist on Pencil and Paper to manage one’s daily tasks, but my desk has a tendency to get piled up with papers, among other things, and I’ve learned to essentially ignore the mess until I have no choice. All arguments for a clean desk aside, this means that any system relying on me to regularly update anything on paper is destined for failure.
While I plan to tackle this shortcoming eventually, for now the GMail Task pane is my answer. I can undock it and run it standalone, so I have it separated from my browser: this allows me to see it constantly. For simple things like a daily task list, the service couldn’t be any easier, just add a task and check it off when complete.
The service supports more features, such as setting due dates and annotations. For now, I plan to add a lot of specific tasks to my list: this seems best in keeping with the Pomodoro spirit.
My official Tomato Timer is on order ($5.99 + free shipping!), but thanks to reader Stephen Wrighton I have been using e.ggtimer.com/25minutes with some success. It is a simple site that counts down from the number of minutes in the URL (you can change it as needed). There is an audible beep when the timer is complete, and a popup message. I have missed it a couple of times while busy with other tasks, but for the most part it has served me well. Best of all it is free and easy to use: I just hit ‘Refresh’ at the beginning of each new Pomodoro.
I mentioned Pomodoro in our weekly Scrum (a topic for another time) and everyone thought it was cute – until I showed them what I was able to accomplish last week because of it. My productivity is currently off the charts, so far a good justification for continuing the experiment.
ReSharper
I’ve certainly heard of productivity tools like ReSharper, but I’ve never really understood what the big deal was, until a couple of things happened recently to make me want to give it a go. First, at the Charlottesville .NET User Group, Justin Etheredge gave a presentation and I got to see it in action for the first time. I was very impressed by what I saw. Then at CodeStock, Mike Wood had a great Open Spaces session, and one of the things said was that if you weren’t using a tool like this then you were shooting yourself in the foot.
Well, I certainly don’t want my foot shot, so I installed ReSharper and immediately began reaping the benefits. I expected some kind of learning curve, but honestly it is all so intuitive that it just sort of happens. My favorite feature so far is where you can begin to define a class and it will move the new class to a new file for you. It’s small things like that, a whole slew of them, that make all the difference. Above all else, this software helps keep my hands on the keyboard.
Coincidentally, I won a copy of DevExpress DXperience Enterprise, which includes a productivity tool called CodeRush. I just installed it and will be experimenting with it in the near future, so more to come on that.
1 commentRants and Raves #3
Rants
Microsoft Certification Exam
I ranted in the last Rants and Raves about the Microsoft Certification exam, specifically about the format. Well, this week I feel no better: I decided that since I was so close last time that I would push ahead and quickly retake the exam, so I scheduled the exam for 9 days after the initial fail. After lots of studying, cramming, and practice tests, I was able to pass. All the prep work is what really delivered in the end, and it was a good thing I had invested the time: this test was far more difficult than my first attempt. It was an agonizing process.
My Rant is the same as last week: I just can’t believe the amount of memorization expected. The exam does little to truly test your knowledge of .Net concepts: instead, it focuses on specific method signatures and return values. But, I don’t want to just Rant and run, so I have a suggestion.
As this is an exam for coders, how about letting us code? Split the exam into two parts: part 1 would be questions regarding general .Net concepts. Part 2 would be a practical hands-on. Develop the exam software to utilize or emulate Visual Studio. Then have tasks to complete, where we write code to solve a particular problem. The kicker is they could write Unit Tests to evaluate our “answers”. Who cares about the specific implementation details? If the Unit Test succeeds, you get credit for your solution.
I’m sure there are plenty of holes in this idea, and by all means I encourage you to point them out, but I’ve really been annoyed by this and would welcome almost any change. I hope it’s not as bad when I go to take my next exam, 70-502 “Microsoft .NET Framework 3.5: Windows Presentation Foundation Applciation Development”.
Raves
Pomodoro
Pomodoro, short for The Pomodoro Technique, is a time-management method that has been picking up steam lately with the developer crowd. I first heard of this a couple weeks ago at CodeStock 2009. I initially dismissed it as gimicky, but out of curiosity I read up on it some more. I was intrigued, so over the last week I’ve been testing the waters, and I must tell you: I’m officially hooked.
It’s an easy read, and the technique is very simple. In a nutshell, you break all your work time into 25 minute increments, each followed by a 5 minute break. This is called a “Pomodoro” (Italian for Tomato.) After 4 consecutive Pomodoros you take an extended break. At the beginning of the day you write down your priorities and tasks, and at the beginning of each Pomodoro you write down what you are going to work on. Then, at the end of the Pomodoro you update your status on that task.
The most important rule is you never violate the Pomodoro. Focus and work intensely on your task for those 25 minutes: not a minute more nor a minute less. To keep you on track, you use a kitchen timer or other device. When the bell goes off, no matter where you are in your task, you stop.
There is more, in fact there is a 40+ page PDF book on implementing the technique that answers all those questions I can hear you asking, like “what about interruptions”, “what about emergencies”, “what if I finish my task in ten minutes”, and so on. Essentially, the whole thing comes down to prioritizing your work and focusing.
The results for me have been excellent. I used the technique to carve out blocks of study time for my exam, time for practice tests, and managed to write a new application in only a few days. By focusing on one thing, intently, I’ve been surprised at how much I can get done in a short while.
I haven’t tried using an actual timer yet, but I soon will. I find it too distracting to constantly check the time, and I frequently work too long when I don’t pay enough attention. I’ll be working on perfecting my technique in the weeks to come. Of course, managing distractions is another key, so things like Twitter are suffering, but I’ve been so productive that I can deal with that.
Silverlight 3 and Expression 3
This probably isn’t news, but today marks the official launch of Silverlight 3 and Expression Studio 3. I’ve been using the Mix09 Preview of Blend 3 for a while now and I’m very happy with it. I haven’t gotten my hands on SketchFlow yet, but I’ve seen it and I’m anxious to give it a whirl. I’m downloading the RC with SketchFlow as I write this, so you can expect I’ll be writing about it soon.
Silverlight 3 is a superb upgrade to Silverlight 2 with tons of new features. For the best news available, be sure to read Scott Guthrie’s announcement.
4 comments