I'm finding that this algorithm is useful in a number of situations. Out in the real world, it is found in Network Intrusion Scanners, grep engines, as well as text processing. Continue reading "C++ Implementation of Wu Manber's Multi-Pattern..." »
Sunday, March 23. 2008
C++ Implementation of Wu Manber's Multi-Pattern Search Algorithm
Monday, March 17. 2008
Don't Use Defined Macros, Use Templated Inline Functions Instead
In the olden C days, one would use #define MACRO .... to build an inline macro for computationally quick evaluation of some calculation. When using that method of programming, one needed to remember to parenthesize extensively in order to prevent wierd things from happening when calling the function with an expression.
The modern approach is to use a template for an inline function, which yields all the efficiency of a macro, plus all the predictable behavior and type safety of a regular function (item #2 in the book Effective C++). An example declaration follows:
template<typename T> inline void DoWithMax( const T& a, const T& b ) { f( a > b ? a : b ); }
Monday, February 18. 2008
Redirect STL cout
In a previous article entitled C++ Override std::cout, std::cerr Streams, I wrote about some sites I found regarding the redirection of cout to some user supplied routine. After some fiddling about, I came up with a result that works for me in Visual Studio 2005 version of C++. Continue reading "Redirect STL cout" »
Tuesday, February 5. 2008
Open Source Site of the Day -- SOCI: The C++ Database Access Library
Back in October 2007, I wrote an article about PostgreSQL, C++ and the lack of binary data and wrappers.
I stand corrected. On two counts. The first is binary access. After looking through the PostgreSQL API, I see that I can indeed get binary data into and out of a database easily. The C based library, libpq, has an API call named PQexecParams which allows full separation of binary values from the query statement. This is a good step towards preventing SQL injection attacks. Continue reading "Open Source Site of the Day -- SOCI: The C++..." »
Monday, January 28. 2008
Symbol Clash Between VC++ oledb.h and Berkeley DB db.h
When attempting to use Berkeley DB4 in a Microsoft Visual Studio 2005 C++ project, the symbol DBTYPE is found in both Microsoft's oledb.h and Berkeley DB4's db.h. It is really hard to get rid of oledb.h as it is buried somewhere in the depths of the stdafx.h precompiled header file. Continue reading "Symbol Clash Between VC++ oledb.h and Berkeley..." »
C++ Override std::cout, std::cerr Streams
C# has a handy method of redirecting Console output. In the first place, C# has a System.Console library for catching all console based output. The Console.SetIn and Console.SetOut methods can then be used to redirect input/output from/to local application based routines. Continue reading "C++ Override std::cout, std::cerr Streams" »
Friday, January 25. 2008
Debian with Java and Eclipse/CDT
After downloading Eclipse/CDT (Eclipse for C++ Developers), and trying to run it I encountered an error about it finding Java RunTime 1.4.2, and it finding that inadequate.
I proceeded to 'apt-get install sun-java6-jre' successfully. Eclipse still didn't start. I found that if one runs 'update-alternatives --config java', one can select the proper Java Run Time with which to be running.
Tuesday, January 22. 2008
Creating a Crypto++ Shared Library in Eclipse/C++
The Crypto++ Library, which is an open sourced C++ Cryptographic library, has a makefile for creating a static library. The library turns out to be a large library. Static link times when linking into my project aren't fast, particularily when used in a VMWare based development environment. To make linking and running faster, a shared library would be much better. I'm using the library in an Linux hosted Eclipse/C++ based IDE. Continue reading "Creating a Crypto++ Shared Library in Eclipse/C++" »
Friday, January 18. 2008
C++ Tools: Face Detection, Artificial Neural Networks
Today I came across a couple of C++ projects relating to Neural Network usage. One is located at CodeProject called Face Detection C++ Library with Skin and Motion Analysis. The author has used a number of interesting statistical and analytical methods for face detection. To quote his mouth-full: "An understanding of wavelet-analysis, dimensionality reduction methods (PCA, LDA, ICA), artificial neural networks (ANN), support vector machines (SVM), SSE programming, image processing, morphological operations (erosion, dilation), histogram equalization, image filtering, C++ programming and some face detection background would be desirable.".
From a C++ library perspective, here is a Fast Artificial Neural Network Library (FANN). I believe the library is written in C, but has API bindings in about 13 different programming language formats, of course with one being C++. The author's description goes as follows: "Fast Artificial Neural Network Library is a free open source neural network library, which implements multilayer artificial neural networks in C with support for both fully connected and sparsely connected networks. Cross-platform execution in both fixed and floating point are supported. It includes a framework for easy handling of training data sets. It is easy to use, versatile, well documented, and fast."
Thursday, January 17. 2008
Crypto++
The C++ library, Crypto++, has an amazing array of crypto routines, including stream cyphers, block ciphers, message authentication codes, hash functions, public-key cryptography, elliptic curve cryptopgraphy, as well as hold-over insecure and obsolescent algorithms. Continue reading "Crypto++" »
Thursday, January 10. 2008
Additional Configuration Notes for Wt, a C++ Web Toolkit
I need to append some additional notes to my 2007/10/03 Wt Configuration Guide article.
As mentioned in the Wt Ext Widget deployment notes, the Wt toolkit makes use of libraries from Ext JS. There are notes at the bottom of the Wt page itemizing the files needed from the JS Ext 1.1 .zip file.
As a side note, all things Ajax can be referenced one way or another starting at the ajaxian web site. Maybe not quite the truth. More all things Ajax at AjaxPatterns... if you want to get under the hood.
Friday, October 19. 2007
C++ Libraries from Scaling Web
Scaling Web has a number of open source libraries that may be of use:
- Template based B+ Tree: Implemented in C++, B+ Tree is template based, so it can be used with any types of data. Memory based B+ Tree is much faster than STL containers like map, hash_map.
- Embedded File System: Embedded File System (EFS) is a library that allows you to create virtual file system in a single file.
- Mork Parser in C++: MorkParser is an efficient C++ implementation of Mork database format reader. The Mork format is used in most Mozilla-based projects, including the Mozilla browser suite, SeaMonkey, Firefox and Thunderbird.
- Mime Email Parser in C++: C++ implementation of RFC 2045 - Multipurpose Internet Mail Extensions (MIME) standard.
- C++ IO Streams Library: IO Streams library provides different Java-like interface streams in C++.
Saturday, October 6. 2007
libpqxx: A PosgreSQL C++ Wrapper Library
I've looked at the C library for PostgreSQL and then wanted to see if there were any C++ wrappers for it. The most current appears to be libpqxx. On first blush, it looks very good. It if functional and robust. But... it has one draw back. The library insists on converting all binary stuff into text for passing back to the caller. For some applications, that can be a reasonable library simplifier.
But in this day and age of Templates and polymorphism, it seems to be a copout. Yes, if I had time, I'd probably try my hand at implementing some sort of 'variant' implementation to handle the various types of data that come back. Continue reading "libpqxx: A PosgreSQL C++ Wrapper Library" »
Wednesday, October 3. 2007
GSL - GNU Scientific Library
I'm coming across all sorts of interesting things today. Another C++ library I've encountered is the GSL - GNU Scientific Library. From the web-site, it is:
a numerical library for C and C++ programmers. It is free software under the GNU General Public License.
The library provides a wide range of mathematical routines such as random number generators, special functions and least-squares fitting. There are over 1000 functions in total with an extensive test suite.
Some of the subject areas covered include:
Complex Numbers | Roots of Polynomials | Special Functions |
Vectors and Matrices | Permutations | Sorting |
BLAS Support | Linear Algebra | Eigensystems |
Fast Fourier Transforms | Quadrature | Random Numbers |
Quasi-Random Sequences | Random Distributions | Statistics |
Histograms | N-Tuples | Monte Carlo Integration |
Simulated Annealing | Differential Equations | Interpolation |
Numerical Differentiation | Chebyshev Approximation | Series Acceleration |
Discrete Hankel Transforms | Root-Finding | Minimization |
Least-Squares Fitting | Physical Constants | IEEE Floating-Point |
Discrete Wavelet Transforms |
Installing And Configuring Wt, a C++ Web Toolkit
I mentioned in another article about doing web page development with C++. I came across Wt: a C++ Web Toolkit. It has been a bear to configure with the ASIO library. I'll layout what I've done below. I'm stuck with an SSL initialization problem. I'm probably going to have to move to FastCGI to see how well that works. Continue reading "Installing And Configuring Wt, a C++ Web Toolkit" »