Things to remember

Visual studio - building startup project

posted Sep 7, 2016, 12:47 AM by Nico Kruithof   [ updated Sep 7, 2016, 1:01 AM ]

This doesn't seem to work as expected yet!

You first need to download the macro editor for Visual studio 2013 from: https://visualstudiogallery.msdn.microsoft.com/d3fbf133-e51b-41a2-b86f-9560a96ff62b

Sub Build_Startup()
    DTE.ToolWindows.OutputWindow.Parent.Activate()
    Dim sb As SolutionBuild2 = DTE.Solution.SolutionBuild
    For Each item In sb.StartupProjects
        sb.BuildProject(sb.ActiveConfiguration.Name, item, True)
    Next
End Sub
Just put that in your macros - using the Macros IDE Alt + F11, and add a keyboard mapping to it (Tools/Customize/Commands/Keyboard, find your new command in the Macros. namespace), and you're all set.

From:
http://stackoverflow.com/questions/1714100/keyboard-shortcut-to-build-only-startup-project

Analyzing linker errors

posted Jul 8, 2014, 1:48 AM by Nico Kruithof

Sometimes you get a linker error that two different kinds of c runtime libraries are used (msvcrt.lib and libcmt.lib). This means that part of the code is compiled with /MD and another part with /MT (or their debug variants). The following helps analyzing the problem as visual studio is not very verbose.

To analyze the library dependencies in the *.obj files, you can runthe following command via the Visual Studio command prompt (in the temp folder of the project, where *.obj files are generated):

for /R %1 in (*.obj) do @dumpbin /directives /section:.drectve %1 > %1.directives.txt

With Notepad++ you can then to search for the name of the offending library in all of these *.directives.txt files. This revealed which project was referencing the wrong lib.

Note: you may want to modify this to include any 3rd-party *.lib files your project may use, and not just *.obj files. "/DEFAULTLIB" directives may also come from them.

for /R %1 in (*.lib) do @dumpbin /directives /section:.drectve %1 > %1.directives.txt


Nice game engine

posted Apr 1, 2014, 10:22 AM by Nico Kruithof   [ updated Jul 8, 2014, 12:04 PM ]

I just came across a nice game engine. Might be a good entry points to get ideas from:
http://www.crystalspace3d.org/main/Main_Page

Another nice engine for professional simulators is:

Disabling dead keys

posted Oct 4, 2013, 5:30 AM by Nico Kruithof

Changing the default input language for the keyboard to "English (United States) – US" solves the problem.

The view matrix and other transforms explained.

posted Sep 19, 2013, 6:25 AM by Nico Kruithof

If you are looking for a nice explanation of transforms in the OpenGL viewing pipeline, have a look at the following pages:

What to do if you installed windows and lost GRUB again?

posted Jul 19, 2013, 5:40 AM by Nico Kruithof

  • Boot from the Live Linux CD.
  • Choose an option that says something like "Try Linux without installing".
  • After Linux desktop environment (like Gnome or KDE) is finished loading, open a Terminal window.
    Under Gnome, open Terminal through, Applications menu -> Accessories -> Terminal
    Under KDE, open Terminal through, KMenu -> System -> Terminal Program (Konsole).
  • In the terminal, type sudo grub.
  • Next type, find /boot/grub/stage1 and press Enter. The output may look like hd0, 6
  • Type root (hd0, 6). Note that we have to use whatever output we get from previous command. If you get hd0, 2, then type root (hd0, 2)
  • Type setup (hd0) (again replace hd0 with the output of the find command) and press Enter. next type quit and press Enter to exit grub.
  • Thats it, Grub bootloader is loaded again in MBR. Restart your computer.

jQuery / Flot

posted Mar 29, 2013, 7:40 AM by Nico Kruithof   [ updated Mar 29, 2013, 7:40 AM ]

This example shows how to load a cvs file into the browser and then plot the data. Javascript allows easy manipulation of the data and the plots.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>P2T2 performance</title>
    <script language="javascript" type="text/javascript" src="js/jquery.js"></script>
    <script language="javascript" type="text/javascript" src="js/jquery.flot.js"></script>
    <script language="javascript" type="text/javascript" src="js/jquery.csv-0.71.js"></script>
 </head>
    <body>
    <div id="placeholder" style="width:600px;height:300px;"></div>

    <script type="text/javascript">
      var plot_data = [];

      function createPlot(csv_data) {
        var data = $.csv.toArrays(csv_data, {separator:";"});
        var processed_data = {};
        data.map(function (elem) {
          if (!(elem[0] in processed_data)) processed_data[elem[0]] = []
          return processed_data[elem[0]].push([ elem[1], elem[2] ]);
        });
      
        var processed_data2 = {};
        for (var key in processed_data) {
          var data0 = processed_data["Euclidean Delaunay"];
          var data1 = processed_data[key];
          var data = []
          for (var i=0; i<.25*data1.length; ++i) {
            data.push([data0[i][0], data1[i][1]/data0[i][1]]);
          }
          processed_data2[key] = data;
        }

        for (var key in processed_data) {
          plot_data.push({
            label : key,
            data  : processed_data[key],
            lines : { lineWidth: 1 },
            shadowSize: 0
          });
        }

        $.plot($("#placeholder"), plot_data, { legend: { position: "nw" } } );
      }

      $.get('performance.txt', createPlot);
    </script>
    </body>
</html>

Javascript graphs.

posted Jan 4, 2013, 4:47 AM by Nico Kruithof   [ updated Jan 4, 2013, 4:47 AM ]

The Highcharts javascript library can produce very nice plots: http://www.highcharts.com/

Another nice, and free, library is Flot: http://www.flotcharts.org/

Wireframe rendering

posted Nov 25, 2012, 7:06 AM by Nico Kruithof   [ updated Nov 25, 2012, 7:06 AM ]

The following geometry shaders renders geometry in wireframe.

#version 330
#extension GL_ARB_geometry_shader4 : enable

layout (triangles) in;
layout (line_strip, max_vertices = 4) out;

///////////////////////
void main()
{
  gl_Position = gl_PositionIn[0];
  EmitVertex();
  gl_Position = gl_PositionIn[1];
  EmitVertex();
  gl_Position = gl_PositionIn[2];
  EmitVertex();
  gl_Position = gl_PositionIn[0];
  EmitVertex();
}

Mathematical programming

posted Oct 19, 2012, 12:28 PM by Nico Kruithof

If you ever need geometric algorithms or mathematical code snippets you should really have a look at
http://www.geometrictools.com/
and
http://www.euclideanspace.com/

1-10 of 21