## Extended GIT Information in bash PS1

Posted on

Extended GIT Information in bash PS1 This will generate shell similar to this : Multiline version: ┌──┤ greg: ~/dev/discovery/discovery-agent │ master ≡ !1 +2 -2 ≡ 2 weeks ago └── λ Format branch ≡ changes additions deletions ≡ last commit Example master ≡ !1 +2 -2 ≡ 2 weeks ago Since we are interested in […]

## Counting transitions in a bit string

Posted on

We need to count a number of transitions in a bit string from 0->1 and 1->0. I needed this in order to determine Uniform Descriptor in Local Binary Patterns(LBP) Samples 0000 0000 (0 Transitions : Uniform) 0x0 1110 0011 (2 Transitions : Uniform) 0xE3 0101 0000 (4 Transitions : NonUniform) 0x50 0000 1010 (4 Transitions […]

## Hamming distance calculation

Posted on

This is a small snippet of how to calculate hamming distance in cpp with small bit of assembly for doing a population count. Code typedef unsigned long long hash_t;   #include <iostream> #include <bitset>   int popcount64(const hash_t& val) noexcept { int ret; __asm__ ("popcnt %1, %1" : "=r" (ret) : "0" (val)); return ret; […]

## Histogram Comparison for Image Analysis

Posted on

DRAFT This is the first article in the series on Image Comparison using Local Binary Patterns. Complete code is on github lbp-matcher We will start off by looking at different methods of comparing histograms. Histogram Intersection Log Likehood Chi Squared Kullback Leibler Divergence All our operations will be performed on 8bpp(bits per pixel) images anything […]

## Image Comparison using Local Binary Patterns

Posted on

This is a series of small articles on Image Comparison using Local Binary Patterns. Topics I like to cover will include Histogram Comparsion Local Binary Patterns Perceptual Hashing From there we will go into building a system that can recognize same words/images in a document.

## Dump leptonica pix data to console

Posted on

Small utility for dumping Leptonica Pix data to the screen. void dump(PIX* pix) { int_t w = pix->w; int_t h = pix->h;   int_t wpl = pixGetWpl(pix); l_uint32* data = pixGetData(pix); l_uint32* line;   printf("\n"); printf("Depth : %d \n", pix->d);   for (int_t y = 0; y < h; ++y) { printf("%04d : ", y); […]

## Fingerprint cannot be generated while adding new ssh key in GitLab

Posted on

This applies to Windows only machines. I have GitLab running and was adding a new ‘ssh key’ from windows that was generated using a standard ssk-keygen command but was reciving following error: “Fingerprint cannot be generated” Command used to generate key: ssh-keygen -t rsa -C “gbugaj@localhost” -b 4096 This produces a key in ‘id_rsa.pub’ file, […]

Posted on

Here we have a method that allows us to determine return parameter type using templates and operator overloading in C++. This is something that I needed for a project that I am working on where a method call would give me the expected type based on the return type. Usage There is two way of […]

## Kryo (missing no-arg constructor): java.nio.HeapByteBuffer

Posted on

While serializing ByteBuffer using Kryo we will run into the following issue. Class cannot be created (missing no-arg constructor): java.nio.HeapByteBuffer To fix this we can create a custom serializer that will take a ByteBuffer and serialize it to and from Kryo. Serializer is rather simple all we need is two pieces of data, length of […]

## EventEmitter

Posted on

Our EventEmitter in PhantomSQL is based on NodeJS version so they should be compatible. Here are couple examples on how to use the emitter. Basic usage of registering and listening to an event. "use strict";   const {EventEmitter} = require(’events’);   // Dump all the args em.on(’hello-event’, (…arg)=> {console.info("Hello event handler : " + arg)}); […]