teleren/devto huggingface dataset:
Why C++ is the best language to learn Algorithms and Data Structures?
Tags: algorithms, computerscience, programming
Published: 2021-04-20 10:42:18

I am a big fan of high-level languages. I love how they present themselves without the unnecessary implementation logic. I love how we can neatly express a data structure in languages like Python. And from a conceptual level of understanding, they are good enough. But this is only half of the story. The main intention for writing algorithms and data structures in practice is efficiency, we want to make our process streamlined. 

Here are a couple of good reasons why you should rewrite your algorithms in C++:

- C++ is a compiled language that outputs high-performing code
- C++ also supports high-level concepts with the *zero-overhead principle*. This is the C++ design principle which says that *you don't pay what you don't use* as well as *what you do use is just as efficient as what you could reasonably write by hand*.
- C++ has a rigorous type system that ensures type safety and enforces the programmer to explicate their intentions with their programs
- since [C++11](https://docs.microsoft.com/en-us/cpp/cpp/welcome-back-to-cpp-modern-cpp?view=msvc-160), the modern standards of C++ have become more elegant, simpler, and safer 
The C++ language is more flexible than any other language as you can express the highest level of abstraction down at the level of the silicon. That range of capabilities supported by the language gives you so much control with designing your algorithms or optimizing the memory management of your data structure. 

The Python courses I have encountered rarely discussed how Python shares resources with another object, I believe, a feature baked into the language. And you can't do anything about it because you are not in control of these lower-level implementations. The implementation of memory sharing and garbage collection in Python are intricate areas of the language optimized for performance and safety. On the surface, the code we write in such languages does not tell you the whole story.

On one hand, you receive a cleaner interface, and you have lesser constructs to worry about. On the other, you are not in control, the language you are operating on are abstractions of a lower level implementation written in C -- a subset of C++.

---
### Articles worthwhile reading
- https://docs.microsoft.com/en-us/cpp/cpp/welcome-back-to-cpp-modern-cpp?view=msvc-160 
- https://realpython.com/python-memory-management/
undefined vs null in Javascript
Tags: javascript
Published: 2021-04-20 10:40:43

If you are from the background of a programming language like Java , you might feel that the way to represent a “no value” is through the value “null”.

But Javascript has two ways to denote a “no value”.

One is “undefined”

Another is “null”

“undefined” represents “no value” whereas “null” represents “no object” to be more specific.

Thus the major difference is that null is concerned with objects only.

**When does Javascript return undefined?**
When a variable is declared but not initialized , javascript throws undefined.

Here is an example:

```
var x;
console.log(x); // the value returned here is undefined
```
If you try to invoke a property of an object which doesn’t exist , you get undefined:

```
var obj = {};
console.log(obj.name); // the value returned here is undefined
```
**When does Javascript return null?**
null means “missing”.

So you get null whenever an object is missing.

For example when you try to access a html element that does not exist , you get null.

The below code returns null if there is no html element named “name” :

```
<script>
console.log(document.getElementById("name"));
</script>
```
**How to check if a function returns null or undefined?**
Let’s say you are invoking a function in your javascript code and that function may return null or undefined. In that case you need to check for both null and undefined :

```
let output =  somefunction();
 
if(output === undefined || output === null){
        //logic here
}
```
You can combine both the checks using ! operator like this:
```
if(!output){
   //logic here
}
```
This works because both undefined and null are treated as “false” by javascript.

But you need to be cautious here , because if the output of the function in the above examples is an empty string , still the value of output is “false”.

This is because javascript treats an empty string as false.

Also the below are treated as false:

0

NaN

false (the boolean value false itself)

To summarize , javascript considers all these as false:

false

0

”

undefined

null

NaN

Reposted from :

https://fullstackdeveloper.guru/2021/04/20/undefined-vs-null-in-javascript/
how does Business Intelligence help companies grow
Tags: beginners
Published: 2021-04-20 10:40:22

In this data-driven period, organizations could fall truly back or lose their piece of the pie since they didn't have significant experiences on what steps to take to improve their effectiveness and decrease their costs. Business Intelligence is tied in with inferring significant experiences that could drive the organization's market and increment their profitability. Business Intelligence assists organizations with developing by working with: 

Helps in identifying more up to date approaches to expand net revenue and perceive market patterns. 

Following execution and dissecting it with the contenders. 

Assists the organization with dissecting their client's conduct and foresee accomplishment alongside identifying more current issues and bottlenecks. 

What's more, from multiple points of view, BI could help in causing your organization to develop significantly. Take on a MSBI course [MSBI course](https://intellipaat.com/msbi-online-training-course/) preparing from Intellipaat and help yourself expertise up in a BI tool to improve your work possibilities
Let life get in the way
Tags: career, productivity, motivation, watercolor
Published: 2021-04-20 10:26:08

---
title: Let life get in the way
published: true
description: How a little side-project helped reset my work-life balance
tags: career, productivity, motivation, watercolor
cover_image: https://cdn.hashnode.com/res/hashnode/image/upload/v1618913614047/hq60N3PhG.jpeg?w=1600&h=840&fit=crop&crop=entropy&auto=compress
canonical_url: https://blog.zack.computer/let-life-get-in-the-way
---

I made zero progress on my side-projects this past week. Indeed, I just barely got the work done for my freelance contracts. I was the opposite of a 24/7 hustler. And that's ok, because I was spending that time letting life get in the way of work.

Specifically one very small bit of life: my new four-legged side project, [Islay](https://www.instagram.com/bigcityislay/).

![Islay](https://cdn.hashnode.com/res/hashnode/image/upload/v1618913569977/ud1h7bdBs.jpeg)

But this post is not (just) an excuse to share adorable photos of this tiny puppy now living in my house. This post is about taking a breath after months of quarantine hustle and realizing I lost sight of that quasi-mythical goal: "work-life balance."

For myself, and I assume I'm not alone in this, it can be easy to get sucked into games about making numbers go "up and to the right" - whether that's getting obsessed with the performance of an API server, maximizing finances, or driving up the engagement stats on a [blog](https://blog.zack.computer) or [Twitter](https://twitter.com/zackdotcomputer). These are games with "high scores" where it's easy to monitor whether we're winning and every time the numbers go up, a little dopamine burst whispers "good job." But the tightly-coupled simplicity of that system makes it addictively, dangerously easy to slip into the habit of working almost every waking moment.

I don't have the be-all and end-all answer to perfect work-life balance and in no way would I - someone who has happily plugged away on projects for 60+ hours a week for basically all of 2021 until this week - pretend that I do. All I can share is what has worked for me looking backwards. A decade ago, finding work-life balance was about unplugging completely and sitting in a park or a bar with people. In 2019 work-life balance was becoming a deep-dive nerd about photography.


This week, work-life balance was teaching this little furry destroyer-of-toys how to sit.

![Sit! Good girl!](https://cdn.hashnode.com/res/hashnode/image/upload/v1618854177364/hOTf8DXOA.jpeg)

The common factor to these was a **living** goal. One that isn't measured in numbers like commits or reps or engagement but rather in moments like stories told or photos made or lessons taught. I don't know if that's the recipe to success. What I do know is I've signed up for a new big project in raising Islay. The payoff for this project will be a little spitfire who will come demand I stop working if I've been grinding too long, because she's a dog and she knows nothing about numbers or making them go up, right, or in any direction at all.
🔴 TechTalk - How can Developers and Designers collaborate better | TheDestroDevShow
Tags: webdev, design, ux, css
Published: 2021-04-20 10:16:28

Hi everyone! 👋

I have started a LIVE TechTalk show on my channel.

And on the 5th Show, Alex Kukharenko joined as a Guest.

Design and development shouldn’t compete — they should support one another as they both follow the same goal - building beautiful, useful and fast products. 
Alex is going to share 9 points for making a better collaboration.

Alex is a UX/UI Designer currently living in Berlin, Germany. He has long years of experience working on UX/UI.

<h3><u>Topic: How can Developers and Designers collaborate better.</u></h3>

You can Watch on YouTube https://www.youtube.com/watch?v=LnFwGVRoRlQ

{% youtube LnFwGVRoRlQ %}

Enjoy 🌸

Also SUBSCRIBE to YouTube Channel - https://www.youtube.com/c/TheDestroDevShow?sub_confirmation=1

LIKE FB Page - https://www.facebook.com/the.destro.dev.show/

Follow on Twitter - https://twitter.com/destro_mas

Follow on DEV - https://dev.to/destro_mas

Made with ❤️ in Berlin!

Cheers!
👋

<hr />
As I am trying to contribute contents on the Web, you can buy me a coffee for my hours spent on all of these ❤️😊🌸

<a href="https://www.buymeacoffee.com/destrodevshow" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 45px !important;width: 117px !important;" ></a>
Storing State on Local Storage in a React Application
Tags: react, javascript, localstorage, quicktip
Published: 2021-04-20 10:13:02

>*Originally posted on my personal blog ➡️ [devugur](https://devugur.com/blog/storing-data-on-localstorage-in-a-react-application)*

Let's say we have a value kept in the state in a react application and we want to keep it there even if we refresh the page. The simplest solution is local storage of the browser!

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

export default function Name() {
  const [name, setName] = useState('');
  const handleChange = (e) => {
    setName(e.target.value);
  };
  
  return (
    <div>
      <input type="text" onChange={handleChange} value={name} />
    </div>
  );
}
```

In the example code, we store the input value in the name variable and we change it by `handleChange` function. Whenever we refresh it will be gone! We can get the advantage of the `useEffect` hook and the `localStorage` of the browser here.

```jsx
import React, { useState, useEffect } from 'react';

export default function Name() {
  const [name, setName] = useState('');
  const handleChange = (e) => {
    setName(e.target.value);
  };
  
  useEffect(() => {
    localStorage.setItem('name-state', JSON.stringify(name));
  },[name]);

  return (
    <div>
      <input type="text" onChange={handleChange} value={name} />
    </div>
  );
}
```
`setItem` method takes two parameters: key for the data and the data itself. Now the data is stored on local storage but if we refresh we wouldn't see the state updated with the local data. In order to achieve that we need to add one more `useEffect` hook to the mix.

```jsx
import React, { useState, useEffect } from 'react';

export default function Name() {
  const [name, setName] = useState('');
  const handleChange = (e) => {
    setName(e.target.value);
  };
  useEffect(() => {
    const data = localStorage.getItem('name-state');
    if (data) {
      setName(JSON.parse(data));
    }
  }, []);
  useEffect(() => {
    localStorage.setItem('name-state', JSON.stringify(name));
  },[name]);

  return (
    <div>
      <input type="text" onChange={handleChange} value={name} />
    </div>
  );
}
```

Notice that we added the last `useEffect` hook before the previous one so that the local data is available to us before setting it again.

And that's it. Even if you refresh the browser, the state will be persisted.

If you liked the article and would like to support me, you can follow me on [Twitter](https://twitter.com/uguremirmustafa).
What does a Data Orchestration platform do?
Tags: lowcode, iot, pipelines, dataprocessing
Published: 2021-04-20 10:11:53

*Data Orchestration* is becoming one of those buzzwords sales people like to throw around in pitch meetings. 

It is very important to understand that data orchestration is not just one *"thing"*, but describes a whole process of how to handle data within a system.

I identified 4 steps each data orchestration platform should support:

###1. Data Ingestion

Data has to get into the system one way or another. We all know how it goes: part of the data we need is on an SQL database somewhere, other data comes in via MQTT and the last part is only available in .txt logs. **Data ingestion can be a mess.**

The first thing a Data Orchestration platform should be able to do is integrate with all these different sources so it is able to combine the data we need.

###2. Data Processing

Data is rarely in the right format when entering a system. Therefore we need a way for data to be **combined, unpacked or decoded**. This step could also entail aggregation if we don't want to use all the data but just a higher order abstraction.

###3. Making Decisions

Now that the data is ready, it is time to make some decisions based on what we ingested. For this, the platform needs some way to **create rules and automated workflows**. The cool platforms even have the ability to utilize AI or ML models and let those call the shots.

![A rule on top of data that is coming in.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pgeyhe9z163ya11mxehj.png)

###4. Taking Actions

Lastly it is time to take action! Based on the data and earlier decisions, the platform should be able to **take actions in and outside of its own ecosystem**. This could go from throwing alarms to turning some physical device on/off or sending quarterly figures to a certain list of employees.


The best of the best data orchestration platforms are flexible in each of these steps, making it a generally applicable solution. They let the developer integrate the system easily with other platforms and provides a way to quickly define new logic. But that is a topic for a whole other article.

Want an example of a data orchestration platform that does these things right? Check out [Waylay IO](https://www.waylay.io/products/waylay-io/product).
Codel - A Theme for Coded Life
Tags: vscode, showdev, programming, design
Published: 2021-04-20 10:08:16

I am 15 years years old and I'm glad to present the dev community a theme that I have made. This is my first VSCode theme. Since the day I started programming, I have used VSCode and used many themes, but never sat to a particular theme. So now finally I have made a theme with inspiration from all the themes I used. Here is the Preview of the theme.

![CODEL](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pyrdl2ca3tpq4kzbewdz.png)

The theme can be found in the [vscode marketplace](https://marketplace.visualstudio.com/items?itemName=GNVageesh.codel) and at [github](https://github.com/GNVageesh/codel)

Would love to know your inputs so that I can improve.

Thank you.....
How are the Hbar tokens/coins mined or created?
Published: 2021-04-20 03:19:05

I don't know how HBARS are created. I think they were made from day 1 and all available bitcoins could also be made from day one, but to incentivize people to pony up their internet electricity and hardware for the network verification of transactions mining was thought up.

Generating just any hash for a set of bitcoin transactions would be trivial for a modern computer, so to turn the process into "work," the bitcoin network sets a certain level of "difficulty." This is what I understand as mining. A puzzle where computers guess at it until one guesses right. This hap ends every 10 minutes on average.

It makes the puzzle gradually harder and halves the reward every 4 years for reasons\*. This seemed ok at first but as it turns out this makes the bitcoin network not scale at the level needed to replace Visa as the network gradually gets slower & more expensive intentionally to avoid forks and other reasons\*. 

For more info on the bitcoin scaling problem look [here](https://en.m.wikipedia.org/wiki/Bitcoin_scalability_problem#:~:text=The%20bitcoin%20scalability%20problem%20is,transactions%20on%20the%20bitcoin%20network).

Hashgraph sidesteps that scaling problem by removing mining entirely and using an entirely new ledger structure, the Hashgraph. I am not certain if that is why all the HBARS are already made. They are locked up and are to be gradually released for reasons\*.

But Hashgraph is still aiming to become a decentralized network, and requires computers for it to validate transactions. Even thought HBAR can't be mined there is still an incentive to pony up your computer and electricity.

You can't mine more HBAR, but soon you can set up a node and get transaction fees for it. Or you can own HBARS and lend them to nodes and get a transaction fee for that.
How to resolve Json Infinite Recursion problem when working with Jackson
Tags: jackson, springboot, json, recursion
Published: 2021-04-20 09:58:23

https://grokonez.com/json/resolve-json-infinite-recursion-problems-working-jackson

How to resolve Json Infinite Recursion problem when working with Jackson

<strong>Json Infinite Recursion</strong> is one of the most common problems when we serialize Java objects which having Bidirectional-Relationships. So in the tutorial <strong>JavaSampleApproach</strong> will show you how to smoothly handle the problems with <strong>Jackson</strong> annotations: <code>@JsonIgnore</code>, <code>@JsonView</code>, {<code>@JsonManagedReference</code>, <code>@JsonBackReference</code>} and <code>@JsonIdentityInfo</code>.

Related articles:
- <a href="https://grokonez.com/java/java-advanced/jackson-converting-java-object-tofrom-json-string">Jackson to convert Java Object to/from Json String</a>
- <a href="https://grokonez.com/spring-framework/spring-boot/integrate-spring-restapis-jsonview">Integrate Spring RestAPIs with @JsonView</a>
- <a href="https://grokonez.com/spring-framework/spring-boot/use-jsonview-serializede-serialize-customize-json-format-java-object">How to use @JsonView to serialize/de-serialize and customize JSON format from Java Object</a>

<!--more-->
<h2>I. Infinite Recursion problem</h2>
We create 2 model classes: <strong>Company</strong> & <strong>Product</strong> have <strong>one-to-many</strong> relationship:

- <strong>Company</strong>:

<pre><code class="language-java">
public class Company {
	private int id;
    private String name;
    private List<Product> products;
	
    public Company(){
    }
    ...
</code></pre>

- <strong>Product</strong>

<pre><code class="language-java">
public class Product {
	private int id;
    private String name;
    private Company company;
	
    public Product(){
    }
</code></pre>
	 
Serialize Java Objects with segment code:

More at:

https://grokonez.com/json/resolve-json-infinite-recursion-problems-working-jackson

How to resolve Json Infinite Recursion problem when working with Jackson
Material Web Components with Preact
Tags: material, webcomponents, mwc
Published: 2021-04-20 09:57:12

Here is is an example demoing  **Drawer Web Component**, simple and effective...

Official site : [MWC](https://github.com/material-components/material-components-web-components)

```js
import "../src/css/mwc.css";
import "@material/mwc-button";
import "@material/mwc-drawer";
import "@material/mwc-top-app-bar";
import "@material/mwc-icon-button";
import { render, h } from "preact";
import { useRef, useEffect } from "preact/hooks";

const Drawer = () => {
  const drawerRef = useRef(null);
  useEffect(() => {
    const drawer = drawerRef.current;
    const container = drawer.parentNode;
    container.addEventListener("MDCTopAppBar:nav", () => {
      drawer.open = !drawer.open;
    });
  });
  return (
    <mwc-drawer ref={drawerRef} hasHeader type="dismissible">
      <span slot="title">Drawer Title</span>
      <span slot="subtitle">subtitle</span>
      <div>
        <p>Drawer content!</p>
        <mwc-icon-button icon="gesture"></mwc-icon-button>
        <mwc-icon-button icon="gavel"></mwc-icon-button>
      </div>
      <div slot="appContent">
        <mwc-top-app-bar dense>
          <mwc-icon-button slot="navigationIcon" icon="menu"></mwc-icon-button>
          <div slot="title">Title !!!</div>
        </mwc-top-app-bar>
        <div>
          <p>Main Content!</p>
        </div>
      </div>
    </mwc-drawer>
  );
};

if (typeof window !== "undefined") {
  render(<Drawer />, document.getElementById("root"));
}
```


{% codesandbox drawerdemo-nhqrf initialpath=/src/index.js %}
Leetcode Solutions Index 
Tags: algorithms, programming, cpp
Published: 2021-04-20 09:55:14

As I started to solve leetcode problems, wanted to document those somewhere where it might be useful for others as well. And so here you are at the main index page of my Leetcode solutions and explanations. I have organized the solutions based on their difficulty level and added a column to show which topics they can be related to. I hope these solutions will be useful for each one of you, if so, please like the posts which helped you.

###Hard-Level Problems
| #  | Problem Title | Related Topics |
|----:|-----------------------------------------:|--------------------|
 
###Medium-Level Problems
| #  | Problem Title | Related Topics |
|----:|-----------------------------------------:|--------------------|

###Easy-Level Problems
| #  | Problem Title | Related Topics |
|----:|-----------------------------------------:|--------------------|
| 589 | [N-ary Tree Preorder Traversal] (https://dev.to/thangarajn1992/c-solution-n-ary-tree-preorder-traversal-45i5) | Tree, DFS, Preorder |