teleren/devto huggingface dataset:
Problems with using Kubernetes
Tags: todayilearned, serverless, kubernetes
Published: 2020-03-09 13:00:28

*TL;DR notes from articles I read today.*

### [“Let’s use Kubernetes!” Now you have problems](http://bit.ly/338gP1V)

- If yours is a small team, Kubernetes may bring a lot of pain and not enough benefits for you.
- If you need to scale, you need at least 3-4 virtual machines, and that means twice as many actual machines at a minimum.
- The codebase is heavy: 580,000 lines of Go code at its heart as of March 2020, and large sections have minimal documentation and lots of dependencies.
- Setting up and deploying Kubernetes is complex - architecturally, operationally, conceptually and in terms of configurations, compounded by confusing default settings, missing operational controls and implicitly defined security parameters.
- Your application becomes hard to run locally because you need VMs or nested Docker containers, to begin with, staging environments, proxying a local process into a cluster or a remote process on to a local machine, etc.
- You are tempted to write lots of microservices but distributed applications are hard to write correctly and hard to debug. If you have more services written than the number of developers on each, you are doing it wrong. 

*[Full post here](http://bit.ly/338gP1V), 6 mins read*

---

### [Severe truth about serverless security and ways to mitigate major risks](http://bit.ly/2wIZ0u1)

- Cloud providers may secure your databases, operating systems, virtual machines, the network, and other cloud components, but you must still protect your application layer (code, business logic, data and cloud service configurations) against cyber attacks.
- Traditional web application firewalls only protect functions called through an API gateway. So, apply perimeter security to each function, incorporate whitelist validation, monitor updates to functions, and add runtime defense solutions.
- Be wary of third-party dependencies. Derive components from reliable official sources via secure links. For Node.js applications, use package locks or NPM shrinkwrap to restrict updates to code until you review them. Identify and fix vulnerabilities with automated dependency scanners.
- Ensure all credentials that invoke third-party services or cross-account integrations are temporary or encrypted and use a cryptographic key management solution. Set strict constraints on input/output messages passing through the API gateway.
- Address the downside of autoscaling, DoW (denial of wallet) attacks: set budget limits with alarms, limit the number of API requests in a given time window, use DDOS protection tools, and try to make API gateways internal and private.

*[Full post here](http://bit.ly/2wIZ0u1), 7 mins read*

---

*[Get these notes directly in your inbox every weekday by signing up for my newsletter, in.snippets().](https://mailchi.mp/appsmith/insnippets?utm_source=devto&utm_medium=post08&utm_campaign=is)*
How important UX design knowledge for frontend devs?
Tags: discuss, frontend
Published: 2020-03-09 13:00:27

---
title: How important UX design knowledge for frontend devs?
published: true
description: Should a frontend dev take UX design courses?
tags: discuss, frontend
---

Hey devs,

I am a frontend developer, I don't design mockups or wireframes. The UX team provide those for me. I just build them using code! 💻

I have been thinking lately about taking UX courses and put myself in their shoes. Mainly because I want to be able to build cooler looking websites even in my free time. ( Just like [my personal website](http://bassemmohamed.me/) )

Aside from the fact that learning is cool and important for everyone whatever his profession is, 

* Is learning UX particularly important for frontend devs? 🤔
* Can it impact dev's career somehow? 🤔
* Will it make a better developer? 🤔
Daily Developer Jokes - Monday, Mar 9, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-03-09 13:00:10

---
title: "Daily Developer Jokes - Monday, Mar 9, 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=Monday%2C%20Mar%209%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.
 -->
Visibility of element in DOM (Python with Selenium)
Tags: python, testing, codenewbie, selenium
Published: 2020-03-09 12:56:07

Hello, 
I am struggling to find a more efficient way to identify if an element is visible in the DOM or not.
I am creating a simple automation script with selenium and python and the best way i found is to use is self.driver.find_elements_by_xpath("xpath") with len function. it would look like this

verify_element = len(self.driver.find_elements_by_xpath(".//xpath"). If it will return the result in a list. If element exist it will return "1" and if it doesn't it will return "0"

The mentioned above works great but it has a mayor setback which is that it takes too long time for that line of code to execute. 

It would be very appreciated if you guys have a better way/solution to share.

thanks in advanced.
Get http code with wget
Tags: curl, wget
Published: 2020-03-09 12:48:56

Sometimes I don't have `curl` available for me in a given environment. Some distributions don't provide it with the default installed utilities and I might not have the privileges to install it.
In such cases, I use wget, which is usually installed.

```
wget --spider -S -T 2 www.jfrog.org 2>&1 | grep "^  HTTP/" | awk '{print $2}' | tail -1
```

Run `wget --help` to see details about the parameters I use here.
Ruby Hash Default Values, Versatile (Of Course!)
Tags: ruby, hash
Published: 2020-03-09 12:15:59

---
title: Ruby Hash Default Values, Versatile (Of Course!)
published: true
description: All about Ruby Hash default values
tags: ruby, hash
---

When you refer to a  non-existent key, a Ruby Hash object returns its default value, right?

Well, not so fast!

The returned value for a nonexistent key is actually controlled by not one, but two, settings:

* Default value:  a stored object.
* Default proc: a stored Proc.

#### Default Value

The simplest case is seen in a new Hash that was created with no argument:

* The default value is initially <code>nil</code>.
* The default proc is initially <code>nil</code>.

```ruby
h = Hash.new
h.default # => nil
h.default_proc # => nil
h[:nosuch] # => nil
```

Whenever the default proc is <code>nil</code>, the returned default value for the Hash comes from <code>#default</code>.

You can initialize the default value with method <code>Hash.new</code>:

```ruby
h = Hash.new(0)
h.default # => 0
h[:nosuch] # => 0
```

You can set the the default value with method <code>#default=</code>:

```ruby
h.default = false
h.default # => false
h[:nosuch] # => false
```

So far, so good.  The default value has ruled.  (BUT only because the default proc has been <code>nil</code>.)

#### Default Proc

When the default proc is not <code>nil</code>, the returned default value is determined by the default proc alone.

How?  We'll get to that.

First, you can initialize the default proc by including a block with <code>Hash.new</code>:

```ruby
h = Hash.new { |hash, key| "Default value for #{key}" }
h.default_proc.class # => Proc
```

Or you can set the default proc with method <code>#default_proc=</code>:

```ruby
h = Hash.new
h.default_proc # => nil
h.default_proc = proc { |hash, key| "Default value for #{key}" }
h.default_proc.class # => Proc
```

When the default proc is set (i.e., not <code>nil</code>), a reference to a non-existent key is handled thus:

* The proc is called with both the Hash object itself and the missing key.
* The block's return value is returned as the key's default value:

```ruby
h = Hash.new { |hash, key| "Default value for #{key}" }
h[:nosuch] # => "Default value for nosuch"
```

Note that in this case, the default value is ignored:

```ruby
h.default = false
h[:nosuch] # => "Default value for nosuch"
```
Note also that in the example above no entry for key <code>:nosuch</code> is created:

```ruby
h.include?(:nosuch) # => false
```

However, the block itself can add a new entry:

```ruby
h = Hash.new { |hash, key| hash[key] = "Subsequent value for #{key}"; "First value for #{key}" }
h.include?(:nosuch) # => false
h[:nosuch] # => "First value for nosuch"
h.include?(:nosuch) # => true
h[:nosuch] # => "Subsequent value for nosuch"
h[:nosuch] # => "Subsequent value for nosuch"
```

Finally, setting the default proc back to <code>nil</code> causes a missing-key reference to return the default value:

```ruby
h.default_proc = nil
h.default = false
h[:nosuch] # => false
```

That's all, Folks!
How I used React Native to Map Bushfires in Australia
Tags: reactnative, javascript, tutorial, react
Published: 2020-03-09 12:13:03

It's always good to learn how to use different libraries and frameworks by making interesting projects.

In this tutorial, I teach you how to use react native maps by mapping out Bushfires on an application using React Native.
{% youtube 4qq0GQPkfjI %}
We take a look at getting react-native-maps up and running.
* Installing and setting up
* Creating markers and covers
* Pulling in live data from an API
* Integrating it and displaying it on the map

If you want to take a sneak peek and what we build, here is a quick animated gif:
![Bushfires in Australia by Adrian Twarog](https://adriantwarog.com/wp-content/uploads/2020/03/bushfires-australia.gif)

## Follow and support me: 
Special thanks if you subscribe to my channel :)
* [🎞️ Youtube](https://www.youtube.com/channel/UCvM5YYWwfLwpcQgbRr68JLQ?sub_confirmation=1)
* [🐦 Twitter](https://twitter.com/adrian_twarog)
* [💬 Discord](https://discord.gg/nGdThpE)
* [💸 Patreon](https://www.patreon.com/adriantwarog)

## Want to see more:
I will try to post new great content every day. Here are the latest items:
* [Adobe XD to Fully Responsive WordPress Site](https://dev.to/adriantwarog/adobe-xd-to-fully-responsive-wordpress-site-16e0)
* [Adobe XD to HTML Full Process](https://dev.to/adriantwarog/adobe-xd-to-html-full-process-ao6)
* [Full Tutorial on how to use SASS to improve your CSS](https://dev.to/adriantwarog/full-tutorial-on-how-to-use-sass-to-improve-your-css-57on)
* [Creating a Mobile Design and Developing it](https://dev.to/adriantwarog/creating-a-mobile-design-and-developing-it-5c4o)
serverless framework template
Tags: serverless, template, aws
Published: 2020-03-09 12:12:14

Looking for a reusable template to start your [serverless framework](https://serverless.com/) journey in [AWS](https://aws.amazon.com/)? You've come to the right place.

## Goals
- Get familiar with the serverless-framework syntax [todo-api serverless.yml](https://github.com/unfor19/serverless-template/blob/master/services/todo-api/serverless.yml)
- How to manage a monorepo, with a shared [common values file](https://github.com/unfor19/serverless-template/blob/master/serverless.common.yml)
- Start working with AWS Lambda Layers instead of attaching dependencies to your Lambda Functions
- Deep dive into the Lambda Layers structure, in both [Python](https://github.com/unfor19/serverless-template/tree/master/services/greet-api/layer) and [NodeJs](https://github.com/unfor19/serverless-template/tree/master/services/todo-api/layer)
- [Modify](https://github.com/unfor19/serverless-template#modify) the repository with your own code, build and deploy!
- Using [serverless framework plugins] (https://github.com/serverless/plugins)
- Concepts, use cases, and project's structure - [Theory](https://github.com/unfor19/serverless-template#theory)

## Repository

{% github unfor19/serverless-template %}
Algorithms in Go: Length of the Longest Substring
Tags: algorithms, go
Published: 2020-03-09 12:04:54

---
title: Algorithms in Go: Length of the Longest Substring
published: true
description: In this post I'll walk through the solution to an algorithms problem. This problem tests on a technique called sliding window.
tags: ["algorithms", "go"]
---

Finding the length of the longest substring of a given string is a very common algorithms question in interviews. In this post, I'm going to walk you through how to solve this problem in Go.

## The problem

Given a string, find the length of the longest substring without repeating characters.

**Example 1:**
```
Input: "abcabcbb"
Output: 3
Explanation: The answer is "abc", with a length of 3.
```

**Example 2:**
```
Input: "bbbbb"
Output: 1
Explanation: The answer is "b", with a length of 1.
```

## Explain the solution

I'll be using a technique called **sliding window**. Here is how it works:

1. Iterate over the string.
2. Maintain two pointers to represent the left and right bound of a window. Both two pointers start at index 0.
3. As we iterate along the string, the right pointer acts as the looping counter, while the left pointer stays where it was, unless the right pointer encounters a character that was visited before, and the left pointer is behind the visited character. When this happens, the left pointer moves to the next iteration position.
4. To determine if a character was already visited or not, we need to maintain a hash map to store the indices of every character that the right pointer has encountered.
5. For each iteration, we calculate the window length and compare it with the previous longest length. If the current length is longer, we update the longest length record.
6. When the iteration finishes, we'll have the longest window length.

## Solution

```go
func lengthOfLongestSubstring(s string) int {
    // making a map the go way
	m := make(map[byte]int)
	res := 0

	for l, r := 0, 0; r < len(s); r++ {
		if index, ok := m[s[r]]; ok {
            // only update the left pointer if 
            // it's behind the last position of the visited character
			l = max(l, index)
		}
		res = max(res, r-l+1)
		m[s[r]] = r + 1
	}
	return res
}

func max(n, m int) int {
	if n > m {
		return n
	}
	return m
}
```
Learn GraphQL and AWS AppSync By Running One Command
Tags: aws, graphql, beginners, tutorial
Published: 2020-03-09 11:58:15

To download a working GraphQL implementation that you can deploy to AWS all you need to do is run:

`npx cdkp init the-simple-graphql-service`

This will clone the typescript implementation from cdkpatterns.com, now you can do:

* npm run test - runs the unit tests
* npm run deploy - deploys to aws if you have your local creds setup
* Read the readme for learning instructions
* Jump into the code in lib/the-simple-graphql-service-stack.ts and start learning
On teaching - Part I
Published: 2020-03-09 10:42:47


Originally published on [https://www.dragosgn.com/on-teaching-part-I/](https://www.dragosgn.com/on-teaching-part-I/)

Last September, I joined the ESMT Coding Bootcamp as a Teaching Assistant. My role consists of supporting students on their full-stack learning journey. I do this either during class or through one to one personalized sessions. I took the job without thinking twice. Finally, an opportunity to develop, learn and inspire the next generation of developers, a no brainer.

Our students are a very diverse crowd. We have 10+ nationalities, different ages, genders, and goals. But they all share a common trait; they are determined, ambitious, and eager to build a career in tech. Many times it was their motivation that kept me on track.

### One of the best experiences in my career

Six months after, I must say the experience has been one of the most rewarding in my professional career. Supporting individuals on their learning journey offers you a unique perspective on learning. Seeing the difficulty of being in the driver’s seat when learning software helps you become a more empathetic leader. Despite all the great material, courses, and boot camps available out there, learning software is still hard. The multitude of tools, frameworks, and patterns frightens even the bravest. And let’s not even get into syntax.

### Job satisfaction beyond financial compensation

As software engineers, we operate in abstract worlds. We learn to translate real-world problems into something that a machine can understand and execute. It is within that process of navigating abstractions that the “real” impact of your work gets distorted.

Teaching is nothing like that. Receiving thank you emails in the middle of the night from students that, through your support, finally managed to solve that hard compiling error is priceless. It goes far beyond financial compensation or career advancement; it is a job well done.

### To teach is to listen

Like any human relationship, empathy and understanding are the keys to success. You must understand what students are struggling with, how do they feel, and what is their approach to solving the issue. It is only after that you can advise, correcting direction using the [Socratic dialogue](https://en.wikipedia.org/wiki/Socratic_dialogue) in the quest for a solution. You will soon learn that to teach is to listen.

Handling two jobs might be a bit exhausting; you will have to sacrifice personal time and feel tired at times. Nevertheless, the experience is worth every minute. So start right now. If you don’t have the opportunity to do it in a class format, try to help somebody that’s at the beginning of their learning curve. If you are a software engineer interested in leadership, teaching is a perfect fist step for further development.

As for me, I am immensely proud of our students and looking forward to graduation!
Project walkthrough: Learning Curve website
Tags: gatsby, css
Published: 2020-03-09 11:55:07

This website is built with Gatsby, TailwindCSS and the source is from Anchor FM (as its a podcast). It also uses Netlify Forms to collect the emails from people who are interested.

Source: https://github.com/aravindballa/learningcurve.dev
Website: https://learningcurve.dev

Here is the video -

{% youtube zmu4AkmB7SU %}
Nevertheless, Francel Coded
Tags: wecoded
Published: 2020-03-09 11:30:37

---
title: Nevertheless, Francel Coded 
published: true
tags: shecoded
---
<!-- ✨This template is only meant to get your ideas going, so please feel free to write your own title & narrative! ✨ -->

## Equality in tech looks like… 

## I’m an expert at…

## My advice for allies to support self-identifying women and non-binary folks who code is...

<!-- Once your post is published, it will not appear on the /t/shecoded page until an admin approves it. This is an extra step to ensure there is no abuse on this important tag. -->
What's your Conference Plan?
Tags: discuss, career, productivity
Published: 2020-03-09 11:26:01

Recently, my job has had me going to a lot of conferences and events, [current news aside](https://techcrunch.com/2020/03/06/sxsw-cancelled/),  conferences are going to eventually start back up, 

During this conference lull, I've been thinking about how to get the most out of them when they're back and some people have been giving me advice on "How to conference"

Some of its been pretty solid advice;
- Don't try to plan more than two things you want to do a day
- Don't feel you need to "get your money's worth"
- Try and attend one thing a day outside normal events you'd attend
- Conferences are the best time to catch local people you've been struggling to find time with

---

But now, it's time to crowdsource some wisdom!

How do you plan for conferences? Do you have any tips? How do you get the most out of the opportunities and networking?


---

Cover Photo by [Jakob Dalbjörn](https://unsplash.com/@jakobdalbjorn) on Unsplash
From Angular to Ionic - Todo App - Tutorial
Tags: angular, ionic, tutorial
Published: 2020-03-09 11:04:14

This is the Ionic 5 version of the Todo app presented in previous posts, without applying the formatting and Web Api. My goal was to practice my Angular lessons from last year, and do this with the trendy Ionic framework.

*Prerequisites:*
a.) javascript/angular intermediate knowledge
b.)check the following Ionic documentation https://ionicframework.com/docs/components/
Especially: button, input, card, alert.
c.) And also please check the steps for creation of simple apps in Ionic:
https://ionicframework.com/getting-started/
d.) code is commented for a better understanding. It's the angular/typescript component file that contains the whole logic, described in the comments, see repo.

Web version is live under the link:
https://ionic5-todo.zoltanhalasz.net/

![Todo App Live](https://dev-to-uploads.s3.amazonaws.com/i/cg0uk2sygwb6qf6jfra1.png)

Repository - zipped.
https://drive.google.com/file/d/14v_qlDgXFgpbiolKVBz-DbWQSJP2ruKU/view
Passing props from child to parent react
Tags: react, javascript
Published: 2020-03-09 10:57:59

How to get an updated state of child component in the parent component using the callback method?

let's take an example that you have two components Form and input-box having a parent-child relationship.

# Form (Parent)

```javascript
import React, { useState, Component } from 'react';
import Input from '../../shared/input-box/InputBox'

const Form = function (props) {

    const [value, setValue] = useState('');

    const onchange = (data) => {
        setValue(data)
        console.log("Form>", data);
    }

    return (
        <div>
            <Input data={value} onchange={(e) => { onchange(e) }}/>
        </div>
    );
}
export default Form;
```

# Input Box (Child)

```javascript
import React from 'react';

const Input = function (props) {
    console.log("Props in Input :", props);

    const handleChange = event => {
        props.onchange(event.target.value);
    }

    return (
        <div>
            <input placeholder="name"
                id="name"
                onChange= {handleChange}
            />
        </div>
    );
}
export default Input;
```

above code, snippets help you get the updated value of the input box in parent component named Form on every onChange activity of child component named inputBox.
กฏ 3 ประการของ Serverless 
Tags: note
Published: 2020-03-09 09:40:42

---
title: กฏ 3 ประการของ Serverless 
published: true
description: กฏ 3 ประการของ Serverless 
tags: note
---

คุณ​ Burke บอกว่า serverless ไม่ได้มีความหมายแค่ว่ารัน application โดยไม่ต้องสนใจ server เพราะถ้ามันมีความหมายแค่นั้น หลายๆ service ก็เป็น serverless เช่น Heroku หรือ digitalocean หรือ AWS Beanstalk ที่กดแค่ปุ่มเดียวก็ได้ wordpress มาใช้งานเลย

ดังนั้นการแยกแยะว่า service ไหนเป็น serverless นั้นเราต้องดูจากกฏ 3 ประการนี้

1. The Law of Furthest Abstraction
เราไม่จำเป็นต้องรับรู้รายละเอียดและความซับซ้อนของ server ที่ใช้งาน
จากตัวอย่างด้านบนที่ยกมา ถึงแม้ว่าเราไม่รู้รายละเอียดตอนที่กดสร้าง wordpress แต่จริงๆแล้ว มันก็มีความซับซ้อนบางอย่าง ที่เราจำเป็นจะต้องรู้จริงๆ เช่น มีกี่ CPU ใช้ mem เท่าไหร่ มี storage เท่าไหร่

2. The Law of Inherent Scale
การทำ scaling เป็นไปโดยอัตโนมัติ ไม่ต้องไปทำระบบ scaling ให้เองทุกอย่าง

3. The Law of Least Consumption
ใช้เท่าไหร่ ก็จ่ายเท่านั้น จุดนี้เป็นจุดสำคัญที่เราสามารถแยก serverless ออกจาก PaaS ได้ง่ายๆ เพราะพวก Heroku นี่ถึงแม้ว่าจะไม่มีคนเข้าใช้งาน แต่เราก็ยังต้องจ่ายอยู่ดี แตกต่างจาก serverless อย่างพวก Firebase Cloud Function ที่เก็บเงินเป็น request, execution time นั่นหมายความว่า ถ้าไม่มีคนใช้งานเลย เราก็ไม่เสียตังค์

## ที่มา
* [The 3 Laws of Serverless](https://burkeholland.github.io/posts/laws-of-serverless/)