Tuesday, December 01, 2015

Git TFS with Git 2.5 and above - Solved!

I experienced the same issues as the OP here: https://github.com/git-tfs/git-tfs/issues/845

In my case:
$ git tfs clone https://me.visualstudio.com/DefaultCollection/_versionControl $/MyProject
TFS repository can not be root and must start with "$/".
You may be able to resolve this problem.
- Try using $/C:/Program Files/Git/MyProject
The solution, courtesy of dscho: an msys2 flag that looks like the most bastardized bash syntax in the world, but apparently works. (Is this valid bash or a special msys2 thing?)
$ MSYS_NO_PATHCONV=1 git tfs clone https://me.visualstudio.com/DefaultCollection/ $/MyProject
Initialized empty Git repository in C:/Projects/MyProject/.git/
This is documented in the release notes here: https://github.com/git-for-windows/build-extra/blob/master/installer/ReleaseNotes.md#known-issues

EDIT:

You can also double up the initial quote after the $, e.g.:
$ git tfs clone https://me.visualstudio.com/DefaultCollection/ $//MyProject
Initialized empty Git repository in C:/Projects/MyProject/.git/


Tuesday, January 27, 2015

Doug Crockford on Monads and JavaScript

He's not the father of JavaScript, he's more the strongly opinionated caretaker.

Here is his fascinating YouTube video on JavaScript and Monads.

Here is the sourcecode: https://github.com/douglascrockford/monad

He covers four monads in the talk:

  • The Identity Monad
  • The Ajax Monad
  • The Maybe Monad, which eliminates the possibility of a null -- very cool!
  • The Promise Monad, which apparently is not agreed upon by all to be a monad

Two links he mentions

Carl Hewitt, inventor of the Actor Model

Mark Miller, Secure Distributed Programming with Object-capabilities in JavaScript

How to Page in ASP.NET Web API

Great article. There are several ways of doing it, including the Twitter way, which handles infinite feeds in real-time scenarios using cursors.

Paging in ASP.NET Web API: Introduction | Jerrie Pelser

Cool Visual Studio Extensions From Mads Kristensen

Mads, the author of the essential Web Essentials extension for Visual Studio, has created a number of other plugins and extensions as well. Here's a link to two blog posts by him describing these extensions.

New handy Visual Studio extensions
New handy Visual Studio extensions - part 2

Monday, January 26, 2015

Learn F# or Haskell?

Here's a side-by-side comparison of ML dialects, of which F# is one, with Haskell:
ML Dialects and Haskell: SML, OCaml, F#, Haskell - Hyperpolyglot

Then there are the various "99 Bottles" F# implementations. Interestingly, Don Syme's is one of the longer version. He is the creator of F# and arguably knows it the best.
99 Bottles of Beer | Language F#

Here's the Haskell version:
99 Bottles of Beer | Language Haskell

Friday, January 23, 2015

ASP.NET - don't minimize files if you're bundling!

If you've got bundling turned on, the ASP.NET bundling library will choose the already minimized instead of minimizing it at runtime. This can cause problems if you have updated the the source file -- file.js or file.css -- and you haven't remimized it.

So don't minimize the file in the IDE. Alternatively, set up some sort of automation that will automatically minimize the file or your minimized CSS and JavaScript files will be out of sync and your won't know why.

See this StackOverflow question: ASP.NET Bundling - Bundle not updating after included file has changed (returns 304 not modified)

Thursday, January 22, 2015

Adding only non-whitespace changes in Git.

Sometimes it's useful to add only the non-whitespace changes because typically they'll be the meaningful content. This StackOverflow question show how to do that.

Here's the command to add everything, ignoring whitespace-only changes:

git diff -w | git apply --cached --ignore-whitespace


Link here: http://stackoverflow.com/questions/3515597/git-add-only-non-whitespace-changes

Wednesday, December 10, 2014

Properly serving SVG files in IISExpress

