teleren/devto huggingface dataset:
Changing the world requires changing yourself!
Published: 2021-05-10 04:31:09

Changing the world requires changing yourself! Who I was when I began passionately helping Humanity via Project Universe is drastically different than who I'm today. Unconditional love for y'all drives my decisions helping all of us live our best lives!

Love first & always!

The $1,000,000,000,000s sitting in banks collecting dust is the reason poverty is as bad as it is today. With ~$60,000 we're creating a free interplanetary-ready education system. With $1,000,000,000,000s and/or Humanity's support we abolish global poverty by the end of 2021.

Support Project Universe for your, your family's, friend's, Humanity's sake. I know it sounds ostentatious, but it's the truth. I'll give my life ensuring 100% of Humanity lives their best lives free of oppression, suffering, poverty.

I'd prefer not to die tho!

From my perspective the way we govern ourselves has catastrophically failed us. We must change how our civilization operates to put an end to the unjust deaths of millions. We must start today, no one has to die/suffer to fix all of the problems plaguing us. Please understand that by helping me help Humanity you're helping yourself. We need all governments, politicians, teachers, leaders working together.

Success is inevitable, how soon depends on you showing your support. Spread the word, donate $1/month, please DO something.

Made it this far & you want to help or are on the fence, reply here, let me know. Helping increase global advocacy/support is the best way you can help without spending $1. Please understand you matter more than you'll ever give yourself credit for.

YOU are my everything!
Array rotation by Reversal Algorithm
Tags: arrays, datastructures, algorithms
Published: 2021-05-10 04:22:31

##Array Rotation
Array Rotation simply means shifting the array elements to the left or right of the array by specified positions. An array can be rotated to the left(clockwise) or to the right (anti-clockwise) to the given number of positions.

##Left rotation

Let's consider an array ***arr*** with ***n*** integer items stored in it. Let's assume ***d*** is the number of positions the array is to be rotated left, then the reversal algorithm can be applied as follows,

* Split the array into two parts A = arr[0...d-1] and B = arr[d...n-1]
* Reverse the array items of part A from position 0 to d-1
* Reverse the array items of part B from position d to n-1
* Now, reverse the entire resulting array to get the left rotated array

```
leftRotate(arr[], d, n)
  arrayReverse(arr[], 0, d-1);
  arrayReverse(arr[], d, n-1);
  arrayReverse(arr[], 0, n-1);
```

Let arr = {10, 20, 30, 40, 50, 60, 70, 80}, n = 8, d = 3

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

##Code

```
#include <stdio.h>

// Using reversal algorithm
// T(n) = Θ(n)
// Aux space = Θ(1)

void reverse(int arr[], int low, int high) {
    while(low < high) {
        int tmp;
            
        tmp = arr[low];
        arr[low] = arr[high];
        arr[high] = tmp;
        
        low++;
        high--;
    }
}

void leftRotate(int arr[], int n, int d) {
    reverse(arr, 0, d-1);
    reverse(arr, d, n-1);
    reverse(arr, 0, n-1);
}

int main() {
	int arr[] = {10, 20, 30, 40, 50, 60, 70, 80};
	int n = sizeof(arr)/sizeof(arr[0]);
	leftRotate(arr, n, 3);
	
	printf("Left rotated Array values are\n");
	for(int l=0; l<n; l++)
        printf("%d ", arr[l]);
        
	return 0;
}
```

##Output
```
Left rotated Array values are
40 50 60 70 80 10 20 30
```

##Right rotation

In order to do right rotation of array items, the only change is first reverse the entire array and follow the reversal of subsets as shown below,

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

##Code

```
void rightRotate(int arr[], int n, int d) {
    reverse(arr, 0, n-1);
    reverse(arr, 0, d-1);
    reverse(arr, d, n-1);
}
```

##Output
```
Right rotated Array values are
60 70 80 10 20 30 40 50 
```

##Thanks for reading!
If you have any questions about the post feel free to leave a comment below.

