teleren/devto huggingface dataset:
Speed Up And Simplify Your Streaming Data Workloads With Red Panda - Episode 152
Published: 2020-10-04 02:10:25

<p>Kafka has become a de facto standard interface for building decoupled systems and working with streaming data. Despite its widespread popularity, there are numerous accounts of the difficulty that operators face in keeping it reliable and performant, or trying to scale an installation. To make the benefits of the Kafka ecosystem more accessible and reduce the operational burden, Alexander Gallego and his team at Vectorized created the Red Panda engine. In this episode he explains how they engineered a drop-in replacement for Kafka, replicating the numerous APIs, that can scale more easily and deliver consistently low latencies with a much lower hardware footprint. He also shares some of the areas of innovation that they have found to help foster the next wave of streaming applications while working within the constraints of the existing Kafka interfaces. This was a fascinating conversation with an energetic and enthusiastic engineer and founder about the challenges and opportunities in the realm of streaming data.</p><p><a href='https://www.dataengineeringpodcast.com/vectorized-red-panda-streaming-data-episode-152/'>Listen Now!</a></p>
Python Subprocess – Execute Shell Commands
Tags: python, computerscience, linux
Published: 2020-10-04 02:09:14

Python subprocess is a module in python that helps us to execute shell commands, get the input/output/error pipes, and the error codes for the executed command from the python language.

##Why Python Subprocess Module?
Do you know any other module in python which can help us to execute the shell commands? Your answer will be the ‘os’ module in python.

The os.system() can help us to execute the shell commands from the python program but the problem is that we cannot get the output of the executed command in our python program.

os.system()
```
>>> import os

>>> os.system('ls')

main.py  requirements.txt  venv
```
The output is generated at the terminal. We can only retrieve the error code for the executed shell command.

Example:

Error code in os.system()
```
import os

out = os.system('ls')

>>> print(out)

0
```
One way to get the output of the executed shell command is by using the pipeline operator to store the output in a text file and then read the file in the python program.

Example:

os.system() pipeline
```
import os

os.system('ls > output.txt')

file = open('output.txt','r')

>>> print(file.read())

output.txt
main.py
requirements.txt
venv
```
Python subprocess module is a high-level interface for executing shell commands from the python program and is intended to replace the following python modules and functions:

*os.system()
*os.spawn*()
*os.popen*()
*popen2.*()
*commands.*()
According to the python official documentation, the subprocess module will rule these previously stated functions as they are going to be deprecated very soon.

Now when you know why to choose subprocess in python and what functions it is going to replace. So let’s learn about Python Subprocess Module.

##Python Subprocess Run Function
```subprocess.run(args, *, stdin=None, input=None, stdout=None, stderr=None, capture_output=False, shell=False, cwd=None, timeout=None, check=False, encoding=None, errors=None, text=None, env=None, universal_newlines=None, **other_popen_kwargs)```

The subprocess.run() function was added in Python 3.5 and it is recommended to use the run() function to execute the shell commands in the python program.

The args argument in the `subprocess.run()` function takes the shell command and returns an object of CompletedProcess in Python.

Example:

CompletedProcess Object
```
out = subprocess.run('ls', shell=True)

>>> print(out)

CompletedProcess(args='ls', returncode=0)
```

Learn more about [Python Subprocess](https://hackthedeveloper.com/python-subprocess-execute-shell-commands/) from the original Post. [Read more](https://www.google.com/search?q=python+subprocess+site%3Ahackthedeveloper.com).
Solving Python Package Creation For End User Applications With PyOxidizer - Episode 282
Published: 2020-10-04 02:06:17

<p>Python is a powerful and expressive programming language with a vast ecosystem of incredible applications. Unfortunately, it has always been challenging to share those applications with non-technical end users. Gregory Szorc set out to solve the problem of how to put your code on someone else's computer and have it run without having to rely on extra systems such as virtualenvs or Docker. In this episode he shares his work on PyOxidizer and how it allows you to build a self-contained Python runtime along with statically linked dependencies and the software that you want to run. He also digs into some of the edge cases in the Python language and its ecosystem that make this a challenging problem to solve, and some of the lessons that he has learned in the process. PyOxidizer is an exciting step forward in the evolution of packaging and distribution for the Python language and community.</p><p><a href='https://www.pythonpodcast.com/pyoxidizer-python-package-creation-episode-282/'>Listen Now!</a></p>
Facade Pattern
Tags: structural, pattern, designpatterns, java
Published: 2020-10-04 01:55:35

Provide a unified interface to a set of interfaces in a subsystem. Façade defines a higher-level interface that makes the subsystem easier to use.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/txfgxgbcp97n0lpjjsni.gif)

