teleren/devto huggingface dataset:
25 Useful Coding Tips for Python Beginners
Tags: python, beginners, programming
Published: 2023-03-15 04:16:23

I created a long video on youtube pertaining to 25 tips to help you write better code in Python, this can help you in a professional setting, or in coding interviews. These tips include ways to improve the readability/maintainability of your code, improve efficiency, and learn aspects of the Python language you may have never heard of!

There are many tips which I summarize here:

- Organize Imports Properly
- Learn to Use PDB
- Use the new Match/Case Statements
- Learn about the Bisect Library
- Learn about the Walrus Operator
- Know when to use Enumerate over Range
- Utilize Numpy for Efficiency
- cProfile for finding Bottlenecks
- Catch-all Unpacking to improve readability
- Prefer f-strings over other string formatting methods
- Naming Variables properly
- Know when to use Generators over Lists
- .get() Method to help with dictionaries
- Specific Exceptions as opposed to broad exceptions
- .zip() Method when iterating over multiple lists can help
- Loops with Else Statements, not a very well-known feature in Python
- Write Docstrings for complicated functions in practice
- Be cautious with Python Dict Order
- List Comprehension better practice
- Use Dictionary Comprehension, a lot of people do not do this for some reason
- Avoid one-line if/loops (seen a lot in hackerrank and leetcode)
- Don’t check for empty containers/sequences, use "if not" instead
- Split Long Lines of more than 79 chars
- Add new line to the end of a file always in accordance with pep8
- … Practice these points in your projects and share with teammates in code reviews :)

Would really appreciate anyone watching the video. I definitely think it can help new beginners. If you like such content please subscribe to the channel it would mean a lot!

Here is the video on youtube: 
{% embed https://www.youtube.com/watch?v=2U98PgL-kuI %}

Channel is here: [channel](https://www.youtube.com/@mmshilleh
)
Of course, comments are always appreciated, thanks!
O que é WebSockets e qual sua função na programação?
Published: 2023-03-15 03:56:58

Os WebSockets são uma tecnologia que permite a comunicação bidirecional em tempo real entre um navegador da web e um servidor. Eles foram introduzidos pela primeira vez em 2011 como parte do HTML5 e oferecem uma alternativa mais eficiente e escalável do que as técnicas de comunicação anteriores, como AJAX ou polling.

Em termos simples, os WebSockets permitem que um servidor envie mensagens para um cliente (navegador) e vice-versa, sem a necessidade de solicitações adicionais do cliente. Isso significa que as atualizações de conteúdo podem ser enviadas instantaneamente para o cliente, sem atraso ou sobrecarga desnecessária no servidor.

Um exemplo de uso popular dos WebSockets é em aplicativos de chat em tempo real, como o Facebook Messenger ou o Slack. Em vez de atualizar a página constantemente para verificar se há novas mensagens, os WebSockets permitem que as mensagens sejam enviadas instantaneamente para todos os usuários conectados ao chat.

Os WebSockets também são úteis em jogos online, onde a comunicação em tempo real é necessária para manter a sincronização entre os jogadores. Em vez de enviar atualizações de jogo periodicamente, os WebSockets permitem que os jogadores se comuniquem instantaneamente com o servidor e com outros jogadores.

Além disso, os WebSockets são usados em muitos outros casos de uso, incluindo notificações em tempo real, monitoramento de dados em tempo real, colaboração em tempo real e muito mais.

Os WebSockets são baseados em um protocolo de rede chamado WebSocket Protocol (RFC 6455), que é um padrão da Internet para comunicação em tempo real. O protocolo é projetado para ser escalável e seguro, com suporte para criptografia de ponta a ponta usando SSL / TLS.

Os WebSockets são suportados por todos os principais navegadores, incluindo Chrome, Firefox, Safari e Edge. A maioria das linguagens de programação da web, como Java, Python, Ruby e JavaScript, também possui bibliotecas para trabalhar com WebSockets.

Em resumo, os WebSockets são uma tecnologia poderosa para comunicação em tempo real entre navegadores da web e servidores. Eles permitem atualizações instantâneas de conteúdo sem a necessidade de solicitações adicionais do cliente, o que os torna ideais para aplicativos de chat, jogos online e muitos outros casos de uso. Com suporte em todos os principais navegadores e linguagens de programação da web, os WebSockets são uma ferramenta importante para desenvolvedores da web que desejam criar aplicativos em tempo real de alta qualidade.
Game As a Service
Tags: saas, devops, liveops, gamedev
Published: 2023-03-15 03:56:43

A Game built as a service, is something that can be played for a very long time and can be updated from from the backed without making huge changes to the game client. In this case to the core game mechanics or launching a game all together. 

To build a game as a service you need the right tools that that let you operate on the game by changing game configurations in real-time on productions servers, based on the data that is being collected from the game and the players who play the game.

A game technically is a software, that is interactive in real-time. Though most of the games run on local machine, a bunch of games run in the cloud. Most importantly these days for a game to be successful you need be able to manages and learn about how players are interacting with your games, and may be tweak the game mechanics, as well as enable match making that makes it fun players with similar skillset play and compete with each other.

Now if you are a developer, designer, or an artist building these games, you need to have the right set of tools at you disposal to make these changes, even better automate and build systems that will constantly update or even build a unique version of your game tailored for each player.. How can you do it?

Well this is where you have to invest and plan very early in your development cycle, how your development pipeline is setup so your game is a service that is living and adopting to players behavior to keep them engaged, entertained, challenged and most importantly having fun.

A Game when designed as a service, with the goal of providing custom game play, art. challenge on any platform..

Stay tuned for more details on how this can be achieved .
React App Showing Blank
Tags: react, reactnative, webdev, javascript
Published: 2023-03-15 03:44:23

Greetings Program...mers!  So I am a React virgin in need of some help.  Please forgive any ignorance on my end ahead of time as I am still learning React.  So here's where I am:
**1)** I have my project exactly where I want it for the web; 
**2)** I run 'yarn start' and it compiles with no errors via the terminal on localhost:3000 and displays fine in a browser window; 
**3)** After confirming all functionality and properly displaying, I run 'yarn global add serve' because I was under the impression that this was the next step; 
**4)** I then ran 'serve -s build' to build the project for production;

