teleren/devto huggingface dataset:
Practice questions on List Comprehension.
Tags: programming, python, beginners
Published: 2022-08-22 15:08:06

1.
```
names = ["aman", "vikas", "vivek", "sandeep", "manik"]
new_names = [2*x for x in names if "a" in x]
print(new_names)

```
Explanation-
Iteration1:
1st item is going to be picked by new_names that is,"aman" and "a" is there in the item, and condition became true.
Iteration2:
2nd item that is "vikas" will be picked out and "a" letter will be checked, and condition became true.
Iteration3:
3rd  item that is "vivek" will be picked out and "a" letter will be checked, and condition became false.
Iteration5:
5th and the last item that is "manik" will be picked out and "a" letter will be checked, and condition became true.
final output-['amanaman', 'vikasvikas', 'sandeepsandeep', 'manikmanik']
2.
```
for x in "data":
 if x == "t":
  break
 print(x)
print("The end")

```
Explanation-
Iteration 1:
x=’d’ ,condition become true and loop get to connected.
if ‘d’==’t’ condition became false and print(x)=d
Iteration 2:
x=’a’ condition become true and machine jumps into the body of loop. 
if ‘a’ == ‘y’ condition is false and print(x)= a
Iteration 3:
x=’t’ condition is true
if ‘t’==’t’ if condition is true and break executes and machine 
jumps outside the loop 
print(‘The end’) = The end
Final output d
 a
The end
3.

```
numbers = [i*10 for i in range(1, 6)]
print(numbers)
```
Explanation-
Iteration1:
i=1 condition became true and it will be multiplied by 10 and output become 10
Iteration2:
i=2 condition became true and it will be multiplied by 20 and output become 20
Iteration2:
i=5 condition became true and it will be multiplied by 50 and output become 50
Final output:[10, 20, 30, 40, 50]
4.

```
List = [character for character in 'Geeks 4 Geeks!']
print(List)
```
Explanation-
Iteration1:
character=G ,condition became true and "G" will be executed.
Iteration2:
character=e ,condition became true and "e" will be executed.
Iteration14:
character=! ,condition became true and "!" will be executed.
Final output:
['G', 'e', 'e', 'k', 's', ' ', '4', ' ', 'G', 'e', 'e', 'k', 's', '!']
5.

```
lis = ["Even number" if i % 2 == 0
else "Odd number" for i in range(8)]
print(lis)
```
Answer this question in comments.
Let’s take a look at the new page, dedicated to Entity Framework Core
Tags: efcore
Published: 2022-08-22 14:40:08

---
title: Let’s take a look at the new page, dedicated to Entity Framework Core
published: true
description: 
tags: EFCore
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---
https://www.devart.com/what-is-entity-framework-core/

On this page you’ll find EF Core Introduction Tutorial: Definition, Architecture, Usage, etc. 

✅ Download a 30-day absolutely free trial of our ADO.NET Data Providers: https://www.devart.com/products.html#.net
Managing packages on macOS with Homebrew
Tags: packagemanagement, macos, homebrew, tooling
Published: 2022-08-22 14:33:29

