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