Thursday, March 13, 2014

SPNs required when using Kerberos auth for Windows Auth on an Asp.net website

To use Kerberos authentication

  • Internet Explorer security settings must be configured to enable Integrated Windows authentication. To enable the browser to respond to a negotiate challenge and perform Kerberos authentication, select the Enable Integrated Windows Authentication check box in the Security section of the Advanced tab of the Internet Options menu, and then restart the browser.

image

  • If a custom service account is used to run the ASP.NET application, then a Service Principal Name (SPN) must be registered for the account in Active Directory.

To register an SPN, use the Setspn.exe utility by running the following commands from a command prompt:

setspn -A HTTP/webservername domain\customAccountName

setspn -A HTTP/webservername.fullyqualifieddomainname domain\customAccountName

Thursday, February 13, 2014

Disabling ChromeDriver logging output

I was trying to figure out how to turn of the logging that the Selenium ChromeDriver was performing and had a hard time doing that.

Chrome Driver Logging Output

I finally figured out how to do it with the following code (the key line of code is highlighted):

		private IWebDriver CreateChromeDriver()
		{
			ChromeOptions chromeOptions = new ChromeOptions();
			chromeOptions.AddArgument("--log-level=3");
			return new ChromeDriver(chromeOptions);
		}
 

Saturday, December 21, 2013

Installing Amazon App-Store on Google Nexus 7

I wanted to use the Amazon app-store on my Google Nexus 7 tablet (mainly because I already have quite a few apps that I have bought for a previous Kindle Fire). So here is how to get the amazon app store on your Nexus device.

First, you need to enable installing of apps from stores other than the Google Play Store. To do this, go to Settings and  select Security. Under Device Administration, make sure “Unknown Sources” is selected.

Second, install the Amazon App Store. To do this, down the “apk” file from Amazon from: http://www.amazon.com/gp/mas/get-appstore/android/ (There is additional information on Amazon’s page).

Thursday, December 12, 2013

CRM 2011–MSCRMKeyGenerator– Key not being regenerated correctly

Recently in a dev environment, when I tried to bring up our CRM environment, I was getting the following error:

image

Not very helpful. But if I look at the URL:

http://xxxxx/orgname/_common/error/errorhandler.aspx?BackUri=&ErrorCode=0x8004A106&Parm0=CrmKey%28Id%3aaa{GUID}%2c%20ScaleGroupId%3a00000000-0000-0000-0000-000000000000%2c%20KeyType%3aCrmWRPCTokenKey%2c%20Expired%3aTrue……

So there is certainly something weird going on here.

Looking at the application logs in the event viewer I found the following error:

