teleren/devto huggingface dataset:
Solution: Polygons and MultiPolygons should follow the right-hand rule
Tags: polygon, righthandrule, openstreetmaps, vasubabu
Published: 2020-06-25 12:41:37

I use OpenStreetMaps/Datahub.io to get the polygon data for an area.
For Country polygons, I prefer Datahub.io and others I prefer Open street maps.

Links:
https://nominatim.openstreetmap.org/search.php?q=liege&polygon_geojson=1&format=json
Note: Please change q=liege to your desired place and nominatim is the UI built on top of OSM.
[Datahub.io](https://datahub.io/core/geo-countries#resource-countries)

sometimes you may see the below error while validating a Geo-JSON data downloaded using https://geojsonlint.com

```
Line 1: Polygons and MultiPolygons should follow the right-hand rule
```
 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/xbjkh8qlqhqicc9dfiy9.png)

This is because the Geo-JSON data is not following the Right-Hand rule. 

#### What is a Right-Hand rule?
When you construct a polygon, you can order the coordinates in one direction or another. If you’re drawing a circle, you might start on the left and go counter-clockwise around to meet the original point. Or, you might go clockwise.

#### Here is the specification:

A linear ring MUST follow the right-hand rule with respect to the area it bounds, i.e., exterior rings are counterclockwise, and holes are clockwise.

Source: [mapster](http://mapster.me/right-hand-rule-geojson-fixer/)

Fix: Its very hard to convert the Geo-Json data according to Right hand rule, one way is use this tool to do that

http://mapster.me/right-hand-rule-geojson-fixer/

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

Geo-JSON Lint:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5ucw9l578ch2leyhpmic.png)
JavaScript Array Reduce Doesn't Like Objects
Tags: javascript, webdev, tips, frontend
Published: 2020-06-25 12:38:03

---
title: JavaScript Array Reduce Doesn't Like Objects
published: true
description: Recently, I was attempting to sum the values of an array that contained objects. This short article is a reminder to myself to never assume functionality and to regularly check the documentation.
tags: JavaScript, WebDev, Tips, FrontEnd
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/r5fumdmmfw6sgxq7saqy.png
---

Recently, I was attempting to sum the values of an array that contained objects, like so ...

```javascript
const pie = [
  { data: 10, color: "#ECD078" },
  { data: 20, color: "#D95B43" },
  { data: 10, color: "#C02942" },
  { data: 10, color: "#542437" },
  { data: 10, color: "#53777A" }
];
```

I simply wanted the sum of the `data` keys. I tried ...

```javascript
const pieTotal = pie.reduce((a, b) => a.data + b.data, 0);
```

... and kept getting `NaN` as a result. When I got some add consoles.log values I decided to dig into reduce and quickly found [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce), which showed the `(a, b)` were not actually two values as I had assumed, but `(accumulator, currentValue)`.

That's what I get for assuming from a Stack Overflow example.

Here's the working reduce code ...

```javascript
const pieTotal =  pie.reduce((a, b) => a + b.data, 0);
```

Just a reminder to myself to never assume functionality and to regularly check the documentation.
Learning DevOps is Fun - I
Tags: devopsbasics, devops
Published: 2020-06-25 12:36:51

These days every one talk about DevOps and there is a lot of craziness going on and around this piece of technology.
WHAT IS DevOps?
Well, DevOps is everything but a technology, folks thought of DevOps as a part of technical stack, but it is nothing but a set of practices, philosophy and tools that increase the ability of any organization to deliver the products/applications or services in a high velocity and very efficiently.
DevOps is a by-product of people, process and products (tools which helps us) to enable continuous delivery to the end customer.
According to Sam Guckenheimer –
“The contraction of “Dev” and “Ops” refers to replacing siloed Development and Operations to create multidisciplinary teams that now work together with shared and efficient practices and tools.”

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

