Creating Javascript accessible object from C++ / CEF

Posted on Leave a commentPosted in cpp

Example with Chromium Embedded Framework (CEF) on how to create an object in C++ and make it accessible via Javascript. console.inof(api) Object {ready: true, version: "psql.0.0.1", info: Object, getVersion: function}console.inof(api) Object {ready: true, version: "psql.0.0.1", info: Object, getVersion: function} void ExtractEngineApp::OnContextCreated( CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context) {   auto info = CefV8Value::CreateObject(NULL, NULL); info->SetValue("major", […]

Tokenizing/splitting string in c++

Posted on Leave a commentPosted in cpp, Uncategorized

This method uses strtok to tokeninze our string given a specific delimeter, results of that are put into supplied vector. There are few other ways we can do this but this one is straight forward. #include <iostream> #include <string> #include <string.h>   #include <memory> #include <stdlib.h> #include <stdio.h> #include <list> #include <vector>   using namespace […]

Calculating partial Hausdorff Distance

Posted on 1 CommentPosted in cpp

  struct Point { Point(int_t _x, int_t _y) : x(_x), y (_y) {   }   int_t x; int_t y; };     typedef std::list<Point*> points_t;   double euclideanDistance(const Point& lhs,const Point& rhs) { double p1 = std::pow((float)(rhs.x – lhs.x), 2); double p2 = std::pow((float)(rhs.y – lhs.y), 2); double vd = std::sqrt(p1 + p2);   […]

Compiling Webkit on Windows using Visual Studio 2012

Posted on Leave a commentPosted in cpp, development

Just some notes on compiling WebKit on windows with visual studio. Issues : C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xrefwrap(431): error C2064: term does not evaluate to a function taking 1 arguments (..\..\win\WebCoreSupport\WebFrameLoaderClient.cpp) 25> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\functional(239) : see reference to function template instantiation ‘_Ret std::_Callable_obj::_ApplyX(_V0_t &&)’ being compiled 25> with 25> [ […]

Leptonica barcode generation

Posted on Leave a commentPosted in cpp

Leptonica provides us with easy way to read barcodes but it does not offer a way to create them(as far as I know). Here is a leptonica function that will allow us to generate CODABAR barcode, in the feature I am planning on adding more type and more options but for now this was all […]