teleren/devto huggingface dataset:
Manage resource locks
Published: 2022-05-05 00:43:19

Task 1: Adding a Lock to the resource group and test deletion

- Sign in to the Azure portal.

- In the Azure portal, navigate to the resource group umarproject.

- You can apply a lock to a subscription, resource group, or individual resource to prevent accidental deletion or modification of critical resources.

- In the Settings section, click Locks, and then click + Add fill the details and click ok.

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

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

- Click Overview and click Delete resource group. Type the name of the resource group and click OK. You receive an error message stating the resource group is locked and can’t be deleted.

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

**Task 2: Test deleting a member of the resource group**

- Search for and select Storage accounts, and then  + Create

- On the Storage Accounts page +Create, pick the name of the resource group that was lock earlier and then fill in the  storage name. Leave the defaults for everything else. as shown in the below image

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/86ehuosai40f8k75aq3w.jpg)

- Click Review + Create to review your storage account settings and allow Azure to validate the configuration.

- Once validated, click Create. Wait for the notification that the account was successfully created.

- Wait for the notification that the storage account was successfully created.

- Access your new storage account and from the Overview pane, click Delete. You receive an error message stating the resource or its parent has a delete lock.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gky11s72a8f93dwlwklt.jpg)
**Note:** Although we did not create a lock specifically for the storage account, we did create a lock at the resource group level, which contains the storage account. As such, this parent level lock prevents us from deleting the resource and the storage account inherits the lock from the parent.

**Task 3: Remove the resource lock**

- Return to the umarproject resource group blade and, in the Settings section, click Locks.

Click Delete link to the far right of the umarproject entry, to the right of Edit.

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

- Return to the storage account blade and confirm you can now delete the resource.

**Congratulations! You created a resource group, added a lock to resource group and tested deletion, tested deleting a resource in the resource group, and removed the resource lock.
**
**Note: **To avoid additional costs, you can optionally remove this resource group. Search for resource groups, click your resource group, and then click Delete resource group. Verify the name of the resource group and then click Delete. Monitor the Notifications to see how the delete is proceeding.
🗞️ Java eclipse temurin:18.0.1_10-jre-alpine is out ! Now what ?
Tags: docker, java, infosec, devops
Published: 2022-05-05 01:57:41

## 🛡️ About

Java 18 is out since a few weeks. 

> Let's see how we can handle its integration in Docker images the Dev(Sec)Ops way 👇

## 🍿 Demo