So, if I say in short DevOps is a blend of practices, processes and the tools that help us to enable efficiency, pace (high) and a valuable delivery to the end customers. This speed enables organizations to better serve their customers and compete more effectively in the market.
History of DevOps
If you want to understand DevOps, you should be aware that where did this DevOps come into the picture? Is it something really new or was already there?
DevOps is based on the concept and values of Agile Software Development, it is basically born out of the need to keep up the velocity of software increased and throughput agile methods have achieved. So, the advancement of Agile Philosophy or Culture, as well as Methods over the last few years, basically exposed the requirement for a more holistic approach to developing/deliver end-to-end software lifecycle.
DevOps is nothing but an IT mindset, incorporated with AGILE values which basically encourage communication, collaboration, integration and automation among the developer communities and IT operations in order to improve the velocity and the quality of delivering software.
There are still so many things left to explain, so you will be seeing a series of articles here, which will explain everything you need to know about #devops.
Some highlights which will be covered in this series will be – 
•	Challenges – that DevOps solves
•	DevOps Goals
•	DevOps Value
•	DevOps Tools
•	Phases of DevOps maturity
•	How to achieve DevOps
•	Last but not the least – What’s in it for you?
Please post your comments/suggestions so that this series can be more efficient and improved.

Happy Learning 😊
Design Collaboration Tools for Designers!
Tags: showdev, webdev, design
Published: 2020-06-25 12:14:26

We want to provide you with everything you need to create your design projects easily. Here is a curated a list of some of the best design collaboration tools from every category. Read on to find your next favorite design collaboration tool!

##Our Recommended [Design Collaboration Tools](https://blog.bit.ai/design-collaboration-tools/) that Rock!
Let’s look at each one of them in detail and decide which one is the best fit for you:

###1. Mural
The first design collaboration tool on the list is Mural, a real-time digital whiteboard for teams! Mural is a great platform for design teams with geographical barriers between them.

Mural wants you to stop digitizing your content, rather start your work on its digital platform. Users can create digital sticky notes, tasks, to-do lists, design mockups, sketches, and more and share it with team members all around the globe.
###3. Filestage
Filestage is a content review and approval platform trusted by design teams around the world. Those teams use Filestage to get the feedback that they need when they need it.

The tool makes it simple for project managers and designers to upload and share their designs with just a few clicks. Those stakeholders can then start to leave their valuable in-conte
###3. Picktochart
Picktochart is a cloud-based application that allows anyone to easily create infographics, presentations or posters. The best thing about Picktochart is it’s easy to use and intuitive interface that takes less than 5 minutes to master.

You can build professional looking visual designs with Picktochart without hiring a professional designer to do so. It works by selecting Picktochart’s wide range of beautifully designed templates and adding visual elements like charts, maps, videos, pictures, icons, etc to it.
###4. Mockplus iDoc
Mockplus iDoc is an all-in-one design collaboration & handoff tool for designers to collaborate and hand off a design to other designers, developers, and product managers effortlessly. It helps connect the entire product design workflow. 

It facilitates handoff by taking designs from PS, Sketch, Adobe XD, and exporting into a format that can generate code snippets, specs, and assets. This can be done pretty much automatically.
Road to Genius: advanced #29
Tags: javascript, beginners, computerscience
Published: 2020-06-25 12:08:31

Each day I solve several coding challenges and puzzles from Codr's ranked mode. The goal is to reach genius rank, along the way I explain how I solve them. You do not need any programming background to get started, and you will learn a ton of new and interesting things as you go.

Here's our second challenge on the advanced level:
```JS
function mode(x) {
  let counts = {};
  let mode = [];
  let max = 0;
  let n = x.length;
  let i = -1;
  let d, k;
  while (++i < n) {
    d = x[i]
    if (d in counts)
      k = ++counts[d];
    else
      k = counts[d] = 1;
    if (k === max)
      mode.push(d);
    else if (k > max) {
      max = k;
      mode = [d];
    }
  }
  return mode;
}
let inp = [2,4,8,8,2,2]
let out = mode(inp)
let A = out.length

// A = ? (number)
```

We need to determine the value of `A`, which is the size of the array `out`, which is the output of the function `mode`.

If you briefly analyze this function, you are unlikely to recognize it, unless you explicitly wrote something very similar in the past. The name of the function `mode` is a well-known operation in statistics for determining the most occurring numbers in a set. In other words, the mode of a set of numbers is the number with the highest frequency.

