Tuesday, April 6, 2010

Entity Framework Error 0019

I’ve got this error while refactoring a project that contains an Entity Data Model.  I’ve tried to google and find good solution.  Here it is:

image

Errors:

BAModel.csdl(3,4) : error 0019: The EntityContainer name must be unique. An EntityContainer with the name 'BAEntities' is already defined.
BAModel.csdl(118,4) : error 0019: Each type name in a schema must be unique. Type name 'BAModel.Activity' was already defined.

One reason you might see this is if you have two models in a project that have the same schema. Maybe you decided to start your model over from scratch.

But in this scenario, that was not the case. It turned out that the problem was because I had changed the assembly name of the project that contained the model. The reference to the original assembly was still in the client application's BIN folder along with the new one.

image

Entity Framework was attempting to load the metadata files from both assemblies and detected the conflict.

Cleaning the project didn't fix the problem. The leftover assembly was still there.. I had to delete the dll and pdb file manually.

I first came across this problem and fixed it last week. But it happened again with another solution today and took me a while to remember the cause and the fix. The older I get, the more I need to rely on my blog for retaining that which my memory seems to be incapable of storing away.

Original solution

Thursday, April 1, 2010

Sitecore - CryptographicException file not found

I’ve got an issue with CryptographicException file not found in Sitecore. See details below

Server Error in '/' Application.

The system cannot find the file specified.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Security.Cryptography.CryptographicException: The system cannot find the file specified.
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[CryptographicException: The system cannot find the file specified.
]
System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer) +7715070
System.Security.Cryptography.DSACryptoServiceProvider.ImportParameters(DSAParameters parameters) +258
System.Security.Cryptography.DSA.FromXmlString(String xmlString) +501
Sitecore.Nexus.Licensing.NexusLicenseApi.(String xml, Guid instance) +124
Sitecore.Nexus.Licensing.NexusLicenseApi.GetSnapShot(Guid instance) +683
Sitecore.SecurityModel.License.LicenseManager.GetSnapshotData(Guid instance) +47
Sitecore.SecurityModel.License.LicenseManager.UpdateSnapshot() +70
Sitecore.SecurityModel.License.LicenseManager.Initialize() +8
Sitecore.Nexus.Web.HttpModule.Application_Start() +76
Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +435
System.Web.HttpApplication.InitModulesCommon() +65
System.Web.HttpApplication.InitModules() +43
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +729
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +298
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +289



Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927


After hours of trying to find the solution I’ve found out that this is IIS settings issue.   This issue was caused by MVC 2 installation, unfortunately it’s uninstall didn’t help.



To fix this:
1. go to IIS Manager
2. go to the application pool instance
3. click advanced settings
4. Under Process model, set Load User Profile to true
Hope this will help!
Eugene

Friday, March 26, 2010

How to Remove and Hide Blogger NavBar (Top Navigation Bar)

I find this Navigation bar on top of the blog useless for me and readers of the blog.

