teleren/devto huggingface dataset:
Introduction to Flutter
Tags: flutter
Published: 2023-01-03 01:00:10

---
title: Introduction to Flutter
published: true
date: 2023-03-23 13:00:00 UTC
tags: ["flutter"]
canonical_url: https://friendlyuser.github.io/posts/introduction_to_flutter/
---

Flutter is a popular, open-source mobile application development framework created by Google. It allows developers to build cross-platform mobile applications for Android and iOS using a single codebase. This means that developers can write an app once and deploy it to both platforms, saving time and resources.

One of the standout features of Flutter is its fast development cycle. With Flutter's hot reload feature, developers can make changes to their code and see the results almost instantly on the emulator or device. This speeds up the development process and allows for more iteration and experimentation.

Flutter also has a comprehensive set of customizable widgets that allow developers to easily create beautiful and intuitive user interfaces. Its design-centric approach means that developers can focus on building an app that looks and feels native to the platform it is running on, without having to worry about platform-specific differences.

In addition to its fast development cycle and customizable widgets, Flutter has a strong community of developers and a robust ecosystem of packages and plugins. This means that developers have access to a wide range of resources and tools to help them build their apps.

Overall, Flutter is a powerful and user-friendly framework that makes it easy for developers to build high-quality mobile applications. If you are a mobile developer looking to build apps for Android and iOS, Flutter is definitely worth considering.


To create a simple Flutter app, you will need to install the Flutter SDK and set up your development environment. Once you have done this, follow these steps:

1. Open a terminal window and navigate to the directory where you want to create your project.
2. Run the command flutter create my_app, where "my_app" is the name of your app. This will create a new Flutter project in a directory with the same name.
3. Navigate to the project directory by running cd my_app.
4. Run the command flutter run to launch the app in an emulator or on a connected device.
5. Your Flutter app will have a basic layout with a single "Welcome to Flutter" message displayed on the screen. You can customize the app by editing the code in the main.dart file located in the lib directory.

To learn more about developing apps with Flutter, you can refer to the Flutter documentation or check out online tutorials and resources. There are also a variety of resources available for learning about Flutter and mobile app development in general, including online courses, books, and community forums.
Informatsion about C++
Tags: programming, cpp
Published: 2023-02-25 13:23:46

_What is C++?_
C++ is a general-purpose, object-oriented programming language. It was created by _Bjarne Stroustrup_ at Bell Labs circa _1980_. C++ is very similar to C (invented by Dennis Ritchie in the early 1970s). C++ is so compatible with C that it will probably compile over 99% of C programs without changing a line of source code. Though C++ is a lot of well-structured and safer language than C as it OOPs based.

Some computer languages are written for a specific purpose. Like, Java was initially devised to control toasters and some other electronics. C was developed for programming OS. Pascal was conceptualized to teach proper programming techniques. But C++ is a general-purpose language. It well deserves the widely acknowledged nickname “Swiss Pocket Knife of Languages.”

Some call C++ “C with classes” because it introduces object-oriented programming principles, including the use of defined classes, to the C programming language framework. Over time, C++ has remained a very useful language not only in computer programming itself, but in teaching new programmers about how object-oriented programming works. However, it does not support only object-oriented, but also procedural and functional. Thanks to its high flexibility and scalability, C++ can be used to develop a broad range of software, applications, browsers, Graphical User Interfaces (GUIs), operating systems, and games.

Today C++ is still very appreciated for its notable portability which allows developers to create programs that can run on different operating systems or platforms very easily. Despite being a high-level language, since C++ is still close to C it can be used for low-level manipulation due to its close relation with machine language.
HasOne Through Relationship
Tags: hasonethrough, laravel, relationships, beginners
Published: 2023-03-23 12:46:59

In Laravel, a HasOne Through relationship is used to define a `one-to-one relationship` through another intermediate model. This relationship is used when you want to retrieve a single related record that is not directly connected to the parent model, but rather through another model.

Let's say we have three models:

1. User
2. Country
3. Post

The `User` model has a relationship with the `Country` model `through` the `Post` model. This means that a `User has one Country`, but that `Country` is retrieved through a `Post` that is associated with the `User`.

Here is an example of how to define a `HasOne Through` relationship in Laravel:

```
// User model
class User extends Model
{
    public function country()
    {
        return $this->hasOneThrough(Country::class, Post::class);
    }
}

// Country model
class Country extends Model
{
    // ...
}

// Post model
class Post extends Model
{
    public function country()
    {
        return $this->belongsTo(Country::class);
    }
}

```

In this example, we define a `country()` method in the User model that uses the `hasOneThrough()` method to define the relationship. The `hasOneThrough()` method takes two arguments:

1. The name of the target model (Country in this case)
2. The name of the intermediate model (Post in this case)

The intermediate model is used to establish the relationship between the `User` and `Country` models. The `country()` method in the `Post` model is used to define the relationship between the `Post` and `Country` models.
Resolvendo problemas no HackerRank: Números Extra Longos em Fatorial(!).
Tags: javascript, beginners, programming
Published: 2023-03-23 12:45:15

Olá, seja bem vindo a mais um Resolvendo problemas no HackerRank: No caso de hoje, vamos pegar um número inteiro e executar seu fatorial, para encontrar valores extraordinários. Vejamos agora uma explicação detalhada e vejamos a resolução.

**Extra Long Factorials -**

O problema neste episódio é curto mas ao mesmo tempo um pouco trabalhoso, visto que ele não nos conta um enredo completo, mas apenas relata que `n`se trata do parâmetro ao qual iremos trabalhar, no caso iremos fazer seu fatorial. 

Caso não esteja se lembrando, um número fatorial seria a multiplicação de um valor pelo seu antecessor,após isso a multiplicação do antecessor de seu antecessor e assim sucessivamente até chegar o valor 1, em exemplos simples seria como o caso abaixo:

- 10!, Ou 10(fatorial, o sinal de exclamação significa fatorial) seria igual a = 10*9*8*7*6*5*4*3*2*1. O resultado deste cálculo é o seguinte: 3628800.

Vejamos o código:

```
function extraLongFactorials(n) {
    // Write your code here
  let factorial = BigInt(1);
  
    for(let i = 1; i <= n; i++){
        factorial = factorial * BigInt(i);
    }
    console.log(factorial.toString());
}
```

A função extraLongFactorials recebe um parâmetro n, que representa o número inteiro cujo fatorial deve ser calculado.

A variável factorial é inicializada com o valor 1 do tipo BigInt.

Em seguida, é iniciado um loop for que inicia em 1 e vai até n. Dentro do loop, a cada iteração, o valor de factorial é atualizado multiplicando-se pelo valor de i, que é o número da iteração atual. Note que o operador * está multiplicando BigInt(i), que é o valor de i convertido para o tipo BigInt.

Finalmente, o valor do fatorial é impresso na saída padrão usando a função console.log(), convertido para uma string usando o método toString() do tipo BigInt.

Em resumo, esta função calcula o fatorial de um número inteiro n usando BigInt, que permite lidar com números maiores do que o limite máximo do tipo Number do JavaScript.


Assim, concluímos mais um _Resolvendo problemas no HackerRank:_ até a próxima.
A simple terminal-based restaurant recommender system
Tags: python, bash, recommender
Published: 2023-03-23 12:19:05

As part of my final project for the data structures and algorithms module of the computer science path in codecademy, I have made a terminal-based recommender system for restaurants. The system is written in python3.

The food type and restaurant data set were provided by codecademy. Both food types and restaurants come as python lists.

I made the following functions:

autocomplete: This function takes lettes and a list as parameters and returns all the words from the list that contain the letters.

quicksort: This function takes a list as parameter and sorts it.

order_restaurants: This function takes the restaurant list as parameter and orders it in a dictionary

prepare_types_and_restaurants: This is a helper function sorting and ordering food types and restaurants.

print_restaurants: This function takes the restaurant dictonary as input and prints it.

print_types: This function takes a list of food types as input and formats it printable.

recommender() This is the main function handling the user inputs and the flow of the program.

Things to improve in coming versions:
- flow optimazation
- error handling
- autocomplete on key press

