Tuesday, December 4, 2012
NCalc: a mathematical expressions evaluator in .NET
For a project that I've been developing lately I needed to evaluate some mathematical expressions that I'll store as text strings. So my first thought was like "I'm not the first man on earth with such necessity, ergo, it must have been accomplished by someone else before me". That is a thought that I have in a lot of situations, but fortunately this time it turned out to be truth.
As the CodePlex project's page states: "NCalc is a mathematical expressions evaluator in .NET. NCalc can parse any expression and evaluate the result, including static or dynamic parameters and custom functions".
IMHO is an excellent tool, but to be fair, I'm not doing nothing overly complicated in my project.
Thursday, November 29, 2012
HOWTO trigger MVC 3 validation from jQuery
Have you ever wonder how to trigger de MVC 3 form validations from jQuery? ... well, I've done it, and belive me, I spend more than an hour finding out how to. So, the answer is pretty simple: to trigger the validators do something like
$('#MyForm').validate().form();
And for checking if the all the validations get passed look for something likevar isMyFormValid = $('#MyForm').validate().valid();
That's all.(The answer was found thanks to the ASP.NET forums)
Monday, November 26, 2012
Test your javascript code online
Some time ago thanks to an answer at StackOverflow I discovered an amazing web service called jsfiddle. Basically it allows you to test your JavaScript code online with the option to make use of some of the most popular frameworks out there (like jQuery, Mootools, YUI, Dojo, etc..), and if you need so, you can share your "fiddles" too.
An excellent tool that always come handy.
Friday, November 23, 2012
HOW TO: render an MVC 3 partial view dinamically with jQuery
Maybe the question in this StackOverflow thread is a little bit too specific, but the most voted answer is a good an short example of how to render an MVC 3 partial view dinamically with jQuery.
http://stackoverflow.com/questions/5628611/asp-net-mvc-3-partial-view-dynamically-rendered-and-linked-from-dynamic-list-in
http://stackoverflow.com/questions/5628611/asp-net-mvc-3-partial-view-dynamically-rendered-and-linked-from-dynamic-list-in
Thursday, November 22, 2012
Brief introduction to MVC 3 partial views
Here's a brief and to the point introduction to MVC 3 partial views by Microsoft's Rachel Appel:
http://rachelappel.com/razor/partial-views-in-asp-net-mvc-3-w-the-razor-view-engine/
The introduction covers in less than 10 minutes the following topics:
http://rachelappel.com/razor/partial-views-in-asp-net-mvc-3-w-the-razor-view-engine/
The introduction covers in less than 10 minutes the following topics:
- What is a partial view and when should I use it?
- Rendering partial views
- Creating a partial view
- Sharing Data between views and partial views
Wednesday, November 21, 2012
HOW TO: embed MVC 3 Razor code inside a javascript block
This one is actually a kind of weird trick that's is required (as far as I know) in the current version of MVC for embedding razor code inside a javascript block. It's very possible that you find yourself wondering how to accomplish this when you are begining with MVC and razor:
http://stackoverflow.com/questions/4204669/asp-net-mvc3-rc-razor-views-syntax-for-embedding-code-inside-javascript-bloc
P.S. I'm not sure if this is still necessary in the current version of MVC (MVC 4 ath the time of this writing)...
http://stackoverflow.com/questions/4204669/asp-net-mvc3-rc-razor-views-syntax-for-embedding-code-inside-javascript-bloc
P.S. I'm not sure if this is still necessary in the current version of MVC (MVC 4 ath the time of this writing)...
Monday, November 19, 2012
HOW TO: query many-to-many relations in EF 4
While working with Entity Framework I found my self a bit lost while working with many-to-many relations, as I expect that a class should exist to represent the many-to-many relation table, but in fact, it doesn't exist. So how on earth do you make a query that intends to use the many-to-many relation?...
The answer come from the usual suspect, her's the link at StackOverflow:
http://stackoverflow.com/questions/553918/entity-framework-and-many-to-many-queries-unusable
Subscribe to:
Posts (Atom)