teleren/devto huggingface dataset:
Ploting graph with R-programming 
Tags: programming, r, newbie, devops
Published: 2021-03-29 03:55:50

#### 🔥[  Introduction to R (1)](https://dev.to/maxwizard01/introduction-to-r-programming-2add)
#### 🔥[ Data Structure (2)](https://dev.to/maxwizard01/data-structure-in-r-programming-2e6k)
#### 🔥[ Statistical value (mean, median, mode etc) (3)](https://dev.to/maxwizard01/statistical-value-with-r-programming-dcc)
#### 🔥[ Tabular Presentation of Data (4)](https://dev.to/maxwizard01/introduction-to-r-programming-2add)
#### 🔥[ Ploting graph with R](https://dev.to/maxwizard01/ploting-graph-with-r-programming-3om7)
#### 🔥 [constructing frequency distribution with R (6)](https://dev.to/maxwizard01/introduction-to-r-programming-2add)
The following is an introduction for plotting simple graphs with the R Programming Language. Each example builds on the previous one. 
In statistic while trying to do analysis on data the most important way of displaying information is the use of graphs. so let's see different kind of graph we can plot with codes.
###Types of Graph
1. [Line Charts](https://dev.to/maxwizard01/ploting-graph-with-r-programming-3om7)
2. [Bar Charts](https://dev.to/maxwizard01/how-to-plot-bar-chart-with-r-1e03)
3. [Histograms]
4. [Pie Charts](https://dev.to/maxwizard01/r-pie-ikh)
5. [Dotcharts]()
6. [Misc]()

### Line Charts
First we'll produce a very simple graph using the values in the weight vector:
### Example:
copy the following codes
```R
# Define the cars vector with 8 values
weight <- c(1, 6, 11, 14, 19, 22, 26, 33)
# Graph the weight vector with all defaults
plot(weight)
```
Result

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g4l35e551xc04huus0fd.JPG)
that is just a simple way to draw a line graph. all your value will be dotted. but that is not nice enough we need to add some attribute that made up perfect graph.
### Title and Colors
Let's add a title, a line to connect the points, and some color with the following codes
Example 1.2

```R
weight <- c(1, 6, 11, 14, 19, 22, 26, 33)
# Graph weight using red points overlay  by a line and use o as the dot
plot(weight, type="o", col="red",font.main=11)
# Create a title with a green, bold font
title(main="Autos", col.main="red", font.main=4)
```
Result
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/584td27n67uw1hkyay69.JPG)
### Explanation
the `plot()` function is used to plot the graph. it can take some parameters like vector ,type and color. 
**Vectors**: is the data will want to use to plot the graph.
**type**: is the kind of mark and line we want to use to specify dot on the graph. it is dot by default and can be change to whatever we want e.g "h","p","s",'S','l' and 'c'
**color**: this is use to give our own preference color.

can we plot two line graph in one graph?? Yeah! we can and we shall take a look at that later. read the next article.
#### 🔥[ Ploting graph with R](https://dev.to/maxwizard01/ploting-graph-with-r-programming-3om7)
#### 🔥 [Bar Charts](https://dev.to/maxwizard01/how-to-plot-bar-chart-with-r-1e03)
#### 🔥[Histograms]
#### 🔥[Pie Charts](https://dev.to/maxwizard01/r-pie-ikh)
#### 🔥[Dotcharts]()
CMake Architecture
Tags: cmake, build, programming, productivity
Published: 2021-03-29 04:38:29

#### INTRODUCTION 

Project CMake started in 1999 with a goal to replace `autoconf/libtool` as a build system for C/C++ projects. It evolved into an extensive toolkit with the following use case:
* `CMake`: build tool
* `CTest`: test driver tool for running regression tests 
* `CPack`: packaging tool to create platform-specific installers
* `CDash`: web app for displaying testing results

CMake can generate `Makefiles` for UNIX-based systems and `VSStudio Project Files` for Windows etc. The only dependency for CMake is C/C++ compiler. It can generate static libraries, shared libraries, executables, and plugins. 

##### Key Features:
* Build tree is kept separate from the source tree.
* Focus is shifted to program to system features and not to the system itself.
* From a user's perspective, there are two steps:
![User View](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s4ljqj4sax1aazj4i7f1.png)
 
    * `configure`: create internal representation of build
    * `generate`: actual build files are created

To avoid setting up the `ENVIRONMENT VARIABLES` every time, `CMakeCache.txt` is generated for all persistent variables. Additional `CMakeLists.txt` can be parsed by using `include` and `add_subdirectory` pattern and having `CMakeLists.txt` in them. One can have custom targets. 
* Parser for `CMakeLists.txt` calls `yacc/lex` for `CMake` language. `yacc/lex` files are kept in source under version control to build CMake.
* From architecture perspective, CMake is a Object Oriented System with following class hierarchy. 

![Code Architecture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c4u601xjsasbg28upur0.png)

#### REFERENCES: 
1. CMake: Architecture of Open Source Applications, Bill Hoffman and Kenneth Martin, https://www.aosabook.org/en/cmake.html
2. Header Image: https://www.pexels.com/photo/arch-architecture-art-building-415574/
How to Clear Route Cache in Laravel

Tags: laravel, exampel, route
Published: 2021-03-29 04:28:31


In this example, I explain how to clear route cache in laravel. We will talk about laravel route cache clear example. Also i will show how to clear cache route in laravel 8.

Some times you face an issue that any changes or edit to the Laravel application are not reflecting on web interfaces. This occurred due to the application is being served by the cache.

Link : [https://web-tuts.com/how-to-clear-route-cache-in-laravel/](https://web-tuts.com/how-to-clear-route-cache-in-laravel/)
Laravel Str slug() Function Example

Tags: laravel, slug, example
Published: 2021-03-29 04:25:56

In this example, I explain laravel Str slug() function. Laravel Str slug() function generates a URL friendly slug from the given string. We will show how to use Str slug() function in laravel.

Link : [https://web-tuts.com/laravel-str-slug-function-example/](https://web-tuts.com/laravel-str-slug-function-example/)
How to Set Session Data In Laravel ?

Tags: example, laravel, session
Published: 2021-03-29 04:23:29


In this example, I explain how to set session data In laravel. We will show set session data in laravel. We will set session data in laravel using session() function.

In this post, We will learn step by step set session example in laravel. Session most use for store data in globally.

Link : [https://web-tuts.com/how-to-set-session-data-in-laravel/](https://web-tuts.com/how-to-set-session-data-in-laravel/)
Negative Number to Positive Number without using abs() - asked in a interview
Tags: javascript, algorithms, programming
Published: 2021-03-29 04:22:26

**In** JavaScript, we have a method called absolute - `abs()` to convert a *negative* number into *positive* number.

**Usage** - `Math.abs(-7);`

**Now**, we will see how we can perform the same operation without using the built-in absolute method,

```
const negativeToPositive = num =>{
  if(num < 0){
    return num * -1;
  }
  return num;
}

console.log(negativeToPositive(-8));
```
Here we have written a function which based on the input number given, converts the *negative* number input to *positive* and for *positive* number input, it just returns the number.

Hope this was helpful😊.
Google Line Chart Example in Laravel

Tags: laravel, googlelinechart, example
Published: 2021-03-29 04:21:10

Google line chart example in laravel. In this example, I explain google line chart example in laravel. We will how to use google chart example in laravel. Also, you will learn dynamic charts in laravel. Google  line charts use to visualize data on your website.

In this post, you will learn dynamic google line charts in laravel. We can simply create google chart in laravel 6, laravel 7 and laravel 8.

Google charts js provide several other charts like bar chart, Column Chart, Area chart, Pie Chart, GEO Chart etc. You can learn example of Google line chart. you learn step by step google line chart in your laravel application.

Link : [https://web-tuts.com/google-line-chart-example-in-laravel/](https://web-tuts.com/google-line-chart-example-in-laravel/)
Accounting my next move
Published: 2021-03-29 04:16:19

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l1x3erl3c1qs7uugdjoo.png)
 
The question that keeps looming is why did I decide to go into Software Development. A question that I wasn't exactly sure I knew how to answer. However, as I began my journey, the answer became quite evident. 

The beginning:

It all started when I was attending college, majoring in Accounting. Math has always been my first love. Since a kid, I've always loved numbers and so math came naturally for me. While studying in accounting in college, we were introduced to some programming along with our basic computers classes which had me intrigued. Who knew years later I would leave behind my dreams of being an accountant to inspire to be possibly integrating accounting software. After I got my degree in Accounting in 2016, and landed my first job, I realized this wasn't exactly what I wanted to be doing the rest of my life.

Making the change:
Through a series of life events, I found myself working at Amazon. After two years, I realized that I didn't want to make a career out of this job so I needed to look for alternatives. I seen they was offering the computer programming class so I took that as my golden ticket opportunity to do something more fulfilling.

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

Enjoying the ride:
I can honestly say now that I am actually do the work in the Flat Iron School program, I made the right choice. I choose to do software development because I genuinely had an interest and coding and finally took the steps to pique that interest. I've always enjoyed problem solving and figuring out how things work. Now, I really to get to put my skills to with computer programming.
#Day8 - Datetime CheatSheet in Python
Published: 2021-03-29 03:59:21

Today we will be discussing the common operations using the Datetime Library in Python

### 1. Get Current Datetime

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1616986916912/8EXEIQ7Fx.png)

### 2. Datetime to a string in the desired format

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

Check out <a href="https://strftime.org/">this resource</a> more for examples

### 3. String to Datetime

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

### 4. Getting Week Number from the Date time object

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

### 5. Arithmetic with Datetime

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1616989019841/9-LyDn9QA.png)

### 6. Get all the days in a year

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

### 7. Get all the dates of all Mondays in a year

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

### 8 . Datetime comparison

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

### 9. Difference b/w datetime objects


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


### 10. Timezones

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1616989970137/5vTbY49Uv.png)
49 Days of Ruby: Day 2 - Installing Ruby
Tags: ruby
Published: 2021-03-29 03:23:52

---
title: 49 Days of Ruby: Day 2 - Installing Ruby
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 2 of the 49 Days of Ruby! 🎉**

Today we are going to install Ruby locally on your machine. We can't move forward with the upcoming topics if we don't have Ruby to work with, right?

It's quite possible that you already have a version of Ruby locally available on your machine. However, most often, that Ruby version is out of date.

For today we are going to learn how to install Ruby version manager on your computer, and how to use it to install and manage your Ruby versions (or Rubies, if you will).

*The steps below are based on a Mac, if you are using Windows check out the [RubyInstaller](https://rubyinstaller.org/) application to get you started.*

## Ruby Version Manager

We are going to use [rbenv](https://github.com/rbenv/rbenv) for our Ruby version manager.

To install rbenv let's use [Homebrew](https://brew.sh/):

```bash
$ brew install rbenv
```

Once that command finishes, you can initialize rbenv by executing `rbenv init` from your command line. If you're curious you can see exactly what `rbenv init` does in the [README](https://github.com/rbenv/rbenv#how-rbenv-hooks-into-your-shell).

You will need to open a new terminal window once initialization has finished.

In a new terminal window you can verify everything worked by running the `rbenv-doctor` script. To do so according to the README:

```bash
$ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
```

You should see a few lines of output after that execution verifying that rbenv is installed.

You're now ready to install the current version of Ruby on your system!

## Installing Ruby

To use `rbenv` to install the latest version of Ruby you want to first identify the latest stable version available. You can do so by running `rbenv install -l` from the command line.

For example, if the latest stable version of Ruby is 3.0.0, then you can install it by running:

```bash
$ rbenv install 3.0.0
```

You can also use `rbenv` to set the version of Ruby you are using, in addition to installation. Once you have installed the latest stable version, let's say it is 3.0.0, you can set your global Ruby version on your system for use with:

```bash
$ rbenv global 3.0.0
```

You could also just do it for this specific shell, if you'd like by using `shell` in place the `global` keyword.

At this point, if you check your Ruby version with `ruby -v` from the command line you should see 3.0.0.

That's it for today! You have successfully installed a Ruby version manager and the latest stable version of Ruby. See you tomorrow for day three!

**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).**
Postgres13 reset lost password Mac BigSur
Tags: postgres, macos, programming
Published: 2021-03-29 02:59:14

Lost your password for the Postgres server?
You can do the below for development, it lets you develop without a password. This below is a quick fix I used for my development purposes. I assume you've knowledge of Vim and Postgres. You can stop at step 9 if you want to leave a blank password. But if you want to reset your password follow the rest.
To reset the password you need to edit the "pg_hba.conf file"
You can locate this file in your applications else you can copy the following to your terminal "sudo vi Library/Application\ Support/Postgres/var-13/pg_hba.conf"
You need to update the "md5" method for all users to "trust" near the bottom of the file.
Locate the name of the service, from the list using the following in your terminal "ls /Library/LaunchDaemons"

5. Find the postgresql and stop the postgresql service.
6. Then, from the terminal "sudo launchctl stop com.edb.launchd.postgresql-13"
7. Again, start the postgresql service. You can do from the terminal using the following "sudo launchctl start com.edb.launchd.postgresql-13"
8. You can start psql session as postgres "psql -U postgres"
9. Now, it will not ask for a password because of the fix in the trust setting that you've applied above.
10. You can reset password in psql session by typing "ALTER USER postgres with password 'secure-new-password';"
11. followed by "\q" to exit the current line in the terminal "enter"
12. Edit the pg_hba.conf file, using "vi pg_hba.conf".
13. Switch it back to 'md5' and restart services again.
Lookup TXT Records using Rust & trust-dns-resolver
Tags: rust, dns, txt, crate
Published: 2021-03-29 02:51:59

This is the third article on using the **trust-dns-resolver** crate  
**Warning: This code is not intended to be used in production. You should review and adjust to your own needs.**

## Getting Started
First we will need to create our development environment.
```zsh
cargo new trust-dns-resolver && cd $_
```
This will give us our standard rust directly structure. We need to add our crate to the `Cargo.toml`  
```zsh
-snip-
[dependencies]
trust-dns-resolver = "0.20.1"
```

Next edit the `src/main.rs` as follows.

{% gist https://gist.github.com/Bas-Man/eb35052052066903ec9ffe9eac57a55b %}

```zsh
cargo run
```

This outputs the following
```zsh
TXT Record 1:
globalsign-smime-dv=CDYX+XFHUw2wml6/Gb8+59BsH31KzUr6c1l2BPvqKX8=

TXT Record 2:
v=spf1 redirect=_spf.google.com

```

### Explaining the code
Documentation for the TXT RData can be found [here](https://docs.rs/trust-dns-proto/0.20.1/trust_dns_proto/rr/rdata/txt/struct.TXT.html)  
Let's take a look at what we are doing here.  
Like the previous examples we create a resolver which will do the work of doing the DNS lookups.  
Next we use the resolver to call `txt_lookup()` and store the result into `txt_response`.  
`txt_response` will contain either a `TxtLookup` or an `Err`. For this reason we need to handle these two cases.  As before I am passing a reference to the `display_txt()` function.  
Within `display_txt` I use `match` to handle my two cases.  
In the case of `Err`. I do nothing and just report there were no TXT records.  
In the case of `TxtLookup`, I will need to do some more processing.
I simply make an `iter()` out of `txt_response` and loop over it and call  `to_string()` on each record in the `iter()`.

I went down a rabbit hole for a while because I incorrectly thought I had to call `txt_data()` which returns a `Box<[u8]`, a smart pointer.

I hope you find this interesting and useful.

P.S: I might revisit this when I look at using regular expressions.
Why did you decide to study software engineering? 
Tags: html, css, javascript
Published: 2021-03-29 02:46:58

Wow, who’s that clean guy ? Aha! That’s me getting a fresh haircut . There isn’t a better feeling then going to the barbershop looking rough then coming out of the barbershop looking like the best version of Yourself. 


Hi, my name is Thomas Coles and I’m a student in Amazon’s career choice software development program

Why have I decided to study software engineering?, Well to be honest I don’t have a coding background or have any experience in this field. I did a little bit of HTML in my 12th grade year of high school which I happening to find interest in at the time. Fast forward 3 years later , I’m working at an Amazon fulfillment center and I don’t remember how I found out about the career choice program but when I first found out about the software development program I was interesting in joining. So now I’m here 1 month into the program, I’m interested in finding out how much I’ll learn from this program and where it takes me in the future
Web Components: Making Life Easier 
Tags: webcomponents
Published: 2021-03-29 02:33:50

Let's be honest, as a non-IST major, this class has continued to be a daunting educational journey for me. Concepts that might come extremely easily for some students continue to humble me after reading over as many articles I can find on Google and yet STILL not understand basic concepts...

However - after a good amount of time trying my best to decipher web components, I feel as though I finally have a solid understanding of web components and how they work! Yay me!

So, a web component, in watered-down language, is essentially a piece or string of code that can be easily replicated and tweaked, but overall allows a coder to write up something once (and only once) so they can reuse it in different contexts over and over. Think of things like widgets on websites, or a header/footer of a website that acts as a menu. These are solid examples of a web component. 

You may be asking - who would use web components? The short answer - just about every website. Two good examples of websites that use web components are Youtube and pretty much all college university-style websites. In this week's video, I can walk you through exactly what I mean by this visually. The link to watch that is here: https://www.youtube.com/watch?v=hZSMgerTCkE

I was able to grasp my understanding of web components through the following sources: 
1) https://developer.mozilla.org/en-US/docs/Web/Web_Components
2) https://levelup.gitconnected.com/web-components-ca2b6727faad?gi=2d81eb623a35
3) https://medium.com/rangle-io/everything-you-need-to-know-about-web-components-part-1-ced95964fbe6
4) https://www.creativebloq.com/features/web-components