If you just edit your web.config file it will actually break your website under IISExpress. Instead, follow the instructions found here: http://tomasmcguinness.com/2011/07/06/adding-support-for-svg-to-iis-express/
  • Open a console application with administrator privileges.
  • Navigation to the IIS Express directory. This lives under Program Files or Program Files (x86)
  • Run the command appcmd set config /section:staticContent /+[fileExtension=’svg’,mimeType=’image/svg+xml’]



Wednesday, November 05, 2014

Git line ending fixups revisited

I blogged about this a few years ago. I discovered how to do this when using .gitattributes, which is automatically created when you use Visual Studio to create a project that uses git as its version control system.

I have a .gitattributes file that contains (among other things) this line at the top:
The sequence of commands is the following:

First, add all changed files: Then, edit the .gitattributes file to comment out the "text=auto" line and save this file: Then issue this command to un-stage all the files. It doesn't matter whether some of the files have meaningful changes. You're not resetting or undoing any file edits, you're merely removing them from the index: Finally, restore the "text=auto" line in your .gitattributes file and save that file: You should be all set. If you issue a git status command again you should see only the files that have meaningful changes, if any.

Friday, September 26, 2014

Beyond SOLID: The Dependency Elimination Principle

http://qualityisspeed.blogspot.com/2014/09/beyond-solid-dependency-elimination.html
Last post I explained why I don't teach the SOLID design principles. Read the post for more detail, but the primary reason is that SOLID encourages heavy use of dependencies. Applying SOLID to a codebase for even a short time will yield dependencies on abstractions everywhere -- quickly producing a codebase that is unintelligible.

Friday, September 05, 2014

git cherry

My mnemonic for git cherry, i.e. git cherry upstream [head]

My quick understanding is that in many cases it means: show me everything that's NOT in upstream.

In other words:

git cherry branch-without-stuff branch-with-stuff

or

git cherry less-stuff more-stuff

or

git cherry present future

or

git cherry past present


So to see what's in develop but not yet in master, type this:

git cherry master develop

Which means, essentially, show me everything in develop that's not (yet) in master. 

Wednesday, August 20, 2014

Strongly-typed function callbacks in TypeScript

The question: http://stackoverflow.com/questions/14638990/are-strongly-typed-functions-as-parameters-possible-in-typescript
In TypeScript I can declare a parameter of a function as a type Function. Is there a "type-safe" way of doing this that I am missing?
My favorite answer: http://stackoverflow.com/a/24034429/53107 from Drew Noakes:
Here are TypeScript equivalents of some common .NET delegates:
interface Action<T>
{
    (item: T): void;
}

interface Func<T,TResult>
{
    (item: T): TResult;
}

Renaming a remote branch in Git

I don't quite understand this, but I'll post it here anyway. It comes from StackOverflow user sschuberth.

git push <remote> <remote>/<old_name>:refs/heads/<new_name> :<old_name>

Example:
git push origin origin/hotfix/Cant-load-assembly.0:refs/heads/feature/Fix-cant-load-assembly :hotfix/Cant-load-assembly.0

Source: http://stackoverflow.com/a/21302474/53107

Friday, June 20, 2014

Git - Refreshing a repository after changing line endings

Who knew? My repositories sometimes contain problematic commits that are just about fixing up line endings, but here's a solution to that from GitHub. (I haven't tested it yet.)
Refreshing a repository after changing line endings
Here's the StackOverflow post from which GitHub gets their answer. There's also something interesting about removing the index, which I never knew about.
Trying to fix line-endings with git filter-branch, but having no luck

Thursday, April 10, 2014

Use Date Based File Archiving with NLog

My quick and dirty way of doing it. The target tag is the most relevant part if you're already using NLog.

Wednesday, April 09, 2014

My Favorite .NET Code Decorations a.k.a. Attributes

[MethodImpl(MethodImplOptions.Synchronized)]

The method can be executed by only one thread at a time. Locks the instance or, for static methods, the class.

[EditorBrowsable(EditorBrowsableState.Never)]

Hides a method from Intellisense.

Thursday, March 27, 2014

Migrate away from MSBuild-based NuGet package restore

Very nifty trick. In the end, your solution will look like the following. Note the .nuget folder has only a NuGet.Config file:


Link: http://www.xavierdecoster.com/migrate-away-from-msbuild-based-nuget-package-restore.
Here are the instructions on how to undo it: http://docs.nuget.org/docs/workflows/migrating-to-automatic-package-restore. Note: where the article says "using TFS," read it as "using version control" because the instructions also apply to Git.

Update 4/4/14: You might have to close the solution and delete any .suo files or Visual Studio will stubbornly bring back the .csproj settings that you deleted.

Update 4/9/14: This doesn't appear very stable when using version control features where you backtrack in history -- for instance to merge a feature branch. Visual Studio stubbornly resurrects the import and target tag in the project file, and killing this won't work unless you first close the solution and delete the .suo file.

I'm actually considering moving back to NuGet package restore. At least it's reliable.

Second update 4/9/14: This doesn't play well with ReSharper's cool feature where it automatically adds NuGet packages to a project instead of just a reference.

Tuesday, February 18, 2014

How to do a rebase with git gui

Who knew? I thought it wasn't possible, but apparently it is if you modify git config.

http://stackoverflow.com/questions/4830344/how-to-do-a-rebase-with-git-gui

Add this to the .gitconfig file in your home directory to add rebase commands to the Tools menu:
[guitool "Rebase onto..."] cmd = git rebase $REVISION revprompt = yes [guitool "Rebase/Continue"] cmd = git rebase --continue [guitool "Rebase/Skip"] cmd = git rebase --skip [guitool "Rebase/Abort"] cmd = git rebase --abort [guitool "Pull with Rebase"] cmd = git pull --rebase

Wednesday, January 29, 2014

AngularJS Dependency Injection Cheatsheet

I finally get it. A cheatsheet for AngularJS dependency injection is as follows:

var somethingController = angular.module('What_it_provides', ['what', 'it', 'depends', on']);

somethingController.controller('Name', ['$what', '$it', 'depends', 'on', function('$what', '$it', 'depends', 'on') {
    // implementation, which returns a value, presumably.
}];

The core Angular dependencies (those in ng) are not listed in the angular.module() call, but they are listed in the .controller() call and in the function signature.

The 'What_it_provides' name seems to be used by the dependency injection framework in calls to angular.module(), i.e. the provider name, e.g. SomethingService. But the name would just be Something.
The 'Name' name seems to be used in parameter lists of implementation functions and in calls to controller(), factory(), etc.

See the example from the AngularJS tutorial step 11.

Friday, January 24, 2014

My git alias configuration

[alias]
        tree = log --graph --oneline --decorate
        st = status

Tuesday, December 03, 2013

Remote Desktop Keyboard Shortcuts

There's some cool stuff in here!

From the article:
  • CTRL+ALT+END: Open the Microsoft Windows NT Security dialog box (CTRL+ALT+DEL)
  • ALT+PAGE UP: Switch between programs from left to right (CTRL+PAGE UP)
  • ALT+PAGE DOWN: Switch between programs from right to left (CTRL+PAGE DOWN)
  • ALT+INSERT: Cycle through the programs in most recently used order (ALT+TAB)
  • ALT+HOME: Display the Start menu (CTRL+ESC)
  • CTRL+ALT+BREAK: Switch the client computer between a window and a full screen
  • ALT+DELETE: Display the Windows menu
  • CTRL+ALT+Minus sign (-): Place a snapshot of the entire client window area on the Terminal serverclipboard and provide the same functionality as pressing ALT+PRINT SCREEN on a local computer (ALT+PRT SC)
  • CTRL+ALT+Plus sign (+): Place a snapshot of the active window in the client on the Terminal server clipboard and provide the same functionality as pressing PRINT SCREEN on a local computer (PRT SC)
http://www.mydigitallife.info/keyboard-shortcuts-in-remote-desktop-connection-rdc-for-navigation/

Monday, November 04, 2013

15 Famous Business Books Summarized In One Sentence

Famous Business Book Summaries - Business Insider -- "Want to read 15 famous business books in under a minute?

To save you some time and money, we've made it possible. We boiled down some of the most popular and influential business books out there to their central lessons.

For those looking to bone up on some business theory, here are the highlights."

Monday, July 22, 2013

How to automatically number paragraphs in Word 2007

Finally!

http://www.dummies.com/how-to/content/numbering-headings-in-word-2007-multilevel-lists0.html

The Shauna Kelly site has a 404. At least I think so -- her 404 is so confusing that I'm not even sure I'm looking at a 404. In any case, no instructions are found on her site on how to actually do it.

Monday, April 02, 2012

10 Value Proposition Examples

Next time someone asks you to write value propositions, you can refer to this page for ideas. 10 Value Proposition Examples:

'via Blog this'

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)

image

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

I will expand this later, I swear.

Caution: when you are using strongly typed models in MVC3 and you modify a property of the model in an Action, that property will get discarded when you create the view unless you clear the ModelState first. When building the view, the model fields are overwritten with values from ModelState, so clearing the ModelState prevents this.

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.

Thursday, October 13, 2011

RegExes for replacing MVC3 hard-coded hrefs with @Url.Content hrefs

I'm posting this here mainly as a memory aid for myself.

My app is sprinkled with lots of links like this:
    <script src="../../Scripts/jquery-ui-1.8.11.min.js" type="text/javascript"></script>

I'd like them to look like this, since NuGet seems to be cognizant of such references and apparently changes them on upgrades:
    <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:
This "Replace With" parameter might be better:
"@Href("~\1")"

UPDATE on 11/22/11:
Now, according to this article, I see that Url.Content is supposed to be better anyway.

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

Steve Smith gave a great talk last night at Bennett Adelson's .NET SIG, with many good links. Here's the link to his blog post on it: Common Design Patterns Resources : Steve Smith's Blog

Monday, July 11, 2011

Thursday, June 23, 2011

Cleaning up POSTs in ASP.NET MVC | Jimmy Bogard's Blog

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

I have to do this in a piece of code, so I'm recording this here for my future reference.

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

3 Free E-Books and a Tutorial on Erlang

From ReadWriteWeb: 3 Free E-Books and a Tutorial on Erlang

Date & Time Formats on the Web

Everything you've always wanted to know about date/time formats but were afraid to ask.

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

When attributes are an integral part of the work flow, testing is a bitch. Luckily I found this code.

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

Compiling MVC Views In A Build Environment: "It turns out we had a bug in our project templates in earlier versions of ASP.NET MVC that we fixed in ASP.NET MVC 3 Tools Update.
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

Knock Me Out: "Ideas, thoughts, and discussion about Knockout (KnockoutJS.com) and related technologies (jQuery and jQuery Templates)"

Friday, April 08, 2011

Why I Still L.O.V.E. ASP.NET WebForms - John Katsiotis

This guy uses the Model-View-Presenter (MVP) pattern with ASP.NET WebForms. A Microsoft MSDN link is here; a Martin Fowler article here.

Why I Still L.O.V.E. ASP.NET WebForms - John Katsiotis: "We will use the MVP pattern and the open-source project WebFormsMVP to accomplish that! Can’t wait? Download the sample!"

Thursday, April 07, 2011

Don't mock HttpContext

Don't mock HttpContext: "It's so easy to take a direct dependency on HttpContext and not even realize it. If you're in the code behind in Web Forms or in a controller action in MVC, it's just right there, tempting you to use it to access session variables, application security, etc.

But don't."

Monday, April 04, 2011

dapper-dot-net - Simple SQL object mapper for SQL Server - Google Project Hosting

Wow. Impressive! Great for quick and dirty stuff, no? It uses dynamic types extensively.

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

If you try the following, it should set the visible text of the dropdown control in question, right?
    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

Includes the handy-dandy command: git config --global merge.conflictstyle diff3

Five advanced Git merge techniques : Inside P4: "Five advanced Git merge techniques
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?"

Saturday, March 19, 2011

IIS Express FAQ : IIS Express : Microsoft Web Platform : The Official Microsoft IIS Site

After I relocated an IIS express application, it stopped working. Even though I re-registered it with Visual Studio, it appeared "stuck" in its old location. The problem is that Visual Studio doesn't tell you that it hasn't really done anything at all when it claims that it's successfully registered your app after you've moved it. After reading this FAQ I was able to delete the broken site registration and then re-add it in Visual Studio. To fix my problem, I ran "%userprofile%\documents\IISexpress\config" from the Windows start menu, did a ctrl-F to find the application name, and simply deleted the configuration node.

IIS Express FAQ : IIS Express : Microsoft Web Platform : The Official Microsoft IIS Site: "Q: Does IIS Express use the same configuration system as IIS 7.x?

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)."

Sunday, February 20, 2011

Reimplementing LINQ to Objects: Part 43 - Out-of-process queries with IQueryable - Jon Skeet: Coding Blog

Reimplementing LINQ to Objects: Part 43 - Out-of-process queries with IQueryable - Jon Skeet: Coding Blog

Interesting stuff throughout, but here's the summary at the end:

"This was really a whistlestop tour of the "other" side of LINQ - and without going into any of the details of the real providers such as LINQ to SQL. However, I hope it's given you enough of a flavour for what's going on to appreciate the general design. Highlights:
  • 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

Reimplementing LINQ to Objects: Part 43 - Out-of-process queries with IQueryable - Jon Skeet: Coding Blog

Interesting stuff throughout, but here's the summary at the end:

"This was really a whistlestop tour of the "other" side of LINQ - and without going into any of the details of the real providers such as LINQ to SQL. However, I hope it's given you enough of a flavour for what's going on to appreciate the general design. Highlights:
  • 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

From http://www.measuringusability.com/blog/customers-observe.php:

"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

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:

{E53F8FEA-EAE0-44A6-8774-FFD645390401};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}

