This is just a spot to keep miscellaneous links. It also shows you what a geek I am.
Monday, January 09, 2012
Wednesday, November 23, 2011
MVC3 app_code directory
I just found out from K. Scott Allen’s MVC3 training video on Pluralsight that the app_code directory in MVC3 is alive and well. Basically the Razor helpers here are pre-compiled and can be accessed globally in the application.
Apparently the usage in a Razor page is as follows:
@Common.Script(“myscript.js”, Url)
Note to self: compare and contrast with shared “editor” partial views.
Note: I composed this post with Windows Live Writer 2011 but it doesn’t seem to play well with Blogger’s own editor. ¡QuĂ© pena!
Tuesday, October 25, 2011
MVC3 ModelState and overwriting model properties
UPDATE 11/10/2011:
This only applies to values passed in via a POST (or a GET?) that you're attempting to override by changing the corresponding fields in the view model.
Wednesday, October 19, 2011
How To: Reset Identity column in SQL Server
Thursday, October 13, 2011
RegExes for replacing MVC3 hard-coded hrefs with @Url.Content hrefs
My app is sprinkled with lots of links like this:
<script src="../../Scripts/jquery-ui-1.8.11.min.js" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
So the following search and replace with RegExes will work:
| Find what: | "\.\./\.\.{/[^"]*}" |
| Replace with: | "@Url.Content("~\1")" |
Include the quotes, and be sure to select "Use regular expressions."
Note that the consistent relative path "../../" must be changed as per your circumstances.
UPDATE on 11/2/11:
Now, according to this article, I see that Url.Content is supposed to be better anyway.
Tuesday, September 06, 2011
Wednesday, July 13, 2011
WCF Notes
To discover WCF services, make sure that https is turned off. This is done in two places, apparently:
- In the binding, on the Security tab, Mode property, make sure the property is not set to “Transport”.
- In the service behaviors, serviceMetadata, make sure httpsGetEnabled is set to false and that httpsGetEnabled is set to true.
When you’re done, turn those things back on again.
Common Design Patterns Resources : Steve Smith's Blog
Monday, July 11, 2011
Irony - .NET Language Implementation Kit.
Thursday, June 23, 2011
Cleaning up POSTs in ASP.NET MVC | Jimmy Bogard's Blog
"What we see over and over and over again is a similar pattern of:
[HttpPost] public ActionResult Edit(SomeEditModel form) { if (IsNotValid) { return ShowAView(form); } DoActualWork(); return RedirectToSuccessPage(); }
Where all the things in red are things that change from POST action to POST action."
Friday, June 10, 2011
How to replace all automatic properties of string type with a string type which is never null
In Visual Studio's Find and Replace dialog, type the following in the "Find what:" field:
public string \{:i\} \{ get; set; \}
Type this into the "Replace with" field:
private string _\1;\npublic string \1 \{\nget \{ return _\1 ?? ""; \}\nset \{ _\1 = value; \}\n\}
This pattern of performing a test in the getter versus the setter guarantees that it will never be null, and is the pattern used in the TextBox web control's Text property.
Afterwards you'll want to reformat the code, and possibly rename the backing fields, e.g. _FirstName, to be more camel-cased instead of being Pascal-cased(-like), e.g. _firstName instead of _FirstName.
Thursday, June 09, 2011
Date & Time Formats on the Web
Date & Time Formats on the Web: "There are several different formats used in different places in the technologies of the World Wide Web to represent dates, times and date/time combinations (hereafter collectively referred to as “datetimes” unless a distinction has to be made). This document presents a survey of the most significant, details which formats are mandated by the key technologies of the web, and offers advice for deciding what formats you should use in your own web applications."
Wednesday, May 11, 2011
Josh Reed Schramm - Software Development Thoughts And Opinions - Blog - Unit Testing Role Based Security w/ ASP.Net MVC
Josh Reed Schramm - Software Development Thoughts And Opinions - Blog - Unit Testing Role Based Security w/ ASP.Net MVC: "I took Paul's code and turned it into a series of three controller extension methods which verify if the entire controller requires authorization, a particular method requires authorization or if a particular method requires a given role (i have not yet written the obvious 4th case - an entire controller requires a given role but it should be trivial.)"
Tuesday, May 10, 2011
Compiling MVC Views In A Build Environment
But if you created your project using an older version of ASP.NET MVC including ASP.NET MVC 3 RTM (the one before the Tools Update), your csproj/vbproj file will still have this bug."
Thursday, April 21, 2011
Knock Me Out
Monday, April 18, 2011
Friday, April 08, 2011
Why I Still L.O.V.E. ASP.NET WebForms - John Katsiotis
Thursday, April 07, 2011
Don't mock HttpContext
But don't."
Monday, April 04, 2011
dapper-dot-net - Simple SQL object mapper for SQL Server - Google Project Hosting
dapper-dot-net - Simple SQL object mapper for SQL Server - Google Project Hosting: "Dapper - a simple object mapper for .Net
Dapper is a single file you can drop in to your project that will extend your IDbConnection interface."
Friday, April 01, 2011
Setting the Text of a ListControl in ASP.NET
listControl.Text = "4 Year College";Well, unfortunately, no! The "Text" property is named that way for consistency across all ASP.NET controls and refers to the form value that is passed to the server when the page is submitted. So unfortunately for me, the "Text" property silently rejected my attempt to set it and the page did not work.You may be asking yourself why I am trying to set the visible text and not the value of the control. The reason is that the application I'm working on receives the displayed text from a web service and not the value that is passed in the form variables. Why not create a dictionary, look up the the text string in the dictionary, and pass that to the control?
The answer? I already have a dictionary. It's called the SELECT control itself. The generated HTML for my control is, say, the following:
This control is essentially a dictionary of key-value pairs: the key is the value attribute of the option tag, and the value is the visible text that is displayed for the given item in the dropdown list. So in the spirit of Don't Repeat Yourself (DRY), I wrote a extension function to allow me to set not just the value but also the text. I give you ListControlExtensions.cs:
Here's a typical usage. In this particular scenario, my data should be scrubbed, but if not I log a warning:
Monday, March 28, 2011
Five advanced Git merge techniques : Inside P4
by Edward Z. Yang
Have you ever performed a merge in Git and not have it quite turn out the way you wanted it to? For example, you accidentally converted all of your UNIX line endings to DOS line endings, and now the entire file reports a conflict? Maybe you see a conflict that you don't really care about resolving, and want to resolve as theirs? Or perhaps the conflicted file is empty and you can't figure out just what happened there?"
Friday, March 25, 2011
Caffeine-Powered Life - Nested Collection Models in ASP.NET MVC 3
Saturday, March 19, 2011
IIS Express FAQ : IIS Express : Microsoft Web Platform : The Official Microsoft IIS Site
A: Yes, IIS Express uses the same applicationhost.config and web.config files supported by IIS 7.x. The key difference is that with IIS Express, the configuration is maintained on a per-user basis. In particular, whereas IIS has a global “applicationhost.config” file, IIS Express maintains a user-specific “applicationhost.config” file in the %userprofile%\documents\IISexpress\config” folder. This lets a standard user run IIS Express and also lets multiple users work on the same machine independently, without conflicting with each other. Some settings require Administrator user rights to set and modify (see question above about running as a standard user)."
Thursday, March 10, 2011
Tuesday, February 22, 2011
Sunday, February 20, 2011
Reimplementing LINQ to Objects: Part 43 - Out-of-process queries with IQueryable - Jon Skeet: Coding Blog
- Expression trees are used to capture logic in a data structure which can be examined relatively easily at execution time
- Lambda expressions can be converted into expression trees as well as delegates
- IQueryable
and IQueryable form a sort of parallel interface hierarchy to IEnumerable and IEnumerable - although the queryable forms extend the enumerable forms - IQueryProvider enables one query to be built based on another, or executed immediately where appropriate
- Queryable provides equivalent extension methods to most of the Enumerable LINQ operators, except that it uses IQueryable
sources and expression trees instead of delegates - Queryable doesn't handle the queries itself at all; it simply records what's been called and delegates the real processing to the query provider"
Reimplementing LINQ to Objects: Part 43 - Out-of-process queries with IQueryable - Jon Skeet: Coding Blog
- Expression trees are used to capture logic in a data structure which can be examined relatively easily at execution time
- Lambda expressions can be converted into expression trees as well as delegates
- IQueryable
and IQueryable form a sort of parallel interface hierarchy to IEnumerable and IEnumerable - although the queryable forms extend the enumerable forms - IQueryProvider enables one query to be built based on another, or executed immediately where appropriate
- Queryable provides equivalent extension methods to most of the Enumerable LINQ operators, except that it uses IQueryable
sources and expression trees instead of delegates - Queryable doesn't handle the queries itself at all; it simply records what's been called and delegates the real processing to the query provider"
Friday, February 18, 2011
Formula for computing how many end users to interview
"Stalking Customers
When I worked at Intuit (makers of TurboTax, Quicken & QuickBooks) we used a method called "follow-me-home." It was as effective as it was simple in identifying customer problems and needs.We went to a customer's house or workplace and watched them do what they do and recorded their behavior and problems they encountered and how they solved them. Data from follow-me-homes were used for new product ideas and improving existing products. "
Tuesday, February 15, 2011
Scott Hanselman - Creating a NuGet Package in 7 easy steps - Plus using NuGet to integrate ASP.NET MVC 3 into existing Web Forms applications
Also my comment on how to wire up the resultant .csproj file to have the MVC context menus:
Woot! I added the GUID {E53F8FEA-EAE0-44A6-8774-FFD645390401} to the ProjectTypeGuids node of the .csproj, and it's a bone fide MFC project with context menus in the Solution Explorer.
This is the result, with the new GUID underlined:
Wednesday, February 09, 2011
The perils of using Func instead of Expression in an IQueryable
I learned the hard way: when using IQueryable against a database, any predicates handed around should be Expression<func<type, bool>> instead of just Func<type, bool>. Func<type, bool> is evaluated in memory! That means that the entire table is fetched from the database, then filtered in memory. Bad, bad, bad!
Friday, February 04, 2011
Video Series: How To Give Great Presentations
Friday, January 21, 2011
Scaffold your ASP.NET MVC 3 project with the MvcScaffolding package « Steve Sanderson’s blog
How To Use Amazon EC2 as Your Desktop - RestBackup™ Blog
Scott Hanselman - Link Rollup: New Documentation and Tutorials from Web Platform and Tools
Scott Hanselman and Rick Anderson collaboration and Mike Pope (Editor)
Both C# and VB versions:
- Intro to ASP.NET MVC 3
- Adding a Controller
- Adding a View
- Entity Framework Code-First Development
- Accessing your Model's Data from a Controller
- Adding a Create Method and Create View
- Adding Validation to the Model
- Adding a New Field to the Movie Model and Table
- Implementing Edit, Details and Delete
- Source code for this series"
Michael C. Kennedy's Weblog - 11 Killer Open Source Projects I Found with NuGet
Wednesday, January 19, 2011 5:18:17 PM (Pacific Standard Time, UTC-08:00)
So maybe I'm late to the party, but I recently started playing with NuGet. It's a killer new way to find, install, maintain, and manage references to open source libraries in Visual Studio 2010. Plenty of people have written about it (Phil Haack and Scott Hanselman for example). Let's just say you should learn about NuGet if you don't know it already.
What I want to talk about is all the cool open source projects I found just by flipping through the pages of the NuGet directory in the Visual Studio 'Add Library Package Reference' dialog."
Monday, December 27, 2010
Kill That Util Class!
Saturday, December 11, 2010
The protocol-relative URL
<img src="//domain.com/img/logo.png">If the browser is viewing that current page in through HTTPS, then it'll request that asset with the HTTPS protocol, otherwise it'll typically* request it with HTTP. This prevents that awful "This Page Contains Both Secure and Non-Secure Items" error message in IE, keeping all your asset requests within the same protocol."
Thursday, December 09, 2010
Algorithmia Source Code released on CodePlex - Frans Bouma's blog
The undo/redo looks intriguing.
Saturday, December 04, 2010
CODE Magazine - Article: Behavior-Driven Development
Wednesday, November 24, 2010
NaĂŻve Bayesian Classification Using C# and ASP.NET
To understand and code for the na ve Bayesian algorithm, we will do some math to understand the procedure. The primary equation for the Bayes rule is:
P(A|B) = (P(B|A) * P(A)) / P(B)"
There's also this: http://nbayes.codeplex.com/
and this: Inference in Belief Networks - CodeProject
InfoQ: Testing Techniques for Applications With Zero Tests
InfoQ: How To Do Large Scale Refactoring
Tuesday, November 23, 2010
InfoQ: Fulfilling the Promise of MVC
Monday, November 22, 2010
So You Want to Interview for a Senior Developer Position…. « If & Else
Saturday, November 20, 2010
10 Steps To Become Better .NET Developer - Blog - CQRS and Cloud Computing
Friday, November 12, 2010
Thursday, November 11, 2010
Jurassic - A Javascript Compiler for .NET
Jurassic is an implementation of the ECMAScript language and runtime. It aims to provide the best performing and most standards-compliant implementation of JavaScript for .NET. Jurassic is not intended for end-users; instead it is intended to be integrated into .NET programs. If you are the author of a .NET program, you can use Jurassic to compile and execute JavaScript code.
Features
- Supports all ECMAScript 3 and ECMAScript 5 functionality
- Simple yet powerful API
- Compiles JavaScript into .NET bytecode (CIL); not an interpreter
- Deployed as a single .NET assembly (no native code)
- Basic support for integrated debugging within Visual Studio
- Uses light-weight code generation, so generated code is fully garbage collected"
Wednesday, November 10, 2010
Building iPhone Apps with HTML, CSS, and JavaScript
Monday, November 08, 2010
Scrum Alliance - New to User Stories?Written for the Scrum Alliance. A CSP’s perspective on user stories, requirements, and use cases
Sunday, November 07, 2010
Ultimate Guide to Website Wireframing
Saturday, November 06, 2010
Git Source Control Provider
FsCheck: A random testing framework
Wednesday, November 03, 2010
Saturday, October 23, 2010
Test with Windows Live Writer
Everyone is telling me that this tool is really the cat’s meow. So far – about 20 words into it – it’s really not half bad.
Let’s insert a photograph, even though this blog isn’t so much of a blog as a glorified collection of bookmarks.
Hmmm, kinda cool!
I wonder if this would work with ScrewTurn Wiki? (Although I would tend to doubt it, but you never know.)
Saturday, October 16, 2010
A few thoughts on jQuery templating with jQuery.tmpl | Encosia
Overall, jQuery.tmpl is a great step in the right direction. It’s small, it’s simple, and it’s fast. Overloading append() to allow the append(Template, Data) syntax is phenomenal. That approach feels more like idiomatic jQuery than anything else I’ve used, including jTemplates."
Monday, October 11, 2010
Teach Visual Studio Your Own Language -�Easy! - Journal - Rinat Abdullin
BDD, Fluent Interface Generator, and a new .NET 3.5 Parser generator
Tuesday, October 05, 2010
Javascript Libraries and ASP.NET: A Guide to jQuery, AJAX and Microsoft - Articles - MIX Online
NET jQuery Extensions at GitHub
Highlights include:
"Templating – Previously referred to as jQuery.tmpl or jQuery-tmpl, the jQuery Templating feature was Microsoft’s first foray into working with the jQuery team and community. Though its inclusion in jQuery isn’t planned until jQuery 1.5 is released, you can begin using it in plugin form immediately. That plugin is currently available on GitHub: http://github.com/jquery/jquery-tmpl"
and
"Data Linking – The next feature that may be a precursor to more official things to come is the jQuery-datalink plugin, which is also available on GitHub: http://github.com/nje/jquery-datalink. With this plugin, you can “link” JavaScript objects together so that they remain synchronized when changes are made to one or both of them. The canonical example of this is linking a JavaScript object’s properties to corresponding fields in a form, to eventually automate tasks such as change tracking and submission."
More from Scott Guthrie:
"jQuery Templates
The jQuery Templates plugin enables you to create client templates. For example, you can use the jQuery Templates plugin to format a set of database records that you have retrieved from the server through an Ajax request.
You can learn more about jQuery templates by reading my earlier blog entry on jQuery Templates and Data-Linking or by reading the documentation about it on the official jQuery website. In addition, Rey Bango, Boris Moore and James Senior have written some good blog posts on the jQuery Templates plugin:
When the next major version of jQuery is released -- jQuery 1.5 -- jQuery Templates will be included as a standard part of the jQuery library."
Monday, October 04, 2010
Sunday, October 03, 2010
Thursday, September 09, 2010
jQuery Grid Recommendations - Stack Overflow
jQuery Grid Recommendations - Stack Overflow: "The best entries in my opinion is Flexigrid and jQuery Grid (1st & 2nd in list). The others are included for completeness.
Flexigrid: http://flexigrid.info/
jQuery Grid: http://www.trirand.com/blog/
jqGridView: http://plugins.jquery.com/project/jqGridView
Ingrid: http://reconstrukt.com/ingrid/
SlickGrid http://github.com/mleibman/SlickGrid
I like the jQuery Grid (#2 above) better than Flexigrid mostly because it supports editable cells, and has very good documentation and samples on the website."
Saturday, August 28, 2010
How to
"How to make engineers write concisely with sentences? By combining journalism with the technical report format. In a newspaper article, the paragraphs are ordered by importance, so that the reader can stop reading the article at whatever point they lose interest, knowing that the part they have read was more important than the part left unread.
State your message in one sentence. That is your title. Write one paragraph justifying the message. That is your abstract. Circle each phrase in the abstract that needs clarification or more context. Write a paragraph or two for each such phrase. That is the body of your report. Identify each sentence in the body that needs clarification and write a paragraph or two in the appendix. Include your contact information for readers who require further detail.
-- William A. Wood (email), September 8, 2005"
Monday, August 23, 2010
The Marvels of Monads - Yet Another Language Geek - Site Home - MSDN Blogs
Thursday, August 19, 2010
Mastering the 960 Grid System | Nettuts
Don’t let jQuery’s $(document).ready() slow you down | Encosia
Thursday, August 12, 2010
Fiddler Extension – Request to Code | Chad Sowald
Tuesday, August 10, 2010
Scott Hanselman - How to Post Code To Your Blog and other Religious Arguments
Saturday, August 07, 2010
Commonly Confused Bits Of jQuery
Tuesday, July 27, 2010
Sunday, June 27, 2010
Thursday, June 17, 2010
Six Things Every jQuery Developer Should Know
Friday, June 11, 2010
Cookieless Session Problems in ASP.NET
Cookieless Session Problems in ASP.NET
Thursday, June 10, 2010
Git Reference
Git Reference
Tuesday, June 08, 2010
Parameterized unit tests using Pex - reducing code written
Friday, May 21, 2010
Thursday, May 06, 2010
Debugging classic ASP web application with Visual Studio 2010
Why, oh why, do people still use classic ASP?
Wednesday, May 05, 2010
Custom Configuration Section Handlers : Steve Smith's Blog
Custom Configuration Section Handlers : Steve Smith's Blog
Steve Smith is the guy who brings you Hudson Software Craftsmanship, who meet once a month in Hudson, OH.
Monday, May 03, 2010
Thursday, April 29, 2010
Using .NET: Tame Your Software Dependencies for Flexible Apps
This uses Castle Windsor and Binsor, a Boo (!) DSL for wiring up dependencies.
Using .NET: Tame Your Software Dependencies for Flexible Apps
Sunday, April 25, 2010
Silverlight 4 Training Kit - ScottGu's Blog
Silverlight 4 Training Kit - ScottGu's Blog
Wednesday, April 21, 2010
Git autocrlf problem revisited -- and solved!
The following commands, issued in a row, will work:
git add -u
git config core.autocrlf false
git reset
git config --unset core.autocrlfThis assumes that you've got
core.autocrlf normally on by default in the global settings file. If you do not, then replace the last line with the following:git config core.autocrlf trueOr, to consolidate in one command, the first version is:
git add -u && git config core.autocrlf false && git reset && git config --unset core.autocrlfwhile the second is:
git add -u && git config core.autocrlf false && git reset && git config core.autocrlf trueMSLinqToSQLGenerator fails when there's a partial class having a Using at the top of the file | Microsoft Connect
MSLinqToSQLGenerator fails with partial class having a Using at the top of the file | Microsoft Connect: "If you add a partial class declaration to a Linq-To-SQL Data Classes context object, and then put a 'using' statement at the top of the file outside the namespace declaration, the following error occurs when you run the custom tool:
'The custom tool 'MSLinqToSQLGenerator' failed. Unspecified error'
Also, Visual Studio will then delete the corresponding '.designer.cs' file for your data context and nothing will compile after that point."
Thursday, April 01, 2010
Belarc Advisor - Free Personal PC Audit
Tuesday, March 30, 2010
Jeffrey rambles about Rx, .NET and programming in general. : Time flies like an arrow in Script#
Jeffrey rambles about Rx, .NET and programming in general. : Time flies like an arrow in Script#: "Time flies like an arrow in Script#
As kouPhax requested this on the Rx forum, I decided to post a port to Script# of the Time flies like an arrow sample that ships with Rx for JavaScript.
Rx for JavaScript already ships with a binding for Script#, so that will make our lives a lot easier (you can find the binding in \Redist\ScriptSharp\RxJs.dll)"
Sunday, March 28, 2010
How to share data between stored procedures
Very cool article. Gives a table summarizing the methods.
Friday, March 19, 2010
Tsung
The purpose of Tsung is to simulate users in order to test the scalability and performance of IP based client/server applications. You can use it to do load and stress testing of your servers. Many protocols have been implemented and tested, and it can be easily extended. WebDAV, LDAP and MySQL support have been added recently (experimental).
It can be distributed on several client machines and is able to simulate hundreds of thousands of virtual users concurrently (or even millions if you have enough hardware ...).
Tsung is developed in Erlang, an open-source language made by Ericsson for building robust fault-tolerant distributed applications.
Tsung is supported by Process-One"
Wednesday, March 17, 2010
Create a self-signed SSL certificate with IIS 6.0 Resource Kit SelfSSL
Wednesday, March 10, 2010
[#LOG4NET-27] Rolling files on date/time boundaries doesn't support a maximum number of backup files. - ASF JIRA
[#LOG4NET-27] Rolling files on date/time boundaries doesn't support a maximum number of backup files. - ASF JIRA
Tuesday, March 09, 2010
Why won't my ASP pages work in IIS 6.0?
Why won't my ASP pages work in IIS 6.0?
Wednesday, March 03, 2010
Introducing SelectorGadget: point and click CSS selectors
Introducing SelectorGadget: point and click CSS selectors: "SelectorGadget is an open source bookmarklet that makes CSS selector generation and discovery on complicated sites a breeze. Just drag the bookmarklet to your bookmark bar, then go to any page and press it. A box will open in the bottom right of the website. Click on a page element that you would like your selector to match (it will turn green). SelectorGadget will then generate a minimal CSS selector for that element, and will highlight (yellow) everything that is matched by the selector. Now click on a highlighted element to remove it from the selector (red), or click on an unhighlighted element to add it to the selector. Through this process of selection and rejection, SelectorGadget helps you come up with the perfect CSS selector for your needs."
Tuesday, March 02, 2010
Glimmer: a jQuery Interactive Design Tool - Home
Glimmer: a jQuery Interactive Design Tool - Home: "Without having to touch a piece of JavaScript code, harness the power of the jQuery. With Glimmer: a jQuery Interactive Design Tool, easily create interactive experiences and use the tool to discover ways to add animation and other effects to your site in new and unexpected places. Glimmer is a Windows application which generates jQuery, XHTML and CSS. If jQuery is the “write less, do more” JavaScript library, then Glimmer is the “write none, do more” jQuery design tool."
Quick and Dirty Guide to Configuring Log4Net For Web Applications
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);Quick and Dirty Guide to Configuring Log4Net For Web Applications
My code:
private static readonly ILog Log { get; set; }
static ClassConstructor()
{
Log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(HttpContext.Current.Server.MapPath("~/log4net.config")));
}
Monday, March 01, 2010
The Kayak Framework: An easy way to speak HTTP with .NET
The Kayak Framework: An easy way to speak HTTP with .NET: "Kayak is a lightweight HTTP server for the CLR, and the Kayak Framework is a utility for mapping HTTP requests to C# method invocations. With Kayak, you can skip the bulk, hassle, and overhead of IIS and ASP.NET. Kayak enables you to do more with less syntax, and is easy to configure to work in any way you care to dream up."
