teleren/devto huggingface dataset:
Daily Challenge #238 - One is the Loneliest Number
Tags: challenge
Published: 2020-05-06 13:05:24

---
title: Daily Challenge #238 - One is the Loneliest Number
published: true
series: Daily Challenge
description: Given a non-negative integer, your function must determine the loneliest number in the string.
tags: challenge
---
The range of vision of a digit is equal to its own value. 1 can see one digit to the left and one digit to the right, 2 can see two digits, and so on.

Thus, the loneliness of a digit is the sum of the digits which it can see.

Given a non-negative integer, your function must determine the loneliest number in the string. 

####Example
```
number = 34315
digit	can see on the left     can see on the right	loneliness
3	      -	                    4, 3, 1	           4 + 3 + 1 = 8
4	      3	                    3, 1, 5	           3 + 3 + 1 + 5 = 12
3	      3, 4	                1, 5	               3 + 4 + 1 + 5 = 13
1	      3	                      5	               3 + 5 = 8
5	     3431	                 -	               3 + 4 + 3 + 1 = 11
``` 
1 is the loneliest number, since it has the least friends and the lowest score.

####Tests
lonelyNum(23456)
lonelyNum(42435)

Good luck!

***
_This [challenge](https://www.codewars.com/kata/5dfa33aacec189000f25e9a9) comes from albertogcmr on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
New personal site, who this?
Tags: showdev, discuss, webdev
Published: 2020-05-06 12:58:37

This one has been long overdue, but [my personal website](https://alexlakatos.com/) finally got a makeover. https://alexlakatos.com/

It used to look like this:

![old alexlakatos.com](https://dev-to-uploads.s3.amazonaws.com/i/4ix1nxc24ynfcz6ytj5r.png)

I've set it up with Jekyll, a stock Material theme and GitHub Pages about 4 years ago. It was clunky, Material was already dated when I made it, and it was slow to build. You could say I didn't really love it, but I needed something in a pinch and it did the trick.

I've been putting off doing something with it for a while now, and the biggest mental blocker has been that I didn't want to go stock theme again. It is supposed to be an expression of myself in digital form, and I'm not exactly stock.

As luck would have it, [Hui Jing](https://twitter.com/hj_chen) was bored and offered to help me out, so I grabbed this opportunity to get to a state where I love my personal website.

Here's how it looks now:

![new alexlakatos.com](https://dev-to-uploads.s3.amazonaws.com/i/rez90iag3phfe2td1nfa.png)

Hui Jing wrote more about the process and the "Artisanal CSS" magic she's worked on it in a blog post:

{% link https://dev.to/huijing/the-one-in-black-and-orange-1oe8 %}

I've migrated it from Jekyll & GitHub Pages to Hugo & Netlify. The main reason for looking for a change was the build time. I don't have that many pages (under 100), but the build time was in minutes. Moving to Hugo and Netlify has shaved that down considerably, to 20 seconds.

I've also added a little pun in it, in the sense that as a JavaScript person I haven't written any JavaScript for my own website, it's just HTML & CSS. 😅 

I love the way my personal site looks right now, and as Hui Jing put it, I love the fact that "this is not industrial mass-produced CSS. This is customised CSS that only works well for this particular site."

And because Hui Jing is still bored, stay tuned, it's getting a light mode on top of the dark mode. 😅 [Later edit: this already happened because Hui Jing and [Wei](https://twitter.com/wgao19) got bored faster than expected. 😊]

I'm curious about what other people are using for their websites, from the stack, and hosting all the way to the look and feel. Please leave a comment with your personal website and something you really like about it. I'm sure other people around here are looking for inspiration, it's not just me!
Creating a Choropleth Map Data Visualization Using JavaScript, on COVID-19 Statistics
Tags: javascript, html, beginners, tutorial
Published: 2020-05-06 12:56:24

---
title: Creating a Choropleth Map Data Visualization Using JavaScript, on COVID-19 Statistics
published: true
description: Need a choropleth map for your web page or app? This tutorial explains how to quickly create such a data visualization using JavaScript, a JS choropleth map displaying data from ECDC.
tags: javascript, html, beginners, tutorial
canonical_url: https://www.anychart.com/blog/2020/05/06/javascript-choropleth-map-tutorial/
cover_image: https://i.imgur.com/azWUoaB.png
---
This data visualization tutorial explains how to quickly produce a stylish interactive Choropleth Map for the web and mobile with the help of JavaScript, step by step. It also shows how to add a Bubble Series. Great for beginners.

All maps created along the tutorial visualize COVID-19 data from ECDC using AnyChart JS and Proj4js.

[Check out the JS choropleth map tutorial](https://www.anychart.com/blog/2020/05/06/javascript-choropleth-map-tutorial/).
38: Create, read, update and delete
Tags: javascript
Published: 2020-05-06 12:54:33

*In computer programming, create, read, update, and delete[1] (CRUD) are the four basic functions of persistent storage.*

Alternate words are sometimes used when defining the four basic functions of CRUD, such as retrieve instead of reading, modify instead of update, or destroy instead of delete. 

--- 
**CRUD is also sometimes used to describe user interface conventions that facilitate viewing, searching, and changing information; often using computer-based forms and reports.**

---
####The acronym CRUD refers to all of the major functions that are implemented in relational database applications. 


Each letter in the acronym can map to a standard Structured Query Language (SQL) statement, Hypertext Transfer Protocol (HTTP) method (this is typically used to build RESTful APIs[4]) or Data Distribution Service (DDS) operation

---
####The comparison of the database-oriented CRUD operations to the HTTP methods has some flaws. 

*Strictly speaking, both PUT and POST can create and update resources; the key difference is that contrary to POST, PUT is idempotent, meaning that multiple identical requests should have the same effect as a single request. Consequently, PUT is a "replace" operation, which one could argue is not "update".*

---
Although a relational database provides a common persistence layer in software applications, numerous other persistence layers exist. CRUD functionality can, for example, be implemented with object databases, XML databases, flat text files, or custom file formats. Some (big data) systems do not implement UPDATE, but have only a timestamped INSERT (journaling), actually storing a new version of the object. As a consequence, they do not have transactions either and might miss consistency.

---
####CRUD is also relevant at the user interface level of most applications. For example, in address book software, the basic storage unit is an individual contact entry. As a bare minimum, the software must allow the user to

* create or add new entries;
* read, retrieve, search, or view existing entries;
* update or edit existing entries;
* delete, deactivate, or remove existing entries.

Without at least these four operations, the software cannot be considered complete. Because these operations are so fundamental, they are often documented and described under one comprehensive heading, such as "contact management", "content management" or "contact maintenance" (or "document management" in general, depending on the basic storage unit for the particular application).

[CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete)
3. Exercise: Write, compile and run a Java program
Tags: java, beginners, devops, programming
Published: 2020-05-06 12:53:13

3.1. Write source code
The following Java program is developed under Linux using a text editor and the command line. The process on other operating system should be similar, but is not covered in this description.

Select or create a new directory which will be used for your Java development. In this description the path \home\vogella\javastarter is used. On Microsoft Windows you might want to use c:\temp\javastarter. This path is called javadir in the following description.

Open a text editor which supports plain text, e.g., gedit under Linux or Notepad under Windows and write the following source code.

// a small Java program
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}

Save the source code in your javadir directory with the HelloWorld.java filename. The name of a Java source file must always equal the class name (within the source code) and end with the .java extension. In this example the filename must be HelloWorld.java, because the class is called HelloWorld
How Technology can lend a helping hand during challenging times?
Tags: ai, datascience, digitaltechnology
Published: 2020-05-06 12:39:58

Robin Cook novels and Contagion movie were just fillers to pass our time. Whenever we watch Hollywood movies where aliens attack and try to capture the earth, we were sure that someone like Bruce Willis or Will Smith would save us for sure. With the advent of Covid19, we are made to look at scientists and research scholars and medical professionals for their opinions and celebrity chart has changed its course.

A similar change is happening in the world of technology where increasing organizations are forced to adopt digital technologies and amend their business processes to the new norm of the world order. Science and technology has always offered helping hands in the time of distress and there are many options for enterprises to leverage technology to overcome this challenging time. Following are three major focus areas that enterprises can leverage:

⦁ Reach-out and smoothen customer experience
⦁ Empathize and collaborate with workforce
⦁ Reengineer & Venture ahead

Reach-out and smoothen customer experience:

The only thing available without limits during lockdown is internet and data. During lock down or post lockdown, your customers would be looking forward to consume your services in safe manner. It would be the appropriate time to make your services and information around that available for easy access.

1. User centric web portals and mobile applications
2. On demand applications to sell products or services
3. Location based services to meet specific needs
4. Mobile platform with video chat and collaboration tools for hospitals,       
   personal tutoring and fitness centers
5. Digital tools that ensure customers of your availability when they need you

Empathize and collaborate with workforce

⦁ Provide digital tools and collaboration platforms
⦁ Provide virtual tools to manage communication
⦁ Onboard vendors on your core applications and integrate them as part of your 
  core business process
⦁ Remote workforce management with reoriented HR practices
⦁ Periodic communication via different channels

Reengineer & Venture ahead

⦁ Leverage analytics and artificial intelligence
⦁ Leverage your historic data to manage cash flow and operations
⦁ Sales/marketing tools to reengineer sales process
⦁ Enhance process efficiency using vision/text analytics tools
⦁ Identify automation opportunities and tools to accelerate the digital journey
May 6th Side Project Checkin
Tags: discuss, sideprojects, checkin, watercooler
Published: 2020-05-06 12:52:36

---
title: May 6th Side Project Checkin
published: true
description: Share your sideproject with the dev.to community.
tags: discuss, sideproject, checkin, watercooler
series: Side-project Checkin
---
Good Morning/Afternoon dev.to peoples!
How's your week going? Have you started any new side projects? Do you have any idea's you might want to talk over with someone? Or are you ready to ship a new feature that you're excited share?! Comment below with your projects!
Hitachi Vantara virtual conference day (free)
Published: 2020-05-06 12:46:01

Hello everyone! :) 

My name is Su and I am in charge of organizing Hitachi Vantara APAC virtual conference on June 4th. I would like to invite all of you to our event. Connect with the DataOps.NEXT experts and it's for free! 

Check out the link: https://bit.ly/3fpr9bs
Professional App for your eCommerce business
Tags: wordpress, startup
Published: 2020-05-06 12:41:55

Sell your products from your own branded store app for iPhone and Android devices.

Android and iOS Native App: Your store versatile application can be perused in the two stages - iOS and Android with high UI/UX quality. Moreover, UI is a pure native app.

We have build a Multi-Vendor Marketplace solution so you can convert your Woocommerce store to full-fledged MultiVendor MarketPlace like Amazon, eBay.

Your app now supports full integration with an e-commerce provider, says now your app will connect with your WooCommerce website so that now you can easily manage both products and sales.

Secure payment integration: AddWeb Shop bolsters multi installment gateway. It works with 99% of payment services. So now collect funds securely for products and services sold over your app.

High performance & Stability AddWeb Shop ensures app stability and high performance by synchronizing updates for performance and having a crash report.

Website To Mobile App

You have a WooCommerce website, AddWeb Shop now supports you by easily converting your E-commerce website to mobile store app in a swift way with our tailor-made solution.

One Step Creation One Step On Air

Now create a mobile store app with a variety of alluring competent ready to use templates for your E-commerce. AddWeb Shop will easily publish your mobile store app on the Google store and app store.


Social Media Integration

Social Login is a single sign-on for end users. Using existing login information from a social network provider to creating an account. This simplifies registrations and logins for end-users

Build your WooCommerce native app now
Get a mobile app that will keep your customers coming back for more.

Contact Us Now: https://addwebsolution.com/addweb-shop
Understanding Kubernetes: part 19 – Useful tools - Kustomize tips
Tags: kubernetes, devops, docker, beginners
Published: 2020-05-06 12:38:46

---
title: Understanding Kubernetes: part 19 – Useful tools - Kustomize tips
published: true
description: Serie of sketchnotes about Kubernetes. Explaining in a visual way Kubernetes principles.
tags: Kubernetes, DevOps, Docker, beginners
series: Understanding Kubernetes in sketchnotes
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/xjv4qreu44fblhjs6sgx.jpg
---

Understanding Kubernetes can be difficult or time-consuming. In order to spread knowledges about Cloud technologies I started to create sketchnotes about Kubernetes. I think it could be a good way, more visual, to explain Kubernetes (and others technologies).

We continue the serie of Sketchnotes about Kubernetes, with some tips for an useful tool: Kustomize.

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

If you are interested, I published all the sketchnotes on Kubernetes (and new ones!) to make a "book" of 120 pages: ["Understanding Kubernetes in a visual way"](https://gumroad.com/aurelievache#uCxcr).

As usual, if you like theses sketchnotes, you can follow me, and tell me what do you think. I will publish others sketchs shortly :-).
Javascript - dynamically generated variable names!
Tags: dynamic, generatevariables
Published: 2020-05-06 12:13:00

---
title: Javascript - dynamically generated variable names!
published: true
description: It's one of those things where you read online and you see people use eval to do the jub, while you can do it in vanilla javascript
tags: dynamic, generate-variables
---


`Sometimes i feel like - put my hands up in the air` .. no, sorry this post was not about songs and lyrics and putting your limbs airborne .. it's about my old issue that I thought I can't pull with javascript - but I was wrong. And that is, to generate some sort of 'loop-able' variable names - naming,, naming.. :(

Sort of, to be able to make variables in series, like: var1, var2, var3 ... simply by looping:

```javascript
// some random arr
var arr = [ 2, 1, 4, 'cat', true, false, null ] ;
// loop and generate dynamic variable names
for( var i = 0; i < arr.length; i++){
    var var+i = i * i; // >> this will surely fail, can't do that in JS
}
```

But that is not doable in javascript.. and that got me pretty hard .. because my brain think in way that should be doable ..?

So today I found out that solution to that problem was instead of variables, to think of array members .. we can easily change keys in array, and as in this simple example below I'll be able to iterate over loop and add any `key as variable` name to it:

```javascript
// some random arr
var arr = [ 2, 1, 4, 'cat', false ] ;
// foo array is "holder" of dynamic variables
var foo = [] ; 
// loop and generate dynamic variable names
for( var i = 0; i < arr.length; i++){
    foo[ "slider" + arr[ i ] ] = [ i ]
}
console.log( foo );
// [slider2: 2, slider1: 3, slider4: 0, slidercat: 1, sliderfalse: 6]
```
CloudTrail S3 Glacier archival - It's a trap...
Tags: aws, beginners, costs, itsatrap
Published: 2020-05-06 12:11:36

I was recently asked to implement a lifecycle policy to archive central S3 stored CloudTrail logs to Glacier, which on face value seemed like a reasonable idea...

The environment is reasonably large and the volume of data generated by CloudTrail is not insignificant, existing stats;
* >6TB S3 CloudTrail usage
* >345,000,000 Files in CloudTrail bucket
* >30,000,000 new CloudTrail files delivered monthly

Here are the current approximate costs based on above usage;
* ~6TB S3 Standard - $156 / month
* ~30,000,000 put requests - $165 / month
* **~$321 / month**

Not a huge expense but not insignificant... I started looking into pricing for Glacier;

* $0.005 per GB
* $0.06 per 1,000 Lifecycle Transition requests
* $0.025 per GB for Storage of 8KB file metadata per object...
* $0.005 per GB for Storage of 32KB index and related metadata per object...

So if I assume that the initial life cycle transition archives 80% of the files, the following new monthly costs would apply;
* 1.2TB S3 Standard - $32 / month 
* 5TB Glacier storage - $25 / month
* 2.1TB File meta data (8 * 276,000,000) * 0.025 = $52 "S3 storage overhead"
* 8.4TB Index meta data (32 * 276,000,000) * 0.005 = $42 "Glacier storage overhead"
* 30,000,000 transitions per month - (30,000,000 / 1000) * 0.06 = $1,800
* **~$1951 / month**

Plus the sweetener... an upfront cost of **$16,560** for initially transitioned files ((276,000,000 / 1000) * 0.06)

This obviously does not make financial sense and would have been a huge mistake to implement a net increase of ~$1630 plus the upfront shocker of $16560, needless to say we did not pursue the option to use Glacier archival for CloudTrail log files. There are other possible creative ways that could be implemented how ever those costs would likely exceed those of the raw S3 storage cost over time.

Disclaimer AWS do not recommend Glacier for archival of small files for exactly these cost implications, though it is something that one could easily fall victim to if implemented in a rush. That said hopefully this post might save someone a potentially major headache.

### References
> https://aws.amazon.com/s3/pricing/

> https://docs.aws.amazon.com/AmazonS3/latest/dev/lifecycle-transition-general-considerations.html
Text wrapping in Vega JS Charts (SVG and Canvas)
Tags: svg, javascript, tutorial, css
Published: 2020-05-06 12:08:00

Creating a Bar Chart using Vega JS library is shown here. 
https://vega.github.io/vega/tutorials/bar-chart/

The sample data in the above tutorial has alphabets as Labels. In real-world, data labels can be long. For example, a bar chart showing sales of various products.

```json
  "data": [
    {
      "name": "table",
      "values": [
        {"category": "Meat and Seafood", "amount": 28},
        {"category": "Milk and milk products", "amount": 55},
        {"category": "Ice cream", "amount": 43},
        {"category": "Cereals and Breakfast Foods", "amount": 91},
        {"category": "Nuts and seeds", "amount": 81},
        {"category": "Seasoning and spices", "amount": 53},
        {"category": "Sweets, candy, chocolate", "amount": 19},
        {"category": "Thin crispy breads", "amount": 87}
      ]
    }
  ],
``` 

Replacing with above product data in the example tutorial would render the below bar chart.

![Long overlapping x-axis labels bar chart](https://raw.githubusercontent.com/tejesh0/host/master/overlapping-labels-bar.png)


A simple way to remove the overlapping of labels is to rotate the labels by an angle.
```json
  "axes": [
    { "orient": "bottom", "scale": "xscale", "labelAngle": -45 },
    { "orient": "left", "scale": "yscale" }
  ],
```
To rotate x-axis labels, `labelAngle` property is used in the code snippet.

The labels no more overlap with neighboring labels but are overlapping with bars.


![labels overlapping on top of bars](https://raw.githubusercontent.com/tejesh0/host/master/labelAngle-overlapping.png)

`text` type mark [documentation](https://vega.github.io/vega/docs/marks/text/) mentions about a solution to wrap text. 

```md
*text property*

The text to display. This text may be truncated if the rendered length of the text exceeds the limit parameter. 
For versions ≥ 5.7, a string array specifies multiple lines of text. 

```

When x-axis vega config is written such that labels text is an array, each item in the array is rendered in a single line.

```json
  "axes": [
    { "orient": "bottom", "scale": "xscale",
      "encode": {
        "labels": {
          "update": {
            "text": {"signal": "split(datum.value, ' ')"}
          }
        }
      }
      
    },
    { "orient": "left", "scale": "yscale" }
  ],

```
By default, vega gets the labels on x-axis from the field mentioned in definition of `xscale`. To transform the labels, `encode` block is used.

`split(datum.value, ' ')` results in an array and each item in the array is on a single line.

![Labels wrapped](https://raw.githubusercontent.com/tejesh0/host/master/labels-wrapped.png)
Daily Developer Jokes - Wednesday, May 6, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-05-06 12:00:10

---
title: "Daily Developer Jokes - Wednesday, May 6, 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=Wednesday%2C%20May%206%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/5e1258b057385.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:___ Why did the functions stop calling each other?

___A:___ Because they had constant arguments.
 -->