Follow me on twitter: [@soorya_54](https://twitter.com/soorya_54)
How to setup wireguard on linux
Published: 2021-05-10 04:17:49

---
title: How to setup wireguard on linux
published: true
description: We look into how to set up WireGuard on a Linux system. In this case, we use Debian in order to create a tunnel between two nodes using WireGuard. The setup is quite easy because WireGuard has strong opinions about what should be available and that means that the setup doesn't have that many things to configure.
tags:
cover_image: https://i.ytimg.com/vi/fQ799PUH2eI/maxresdefault.jpg
---

{% youtube fQ799PUH2eI %}

We look into how to set up WireGuard on a Linux system. In this case, we use Debian in order to create a tunnel between two nodes using WireGuard. The setup is quite easy because WireGuard has strong opinions about what should be available and that means that the setup doesn't have that many things to configure.
Modify Modules With Professional Odoo Training Program
Tags: odoo, opensource, programming, news
Published: 2021-05-10 04:16:40

There are huge numbers of ERP software and platforms available within the industry– both restrictive and open-source - that provide you [Odoo Consultation](https://www.techultrasolutions.com/odoo-consulting) consistent with your business necessities. There are numerous individuals who believe that modern and upgraded ERP programming is extremely complex when contrasted with the off-the-rack ERP or traditional ERP systems. This contention depends on the rationale that the modules and therefore the code of the most ERP should be changed which prompts increment in time and henceforth cost.


These mentioned contention about greater expenses depends on a couple of misconceptions. As a reputed and best [Odoo Development Service](https://www.techultrasolutions.com/odoo-development), we are sharing and debunking the misconceptions related to the ERP system.


**1: ERP framework will have all the features that the organization needs**

The traditional ERP systems do not have all the highlights that a corporation needs. There are consistently tons of highlights missing from the system that needs modification. so as to make customization, it also requires additional cost.

Read more> [https://www.techultrasolutions.com/blog/our-blog-1/modify-modules-with-professional-odoo-training-program-14](https://www.techultrasolutions.com/blog/our-blog-1/modify-modules-with-professional-odoo-training-program-14)
Supabase Schema Visualizer - No installation/login
Tags: showdev, vue, vite, supabase
Published: 2021-05-10 03:45:51

# The Idea and Inspiration 💡

Recently, I got addicted to [Supabase ⚡](https://supabase.io/) as an **Open-Source Firebase Alternative**, and I'm having so much fun with it. It has such wonderful UI, and well-written documentation, that allows me to spin up a project easily.

Because of that, I've started to learn **PostgreSQL**, which Supabase built on top of. I quickly realized that how great would it be if I can easily visualize all my tables, and the relationship with one another (since PostgreSQL is a relational DB), and there's when I found out about **Database Schema**🔥.

😥 Unfortunately I found many Database Schema Visualizer online which either requires me to install database software, or login with email, which I do not want to . Thus, this gave me the idea to code it myself, since I'm a Web Developer💻.


# Showcase 🌟

If you are Supabase user, or interested in using the visualizer, here's the link to it: [Supabase Schema Visualizer](https://supabase-schema.vercel.app/)


{% github zernonia/supabase-schema %}


*If you find this useful, remember to 🌟 it on Github*

# Lend me a Hand ✋

When you navigate through the App, you might notice some bugs or possible improvement, feel free to contribute to this project.💘 

# Ultimate Hope 🔮

My Vision for this project is hopefully that it might be absorbed  into official [Supabase App](https://app.supabase.io/), where developer can quickly manage their project's schema visually without leaving the app. So if you find it helpful and wish to have this features, a star on Github would be very much appreciated.

# Follow me 🐤

{% twitter 1391430752462508042 %}

# Thank you 🙏
Var vs let vs const in JavaScript
Tags: var, const, javascript, let
Published: 2021-05-10 03:45:40

---
title: Var vs let vs const in JavaScript
published: true
date: 2021-05-10 3:44:35 UTC
tags: Var,Const,JavaScript,Let
canonical_url: https://blog.jws.app/2020/var-vs-let-vs-const-in-javascript/
---

The next post in our X vs Y vs Z series is [var](https://www.w3schools.com/js/js_variables.asp) vs [let](https://www.w3schools.com/JS/js_let.asp) vs [const](https://www.w3schools.com/JS/js_const.asp).  I’ve wanted to cover this for a little while.  Let and const were added to [JavaScript](https://blog.jws.app/tag/javascript/) with ECMAScript 6.  Var has been around a bit longer.

Var is used to declare a function-scoped or globally-scoped variable.  Var declarations are processed before any code is executed.  Let’s take a look at a quick example.

{% codepen https://codepen.io/steinbring/pen/dyMMdZp %}

In the above example, there is a lot going on.

[![](https://i0.wp.com/blog.jws.app/wp-content/uploads/2020/09/Screen-Shot-2020-08-15-at-4.54.57-PM.png?resize=300%2C169)](https://i0.wp.com/blog.jws.app/wp-content/uploads/2020/09/Screen-Shot-2020-08-15-at-4.54.57-PM.png)

If you click button #1, it shows you the value of pi.  When you click on button #2, it shows you my name.  When you click on button #3, it shows you a sentence based upon the two prior values.  Using button #4 and button #5, you can change the value of pi and my name.  When you click on button #3 again, your changes are reflected in the sentence.  The values in this first example are using var to define them.

Next, let’s look at the same thing but let’s use let instead of var.

{% codepen https://codepen.io/steinbring/pen/vYGGdaZ %}

This example works exactly the same as the first one.  You can load the values and change them.  Now, let’s see how const works in the same scenario.

{% codepen https://codepen.io/steinbring/pen/xxVVYaV %}

Now, defining everything using const makes all of the values immutable.  You can define their initial value but you can’t change their value.  That means that buttons #1, #2, and #3 work fine but #4 and #5 result in errors.

The benefit of using let and const over just var is that you can signal your intentions for the values.  If you have something that _shouldn’t_ change it’s value, use const and you won’t be able to change it’s value.

Now, there is an exception to keep in mind with const and objects.

{% codepen https://codepen.io/steinbring/pen/Rwaayrz %}

In the above example, we are defining me using const but we are later changing it.  You _can_ add properties to a constant object and you can even change the value of what you added.  It’s something to keep in mind.


The post [Var vs let vs const in JavaScript](https://blog.jws.app/2020/var-vs-let-vs-const-in-javascript/) first appeared on [Blog.jws](https://blog.jws.app/).
Basic Data Structures
Tags: javascript, devops, tutorial, beginners
Published: 2021-05-10 03:35:41

* Data can be stored and accessed in many ways. You already know some common JavaScript data structures — arrays and objects.

* In this Basic Data Structures posts, you'll learn more about the differences between arrays and objects, and which to use in different situations. You'll also learn how to use helpful JS methods like `splice()` and `Object.keys()` to access and manipulate data.

#### Use an Array to Store a Collection of Data
Here is an example of the simplest implementation of an array data structure. This is known as a one-dimensional array, meaning it only has one level, or that it does not have any other arrays nested within it.
```
let array = ['one', 2, 'three', true, false, undefined, null];
console.log(simpleArray.length);
```
```
The `console.log` call displays `7`.
```
* All arrays have a length property, which as shown above, can be very easily accessed with the syntax Array.length.
* Notice it contains booleans, strings, and numbers, among other valid JavaScript data types.


#### Access an Array's Contents Using Bracket Notation
* We have the ability to not only store data, but to be able to retrieve that data on command. So, now that we've learned how to create an array, let's begin to think about how we can access that array's information.
* When we define a simple array as seen below:
```
let myArray = ["a", "b", "c"];
```
* In an array, each array item has an index. It is important to note, that JavaScript arrays are zero-indexed, meaning that the first element of an array is actually at the zeroth position, not the first. In order to retrieve an element from an array we can enclose an index in brackets and append it to the end of an array, or more commonly, to a variable which references an array object. This is known as bracket notation. 
*Ex:
```
let ourVariable = myArray[0];
```
* Now `ourVariable` has the value of `a`.

* In addition to accessing the value associated with an index, you can also set an index to a value using the same notation:
```
myArray[1] = "e";
```
* Using bracket notation, we have now reset the item at index 1 from the string `b`, to 'e`. Now `myArray` is `["a", "e", "c"]`.
Block chain
Published: 2021-05-10 03:33:07

Every since I learned about Cryptocurrency I have taken an interest in the technology. I started by learning how to buy and trade crypto. If you do not know what cryptocurrency is, it is digital currency.

Crypto is created on the block chain. Block chain can be defined as a system where crypto currency can be recorded and maintained like a ledger. The cool thing about the block chain is that it is not controlled by one entity, but  is maintained by several computers that are linked by peer to peer network. The block chain is decentralized. 

I think that this technology is very powerful and has opened up so many possibilities. This is a real cool place for developers to be in because right now there are so many cool things that can be created on the block chain.

The programming language that developers are using in the space is called solidity. The programming language is very similar to JavaScript. In solidity you create smart contracts and this is how solidity communicates with the block chain. Solidity is used on Ethereum. 

I am still learning about how the block chain works. I am excited to see how this technology evolves.

Happy coding!
Ultimate Web Development Resources
Tags: webdev, programming, showdev, opensource
Published: 2021-05-10 03:29:44

Hi

The below is my github repository which gives a combination of all the available web development resources from beginner to expert level.

I will be updating the repository frequently 

Use it 👇

[Ultimate Web Development Resources](https://github.com/dhanushnehru/Ultimate-Web-Development-Resources)

For more technology related information connect with me

[Twitter](https://twitter.com/Dhanush_Nehru)
Introduction to lit-html.js
Tags: javascript, typescript, html, webcomponents
Published: 2021-05-10 03:16:12

**lit-html is a templating library.**

### What do it means to be a templating library?
Templating Library helps you create DOM nodes/element at runtime.

If you have to create a DOM node tree like this **at run time**:
```html
<body>
	<!--START: create this at run time and append to body-->
	<div id="myid1">
		<div style="width:50px;height:50px:background-color:red;">
		</div>
	</div>
	<!--END-->
</body>
```

Ordinarily without any templating library, you would have written a JS code something like this(not boasting to be an accurate code):
```js
let div1 = document.createElement("div");
div1.id = "myid1";

div1.addEventListener("click",()=>{
alert("hello");
});

let div2 = document.createElement("div");
div2.style.width="50px";
div2.style.height="50px";
div2.style.backgroundColor="red";

div1.appendChild(div2);
body.appendChild(div1);
```
Too verbose and impractical for creating deeply nested node trees.

**lit-html** helps your create this JS code like this:
```js
let mytemplate = html`
<div id="myid1"  @click=${()=>alert("hello")}>
    <div style="width:50px;height:50px:backgroundcolor:red;">
    </div>
</div>
`;
render(mytemplate,document.body);
```
This code looks almost similar to the the Node tree we intended to create. Infact we have added an event listener too on the DOM.

Lets break down this code and understand whats happening.
1.  ``html `...` `` : this is a [JS template string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals).
Many of the JS user is accustomed to template string like this `` `Some text ${some_var}` ``, but the specification of template string also allows to add tags before this template strings `` tag`Some text ${some_var}` `` . Read the tagged template JS specification [here at mozilla docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates).
So **lit-html** lib has created this `html` tags to help you convert your template string into DOM node tree.

2. `@click=${()=>alert("hello")}` this helps you add event listeners to your DOM tree, at run time. Isn't it awesome. user of other libraries might be accustomed to similar syntax provided by there own libraries.

3. `render` function call. It has two arguments, one is the template and other is the place where this node tree created will be appended at run time.


# Tutorial
There is no better tutorial for lit-html, than the (official documentation](https://lit-html.polymer-project.org/guide/getting-started). It will be hardly 1-2 hrs read and you be ready to use lit-html in your projects.
Branch and Bound
Published: 2021-05-10 03:14:50

#Intro to Branch and Bound :

Branch and bound is a systematic method for solving optimization problems
B&B is a rather general optimization technique that applies where the greedy method and dynamic programming fail.
However, it is much slower. Indeed, it often leads to exponential time complexities in the worst case.
On the other hand, if applied carefully, it can lead to algorithms that run reasonably fast on average.
The general idea of B&B is a BFS-like search for the optimal solution, but not all nodes get expanded (i.e., their children generated). Rather, a carefully selected criterion determines which node to expand and when, and another criterion tells the algorithm when an optimal solution has been found.

#Uses of Branch and Bound :

Branch and bound algorithms are used to find the optimal solution for combinatory, discrete, and general mathematical optimization problems. In general, given an NP-Hard problem, a branch and bound algorithm explores the entire search space of possible solutions and provides an optimal solution.

#Algorithm :

```
Set L = {X} and initial ize x
2  while L # 0 :
3	Select a subproblem S from L to explore
4	if a solution.r' E {x E S I f (x) < /(x)} can be found: Set .X =x'
s	if S cannot be pmned:
6	Partition S imo S1 , S2 , ... , S,. Insert S1, S2, . . . , S, into L
8	Remove S from L
9 Return x

```
#conclusion :

cutting planes can reduce the search space and thus improve the lower bounds on solutions of mixed integer linear programs. When using cutting planes, the branch-and-bound algorithm is also called the branch-and-cut algorithm. Preprocessing can reduce problem size and improve problem solvability.
49 Days of Ruby: Day 44 -- Code Comments
Tags: ruby
Published: 2021-05-10 02:54:53

---
title: 49 Days of Ruby: Day 44 -- Code Comments
published: true
description: Join us on a 49 day learning journey through Ruby!
series: 49 Days of Ruby
tags: #ruby
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/9m73qaetuse3nm3y3it8.png
---

**Welcome to day 44 of the 49 Days of Ruby! 🎉**

We are only a few days away from finishing our 49-day journey through Ruby! We took a quick detour yesterday to discuss version control, and today, we are going to discuss commenting on code.

Commenting on your code is a very important, and often underappreciated, feature of software development.

Code comments can not only help others trying to understand your application, but they can even help you!

How can code comments help you with your own code?

Let's say you struggled to try to get something right after days and days of work. You eventually end up with a solution. The solution is complex and a bit cryptic.

Now, a couple of months have passed, and you return back to that code. How hard will it be for you to get back into it and remember what you did there?

With code comments, it could be a lot easier!

How do you write comments in your Ruby code?

```ruby
# This is a comment
# This is another comment
def my_method
  puts "here is some code"
  puts "this code is really complex"
  # I'm adding a comment in the middle of the method
end
```

The `#` symbol tells Ruby not to interpret what follows it on that line. You can interject comments anywhere in your code. For example, you see above there is a comment in the middle of a method definition.

Sometimes, new developers feel that if they write comments, it'll mean their code is "less serious". The opposite is true! Well placed comments can mean the difference between code impossible to understand, and code that is understandable.

In your Ruby journey, keep on commenting!


**Come back tomorrow for the next installment of 49 Days of Ruby! You can join the conversation on Twitter with the hashtag [#49daysofruby](https://twitter.com/hashtag/49daysofruby).**
Hosting react on apache.(Ubuntu, AWS)
Tags: react, apache, hosting, tutorial
Published: 2021-05-10 02:45:23

Are you willing to host react on Apache ??
Here are few steps.

###STEP 1 - Install Apache.
```
sudo apt install apache2
```
This command will install apache on you machine.

###STEP 2 - Pull code.
Go to 
```
cd /var/www/html
```
and pull your react code using git

```
sudo git clone <your-git-repo>
```
Install dependencies 
```
sudo npm install
```
and build your react project using
```
sudo npm run build
```
you production will be in build folder now

###STEP 3 - Configure your Apache config files
You will have to mention path of build folder in .config files. 
edit /etc/apache2/apache2.conf
```
sudo vi /etc/apache2/apache2.conf
```
Comment existing Directory tags to avoid conflicts for example in my case I commented by adding # as shown below
```
#<Directory />
#       Options FollowSymLinks
#       AllowOverride None
#       Require all denied
#</Directory>
#
#<Directory /usr/share>
#       AllowOverride None
#       Require all granted
#</Directory>

#<Directory /var/www/>
#       Options Indexes FollowSymLinks
#       AllowOverride None
#       Require all granted
#</Directory>

#<Directory /srv/>
#       Options Indexes FollowSymLinks
#       AllowOverride None
#       Require all granted
#</Directory>
```
### STEP 4 - Add our React build directory into apache.conf. 
Here in my case build of react is at /var/www/html/reactproject/build it may be different in your case replace this with you present build directory in following code
```
<VirtualHost *:80>
    #ServerName yourserver.com
    DocumentRoot /var/www/html/reactproject/build

    # Relax Apache security settings
    <Directory /var/www/html/reactproject/build>
      Allow from all
      Options -MultiViews
       Require all granted
    </Directory>
</VirtualHost>

```
### STEP 5 - Restart and test
Every time you edit Apache files restart apache by using following command
```
sudo systemctl restart apache2.service
```
Check status
```
sudo systemctl status apache2.service
```

> You are good to go. for further assistance feel free to contact me will love to help you out 
> IF YOU LIKED THIS ARTICLE MAKE SURE TO FOLLOW ME ON DEV.TO AND ON [INSTAGRAM](https://www.instagram.com/rawasaditya/)




[![Aditya Rawas Coffee](https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-1.svg)](https://www.buymeacoffee.com/adityarawas)