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".

 


 


 


 


Wednesday, December 19, 2012

Problems When Renewing a Multi-domain SSL Certificate on IIS 7

Last weekend, I needed to renew my multiple domain SSL certificate on my IIS 7 server. The IIS manager just did not work right, and the process was a little complicated. So I would like to share my experience here, hoping that it will help others faced with the same situation.
First of all, how do I know which version of IIS I was running? When you are hosting multiple domains, the default IIS website home page is not likely going to be the IIS start page. So checking the default website home page usually does not work. I opened Windows Task Manager, and selected "Show processes from all users":


  
Then I right clicked on "w3wp.exe", and on its popup menu, I clicked on "Properties":


  
Then I clicked on the "Details" tab:


  
I see that the version number is 7.5…

Now about the SSL certificate installation.

First I installed my new multi-domain certificate by clicking on the "Server Certificates" icon in the IIS Manager Home pane.



The certificate is not applied to any of the websites at this point. I went to the "Bindings…" menu of each website, and edited the https port 443 bindings. I selected the new certificate for each website. I ran into a problem immediately. IIS started to shut down my sites, saying that the port 443 was in use. This is because the "Host name:" field for https binding is always read-only and always blank, even though I had a valid host header value for port 443 before. After the certificate selection, IIS actually changed the host headers to blanks! As a result, all my sites tried to respond to all requests on port 443.

At this point, I had to fix them from the command line. First, I navigated into the "C:\Windows\System32\inetsrv" directory, and then I ran the following command:

appcmd set site /site.name:"IIS Site Name" /-bindings.[protocol='https',bindingInformation='*:443:']

The "IIS Site Name" came from the left pane of the IIS manager. The "-binding" switch removes the binding that does not have a header value specified. Then I ran the following:

appcmd set site /site.name:"IIS Site Name" /+bindings.[protocol='https',bindingInformation='*:443:www.*******.com']

Here www.*******.com is the root of each website URL, in my case each has the form of www.*******.com.

That completed the renewal.