teleren/devto huggingface dataset:
Add Destroy Script 🔥💻 To package.json
Tags: beginners, productivity, webdev, npm
Published: 2020-02-25 09:55:34

---
title: Add Destroy Script 🔥💻 To package.json
published: true
description: Add a destroy script to your package.json, so you can easily clean down your development environment using a single command.
tags: beginners, productivity, webdev, npm
---

On rare occasions I find myself having to clean my development environment (i.e. delete the following folders - node_modules, build, coverage, etc). As this could include multiple folders, I decided the best approach was to create a script. I also hate typing the same commands over and over again, save those fingers!🖐️

I wanted a cross platform approach (works on both Linux and Windows), `rimraf` is the ideal candidate as it's an <a href="https://www.npmjs.com/package/rimraf" title="rimraf - npm">npm package</a> that deletes folders recursively and works cross platform.

Why make the solution cross platform? So all developers that collaborate on the code base can benefit.

Now we could install rimraf globally, but we can't guarantee that another developer has this installed, which will result in the script failing when executed.

A cleaner approach is to have the dependency installed as a dev dependency. However, this will cause issues as `rimraf` will try to delete the node_modules folder where `rimraf` is currently executing from. Hence it would try and delete itself and fail.

So to resolve this issue, we can execute `rimraf` when we need to run it (one-off invocation without local installation) via the `npx` command. The `npx` command was introduced with npm 5.2.0 and later.

#The Destroy Script 🔥

Below is an example of the destroy script, this will delete the node_modules, build and coverage folders and all their contents.

```json
{
  "scripts": {
    "destroy": "npx rimraf node_modules build coverage",
  }
}
```

#Execute Destroy Script 

The destroy script can be executed either by using npm or yarn.

```bash
npm run destroy
```

Or

```bash
yarn destroy
```
Asynchronous HTTP requests in Python
Tags: python, beginners, datascience
Published: 2020-02-25 09:49:22



In python, you can make HTTP request to API using the requests module
or native urllib3 module.

However, requests and urllib3 are synchronous. It means that only one HTTP call can be made at a time in a single thread. Sometimes you have to make multiples HTTP call and synchronous code will perform baldy. To avoid this, you can use multi-threading or since python 3.4 asyncio module.

## Test case

In order to show the difference of time between sync and async code, i made a script that read a file with 500 cities names and perform HTTP call to an API to retrieve information about location, population and so on from the city name.

### Sync code performance
Here is the sync code version with the requests module

```python
@timeit
def fetch_all(cities):
    responses = []
    with requests.session() as session:
        for city in cities:
            resp = session.get(f"https://geo.api.gouv.fr/communes?nom={city}&fields=nom,region&format=json&geometry=centr")
            responses.append(resp.json())
    return responses
```
`Finished 'fetch_all' in 38.7053 secs`


### Async code performance

I used aiohttp module to make the async code as the requests module doesn't support asyncio for now.

```python
async def fetch(session, url):
    """Execute an http call async
    Args:
        session: contexte for making the http call
        url: URL to call
    Return:
        responses: A dict like object containing http response
    """
    async with session.get(url) as response:
        resp = await response.json()
        return resp

async def fetch_all(cities):
    """ Gather many HTTP call made async
    Args:
        cities: a list of string 
    Return:
        responses: A list of dict like object containing http response
    """
    async with aiohttp.ClientSession() as session:
        tasks = []
        for city in cities:
            tasks.append(
                fetch(
                    session,
                    f"https://geo.api.gouv.fr/communes?nom={city}&fields=nom,region&format=json&geometry=centr",
                )
            )
        responses = await asyncio.gather(*tasks, return_exceptions=True)
        return responses
@timeit
def run(cities):
    responses = asyncio.run(fetch_all(cities))
    return responses

```
`Finished 'run' in 3.0706 secs`
## Conclusion
As you can see, the async version is a lot faster than the sync version so if you run into a situation where your code is performing multiple I/O calls then you should consider concurrency to improve performance. However asynchronous version requires more work as you can see.