#Participants#

* Facade: knows which subsystem classes are responsible for a request. Delegates client requests to appropriate subsystem objects.
* Subsystem classes: implement subsystem functionality.
Handle work assigned by the Facade object.
Have no knowledge of the facade and keep no reference to it.

#Code#
```java
public class Main {

	public static void main(String[] args) {
		Facade facade = new Facade();
		facade.methodA();
		facade.methodB();
	}
}

public class SubSystemOne {
	public void methodOne() {
		System.out.println(" SubSystemOne Method");
	}
}

public class SubSystemTwo {
	public void methodTwo() {
		System.out.println(" SubSystemTwo Method");
	}
}

public class SubSystemThree {
	public void methodThree() {
		System.out.println(" SubSystemThree Method");
	}
}

public class SubSystemFour {
	public void methodFour() {
		System.out.println(" SubSystemFour Method");
	}
}

public class Facade {

	private SubSystemOne one;
	private SubSystemTwo two;
	private SubSystemThree three;
	private SubSystemFour four;

	public Facade() {
		one = new SubSystemOne();
		two = new SubSystemTwo();
		three = new SubSystemThree();
		four = new SubSystemFour();
	}

	public void methodA() {
		System.out.println("\nmethodA() ---- ");
		one.methodOne();
		two.methodTwo();
		four.methodFour();
	}

	public void methodB() {
		System.out.println("\nmethodB() ---- ");
		two.methodTwo();
		three.methodThree();
	}
}
```

