teleren/devto huggingface dataset:
Rust Macros
Tags: rust
Published: 2023-03-05 12:05:21

In this blog post, let us explore more in detail how to work with `Macros` in Rust

### What are Macros?
Macros are a way of writing code that writes other code, which is known as _metaprogramming_

Metaprogramming is useful for reducing the amount of code you write and maintain, which is also one of the roles of functions. However, macros have some additional powers that functions don’t.

### Types of Macros

There are two kinds of macros: _Declarative_ and _Procedural_

#### Declarative Macros

It is a most used form of macros in Rust. Also referred to as “macros by example”, “macro_rules! macros”.  Allows you to write something similar to match expression

To define a macro, we use macro_rules! Construct. We use #[macro_export] annotation to indicate that this macro should be made available whenever the crate in which the macro is defined is brought into scope. 

##### Declarative Macros Syntax

```
#[macro_export]
macro_rules! <name of macro> {
    ( $( $x:expr ),* ) => {
        {
            <implementation>
        }
    };
}
```

#### Procedural Macros

It acts more like a function (and is a type of procedural)

Accepts some code as an input, operates on that code, and produces some code as an output rather than matching against patterns and replacing the code with other code as declarative macros do.

Three kinds of procedural macros: 

##### Derive

Derive macros define new inputs for the derive attribute. These macros can create new items given the token stream of a struct, enum, or union. They can also derive macro helper attributes.

##### Derive Procedural Macros Syntax

```
extern crate proc_macro;
use proc_macro::TokenStream;

#[proc_macro_derive(<Name of Derive Macro>)]
pub fn derive_macro(_item: TokenStream) -> TokenStream {
    <Implementation>
}
```

##### Attribute-like

Attribute macros define new outer attributes which can be attached to items, including items in extern blocks, inherent and trait implementations, and trait definitions.

##### Attribute Procedural Macros Syntax

```
extern crate proc_macro;
use proc_macro::TokenStream;

#[proc_macro_attribute] 
pub fn <Attribute Name>(_attr: TokenStream, item: TokenStream) -> TokenStream { 
<Implementation> 
}
```

##### Function-like

Function-like procedural macros are procedural macros that are invoked using the macro invocation operator (!)

##### Function-like Procedural Macros Syntax

```
extern crate proc_macro;
use proc_macro::TokenStream;

#[proc_macro]
pub fn <Macro Name>(_item: TokenStream) -> TokenStream {
    <Implementation>
}
```

### Macros vs Functions

Macros are more complex to implement than function definitions because we’re writing Rust code that writes Rust code.

Macro definitions are generally more difficult to read, understand and maintain than function definitions

Macros must define first or bring them into scope before you call in a file, as opposed to functions you can define anywhere and call anywhere

Please feel free to share your comments if any

Happy reading!!!
Mastering Spring Boot + Developing a Full-Stack Role Based App
Published: 2023-03-07 12:13:31

Mastering Spring Boot + Developing a Full-Stack Role Based App (using Spring Data JPA, JUnit, Mockito, Spring Security)

     **1- Spring Boot Complete Reference :**
       1- What and Why Spring Boot.
       2- Spring Boot History.
       3- Spring Boot Features.
       4- Building Spring Boot First App.
       5- Spring Boot Project Structure.
       6- Spring Boot Runners.
       7- Spring Boot Dev Tool.
       8- Spring Boot Manage Properties.

     **2- Develop Full-Stack Application**
      1- Spring Boot.
      2- Spring Data JPA.
      3- Spring Testing.
      4- Junit
      5- Mockito
      6- Spring Security
      7- Thymeleaf
      8- Upgrade to Spring Boot 3
How To Create BEP20 Token At Affordable Cost?
Published: 2023-03-07 12:13:18

   
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lrosm1t2gwdl8h19l56e.png)
   BNB Chain has become one of the most popular blockchain networks for creating decentralized applications and tokens. Its affordability, speed, and compatibility with the Ethereum Virtual Machine (EVM) have attracted many developers and entrepreneurs. 

One of the most common token standards on the BNB Chain is the BEP20 token, similar to the ERC20 token standard on Ethereum. Now we shall discuss how to create a BEP20 Token at an affordable cost.

Before knowing the cost of the BEP20 token, we have to know How to create BEP20 Token following these six sufficient steps:

