Tuesday, November 24, 2015

"Source control provider could not be initialized" in Dexterity

In Dexterity I open Options > Source Control > and change the Provider = Team Foundation Server 2010. I point the RootDirectory to the local folder I pulled down from TFS. Then i click Projects and get the error "Source control provider could not be initialized"

1. Windows 10
2. Visual Studio 2015
3. GP2015R2
4. Dex 14.00.84

1. Made sure security was set to Everyone on the RootDirectory
2. Turned off Firewall
3. Ran as administrator
4. Double-checked that Team Explorer 2010 was installed

After double-checking all of this stuff I still had the error. Eventually I ran Process Monitor on a computer where it was working and the new computer where it wasn't working, filtered for Process Name = Dex.exe, then got Dex to a point where I could just click on "Projects" in source control and clicked it. 

The first line in Process Monitor where it differentiates is when it tries to load this file:
C:\Users\<USER>\AppData\Local\Microsoft\Team Foundation\3.0\Cache\7553ef4f-f18b-4db8-b064-7a31ae2040f9\LocationServiceData.config

I looked on the new computer that's not working and checked folder C:\Users\<USER>\AppData\Local\Microsoft\Team Foundation\3.0\Cache\
and noticed that it was empty. 

So I tried copying the data from the working computer to the new computer. The two computers have the same folder structure, and they're using the same source control, so I figured why not? Well, IT WORKED!

Subsequent error
After copying the Cache folder from a working environment, it made Dex's source control work. However, when trying to do a lock/checkout on a file it's crashing Dex with a vague error that says
Faulting application name: Dex.exe, version:, time stamp: 0x55510397
Faulting module name: KERNELBASE.dll, version: 10.0.10240.16384, time stamp:

1. Install VS2010
2. Install VS2010 SP1
3. Cut&Paste files from C:\Users\<USER>\AppData\Local\Microsoft\Team Foundation\3.0\Cache\ into a folder, just in case
4. Open VS2010
5. Connect to TFS
6. Pull down the Dex root folder. This populates the Cache folder with valid files.
7. Open Dexterity, set the source control, do a Lock on a file to make sure it's working

Sunday, November 15, 2015

JSON web request using Python

Get the requests module
If you don't already have the requests module, follow these steps:
1. Download the requests module ZIP. Here's a direct link to the ZIP: https://github.com/kennethreitz/requests/archive/master.zip

2. Unzip

3. Copy and paste the "requests" folder to C:\<python installation folder>\Lib\
Note: I'm using python 2.6, and my installation folder is C:\Python26

Source: https://www.youtube.com/watch?v=Ng5T18HyA-Q 

The explanation of what it's doing
#I'm using the Yahoo API to request the USD:EUR exchange rate
#It's passing back json format
#so i'm using a json decoder from the requests object
#then i'm navigating the dictionary of dictionaries to get to the exchange rate
#Note: There's no error handling or anything, this is just to show a simple example of how to do a web request in python

The Code
import json import requests #Get exchange rates req = requests.get('http://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.xchange where pair in ("USDEUR")&format=json&env=store://datatables.org/alltableswithkeys') res = req.json() exchangeRate = float(res["query"]["results"]["rate"]["Rate"]) #Get euros euros = float(raw_input("How many euros?")) #Convert USD = (euros * exchangeRate) #Output print """ Exchange rate: {0} Euros: {1} USD: {2} """.format(exchangeRate, euros, USD)
There was an error in this gadget