Wednesday, February 09, 2011

The perils of using Func instead of Expression in an IQueryable

This is sort of a LINQ 101 thing, but I haven't had much of an opportunity to use LINQ to SQL yet, believe it or not.

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

Friday, January 21, 2011

Scaffold your ASP.NET MVC 3 project with the MvcScaffolding package « Steve Sanderson’s blog

Very cool. This thing will generated CRUD support, list views, etc.

Scaffold your ASP.NET MVC 3 project with the MvcScaffolding package « Steve Sanderson’s blog: "I’ve been working with Scott Hanselman lately on an enhanced new scaffolding package called MvcScaffolding. The term “Scaffolding” is used by many software technologies to mean “quickly generating a basic outline of your software that you can then edit and customise”."

How To Use Amazon EC2 as Your Desktop - RestBackup™ Blog

How To Use Amazon EC2 as Your Desktop - RestBackup™ Blog: "In this article, I describe how I use EC2 as my Linux development desktop. I provide detailed instructions for every step of the setup process. This guide assumes that your client machine is Windows."

Scott Hanselman - Link Rollup: New Documentation and Tutorials from Web Platform and Tools

Scott Hanselman - Link Rollup: New Documentation and Tutorials from Web Platform and Tools:

Michael C. Kennedy's Weblog - 11 Killer Open Source Projects I Found with NuGet

Michael C. Kennedy's Weblog - 11 Killer Open Source Projects I Found with NuGet: "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!

According to him, a static "Helper" or "Util" class is an anti-pattern in a language like C#, which has extension methods, so kill it!

Interesting take. I'd agree that it can greatly reduce the incidence of such classes, yes.

Kill That Util Class!: "According to me a Util class is a sign of misplaced responsibility (a missed opportunity to see an abstraction fulfilling that behavior), resulting in poor OO-ness. Often, utility methods are placed in classes with only static methods and disallow instance creation with new. If you listen carefully, these Utility classes cry out loud, telling you to find a home for the homeless child!"

Saturday, December 11, 2010

The protocol-relative URL

From Paul Irish: The protocol-relative URL: "There's this little trick you can get away with that'll save you some headaches:
<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

This code library is used by the LLBLGen Pro 3.0 designer, so it's stable and tested.

The undo/redo looks intriguing.

