My Blog

Here you can find my private notes about programming that I wanted to share with you. Feel free to filter based on the topic you want or search for something specific.

    The System.BadImageFormatException error when unit-testing in Visual Studio and its solution

    The BadImageFormatException was unhandled – An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) exception is being thrown when you try to load a .dll of your application which was compiled with 32 bits (X86) or 64 bits (X64) and the process that runs this file runs in a different bit-environment than the file.

    If you see this exception when you run your C# unit tests in Visual Studio, then the reason for this error is that the test environment of Visual Studio has a different bit setting than the compiled code which is under test. To fix that you have to do the following change in your Visual Studio test settings:

    Read the complete article

    The EPERM error in npm when using TFS and Visual Studio and how to solve it

    When you work with Team Foundation Server (TFS) and Visual Studio and you do web development, chances are that you will come across the EPERM error when npm tries to change a file in your application. The complete error message is Error: EPERM: operation not permitted, rename and then the absolute path to the problematic file follows.

    Read the complete article

    How to style a scrollbar by using only CSS features and have a cross browser support

    For your new web application, you might want to style the scrollbar so that it fits to the general design.

    You can either use JavaScript code to achieve the styling or you could stick to CSS properties and pseudo-selectors.

    In this article we pick the second variant and our main goal is to have a cross browser support for a styled scrollbar.

    Read the complete article

    A list of things to think of before deciding to use a distributed cache

    Choosing the right cache software for your web application is not an easy job. The first and most important question that you have to ask yourself is if you actually need a cache in your application. But what exactly is a cache and how an application can profit or not from its use?

    A cache is a software component that is used for storing data in memory (RAM) in order to provide faster accesses to this data. Using a cache you can save time and I/O operations, since you do not access the data stored in other slower types of storages such as relational databases or XML files in a hard disk drive.

    Most of the cache implementations provide a simple key-value storage, where the key is unique in the cache. The value can be then extracted by using the unique key. The type of the value can be from a simple primitive value (boolean, string, number) to a complex object. In both type-cases you have to serialize the key-value pair and most of the times store it a simple string in the cache (continue reading for more information about serialization and desirialization).

    Read the complete article

    Use the JavaScript ES6 Backtick (Template literal) feature to write multiline strings in HTML code

    The ES6 specification of JavaScript and of course the TypeScript language, provide us the template literal syntax (the `` characters). With the template literals we can write multiline strings in JavaScript without having to use the old syntax. Take a look at the following example:

        var testString = "Lorem ipsum dolor sit amet, \
                \nconsetetur sadipscing elitr, \
                \nsed diam nonumy eirmod tempor \
                \ninvidunt ut labore et dolore";
    Read the complete article