[Eclipse Temurin](https://hub.docker.com/_/eclipse-temurin) is maintaining a rich collection of Java images.

See below how we are aware of required maintenant on our own images... and how we double check it is well secured with [`grype`](https://github.com/anchore/grype) : 

{% youtube https://youtu.be/dhhRxWpDWE0 %}


## 🔖 Related posts

{% embed https://dev.to/optnc/bench-and-choose-java-8-docker-images-with-anchoregrype-4fg8 %}

{% embed https://dev.to/optnc/grype-0350-new-feature-indicate-location-of-vulnerability-1pam %}

{% embed https://dev.to/optnc/about-java-bytecode-native-binaries-security-short-grype-benchmark-4ng9 %}

{% embed https://dev.to/optnc/dependency-management-automation-with-dependabot-3l62 %}
Feliz dia de Star Wars!
Tags: starwarsday, webdev, beginners, programming
Published: 2022-05-05 01:05:14

Olá, pessoal <3

Em comemoração ao [dia de Star Wars](https://canaltech.com.br/entretenimento/por-que-o-star-wars-day-e-celebrado-no-dia-4-maio-40537/) trouxe um post especial!

Quem me acompanha no instagram viu minha postagem comemorando e prometi colocar aqui no post alguns links de projetinhos legais com a temática Star Wars!
Vem comigo conferir!

1 - [Construindo uma galáxia com código](https://code.org/starwars)

Esse projetinho é voltado mais para pessoas que estão iniciando na programação, que ainda não possuem conhecimento em nenhuma linguagem específica. O code.org oferece gratuitamente exercícios de programação utilizando a programação por meio de bloquinhos, é muito legal para exercitar sua lógica e também o aprendizado para quem está iniciando. Esse projeto em especial é sobre Star Wars :D

2 - [Desenvolvendo a intro de Star Wars](https://medium.com/womakerscode/desenvolvendo-a-intro-do-star-wars-com-html-css-javascript-node-js-365e1232a169)

Sabe aquele famoso letreiro que aparece logo no início de todo filme de Star Wars? Nesse post a @glaucia86 ensina como reproduzir essa intro usando HTML, CSS e JS.

3 - [Jogo de Super trunfo usando os veículos de Star Wars](https://github.com/DevGirlsMentor/warship)

Esse projetinho foi criado pela comunidade [Dev Girls Mentor](https://dev.to/devgirlsmentor). O jogo já foi desenvolvido mas as meninas mantém as aulas de live coding gravadas [aqui](https://www.youtube.com/channel/UCInhCRdbbk-JgXEw0LoJeGw) então você ainda pode acompanhar e desenvolver junto <3
Lembrando que a comunidade tem um discord e lá tem os encontros e anúncios de novos projetos e muito mais então não deixem de participar da comunidade!

4 - [API Star Wars](https://swapi.dev/)

Se você já sabe consumir dados por meio de APIs saiba que existe uma API especialmente com dados sobre Star Wars [aqui](https://swapi.dev/) então você pode soltar a imaginação e criar projetinhos utilizando esses dados. (Exemplo: Um buscador de informações sobre os personagens)

Espero que vocês tenham gostado do post especial de Star Wars! 

May the 4th be with you!
HABILITAR EL INICIO DE SESIÓN DE ROOT A TRAVÉS DE SSH
Tags: devops, linux
Published: 2022-05-05 00:29:25

Inicie sesión en su servidor como root.
Como usuario root, edite el archivo **sshd_config** que se encuentra en  /etc/ssh/sshd_config

`vim /etc/ssh/sshd_config`

Agregue la siguiente línea al archivo, puede agregarla en cualquier lugar, pero es una buena práctica encontrar el bloque sobre autenticación y agregarlo allí.

`PermitRootLogin yes`

Guardar y salir del archivo.
Reinicie el servidor SSH:

`systemctl restart sshd`

¡Y eso es! Con la nueva línea agregada y el servidor SSH reiniciado, ahora puede conectarse a través del usuario root.

En este caso, podrá iniciar sesión como usuario root utilizando la contraseña o una clave ssh .
Compiler in C not Rust | Mufi Lang
Tags: c, programming, computerscience
Published: 2022-05-05 00:10:41

I haven't written in a while mostly because I've been busy, and spent my free time writing Mufi-Lang. 

I spent some time trying to figure out what language to write the byte code compiler in, and I felt the biggest fun would be writing it in C. One reason, I don't have much projects in C, two, I learned how to write a compiler in C, and three, why the hell not? 

Don't think I tried Rust, I really did, but too keep originality in my code, sticking with just standard library, I felt C was my shining knight. Now in no way am I saying C is a better choice, or Rust is one, I'm giving the lazy reasons of why I chose one over the other, and these reasons are based upon comfort. 

I have a lot of plans for Mufi, I plan to first release in Unix systems using a Python setup script, and I'll have to figure out things like Winget, Snap and such. I will also write documentation in markdown to get started, probably have a simple website on it. 

In `0.1.0` I do not anticipate of having any type of import system, and instead you'll just have to rely on the standard library that will mainly have file operations, math functions and such. 

This language will grow gradually, and I do want to get contributors to expand it's capability. I know it's not going to go big, but just writing it is an euphoria. 

The first release _Baloo_ will be expected to release in the next month or two, and after that updates will come in a release cycle. 

Check out the [repo](https://github.com/MKProj/Mufi-Lang) to see more of the project.
Diagrams as Code
Published: 2022-05-05 21:39:18

---
title: Diagrams as Code
published: true
date: 2022-05-05 00:00:00 UTC
tags: 
canonical_url: https://logs.zozo.dev.br/en/post/diagrams-as-code/
---

Come, come, come and find out how to generate diagrams using Python code!!

[Em Português 🇧🇷 🇵🇹](https://logs.zozo.dev.br/post/diagrama-como-codigo/)

In my day-to-day as an instructor, one of the jobs is to create diagrams that clearly illustrate the topic being presented to students, there are many good graphic tools online like [draw.io](https:/ /draw.io), [LucidChart](https://www.lucidchart.com), among others.

But despite these tools being very intuitive and easy to use, when you need to scale the creation of diagrams, need to create diagrams bringing information from external tools or even create simple diagrams quickly, you end up running into problems with formatting options and lack of automation of these tools, which make it difficult to create a “factory” of diagrams.

Thinking about this scenario, Python has a package that can be used to represent and generate diagrams as code, facilitating the creation of this “factory”.

The package is called [diagrams](https://diagrams.mingrammer.com) and it has a very interesting way of working, it makes use of Python’s operator overload to perform in a more intuitive way the connection that the nodes will have in diagram graphics. For example:

- The `>>` operator represents a right-to-left binding
- The `<<` operator represents a left-to-right binding
- The `-` operator represents a directionless binding
- And it’s still possible to make bidirectional bindings using the `Edge` class

If you’re looking for a more programmatic way to generate diagrams, this package is worth checking out.

Below are some examples I developed, which can be tested on [Google Colab](https://colab.research.google.com/drive/1MrlVVFXAAMvuQJ8m-qkyY05wnurAl5uQ?usp=sharing)

<script type="application/javascript" src="https://gist.github.com/ozorest/c19718ac3d3bdcd0cbc3c8a96d093e48.js"></script>
Adhere to H5P code style with ESLint
Tags: h5p, node, eslint, edtech
Published: 2022-05-04 23:13:08

## Overview
The [H5P GitHub](https://github.com/h5p) contains a [Dev Tools repo](https://github.com/h5p/h5p-dev-tools) containing PHP and ESLint config files. There is also a [H5P boilerplate code template](https://github.com/otacke/h5p-editor-boilerplate) with a slightly different `.eslintrc.json` config file.

This guide is for anyone using the above resources to create their own H5P content types while following the H5P specified coding style, and for people that may be unfamiliar with ESLint. 

## Process: MacOS and VSCode
I'm using the ESLint CLI and the [VSCode extension](dbaeumer.vscode-eslint). Navigate to the root of your content type and run `npx eslint -h` to see a list of available commands. To use the config included in any boilerplate code linked above, run `eslint -c myconfig.json myfiletotest.js` the proper names of your files. Reference the docs [Using Configuration Files](https://eslint.org/docs/user-guide/configuring/configuration-files#using-configuration-files) for more information. You should then see your linting errors in the terminal.
Hoisting in Javascript
Tags: javascript, programming, tutorial, beginners
Published: 2022-05-04 23:10:58

In javascript, hoisted objects are objects that can be accessed before their declaration in the code without javascript throwing an error complaining about it.
some things can be hoisted like variables, functions and classes

## Variables declared with var
if we try to access a variable declared with var before it's declaration in the code it's value will be **undefined**
```javascript
console.log(name); //undefined
var name = "John";
```
again javascript will set that variable to undefined instead of throwing an error

## Variables declared with let and const
these variables are not hoisted and will cause an error if accessed before declaration
```javascript
console.log(name); //reference error: name is not defined
const name = "John";
```
## Functions
functions are also hoisted and their value will be the function itself which means it can be used perfectly before declaration
```javascript
sayHi(); //Hi
function sayHi() {
   console.log("Hi");
}
```

However arrow functions are not hoisted even when declared with var
```javascript
sayHi(); // sayHi is not a function
var sayHi = () => console.log("Hi");
```

## ES6 Classes
classes are not hoisted and will cause an error when accessed before declared
```javascript
const person = new Person(); //cannot access 'Person' before initialization

class Person {
  constructor() {}
}
```

## Summary
**var variables**: hoisted and undefined by default
**const variables**: not hoisted
**functions**: hoisted and can be used
**arrow functions**: not hoisted
**classes**: not hoisted
Microservices
Tags: appwritehack, javascript, node, codereview
Published: 2022-05-04 22:46:16

### Overview of My Submission
So basically I was exploring the concept of Microservices few days back ago to learn about how we can achieve the Microservice architecture for large scale applications and how we can reduce the dependences of multiple modules on one another and in a mean time I found out about Appwrite tool which is really helpful for backend services so I decide to explore it and found out that i can host my Microservice server to Appwrite with all features like authentication, encryption, predefine functions etc. My main concept of the submission is to divide the server in microservice module so that is any module break\no available user can still do some actions on website\app so their will be no restrictions or any performance issue. 

> My project is still in under development 


### Submission Category: 
Wacky Wildcards


### Link to Code
{% embed https://github.com/zaahmed-nisum-com/microservice-servers %}


### Additional Resources / Info
Postman for API's testing
Why 1 Good UX Is Worth 5 Engineers w/ Toast's Brad Pielech
Tags: ux, podcast, management, techtalks
Published: 2022-05-04 22:05:47

*We want to make the Dev Interrupted podcast a vital, enjoyable part of your week.* ***Please take 2 minutes and answer our new [Listener Survey](https://www.surveymonkey.com/r/PRYRNC5).*** *It lets us know a bit about you, what you want from Dev Interrupted and what you want from podcasts in general!*

Few companies have mastered making products consumers actually want to use like Toast.

A $30 billion giant in the tech-food business, Toast faced their worst case scenario during the pandemic when the restaurants at the heart of their business were all forced to shut down.

Toast rose like a phoenix to become one of the best success stories of pivoting during the pandemic by making users love using their food delivery systems.

To understand how Toast became one of the great success stories of the last 2 years, we spoke to Brad Pielech, the company’s Director of Engineering.

An amazing conversation that’s informed how we think about product at LinearB, Brad made a flawless case for the importance of UX - and why the alliance between UX and devs at Toast produced a market-beating pivot that took the company from unicorn to brink of collapse and back again.

{% spotify spotify:episode:1hvbIaIEVFlHLSETyXfkmt %}

## Episode Highlights Include:
* (1:13) Dan & Brad's history at Cloudlock
* (5:48) Secret to building & maintaining relationships in a remote world
* (10:21) Why engineers should make friends with their Legal Dept.
* (18:00) One good UX is worth 5 engineers
* (20:29) The Triad Team Model: Eng + Design + Product
* (33:08) How Toast survived the pandemic
* (37:57) Change can be scary for engineers
* (45:51) Support local restaurants!

***Starved for top-level software engineering content? Need some good tips on how to manage your team? This article is inspired by [Dev Interrupted](https://devinterrupted.com/podcasts/) - the go-to podcast for engineering leaders.***

*Dev Interrupted features expert guests from around the world to explore strategy and day-to-day topics ranging from dev team metrics to accelerating delivery. With new guests every week from Google to small startups, the Dev Interrupted Podcast is a fresh look at the world of software engineering and engineering management.*

[***Listen and subscribe on your streaming service of choice today.***](https://devinterrupted.com/podcasts/)

![https://devinterrupted.com/podcasts/](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gl8yy3hpnevlyboet97b.png)
Day 26: errors errors errors!
Published: 2022-05-04 22:03:20

Hi!
this is an unusual day of errors everything that I was supposed to work on for today nothing is passing and I don't even now why :( the paper that I'm working is getting more closer to me and I still have a long way to go with no motivation at all
I think I'm going to need that super human power that I'm always talking about 
I'm not even thinking clearly. Tomorrow I will need to use take priorities and try to level up with the paper maybe work on the errors if possible but for now I gotta run 
signing off...
Adding sudo to windows
Published: 2022-05-04 21:41:44

---
title: Adding sudo to windows
published: true
description: Using commands similar to sudo in windows
tags: 
//cover_image: https://direct_url_to_image.jpg
---
It is sometimes annoying to open a terminal in windows with elevated privileges as you have to rely on some form of GUI to select the option `Run as Admin`. In Linux we can just open the terminal with a hotkey and then get root access straight with `sudo` from the same terminal.

In windows, there's a tool called [`gsudo`](https://stackoverflow.com/a/58753166/7358595) that allows us to turn our normal cmd or powershell terminal into an administrative terminal just like `sudo` does in Linux. So, we just prepend whatever command we like to run with `gsudo` and it will show us a User Access Control(UAC) pop-up where we can insert our username and password. [Usage](https://github.com/gerardog/gsudo#usage)

To make `gsudo` work more like `sudo` in linux, we can enable credentials cache that will show less UAC popups just like in Linux where `sudo` remembers your password for 15 minutes by default.
```powershell
gsudo config CacheMode Auto
```
Amazon Elastic Beanstalk Woes
Tags: aws, elasticbeanstalk
Published: 2022-05-04 21:35:30

Lots of head-banging today, trying to get a PHP app up & running.

First, my app has its webroot in a sub-directory. I could not get `.ebextensions/nginx/nginx.conf` or `.ebextensions/nginx/conf.d/mysettings.conf` to specify the `root`. I ended up finding a configuration in Elastic Beanstalk itself that specified the webroot, so I was able to set it to `/var/app/current/[MYSUBDIR]`. But it took lots of attempts before I got that right.

Now I'm trying to get npm installed so I can install some files I have in my package.json, but npm depends on nodejs, which when I try to install this, it complains that it requires libuv >= 1:1.43.0. So now I gotta figure out how to either fast-forward the Amazon AMI to [this version](https://docs.aws.amazon.com/linux/al2022/release-notes/all-packages-al2022-20220419.html) that has that version of libuv, or compile/install libuv directly, or install a downgraded version of nodejs. But I mean ... com'on ... I'm just trying to get npm installed. Why is this so difficult?

Not a good day ... I'm thinking if I ever do get this all figured out, I'll publish some straight-forward docs.
PHP functions strcspn() and strspn()
Tags: php, webdev, tutorial
Published: 2022-05-04 21:10:02

## Function strcspn()

The function `strcspn()` finds the length of initial segment not matching mask.

In the code snippet below, we want to find the prefix length of a UK post code. `CF34 9LH` is the post code string and the disallowed character list is `0123456789`. The function `strcspn()` is called to find the length of the initial segment that does not contain any numbers. So, `CF` is the string segment and the length is 2.

```php
$p = strcspn('CF34 9LH', '0123456789');
echo "The length is " . $p;
//The length is 2
```

You can then easily get the prefix of a post code like this:

```php
$postCode = 'CF34 9LH';
$postPrefix = substr($postCode, 0, strcspn($postCode, '0123456789'));
echo "The prefix is " . $postPrefix;
//The prefix is CF
```

You can also use the function `strcspn()` for checking a file name whether it contains any invalid characters.

```php
$str = "filename123$/@456";
$invalidChars = "\\/*@$";
$validLen = strcspn($str, $invalidChars);

if ($validLen != strlen($str)) {
    echo "Invalid character found at position " . $validLen;
    //Invalid character found at position 11
}
```

In the above code snippet, since the file name string `$str` contains invalid characters, the length of the initial segment, i.e. `filename123`, is not the same with the whole file name string. The error message is therefore printed out.

## Fuction strspn()

On the contrary, the function `strspn()` gets the length of the initial segment of a string, which consists entirely of characters contained within a given mask.
...

For the rest of the content, please go to the link below:
[https://www.codebilby.com/blog/a40-php-functions-strcspn-and-strspn](https://www.codebilby.com/blog/a40-php-functions-strcspn-and-strspn)