> This article originally appeared on my personal dev blog: [Byte High, No Limit](https://andrewowen.net/blog/).

If you're a Linux user, or you read my post on Scoop, you'll be familiar with package managers. They aim to simplify installing, upgrading, configuring and removing software. A key feature is dependency management: if a package requires software that isn't already installed, the package manager can install it.

Apple's solution to managing installed software on macOS, and its other operating systems, is the App Store application. Typically, end-user applications don't have dependencies. However, command line tools often do, particularly if they originated on Linux. Another issue is that macOS typically ships with older versions of common tools, if it includes them at all.

The most popular third-party package manager on macOS used to be [MacPorts](https://www.macports.org/ "MacPorts"), and it's still a valid choice. But it has been replaced in popularity by [Homebrew](https://brew.sh/ "Homebrew"), which is based on Git and Ruby.

If you haven't already installed the Xcode command line tools, you might want to do that first. From the command line, enter: `xcode-select --install`.

To install Homebrew, open the **Terminal** and enter `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`.

To update the package list, enter `brew update`. To upgrade all packages, enter `brew upgrade`. Now you're ready to add whatever packages you like.

Homebrew includes an extension called Cask. You install command line apps with `brew install <`_`app name`_`>`. For graphical apps use `brew casks install <`_`app name`_`>`. 

Having been using an M1 (ARM CPU) Mac for over a year now, I'm pleased to report that I haven't run into any problems with Homebrew.
5 important reasons why should you use CodeFace!
Published: 2022-08-22 14:30:31

In the list of in-demand professions, we would not be wrong if we say that the specializations related to information technologies, especially programming, were at the forefront. If we look at the marathon of becoming a programmer today, we can see several typical obstacles faced by almost a large number of marathon participants. If we look at all these obstacles, we can clearly see that they come out of the same door "Coding skill". The CodeFace project is a project designed to solve this problem from the roots. If we use such an analogy, we have all played online games against randomly selected opponents over time and this has developed our skills in that game and made us Gamer :-). the most important point is that even if we lose in that game, it will not cause a lack of self-confidence in us. CodeFace is a project based on these logic and principles. By logging in with your Github or Google account, you are ready to take part in Code wars, and as if you are competing with a random programmer on a random algorithm given to you by the system in a game. In the logic of code wars, a magic wand that will instill confidence in you and have a great positive effect on the development of "coding skills" will be "this is our little secret". We assume that a small preliminary impression about code wars is enough. Now let's talk to you about the other 4 reasons "Why I should be a CodeFace user".

You will add experience to your experience by working on freelance orders, in addition, the code you write will be analyzed by CodeFace and if changes are needed, it will be presented to you in proposals.

he web IDE for writing code will help you if you need to make immediate changes in the project you are writing, and it will also be your practice arena to improve your coding skills and become a better CodeFace code warrior in your free time.

Your project management software supports you in all project phases: from planning, initiation and regular control to systematic evaluation during and after the completion of a project. In this way, you can efficiently use the potential of your specialists and conduct out your projects as successfully as possible while saving resources. project management software supports you in all project phases: from planning, initiation and regular control to systematic evaluation during and after the completion of a project. In this way, you can efficiently use the potential of your specialists and conduct out your projects as successfully as possible while saving resources.

Writing code using many FREE UI tools will greatly increase your speed

Premium properties is our little "secret" sssh!
DRF boilerplate for user registration and auth using phone number and/or email
Tags: django, showdev, python
Published: 2022-08-22 14:22:00

Hello everyone, I'm back with a boilerplate project that has saved my time and will hopefully save yours too.

Developers often don't want to take part in the hassle of setting up an authentication system every time a new project is started. I would rather find a boilerplate or package that accomplishes this task (I'm sure I speak for a lot of us by saying this). However, different projects require different ways to authenticate users. Some require email, others phone number, and finding that "perfect" boilerplate for our project can be a difficult task.

There are a lot of boilerplate projects for the default username-based authentication in Django, as well as email authentication. It's fairly easy to customize our Django project to use [email instead of username](https://dev.to/earthcomfy/getting-started-custom-user-model-5hc) for auth. However, I've not come across a boilerplate that satisfies my requirements for an authentication system using phone number and/or email together with verification. Even if they do, they are not up-to-date.

And I use a combination of the two (phone number and email) mostly in my projects, which is why I decided to create this boilerplate. I've used [dj-rest-auth](https://dj-rest-auth.readthedocs.io/en/latest/) package, a fork of the no longer maintained, [django-rest-auth](https://github.com/Tivix/django-rest-auth) package. I've also included third-party authentication using Google, password change, and reset endpoints. For phone verification I've used Twilio.

Let me know your feedback and anything you would like to see fixed about the project.

I hope this is something will find useful for your next project with room for customization. If you like it, don't forget to leave a [star on GitHub] (https://github.com/earthcomfy/drf-phone-email-auth).

![till next time](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6zs96jug8xypikdfe1wm.gif)
You need to learn AWS RIGHT NOW!! 🚀
Tags: aws, cloud, programming, beginners
Published: 2022-08-22 14:12:00

If you are in IT field you should learn the **Cloud** and **AWS** is the biggest player out there

**Why Should I learn Cloud? 🤔**
The **Cloud** is basically someone else's computer, in this case Amazon's computer.
Amazon has a large number of computers, or **Servers**.
In Simple terms, Amazon allows you to use their computers or servers for a _service charge_, and a large number of companies use it.
So, Companies instead of purchasing their own servers, which can cost hundreds of thousands or even millions of dollars, they are basically _renting Amazon's Server_.