I threw the build folder out onto my server thinking it was ready, and the index.html file is still just displaying a blank screen. I even tried sharing hosting access in my .htaccess file by adding: 
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L
but unfortunately, this did nothing.
This needs to be moved into production for my website without using a local IP address or emulated server. Thank you in advance.
ANALYZE Table
Tags: opengauss, database
Published: 2023-03-15 03:42:14

The execution plan generator needs to use table statistics to generate the most effective query execution plan to improve query performance. After data is imported, you are advised to run the **ANALYZE** statement to update table statistics. The statistics are stored in the system catalog **PG_STATISTIC**.

**ANALYZE Table**
**ANALYZE** supports row-store and column-store tables. **ANALYZE** can also collect statistics about specified columns of a local table. For details on **ANALYZE**, see **ANALYZE | ANALYSE**.

Update table statistics.

Do **ANALYZE** to the **product_info** table.

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

**autoanalyze**
openGauss provides the GUC parameter autovacuum to specify whether to enable the autovacuum function of the database.

If **autovacuum** is set to **on**, the system will start the autovacuum thread to automatically analyze tables when the data volume in the table reaches the threshold. This is the autoanalyze function.

**·** For an empty table, when the number of rows inserted to it is greater than 50, **ANALYZE** is automatically triggered.
**·** For a table containing data, the threshold is 50 + 10% x **reltuples**, where **reltuples** indicates the total number of rows in the table.
The autovacuum function also depends on the following two GUC parameters in addition to **autovacuum**:

· track_counts: This parameter must be set to **on** to enable statistics collection about the database.
· autovacuum_max_workers: This parameter must be set to a value greater than **0** to specify the maximum number of concurrent autovacuum threads.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cn5awvc6mevompkuh0ty.png)
Zerando HackerRank ( 14 )
Published: 2023-03-15 03:39:00

E no décimo quarto desafio desta serie que queima os miolos, vamos abordar um problema um pouco mais simples que envolve numero pares e impares.

Para isso vamos aprender 2 conceitos.

O primeiro é o de como descobrir se um número é par ou não. 
Para isso usamos o sinal "%", utilizamos este sinal em javascript para relacioná-lo ao resto de uma divisão, por exemplo:

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

Esse trecho de código define uma variável chamada "num" e atribui o valor 10 a ela. Em seguida, ele verifica se "num" é um número par usando o operador módulo (%).

O operador módulo retorna o resto da divisão entre dois números. Quando um número é divisível por 2 (ou seja, é um número par), o resto da divisão por 2 é 0. Portanto, a condição "num % 2 === 0" verifica se o valor de "num" é um número par.

Uma forma um pouco mais completa de se fazer isso seria assim:

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

O segundo conceito que vamos aprender para isso sera o de uso de um ternário.

O operador ternário é uma estrutura de controle de fluxo em JavaScript (e em outras linguagens de programação) que permite avaliar uma expressão e retornar um dos dois valores possíveis com base em uma condição.

A sintaxe do operador ternário é a seguinte:

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

Utilizando essa logica o código que faremos de par e impar ficara assim:

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

