teleren/devto huggingface dataset:
Deploying landing pages using GitHub Actions and Azure Static Web Apps
Tags: actionshackathon, github, opensource
Published: 2021-12-01 19:38:19

---
title: Deploying landing pages using GitHub Actions and Azure Static Web Apps
published: true
description: My submission to the GitHub Actions x DEV Hackathon!
tags: actionshackathon, github, opensource
---

In this article, you will learn how to deploy and create a continuous integration in GitHub using GitHub actions and Azure  static web apps.
First, we need a lading page or static site that only uses html, css and JS. 

In the GitHub repo, we need to create a workflow in the folder .github/workflows. 
https://github.com/Mteheran/landingpagetoazure

### My Workflow
In this workflow, we detect changes over the main branch and pull requests against this branch. In the property "app_location"  you need to set the folder where your app is located or just use "/" if it is located in the base path. 

``` yml
name: Azure Static Web Apps for Static Sites

on:
  push:
    branches:
      - main
  pull_request:
    types: [opened, synchronize, reopened, closed]
    branches:
      - main

jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    name: Build and Deploy Job
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
          repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
          action: "upload"
          app_location: "/union" # App source code path
          skip_app_build: true

  close_pull_request_job:
    if: github.event_name == 'pull_request' && github.event.action == 'closed'
    runs-on: ubuntu-latest
    name: Close Pull Request Job
    steps:
      - name: Close Pull Request
        id: closepullrequest
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
          action: "close"

```
We are using the secret AZURE_STATIC_WEB_APPS_API_TOKEN to deploy azure static web apps. After creating a new Azure static site, you just need to get the token to deploy the site.
![Azure static web app deploy token](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/26a4mcydqn5kd6fas393.png)

In the settings of the project, you need to create this key, copying the value from Azure static web apps. 
![Key settings in GitHub](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z4dg2tndyegy7zwir8yq.png)


### Submission Category: 
[Note]: # DIY Deployments


### Yaml File or Link to Code
{% github Mteheran/landingpagetoazure %}


### Additional Resources / Info

Link to the template (union): https://www.designbombs.com/freebie/union/
Terraform: Compare lists of maps for equality
Tags: terraform
Published: 2021-12-01 19:34:02

---
title: Terraform: Compare lists of maps for equality 
published: true
description: use terraform functions to compare 2 lists of maps for equality
tags: #terraform
//cover_image: https://direct_url_to_image.jpg
---

Say you want to compare 2 lists with n maps in them. You're not sure, in fact you're certain, that the order cannot be relied upon. How can do do this?

