teleren/devto huggingface dataset:
A Step-by-Step Guide to Creating a Calculator App in Android Studio with Java
Tags: programming, development, android, tutorial
Published: 2023-06-10 18:29:04

{% embed https://youtu.be/g5PI_w2xlSg %}
**Step 1: Setting up the Project**
The first step in creating our calculator app is setting up a new project in Android Studio. We'll cover everything from configuring the project settings to choosing a layout template for our app's user interface.

**Step 2: Designing the Calculator Layout**
Next, we'll dive into designing the user interface of our calculator app. We'll discuss various layout elements, such as buttons and text fields, and demonstrate how to arrange them in a logical and user-friendly manner.

Step 3: Adding Functionality to the Buttons
Once our layout is in place, it's time to add functionality to the buttons. We'll show you how to handle button clicks and implement the necessary code to perform calculations based on the user's input.

**Step 4: Performing Calculations**
In this step, we'll delve into the logic behind performing calculations within our calculator app. You'll learn how to handle different mathematical operations, handle input validation, and display the results to the user in real-time.

**Step 5: Testing and Deployment**
With the core functionality in place, we'll guide you through the process of testing your app on an emulator or a physical Android device. We'll also discuss how to prepare your app for deployment, so you can share it with others or even publish it on the Google Play Store.

**Conclusion:**
By following this tutorial, you've learned how to create a fully functional calculator app using Android Studio and Java. From project setup to designing the user interface and implementing the necessary functionality, you now have the knowledge to develop your own Android apps. Whether you're a beginner or an aspiring app developer, this tutorial provides a solid foundation to explore further possibilities in Android development.

So why wait? Start building your own calculator app today and unlock the doors to a world of Android app development possibilities!

**Build android apps without coding** 
Start for free: https://try.draftbit.com/buildwithoutcode

Feel free to reach out to me with any questions or opportunities at (aahsanaahmed26@gmail.com) 
**LinkedIn** (https://www.linkedin.com/in/ahsan-ahmed-39544b246/) 
**Facebook** (https://www.facebook.com/profile.php?id=100083917520174).
**YouTube**(https://www.youtube.com/@mobileappdevelopment4343)
**Instagram**(https://www.instagram.com/ahsanahmed_03/)
The Power of Design Systems: Streamlining UI Development with Figma and React
Tags: webdev, react, ui, development
Published: 2023-06-10 18:06:30

Design systems are a game-changer for UI development. Let's explore how to harness the power of Figma and React to streamline your UI development process and build consistent, scalable interfaces!

🎨 Tip 1: Designing with Figma Components
Utilize Figma's component system to create reusable UI elements. By designing and organizing components in Figma, you establish a visual language that can be easily translated into React components, saving time and ensuring design consistency.

✨ Tip 2: Building a React Component Library
Leverage the power of React to create a component library that aligns with your Figma design system. Break down Figma components into reusable React components, encapsulating their functionality and styling.

💻 Tip 3: Using Styled Components for Styling
Integrate Styled Components into your React component library to enhance styling flexibility and modularity. With Styled Components, you can define and reuse styled elements with CSS-in-JS syntax, ensuring consistent and maintainable styles.

```
import styled from 'styled-components';

const Button = styled.button`
  /* Styles here */
`;

const StyledComponent = () => {
  return <Button>Click me</Button>;
};
```

🌐 Tip 4: Storybook for Component Documentation and Testing
Utilize Storybook to document, showcase, and test your React components in isolation. Storybook provides a dedicated environment to explore component variations, test edge cases, and document component usage guidelines.

🚀 Tip 5: Collaborating between Designers and Developers
Establish a seamless collaboration workflow between designers and developers using tools like Figma's developer handoff feature. Generate CSS code snippets, export assets, and provide design specifications to ensure accurate implementation and smooth handoff.

💡 By harnessing the power of design systems, Figma, and React, you can streamline UI development, promote design consistency, and build scalable interfaces. Empower your team with a robust design-to-development workflow and elevate your UI development game!
Pyenv: Como gerenciar múltiplas versões Python
Tags: braziliandevs, python
Published: 2023-06-10 17:43:11

## Introdução

Gerenciar múltiplas versões de uma linguagem de programação é uma atividade bastante comum principalmente quando estamos trabalhando em times com diversas aplicações ou em empresas que possui diversos sistemas, por sorte, existem ferramentas que facilitam esse trabalho, nesta postagem vou apresentar o Pyenv que utilizo no dia a dia para programar em Python.

## Pyenv
O pyenv é uma ferramenta simples para gerenciar versões e ambientes virtuais da linguagem. Um ambiente virtual python é um mecanismo de isolamento de instalação de pacotes/bibliotecas com ele você consegue distinguir dependências utilizadas em projetos.

Após instalar a ferramenta abaixo alguns comandos úteis: 
- **help**: Demostra todos os comandos disponíveis e um resumo do que fazem;
- **install**: Instalar versões python disponíveis;
- **install --list**: Listar as versões disponíveis para instalação;
- **versions**: Lista todas versões python existentes na sua máquina;
- **virtualenv**: Comando para criação de ambiente virtual;
- **virtualenv-delete**: Deletar ambiente virtual;
- **activate**: Selecionar e ativar ambiente virtual;
- **global**: Definir versão global python da sua máquina;
- **local**: Definir versão local python (Útil quando quer setar em um projeto algum ambiente virtual especifico);
- **update**: Atualiza a ferramenta incluído possíveis novas versões disponíveis do python. 

### Exemplo: Instalando a versão python 3.11
[Tutorial de como instalar pyenv no ubuntu](https://gist.github.com/luzfcb/ef29561ff81e81e348ab7d6824e14404)

**Comandos**:
```bash
pyenv install 3.11.0 # instalar
pyenv versions # verificar instalação
pyenv virtualenv 3.11.0 demo-311 # criar ambiente virtual
pyenv activate demo-311 # ativar ambiente virtual
pyenv virtualenv-delete demo-311 # deletar ambiente virtual
```

**Saída**:
```bash
$ pyenv install 3.11.0
Downloading Python-3.11.0.tar.xz...
-> https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tar.xz
Installing Python-3.11.0...
Installed Python-3.11.0 to /home/<user>/.pyenv/versions/3.11.0

$ pyenv versions
* system (set by /home/<user>/.pyenv/version)
  3.11.0

$ pyenv virtualenv 3.11.0 demo-311

$ pyenv versions
* system (set by /home/<user>/.pyenv/version)
  3.11.0
  3.11.0/envs/demo-311
  demo-311 --> /home/<user>/.pyenv/versions/3.11.0/envs/demo-311

$ pyenv activate demo-311
(demo-311) $
```
Após o ambiente ativo pode-se instalar as bibliotecas que estará isolada no **_python 3.11_** com ambiente virtual **_demo-311_**


## Referências
https://github.com/pyenv/pyenv
https://docs.python.org/pt-br/3/library/venv.html
Should I shut down my computer or put it to Hibernate mode, what are the pros and cons of both of them
Published: 2023-06-10 17:39:05

Hi I just wanted to write this article that I found people discussing about on the internet

Both shutting down and hibernating your computer have their own pros and cons. Here's a brief comparison:

**Shutting Down:**
_Pros:_
1. Saves energy as the computer is completely turned off.
2. Clears the RAM, which can help with system performance when you restart.
3. Reduces the risk of hardware damage due to overheating or power surges.

_Cons:_
1. Takes longer to start up the computer, as it has to go through the entire boot process.
2. All open applications and documents are closed, so you'll need to reopen them when you start the computer again.

**Hibernate:**
_Pros:_
1. Saves your current session, including open applications and documents, to the hard disk, allowing you to resume where you left off.
2. Uses no energy while in hibernate mode, as the computer is turned off completely.
3. Faster startup compared to a full shutdown, as it only needs to load the saved session from the hard disk.

_Cons:_
1. Takes up disk space to store the saved session.
2. Does not clear the RAM, which might lead to performance issues if the computer is not restarted for a long time.

In most cases, Sleep and Hibernate will be sufficient for modern laptops. Hibernating a PC gives you the best of both worlds when it comes to Sleep and shutting down. However, it's still a good idea to shut down your computer occasionally to clear the RAM and perform system maintenance during startup.

In my case my computer is always set to hibernate mode when I am away, I restart it once a month at least when I see that it became slow.
Solidity interview question #1
Tags: webdev, blockchain, web3, solidity
Published: 2023-06-10 17:34:36

The Ethereum Virtual Machine (EVM) is an integral part of the Ethereum blockchain. It serves as the core infrastructure of the blockchain, allowing the execution of smart contracts. The EVM is a runtime environment for smart contracts in Ethereum, and it is completely isolated, meaning that code running inside the EVM has no access to the network, filesystem, or other processes

Solidity is a programming language specifically designed for creating and deploying smart contracts on the Ethereum blockchain. Smart contracts are written in Solidity and then compiled into bytecode, which can be executed by the EVM 

To better understand the relationship between EVM and Solidity, let's consider an example. Suppose you want to create a simple smart contract for a voting system. You would write the smart contract using Solidity, defining the rules and logic for voting and counting votes. Here's a basic example of a smart contract written in Solidity:

```solidity
pragma solidity ^0.8.0;

contract Voting {
    mapping(address => uint) public votes;

    function castVote(uint candidateId) public {
        require(candidateId >= 1 && candidateId <= 3, "Invalid candidate ID");
        votes[msg.sender] = candidateId;
    }

    function getVote() public view returns (uint) {
        return votes[msg.sender];
    }
}
```

In this example, the `Voting` contract allows users to cast their vote for a candidate with a specific ID. The votes are stored in a mapping, and users can also check their previously cast vote.

After writing the smart contract in Solidity, you would compile it into bytecode. The bytecode is then deployed to the Ethereum blockchain, where it can be executed by the EVM. When users interact with the smart contract, the EVM processes the transactions and ensures that the smart contract's logic is executed correctly and securely
Unleashing the Power of Scripting Languages for Game Developers: Breathing Life into Dynamic Gaming Experiences
Tags: programming, productivity
Published: 2023-06-10 17:32:52

The realm of game development thrives on the infusion of dynamic elements, giving games a captivating and immersive quality. This is where the magic of scripting languages shines through, equipping game developers with tools to weave an intricate tapestry of features into their digital masterpieces.

Recently, we have concocted our own bespoke scripting language, tailored to elevate our game development process. This linguistic innovation empowers designers to breathe life and dynamism into every facet of the game.

A standout advantage of employing a custom scripting language is the streamlined debugging process. With a robust runtime console at their fingertips, developers can effortlessly assess and pinpoint issues during the game's creation. This not only conserves valuable time and resources but also guarantees a polished, high-calibre game before it reaches eager players.

The possibilities with scripting languages in game development stretch far beyond debugging. Designers can harness their power to conjure unique game modes, quests, and missions. Additionally, they can craft personalized user interfaces to amplify the player's gaming experience.

Furthermore, game developers can wield scripting languages to orchestrate custom AI behaviours for non-playable characters, adding layers of complexity and engagement for players to navigate.

Scripting languages have evolved into indispensable tools for game developers aspiring to inject dynamic elements into their creations. With a myriad of applications, such as debugging, devising custom game mechanics, and enriching the player's experience, scripting languages enable game developers to transcend limits and craft mesmerizing, unforgettable gaming experiences for players.
Collect & Store form data without Integrating Backend
Tags: frontend, nobackend, formdata
Published: 2023-06-10 17:32:27

Build no admin panel in the backend to collect the form data.
No hasstle of API Creation | No need to connect website with Complex CRMs.

Use [formify.pro](https://www.formify.pro/) 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qntf91zhgd8mejqvq3e1.jpg)
How to parse Postgres log file and to print all the errors along with a specified number of lines before and after each error?
Tags: aws, devops, bash, postgres
Published: 2023-06-10 17:27:58

When working with PostgreSQL databases, it is important to check the log files. 

Here is a bash script that parses the log file and prints all the errors along with a specified number of lines after each error.

```
#!/bin/bash

log_file="/tmp/my_postgres_aws_rds_log_file.log"
error_pattern="ERROR:"                # Pattern to search for errors
lines_before_error=2                  # Number of lines to print before each error
lines_after_error=3                   # Number of lines to print after each error

grep -B "$lines_before_error" -A "$lines_after_error" "$error_pattern" "$log_file"
```
How to download AWS RDS Postgres log files?
Tags: postgres, aws, bash, postgressql
Published: 2023-06-10 17:21:35

The following bash script downloads AWS RDS Postgres log files, appending them to one single file. It uses aws-cli.

```
the_region="us-east-1"
the_db_instance="my-db-instance"

for filename in $( aws rds describe-db-log-files --region $the_region --db-instance-identifier $the_db_instance | jq -r '.DescribeDBLogFiles[] | .LogFileName' )
do
aws rds download-db-log-file-portion --region $the_region --db-instance-identifier $the_db_instance --output text --no-paginate --log-file $filename  >> /tmp/postgres_aws_rds_logs_$the_db_instance.log
done
```
Creating a resource group using Azure CLI
Published: 2023-06-10 17:10:12

The Azure command line interfase (CLI) is a powerful tool that allows  developers and IT professionals to manage and interact with Azure resources through the command line. In this beginner's guide, we will explore how to create a resource group using Azure CLI. A resource group is a logical container for organizing and managing Azure resources in a unified manner. Now lets learn the step-by-step process of creating a resource group using Azure CLI.

Step1: Make sure you have installed and set up the Azure CLI on your local machine then log in using the **az login** command  line.

Step2: create a resource group. Use the **az group create** followed by all other parameters. e.g.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/khrryhcdob668fl85cc8.png)
You can choose any name you want and the region you want the resource to be hosted on.
Verify that the resource group has been created.After the resource group has been created, Azure CLI will provide information about the newly created resource group, including its name, location, and ID e.g.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tgvzjgpwdp1qyvyrkkqw.png)
Conclusion:
Congratulations! You have successfully created a resource group using Azure CLI. Resource groups serve as an essential organizational component in Azure, enabling you to manage and group your Azure resources efficiently. By following these simple steps, you can start organizing your resources and leverage the power of Azure CLI to streamline your Azure management tasks.
I think, i did something wrong on GIT.
Tags: git
Published: 2023-06-10 16:55:04


I started a repository in git, the folder has 90 gigabytes... until then, ok, I did a 'git add .', and it's taking too long, it took so long that I regretted having done it, and now I'm afraid to close git and something goes wrong, what do I do?
Small European Country Experiment
Published: 2023-06-10 16:53:43

After dabbling into language learning with [glot.space](https://glot.space), [a tool for online meetups](https://flat.social/use-cases/online-meetup), I'm now experimenting with a website about a [small european country](https://smalleuropeancountry.com/)

Can it become the top 1 result when people want to learn about what is the smallest european country? Let's see!
The Next Big Milestone for AI
Tags: discuss, ai
Published: 2023-06-10 16:38:15

AI is turning out to have many applications such as self driving vehicles, interpretation of text, and the ability to generate media better than a human.

It is easy to be critical of the work and say the end is near unless we stop the evil whatever, but I'm curious what the future will hold. Surely there will be other products and applications of AI that benefit humans.

Currently we have the following types of software powered by some form of AI:
* Text to text for translating and understanding large globs of text
* Text to media for generating human like content such as images, audio, and video
* Media to text for summarizing large blobs of data as a transcript.

In my opinion, I think the next big thing is going to be advancements in accessibility. Stuff like auto generating ASL for videos, or headphones that translate from Chinese to English in real time.
What is a Parser? Unveiling the Inner Workings of Programming Language Interpreters
Tags: apacheage, postgres
Published: 2023-06-10 16:17:08

**Introduction:**
If you're exploring the world of programming, you may have come across the term "parser." But what exactly is a parser? In simple terms, a parser is a tool that helps computers understand the structure and meaning of the code you write. Let's take a closer look at parsers and how they work.

**What is a Parser?**
A parser is like a translator between you and the computer. When you write code, you use specific syntax and rules. The parser's job is to read your code and make sure it follows the correct grammar and structure of the programming language you're using.
How does it work?
A parser examines your code line by line, piece by piece. It looks for patterns and follows a set of rules to figure out what each part of the code means. It checks for things like proper use of brackets, semicolons, and keywords. If it finds any errors or inconsistencies, it will let you know so you can fix them.

**Example of a Parser:**
**Recursive Descent Parser:** One common type of parser is called a recursive descent parser. It works by starting at the top-level rule of the grammar and then breaks it down into smaller rules. It does this recursively until it reaches the individual elements of the code. It's like solving a puzzle, breaking it down into smaller pieces until you understand the whole picture.

**Conclusion:**
Parsers are essential tools in programming languages. They help computers understand the code you write by checking its grammar and structure. By using parsers, you can catch errors and make sure your code makes sense to the computer. So the next time you write code, remember that the parser is there to assist you and ensure your instructions are clear and accurate.

Apache-Age:-https://age.apache.org/
GitHub:-https://github.com/apache/age
Difference between ngOnChanges vs ngOnInit in angular component
Tags: angular, typescript, programming
Published: 2023-06-10 16:14:12

In simplest terms:
ngOnChange - changes on every click event made or component interaction

ngOnInit -Initializes only once upon server start
example below:
in <any name>component.ts file:
ex. app.component.ts
```
 private number: number = 234;
  name: string = 'Oyata';
  user = {
    name: 'Yamata',
  };

get counter() {
    return this.number;
  }
  set counter(value) {
    this.number = value;
  }
  increment() {
    this.counter++;
  }
  decrement() {
    this.counter--;
  }
```
Paste below code in any child component.ts file.
Based on the exmaple below I name the file child.component.ts
```
ngOnChanges(changes: SimpleChanges) {
    // runs before ngOnInit()
    // executes on every change
    const newNumberChange: SimpleChange = changes.myNewNumber;
    console.log(
      'Previous Value - (ng on changes): ',
      newNumberChange.previousValue
    );
    console.log(
      'Current Value - (ng on changes): ',
      newNumberChange.currentValue
    );
    this.myNewNumber = newNumberChange.currentValue;
  }
 ngOnInit() {
    // executes only one time
    // use to initialize or call functions / methods
    console.log('ngOnInit Value: ', this.myNewNumber);
  }
```
In the chicld.component.html, you can paste the below code:

```
<h2>{{ myNewNumber }}</h2>
<h2>{{ myName.name }}</h2>
```

In app.component.html, you can paste the below code:

```
<button (click)="decrement()">Subtract</button>
<div>
  <app-child [myNewNumber]="counter" [myName]="user"></app-child>
</div>
<button (click)="increment()">Add</button>
```