teleren/devto huggingface dataset:
Why shouldn't you learn programming?!
Tags: csharp, webdev, python, javascript
Published: 2020-12-01 08:11:14

I saw many articles said "You should learn programming" or "You have to learn programming". But I decided to write an article and tell you why "You shouldn't learn it"

If you are not interested in programming, You shouldn't learn it!
If you are not interested in programming, You shouldn't learn it!
If you are not interested in programming, You shouldn't learn it!
If you are not interested in programming, You shouldn't learn it!
If you are not interested in programming, You shouldn't learn it!
If you are not interested in programming, You shouldn't learn it!

I copied this like 6 times for more focus.

Programming is a skill and many people like it and many people don't. If everybody liked to learn it, there wouldn't any programmers in the world and no one could make money of it.

You may interest in another field, You don't have to learn it if you hate it. 

Put comments under this post and don't forget to like it and follow me on Twitter.
HTML5 canvas... responsive!
Tags: webdev, javascript, html
Published: 2020-12-01 08:09:41

Hey folks,

I recently decided to learn SVG to see how it could help me with creative coding / generative art. Safe to say, I was blown away by how incredibly simple and easy it was to create truly responsive, scalable works that I could embed anywhere.

This was amazing for a while, until I started getting a craving for some bitmap action.

**Cool**, I thought. Let's got to `<canvas>` land.

...

Nope, **not cool**. I had forgotten how painful it was to make `<canvas>` *actually look good*. 

The default `<canvas>` element was a million miles away from the responsive, crisp rendering nirvana of SVG. 

Everything looked blurry on my retina screen, making the element fluid was a living nightmare and loosing my drawing state on resize made me sad *(especially for generative stuff)*

## VBCanvas to the rescue

As a remedy to the issues outlined above, I have created a JavaScript library - `VBCanvas` that addresses the responsive issues of the default `<canvas>` element. 

