teleren/devto huggingface dataset:
Featuring a post on twitter
Tags: help
Published: 2019-06-17 11:53:31

I've recently read somewhere that when we write a blog post we are also welcome to prepare a Twitter message that can be reused later by the dev team to feature the post if they want. 

Unfortunately, I didn't save that comment/post (?) and now that I'm back from vacation, I can't find it anywhere.

Does anyone know what I talk about here? @ben maybe? Or did I just imagine it while travelling? Thanks for the help in advance.
Kotlin vs React Native for Android only app
Tags: kotlin, reactnative, android, offline
Published: 2019-06-17 11:39:38

---
title: Kotlin vs React Native for Android only app
published: true
description: Kotlin vs React Native for Android only app
tags: kotlin, react-native, android, offline, reactnative
---
I am looking for any advice on what the benefits of Kotlin or React would be for an Android only app, which will be running on some older hardware - 4.4.2, and will need to run offline syncing data to a backend server 

1. What are the developer benefits 

2. What are the end-user benefits 

3. Any pit-falls to watch out for, when selecting one or another? 

4. Overall which will be better for the end users

*Update 1:* Came across this article https://medium.com/mop-developers/mobile-app-development-react-native-vs-native-ios-android-49c5c168045b which points more to Kotlin (not decided yet)
Do you really need Kubernetes in your company/startup?
Tags: kubernetes, devops, docker, hype
Published: 2019-06-17 10:37:00

Let me start saying that I love Kubernetes, I even have a personal one for my things but I'm an experienced DevOps and it is in my spare time.

Usually, you want the complexity of the technical solutions your company uses to increase on complexity accordingly to your needs.

You may think: *whoa! I need to have autodiscovery between my microservices, a load balancer for the HTTP API and everything must be declared as a code to be maintainable without a shady guy from Ops*

And of course, you need that, especially the last part, but is really Kubernetes the only thing that can give you that?

### [Docker-Compose](https://docs.docker.com/compose/)

Its a tool written in Python that let you define environments using YAML.

The good things about this are that you can use this to make and maintain the developer's local environment and If you have only one production server (very little startup) you can even use the same YAML files used to develop your solution to deploy it into the server.

The bad thing is that it is not really designed to run on a cluster so you are limited to a one and only production machine.

### [Docker Swarm](https://docs.docker.com/engine/swarm/)

 It's a solution that comes with Docker and allows to manage several machines with Docker as one cluster.

In essence, Swarm and Kubernetes do the same but are not the same. The good thing about Swarm is that you can reuse the same YAML files that you were using with docker-compose and, in the pipeline, add the scaling stuff they need on Swarm.
You can use things like Traefik to manage the access and you can reuse it if you switch to Kubernetes later on.

The only problem is that it lacks good observability when reaching a good size.

### [Kubernetes](https://kubernetes.io/)

Kubernetes is a generalist container orchestrator, therefore it doesn't deal with Docker concepts but with abstractions that represent concepts inside the ecosystem, like Pods.

The good thing about Kubernetes is that is really easy to manage deploys and release cycles using either Kubernetes definitions (YAML or JSON) or Helm charts (a kind of deploy config on repositories) and you can even, with some tinkering around, use docker-compose files to do the deploys. It is also absurdly robust once correctly set up.

The cons are that it is not an easy piece of software to manage (the internals) and deploy, thus needing a DevOps team taking care of it.

### My Conclusions

The key here is to understand where you are, if you are still preparing an MVP to launch and the only thing in your infrastructure is a webserver then you are better off with docker-compose and progressively go up.

Also, if your Kubernetes will have more orchestrator services than services is orchestrating then you may be better off with Swarm.

All I wanted with this is to make people think about the technologies they choose to use, accidental complexity carries a cost and it should not be taken lightly so don't let the hype get you.
<ul> or <ol>? Do you know when to choose which?
Tags: html, webdev, a11y
Published: 2019-06-17 10:04:17

---
title: <ul> or <ol>? Do you know when to choose which?
published: true
description: Marking up information as a list seems such an easy task. But if you've been going at it for a while your brain starts seeing lists everywhere. Use these tricks to decide when to use a <ul> and when to use a <ol>.
tags: html, webdev, a11y, accessibility
canonical_url: http://rikschennink.nl/thoughts/list-or-no-list-thats-the-question/
cover_image: https://thepracticaldev.s3.amazonaws.com/i/6aeceb0fa8fkayelgnxv.jpeg
---

