Sunday, August 3, 2014

Fix Windows 8.1 Cannot Launch “PC Settings” or “Store” Problem

On my Windows 8.1 Desktop Computer, I have two user accounts.  One is connected to my “Microsoft Account” online. It was created when I installed Windows 8.1 on this PC. The other is a Windows domain user account. It was setup when I joined this PC to a local Windows domain.

In the “Microsoft Account”, I am able to run all “Metro Apps” or “Modern Apps”. I can go to “Microsoft Store”, etc. Everything seems to work fine.

But in the domain user account, there are all sorts of problems. In the “Action Center” of the control panel, I kept getting errors saying that I needed to enter a password to connect to a “Microsoft Account”. But when I clicked on “Enter Password”, the “PC Settings” app flashed on the screen, and nothing followed. An icon for “PC Settings” showed up on the task bar, but when I clicked on it, a gigantic “PC Settings”  icon flashed by, and still nothing happened. In the event log, I saw the following:

“Activation of app windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel failed with error: This app does not support the contract specified or is not installed. See the Microsoft-Windows-TWinUI/Operational log for additional information.”

I searched online, and it turned out that this had to be fixed by running three powershell commands from an administrator command prompt:

powershell -ExecutionPolicy Unrestricted Add-AppxPackage -DisableDevelopmentMode -Register $Env:SystemRoot\camera\AppxManifest.xml

powershell -ExecutionPolicy Unrestricted Add-AppxPackage -DisableDevelopmentMode -Register $Env:SystemRoot\FileManager\AppxManifest.xml

powershell -ExecutionPolicy Unrestricted Add-AppxPackage -DisableDevelopmentMode -Register $Env:SystemRoot\ImmersiveControlPanel\AppxManifest.xml

The link is here:

http://answers.microsoft.com/en-us/windows/forum/windows_8-winapps/i-cant-open-any-windows-8-apps-including-pc/aaa88b5e-98c6-4958-a896-b991b924e4f0?rtAction=1407081231306

It turned out that this “Add-AppxPackage” command is a cure for the “Microsoft Store” problem as well:

powershell -ExecutionPolicy Unrestricted Add-AppxPackage -DisableDevelopmentMode -Register $Env:SystemRoot\WinStore\AppxManifest.xml

The link is here:

http://answers.microsoft.com/en-us/windows/forum/windows8_1-windows_store/windows-81-store-stuck-on-load-loop/827ba1d0-d49b-4aae-87ef-70180b645e48

The Microsoft Store error in the event log looked like this:

“Activation of app winstore_cw5n1h2txyewy!Windows.Store failed with error: This app does not support the contract specified or is not installed. See the Microsoft-Windows-TWinUI/Operational log for additional information.”

Obviously this is not something that we outside of Microsoft could have figured out on our own.  But if this happens every time when a domain user is added to a Windows 8.1 machine, I wonder why Microsoft has not patched it.

Perhaps few in the corporate world care about the “Modern Apps” or the “Microsoft Store”. That cannot be good news for Microsoft. Then again Windows patches have been making my PC not bootable from time to time in the last few months. It seemed to have been caused by an “AMD WDDM1.3 driver update”, but I am not certain. Until I am certain, Windows auto update has to stay at “Off”.

Saturday, June 14, 2014

My Internet Explorer Was Not Showing Any Browsing History

This started when I moved my Windows OS installation onto an SSD drive. The SSD drive holds the OS, program installations, and all temporary files.

Because it is only 250 GB, my user files are stored on a pair of old fashioned 7200RPM hard drives configured in a RAID 0 configuration. This drive is mounted as "C:\users\%username%". I copied Windows generated contents into this "folder", and everything works fine. Except IE. It no longer showed any files in its "History" window. I moved its "Temporary Internet Files" folder to the SSD to get better performance, but its history window was still empty. The "Temporary Internet Files" folder had files, but they were just now shown in the history window.

I was running Windows 7 back then. So I figured that I would upgrade to Windows 8, and the IE problem would go away. Well it did not. Worse, Windows 8 installation did not understand that "C:\users\%username%" was not a regular folder but a mounted drive, and created a mess. I had to manually fix the mess.

The IE problem persisted. I was running a newer version of IE, but it still would not show any files in its history window.

Then I upgraded to Windows 8.1. The IE problem was still there. Windows 8.1 installation did not understand that "C:\users\%username%" was not a regular folder but a mounted drive, either. I had to manually fix the installation mess, again.

Yesterday, I saw this at "answers.microsoft.com":  "IE11 no history displayed". It turns out that I need to have a "system" attribute set on "C:\users\%username%\appdata\local\Microsoft\Windows\history". Apparently when I copied my files to the drive mounting folder, the attributes were lost, even though I could swear that I used the preserving attribute option on the copy.

So I added the "S" attribute as suggested. Now IE history is working again. Finally.

The original answer was from "social.technet.microsoft.com": http://social.technet.microsoft.com/Forums/ie/en-US/6418ae13-63c7-44a1-9e97-0ad875a2bd7a/browsing-history-not-being-recorded?forum=ieitprocurrentver

Thank you Rory.

Tuesday, February 25, 2014

Interesting Differences Between Double, Float, and Decimal in .NET

We all know that these data types have different precision. Decimal numbers have 28-29 significant digits. A decimal number has 128-bits. A double number has 64 bits, and 15-16 significant digits. A float number has 32 bits, and 7 significant digits.

Decimal numbers are good for financial and monetary calculations, not only because of the extra precision, but also because unlike double and float, it does not use binary representation.

For example, 1/10 in decimal representation is 0.1, which has only 1 digit. But in binary representation, it becomes a number with repeating digits: .001100110011..., where the pattern "0011" repeats indefinitely. This means that there will be rounding errors when performing calculations involving 0.1 in binary representation. But that is exactly what double and float data types would do. They use binary representation.

