Posts tagged .Net
Get a VS2010 Ultimate Experience for Less
3As of writing this blog post, there are thousands of developers converging in Las Vegas for the official release of Visual Studio 2010. I’ve been using Visual Studio 2010 for the a while now and it has been a generally positive experience. While as was exploring the VS2010 site I saw this question posed. “What Edition is Right for Me?” That prompted me to look through the editions. Microsoft has planned to sell for commercial versions: Professional, Premium, Ultimate, and Test Professional. A much smaller selection that the VS2008 editions, but that is a good thing. What shocked me was the outrageous price jump from Professional to Ultimate, from $799 to $11,899; that is over $11,000 difference for one copy of Visual Studio. So this blog post is to show you how to get an Ultimate experience for less, so that you can utilize that extra money for pizza and beers for you development staff.
1.) Visual Studio Professional ($799)
you are going to need this right? So what is missing from Professional that is in Ultimate?
- Intellitrace (Historical Debugger)
- Static Code Analysis
- Code Metrics
- Profiling
a.) Intellitrace ( $0 no alternative )
sadly I couldn’t find something that replaced this feature. It is very cool. Look at it this way though, the fact that Microsoft moved it up to the premium edition makes me think that they feel the common developer probably doesn’t need it. I also rarely used this feature in my own development.
b.)Static Code Analysis & Code Metrics ($410)
so what is static code analysis? Wikipedia defines it as the analysis of computer software that is performed without actually executing programs built from that software. Hmm… this sounds familiar, I think I’ve done that before. Oh wait I have! NDepend is a great static analysis tool that has been around for a while now.
c.) Profiling ( $0 – $500 )
There are a ton of profilers for the .Net framework, and some of them are FREE! In this post I chose the two that a company might buy ANTS Memory Profiler and JetBrains ReSharper.
2.) Testing
So you are a testing kind of developer, that’s great but you want all the extras that ultimate offers.
- Code Coverage
- Test Impact Analysis
- Coded UI Test
- Web Performance Testing
- Load Testing
- etc…
a.) Code Coverage ($479)
NCover is a mature and great tool for code coverage.
b.) Web Performance Testing and Load Testing($0)
The web has been around long before VS2010, so this problem has been solved a million times. Realizing that there are a ton of tools out there to do this and I won’t list each of them. Just Google and prepare to be overwhelmed by the possibilities.
c.) Coded UI Test ($0)
Watin allows you to code tests for UI interaction of web applications, which is probably the hardest interaction to test for.
d.) Resharper ($349)
I have to mention this tool just because it is so good and it improves the unit testing experience inside of visual studio, regardless of your framework.
3.)Database Development
the dreaded database…. how do we handle this stuff?
- Database Deployment
- Database Change Management
- Database Unit Testing
- Data Generation
a.) Database Deployment ($0 – not needed)
In theory this sounds great, but the majority of companies have a company structure that forbids any developer from making database pushes; the job of pushes are usually left to a Database Administrator. They will probably want to execute SQL that they have crafted and labored over.
b.) Database Change Management ($0 – code option)
again this is probably left up to your DBA with a combination of your source control (SVN, Hg, Git, TFS). I recommend looking into a migration framework if you really want to control the versioning of a database.
c.)Database Unit Testing (Whaaaaat? $0)
this troubles me on two fronts. First off you probably shouldn’t be unit testing enough of your database to have a whole project dedicated to it. Secondly, this is what developers refer to as integration tests and you don’t need any other tools other than your favorite unit testing package to do this. Granted, VS2010 probably has some nice UI tools to make this more pleasurable, but in my opinion tests are about results and not how pretty the UI is.
d.) Data Generation ($0)
This is a problem that isn’t that complicated to solve, and again has been solved. Check out AutoPoco which allows you to generate a ton of data easily through a fluent interface. After generation, just go ahead and pump this data into your database with your favorite ORM or DAL.
4.)Architecture and Modeling ($100)
Buy a whiteboard for modeling and get your team involved. There is nothing worse than an Ivory tower architect that pushes his architectural will on the team without discussion.
5.)Source Control ($300)
Unfuddle is a great online source control provider and in my opinion gives you a lot of things your business will use from Team Foundation Server. When I quote the $300, I am talking about for your whole company and not per developer. This is a huge cost savings. There are also a ton of other online source control providers that are similar to Unfuddle.
Tools I have to mention: TortoiseSVN, MsysGit, TortoiseHg, AnkhSVN (all free)
Conclusion and Total Price: $2637 ($2832 less than Premium and $9262 less than Ultimate)
That savings per developer is nothing to joke about. You could save over $9000 dollars but just looking around more. So what is the downside? Well you will have a hodgepodge of tools to use and many of these options might lack UI tools and possibly Visual Studio integration. Do your homework and see if the benefits of buying these tools outweigh your desire to have a all in one tool like VS2010. If you have a team of five developers, I just saved you over $45k. Your welcome.
C4MVC Presentation on Database Migrations
0Hello everybody. It has been about a week since I gave my C4MVC presentation on database migrations. The video is below, and the code is also downloadable below.
Asp.Net MVC 2 Quick and Simple Site – v1
0*Note: Asp.Net MVC 2 project in Visual Studio 2010
I sat down last night and was thinking about how I could get a simple starter site up and running for a client, until I could design something more tailored to their needs. There is nothing worse than having a “under construction” page or a “coming soon” page. It doesn’t really say much about what is happening or what might be coming. So I sat down and came up with the basics of what a client might want right from the start, here were my requirements.
- Set a Logo, Name, and Subtitle
- Be able to quickly edit a small about section (Content)
- Quickly add some of the more important social networks (Twitter, YouTube, FeedBurner, Delicious, MySpace, and Facebook).
- Be able to add Google Analytics (Optional)
- A dynamic image gallery (drop images in a directory and everything is done for you).
- Basic contact information. Email, Phone, and Website.
- No external libraries to install (this hurts but is helpful).
So I sat down and started writing. I wanted someone to be able to push this site without editing a lot of files or having to setup a database. I opted to put a lot of the client’s settings in configuration. Yes configuration sections are not the new hotness but they can still serve a powerful purpose.
My first iteration had me using controller actions for each part of the site, but I slowly realized it was overkill. I opted to have one controller action from my index, and then break sections up into partial views that would be all rendered at the same time. Then those sections would be hidden and made visible using JQuery. After a little design, I ended up with this.
Let’s look at how to set this up.
Step 1 – Setup the Configuration
There are some pretty simple configuration sections in the web.config included with this project. You will see two App settings: WorkImagesDirectory and GoogleAnalyticsCode. The WorkImagesDirectory is used to find all the images in your gallery. Thumbnails for all your images will be automatically created if they are missing. The GoogleAnalyticsCode setting should be set to your Google Analytics code UA-XX-XXXX (or something like that). If you leave out the Google Analytics code then the script won’t be output to the page.
Next you will see a ContactInformation section. In this section you can set the name, site subtitle, email, phone, and website.
Finally, you will see a SocialNetworks section. Only the social network usernames you set will show up on the page. You can set Twitter, Facebook, YouTube, Delicious, MySpace, and FeedBurner(a blog maybe).
Step 2 – Setup Content
Once the configuration is done, then you probably want to change some of the content to reflect some good information.
All tabs are separated into partial views: About, Contact, Work, Social. Just replace the HTML content in here with what you want, leaving the nested RenderPartials.
Step 3 – Modify Colors and Images
All the images and style sheets you need to modify are under the Content directory. If you like the color and just want to modify the avatar at the top, just overwrite the avatar.png under Content/img.
Step 4 – Deploy It
Just publish what is there to your hosting provider and you are ready to go.
Conclusion
This is a good little site to get up and running for your clients, but it isn’t anything ground breaking. The code is straight forward, so even a novice can get in there and change things. The point here was not to over complicate the solution with third party libraries. It is to get a site up with in minutes, while still giving some great functionality to the people that need it.
Oldie But Goodie : Open Flash Chart – Fixing Open Source
2This is from my old blog “Monster’s Got My .Net.” I didn’t realize that there was link to this on the OpenFlashChart site, so I am reposting it here for anyone that would like to use the code. Hope I didn’t inconvenience anyone.
So if you have ever had to write a report of any kind, you know how much your clients are itching to have some kind of chart on the page, and something with a lot of pizzazz. Well the problem is that those charts usually can cost you a pretty penny. Companies like Telerik and Infragistics offer great products, but for those with a budget (you cheap bast’d) there are great open source alternatives. The problem with open source sometimes is that it usually written to support multiple web technologies and not just ASP.NET. Everybody knows ASP.NET is the best and obviously these open source projects are written with a lapse in judgement, but forgiveness is the best policy because these projects can be awesome (just kidding about the lapse in judgement).
OpenFlashChart.zip (694.51 kb (Visual Studio 2008)
What I found in my search was Open Flash Chart,which is amazing. So I downloaded the project and installed it, and it had a .NET example in there (in chinese) and it worked but I didn’t like how it worked. I then looked on CodePlex and found someone who implemented a cool version of Open Flash Chart, but it didn’t work with the newer Open Flash Chart build. The newer version uses JSON. I decided to take both projects and merge them together to make a better mouse trap.This project was written using some of the new features of C# 3.0, so if you need to run it in 2005 then you might need to modify some of the code.
There are three aspects to this project: the ASP.NET Control, the Charts, and an HttpHandler. If you want to see the details of the infrastructure I suggest you look at the original author’s post, I only take credit for fixing it, but he wrote the ASP.NET infrastructure originally.
If you are intereseted in an Open Flash Chart control you can download the assembly here. I will also try to contact the original author and get the latest version on codeplex.
OpenFlashChart.zip (694.51 kb) Visual Studio 2008
Note: The HttpHandler solution utilizes cache, which works until you try to use it on load balanced machines without distributed cache. You can point the control to data pages as a work around. Play around and see what’s in the code. All credit goes to the original authors, I greatly respect their work and have included credit in the example project.
Update : How Ironic, the download to the fix didn’t work. I think it works now so you can download it.
Boogey Down with SQLite – SQLite Administrator
0I have always been a big fan of in-memory / file system databases. Why you ask? Well it’s because as a developer it offers a low learning curve and it’s easy to integrate into any project. As a person that pays for webhosting, I can save between 10 – 30 dollars a month on database expenses, especially if the database in question is never going to be that large. That is between $120 – $360 a year, that’s no chump change.
SQLite is a software library that implements a self-contained, serverless, zero-configuration,transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world. The source code for SQLite is in the public domain.
SQLite is the champion of small databases. It is used by Adobe, Apple, Bloomberg, Mozilla, and other companies. There is one small drawback (no pun intended). It can be difficult to manage without the right tools. That is where SQLite Administrator comes in. This tool is amazing, and it gives you a similar experience to SQL Server Management Studio. You can manage your database like a pro with all the nice IDE candy. Check out the screenshots below.
So if you are a web developer getting ready to code up your next site, make sure you think about SQLite. It allows you to give your clients a rich data driven experience without the overhead costs of an expensive service based database, and feel comfortable knowing that you can manage that database with SQLite Administrator.
Timestamp Generator Tool For Migrations
0On my latest project, I’ve started using migrations as a way to iteratively create my database. This helps me focus on features as they evolve. Currently everything is ok, because I am the only one prototyping the system, but I started thinking about the other developers that might work on this project. What would happen when they begin writing migrations. First let’s take a look at how my current migrations look.
[Migration(1)]
public class AddUserTable : Migration
{...}
[Migration(2)]
public class AddRolesTable : Migration
{...}
[Migration(3)]
public class AddLocationsTable : Migration
{...}
Notice how it is simply numbered 1, 2, 3, etc. What happens when multiple developers are looking at the migrations and developing their own migrations. They will want to number their migration the next number in the sequence, which will be cause huge problems when they submit their changes to source control. Luckily the migration framework I am using supports integers of any kind as schema versions. The only consideration is that migrations are executed in sequential order based on the integer. Say hello to my little friend, the Aqua Bird Consulting Timestamp generator.

I hooked up the little utility into Visual Studio as an external tool, similar to the “CreateGUID” tool.

Now anytime I need to generate an integer for my migrations, all I have to do is click that timestamp generator button and the application will come up with a generated integer. The date and time used is UTC, which means you should be ok even if you have team members around the country or even around the world. I also allow you to select the date of the timestamp. In the instance you choose to generate a timestamp from the datepicker, the UTC time will be used of the current UTC DateTime.
Hope this helps other migration users, I compiled this to work with the .Net 3.5 framework.
So You Want To Build A Plug-in Enabled Application?
0Like the title of this post asks, so you want to build a plug-in enabled application? As a developer I’ve run across this scenario at different times during my career and every time it pops up, I always seem to know a little more than I did the last time I approached this problem. This post is about helping you think about a plug-in application of your own. First, let’s look at scenarios where you would want to have a plug-in architecture.
It’s Plug-in Time!
Ok before you use this hammer, you first have to know what you’re swinging at. Below are common usages for a plug-in application, but certainly not all the scenarios.
- Job Scheduler
- Content Management System or Blog Engine
- Integrated Development Environment (IDE)
- Highly Customizable Software Products
- And Much More!!
So those are a few ideas of where a plug-in architecture could be helpful, now lets look at what you should keep in mind when developing a plug-in based application.
Shells Aren’t Just For Turtles
For any good plug-in architecture to work it will need a solid shell. A shell is that part of the architecture that orchestrates and manages all those plug-ins you want to work together. Below are some
features to keep in mind when creating a shell. They are in no particular order of importance.
- Service Location : The shell should be capable of finding services, and giving a plug-in the ability to find a service as well.
- Strong Exception Handling: The shell shouldn’t trust any plug-in to do its job. If the plug-in is bad, that doesn’t mean the shell has to freak out.
- Logging: The shell should let you know what it’s doing, and what it hopes to do if all goes well.
- Instrumentation: The shell should let you enable and disable a plug-in. This could be as simple as deleting a configuration or building an admin tool.
- Abstract: The more abstract your shell is, the more the responsibility of functionality falls on your plug-in. This is a good thing.
- Orchestration Theme: The shell has a theme to its orchestration i.e. executing a scheduled job, displaying web pages, etc.
- Event Aggregation: Things happen in plug-ins, but how are you going to let other plug-ins know or the shell for that matter.
Keeping some of the things mentioned above in mind will help keep you on the right path when building the shell, but what about those plug-ins? That’s the next step.
It’s in the Contract
There are usually two approaches to allowing developers to create a plug-in. The one way is through inheritance. The developer inherits from “PluginBase” that has methods he needs to override. From my experience having a “PluginBase” has always lead to more headache than it is worth. I found that functionality would be inherited into a plug-in that I didn’t necessarily want. Any functionality I wanted in all and every plug-in usually ended up finding a better home in the shell.
The second way to allow developers to create a plug-in is through interfaces/contracts. Interfaces give developers a better understanding of what they need to implement, and with interfaces there is more room for composition. Remember .Net does not support multiple inheritance but it does allow for multiple interfaces. This allows a developer to build very specific plug-ins by only implementing the interfaces that make sense. i.e. a plug-in that has a UI might implement a UIPlugin contract, where as a plug-in that doesn’t have a UI would just neglect implementing that interface.
The Right Technology Stack
The success of your architecture depends on the technology you choose. As like any other development project, you have to choose the right tools for the job. If your plug-in architecture needs to span across networks and live on multiple machines, storing your configuration in files might not be a good idea. If your plug-in architecture exists on one machine, then you probably don’t need WCF or any other kind of remoting. That being said, you should build your architecture so that you can change major parts of your architecture without major effort or overhaul of the entire architecture. Using patterns like IoC can help make this less earth shattering.
Conclusion
Plug-in Architectures are very powerful. They can be the solution to a lot of problems, but I would not advise going down this route if you just want to flex your development muscles. A good exercise to do is to whiteboard the different aspects of your architecture. Draw a large circle in the middle of the board and label it “Shell,” then draw little circles connected to the larger circle for each plug-in. This will help you visualize what your plug-ins are, and what your shell needs to accomplish for these things to work together. Once you realize what the shell is and more importantly is not, you will find your plug-in architecture will fall right into place.
Good Luck,
I know these kind of projects can be really fun