What this function basically does is keep track of the most occurring numbers, these are stored in the internal array `mode`, do not confuse it with the function `mode`.

The while-loop iterates over each number in the input array `x`, each element is assigned to variable `d`. The first if-else statement keeps track of all the numbers as a key-value object; whereby variable `k` is the number of occurrences of the number `d`.

The second if-else checks if `k` is greater than the current highest occurring number (i.e. its frequency). It uses the variable `max` to keep track of the highest frequency. If `k == max` then `d` is added to the `mode` array. Because it's among the highest occurring numbers up to that point.
Else if `k > max`; meaning the number `d` has a higher frequency than all the numbers in `mode`, then it overrides `max` with `k`, and `mode` becomes a new array with `d` as the first number.

Let's put this all in pseudo-code:
```
x = [2, 4, 8, 8, 2, 2]
mode = []
max = 0

-> d = 2
   k = 1
   max = 1
   mode = [2]

-> d = 4
   k = 1
   max = 1
   mode = [2, 4]

-> d = 8
   k = 1
   max = 1
   mode = [2, 4, 8]

-> d = 8
   k = 2
   max = 2
   mode = [8]

-> d = 2
   k = 2
   max = 2
   mode = [8, 2]

-> d = 2
   k = 3
   max = 3
   mode = [2]
return mode;


--> out = mode(x) = [2]
    A = out.length = 1
```

