More On The ASP.NET MVC Framework
Posted On Monday, October 15, 2007 at at Monday, October 15, 2007 by Ben HHere is Scott Hanselman’s take on it.
ASP.NET MVC Framework
Posted On at at Monday, October 15, 2007 by Ben HHaving a small passion for Design Patterns I’ve been playing with the model-view-controller (MVC) pattern for awhile now. Microsoft is working on a MVC framework for ASP.Net. See Scott Guthrie’s post on it here. This looks like a really cool thing and I can’t wait to play with it.
Sometimes I see MVC being very useful for creating an application framework. However, other times I see it being very cumbersome for making simple changes. So, the one caveat I have to the ASP.Net MVC framework is to do some design first and see if it is necessary for your application. For large enterprise applications this will be great. For smaller web applications this may be overkill.
DefaultButton Attribute in ASP.Net
Posted On Wednesday, October 03, 2007 at at Wednesday, October 03, 2007 by Ben HI just found a cool attribute that you can use on many of the ASP.Net 2.0 and above controls. Its the DefaultButton attribute. You can use this on the Form tag to make one default button for the entire page or you can use it in the ASP Panel to make one default button for just that area of the page.
It’s quit simple to use. I had two different areas where users can enter values in a text box. I found myself typing in values and hitting Enter to submit. Well, the Enter key would cause a refresh of the page, but my handlers were not firing. I added a panel around these two areas, set the DefaultButton attribute and bam, it works great now!
Open Source vs. Proprietary
Posted On at at Wednesday, October 03, 2007 by Ben HHere is a link to an article I found on the benefits and draw backs of these two software development philosophies. There were only 228 companies surveyed, but the results are interesting.
My take on this topic is that open source is anything but free once you take into consideration the cost of initial installation and maintenance. However, with all the toolkits, extensions, SDKs, etc. that have to be installed these days to develop with proprietary systems, the gap is closing.
After developing so long on the proprietary side of things I find it hard to make the switch to open source. So, many of the things I take for granted in the proprietary world just aren’t there in open source.
Tools For Web Developers
Posted On Thursday, September 13, 2007 at at Thursday, September 13, 2007 by Ben HI haven’t needed to use Fiddler for awhile and I noticed there is a 2.x version available here. For those of you that have never used Fiddler it is very useful to debug Web Apps. It allows you to view what is being passed between the server and the client. Even the Ajax callbacks. If you have not used it try and let me know what you think.
There are some additional links on the Fiddler install page that are useful for web development as well. I use the IE Developer Toolbar often to debug CSS\style issues. I have not used any of the IE Powertoys for WebDevs. I’m installing it now. I’ll let you know what I think. Again let me know what you think of these tools.
Follow-up on My Locking Issues
Posted On Wednesday, August 22, 2007 at at Wednesday, August 22, 2007 by Ben HI finally was able to fix the issue in my previous post. The problem was not the locking hint on the queries, but the fact that the column I was using in my where clause was not indexed. So, even though only the row was being locked the next update needed to do a complete table scan to find the next row to update. This table scan was blocked until the previous update finished. Since these updates were all happening in the same transaction, deadlock occurred. Once I indexed that column the issue went away.
Being on the Bleeding Edge...
Posted On Tuesday, August 21, 2007 at at Tuesday, August 21, 2007 by Ben HJust a quick post about being on the bleeding edge. I’ve recently been working with Windows Workflow using the Service Broker to queue up my workflow requests asynchronously. This is a great concept, but I’ve been amazed at the lack of quality information on these two pieces of technology. Sure there is plenty of information about the theories of these technologies and how to get started. However, there is a huge void of information about how to debug and fix things when they break.
This is one of the problems with working with new technologies right out of the gates. Sure there will always be a learning curve when using technology that you are not familiar with. However, the magnitude of that curve is far greater when the technology itself is in it’s infancy. It takes much longer to get past an issue when you have to dig and use trial an error as opposed to searching the web and finding documentation, articles and\or blog posts on it.
This is the bane of my existence these days and I think there are many developers out there that would agree. As soon as I get over the learning curve for a piece of technology the new version of, or a replacement for, that technology is released and I have to go through it all over again. So, in essence I’m in a learning curve that never hits the down ward side of the curve!!!
In order to fulfill the demands of our clients we need to use the latest and greatest technologies (I’m getting pretty comfortable with all the Ajax stuff, now everyone wants to use Silverlight). Don’t get me wrong, I really like learning and using new technologies. Plus I take pride in being one of the first implementors of these new technologies. However, it would be nice to sit back and write ‘Hello World’ apps every once and awhile…
SQL Locking
Posted On Monday, August 20, 2007 at at Monday, August 20, 2007 by Ben HRecently my database has been experiencing some deadlock issues. The issues are due to some automation we’ve created to update inventory levels. This automation is close to real time. Meaning the inventory table is constantly getting updates and inserts. This caused all kinds of locks and blocking. To start with check out this MSDN article on Locking Hints.
In my case, I started by using row locks when doing my updates. Here is a sample of my changed SQL:
Update
Inventory WITH (ROWLOCK) set CountOnHand = @CountCurrentOnHand, Price = @Price, InventoryDesc = @InventoryDesc where InvID = @InvIDThat reduced the deadlocks, but did not solve them. So, I also added the NOLOCK to the queries that access the inventory table on a regular basis. Here is a sample of the SQL:
Select * from
Inventory with (NoLock)This can be risky because doing so is a ‘Dirty Read’. This means I could read data that has not been committed and might possibly be rolled back. In my case the inventory levels are important, but they are also verified and corrected on checkout. So, for the time being we are running in this manner and keeping an eye on things. Any comments are welcomed.
A couple cool free apps I've been using
Posted On Thursday, July 26, 2007 at at Thursday, July 26, 2007 by Ben HI have not had a chance to blog about a couple apps I found online.
The first one is called Quest Comparison Suite for SQL Server. This is an alternative to using Red Gate SQL Compare. I have used Reb Gate in the past and it is great, but it is pretty pricey. This tool is pretty impressive for a free tool. It was written using the .Net 1.1 framework but still works well. The only issue I’ve had with it is the way it creates the SQL scripts. Sometimes it inserts transaction and rollbacks that cause some issues. I turned those off and use this to create a SQL script that I then go in and modify a bit to get the job done. Overall it is a great tool and it’s free!
The second is one I just downloaded and installed this week. It’s called Synergy. This is a great tool that let’s you share a mouse and keyboard between machines. I know this doesn’t sound like anything to blog about, but let me explain how it works. Most people know about KVM switches. Well with this tool you can do the same thing that a KVM switch can do without the switch. It uses the network instead. So, as long as the two machines are on the same network you can setup Synergy to switch machines when your mouse hovers over any edge of your screen. You configure which side of the screen goes where.
I use Synergy because I have a laptop that I use to develop from home and a desktop that I use at work. So, when I’m at work I can set this up so I can use the same keyboard and mouse and switch between my desktop and laptop. It works like I have dual monitors setup but it actually switches from my desktop screen to my laptop screen and back. It’s hard to explain, but it is cool. The only downside is the UI for this tool. Setting it up is a pain through the UI, but once it is setup it is great. If you want to try it be sure to read the documentation. We all read the documentation before we use stuff right
Comments On Last Nights Design Patterns Talk
Posted On Tuesday, July 24, 2007 at at Tuesday, July 24, 2007 by Ben HLast night I presented on simple design pattern at the Denver .Net User’s Group. Here are a final comment:
During the presentation I received a very valid questions. ‘Why use a pattern when I can just code the new functionality right into my concrete object?’ The answer I gave last night was you CAN code the functionality right into the base object. That would work just as well as using a pattern to do it. I stick by that answer. If there was a cookie cutter solution for every software issue out there, we would all be out of a job. From all the announcements on job posting before the meeting we can all see this is not the case. What I’m trying to say here is that design patterns are not meant to be the end all be all of OO design. So, don’t try to ‘fit’ your solution or design into one of these patterns. Instead, focus on the underlying philosophies of these patterns to solve the problem. The most common philosophy in patterns is coding to an interface. Use interfaces and base classes as much as possible to provide flexibility and ease of maintenance. So, when your out there researching and learning design patterns, try to think outside the box and by all means modify the pattern to solve your issue.
I got some great feed back from Brad Wood (Thanks Brad!). He sent me a great link to Jeff Atwood’s blog post on the Gang of Four book and how it is misused in some cases. It relates to what I said above. I will let you read it and try not to skew your opinions of it.
The title on my blog is Keep it Simple Stupid. I try to use that every day when I design and code. Some design patterns are overkill for many issues. So, the challenge we all have is to learn these patterns back to front so we know when a pattern is the right solution and when it is overkill.
Also, I forgot to mention this when I posted the samples and demos but if any of you have your own blogs feel free to post and link to my blog if you deem it worth. That is all I’m going to say on it.
Slides and Samples From My Presentation At The Denver .Net User Group 07/23/2007
Posted On at at Tuesday, July 24, 2007 by Ben HThis zip file contains everything from my presentation last night. If you were not able to make it please check out the Power Point because I made it a point to be pretty descriptive on my slides to allow people to review the patterns and make sense out of the demos. If you have any questions feel free to email me at BenH@coloradotc.com or just comment on this blog.
A couple of things about the demos.
- If you have attended this talk in the past at another user group or code camp, you might want to get and look over this presentation again. I re-did all the demos and made extensive changes to the slides. So, take a look.
- You must run the script in the “DBScript” folder against you SQL server if you are going to use the SQL server provider. This script will create the DB, the tables, the stored procedures and finally fill in all the sample data.
- After you run the DB script to create your DB you will also have to change the connection string in the SQLDAL.cs file to connect to your SQL server.
- I used Access 2007 in the demo, but I have also provided an Access 2003 version for those of you who do not have Access 2007 yet (Shame on you if you don’t… :-))
- Again, if you want to use the Access provider you will have to change the connection string in the MSAccessDAL.cs file to point to the proper file.
- I had a problem with my Add Vacation decorator demo. I have not had a chance to fix that yet. Once I do get it fixed I post the file again to this site. Hopefully, I will do that in a couple days.
Other than that happy coding. Please add my blog to your aggregator. I have already received some good feedback from last night’s talk and I have a few comments of my own that I will be adding out here shortly.
Troubleshooting SQL Server 2005 Service Broker
Posted On Monday, June 11, 2007 at at Monday, June 11, 2007 by Ben HMy latest project has not only required me to use Workflow but also to create and use a Service Broker on SQL Server 2005. Service Brokers are similar to MSMQs (Microsoft Simple Message Queues) except they are managed by SQL Server 2005. For a great introduction to Service Brokers check out this intro on The Code Project.
Service Brokers are pretty simple to understand. There are also many articles out there on how to set one up. Most of this is pretty simple to setup as well. However, there is not much out there on how to troubleshoot if something goes wrong. In my case, I’m still not 100% sure what did go wrong..
However, I do know it is fixed now.
The frustrating thing is that when I actual started the conversation and sent the message I got no errors. All I knew was that the queue was still empty and my receiver never got the message.
I stumbled across a great article on troubleshooting here. This article helped me put together a series of queries that ultimately led me to determine the errors I was getting. Here is the query I created:
-- This query get's incremented if your msgs are having errors
select p.*
from sys.objects as o
join sys.partitions as p on p.object_id = o.object_id
where o.name = 'sysxmitqueue'
-- Error messages in the queue are located in the transmission_status field
SELECT *
FROM sys.transmission_queue
SELECT conversation_handle, is_initiator, s.name as 'local service',
far_service, sc.name 'contract', state_desc
FROM sys.conversation_endpoints ce
LEFT JOIN sys.services s
ON ce.service_id = s.service_id
LEFT JOIN sys.service_contracts sc
ON ce.service_contract_id = sc.service_contract_id;
These queries give you all the system related info about the brokers. Hopefully you can use this to troubleshoot your own Service Broker.
Been Learning Windows Workflow
Posted On Thursday, June 07, 2007 at at Thursday, June 07, 2007 by Ben HSorry for the lack of posts lately! I’ve been working on a project involving Windows Workflow and it’s been consuming all my time. I’ve also had a run of personal events that have been taking up any free time that I’ve had. The nice weather of the spring season has also been calling me to get outdoors. Anyways, I’m back and ready to blog all my experiences with Workflow. So, be ready for many new posts in the next few days.
Interesting Concept - BungeeConnect
Posted On Friday, May 04, 2007 at at Friday, May 04, 2007 by Ben HI thought I would pass this on. I have not had time to go through all the screenshots and videos, but basically this is web development environement where the IDE is actually an online website. So, you can develop web pages from within a web page! Kind of ironic. They also let you deploy your web site to thier infrastructure so you don’t have to worry about hosting and such. SAAS for the web developer. Who’d of thought.
New Release of the MS CRM SDK
Posted On at at Friday, May 04, 2007 by Ben HJust wanted to let everyone know that they released a new version of the CRM SDK on May 1st. Download it here. Also, learn more about customizing and developing with MS Dynamics CRM 3.0 here. Enjoy!
Microsoft Stoled .Net?
Posted On Monday, April 23, 2007 at at Monday, April 23, 2007 by Ben HI had to put this out here. In short a company is suing MS for patent infringement saying they have a patent on using XML to define web sites. I think this is a move to get some free press and nothing more.
It does bring up an interesting point about patents and software. How can you patent software? It is so easy to grab sample code from the net and tweak it to work in your application. So, does the code have to be an exact match for it to be patent infringement? Or is it sufficient to say that if software solves the same problem in the same way it is an infringement? I think there is some gray area there. Any Comments?
E-Learning With Innerworkings
Posted On at at Monday, April 23, 2007 by Ben HI found this offer from Innerworkings today and wanted to pass it along. It’s a free trial of their new Ajax learning for ASP.Net.
I had the opportunity to work with some of Innerworking’s object oriented related courses (innerworkings calls them drills) when I was doing some supplementary web casts on the same topics for FDC. I have to say their e-learning methods are top notch. Instead of everything being web based, they have you install their client interface. It is a great interface and the drills really walk you through the processes of solving real world problems.
If you are a manager\team lead and are trying to get your people up to speed with new techniques\technologies, Innerworkings is a great way to go. It is also great for the software professional who is just trying to upgrade his\her skills to the latest technology.
Obviously, I highly recommend them.
Grasshopper 2.0 CTP
Posted On Friday, April 20, 2007 at at Friday, April 20, 2007 by Ben HI must admit that I bleed Microsoft and the .Net Framework when it comes to software development. So, I’m not very familar with the J2EE or Linux platforms but I recently came accross a link to a plug in for Visual Studio that will let you deploy and convert your projects to these platforms. I thought it was interesting so if you want to know more click here.
Software Factory For WCF
Posted On Thursday, April 19, 2007 at at Thursday, April 19, 2007 by Ben HThis has been out for a few months, but I just ran across it. This is an update to the Web Services Software Factory that was released by the Patterns and Practices group last year. This one includes loads of stuff that will help you use WCF and also migrate your current asmx web services over to WCF. Check it out!
ASP.Net Tutorials
Posted On Tuesday, April 17, 2007 at at Tuesday, April 17, 2007 by Ben HI recently found some ASP.Net tutorials out on Scott Guthrie’s blog. These are great if you would like to walk through some of the ins and outs of using data in ASP.Net. Obviously, you also get some exposure to ASP.Net in general since you must be pretty familar with ASP.Net in order to start working with data. Click here for Scott’s post.