A expressão "num % 2 === 0" é avaliada, verificando se "num" é par ou ímpar usando o operador módulo (%). Se o resultado da expressão for verdadeiro, ou seja, se "num" for um número par, a primeira expressão após o ponto de interrogação é executada, o que é uma chamada ao console.log() para imprimir a mensagem "Even number". Caso contrário, se o resultado for falso, ou seja, se "num" for um número ímpar, a segunda expressão após os dois pontos é executada, que é outra chamada ao console.log() para imprimir a mensagem "Odd number".
Performing a Deep Copy by Creating a Temporary Table and Truncating the Original Table
Tags: opengauss, database
Published: 2023-03-15 03:37:15

Run the **CREATE TABLE …. AS** statement to create a temporary table for the original table, truncate the original table, and batch insert data of the temporary data into the original table.

When creating the temporary table, retain the primary key attributes of the original table. This method is recommended if the original table has dependency items.

**Procedure**
1. Run the **CREATE TABLE AS** statement to create a temporary table **customer_t_temp** for the **customer_t** table.

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

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

2. Truncate the original table **customer_t**.

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

3. Run the **INSERT INTO…SELECT** statement to batch insert data of the temporary table into the original table.

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

4. Delete the temporary table **customer_t_temp**.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l1dviw5yf3gysjqcssxg.png)
Performing a Deep Copy by Using the CREATE TABLE LIKE Statement
Tags: opengauss, database
Published: 2023-03-15 03:33:40

Run the **CREATE TABLE LIKE** statement to create a copy of the original table, batch insert data of the original table into the copy, and rename the copy to the name of the original table. This method does not inherit the primary key attributes of the original table. You can use the **ALTER TABLE** statement to add them.

**Procedure**

1. Run the **CREATE TABLE LIKE** statement to create the copy **customer_t_copy** of the **customer_t** table.

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

2. Run the **INSERT INTO…SELECT** statement to batch insert data of the original table into the copy.

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

3. Delete the original table.

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

4. Run the **ALTER TABLE** statement to rename the copy to the name of the original table.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2xeaed1qm1u6wnokbgp7.png)
DrupalCon Lille 2023 Call for Papers Now Open.
Tags: drupal
Published: 2023-06-14 14:25:31

---
title: DrupalCon Lille 2023 Call for Papers Now Open.
published: true
date: 2023-03-15 00:37:17 UTC
tags: Drupal
canonical_url: https://thehigglers.com/blogs/drupalcon-lille-call-for-paper-announcement/
---

The Drupal community is gearing up for DrupalCon Lille 2023, which will take place in the charming city of Lille, France, from August 23-27, 2023. DrupalCon is the premier event for Drupal enthusiasts, and this year’s conference promises to be an exceptional one. The organizers have announced that the call for papers is now open, and they’re inviting submissions from the community.

DrupalCon Lille is an excellent opportunity to share your expertise, knowledge, and experience with other Drupal enthusiasts. The conference brings together developers, designers, project managers, and business leaders from around the world to learn, network, and collaborate. As a speaker, you’ll have the opportunity to share your insights and ideas with a captive audience, and contribute to the advancement of the Drupal community.

The organizers are looking for presentations on a wide range of topics related to Drupal development, design, and business. The following are some of the suggested topics:

- Site building and development
- Front-end development
- Back-end development
- DevOps and infrastructure
- DevOps and infrastructure
- Business strategy and marketing
- Project management
- Case studies and success stories
- Community and culture

