teleren/devto huggingface dataset:
Using Git on Visual Studio
Tags: beginners, dotnet, git, tooling
Published: 2023-01-23 18:05:26

Visual Studio is a common tool with dotnet developers. It is an IDE where you can do all your developments without needing any other tool, even database management software. Last week, I saw someone who has Visual Studio use git bash to manage their git repo. I showed them how to use the git tool on the IDE and thought to write something about it.

You can clone an existing repo or start a new project entirely from Visual Studio without having to use any terminal. Everything you need is already in the IDE. 

Let us start with cloning an existing repo.

When you open your Visual Studio (version >= 2019), you get this screen. 

Let's assume you have a repo you want to clone.

![Visual studio screen highlighting cloning an existing repo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o3d1l22oktocrctohq3m.png)

Click on "Clone a repository" and you will get this page


![clone repository page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q3fbvz078rcili4jnhqh.png)



Put the link of the repo you want to clone and click on clone


![clone repo page pointing to the clone button](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k4lfe88kal48nai0mdtp.png)



Voila, you have successfully cloned a repo.

To create a new repo from a new project, follow these steps:

1. Create your project

![create new project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m5ggtc4geowm9unm3n8w.png)

2. After your project is created, click on the "Git changes" tab beside the Solution Explorer.

![git changes tab](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mi9exvg5g0i0g93sa7e8.png)

If you cannot find the "Git changes" tab, click the View tab at the top of Visual Studio, you will find "Git changes" there.


![git changes location on top of visual studio](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/12hix4cqy6v3skct8dpw.png)

3. When the Git changes tab come up, click on "Create new repository" and you will get this page

![create new repo page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9d7mnwtv8sfb72sbe5b3.png)

4. Fill the form with everything you want and you are good to go. Subsequent changes can be made in the "Git changes" tab.


NB: You must have your git set up before you can do all these. You may get some prompt to set up your git if you have not.
Python & Firebase realtime messaging
Published: 2023-01-23 18:00:00

Firebase Realtime Database is a cloud-hosted NoSQL database that allows you to store and sync data between your users in real-time. You can use the Firebase Realtime Database with Python using the `firebase-admin` library. Here is an example of how to send a message to the Firebase Realtime Database using Python:

- Install the firebase-admin library:
```
pip install firebase-admin
```

- Import the necessary modules:
```python
from firebase_admin import credentials, db
```

- Initialize the Firebase Admin SDK with a service account:
```python
cred = credentials.Certificate('path/to/serviceAccountKey.json')
firebase_admin.initialize_app(cred, {'databaseURL': 'https://your-project-name.firebaseio.com'})
```

- Get a reference to the database:
```python
ref = db.reference()
```

- Send a message to the database:
```python
ref.child("messages").push({"text": "Hello, World!"})
```

- You can also listen for real-time updates to the database:
```python
def on_message(event):
    print(event.event_type)  # can be 'put' or 'patch'
    print(event.path)
    print(event.data)  # new data at /path

my_stream = ref.child("messages").stream(on_message)
```

Make sure to replace "path/to/serviceAccountKey.json" with the path to your service account key and "your-project-name" with the name of your Firebase project. The file will have the following structure:
```javascript
{
  "type": "service_account",
  "project_id": "your-project-id",
  "private_key_id": "your-private-key-id",
  "private_key": "-----BEGIN PRIVATE KEY-----\nyour-private-key\n-----END PRIVATE KEY-----\n",
  "client_email": "your-service-account-email",
  "client_id": "your-client-id",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/your-service-account-email"
}
```

Also, you can use the python library `pyrebase` to interact with the Firebase Realtime Database using the REST API, it has some more functionality than `firebase-admin` library.
Hashing Passwords using the md5() Method in Groovy and Using it as a Parameter in JMeter
Tags: tutorial, jmeter, performance, groovy
Published: 2023-01-23 17:49:58

In this article, we will look at how to hash a password using the md5() method in Groovy programming language and use it as a parameter for a login request in JMeter.

Groovy provides a built-in method called md5() that can be used to hash a password using the MD5 algorithm. This method is a one-liner, and it's more readable than using the `MessageDigest` class from the `java.security` package.

Here are the steps to hash a password using the md5() method in Groovy and use it as a parameter named "password" for a login request in JMeter:

1. Create a JSR223 Sampler in your test plan and set the language to Groovy.

2. In the JSR223 Sampler, define the password as a variable and use the md5() method to hash it:

    ```groovy
    def pass = "this_is_my_password"
    def md5 = pass.md5()
    ```

3. Store the hashed password in a variable for future use:

    ```groovy
    props.put("password", md5)
    ```

4. In the next step, you can use the props.get("password") method to get the hashed password and use it as the value for the "password" parameter in your login request.

*It's important to note that storing plain text passwords in your test plan is a security risk, and it's not considered a best practice. Instead, you can use an external encryption tool, a password manager to encrypt your passwords and use the encrypted value in your test plan or get the password from a file.*

In conclusion, this article provides an explanation on how to hash a password using the md5() method in Groovy and use it as a parameter for a login request in JMeter. By following these steps, you can ensure the security of your password while still being able to use it in your test plan.
Install a Next.js app on a Kubernetes cluster using MetalLB
Tags: kubernetes, metallb, nextjs
Published: 2023-01-23 17:43:55

Install a Next.js app on a Kubernetes cluster using MetalLB following these steps

1. Create a Kubernetes cluster: You will need to have a Kubernetes cluster set up and running in order to deploy your Next.js app. There are various ways to set up a cluster, such as using a cloud provider like Google Kubernetes Engine (GKE) or Amazon Elastic Kubernetes Service (EKS), or by setting up a cluster on your own infrastructure using tools like kubeadm or kops.

2. Install MetalLB: MetalLB is a load balancer that can be used to assign a public IP address to a service in a Kubernetes cluster. To install MetalLB, you will need to run the following command on your cluster:

```

kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/main/manifests/namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/main/manifests/metallb.yaml
```

3. Create a configuration file for MetalLB: You will need to create a configuration file that tells MetalLB which IP range it should use to assign IP addresses to services. You can create a configuration file using YAML.

4. Create a deployment and service for your Next.js app: You will need to create a deployment and a service for your Next.js app in order to deploy it to your Kubernetes cluster. You can do this by creating a deployment.yaml and a service.yaml file, then running the following command:

```
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
```

5. Update your service to use a LoadBalancer: In order for your Next.js app to be accessible from the internet, you will need to update your service to use a LoadBalancer. You can do this by running the following command:

```

kubectl patch svc <your-service-name> -p '{"spec": {"type": "LoadBalancer"}}'
```

6. Wait for MetalLB to assign an IP address: Once your service is updated to use a LoadBalancer, MetalLB will assign a public IP address to it. You can check the status of the IP address by running the following command:

```
kubectl get svc <your-service-name>
```

Take your time and read through the references. If you run into difficulty don't hesitate to ask for help in the comments below.
Hobbyists, Do Not Quit
Tags: community, programming, watercooler
Published: 2023-01-23 17:42:30

## Programming as a Hobby

So, here is my story. I was a kid who was busy with boring and usual everyday things. This was until I found out about this whole new world. It was really motivating since I could see what I created (what I made was not usable enough in the beginning, but later I improved). During the COVID pandemic, programming was everything to me. I learnt and made a lot of things during that period.

## The Challenge

I am a school student and thus, have to give enough time to my studies. Now I also have other things which were not present during the pandemic.  

This is where the problem is. Time is limited. 

## The Solution


![The Solution](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i0hiifge97osviivx8ua.jpeg)
> You don't have time, you make time.

This quote is the key to time management. 

You might not get 'long coding hours' of about 2 to 3 hours, but you can always keep 30 minutes of your valuable time aside everyday for your beloved hobby (that is in my case, yours may vary). You can make very minute progress everyday, but remember that you will eventually have a finished project that will make you realise that:

> It was all worth it.


Happy coding to everyone, especially the hobbyists like me who take their hobby seriously. If you are going through tough times, just remember that things will get better and that a hobby can bring unfathomable levels of joy. Also, kindly let me know about your experience of first programming and how you started.
1- What is Python Programming?
Tags: python, programming, research, tutorial
Published: 2023-01-23 17:34:20

--- series: Python for scientific research ---
#### What is Python?

Python is a popular, high-level, and powerful programming language created by Guido Van Rossum in 1991.

#### Why Python?

1. It is open-source programming!
    
