teleren/devto huggingface dataset:
GitHub Codespaces, Visual Studio Code and Remote Containers
Tags: github, visualstudiocode, devops, developer
Published: 2021-04-29 20:36:34

![Cloud with Chris Logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xea3wl8co4ylrpcvmuuh.png)

**This post was originally published on Fri, Jan 8, 2021 at [cloudwithchris.com](https://www.cloudwithchris.com/episode/github-codespaces-and-vscode-remote-containers/).**

In this episode, we're going to be taking a slight detour away from GitHub actions and focus on some of the announcements from GitHub universe last week. We're going to explore them both from the announcements, and also take a look at some of those features that have already been released. Stay tuned!

{% youtube H6134ad2x4Q %}
GitHub Issues and GitHub Discussions
Tags: github, githubactions, devops, opensource
Published: 2021-04-29 20:34:03

![Cloud with Chris Logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xea3wl8co4ylrpcvmuuh.png)

**This post was originally published on Wed, Dec 16, 2020 at [cloudwithchris.com](https://www.cloudwithchris.com/episode/github-issues-github-discussions/).**

In this episode, we'll be taking a look at GitHub Issues and GitHub Discussions which recently came out at GitHub Universe. Interested? Then stick around as we find out more about both of these topics!

{% youtube 9Cajj3_kcos %}
How to query Ancestry fast
Published: 2021-04-29 20:26:12

[Ancestry](https://github.com/stefankroes/ancestry) is a great library to organize models in a tree structure.

For example, if you have Location model, which may be City, State, and Country, and you want to easily organize and query between all those entities.

By default Ancestry makes requests with LIKE query, e.g.

```sql
SELECT
  locations.*
FROM 
  locations 
WHERE
  "locations"."ancestry" LIKE '4a5b7a5d-1147-4d09-8a5d-a1a476c5be50/88fd88b7-eecd-4fc0-b18d-e2b6a077ab66/550f9809-e875-4fab-8cac-db8e6d59e0e5/%' 
OR 
  "locations"."ancestry" = '4a5b7a5d-1147-4d09-8a5d-a1a476c5be50/88fd88b7-eecd-4fc0-b18d-e2b6a077ab66/550f9809-e875-4fab-8cac-db8e6d59e0e5'
``` 

Sometimes you need to write a query to check all descendants, like 

```sql
SELECT
  locations.*, count(distinct cities.id)
FROM 
  locations 
LEFT JOIN locations as cities ON 
  cities.ancestry LIKE '%' || locations.id || '%'
WHERE
  cities.location_type = 'CITY'
GROUP BY
  locations.id
```

(in this example `locations.id` is `uuid`, so we can use simplified LIKE query with '%' || locations.id || '%'. With `int id` it requires a different request)
 
But this request is running too long.
PostgreSQL does have indexes that may speed up LIKE queries, for example `GIN` and `GiST`.

But before using index, we can change that query to this
```sql
SELECT
  locations.*, count(distinct cities.id)
FROM 
  locations 
LEFT JOIN locations as cities ON 
  locations.id = ANY((string_to_array(cities.ancestry, '/')::uuid[]))
WHERE
  cities.location_type = 'CITY'
GROUP BY
  locations.id
```

And it runs MUCH faster. On our data, we get an improvement from 5 seconds to 6 ms(!).
 
And it's possible to use it with `int` ids, just change `uuid[]` to `int[]`.

After we can also add GIN index to it, if we want to.
```ruby
add_index :locations, "(string_to_array(ancestry, '/')::uuid[])", using: :gin
```
But it already runs much faster.

Another way to speed up Ancestry queries is to use `ltree` index, but it requires a diffent syntax.

### Sources:
string_to_array: https://github.com/stefankroes/ancestry/issues/466
GIN and GiST index documentation: https://www.postgresql.org/docs/9.1/textsearch-indexes.html

ltree: https://github.com/stefankroes/ancestry/issues/102
ltree index documentation: https://www.postgresql.org/docs/9.1/ltree.html
GitHub Universe and GitHub Actions Deployments
Tags: github, githubactions, devops, git
Published: 2021-04-29 20:31:09

![Cloud with Chris Logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xea3wl8co4ylrpcvmuuh.png)

**This post was originally published on Tue, Dec 15, 2020 at [cloudwithchris.com](https://www.cloudwithchris.com/episode/github-universe-roundup/).**

In this episode, we're going to be taking a slight detour away from GitHub actions and focus on some of the announcements from GitHub universe last week. We're going to explore them both from the announcements, and also take a look at some of those features that have already been released. Stay tuned!

{% youtube -3K550t5bzQ %}
GitHub Actions and Azure - Deploying .NET Core code to Azure App Service
Tags: github, devops, dotnet, azure
Published: 2021-04-29 20:29:07

![Cloud with Chris Logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xea3wl8co4ylrpcvmuuh.png)

**This post was originally published on Wed, Dec 2, 2020 at [cloudwithchris.com](https://www.cloudwithchris.com/episode/github-actions-deploy-to-appservice/).**

You have your .NET Core code. You have your application infrastructure ready. Now, it's time for us to deploy that application to Azure using GitHub Actions!

{% youtube vmvr9_BDPTE %}
GitHub Actions and Azure - Deploying ARM templates with GitHub Actions
Tags: github, githubactions, devops, azure
Published: 2021-04-29 20:26:48

![Cloud with Chris Logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xea3wl8co4ylrpcvmuuh.png)

**This post was originally published on Wed, Dec 2, 2020 at [cloudwithchris.com](https://www.cloudwithchris.com/episode/github-actions-deploying-infrastructure/).**

Have an application that you want to deploy to Azure in an automated way? Well, before we deploy the application code, we need some Azure Infrastructure for it to run on. In this video, we have you covered on how to deploy that infrastructure!

{% youtube o7Ab5LsAm8o %}
Crash reports and usage metrics for JavaScript libraries
Tags: javascript, showdev, devrel
Published: 2021-04-29 20:24:48

At Bugout.dev (https://bugout.dev/) we've built a product that helps maintainers of APIs, libraries, and command line tools understand:
1. Who their users are
2. How exactly they use their software
3. What issues their users have

If you have built a developer tool and integrate with Bugout, it runs on your user's machines only with their consent. This provides you with rich information about your users. For example, operating system, CPU architecture, version of your tool they are using, and even their email in case they are having an issue and would like your help resolving it.

This week, we released the Javascript version of our usage and crash reporting library, Humbug:
{% github bugout-dev/humbug %}

We currently support Node.js as the Javascript runtime, although we plan to add browser support soon.

Our package is available on npm:
```bash
npm install @bugout/humbug
```

If you have a tool in which you'd like to try Bugout, you can start for free by signing up for an account at https://bugout.dev.

If you need any help getting started, please leave a comment and we'll help you as soon as we can. We also appreciate any feedback.

Thank you!
GitHub Actions and Azure - Getting started with GitHub Actions and Azure Login
Tags: github, githubactions, devops, azure
Published: 2021-04-29 20:24:18

![Cloud with Chris Logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xea3wl8co4ylrpcvmuuh.png)

**This post was originally published on Sun, Nov 29, 2020 at [cloudwithchris.com](https://www.cloudwithchris.com/episode/github-actions-getting-started/).**

Want to find out more about how GitHub Actions work? How about the Azure Actions that you might use in your first deployments in the platform? Then stick around, because this video is the one for you!

{% youtube 4HjCS4HMGCU %}
Formatted String Literals in Python
Tags: python, programming
Published: 2021-04-29 20:22:09

## Old-school  way of formatting strings `str.format()`
The Python `string .format()` method was introduced in version 2.6. Following is an example that uses `.format()` method of formatting strings.


```
#Example 1 (simple)
name = "Sweta Shaw"
print("My name is {}".format(name))

#output
My name is Sweta Shaw
``` 

The above code looks neat but the real struggle happens when the number of variables increases.


```
#Example 2 (complex)
first_name = "Sweta"
last_name = "Shaw"
profession = "software developer"
platform = "hashnode"

print("Hi! I am {first_name} {last_name}, a {profession} by profession currently writing this article on {platform}.".format(first_name= first_name, last_name =last_name , profession = profession, platform = platform))

# output
Hi! I am Sweta Shaw, a software developer by profession currently writing this article on hashnode.
``` 

This is where the **f-string** literals come to the rescue. It was introduced in Python 3.6

A ***formatted string literal* **or ***f-string*** is a string literal that is prefixed with `f` or `F` and curly braces containing expressions that will be replaced with their values.


```
# Example 1 using f-string
name = "Sweta"
print(f"My name is {name}")

# output
My name is Sweta Shaw
``` 

Let's see how we can write the complex example 2 using f-strings:


```
# Example 2 using f-string
first_name = "Sweta"
last_name = "Shaw"
profession = "software developer"
platform = "hashnode"

print(f"Hi! I am {first_name} {last_name}, a {profession} by profession currently writing this article on {platform}.")

# output
Hi! I am Sweta Shaw, a software developer by profession currently writing this article on hashnode.
``` 

We can also perform arithmetic operations using f-string literals.

```
f"{2 * 37}"
# output 
'74'
``` 


```
a = 20
b = 50

print(f"The smaller number between {a} and {b} is {a if a < b else b}")

# output
The smaller number between 20 and 50 is 20
``` 


### Printing a list

```
authors = [("id", "author", "book"), ("101", "Changing India", "Dr. Manmohan Singh"), ("102","War and Peace", "Leo Tolstoy "), ("103", "Emma", "Jane Austen")]
for id, author,book in authors:
    print(f"{id} {author} {book}")

# output
id author book
101 Changing India Dr. Manmohan Singh
102 War and Peace Leo Tolstoy 
103 Emma Jane Austen

``` 

### Beautify this output using f-string indentation
This is done by mentioning the number of spaces taken by each variable. Here 'id' has been assigned 5 spaces and author and book 20 spaces each.


```
authors = [("id", "author", "book"), ("101", "Changing India", "Dr. Manmohan Singh"), ("102","War and Peace", "Leo Tolstoy "), ("103", "Emma", "Jane Austen")]
for id, author,book in authors:
    print(f"{id:{5}} {author:{20}} {book}")

# output:
id    author               book
101   Changing India       Dr. Manmohan Singh
102   War and Peace        Leo Tolstoy 
103   Emma                 Jane Austen


``` 
You can read more about f-string literals [here](https://www.python.org/dev/peps/pep-0498/#abstract)
Java 8 Stream API on Arrays
Tags: java, stream, functional
Published: 2021-04-29 20:02:02

---
title: Java 8 Stream API on Arrays
published: true
description: using Java 8 stream api on an array of strings
tags: java, stream, functional
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2tepyvhalyophog228u5.png
---

Java 8 introduced the concept of functional programming. My first instinct when I need to iterate is to use a for-loop. So here are some common operations on arrays using the stream api. I'll reference this post when I need a friendly reminder. USE MORE STREAMS! You can read more about java streams [here](https://www.baeldung.com/java-8-streams). Also I'm using the Java 8 method reference syntax, you can read more about that topic [here](https://www.baeldung.com/java-method-references).
 

#### Given an array of strings that represent a phone number, format and print each to console. 

```java
String[] phoneNumbers = new String[] {"3125550909", "3125557676", "3125552323", "3125556161", "3125554141"};

String[] formattedPhoneNumbers = Arrays.stream(phoneNumbers)
        .map(value -> String.format("1-(%s)-%s-%s", value.substring(0,3), value.substring(3,6), value.substring(6,10)))
        .toArray(String[]::new);

Arrays.stream(formattedPhoneNumbers).forEach(System.out::println);
```


#### Given an array of strings that represent zip codes, filter out unwanted zip codes and print remaining to console.

```java
String[] zipCodes = new String[] {"60640","94102", "60602", "94115", "60647", "94140"};

String[] subsetZipCodes = Arrays.stream(zipCodes)
        .filter(value -> value.contains("606"))
        .toArray(String[]::new);

Arrays.stream(subsetZipCodes).forEach(System.out::println);
```


#### Given an array of sentences, count the number of occurrences for each word and print to console.

```java
String[] lines = new String[] {
		"toast for breakfast ",
        "sleepy in chicago",
        "tired in the morning",
        "coffee in the morning",
        "sleepy breakfast today",
        "breakfast in chicago" };

Map <String, Integer > wordCount = Arrays.stream(lines)
        .map(w -> w.split("\\s+"))
        .flatMap(Arrays::stream)
        .collect(Collectors.toMap(w -> w, w -> 1, Integer::sum));

wordCount.forEach((k, v) -> System.out.println(String.format("%s ==>> %d", k, v)));
```

#### Given an array of names, and a custom NbaPlayer class, create a new array with elements of NbaPlayer type.
```java
String[] names = {"lebron", "kyrie", "doncic", "davis", "lavine"};

class NbaPlayer {
    String name;
    NbaPlayer(String name){
        this.name = name;
    }

    @Override
    public String toString() {
        return "NbaPlayer{" +
                "name='" + name + '\'' +
                '}';
    }
}

NbaPlayer[] players = Arrays.stream(names).map(NbaPlayer::new).toArray(NbaPlayer[]::new);

Arrays.stream(players).forEach(System.out::println);
```

That's all for now. Maybe in the next post I'll do more with streams and other data structures. ArrayLists for sure. 👨🏽‍💻
GitHub Actions and Azure - Source Controlling our Code using Git
Tags: github, githubactions, devops, azure
Published: 2021-04-29 20:22:07

![Cloud with Chris Logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xea3wl8co4ylrpcvmuuh.png)

**This post was originally published on Sun, Nov 29, 2020 at [cloudwithchris.com](https://www.cloudwithchris.com/episode/github-actions-git/).**

Want to automate your application deployments into Azure? Heard about Git, GitHub or GitHub actions want to find out more? I'm starting a new series on how you can use GitHub Actions to deploy your applications into Azure! Interested? Then stick around to find out more.


{% youtube iS2d5EykbQY %}
IMDB clone using bootstrap
Published: 2021-04-29 20:21:33

---
title: IMDB clone using bootstrap
published: true
description: IMDB clone using bootstrap and omdbapi API
tags: 
//cover_image: https://direct_url_to_image.jpg
---
Here a personal project using Javascript Vanilla and bootstrap

https://codepen.io/irwingb1979/pen/ExZzgzd
34 - The Bulkhead Pattern (Isolate your components to prevent failures)
Tags: architecture, resilience, cloud, azure
Published: 2021-04-29 20:19:38

![34 - The Bulkhead Pattern (Isolate your components to prevent failures)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oxdarxjw92k37dvtd1tu.jpg)

**This post was originally published on Fri, Apr 9, 2021 at [cloudwithchris.com](https://www.cloudwithchris.com/episode/bulkhead/).**

Do you know what caused the Titanic to sink? Poorly designed bulkheads. How can you ensure resilience between components in your cloud application? Effectively designed bulkheads! In this session, join Chris as he explores how the bulkhead pattern can help you prevent excessive load or failures in one service impacting the consumers of that service!

{% youtube xPJSKM2AsQo %}
33 - External Config and Claim Check Pattern - Easier Management and Externalising Payloads
Tags: azure, architecture, cloud, design
Published: 2021-04-29 20:16:35

![33 - External Config and Claim Check Pattern - Easier Management and Externalising Payloads](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k23nnf86mk0r1xahyt2r.jpg)

**This post was originally published on Fri, Apr 2, 2021 at [cloudwithchris.com](https://www.cloudwithchris.com/episode/external-config-and-claim-check/).**

How often do you think about the configuration of your applications across environments/regions/deployment boundaries? What if that configuration was stored somewhere externally but centralised, to make management easier? That's the idea behind the external config pattern! How about another scenario - What about those times where you've wanted to use a messaging service, but your payload is too big? Thought about externalising that payload too? Well, that's the Claim-check pattern! Join Peter and Chris as they talk about both of these patterns in this episode of Cloud with Chris!

{% youtube QHW5Nc9J1bg %}
32 - Accelerate .NET to Azure with GitHub Actions
Tags: devops, github, dotnet, azure
Published: 2021-04-29 20:13:42

![32 - Accelerate .NET to Azure with GitHub Actions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mjp6o37jewsr9kded5nk.jpg)

**This post was originally published on Fri, Mar 26, 2021 at [cloudwithchris.com](https://www.cloudwithchris.com/episode/accelerate-dotnet-to-azure-with-github-actions/).**

GitHub Actions makes it easy to automate all your software workflows, now with world-class CI/CD. Build, test, and deploy your code right from GitHub. Make code reviews, branch management, and issue triaging work the way you want. With .NET Core bringing a cross platform approach, getting your applications to the Cloud is easier than ever.

In this session we will learn the different ways to deploy our .NET applications to the cloud and how we can use GitHub Actions to make it faster!

{% youtube UHoC_IpCsSs %}
BDD
ISN'T ABOUT TESTING
Tags: testing, bdd, transformation
Published: 2021-04-29 20:12:54

Interestingly, many organizations still firmly believe that BDD is all about “Testing”. In this article, I am going to share my experience on what people, whom I met in various forums, think about BDD from a testing point of view.

First thing first, let’s be very clear that BDD is different and testing is different. Like I said in my previous article, BDD is collaborative work. Various stakeholders collaborate and work together to harvest the fruits of requirements. Also, BDD is all about mindset.

On the other hand, “Testing” plays a small part, and there is no defined process for testing. In an ideal scenario, a tester plays an important role. He/she will collaborate closely with Business Analysts/Product Owners and Developers to understand the requirements and write edge cases to see how they can break the system, which eventually converts to acceptance criteria.

Everyone has different opinions when it comes to BDD and its process. A massive debate might occur like who should write acceptance criteria scenarios (business analysts) until who automates the acceptance tests (developers). You can read about the roles and responsibilities in a BDD project article that I wrote here.

From my personal experience, I firmly believe that testers should automate acceptance tests. Again, it’s debatable. As per some books and based on other’s experiences, they think developers should do partial testing. I agree with this to some extent.

But practically, developers are so occupied in their deliverables and unit testing. I have seen many developers showing less interest in automating the acceptance tests because of various reasons like delay in delivery, more sprint work, last-minute changes, etc., and this will eventually, lead to riskier product delivery. It can take us to loads of production bugs occurring if the developer spends time in writing step definitions or automated acceptance tests.

To avoid this, SDETs (or QE or Testers) will always be very handy. They help to automate the acceptance tests using tools & frameworks like Selenium, Cucumber, SpecFlow, Serenity, Cypress, etc., which suits very well them.

Doing so doesn’t mean if testers are automating acceptance tests, BDD = testing. In a nutshell, BDD is all about collaborative work, and testing plays a part in it.
31 - Deploying to Azure through Terraform Cloud
Tags: devops, terraform, azure, infrastructureascode
Published: 2021-04-29 20:10:44

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

**This post was originally published on Fri, Mar 19, 2021 at [cloudwithchris.com](https://www.cloudwithchris.com/episode/deploy-using-terraform-cloud/).**

You may have heard of Terraform, but are you aware of Terraform Cloud or Terraform Enterprise? In this session, Chris will give a rundown of how he has used Terraform Cloud as the underlying engine to deploy some of his own projects onto Azure. Prepare to get meta as we even look how Terraform can help set up Terraform Cloud in this episode of Cloud with Chris!

{% youtube iewk-BkJpdU %}
10 Simple Toggle Switch Animation Using CSS And JavaScript
Tags: javascript, css, webdev, productivity
Published: 2021-04-29 20:08:34

Here I list 10 simple toggle button animation examples. All of them work based on simple transition property. JavaScript is used to toggle class to the elements and mimic the checkbox effect. I am not going to comment how this is created, try to build with your idea, this is simple, I limit the CSS styling to reduce complexities. Its just beginner level code, you can do it without any help. If you are have any doubt, comment it I will help you. I hope you will be able to design better than me. happy Coding

{% codepen https://codepen.io/kiran-r-raj/pen/MWJRJOK default-tab=result %}

{% codepen https://codepen.io/kiran-r-raj/pen/ZELNzVN default-tab=result %}

{% codepen https://codepen.io/kiran-r-raj/pen/XWpwWzK default-tab=result %}

{% codepen https://codepen.io/kiran-r-raj/pen/YzNbzMj default-tab=result %}


{% link https://dev.to/kiranrajvjd/12-simple-css-hover-effects-95d %}
{% link https://dev.to/kiranrajvjd/24-html-tags-you-may-not-know-37be %}
{% link https://dev.to/kiranrajvjd/19-simple-hover-animation-using-css-1l36 %}
{% link https://dev.to/kiranrajvjd/the-ultimate-web-developer-resources-list-200-resources-2gf5 %}
30 - The Cache Aside Pattern (Optimise your caching approach!)
Tags: architecture, data, azure, scalability
Published: 2021-04-29 20:07:25

![30 - The Cache Aside Pattern (Optimise your caching approach!)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x4c7rn1iddcz1e7me90r.jpg)

**This post was originally published on Fri, Mar 12, 2021 at [cloudwithchris.com](https://www.cloudwithchris.com/episode/cache-aside/).**

Have you implemented caching within your application and need a better way to maintain consistency between your cache and datastore? Or maybe you haven't adopted caching yet, and intrigued on what patterns you could use to do so? Then take a look in this session as Chris explores how caching can improve your access to information in your data store, using the cache aside pattern.

{% youtube oo5YIkEmujk %}
Is there anything you want to know about Netlify or JAMstack? Answer for the chance to be featured on our podcast!
Tags: podcast, netlify, jamstack
Published: 2021-04-29 20:01:43

---
title: Is there anything you want to know about Netlify or JAMstack? Answer for the chance to be featured on our podcast!
published: true
description: 
tags: podcast, netlify, jamstack
---

The [DevDiscuss Podcast](dev.to/devdiscuss) begins with an interview and ends with commentary from listeners — and we like to feature the actual voices from our community!

To inform an upcoming episode of the show, we'd like to know...

> ### **“Is there anything you want to know about Netlify or JAMstack?”**

For your chance to hear your actual comments on an upcoming episode, answer the question above by:

- Calling our Google Voice at +1 (929)500-1513 and leave a message 📞

- Sending a voice memo to pod@dev.to 🎙

- OR, leaving a comment here (we'll read your response aloud for you) 🗣

Please send in your recordings by Wednesday, May 5th at Midnight, ET (9 PM PT, 4 AM UTC)

#### Voice recordings will be given priority placement 😉