Jan 29 2014

HTTP Proxy Per Git Repository

Published by under Programming

I’ve finally made the switch to using Git instead of Subversion as the source control system at work.  I’ve been using it for a while with a couple of personal projects that I’ve got hosted on BitBucket using the wonderful SourceTree, created by my friend Steve Streeting, and I’ve come to prefer it to Subversion. At work, I set up a Stash server and have been syncing our Subversion repository into it for a while but never quite made the jump to Git until now.

The first hurdle I’ve hit is with proxy settings.  On my development machine I’ve got cloned BitBucket repositories and to be able to use those I need to connect through a proxy.  Thankfully SourceTree makes it easy to configure Proxy settings for Git.  However, these are system wide settings.  Now that I want to work with our internal Stash server I need Git to use the proxy for some repositories but not for the internal one.

Given that I’ve got lots of external repositories but only one internal repository I’ve left the Git default settings to use the Proxy server.  Unfortunately SourceTree doesn’t help with specifying a proxy for a single repository but it’s not hard.

  • Open the local repository in Explorer and head into the .git directory (you may need to show hidden files & folders)
  • Open up the config file in your favourite text editor
  • At the bottom of the [core] section of settings add the following:
    [http]
        proxy =
  • Save the config file.

That’s all there is to it.  You don’t even need to restart SourceTree for it to pick up the change.  This change is basically telling Git not to use a Proxy for this repository.  Alternatively, on the “proxy =” line you could specify a proxy to use, e.g. if you have lots of internal repositories and only one external then it would be easier to default the global settings to no proxy and only specify a proxy for just one repository.

Hope this helps!

No responses yet

Nov 14 2012

Beating CRM2011 Anti-XSS with a Web Resource Shim

Published by under Microsoft CRM

Background

In Microsoft Dynamics CRM we’ve got several places that documents relating to an account can be uploaded to SharePoint.  Some are custom solutions developed whilst we were using CRM4 and others are using the built-in CRM2011 SharePoint integration.

To keep things simple for users, I have created a SharePoint web part that allows them to see a consolidated view of documents relating to each account.  This web part has a menu against each document that allows users to open the record that the document was uploaded against.

The Problem

Previously, I was just opening the CRM record in an Internet Explorer (IE) window and everything was fine.  However, now CRM has got a nifty Xrm.Utility.openEntityForm() JavaScript function that will open entity forms in either an IE or Outlook window, depending on which client the user is using to access CRM.

If you are using a CRM Web Page WebResource, you’ve got the option of either including ClientGlobalContext.js.aspx or using parent.Xrm to access the Microsoft Xrm JavaScript object model.  Unfortunately, Crm is on one website address and SharePoint is another website address.  Therefore, although SharePoint is being displayed in CRM using an iFrame, Anti-XSS (Cross Site Scripting) prevents the use of parent.Xrm in the SharePoint page.

The Solution

Given that the Xrm JavaScript object model needs to be used from a page in CRM the solution I came up with is to use a WebResource html page that will act as a shim for SharePoint:

!DOCTYPE html>
<html>
<head>
    <title>Xrm Shim</title>
    <base>
    <script type="text/javascript" src="../ClientGlobalContext.js.aspx"></script>
    <script type="text/javascript" src="../c5_javascript/lib/jquery.min.js"></script>
    <script type="text/javascript">
        $(function () {
            var data = Xrm.Page.context.getQueryStringParameters();
            Xrm.Utility.openEntityForm(data.typename, data.id);
        });
    </script>
    <meta charset="utf-8">
</head>
<body>
</body>
</html>

I then updated my SharePoint web part to run the following script when the user clicks the CRM Record menu item:

crmRecordMenuItem.ClientOnClickScript =
    string.Format(@"ifrm = document.createElement('IFRAME');
        ifrm.setAttribute('src', '{0}/{1}/WebResources/xrmshim.htm?typename=%DocTypeName%&amp;id=%CRMDocID%');
        ifrm.style.width = 1+'px';
        ifrm.style.height = 1+'px';
        document.body.appendChild(ifrm);", crmUrl, crmOrgName);

This creates an iFrame that loads from html shim from CRM which in turn calls Xrm.Utility.openEntityForm using the typename and id passed from SharePoint in the query string parameters.

The shim is simple enough that it can be used on any page that is hosted on any site other that CRM.  It could be extended to call any Xrm object model methods provided by ClientGlobalContext.js.aspx.

No responses yet

Aug 16 2012

Camp fire somewhere in the Jura region of Switzerland :-)

Published by under General

via Instagram http://instagr.am/p/OYVQBtPF2C/

No responses yet

Aug 14 2012

Ein beir im Kandersteg

Published by under General

via Instagram http://instagr.am/p/OTXWWqvF3r/

No responses yet

Aug 11 2012

Dinner by Lake Como, Italy

Published by under General

via Instagram http://instagr.am/p/OMrNeRvF1t/

No responses yet

Aug 02 2012

Awesome! #iwantoneofthose

Published by under General

via Instagram http://instagr.am/p/N1mUsrPF3y/

No responses yet

Jul 29 2012

Sometimes I think I spoil @therealjackcat!

Published by under General

via Instagram http://instagr.am/p/Nql9FgPFwg/

No responses yet

Jul 07 2012

Sailors cooking up a storm @GsyWalledGarden

Published by under General

via Instagram http://instagr.am/p/MxjxrMPF2A/

No responses yet

Jul 07 2012

2 Hungry Sailors are in @GsyWalledGarden again this morning :-)

Published by under General

via Instagram http://instagr.am/p/MxhwhqvF1h/

No responses yet

Jun 29 2012

Home grown (except pie) post-workout feast!

Published by under General

via Instagram http://instagr.am/p/MeIsXAvF0W/

No responses yet

Next »