Algorithmia Source Code released on CodePlex - Frans Bouma's blog: "One of the main design goals of Algorithmia was to create a library which contains implementations of well-known algorithms which weren't already implemented in .NET itself. This way, more developers out there can enjoy the results of many years of what the field of Computer Science research has delivered. Some algorithms and datastructures are known in .NET but are re-implemented because the implementation in .NET isn't efficient for many situations or lacks features. An example is the linked list in .NET: it doesn't have an O(1) concat operation, as every node refers to the containing LinkedList object it's stored in. This is bad for algorithms which rely on O(1) concat operations, like the Fibonacci heap implementation in Algorithmia. Algorithmia therefore contains a linked list with an O(1) concat feature."

Saturday, December 04, 2010

CODE Magazine - Article: Behavior-Driven Development

Uniting XP, Scrum, and BDD.

CODE Magazine - Article: Behavior-Driven Development: "Extreme Programming and Scrum compliment each other, but they weren’t made from the start to fit together hand in glove. Practicing Extreme Programming and Scrum are more effective when practiced together, and even more effective when practiced together as Behavior-Driven Development."

Wednesday, November 24, 2010

Naïve Bayesian Classification Using C# and ASP.NET

Gonna learn me some Bayesian inference. Maybe.

Naïve Bayesian Classification Using C# and ASP.NET: "THE BAYES RULE

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: Testing Techniques for Applications With Zero Tests: "Agile techniques recommend having adequate unit and acceptance tests to build a robust test harness around the application. However, in the real world, not all applications are fortunate enough to have a test harness. In an interesting discussion on the Agile Testing group, members suggested ways to test applications which do not have any automated tests."

A six-step approach is outlined.

InfoQ: How To Do Large Scale Refactoring

InfoQ: How To Do Large Scale Refactoring: "Refactoring by definition means changing the internal structure of a program without modifying its external functional behavior. This is mostly done to improve the non-functional attributes of the program thus leading to improved code readability and maintainability. However, refactoring on a large scale often gives jitters to even seasoned Agilists. The Agile community discussed some ways of handling the large scale refactoring."

Strangling was mentioned as a good approach.

This article also discusses the Mikado Method, which is kind of interesting.

Tuesday, November 23, 2010

InfoQ: Fulfilling the Promise of MVC

Supposedly the original intent of MVC, which has since been bastardized. Check out his PhD dissertation, linked to in the article.

InfoQ: Fulfilling the Promise of MVC

Monday, November 22, 2010

So You Want to Interview for a Senior Developer Position…. « If & Else

So You Want to Interview for a Senior Developer Position…. « If & Else - "When my last company imploded in an epic fiery crash, I quickly found myself moving from Nashville, TN to Chattanooga, TN to become part of a growing team that was recruiting for several senior positions. While I’m the most recent full-time senior member to come aboard, we are still actively seeking senior level talent. Since August, I have sat through countless phone screens, phone interviews and a handful of in-person interviews as part of that search. To say that it has been eye-opening and disappointing would be an understatement. The opinions and observations I’m about to share are my own – and do not reflect the views of my employer (an employer who has been gracious and generous not only to me, but to many candidates, including the ones they’ve flown in from across the country, covering the cost of travel). I don’t intend for this post to be an exhaustive treatment of “what to ask senior architect or developer candidates in an interview” – consider it more a discussion of “the minimum requirements for someone (including you) interviewing for a senior developer or architect position”. I genuinely do not mean to come across as the ‘grumpy, impossible to please’ developer/architect. My frustration will be evident, though, so at least that’s out in the open…."

Saturday, November 20, 2010

10 Steps To Become Better .NET Developer - Blog - CQRS and Cloud Computing

10 Steps To Become Better .NET Developer - Blog - CQRS and Cloud Computing: "Here's a list of things you might want to learn about in order to become a better .NET developer. Better developers are eligible to higher paychecks, exciting projects and more freedom in their lifestyles."

Thursday, November 11, 2010

Jurassic - A Javascript Compiler for .NET

Might this come in handy some day?