If you want to see the threading version that works with the requests module and also see how to implement automatic retry and caching on your API call check out [this tutorial](https://medium.com/me/stats/post/70a555fecc97).
Software course Training Institute in Bangalore
Published: 2020-02-25 09:40:44

Nearlearn is the best top-rated leading Software Course Training Company in Bangalore offers Courses in Machine Learning, Blockchain Training, Python Training, React Native Training, React JS Training, Data Science Training, Artificial intelligence and Deep Learning. We provide the best Software Learning Experience with real time designs for better technical ideas and give our students support in placement. With 10 + years of industry experience, our Trainer is well-experienced in relevant skills. Nearlearn Provides Corporate Classroom & Online training for all Practical Sessions Trend Courses. We trained our students on live projects, where they gained their knowledge easily.
Courses We Offer:-
•	Machine learning With python
•	Data Science using Python
•	Blockchain Training
•	React JS Training
•	Python Training
•	React Native Training
•	Artificial intelligence
•	Deep Learning  
•	Business Intelligence & Visualization
Our aim is to provide the best training programs through which their aspirations will come true and be able to achieve their target and have also been placed in reputable companies with a high salary package. Our teacher is committed to bringing their trainees to a high level. If you are qualified here then it will be easier to get a job in preferred companies and stand up in the market.
Our Support Provided While under training:
•	Enquires regarding the course.
•	Expert trainers conduct training session
•	Classroom Training and Online Training
•	Provide Study Material for related course
•	Online Test were Conducted
•	Give Regular assignment and conduct quiz to brushup their Knowledge.
•	 Student Support and guidance were provided after Completion of Course.
If you're looking for the best Software Course Training Company in Bangalore then Nearlearn is the best Bangalore Institute. The company provides high-quality training programs and our certification is recognised internationally. We have held 15 + seminars and give 500 + courses. Most governing bodies around the world have approved us. Our goal is to help freshers, corporate, software engineers, individuals to gain knowledge through their hand to handle projects and real-time training. We provide online test access to Life Time LMS (Learning Management System), Assessments after course completion. 
With the industry's best trained qualified corporate trainers, we are one of the top corporate training providers with a fast growth rate in the market.
Our Clients are:
•	DELL
•	SAMSUNG
•	DXMINDS
•	HONEYWELL
•	BHARATI VIDHYAPEETH
•	SERVICEMAX
•	NAVRITI
•	UPES
•	NEW HORIZON COLLEGE OF ENGINEERING
Our training courses are well designed by Strong Experience experts and industry background to impact better knowledge for the candidates by attending the training.Nearlearn always guide students with 24 × 7 Support.
Nearlearn
BTM 2nd Stage, Bangalore
560076
Ph no.- +918763824286      
E-mail:- info@nearlearn.com
Website : https://nearlearn.com/
How to architect epic Angular app in less than 10 minutes! ⏱️
Tags: webdev, typescript, angular
Published: 2020-02-25 10:23:14

---
title: How to architect epic Angular app in less than 10 minutes! ⏱️
published: true
date: 2020-02-25 09:33:00 UTC
tags: web-development,typescript,angular,angularjs
canonical_url: https://medium.com/@tomastrajan/how-to-build-epic-angular-app-with-clean-architecture-91640ed1656
---

![](https://cdn-images-1.medium.com/max/1024/1*f_VE9z0t6m6mnk7TtPqx-w.jpeg)<figcaption>Original photo by <a href="https://unsplash.com/@grantlemons?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Grant Lemons</a></figcaption>

In this article we are going to learn how to scaffold new Angular application with clean, maintainable and extendable architecture in almost no time and what are the benefits of doing so. Besides many actionable tips, we’ll also discus guidelines about where we should implement most common things like reusable services, feature specific components and others…

> For the last year and a half I have been consulting for a huge Swiss insurance enterprise organisation with more than 90 Angular apps. Yes, ninety, crazy, but also cool!

> Besides that I was also pretty busy with preparation of many [Angular workshop](https://tomastrajan.com/workshops/angular-state-management-workshop-with-ngrx) exercises which involved scaffolding of many projects from scratch.

💎 **This article brings together all the lessons learned in a distilled cleaned up form for you to cut down your learning curve and help you make your Angular SPAs epic!**

[Read more...](https://medium.com/@tomastrajan/how-to-build-epic-angular-app-with-clean-architecture-91640ed1656)

EDIT: fixed link 🤦😂
Free, open-source Stripe-to-ERC-20 process: Leverage events from smart contracts
Tags: blockchain, opensource, testing, startup
Published: 2020-02-25 09:11:29


The MESG Foundation launched its testnet last month, along with the testnet [Explorer](http://explorer.testnet.mesg.com/?utm_source=devto&utm_campaign=stripe_erc20) for the visualization of data on the testnet. 

## What's it good for?
All services and processes on the testnet and Explorer are reusable by anyone, in any application, and are easily deployable with a single line of code. 

Plus, when services or processes are used by others, token payments are sent back to the service's developer. Check out all of the actors in the MESG Economy in this article: [Token Utility in the MESG Economy](https://blog.mesg.com/token-utility-in-the-mesg-economy/?utm_source=devto&utm_campaign=stripe_erc20).

## Stripe to ERC-20 Process
Just today, a [reusable webhook-to-ERC-20 process](https://explorer.testnet.mesg.com/processes?utm_source=devto&utm_campaign=stripe_erc20) was just posted on the Explorer that allows anyone to connect to any ERC-20 smart contract to a webhook, with two-way interaction. It has been connected to Stripe as a dem. Feel free to play with it here: http://stripe-erc20.demo.mesg.com/


![Screen Shot 2020-02-25 at 3.19.20 PM.png](https://cdn.steemitimages.com/DQmWaPoE1qcQaVEVSG6fmFSMcR63WqL335VG8qixCxjsHp1/Screen%20Shot%202020-02-25%20at%203.19.20%20PM.png)


## Reuse it, fork it, do whatever you want!
**Developers!** Feel free to reuse this process with any ERC-20 smart contract, fork the application, or even reuse the individual Stripe, webhook or ERC-20 services in combination with any other service on the testnet to build whatever you'd like. [Get started here](https://docs.mesg.com/?utm_source=devto&utm_campaign=stripe_erc20)
Thoughts on Java, Part 1
Tags: java
Published: 2020-02-25 09:01:55

Tracking my thoughts and understanding of Java as my understanding grows.

**Impressions**

Words that are jumping out include 'structured' and 'arbitrary'. I've already written about my first impressions of type-safety, but this moves into new territory, like the different classes of strings.

**Progress**

It's harder to predict how long tasks will take; Some things are very similar in implementation to Ruby, but with strings it's Apples and Oranges. Some strings are mutable, some are immutable, and trivial tasks like pushing strings to arrays has made me aware of the StringBuffer class, which does not return a string equal to that of the String class.

**Closing**

Working with Java has meant dealing with things I didn't know existed, so assuming that the OO similarities make up for being static, typed, and compiled was wishful thinking. I'm starting from the beginning again, only the beginning is harder here. It's a lesson in humility.
I'm learning a lot though, and I think that once the basics are down, things will seem clear, and I'll be a better programmer for having learned to do it this way.
Making a simple author byline for your website
Tags: tutorial, beginners, webdev, css
Published: 2020-02-25 09:17:21

---
title: Making a simple author byline for your website
published: true
date: 2020-02-25 02:00:00 MST
tags: tutorial, beginners, webdev, css
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/kctv2imxw0iuf8y232mw.jpeg
canonical_url: https://developerbacon.ca/articles/how-to-make-a-simple-author-byline-for-your-website/
---

## [Why would you want an author byline on your website](#why-would-you-want-an-author-byline-on-your-website)

The main reason you would want to add an author byline to your site is to give credit where credit is due, and by this, I mean giving information about the author of the post or article.

The HTML for this author byline example contains a `rel="author"` attribute to help with the SEO of the page.

## [HTML](#html)

```html
<div class="author">
	<img
		class="author__item author__pic"
		src="https://en.gravatar.com/userimage/137371786/7395c6c605915c6315f96d8cd8f6ada9.jpg?size=200"
		alt="my face"
	/>
	<div class="author__item author__name">
		<span><b class="author__heading">Author:</b></span
		><br />
		<span
			><a class="author__link" rel="author" href="//brettanda.ca" target="_blank"
				>Brett Anda</a
			></span
		>
	</div>
	<div class="author__item author__date">
		<span><b class="author__heading">Date Posted:</b></span
		><br />
		<span>Today</span>
	</div>
</div>
```

## [SCSS](#scss)

```scss
.author {
	display: flex;
	flex-flow: row wrap;
	justify-content: center;
	align-items: center;

	@media all and (max-width: 600px) {
		flex-flow: column nowrap;
		text-align: center;
	}
}

.author__item {
	flex: 0 1 8rem;
	margin: 1rem;

	@media all and (max-width: 600px) {
		flex: 1 1 3rem;
		margin: 0.5rem;
	}
}

.author__pic {
	flex-shrink: 0;
	flex-basis: 8rem;
	object-fit: cover;
	object-position: center;
	width: 8rem;
	height: 8rem;
	border-radius: 50%;
	padding: 0.3rem;
	border: 2px solid rgba(0, 0, 0, 0.5);
}

.author__heading {
	font-size: 90%;
	display: inline-block;
	margin-bottom: 0.5rem;
}

.author__link {
	text-decoration: none;
	color: blue;

	&:hover,
	&:focus {
		text-decoration: underline;
	}
}
```

**There is no javascript needed for this example**

## [Codepen example](#codepen-example)

If you want to see this in example in action here is a Codepen I made for it.

<iframe height="265" style="width: 100%;" scrolling="no" title="Author byline example" src="https://codepen.io/brettanda/embed/RwPKjEo?height=265&theme-id=dark&default-tab=result" frameborder="no" allowtransparency="true" allowfullscreen="true">
  See the Pen <a href='https://codepen.io/brettanda/pen/RwPKjEo'>Author byline example</a> by Brett
  (<a href='https://codepen.io/brettanda'>@brettanda</a>) on <a href='https://codepen.io'>CodePen</a>.
</iframe>
Understanding Bias-Variance Trade-Off (Part 2)
Tags: machinelearning
Published: 2020-02-25 08:46:04

This is the continuation of [Understanding Bias-Variance Trade-Off (Part 1)](https://dev.to/kelvinjose/understanding-bias-variance-trade-off-part-1-3gk)

The trade-off between bias and variance can be depicted as, model with low bias will be flexible enough to fit the data well. But if it becomes too flexible it will memorize and overfit the data instead of generalizing it and it won’t perform well on a different but similar dataset i.e. error due to high variance. n the figure below, we see a plot of the model’s performance using prediction capability on the vertical axis as a function of model complexity on the horizontal axis. Here, we depict the case where we use a number of different orders of polynomial functions to approximate the target function. Shown in the figure are the calculated square bias, variance, and error on the test set for each of the estimator functions.

We see that as the model complexity increases, the variance slowly increases and the squared bias decreases. This points to the tradeoff between bias and variance due to model complexity, i.e. models that are too complex tend to have high variance and low bias, while models that are too simple will tend to have high bias and low variance. The best model will have both low bias and low variance.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/lmrl3jjzzx964hfdgke1.jpeg)

Managing the bias-variance tradeoff is one great example of how experienced data scientists serve an integral part of an analytics-driven business.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/pzxqo0abg2li77omds7b.png)
Understanding Bias-Variance Trade-Off (Part 1)
Tags: machinelearning
Published: 2020-02-25 08:36:35

The bias-variance trade-off is one of the most important aspect of machine learning projects. To approximate reality, different algorithms use mathematical and statistical techniques to optimize and best estimate model parameters. In between this optimization task, algorithms often encounter a dramatic term called error.

Errors can be divided into two as reducible and non-reducible errors. Among these two, reducible error is further divided into bias error and variance error. Irreducible error or uncertainty is associated with a natural variability in a system. Data Scientists try to reduce bias and variance errors in order to formulate an optimized and accurate model which might be taken into real world, we don’t know. However there is a trade-off between bias and variance in selecting the best model.

The term bias error shows how much a model’s predictions (y-hat) differ from the actual or expected outcome (y), over the training data. Or the model tries to over simplify the assumptions about the data which in turn underfits the training data. I would say this is purely related to the model selection procedure. Data scientists can re-sample the data and build another model and average the cost value to see the former issue still exists or not. If this average shows a significant difference from y, we should doubt there is high bias error.

The error due to variance is the amount by which the prediction, over one training set, differs from the expected predicted value, over all the training sets. When models become too complex, they will be sensitive to even the high degree variations of the training data. But overfitting the data instead of best fit, the same model may act weird with another similar dataset. As with bias, you can repeat the entire model building process multiple times.

*find Part-2 of this post* [here](https://dev.to/kelvinjose/understanding-bias-variance-trade-off-part-2-2g2o)
Career Pixel - Be a better programmer
Published: 2020-02-25 08:25:47

## 1 - Be nice

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

Be nice to your co-workers, clients, you name it. Listen closely and help them whenever you can.

## 2 - Be empathetic

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

To me, empathy is the most important skill a programmer should have. Make a conscious effort to understand your co-workers' point of view, your users' point of view. Try your best to understand where they are coming from.

## 3 - Be organized

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

Keep track of your tasks. find your rhythm and habits, and be consistent. Document EVERYTHING.

## 4 - Be a mentor

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

Here’s one thing I believe in: you never truly know something until you can successfully teach it. Mentor or help others with their projects or even a simple task. Not only it’s a nice thing to do, but it will also improve your skills in the process.

---

You can also find these pixels on my Instagram: https://instagram.com/valentinprgnd. I will publish Pixels every Monday, Wednesday, and Friday about career development in tech, code, mental health and health for developers. Follow me for more tips @valentinprngd and check out my podcast https://rebased.whatdafox.com.
Play With DOM (querySelector) – JavaScript Series – Part 26
Tags: javascript, beginners, codenewbie, tutorial
Published: 2020-02-25 08:19:58

In last tutorial we worked with the dom for change the styles, now we are going to work with the dom for changing some html.

To change html before we use write. Now we are going to use innerHTML which is going to change the whole text with tag

Example –

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/nbh48uq17wjaqvvos0w8.png)


Up until now we’ve just used querySelector. If we use this on li then it will just give us first list of the item, so we need to call All of it by querySelectorAll

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/rne3nukxdsf1kywgm34z.png)

Can you remember the array? Using index now we can select a element from li and can change it.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/hnufthomkxv7pz4el90x.png)

Now we can get the parent from a li item by just using parentElement

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/w1070hhg94ayatvdm8y8.png)

Like in this way we can use children too

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/81oddnqtmp055xj5irbq.png)

Finally we can use variable to store the selector, so that it will be easy to write something

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ib1epqj8ivh6urx0t42g.png)

Can you play with the dom now? If not follow & DM me part you didn’t understand about it!

Other posts of this series can be found here – https://blog.nerdjfpb.com/tag/javascript/

You can see the graphical version here
{% instagram B80cPdqAqeG %}

Source Codes - { Check commits }
{% github nerdjfpb/javaScript-Series %}

Originally it published on [nerdjfpbblog](https://blog.nerdjfpb.com/javascript-part-26/). You can connect with me in [twitter](https://twitter.com/nerdjfpb) or [linkedin](https://www.linkedin.com/in/nerdjfpb/)!
Is there a compatibility issue with Postgres and python UUID ?
Tags: django, aws, python, postgres
Published: 2020-02-25 07:48:46

Am regularly receiving a 500 error in my Django backend on AWS, and the message is "UUID is not a valid UUID", and it's raised by a Validation error. 

The weird about this is, i just have to restart the server and everything continue to work without problem. But sometime it crash, and i am not able to know what cause this.

This issue is the same explained here: https://code.djangoproject.com/ticket/29293

Am only having this in production. 

Hope someone has face and resolve the similar issue in the past.

Thanks