Thanks for reading and following along in my struggle to understand coding every week!
Manipulation des "String" avec Javascript
Tags: french, javascript, beginners, tutorial
Published: 2021-03-29 02:27:42

---
title: Manipulation des "String" avec Javascript
description:
published: true
tags: french, javascript, beginner, tutorial
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ik1c8mr2sz8zi3g466dq.jpg
---
Si vous aimez ce genre de post et que vous ne voulez rien manquer de ma part, cliquez sur Follow. 

Voici les principales fonctions de manipulation des String en JavaScript

<h2>String</h2>
```js
const name = 'Mike Taylor'
// Accès direct
console.log(name[0]) // M

// Retourne la postion (zero base)
console.log(name.indexOf('T')) // 5

// Modifie un élément
name[0] = 'P' // Pike Taylor

// Extrait une partie de la chaine
console.log(name.slice(5)) // Taylor
console.log(name.slice(5, 8)) // Tay
console.log(name.slice(-2)) // or

// Conversion en minuscule / majuscule
console.log(name.toLowerCase()) // mike taylor
console.log(name.toUpperCase()) // MIKE TAYLOR

// Enlève les espaces blancs
const title = ' Ceci est un test avec des blancs   '
console.log(title.trim()) // 'Ceci est un test avec des blancs'

// Enchainement de fonctions.
console.log(title.toLowerCase().trim())  

// Remplace
const name = 'Mike Taylor'
console.log(name.replace('Mike', 'Paul') // Paul Taylor

// Inclut?
const name = 'Mike Taylor'
console.log(name.includes('Mike')) // true

// Divise 
const colors = 'Red, Green, Blue')
console.log(colors.split(',')) // ['Red', 'Green', 'Blue']

// Regroupe
const colors = ['Red', 'Green', 'Blue']
const colors_string = colors.join('-') // Red-Green-Blue

```

<h2>Opérateur Short-circuit || </h2>
```js
// Si première expression est vrai alors retourne la première expression
// Si première expression est fausse alors retourne la deuxième expression
console.log('Hello' || 'Hi') // 'Hello'
console.log('' || 'Bye') // 'Bye'
console.log('' || 0 || 100) // 100

// Exemple d'assignation conditionnel
const maxUser = config.maxUser || 10

```

<h2>Opérateur Nullish Coalescing </h2>
```js
// Assignation seulement si null ou undefined
const maxUser = config.maxUser ?? 10

```

<h2>Enchainement optionel</h2>
```js
if (customer.creditLimit) {
  if (customer.creditLimit.dateExpire) {
    console.log(customer.creditLimit.dateExpire)
  }
}
console.log(customer.creditLimit.dateExpire) // error
// Enchainement optionnel: assignation seulement si undefined ou null
console.log(customer.creditLimit?.dateExpire) // undefined

```