teleren/devto huggingface dataset:
Short introduction to Discriminated Unions in F#
Tags: fsharp, basics
Published: 2019-05-05 19:28:13

---
title: Short introduction to Discriminated Unions in F#
published: true
description: 
tags: fsharp, basics
cover_image: https://thepracticaldev.s3.amazonaws.com/i/xzsvxqcxr8cbu4yzdntl.jpg
---

> Cover photo by [Ilija Boshkov][4] on [Unsplash][5]

The last few months I've been trying to get my head around F#. If you'd like to start learning F# I can highly recommend [_Get Programming with F#_][1] by Isaac Abraham, especially when you have a background in C# like I do.
Today I've learned something about Discriminated Unions in F#. You use a DU when you have to model an _is-a_ relationship.
But first things first, how does such a relationship look like in an object oriented language like C#?

``` csharp
public abstract class Animal
{
    public abstract string Talk();
}
```

``` csharp
public class Dog : Animal
{
    public override string Talk()
    {
        return "Woof!";
    }
}
```

``` csharp
public class Cat : Animal
{
    public bool IsAggressive { get; set; }

    public override string Talk()
    {
	    return IsAggressive
	        ? "MEEEEEEEEOOOOOOOW!!!"
	        : "Meow";
    }
}
```

``` csharp
// usage
var dog = new Dog();
dog.Talk(); // Woof!

var cat = new Cat();
cat.Talk(); // Meow

var aggressiveCat = new Cat { IsAggressive = true };
aggressiveCat.Talk(); // MEEEEEEEEOOOOOOOW!!!
```

And now let's see the equivalent in F#:

``` fsharp
type Animal = // base type
    | Dog // no custom fields
    | Cat of IsAggressive:bool // add custom field
		
// add function with the help of pattern matching
let talk animal =
    match animal with
    | Dog -> "Woof!"
    | Cat aggressive when aggressive = true -> "MEEEEEEEEOOOOOOOW!!!"
    | Cat _ -> "Meow"
```

``` fsharp
// usage

let dog = Dog
dog |> talk // Woof!

let cat = Cat false
cat |> talk // Meow

let aggressiveCat = Cat true
aggressiveCat |> talk // MEEEEEEEEOOOOOOOW!!!
```

Pretty neat, isn't it?
What I really like about the F# approach is that I'm able to see the whole type hierarchy at a glance. Of course it's technically possible to put all C# classes into one file. But then you would certainly follow the "One class per file" convention ;-)

You can read more about Discriminated Unions on [_F# for fun and profit_][2] or [_Microsoft Docs_][3].

[1]: https://www.manning.com/books/get-programming-with-f-sharp
[2]: https://fsharpforfunandprofit.com/posts/discriminated-unions/
[3]: https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/discriminated-unions
[4]: https://unsplash.com/photos/0nI1DczRQAM?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[5]: https://unsplash.com/search/photos/f%23?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
TypeScript Interfaces
Tags: typescript, interfaces
Published: 2019-05-05 18:25:43

---
title: TypeScript Interfaces
published: true
description: What are interfaces in TypeScript and why they are usually better than classes.
tags: typescript,interfaces
canonical_url: http://taylorhutchison.com/2019/05/05/typescript-interfaces.html
---

### TypeScript Interfaces
Interfaces in TypeScript are a useful feature that I think are both underutilized and misunderstood. So in this post I will be describing what interfaces are and contrasting that with Interfaces in C# to highlight an important difference.

Looking at the [TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/interfaces.html), interfaces are described as giving names to the "shape" of values. This is a great description if you are computer scientist or expert in typed languages, but to the new programmer this definition is insufficient.

When the TypeScript Handbook talks about "shape" it means the properties and functions and their inferred types that are part of an object. Take for example an object defined as:

```typescript
const config = {
    log: true,
    user: 'example'
};
```

This object has a shape with two properties: a boolean called log and a string called user. In JavaScript we often create object literals and pass them around to functions which examines the object to see if the desired properties exist. 

One method to constrain a function so that it only takes certain types is the use of classes, which will be familiar to anyone from an OO background. You create a class with certain properties and then instantiate that class with the new keyword. There are many benefits to this approach, but not always.

If you like working with object literals in javascript, or you mostly get your data from an external API and you have no need to "new-up" objects then interfaces are a preferred means of adding type safety to your application.

Take this example:

```typescript

interface INamed {
    name: string;
}

function sayHello(INamed object) {
    console.log(`Hello, my name is ${object.name}`);
}

const person = {
    name: 'Taylor',
    profession: 'Software Developer'
}

const country = {
    name: 'England',
    area: 50346
}

sayHello(person);
sayHello(country); 

```

In that example an interface was used to constrain the type passed to the sayHello function. Object need only contain a name property of type string to be able to be passed in. 

**Most importantly: We didn't need to declare our person or country object literals as implementing the INamed interface. It worked simply because they had those properties and the typescript compiler was able to figure out they passed the "does it have a name property of type string" test.**

So in conclusion, always use interfaces until you absolutely need classes.
Hello World! - Obligatory introduction post
Tags: introduction, beginners, frontend, career
Published: 2019-05-05 16:27:38

---
title: Hello World! - Obligatory introduction post
published: true
description: Introductory post to... introduce myself
cover_image: https://thepracticaldev.s3.amazonaws.com/i/154ks1y78uxx081f1r4d.jpg
tags: introduction,beginners,frontend,career
---

Hey guys! 
I'm not very good at writing. Trying to work on that.
Nor is English my first language.

As my profile says, I'm a "35 year-old junior front-end web developer" from Belgrade, Serbia.

As you can imagine, I only started getting into this industry after the age of 30. It hasn't been easy, especially in a country as broken, corrupted, and twisted as Serbia.

But I finally made it. I finally managed to find a developer job at my age :)

