teleren/devto huggingface dataset:
How to add and remover items from a list
Tags: python, programming
Published: 2021-06-11 02:10:45


Iam learning how to use lists in pyhton, but iam having problems with my code, that´s about a grocery cart.
while True:
    n = input().split()
    comand = input()
    lista = [n]
    if comand == 'show':
        lista.sort()
    if comand == 'add':
        lista.append(input())
    if comand == 'remove':
        lista.pop()
    if comand == 'terminate':
        break
print(lista)

show == show itemns in ascending order
add == adding a new number
remove == removing a number of the list
terminate == exit


if you cannot help thanks for just read my problem :)
Learning faster with Cone of Learning
Tags: career, motivation, writing, leadership
Published: 2021-06-11 02:09:54

How many times have you wondered how you could learn something faster, understand it easier, remember easier? Well, this text is not an answer to these questions for you.

This text is, actually, a set of learning around the Cone of Learning that helped me to understand and improve my way of learning, developing, improve myself.

**TL;TR**
Cone of Learning is a visual representation of two forms of learning: active and passive. It was developed by Edgar Dale  with the purports to inform viewers of how much people remember based on how they encounter information.

![Cone of Learning Example](https://i.imgur.com/GTcOzVZ.png)

**Active and Passive Learning**
Briefly, the active learning way encompasses activities that when done return a higher result. Passive Learning, on the other hand, encompasses those where your return will not be so high.

**Riding a bike**
In practice, let's imagine that you want to learn to ride a bicycle. You can pick up and read articles about, watch videos, tutorials. That would be a passive way to learn. And consequently, the return of what you want will take a little longer (in this case I believe it is even difficult to have this return).

At that moment a friend looks at you and says “you need to learn by doing if you want to ride a bike one day”. We then have our active form.

The cool thing about the cone of learning is that you can apply it in any scenario in life and you can also combine both forms of learning to achieve the desired result.

**In Code**
I like to use the same concept for code. I spent a lot of time reading, watching tutorials, courses, and so on. Time passed and I didn't feel that it helped me to move forward. When I decided to start breaking down, doing real things, applying ideas, that's when I evolved.

**Career**
I sought to find a place where I could start applying these concepts in real life. So, if I could advise you, I would tell you to go to places where you can and have the freedom to code, apply concepts, live the real life.

A place where you break the master, make a wrong commit, spend more time on an issue because [you were in the wrong file](https://dev.to/beatrizoliveira/issue-1-i-was-editting-the-wrong-filename-35n6). Because you will only avoid this in the future once you've been through it or gone through it with you.

In our team we say that we are not smarter, we have only been through that before.
Swiftly learning Swift continued: Where clause, logical Operator , for-in loop and stride function
Tags: swift, beginners
Published: 2021-06-11 02:01:30

Quick overview: Today, I was introduced to where clause. At first glance I didn't know what I was viewing. LOL. But after reading it made sense. Logical operators && , || and ! wasn't something new to me but good as a refresher. The for-in loop and stride function is amazing ! 

The swift language is so easy to grasp (well so far). I still have some topics to read about like: arrays and sets, dictionaries, functions, structures and classes.This weekend I'm going to try and start the beginning works of an app that I've had in mind. 

Until next time !
Remap Caps Lock to Escape or Control
Tags: vim, emacs, mac
Published: 2021-06-11 01:00:34

## Emacs

`Caps Lock` to `Control`
```
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x7000000E0}]}'
```

## Vim

`Caps Lock` to `Escape`

```
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}'
```

This seems to not affect external keyboards in my setup. If you know a fix, please drop a comment!

## Reset

`Caps Lock` to `Caps Lock`

```
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000039}]}'
```

## Learn More (Remap Other Keys)

https://developer.apple.com/library/archive/technotes/tn2450/_index.html

Credits: https://superuser.com/a/1405422
SQL Server on Linux via Docker
Tags: sqlserver, linux, docker
Published: 2021-06-11 00:09:19

---
layout:     post
title:      SQL Server on Linux via Docker
subtitle:   Reference post for getting SQL Server Linux up and running
comments:   true
author:     Mark Roxberry
excerpt:    Running SQL Server on Linux for Docker Engine
tags:       [sqlserver, linux, docker]
categories:
   - linux
   - docker
   - sqlserver
postimage: 
    src: "post.png"
    alt: "main post image"
canonical_url: https://roxberry.dev/linux/docker/sqlserver/2017/08/25/sql-server-linux-notes/
featured:   true
---
1. Get [Docker](https://www.docker.com/) (if it is not already running)

1. Get the SQL Server on Linux for Docker Engine image

   I'm running Docker on MacOS, I will use the SQL Server on Linux for Docker Engine at [Docker Hub](https://hub.docker.com/r/microsoft/mssql-server-linux/)

   ```
   docker pull microsoft/mssql-server-linux
   ```

1. Set the settings and start the container

   SQL Server on Linux for Docker Engine requires an environment setting to accept the EULA and set a strong SA password:

   ```
   ACCEPT_EULA = Y
   SA_PASSWORD = <your password>
   ```

   Run this in the terminal:

   ```
   docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -d microsoft/mssql-server-linux
   ```


1. Copy a backup to the container

   ```
   docker cp '/tmp/DatabaseName.bak' mssql-server-linux:/tmp
   ```

1. Restore the backup

   ```
   RESTORE DATABASE DatabaseName FROM DISK='/tmp/DatabaseName.bak'
   WITH MOVE 'DatabaseName' TO '/var/opt/mssql/data/DatabaseName.MDF',
   MOVE 'DatabaseName_log' TO '/var/opt/mssql/data/DatabaseName_log.ldf'
   Go
   ```

1. Connect with a docker command or an IDE like [DataGrip](https://www.jetbrains.com/datagrip/)

![JetBrains DataGrip IDE](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k3qq79gwuc4at1eukk9n.png)

Using SQL Server for Linux in Docker has allowed me to continue to develop using a Linux distro or macOS without needing to set up a VM to run the database backend.
From the message queue: What is the best company to work for as a beginner?
Tags: career, job
Published: 2021-06-13 18:57:55

---
title: From the message queue: What is the best company to work for as a beginner?
published: true
date: 2021-06-11 00:00:00 UTC
tags: career,job
canonical_url: https://jhall.io/archive/2021/06/11/from-the-message-queue-what-is-the-best-company-to-work-for-as-a-beginner/
---

I was recently asked a question by Joshua (slightly edited). He is still studying, but now looking forward to his first serious job search.

> I have a question. If you dont mind asking Which is the best company to work as beginner. I am trying to look to get in a couple of company types:
> 
> - Consulting. Kind of B2B where I can work in different project and will have a huge learning.
> - Engineer. Here the role is DevOps engineer where I am the part of company. More “real world” experince.
> 
> I am confused which path should I pick.
> 
> A couple of things I am considering:
> 
> 1. For me right now learning > salary. Why? I believe If I do have enough skills I can earn more in future.
> 2. Switching job in future I am worried. If I worked as consultant will it be transistation to engineering role in future

Of course there’s no single correct, or one-size-fits all answer. But this is how I responded:

> Right on with #1. I think learning is almost always more important than salary (unless of course you can’t even pay the bills, then salary becomes super important!) Here are some of my basic suggestions:
> 
> - Don’t worry too much about which company you join. You’ll (probably) change a lot. Most people in tech change roles every 2 years or so. So if you find that your first job isn’t perfect, don’t worry, you’ll have many more.
> - Choose a job/company based on which will help you achieve your personal career goals. If you’re still exploring, that can mean taking a job that will give you more exposure to new things, rather than focusing on something specific. So as an example: Maybe you’d prefer to work for a consultancy, so you can interact with many clients/projects, rather than working with a traidtional company where you may work with only a single project.
> - As your career goals change (and they should!), adjust your criteria for jobs. This could mean a change in technical stacks, it could mean a focus on a specific type of business or problem domain, etc. Just be constantly thinking about what’s important to you, and adjust accordingly.
> 
> If you want to go into consulting, or launch your own startup, your career path will be different than if you’re just interested in solving difficult problems, and you don’t care who for. And of course as you grow in your career, you’ll probably become interested in certain types of problems. Maybe you’ll become interested in the problems associated with scaling databases, or with with networking technologies, or with graphical UIs, or with team structure and managing people, etc.

Is there anything you would add?

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._
How to check if a string is a valid URL slug in JavaScript?
Tags: javascript
Published: 2021-06-11 00:00:00

---
  title: How to check if a string is a valid URL slug in JavaScript?
  published: true
  tags: JavaScript
  date: Fri Jun 11 2021 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/check-if-string-valid-url-slug-javascript
  cover_image: https://melvingeorge.me/_next/static/images/main-887019bcc5476bc33c8e7f7f076202c0.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/check-if-string-valid-url-slug-javascript)
  
To check if a string is a valid URL slug, we can use a regex expression to match for strings that are small English alphabets separated by a dash in JavaScript.

### TL;DR

```js
// Regular expression to check if string is a valid url slug
const regexExp = /^[a-z0-9]+(?:-[a-z0-9]+)*$/g;

// String with valid url slug
const str = "hello-world";

regexExp.test(str); // true
```

This is the regex expression for matching almost all the test cases for a valid URL slug in JavaScript.

```js
// Regular expression to check if string is a valid url slug
const regexExp = /^[a-z0-9]+(?:-[a-z0-9]+)*$/g;
```

Now let's write a string with valid URL slug like this,

```js
// Regular expression to check if string is a valid url slug
const regexExp = /^[a-z0-9]+(?:-[a-z0-9]+)*$/g;

// String with valid url slug
const str = "hello-world";
```

Now to test the string, we can use the `test()` method available in the regular expression we defined. It can be done like this,

```js
// Regular expression to check if string is a valid url slug
const regexExp = /^[a-z0-9]+(?:-[a-z0-9]+)*$/g;

// String with valid url slug
const str = "hello-world";

regexExp.test(str); // true
```

- The `test()` method will accept a `string` type as an argument to test for a match.
- The method will return boolean `true` if there is a match using the regular expression and `false` if not.

See the above example live in [JSBin](https://jsbin.com/guqevataxu/2/edit?js,console).

If you want this as a utility function which you can reuse, here it is,

```js
/* Check if string is a valid URL slug */
function checkIfValidURLSlug(str) {
  // Regular expression to check if string is a valid url slug
  const regexExp = /^[a-z0-9]+(?:-[a-z0-9]+)*$/g;

  return regexExp.test(str);
}

// Use the function
checkIfValidURLSlug("hello-world"); // true
checkIfValidURLSlug("HELLO-world"); // false
```

That's all! 😃

### Feel free to share if you found this useful 😃.

---
WordPress forgotten password localhost hack
Tags: wordpress, password, security
Published: 2021-06-11 07:57:53

---
title: WordPress forgotten password localhost hack
published: true
date: 2021-06-11 00:00:00 UTC
tags: wordpress, password, security
canonical_url: https://thomasxbanks.com/articles/wordpress-local-forgot-password-hack/
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6c46jj0h28vtkpaa741o.jpg
---

I have lost count of the number of times I've forgotten the password to the local or development CMS.

My natural instinct is to click the _Forgot Password_ link but, obviously, there's no way to trigger that email from the local system.

I've spent too long hunting through articles on how to recover the forgotten password. The quickest and easiest solution that I've found is to change the password manually in the database.

![A hacker wearing an Anonymous mask hacks into a WordPress blog. Possibly.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lwoq5ndminw5a4saboai.jpg)

## How do we do that then?

WordPress stores passwords in the `wp_users` table. The prefix may be different if you have elected to change that in the `wp-config.php` file. It's good practice to do that for security.

When you look at the table, it'll look a little like this…

| ID | user\_login | user\_pass |
| --- | --- | --- |
| 1 | thomasxbanks | $P$BHpcLw/aWsTPmeDprzXwOEl45bJm9A3 |

WordPress stores your password as an [MD5 hashed string](https://en.wikipedia.org/wiki/MD5)<sup>*</sup>. This prevents anyone with access to the database seeing confidential information in plain text.

If this _wasn't_ obfuscated like this, we'd be able to copy our password and paste it into the login form…but we can't - and for good reason!

So, to fix our little problem, we need to replace the existing hashed password with a new hashed password - we can't overwrite the MD5 hash with plain text because that won't work.

I have [Hasher](https://marketplace.visualstudio.com/items?itemName=deerawan.vscode-hasher) installed as a plugin in VS Code. If you don't use VS Code or don't want to use this extension, [MD5 Hash Generator Online](https://www.md5hashgenerator.com/) works pretty well.

I would recommend that you don't create your "forever password" using these hash generators though. Overwrite the existing password with something easy to remember and **very, very temporary** - a favourite of mine is `Pa55word!` —

```
267057150e34eca5c6af39ec9b30864e
```

Once the password has been changed, you can log in with your new password **and immediately change it to something more secure**.

I hope this helps you as much as it has helped me. 😎

<hr/>
<sup>*</sup> As pointed out by [@sorinmarta](https://dev.to/sorinmarta) in the comments, WordPress salts the password using PHPass (as you can see from the `$P$` at the start of the example password). This hack will still work though as, even if your password has been salted, [you can still replace the password with an MD5 hash, and WordPress will let you log in](https://wordpress.org/support/article/resetting-your-password/).
Guest on .NET Docs Show: Making Phone Calls 📞 from Blazor WebAssembly with Twilio Voice
Tags: dotnet, aspnet, twilio
Published: 2021-06-12 03:55:25

---
title: Guest on .NET Docs Show: Making Phone Calls 📞 from Blazor WebAssembly with Twilio Voice
published: true
date: 2021-06-11 00:00:00 UTC
tags: dotnet, aspnet, twilio
canonical_url: https://swimburger.net/blog/dotnet/guest-on-dotnet-docs-show-making-phone-calls-from-blazor-webassembly-with-twilio-voice
cover_image: https://swimburger.net/media/it4d44ic/e3ormkpx0aqcr32.jpg?crop=0.0016025641025640366,0.0475567108924667,0,0.017614229278473573&cropmode=percentage&width=1000&height=420
---

Earlier this week, the folks at the .NET Docs Show invited me over to talk about Twilio, .NET, and Blazor WebAssembly. We discussed different architectures, workflow diagrams, Twilio capabilities, and how to integrate them using ASP.NET WebAPI's and Blazor WebAssembly.

{% youtube e8DX7HdSmkU %}

Thank you to everyone who watched and for all the interesting questions! 🙏
Notes on “Ramping Up at Your First Developer Job”
Tags: codenewbie, firstyearincode
Published: 2021-06-11 10:08:42

---
title: Notes on “Ramping Up at Your First Developer Job”
published: true
date: 2021-06-11 11:00:00 UTC
cover_image: 'https://www.rockyourcode.com/static/img/2021-06-11-ramp_up_first_dev_job_1000x420.jpg'
tags: codenewbie, firstyearincode
canonical_url: https://www.rockyourcode.com/notes-on-ramping-up-at-your-first-developer-job/
---

The talk [WebOfficeHours - Ramping Up at Your First Developer Job][youtube] by Mark Noonan is a 1-hour video with useful info for junior developers.

Here are my condensed notes:

### First Week on the Job

- tedious computer setup using skills you never need in any other situation
- take notes for the next person

### Imposter Syndrome

- remember they hired you on purpose

### Communication

- you might get trained on some of the stuff you'll need to do in your job
- _BUT_: people have no idea what other people have told you or not yet, so they might assume that you know XYZ, when nobody told you about it

### Social Circle

- figure out what everybody does and where you fit
- smaller vs bigger team: in bigger teams there are more layers
- in quickly moving teams: it's still not expected that you magically produce work, but you might have to stand up for yourself

### Learning a New Codebase

- take a look at the most recent commits/work

### Git (Version Control) && Jira (Ticketing System)

- the culture of how Git is used is often different (and might not be documented)
- make sure to ask how to approach version control
- workflows are always different: ask

### Be a Little Cynical

- make sure that others see your effort 
- don't get stuck even on the things you were hired to do

### Asking for Help Is a Superpower

### Managing Frustration Is Your Job

- working as a developer is often hard
- learn how to be patient

### Debugging

- learn how to debug (inspector, dev tools, break points)

### Make a Lot of Notes

- ask a lot of questions

### Don't Be Too Shy in Meetings

- it's ok to mostly hang back in meetings, but say at least one thing if you can

### Carving Out "Your Job"

- try to find the things you're good at

### You Can Do Anything if You Have Enough Time

- your motivation for asking for help is not that you can't get it to work — it's that it's not worth your time to spend too much time on learning all the stuff
- you will often need to work on something that you haven't worked on before

## Links

- [WebOfficeHours - Ramping Up at Your First Developer Job][youtube] by [Mark Noonan](https://twitter.com/marktnoonan)
- [How to ask good questions](https://jvns.ca/blog/good-questions/) by Julia Evans

[youtube]: https://youtube.com/watch?v=oXfuyCMXJR8
Moving Lagoon to semantic versioned Docker Images
Tags: docker, versioning, semantic, images
Published: 2021-06-10 22:40:21

One of the more visible issues with our Docker image publishing process was that some of the images were being published with very complicated tags. 

For example: `amazeeio/php:7.4-cli-drupal-v1.8.2` was release 1.8.2 of the PHP image for Drupal CLI, based on PHP 7.4.

With more and more services now performing automated dependency resolution and updates for git-based workflows, our tagging system was virtually impossible for these tools to decipher.

Instead, we will be renaming all the images to a standard format, as well as dual-publishing our images to our `uselagoon` organisation in Docker Hub.

This means the above image will become `uselagoon/php-7.4-cli-drupal:1.8.2`. Shifting each variant of each application into its own unique namespace allows us to use the tag purely for the specific version.

This will unlock the ability for our downstream customers to pin their projects to our published releases, and enable a wider range of automated tools that support automated Docker dependency updates ([Whitesource Renovate](https://www.whitesourcesoftware.com/free-developer-tools/renovate/), [Dependabot](https://dependabot.com/) and others) to generate pull requests automatically for any new Lagoon image release, which can then trigger Lagoon to automatically build them.

We will also be adopting a date-based tagging system, with a scheduled release every month – using the year/month to identify a set of images, with the ability to provide “patch” release images mid-cycle.

For example, `uselagoon/nginx:20.12.0` would be the December 2020 release of the NGINX image.

## Maintaining Legacy Tags

To ensure minimum disruption to our existing customers, we will be maintaining the current tag naming system for our images. While there are obvious benefits to the new naming system, we want to make sure that we are backward-compatible, so we will continue to release the images to both the new and old tag systems. We will be moving our example repositories across to the new versions as soon as they are available, and are anticipating that future projects would be built on the new versions too.

## Check out the images

Head over to our new Docker Hub repository at https://hub.docker.com/u/uselagoon and see the published images for yourself - you should also plan to migrate from your current `amazeeio/`-based images to the `uselagoon/` namespace.
Postman and AWS secrets Manager
Tags: aws, postman, secretsmanager, api
Published: 2021-06-10 22:30:21

Hello, 
Recently, the project (website) I am working on was attacked :( we decided it's time to analyse the code to find if there is any vulnerabilities to correct in order to improve the security (so we postpone the work that we had plan to do to implement new features). We were shocked to discover that many credentials that we use to access API are hardcoded in the application! we have decided to use AWS Secrets Manager in order to manage different passwords of API used in our app.

I never worked with AWS Secrets Manager, so it was for me the opportunity to use it. Here is the first steps that allow me to retrieve my password from AWS Secrets Manager using Postman  : 

1. I created a pair of value, key at AWS Secrets Manager, it's simple and well explained at this link : 
https://docs.aws.amazon.com/secretsmanager/latest/userguide/tutorials_basic.html#tutorial-basic-step1 

2. In order to access to the value stored, I added a Permission Policy SecretsManagerReadWrite, more information at the documentation : 
https://docs.aws.amazon.com/mediaconnect/latest/ug/iam-policy-examples-asm-secrets.html

3. Everything is ready to test retrieving the value via Postman : 
the Endpoint : https://secretsmanager.REGION_ID.amazonaws.com/GetSecretValue
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ar3eylgkx1g9hhnazm9y.png)

In the body, I specified the secretId that I took from AWS Secrets Manager: 
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b4nhgylqoophhup255j2.png)

and voila, the result : 
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xsy0105b3thwbo0n6g3h.png)