I recently had a conversation with someone who is looking to make a fresh start and become a developer (coming from other IT positions). The question they had was:
What should I learn to get started in .NET and web development?
Now this question was starting from a position of “I’d like to get started with .NET and the web. How do I do that?” So please hold your “No, choose Ruby (or NodeJS or … )” comments. That’s another blog post. :)
Here’s my advice along with a bunch of courses you can use to accomplish this efficiently and affordably. Continue reading →
I’ve been working with MongoDB for a long time now. Back in the early days, there really were no management tools analogous to RDBMS tools (e.g. SQL Server Management Studio). Since then, things have changed significantly. It’s time to look around and see what management / monitoring tooling is around these days for MongoDB.
The news is good. There are many different options to choose depending on your platform and use-cases.
This article demonstrates a technique and supporting library for adding optimistic concurrency control to NoSQL databases and MongoDB in particular.
Watch a video walk-through using this library:
Quickly, what is optimistic concurrency control?
Ideally, all databases that allow concurrent access or disconnected access need to implement some form of concurrency control. This usually comes in two flavors:
Pessimistic concurrency control
Optimistic concurrency control
Pessimistic concurrency control is usually used when working heavily within transactions. That may be fine for bank transfers, but it typically falls down in the face of disconnected models used by almost all ORMs such as Entity Framework. Moreover, it is entirely inappropriate for NoSQL databases.
Frameworks such as Entity Framework have optimistic concurrency control built in (although it may be turned off). It’s instructive to quickly see how it works. Basically there are three steps:
Get an entity from the DB and disconnect.
Edit in memory.
Update the db with changes using a special update clause. Something like: “Update this row WHERE the current values are same as original values”.
If that update returns “0 rows modified” then we know it was changed since we loaded it and are about to overwrite someone’s changes. This results in a concurrency exception and not changes go through.
Optimistic concurrency control for MongoDB
By carefully constructing update commands in C# with the official 10gen C# driver, we can achieve almost exactly the same flow. At the end of this article is a simple C# class (data context) which has save and delete methods which internally are safe via optimistic concurrency control. Continue reading →
[Note: reblogged from blog.learninglineapp.com. I'd like to personally invite you to check out our work over at LearningLine - just follow the links below.]
We believe that LearningLine is the most effective online training for developers, period. Today it gets even better. We are announcing the ability to preview any of our online courses, for free without entering any payment information.
This is not a trial that becomes a subscription or a silly 5 minute preview like other company’s offer. You can now study approximately the first hour of any one of our courses. And you can spend as much time as you like doing so.
This means there is now a lot of content available to you right now. At a typical student speed working for an hour a day, it would take over a month to complete all the content that is available for preview. Continue reading →
Important note: In order to run this demo, you must download MongoDB and start it on your local machine. You do not need to initialize a database or anything like that but the db will be empty so use the admin feature to create categories and books. Running MongoDB as a Windows Service is not required.