Solving tech problems

Mscorsvw.exe high CPU usage on Windows Server 2012

System Administration

I sometimes really hate Windows. When you do obligatory updates sometimes it takes hours for operating system to settle down and stop using CPU and memory like crazy. One of these processes are mscorsvw.exe and ngen.exe which do some .NET assemblies optimization. I read about a lot of angry posts about these processes and that it takes hours “to optimize” and during these hours your server and services on it are suffering (and you need to be clever when finding explanations to your clients). Follow these steps: Navigate to the…read more

Cannot resolve %windir%

System Administration

I faced once strange problem that somehow system environment variable %windir% could not be resolved. This means that all shortcuts that are pointing to C:\Windows\System32 will not work. You will not be able to set it directly by clicking with right mouse button on Computer icon and you will get this message To solve this just open this directly from Start > Run… and set this environment variable c:\Windows\System32\systempropertiesadvanced.exe In my case %windir% was pointing to undefined %SystemRoot% so I just added it and make it point to C:\Windows This…read more

Microsoft .NET to run on Linux and Mac OS X

Learning, Products and Services, Programming, Technologies

Microsoft .NET will finally run fully on Linux and Mac OS X platform and this is a great news. Visual Studio is maybe the best tool for developers and Microsoft decided to open sourcing the full server-side .NET Core stack, from ASP.NET 5 down to Core Runtime and Framework. Microsoft is also giving for free Visual Studio Community 2013 full featured edition of Visual Studio, available today. You can watch more about this here. Open source links ASP.NET – https://github.com/aspnet/home .NET Compiler – https://roslyn.codeplex.com/ .NET Core – https://github.com/dotnet/corefx .NET –…read more

How to delete duplicated records in MS SQL Server?

Databases, Programming

First, create one demo table Let’s create one demo table first. It will be called Person and will hold some fictive person data. Now, fill the data Insert some fictive person data and do some duplicated records that have the same values for fieldsĀ  firstname, lastname and email. Now the magic Use this subquery trick to extract duplicate records and then delete them. Notice the use of PARTITTION and WITH Transact-SQL keywords. All records that have RowNumber > 1 are deleted.

Using SQL Server APPLY command in queries

Databases

APPLY clause in Transact-SQL is interesting because it can be user in the following scenario: For example, you might create a query that returns a list of payments (in this case last 2 payment amounts and dates) for each subscriber inside your SaaS product. You get something like this 958 Usain Jordan 2014-06-01 299.00 958 Usain Jordan 2014-07-18 458.00 110 Seagal KungFu 2014-01-12 15.16 110 Seagal KungFu 2014-03-06 17.45

Stop automatic rebooting of Windows 7 after Windows Update

System Administration

If you want your PC with Windows 7 operating system to work as server then you definitely want to stop automatic rebooting after Windows Update install new patches. To do this you need to do the following: Open the Registry Edit (WindowsKey + R, “regedit.exe“) (Remember to be careful! DON’T change anything unless you know exactly what you’re doing!) Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU Chances are that you’ll be missing these keys. If keys WindowsUpdate\AU exist, go ahead to step 3 OTHERWISE, continue through these indented steps… Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows (Make sure…read more

Using SQL Server PIVOT feature to transform rows into columns

Databases, Programming

PIVOT queries in SQL Server are useful when we need to transform data from row-level to column-level. Example: Imagine having the table named Invoice (payments per month) – for simplicity let’s say that we have PaidDate and Amount. What we wanted now is to get total money collected from the beginning of the year 2014, and in order to do this we can use this PIVOT query: And we finally get

MS SQL Server 2014 “Hybrid” to attack MongoDB

Databases

On April 1st 2014 MS SQL Server 2014 is internally released for small group of big customers such as bwin and others. The biggest improvement is in-memory OLTP engine to deliver breakthrough performance to their mission critical applications. Company bwin scale its applications to 250K requests a second, a 16x increase from before, and provide an overall faster and smoother customer playing experience. The new In-Memory OLTP engine (formerly code named Hekaton), provides significantly improved OLTP performance by moving selected tables and stored procedures into memory. Hekaton enables you to use both…read more

How to escape parenthesis/brackets ‘{‘, ‘}’ in string.Format?

Programming

Usually you have something like this: string.Format(“Output: {0}”, “A”); This will result as: Output: A What you should do if you want to make an output like this? Output: {A} You need to escape parenthesis/brackets like this: You use {{ to output { You use }} to output } So, you final C# command should look like this: string.Format(“Output: {{{0}}}”, “A”);