angular js calling services twice – Angular JS

Hey everyone,

I had a few of my AngularJS services being called twice. The issue turned out to be that I’d added a controller to both my route and my view:

app.config(function ($routeProvider) {
    $routeProvider
		.when('/', {
		    controller: 'ProjectsController', /* <---- here */
		    templateUrl: '/Home/Home'
		})
<div>
    <ul ng-controller="ProjectsController"><!-- <-- here -->
        <li ng-repeat="project in projects">
            <b>{{project.Name}}</b>
        </li>
    </ul>
</div>

Removing it from the controller resolved the issue. Check out the following StackOverflow post for more info: http://stackoverflow.com/a/15535724/522859

Error: $injector:modulerr Module Error – AngularJS

Hey everyone,

Just getting back into angularjs and I came across the following error:

Unknown provider: $routeProvider

It turns out I that while I had included the route provider file I had missed adding it to the app:

 
//Original
var app = angular.module('commandsApp', [']);
 
//Fixed
var app = angular.module('commandsApp', ['ngRoute']);

Check out the following links if you’re still having issues:
http://plnkr.co/edit/zbG9Vycrxk6mmlzwfTRm?p=preview
https://docs.angularjs.org/api/ngRoute/provider/$routeProvider

TF30063: You are not authorized to access asxproject – TFS Online/Visual Studio

Hey everyone,

I ran into the following issue while trying to install the HTML Agility Pack via Nuget today:

TF30063: You are not authorized to access asxproject…

This fixed it for me:
– Go to “Team Explorer”
– Up the very top click on the “Connect to Team Projects” button (power cable looking icon next to the home button)
– Right click on the project and then click connect

Once connected, everything seemed to start working for me again. Check out this stackoverflow post more info: http://stackoverflow.com/a/16700451/522859

The installer has encountered an unexpected error installing this package.This may indicate a problem with this package.The error code is 29506 – SQL Server Management Studio

Hey everyone,

I ran into the following error while trying to install Sql Server Management Studio on Windows 8:

The installer has encountered an unexpected error installing this package.This may indicate a problem with this package.The error code is 29506

To fix it, all you need to do is run the exe with administrative privileges.

Repeat a character x times with c#

Hey everyone,

Just a neat little trick I came across on Stackoverflow, repeating a character x times without using a loop:

string result = new String(‘x’, 5); //xxxxx
string result = new String(‘a’, 3); //aaa

Check out the original post for more info: http://stackoverflow.com/a/3754700/522859

oldIndex must be a valid index in the Children collection (Visual Studio)

Hey everyone,

Just posting this in case anyone else runs into it. After unshelving, the following error kept popping up when I tried to open files using the solution explorer:

oldIndex must be a valid index in the Children collection
Parameter name: oldIndex
Actual value was -1.

I’m still not sure what caused it, but restarting visual studio seems to have fixed it.

Unable to Start Apache – Xampp

Hey everyone,

I was mucking around with xampp this morning and ran into the following issue with apache:

3:41:52 PM [main] Initializing Control Panel
3:41:52 PM [main] Windows Version: Windows 8 Pro 64-bit
3:41:52 PM [main] XAMPP Version: 5.6.3
3:41:52 PM [main] Control Panel Version: 3.2.1 [ Compiled: May 7th 2013 ]
3:41:52 PM [main] You are not running with administrator rights! This will work for
3:41:52 PM [main] most application stuff but whenever you do something with services
3:41:52 PM [main] there will be a security dialogue or things will break! So think
3:41:52 PM [main] about running this application with administrator rights!
3:41:52 PM [main] XAMPP Installation Directory: “c:\xampp\”
3:41:52 PM [main] Checking for prerequisites
3:41:52 PM [main] All prerequisites found
3:41:52 PM [main] Initializing Modules
3:41:52 PM [Apache] Problem detected!
3:41:52 PM [Apache] Port 80 in use by “Unable to open process” with PID 7820!
3:41:52 PM [Apache] Apache WILL NOT start without the configured ports free!
3:41:52 PM [Apache] You need to uninstall/disable/reconfigure the blocking application
3:41:52 PM [Apache] or reconfigure Apache and the Control Panel to listen on a different port
3:41:52 PM [Apache] Problem detected!
3:41:52 PM [Apache] Port 443 in use by “Unable to open process” with PID 7820!
3:41:52 PM [Apache] Apache WILL NOT start without the configured ports free!
3:41:52 PM [Apache] You need to uninstall/disable/reconfigure the blocking application
3:41:52 PM [Apache] or reconfigure Apache and the Control Panel to listen on a different port

In order to fix this, you can just kill the process that is blocking the port. Unfortunately I had IIS on this and needed another solution. As always, stackoverflow had the answer:

– In the xampp control panel, click config (same line as apache) and open the httpd.conf file
– Search for listen 80 and change it to list 8080 (or an alternative free port)
– Save and close the file
– In the xampp control panel, click config (top right)
– Click service and port settings and change the main port (and ssl if necessary) to match your httpd.conf file
– Click save and restart apache (note you may also need to run as administrator)

Check out this link for more info: http://stackoverflow.com/a/25113205/522859

Resources for Mocking WCF

Hey everyone,

Just a few links I came across for mocking WCF in case anyone else needs them.

This tutorial was great: http://weblogs.asp.net/cibrax/unit-tests-for-wcf

The only issue being that it was missing a few class definitions (IIncomingWebRequestContext and IOutgoingResponseContext). I got lucky and was able to find full code samples at the following links:

https://code.google.com/p/netfx/source/browse/trunk/Source/ServiceModel/Web/IIncomingWebRequestContext.cs?r=18

http://netfx.googlecode.com/svn-history/r28/trunk/Source/ServiceModel/Web/Wrappers.cs

Just in case these links ever go down:

http://pastebin.com/CjUMwhsG
http://pastebin.com/F1Fj9eRC

No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient’ – MVC5

Hey everyone,

Just an error I came across while trying to use a new solution project:

No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient’

The fix for this was simply to run the following command in the package manager console:

1
PM> Install-Package EntityFramework

Thanks to StackOverflow for the details: http://stackoverflow.com/a/18642452/522859