#Output#
```
methodA() ---- 
 SubSystemOne Method
 SubSystemTwo Method
 SubSystemFour Method

methodB() ---- 
 SubSystemTwo Method
 SubSystemThree Method
```
{% github https://github.com/eidherjulian61/design-patterns no-readme %}
{% link https://dev.to/eidher/principales-patrones-de-diseno-13ao
 %}
React(&Native) Submit and Validate with Formik from outside the Form
Tags: react, reactnative, formik, hooks
Published: 2020-10-04 01:50:33

---
title: React(&Native) Submit and Validate with Formik from outside the Form
published: true
description: 
tags: React, ReactNative, Formik, Hooks
//cover_image: https://direct_url_to_image.jpg
---

Let's say you need to call the Submit event from Formik from outside the form for whatever reason, the form is in an external component for example. The `useRef` hook will help here:

```javascript
import React, { useState, useRef } from 'react';

const YourComponent = () => {
  const formRef = useRef();
  const [input, setInput] = useState({});
  const [step, setStep] = useState(1);

  const saveInput = () => {
    if (formRef.current) {
      formRef.current.handleSubmit();
      if (formRef.current.isValid) {
        setStep(2);
      }
    }
  };

  const ValidationSchema = Yup.object().shape({
    name: Yup.string().min(2, 'Too Short!').max(50, 'Too Long!').required('Required'),
  });

  return (
    <View>
      <Formik
        initialValues={{
          name: '',
          description: '',
          points: '',
          redemptionsTotal: '',
          redemptionsPerUser: '',
        }}
        validationSchema={QrCodeSchema}
        validateOnChange={true}
        validateOnBlur={false}
        validateOnMount
        onSubmit={(values) => setInput(values)}
        innerRef={formRef}
      >
        {({ handleChange, handleBlur, values, touched, errors }) => {
          return (
            <FormInput
              allowFontScaling={false}
              onChangeText={handleChange('name')}
              onBlur={handleBlur('name')}
              value={values.name}
              error={errors.name}
              touched={touched.name}
              name="name"
              placeholder="TITLE"
              returnKeyType="next"
              blurOnSubmit={false}
              style={styles.inputStyle}
            />
          );
        }}
      </Formik>
      <YourActionsComponent>
        <Button name="submit" title={'Define Dates'} onClick={() => saveInput()} style={styles.stepButton} />
      </YourActionsComponent>
    </View>
  );
};

```

In this small example, where we have a wizard-like modal where the user fills a few inputs in every step, we set that when the form mounts it will check if there are any invalid inputs and it won't let the step change happen if so.

We save the form data from Formik into the form ref, there we have access to all the important state from the form (run a `console.log(formRef.current)` to see more) and you can programmatically call the submit from outside this way.

For more info about Formik validation https://formik.org/docs/guides/validation
YAML (and JSONC) failed as a data transfer format with comments
Tags: yaml, discuss
Published: 2020-10-04 01:27:15

Deserializing to native data structures typically results in comment loss, and you cannot really write comments programmatically. (In most implementations, actually. You can indeed preserve comments in [Python's ruamel.yaml](https://yaml.readthedocs.io/en/latest/).)

Solution? I suggest a half-deserialized format, XML tree ([with comments](https://www.tutorialspoint.com/xml/xml_comments.htm)), then traverse via XPath, only to continue to native data structures, if asked to.
My Recursion Tree Visualizer project went viral on Linkedin
Tags: javascript, react, computerscience
Published: 2020-10-04 00:34:16

Recently I finished my favorite side project by now.

It is a Recursion Tree Visualizer that helps programmers understand recursion. You input any recursive function using javascript code and visualize your corresponding recursion tree.

I first published this in my Linkedin profile and I was surprised by the quick engagement that the [post](https://www.linkedin.com/feed/update/urn:li:activity:6716531439292211200/) generated.

![Screen Shot 2020-10-03 at 21.40.35](https://dev-to-uploads.s3.amazonaws.com/i/1pi68zg0ynq9y4gdwfwq.png)

More than 15K views and more than 1K likes in just a few days 🤯.
 
If you want just to try it out, access https://recursion.now.sh.
Google maps on React
Published: 2020-10-04 00:10:40

This week I wanted to add a page to my grocery store application where you could show the location of the store using google maps. I tried using the Google maps Javascript API documentation, which asks you to load a script tag with the API url and key, but that led to some CORS issues for me. Based on some articles that I read, it had something to do with the issue of not being able to run the script from a front end application. So, I ended up using a library called Google Maps React which allows you to hook up the Google Maps API directly to your components. 

**Getting the API Key**

You still need access to an API key in order for you to gain access to this library so you'll want to head over to the Google's developer console in order to sign up for an account and get the API key. 

After you're connected, you will want to enable certain API's that you want to use, and for my own purposes, I enabled the Maps Javascript API and the Geocoding API. The first is for the actual rendering of the map, and the second is for converting addresses into coordinates. 

Lastly, you will want enable a billing account, where you have to give your credit card information. You won't get charged intially since there is a free trial of 3 months during which you get 300 dollars worth of credit. Very pricey, and thinking of looking for other solutions, before the free trial is over.

**Google Maps React**

Once you get your API key you have everything you need to use Google Maps React. If you want to see the full documentation, it is available on their [npm page]
(https://www.npmjs.com/package/google-maps-react).

First install the library
`npm install google-maps-react`

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7kiegmf29bw1fg842ins.PNG)

Here are some of the imports that I used for my map component, the required ones being the Map and GoogleApiWrapper.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/k2lc3xjeomqrfmsj7x7s.PNG)

This is the component itself. I ended up using the markers for marking out where my stores were and obviously the map component intself. The properties of concern for my app were the initialCenter of the map component and position attributes for the markers. I wanted the map to start on the store's location and the markers to mark out the user's location and store's location. 

The user's location was using the navigator object available on the browser, and the store's location was using sending parameters of the store's address to the Geocoding API I enabled. Both of these return object literals that have 'lat' and 'lng' properties, that can be passed into the respective component properties to get our desired map configuration.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/2lvizkmsd1paqefzf8dj.PNG)

Last but not least we have our API's export statement, which we need to insert our API key. I simply wrote a note here, but you'll want to hide it in an env file which is git ignored so that it's hidden.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5r0irh3nhpnlxzn7jh05.PNG)

And there you have it! Google Maps on your React app.
How to add an element after a DOM element in JavaScript?
Tags: javascript
Published: 2020-10-04 00:00:00

---
  title: How to add an element after a DOM element in JavaScript?
  published: true
  tags: JavaScript
  date: Sun Oct 04 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/insert-after-element-dom-javascript
  cover_image: https://melvingeorge.me/_next/static/images/main-ff4d09d994ed86b6255ea93c6dbefd50.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/insert-after-element-dom-javascript)
  
To insert a text or an element after an element, we can use the `after()` method in the element object in JavaScript.

Let's say we have a HTML structure like this with a `div` tag and 2 `paragraph` tags inside it,

```html
<div>
  <p id="para1">I'm paragraph 1</p>
  <p id="para2">I'm paragraph 2</p>
</div>
```

What if we want to insert a text or another element after the `para1` paragraph tag? Well, Don't worry, we can use the `after()` method of `para1` paragraph tag to insert an element or a text.

So first, let's get the reference to the `para1` paragraph tag like this,

```javascript
// get reference to para1 paragraph tag
const para1 = document.querySelector("#para1");
```

Now let's use the `after()` method in the `para1` element and pass another `span` element as an argument to the `after()` method.

```javascript
// get reference to para1 paragraph tag
const para1 = document.querySelector("#para1");

// create a span element
const span = document.createElement("span");
span.innerHTML = "I'm a span tag";

// use the after() method in the para1 tag
// to add the span tag after the para1 paragraph
// element
para1.after(span);
```

We can also add text content using the `after()` method.

```javascript
// get reference to para1 paragraph tag
const para1 = document.querySelector("#para1");

// create a span element
const span = document.createElement("span");
span.innerHTML = "I'm a span tag";

// use the after() method in the para1 tag
// to add the span tag after the para1 paragraph
// element
para1.after(span);
para1.after("I'm just a text");
```

Now the output looks like this,

```html
<!-- 
    I'm paragraph 1
    I'm just a text I'm a span tag
    I'm paragraph 2
 -->
```

See this example live in [JSBin](https://jsbin.com/wuzuqovovo/edit?html,js,output).

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

---
Whoisdomainthis - Domain Statistic Search Tool
Published: 2020-10-03 23:59:29

Free Domain Statistic Search Tool shows you related information about domain name such as WHOIS record/DNS records, number of pages indexed in Search Engines (Google, Yahoo, Bing), Server IP and Geo location, Alexa statistic, Like count and more...

WHOIS Lookup Tool
https://whoisdomainthis.com/whois.html

DNS Record Lookup
https://whoisdomainthis.com/dns.html

IP Address Lookup
https://whoisdomainthis.com/ip.html

What Is My Public IP Address?
https://whoisdomainthis.com/whatismyip.html

Favicon Generator
https://whoisdomainthis.com/favicon/
Pickles? Finance? Find out what the hype is about!
Published: 2020-10-03 23:56:40

#### What is Pickle? 
[Pickle](https://pickle.finance) is an experimental protocol using farming rewards, vaults, and governance to put stable coins closer to their pegs.

#### Abstract
To bring stable coins closer to their pegs, the Pickle protocol uses farming rewards, vaults, and governance. By distributing PICKLEs to [Uniswap](https://uniswap.info/) LPs of different stable coin pools, capital movement between stable coins is encouraged. Pickle Vaults, will use various active strategies to produce returns for pVault owners and the protocol, including leveraged flash loans to short off-peg stable coins.

#### Why does Pickle exist?
Due to varying market conditions and monetary policy restrictions, Stable coins have often gone off peg. This problem has only been compounded by the recent boom in yield farming as farmers purchase and sell vast quantities of stable coins to find the best yield. 
A much more stable stable coin ecosystem is needed for the DeFi ecosystem to flourish.

![Website](https://user-images.githubusercontent.com/30378184/95003833-670fd680-05db-11eb-99a9-b706ac5ed181.png "screenshot of site")

#### How do I start farming?
Visit [Pickle Finance](https://pickle.finance) and unlock and link your wallet. Then you can deposit UNIV2 PICKLE/ETH LP and earn Pickle in return.
DNS.glass checks the health and configuration & provides DNS report and mail servers report.
Published: 2020-10-03 23:54:18

DNS.glass checks the health and configuration & provides DNS report and mail servers report.

And provides suggestions to fix and improve your domain DNS, with references to protocols’ official documentation. 

https://dns.glass/google.com
https://dns.glass/name.com
https://dns.glass/bluehost.com
https://dns.glass/dns.glass
TempMail - Forget about spam, advertising mailings, hacking and attacking robots.
Tags: tempmail
Published: 2020-10-03 23:47:05

https://TempMail.at

Free Temporary Email Address- tempmail, 10minutemail, throwaway email, fake-mail or trash-mail!

Forget about spam, advertising mailings, hacking and attacking robots. Keep your real mailbox clean and secure. tempmail.at provides free temporary, secure, anonymous, free, disposable email address.
2020 - AWS Solutions Architect – Associate (SAA-C02) Certification
Published: 2020-10-03 23:40:28


If you are planning to take the `AWS Solutions Architect` certification, here you will find some useful material:
* [Official AWS documentation](#aws-docs)
* [Courses](#courses)
* [Labs](#labs)
* [Practice Tests](#tests)
* [Blogs](#blogs)
* [Other Resources](#other-resources)

### AWS docs <a name="aws-docs"></a>

### Courses <a name="courses"></a>
* [Exampro YouTube Full Course](https://www.youtube.com/watch?v=Ia-UEYYR44s)
* [Exampro website](https://www.exampro.co/aws-exam-solutions-architect-associate
)
* [Cloudacademy](https://cloudacademy.com/learning-paths/aws-solutions-architect-associate-saa-c02-certification-preparation-954/)

### Labs <a name="labs"></a>

### Practice Tests <a name="tests"></a>
* [www.whizlabs.com](https://www.whizlabs.com/aws-solutions-architect-associate/practice-tests/)

### Blogs <a name="blogs"></a>
* https://medium.com/@neal_davis/aws-certified-solutions-architect-saa-c02-how-to-best-prepare-in-5-steps-429e0d5797c5
* https://dev.to/sunilc_/most-commonly-used-aws-services-and-how-we-are-using-them-238n

### Other resources <a name="other-resources"></a>
* https://acloudguru.com/
How Spring implements Singleton Beans
Tags: singleton, beans, spring, java
Published: 2020-10-03 23:22:13

In the next example, the dataSource method is a bean that is called twice. However, we know that a bean is a singleton by default in Spring (see the link below):

{% link https://dev.to/eidher/dependency-injection-using-spring-ckk %}

```java
@Configuration
public class AppConfig {

	@Bean
	public DataSource dataSource() {
		return new JdbcDataSource();
	}

	@Bean
	public DevRepository devRepository() {
		JdbcDevRepository repository = new JdbcDevRepository(dataSource);
		repository.setDataSource(dataSource());
		return repository;
	}

	@Bean
	public ProdRepository prodRepository() {
		JdbcProdRepository repository = new JdbcProdRepository();
		repository.setDataSource(dataSource());
		return repository;
	}
}
```

At startup time, a subclass is created using [cglib](https://github.com/cglib/cglib)  (Code Generation Library). It only calls super in the first invocation of the bean, then one instance is cached by the application context and the child class is the entry point. 

```java
@Configuration
public class AppConfig$$EnhancerByCGLIB$ extends AppConfig{
...
}
```

However, cglib does not support classes with constructors (autowired constructors are possible since Spring 4.3. See [Spring Injection Types](https://dev.to/eidher/spring-injection-types-c6d)), so Spring now uses [objenesis](http://objenesis.org) to overcome this.

{% link https://dev.to/eidher/singleton-pattern-9e7 %}