2. Runs on various platforms (Windows, Linux, Mac, Raspberry Pi, etc).
    
3. Syntax in Python is simple and similar to the English language.
    
4. It easy and need minimum effort.
    
5. A large number of Python libraries available for different use.
    
6. It can connect with functions written in C C++ and Fortran.
    
7. Code execution and prototyping are very quick in Python.
    
8. Python is becoming the criterion for scientific research.
    

If you like the content, please [SUBSCRIBE](https://www.youtube.com/channel/UCpbWlHEqBSnJb6i4UemXQpA?sub_confirmation=1) to my channel for the future content.

To get full video tutorial and certificate, please, enroll in the course through this link: [https://www.udemy.com/course/python-for-researchers/?referralCode=886CCF5C552567F1C4E7](https://www.udemy.com/course/python-for-researchers/?referralCode=886CCF5C552567F1C4E7)
Music Monday — What are you listening to? (70's Edition)
Tags: watercooler, discuss, music
Published: 2023-01-23 17:33:20

_cover image source: [lnr_motion](https://giphy.com/gifs/david-bowie-davidbowie-gPq0XVrohdDFxEcuDH)_

**Last week, we traveled back in time to the 80's... this week, we're going back even further to the decade before. The seventies brought us all sorts of new fun genres and sounds. From Glam Rock to Punk, Funk & Disco, and the beginnings of Hip Hop... many a genre originated in the decade. So, dust off your vinyl collection, and let's take a ~~look~~ listen to some groovy tunes from the 70's era.**


![cartoon disco ball spinning with hands in the air](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xb7qxdkkblgo9mgg0kqk.gif)

***

## How we do 

In this weekly series, folks can chime in and drop links to whatever it is they've been listening to recently + browse others suggestions.

If you like talking about music, consider following the org [#music discussions](https://dev.to/music-discussions) for more conversations about music!

{% embed https://dev.to/music-discussions %}

***

Alright y'all! Let's travel back to the 70's and listen to some tunes. _Note: you can embed a link to your song using the following syntax `{% embed https://... %}`. This should work for most common platforms!_

Really looking forward to listening to y'all's suggestions! 🎶
2- Using Miniconda to install Python
Tags: python, programming, tutorial, conda
Published: 2023-01-23 17:32:06

--- series: Python for scientific research ---
There are many ways to install and run Python and its tools and libraries. In this learning series, we use "Miniconda" to install and run Python. Miniconda is a small version of Anaconda, which includes Python, conda, and a few packages including pip.

Firstly, \[download\](https://docs.conda.io/en/latest/miniconda.html) Miniconda. On the website choose a suitable version for your computer. For me, it is \*Miniconda 3 Windows 64-bit\*.


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



Then, install Miniconda by double left click on it.


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

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

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

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

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

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

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


Congratulations! Now, Miniconda and Python are installed on your computer.

If you like the content, please [SUBSCRIBE](https://www.youtube.com/channel/UCpbWlHEqBSnJb6i4UemXQpA?sub_confirmation=1) to my channel for the future content.

To get full video tutorial and certificate, please, enroll in the course through this link: [https://www.udemy.com/course/python-for-researchers/?referralCode=886CCF5C552567F1C4E7](https://www.udemy.com/course/python-for-researchers/?referralCode=886CCF5C552567F1C4E7)
Declarative approach is way more accurate
Published: 2023-10-18 08:14:48

---
title: Declarative approach is way more accurate
published: true
date: 2023-01-23 17:30:00 UTC
tags: 
canonical_url: 
---

Declarative approach နဲ့သွားတာကလူနားလည်တယ်ဆိုပေမဲ့ တချို့နေရာတွေမှာ DIY မဖြစ်တာတွေရှိတယ်။ ဆိုပါစို့ကိုယ်က Full fledged Framework လိုမဟုတ်ဘဲနဲ့ Utility လေးတွေပေးထားတဲ့ကောင်တွေသုံးတာမျိုးဆိုပိုသိသာတယ်။ ဥပမာကိုယ်က Laravel သုံးတယ်ဆိုရင် Laravel ကပေးထားတဲ့ API design အတိုင်းသွားရမှာ၊ ဘာလို့ဆိုသူက "ဒီလိုရေးမှဒီလိုဖြစ်မယ်" ဆိုတဲ့ပုံစံမျိုးနဲ့သွားကြရလို့။ သဘောတရားက တစ်နေရာရာမှာ Rely လုပ်နေတာမျိုးကိုပြောချင်တာ။

Backend မှာအဓိကပြဿနာတက်တာက Code ကလှသင့်သလောက်မလှတာမျိုး။ Middleware တွေရေးတဲ့နေရာတွေမှာအဓိကဖြစ်တာ။ Middleware တွေက Low level အနေနဲ့သွားရင် Validation လိူကိစ္စတွေက Declarative ဆန်ဆန်သွားလို့ရတယ်။ ဒါပေမဲ့ အဲ့လိုလုပ်လို့ရမဲ့ Facade တွေပါမလာဘူး။

Request မလာခင်မှာ Middleware Stack သွားစီမှရမှာ။ အဲလိုမျိုးတွေက Declarative မဖြစ်ဘူး။ ဒါကြီးကဘာကြီးလဲပေါ့။ ဒီလိုကောင်မျိုးကို Cover ဖြစ်ဖို့ Naming Convention လိုကောင်တွေနဲ့ Cover ကြပေမဲ့ အမြဲတမ်း Nonsense ဖြစ်တယ်။

ဒီလိုကောင်တွေကိုကိုယ့်ဘာသာကိုယ်ရအောင် cover ထားသင့်တယ်။ ဒီ့အတွက် DRY ကိုတော့လိုက်နာနိုင်မှာမဟုတ်ဘူး။ နည်းနည်းတော့ Duplicated ဖြစ်တာပေါ့။ ဒါက Trade off သက်သက်ပါ။ ဟိုဘက်မှာ Human Readable ဖြစ်သွားမယ်။ DX ပိုကောင်းမယ်။

အစကတည်းက Code တွေကလူနားလည်တာမျိုးပဲဖြစ်ရမှာ။ Machine နားလည်ဖို့ဆိုပြီးတွေးတာမျိုးကမှားတယ်။ Machine နားလည်စေချင်ရင် Switch နဲ့သွားပေါ့။ ဒီ့ထက်ကောင်းတာမရှိဘူး။Programming Principal တွေကိုလိုက်နာတယ်ဆိုတဲ့နေရာမှာ Domain Knowledge လည်းရှိဖို့လိုသေးတယ်။ ဒါကြီးကိုပဲအမြဲသုံးနေရမယ်ဆိုတာမျိုးမဟုတ်ဘူး။ ဒါပဲသုံးရမယ်တာမျိုးတွေးရင် သွားပြီပဲ။
3- How to create environments and install Python packages?
Tags: python, programming, tutorial, beginners
Published: 2023-01-23 17:26:27

--- series: Python for scientific research ---

Click on start in Microsoft. Then, select: *Anaconda Prompt (miniconda 3)*.


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



Your miniconda opened with the *base environment*.

List of commands in conda available [here](https://docs.conda.io/projects/conda/en/4.6.0/_downloads/52a95608c49671267e40c689e0bc00ca/conda-cheatsheet.pdf)

To show packages already installed into the environment we can use:

```python
conda list
```


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



To show environments of miniconda use:

```python
conda env list
```

The output is:


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



#### Create new environment:

In this learning series, we create and use a new environment "da35" with Python version 3.5:

```python
conda create --name da35 python=3.5
```

#### Tip:

Not all Python libraries available for all Python versions. We prefer Python 3.5 for data analysis so we named it da35.

#### Go to your newly created environment "da35":

```python
conda activate da35
```

#### Tip:

(Every time when you start working inside this environment you have to activate it because libraries you installed inside it not available to base and other environments.)

#### Install packages:

We have some commands to install libraries such as "conda", "pip".

#### Tip:

(Before installing packages, you have to activate the environment that you like the packages install within.)

For instance, to install NumPy (scientific computing) and seaborn (statistical data visualization) packages we use:

```python
conda install numpy
pip install seaborn
```

If you like the content, please [SUBSCRIBE](https://www.youtube.com/channel/UCpbWlHEqBSnJb6i4UemXQpA?sub_confirmation=1) to my channel for the future content.

To get full video tutorial and certificate, please, enroll in the course through this link: [https://www.udemy.com/course/python-for-researchers/?referralCode=886CCF5C552567F1C4E7](https://www.udemy.com/course/python-for-researchers/?referralCode=886CCF5C552567F1C4E7)
4- How to install and run jupyter notebook platform
Tags: python, tutorial, beginners, programming
Published: 2023-01-23 17:21:41

--- series: Python for scientific research ---
To write and execute python codes you can use many platforms such as "jupyter notebook", "Spyder" and "Google Colab". In this learning series we use "jupyter notebook" platform.

The Jupyter Notebook is a free web application for creating and sharing documents that contain live code, equations, visualizations, and narrative text.

Firstly, we activate our environment:

```python
conda activate da35
```

Then, we install jupyter notebook:

```python
conda install jupyter
```

Look at the list of installed packaged to confirm jupyter notebook is installed:

```python
conda list
```

To start running it, inside Anaconda Prompt write:

```python
jupyter notebook
```

This window should be opened:


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



#### Install a collection of various different notebook extensions for Jupyter:

```python
conda install -c conda-forge jupyter_contrib_nbextensions
```

In the opened Jupyter Notebook window, click on "Nbextentions", then select any necessary extensions.


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



To close jupyter notebook, inside conda mrompt use control and c.

```python
ctrl+c
```

If you like the content, please [SUBSCRIBE](https://www.youtube.com/channel/UCpbWlHEqBSnJb6i4UemXQpA?sub_confirmation=1) to my channel for the future content.

To get full video tutorial and certificate, please, enroll in the course through this link: [https://www.udemy.com/course/python-for-researchers/?referralCode=886CCF5C552567F1C4E7](https://www.udemy.com/course/python-for-researchers/?referralCode=886CCF5C552567F1C4E7)
which framework should I use for front-end development Reactjs or Nextjs?
Tags: javascript, react, nextjs, webdev
Published: 2023-01-23 17:20:46

The choice between React and Next.js depends on your specific needs and the type of project you're working on.

React is a JavaScript library for building user interfaces. It provides a flexible and powerful way to create reusable UI components, and it's widely adopted by the developer community. React is also compatible with a wide range of other libraries and frameworks, which makes it easy to integrate with existing projects.

Next.js, on the other hand, is a framework built on top of React that provides a set of features for building server-rendered React applications. Some of the key features of Next.js include automatic code splitting, server-side rendering (SSR), and a development server with hot module replacement (HMR). Next.js also provides a simple way to set up and configure webpack, which can save you time and effort when building a production-ready app.

If you're starting a new project from scratch and you're looking for a framework that can handle both client-side and server-side rendering, Next.js might be a good choice. It also provides some built-in features like automatic code splitting, which can make your application more performant. Also, Next.js has a built-in development server and a simple way of setup and configuration of webpack, which can make your development process more efficient.

On the other hand, if you're already familiar with React, and you're looking to add some new functionality to an existing project, React might be the better choice. It allows you to add new components and functionality to your existing codebase without having to rewrite everything.

Ultimately, the choice between React and Next.js depends on your specific use case and requirements. You can also try both of them and decide which one works better for you
5- How to run a Python program?
Tags: programming, python, tutorial, beginners
Published: 2023-01-23 17:18:20

--- series: Python for scientific research ---

For short commands, we do not need to write scripts. We use command line: In the search window of Windows write:

```python
cmd
```

Then click *Enter* to open command prompt.

To open Python, inside the command prompt write:

```python
python
print("Hello World!")
### Hello World!
```

To close the Python use:

```python
exit()
```

#### Write a simple python file

Open Notepad, inside notepad, write: *print("Hello, World!")*, then save it as: helloworld.py

To run a python file on the command line: Change the directory to the folder (e.i. Python38) that includes the file. then we use command: python file-name.py

```python
cd C:\Python38

python helloworld.py
### Hello, World!
```

helloworld is the name of the file.

Congratulations, you have written and executed your first Python program.

If you like the content, please [SUBSCRIBE](https://www.youtube.com/channel/UCpbWlHEqBSnJb6i4UemXQpA?sub_confirmation=1) to my channel for the future content.

To get full video tutorial and certificate, please, enroll in the course through this link: [https://www.udemy.com/course/python-for-researchers/?referralCode=886CCF5C552567F1C4E7](https://www.udemy.com/course/python-for-researchers/?referralCode=886CCF5C552567F1C4E7)