teleren/devto huggingface dataset:
Good vs Evil: love for Microsoft
Published: 2020-09-23 04:41:12

From my early years, I were convinced about the free software philosophy (which I'm still attached to) and back then Microsoft was the devil against the software freedom, and everything around Microsoft was a thing I learned to hate like in a movie, was the empire against the republic.

> It's important to say that at that moment, I was very young and the first generation on my family to be close to computers and the internet. And to share was a principle for my family and, I took very personally the fight of the good vs the evil.

Is well known that all the power of Microsoft were used against the practices of building and sharing software collaboratively, but then something changes suddenly, with the _"Microsoft ❤️ Linux"_, with that announcement many discussions with my friend's circle were around speculations about the real intentions of Microsoft with this change, was very hard to imagine good intentions after many years of calling free software an abomination, and use a heart emoji to express that. 

![Microsoft loves Linux](https://dev-to-uploads.s3.amazonaws.com/i/t5et0ndenoj68e1obzm9.png)

We were waiting for a mistake from Microsoft to turn back and expose the real intention, and then, was announced one of the most strategical moves from Microsoft to own the open-source, and it was the acquisition of Github, at that moment and now, the larger repository of open source software and the social network to share code. I entered in panic, imagining some legal move to avoid any new contributions or licensing over the shared code and so on.

![Palpatine Star Wars](https://media.giphy.com/media/3o84sBDmixSkHj8h8Y/giphy.gif)

And the time goes by, but I can't see any clue. All I can see is that many of the current technologies that I use (languages, libraries, tools...) are in some way involved with or supported by Microsoft.

Now seems like I was pulled to the dark side or something, but Microsoft managed to make me love Microsoft.
Naïve Bayes Deep Learning
Tags: python, deeplearning, computervision, keras
Published: 2020-09-23 03:54:26

Can a machine identify a bee as a honey bee or a bumblebee? These bees have different behaviors and appearances, but given the variety of backgrounds, positions, and image resolutions, it can be a challenge for machines to tell them apart.

Find out here at https://www.andrewdarmond.com/post/naive-bees-deep-learning/
The Ultimate Hadoop Installation Cheat Sheet
Tags: java, tutorial, codenewbie, beginners
Published: 2020-09-23 03:31:47

### 1. Install Java

```
$ apt-get -y upgrade && apt-get -y update
$ apt install -y default-jdk
$ java --version
```

### 2. Create Dedicated Hadoop user

```
$ sudo addgroup [group name]
$ sudo adduser --ingroup [group name] [user name] 
$ sudo adduser [username] sudo # Add to sudoers group
```

### 3. Setup Local and HDFS network connection using SSH 

```
$ sudo apt-get install openssh-client openssh-server
$ su - [username]
$ ssh-keygen -t rsa -P ""
$ cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
```

### 4. Download Hadoop Tar file from official registry

Link to [Hadoop Registry](https://hadoop.apache.org/releases.html).

```
$ cd [to hadoop folder]
$ sudo tar xvzf [folder name]
$ sudo mv [extracted folder] /usr/local/hadoop
$ sudo chown -R [username] /usr/local/hadoop
```

### 5. Perform configurations

#### 1. ~/.bashrc

Add following lines at End of file

``` 
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
export HADOOP_HOME=/usr/local/hadoop
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/native"
```

* Execute the file to modify changes.

```
$ source ~/.bashrc
```

#### 2. /usr/local/hadoop/etc/hadoop/hadoop-env.sh

```
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
```

#### 3. nano /usr/local/hadoop/etc/hadoop/core-site.xml

```xml
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
```

#### 4. /usr/local/hadoop/etc/hadoop/hdfs-site.xml

```xml
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/usr/local/hadoop_tmp/hdfs/namenode</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/usr/local/hadoop_tmp/hdfs/datanode</value>
</property>
```

#### 5. /usr/local/hadoop/etc/hadoop/yarn-site.xml

```xml
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
```

#### 6. /usr/local/hadoop/etc/hadoop/mapred-site.xml

```xml
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
```

### 6. Create directories for data node and name node

```
$ sudo mkdir -p /usr/local/hadoop_space
$ sudo mkdir -p /usr/local/hadoop_space/hdfs/namenode
$ sudo mkdir -p /usr/local/hadoop_space/hdfs/datanode
$ sudo chown -R nish /usr/local/hadoop_space
```

### 7. Running Hadoop in Action

#### i. Format Name node

```
$ hdfs namenode -format
```

#### ii. Start All hadoop components

```
$ start-dfs.sh
```

#### iii. Start YARN

```
$ start-yarn.sh
```

#### iv. Check which components are up

```
$ jps
```
What's your embedded database of choice?
Tags: database, discuss, desktop
Published: 2020-09-23 02:19:57

For stability (i.e. ACID), it used to be SQLite. But SQLite has an issue that is bugging me -- case-insensitive LIKE (or case-sensitive only for ASCII).

Later on, I have found that [h2 database](http://h2database.com/html/main.html) which indeed (supposed to) can only normally run through JVM's JDBC, can also run in [server mode](https://stackabuse.com/integrating-h2-with-python-and-flask/), as well as there are bindings in [Python](https://pypi.org/project/JayDeBeApi/) and [Node.js](https://www.npmjs.com/package/jdbc).

But I chose to code in JVM (using Kotlin)...

I also know that there is embedded Neo4j, only in JVM.
No Xcode or CLT version detected
Tags: npm, git, xcode, osx
Published: 2020-09-23 02:08:23

I recently updated to MacOS Catalina. And faced some issues when running some `git` and `npm` commands.

I cloned a repo from GitHub and tried to run

```
npm ci
```

This error appeared after running the command
```
No Xcode or CLT version detected
```
as the cover image above shows.

Now as every faithful developer, I googled the error and pointed me to StackOverflow and some other blogs.

I checked CommandLineTools path with 
```
xcode-select -print-path
```
and it showed the correct path
```
/Library/Developer/CommandLineTools
```

So maybe the package was broken or some links were not created (not sure lol). So I deleted it
```
sudo rm -rf /Library/Developer/CommandLineTools
```

After deleting CommandLineTools this window prompted me
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/tr74gyf75fzsegku32os.png)

If the window didn't show, just run 
```
xcode-select --install
```

But for some reason it didn't download and showed me an error
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/oh4iof3q82z4bwkya091.png)

So I went to download it manually in Apple website. Use your Apple ID to sign in.
`https://developer.apple.com/download/more/?=Command%20Line%20Tools`

I chose the latest one which is the first entry in the table.

After downloading I just installed the package normally:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0bpx3jgarsjrfzhbvola.png)

And everything worked back to normal after that. 

Hope this helps out somebody.

Cheers!
Bootcamp Java Developer Day #3
Tags: java, bootcamp
Published: 2020-09-23 01:40:50

#### Day 3:

It's day three and I'm still on course 5.

##### 5) Ongoing: Fundaments of Systems Architecture

- Third section: Architecture of mobile applications and Internet of Things

I've completed the third section of course #5 mainly on **Internet of Things** (IoT). It was focused on: Things - **Cloud** - Intelligence. It presented a little bit of **embedded systems** such as Arduino (and a C program to blink a LED) and Raspberry Pi. It also explained the model **Publisher-Subscriber** and **MQTT** protocol and the levels of **Quality of Service** (QoS). We studied a case of GPS data being transferred in this architecture GPS => MQTT => Broker => Worker => Data Store using cheap tools to the AWS powerful cloud support for IoT.

- Fourth section: Essential Data Architecture

I started the fourth section (but didn't finished it) where the concepts of data and **data bases** were introduced. Models of data bases were presented: Flat, Hierarchical, Relational.
Trolling Twitter followers with .htaccess & PHP
Tags: php, jokes, tutorial, webdev
Published: 2020-09-23 01:12:05

Thought this was pretty entertaining! David Sandberg trolls his Twitter followers by using .htaccess to spoof an image file to return a PHP script that programmatically returns an image based on the visitor IP address.

{% twitter 1308516905167200256 %}

Here's the code from the Tweet for anybody wanting to try anything similar:

### .htaccess
```
RewriteEngine on
Redirect /whatisthis.jpg /whatisthis.php
```

### whatisthis.php
```
<?php
function getIMG() {
    // Get last digit of IP address
    $numb = substr($_SERVER['REMOTE_ADDR'], -1);

    // Return a different image based on IP
    if($numb == 1 || $numb == 2) {
        header("Location: 1.jpg");
    } elseif($numb == 3 || $numb == 4) {
        header("Location: 2.jpg");
    } elseif($numb == 5 || $numb == 6) {
        header("Location: 3.jpg");
    } elseif($numb == 7 || $numb == 8) {
        header("Location: 4.jpg");
    } elseif($numb == 9 || $numb == 0) {
        header("Location: 5.jpg");
    }
}

getIMG();
?>
```
Docker params change detection
Tags: docker, development, bugfix
Published: 2020-09-29 21:33:00

---
title: Docker params change detection
published: true
date: 2020-09-23 00:00:00 UTC
tags: docker,development,bugfix,docker
canonical_url: https://puppetlabs.github.io/iac/docker/development/2020/09/23/docker-params-change-detection.html
---

## Docker params change detection

The problem was reported by a client with the ticket [MODULES-10734](https://tickets.puppetlabs.com/browse/MODULES-10734). After analysis, we discovered that we don’t have parameter change detection mechanisms. In this blog post, we try to explain the problem in detail with examples.

An interesting behaviour was present in docker::run component. The problem was that if any parameter was added/modified/removed puppet agent would only apply the change only if you stopped, removed the container manually and reapplied the manifest, forcing a new container creation.

The solution was to create a new function that detects if at least one parameter is changed. The detection mechanism is based on the check between parameter values from the manifest file and correspondent field from the docker inspect object of the currently running container. The solution is present in the 3.11.0 version.

So now let’s see how the problem can be reproduced by using version `<= 3.10.2`:

### 1. install puppetlabs/docker module

```
$: puppet module install puppetlabs/docker --version 3.10.2

```

### 2. apply this manifest:

```
class { 'docker': }
docker::run { 'servercore':
  image => 'hello-world:linux',
  restart => 'always',
  net => $facts['os']['name'] ? {
    'windows' => 'nat',
    default => 'bridge',
  },
}

```

### 3. check the image tag by running this command:

```
$: docker inspect --format="" servercore
$: hello-world:linux

```

### 4. change the image tag from `hello-world:linux` to `hello-world:latest` and reapply the manifest.

The manifest should look like this:

```
class { 'docker': }
docker::run { 'servercore':
  image => 'hello-world:latest',
  restart => 'always',
  net => $facts['os']['name'] ? {
    'windows' => 'nat',
    default => 'bridge',
  },
}

```

… and now check if the change was applied

```
$: docker inspect --format="" servercore
$: hello-world:linux

```

so… something is wrong, the tag was not changed to `hello-world:latest`. If we want to apply this change we need to do a few more steps:

- stop the container: `docker stop servercore`
- remove the container: `docker rm servercore`
- reapply the manifest detailed above: `puppet apply <manifest_file_name>`

In conclusion in the puppetlabs/docker module versions `<= 3.10.2 `the parameter change is not detected. If we want to change some parameters for the same container, the puppet agent will not apply these changes for us until we delete the container manually.Using the latest versions(`>=3.11.0`) this problem is resolved by having the parameter detection mechanism implemented for the most important parameters such as image, volumes and ports.Also please take a look at the [solution](https://github.com/puppetlabs/puppetlabs-docker/pull/648).

Kind regards,[Adrian Iurca](https://github.com/adrianiurca)
Building a Blogging Platform, but Why?
Published: 2020-09-23 00:34:41

**Hey** everyone, ✌️
Hope your all having a great day!

This is my first DEV post so I'm super excited to share what I'm currently working on.

From the **Title** you can probably guess what this post is about so why am I building a Blogging Platform?

Because, why not? Just kidding the answer isn't so simple, recently I've been looking for a static site generator, although there are many great solutions I really wanted a lightweight, highly customizable, simple to use & a framework that is 100% dedicated to blogging.
Turns out that I could not find a solution that I was satisfied with!

So what features will my blogging platform have that others don't? - See down below!

# Features
* Open Source with the MIT License
* Default Config options for Amplify, Cloudflare Workers Sites, Docker with nginx, Firebase, GitHub Pages, GitLab Pages, Netlify, Render, Surge & Vercel - Wow, 😳 that's a lot of Hosting Providers
* Easy installation from NPM
* Automatic SEO
* Prebuilt theme with customization options or if you'd like you can just create a theme from scratch if that's something your into
* Simple Prebuilt website UI

And more...

Obviously this project is not public yet, but I hope to release it to Github as soon as possible!

As always have fun!!! 🥳
How to convert a Buffer data to JSON in Node.js?
Tags: node
Published: 2020-09-23 00:00:00

---
  title: How to convert a Buffer data to JSON in Node.js?
  published: true
  tags: Nodejs
  date: Wed Sep 23 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/convert-buffer-to-json-nodejs
  cover_image: https://melvingeorge.me/_next/static/images/main-6ab9bfd651c963897b2d8a34a579cc71.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/convert-buffer-to-json-nodejs)
  
To convert a `Buffer` to `JSON`, you can use the `toJSON()` method in the Buffer instance.

```javascript
// convert buff object to json
const json = buff.toJSON();
```

For an example, let's say we have an array with some data like this,

```javascript
// data
const data = [0x1, 0x2, 0x3, 0x4, 0x5];
```

Now let's convert this data to buffer using the `from()` method in the Buffer class.

```javascript
// data
const data = [0x1, 0x2, 0x3, 0x4, 0x5];

// for an example first let's convert
// this object to buffer
const buff = Buffer.from(data);
```

Now let's convert this buffer to `JSON` using the `toJSON()` method in the `buff` object.

```javascript
// data
const data = {
  name: "John Doe",
  age: 23,
};

// for an example first let's convert
// this object to buffer
const buff = Buffer.from(data);

// buffer to JSON
// using the toJSON() method
const json = buff.toJSON();

console.log(json);
/*
{ type: 'Buffer', data: [ 1, 2, 3, 4, 5 ] }
*/
```

- The actual data will be in a property called `data` and the type of data is in a property called `type` in the json object.

See this example live in [repl.it](https://repl.it/@melvin2016/Convert-buffer-to-JSON).

### Feel free to share if you found this useful 😃.

---
.NET Core Rendering Host - Experience Editor 404 error
Tags: sitecore, netcore, renderinghost, experienceeditor
Published: 2020-09-23 01:07:26

---
title: .NET Core Rendering Host - Experience Editor 404 error
published: true
date: 2020-09-23 00:00:00 UTC
tags: Sitecore, NETCore, RenderingHost, ExperienceEditor
canonical_url: https://robearlam.com/blog/net-core-renderinghost-experience-editor-404-error
---

So we've been rebuilding the Sitecore MVP site currently, and you can see how were going as the repository is Open Source, meaning you can see how we're progressing right [here](https://github.com/Sitecore/MVP-Site).One of the issues we ran into during this build stopped our site from loading in the Sitecore Experience Editor, we kept getting the following 404 error:```Error Rendering Sitecore.JavaScriptServices.ViewEngine.Presentation.JsLayoutRenderer: The remote server returned an error: (404) Not Found. at System.Net.WebClient.UploadDataInternal(Uri address, String method, Byte[] data, WebRequest& request) at System.Net.WebClient.UploadString(Uri address, String method, String data) at Sitecore.JavaScriptServices.ViewEngine.Http.RenderEngine.Invoke[T](String moduleName, String functionName, Object[] functionArgs) at Sitecore.JavaScriptServices.ViewEngine.Presentation.JssRenderer.PerformRender(TextWriter writer, IRenderEngine renderEngine, String moduleName, String functionName, Object[] functionArgs) at Sitecore.JavaScriptServices.ViewEngine.Presentation.JssRenderer.Render(TextWriter writer) at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args)```After a bit of digging, it turns out we were missing a couple of environment variables in our Docker-Compose yaml. We only had the following values defined for our Rendering Host container:``` environment: ASPNETCORE_ENVIRONMENT: "Development" ASPNETCORE_URLS: "http://*:80" Sitecore __InstanceUri: "http://cd"```The two we were missing were the `Sitecore__ RenderingHostUri` and `Sitecore __EnableExperienceEditor` values. Once we added those back in, our Experience Editor integration started working fine again. The final rendering container definition we ended up with was:``` environment: ASPNETCORE_ENVIRONMENT: "Development" ASPNETCORE_URLS: "http://*:80" Sitecore__ InstanceUri: "http://cd" Sitecore __RenderingHostUri: "https://${RENDERING_HOST}" Sitecore__ EnableExperienceEditor: "true"```You can see our full Docker-Compose yaml file [here](https://github.com/Sitecore/MVP-Site).
🎁 A collection of Kafka-related talks 💝
Tags: apachekafka, techtalks, data, learning
Published: 2020-09-24 08:50:25

---
title: 🎁 A collection of Kafka-related talks 💝
published: true
date: 2020-09-23 00:00:00 UTC
tags: apachekafka, techtalks, data, learning
canonical_url: https://rmoff.net/2020/09/23/a-collection-of-kafka-related-talks/
---

Here’s a collection of Kafka-related talks, _just for you._

Each one has 🍿🎥 a recording, 📔 slides, and 👾 code to go and try out. 

* * *

## Let’s get started with the foundations - what _is_ Apache Kafka? 

👉 [Kafka as a Platform: the Ecosystem from the Ground Up](https://rmoff.dev/kafka101)

another introductory talk, going into some of the detail of ksqlDB

➡️ [Introduction to ksqlDB](https://rmoff.dev/ljc-kafka-03)

* * *

## Theory and foundations are useful, but what about seeing the concepts do something…

▶️ [Apache Kafka and ksqlDB in Action: Let’s Build a Streaming Data Pipeline!](http://rmoff.dev/bigdataldn2020)

* * *

## Real-life examples

Here’s a nice example using real data to solve a real problem - is my train late now? What are the routes most likely to be delayed? 

🚂 [On Track with Apache Kafka: Building a Streaming Platform solution with Rail Data](https://rmoff.dev/oredev19-on-track-with-kafka)

Moving from 🚆to 🚗, let’s take another real data feed and build some realtime location-based notifications 📟

🤖 [Building a Telegram bot with Go, Apache Kafka, and ksqlDB](https://rmoff.dev/carpark-telegram-bot)

* * *

## Integration and data pipelines

Integration between Kafka and other systems? Kafka Connect has you covered ⚡

⏱️ [Kafka Connect in 60 seconds](https://rmoff.dev/what-is-kafka-connect)

🦸‍ [From Zero to Hero with Kafka Connect](https://rmoff.dev/ljc-kafka-02)

🧞 [No More Silos: How to Integrate Your Databases with Apache Kafka and CDC](https://talks.rmoff.net/gnw8Mf/no-more-silos-integrating-databases-and-apache-kafka)

The question that always comes up when we talk about integration - how to get data from Oracle into Apache Kafka?

ℹ️ [Integrating Oracle and Kafka](https://rmoff.dev/oracle-and-kafka)

* * *

## Architecture

A change of pace from the hands-on, and instead some architectural consideration and thoughts.

🏛 [The Changing Face of ETL: Event-Driven Architectures for Data Engineers](https://rmoff.dev/oredev19-changing-face-of-etl)

* * *

## For more great Apache Kafka and Confluent Platform content subscribe to these Youtube channels 👍

🎥 [Robin Moffatt](https://youtube.com/rmoff)

🎥 [Viktor Gamov](https://www.youtube.com/ViktorGamov)

🎥 [Confluent](https://www.youtube.com/confluent)
🌒 JakartaEE JSON-B 🐝 Retrofit2 Converter
Tags: jakartaee, jsonb, serialization, retrofit
Published: 2020-09-23 09:13:49

---
title: 🌒 JakartaEE JSON-B 🐝 Retrofit2 Converter
published: true
date: 2020-09-23 00:00:00 UTC
tags: jakartaee,jsonb,serialization,retrofit
cover_image: https://carloschac.in/public/images/retrofit2.png
canonical_url: https://carloschac.in/2020/09/23/jsonb-retrofit2-converter/
---

> Retrofit is pluggable allowing different serialization formats and their libraries to be used for converting Java types to their HTTP representation and parsing HTTP entities back into Java types.
> 
> These are called converters, and Retrofit includes a few first-party modules for popular frameworks

Just for fun, I created a [Retrofit2]((https://square.github.io/retrofit/)) `Converter.Factory` for [JakartaEE Json-B]((http://json-b.net/)).

<!-- more -->
### Usage

#### Add the dependencies:

##### Retrofit2

```
<dependency>
  <groupId>com.squareup.retrofit2</groupId>
  <artifactId>retrofit</artifactId>
  <version>2.9.0</version>
</dependency>

```

##### OkHttp3

```
<dependency>
  <groupId>com.squareup.okhttp3</groupId>
  <artifactId>okhttp</artifactId>
  <version>3.14.9</version>
</dependency>

```

##### JakartaEE Json Binding Reference Implementation

```
<dependency>
  <groupId>org.eclipse</groupId>
  <artifactId>yasson</artifactId>
  <version>1.0.8</version>
</dependency>

```

##### JsonB Retrofit2 Converter

```
<dependency>
  <groupId>io.github.cchacin</groupId>
  <artifactId>jsonb-retrofit-converter</artifactId>
  <version>1.0.2</version>
</dependency>

```

Add a converter factory when building your `Retrofit` instance using the`create` method:

```
var retrofit = new Retrofit.Builder()
    .baseUrl("https://example.com/")
    .addConverterFactory(JsonbConverterFactory.create())
    .build();

```

Alternatively, you can pass an instance of `javax.json.bind.Jsonb`:

```
var jsonb = JsonbBuilder.create(/* configure your jsonb instance here */ );
var retrofit = new Retrofit.Builder()
    .baseUrl("https://example.com/")
    .addConverterFactory(JsonbConverterFactory.create(jsonb))
    .build();

```

Now we are able to use **JakartaEE JsonB** to serialize and deserialize POJOs using **Retrofit2**

The code is available on Github:

{% github cchacin/jsonb-retrofit-converter %}
Understanding React Rendering
Tags: javascript, node, react, render
Published: 2020-09-23 16:43:36

---
title: Understanding React Rendering
published: true
date: 2020-09-23 00:00:00 UTC
tags: JavaScript,Node,React,Render, reactjs
canonical_url: https://www.loginradius.com/engineering/blog/understanding-react-rendering/
---

Learn to optimize the React rendering process.

   
[Read On](https://www.loginradius.com/engineering/blog/understanding-react-rendering/)