Unfortunately it’s not possible to hide this NavBar using blogger settings.   But you can do this manually editing Html of the page and adding needed CSS class there.  Here are the instructions:

  • Login to Blogger.
  • On the Blogger Dashboard, click on the Layout link of the blog.

    image

  • The Edit HTML page under Layout tab should be loaded. If not, go to the tab.
  • Search for the following line of code:

    </style>

    Then, add the following line of code before that line:

    #navbar-iframe{ display: none !important; }

    The Blogger Classic Template uses iframe to load the NavBar, and styles it with ID named navbar-iframe. The name actually also works for new Blogger Widget Template too.

  • Register for Visual Studio 2010 Beta Exams

    You are invited to take part in one or more beta exams for Visual Studio 2010 and the Microsoft .NET Framework 4.

    If you pass one of the beta exams, the exam credit will be added to your transcript and you will not need to take the exam in its released form. The 71-xxx identifier is used for registering for beta versions of MCP exams, when the exam is released in its final form the 70-xxx identifier is used for registration.
    By participating in beta exams, you have the opportunity to provide the Microsoft Certification program with feedback about exam content, which is integral to development of exams in their released version. We depend on the contributions of experienced IT professionals and developers as we continually improve exam content and maintain the value of Microsoft certifications. The following exams are a part of this beta offering.

    Exam 71-511, TS: Windows Applications Development with Microsoft .NET Framework 4

    Exam 71-515, TS: Web Applications Development with Microsoft .NET Framework 4

    Exam 71-513: TS: Windows Communication Foundation Development with Microsoft .NET Framework 4

    Exam 71-516: TS: Accessing Data with Microsoft .NET Framework 4

    Exam 71-518: Pro: Designing and Developing Windows Applications Using Microsoft .NET Framework 4

    Exam 71-519: Pro: Designing and Developing Web Applications Using Microsoft .NET Framework 4


    Availability

    Registration begins: March 17, 2010

    Beta exam period runs: April 5, 2010 – April 30, 2010

    Receiving this invitation does not guarantee you a seat in the beta; we recommend that you register as soon as registration opens. Beta exams have limited availability and are operated under a first-come-first-served basis. Once all beta slots are filled, no additional seats will be offered. If you register, please ensure you are committed to attend.

    Testing is held at Prometric testing centers worldwide, although this exam may not be available in all countries (see Regional Restrictions). All testing centers will have the capability to offer this exam in its live version.

    Regional Restrictions: India, Pakistan, China


    Registration Information

    You must register at least 24 hours prior to taking the exam.
    Please use the following promotional codes when registering for your chosen exam(s):

    Exam Number Beta Code
    71-511 511BC
    71-515 515AA
    71-513 513CD
    71-516 516B1
    71-518 518PE
    71-519 519ZS

    To register in North America, please call:

    •Prometric: (800) 755-EXAM (800-755-3926)

    Outside the U.S./Canada, please contact:

    •Prometric: http://www.register.prometric.com/ClientInformation.asp


    Test Information and Support

    You are invited to take this beta exam at no charge.
    You will be given four hours to complete the beta exam. Please plan accordingly.

    Find exam preparation information:

    Exam 70-511, TS: Windows Applications Development with Microsoft .NET Framework 4

    Exam 70-515, TS: Web Applications Development with Microsoft .NET Framework 4

    Exam 70-513: TS: Windows Communication Foundation Development with Microsoft .NET Framework 4

    Exam 70-516: TS: Accessing Data with Microsoft .NET Framework 4

    Exam 70-518: Pro: Designing and Developing Windows Applications Using Microsoft .NET Framework 4

    Exam 70-519: Pro: Designing and Developing Web Applications Using Microsoft .NET Framework 4


    Frequently Asked Questions

    For Microsoft Certified Professional (MCP) help and information, you may log in to the MCP Web site at http://www.microsoft.com/learning/mcp/

    or contact your Regional Service Center:

    http://www.microsoft.com/learning/support/worldsites.asp.

    What is a beta exam?

    Where can I learn more about the registration process?

    Where can I learn more about the beta exam invitation process?

    Where can I learn more about the new structure of Microsoft Certification?

    Who do I contact for help with this beta exam or other MCP questions?

    Tuesday, March 9, 2010

    SQL 2008 Management Tools: Can't save changes that require Recreation of Database

     

    New stupid default setting in SQL Server's Management Tools: When you design a table in a database and then try to make a change to a table structure that requires the table to be recreated, the management tools will not allow you to save the changes. Instead you'll be greeted by this friendly dialog:

    PreventSave2

    Notice that there's no option to save the changes - it's a hard rule that is applied upon saving and you can get past this other than back out of the dialog.

    My first thought here is "Crap! Now what?" and off I go searching for an option to turn this off. Eventually I find a solution after a quick search online. As it turns out it's just an annoying configuration default setting that can be easily changed, but if you're like me and you spend a while searching around the Management Tools and finding nothing initially, I ended up eventually backing out of my initial database changes and losing a bit of work in the process. It wasn't until a bit later that I found the setting to change.

    Hopefully you'll find this entry before you back out of database changes - you can get out of the above dialog, make the settings change and then still go ahead and save changes to your database.

    The fix is: Go to Tools | Options | Designers | Tables and Designers and uncheck the Prevent Saving Changes that require table re-creation option:

    PreventSavingChanges

    and that does the trick.

    This is a pretty harsh change IMHO. While I think it's a good idea that the tools now detect table recreation changes and can notify you, I think the better option by far would have been to pop up that initial dialog with a warning message AND provide an option on the buttons to either go forward or abort. Instead this arcane switch is going to cause some pause for most people familiar with the old tool behavior. It's not like this option is easy to find - I looked in the database options before I finally found it in the global tool options.

    As it is, reverting back to the 'old' behavior now doesn't let you know that a table recreate is required either, so the behavior now is the same as was with the old tools. Here Microsoft added some useful functionality and then UI fails to expose it intelligently...

    Source

    Tuesday, January 5, 2010

    Enable the Secret "How-To Geek" Mode in Windows 7

    We haven’t told anybody before, but Windows has a hidden “How-To Geek Mode” that you can enable which gives you access to every Control Panel tool on a single page—and we’ve documented the secret method for you here.

    Update: Do not use this on Vista. If you did, you can use Ctrl+Shift+Esc to start task manager, File \ Run and open a command prompt with cmd.exe, and then use the rmdir command to get rid of the folder.

    To activate the secret How-To Geek mode, right-click on the desktop, choose New –> Folder, and then give it this name:

    How-To Geek.{ED7BA470-8E54-465E-825C-99712043E01C}

    image

    Once you’ve done so, you’ll have activated the secret mode, and the icon will change…

    image

    Double-click on the icon, and now you can use the How-To Geek mode, which lists out every single Control Panel tool on a single page.

    image

    At this point you might notice why this is a stupid geek trick—it’s much easier to use the default Control Panel than navigating through a massive list, and anybody that really calls themselves a geek will be using the Start Menu or Control Panel search box anyway.

    In case you were wondering, this is the same as that silly “God Mode” trick that everybody else is writing about. For more on why it’s pointless, see Ed Bott’s post on the subject.

    Alright, So It’s Not Really a Secret How-To Geek Mode

    Sadly, this is nothing more than a stupid geek trick using a technique that isn’t widely known—Windows uses GUIDs (Globally Unique Identifiers) behind the scenes for every single object, component, etc. And when you create a new folder with an extension that is a GUID recognized by Windows, it’s going to launch whatever is listed in the registry for that GUID.

    You can see for yourself by heading into regedit.exe and searching for {ED7BA470-8E54-465E-825C-99712043E01C} under the HKCR \ CLSID section. You’ll see on the right-hand pane that it’s the “All Tasks” view of the Control Panel, which you can’t normally see from the UI.

    image

    You can use this same technique for other Windows objects by doing some digging around in the registry… for instance, if you were to search under HKCR \ CLSID for “Recycle Bin”, you’d eventually come across the right key—the one on the left-hand side here:

    image

    So if you created a folder with the name “The Geek Knows Deleted Files.{645FF040-5081-101B-9F08-00AA002F954E}”, you’d end up with this icon, clearly from the Recycle Bin.

    image

    And it’s even a fully functional Recycle Bin… just right-click and you’ll see the menu:

    image

    So here’s the quick list of the ones I felt like digging up, but I’m sure there’s more things you can launch if you really felt like it.

    Recycle Bin: {645FF040-5081-101B-9F08-00AA002F954E}

    My Computer: {20D04FE0-3AEA-1069-A2D8-08002B30309D}

    Network Connections: {7007ACC7-3202-11D1-AAD2-00805FC1270E}

    User Accounts: {60632754-c523-4b62-b45c-4172da012619}

    Libraries: {031E4825-7B94-4dc3-B131-E946B44C8DD5}

    To use any of them, simply create a new folder with the syntax AnyTextHere.{GUID}

    Create Shortcuts to GUIDs

    Since the GUID points to a Windows object launched by Windows Explorer, you can also create shortcuts and launch them directly from explorer.exe instead of creating the folder. For instance, if you wanted to create a shortcut to My Computer, you could paste in the following as the location for a new shortcut:

    explorer ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}

    image

    And just like that, you’d have a shortcut to My Computer, which you can customize with a different icon, and a shortcut key if you so choose.

    image

    Yeah, it’s a stupid geek trick, but it’s always fun to learn new things.

    Note: The Control Panel’s All Items hack and the Libraries hack will probably only work in Windows 7. The others should work in any version of Windows.

    Source