When to mark up information as a list? It seems such an easy task. But if you’ve been at it for a while your brain starts seeing lists everywhere. The next couple of tricks help you decide if information should be marked up as a list, and if so, if that list is unordered or ordered.


## Are you looking at a list?

Information should be marked up as a list if it consists of a set of similar items. For instance, search results, or navigation items. Sometimes when converting a visual design to HTML you might notice every single element collection starting to feel like a list. When it feels like you're in that kind of situation, ask yourself:

*"Should screenreader software announce the number of items?"*

If it should, the information you’re looking at is definitely a list.

Another way would be to ask yourself if it would be weird if the items in the list would be marked with bullets or numbers (trick by [@stommepoes](https://twitter.com/stommepoes/status/773123776120811521)). If it’s not weird, we got a list on our hands.


## Should the list be ordered?

Now that we've found a list we need to decide if it's an ordered `<ol>` or if it's an unordered `<ul>` list.

[The w3 spec states the following about about ordered lists](https://www.w3.org/TR/html52/grouping-content.html#elementdef-ol):

> A list in which the items are intentionally ordered, such that changing the order would change the meaning of the list.

If changing the order of the list causes the list to lose any meaningful data then it should be marked up as an ordered list.

For instance the following lists should be formatted as an `<ol>`
- Search results (assuming they’re returned by relevance). Shuffle the list items and suddenly you can no longer determine the relevance of each item.
- Article comments. Shuffling the comments causes comments referencing earlier comments to lose meaning.
- IKEA furniture instructions.

If a list does not lose information when shuffling the items it’s safe to go with the `<ul>` instead of the `<ol>` element.

That's it, you now possess the super power to determine if if some bit of information should be marked up as a list or not. Let me know if you have any questions, happy to answer them below.
Easy way to convert a list into a string 
Tags: python
Published: 2019-06-17 09:28:57

Converting the python list to string


Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> a=['1','2','3','4']
>>> s="".join(a)
>>> s
'1234'
>>> type(s)
<class 'str'>
>>>
Systemctl shows service file Not Found even though .service file is present
Tags: linux, systemd, centos, beginners
Published: 2019-06-17 09:17:38

---
title: Systemctl shows service file Not Found even though .service file is present
published: true
tags: linux, systemd, centos, beginner
canonical_url: http://alexandrubucur.com/blog/2019/systemctl-shows-service-file-not-found-even-though-.service-file-is-present/
---
Hi All,

I'm writing a step by step setup for a self hosted gitea instance (on CentOS 7) and hit the stupidest __bug__ (if you can call it that) of systemd.
After writing the gitea service file I was getting the following error:

```sh
[root@gitea ~]# systemctl start giteaselfhost
Failed to start giteaselfhost.service: Unit not found.
```

After a few hours of maddening permission checks and debugging, the problem was that I had a `Requires` dependency to a [service file that wasn't there](https://serverfault.com/a/968233/89407).

Removing the broken dependency made the service work, so hopefully at some point systemd will give nicer errors when missing dependencies.
Multiple Inheritance with Traits in PHP
Tags: php
Published: 2019-06-17 08:35:32

[Traits](https://www.php.net/manual/en/language.oop5.traits.php) in PHP is a powerful way to reduce code duplication.

In [inheritance](https://developer.hyvor.com/tutorials/php/oop-inheritance), we can only inherit a single class. Here's an example.

```php
class Object {
    public $width;
    public function setWidth($width) {
         $this -> width = $width;
    }
}

class Box extends Object {
    
}
$box = new Box;
$box -> setWidth(10);
```

Here, we used [single inheritance](https://www.php.net/manual/en/language.oop5.inheritance.php). If we needed to use multiple inheritance, we cannot do that with extending. We will need to use [Traits](https://developer.hyvor.com/tutorials/php/oop-traits) for that.


# What are traits?
Traits are class-like which contains methods. Traits cannot be instantiated.

Here's a simple trait.


```php
Trait ObjectToArray {
    public function getArray() {
         return get_object_vars($this);
    }
}
```

Let's use our trait in a class.

```php
class User {
    use ObjectToArray;
    public function __construct($name, $country) {
        $this -> name = $name;
        $this -> country = $country;
    }
}

$user = new User('John', 'USA');
var_dump($user -> getArray());
```

In the same way you can use multiple traits in a class.

```php
class User {
    use ObjectToArray;
    use ObjectToJSON;
    // and more...
}
```

# Conclusion
Traits are quite useful if you need to use the same methods in multiple classes. Traits helps you to keep the code more organized. But, I haven't seen developers using Traits frequently. They tend to use inheritance and interfaces.

I'm not sure about the reason, but, what I assume is that most of PHP devs are not aware of **Traits**.

Thank you for reading!
Blockchain and junior developer
Tags: discuss, blockchain, developer, junior
Published: 2019-06-17 08:21:08

---
title: Blockchain and junior developer
published: true
tags: discuss, blockchain, developer, junior
---

I'm getting very interested in blockchain technology and I was wondering if it's a good thing since I'm junior with only 8 months of experience at a real job.

It would be awesome to get the job as a blockchain developer someday (probably remote since there are none blockchain jobs in my country) so should I invest in it or nah?
Try Sign In with Apple in Your Auth0 Apps Today
Tags: signinwithapple, identitymanagement, authentication
Published: 2019-06-18 13:26:00

---
title: Try Sign In with Apple in Your Auth0 Apps Today
published: true
description: Integrated support for Sign In with Apple is now available in Auth0 as a beta feature.
tags: #signinwithapple #identitymanagement #authentication
canonical_url: https://auth0.com/blog/try-sign-in-with-apple-in-your-auth0-apps-today/
---

Today, we are happy to announce that integrated support for Sign In with Apple is available in Auth0 as a beta feature, making it far easier than anything we've shown yet to preview the experience in your own applications. You don't even need an Apple Developer account to get started — just flip a switch and give it a try!

[Read on 🍎](https://auth0.com/blog/try-sign-in-with-apple-in-your-auth0-apps-today/?utm_source=dev&utm_medium=sc&utm_campaign=signinwithapple_auth0)

![Try Sign In with Apple in Your Auth0 Apps Today](https://cdn.auth0.com/blog/sign-in-with-apple/apple-toggle.png)
We don’t see things as they are, we see them as we are.
Tags: dailywriting
Published: 2019-06-17 21:22:09

---
title: We don’t see things as they are, we see them as we are.
published: true
tags: daily-writing
canonical_url: https://marcusblankenship.com/we-dont-see-things-as-they-are-we-see-them-as-we-are/
---

Leaders need to understand that mental models are the lens through which we see reality, **indirectly.**

Otherwise, we fall into the bias of [Naïve Realism](https://en.wikipedia.org/wiki/Na%C3%AFve_realism_(psychology)), believing that we see things objectively, as they “really” are.

This is a problem because it makes us sure that what we perceive is true and correct.

And being sure of something can motivate us to take the “obvious” action or reaction.

It also makes anyone who doesn’t agree with us appear ignorant, crazy, or stupid.

We’d be well advised to pause and ask ourselves:

1. What perspective am I using right now, and what are the subparts of that perspective?
2. Can I think of the situation from multiple perspectives?
3. Are their perspectives missing from my analysis?

**Any given situation has multiple perspectives.**

Let’s try a simple example:

_You are a development manager working at BIGCORP, and your company announces a change to adopt an “unlimited vacation” policy in 2020._

1. What is your gut reaction to this policy change?
2. What perspective is your gut using?
3. What subparts of the perspective can you see?
4. Can you think of the situation from other perspectives? Do they provide a different reaction?
5. What perspectives might be missing from your analysis?
6. What conflicts/surprises may arise between different perspectives?

It might be interesting to pass this around your team, and see what different perspectives and reactions they have.

Or, take a moment and write me back with your answers.

Best,  
Marcus

The post [We don’t see things as they are, we see them as we are.](https://marcusblankenship.com/we-dont-see-things-as-they-are-we-see-them-as-we-are/) appeared first on [Marcus Blankenship](https://marcusblankenship.com).
Question for Self-Taught Developers...
Tags: beginners
Published: 2019-06-17 06:21:57

---
title: Question for Self-Taught Developers...
published: true
description: 
tags: #beginner
---

I'm curious...for those of you who self-taught yourself to code, how much did a mentor play a factor in your journey?

A lot?
A little?
None at all?

As I've been going over my JavaScript studies and struggling with certain things, I couldn't help but to wonder if most other self-taught developers go at this whole thing solo as well? Or if most find a mentor at some point to help guide them?

While I'm fully confident in my abilities to become a full stack developer on my own, there are definitely times when I think an experienced developer who has done all this before would be super helpful in the coding journey.

What do you think, my fellow self-taught programmers? Is having a mentor unrealistic these days?
Google analytics, privacy, and personal blog
Tags: hugo, webdev, help, discuss
Published: 2019-06-17 06:11:06

---
title: Google analytics, privacy, and personal blog
published: true
description: How to respect privacy and get analytics?
tags: [hugo, webdev, help, discuss]
cover_image: https://thepracticaldev.s3.amazonaws.com/i/a5y9da16i87qv4vqvptm.jpg
series: Hugo theme
---

**UPD**: I found modern alternatives for GA. See my post here https://stereobooster.com/posts/useful-modern-tools-for-static-websites/

I want to start my personal blog and I need analytics there. I want to use Hugo (or another static site generator) and host it with Netlify (or now, or S3 + CloudFlare). This means that I need to use 3-rd party service to collect analytics, right? I do not plan to monetize blog (do not know how?), so I don't want to pay for analytics service. I guess cheapest would be to rent DigitalOcean server for 5$ month (e.g. 60$ a year). But Google analytics costs 0$. On the other hand, I concerned about the privacy of my visitors.

Demo is [here](https://stereobooster.netlify.com/). Source code is [here](https://github.com/stereobooster/hugo-pipes-parcel/tree/basic-theme).

## Current solution

For now, I decided to use Google analytics with [ganalytics](https://github.com/lukeed/ganalytics/).

I ask for consent before saving any data to the user device

```html
<div class="cookie" hidden>
  <p>
    Can we store cookies on your device? See <a href='{{ .Site.BaseURL }}privacy/'>Privacy Policy</a> for details.<br>
    <button type="button" class="cookie-yes">Yes</button> <button type="button" class="cookie-close">Close</button>
  </p>
</div>
```

If I don't have consent I send [anonymized request](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#aip) to Google analytics, but don't store any identifier on the device.

If I have consent I send a regular request with stored id.

There is a form with which the user can revoke consent and erase a locally stored identifier.

```html
<form class="consent">
  You can revoke consent and remove unique identifier ("cookies") at any time using the form below.
  <noscript>This form needs JavaScript enabled in the browser in order to work</noscript>
  <br><br>
  <input type="radio" id="agree" name="consent" value="agree">
  <label for="agree">I <b>allow</b> to store a unique identifier on my computer to track my visits to this site.</label>
  <br><br>
  <input type="radio" id="disagree" name="consent" value="disagree">
  <label for="disagree">I <b> don't allow</b> to store unique identifier on my computer.</label>
</form>
```

This form is on the page with the privacy policy, which explains that the website uses Google analytics and when data sent.

Remarketing feature is turned off. Advertising Reporting Features are turned off. I don't want to share data with Google.

I simply want to know a number of views of my posts, top source of traffic (search, social, referral), maybe region - nothing fancy.

## WDYT

What do you think about my solution? Is it fair privacy-wise? Do I miss something?
FastestBinaryStream
Tags: news, csharp
Published: 2019-06-17 05:59:47

I've just published my first-ever NuGet Package, `FastestBinaryStream`.  It's very simple - but that's largely the point!

`FastestBinaryStream` is an all-in-one fluent class for binary protocol implementation in C#.  It foregoes safety checks, abstractions, and maintainability in favor of operating as quickly as mechanically possible.

Here's an example that uses it to convert a public key from its raw form into an SSH-formatted public key:

```csharp
new BinaryStream(sizeof(int) + publicKeyAlgorithm.Length + sizeof(int) + publicKeyData.Length)
    .WriteBig(KeyType.Length) // write an integer in big-endian byte order
    .Write(Encoding.ASCII.GetBytes(publicKeyAlgorithm)) // write an array of bytes, verbatim
    .WriteBig(publicKeyData.Length)
    .Write(publicKey)
    .FlushBase64String(out var sshPublicKey)
    .Dispose();
```

Right now, it's my best guess based on past experience optimizing code.  In the future, I hope to verify that it's achieving its goal by analyzing the IL it produces, and by running performance tests.

Contributions and feedback are welcome.  There's a to-do list in the readme.

[GitHub](https://github.com/M-Pixel/FastestBinaryStream) | [NuGet](https://www.nuget.org/packages/FastestBinaryStream/)
Managed Hosting vs Unmanaged Hosting Service
Tags: webhosting
Published: 2019-06-18 07:39:05

---
title: Managed Hosting vs Unmanaged Hosting Service
published: true
tags: Web Hosting, web hosting
canonical_url: https://kevinhq.com/managed-hosting-vs-unmanaged-hosting-service/
---

Which one should you choose: fully managed host service or unmanaged hosting service? Let’s see how to choose between both options. Managed Hosting Managed hosting means your hosting will do the most of the management for your server. There are two kinds of managed hosting: half managed web hosting and fully managed web hosting. You need to ask… 

[Read More »Managed Hosting vs Unmanaged Hosting Service](https://kevinhq.com/managed-hosting-vs-unmanaged-hosting-service/)
Write to Text File C#
Tags: csharp, tutorial, beginners
Published: 2019-06-18 15:21:00

---
title: Write to Text File C#
published: true
tags: csharp,tutorial,beginners
series: C# File I/O
cover_image: https://wellsb.com/csharp/wp-content/uploads/sites/2/2019/05/beginners-file-write-min.png
---

To write to a text file in C#, you will use a StreamWriter object. In this tutorial, you will learn how to use StreamWriter to write a string to a file synchronously. You can also use StreamWriter to append text to an existing file and to write to a file asynchronously. To use the StreamWriter object, you must include the System.IO directive in your project. To create an instance of a StreamWriter...

[Source](https://wellsb.com/csharp/beginners/write-to-text-file-csharp/)
Refactoring a Class Component to a Functional Component w/ State Hooks
Tags: react, javascript, usestate, webdev
Published: 2020-02-27 03:40:05

---
title: Refactoring a Class Component to a Functional Component w/ State Hooks
published: true
tags: react,javascript,usestate,webdev
---

## Introduction

Up until early this year with the release of [React 16.8](https://reactjs.org/blog/2019/02/06/react-v16.8.0.html) in February, we as React developers have had to rely on class components to create any components that needed to rely on their own internal state.

State can be used for a variety of different purposes, but in general, it helps us keep track of variables that are only needed within the scope of the component we are using them in or in a component consumed by the component we are in.

## Examples

As a simple example, I’ve created a component that consists of a button and an icon (started directly from `create-react-app`). When the button is clicked, the visibility of the icon is toggled. To accomplish this, we’ll keep track of the visibility in the component’s state.

### Here is how we would do it in a class component:

{% gist https://gist.github.com/thatzacdavis/1ce29bfdc9b25d5b0d92ddaddc73f8e6 %}

### And here is how it ended up after we refactored it into a functional component using the `useState` hook:

{% gist https://gist.github.com/thatzacdavis/85b8a61d4bc5c70274b54b122c6df7c4 %}

I greatly prefer how much simpler the code is with the `useState` hooks as compared to the traditional way of handling state in class components, and the process itself was simple.

First, I turned the component into a functional component, removing the constructor and therefore the binding of the `handleClick` function.

Then, I brought in the `useState` hook, which rendered the entire `handleClick` function pointless, so I was able to simply call the setter directly from the `onClick` prop of the button itself.

And voila! I got rid of *13 lines of code* in two simple steps.

There is much less boilerplate when you are given a function that will directly set the state variable for you instead of writing the `setState` call inside of your own function, and while a 13-line difference might not look huge in this small example, imagine a larger component that needs to keep track of a handful of different variables in its state. The code can begin to get quite long and verbose when you have to write each individual state setter and bind the functions in the constructor.

__13 lines per state variable, per component, can really add up!__

Hooks are certainly the future of React, and hopefully, I have helped illustrate just why that is in this simple example.
Java 13 - Simplified Booster
Tags: java, news
Published: 2019-06-17 04:05:02

---
title: Java 13 - Simplified Booster
published: true
description: We look at what will come in the next release of java. Java 13, this release will boost your development and help you get up and running.
tags: java, news
---

{% youtube nAKWA1Z9pSg %}