Differences in end of line characters

When You are working with different operating systems you encounter different line endings. Editing a file on a Linux system and opening it on a windows machine can give a weird result.

Here is a short overview which system uses which command characters:

OS Command character
Windows CR + LF
Linux LF
Mac OS <= 9 CR
Mac OS X LF

JavaScript: dot vs bracket notation

During linting my code jshint gave me the “hint” that I should prefer dot notation over bracket notation.

"testcase": data.finding["testcase"], [‘testcase’] is better written in dot notation.

What is that?

  • Accessing members with “.” is called “dot notation”.
  • Accessing them with [] is called “bracket notation”.

 

The Normal Distribution

Diving deeper into data science I started to brush up my knowledge about math especially statistics.

The Mother of all Distributions

The normal distribution was formulated by Carl Friedrich Gauß in 18XX and can be implemented in Python like the following :

def normal_distribution(x, mu=0, sigma=1):
    sqrt_two_pi = math.sqrt(2*math.pi)
    return math.exp(-(x-mu)**2 / 2 / sigma**2) / sqrt_two_pi * sigma

Useful Outlook Settings

Being forced to use Outlook at work, I use the following configuration:

  • Disable Popups
    • Options -> Mail -> Message Arrival
  • Default Reminder -> 5mins
    • Options -> Calendar -> Calendar options -> Default reminders
  • Activate Week Number
    • Options -> Calendar -> Display options -> Show week numbers in the month view
  • Enable Calendar in Mail View
    • Mail View -> View -> ToDo-Bar -> Calendar

 

KnockoutJS: passing parameters to components

HTML

<my-component params='from: "foo"'></my-component>

JS

class MyViewModel {
    constructor(params) {
        console.log(params["from"]);
    }
}

ko.components.register('table-edit', {
    template:
        ``,

    viewModel: {
        createViewModel(params) {
            return new TableViewModel(params);
        },
    }
});

Distributing your own package on PyPi

In Regular Expressions Demystified I developed a little python package and distributed it via PyPi.

I wanted to publish my second self-written package as well, but coming back after almost a year, some things have changed in the world of PyPi, i.e. the old tutorials aren’t working anymore.

What You have to do is the following thing in a nutshell:

python setup.py sdist
twine upload dist/*

The complete guide can be found here.