teleren/devto huggingface dataset:
Kafka Replication with Cloudera Streams Replication Manager
Tags: 2020, apachekafka
Published: 2021-02-24 19:56:24

---
title: Kafka Replication with Cloudera Streams Replication Manager
published: true
date: 2021-02-23 19:22:00 UTC
tags: 2020,apachekafka
canonical_url: 
---

# Kafka Replication with Cloudera Streams Replication Manager

  

**Source Code:**    [https://github.com/tspannhw/EmergingTechnologyDay2020](https://github.com/tspannhw/EmergingTechnologyDay2020)

  

**Source Event: **  [https://www.cloudera.com/about/events/virtual-events/cloudera-emerging-technology-day.html](https://www.cloudera.com/about/events/virtual-events/cloudera-emerging-technology-day.html?utm_medium=clouderan&utm_source=field&keyplay=ALL&utm_campaign=FY21-Q2_VE_USPS_Emerging%20Tech%20Day_2020-05-13&cid=7012H000001OjFx)
Serverless Python Chatbot in Azure
Tags: python, azure, serverless
Published: 2021-02-23 19:20:33

Why Chat Bots?
Chatbots becoming increasingly prominent in organizations around the world. The exchange of information between companies and costumers to completely replacing any middle layer teams.
We can expect that up to 75% of queries in the customer service sector will be handled by bots by 2022 driving business costs of more than 10 billion dollars per year.

Why Serverless?
Serverless computing is a cloud computing execution model in which the cloud provider allocates machine resources on demand, taking care of the servers on behalf of their customers.
It works on pay per usage consumption model. It is PaaS offering or FaaS (Functions as a Service) HA (highly available), scalable and it support polygot application deployment. 

Following are few steps to get your bot built and set up.
What you will need is simply an Azure Subscription, Visual Studio Code (VSCode) installed in your machine alongside some version of Python!

Step 1: Register a new Web App Bot service on Azure Portal
Step 2: Set up Azure access through VSCode
Step 3: Create a new Azure Function App project
Step 4: Modify the code for your Function App
Step 5: Test your API locally
Step 6: Deploy your Function App to Azure
Step 7: Connecting the BOT to the Server-less Function
Step 8: Publishing your Bot to a Channel
Step 9: Publish your Bot App to MSTeams/Slack
Spring Data JPA Against Big Data Sources
Published: 2021-02-24 19:56:40

---
title: Spring Data JPA Against Big Data Sources
published: true
date: 2021-02-23 19:20:00 UTC
tags: 
canonical_url: 
---

## Spring Data JPA Against Big Data Sources

  

  

Download Hive JDBC Driver

  

[https://www.cloudera.com/downloads/connectors/hive/jdbc/2-6-5.html](https://www.cloudera.com/downloads/connectors/hive/jdbc/2-6-5.html)

  

**References**

  

[https://docs.cloudera.com/documentation/other/connectors/hive-jdbc/2-6-9.html](https://docs.cloudera.com/documentation/other/connectors/hive-jdbc/2-6-9.html)

  

[https://community.cloudera.com/t5/Community-Articles/Writing-Spring-Boot-Microservices-To-Access-Hive/ta-p/247250](https://community.cloudera.com/t5/Community-Articles/Writing-Spring-Boot-Microservices-To-Access-Hive/ta-p/247250)

  

[https://shalishvj.wordpress.com/2018/06/02/hive-jdbc-spring-boot-restful-webservice-in-pivotal-cloud-foundry/](https://shalishvj.wordpress.com/2018/06/02/hive-jdbc-spring-boot-restful-webservice-in-pivotal-cloud-foundry/)

  

[https://github.com/tspannhw/hive/blob/master/pom.xml](https://github.com/tspannhw/hive/blob/master/pom.xml)

  

[https://github.com/firecodeman/Cloudera-Impala-Hive-JDBC-Example/blob/master/src/main/java/com/cloudera/example/ClouderaHiveJdbcExample.java](https://github.com/firecodeman/Cloudera-Impala-Hive-JDBC-Example/blob/master/src/main/java/com/cloudera/example/ClouderaHiveJdbcExample.java)

  

[https://docs.cloudera.com/documentation/other/connectors/hive-jdbc/Cloudera-JDBC-Driver-for-Apache-Hive-Release-Notes.txt](https://docs.cloudera.com/documentation/other/connectors/hive-jdbc/Cloudera-JDBC-Driver-for-Apache-Hive-Release-Notes.txt)

  

[https://start.spring.io/](https://start.spring.io/)
What's the coolest project you've worked on? (frontend,backend)
Published: 2021-02-23 19:17:00

Just wanted to get some feedback from people and have an open discussion about some of the coolest projects you've been apart of. Whether open source or private projects. Ill update this post with some links to the projects too if people want them posted.

For me working on offerly.io was a phenomenal project, react wise there is a ton built into this product and is all ran serverless. 

Tell me about some cool projects you've worked on and if your'e looking to contribute in projects!
Announcing the Spring 2021 Chainlink Hackathon!

Published: 2021-02-23 19:01:22

We're excited to announce the Spring 2021 Chainlink Virtual Hackathon from March 15th to April 11th!

- Compete to win over $80k+ in prizes

- Every participant that submits a valid project earns 1 LINK

- Learn in workshops with top protocols in DeFi, gaming, and more

- Team up with other devs to build a product that showcases your creativity

- Be seen by top recruiters in the space

Join the Hackathon channels in the Chainlink Technical Discord to be part of building the future with Chainlink oracles. We can’t wait to see what you’ve been dreaming up, so sign up now and let’s get hacking.

Register here ➡️ http://chn.lk/3aEozOC
Python Singletons
Tags: python, oop, architecture, singleton
Published: 2021-02-23 18:51:40

A long time has passed since I last wrote a Singleton. Definitively, we rarely write singleton patterns in Python because we can represent singletons as variables in a module, and import them everywhere - see my strategy for [logging library wide](https://dev.to/joaomcteixeira/setting-up-python-logging-for-a-library-app-6ml).

However, how should we construct a singleton class which represents a state that is initialized (loaded/read) together with the class first instantiation and for which we don't want the whole loading process to be repeated in case the singleton class is instantiated again at a different stage of the runtime?

Well, here it is:

```python
class MyClass:
    _state = None

    def __new__(cls, *args, **kwargs):

        if cls._state:
            print('State already exists, returning existing state.')
            return cls._state

        elif cls._state is None:
            cls._state = super().__new__(cls)
            return cls._state

    def __init__(self, arg):
        self.arg = 1


a = MyClass(1)
print(a.arg)  # 1
b = MyClass(2)
print(b.arg)  # 1

assert a is b  # True
```

Enjoy and Cheers,
10 LINQ OPERATORS THAT WILL HELP YOU WORK EFFECTIVELY WITH COLLECTIONS IN C#
Tags: csharp, codenewbie, beginners, dotnet
Published: 2021-02-23 18:47:33

Hey, I wrote a short ebook about LINQ and 10 operators. It contains code examples of how you can use LINQ. There's also a nice bonus section in the end.

I'll be clear with you, it requires a subscription to the newsletter if you want to get it. However, if you're learning C# and putting your first steps into the .NET world, you will like it. 

If you're pro or you don't like subscribing to newsletters, please DON'T JOIN.

https://dotnetcoreschool.com
Weekly Fronted Digest (15 February - 21 February)
Published: 2021-02-23 18:12:18

What`s cooking, good-looking?
Check out my own digest in English (originally in Russian). Here are the articles that I paid more attention to than the others.

Give me some feedback plz. It`s my first try to make a digest. Check the full version in Russian on my Github: https://github.com/Ra1nbow1/weekly_frontend_digest

We`re about to start


**6 best fonts for programming:**
https://dev.to/braydoncoyer/6-best-fonts-for-programming-in-2021-373c

**10 trending projects for web devs:**
https://dev.to/iainfreestone/10-trending-projects-on-github-for-web-developers-19th-february-2021-hpi

**A complete guide to CSS-property Transition:**
https://www.joshwcomeau.com/animation/css-transitions/

**15 Helpful JavaScript One-Liners:**
https://js.plainenglish.io/15-helpful-javascript-one-liners-946e1d1a1653

**Add a selection of interesting projects with Codepen?**

Follow me on <a href="https://github.com/ra1nbow1">Github</a> and <a href="https://twitter.com/romanov_web">Twitter</a><3
The 7 Most Popular DEV Posts from the Past Week
Tags: top7
Published: 2021-02-23 18:06:48

---
title: The 7 Most Popular DEV Posts from the Past Week
published: true
description: A round-up of the most-read and most-loved contributions from the community this past week.
tags: icymi
cover_image: https://thepracticaldev.s3.amazonaws.com/i/sfwcvweirpf2qka2lg2b.png
---
_Every Tuesday, we round up the previous week's top posts based on traffic, engagement, and a hint of editorial curation. The typical week starts on Monday and ends on Sunday, but don't worry, we take into account posts that are published later in the week._ ❤️

### UI fundamentals

If you don't have experience as a UI designer, these tips from @doabledanny will help you implement great design into your applications without needing to take a class. 

{% link https://dev.to/doabledanny/11-easy-ui-design-tips-for-web-devs-j3j %} 

### Nerve-busting interview prep
@thecaitcode said that in their experience, developers tend to focus mostly on technical interview prep — but only 30% of the questions fall into that category. Don't overlook those product, agile, and soft-skills-related questions while preparing for your next interview. 

{% link https://dev.to/thecaitcode/non-technical-frontend-interview-questions-1o5 %}



### Vite! Vite!

@yyx990803 recently joined DEV and had a pretty awesome announcement right out of the gate — Vite 2.0!

{% link https://dev.to/yyx990803/announcing-vite-2-0-2f0a %}

### Practice and patience makes perfect

@pfacklam says that aiming to be a better developer already takes you a big step further. If you take the time and work on yourself, the rest will come naturally ❤️ 

{% link https://dev.to/pfacklam/are-you-a-good-developer-already-3j2n %}

### How Lighthouse measures performance

@laurieontech dives into Lighthouse: what it does, why that's important, and how it differs from other tools.  

{% link https://dev.to/laurieontech/performance-tools-4clf %}

### Why would you want to know if an element is visible in the browser's viewport?

LOTS of reasons. @emmaccen helps us figure out how to know and detect if an element is visible in the browser's viewport and shares a hefty sample list of why this might matter to you. 

{% link https://dev.to/emmaccen/how-to-know-if-an-element-is-visible-in-viewport-c45 %}

### Ruby: A Love Story

Considering DEV is powered by Ruby on Rails, I was all about this post by @sylwiavargas. Turns out a lot of other folks were, too!

{% link https://dev.to/sylwiavargas/why-do-you-love-ruby-actually-an-ode-5e7n %}

_That's it for our weekly wrap up! Keep an eye on dev.to this week for daily content and discussions...and if you miss anything, we'll be sure to recap it next Tuesday!_
"use strict" in javascript
Tags: javascript, es5, ecmascript6, webdev
Published: 2021-02-23 18:00:32

Javascript is crazy language it will allow us to write bad code that we shouldn't do.

`use strict` directive introduced in ECMAScript version 5. It is to indicate that the code should be executed in "strict mode". 

This directive will tell to interpreter to turn badly written JavaScript into errors for example.

```javascript
x = 200
console.log(x) // 200
```
Here above snippet is a not a valid JS code because we haven't declared `x` variable with `let`, `var` or `const` so with the help of `use strict` we can solve this problem.

```javascript
"use strict"
x = 200
console.log(x) // ReferenceError: x is not defined
```
## Also helps to ?
This forces developers to write cleaner, more organized, and more readable code in the process. In fact, use strict is used by many famous JavaScript libraries such as ReactJS, jQuery, and more.

## What Exactly use strict will do 

###### Here are the some main features that strict mode includes
- Forces proper declaration of variables.
```javascript
x = 200
```
- Prevents global variables.
- Blocks assignment to non-writable global variables.
```javascript
NaN = 1
```
- Blocks repeated object property names.
```javascript
const x = {a: 1, b: 2, a: 3}
```
- Prevents variable/object hoisting.

-------

Strict mode is enabled by default for Ecmascript Modules. Projects built with Babel/Typescript doesn't require it.

Here in [MDN Web Docs Page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode) one can read more about the exact functionality of `use strict`.

Thanks 🙏 for reading. 
Hope you enjoyed it.
Chrome Extensions Manifest 3 Migration
Published: 2021-02-23 17:59:54

If we have an existing Manifest 2 Chrome extension and change it to Manifest 3, with a background scripts configuration like this:

```json
  "background": {
    "scripts": [
      "background.js"
    ],
    "persistent": true
  },
```
Compiling and reloading our extension shows this error.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jk8el1wmuk8wikt8hc3k.png)

That error is a result of migrating to the Chrome Extension Manifest version 3.

**Extensions API**

The Chrome Extensions [API](https://developer.chrome.com/docs/extensions/reference/) has a section on Manifest 3 changes. Background [scripts](https://developer.chrome.com/docs/extensions/mv3/intro/mv3-overview/#service-workers) must use service workers now. 

- Rename the backgroundscript.js to sw.js to reflect it's function:

- Update webpack config.

```json
entry: {
  popup: path.join(__dirname, "src/popup.tsx"),
  content: path.join(__dirname, "src/content.ts"),
  serviceWorker: path.join(__dirname, "src/sw.ts"),
  },
```

**[API Unification Changes](https://developer.chrome.com/docs/extensions/mv3/intro/mv3-migration/#action-api-unification)**



Deprecations of brower_actions and page_actions require changes to:
- The manfest.json file
- To our sw.js file.

>The browser_action and page_action constructs are no longer valid.

In the manifest, change those to this:
```json
{
  "action": { … }
}
```
Make change to sw.js code too.


```typescript
// From this:
chrome.browserAction.onClicked.addListener(tab => { … });
chrome.pageAction.onClicked.addListener(tab => { … });

// To this
chrome.action.onClicked.addListener(tab => { … });
```
For our small extension we were able to get a clean reload.

Our first attempts to implement our service workers failed

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/btbhjmzmf40w8yivv18f.png)

Coming up: Implementing Service Workers for Chrome Extensions using Manifest 3.

JWP2021 Chrome Extension Service Workers
PHP proposal: List Comprehension (like in Python)
Tags: php, laravel, symfony
Published: 2021-02-23 17:56:12

---
title: PHP proposal: List Comprehension (like in Python)
published: true
description: 
tags: php, laravel, symfony
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/urbw41krdn35mwtzfbra.jpg
---

There is a proposition on the table for PHP to add List Comprehension in a future version release.

For those who dont know what is List Comprehension we can define it as a shorthand syntax that offers a more compact, readable, and expressive way to define common list interactions.

Many languages have comprehensions of some form or another, and the syntax varies widely between them. The specific syntax proposed for PHP was initially inspired by Python.

You can see detail explanation with more examples here: https://wiki.php.net/rfc/comprehensions

Here a example
```php
// Normal interation
$gen = (function() use ($list) {
  foreach ($list as $x) {
    If ($x % 2) {
     yield $x * 2;
    }
  }
})();

// Shorthand List Comprehension
$gen = [for $list as $x if $x % 2 yield $x*2];

// General form
'[' ('for' <iterable expression> 'as' $key '=>' $value ('if' <condition>)?)+ (yield <expression>)? ']'
```

So what do you think about that? For my part, I use List Comprehension in Python and I love it, so cant wait!
React - create simple animated expander
Tags: react, javascript, webdev, css
Published: 2021-02-23 17:42:24

Hi there! 👋 😊

Today, I was thinking about creating an animated expander in React and I came up with the following solution. 🔽

__Before we start__, I would highly recommend you to check out __runnable examples__ for the solution on our website:
[How to create simple animated expander in React](https://dirask.com/posts/How-to-create-simple-animated-expander-in-React-1GBAEj)

Effect of this short post:![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jwfr26tz6gknjqzege5v.png)

In the example below, I've created a simple expander that displays Fruits 🍉 and Vegetables 🍅 lists on click event. I've used a modern approach that involves the use of functional components and React hooks. In this case `useState` hook stores the state of my expander. 🔺🔻

Practical example:
```jsx
import React from 'react';

const expanderStyle = {
    margin: '6px 0',
    padding: '2px',
    border: '1px solid #85C1E9'
};

const headerStyle = {
	display: 'flex',
    cursor: 'pointer'
};

const titleStyle = {
    padding: '3px',
	flex: 'none'
};

const spacerStyle = {
	flex: '1'
};

const iconStyle = {
	padding: '3px',
	flex: 'none'
};

const contentStyle = {
	overflow: 'hidden',
    transition: 'all 0.3s'
};

const contentExpandedStyle = {
    ...contentStyle,
    padding: '4px 0',
    border: '1px solid #85C1E9',
    height: 'auto',
    filter: 'opacity(1)'
};

const contentCollapsedStyle = {
    ...contentStyle,
  	padding: '0 0',
    border: '1px solid transparent',
    height: '0',
    filter: 'opacity(0)'
};

const Expander = ({title, children}) => {
    const [expanded, setExpanded] = React.useState(false);
    const handleHeaderClick = () => {
    	setExpanded(expanded => !expanded);
    };
  	return (
      <div style={expanderStyle}>
        <div style={headerStyle} onClick={handleHeaderClick}>
          <div style={titleStyle}>{title}</div>
          <div style={spacerStyle} />
          <div style={iconStyle}>{expanded ? '🔺' : '🔻'}</div>
        </div>
        <div style={expanded ? contentExpandedStyle : contentCollapsedStyle}>
          {children}
        </div>
      </div>
    );
};

// Usage example:

const App = () => {
  return (
    <div style={{height: '260px'}}>
      <Expander title="🍏🍌🍊 Fruits">
        <ul>
          <li>🍏 Apple</li>
          <li>🍌 Banana</li>
          <li>🍊 Orange</li>
        </ul>
      </Expander>
      <Expander title="🥕🥒🍅 Vegetables">
        <ul>
          <li>🥕 Carrot</li>
          <li>🥒 Cucumber</li>
          <li>🍅 Tomato</li>
        </ul>
      </Expander>
    </div >
  );
};

export default App;
```
You can run this example [here](https://dirask.com/posts/How-to-create-simple-animated-expander-in-React-1GBAEj)

Let me know if you like it or not in the comment section! 😊
_____________
## Write to us!
If you have any problem to solve or questions that no one can answer related to a React or JavaScript topic, or you're looking for a mentoring write to us on [dirask.com -> Questions](https://dirask.com/questions)
For WebDevelopers console.log() is Boring.
Tags: javascript, node, npm, webdev
Published: 2021-02-23 17:36:50

Here i have included my experience with console.log() while creating webApp in node and how i made debugging a little bit fun. This blog is uploaded to blogger.com by me.
[read it here](https://sudip-karmakar.blogspot.com/2021/02/for-web-developers-consolelog-is-boring.html)
How to debug postMessages
Tags: debugging, debug, webdev
Published: 2021-02-23 17:00:39

---
title: How to debug postMessages
published: true
description: Log messages between pages and iframes or pop-ups
tags: debugging, debug, webdev
canonical_url: https://arthurdenner.hashnode.dev/how-to-debug-postmessages
cover_image: https://res.cloudinary.com/arthurdenner/image/upload/v1614099510/posts/postmessage_devto.png

---

## TL;DR

```js
monitorEvents(window, 'message')
// or
window.addEventListener('message', console.log)
```

## Concept

From the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage):

> The window.postMessage() method safely enables cross-origin communication between Window objects; e.g., between a page and a pop-up that it spawned, or between a page and an iframe embedded within it.

That's pretty cool, right?

## Demo

[Here is a demo](https://codesandbox.io/s/postmessage-demo-xggln?file=/index.html) of postMessage usage.

{% codesandbox xggln %}

## Debug

But how can we debug these messages?

Run the following in the Console tab:

```js
// On Safari and Chromium-based browsers
monitorEvents(window, 'message')

// On Firefox
window.addEventListener('message', console.log)
// ^ It works in all the other browsers too
```

> If you're testing in CodeSandbox, run the command in the Console of [its detached window](https://xggln.csb.app/).

## Result

After the setup, when receiving messages, you should see something like this:

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1614026390643/uAZPyatu3.png)

That's it!

---

I hope you enjoyed this post and [follow me](https://linktr.ee/arthurdenner) on any platform for more.
Why Did I Begin Studying Software Engineering? From Chef to Coder
Tags: codenewbie
Published: 2021-02-23 17:30:03

So why leave behind a seemingly successful career in the culinary field as a Chef? To be honest, it never really was something I had a passion for. Don't get me wrong I was great at it, had fun, and met a lot of awesome people in my time as a Chef. However, I was left wanting to do something more than just running kitchens and making the weekend special. When I was younger I really enjoyed creating my own free webpages. It became a passion to design websites with colorful creative graphics, music, and pictures. I also desired a deeper understanding of the logistics. I was offered the opportunity to study web design at a technical high school, but I was discouraged immediately because I didn't have the support from my family to pursue it. I believe their remark was along the lines of; "Sounds really hard, you should you do cooking so that way you'll never be hungry". That remark not only discouraged me but shifted my perspective for years.

That became my perspective until several years later one night at work. One evening after a busy shift at work, I went to the bar and there was a lone patron on his laptop. We chatted a little bit until I asked what he was working on, and he told me about his project for a coding boot camp he was enrolled in. I became immediately intrigued and excited. I began to ask him a plethora of questions such as "How did you get into coding?", "Do you like coding?", "What is your career plan like?". We talked for hours; this reignited my suppressed passion. He advised the best way to begin coding is to "Just Do It", go to a website that teaches the information you need to learn, and then attend a boot camp to solidify what you've learned. This logic made perfect sense to me because that is the method that worked best for me. I was a self taught chef. On the surface level it appeared simple. I thought that until I actually began the process of learning to code.

Immediately I discovered after cooking for so long I had forgot how difficult it can be to learn a new skill. It was not this simple process. There were many steps involved. So many boot camps online promising success. I was immediately overwhelmed by the information overload. I decided to take a step back and try a new method. Formal school to learn the logistics became my new plan.
From my time exploring free code camp's website I did learn a few important lessons. Lesson number 1, with Coding you don't have to memorize every sequence, every code, and every language that was a big relief. Lesson number 2, knowing that Google and Youtube videos as reference points were not frowned upon in this industry. This was a very pleasant surprise, being that this was also true in the culinary world. I decided to enroll in this program to learn the proper skills, meet new people with the same interests and finally pursue my passion. I am excited to engage with everyone and pursue this new career!