teleren/devto huggingface dataset:
This Week In Python
Tags: python, discuss, thisweekinpython
Published: 2023-03-24 14:44:29


**Fri, March 24, 2023**


This Week in Python is a concise reading list about what happened in the past week in the Python universe. 

**I have received some good suggestions for this week's content. Thank you.**

**Did I miss anything from the Python universe this week? What did you read or tried out?**


## Python Articles



- [How to Evaluate the Quality of Python Packages](https://realpython.com/python-package-quality/) 
- [Building And Distributing A macOS Application Written in Python](https://blog.glyph.im/2023/03/py-mac-app-for-real.html) 
- [Python 3.12: A Game-Changer in Performance and Efficiency](https://python.plainenglish.io/python-3-12-a-game-changer-in-performance-and-efficiency-8dfaaa1e744c) 
- [Django: How to profile and improve startup time](https://adamj.eu/tech/2023/03/02/django-profile-and-improve-import-time/) 
- [When to use Python's "list" constructor](https://www.pythonmorsels.com/using-list/) 




## Projects



- [pyenv-legacy](https://github.com/0q2/pyenv-legacy) – Diagnose python projects that lack specified versioning based on supported python versions at time of last commit
- [pysh](https://github.com/blipk/pysh) – bash in python
- [drf-test-generator](https://github.com/saadmk11/drf-test-generator) – A Django Package that generates basic unittest and pytest style tests for Django REST Framework ViewSets
- [duckargs](https://github.com/eriknyquist/duckargs) – Productivity tool for quickly creating python programs that parse command-line arguments. Stop writing argparse boilerplate code
- [chatter](https://github.com/mandgie/chatter) – A python chatGPT cli built with Typer



**Did I miss anything from the Python universe this week? What did you read or tried out?**
TIL 03/23/23
Published: 2023-03-24 14:29:59

Today was a very frustrating day as I dived into the EACH module in my Ruby course.

I was stuck on a specific question for quite some time:

## Write a program that:
# 
# Asks the user to enter a word.
#  The program should print each letter in the word the number of times it appears in the word. ##

I realized that I was highly overthinking it. I relied on chat GBT to help explain things to me and the answer it provided still was not passing in the ruby course.
I asked for help and others could not figure it out as well.
I decided to take a break and look at it with fresh eyes on 03/24. 
At this point I was still frustrated so, I asked another classmate of mine and WALA!
The answer is below: 

puts "Enter a word:"

answer = gets.chomp.split("")

answer.each do |letter|

  count = answer.count(letter)
p "#{letter} appears #{count} times"
end

I understand why this was done in this format. I still believe I need more and more practice!
Resolvendo problemas no HackerRank: Anexando e Excluindo strings;
Tags: javascript, programming, beginners
Published: 2023-03-24 14:17:50

Olá, seja bem vindo a mais um Resolvendo problemas no HackerRank: No caso de hoje, vamos adicionar e retirar letras dentro de um arrays sendo elas strings. Vejamos agora uma explicação detalhada e vejamos a resolução.

**Append and Delete -**

Nós temos duas sequências de letras minúsculas em inglês(as letras servem para português, são de nosso alfabeto). Você pode realizar dois tipos de operações na primeira string:

Acrescente uma letra minúscula do inglês ao final da string.
Exclua o último caractere da string. Executar esta operação em uma string vazia resulta em uma string vazia.

Dado um inteiro `k`e duas strings `s`e `t`, devemos converter  a sequência de `s`e deixá-la igualmente a `t`ainda seguinto o número de movimentações descritas por `k`.

- string s: a string inicial
- string t: a string desejada
- int k: o número exato de operações que devem ser realizadas

Vejamos um exemplo que ajude a entender o que se pede:

```
hackerhappy //s
hackerrank // t
9 // k
```

Nós vamos retirar as 5 últimas letras de `s`que são `happy` e logo após inserir + 4 formando `rank`e igualando a sequência de arrays entre `s`e `t`.

Compreendendo o funcionamento e sua lógica,vejamos agora como executar esse código:

```
function appendAndDelete(s, t, k) {
    // Write your code here
  for(var i = 0; i < s.length; i++) {
        if (s[i] !== t[i]) break;
    };
    let z = (s.length + t.length) - (i * 2);
    if (k >= s.length + t.length) return 'Yes'
    else if (z % 2 === k % 2 && z <= k) return 'Yes';
    else return 'No';
}
```

A função se inicia com os parâmetros (s,t e k) que tem os respectivos valores anteriormente revelados. Criamos uma iteração do index `i`, onde irá percorrer o comprimento do array de strings `s` enquanto ele for menor que ele. E se o index de `s` for diferente do index de `t`quebraremos a iteração e continuamos o próximo passo.

Depois criamos mais uma variável chamadada `z`que representa a soma do comprimento de `s`e `t` menos o index atual multiplicado por 2. Se o `k`que representa o número de ações a serem feitas for maior ou igual ao comprimento de `s` e `t`, retornaremos o string "YES". E se o restante de `z` for idêntico ao restante de `k` e  `z` for menor ou igual a `k`, também retornaremos uma string "YES". Caso contrário as situações anteriomente ditas, o retorno será uma string "NO".


Vejamos o resultado a seguir:

```
hackerhappy
hackerrank
9

input de resposta = YES
```

Assim, concluímos mais um _Resolvendo problemas no HackerRank:_ até a próxima.
UML (Unified Modeling Language)
Tags: uml, frontend
Published: 2023-03-24 14:01:53

UML
UML (Unified Modeling Language) adalah bahasa pemodelan untuk menggambarkan dan merancang sistem perangkat lunak. UML terdiri dari berbagai jenis diagram yang digunakan untuk menggambarkan berbagai aspek dari sistem yang dirancang. Berikut merupakan contoh dari diagram UML :
1.Diagram Use Case
Use case diagram digunakan untuk menggambarkan interaksi antara pengguna dan sistem perangkat lunak. Diagram ini memberikan daftar kasus penggunaan atau fungsi sistem. Use case diagram dapat membantu pengembang memahami kebutuhan pengguna dan menentukan fitur yang dibutuhkan sistem. 
 
![Use Case Diagram (www.uml-diagrams.org.)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2na6falv24voqq61tata.png)


2.Diagram Class
Class diagram digunakan untuk menggambarkan struktur kelas-kelas yang terdapat dalam sebuah sistem perangkat lunak. Diagram ini menunjukkan hubungan antara kelas dan properti serta metode dari masing-masing kelas. Diagram kelas membantu pemrogram memahami struktur sistem dan menjelaskan hubungan antar kelas. 
 
![Class Diagram (www.uml-diagrams.org)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zrp2a7zldvpfqnag1c3o.png)

3.Diagram Sequence
Sequence diagram digunakan untuk menggambarkan interaksi antar objek dalam sistem perangkat lunak. Diagram ini menunjukkan urutan pengiriman pesan antar objek. Sequence diagram membantu pengembang memahami aliran interaksi antara objek sistem. 
 
![Squence Diagram (www.uml-diagrams.org.)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k8kcauiv6usttmj06oi3.png)

4.Diagram Activity
Activity diagram digunakan untuk menggambarkan aktivitas atau proses dalam sistem perangkat lunak. Diagram ini menunjukkan urutan operasi yang dilakukan oleh objek sistem. Diagram aktivitas membantu pengembang memahami proses kerja sistem dan mengidentifikasi area. 
 
![Activity Diagram (www.uml-diagrams.org.)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qcyydq0dpj8v08tu2o09.png)
The easiest way to use HubSpot Search API
Tags: beginners, programming, typescript, api
Published: 2023-03-24 13:47:24

Whenever working on integrations, we basically use the APIs to retrieve the information. Some APIs are pretty straightforward to understand, so just by looking at the endpoint we can make out how to use it but sometimes, you need to dig in a bit to understand the usage.

I came across this situation in my application where I wanted to retrieve all the contacts from HubSpot based on a particular property value. For eg. If there is a contact property named **Company_Affiliation** and I want to retrieve all the contacts with a company affiliation value of say **Fictional Company** then how should I use the Search API?

## The Endpoint

POST
/crm/v3/objects/contacts/search

## The Input

```
const inputHubSpotSearchObject=
    {
        "objectName":"contacts",
        "limitValue":"100",
        "afterValue":"0",
        "filters":[
            {
                "value":req.body.company_name,
                "propertyName": "company_affiliation",
                "operator": "EQ"
            }
            
        ]
    }
```

## The API call

```
const response = await axios.post(`${process.env.API_URL}/api/hubspot/search`,inputHubSpotSearchObject,
                          {
                          headers: {
                              "Content-Type": "application/json",
                              Authorization: `Bearer ${accessToken}`,
                          }});
```

## The Response


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

## Conclusion
I hope you found this article helpful. For more information visit [link](https://developers.hubspot.com/docs/api/crm/search)

Happy Coding!!!
Days_13 Gradebook Builder
Published: 2023-03-24 13:39:12

Here is a grading scale to help you decide the letter grade the user received (feel free to use a different grading scale if you like.)

Letter Grade	Percentage
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5dt5srccbqqj6hjb0t9d.PNG)

```
class Rank():
  def __init__(self, nama, nilai):
    self.nama = nama
    self.nilai = nilai
    
  def penentuan(self):
    if self.nilai >= 90 and self.nilai <= 100:
      print(self.nama,"Value A+,CONGRATULATIONS")
    elif self.nilai >= 80 and self.nilai <= 89:
      print(self.nama,"Value A,Bagus. Pertahankan")
    elif self.nilai >= 70 and self.nilai <= 79:
      print(self.nama,"Value B,Tetap semangat")
    elif self.nilai >= 60 and self.nilai <= 69:
      print(self.nama,"Value C,Tingkatkan Lagi")
    elif self.nilai >= 50 and self.nilai <= 59:
      print(self.nama,"Value D,Jangan menyerah")
    else:
      print(self.nama,"Belajar Yang Giat ok!!!!!!!!")
      
def Masukan(): 
  nama = input("Masukan Nama? ")
  nilai = int(input("Masukan Nilai? "))
  t = Rank(nama,nilai)
  t.penentuan()
Masukan()
```
1. Making Your Website Accessible to All: An Introduction to Web Accessibility
Tags: webdev, a11y, inclusion, programming
Published: 2023-03-24 13:33:11

As the internet becomes more pervasive in our daily lives, it's essential to ensure that everyone can access the same information and services online, regardless of any disabilities or impairments they may have. This is where web accessibility comes in - the practice of designing and developing websites and digital content that people of all abilities can use.
In this first post on web development accessibility, we'll explore the basics of web accessibility, why it's essential, and how we can ensure our website is accessible to everyone.

## What is Web Accessibility?
Web accessibility is the practice of designing and developing websites, tools, and technologies that are accessible to people with disabilities. Disabilities can include visual, auditory, physical, and cognitive impairments.

## Why is Web Accessibility Important?
Web accessibility is crucial for several reasons. Firstly, it ensures everyone can access the same information and services online, regardless of their abilities. It also promotes inclusivity and diversity, helping to create a more equitable and fair society.
In addition, web accessibility is essential for businesses and organizations that want to reach the broadest possible audience. By making a website accessible, one can tap into the estimated 1 billion people worldwide who have disabilities, many of whom are potential customers or clients.

## How to Make A Website Accessible?
There are several best practices and guidelines to make a website accessible to everyone. Some of these include:

1. Providing text alternatives for non-text content, such as images and videos
2. Ensuring that a website is keyboard accessible
3. Using clear and simple language for content
4. Making sure that your website is compatible with assistive technologies, such as screen readers and braille displays
5. Providing captions and transcripts for audio and video content

## Conclusion
Web accessibility is a crucial aspect of web development that ensures everyone can access the same information and services online, regardless of their abilities. By following best practices and guidelines for web accessibility, you can create a website that is inclusive and accessible to everyone. In our upcoming posts, we'll delve deeper into these best practices and explore more ways to make your website accessible to all.

Thank you for reading! Stay tuned for next week's post on "Understanding WCAG Guidelines for Web Accessibility."
5 ChatGPT-4 Productivity Hacks: Unleash the Power of AI and Supercharge Your Software Engineering Workflow
Tags: productivity, career, discuss, ai
Published: 2023-03-24 13:18:44

Hey, all you amazing code crusaders! 🚀 Are you ready to revolutionize your software engineering workflow and unleash the power of AI? Introducing ChatGPT-4, your new secret weapon to supercharge your productivity and leave your competition in the dust! Check out these 5 mind-blowing productivity hacks, and prepare for a future of coding domination. Let's do this! 💥

## Hack #1: Instant Code Review Buddy 🧠🔍

Tired of waiting for your teammates to review your code? ChatGPT-4 is here to save the day! With its powerful AI capabilities, it can quickly review your code, identify potential issues, and suggest improvements. Just give it access to your code and watch the magic happen. Say goodbye to long review cycles!

## Hack #2: Code Snippet Generator ⚡🎯

Struggling with a tricky problem and need a quick code snippet? ChatGPT-4 has your back! Just describe your problem, specify your programming language, and let the AI create a tailored snippet to help you tackle that pesky issue. This hack will have you coding like a pro in no time!

## Hack #3: Programming Language Translator 🌐💬

Can't remember the syntax for that obscure programming language? No worries! ChatGPT-4 can translate code from one language to another with jaw-dropping accuracy. Just input your code, specify the target language, and watch as ChatGPT-4 flawlessly converts your code. It's like having your very own babel fish for programming languages!

## Hack #4: Instant Tech Support Guru 🧞‍♂️💡

Stuck on a problem and can't find the answer in online documentation? ChatGPT-4 to the rescue! Just describe your issue, and the AI will search its vast knowledge base to provide a concise, helpful solution. It's like having a tech support guru in your pocket 24/7!

## Hack #5: Creative Brainstorming Partner 🎨🌪️

Need fresh ideas for your next project? ChatGPT-4 can be your creative brainstorming partner! Just provide some context, and the AI will generate a plethora of innovative ideas, helping you think outside the box and explore new possibilities. Let your creativity run wild!

---

Well, fellow software engineers, the future is here, and it's looking brighter than ever! With these 5 ChatGPT-4 productivity hacks, you'll be ready to tackle any challenge that comes your way. Now it's your turn to weigh in! Have you tried any of these hacks? What's your favorite way to use ChatGPT-4 in your software engineering workflow? Share your thoughts, experiences, and wildest success stories in the comments below! Let's help each other level up and embrace the full potential of AI in our coding adventures! 🚀
Anvil meets OpenAI meets People
Tags: anvil, openai, audit, tutorial
Published: 2023-03-24 13:15:04

Earlier this week I had a very quick Twitter exchange about “wouldn’t it be nice to have a UI for logging outputs for AI chat, to provide an audit trail for ideas.”

The context was patents, but being able to distinguish the owner of creativity is going to become ever more important, especially given that academics have already decided [the detection game is a turkey](https://medium.com/r/?url=https%3A%2F%2Farxiv.org%2Fabs%2F2303.11156).

I set to it and doodled out the application in [Anvil.Works](https://anvil.works), a mega-powerful python framework for full stack development, hooking it straight into the latest version of the [OpenAI API](https://platform.openai.com/).


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

The result is damn tidy for an hour of effort and I've made it open, so [people can clone](https://anvil.works/build#clone:JF2OSZV3VSHZFNIE=RNOYZTGTMO7L6HXYZLHFNQKV) and tinker to their heart's content.

You can use a free account in Anvil. You'll need to add your secret key for OpenAI's API to the secrets manager and call it "openaikey."

I've made a quick [video tutorial](https://www.youtube.com/watch?v=woBqV3I6Htg) to accompany this, so you can see how the magic is done.
https://www.youtube.com/watch?v=woBqV3I6Htg
How to Install Magento Extension
Tags: webdev, magento, magento2tutorial
Published: 2023-03-24 12:44:33

Introducing a Magento expansion is extremely valuable for your store; it adds greater usefulness to your store. It upgrades the client experience for all the more great traffic with additional draws in clients. It likewise further develops your store perceivability.

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

A clear cycle can be finished in only a couple of steps. All things considered, this gets everything rolling. You can likewise begin to introduce the subject assuming you are forgotten about with it. Here is a bit by bit guide on the most proficient method on how to install a Magento extension.

For more info, visit https://webguru.dev/how-to-install-magento-extension/
Internal of RXDB: Plugins, Storages Adapters 🚀
Tags: javascript, rxdb, angular, beginners
Published: 2023-03-24 12:30:00

RXDB (short for Reactive Database) is an open-source client-side database that utilizes reactive programming and offline-first principles.

## 🏛️ Architecture

RXDB follows a modular architecture, which is divided into multiple layers. Each layer has a specific responsibility, making the codebase easy to maintain and extend. The main layers of RXDB are:

1.  📑 **Core Layer**: This layer provides the basic functionality of RXDB, such as document CRUD operations and query execution.

1. 🧩 **Plugin Layer**: Plugins are building blocks that helps to extend the functionality of RXDB. They can be used to provide encryption, sync, and validation features, among others. This layer is responsible for the communication between RXDB and the underlying database system. Currently, RXDB supports multiple adapters, including PouchDB, MongoDB, and SQLite.

## 🗃️ Data Structures

RXDB uses the JSON data format to store and retrieve data. Each document in RXDB is represented as a JSON object, which can be easily manipulated using JavaScript. Documents can have arbitrary nesting, allowing for complex data structures to be stored in the database.

In addition to the JSON data format, RXDB also supports binary data storage using the Blob data type. This can be useful when working with large files or binary data, such as images or videos.

## 🧩 Plugins

RXDB's plugin system allows developers to extend the functionality of the database by adding additional features. Some popular plugins include:

1. **Encryption Plugin**: This plugin provides transparent encryption for data stored in RXDB. It uses the Web Cryptography API to encrypt and decrypt data on the client-side, ensuring that sensitive data remains secure.

2. **Replication Plugin**: This plugin enables data synchronization between multiple instances of RXDB. It uses a variety of synchronization protocols, including PouchDB's Sync Protocol, to keep data consistent across different devices and platforms.

3. **Validation Plugin**: This plugin provides data validation and schema enforcement for RXDB. It can be used to ensure that data stored in the database conforms to a specific schema, preventing data corruption and other issues.

## Storage

RXDB supports multiple storage options, including:

1. **IndexedDB**: This is the default storage backend for RXDB. It is a key-value store that is built into most modern web browsers, making it a good choice for web-based applications.

2. **LocalStorage**: This storage backend is also built into most modern web browsers. It provides a simple key-value store, but has a smaller storage capacity than IndexedDB.

3. **Memory**: This storage backend stores data in memory, making it useful for testing and debugging purposes.

4. **Custom**: RXDB also allows developers to create their own custom storage backends by implementing the RxStorage interface.

##  Angular + ngrx + rxdb example: 

https://github.com/dhrn/rxdb-ngrx-example or https://stackblitz.com/edit/angular-1zvpdc
Expose Your Currently Listening Song on Your Profile with Last.fm Profile Readme
Tags: lastfm, profile, readme, typescript
Published: 2023-03-24 12:02:00

I love listening to music and sharing my taste with others. Recently, I discovered GitHub's new system for effectively displaying SVG content with Markdown and HTML on readme(s). With that in mind, I created a tool called [Last.fm Profile Readme](https://lastfm-profile-readme.vercel.app), which allows you to display an SVG image with your currently listening song details on your Github profile readme.

## How to use

To display your currently listening song, add an image to your readme with the following link:

`https://lastfm-profile-readme.vercel.app/api/:username`

Replace :username with your Last.fm username. The API will return an SVG image with your currently listening song details, which can be displayed in your Github profile readme.

Here is an example of how it should look:

```less
![Currently listening to](https://lastfm-profile-readme.vercel.app/api/Monochromish)
```

![Currently listening to](https://lastfm-profile-readme.vercel.app/api/Monochromish)

(ignore the weird font that's on Dev.to)

## Customisation

You can customize the image by adding query parameters to the link:

- `color` - The color of the card (Hex color code) (Default: `#000`)
- `textColor` - The color of the text (Hex color code) (Default: `#fff`)
- `isRounded` - Whether the card should be rounded or not (Default: `false`)
- `displayName` - Whether last.fm username should be displayed or not (Default: `false`)
- `apiKey` - You can use your own Last.fm API key in case my preexisting one dies somehow

Here is an example of how it should look with url queries:

```less
![Currently listening to](https://lastfm-profile-readme.vercel.app/api/Monochromish?color=25332E&textColor=D8D8D8&isRounded=true&displayName=true)
```

![Currently listening to](https://lastfm-profile-readme.vercel.app/api/Monochromish?color=25332E&textColor=D8D8D8&isRounded=true&displayName=true)
PHP Login Page With Chat GPT
Tags: webdev, programming, tutorial, beginners
Published: 2023-03-24 11:58:51

{% embed https://www.youtube.com/watch?v=Z5MuDfW3hLM %}

In this tutorial, we'll show you how to use Chat GPT, a powerful language model developed by OpenAI, to build a PHP login page. Instead of manually coding the login page, we'll use Chat GPT to generate the code for us.

First, we'll log in to OpenAI. Then, we'll ask Chat GPT to help us generate the HTML, CSS, and PHP code for our login page. We'll also show you how to customize the generated code to suit your specific needs.

By using Chat GPT, you can save time and effort in building your login page, as well as take advantage of the model's natural language processing capabilities to provide a more intuitive and user-friendly experience for your users.

This tutorial is suitable for developers of all skill levels. We'll provide step-by-step instructions and all the code used in the tutorial for you to download and use in your own projects. So, join us as we show you how to use Chat GPT to build a PHP login page and streamline your development process.

#chatgpt #chatgpttutorial #chatgptprompts #chatgptphp