The reason why companies move their Infrastructure to Cloud is because of the _Lower Cost, Freedom to grow, lot of features offered by Amazon_.
So lot of companies are moving their Infrastructure to Cloud and this why they need you they need **skilled IT people**, people who know **AWS** to help them move their stuff to the Cloud and once it their they need help managing it.
This is why there is so much demand for this skill.

**Where do I start learning? 🥺**
You can choose between two certifications. The first is **AWS Certified Cloud Practitioner**. This is an **entry-level certificate**, so if you're new to the cloud and IT, this will be perfect for you.
If you are already in IT and have some knowledge of the cloud, you should pursue the second certificate, **AWS Certified Solution Architect Associate**. This certification will allow you to get your foot in the door as a Cloud administrator.

If you want to obtain these certifications, there are numerous free and paid courses available online; however, I will write some articles to get you started with AWS.

######Thank you for reading this article do follow me for more!
Difference Between Strapi v3 and v4, what changed, and why?
Tags: strapi, javascript, headlesscms
Published: 2022-08-22 14:01:45

_​There have been many questions about the changes, and we answered them here._

Recently we had a live stream where Paul, Developer Advocate, and Aurélien Georget, CPO and Co-founder at Strapi, discussed last week what were the main motivations around releasing v4, the reasons behind breaking changes like GraphQL, dive into the granularity in the API response and the features that will be supported, v4 improvements and more.

