Default style sheet for displaying XML in iFrame

You may notice that format of XML in iFrame not displayed at IE11, while it can show the correct format at IE8.

I got the official response from Microsoft as ‘by design‘ since the IE9 update, and you can also find the issue’s sample screenshot from that link.

To make the XML format continue work, the XML needs to be transformed to HTML manually, then rendered to the browser.

IE8 support this functionality, because the msxml3.dll contains the default style sheet, while the default SS file is removed from IE9.

msxml3

Open the msxml3.dll via visual studio

Fortunately, I found the solution here, which works perfect.

Singleton Pattern with Multithreading

The little Singleton Pattern has only one class, which ensures at any time there is only one instance of itself. By using the only ONE, you can ensure that every object in the application is making use of the same global resource. Here, I pick up a issue when dealing with multi-threading, option is to use “double-checked locking” to reduce the use of synchronization.

Let’s check out the code as below:

    public class SingletonClass
    {
        private static SingletonClass _current = null;
        private static readonly object _lock = new object();
        private SingletonClass()
        {
        }
        public static SingletonClass getInstance()
        {
            if (_current == null)
            {
                lock (_lock)
                {
                    if (_current == null)
                    {
                        _current = new SingletonClass();
                    }
                }
            }
            return _current;
        }
    }

install EntLib6.0 Distributor service

1. Download installed binary from EntLib
http://www.microsoft.com/en-ca/download/details.aspx?id=38789

2. Extract EnterpriseLibrary6-binaries.exe, then install the using PowerShell.
“powershell -File .\install-packages.ps1″, run PowerShell as admin,  make sure the Set-ExecutionPolicy is Unrestrict

3. Install the distribution service
Run Visual Studio Command Prompt as Admin->”installutil /i msmqdistributor.exe”, then input the domain\username, Pword for installation.
http://msdn.microsoft.com/en-us/library/ff647847.aspx

4. Run services.msc to launch the services, select “Enterprise Library Distributor Service”, check the Properties, the path of this service should be located at the place at step 3). Start the service.

Unity for DI

Unity, the block of Enterprise Library, provides an easy way to implement the IoC pattern, and consequently the Dependency Injection. Here a sample to how to use this block.
First, create the serivce locator class for common use. The object should be intance once, we use Singleton to create it as Current.

        private static IServiceLocator CreateServiceLocator()
        {
            IUnityContainer container = new UnityContainer().LoadConfiguration();
            return new UnityServiceLocator(container);
        }

Then, create the interface(IOccupation and method DoJob)and the classes(Doctor, Teacher etc.) to implement it.

The consumer to use unity should add below config.

            List occupations = null;
            occupations = ServiceLocation.Current.GetAllInstances().ToList();
            foreach (var occupation in occupations)
            {
                occupation.DoJob();
            }

Hello, Galileo

Last week, we have a visit to the Intel Fab 68 Plant which located at develop zone of Dalian which was built 4 years ago.

9

The purpose of the visit is for the demo show of Intel’s new develop board – Galileo. Before the Galileo demo, at the opening keynote, the speaker Chen Wei (GM, Intel China IoT ) introduced the history of Intel company and the current strategy of Intel, especially from the view of Internet of Things. He focus on the Internet of Things Innovation, from the people living to industry area. Also, he mentioned the Moore’s law, in his words, the smart car would be cost 0 some long timer later. Along with the hardware industry, the financial industry may somehow indirectly affect by the law. Innovation is the neccessary composition for all industries. Just like the words “In our industry you innovation or … you die”

There are indeed some innovation ideas, like the Air Quality Monitor, Remote Observer, and Roomie. The most attracting people eyes is Roomie, which is used for detect the meeting room is current being used or not. The system is based on the Galileo board with three different sensors which for detect human, and it can maximum support 255 rooms using the extended GPIO. Users can check all the rooms’ status using their phones or from intranet.

2

Another one is a demo which using the camera and OpenCV to detect the product(Wafer) quality, this small function may replace the existing expensive machine if the precision is met the requirement, and it can reduce a lot of cost.

 1

All these demos use lots of perpheral device, like camera, microphone, infra or light sensors as input. They are relatively not so closed to our financial business, but except the same way of innovation using the current system.