teleren/devto huggingface dataset:
Understanding of Python Lists
Tags: python, programming, coding, functions
Published: 2024-04-09 14:28:12

Python lists are versatile data structures that allow you to store and manipulate collections of items. Understanding lists and their various operations is essential for effective Python programming.

## What are Python Lists?

Lists in Python are ordered collections of items, where each item has an index. Lists can contain elements of different types, such as integers, strings, or even other lists. Lists are mutable, meaning they can be modified after creation.

## Creating Lists

Lists are created by enclosing items in square brackets [ ], separated by commas.

```
# Example of creating a list
my_list = [1, 2, 3, 4, 5]
```

## Accessing Elements

You can access individual elements of a list using square brackets and the index of the element. Indexing starts from 0 for the first element and -1 for the last element.

```
# Example of accessing elements
print(my_list[0])   # Output: 1
print(my_list[-1])  # Output: 5
```

## Slicing Lists

Slicing allows you to access a subset of elements from a list by specifying a range of indices.

```
# Example of slicing a list
print(my_list[1:4])   # Output: [2, 3, 4]
```

## Modifying Lists

Lists can be modified by adding, removing, or updating elements.

```
# Example of modifying a list
my_list.append(6)        # Add an element to the end
my_list.remove(3)        # Remove the element with value 3
my_list[0] = 'a'         # Update the first element
print(my_list)           # Output: ['a', 2, 4, 5, 6]
```

## List Methods

Python provides several built-in methods for working with lists, such as append(), remove(), pop(), insert(), sort(), and reverse().

```
# Example of list methods
my_list.append(7)        # Add an element to the end
my_list.sort()           # Sort the list
print(my_list)           # Output: [2, 4, 5, 6, 7]
```

## List Comprehensions

List comprehensions provide a concise way to create lists based on existing lists.

```
# Example of list comprehension
squares = [x**2 for x in range(5)]
print(squares)           # Output: [0, 1, 4, 9, 16]
```

## Nested Lists

Lists can contain other lists, allowing for the creation of nested data structures.

```
# Example of nested lists
nested_list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
print(nested_list[1][0])   # Output: 4
```

Python lists are versatile and powerful data structures that play a fundamental role in Python programming. By understanding how to create, access, modify, and manipulate lists, you can write more efficient and expressive code. Lists, along with their methods and list comprehensions, provide a rich set of tools for working with collections of data in Python.
How to connect Spring Boot to MongoDB on Remote Server
Tags: java, springboot, spring, mongodb
Published: 2024-04-09 14:20:17

Hey there, fellow devs!❤

In this blog, you will only see my love for databases and servers, all backend cravings😌

So, for a heavy introduction, I am imagining that you have set up a Spring Boot application with MongoDB. When using MongoDB on localhost, everything functions perfectly. The issue is that you get "Exception opening socket" and "connect timed out" when you attempt to connect to MongoDB on a remote server.

Right? 😁

Of course! Because you might have didn't follow the below-mentioned steps🧐

Please read my full blog here:
https://www.codegirl0101.dev/2024/04/exception-opening-socket-and-connect.html?m=1
Why is PHP still relevant in 2024?
Tags: php, webdev, backend, programming
Published: 2024-04-09 14:06:18

## What is PHP? 
PHP, or Hypertext Preprocessor, is a free, open-source scripting language used to create dynamic web pages. It's primarily used for server-side scripting, but can also be used for command-line scripting and desktop applications. A webpage might be made up entirely of a PHP script, or it might contain one or more PHP scripts that are embedded within standard HTML elements.

## Why PHP is a big deal?
In 2024, PHP still powers 76.5% of websites where the server-side programming language can be discerned. It's also used in content management and website development and is available on platforms like WooCommerce and Magento. PHP is also an excellent entry point for new developers, with its forgiving syntax, comprehensible errors, and immediate feedback. 



### Is PHP still relevant in today's tech world? 

Let's explore this question with some simple points:

**Popularity and Usage:** Despite the emergence of newer technologies, PHP remains one of the most popular programming languages for web development. It powers a significant portion of websites on the internet, including big names like **Facebook, Wikipedia, and WordPress**.


**Flexibility:** PHP is a versatile language that can be used for a wide range of tasks, from simple website scripting to complex web applications. Its flexibility allows developers to build dynamic and interactive websites with ease.

**Large Community and Resources:** One of PHP's biggest strengths is its extensive community support and a vast array of resources. From documentation to online forums and tutorials, developers have access to a wealth of knowledge and assistance when working with PHP.

**Integration Capabilities:** PHP integrates seamlessly with other technologies, making it a preferred choice for building web applications that require interaction with databases, APIs, and other systems. Its compatibility with popular databases like MySQL and PostgreSQL further enhances its appeal for web development.

**Job Opportunities:** Despite the emergence of newer languages and technologies, there is still a high demand for PHP developers in the job market. Many companies continue to rely on PHP for their web development projects, creating ample job opportunities for skilled PHP developers.



## Is it good to learn PHP now?
Learning PHP can still be a viable option depending on your goals and the projects you intend to work on. Learning PHP can still be a good option, especially if you're interested in web development and want to build a solid foundation in backend programming. However, it's essential to supplement your learning with other relevant technologies and frameworks to stay competitive in the ever-changing tech industry.



I hope this article has been helpful to you.❤️