Besides the fact that decimal numbers are more precise when dealing with numbers with base 10, such as 0.1 and 0.01, dimes and pennies, their default behaviors when converting to text strings are different. If you run the following code:

            decimal test = 0.00M;
            Console.WriteLine(test.ToString());

            test = 0.000M;
            Console.WriteLine(test.ToString());

            double test2 = 0.00;
            Console.WriteLine(test2.ToString());

            test2 = 0.000;
            Console.WriteLine(test2.ToString());
    
what you see on the screen are "0.00", "0.000", "0", and "0".

Interesting, isn't it?

Friday, November 8, 2013

The Fix for a Mysterious SSIS Error

When running an SSIS project, I was getting a very strange error: All data flow components of a child package succeeded with green check marks, but the entire package is marked with a red cross, indicating that it failed. In the "Progress" log, the error says: [... [1875]] Error: Category does not exist.

It turns out that the error was caused by a debug break point in a script component. Debug break point in a script component usually works, but when a data viewer is turned on, or an earlier debug break point was hit in a different script component, a subsequent debug break point in a script component would usually fail, probably due to lack of available RAM or something.

This type of failure would be harmless if the package is the last one in the control flow. But if it is in the middle of the control flow, the entire task would fail.

The fix is easy, of course. All you would need to do is to open the script component source code, and remove the break point.


Monday, August 19, 2013

Building LightSwitch HTML Clients with TFS Builder Agent

LightSwitch HTML Client is now included in Visual Studio 2012 Update 3. It is really a very nice thing when you want to build a tool quickly for internal use. The problem is that it does not play nice with TFS build agents.

First of all, if you are running a 64 bit server, MSBuild usually defaults to use its 64 bit version. The problem is that "Microsoft.VisualStudio.Settings.11.0.dll" that comes with Visual Studio 2012 SDK has only a 32 bit version. So when the TFS build agent runs, you will get errors saying that "The system cannot find the file specified. File name: 'Microsoft.VisualStudio.Settings.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'...". The file is actually right there in the Visusal Studio SDK common assembly folder. you can even add it to the GAC. It will not help because it is a 32 bit assembly. You will have to switch to the 32 bit MSBuild in your build definition:

Build Definition Setting for Building LightSwitch Applications
Once you set the MSBuild platform to "X86", the problem goes away. By the way, this does not change the build platform setting in your solution. It only applies to the MSBuild process. So everything works out as far as fixing the missing DLL problem.

The problems for building LightSwitch applications do not end there, unfortunately. Once you get pass the DLL problem, you will most likely see that the build agent starts to complain that the server output is missing: "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.targets (108): Could not copy the file "...\obj\Release\Application.Server.dll" because it was not found.

Usually TFS build agent would build the release configuration of a solution. With LightSwitch projects (*.ls3proj) files, there are actually two sub-projects; one for the server and one for the HTML client. When building the LightSwitch project using MSBuild, the selected build configuration information gets lost. It never gets passed to the two sub-projects. When no build configuration is specified, these projects default to debug builds. When the time comes for the "ls3proj" to copy the output files, they are created in the wrong configuration, any you will get the errors described above.

A quick fix for this is to change the default configuration of these sub-projects. In the .Server folder, open the "*.csproj" file with NotePad, and change the default configuration to "Release":

Server Project File

Similarly, you can change the HTML client default to release as well. In the .HTMLClient folder, open the "*.jsproj" file with NotePad, and add a default configuration that is set to "Release":

HTML Client Project File

Of course, a better solution would be to fix "Microsoft.LightSwitch.Build.Tasks.targets" file to pass selected configuration to the sub-projects. That is a little more complicated. Since I do not need to create LightSwitch projects very often, fixing the project files is a much simpler solution.

Tuesday, May 21, 2013

Developing SSIS Packages with SSDT in Visual Studio 2012

Unlike older versions of Visual Studio, Visual Studio 2012 relies on SQL Server Data Tools (SSDT) for SQL project support. However, after installing SSDT (http://msdn.microsoft.com/en-us/jj650015), you will notice that the old Business Intelligence project types are missing. As a result, Integration Services (SSIS) project type, Reporting Services (SSRs) project type, and Analysis Services (SSAS) project type are not available when you try to create a  new project.

It turns out that "SQL Server Data Tools - Business Intelligence for Visual Studio 2012 (SSDT-BI)" is a package that is separate from SSDT. It can be downloaded from here: http://www.microsoft.com/en-us/download/details.aspx?id=36843.

Installing SSDT-BI is fairly straightforward, except the following:
  1. It will launch the SQL Server installer. You will need to check the   "SQL Server Data Tools - Business Intelligence" as an option.
  2. If you are running a 64 bit OS, you will need to select "create a new SQL instance". Otherwise you will get an "architecture mismatch" error, and the installation will fail. The installer will not actually create a new instance of SQL.
Once this is completed, you will be able to create SSIS packages with SSIS packages like before.

 

Monday, December 24, 2012

SharePoint 2010 Site Home Page

In SharePoint 2010, if you add a new page called "Home" (Home.aspx for the real file name) to your website, it automatically becomes the default home page of your "SitePages" directory. If you open the URL "http://yoursite/SitePages", it will lead to the new home page "Home.aspx".

If you intended to hide the original default page "http://yoursite/SitePages/Forms/AllPages.aspx", this is fine, of course. You just have to remember that it breaks the link "Site Pages" on the "All Site Content" page, or anywhere else for that matter. When you click on "Site Pages", instead of showing your site pages, it will now hop over to your "Home.aspx".