The organizers of DrupalCon Lille welcome proposals from Drupal enthusiasts of all skill levels and backgrounds. If you have a great idea for a presentation, don’t wait too long to submit it. The deadline for session submissions is April 24, 2023, at 23:59 CET (Lille Time). Please note that the organizers have announced that there will be no deadline extensions this year, so it’s important to submit your proposal as soon as possible. [Session Submission Link](https://kuonicongress.eventsair.com/PresentationPortal/Account/Login?ReturnUrl=%2FPresentationPortal%2Fdrupalcon-lille-2023%2Fsession-portal)

Submitting a proposal is easy. Simply visit this [website](https://kuonicongress.eventsair.com/PresentationPortal/Account/Login?ReturnUrl=%2FPresentationPortal%2Fdrupalcon-lille-2023%2Fsession-portal) create your account and login and there on-wards follow the online submission form. You’ll need to provide some basic information about yourself, your proposed session, and your speaking experience. The deadline for submissions is April 24, 2023, so be sure to get your proposal in on time.

In conclusion, DrupalCon Lille is an excellent opportunity to share your expertise and learn from other Drupal enthusiasts. If you’re passionate about Drupal development, design, or business, consider submitting a proposal for DrupalCon Lille 2023. Who knows? You might just end up inspiring someone else in the community.
Performing a Deep Copy by Using the CREATE TABLE Statement
Tags: opengauss, database
Published: 2023-03-15 03:30:10

Run the **CREATE TABLE** statement to create a copy of the original table, batch insert data of the original table into the copy, and rename the copy to the name of the original table.

When creating the copy, you can specify table and column attributes, such as the primary key.

**Procedure**
Perform the following operations to carry out a deep copy for the **customer_t** table:

1. Run the **CREATE TABLE** statement to create the copy **customer_t_copy** of the **customer_t **table.

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

2. Run the **INSERT INTO…SELECT** statement to batch insert data of the original table into the copy.

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

3. Delete the original table.

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

4. Run the **ALTER TABLE** statement to rename the copy to the name of the original table.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ggc2tlxa9azo900y3gf.png)
Updating and Inserting Data by Using the MERGE INTO Statement
Tags: opengauss, database
Published: 2023-03-15 03:26:39

To add all or a large amount of data in a table to an existing table, you can run the **MERGE INTO** statement in openGauss to merge the two tables so that data can be quickly added to the existing table.

The **MERGE INTO** statement matches data in a source table with that in a target table based on a join condition. If data matches, **UPDATE** will be executed on the target table. Otherwise, **INSERT** will be executed. This statement is a convenient way to combine multiple operations and avoids multiple **INSERT** or **UPDATE** statements.

**Prerequisites**
You have the **INSERT** and **UPDATE** permissions for the target table and the **SELECT** permission for the source table.

**Procedure**
1. Create a source table named **products** and insert data.

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

2. Create a target table named **newproducts** and insert data.

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

3. Run the **MERGE INTO** statement to merge data in the source table **products** into the target table **newproducts**.

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

4. Query the target table **newproducts** after the merge.

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

The command output is as follows:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4sitgfsfqls295s1t9zz.png)
Updating a Table by Using DML Statements
Tags: opengauss, database
Published: 2023-03-15 03:22:32

In openGauss, you can update a table by running DML statements.

**Procedure**

There is a table named **customer_t** and the table structure is as follows:

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

You can run the following DML statements to update data in the table.

**·** Run the INSERT statement to **insert** data into the table.

**-** Insert a row to the **customer_t** table.

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

**-** Insert multiple rows to the **customer_t** table.

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

For details on how to use **INSERT**, see Inserting Data to Tables.

**·** Run the **UPDATE** statement to update data in the table. Change the value of the **c_customer_id** column to **0**.

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

For details on how to use **UPDATE**, see **UPDATE**.

**·** Run the **DELETE** statement to delete rows from the table.

You can use the **WHERE** clause to specify the rows whose data is to delete. If you do not specify it, all rows in the table are deleted and only the data structure is retained.

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

For details on how to use **DELETE**, see DELETE.

**·** Run the **TRUNCATE** statement to delete all rows from the table.

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

For details on how to use **TRUNCATE**, see TRUNCATE.

The **DELETE** statement deletes a row of data each time whereas the **TRUNCATE** statement deletes data by releasing the data page stored in the table. Therefore, data can be deleted more quickly by using **TRUNCATE** than using **DELETE**.

**DELETE** deletes table data but does not release table storage space. **TRUNCATE** deletes table data and releases table storage space.
Voice AI with Raspberry Pi - ReSpeaker
Tags: 100daysofcode, challenge, raspberrypi, ai
Published: 2023-03-15 02:53:48

For day 44 we'll use [Porcupine Wake Word](https://picovoice.ai/platform/porcupine/) and Seeed Studio ReSpeaker. 
{% embed https://www.youtube.com/watch?v=GqxWHoQ560g %}

Let's get started!
**1. Installation**
- Follow the instructions on [Seeed Studio](https://wiki.seeedstudio.com/ReSpeaker_4_Mic_Array_for_Raspberry_Pi/) to install and set up the microphone array.

-Install the demo:
```
sudo pip3 install ppnrespeakerdemo
```

[Porcupine Wake Word](https://picovoice.ai/platform/porcupine/) requires a valid `AccessKey` at initialization If you haven't already, grab your AccessKey from [Picovoice Console](https://console.picovoice.ai/) for free. 

**2. Usage**
Below are the colors associated with supported wake words for this demo:

- #ffff33 Alexa
- #ff8000 Bumblebee
- #ffffff Computer
- #ff0000 Hey Google
- #800080 Hey Siri
- #ff3399 Jarvis
- #00ff00 Picovoice
- #0000ff Porcupine
- #000000 Terminator

- Run the demo. Do not forget to replace the placeholder with your `AccessKey`

```
porcupine_respeaker_demo --access_key ${ACCESS_KEY}
```
Wait for the demo to initialize and print `[Listening]` in the terminal. 

**Say `Picovoice`**
The demo outputs:
detected `'Picovoice'`
The lights are now set to green. 

**Say `Alexa`**
The lights are set to yellow now. 

**Say `Terminator`**
The lights are now turned off.

**_Happy Pi Day! _**