- Choose a token name and symbol
- Decide on the token supply and decimal places
- Create a wallet and fund it with BNB.
- Deploy the BEP20 Token contract
- Verify & test the token contract
- List the token on some popular exchanges.

Let's have a look now!

**While discussing the BEP20 token development cost, is influenced by various factors.**

1. Business Type 
2. Features of BEP20 token
3. The BEP20 token's appearance
4. It is necessary to create several BEP20 Tokens.
5. Your BEP20 token project's complexity
6. Number of developers working on the BEP20 token
7. Where BEP20 token creation services are available.
8. Testing and production of BEP20 tokens
9. Token distribution
10. Ongoing assistance and maintenance


Based on these factors, the cost might vary but it is estimated to start from $5.5k, with a stunning BEP20 token wallet mobile app for Android and IOS. However, the cost will vary depending on your business requirements.

Indeed, creating a BEP20 token on BNB Chain is relatively easy and affordable compared to other blockchain networks. You now have a question after understanding how to generate a BEP20 Token and how much it costs. Who creates these proper BEP20 tokens?

There are multiple BEP20 token development service providers available in the crypto market. But there are various things you have to consider before choosing a **_[BEP20 Token Development Service Provider](https://bit.ly/3IPO8Mu)_**, like portfolio, ratings, reviews, quality, years of experience they have in the field, and many more. They provide you with the best-in-class BEP20 at an affordable price and make your dream a reality today.

_**If you desire to make your dream come true, the foremost thing you have to do is wake up!**_
c++ dasturlash tiliga kirish darsi
Published: 2023-03-07 12:12:10


Biz sizlar bilan bugungi darsda **c++** dasturlash tiliga kirishni qisqacha  o'rganamiz biz birinchi bo'lib deyarli barcha dasturlash tillarida bo'lganidek **c++** da ham kutubxona chaqiramiz chunki u yerda biz **c++** ni funksiyalarini o'rganamiz **c++** da kutubxona quyidagicha chaqiriladi.

```cpp
#include <iostream>
```
Endi biz **c++** da kod yozishni boshlaymiz misol tariqasida manabularni ko'rishimiz mumkin deyarli barcha dasturchi birinch shu jumlalar bilan boshlasa kerak.

```cpp
#include <iostream>

int main() {
  std::cout << "Hello World!\n";
  

```
Biz har bir kodni yozayotganimizda _std_ bu belgini yozmaslik uchun boshida bildirib o'tishimiz kerak bo'ladi biz uni quyidagicha bildiramiz.

```cpp
#include <iostream>
using namespace std;
int main() {
  std::cout << "Hello World!\n";
  
}
```
Endi esa ekranga kodni chiqarishni ko'rib o'tamiz biz shu tarzda bildiramiz.

```cpp
cout 
```
tepada ko'rayotganimiz qisqartmasi o'zi aslida _console out put_ bo'ladi.


**c++** da tekstlar va matematik amallarni farqlashni ko'ramiz.
Agar biz qo'tirnoqqa olsak bu tekst bo'ladi misol tariqasida bularni ko'rishimiz mumkin.

```cpp
cout<<"Hello world!";
```
Biz raqamlarni qo'shtirnoqqa ola olmaymiz agar olsak u ham tekstga aylanib qoladi matimatik amal bajara olmaydi matematik funksiya bajarishi uchun esa quyidagicha yoziladi.

```cpp
#include <iostream>
using namespace std;
int main() {
  
cout << "Hello World!"<<endl;
cout<<5+7<<endl;
}
```
Natija:

```cpp

Hello World!
12

```
Ko'rib turganinggizdek qo'shtirnoq ichidagi so'zlar tekst bo'lib ko'rindi pastdagi sonlarni esa natijada ishlangan holda chiqdi.


Endi esa kamment yozishni ko'ramiz.Kamment yozishda belgilar 2xil bo'ladi ya'ni bir qatorli va ko'proq qatorli kammentlarga ajratamiz.

Birinchi 1 qatorli kammentni belgilarini ko'ramiz.
```cpp
// shu tarzda belgi qo'yilsa 1 qatorli kamment bo'ladi.
```
Endi esa ko'p qatorli kammentni belgilarini ko'ramiz.

```cpp
/* shu tarzda bo'ladi oxirida esa bunday belgilar qo'yiladi */
```


Yana bir tushuncha kod yozayotganda yangi qator hosil qilish _<<endl;     \n";_  shu belgilar bilan hosil qilinadi.

```cpp
#include <iostream>
using namespace std;
int main() {
  
cout << "Hello World!"<<endl;
cout<<"Big dreams \n";
}
```
An overview of the Process Mining utilizing Python
Tags: process, mining, pm4py, python
Published: 2023-03-07 11:03:35

Process mining is a data mining technique to obtain knowledge utilizing the event data of the process itself. It is a valuable tool for businesses wanting to improve their business processes. More in detail, process mining is a type of data mining that analyzes business processes to improve process efficiency and effectiveness by revealing hidden insights and patterns in process data. Process mining begins with data collection from multiple sources, such as event logs from IT systems or BPMN process models. From the data, it is possible to generate a process map that depicts the flow of activities and their interactions. After creating the process map, it is possible to use numerous techniques to examine the data. Process discovery, for example, uses data to develop a process model without prior knowledge of the process. Conformance checking compares the actual process to a pre-defined process model to find variations and non-compliance. Process cycle time and resource consumption can be optimized through performance analysis. These identify regions with long processing cycle times or unused resources. You could use the insight to improve performance, resulting in cost savings, higher revenue, and increased customer satisfaction. You can integrate process mining into an organization’s workflow with the help of numerous Python modules to compute some metrics. Some of them are:

- Process performance metrics such as process cycle time, throughput time, and waiting time
- Process compliance metrics such as conformance, fitness, and simplicity
- Resource utilization metrics such as resource workload and resource efficiency
- Business performance metrics such as revenue, cost, and customer satisfaction
- Quality metrics such as error rates and rework rates

Continue on [An overview of the Process Mining utilizing Python](https://medium.com/@davide.gazze/an-overview-of-the-process-mining-utilizing-python-15b583f72ab1)
Boost Your JavaScript Efficiency: 20 One-Liner Examples for Quick Coding
Tags: javascript, programming, binarydiods, sh20raj
Published: 2023-03-07 12:00:48

Here are some examples of top JavaScript one-liners:

Find the maximum value in an array:

```javascript
const max = Math.max(...array);
```

Filter an array to remove duplicates:

```javascript
const unique = [...new Set(array)]
```

Convert a string to title case:

```javascript
const titleCase = str => str.toLowerCase().replace(/(^|\s)\S/g, t => t.toUpperCase());
```

Check if an array includes a certain value:

```javascript
const includesValue = array.includes(value);
```

Reverse a string:

```javascript
const reversedString = str.split("").reverse().join("");
```

Get the sum of an array:

```javascript
const sum = array.reduce((acc, curr) => acc + curr, 0);
```

Shuffle an array:

```javascript
const shuffledArray = array.sort(() => Math.random() - 0.5);
```

Find the average of an array:

```javascript
const avg = array.reduce((acc, curr) => acc + curr, 0) / array.length;
```

Check if a value is a number:

```javascript
const isNumber = value => !isNaN(value);
```

Get the current date in ISO format:

```javascript
const currentDate = new Date().toISOString().slice(0, 10);
```

Check if an array is empty:

```javascript
const isEmpty = array.length === 0;
```

Convert a number to a string with commas:

```javascript
const numberWithCommas = num => num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
```

Find the smallest value in an array:

```javascript
const min = Math.min(...array);
```

Remove a specific value from an array:

```javascript
const newArray = array.filter(value => value !== toRemove);
```

Find the index of a specific value in an array:

```javascript
const index = array.indexOf(value);
```

Get the last element of an array:

```javascript
const lastElement = array[array.length - 1];
```

Sort an array of objects by a specific property:

```javascript
const sortedArray = array.sort((a, b) => a.property - b.property);
```

Merge two arrays:

```javascript
const mergedArray = [...array1, ...array2];
```

Check if a string contains a specific substring:

```javascript
const containsSubstring = str.includes(substring);
```

Reverse the order of words in a string:

```javascript
const reversedWords = str.split(" ").reverse().join(" ");
```
NEW: 2023 IT freelancer survey
Tags: freelance, it, tech, survey
Published: 2023-03-07 11:55:53

At freelancermap, we've launched a survey among IT freelancers from all over the world and are looking for professionals who would like to contribute with their experience, helping us uncover valuable facts about the global IT freelance market.

If you have something to say, this is the place. Let YOUR voice be heard 💙

This is the link to the survey: https://umfrage.freelancermap.de/index.php/273729?lang=en

Thank you in advance for your support 🙏
TDD with React
Tags: react, testing
Published: 2023-03-07 11:46:42


**What is TDD?**
TDD stands for Test-Driven Development." This is an approach to developing your code after writing its test cases. Here, the test cases will drive the development of your code. In simple terms, first you write the test cases for what you are going to develop, and then you start the actual development.
**Developing a React application with the TDD approach**
Let’s suppose you want to create a user sign-in component. Before creating the component, let's identify the elements that are required to build the whole component. Let’s see the step-wise approach that we need to follow for TDD.
**Step 1:**
Create an empty component

```
const Signin= () =>{}; export default Signin;
```
**Step 2:**
Assume that you have a header element, and write a test case to verify that the header element is present in your component when it renders. If you don’t have any, the test case should fail.
Write a test case using the React testing library.

```
import "render, screen" from "@testing-library/react";
import Signin from ". /pages/signin"
test ("Signin header should be present"), () =>
render(<Signin/>)
const header=screen. getByText(/Signin/i);
expect(header).   toBeInTheDocument ();
})
```
Now run the command "npm test." If your test fails, then you are going in the right direction because you haven’t added the element to your component yet.
**Step3:**
Now add the element to your component.

```
const Signin = () =>

 <h3>Signin</h3>
export default Signin;
```
Run your test again and expect it to pass. If your test case passes, then you have  the approach; now repeat these three steps for every other element that you want to add to your component.
What is the duration of expected results with NFT marketing?
Tags: webdev, beginners, programming
Published: 2023-03-07 11:27:15

The duration of expected results with NFT marketing is difficult to determine, as it can vary widely based on numerous factors. Highly anticipated releases from popular artists or celebrities can generate significant buzz and demand, leading to immediate sales and rapid value increases. However, success is often dependent on external factors such as media coverage and social media buzz. Building a long-term brand and customer base for NFTs requires creating a strong and recognizable brand, engaging with the community through social media, and consistently offering high-quality NFTs. It may take several months or even years to build up a loyal following and establish a strong presence in the market. Ultimately, the duration of expected results with NFT marketing will depend on the specific goals and strategies of the marketing campaign, the quality of the NFTs being marketed, and the overall market demand for NFTs at the time.

Visit Us : https://www.chaincella.com/nft-marketing-service
Need a help with UEFI modifying.
Tags: uefi, dxe, bios, edkii
Published: 2023-03-07 11:22:50

Good afternoon dear developers. I have a DXE driver starting right after PC launch. This dxe driver showing the authorization window, and blocking the OS loading.  It is working on Gigabyte H310M A 2.0 motherboard. But it doesn't work on motherboards for AMD processors, it is showing black screen and all. Could you please help me to solve this problem?
Emails templates with Supabase
Tags: webdev, javascript, beginners, programming
Published: 2023-03-07 11:17:08

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

Email templates in HTML are a crucial aspect of email marketing campaigns. These templates serve as the foundation of an email and determine its overall design, structure, and content. With Supabase, businesses can create and customize email templates that are both visually appealing and effective at converting leads into customers.

Supabase provides businesses with a range of customizable email templates that can be adapted to suit their specific needs. These templates are designed to be easy to use and can be edited using HTML or a drag-and-drop interface. Additionally, Supabase offers a range of pre-built components, such as buttons, images, and text blocks, that can be used to create compelling email templates quickly.

One of the key benefits of using Supabase for email templates is the platform's ability to automate the creation and delivery of emails. By using Supabase's automation features, businesses can send targeted emails to specific groups of customers at the right time, increasing the likelihood of conversions.

Supabase also offers a range of tools and features to help businesses track the performance of their email campaigns. These tools provide real-time data on open rates, click-through rates, and other key metrics, allowing businesses to identify what works and what doesn't.

In conclusion, email templates in HTML are an essential component of email marketing campaigns. With Supabase, businesses can create and customize templates that are visually appealing and effective at converting leads into customers. The platform's automation features and tracking tools make it easy to create and monitor email campaigns, helping businesses to optimize their email marketing efforts and drive growth.

Guillaume Duhan
9 Red Flags to Watch for in Your Code | Code Smells
Tags: programming, webdev, cleancode
Published: 2023-03-07 11:02:04

Good afternoon to each and every one of ya! ☕

Whether you're a seasoned developer or just starting out, understanding code smells is essential for writing clean, maintainable code.

Code smells are patterns or structures in software code that suggest potential problems, such as inefficiencies, bugs, or design flaws. Recognizing and addressing code smells is important for maintaining high-quality, maintainable code. Common code smells include long methods or classes, duplicate code, and excessive coupling between modules. Understanding code smells is a crucial skill for software developers of all levels.🤹

I strongly encourage you to get familiar with this topic and learn how to identify and eliminate smells in your codebase. 👇👇
{% embed https://medium.com/@vitaliysteffensen/9-red-flags-to-watch-for-in-your-code-code-smells-34cba58d4466 %}

As always, I welcome your feedback and thoughts on the topic. Let's start a conversation in the comments section! 💬
GitHub Actions: Building and testing multiple NodeJS versions with one action
Tags: githubactions, github, node, devops
Published: 2023-03-07 10:19:19

In the [previous article](https://dev.to/rukundokevin/github-actions-setting-up-ci-for-a-node-project-51l1) we set a node project with GitHub Actions.

Now we are going to build and test for multiple NodeJS version in one action, because it sometimes important to build and test your software with multiple versions of NodeJS, e.g. to cover backward compatibility or to test against all available LTS releases.

 Sounds fun --- let's get to it.

```
# This workflow will do a clean install of node dependencies, build the source code and run tests
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: CI Pipeline

# trigger build when pushing, or when creating a pull request
on: [push, pull_request]

jobs:
  build:

    # run build on latest ubuntu
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [16.x, 18.x]
    steps:
    # this will check out the current branch (https://github.com/actions/checkout#Push-a-commit-using-the-built-in-token)
    - uses: actions/checkout@v3
    # installing Node
    - name: Use Node.js 16.16.0
      uses: actions/setup-node@v3
      with:
        node-version: ${{ matrix.node-version }}
    # install dependencies using clean install to avoid package lock updates
    - run: npm ci
    # build the project if necessary
    - run: npm run build --if-present
    # finally run the test
    - run: npm test
```

After that commit & push your work and head over to action section of your repo to view all executed workflows.

![Workflow for multiple Node Versions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8si612z5jyhuwvwhk0yc.jpg)

In the next article we will add coveralls to view code coverage badge.
How to Install Obsidian On Linux | Set it's $PATH variable
Tags: obsidian, ubuntu, linux, path
Published: 2023-03-07 10:09:42

In this blog we will learn about
1. How to download Obsidian App Image.
1. How to install and set up the $PATH for obsidian.

Let's get started. 
## Downloading 
- First of all, install the AppImage from the [link](https://obsidian.md/download). This file will probably be downloaded in your `Home/Downloads` folder.

## Installing
- Now open a terminal in your `Home/Downloads` folder.
- You have to make this AppImage an executable file by using
```
sudo chmod +x Obsidian-1.1.9.AppImage
```

- After that you have to rename the _Obsidian-1.1.9.AppImage_ to _obsidian_ using 
```
mv Obsidian-1.1.9.AppImage obsidian
```

- Then you'll have to create a new folder for obsidian at `usr/bin` and then copy the _obsidian_ file to that folder.

```
sudo mkdir /usr/bin/obsidian
sudo cp obsidian /usr/bin/obsidian/obsidian
```

- Now to add the PATH. You have to set the variable name in  ~/.profile. This can be done by using 
```
gedit ~/.profile (any text precessor)
export PATH=$PATH:/usr/bin/obsidian
```

in the terminal to open the file. Then adding line `export PATH=$PATH:/usr/bin/obsidian` at the end of your ~/.profile file.

- Save and then close the file. You also have to restart the device to use these changes. 
- Now you can run obsidian from Application Launcher by Alt + F2 then typing obsidian. And from terminal by Ctrl + Alt + T then typing obsidian.