It just goes to show there is no such thing as a wrong time to start doing something. It is an overused phrase, but it really is better late than never.


###Previous life###
#####Just in case anyone is interested#####
A lifetime ago I was aspiring to be a musician, I have an MA degree and all. Sadly, it's not much of a career choice anymore, especially in my environment. So after some years of "beating a dead horse", I finally decided to make a change.


###Tech-related education###
At the age of 30 (ish) I enrolled in a 3-year e-business program at an IT school.
That e-business program was *really* broad and covered many related subjects, like e-commerce, e-banking, sales, management, project management, digital marketing, and yes, some web development and programming basics.

The thing is, because we had so many subjects and only 3 years, we didn't go deep into any of them and only kind of scratched the surface with most of them.

That's why, after I was done with all the exams, I needed some time to focus on one or two topics I was most interested in - and I went back and forth between digital marketing and web development for about a year before I found my first job.


###What am I doing here?###

First of all I wanna say I have no desire of becoming a "professional influencer" or something like that. I don't want to make money doing this, nor do I care about amassing crazy amounts of followers.

I'm mainly here for community interaction - finding like-minded people I can discuss things with, share thoughts and experiences, and learn from.

As for content, I first started sharing some thoughts about jobhunting and the industry, and documenting my journey on [Instagram](https://www.instagram.com/vladimir.dev/), and some of the posts turned out pretty good, so I'm thinking of sharing them here, roughly once a week.

I called them #TipOfTheWeek on IG, but I'm really bad at coming up with names, so feel free to shoot me suggestions, I'm sure yours will be better than mine.


Have a great day!
MacBook 2018 Air or MacBook Pro 13 Dual core?
Tags: apple, macbook, vue, rails
Published: 2019-05-05 16:26:13

---
title: MacBook 2018 Air or MacBook Pro 13 Dual core?
published: true
description: MacBook Air 2018 or MacBook Pro 13 Dual Core?
tags: Apple, MacBook, VueJs, Ruby on Rails
---

Which MacBook should I get for web development, specifically VueJs, Ruby on Rails coupled with a few Virtual Machines (Homestead) and Parallels?

Is the MacBook Pro 13 Dual Core slightly faster than the newer MacBook Air 2018? I am looking at 16GB RAM modes ONLY. 

Your thoughts and suggestions are most appreciated 😬
Training YOLO using Darknet Set Up Cheat Sheet
Tags: machinelearning, beginners, yolo, darknet
Published: 2019-05-05 16:20:20

---
title: Training YOLO using Darknet Set Up Cheat Sheet
published: true
description: If you want to train your YOLO model using darknet this cheat sheet will help you to understand how your project files, config and data set files, need to be placed. 
tags: machinelearning, beginners, yolo, darknet 
---

## A cheat sheet to easy understand how the config files have to be set up to train YOLO using Darknet. 

This Cheat sheet it's a recap of different files involved in setting up YOLO model using Darknet.  

Starting off the command line you need to execute to start training your model, it explains which files are needed, what parameters need to be configured, the meaning of each parameter and where to place your data set and config files. It's based in Google Colaboratory notebook, but it can be ported to your local environment as well.

![Darknet Yolo Config Files.png](http://blog.ibanyez.info/download/B20190410T000000072.png)

You can download the image [here](http://blog.ibanyez.info/download/B20190410T000000072.png) to expand.

If you have questions or suggestions, comment these right here!


**EDIT:** Some people asked me on Twitter what's YOLO. You can find a more detailed but basic explanation [in this post](http://blog.ibanyez.info/blogs/coding/20190410-run-a-google-colab-notebook-to-train-yolov3-using-darknet-in/#some-information-about-object-detection-yolo-darknet-and-some-basics-about-deep-learning)
dmerej.info: now also in French
Tags: french
Published: 2019-05-06 14:41:58

---
title: dmerej.info: now also in French
published: true
tags: french
canonical_url: https://dmerej.info/blog/post/dmerej-info-in-french/
---

Hello there,

Just a quick note to let you know I’m now also producing contents in French, at [https://dmerej.info/blog/fr](https://dmerej.info/blog/fr)

If you do speak French, you can read more about it in [the introductory post](https://dmerej.info/blog/fr/post/bonjour-monde/).

Cheers!

Not sure if I'll cross-post from the French blog to dev.to, let's wait and see.
Serverless Absurdity
Tags: serverless, gatsby, absurd
Published: 2019-05-05 16:04:13

---
title: Serverless Absurdity
published: true
description: Sometimes my brain needs to be less productive and embrace chaos.
tags: serverless, gatsbyjs, absurd
---

This short post it's about something less productive and .. absurd:

![GatsbyJS Absurd Starter](https://static.appseed.us/misc/jamstack-gatsbyjs-absurd.jpg)

- Live [Absurd Demo](https://jamstack-gatsbyjs-absurd.appseed.us)
- Built with **Bulma Css**
- The original [starter](https://github.com/ajayns/gatsby-absurd)
- [Enhanced](https://github.com/rosoftdeveloper/appseed/tree/master/jamstack/gatsbyjs-absurd) version - with Ftp Deploy Script 
- License **MIT**



Related resources
- [Bulma Css](https://bulma.io/)
- [Get to Know Bulma](https://scotch.io/bar-talk/get-to-know-bulma-my-current-favorite-css-framework)
- [Bulma CSS Resources](https://blog.appseed.us/bulma-css-resources-curated-list/) - A curated List
- [Bulma Css Apps](https://appseed.us/apps/bulma-css) - Free & Paid  


Cheers!
JS courses on twitch :)
Tags: javascript, beginners, opensource
Published: 2019-05-05 14:58:34

I am happy to announce that I will start live interactive Javascript courses on twitch: https://www.twitch.tv/f3ltron.

All javascript lovers are welcome! A live presentation will take place on Tuesday, 8:30 pm 22:30 pm GMT + 1.

The first course will take place on Friday! 

I hope you will be there.

Sorry but for now it will be essentially french but if there is a lot of internationals i could prepare english version too <3
Print in Python without newline
Tags: python
Published: 2019-06-18 10:47:15

---
title: Print in Python without newline
published: true
tags: python
canonical_url: https://ofdigitalwater.postach.io/post/print-in-python-without-newline
---

If you want to print a string in Python without newline at the end, do it like [this](https://stackoverflow.com/questions/493386/how-to-print-without-newline-or-space):

```python
# ... and if you are in Python 2: from __future__ import print_function
print('.', end='')
```
Should you follow a tutorial about a specific topic and implement it into your project? 🤔 
Tags: discuss, help
Published: 2019-05-05 12:29:38

I'm working on an authentification function for my project ["ServerMonitor"](https://monitor.inspiredprogrammer.com). My knowledge about such a topic is quite small, so I searched for a [tutorial on YouTube](https://youtu.be/803Ei2Sq-Zs) to get it done.

![](https://thepracticaldev.s3.amazonaws.com/i/0mzbbcsjr0pxuivgl7g1.png)

Working through this tutorial helps me a lot but it feels wrong.
Everything I have programmed so far was a one to one copy of this tutorial which brings me to the following question.

*Should you follow a tutorial about a specific topic and implement it into your project?*

I mean, you get a lot done and learn something but it is not your own code.
Should you rather try to get through the documentation and try to solve everything on your own?

How do you deal with it?
Linux Terminal Tricks    
Tags: linux, terminal, productivity
Published: 2019-05-05 12:25:31

---
title: Linux Terminal Tricks    
published: true
description: linux, terminal
tags: linux, terminal, productivity
---
<img src="https://proxy.duckduckgo.com/iu/?u=https%3A%2F%2Fi.pinimg.com%2Foriginals%2F1d%2F0f%2F4d%2F1d0f4dec977f2478992faade43b7b579.png&f=1" alt="linux terminal productivity">

If you use Linux regularly, it pays to learn Linux productivity tricks. You could be wasting a lot of time, doing things the slow way.

Why not increase productivity? Learn bash tricks, keyboard shortcuts, work with multiple terminals at once and use all kinds of productivity tricks?

Take a look at the tutorial below, it will boost your Linux skills:

Read more: https://codecasts.teachable.com/p/linux-terminal-productivity
Bootstrap does not use complete jQuery
Tags: bootstrap, jquery, webdev
Published: 2019-07-06 14:48:48

---
title: Bootstrap does not use complete jQuery
published: true
tags: bootstrap,jquery,webdev
canonical_url: https://ofdigitalwater.postach.io/post/bootstrap-does-not-use-complete-jquery
---

Should you want to use [Bootstrap framework](https://getbootstrap.com/), you will also include [jQuery library](https://jquery.com/), for example:

```html
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
```

If you pay attention to the filename of jQuery included, you will see that this is the [_slimmed_](https://stackoverflow.com/questions/35424053/what-are-the-differences-between-normal-and-slim-package-of-jquery) version of the library. For example, it does not have `$.get()` function.

Should you want to perform AJAX, or use other functions not contained in the slimmed version, include the full jQuery instead, in the above case:

```html
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT" crossorigin="anonymous"></script>
```
Two Factor Authentication 🔏👤
Tags: internet, password, security
Published: 2020-04-12 23:57:40

---
title: Two Factor Authentication 🔏👤
published: true
date: 2019-05-05 10:48:00 UTC
tags: internet,password,security
canonical_url: https://2kabhishek.blogspot.com/2019/05/two-factor-authentication.html
series: Online Security
---

[![](https://lh3.googleusercontent.com/-B2cmr7s3Nlw/XZSEJWwZz0I/AAAAAAAALVo/ddk9BsUgMrox9a1JiFJt5J0PKxXSVIK_gCLcBGAsYHQ/s640/1570014220632531-0.png)](https://lh3.googleusercontent.com/-B2cmr7s3Nlw/XZSEJWwZz0I/AAAAAAAALVo/ddk9BsUgMrox9a1JiFJt5J0PKxXSVIK_gCLcBGAsYHQ/s1600/1570014220632531-0.png)
  

In a previous post, I wrote about password managers and why you should have one, In this follow up article I'll try to explain Two Factor Authentication or 2FA and how it can make your security more robust.  
  

So what 2FA does is that It adds another layer to your security.  
After you provide your username and password 2FA will ask for a special code that you may receive via SMS or an authenticator app. You can only login after providing the 2FA code.

So now, even if someone manages to get their hands on your login credentials they still won't be able to access your account. 2FA is not unbreakable but it is more secure than passwords.  
  

Most of the online services provide 2FA including Google, Facebook, Twitter, GitHub, Steam etc. You can setup 2FA for your account by going to the security settings of that platform. You can also visit [twofactorauth](https://twofactorauth.org/) to check if a service provides 2FA or not.

For authentication you may use SMS or an authenticator app.  
  
Using an authenticator app is recommended though as it can backup your codes and sync them across multiple devices, so even if you happen to lose your primary device or SIM card you'll still be able to access your accounts without any problems.  
  

A good cross platform authenticator app is [Authy](https://authy.com/). It has all the standard features of an authenticator app plus backups and support for multiple devices.  
  

I hope you now have a basic understanding of what 2FA is and will be using it to lockdown your online security.
Truly Integrated Development Environment
Tags: webdev, discuss, productivity, docker
Published: 2019-05-05 10:30:17

---
title: Truly Integrated Development Environment
published: true
description: What does it take to create a development environment?
tags: [webdev, discuss, productivity, docker]
cover_image: https://thepracticaldev.s3.amazonaws.com/i/74ht1cxk0o4ad3nu0wc6.jpg
canonical_url: https://stereobooster.com/posts/truly-integrated-development-environment/
---


When people say IDE most of the time they mean just glorified text editor, sometimes with the debugger, sometimes with autocompletion. In my opinion, the text editor is not enough to qualify as a development environment. As well we will need: 
- a compiler (or interpreter, or transpiler, etc)
- an automation tool (`make` or similar)
- a package manager (`bundler`, `yarn`, `cargo` or similar)
- probably a version switcher (`rbenv`, `nvm`, `rustup` or similar)
- a [language server](https://langserver.org/) for more intelligent autocompletion (`solargraph`, `typescript`, `flow`, `gocode` or similar)
- a linter or a type checker (`rubocop`, `eslint` or similar)
- a formatter (`prettier`, `gofmt` or similar)
- maybe a shell (`bash`, `zsh` or similar) and git

## Solution

Recently I found a potential solution for a truly integrated development environment: Docker + "cloud IDE" (in-browser IDE). We can pack all tools in Docker container and some "cloud" IDE and configure all tools to work together, then you would use one command to run Docker container and fully working editor will be available in the browser.

I wasn't the first one to come up with this idea, so there are some options:

[Theia](https://www.theia-ide.org/):

```
docker run -it -p 3000:3000 -v "$(pwd):/home/project:cached" theiaide/theia
```

[Coder](https://coder.com/):

```
docker run -it -p 127.0.0.1:8443:8443 -v "${PWD}:/home/coder/project" codercom/code-server --allow-http --no-auth
```

[Eclipse Che](https://www.eclipse.org/che/docs/che-6/quick-start.html):

```
docker run -ti -v /var/run/docker.sock:/var/run/docker.sock -v /local/path:/data eclipse/che start
```

What would you expect from IDE? What it should provide out of the box? 

> Photo by NESA by Makers on Unsplash
Darkweb + Python: discover, analyze and extract information from hidden services
Tags: python, darkweb, tornetwork, hiddenservices
Published: 2019-05-05 08:48:05

---
title: Darkweb + Python: discover, analyze and extract information from hidden services
published: true
description: The talk will start explaining how Tor project can help us to the research and development of tools for online anonymity and privacy of its users while surfing the Internet, by establishing virtual circuits between the different nodes that make up the Tor network. 
tags: python,darkweb,tor network,hidden services
---

https://es.slideshare.net/jmoc25/darkweb-python-discover-analyze-and-extract-information-from-hidden-services

![python](https://thepracticaldev.s3.amazonaws.com/i/kgpv4e98svmyr6hzh3v7.png)

In addition, we will review how Tor works from anonymity point of view, preventing websites from tracking you. Python help us to automate the process to search an discover hidden services thanks to packages like requests,requesocks and sockspy,At this point we will review the crawling process and show tools in python ecosystem available for this task(https://github.com/jmortega/python_dark_web)

These could be the talking points:

-Introduction to Tor project and hidden services
-Discovering hidden services.
-Modules and packages we can use in python for connecting with Tor network
-Tools that allow search hidden services and atomate the crawling process in Tor network
Using Leaflet and OpenStreetMap in an Ionic Application in one Go
Tags: javascript, ionic, leaflet, openstreetmap
Published: 2019-05-05 07:53:14

---
title: Using Leaflet and OpenStreetMap in an Ionic Application in one Go
published: true
description: This tutorial will show you how to integrate OpenStreetMap by using the Leaflet library. We go through markers, animations and interactions.
tags: javascript,ionic,Leaflet,OpenStreetMap
canonical_url: https://javascripttuts.com/using-leaflet-open-street-map-in-an-ionic-application-in-one-go/
---
What is the difference between State and props in ReactJs?
Tags: react
Published: 2019-05-05 07:41:24

---
title: What is the difference between State and props in ReactJs?
published: true
description: 
tags: #reactjs
---

State - This is data maintained inside a component. It is local or owned by that specific component. The component itself will update the state using the `setState` function.

Props - Data passed in from a parent component. `props` are read-only in the child component that receives them. However, callback functions can also be passed, which can be executed inside the child to initiate an update.

The difference is all about which component owns the data. State is owned locally and updated by the component itself. Props are owned by a parent component and are read-only. Props can only be updated if a callback function is passed to the child to trigger an upstream change.

The state of a parent component can be passed a prop to the child. They are referencing the same value, but only the parent component can update it.