It does this by introducing a `viewBox` attribute that works [just like SVG's](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/viewBox).

You can check the library out [here on Github](https://github.com/georgedoescode/VBCanvas) or [here on NPM](https://www.npmjs.com/package/vb-canvas)

## How it works

In short, you can define a `viewBox` for your canvas - say `0 0 100 100` __(x, y, w, h)__ and draw everything relative to those coordinates. The setup looks something like this: 

```javascript
const { ctx, el } = VBCanvas.createCanvas({
  // viewBox (x, y, width, height)
  viewBox: [0, 0, canvasWidth, canvasHeight],
  // where to mount the <canvas> element
  target: '.canvas-wrapper',
});

// draw stuff with ctx!
```

The `<canvas>` element will then automatically scale / respond exactly like an `<svg>` element. You can set any dimensions you like, VBCanvas will take care of all the scaling for you.

This makes creative truly responsive `<canvas>` elements extremely easy!

Here is a simple example in which the canvas is always scaled to **fit** it's container. Much like `background-size: contain;` in CSS or `xMidYMid meet` for SVG.
 
{% codepen https://codepen.io/georgedoescode/pen/ZEOgLwZ %}

And here is an example where the canvas is scaled to **fill** it's container. Much like `background-size: cover` in CSS or `xMidYMid slice` for SVG.

{% codepen https://codepen.io/georgedoescode/pen/GRjJQgm %}

The code for the two above examples is exactly the same, apart from the `scaleMode` option which defines how the canvas should scale. 

**Note:** I have noticed that `requestAnimationFrame` sometimes jumps frame rate in iFrames / embeds, if you notice some slightly wacky speed stuff in the examples, it's that.

I suggest opening the examples up and seeing how the canvas responds to resizing the viewport. 

## Have a play! 

I hope some people find this library useful, and please do give me a shout on twitter @georgedoescode if you have any feedback. PRs / issues are of course always welcome 🙏
How to compare two arrays in javascript?
Tags: javascript, react, angular
Published: 2020-12-01 08:03:15

---
title: How to compare two arrays in javascript?
published: true
description: every method combinate with indexOf method
tags: javascript, react, angular
//cover_image: https://direct_url_to_image.jpg
---
Some days ago I needed to compare two arrays in Javascript and I trivially tried to compare them as if they were strings
```js
const serviceList = ["sales_bot"]
const botType = ["sales_bot"]
console.log(serviceList == botType)
```

and the result was this:
```js
false
```
It is possible to compare arrays using the "every" method in javascript. A possible solution is
```js
botType.length === serviceList.length && serviceList.every(item => botType.indexOf(item) > -1)
```
I started with length arrays comparison, to be sure to have the same items. Then, I needed to check if the items were inside the same number of times. 

It is essential that the first condition is satisfied at first, since it is less elaborate than the second one. Indeed, the second condition has to cycle every element of the array.

If the first returns FALSE, then the second one won't even be executed. Therefore we are sure that the arrays will be different because they have different numbers of elements.

If the first returns TRUE, is to check even the second condition. This means to check that all the elements of arrays are actually the same


How is this comparison done?

The every method returns true just if all elements satisfy the condition and the indexOf method return the index of element. If doesn’t exist the result is -1. For this reason the condition is > -1

In this case, I knew for sure that one of my array would have never been empty, otherwise the problem would have been somewhere else. It happens other times that this thing is not obvious and then you need one more check like the following:

```js
botType.length === serviceList.length && serviceList.length > 0 && serviceList.every(item => botType.indexOf(item) > -1)
```
Enjoy your code mates!
RXJS react learning question
Tags: beginners, javascript, webdev
Published: 2020-12-01 07:51:04

Hi all,


looking for advice please. A project I am working on uses rxjs with react. All the books I have found are rxjs vanilla. If i read the vanilla js would it help me with react? I feel would be better if i read a rxjs with react book 

can anyone suggest any resources please I did try good
Digital Marketing Agency In India - Digital Daisy
Tags: marketing, services
Published: 2020-12-01 07:49:27

Digital Daisy has begun to provide for all sorts of web development and marketing (general advertising, strategy, branding and promotions). Our focus is on supplying all kinds of digital marketing wants and web solutions. It is a top new age web solutions and online marketing and advertising platform. Daisy is your one-stop for all things digital. We help you transform your thoughts into reality. We've got a fantastic team of professional programmers, artsy designers along with a result-oriented advertising staff, they love what they do. With our unique and neoteric thoughts, we deliver new experiences coming from a mix of technology and creativity. Maintaining your company objectives at the heart of our business strategy, we assist you to position yourself as a pioneer.

www.wearedaisy.com
Testing simple web server
Tags: go, testing, webdev
Published: 2020-12-01 07:28:46

# Testing web server in Golang

- create a file with name `<anything>_test.go`, these files are ignore by compiler
- write a func matching `func TestXxx(*testing.T)`  where Xxx does not start with a lowercase letter. The function name serves to identify the test routine.
- to run the test : `go test`

## Testing
- inorder to test the handler, we call it by passing `http.ResponseWriter` and `*http.Request`

- to create a new Request

```
req, err := http.NewRequest(
    http.MethodGet,                 // defining method of HTTP request
    "http://localhost:8080/",       // Url to hit
    nil,                            // Body (taking nil right now)
)

// checking for any errors            
if err != nil {
    t.Fatalf("Could not create a request %v", err)
}
```

- to record the response from the writer

```
rec := httptest.NewRecorder()
```

- to verify

```
// calling the function
helloWorldEndPoint(rec, req)

// checking status code
if rec.Code != http.StatusOK {
    t.Errorf("accepted status 200, got %v", rec.Code)
}

// checking the msg returned
if !strings.Contains(rec.Body.String(), "hello world") {
    t.Errorf("unexpected body in response %q", rec.Body.String())
}
```

### Full code server.go

```
package main

import (
    "fmt"
    "log"
    "net/http"
)

func main() {

    http.HandleFunc("/", helloWorldEndPoint)
    fmt.Println("Server :  http://localhost:8080")
    log.Fatal(http.ListenAndServe(":8080", nil))

}

func helloWorldEndPoint(writer http.ResponseWriter, request *http.Request) {

    fmt.Fprintf(writer, "hello world")

}
```

#### full code main_test.go

```
package main

import (
    "net/http"
    "net/http/httptest"
    "strings"
    "testing"
)

func TestHandler(t *testing.T) {

    req, err := http.NewRequest(
        http.MethodGet,
        "http://localhost:8080/",
        nil,
    )

    if err != nil {
        t.Fatalf("Could not create a request %v", err)
    }

    rec := httptest.NewRecorder()
    helloWorldEndPoint(rec, req)

    if rec.Code != http.StatusOK {
        t.Errorf("accepted status 200, got %v", rec.Code)
    }

    if !strings.Contains(rec.Body.String(), "hello world") {
        t.Errorf("unexpected body in response %q", rec.Body.String())
    }

}
```
Free Machine Learning & Data Science training resources for beginners.
Tags: machinelearning, ai, datascience
Published: 2020-12-01 07:28:11

This video shares a valuable resource for data science aspirants that contains links free resources of all the concepts in machine learning and data science. All links are at one pdf document. Checkout the video about the document content and download it.
Video Link: https://youtu.be/Q9sLUJZsfSs
Amazon introduces native Mac instances for AWS
Tags: aws, ios, cloud
Published: 2020-12-01 07:25:51

Yay!

For the first time you can now run a Mac mini in AWS. Some of the details that have been released:

They are intel, with M1 coming in 2021.

Not virtualised.

You can attach block storage.

You can manage multiple images for Dev builds.

Seems like it is just for AWS workspaces, not sure about Lightsail just yet..

There is a 24hr up front cost, then its per second billing

Apparently cheaper than other Mac Cloud providers at $1.083 per hour

They are are i7 machines with six physical and 12 logical cores and 32 GB of memory.

Big Sur not supported just yet
How To Rotate Array Elements using JavaScript Array Methods

Tags: javascript, html, webdev
Published: 2020-12-01 07:24:24

As a JavaScript developer, we come across many instances where we need to rotate the array elements to left or right. Many Algorithms need this logic too. So here is the way to rotate the array elements to right and left.

##Rotate the Elements to the Left:
We can use array methods `push()` and `shift()` to rotate the elements to the left. Let’s see how we could do use these methods.

*1) The `shift()` method removes the first element from an array and returns that removed element.
2) The `push()` method adds one or more elements to the end of an array and returns the new length of the array.*
```javascript
let starks = ['Rob', 'Jon', 'Sansa', 'Arya', 'Bran']

starks.push(starks.shift())

console.table(starks) 
// expected result: [ 'Jon', 'Sansa', 'Arya', 'Bran', 'Rob' ]
```
1) The `shift()` method removes the first element from the array. In our example, The [‘Sansa’] is removed if we do *starks.shift()*.(which should be added to the last).

2) Now the *starks.shift()* contains [‘Sansa’] and the starks contains [‘Arya’, ‘Bran’, ‘Rob’, ‘Jon’].

