{ coder bag }

10Nov/2013-

CPU core parking manager

Hello everyone here is the new version of CPU core parking utility. I will not go into details about the core parking mechanism itself (read my previous post: http://coderbag.com/Programming-C/Disable-CPU-Core-Parking-Utility ) and for now will only explain application functionality.

Note: this is BETA version of the CPU core parking manager application, so I’m still working on it and will continue to make improvements. I'm also planning to add more functionality to it. With this version you don’t have to restart your computer anymore after you apply core parking settings.

25Apr/2011-

Foreign key must have same number of columns as the referenced primary key

Recently, while trying to map an entity to a database, I came across a problem:

Error message: “you must have same number of columns as the referenced primary key”.

Luckily after some time of trying I was able to solve it. Let’s look at this problem more closely. Imagine, we have a simple database that contains 4 tables:

Person 

Medication 

PersonMedications 

ScheduledMedications

Where each Person can have multiple medications associated with him/her, also we can have zero to many medications scheduled per person. (See the diagra

3Mar/2011-

Disable CPU Core Parking Utility

If you are an owner of a new multicore Intel CPU for example Intel core I7 and Windows 7 or Windows Server 2008 OS, you already might notice that some of the cores in your resource monitor are marked as parked. This is a new feature of windows 7/2008 operating system that is made to balance energy consumption by your CPU. So let’s say if you are performing some tasks that do not consume a lot of CPU power, all the cores that are parked will remain in that state. However, if you are running something that requires a lot of CPU power, all the cores, which were previously parked, will be placed in the active state (unparked) to perform the task. And after it’s done, they will be parked again.

All in all, this is a nice featu

15Feb/2011-

Implementing Concurrent Queue

Everyone has, probably, used FIFO (first in first out) Queue data structure in one way or another in the applications. There are many different ways of how to build a queue. And one of the most intuitive and common ways to do this is to represent a Queue as linked list with 2 ends, where one of this end’s will refer to the beginning of the queue, and the other to the end of the queue.

Even though the basic queue has a really simplistic implementation, it does require some changes in code in order to use the same data structure in the multithreaded environment.

17Nov/2010-

Building Concurrent Stack

As all of you have probably noticed, computer industry has progressed a lot in the past couple of years. Along with this fact, a multithreaded programming became an everyday reality for a lot of developers instead of just a theoretical aspect of a programming. These days it is not a wonder to see a CPU that can concurrently execute 8 and more threads. Unfortunately, with all this hardware progress, concurrent programming is still a complex topic. By making decision to apply concurrency to an application, developer is facing many challenges and tradeoffs, and I think one of these tradeoffs is a possible increase of application complexity. However, I strongly believe that it is wasteful to not use the full power of your CPU whenever it is possible to increase program responsiveness, scalability, and decrease execution time.

20Oct/2010-

Building a Network Sniffer in NET

 Everyone, who had worked with the network more or less seriously, knows about the programs such as sniffers or packet analyzers as they are officially called. Recently, I came across the idea to build my own packet analyzer using C# and .NET.  This task turned to be not that hard at all as I thought it would be, but it was a lot of fun. I bet everyone likes to watch all these packets arriving to your computer?.   So to make the long story short, in this article I provide the full source code for the sniffer project that everyone can use in any way they want.  I think I’ve done a good job commenting the code, so that’s why I’m not going to explain here how this tool is working in a great detail.

18Sep/2010-

Drag Drop file Upload With Google Gears and ASP NET

Hi all !

As a quick beginning, a few months ago I came across the problem, how to implement fast and easy file upload mechanism with minimal user interaction. To say more, this mechanism should be able to upload multiple files at once and save them to a database as blobs.

Of course, I new about the old fashion file upload mechanism with brows button, choose file window e.t.c. But that's not what I was looking for. And here is the point where google gears file drag-drop cames up. So in this article I would like to share my experience of implementation file upload using gears drag & drop feature on ASP.NET web site. To simplify the task a bit, we are not going to upload the files into a database, instead we will use a directory on the server that will contain all the uploaded files. And for those of you who will decide to use a database for this purpose, it wi

5Sep/2010-

DLL Injection Using Remote Thread

This post will show a simple technique of how to create remote thread and inject the DLL in a chosen process.  We will accomplish this task by using CreateRemoteThread() Win API routine. The thread that we will create in the remote process will not do anything accept for calling a LoadLibrary() function which argument will be the DLL name that we want to inject in the target process address space. As you probably have already guessed that loaded by remote thread DLL will be able to do all the good work for us in the future.

Let's see what steps should be done to accomplish the task.

3Aug/2010-

Problem A Consanguine Calculations

Today we are going to look into the first problem that was presented on World Programming Contest in Tokyo.

As a ACM rules state, sollution to problems should be written using C++ or Java programming languages,  and our language of choice today will be C++. But of course, this program could be easily translated to any other language.

Before we begin, let us look at the problem first !

 

Problem A+  Consanguine

1Aug/2010-

Setting KD session

 Making a host target setup to work can be a challenge. Both components, hardware and software, must function properly.

There are several options of how target and host machines can be connected:

1) Using Serial Cable (null modem cable or RS-232)

 2) Using USB cable

3) Using IEEE 1394 cable

 Both USB and IEEE 1394 are much faster options than a regular serial cable. However, there are several disadvantages of using them . First of all, using a serial cable for a host target setup is less confusing. Needless to say that serial cable is a lot cheaper then USB or IEEE cable. For example, the price for USB debugging cable is around 80$ which makes a big difference if we compare this price to a 10$ null cable.

30Jul/2010-

Problem G Network

In this post I will show the solution to one of the problems given in World University Programming Championship 2007 in Tokyo.

As a ACM rules stands programs should be written using C++ or Java languages, tht's why I decided to implement it using C++. However, it could be easily transfered to any C-like language.

Let's look at the problem

20Jul/2010-

Filter HTML from the text

In one of the projects at work I was faced with the problem, so I needed to filter out all the html tags from the text accept for those that are allowed.

3Jun/2009-

Single Responsibility Principle

  As Single-Resposibility Principle stands, "A class should have only one reason to change".  At first, this statement sounds really obvious. However it is not always easy to find out wether the class needs to be decoupled. Here I will show a simple example of a single responsi