Author name: greg

Compiling Webkit on Windows using Visual Studio 2012

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> [ …

Compiling Webkit on Windows using Visual Studio 2012 Read More »

Calculate centroid of 2D non crossing polygon

Calculate centroid of 2D non crossing polygon,To accommodate that points are correct using Gift wrapping algorithm(Finding Convex Hull) Test case import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java.awt.Point; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.junit.Test; public class MathUtilTest { @Test public void computeCentroidWithHull() { Point p1 = new Point(1, 1); Point p2 = new …

Calculate centroid of 2D non crossing polygon Read More »

Find Convex hull of given points using Gift wrapping algorithm

Find Convex hull of given points using Gift wrapping algorithm This is implementation of Grift wrapping algorithm for finding convex hull.   private static final Integer ZERO = new Integer(0);     /** * Find Convex hull of given points * * @ref http://en.wikipedia.org/wiki/Gift_wrapping_algorithm * @param vertices * @return */ private static List<Point> findConvexHull(final List<Point> …

Find Convex hull of given points using Gift wrapping algorithm Read More »

Convert Leptonica PIX data to Java BufferedImage

This snippet allows us to convert Leptonica PIX data into Java BufferedImage, in my case the pix->data could be compressed using zlib so I am decompressing before recreating image. We are assuming here that this is bi-tonal image(1 bpp) Sample Usage BufferedImage image = LeptonicaUtil.convert(zlibData, width, height, 1); ImageIO.write(image, "png", new File("C:/temp/test.png")); BufferedImage image = …

Convert Leptonica PIX data to Java BufferedImage Read More »

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 »

java.lang.ClassNotFoundException: org.springframework.web.context.support.StandardServletEnvironment

While upgrading from Spring 3.0.5 to 3.1.1.RELEASE I started getting following exception. java.lang.ClassNotFoundException: org.springframework.web.context.support.StandardServletEnvironment at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at org.springframework.web.servlet.HttpServletBean.<init>(HttpServletBean.java:90) at org.springframework.web.servlet.FrameworkServlet.<init>(FrameworkServlet.java:211) at org.springframework.web.servlet.DispatcherServlet.<init>(DispatcherServlet.java:323) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at java.lang.Class.newInstance0(Class.java:355) at java.lang.Class.newInstance(Class.java:308)java.lang.ClassNotFoundException: org.springframework.web.context.support.StandardServletEnvironment at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at org.springframework.web.servlet.HttpServletBean.<init>(HttpServletBean.java:90) at org.springframework.web.servlet.FrameworkServlet.<init>(FrameworkServlet.java:211) at org.springframework.web.servlet.DispatcherServlet.<init>(DispatcherServlet.java:323) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) …

java.lang.ClassNotFoundException: org.springframework.web.context.support.StandardServletEnvironment Read More »