3) The `push()` method adds the one or more elements to the last so the element [‘Sansa’] is added in the last which gives us the array which is rotated to left.
***

##Rotate the Elements to the Right:

We can use array methods `unshift()` and `pop()` to rotate the elements to the right. This is how it is gonna work.

*1) The `unshift()` method adds one or more elements to the beginning of an array and returns the new length of the array.
2) The `pop()` method removes the last element from an array and returns that element.*
```javascript
let starks = ['Rob', 'Jon', 'Sansa', 'Arya', 'Bran']

starks.unshift(starks.pop())

console.log(starks)
// expected result: [ 'Bran', 'Rob', 'Jon', 'Sansa', 'Arya' ]
```
1) The `pop()` method removes the last element from an array and returns that element. So we get [‘Jon’] from the *starks.pop()*.

2) The *starks.pop()* has [‘Jon’] and starks has [‘Sansa’, ‘Arya’, ‘Bran’, ‘Rob’].

3) The `unshift()` method adds one or more elements to the beginning of an array. We are adding the element we got from stark.pop() ([‘Jon’] is added to the beginning) to the first using `unshift()`.
***
And that sums up the rotation to left and right using Array methods.

Thank you
Benefits Of Email Marketing Tools For Your Business
Tags: digitalmarketing, emailmarketing
Published: 2020-12-01 07:08:03

When someone visits your website and thinks about subscribing to your mailing list to keep in touch with you via email, it is called email marketing. An email list like this is very important if you sell a service or product. Email marketing allows you to retain your customers, earn their trust, and promote your brand awareness while encouraging your followers to buy from you more often.

