teleren/devto huggingface dataset:
Taking tutorials doesn't make you a noob
Tags: devlive
Published: 2020-06-29 17:25:00

Here's a word of encouragement. You aren't a noob if you take coding tutorials.

It is generally agreed that programmers become better at what they do when they take on projects. But here's something no one says 

> The projects you build while developing yourself consist of things other people have done. So if you need to take some tutorials to get part A to work, that's totally fine.

## Let's see a real-life case-study.
### Task
Build a school management system
### Frontend Task breakdown
1. Get some existing designs from dribble
2. Set up React project
3. Create the basic UI
4. Use graphql as the data layer
5. Use Auth0 for identity management

Now, you only know how to execute 1, 2 and 3. To get 4 and 5 to work, you look through the docs and start trying to get it into your existing project. But you fail at it because you have no idea of what you are doing.

There's nothing wrong if you set up a new project and take tutorials on Graphql and Auth0, totally unrelated to your school management system. After completing those tutorials, you can immediately apply the knowledge you attained to your school management system. That's an efficient way to learn and grow.

## How great engineers learn
Great engineers take the business problem presented to them. They then analyse this problem and chose the best tools for the job. If the job requires them to learn a new skill/technology, they quickly find a means to learn that skill/technology. 

No one will pay you to figure out your way around a technology entirely from the tech's docs. If you combine tutorials, StackOverflow and docs to get the job done, then you have done well. 

## So, what's the general approach to learning new things?

Referencing this tweet on how software developers approach learning new things, we can see that most people combine tutorials, documentation and StackOverflow. 
{% twitter 1276136862185390080 %}

When you're just starting out, docs may not be ideal. As you grow, you'd learn how to read docs. Docs usually contain info you won't find in tutorials.

## When is calling yourself a noob justifiable
Calling yourself a noob largely depends on your standards and situation. In my humble opinion, you are doing what a noob does if you blindly take tutorials for the sake of taking tutorials. When you don't have any clear goal for taking the tutorials you are taking.

Some people do it for the joy of learning. Others do it to have a bigger picture of how products are built. It's your life. Don't allow anyone (or your internal voice) to call you a noob for no reason. Thanks for reading.
AutoDeploy your projects using Github WebHooks
Tags: github, aws, node, javascript
Published: 2020-06-30 11:23:04

Hey Everyone,

Many of us has this problem of deploying our github repo to EC2 machines or Digital Ocean's droplets or etc. We can automate this process by running a simple webhook script on our machine.

Lets start !

# The script

```js
const secret = "secret-from-github";
const repo = "path-to-repo-on-machine(eg ~/react-project)";
const http = require('http');
const crypto = require('crypto');
const exec = require('child_process').exec;
const child = require('child_process');
http.createServer(function (req, res) {
        let data= []

        req.on('data', function(chunk) {
                data.push(chunk);
        });

        req.on('end', () => {
                let sig = "sha1=" + crypto.createHmac('sha1', secret).update(data.toString()).digest('hex');
                if (req.headers['x-hub-signature'] == sig) {
                        if(JSON.parse(data).ref==='refs/heads/master'){
                                console.log('Deploying commit - ',JSON.parse(data).head_commit.message)
                                exec('cd ' + repo + ' && git pull origin master && npm install && npm run build && pm2 start npm -- start');
                        }
                }

        })

    res.end();
}).listen(8080);
```
- This script is first generating a sha signature using sceret and verifiying the request.
- If request signature matches our generated signature then we our parsing the payload to JSON.
- In this script we are receiving all the events that are being generated on our Github repo like commit , pull request, merge.
- I have a develop branch and a master branch.
- I am triggering the build when an event occurs on a master branch. ```if(JSON.parse(data).ref==='refs/heads/master')```
- When we have a merge event to our master branch it will first go to your directory on server and run 

👉🏻 git pull origin master

👉🏻 npm install 

👉🏻 npm run build 

