How to open Clion straight out of the terminal

How to open Clion straight out of the terminal With the open command in MacOS you can open applications directly from the terminal, if you are a in a certain directory and you would like to open it in clion without starting clion first and then select the directory again, you can just run open -a Clion . 馃槉

November 28, 2019 路 1 min 路 Moritz Gnisia

Create markdown tables in the terminal

Functions are definitely a nice tool in fish to help you work more efficient and utilize them in the daily life. Recently during a lab course one had to describe the function of different cpp-files. As Markdown is the way to comment them in gitlab or github I thought that it might be beneficial to have the possibility to create a markdown table just in the terminal. In fish you can easily write your function or if you are more familiar with bash, just use the latter. A brief description of the script: ...

November 27, 2019 路 1 min 路 Moritz Gnisia

Entering two commands in PyCharm simultaneously

Entering two commands in PyCharm simultaneously When you are working with matplotlib the default workflow is two create first the image itself with plt.plot() and then plt.show(). Those commands are usually entered after each other. However you can also enter them simultaneously by just concatenating them with a semicolon. So you can run plt.show([1,2,3]); plt.show() and the image if you run PyCharm in the scientific mode will popup immediately.

November 15, 2019 路 1 min 路 Moritz Gnisia

Opening PDFs in the same tab in Skim

Opening PDFs in the same tab in Skim Skim is a nice and useful programm for PDF annotations. However if you open multiple PDFs, macOS always opens them in new Skim windows. If you want to change this behavior run the following command: defaults write -app Skim AppleWindowTabbingMode -string always There are different options available and you can find a list here

November 6, 2019 路 1 min 路 Moritz Gnisia

How to use VSCode for writing compiler commands

How to use VSCode for writing compiler commands Simplify writing compiler commands Motivation While learning C/C++ I found that writing the compiler commands for the terminal is tedious job especially if you write many files. To simplify this process you can use the snippets of vscode. Solution The steps are as follows: Open the command palette Enter Configure User Snippet Select the language for which you would like to configure your the snippets, I choose C A .json File will open and you can configure your snippets for all C programms For writing the compiler commands I use the following snippet: "compile_pthread": { "prefix": "comp", "body": [ "$LINE_COMMENT gcc -o $TM_FILENAME_BASE -lpthread $TM_FILENAME && ./$TM_FILENAME_BASE ", ], "description": "Create compiler commands" } With the prefix comp I can write the compiler command for a specific c file. With the variable $LINE_COMMENT I create a line comment, $TM_FILENAME_BASE takes the file name and $TM_FILENAME is the full file name e.g. programm.c. I included the -lpthread option as I currently study parallel programming. ...

September 27, 2019 路 1 min 路 Moritz Gnisia

Installation of IPython in a Virtualenv

Working with Virtualenvs like pipenv is more than beneficial as you keep track easily of the different dependencies of your project and dont have to worry about your main python environment. However in during the development of your projects you might run into the situation that you require the shell for just verifying some small functions or run some scripts. The basic python shell provides is definitely suitable for this situation but using a shell like from ipython is even better. You can select last commands with the arrow keys and also have a nice highlighting, but how do you setup the ipython shell? Its straight forward: ...

March 24, 2019 路 1 min 路 Moritz Gnisia

Accessing the values of a relationship field in a Django Dashboard

Accessing the values of a relationship field in a Django Dashboard When you would like to group your instances of model by a category that stands in relationship to this model like the following: from django.db import models class model1(models.Model): name = models.CharField(max_length=256) def __str__(self): return self.name class model2(models.Model): some_other_name = models.CharField(max_length=256) name_model_1 = models.ForeignKey(model1, on_delete=models.CASCADE) def __str__(self): return self.some_other_name You might run into the problem that when you group the objects of your model2 by the field name_model_1 that you actually don鈥檛 get the exact values of this field. Instead you will be given the id of the belonging field, in this case name. But when you would like to visualise your data in a bar chart like the django extension django-controlcenter. In this case you can easily modify your queryset by just extending the string selection with the double underscore: ...

March 17, 2019 路 1 min 路 Moritz Gnisia

Adding Click- and Mouseover-Events simultaneously to GeoJson Markers on a Leaflet Map

When you are developing Leaflet Maps for Desktop and Mobile Applications, you might want to add nice features like a Mouse Over Effect for Desktop Users, but what if you have a mobile user also accessing the website in this case the easiest way might be just to add a click event. When I dealed with this problem, I found a good hint in this Stackexchange with a top answer of IvanSanchez, where he mentioned that when you bind a popup you automatically also add and click event. Having this in mind you only need to add an mouseover event to your markers! Then you have successfully added the mouseover and click event. ...

March 14, 2019 路 1 min 路 Moritz Gnisia

Download PDFs batchwise with Python

Downloading multiple PDFs in a batch depending on your browser can be a time consuming job, so the easiest way to do this properly and platform independent is simply to write a small python script 馃槂馃悕 ...

December 15, 2018 路 1 min 路 Moritz Gnisia

A simple class

Definition of the class The first step to write a class in C++ is by typing the keyword class and the corresponding name of the class like so class Airplane { // Attributes and Methods of the class come here } In the next step you can define three different type of attributes to this class: private protected public The main difference between the public and the two other attributes are the aspect that you can鈥檛 access from the outside. This might be helpful in terms of security reasons. We will just take the public attributes. ...

December 4, 2018 路 3 min 路 Moritz Gnisia