Current key (KeyType : CrmWRPCTokenKey) is expired.  This can indicate that a key is not being regenerated correctly.  Current Key : CrmKey(Id:GUID, ScaleGroupId:00000000-0000-0000-0000-000000000000, KeyType:CrmWRPCTokenKey, Expired:True, ValidOn:11/03/2013 17:47:19, ExpiresOn:12/06/2013 17:47:19, CreatedOn:11/03/2013 17:47:19, CreatedBy:NT AUTHORITY\NETWORK SERVICE.

After some googling, I found that the reason for this was that the “Microsoft Dynamics CRM Asynchronous Processing Service” may not be running. Which indeed was true in my case. But, after restarting the service, it still was not working.

The final thing that I had to do was issue an iisreset against the server hosting CRM.

Tuesday, December 10, 2013

Custom Rules in Fiddler

I needed to setup a filter in Fiddler so that I could view only JSON requests being made from my application. The default filter doesn’t allow for viewing only JSON requests. But luckily Fidller allows you to setup custom rules. Here is what I did:

Within the class “Handlers” add the following lines of code:

public static RulesOption("Display Only &Json Requests")
var m_bShowOnlyJsonRequests: boolean = false;

The above lines will add a Menu option under rules, that will easily allow you to turn on or off the JSON filtering.

image

Next, within the method: static function OnBeforeRequest(oSession: Session), add the following lines of code:

if (m_bShowOnlyJsonRequests && oSession.oRequest["Content-Type"] != "application/json"){
                oSession["ui-hide"] = "true";
          }

The above lines of code allow filters to display only those sessions that have a content-type header set to “application/json”.

As simple as that!

Notes:

1. The biggest problem that I have found is that there is hardly any documentation regarding the methods and properties available within the script file or off the oSession object (which is of type Session).

2. I think the script is based of JScript. I just wrote my code to resemble C# and it worked for my simple filter.

3. Samples from FiddlerBook site: http://fiddlerbook.com/Fiddler/dev/ScriptSamples.asp

4. Fiddler Script Editor is a pretty good tool that can help writing complex rules (it provides some documentation, though it wasn’t always helpful). http://fiddler2.com/fiddlerscript-editor

5. More Samples: http://fiddler2.com/documentation/KnowledgeBase/FiddlerScript/ModifyRequestOrResponse

6. Session object properties/flags: http://fiddler2.com/documentation/KnowledgeBase/SessionFlags

Tuesday, October 15, 2013

MSBUILD : error MSB1005: Specify a property and its value.

I was getting the following error from MS-Build:

MSBUILD : error MSB1005: Specify a property and its value.
Switch: /p:Deploy=true;DeployToEnvironment=es1ci;Configuration=Debug;UsingNUnit=true;

The problem turned out to be the last “;”. Apparently MsBuild doesn’t like it!. Took it out and MsBuild was able to run!

Thursday, October 10, 2013

Work Ethic–17 things you should never say to your boss

I came across this article on LinkedIn recently and found it interesting as, in a way, it kind of tells you what someone with good work ethics would not do or say at work. (its based on answers given by bosses at some new technology companies). I wish more people would read this.

Read it at: http://www.linkedin.com/today/post/article/20130923134035-15077789-17-things-you-should-never-say-to-your-boss

17 Things You Should Never Say to Your Boss

1. 'I Am Just Here for the Money'

In China, it is very common for a lot of employees to work just for the money. This means they will leave if you fail to give them a raise or if their peers start to make a lot more money than they do. Our interview process has filtered this as much as possible but if we hear through the "grapevine" that the person is just doing the job for the money we will let them go very quickly.

- Derek Capo, CEO and Founder, Next Step China

2. 'You Never Told Me to Do It'

When something important doesn't get done, the worst thing you can say is, "You never asked me to do it." There are few better ways to neglect yourself of that promotion, a raise, or even job security.

- Ken Cauley, President, Advanced Media

3. 'There's Something Wrong'

It's easy to complain about what's wrong. It's hard to come up with solutions to fix the problem. My former manager at LivingSocial said, "Be a problem solver, not spotter," and I've taken this advice to heart in my everyday life. If you see a problem, don't address the situation with what's wrong; address the situation with an answer. If you don't have a real solution, wait until you do.

- Sarah Ware, Markerly

4. 'I Want to Do What's Easiest'

We have a client who had an employee literally explain that he would rather do a particularly menial task than the task that the employer had assigned because it would be easier for him. We were shocked. This is the most explicit way to alert your boss that you don't care about improving your skill set without directly telling him. Never do this if you care about your career!

- Patrick Conley, Founder / CEO, Automation Heroes

5. 'That Takes Up Too Much Time'

Through the years, we have had many operational restructurings that have required large amounts of data to be filtered and edited or re-formatted in some manner. There's nothing worse than an employee who complains about the amount of time required to move the company to the next level.

- Laura Land, CFO / COO, Accessory Export, LLC

6. 'I Could Be Doing Other Things'

Bratty much? Don't complain about your job. If you hate it, quit. If there's something wrong with it, find a way to fix it. If someone or something is really ticking you off, don't project your anger onto others, especially not your boss. If it's a good job, be grateful for it. If you want more out of your job, make it happen. Be diplomatic about it and make it your dream job, or leave.

- Danny Wong, Co-founder, Blank Label

7. 'I Promise to Do That'

Don't ever tell your boss you're able to do something if you know you may not be able to deliver. It is better to be honest, ask for advice and have a proactive attitude. If you fail to deliver, then it has negative repercussions for the business, which is taken much more seriously.

- Christopher Pruijsen, Co-Founder / Partnerships, Afrostart.io

8. 'It's Too Difficult'

I get fired up when someone is paralyzed and doesn’t complete a task because it’s difficult or because few others have done it. We’re a disruptive company that has to innovate, that has to do things few have done before us. One of my advisors here has a quote: “If it were easy, everyone would be doing it.” We won’t win if we don’t think big.

- Marcos Cordero, Chief Gradsaver, GradSave, LLC

9. 'I Agree to Disagree'

Whether it is said explicitly or passive-aggressively, this mindset has no place in startup culture. Those who have this mindset should either found their own startups or go work in big corporate America where this goes unnoticed. At a startup, you're either all the way in or all the way out.

- Danny Boice, Co-Founder & CTO, Speek

10. 'I Don't Have an Opinion'

The people who just sit and nod their heads are the ones who are expendable. If you want to make an impression as a valuable member of the team, offer your insights. No one ever agrees with his boss 100 percent all the time, so make your opinion known if you have something worth saying.

- Nick Friedman, President, College Hunks Hauling Junk and College Hunks Moving

11. 'I Can't'

I don’t want to hear excuses ever! We focus on hiring can-do, positive, creative employees with passion, drive and determination.

- Kuba Jewgieniew, Founder and CEO, Realty ONE Group

12. 'I'm Not Optimistic'

The most important thing for any team member is to stay optimistic. Being a pessimist and doubting the future of the company is a real downer. There is nothing wrong with being realistic; however, people who are melancholy suck the life out of an early-stage company and cannot last long.

- Raoul Davis, CEO, Ascendant Group

13. 'I'm Clocked Out'

There is nothing more discouraging to an entrepreneur than when an employee says he is not willing to go the extra mile because he isn't "clocked in." We remind our employees that they work for a young company and they are in control of their own careers. Acting within the status quo never gets you to the top!

- Darren Solomon, President, Kid Ventures

14. 'That's Not My Responsibility'

It’s critical that everyone feels invested in the success of all areas of the business. Everyone should be willing to pitch in, even if what’s required isn’t part of their normal day-to-day activities.

- Robert J. Moore, Co-Founder and CEO, RJMetrics

15. 'That's Not My Job'

Your responsibilities aren't limited to what was listed in your original job description -- especially at a startup. Unless your boss is asking you to do something illegal or unethical, you should do it.

- Mary Ellen Slayter, Founder/Managing Director, Reputation Capital

16. 'I Don't Like Working for Other People'

An employee actually told me that he didn't like working for other people. That person doesn't work for me anymore!

- Andrew Angus, CEO, Switch Video

17. 'I'm Not Working Hard'

I never want to know that someone who works for me isn’t working hard. People can disagree with me, and I’m fine to hear criticism. I’ll never lose respect for anyone because he disagrees with me or because they failed. I don’t want to know if someone is giving less than their best effort or that someone lied. I have high expectations of people when it comes to their work ethic.

- Dries Buytaert, Co-founder and CTO, Drupal

Monday, September 16, 2013

CRM 2011–Plugin Registration Error: Assembly must be registered in isolation

While registering a CRM 2011 plugin I kept getting the following error in only one of our test environments.

Assembly must be registered in isolation

After a lot of searching I found out that the reason I was getting this error in only one environment was that I was not designated as a “Deployment Administrator”. Once I had that fixed, the error went away!

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Action failed for assembly xxxxxxxxx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=yyyyyyy': Assembly must be registered in isolation.

Friday, September 06, 2013

What We Actually Know About Software Development, and Why We Believe It's True

A very good presentation on how we can make the field of software engineering better by Greg Wilson: http://vimeo.com/9270320. He also brings up some thought provoking data-points:

Greg Wilson - What We Actually Know About Software Development, and Why We Believe It's True from CUSEC on Vimeo.

From the slides in the presentation:

  • Most errors are introduced during requirements analysis and design. Not during writing and debugging. The later a bug is removed, the more it costs to remove. (Boehm (1975))
  • For every 25% increase in problem complexity, there is a 100% increase in solution complexity. It's non-linear because of interaction effects.  (Woodfield (1979))
  • The two biggest causes of project failure are poor estimation and unstable requirements, neither of which seem to be improving in the industry as a whole. (van Genuchten (1991))
  • If more than 20-25% of a component has to be revised, it's better to rewrite it from scratch. (Thomas et al. (1997))
  • Hour for hour, sitting down and reading the code is the most effective way to remove bugs. It's better than running the code and better than writing unit tests. 60-90% of all errors can be removed before the very first run of the program. BUT, all of that value comes from the first hour by the first reviewer. You can only read code for an hour before your brain is full - only a couple hundred lines of codes depending on skill / practice. This means we should have small patches and changes. (Fagan (1975))
  • The architecture of the system reflects the organizational structure that built it. (Herbsleb (1999))
  • Physical distance between a team of developers doesn't affect post release fault rate. Distance in the org chart does. Thus, it's fine to have people remote as long as they are on the same team, just don't put developers working under different people on the same project. (Nagappan (2007) & Bird (2009))
  • No code (or other) metrics that were published before 2001 have any correlation with post-release error rate beyond that predicted by source lines of code (SLOC). (El Emam (2001))
  • When estimating the time it will take to complete a project the only thing that matters in the spec for the project is how long the writer of the spec thinks it will take (ie. the anchoring effect from psychology). "All work done to date on software estimation is pretty much pointless. All the engineers are going to give us back is what we want to hear." (Aranda & Easterbrook (2005))

Monday, August 12, 2013

WPF–Creating a single instance application

I wanted to make my WPF application such that only a single instance of it could run at a time. I found that there were 2 main ways demonstrated on the internet:
1. Use “Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase” and setup the “OnStartupNextInstance” to activate the first instance of the application. or
2. Use Mutex to ensure only a single instance of a program can be run at time. (Which is the accepted answer on StackOverflow. http://stackoverflow.com/a/522874/44815).
I wanted to use the Mutex method, though the article referenced in the StackOverflow answer - “C# .Net Single Instance Application” does not give all the details that one has to implement for a WPF application, so here is some more detailed info:

1. Add a Mutex to the “App” class
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App
{
 /// <summary>
 /// This should be a unique name which is used to determine if another instance of app is running
 /// </summary>
 private const string APP_UNIQUE_NAME = "UNIQUENAME_FOR_MY_APP or use a GUID";
  /// <summary>
  /// Initializes the Mutex class and make the calling thread have initial ownership of the mutex
 /// and a string that is the name of the mutex.
 /// </summary>
 static readonly Mutex _mutex = new Mutex(true, APP_UNIQUE_NAME);


2. Add a Main method to the “App” class, which will act as the entry point for the application and will signal the mutex to wait until its released
[STAThread]
static void Main()
{
//using TimeSpan.Zero as we want the mutex to test state of wait handle and return immediately
 if (_mutex.WaitOne(TimeSpan.Zero, true))
 {
 //calling waitone stops everyone else from entering the code in this block until the mutex is released
  try
  {
   App app = new App();
   app.InitializeComponent();
   app.Run();
  }
  finally
  {
   _mutex.ReleaseMutex(); 
  }
 }
 else
 {
  MessageBox.Show("Only one instance of the app can be run!","App Name",MessageBoxButton.OK, MessageBoxImage.Exclamation);
 }
}
3. Setup the WPF application to use the “Main” method as its entry point
a. Right click on the application’s project file and select properties. On the tab “Application”, set the “Startup object” to the name of the “App” class we modified above.
b. Right click on the “App.xaml” file in your project and select properties. Change the “Build Action” to “Page” from “ApplicationDefinition
4. Build and test the application!