teleren/devto huggingface dataset:
ma'lumot turlari (2)int va str
Tags: python, programming, beginners, wordpress
Published: 2023-01-25 15:34:52

print("element at odd -index positions fromarks=float(input("enter marks:"))
print("\n")
print("student marks:",marks)
print("type is :",type(marks))

list1=[1,3,5,7,11,13,17,19,23,31,41]
list2=[2,4,6,8,10,12,14,16,18,20,22]
print("toq sonlar:",list1[0:7])
print("juft sonlar:",list2[0:7])


list1=[1,3,5,7,11,13,17,19,23,31,41]
list2=[2,4,6,8,10,12,14,16,18,20,22]
res=list()
odd_elements=list1[1::2]m list one ")
print(odd_elements)

even_elements=list2[0::2]
print("element at even -index positions from list two")
print(even_elements)

print("printing final third list")
res.extend(odd_elements)
res.extend(even_elements)
print(res)

solution1
#revers()- bu fundsiy biza kiritgan sonlarnni teskarisiga ugirib beradi.
list1=[100,200,300,400,500]
list1.reverse() #reverse teskarisiga qilish
print(list1)

solution2
#-1 salbiy kesish dan foydalanish shunda biza kiritgan sonlarnni teskarisiga ugirib beradi va edranga chiqarib beradi .
list1=[300,400,500,600,700]
list1=list1[0::1]
print(list1)#chiqadi 300 , 400.

list1=(300,400,500,600,700)
list1=list1[0::-1]
print(list1)

tuple1=("orange",[10,20,30],[5,15,25])
print(tuple1)
print(tuple1[0])
print(tuple1[1])
print(tuple1[2])
print(tuple1[1][1])#hozir bu holatda 20 soni ekranga chiqadi .


tuple1=(11,22,33,44,55,66)
print(tuple1[3])# chiqadi 44
print(tuple1[4])# chiqadi 55

print(tuple1[3])
list1.reverse()
print(list1[3::-1])
print(tuple(2))
A nth-child CSS trick
Tags: css, tutorial, webdev, beginners
Published: 2023-01-25 15:27:06

Sometimes you figure out a cool trick that just feels so powerful. It opens you up to a range of new possibilities. That you, quite frankly, rarely use. But still, it is a cool trick. For me, the latest of these tricks is setting a CSS custom property value, corresponding with the `:nth-child` value. Why? Because now we can use the `--nth-child` custom property inside `calc()` functions. 

## But why not use X?
Sure, in most, if not all, of my projects I use SCSS instead of CSS. But CSS is getting more and more features, making SCSS redundant for me. Looking at you [CSS nesting](https://www.w3.org/TR/css-nesting-1/). With each trick or implementation, you can remove another dependency on SCSS, and go back to plain CSS. Using `@for-`loops makes it easy to achieve the same result. But you will generate roughly the same CSS selector several times.   

You might also think using `:nth-child(n)` would allow you to achieve the same, without all the custom properties. Unfortunately, the `n` is not useable in the `calc()` function. So, we use custom properties.

## How to set it up
On the highest level of your CSS, you define a list like the one below. This results in all elements having access to a `--nth-child` custom property. At least as long as you don’t exceed the length of your list.

```css
:nth-child(1) { --nth-child: 1 }
:nth-child(2) { --nth-child: 2 }
:nth-child(3) { --nth-child: 3 }
:nth-child(4) { --nth-child: 4 }
:nth-child(5) { --nth-child: 5 }
```

## What can we do with this trick?
Glad you asked! In the last few years, I came across two use cases. Two, whole, use cases. In the latest use case, I wanted to automatically generate a color palette. Not to match a branding of a company. But to automatically populate different series of data in a chart. With this trick, we can do that with a single line.

```css
background-color: hsl(calc(100 * var(--nth-child)) 100% 40%);
```

In an earlier use case, I replicated the UI implementation of toasts from [Vercel](https://vercel.com/design/toast). On the link, you see a list of toast messages stacked with a little bit of perspective. I originally used an SCSS implementation, looking like the snippet below. Note it uses `:nth-last-of-type`, given the reversed order and bottom orientation. But the general idea remains the same. 

```scss
@for $i from 1 through 20 {
	&:nth-of-type(#{$i}) {
	  opacity: 1 - 0.15 * ($i - 1);
	  transform:
		  translate3d(50%, 0 - (5 * ($i - 1)) + px, -1 * $i + px) 
		  scale(1 - (0.05 * ($i - 1)));
	}
}
```

This would create twenty different CSS selectors, all with a different value for `$i`. But using this little trick, we can reduce the code, and make it more maintainable in the process.

```css
.class {
	/* We want to start counting at 0 */
	--v: var(--nth-last-child) - 1;
	opacity: 1 - calc(var(--v) * 0.15);
	transform:
		translate3d(
			50%, 
			calc(-5px * var(--v)), 
			calc(-1px * var(--v)) 
		scale(calc(1 - var(--v) * 0.05);
}
```

That was it. That was my latest CSS trick.
How to allow webview camera and microphone access from swift
Published: 2023-01-25 15:23:56

With the release of iOS 15, Apple introduced the ability to request media capture permission directly from the `WKWebView`. This allows developers to have more control over how and when the user is prompted for camera and microphone access.

To implement this feature, we will first need to implement the a `WKUIDelegate` method To your `ViewController` This method is called when the `WKWebView` encounters a request for camera or microphone access from a website.

Here's how it looks. 

```swift
    @available(iOS 15, *)
    func webView(
        _ webView: WKWebView,
        requestMediaCapturePermissionFor origin: WKSecurityOrigin,
        initiatedByFrame frame: WKFrameInfo,
        type: WKMediaCaptureType,
        decisionHandler: @escaping (WKPermissionDecision) -> Void
    ) {
        decisionHandler(.grant)
    }
```

You also need to add the `WKUIDelegate` to your `ViewController` and set 
`webView.uiDelegate = self` and your done. 

**No more permission request from the webview.** 🎉

A good thing to note though is that this will allow permissions from all sites, you should probably limit it to use only the url's you want.
7 Goals as Software Developer
Tags: beginners, webdev, programming, career
Published: 2023-01-25 15:12:30

As a software developer, it can be challenging to find your goals, but there are a few approaches you can take:

1. **Test your abilities**: Determine your developer hobbies and strong points. This will enable you to identify the projects and types of tasks for which you are most suitable.

2. **Look at the most recent trends**: Observe the most recent innovations and patterns in software development. Decide which areas fit your interests and expertise.

3. **Connect with other developers** in your neighborhood and sector through networking. They can provide you with insightful information about various initiatives and prospects.

4. **Play around**: Examine various undertakings and methodologies. By doing so, you'll be able to recognize your strengths and areas of expertise.

5. **Don't be rigid**: Be flexible in your goals as your interests and skills change. Be open to new chances.

6. **Try to learn**: 
Continue to learn about, investigate, and test new tools, approaches, and frameworks.

7. **Keep it real** :sunglasses: : 
Set attainable goals that you can achieve after considering your experience and skills.

Please continue in the comments :)
SonarQube Docker with PostGres issues
Published: 2023-01-25 15:05:19

**Problem**: Created a new docker container for SonarQube and it failed with the error:

`bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]`

**Solution**: 

edit the file /etc/sysctl.conf
change or add a line `vm.max_map_count=262144`
then run `sysctl --system`


https://stackoverflow.com/questions/41064572/docker-elk-vm-max-map-count
Python 🐍GitHub repositories to make your skills shine 🌟
Tags: python, programming, github, tutorial
Published: 2023-01-25 15:05:04

## Introduction

- [Python](https://youtu.be/2VRXU2H4q0c) developers are highly sought after in the tech industry due to their specialized skills and knowledge.
- [Python](https://youtu.be/8ZBgf8tQok0) is a versatile programming language that can be used for web development, software engineering, data analysis, artificial intelligence and more. 
- As such, it requires a unique set of skills from its developers that make them invaluable assets to any company or organization looking for an experienced programmer. 
- First off, [Python](https://youtu.be/2VRXU2H4q0c) developers must have strong problem-solving abilities as they need to understand complex algorithms and develop efficient solutions using the language’s syntax. 
- They must also possess excellent debugging capabilities so they can quickly identify errors in code before deployment.
- Additionally, having good communication skills will help them effectively collaborate with other members of the team on projects and ensure everyone understands what is expected from each person involved in order to meet deadlines efficiently without compromising quality standards. 
- Finally, being able to stay up-to-date on new technologies related to [Python](https://youtu.be/2VRXU2H4q0c) will give these professionals an edge over others who may not be aware of recent advancements made within this field.
- Plus it helps keep their skill sets sharp so they remain competitive when applying for jobs or promotions within their current positions.
- All these qualities combined make [Python](https://youtu.be/8ZBgf8tQok0) developers some of the most sought after individuals by employers around world today – making sure you hone your craft accordingly could open many doors career wise.


#### Learn 👩‍💻 Python

Python top free courses from Coursera🐍💯🚀

🎥 {% youtube 2VRXU2H4q0c%}


#### Python GitHub Repositories

7 GitHub Repositories That Will Take Your Python 🐍 Skills To The Next Level 🚀
 
🎥 {% youtube iFehSaR5H2A%}


### Connect with Me 😊

#### 🔗 Links

[![linkedin](https://img.shields.io/badge/linkedin-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/mahmoud-el-kariouny-822719149/)

[![twitter](https://img.shields.io/badge/twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/Mahmoud42275)
Get the last directory a file with bash
Published: 2023-01-25 15:04:45

**Problem:**
You need to get the last directory a file is in,

**Solution** (one of many I'm sure):
using the full filename "/path/to/file/filename.txt"
`dirname /path/to/file/filename.txt`

this produces */path/to/file*, then we use shell replacement as such:
`    echo ${INPUT##*/}`

which produces 
`    file`
Substring in MySQL - Syntax and Examples
Tags: mysql, database, dbforge, dbforgestudio
Published: 2023-01-25 15:03:33

---
title: Substring in MySQL - Syntax and Examples
published: true
description: Substring in MySQL
tags: #mysql #databases #dbforge #dbforgestudio
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-01-25 15:01 +0000
---
In this article, you will find a detailed guide with basic syntax and examples of how to use the MySQL SUBSTRING() function - https://blog.devart.com/mysql-substring.html

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/750wdvyfe2d414273mlq.png)
Passing config args from cli
Tags: nx
Published: 2023-01-25 15:02:11

Hey there!

Can I somehow to set up i18n.locales from cli
something like: nx run web:prod i18nLocales=...
{
  "name": "web",
  "$schema": "../node_modules/nx/schemas/project-schema.json",
  "projectType": "application",
  "sourceRoot": "src",
  "prefix": "prefix",
  "i18n": {
    "locales": {
      "en": "src/assets/i18n/translation.en.xlf",
      "de": "src/assets/i18n/translation.de.xlf"
    }
  },
写论文必备，在线代码高亮工具，无缝粘贴到 Word
Published: 2023-01-25 14:49:41

![截图](https://devopenclub.parryqiu.com/blog_c75abebd3348085d916346c8386e6a60.png)

在校的朋友最近应该就要进入论文期了，分享一个在线代码高亮的站点，可以一键高亮美化代码，粘贴到 Word 中也可以保持非常好的格式，为您的论文加分。
<!-- more -->

# 1. 功能

- 支持 161 种语言格式的高亮；
- 默认为自动检测代码语言；
- 特别为论文排版优化，使用优雅的代码字体润色代码；
- 为生成的代码添加行号，方便在代码描述文字里指定到特定行数的代码；
- 为 Microsoft Word 的排版优化给出了指引方案。

在线工具地址：[https://highlightcode.com/](https://highlightcode.com/)

# 2. 效果截图

## 站点首页

![截图](https://devopenclub.parryqiu.com/blog_9b97d90dcc1edde7fbc1915418fc32a0.png)

## 在线高亮美化后的效果

![截图](https://devopenclub.parryqiu.com/blog_1120aa14792727a682ac0b1c87b10c41.png)

## 默认粘贴到 Word 中与样式调整后的对比

![截图](https://devopenclub.parryqiu.com/blog_08d124a42b74b2151060c70ed2be2a78.png)

## 最终粘贴到 Microsoft Word 中的效果

![截图](https://devopenclub.parryqiu.com/blog_7ec01917cad9b26136e7faf8c29db772.png)

# 3. 在线工具地址

[https://highlightcode.com/](https://highlightcode.com/)
帮您 24 小时监控站点、设备、API 的状态，咕咕监控是您的运维工具人
Published: 2023-01-25 14:45:42

帮您 24 小时监控站点、设备、API 的状态，咕咕数据是您的运维工具人



不管是独立开发者还是中小型企业，随着 Web 应用、API 数据接口或者设备越来越多，经常不知道什么时候某一个功能模块宕机了，而等发现宕机的时候可能已经是很多天以后了，如果是一些孵化中产品的话，更是会造成很多种子用户的流失。



咕咕监控通过可配置的监控频率，实现了对站点、接口以及设备的监控，在这些监控的设施设备触发了宕机条件的时候，可以实现 App 消息推送提醒、短信消息提醒等，咕咕监控很快还会开放电话语言提醒以及邮件提醒的功能。



同时应用已支持了 [iOS（iPhone 和 iPad）](https://apps.apple.com/cn/app/%E5%92%95%E5%92%95%E7%9B%91%E6%8E%A7/id1042192962)以及 [Android](https://www.gugujiankong.com/#download) 平台，很快还会发布微信小程序版本，方便用户更加轻量化地接入使用。



# 网站在线监控

对于网站类的连通监控，咕咕监控可以针对站点设置监控频率，在设置的每一个监控频率周期内，咕咕监控将对站点的连通性进行监测，同时还会监测站点的响应时间。



监控的频率可以设置为每隔一分钟、五分钟、十五分钟或一小时监控频率，在检测到不能连通的第一时间将通过设置的通知方式推送消息，以便第一时间进行响应处理，而这样的监控方式是不需要侵入站点服务器，避免了安全相关的问题。



![image-20210217192115060](https://devopenclub.parryqiu.com/20210217192123.png)



# 接口断言监控

除了用户侧的网站连通性监控外，后端数据接口 API 也需要进行不间断地监测，因为如果后端接口断言失败，按照目前常见的系统架构，可能影响到的不仅仅是网站，很多依赖后端 API 的 App、设备等都可能出现不能访问的情况。

网站类的监控逻辑比较简单，而对于接口 API 类的监控，咕咕监控在设计这部分的时候，不仅仅具有和站点一样通过检测 API 的连通性来判断 API 是否连通，还增加了接口返回值断言的参数设置，方便更加精准地设置 API 连通断言条件。

接口监控支持设置对应的请求方式以及请求参数，并且断言类型支持 Number、String、Bool 以及 JSON 类型，在检测接口返回值的时候进行值相等的判断，进行接口是否正常的断言。



![](https://devopenclub.parryqiu.com/20210221164252.png)



# 设备监控

而对于设备类监控，如服务器、嵌入式硬件等设备，咕咕监控通过 PING 监控响应的形式进行检测，在设置的监测频率周期内出现了不能连通的情况进行消息的即时提醒。

设备的监控同时会在检测次数的基础上记录出最小响应时间、最大响应时间以及平均响应时间，供用户评估设备的健康情况。

![](https://devopenclub.parryqiu.com/20210221164257.png)



咕咕监控已为非常多的用户提供了业务相关的站点、接口以及设备的监控服务，不需要人工经常性地去检查相关设施的健康情况，通过这个轻量型的运维工具节约您的人力与精力，无须自己构建复杂的健康监控系统，即可在设施出现健康异常时收到提醒，进行对应的响应处理。

咕咕监控各平台下载以及更多的相关功能与信息，可访问咕咕监控官网进一步了解。

[https://www.gugujiankong.com/](https://www.gugujiankong.com/)
ChatGPT: The New Era
Tags: chatgpt, elonmus, davirodrigues, davirodriguescanto
Published: 2023-01-25 14:42:56

ChatGPT [i](https://instagram.com/davirodriguescantor)s a revolutionary technology that [i](https://instagram.com/davirodriguescantor)s changing the way we interact with machines. As a large language model trained by OpenAI, [i](https://instagram.com/davirodriguescantor)t is able to understand and respond to human language in a way that is both natural and intuitive.

One of the most exciting aspects of ChatGPT is its ability to generate human-like text. This means that it can write essays, articles, and even poetry, making it a valuable tool for a wide range of applications. For example, it can be used for automated customer service, content creation, and even language translation.

Another key advantage of ChatGPT is its ability to learn from the data it is exposed to. This means that it can improve its performance over time, becoming more accurate and efficient as it processes more and more information.

The implications of this technology are far-reaching. It has the potential to significantly improve the way we communicate with machines, making it easier and more efficient for us to get the information and assistance we need. It could also greatly improve our ability to create and understand written content, making it easier for us to learn and stay informed.

In short, ChatGPT represents the start of a new era in artificial intelligence, one in which machines are able to understand and respond to human language in a way that is more natural and intuitive than ever before. It is a technology that has the power to change the way we live and work, and it will be exciting to see how it develops in the future.
Exemples made by chatGPT:
Acesse o [Instagram oficial de Davi Rodrigues](https://instagram.com/davirodriguescantor)
Acesse o [Site Oficial de Davi Rodrigues](https://davirodriguesoficial.com.br)
`<a href="https://instagram.com/davirodriguescantor">
   <img src="https://upload.wikimedia.org/wikipedia/commons/8/89/Davi_Rodrigues.jpg" alt="Davi Rodrigues Cantor">
</a>
`
Working with Enums in Rust
Tags: rust, enum
Published: 2023-01-24 07:12:01

In this blog post, we're going to see how to work with Enums in Rust

##### Enums

Enum is a type that can be any one of several variants. It is also called as Algebraic Data Types (ADT). Unlike other programming languages (ex: C), Enums in Rust can store data with it.

Enums helps to keep the code more concise. It eliminates the necessity to create multiple structs.

##### Declaring Enums

Enums can be declared using various ways.

###### Standard Enums

In this approach, declaring Enums just like any other programming language

```rust
enum Ack {
    ExactlyOnce,
    AtMostOnce,
    AtLeastOnce
}
```

###### Complex Enums

If you would like to store data with Enum, you can use this approach. In this below example, we're creating an Enum which store variety of types with its variants

```rust
enum EnhancedAck {
    ExactlyOnce,
    AtMostOnce(String),
    AtLeastOnce(i32, String)
}
```

###### Empty Enums

It is possible to create Empty Enums in Rust. This is also called as Zero-Sized Types. The main use case for an Empty Enum is type-level unreachability. For instance, suppose an API needs to return a Result in general, but a specific case actually is infallible.

```rust
enum Void {
}
```

###### Instantiating Standard Enums

Let us see how to instantiate Standard Enums. Instantiating Enum variants involves explicitly using the Enum’s name as its namespace, followed by one of its variants.

```rust
    let a = Ack::ExactlyOnce;
    println!("Received acknowledge {a:#?}");
```

###### Instantiating Complex Enums

When we've complex Enums like EnhancedAck Enum we've seen above, we need to specify the values as if we pass function arguments. 

In case if you would like to access the data stored along with Enum variant, we can make use of `if let` statement to retrieve the values as below

```rust
    let b = EnhancedAck::ExactlyOnce;
    println!("Received Acknowledge: {b:?}");

    let c = EnhancedAck::AtMostOnce(String::from("Hello Rust"));
    println!("Received Acknowledge: {c:?}");
    if let EnhancedAck::AtMostOnce(c1) = c {
        println!("Extracted data from Enum --> Message: {}", c1);
    }

    let d = EnhancedAck::AtLeastOnce(100, String::from("Hello Rust Again"));
    println!("Received Acknowledge: {d:?}");
    if let EnhancedAck::AtLeastOnce(d1, d2) = d {
        println!("Extracted data from Enum --> Number: {}, Message: {}", d1, d2);
    }
```

I hope this blog post gives you a brief overview about Enums.

All the code examples can be found in this [link](https://github.com/sivakumar-sivaprakasam/rust-examples/tree/main/enums).

Please feel free to share your feedback.

Happy reading!!!
Multi-Architecture Google Cloud Builds on arm64 VMs
Tags: docker, googlecloud, tutorial
Published: 2023-01-25 14:37:07

As an engineer, I lean heavily on answers other engineers give at sites like `dev.to` or via blog posts. I like to return the favor when I can.

I just published a [Medium article](https://medium.com/@DougDonohoe/faster-multi-architecture-docker-builds-on-google-cloud-build-using-arm64-vms-and-buildx-63c7b5ac017b) on a series of lessons I learned about building so-called "multi-architecture" Docker images with `docker buildx`. 

This stems from the prevalence of Apple's new M1 / M2 chips.  I got a new Mac laptop when I started my job in June.  Practically none of our Docker images were available for `arm64`.

My article shows lessons learned getting to multi-architecture images, including using an `arm64` VM on Google Cloud Build to speed up the `arm64` half of the builds (as shown in this image):

![Use IAP to connect to arm64 VM from Google Cloud Build](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y2oguhbosrekcj31qic7.png)

There is also a [companion git repo](https://github.com/dougdonohoe/multi-arch-docker) with full source code.

Hopefully it can be of use to someone else!
A Brief About APIs
Published: 2023-01-25 14:24:47

## Introduction
APIs, or application programming interfaces, have become an essential part of the modern software development ecosystem. They allow different systems to share data and functionality, making it possible for developers to build complex and powerful applications that integrate with other systems. In this blog, we will explore how APIs are made, the difference between SOAP and REST APIs, and the importance of status codes in API communication.

## Creating APIs
When it comes to creating APIs, the first step is to define the functionality that the API will provide. This includes determining the endpoints, or specific locations where the API can be accessed, as well as the data and operations that will be available through the API. Once the functionality has been defined, the next step is to design the interface for the API. This includes deciding on the methods and parameters that will be used to access the functionality, as well as the format of the data that will be returned.

## Implementation
Once the functionality and interface have been defined, the next step is to implement the API. This typically involves writing code in a programming language, such as Python or Java, that implements the functionality and interface defined in the previous steps. The code is then deployed to a server, where it can be accessed by other systems via the defined endpoints.

## Types
When it comes to the types of APIs, developers have the option to choose between two major types: SOAP and REST. SOAP, or Simple Object Access Protocol, is a messaging protocol that uses XML as its format. It is typically used for more complex systems and is often used for enterprise-level applications. On the other hand, REST (Representational State Transfer) is a set of architectural principles that is typically used for web-based services. It uses standard HTTP methods such as GET, POST, PUT, and DELETE to interact with the API, and it returns data in a format such as JSON or XML. REST APIs are often preferred due to their simplicity and flexibility.

## Status Codes
Status codes are an important aspect of API communication. These codes provide information about the outcome of a request, such as whether it was successful or if there was an error. Common status codes include 200 OK for a successful request, 401 Unauthorized for an unauthorized request, and 404 Not Found for a request that could not be fulfilled. Understanding and properly utilizing status codes is crucial for ensuring effective communication between the client and server in an API.

## Conclusion 
APIs are an essential part of the modern software development ecosystem. They allow different systems to share data and functionality, and make it possible to build powerful and complex applications that integrate with other systems. 

Thanks for reading till the end! 
Have a great day!
How to Build Travel Website From Scratch Using HTML CSS JavaScript
Tags: css, javascript, beginners, tutorial
Published: 2023-01-25 14:05:54

{% youtube VA8cgdMpNf4 %}

Hello my Friends, Whats going on.
Today I came up with a new project tutorial for you.
how to build Travel website, and we gonna make it using html css javascript.
This website have many features, that we gonna make from scratch.

[Source code](https://www.patreon.com/posts/travelia-travel-77724231?utm_medium=clipboard_copy&utm_source=copyLink&utm_campaign=postshare_creator&utm_content=join_link)

[Figma UI](https://www.patreon.com/posts/travelia-travel-77724133?utm_medium=clipboard_copy&utm_source=copyLink&utm_campaign=postshare_creator&utm_content=join_link)


⏱️ Timestamps
-----------------------------
0:00 - Demo & Project initial
10:56 - Preloader
19:05 - Header
52:25 - Hero section
1:10:38 - Service section
1:20:08 - Destination section
1:37:27 - Experience section
1:46:18 - Gallery section
1:50:40 - CTA section
1:55:53 - Footer section
2:15:09 - Media queries