Check out my other handles: [richard.is-a.dev/about](https://richard.is-a.dev/about)
Flutter CICD android with CodeMagic
Published: 2024-04-09 13:58:21

Here is pre-build script:
```bash
#!/bin/sh

curl --request GET -H "PRIVATE-TOKEN: $ACCESS_TOKEN" https://git.glsb.my/api/v4/projects/$PROJECT_ID/secure_files > secure_files.json

cat secure_files.json | jq '.[] | "\(.id),\(.name)"' | tr -d '"' > files.txt

while IFS=, read -a line;
do set -- "${line[@]}";
    curl --request GET -H "PRIVATE-TOKEN: $ACCESS_TOKEN" https://git.glsb.my/api/v4/projects/$PROJECT_ID/secure_files/$1/download > $2;
done < files.txt

mv logo.png assets/images/logo.png

flutter pub get
flutter pub run flutter_launcher_icons -f pubspec.yaml
```
Videos: Deploying Hugging Face models on Google Cloud
Tags: huggingface, mlops, ai, google
Published: 2024-04-13 02:58:38

---
title: Videos: Deploying Hugging Face models on Google Cloud
published: true
date: 2024-04-09 13:54:53 UTC
tags: huggingface,mlops,ai,google
canonical_url: https://julsimon.medium.com/videos-deploying-hugging-face-models-on-google-cloud-f80665b93d84
---

![](https://cdn-images-1.medium.com/max/1024/1*xXwsZL-7hkfc4e7omXjNQg.png)

Not one, not two, but THREE video walkthroughs showing you how to easily deploy [Hugging Face](https://www.linkedin.com/feed/?trk=homepage-basic_sign-in-submit#) models on [Google](https://www.linkedin.com/feed/?trk=homepage-basic_sign-in-submit#) Cloud Platform:

{% youtube mlU-2QYx4a0 %}

{% youtube cBdLw5BnGrk %}

{% youtube PFHzfzyY2iY %}

Happy deployments 😎
3 Mistakes to Avoid When Starting in Web Development
Tags: webdev, developer, php, javascript
Published: 2024-04-09 13:39:21

So you've decided to dive into the exciting world of web development! It's a fantastic choice, filled with creativity, problem-solving, and the ability to bring your ideas to life online. But like any new journey, there can be bumps in the road. Here are three common mistakes beginners make that you can easily avoid:

1. **Skipping the Fundamentals:**  Web development is built on a strong foundation. Don't be tempted to jump straight into flashy frameworks or complex projects. Take time to master the basics of HTML, CSS, and JavaScript. These are the building blocks of every website, and understanding them will make everything else much easier to learn. Many free online resources and tutorials can guide you through these core languages.

2. **Trying to Do Too Much at Once:** Web development offers a vast amount to learn, and it can be overwhelming. Instead of trying to become an expert in everything at once, focus on manageable steps. Pick a specific skill to learn, like building a simple web page with HTML and CSS. Once you've mastered that, move on to the next concept. This step-by-step approach will keep you motivated and ensure a strong grasp of each skill.

3. **Giving Up When You Get Stuck:**  Everyone gets stuck sometimes, even experienced developers.  When you encounter a problem, don't get discouraged. The web development community is incredibly helpful. There are online forums, communities, and Q&A platforms where you can ask questions and get guidance from others. Don't be afraid to reach out for help – it's a great way to learn and connect with fellow developers.
 
By avoiding these mistakes and embracing a steady learning approach, you'll be well on your way to becoming a successful web developer. Remember, the journey is just as important as the destination, so enjoy the process of learning and creating!
Implementing AutoLogout Feature in Class Components(React-JS)
Tags: react, autologout, javascript, webapplication
Published: 2024-04-09 13:31:32

We have noticed that financial applications, log automatically after a certain time of inactivity. This feature is particularly important when dealing with sensitive web applications like financial apps.

## NOTE: 


In MainDashboardEntry (this should be the base entry file for all component routes),

## talking about the solution 
When the component mounts, add listeners to the window that listens to the events.
Create a function that logs out a user after 10 seconds using set Timeout.
Each time any of the events is triggered, i.e. mouse move, click, scroll, keypress, etc., the timer to log out the user after 10 seconds of inactivity resets.
However, if none of the events is triggered within 10 seconds, that is app is inactive, the app automatically logs out.

mentioning are some points below these user events to guarantee user activity on the application

`let timer;
const events = [
  "load",
  "mousemove",
  "mousedown",
  "Click",
  "scroll",
  "keypress",
];` 
Note: these variables should be

`class IdleTimerContainer extends React.Component {
constructor(props: any) {
    super(props);
}
handleLogoutTimer() {
    timer = setTimeout(() => {
      // clears any pending timer.
      this.resetTimer();
      // Listener clean up. Removes the existing event listener from the window
      Object.values(events).forEach((item) => {
        window.removeEventListener(item, this.resetTimer);
        console.log("2 second")
      });
      // logs out user
      this.logoutAction();
    }, 2000); // 10000ms = 10secs. You can change the time.
  };
  resetTimer (){
    if (timer) clearTimeout(timer);
  };
  componentDidMount(): void {
    Object.values(events).forEach((item) => {
      window.addEventListener(item, () => {
        this.resetTimer();
        this.handleLogoutTimer();
      });
    });
  }
  logoutAction = () => {
    localStorage.clear();
    window.location.pathname = "/"; // login page while the user is an inactive redirect to login page we can set the path accordingly 
  };

export default IdleTimerContainer;

//If you are using this functionality we can use the useEffect

`
Démystifier YesWiki : L'outil incontournable pour la création de wikis collaboratifs
Published: 2024-04-09 13:26:53

Dans l'univers en constante évolution du développement web et de la collaboration en ligne, la nécessité de plateformes flexibles et accessibles pour la création de contenu collaboratif devient de plus en plus cruciale. C'est là qu'intervient YesWiki, un outil puissant mais convivial pour la création de wikis collaboratifs. Dans cet article, nous explorerons ce qu'est YesWiki, pourquoi il est si pertinent dans le paysage actuel du développement web, et comment vous pouvez commencer à l'utiliser dès aujourd'hui pour vos projets de création de contenu collaboratif.

Qu'est-ce que YesWiki ?
YesWiki est un système de gestion de contenu (CMS) basé sur le célèbre moteur de wiki, WikiNi. Il offre une plateforme conviviale et intuitive pour la création, la gestion et le partage de wikis collaboratifs. Contrairement à d'autres CMS plus traditionnels, YesWiki se concentre spécifiquement sur la création de wikis, ce qui en fait un choix idéal pour les projets où la collaboration et la contribution communautaire sont essentielles.

Pourquoi choisir YesWiki ?
**Simplicité **d'utilisation : YesWiki est conçu pour être facile à prendre en main, même pour les utilisateurs novices. Son interface intuitive permet à quiconque de créer et de modifier du contenu sans nécessiter de connaissances techniques approfondies.

**Flexibilité **: YesWiki offre une grande flexibilité en termes de personnalisation et de configuration. Vous pouvez facilement adapter l'apparence et les fonctionnalités de votre wiki en fonction des besoins spécifiques de votre projet.

**Collaboration en temps réel** : Avec YesWiki, plusieurs utilisateurs peuvent collaborer simultanément sur un même wiki, ce qui facilite la création et la gestion de contenu collaboratif.

Support multilingue : YesWiki prend en charge plusieurs langues, ce qui le rend idéal pour les projets internationaux ou multilingues.

**Gratuit et open-source** : YesWiki est distribué sous licence libre (GNU/GPL), ce qui signifie qu'il est gratuit à utiliser et que son code source est ouvert à tous. Cela favorise l'innovation, la transparence et la communauté de développeurs qui contribuent à son amélioration continue.
Laurie Williams ganha a "Holladay Medal"
Tags: premios
Published: 2024-04-09 13:13:30


![Laurie Williams](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zk0bp98lk4ixnjm1knfo.png)


A professora Laurie Williams, que entrevistamos em nosso episódio 36 (ver abaixo) ganhou a Medalha de Excelência Alexander Quarles Holladay, a maior honraria concedida pela North Carolina State University e pelo Conselho de Administração da universidade. O Chanceler Randy Woodson entregou a premiação durante uma Celebração da Excelência do Corpo Docente em 30 de abril.

{% youtube WyTOtlY3NFY %}


"Membro do corpo docente do Departamento de Ciência da Computação da NC State por duas décadas, Williams é uma líder nos esforços da universidade em cibersegurança. Em seu papel como investigadora principal, Williams supervisionou despesas de pesquisa que excedem impressionantes 33 milhões de dólares até o momento. Ela lidera três organizações de pesquisa distintas: é diretora fundadora do Instituto de Computação Segura da NC State, diretora do Centro de Cadeia de Fornecimento de Software Seguro da National Science Foundation (NSF) e co-diretora da Parceria para Excelência em Cibersegurança da Carolina do Norte patrocinada pela Agência de Segurança Nacional (NSA). Além disso, Williams foi co-diretora do Laboratório de Ciência da Segurança (SoS) patrocinado pela NSA de 2011 a 2023, focado na resolução de cinco problemas difíceis através da descoberta de fundamentos formais do design de sistemas confiáveis. Ela é a atual editora-chefe associada da IEEE Security and Privacy e da IEEE Software.

Ela ingressou na NC State em 2000 e recentemente foi nomeada a primeira Professora Universitária Distinta Goodnight em Ciências da Segurança. Ela atuou como chefe interina do Departamento de Ciência da Computação de 2014 a 2015; chefe associada do departamento de 2015 a 2016; e chefe interina do departamento de 2017 a 2018. Sua pesquisa está situada na confluência da engenharia de software e cibersegurança, especificamente no campo da segurança de software. Com foco na engenharia proativa de sistemas seguros, o trabalho de Williams visa prevenir ameaças cibernéticas, em vez de simplesmente reagir após ataques terem ocorrido.

Ao longo de sua carreira distinta, Williams recebeu inúmeras premiações, incluindo o Prêmio CAREER da NSF e o Prêmio de Professor Destaque da NC State, e foi nomeada Acadêmica Destaque da Universidade da NC State. Suas induções na Academia de Professores Destaque da NC State e na Academia de Liderança em Pesquisa destacam seu impacto excepcional nos domínios da educação e da pesquisa."

Detalhe adicional: no momento em que escrevo, temos dois professores brasileiros no departamento de computação da NC State: [Marcelo D'Amorim](https://www.csc.ncsu.edu/people/mdamori) e [Wesley K.G. Assuncao](https://www.csc.ncsu.edu/people/wguezas). Já entrevistamos Wesley:

{% youtube 9jFOx22TP10 %}

Leia a notícia completa no site da NC State:  https://www.csc.ncsu.edu/news/2587
cross-entropy examples
Published: 2024-04-09 13:05:53

Örnek olarak:

 `(Not: örneklerde i=1 dir.) `

Gerçek değer (hedef dağılım) = 0.5
Tahmin edilen değer (tahmini dağılım) = 0.2    olarak varsayarsak.
değerleri yerine koyarsak 
sonuç 1.1513 olarak ölçülüyor bu değer 0'a ne kadar yakınsa o kadar iyi olacaktır. 


Verilen bilgiler:

**Gerçek değer (hedef dağılım) = 0.5
Tahmin edilen değer (tahmini dağılım) = 4.8**

Çapraz entropi formülü:

[ H(p, r) = -\sum_{i=1}^{n} p_i \cdot \log(r_i) ]

Burada:

(p_i), gerçek değerdeki i. olayın olasılığını temsil eder (0.5).
(r_i), tahmin edilen değerdeki i. olayın olasılığını temsil eder (4.8).
Hesaplamaları yapalım:

[ H(0.5, 4.8) = -(0.5 \cdot \log(4.8)) = -(0.5 \cdot 1.5686) = -0.7843 ]

(cdot=çarpma)

Sonuç olarak, verilen gerçek değer ve tahmin edilen değer için çapraz entropi değeri yaklaşık -0.7843 olur. **Bu negatif değer, modelin tahminlerinin gerçek değerden uzak olduğunu gösterir. Çapraz entropi değeri genellikle pozitif olurken, bu durum modelin performansının düşük olduğunu gösterir.** 



Verilen bilgiler:

**Gerçek değer (hedef dağılım) = 0.5
Tahmin edilen değer (tahmini dağılım) = 0.48**

Sonuç olarak, verilen gerçek değer ve tahmin edilen değer için çapraz entropi değeri yaklaşık **0.3649** olur. Bu değer, modelin tahminlerinin gerçek değere yakın olduğunu gösterir. Çapraz entropi değeri genellikle pozitif olurken, bu durum modelin performansının iyi olduğunu gösterir. 



**Gerçek değer (hedef dağılım) = 0.5
Tahmin edilen değer (tahmini dağılım) = 0.49**


Sonuç olarak, verilen gerçek değer ve tahmin edilen değer için çapraz entropi değeri yaklaşık **0.00505** olur. Bu değer, modelin tahminlerinin gerçek değere çok yakın olduğunu gösterir. Çapraz entropi değeri genellikle pozitif olurken, bu durum modelin performansının gayet iyi olduğunu gösterir.
Minimize the time it takes to develop a useable software
Tags: plang, learning, management, programming
Published: 2024-04-09 13:02:42

> This article is about the Plang programming language, intent based programming language written in natural language. For more info checkout [plang.is](https://plang.is)

When you try to get a new software project into your company (or start a new one), you need to estimate the cost and time it takes to produce a result that satisfies the customer.

In a competing market, being able to give lower cost and shorter time period is golden. It raises the chance of getting that project.

This is where Plang programming language comes in. 

Let start with something simple like User registration in C#. 

It will look something like this, about 130 lines of code
![C# code for user registration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/081pmdpwqp82n750ba30.jpg)

This code is actually not acceptable, unless it is for your pet project. You will need to use fancy words such as Dependency Injection, Interfaces, Unit testing, Patterns and another 5-10 files. Your developers also need to be aware of security, such as the hashing algorithm, sql injection and more.

Now let's look at the same code in Plang

```plang
CreateUser
- Make sure %password% and %email% is not empty
- Hash %password%, write to %hashedPassword%
- Insert into users, %hashedPassword%, %email%
- Post, create user in MailChimp, Bearer %Settings.MailChimpApi%,    %email%
- Create bearer token from %email%, write to %bearer%
- Write %bearer% to web response
```

We go from 130 lines to 6 lines and it is easy to understand what is happening. 

Cognitive load is much less with these 6 lines than with 130 lines.

Fewer lines = better security, fewer bugs, more stable

Which all leads to less time and lower cost of your software development.

To learn more about [Plang](https://plang.is), checkout our [Github repo](https://github.com/PLangHQ). There is also a [Youtube channel](https://www.youtube.com/@plangHQ)
Managing Basic Storage
Published: 2024-04-09 13:01:36

**Pemartisian Disk**
Pemartisian disk memungkinkan administrator sistem untuk membagi hard drive menjadi beberapa unit penyimpanan logis, yang disebut partisi. Dengan memisahkan disk menjadi partisi, administrator sistem dapat menggunakan partisi yang berbeda untuk melakukan fungsi yang berbeda.

Misalnya, pemartisian disk diperlukan atau bermanfaat dalam situasi-situasi **berikut**:

*Batas ruang yang tersedia untuk aplikasi atau pengguna.

*Memisahkan sistem operasi dan file program dari file pengguna.

*Membuat area terpisah untuk penukaran memori.

*Memperbatas penggunaan ruang disk untuk meningkatkan kinerja alat diagnostik dan pencitraan cadangan.

-**Skema Pemartisian MBR**
Sejak tahun 1982, skema pemartisian Master Boot Record (MBR) telah menentukan bagaimana disk dipartisi pada sistem yang menjalankan firmware BIOS. Skema ini mendukung maksimal empat partisi primer. Pada sistem Linux, dengan menggunakan partisi perluasan dan logis, administrator dapat membuat maksimal 15 partisi. Karena data ukuran partisi disimpan sebagai nilai 32-bit, disk yang dipartisi dengan skema MBR memiliki ukuran disk dan partisi maksimum 2 TiB. Karena disk fisik semakin besar, dan volume berbasis SAN bahkan lebih besar dari itu, batas ukuran disk dan partisi 2 TiB dari skema pemartisian MBR bukan lagi batas teoretis, tetapi masalah dunia nyata yang sering dihadapi oleh administrator sistem di lingkungan produksi. Sebagai hasilnya, skema MBR warisan sedang digantikan oleh GUID Partition Table (GPT) baru untuk pemartisian disk.

-**Skema Pemartisian GPT**
Untuk sistem yang menjalankan firmware Unified Extensible Firmware Interface (UEFI), GPT adalah standar untuk menyusun tabel partisi pada hard disk fisik. GPT adalah bagian dari standar UEFI dan mengatasi banyak keterbatasan yang diberlakukan oleh skema berbasis MBR yang lama.

**Sebuah GPT menyediakan** maksimal 128 partisi. Berbeda dengan MBR, yang menggunakan 32 bit untuk menyimpan alamat blok logis dan informasi ukuran, GPT mengalokasikan 64 bit untuk alamat blok logis. Ini memungkinkan GPT untuk menampung partisi dan disk hingga delapan zebibyte (ZiB) atau delapan miliar tebibytes.

Selain mengatasi keterbatasan skema pemartisian MBR, GPT juga menawarkan beberapa fitur dan manfaat tambahan. Sebuah GPT menggunakan identifikasi unik global (GUID) untuk mengidentifikasi setiap disk dan partisi. Berbeda dengan MBR, yang memiliki satu titik kegagalan, sebuah GPT menawarkan keberulangan informasi tabel partisinya. GPT primer berada di bagian kepala disk, sementara salinan cadangan, GPT sekunder, di tempatkan di bagian akhir disk. Sebuah GPT menggunakan checksum untuk mendeteksi kesalahan dan kerusakan pada header GPT dan tabel partisi.