This post is based on Scott Hanselman’s SignalR post – but tweaked for MVC3. Source.
This is getting my vote for Tool of The Year™ 2011.
As it’s description states in their GitHub page:
Async signaling library for ASP.NET to help build real-time, multi-user interactive web applications.
In a nutshell SignalR lets you communicate with clients on your website in real time. Imagine Comet implementation without all the fuss. Dead easy to setup, dead easy to work with, fast as holy hell. Yes – I’m excited.
I’m going to show you how to build a small chat application using SignalR in an MVC3 application.
This is our end result:
The user is going to click on the link, and using AJAX we’re going to fetch the result and update the value on the screen. All without doing a complete page refresh.
Today I’m going to show you how to create an editor template for DateTime objects in your model.
This is what we’re aiming for. A label for our input, and when the input has focus we should display a nice DatePicker widget kindly provided for free by the excellent jQueryUI library.
So in my application, I found myself needing a way to get business days for a given month. It’s for student attendance, so I only need to get the days from Monday through Friday for a given month.
Hopefully someone finds this useful. 🙂
How many times have you started feeling your machine is getting a bit crusty around the edges. Computer taking a bit too long opening a picture, a bit too long closing that tab, a few extra seconds to open the context menu. We’ve all been there, right?
I had the idea for this little experiment last Wednesday when I had to completely wipe my desktop PC. It was old, running on it’s previous OS for two years straight in the hands of my technophobic wife.
The PC had seen better days.
I’m sure there are many ways to skin this proverbial cat, but I’ve worked on it for a bit and I feel I like this approach. It’s easy to modify, easy to follow along with and allows for some cool GUI manipulations. Well, as far as you can get with Windows Forms anyway.
Here’s a screenshot of how it looks when someone tries to act smart and corrupt our precious database!
Here’s how to do it.
Inspired by this question over on StackOverflow, I decided to finally sit down and work through a couple examples on how to override Equals and GetHashCode for a custom type.
Reasons why you would want to do this:
- You need to be able to compare between two types easily.
- You want to be able to use your custom type in a HashTable.
You’ve been there before, you need to verify if a certain item is already in the collection, but you don’t quite feel you’ve done it in the correct manner. Your inner programmer is itching somewhere and you just know there’s a better way.
Let me show you how with a simple example.