This is a guide how to get your own simple dashboard running locally. You will need a computer and an internet connection, but given that you are readig this you already have both.
Since dash is a python framework we need to install python first. If you are using Linux it will most likley be already installed (check by typing python in your terminal). Otherwise you can download python here. For Linux you might also have to install pip, you can find instructions here.
Now we have to install dash. For Linux open a terminal and run the command ‘python -m pip install dash pandas’. For Windows open CMD or Powershell and run ‘py -m pip install dash pandas’. Now we can use dash and pandas. Pandas in a library to handle datasources.
Open up the editor or IDE of your choice and a terminal session in your source folder.
First of all we need to import all needed packages:
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objects as go
from dash.dependencies import Input, Output
import pandas as pd
Now to make the dashboard a little bit more interesting, lets add a callback:
if(input is None):
data = go.Scatter(
x=[random.randint(0, 100) for i in range(0, 100)],
y=[random.randint(0, 100) for i in range(0, 100)],
layout = dict(
return go.Figure(data=data, layout=layout)
And finally run it!
if __name__ == '__main__':
Now switch to your open terminal and run the server: Linux -> ‘python3 dashboard.py’ WIndows -> ‘py dashboard.py’
You will see some output with information about the server, like the adress where you can reach it.
If you enable the debug optiption, you will see debug information on the dashboard and the code will be ‘interactive’ so when you change something and save the file it will auto restart the server which is super useful. Just make sure there are no errors : )
You can find the example with a bit more happening here. Head over here to see all the graphs or inputs available.
Now you are ready to tinker around on your own and create beautiful dashboards.
The following tutorial shows how to clone the demo project used in the presentation. In the presentation we will program the demo project step by step.
What is GameMaker Studio 2?
GameMaker Studio 2 is an IDE that combines the game engine GameMaker and other useful tools for game development, such as a graphics editor or a sound mixer… GameMaker specializes in 2D game development and offers a series of tutorials and demos for different skill levels. The demo includes a short introduction of the most important editors and a project where the basic functions of GameMaker are explained.
Installing the Demo project
Step 1: Install the free version of GameMaker Studio 2 by selecting, downloading and installing the Free Trail version. Note: unfortunately a registration at YoYo Games is necessary!
Step 2: Open GameMaker Studio and log in On the main screen, select the Source Control tab and then click “Clone Repository”.
Step 3: Enter the path to the demo project: https://github.com/CHP-EmAS/GameMaker_Studio_2_ePortfolio.git in the first field and select a new folder where the project should be cloned. Afterwards confirm with OK.
Step 4: After successful cloning a window opens where you have to select the demo project. Select the file “Demo.yyp” and confirm with OK.
Step 5: The project is now opened and can be started. To do this, you have to press the “Run” button at the top of the control bar. The game starts in an extra window.
Step 6: Now you can try everything as you like. The graphics are cc and can be processed further.
Thank you for reading this little tutorial about GameMaker Studio 2. I hope it could help you to get a first impression on how to work with GameMaker. Every feedback is appreciated.
The following tutorial should give an overview about the functionality of mocking frameworks and why you should use them to write better tests. The popular mocking framework for Java, Mockito, will be used as a practical example.
What is Mocking?
Mocking in general describes the copying of something
else behaviour. In the context of object-oriented programming languages do you
want to fake the behaviour of an object without having to create a real instance
of the object. But why should you want to do something like this?
Good code should also be well tested. Many of those tests will be unit tests, which should verify the behaviour of a single component, without relying on dependencies to other objects. The following picture illustrates this well.
mocking the needed objects are you able to isolate the component that you want
to test. Now it is easier to locate a possible error, because only the test of
the broken component will fail if something goes wrong.
There are two different methods of mocking, proxy-based mocking and class loader remapping. Mockito uses proxy-based mocking.
I chose to work with Mockito for this tutorial because
it is the most used mocking framework for Java and one of the most used Java
libraries in general. It has many advanced features, but it is also easy to write
good tests with just the basic tools. When you encounter a problem, then the
possibility that someone already solved it or something similar, is extremely
high. Also, the general concept of working with proxy-based mocking should be
transferable to any other mocking framework of your choice.
How to use Mockito
To use Mockito do you have to include the Mockito library
and a testing framework into your project. I will use Junit 5 as my testing
framework. For an easy setup did I use Maven. You can find the necessary Maven
packages with the following addresses:
Then all you need is to make the following imports at the beginning of your test class, and you are ready to write unit tests with mocks.
In the following part I will explain some of the basic functionalities of Mockito. For better visualization did I write a little test project where I showcase the explained functionalities. You can find the source code in the following git repository: Mockito_ePortfolio
It contains a simple library and book class. The different tests should cover the functions of the library class and I will always mock the book class to give an example how you can work with Mockito. When writing about a certain feature, I will be referring to the test class where it is implemented.
Create a mock an set its behaviour
Let us begin with the most important part. How do I
create a mock of the needed class? This part is very simple. You just call the
static method mock(MyClass.class) to create a new mock object. Now you must
define the behaviour of your mock object when certain functions are called on
This can be realized with when(mock.doSomething()).thenReturn(xyz) and is called stubbing. With this you can create the necessary environment that is needed for your test to work. You can find this in every test class, but in its most basic form can you see it in the class TestSumOfPages.java. Now you are already able to get your test working without dependencies to other classes than the on that should be tested. But we are still not verifying if the behaviour of our class is as intended. First you can use the utilities of JUnit in form of the different Assert-functions to verify the output of the tested methods. But Mockito also provides you with some extra tools, so you can write even better tests.
Verification with Mockito
You can verify if the functions of a mock object have even been called within your test. This can be helpful to see if the code is executed as intended and does not only somehow gives the correct results back. For this you can use the verify() function. You can also specify how often a function should have been called, either with an exact number or a minimum or maximum. In the class TestAvgPerChapter.java can you find a simple example for the use of the verify() function.
In this class can you also find an example for the InOrder feature. You have to create a new InOrder() object with the mock objects that have to be verified as arguments to make use of this. Then you can call the verify() function on the InOrder() object to check if the functions have been called in the same order as you verify them. This can be helpful in multithreading scenarios when certain functions must be called before the rest. The given example is not very practical but shows how to use the functions.
Alter the behaviour of the mock while testing
Sometimes you also want to test your code under
different scenarios. Then you must change the behaviour of your mock multiple
times. In theory you can do this by stubbing the needed function again with a
different return value after the first use. In big tests this can become very
tedious and blows the code up. That’s why there are different options to
control the behaviour of your mock for different calls.
The most simple variant is the reset() function. When you call this on a mock, all stubbing will be reset to the default value. You can find a simple example for this in the test class TestAvgChapterPerBook.java in the function testAvgChapterPerBook().
A little bit more advanced is the usage of consecutive stubbing. With this feature do you define the return value for every call at once. You can either do this by chaining doReturn() statements or by giving several arguments. They will then be executed in the defined order. An example can be found in the class TestListOfAuthors.java. Consecutive stubbing can be helpful when you want to test different scenarios in one test. You then have a clear separation of the test code and the definition of you mock object.
At the end I want to give a brief introduction into
the topic of partial mocking of real objects. The basic idea is that you use a
real instance of the needed object for testing and only stub selected
functionalities, where necessary. In the past this was considered a bad
practice and a code smell because the reason you are using mocks is just to
avoid using the real object. But there are several use cases where this can be
necessary, like when working with legacy code or third-party interfaces.
When you want to utilize this feature you can use the spy() method to create your mock object. You need a real instance of the object to mock as an argument. Then you can use your mock instance as usual. The difference is now that when you are not stubbing a function then the function of the real object will be called instead of a default null value. An example for this can be found in the class TestAvgChapterPerBook.javaand the function testWithSpy().
Thank you for reading this little tutorial about Mockito. I hope it could help you to get a first impression on how to work with mocks. Every feedback is appreciated.
The JWT_TOKEN_SECRET is a password that is used to encrypt the JWT that is responsible for verifying requests. You can use any password you like, but we recommend a minimum length of 16 characters.
The BACKDOOR_HASH_KEY is a Bcrypt Hash which you can create here, just enter any password for Encrypt and leave the rounds at 12. Enter the hashed key as BACKDOOR_HASH_KEY. This password is used for secure communication between webservices and the api.
Ladies and gentleman, today I want to introduce you to our metrics system. We are using Sonarqube to analyse where our code lacks attention. Sonarqube is quickly set up inside a docker container (maphynn_sonarqube) and provides support for several languages. As such, typescript wich is used by our backend. But plugins can also provide metrics for other languages. We used this plugin for our frontend which uses flutter and dart. The sonar-scanners are run during the ci/ce pipline on gitlab for the dev branches. The analysis of the website is currently not working because we do not have any unittests and the sonar-scanner expects test and coverage outputs.
Now lets take a look at how metrics improved our code. I will take the app for an example. First there were approx. 900 code smells ?! What in the world have I done? … well maybe it isn’t entirely my fault… so I think the plugin for dart enables EVERY dartanalyzer rule. Some of the even are contradictory -> Use final modifier for variables that are only assigned once. OK did that, but hey don’t do it for variabels in methods… but you told me to … anyway. It also desn’t like JSON strings no idea why… Anyway after a bit of work we are down to 400ish. And I will from now on use final and write some comments.
The following is an example where I decided not to change anything:
I don’t see why I wouldn’t want do that. Sure the name of the variable implies the type but it also doesn’t hurt.
For the Api there were security issues which turned out to be the ‘hardcoded’ passwords for the api documentation so nothing to worry about.
So this is our metrics system. Hope you find this interesting and see you guys next week!
P.S. if anybody also uses sonarqube and has sucessfully activated the authentification using their gitlab, please tell me how. Somehow gitlab appends a “/gitlab” to the end of the redirecion url and it doesn’t work.
P.S.P.S. I think it might be better to set up metrics earlier when you have less code. It might be a lot of set-up in the beginning, but you won’t be overrun by things you did wrong the last year.