Jurassic - A Javascript Compiler for .NET: "What is Jurassic?

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

I'm a cheap bastard without a Mac, so ...

Building iPhone Apps with HTML, CSS, and JavaScript: "If you know HTML, CSS, and JavaScript, you already have what you need to develop your own iPhone apps. With this book, you'll learn how to use these open source web technologies to design and build apps for both the iPhone and iPod Touch. Buy the print book or ebook or purchase the iPhone App"

Saturday, November 06, 2010

Git Source Control Provider

I'll have to try this out too.

Git Source Control Provider: "Visual Studio users are used to see files' source control status right inside the solution explorer, whether it is SourceSafe, Team Foundation Server, Subversion or even Mercurial. This plug-in integrates Git with Visual Studio solution explorer."

FsCheck: A random testing framework

I'll have to check this out.

FsCheck: A random testing framework: "FsCheck is a tool for testing .NET programs automatically. The programmer provides a specification of the program, in the form of properties which functions, methods or objects should satisfy, and FsCheck then tests that the properties hold in a large number of randomly generated cases. While writing the properties, you are actually writing a testable specification of your program. Specifications are expressed in F#, C# or VB, using combinators defined in the FsCheck library. FsCheck provides combinators to define properties, observe the distribution of test data, and define test data generators. When a property fails, FsCheck automatically displays a minimal counter example."

Wednesday, November 03, 2010

Mockingbird

New (?) UI mockup tool similar to Balsalmiq and another one I can't remember.

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

I have to create some email templates for use by (gulp) classic ASP. I thought I'd do a bit of reading on templates in order for (1) my template tag convention to be inspired by existing templates and thus be future-friendly, and (2) perhaps if I'm lucky, to find a template I can actually use on the server itself. (PURE, mentioned below, might be a candidate.)

A few thoughts on jQuery templating with jQuery.tmpl | Encosia: "I spent some quality time with Dave Reed’s latest revision of John Resig’s jQuery.tmpl plugin recently, migrating a small project from jTemplates. Since both the jQuery team and Microsoft team have requested feedback on jQuery.tmpl, I decided to write about my experience using it (as I am wont to do with these templating proposals).
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."

He mentions that it lacks composability, but this article is from May. Has Microsoft added it since then?

From the comments, a few more libraries to consider:
Spark - the new hotness, apparently. Included with the latest Microsoft MVC, if I'm not mistaken.
PURE - seems more decoupled than the others, but at first glance it doesn't seem to support to ubiquitous "${}" convention.

I'm still reading. This is kind of a brain dump for further research at some point when I have more time (i.e. when hell freezes over).

Monday, October 11, 2010

Teach Visual Studio Your Own Language -�Easy! - Journal - Rinat Abdullin

Teach Visual Studio Your Own Language -�Easy! - Journal - Rinat Abdullin: "In this article we'll see how simple it is to extend Visual Studio with a custom language. This language will have a real syntax that will be evaluated and transformed into the C# code on-the-fly, saving a few lines of repetitive code!"

BDD, Fluent Interface Generator, and a new .NET 3.5 Parser generator

StoryQ uses a fluent interface generated by Flit, the Fluent Interface Toolkit, which is turn was developed using Irony, a new development kit for writing parsers in .NET. (However, the last release was almost exactly a year ago, so who knows what's up with it?)

Tuesday, October 05, 2010

Javascript Libraries and ASP.NET: A Guide to jQuery, AJAX and Microsoft - Articles - MIX Online

Javascript Libraries and ASP.NET: A Guide to jQuery, AJAX and Microsoft - Articles - MIX Online: "When Microsoft announced they would begin providing official support for jQuery, few of us realized how profoundly that announcement would eventually impact client-side development on the ASP.NET platform. Since that announcement, using jQuery with ASP.NET has moved from the obscure, to a central role in ASP.NET MVC’s client-side story, and now to the point of potentially superseding ASP.NET AJAX itself."

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."

Thursday, September 09, 2010

jQuery Grid Recommendations - Stack Overflow

jQuery grid reference from StackOverflow:

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."