![coding challenge answer](https://dev-to-uploads.s3.amazonaws.com/i/p4m7bnd09c7wktilxpy3.png)

By solving these challenges you train yourself to be a better programmer. You'll learn newer and better ways of analyzing, debugging and improving code. As a result you'll be more productive and valuable in business. Join me on the Road to Genius and upgrade your programming skills, at https://nevolin.be/codr/
Daily Developer Jokes - Thursday, Jun 25, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-06-25 12:00:11

---
title: "Daily Developer Jokes - Thursday, Jun 25, 2020"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Thursday%2C%20Jun%2025%2C%202020"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e125970d9ec2.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ What is a pirate's favorite programming language?

___A:___ You'd think it was R, but a pirate's first love is Objectively C.
 -->
Data Standardization with Web Data Integration
Tags: datascience, bigdata, webscrapingservices, dataintegration
Published: 2020-06-25 11:48:19

Integrating web data manually or using traditional web scraping methods involves higher risks and costs because of challenges like incomplete, inaccurate, unreliable and out of date data. Web Data Integration provides high quality, extensive data which is ready for analysis. Therefore, organizations can get data from anywhere and analyze it instantly by using Web Data Integration. This way organizations don’t need to spend time and resources in standardizing, cleaning the data and are also ensured that the data is reliable.

To get an edge over competitors in this dynamic market, businesses are making more and more data-driven decisions. Web Data Integration provides huge opportunity for businesses to take this advantage of the available data. For example, online travel booking services, e-commerce, banking services, have been trying to provide all the services a customer may need and hence the competition has become fiercer in every industry
The most common use of web data for e-commerce includes monitoring the price of similar products, competitive research on the latest trends, leveraging social media to gain insights about customers feedback and expectations. Web Data gives your business such valuable insights which enable you to enhance your brand and improve customer loyalty by meeting customer needs.
Such valuable web data which can be provided without any delay whenever required can give your business the required edge over your competitors.

Our Web Data Integration solution includes extracting, cleaning, integrating and consuming data through the data standardization process. This can provide your business the required reliable data in the required format within minutes and hence save the ordeal of spending time and valuable resources on getting the accurate data. PromptCloud understands that providing accurate data in the standardized format is crucial as the business decisions are based on this data. Data is important and we believe in providing the highest level of quality data to people.
Fix and Recover a "corrupt history file" in ZSH 
Tags: zsh, fix, shell
Published: 2020-06-25 11:41:25

---
title: Fix and Recover a "corrupt history file" in ZSH 
published: true
description: How to fix and recover a "corrupt history file" in the ZSH shell.
tags: zsh, fix, shell
cover_image: https://ohmyz.sh/img/themes/nebirhos.jpg
---

Move to the home directory
`$ cd ~`

Move the `.zsh_history` file into another `.zsh_history_bad` file

`$ mv .zsh_history .zsh_history_bad`

Write all printable strings into a new `.zsh_history` file

`$ strings .zsh_history_bad > .zsh_history`

Finally, reload the history.

`$ fc -R .zsh_history`

Happy ZSH-ing!
How CI/CD works ?
Tags: git, devops, gitlab, opensource
Published: 2020-06-25 11:13:16

Have you ever come across a method that introduces automation mechanisms within varied stages of app development thereby, easing the process of delivering an application to customers? If not, its time to research the nuances of a CI/CD Pipeline. Continuous Integration and Continuous  Deployment are the primary concepts attributed by this pipeline. The primary objective of CI/CD is to simplify the process of integrating code changes by following the set of operating principles during the experimentation phase thereby, enabling the app development teams to deliver reliable code modifications. As mentioned earlier, it further assists in building an application and running diverse tests in an automated manner. Besides this, the operational efficiency of CI/CD is further bifurcated into two mechanisms. Continuous Integration fosters a technical goal that aims towards establishing a consistent and automated platform to build and test applications. Meanwhile, Continuous deployment process strives hard to optimize application delivery within the corresponding environments. Besides this, CI/CD pipeline also promotes CI/CD tools which contributes towards storing environment-specific parameters. The CI/CD tools primarily helps the developers to initiate builds on-demand as in, executing the enhancements that are triggered in the control repository instantaneously. In addition to the above-mentioned pointers, the most significant CI/CD tools are enlisted as follows, Jenkins, Azure DevOps, CircleCI, Travis CI, AWS CodeBuild. It is also evident that these tools are unanimously used to automated the code integration process. Furthermore, the CI/CD tools also allow setting environment variables and masking variables such as passwords and account keys thereby, resulting in configuring them during deployment for the corresponding environment. Moreover DevOps, a vital part of software development, also contributes consistently towards the competencies of a CI/CD Pipeline. The most eminent DevOps activities include, Continuous Integration, Continuous Delivery, Test Automation, Cloud  Infrastructure and Configuration management. CI/CD is considered as the backbone for an efficient DevOps. It is also statistically proven that, organizations which apply DevOps, document an 18% reduction in the time consumed towards marketing new applications and 21% increase in competently delivering new software unto the suitable customer base.
DevOps Is Crucial To Your Business. Learn Why!
Tags: devops, webdev, azure, aws
Published: 2020-06-25 11:13:13

Jeff Sussna said DevOps core insight is that reducing the distance between: 
•	people, 
•	teams, and 
•	activities 
Combined with reducing the batch size of your work allows you to deliver more value more continuously with greater quality. It's a good definition of DevOps. 

It's a different combination mainly of cultural norms, of practices, often complimented by technology. 

Every year, Puppet Lab sponsors a state of DevOps survey, and over time this has taken input from thousands of professionals, 4, 600 in the last year alone. And what they learn is things like high-performing organizations do 200 times more frequent deployment. 

The lead time for change from the time you commit code until it gets to production is under an hour for high performers. It's between a week and a month for the media performers and between one and six months for low performers. That may be you, depending on what your culture is, and that's so frustrating when you want to be able to deliver value. 

What's also great is there's a 24 times faster recovery from failure. This is extremely important because we know the cost of downtime is high. 

What's also fascinating is DevOps organization spend 22% less time on unplanned work. This is break/fix work. This is emergency software deployments, patches, things like that. This can sometimes happen if work isn't done correctly the first time. 

So, high-performing orgas spend about half their time on new work, 20% on unplanned work. In contrast, the low performers spend about 38% of their time on new work and about 27% of their time on unplanned work. And then you have 50% less time remediating security issues. This one is also exciting because sometimes security is bolted onto so many project teams at the end. 

Instead, when you have this product culture, DevOps-oriented and customer experience-oriented team. Security is part of everyone's work, not something that's just latched on the end. 

You can achieve this through better partnership with security. Security capabilities in your automated testing, and even having better security libraries used by the team. It's something that's much more needed to achieve good result.
Sapper with "cache-first"
Tags: serviceworker, cachefirst, networkfirst, sapper
Published: 2020-06-25 11:08:55

The serviceworker of Sapper works with *network first, falling back to cache if the user is offline*. How to change the serviceworker to implement *cache-first* instead of *network-first*?

**service-worker.js:**

```javascript
import { timestamp, files, shell, routes } from '@sapper/service-worker';

const ASSETS = `cache${timestamp}`;

// `shell` is an array of all the files generated by the bundler,
// `files` is an array of everything in the `static` directory
const to_cache = shell.concat(files);
const cached = new Set(to_cache);


self.addEventListener('install', event => {
	event.waitUntil(
		caches
			.open(ASSETS)
			.then(cache => cache.addAll(to_cache))
			.then(() => {
				self.skipWaiting();
			})
			.then(console.log("install ASSETS", ASSETS)) 
	);
});

self.addEventListener('activate', event => {
	event.waitUntil(
		caches.keys().then(async keys => {
			// delete old caches
			for (const key of keys) {
				if (key !== ASSETS) await caches.delete(key);
				}
			self.clients.claim();
		})
	);
});

self.addEventListener('fetch', event => {
	
	if (event.request.method !== 'GET' || event.request.headers.has('range')) return;

	const url = new URL(event.request.url);

	// don't try to handle e.g. data: URIs
	if (!url.protocol.startsWith('http')) return;
   
	// ignore dev server requests
	if (url.hostname === self.location.hostname && url.port !== self.location.port) return;

	// always serve static files and bundler-generated assets from cache
	if (url.host === self.location.host && cached.has(url.pathname)) {
		event.respondWith(caches.match(event.request));
		return;
	}

	// for pages, you might want to serve a shell `service-worker-index.html` file,
	// which Sapper has generated for you. It's not right for every
	// app, but if it's right for yours then uncomment this section
	/*
	if (url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) {
		event.respondWith(caches.match('/service-worker-index.html'));
		return;
	}
	*/

	if (event.request.cache === 'only-if-cached') return;

	// for everything else, try the network first, falling back to
	// cache if the user is offline. (If the pages never change, you
	// might prefer a cache-first approach to a network-first one.)
	
	event.respondWith(
		caches
			.open(`offline${timestamp}`)
			.then(async cache => {
				try {
					const response = await fetch(event.request);
					cache.put(event.request, response.clone());
					return response;
				} catch(err) {
					const response = await cache.match(event.request);
					if (response) return response;

					throw err;
				}
			})
	);
});
```
I changed Github's default font and UI 😍😎, fonts glyphs enabled :)
Tags: github, discuss, webdev
Published: 2020-06-25 11:06:34

I changed the default font to Montserrat and code font to JetBrains Mono 😍😍😍😍😍😍

Here is how it looks, Love it 😍 event the font glyphs are enabled :)

![Snap](https://dev-to-uploads.s3.amazonaws.com/i/peklcelm95nos5e3kd0g.jpeg)

Here you can see the font-glyphs

![Glyph snap](https://dev-to-uploads.s3.amazonaws.com/i/zl55npbqmm0av1daipj6.jpeg)

![Snap 2](https://dev-to-uploads.s3.amazonaws.com/i/ekrsfg3irvmwufw3ln0e.png)


---

## You can do it too
**Just inject this CSS**
```css
#js-pjax-container > div.container-xl.px-3.px-md-4.px-lg-5 > div > div.flex-shrink-0.col-12.col-md-3.mb-4.mb-md-0 > div > div.clearfix.d-flex.d-md-block.flex-items-center.mb-4.mb-md-0 > div.position-relative.d-inline-block.col-2.col-md-12.mr-3.mr-md-0.flex-shrink-0 > a > img {
	max-width: 200px!important;
	border-radius: 0px!important;
}

* {
	font-family: "Montserrat" !important;
}

.blob-wrapper,
.blob-wrapper *,
code,
code *,
pre,
pre *,
.highlight ,
.highlight *{
	font-family: "JetBrains Mono"!important;
}
```