alloc_gdi_handle out of GDI object handles : wine error

If you are developing and testing win32 applications under Linux using a cross compiler and wine, there is chance you may end up error like below;

alloc_gdi_handle out of GDI object handles

A common cause for this error is large stack buildup of win32 gdi objects which were not released consequently.

try to append the following line in your code.

I give two example

HDC hdc = GetDC(handle);
// some work with hdc
ReleaseDC(handle, hdc); // <— add this line

Delete created HFONT objects using when they are not required


Preferred partition scheme for Linux file system

This article is designed to with Ubuntu Linux in mind and more specifically newer releases like 12.04 – 14.04

In past I have been using single partition starting from / for all my installation but later I realized its high importance of creating multiple partition. This is not a definitive answer for all the cases.

we have to create at-lease four partition dedicated to Linux system

/ – 5 GB
/usr – 25 GB (user binaries, libs and apps)
/home – 10 GB (if required adjust it later)
/var – 5 GB (for log files, mails, mysql database)
/swap – (1 – 2) x RAM size

simplified understanding of crypto currencies – bitcoins

This is a simplified explanation on how crypto currencies (such as Bitcoin) work. This is article is intended to decipher the fundamentals of crypto currencies in relation to traditional monetary system which many of us find difficult to grasp. Note that a digital currency is not a radically new way of doing commerce but since the time we started using internet banking where there is no transfer of physical money can be though as one step earlier from the concept of todays crypto currency.

To understand this fully you need very basic knowledge of software encryption concept, if you dont then please do a Google for quick primer. In the later part of this article I might use the terms digital currency or crypto currency interchangeably.

First we should ask a question to ourselves: How to have a given type of monetary system successfully work for a regular transactions? what are the fundamental requirements?

To make this understanding easier It is good to depict a commercial exchange between just TWO parties, later we will deal more complex system where network of computer are involved for verification and integrity of digital currency which is analogous to banking system.

1. A payer of who owns some money.
2. A receiver who needs to be paid.
3. Physical or otherwise type of object accepted by both parties as currency. This can hold a certain monetary value.

In digital currency a payer and receivers are NOT directly humans but software application (such as bitcoin wallet) running on PCs or it can be a mobile device too. Now coming to third and most important the currency itself, in traditional commercial exchange we have paper & metal based currencies but in digital world we are naturally going to use computer files (in a special format) because everything in computer world is a file. Here comes the difficult part, compare with earlier with a paper based currency which is a physical object only governments can produce them and in case if I give you one dollar my wallet has 1 dollar less.. naturally!

Now how do we mimic the same process in digital currency, everyone knows that computer files are not physical object but they a pattern of dots in magnetic harddisk. They can be copied and replicated without destroying the original copy. This throws a most fundamental requirement for a crypto currency? that is.

1. A unit of digital currency is usually never be Created (currency mining is an exception) Destroyed or Modified (few exceptions) – immutable.
2. A transfer of digital currency should be synchronized, this is like If I copy digital currency (a computer file) to your pc, my file should automatically get removed.

That was for easy understanding however most cases transfer of digital currency would take place within internet. Also deleting a file doesn’t mean that deleting a crypto currency file from file system but if you can simply change the value to 0, that is equally workable.

Lets go back to our previous example of just two person (PCs) A and B. lets assume that God has already created 5 dollar worth crypto currency at the time person A bought his PC. Now how do we achieve above two requirements?

First thing is I should not manually copy my currency to other PC rather use an authorized application to do that automatically unset the original file at A when it has been copied to destination B. This looks nice at first but it is not a full proof way of doing so. First of all this system is 100% dependent on software application which would should be only made by single authority. Second problem is if somebody hacks into this software he can gain the access to limitless crypto currency as he would keep transferring money but his own balance would never drain off.

Having a software application (call it wallet or client) for managing digital currency is a necessity but it does not fulfill our needs.So what do we do? Hint:- there has to be some mechanism incorporated in currency (File) itself, so that it can validate itself, prevent forgery etc. Wait this is going to fast..! let us return to our previous two requirements.

Anybody who knows the basics of encryption knows that encryption is used hide the information except from the intended recipient. Not just that but by using encryption we can make our information immutable, as nobody can see it no body can modify it! This means in my currency file instead of putting 5 dollar I should encrypt the value before storing. So now encryption is the most basic requirement for digital currency to function.