The term is [_Symmetric Difference_](https://www.terraform.io/docs/language/functions/setsubtract.html#set-difference-symmetric-difference-). I figured this out as part of my delve into [terraform test](https://www.terraform.io/docs/language/modules/testing-experiment.html). Here's how you can do it:

main.tf:
```terraform
locals {
  tag_set_1 = [
    {
        "Key": "workspace",
        "Value": "default"
    },
    {
        "Key": "terraform",
        "Value": "true"
    },
    {
        "Key": "environment",
        "Value": "drew"
    }
]

tag_set_2 = [
    {
        "Key": "workspace",
        "Value": "default"
    },
    {
        "Key": "environment",
        "Value": "drew"
    },
    {
        "Key": "terraform",
        "Value": "true"
    }
]
}

output equality_check {
  value = length(setunion(setsubtract(local.tag_set_2, local.tag_set_1), setsubtract(local.tag_set_1, local.tag_set_2))) == 0
}

```

Try it out!
```
$ terraform apply
Outputs:
equality_check = true
```

Try it out locally using `terraform console` (instead of `terraform apply`:
```
$ echo 'length(setunion(setsubtract(local.tag_set_2, local.tag_set_1), setsubtract(local.tag_set_1, local.tag_set_2))) == 0' | terraform console

true
```
TypeScript used to be on my $#!% 💩 list  
Tags: typescript, javascript, webdev, discuss
Published: 2021-12-01 19:20:44

## JavaScript (JS)
JS - a high-level, ECMAScript, interpreted / just-in-time compiled programming language developed by Brendan Eich of Netscape. Not to be confused with [Java](https://dev.java/).

> JavaScript was initially created to “make web pages alive”.

* well known - JS is almost as old as the internet
* JS is an OOP (object oriented programming) language
* JS is single-threaded
* but JS is weakly and dynamically typed

👩🏽‍💻 (me): Good ol' [JavaScript](https://www.javascript.com/), what more can I say about one of the worlds most popular scripting language? 🌎 (world): **Learn to [TypeScript](https://www.typescriptlang.org/) or GTFO**.

So I started learning TypeScript. Not gonna lie it was so painful in the beginning. I hadn't been working with JS long enough, understand JS well enough, or become annoyed enough by all the silly JS errors / browser compatibility issues to appreciate something like TS. 

> Thus, TS **was** very much so on my 💩 list, but I have since seen the light. 

## TypeScript (TS)
TS - a strongly typed programming language developed by Microsoft that builds on JavaScript, giving you better tooling at any scale.


### Editor Checks
Suddenly debugging was less of a nightmare with editor checks, because if TS doesn't like it, it wont compile.

```
const user = {
  id: l334,
  firstName: "Nicole",
  lastName: "Nobles",
  job: "Web developer",
}

console.log(user.name)
```

JS doesn't know to alert me that user doesn't have a name property.
 
but with TS I get an error:
`Property 'name' does not exist on type { firstName: string; lastName: string; job: string }`

### Auto-complete
No more guessing what properties are on an object.

### Interfaces
If I made a User interface I can't add / remove any required properties to the object. 

*Note: adding `?` after a property makes it optional.

```
interface User {
  id: number
  firstName: string
  lastName: string
  job: string
  remote?: boolean
}

function updateUser(id: number, update: Partial<User>) {
  const data = getUser(id)
  const user = { ...data, ...update, city: "Hachiōji" }
  saveUser(id, user)
}
``` 
TS will rightfully complain that 'city' does not exist on interface 'User'.

This only the tip of the TS iceberg. Don't take my word for it, you can check out the documentation [here](https://www.typescriptlang.org/docs/).

## Conclusion
Once given a proper chance TypeScript has been amazingly helpful at saving me time and hard ache with features Editor Check, Auto-complete, and Interfaces. I won't lie sometimes I just slap `any` on things and call it a day, but it eats away at me until I get it typed like the rest of the project. 

So, **Keep calm, and Type(Script) on**. Thanks for reading! 😊
Welcome Thread - v153
Tags: welcome
Published: 2021-12-01 19:15:04

---
title: Welcome Thread - v153
published: true
description: Welcome to DEV! A thread of hellos and intros.
tags: welcome
canonical_url: 
---

![Cow saying hi](https://media.giphy.com/media/xT1XGDKwOxacd92rYI/giphy.gif)

### Welcome to DEV!

1. Leave a comment below to introduce yourself! You can talk about what brought you here, what you're learning, or just a fun fact about yourself.

2. Reply to someone's comment, either with a question or just a hello. 👋 

**Great to have you in the community!**
Build 30 JavaScript projects in 30 days:Day 0
Tags: javascript, webdev, beginners, programming
Published: 2021-12-01 19:09:51

This is building 30 projects in 30 days series. I'll be following Wes Bos Javascript30 course for this challenge,the link to which is: https://javascript30.com/.

I'll be sharing my approach in every article which may or may not be same as the one mentioned in his videos.

Before starting with this series I'd recommend you to download the starter files in your device, the link to which is [here](https://github.com/wesbos/JavaScript30)

**<u>Process to download starter files -></u>**
1. **Fork** the repo by clicking the option in the top right.
2. **Clone repo:** 

  2.a. If you have <u>github desktop</u> installed (which I recommend as it is easier to work with), click on the green colored 'code' option and then click open with gitub desktop. Now the application will automatically clone the repo to your device. After cloning they'll be two options on your screen-> contribute to parent project ( choose this if you want to make contribution to the repo, which in this case, you're not) . Second, for your own use. Choose this one.

 2.b. <u>Using git bash:</u> Refer to this [article](https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository) 

Now go to the folder where repo has been cloned and congrats there is your starter package! You can copy and paste all the sounds,images etc. to your project folder as per your requirements and use them in your projects.


This is it for today. In my next article, I will discuss the first project, which is a DrumKit.

If you have any doubts or suggestions please do let me know in the comment section. I'll be more than happy to interact with you. 

If you like this series and want to be a part of it, do consider following me at @prachigarg19

Thanks for reading. :)
Living in the Shell #7; zip
Tags: productivity, linux, bash, devops
Published: 2021-12-01 19:09:07


## `zip` 🗜️

Creates ZIP archives.

## Test archive integrity `-T`

```sh
zip -T x.zip
```

## Create/update zip archive (add/update file)

```sh
zip x.zip ~/.bashrc ~/.profile
```

> Creates `x.zip` archive file (if not exist) and adds `.bashrc` and `.profile` to it.

## Add directory and its content `-r`

```sh
zip -r x.zip ~/Documents
```

> Without `-r` nothing is added.

## Add all names except directories `-D`

```sh
zip -D x.zip ~/*
```

## Set password while add/update files `-P`

```sh
zip -P my-password x.zip file-to-add-or-update.txt
```

## Store-only mode (fast, without compression) `-0`

```sh
zip -0 x.zip ~/Pictures
```

## Fast compression mode (fast, low compression) `-1`

```sh
zip -1 x.zip ~/Pictures
```

## Ultimate compression mode (slow, maximum compression) `-9`

```sh
zip -9 x.zip ~/Pictures
```

## Delete file from archive `-d`

```sh
zip -d x.zip .bashrc
```
How to Evaluate the Maturity of DevOps Practices in your Company?
Tags: technology, softwaredevelopment, programming, devops
Published: 2022-07-17 13:54:53

---
title: How to Evaluate the Maturity of DevOps Practices in your Company?
published: true
date: 2021-12-01 18:58:59 UTC
tags: technology,softwaredevelopment,programming,devops
canonical_url: https://faun.pub/how-to-evaluate-the-maturity-of-devops-practices-in-your-company-58a1ff7246a2
---

[![](https://cdn-images-1.medium.com/max/2293/0*4y6BdmnidegknODW)](https://faun.pub/how-to-evaluate-the-maturity-of-devops-practices-in-your-company-58a1ff7246a2?source=rss-6e21f0d290d1------2)

Discover SMART Maturity Assessment Inspired by Lean Manufacturing

[Continue reading on FAUN Publication »](https://faun.pub/how-to-evaluate-the-maturity-of-devops-practices-in-your-company-58a1ff7246a2?source=rss-6e21f0d290d1------2)
AWS IAM managed policies for Amazon DynamoDB
Tags: database, nosql, security, aws
Published: 2021-12-01 18:58:31

For application access, please do not use the AWS provided managed IAM policies for Amazon DynamoDB, both "AmazonDynamoDBReadOnlyAccess" and "AmazonDynamoDBFullAccess". I know it is tempting, but please don't do it. These built-in AWS managed IAM policies are designed for use in the AWS Console and therefore have more permissions than most applications should have access to.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/17kqsfmocbegyzcl2twi.png)

In order to follow least privilege security conventions, it is best practice to create your own custom IAM policy for DynamoDB access by an application. If this is something you have never done before, don't be intimidated. I got ya. To get you started, [here are a few templates](https://github.com/aws-samples/aws-dynamodb-examples/tree/master/DynamoDBIAMPolicies) I created to use to enable *full* access to only Amazon DynamoDB table resources. Ultimately you should narrow access in the policies you crate down to just the operations the app needs to do on DynamoDB.
Knowing Where to Start
Tags: javascript, beginners, flatiron
Published: 2021-12-01 18:45:51

I've discovered as of late that **knowing where to start is half the battle**.

When I am approaching a function I need to write for a lab, I can think of the different methods I need to use to complete the assignment, but I struggle a lot with knowing where to start. I might try working backwards for a change, starting with defining what I need to see in my output and working back from there.

Has anyone else faced this kind of hurdle? How did you overcome it? Practice, practice, practice?
Microsoft Orleans - Orleans.SyncWork now a part of OrleansContrib
Tags: programming, c, netcore, microsoftorleans
Published: 2022-12-15 17:19:47

---
title: Microsoft Orleans - Orleans.SyncWork now a part of OrleansContrib
published: true
date: 2021-12-01 18:40:00 UTC
tags: programming,c,netcore,MicrosoftOrleans
canonical_url: https://blog.kritner.com/2021/12/01/microsoft-orleans-orleans-syncwork-now-a-part-of-orleanscontrib/
series: Microsoft Orleans

---

The package I wrote about in [this post](/2021/11/22/microsoft-orleans-long-running-cpu-bound-work/) is now a part of the [OrleansContrib](https://github.com/OrleansContrib) organization!

This is a pretty short post, I think, but after a [tweet](https://twitter.com/RLHammett/status/1461814378710409217) about the release of [Orleans.SyncWork](https://github.com/OrleansContrib/Orleans.SyncWork), there was a bit of back and forth in the thread:

![back and forth in a twitter thread](https://blog.kritner.com/2021/12/01/microsoft-orleans-orleans-syncwork-now-a-part-of-orleanscontrib/tweet.PNG)

I reached out to Reuben shortly after, and now the repository is a part of the OrleansContrib organization! I don’t think this actually means anything of super significance, but it’s pretty cool! Maybe the package will now get better visibility!

That’s it!

## Resources:

- [Microsoft Orleans - Long running CPU bound work](/2021/11/22/microsoft-orleans-long-running-cpu-bound-work/)
- [OrleansContrib/Orleans.SyncWork](https://github.com/OrleansContrib/Orleans.SyncWork)
Apama Advent Calendar - 01 Dec 2021 - Finding information
Tags: apama, iot, cumulocity
Published: 2021-12-03 11:47:45

---
title: Apama Advent Calendar - 01 Dec 2021 - Finding information
published: true
date: 2021-12-01 18:14:07 UTC
tags: #apama, #iot, #cumulocity
canonical_url: https://tech.forums.softwareag.com/t/apama-advent-calendar-01-dec-2021-finding-information/253610
---

Seasons Greetings!

This is Day #1 of a short series of brief tips, tricks, hints, and reminders of information relating to the Apama Streaming Analytics platform, both from Software AG as well as from the community.

Since we’re at Day #1, let’s start with some basics of where to find documentation relating to Apama:

- [Apama product site at Software AG](https://www.softwareag.com/en_corporate/platform/iot/apama.html)
- Official Documentation (currently for version 10.11) ([HTML](https://documentation.softwareag.com/apama/v10-11/apama10-11/apama-webhelp/index.html), and [PDF](https://documentation.softwareag.com/apama/v10-11/index.htm))
  - [A copy of the documentation](https://www.apamacommunity.com/docs/) on the [Apama Community](https://www.apamacommunity.com/) site
- [Training from Software AG](https://knowledge.softwareag.com/)
- Software AG [Tech Community](https://techcommunity.softwareag.com/en_en/apama.html) for Apama

If you are using Apama within the Cumulocity IoT platform, then you can find addition information relating to the microservice and the Streaming Analytics web application below:

- [Streaming Analytics Overview in the Cumulocity IoT Guides](https://cumulocity.com/guides/apama/overview-analytics/)

In the coming days we’ll be picking out specific topics of interest, at time referring to information within the above documentation sites, or reminding you of blog posts.

Note: some posts may be published a day or two early or late (e.g. Mon-Fri) so you may find you have bonus days with more than post!

[Read full topic](https://tech.forums.softwareag.com/t/apama-advent-calendar-01-dec-2021-finding-information/253610)
The best way to get the last element of an array:
Tags: javascript, webdev, programming, tutorial
Published: 2021-12-01 17:57:34

EDIT: Safari does not support it ,_, 
But use it in Node js or with a bundler!

So some people would say:

```
array[array.length-1]
```

But I'd say:

```
array.at(-1)
```
The Performance of both is the same.

MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at
Redux: Copy an Object with Object.assign
Tags: javascript, webdev, beginners, react
Published: 2021-12-01 17:33:11

* The last posts worked with arrays, but there are ways to help enforce state immutability when state is an object. A useful tool for handling objects is the `Object.assign()`
* `Object.assign()` takes a target object and source objects and maps properties from the source objects to the target object.  This is used to make shallow copies of objects by passing an empty object as the first argument followed by the object(s) you want to copy.

* Example:
```React
const myObject = Object.assign({}, obj1, obj2);
```
* This creates `myObject` as a new `object`, which contains the properties that currently exist in `obj1` and `obj2`.

* Code:
```React
const defaultState = {
  user: 'CamperBot',
  status: 'offline',
  friends: '732,982',
  community: 'freeCodeCamp'
};

const immutableReducer = (state = defaultState, action) => {
  switch(action.type) {
    case 'ONLINE':
      // Don't mutate state here or the tests will fail
      return
    default:
      return state;
  }
};

const wakeUp = () => {
  return {
    type: 'ONLINE'
  }
};

const store = Redux.createStore(immutableReducer);
```
* Here we have a Redux state and actions that were modified to handle our `object` situation. We need to edit the code to return a new `state` object for actions with the type `ONLINE`, which set the `status` property to the string `online`

*Answer:
```React
const defaultState = {
  user: 'CamperBot',
  status: 'offline',
  friends: '732,982',
  community: 'freeCodeCamp'
};

const immutableReducer = (state = defaultState, action) => {
  switch(action.type) {
    case 'ONLINE':
      const myObject = Object.assign({}, state, {status: 'online'})
      return myObject;
    default:
      return state;
  }
};

const wakeUp = () => {
  return {
    type: 'ONLINE'
  }
};

const store = Redux.createStore(immutableReducer);
```
Larson, Q., 2019. Frontend Development Libraries. [online] Freecodecamp.org. Available at: https://www.freecodecamp.org/learn/front-end-development-libraries/redux
Get rid of try-catch in server-side development, here's a better way!
Tags: javascript, node, webdev, react
Published: 2021-12-01 17:32:55

**PS: This write-up goes well with node.js or express.js development** 

We'll go knocking on the try-catch statement door whenever we encounter an asynchronous function in javascript - the traditional way. It is and will always be the backbone to handling async-await functions in server-side development.
It has been of great help when we had to avoid the callback function and got us out of callback hell several times.

But what if we can enhance this and make the try-catch statements shorter and cleaner. Here goes our typical way of handling things.

```
async function main(req, res, next) {
  try {
    var result = await doSomething();
    console.log(result);
  } catch (error) {
    console.error(error);
  }
}
```

Being Javascript developers, we are familiar with the above code, `result` is printed to the console if everything goes smooth or else `error` gets printed - :cake:


### A Cleaner Alternative

Say if we're using Express framework and handling requests using try-catch, here's something cleaner and simpler that can be replaced for the never-ending lengthy statements.

```
const catchAsync = (fn) => (req, res, next) =>{
    Promise.resolve(fn(req, res, next)).catch((err) => next(err));
});

```

`catchAsync` function can be considered as a middleware that just accepts the parameters (req, res, next). If there's any error, then it returns the error.

This is how we can call our enhanced error catching function to avoid try-catch statements. 

```
const sampleFunction = catchAsync(async (req, res) => {
           const awaitedResponse = await getResponse();
           res.send(awaitedResponse);
});

```


`catchAsync` can be called anywhere we need to implement our traditional try-catch logic. Let's keep enhancing our good old lengthy statements and make javascript simpler for budding developers
dev.to init
Tags: writing, product, programming, beginners
Published: 2021-12-01 17:32:44

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wyxmz4t6pxuhdpebjyf1.png)
 
```php
function helloWorld()
{
    echo 'hello dev';
}
```

`npm run dev`
League of Legends!
Tags: vue, programming, beginners, javascript
Published: 2021-12-01 17:31:58

Hi!
Practice is the best way to learn. I began with VueJs and I have just been a public League of Legend web clone.
You can get a preview at [league-of-legends-clone](https://github.com/thuongtruong1009/league-of-legends-clone).
If you like this, let it be a star bonus to support me!
Thank you very much!
Happy coding 😊
LaTeX & Macros: Macros with Optional Arguments
Tags: codenewbie, latex
Published: 2021-12-01 17:28:52


Hello, how are you? :) 

In this post I tell you 
- How to create macros with optional arguments

We have seen that we can create our own instructions, [macros without arguments](https://dev.to/latexteada/latex-macros-creating-macros-macros-without-arguments-4338), and [macros with arguments](https://dev.to/latexteada/latex-macros-macros-with-arguments-2a42). Sometimes is convenient to set a *default argument* in a macros and modify it just when we need it, that is what we are going to learn today 

## Optional Arguments 

### Macros with one argument

The general structure of that is 

```LaTeX
\newcommand{name}[Narg][default]{instructions}
```
- `name` is the name of the command
- `Narg` is the number of arguments 
- `default` is going to be the value which will be the default value, but, also, the argument which will change
- `instructions` is what the command will do 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m2wekdh20bhzhu7991xj.png)

Produces 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p72y2ge0yp1h18lq39jn.png)
  
Did you notice? If we want to change the argument we use `[]` instead of `{}`

> If we do not specify the argument it will show the default command, but if we change, the instruction will change 

### Macros with multiple arguments 

We already know how to *set an optional argument* but with macros with one argument, what if we want a macros with multiple argument?

> ***Only the first argument*** may be optional

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ttt442c8ln35645jc319.png)

Produces 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sfhafrqg4zmok7qink3l.png)

We need to call the optional argument with `[]` as the previous example

This is all for today. 

Do not forget to follow me on Twitter `@latexteada`

Greetings :)