You can get the code here:
[https://github.com/ptrick72/RestaurantRS]
Which tool using GPT-4 API do you think is the best?
Tags: discuss, api, ai, chatgpt
Published: 2023-03-23 12:19:03

Since ChatGPT-4 went live, the tech world has been buzzing with a new wave of innovation. My AI bot by Snapchat, GrammarlyGO, Bing by Microsoft, Roleplay by Duolingo and more new tools or features have been released by different companies.

Which one do you think is the most prominent?
What is Test Data Management
Tags: beginners
Published: 2023-03-23 12:06:13

Test Data Management (TDM) is a process that involves managing and controlling the data used in software testing. TDM includes activities such as selecting appropriate data, creating test data sets, maintaining the integrity and quality of test data, and ensuring that test data is available when needed.

The goal of TDM is to ensure that testing is conducted using accurate and appropriate data, and that data is used effectively to identify defects and ensure that the software meets the required quality standards. By managing test data, TDM helps to reduce the risks and costs associated with software defects and project delays, and improves the overall efficiency of the testing process. For more details from the top industry experts, You can even check in-depth and Upskill yourself Software Testing Fundamentals concepts from [Software testing Course](https://www.edureka.co/selenium-certification-training).

TDM includes various techniques and tools, such as data masking, data subsetting, data generation, and data virtualization. These techniques help to ensure that the test data is representative of real-world scenarios, while also protecting sensitive data and complying with data privacy regulations.

In Selenium, data refers to any information that is used or manipulated by a web automation script. This can include things like user input, such as usernames and passwords, as well as data retrieved from the web page being automated, such as text content or form values.

Data in Selenium is often stored in variables or objects within the script, and is used to perform various actions and validations on the web page. For example, data may be used to fill out form fields, click buttons, navigate to different pages, or verify that certain elements are present on the page.

In addition to using data in the script itself, Selenium also provides various methods for retrieving and storing data externally, such as reading from and writing to files or databases. This allows scripts to work with larger or more complex datasets, and to persist data across multiple test runs or environments.
Making of Among Us in Discord - DEVBLOG 4 - Start Screen...(1/3)
Published: 2023-03-23 11:56:58

{% embed https://twitter.com/MrStiK101/status/1638870087061872640?s=20 %}

**Heya, this is~ you know who am I, don't you!**

So, quick coding, I made the Start Screen today most of it, because I'm fasting, and exams too so I might get only little time to code, so... Time is Precious!

I think my blogs are not having coding content, so, I might share code next blogs... but here's today's code for a good start.

``` python
players = []
host = ''
class StartButton(discord.ui.View):
        def __init__(self):
            super().__init__()
            self.value = None

        @discord.ui.button(label='Join Game', style=discord.ButtonStyle.grey)
        async def start_button(self, interaction: discord.Interaction, button: discord.ui.Button):
            players.append(f'{interaction.user.name}#{interaction.user.discriminator}')
            await interaction.response.send_message("You've successfully joined the GAME!!!", ephemeral=True)
            print(players)
            self.value = False
            self.stop()
        
@bot.command()
async def start(ctx):
    start_embed = discord.Embed(
        colour=discord.Colour.red(),
        title='Welcome to the **LOBBY**',
        description='Game will start once there are enough players and to join, Click "Join Game"'

    )

    start_view = StartButton()
    await ctx.send(embed=start_embed, view=start_view)

```

So, yeah, let me explain a bit:

`players` is a list (or an array, in other language terms :) ) and `host` is a string and these variables will contain user names... and I think you may know what are their uses... -_-

And when somebody starts a game, the user who said that will be the host (it is not included, maybe tomorrow) ( [❕] StiK will remember that...) and the users who press Join gets their name in the `players` list and actually adds their username by getting the name and discriminator value. The username string goes:

`f'{interaction.user.name}#{interaction.user.discriminator}'`

I made it a formative string for doing it easy, example, just say UserGuy#0001 clicked this. That guy is the interaction.user, his name being 'UserGuy' and discriminator '0001'. So, I first formatted the name variable then a '#' goes on and then finally the discriminator. Thus we got the name!

My plan is to add these players in a 'Nested Dictionary' with their color and role as a dictionary... so it might be easy to manage them and their actions and roles...

So, yeah, if you have suggestions, please, PLEASE let me know because as you can see, I'm new to python and I'll never forget the help.

[PS: GOTO THE OG TWEET AND YOU'LL SEE THE *SECOND IMAGE* I WAS TALKING ABOUT IN THE TWEET]

So, yeah, that's for today,

Toodles.
C++ Chiqarish operatori
Tags: programming, cpp, tutorial, beginners
Published: 2023-03-23 11:49:53

Assalomu alaykum bugungi darsimiz qisqa boladi  bugun siz bilan C++ dasturlash tilida chiqarish operatori haqida gaplashamiz 

C++ dasturlash tilida "cout" kalit sozi <<bilan birgalikda chiqarish operatori yoziladi 

Operator-bu darsturlash tilida aniq bir maqsadga yonaltirilgan. ishni malum qismini yani C++ musol uchun chiqarish operatori takrorlash, takrorlash operatori, shart operatori va bir qanchasini musol keltirsa boladi. Operatorlardan song ; bilan yakulanadi. Ayrim operatorlar asosan {} figurniy qavis bilan ishning malum bir vazifasini bajariladigan qismi 
yakunlanadi,

C++ darsturlash tilida chiqarish operatori uchun misol keltirsmiz

```
# include <iostream>
using namespace std;

int main()

cout << "Hello world ! Ilmhub IT school 

return 0
```

Natija Hello world! ilmhub it school

Siz C++ darsturlash tilida cout ni hohlagancha ishlatishingiz mumkin. Unutmnag bu zaylda chiqarish operatorini ishlatish jarayonida har bir qatorda chiqadi. Quydagi kodga nazar soling 

```
# include <iostream>
using namespace std;

int main()
{
cout << "Salom Dunyo";
cout << "Ilmhub It school";

return 0
}
```
Natija: Salom dunyo 
Natija: ilmhub it school
NATS messaging system
Tags: node, nats, microservices
Published: 2023-03-23 11:49:16

NATS (or "NATS Messaging System") is a lightweight and high-performance messaging system that is designed for building distributed systems, cloud-native applications, and microservices.

NATS provides a publish-subscribe model for sending and receiving messages between clients. Clients connect to a NATS server, which acts as a message broker, and then subscribe to specific subjects (topics) to receive messages published to those subjects by other clients.

NATS is known for its simplicity, scalability, and speed. It is designed to be easy to use and integrate with existing applications, while also being able to handle large-scale messaging workloads with high throughput and low latency. NATS supports a variety of messaging patterns, including point-to-point, publish-subscribe, request-reply, and queueing.
NATS supports several messaging patterns, which makes it a versatile messaging system suitable for a wide range of use cases. Here's a brief overview of each of the messaging patterns supported by NATS:

1. Point-to-Point (P2P): In the point-to-point messaging pattern, a sender sends a message to a specific recipient (or a set of recipients) using a unique subject or queue. Only one recipient receives the message, and the message is not broadcast to any other recipients. NATS provides a queueing mechanism that enables multiple subscribers to consume messages from the same subject, and NATS ensures that only one subscriber receives each message.
2. Publish-Subscribe (Pub-Sub): In the publish-subscribe messaging pattern, a sender sends a message to a specific subject, and multiple recipients receive the message. The sender does not know how many or which subscribers will receive the message. NATS allows subscribers to subscribe to subjects using wildcards, so they can receive messages published to multiple related subjects using a single subscription.
3. Request-Reply: In the request-reply messaging pattern, a client sends a request message to a server, and the server replies with a response message. NATS provides a mechanism for implementing request-reply messaging, where a client sends a request message to a subject and waits for a response message with a matching subject.
4. Queueing: NATS also supports message queueing, where multiple clients can subscribe to the same subject and compete for messages. In this pattern, messages are distributed evenly among the subscribed clients, ensuring that each client receives an equal share of messages.

NATS also has a number of advanced features, such as support for distributed tracing, load balancing, and fault tolerance. It also has client libraries available for many programming languages, making it easy to use with a variety of applications and systems.

Overall, NATS is a powerful and flexible messaging system that can be used for a wide range of applications and use cases, from simple messaging to complex distributed systems.
[Opinion] Why is my code so bad
Tags: webdev, productivity, programming
Published: 2023-03-23 11:25:42

# TL; DR
- You need to convince yourself; you should be equipped with solid knowledge and experience
- You should talk with your bosses and coworkers frequently to get feedbacks from them

## Why I write this short article
It’s been hard weeks. I’ve been doing a task that involves not typical REST API or MVC things. I had to figure out how to do that task from the beginning, designing the logic flow by myself. 

But you may also have experienced this: if you’re not fully in charge of the task that you’re doing, you have to at least firmly understand what you're doing and need to persuade others. Unfortunately, due to my lack of knowledge and experience, I couldn't be sure of my work result, I had to change the logic more than three times. 

It was (to be honest)so torturing experience, so I write this article at least for myself not to have such a pain again. 

## So what was the problem?
The main problem is, of course, I wasn’t convinced at all about myself and my decisions. I wasn’t sure what I was doing, always afraid of things going wrong, and disappointed in my lack of knowledge and skills.

However, that’s something I can’t control(my personality) that easily. So I think **there is only one way to get over this: I have to improve my knowledge, skills, and experience, until I achieve the level at which I could convince myself.** 

## How I should have done
But couldn’t there be a better way? I think I had. The followings are possible behaviors I could have taken to avoid the current disaster:

- **More frequent feedback**: even small changes in your code, you should confirm that you can go on with it, otherwise many other classes and functions will rely on your shitty code
- **The basic design**: Software design is so important since all your work is based on this. If you change your design, it means you have to change your public interfaces, which also means that your tests, implementations, and configurations all need to be changed in the worst case. 

So, I recommend you should talk with your bosses and coworkers frequently(ideally every 2~3 hours a day during your work). Talk about your design plan, your estimations, and any difficulties you’re having at the moment. Based on their feedback, you’ll be more convinced about your work and stop wasting your time. 

## Conclusion 
Today I don’t talk about how to code, but rather *how to work*. Good code skill is something you must have, but that’s not enough, since most programmers work as a team. You have to improve yourself, but at the same time, you must communicate with others and observe yourself in an objective perspective.