Watch the full live stream [here](https://youtu.be/U_n_H0Rj_Sk):

{% embed https://youtu.be/U_n_H0Rj_Sk %}

## A new live stream is coming up: Creating Business Websites With Remix and Strapi

In September, we will go live with Gustavo from [seasoned.cc](seasoned.cc), where they help non-technical founders create successful startups. They will share how recently migrated one of their customers from WordPress to use modern web development technologies, which include Strapi and Remix.

Make sure to [register](https://lu.ma/remix-with-strapi) and join us!

## Try the latest version of Strapi!

To create a new Strapi project, simply run the following command:

```
npx create-strapi-app my-project --quickstart

```

Follow the Quick Start Guide for detailed step-by-step instructions or have a look at a video instruction:

{% embed https://youtu.be/h9vETeRiulY %}
İstemci Makine için Zabbix Agent Otomatik Kayıt Yapılandırması
Published: 2022-08-22 13:59:51

Zabbix Agent kurulumuyla beraber gelen yapılandırma dosyası[^1], güncellemeler ile değişebilmektedir.
Bundan dolayı ek yapılandırma dizini[^2] altında, `.conf` ile biten herhangi bir isimde dosya oluşturup yapılandırmayı bu dosyaya girmeyi tercih ediyorum.

Hostname değişkeni, kurulumla beraber gelen yapılandırma dosyasında etkin.
Bu değişkeni sıfırlamak için boş değer girdik. Değişken sıfırlandığı için otomatik olarak makine ismi tanımlanıyor. Böylece her makinede yapılandırma dosyasını ayrı ayrı düzenlemeye gerek kalmıyor.
HostMetadataItem değişkenine de system.uname değeri girildiğindei, Zabbix sunucusunun doğru makineleri ayrıştırması için gerekli olan değeri tanımlamış oluyoruz.

```
Server=ZABBIX_SUNUCU_IP
ServerActive=ZABBIX_SUNUCU_IP
Hostname=
HostMetadataItem=system.uname
```

### Kaynakça

* https://www.suleymankaratas.net/zabbix-6-0-auto-registration-ile-host-ekleme/

### Dipnotlar

[^1]: Zabbix Agent 2: `/etc/zabbix/zabbix_agent2.conf` Zabbix Agent: `/etc/zabbix/zabbix_agentd.conf`
[^2]: Zabbix Agent 2: `/etc/zabbix/zabbix_agent2.d/` Zabbix Agent: `/etc/zabbix/zabbix_agentd.d/`
Electron JS Windows setup
Tags: javascript, beginners, programming, webdev
Published: 2022-08-22 13:52:15

I’ve had this one terrible problem a long time ago where I could not for the life of me get electron js to work on windows. So, here I am to help anyone else who may be struggling like I was. I hope this can help more than the articles I read.
	Okay first up we’ll need node.js that is a must, like in all js projects. Then what well have to do is go to the official electron site to get the download command (you can see it below)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/phiuwpl0w0nmv27u7xs3.JPG)
	Then you’ll want to have a github account and git installed on your machine.
	That covers the prerequisites, now to get into the meat of the topic. When using wsl and windows in combination with electron js there is one step that I missed the first time I installed electron for a project. Here was my pitfall, I missed a crucial step when I was installing electronJS. I was using wsl2! In the instructions to download electron js it specifically warns against this, so use power shell.
	So the first steps to getting things tetup is having a directory you want lectron in, we can do this my running this little command here: mkdir my-electron-app && cd my-electron-app
After you run that command you can run npm init. Once that is finished run:npm install electron --save-dev 
	Then that's all to the setup.The rest of the basics you will need to actually get familiar with electron can be found in the electronjs official site. Thank you for taking the time to read this short article.

https://www.electronjs.org/docs/latest/tutorial/tutorial-first-app
Easy Test Deployments with Terraform
Tags: terraform, aws, testing
Published: 2022-08-22 13:51:22

Recently I was forced into using Terraform to define infrastructure. I'm so used to CDK and being able to adjust everything through context settings that I quickly ran into a problem: how do I deploy a copy of my project to test it?

## Editing Files Directly

All I needed to update was the backend and my AWS profile. So the first way I tried was pretty obvious, edit the main terraform file where the backend and AWS provider is defined. The obvious problem is that I make frequent commits and usually just do `git commit -a -m ...`. So I knew those changes would run in a pipeline and blow it up.

## What About Variables?

My next idea was to use variables that would work for the AWS profile. The problem is the `backend` block needed to be set to `local`, and you can't pass variables into block labels.

## Override Files

It turns out that HashiCorp has a solution for this: [Override Files](https://www.terraform.io/language/files/override). They essentially work the same as my first method of editing the terraform file, but it's done in a special file to keep it out of the repository.

Add `*override.tf` to your `.gitignore` file, then add a file next to the one you want to update with the same name, but add `_override` to the end. For example, I created the file `terraform_override.tf` to override settings in `terraform.tf`.

When creating the file, you only have to define the properties you want to be updated. Continuing my example, I created the following override file:

``` terraform
terraform {
  backend "local" {}
}
		  
provider "aws" {
  profile = "my-aws-profile"
}
```

## Summary

Override files allow you to update terraform settings for local development easily. Since they're stored in files that can be easily added to `.gitignore`, you don't have to worry about them ending up in your repository and running on a pipeline.
Status Page, with Redis
Tags: redishackathon, dotnet, blazor, docker
Published: 2022-08-22 13:29:00

### Overview of My Submission

This project is basically a Status Page (like Github Status, Azure Status, Atlassian Statuspage, or something similar) built on top of Blazor Server and Redis. Here you can define a "health check" and get reports when one of your service is down. Also it has a Discord webhook client that will send you a message when one of your service status has changed.

- Monitor HTTP/TCP service uptime
- Simple latency graph over time
- Incident report when one of the services status has changed
- Discord webhook notification

![RedisStatusPage home page](https://user-images.githubusercontent.com/8360880/185859218-9b80ef50-4c8c-486f-baf0-8b846d4feedf.png)

Project video overview

[![Status Page, with Redis Video](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hcg8ssri3pzhn5ly4gys.png)](https://youtu.be/X98C4xnlrOI)

### Submission Category

MEAN/MERN Maverick

### Language Used

C#/Blazor Server

### Link to Code

{% embed https://github.com/fahminlb33/RedisStatusPage %}

### Random advice: Read as many resources before starting a hackathon project...

Here's one of _bruh_ moment when I was almost finished working on this project.

Like many developers out there I usually work with SQL or document DB and in this project I also used Redis.OM to help me use Redis faster via LINQ APIs. 

But then I checked out the Redis sample app, Redis Analytics Bitmaps demo.

_Bruh... damn_

I never thought of using many different keys and data structure to store my service monitoring data. Why I don't use Set with a many different part of the service and timestamp as key and simply query it using something like `SCAN`? Why I have to bother dealing with complicated LINQ queries when Redis may have a much cleaner alternative? I simply haven't learned Redis enough.

At that time I'm still thinking of modelling data as table in Redis, and ignores the fact that Redis is different from SQL database and document DB like Mongo and I was stuck with that mindset for quite some time.

After I realized there are many more alternatives to model data in Redis, I felt I have to rewrite my project to embrace Redis data structures.

While I'm working on the improved version of this project, the current implementation of this project is already finished and working properly, you can try to run it right now :D and I will try to rewrite it maybe over the weekend, but I don't know when I will have time to finish it before the hackathon ends.

- - - 

* _Check out [Redis OM](https://redis.io/docs/stack/get-started/clients/#high-level-client-libraries), client libraries for working with Redis as a multi-model database._
* _Use [RedisInsight](https://redis.info/redisinsight) to visualize your data in Redis._
* _Sign up for a [free Redis database](https://redis.info/try-free-dev-to)._
Music Monday — What are you listening to? (August 22)
Tags: watercooler, discuss, music
Published: 2022-08-22 13:47:20

_cover image source: [clip from The Get Down](https://giphy.com/gifs/netflix-the-get-down-thegetdown-3oz8xtsmgSk9BCJ2P6)_

In this weekly series, folks can chime in and drop links to whatever it is they've been listening to recently + browse others suggestions.

If you like talking about music, consider following the org [#music discussions](https://dev.to/music-discussions) for more conversations about music!

{% embed https://dev.to/music-discussions %}

***

So, let me hear what you're tuning into this Monday. _Note: you can embed a link to your song on most platforms using the following syntax `{% embed https://... %}`._

I look forward to listening to y'all's suggestions! 👂 🎶
I built my first game with Python - Guess the Dog
Tags: python, beginners, showdev, gamedev
Published: 2022-08-22 13:46:00

Hey everyone. Really happy to have built my first game! It’s a simple dog guessing game, but I learnt a lot important Python logic building it.

Apart from the whole loop to create the turn and point systems, at each turn the game makes a request to this cool Dog API to get a new photo. Since the breed’s name is in the image URL, I had to understand how to parse the URL, change the strings’ order and replace characters.

Oh, I also put in 2 little cheats that will immediately give you a point. There’s one in English and one in Portuguese for the other Brazillians out there hehe :)

Might not be a big accomplishment to everyone, but I’m happy w it!

[Click here to play](https://ek.abstra.run/07cf45bf-4a36-41a1-9fd2-b7531cf4c7c7)



Important disclaimer: I’m interning at Abstra Cloud. I used it to generate the UI and hosting for me bc right now I’m more focused on learning logic. I’ve been making most of my projects over there, but wanted to share bc it also would be cool for someone to make this elsewhere. Hope that’s okay!



Full code (with the cheat hidden!):
```python
import requests
from urllib.parse import unquote, urlparse
from pathlib import PurePosixPath

points = 0
tries = 0

def request():
    x = requests.get('https://dog.ceo/api/breeds/image/random')
    response = x.json()
    url = response["message"]
    return url

def urlparser(url):
    name = PurePosixPath(
            unquote(
                urlparse(
                    url
                ).path
            )
        ).parts[2]
    name = name.replace('-', ' ')
    name = name.split()
    name = list(reversed(name))
    return " ".join(name)

while tries < 5:
    selected_url = request()
    selected_name = urlparser(selected_url)
    print(selected_name)

    guess = Page().display_image(selected_url)\
                .read("What is this dog's breed?")\
                .run()
    guess_answer = guess["What is this dog's breed?"].lower()
    cheat_options = [???]

    if guess_answer in selected_name or guess_answer in cheat_options:
        points += 1

    tries += 1

if points > 2:
    display(f"Congrats dawg! You scored {points} points 😎")
else:
    display(f"Woof... You only scored {points} points.")
```
Laravel 9 - New scalar() method
Tags: php, laravel, database, programming
Published: 2022-08-22 13:41:00


In **Laravel 9.8.0**, the _scalar()_ method was added that allows you to retrieve the first column of the first row from the query result.

Before:
```
DB::selectOne("SELECT COUNT(CASE WHEN food = 'burger' THEN 1 END) AS burgers FROM menu_items")->burgers
```

Now:
```
DB::scalar("SELECT COUNT(CASE WHEN food = 'burger' THEN 1 END) FROM menu_items")
```