Posts

Showing posts from 2012

Calculating values for bar charts in LaTeX

Image
The bchart package If you want to add some bar charts to your latex document you might want to use bchart. This pdf by Tobias Kuhn shows some examples of how to use the package. Description taken from that pdf: bchart is a LATEX package for drawing simple bar charts with horizontal bars on a numerical x-axis. It is based on the TikZ drawing package. The focus of this package is on simplicity and aesthetics. Using the package one can display labels, specify the axis range, bar colors or unit of the values. Calculating values Unfortunately the package has a drawback. If you use math expressions they will be calculated for the bars but wont their values won't be displayed. In addition you cannot use \pgfmathparse{} to calculate the value for the chart because it will cause errors in displaying the bars. Which renders: I believe it is due to internal usage of pgfmath of the package. There is a simple solution though, using \\pgfmathsetmacro{}{}: Which renders: ...

Setup SQL Server 2012 and Adventure Works cube with Visual Studio 2010

Image
This tutorial will show you how to deploy a cube onto SQL Server 2012 using VS2010 and might help you avoid some of the problems I've encountered. It is complementary with Multidimensional Modeling (Adventure Works Tutorial) and uses its Adventure Works db and cube project. While this  states that it is not possible to deploy a cube using Visual Studio it is no longer the case with SQL Server 2012. Prequisites Visual Studio 2010 disc or image Installed Visual Studio 2010 SQL Server 2012 disc or image Service Pack 1 for VS2010  due to this Installing SQL Server 2012 or adding required features Note: Running VS2010 during the installation might cause errors so close it. Run SQL Server Setup by selecting New SQL Server stand-alone installation or add features to an existing installation from Installation tab of the SQL Server Installation Center. Move through the process up to Installation Type . If you already have an installed SQL Server you would...

MongoDB and distinct values in arrays

This post is a mini-tutorial on how to deal with array fields in MongoDB, specifically arrays of items that may or may not be duplicated. Let's create a collection of unicorns, smilarly to  The Little MongoDB Book examples: Find should now return something like this, the _ids will vary: Adding a value into an array We've found out that our unicorn Scott also loves playing games, so lets push a new value into our document's loves array: Using push , we could insert into our the same value multiple times. Pushing a value if its unique We have found out that all our unicorns love movies and want to update the whole collection. Unfortunately Scott already has got movies in his loves field. As shown here , we can use addToSet , which won't add a duplicated value to an array: The third parameter of update is upsert (false by default). The fourth is multi which makes the query update every document that matches the criteria (false by default meaning th...

Installing FANN on Java project and NativeLibrary.loadLibrary problems with 32bit/64bit

If you try to install FANN  and get it working with a Java project you might run into a few problems. The whole process is explained on the fannj (the Java binding) project's wiki but not in great detail. Installing Fannj Get fannj Store it somewhere and add the jar to your project. Get FANN Extract it somewhere. Set up the DLL by either: copying the fannfloat.dll to System32, or adding the following line before you try to use FANN:  System.setProperty("jna.library.path", [fannfloat.dll dir path]); Solutions to common issues No Java Native "Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jna/Platform" Solution : Download the JNA and add the jar to your project. Can' find the FANN library Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'fannfloat': The specified module could not be found. Solution : Add debugging code (or better yet: use a debugger) after y...