Monday, October 26, 2009

Microsoft Security Essentials and SourceGear Vault

Lately I've been having problems using Source Gear Vault version 4.1.4
I've never had any problem like this with Vault so i started thinking what did I install on the last days. The answer was Microsoft Security Essentials.

I was getting this ugly error message:
Getting latest version of files
Local file update for $/MyFile.cs failed: System.UnauthorizedAccessException: Access to the path 'C:\Users\genwise\AppData\Local\Temp\tmpC692.tmp' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.Delete(String path)
at VCDiff.VCDiff.Apply()
at VaultClientOperationsLib.WorkingFolder.UpdateHiddenFileContentsFromDelta(VaultClientFile file, String deltaFile, Int64 baseVersion, Int64 targetVersion, UInt32 targetCRC, Int64 targetSize)
at VaultClientOperationsLib.UpdateThread.ProcessCommand(UpdateThreadCommand command, UpdateThreadCommandResult& outputResult)


Luckily they guys at Microsoft included a nice option to exclude certain files and folders. Thanks to this I was able to get rid of this problem ( I am not a security export so i hope I didn't open a Pandora Box with this change..)

Sunday, October 11, 2009

IIS 64bits and Oracle 32bits

At the office we have new i7 machines with 64bit OS.
I've spent 2hs to find a solution to this problem so it's worth blogging about it.

I had a DNN site using my own BOLayer which in turn used Oracle (10.2)

I was getting this error on IIS : "the provider is not compatible with the version of Oracle client"

Tried almost everything until I've noticed a nice option in the IIS Application pool advance settings:
"Enable 32-Bit Applications" which weirdly enough was configured as false (default value).





Thursday, October 8, 2009

Google Translate API for .NET 0.3

We use localization in some of our WPF projects and I was wondering how easy would be to integrate the Google Translate API. I must say it has been unbelievable easy to use it! Check the code below:


using Google.API.Translate;
using NUnit.Framework;
 
namespace GoogleTranslation
{
    [TestFixture]
    public class GoogleTransationFixture
    {
        [Test]
        public void TranslateTest()
        {
            var client = new TranslateClient("test");
            var result  = client.Translate("casa", Language.Spanish, Language.Dutch);
            Assert.IsNotEmpty(result);
            Assert.AreEqual("huis", result);
        }
    }
}

Thursday, February 26, 2009

Creating RibbonTab programatically

I've spent several hours on this issue so it's worth document it just in case it might help someone out there...

When using CWPF (aka Prism) in combintation with the RibbonControlsLibrary I was having a weird problem that my RibbonTabs created "inside" the Prism Modules where loosing it's bindign context and therefore the icon/text was gone (the 2nd time).


Both  Bartek Szafko and Joachim Kerschbaumer articles explain very nicely how to create adapter to be able to use RibbonTabs inside CWPF. I am not going to talk about that in this entry so please read them before in case you are just starting with the RibbonControlsLibrary .

My problem is that each of the RibbonTabs created inside CWPF IModule is also driven by a ViewModel. 

  public partial class DynamicTab 
    {
        public DynamicTabVM ViewModel { get; private set; }

        public DynamicTab()
        {
            InitializeComponent();
            DataContext = ViewModel= new DynamicTabVM();
        }

The technique of re-attaching the RibbonTab works fine if there is no databinding or it's using static resources.

In my scenario all the RibbonButtons have a Bindingg against an ICommand in the viewModel.
                     
When "switching" between Ribbon Tabs --> the DataContext was gone for the "dynamic" RibbonTab. 

I COULD not solve the problem by changing the binding to RelativeSource. Probably this is because I am new to WPF binding and the IDE (vs.net 2008) does not really help at all here.


      private void AddDynamicTabs()
        {
            //Create the Tab.
            var dynamicTab = new DynamicTab();

            // The tab DataContext is the ViewModel.
            var vm = (DynamicTabVM) dynamicTab.DataContext;

            // Take the included ribbon tab.
            RibbonTab tab = dynamicTab.DynamicRibbonTab;
            
            // Disconnect from container
            dynamicTab.Content = null;

            // Re-assign the DataContext
            tab.DataContext = vm;


            foreach (var group in tab.Groups)
            {
                group.DataContext = vm;

                foreach (var control in group.Controls)
                {
                    if (control is RibbonButton)
                    {
                        (control as RibbonButton).DataContext = vm;
                    }
                    // TODO : Applies to more controls.. We are currently using RibbonButton.
                }
            }

            MyRibbon.Tabs.Add(tab);

            // This is needed to be able to view the NEW tab using the correct Style/Skin.
            MyRibbon.InvalidateVisual();

        }


You can download the Example code.

The example is not actually using CWPF and therefore this code should be included in the Adapter. 



Thursday, November 6, 2008

VSCT Designer

Long time since my last entry, I have just moved and have been extremely busy / chaotic during the last weeks. Back online now.

I've found the following tool this seems very interesting for anybody working with DSL or VSX: 
http://www.codeplex.com/VSCTDesigner

I did have a little problem with adding bitmaps and therefore I've created the following post in the Codeplex website.

Wednesday, July 9, 2008

How to copy hibernate.config to the VSTS Output Folder?

VSTS is now included by default in the standard/professional version of vs.net 2008. Until now i was using NUnit + TestDriver.net, etc.

I've decided to test VSTS and found 1 big problem : my nhibernate.config file was not copied to the output directory of the test output folder. I was expecting this to be automatically since I've set the "Always Copy" in the build property for the file.

Doing some basic Google searches I've noticed I am not the only guy having this problem.

The solution is to open the "localtestrun.testrunconfig" file which is added automatically to the solution by VSTS, go to "Deployment" and then add the file you want to deploy/copy.










Once this is done, the hibernate.config file copied every time we run a test. This can be seen in the image below. VSTS creates 1 output folder for each test run.

Saturday, June 28, 2008

Code Generation 2008 : more than just content

The conference is now over.

Besides the fact of being a very good conference, one the most important things is that during the conference I've met wonderful people. Not only we had a lot of fun together but also we discussed some very interest topics.

Pedro Molina , me , Alejandro Silva and Gaston Milano

It's was amazing to see how much we had in common and how much effort we had wasted trying to solve all of us the same stuff. We are working in our little isolated island without having ways to correctly shared/reuse some of the common concepts in our tools/products.

Besides there deep technical knowledge and wonderful ideas, the most important thing was that we had a lot of fun together.

Another person which I was very pleased to met from Microsoft was Jean-Marc Prieur (picture, and yes, the guy in the background is Steve Cook).

He was "extremely" helpful, always open to new ideas , listened far beyond the extend of his responsibility, stayed "after" the conference to keep listening.
"Chapeau!!!".

Later during next week I will write down more stuff related to my point of view of some very specific stuff I've learn.