development

Encrypting application configuration files – Java AES

There other day I needed to encrypt certain properties in our XML configuration files. But there were few challanges that needed to be addressed Use existing Java installation !!! How will Master Encryption Key be derives and stored !!! First restriction is very important as it limits us to what algorithmic and key sizes can …

Encrypting application configuration files – Java AES Read More »

Population Count using popcnt instruction (counting number of on bits)

Using popcnt instruction found on newer processors to get population count which is number of set bits. Reference : SSE4 Here are couple example inputs with expected output. 0xA = 1010 — > 2 0x3F2 = 1111110010 — > 7 #include <iostream> #include <stdio.h>   using namespace std;   int main() { // 0xA = …

Population Count using popcnt instruction (counting number of on bits) Read More »

Leptonica Tutorial – Cropping

Common use is to crop to certain area of an image, this can be quite easily accomplished with following code. BOX* box = boxCreate(x, y, w, h); PIX* dpix= pixClipRectangle(spix, box, NULL);BOX* box = boxCreate(x, y, w, h); PIX* dpix= pixClipRectangle(spix, box, NULL);