[Email Marketing](https://www.propelguru.com/email-marketing/) has several advantages. While this is a great marketing tool, it unfortunately seems to get a bad rap with some companies, who don't fully understand it. 

**1. Design a newsletter**

An ideal way to stay in touch with your mailing list is with a newsletter. It gives you an ideal mix of updates, news, information and special offers about your business to generate engagement with subscribers and let them know more about you. The newsletter is also a great way to encourage calls to action, perhaps with a limited-time offer.

**2. Build a strong bond with your followers**

Over time, your connection with your subscribers will grow. As you grow stronger, your subscribers' loyalty to your business increases, and as a result, your business sales and profits increase. Your business will gain new referrals, opportunities, and win-win partnerships, as well as build a new customer base.

**3. The most economical and effective advertising technique**

Nonetheless, email marketing is one of the most lucrative ways to promote a business. Over time, you can build a mailing list with a large number of potential customers who show a deep interest in what you have to offer by providing you with their email address.

Communicating with your subscribers is absolutely free and each of your emails generates great sales.

**4. Provide a visible link to unsubscribe**

You may think of this as a negative approach, but it is actually a positive approach. Your readers are comfortable when they feel like they are in full control and don't have to do anything. So, never forget to include an unsubscribe link in your email. Trying to hide it or not providing a link will only earn you the frustration and anger of your subscribers, leading to results that are completely opposite to what you want to achieve.

In this blog we have discussed the Benefits of Email marketing tools for our business, for more information regarding Email Marketing, you can visit Propel Guru a [Digital Marketing Company](https://www.propelguru.com/).
Common Git commands
Tags: git
Published: 2020-12-01 06:37:50

Few of the git command that we use at Student Edge:
####Pulling from origin (note: master below can be replaced by any branch name)
`git pull --rebase origin master`

####Switching to an existing branch
If you already have the branch locally you can just do

`git checkout MyOtherBranch`

if you don't have the branch locally you need to do the following
```
git fetch

git checkout -b MyOtherBranch remotes/origin/MyOtherBranch
```
####Creating a new branch
`git checkout -b MyNewBranch`

####Pushing your branch to origin
`git push origin MyBranch`

####Commit your code to your current branch.
```
git add --all :/

git commit -m 'WR-123 I changed something'
```

####Make a tweak to your previous commit
`git commit --amend`

After running the above it will open vim. Just type `:wq` and it will rebase and commit it

####Remove a commit from your branch (note: the hats are how many commits to go back)
`git rebase -i HEAD^^`

After running this it will open vim with all the commits listed, the number of `^` will indicate how many commits it will show. Type `i` which will put it in edit mode. Delete the commit lines you want to remove. Then press `Esc` and then `:rw` to rebase.

Thanks to [Dan](http://danielvanheerden.com/my-gitconfig/), you can add this helper git file in the root of your user account folder (eg. C:\users\'myUser') and create your own git shortcuts (.gitconfig)
```
[user]name = Your user name
email = your@email.com

[alias]# Pretty text base branch tree
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

# When on master branch, force local master to be the same as origin
refreshmaster = checkout    -B master remotes/origin/master

# pretty diff of changes
diff = diff --word-diff=color

# After Fixing conflicts - OK to proceed with rebase
ok = rebase --continue

# Push the current branch upstream to it's namesake branch on origin
up = push origin HEAD

# Push the current branch upstream to it's namesake branch on origin with FORCE
upf = push -f origin HEAD

# Replace NEW stuff from master to my current branch
new = pull --rebase origin master

# Track all new changes
done = add --all :/

# Amend my last commit - request you to do "git add --all :/" or "done" first and then do `:wq` in vim to save and rebase
tweak = commit --amend

# Give a list of the last branches on my local git
lb = for-each-ref --sort=-committerdate --format='%(refname:short)' refs/heads/
changes = diff-tree --no-commit-id --name-only -r 

[push]
default = upstream
```
Officially  a Tech Returner !
Published: 2020-12-01 06:26:51

I was so happy when I first found out I was selected for the “Return to Tech” program. After a long career break in programming, I was finding it challenging to return back to software development career. Due to my passion in programming and developing software solutions I really wanted to get back into career again. I was working on my own for few months recently to get myself up to date with all those latest technologies. However, with such a vast area to learn and working on my own I felt it quite difficult and alone. 

For me to be the part of tech returner program it is such a great opportunity where I get right support; mentors and team to work with and more importantly others who are on same boat as me and understand the difficulties we all are facing to return back to our career. As I am a hardworking and self-driven person, all I have to do now is give my 100% and step into this journey to rebuilt my career with growth mindset.
setup nginx server
Published: 2020-12-01 05:59:55

1. https://www.digitalocean.com/community/tutorials/initial-server-setup-with-centos-7
2. https://www.digitalocean.com/community/tutorials/additional-recommended-steps-for-new-centos-7-servers
3. https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-7
Setting up SSH Access to your Web Hosting Service.
Tags: remote, beginners, tutorial, ssh
Published: 2020-12-01 05:51:52

---
title: Setting up SSH Access to your Web Hosting Service.
published: true
description: Setting up SSH access to your web hosting service to manage your remote server remotely.
tags: remote, beginners, tutorial, ssh
// cover_image:
canonical_url: https://jamesinkala.com/blog/setting-up-ssh-access-to-your-web-hosting-service/
---

This is a simple guide to help you setup ssh access to your web server.

First and foremost, you need to enable ssh access on your web hosting provider's dashboard.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7gy81yolzp8ewa9cg9l2.gif)  

Look for the SSH access setting which will most likely be off.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ywvhg6bzy3qpb0e8so50.gif)  

And turn it on.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/l6glfiq18misdr5i4kay.gif)  

### Remote Access ###
What's left is trying to access your remote server from your local machine. You might opt for tools like [PuTTY](https://www.putty.org) or use your operating system's built in SSH client which the Mac OS and Windows (Windows 10, [2015 onwards](https://devblogs.microsoft.com/powershell/looking-forward-microsoft-support-for-secure-shell-ssh)) port out of the box.
All you need is open windows command prompt or terminal on Mac and use your server's access credentials as follows.
```sh
$ ssh username@server_ip_address
```
You will be prompted to insert your password and that's it.

Break a `shell`.