03 April, 2017

How to help you find out when you logged on / off of your computer (the easy way)

I actually have created me a keylogger that gets started for this kind of stuff, but if you need to do it without using a program then: 

just edit the security policy to audit logon successes. Run SECPOL.MSC and select audit Policy under the Local Policies in the tree view on the left. Enable auditing for logon events. Now these events will show up in the event viewer and can be viewed remotely.

i might post a blog about my keylogger -which i actually call ActivityLogger- at a later stage. its a neat tool that helps me keep track of my active times during the day in from of the pc

02 December, 2016

So you want to use Sqlite with EF 6?

You know about normal SQL databases and wanna start playing around with SQLite and have a rough understanding what SQLite is. For working with it you desire to use EF from the start on.
And you want to use the "Database First" Approach and create your model the sqlite database.

Thats how I wanted to do it. Unfortunately, using DB-first approach with sqlite is very tricky and volatile. I managed to do it... only to find that 2 months later my Visual Studio wasnt able to do the same thing again because the "Data Provider" inside my visual studio had forgotten the installed sqlite... and i needed to do the procedure again.

so my actual suggestion is.... if you want to use SQLite with EF then.... don't. 

For now, for small applications I need a local DB started to use Dapper together with SQLite instead and use Code-First. Its really much easier. If you follow the steps in this excellent article during reading you will have a working ORM solution with a running SQL database in under 5 minutes.

With that suggestion and warning out of the way and you still want to use EF together with SQLite...

Then here is your cookbook.

(This at least worked for me after many failed attempts)

Create your VS solution (I still use VS2013); open Nuget Manager, search for and add:

System.Data.SQLite (x86/x64) Version 1.0.103

(I had troubles with other versions).
Ignore all other things you find on this topic on the web.


SQLite/SQL Server Compact Toolbox

then install

Change the target framework for your projects to 4.5.1 in the "Properties" of the project in your soluion

Download and install "DB Browser for SQLite"
I use version 3.9.0

Open DB Browser for SQLite and create a new database and save it. Lets call it Db.sqlite

Add the newly created database to your visual studio project (via Add>Existing Item...);
You might want to actually add a copy of the original Db.sqlite....

now add a new "ADO.NET Entity Data Model" object to your project. Click "EF Designer from data..." go to "New Connection", under "Data source:" press "Change", and select System.Data.SQLite Database File; connect to your DB.sqlite and you are ready to go

12 September, 2016

von fast allen habe ich glückwünsche bekommen. nur die eine die mir noch wirklich wichtig wäre habe ich aus nachvollziehbaren gründen nicht bekommen

07 September, 2016

04 August, 2016

Quickstart to start game development with Javascript 

So you want to start making some games for the web and want to dive right into it?
You have some understanding about programming and maybe even game development but this whole Web-Thing and setup for being able to use the new Javascript is just a hassle for you you dont want to dive right into?

Then this blog post is for you.

Setting up the toolchain for making easy javascript coding for the browser is a knowledge in itself... and it doesnt have much to do too much with programming. so enthusiasts might be put off.

Unfortunately the current ecosystem makes it hard for newcomers to modern javascript.

Following this link you will get a completely set-up toolchain to be able to create your own HTML5 games using Pixi and Howler.

Its crude and the toolchain doesnt support tests but it will get the job done. You can even use it to make simple deployments.it should make it possible for you to get the tutorials you find on the web run or use as the base for a small game.

How to use it:

Check out the readme on the github page. Basically you will have to install npm/node, then navigate to the directory of the project provided here and run the following commands:

>npm install

Done. Now start coding.

You will notice that after running "gulp" on the commandline, that command will not complete. He will open up a new tab in chrome (you DO have chrome installed right?!) but never stops execution. This is intended. Gulp is watching for any file changes done in the project. If he finds changes, he makes a build.
That means, as soon as you make changes to a javascript file or the html file, the build process runs.
For all you out there using WebStorm, I also included a webstorm setup to get you going. All that is by no means perfect, but a good starting point. included 2 media files are all common assets that can be found on the internet.

Please note that kudos must go to Falconerd whose gulpfile I used as a base of this project.

12 March, 2015

How to allow Jenkins installation access to your MS SQL Server

if you want to run integration tests against the database and your tests shall be automated with jenkins, then you will need to add the jenkins service (normally you will install jenkins as a windows service) as an sql database user.

so how to find out how the user is called?

open your jenkins installation and go to its system properties.

you can either reach it via the URL


or you navigate to it through by clicking "manage jenkins" > "system information"

there, scroll down. you will find 2 entries:

USERDOMAIN and USERNAME (if your server is part of a domain of course). Example for this would be: CompanyDomain\ServerName$

now, add a new SQL User in sqlexpress by opening sql server managment studio, navigating to security/logins and say "new login..." by right click. use "windows authentication" and enter as the login name <ValueOfUserDomain>\<ValueOfUserName>.
So in our example you would add COMPANYDOMAIN\SERVERNAME$ into here.

Now you of course might also need to give this user appropriate permissions to do stuff, but i leave all that to you!

Happy coding

26 February, 2015

How to convert SVG files to PNGs using C#

How to convert SVG files to PNGs using C#

or... how to convert vector images to normal images using C# with a good DPI that is better than the default of 96 DPI.

SVG files seem to be becoming more and more relevant in the Web and also other applications are using them. However, I was surprised to find that its NOT that easy to get a PNG out of a SVG file.

There are some tools out there, but they require python or the use of browsers... both not really perfect for my needs.
And my needs were that I needed a GUI that I can give my non-programmer colleages and that would just run on a windows PC.

When I was done I therefore figured out some of you out there might appreciate some help/info if you have similar problems: So I began to look if there are some C# libraries around and I stumbled upon several and two looked especially promising

SVG Rendering Engine    https://svg.codeplex.com


SharpVectors - SVG# Reloaded    https://sharpvectors.codeplex.com/

both also available via nuget.

Both support conversion to PNGs, though it feels like its just a side-effect of what the libraries actually want to accomplish.

WHICH of the two you use is up to you, what we are going to do works with both, but I personally prefer SharpVectors because of the better documentation, and cleaner code structure (imho, but ymmv).

So in sharpvectors you would now do the following:

 var converter = new ImageSvgConverter(null);  
 string temporary = file + ".tmp.png";  
 converter.Convert(file, temporary);  

so far so good, above code would create me a PNG file out of my SVG.
ALAS, the resolution sucks and via (both of) the library(ies) its not possible to just set the resolution (now i am talking about width and height in pixels) & DPI. or it SHOULD work but the result is not what I expected. In my researches I found quite many dead-ends. from what I read on the internet it may also be down to some GDI+ bug in Windows 7+, whatever it is, i needed some fix:

My PNG needed to have a resolution of 1200 DPI instead of the default 96.

So what did I do? First, I changed my SVG files. Inside the SVG files which are just XMLs, you have definitions for the width and height in pixels. With some calculations I upscaled the pixels there, in my case from

  <?xml version="1.0" encoding="UTF-8"?><svg version="1.2" baseProfil="full" width="1011px" height="638px" viewBox="0 0 1011 638" xmlns="http://www.w3.org/2000/svg">  
   <rect x="0" y="0" width="1011" height="638" fill="#FFFFFF"/>  
  <?xml version="1.0" encoding="UTF-8"?><svg version="1.2" baseProfil="full" width="4044px" height="2552px" viewBox="0 0 4044 2552" xmlns="http://www.w3.org/2000/svg">  
   <rect x="0" y="0" width="4044" height="2552" fill="#FFFFFF"/>  

Then in SVG you can scale around and do some other crazy stuff. I therefore changed the next XML node, which is a plain



 <g transform="scale(4.0, 4.0)">  

more or less meaning every child node that he renders he should render 4 times as big.

that now helped that the PNGs were printed out big enough in a good resolution, but for printers that rely on the DPI, where you dont want to use "fit to scale" when printing, but use the actual DPI information of the file we now still need to set the DPI from 96 to the correct 1200 DPI.

I ended up with a workaround to archieve that by creating a temporary Bitmap instance. Because it turns out, when i just set the resolution (DPI) of my image that i just created, it did not change anything.

so my final code looked like this

 private void SaveImage(uint dpi,string file)  
      var converter = new ImageSvgConverter(null);  
      string temporary = file + ".tmp.png";  
      string convertedFileName = file.Replace(".svg", "").Replace(".SVG", "") + ".png";  
      converter.Convert(file, temporary);  
      using (Bitmap bitmap = (Bitmap)Image.FromFile(temporary))  
           using (Bitmap newBitmap = new Bitmap(bitmap))  
                newBitmap.SetResolution(dpi, dpi);          //dpi could be 96, 300, 600, 1200, whatever floats your boat  
                newBitmap.Save(convertedFileName, ImageFormat.Png);  
This finally archieved what I looked for:
photoshop, illustrator und irfanview finally correctly read out the 1200 DPI.

Satisfied, I created a small GUI around it and was able to provide the solution I was looking for:

Creating a PNG out of an SVG in any desired resolution (my case 4044px times 2552px) and DPI (1200 instead of 96)

Happy Coding