👉🏻 pm2 start [pm2 is process manager for nodejs. you can replace it with npm start also ]
> Note: git pull will ask for username and password.The prompt should not come thats our motive here. You need to either use ssh or use ```git config credential.helper store```. Check this out [here](https://stackoverflow.com/a/51327559/8461016).I am using credential store as i am the only one accessing that server. 

Now start the script using node or pm2.

# Configuring the Machine.

If you are using nginx , create a proxy pass for it. You just need to open the port 8080 for communication.
- NGINX is a better option as you can assign subdomain to it and also ssl certificate.

# Configuring Repo on Github

1. Go to Setting 👉🏻 Webhooks.
2. ![Webhook page](https://dev-to-uploads.s3.amazonaws.com/i/5jy9s52wkstxp6j0frq2.png)
3. After adding the webhook , edit it and enforce ssl for better security.

That's it . Your are done 🎉.

You can find me on other platforms 👇

{% twitter 1276500269027622918 %}

I am using this method in my latest project https://ismy.institute/

We are participating in YC SUS2020 also.
Mutation Testing Badge with Pitest and Stryker Dashboard
Tags: test, codequality, java, maven
Published: 2021-02-24 12:19:07

---
title: Mutation Testing Badge with Pitest and Stryker Dashboard
published: true
date: 2020-06-30 11:18:13 UTC
tags: test, quality, java, maven
canonical_url: https://maarten.mulders.it/2020/06/mutation-testing-badge-with-pitest-and-stryker-dashboard/
---

Over the years, badges have become a way for open source maintainers to show the state of their product. Badges can give a quick overview of the code quality, test coverage or build health of an open-source product. The problem with code coverage is, however, that a high coverage doesn’t mean the tests are any _good_. If only there was a way to show the quality of the test suite...

---

[Continue reading...](https://maarten.mulders.it/2020/06/mutation-testing-badge-with-pitest-and-stryker-dashboard/)
JavaScript Vs TypeScript
Tags: javascript, java, typescript, csharp
Published: 2020-06-30 11:16:39

What is JavaScript?
JavaScript is a popular scripting language, used for creating web pages. It is majorly used for client-side Dynamic pages. Programs we write in JavaScripts are known as scripts. Along with HTML and CSS, JavaScript is one of the core technologies of the World Wide Web. JavaScript allows us to develop interactive web pages and is an essential part of any web application services. The majority of websites use JavaScript for client-side page behavior, and all major web browsers have a dedicated JavaScript engine to execute it. JavaScript is Object-Oriented language but, it is not class-based Object Oriented language like JAVA, C++, C#, etc. JavaScript is a prototype-based language.

What is TypeScript?
While TypeScript is an open-source object-oriented programming language. It is a combination of some of the features of JavaScript and additional features like static typing, classes, and interface. We can also say that TypeScript is a superset of JavaScript. If you are writing a JavaScript it is a valid TypeScript. You can not directly run the TypeScript on the browser and it needs a compiler to compile the code and turn it into the JavaScript file.


Pros of Using TypeScript over JavaScript
It always highlights errors at compilation time during the time of development. Whereas if you are using JavaScript errors get pointed out at runtime.

One can run TypeScript on any browser or JavaScript engine. TypeScript includes the features that are strongly typed or Static Typing. Static typing helps us for checking type correctness at compile time. However, this feature is not available in JavaScript.

An additional feature of using TypeScript is it allows great tooling supports with IntelliSense which provides active hints as the code is added.

TypeScript compiler can compile the .ts files into Es3, ES4 and ES5.

Frameworks like Angular 2 also use TypeScript as a programming language.

 

Cons of Using TypeScript over JavaScript
Usually, TypeScript takes a longer time to compile the code as compared to the JavaScript.

TypeScript does not support abstract classes.

If you run the TypeScript application into the browser, a compilation step is needed to transform TypeScript into JavaScript.

Get the conclusion here: https://www.rlogical.com/blog/javascript-vs-typescript/
So many months.....
Tags: computerscience, codequality, java, cpp
Published: 2020-06-30 11:11:49

Hello my gorgeous friends on the internet, It's been a while I was not active on social medias, since my tuitions classes were resumed and many other reason. But now, I will take some time out to resume and work on my coding skills. 

At present I have done good stuff related web programming, but now I want to do some competitive coding too, Few weeks ago I started learning Java and today I take "Introduction of C++" now I'm confused, which what(java/c++) should i proceed.

What's your opinion, suggest me guys....
What are you using for your documentation?
Tags: discuss, documentation, webdev
Published: 2020-06-30 10:51:48

Hi everyone,

I am sure there is no "best" tool for it but what are your recommendations for documentation. It should support MDX.

- Gatsby has some nice themes for documentation
- there is [Docz](https://www.docz.site/) which is built on top of Gatsby
- [Dokz](https://dokz.site/) which is powered by NextJS
- I am sure there are a lot more tools out there

What is your preferred choice? What would you use if you have to start writing documentation today?
Time Zone issue with Heroku
Tags: momentjs, heroku, node
Published: 2020-06-30 10:44:36

I've been using [Heroku](https://heroku.com) for a while now, Recently I was working on a project which was a basic chat application, It was built with [Nodejs](https://nodejs.org/en/), [socket.io](https://socket.io/), [momentjs](https://momentjs.com/).

As it was a chat application I used momentjs for the timestamps on the messages, Everything was working fine locally, but when I deployed my app on Heroku I found that messages were not showing the correct time.

As the Heroku's default region is set to **US** & I was from **India** that was causing the issue. So basically momentjs was showing **US Timezone**.

So the problem was with Heroku's Timezone & Luckily Heroku allows us to change the timezone of our app just by simply adding a new config var.
After fixing the problem it was working fine :)

Here's the Solution:

#### Heroku Dashboard - Website
1- Login into the Heroku from a browser
2- Select your app
3- Go to the setting tab
4- Press "Reveal Config vars" button
5- Set the keys to "TZ" and value of your timezone (Eg: Asia/Kolkata)
6- Press the add button

#### Heroku CLI
1- Open your Command shell
2- Login into Heroku
3- cd into your App directory
4- Setup TZ

```bash
heroku config:add TZ="Asia/Kolkata"
```

### What is correct TZ value of your country ?

You can find your country's TZ value from this [wiki](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) page

**India uses a single time zone for the whole country.**
I looked on the Wiki page List of tz database time zones, but I was unable to find an entry for India.

If you can't find your country's TZ follow this [link](https://github.com/eggert/tz/blob/master/zone1970.tab)


**_Thanks for reading!_**
how not to use reduce
Tags: javascript, typescript, webdev, beginners
Published: 2020-06-30 10:33:13

Why not reduce?

- https://dev.to/ycmjason/writing-cleaner-code-with-the-rule-of-least-power-rolp-4kkk
- https://twitter.com/jaffathecake/status/1213077702300852224

This list intend to be a forever growing one that hope to collect typical patterns of reduce to avoid. Please feel free to suggest more examples!

-------

This post is not about space / time performance perks by not using reduce. This is all about readability.

-----------

🔴 Do not

```js
faces.reduce((acc, face) => {
  return [...acc, mask(face)]
}, [])
```

✅ Do

```js
faces.map(mask)
```

-----------

🔴 Do not

```js
bags.reduce((acc, bag) => {
  return [...acc, ...bag.apples]
}, [])
```

✅ Do

```js
bags.flatMap(bag => bag.apples)
```

----------

🔴 Do not

```js
phones.reduce((acc, phone) => {
  return isNew(phone) ? [...acc, phone] : acc
}, [])
```

✅ Do

```js
phones.filter(isNew)
```

----------

🔴 Do not

```js
dogs.reduce((acc, dog) => {
  return isHappy(dog) ? acc + 1 : acc
}, 0)
```

✅ Do

```js
dogs.filter(isHappy).length
```

----------

🔴 Do not

```js
people.reduce((acc, person) => ({
  [person.dna]: person
}), {})
```

✅ Do

```js
Object.fromEntries(
  people.map(person => [person.dna, person])
)
```

----------

🔴 Do not

```js
people.reduce((acc, person) => {
  return Math.max(acc, person.age)
}, -Infinity)
```

✅ Do

```js
Math.max(...people.map(person => person.age))
```
Spark NLP: State of the art natural language processing at scale
Tags: spark, naturallanguageprocessing, ai, machinelearning
Published: 2020-06-30 10:13:01

Natural language processing is a key component in many data science systems that must understand or reason about text. Common use cases include question answering, paraphrasing or summarization, sentiment analysis, natural language BI, language modeling, and disambiguation. This talk introduces the Spark NLP library – the most widely used NLP library in the enterprise, thanks to implementing production-grade, trainable, and scalable versions of state-of-the-art deep learning & transfer learning NLP research, as a permissive open-source library backed by a highly active community and team.

{% youtube WxPARvMtkK8 %}

Spark NLP natively extends the Spark ML pipeline API’s which enabling zero-copy, distributed, unified pipelines, which leverage all of Spark’s built-in optimizations. Benchmarks and design best practices for building NLP, ML and DL pipelines will be shared. The library implements core NLP algorithms including lemmatization, part of speech tagging, dependency parsing, named entity recognition, spell checking and sentiment detection. The talk will demonstrate using these algorithms to solve commonly used tasks, using Python notebooks that will be made publicly available after the talk. Bio: David Talby is a chief technology officer at John Snow Labs, helping fast-growing companies apply big data and data science techniques to solve real-world problems in healthcare & life science. Previously, he was with Microsoft where he led business operations for Bing Shopping in the US and Europe, and before that at Amazon in Seattle and in the UK, where he built and ran distributed teams that helped scale global financial systems. David holds a PhD in computer science and master’s degrees in both computer science and business administration.

- You can find David’s slides here <https://drive.google.com/file/d/1JY69DNcoBPkGlNTd2HyWvnUmDorkvH6f/view?usp=sharing>
- Spark NLP homepage:
  <https://nlp.johnsnowlabs.com/>
- Public notebooks about the open-source library:
  <https://github.com/JohnSnowLabs/spark-nlp-workshop/tree/master/tutorials/colab>


[![Creative Commons License](https://i2.wp.com/i.creativecommons.org/l/by-nc-sa/4.0/88x31.png?w=800&ssl=1)](http://creativecommons.org/licenses/by-nc-sa/4.0/)
This work is licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-nc-sa/4.0/).
Active Learning for Natural Language Processing
Tags: machinelearning, activelearning, ai
Published: 2020-06-30 10:10:17

More than 90% of machine learning applications improve with human feedback. For example, a model that classifying news articles into pre-defined topics has been trained on 1000s of examples where humans have manually annotated the topics. However, if there are tens of millions of news articles, it might not be feasible to manually annotate even 1% of them. If we only sample randomly, we will mostly get popular topics like “politics” that the machine learning model can already identify accurately. So, we need to be smarter about how we sample. This talk is about “Active Learning”, the process of deciding what raw data is the most optimal for human review, covering: Uncertainty Sampling; Diversity Sampling; and some advanced methods like Active Transfer Learning.

{% youtube 13dyBvIAa1E %}


Robert Munro has worked as a leader at several Silicon Valley machine learning companies and also led AWS’s first Natural Language Processing and Machine Translation solutions. Robert is the author of Human-in-the-Loop Machine Learning, covering practical methods for Active Learning, Transfer Learning, and Annotation. Robert organizes Bay Area NLP, the world’s largest community of Language Technology professionals. Robert is also a disaster responder and is currently helping with the response to COVID-19.

The slides are available on [this link](https://docs.google.com/presentation/d/1lgZRRcJR2V0Ih8LDw4ezCIyqA8-dJBltwKIgF5rWV4M/edit?usp=sharing).



[![Creative Commons License](https://i2.wp.com/i.creativecommons.org/l/by-nc-sa/4.0/88x31.png?w=800&ssl=1)](http://creativecommons.org/licenses/by-nc-sa/4.0/)
This work is licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-nc-sa/4.0/).
The 10-Day JavaScript Challenge
Tags: javascript
Published: 2020-10-21 07:30:12

---
title: The 10-Day JavaScript Challenge
published: true
date: 2020-06-30 06:13:00 UTC
tags: JavaScript
canonical_url: https://drmsite.blogspot.com/2020/06/the-10-day-javascript-challenge.html
---

Yay! There's another one started, such fun!

I'll add to this is I go along.

## Day 1

```javascript
const add = (...a) => a.reduce((t, v) => t + v)
```

## Day 2

```javascript
const allLongestStrings = a => a.filter(i => i.length === Math.max(...(a.map(a => a.length))))
```

This is not overly efficient, but it works. Then I got to remembering about default values and altered it to this:

```javascript
const allLongestStrings = (a, i = Math.max(...(a.map(a => a.length)))) => a.filter(e => e.length === i)
```

Longer, but we only check for the longest string the once, rather than over each iteration.

## Day 3

```javascript
const allLongestStrings = (a, i = Math.max(...(a.map(a => a.length)))) => a.filter(e => e.length === i)
```

## Day 4

```javascript
const arrayReplace = (arr, o, n) => arr.map(e => e === o ? n : e)
```

## Day 5

```javascript
const caseInsensitivePalindrome = (s) => s.toLowerCase().replace(/[\W\_]/g, '') === s.toLowerCase().replace(/[\W\_]/g, '').split('').reverse().join('')
```

I like this way because it deals with `"A man, a plan, a canal, Panama!"`. But I really like this one (not mine):

```javascript
const caseInsensitivePalindrome = s => [...s = s.toLowerCase()].reverse().join`` === s;
```
Which web hosting is best for WordPress
Tags: wordpress, webhosting, paas, vps
Published: 2020-06-30 06:08:47

Considering the present scenario, you will find a number of options such as Shared hosting, VPS hosting and so on in the modern market, which offer you various solutions to host your WordPress site.

But what you are unaware of, are the few potential issues which are inevitable with traditional methods like Shared hosting and VPS hosting. The primary focus in Shared hosting is often on cutting costs rather than superior performance, as a result of which, you might experience resource limitation as everybody else in the server uses the same CPU, memory and bandwidth.

Meanwhile, VPS hosting on the other hand offers better performance compared to Shared hosting, but it too lacks in a few significant areas. You are still going to have only a fixed and limited amount of resources which can’t be scaled up or down without downtime.

Secondly, if the main server fails, your site, along with all the other sites on the server are going to fail.

I was suggested a PaaS solution called CloudJiffy, which basically is a container based service that groups multiple containers into environments, providing unique features that make hosting services a lot easier. It helped me overcome the majority of problems I faced using Shared and VPS hosting. They also provide you with the option of deploying applications including WordPress effortlessly at the click of a button.

Here, I was able to take advantage of the auto scalability, where my resources are automatically scaled up or down, depending on the traffic. Also, the option of automated Clustering is available, where our site is hosted on a platform of multiple servers, therefore my site is always going to be up and running even if anyone of the server fails.

Also, they offer a very unique and user-friendly Pay-As-You-Consume pricing scheme, where I only pay based on your actual resource consumption. To know more- https://cloudjiffy.com/
Add syntax highlighting to 'cat' in your terminal
Tags: syntax, highlight, cat, terminal
Published: 2020-06-30 09:44:41

I use my terminal everyday, and frequently I am way faster with it then navigating around with my mouse in Finder.

Within your terminal the `cat` command is very useful to quickly peek inside a file, but when you're looking at source code, this is a bit difficult to read. I just thought "_Wouldn't there be syntax highlighting for my terminal?_". As it turns out, there is. 🎉

## How to set it up

* With [Brew](https://brew.sh/), install Pygments: `brew install pygments`
* Next, add the following to your .zshrc/.bashrc file: `alias cat="pygmentize -g"`
* Open a new terminal window, or source your .zshrc file: `source ~/.zshrc`

Now, when you e.g. run `cat Dockerfile` on a Dockerfile, things look very neat!