Click here to Skip to main content
15,880,469 members

Articles by Morten Nilsen (Tip/Tricks: 5)

Tip/Tricks: 5

RSS Feed

Average article rating:

No articles have been posted.

Average blogs rating:

No blogs have been submitted.

Average tips rating: 4.50

Database Development
SQL Server
24 Nov 2010   Updated: 24 Nov 2010   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 5,650     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
Unless you are placing this code in a stored procedure, you could just as well do this:SELECT *FROM ( SELECT 'A1' AS String1,'B1' AS String2, GETDATE() AS DateCol UNION ALL SELECT 'A2','B2', GETDATE()) AS dORDER BY And then append the sanitized column name to sort...
Desktop Programming
WPF
22 Nov 2010   Updated: 22 Nov 2010   Rating: 3.50/5    Votes: 2   Popularity: 1.05
Licence: CPOL    Views: 14,160     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
Shows you how you can attach a viewmodel to your WPF window using attached properties, rather than setting the DataContext to a static resource or in code-behind
22 Nov 2010   Updated: 22 Nov 2010   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 8,930     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
I also have implemented a MarkupExtension to set the DataContext, which looks like this:[MarkupExtensionReturnType(typeof(ApplicationControllerBase))]public class ApplicationDataContext : MarkupExtension{ private Type dataContextType; public ApplicationDataContext(Type...
Programming Languages
C#
22 Nov 2010   Updated: 21 Dec 2010   Rating: 5.00/5    Votes: 5   Popularity: 3.49
Licence: CPOL    Views: 14,912     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
Here is my take on the same, using Lambda expressions and slightly more advanced regular expression features:I have not tested this code, so errors may exist.This implementation will ignore unrecognized tokens. namespace Postfix { class Parser { static Dictionary<string,...
Javascript
22 Nov 2010   Updated: 22 Nov 2010   Rating: 5.00/5    Votes: 5   Popularity: 3.49
Licence: CPOL    Views: 16,655     Bookmarked: 5   Downloaded: 0
Please Sign up or sign in to vote.
From what I understand of best practices in the JS world, one should not use the new keyword very often.For this example, I would suggest this as an alternate approach:Create a new script file arithmetic.jsvar Arithmetic = function(){ var obj = { add: function(a,b) { return a +...

Average reference rating:

No reference articles have been posted.

Average project rating:

No projects have been posted.
Norway Norway
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.