teleren/devto huggingface dataset:
Multi-thread Processing in Rust
Tags: rust, tutorial, programming, github
Published: 2022-10-07 15:33:45

Most program we wrote is single threaded. Since most of the task is [IO bound](https://en.wikipedia.org/wiki/I/O_bound). It make sense to keep it simple by writing a single threaded program. But what if we have a [CPU bound](https://en.wikipedia.org/wiki/CPU-bound) task? Let say, cracking a MD5 hash? Don't ask me why cracking MD5 hash, it's just one of CPU intensive task that I can think of, purely for demo purpose.

A naive hashing algorithm will be like this.

```rust
// Iterate from 0 util we found the target number
let mut i = 0_u32;
loop {
    // Hash our guessing number and compare with the target hash
    // Stop the loop if we found the target number
    if md5::compute(i.to_string()).eq(&TARGET_HASH) {
        break;
    }
    // What's our next guess?
    i += 1;
}
```

For the hashing task we can distribute the work to `N` threads. With each thread start search the target number starting from `N` and continue the search by incrementing the number by `N`.

So, for example we've 3 threads. The search space for each thread would be:

```
Thread 1: 1, 4, 7, 10...
Thread 2: 2, 5, 8, 11...
Thread 3: 3, 6, 9, 12...
```

That's how we divide the task to `N` threads with each thread work on a unique and non-overlapping search space.

```rust
// A MPSC channel to inform the main thread some worker found the solution
let (tx, rx) = mpsc::channel();
print!("Parallel hashing with {} threads: ", num_workers);

// Spawn workers
for worker in 0..num_workers {
    // Clone the transmission end and move it into the spawned worker
    let tx1 = tx.clone();
    thread::spawn(move || {
        // The guess number start from the worker number
        let mut i = worker;
        // Iterate from 0 util we found the target number
        loop {
            // Hash our guessing number and compare with the target hash
            let hash = md5::compute(i.to_string());
            // Stop the loop if we found the target number
            // And inform the main thread that we found the target number
            if hash.eq(&TARGET_HASH) {
                tx1.send("Found!").unwrap();
                break;
            }
            // What's our next guess?
            i += num_workers;
        }
    });
}

while let Ok(_) = rx.recv() {
    // Exit main thread, this will kill all spawn threads
    break;
}
```

Source code available on [GitHub](https://github.com/billy1624/rust-playground/tree/master/parallel-hashing).
🔴  Live Q&A session on Discord Tuesday, 11 at 6:00 PM CEST with Nicolas Rabault.
Tags: help, opensource, live, luos
Published: 2022-10-07 15:50:33

💬  Comment on this post with your question now and we’ll answer it live!

[To participate ⏩](https://discord.gg/DUNWRFQSdP?event=1026867797004927027)

Save the date, it will be a small friendly event to ask all the questions you want about Luos: upcoming features, vision, best use cases, pros and cons.
How to Organize Crypto Payments in Your Business
Tags: crypto, web3, business, payments
Published: 2022-10-07 15:43:30


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

More and more news about the acceptance of cryptocurrencies by stores of major companies is seeping into our lives. McDonald’s customers in Switzerland pay in BTC and USDT, Gucci stores in the U.S. use the top 10 digital currencies to pay for goods, Starbucks also accepts Bitcoin to buy a cup of coffee in the morning. And there are a large number of such examples around the world. Obviously, the demand for virtual coins is growing, so businesses are starting to work closely with them.

A distinctive feature of crypto payments from traditional ones is their unrestrictedness. It is possible to transfer funds without intermediaries to any state. But, besides this, there are other advantages:

- minimal fee for transaction processing;
- high speed of transfers;
- cross-border payments at any time — 24/7;
- protection of personal data due to blockchain technology
- no chargeback.

How to Accept Cryptocurrencies?

This is a fairly easy process, reminiscent of the Internet acquiring we’re used to. On the website of the company providing goods or services, you need to integrate a cryptocurrency payment gateway — software that performs the tasks of transferring and receiving cryptocurrencies from buyers.

The buyer, after deciding on a purchase on the site, chooses a cryptocurrency payment method and pays for the goods using a special web interface.

There are several payment options: by QR-code, by wallet address or via Web 3.0 wallet. The option of payment via Web 3.0 wallet is currently available only at one service — 0xprocessing. Besides payment for goods, the implementation of Web3 processing allows you to configure the automatic disbursement of salaries to Web3 wallets of employees of the company.

Using the service simplifies the payment process and protects against volatility. In fact, no matter how unstable the currency is, once it is transferred to the merchant’s account, it retains its value due to conversion into stablecoins supported by the service.

In order to connect a cryptocurrency payment gateway, you need to submit an application on the service’s website, wait for its approval and implement the software on the site.

There are many services on the market today. We recommend to start with 0xprocessing. It is a multifunctional and progressive provider of cryptocurrency payment services, offering more than 40 top cryptocurrencies, agent and Web3 processing, as well as recurring payments and automatic volatility risk control system.

Contact 0xprocessing:
http://0xprocessing.com
https://t.me/OxProcessing_bot
Hacktoberfest 2022 with MindsDB
Tags: hacktoberfest, mindsdb, opensource, machinelearning
Published: 2022-10-07 15:42:47

## It’s time to Hack!

Join MindsDB’s Hacktoberfestivities by making Open Source Contributions and get a chance of winning a [Razer Blade 15 Laptop](https://www.razer.com/hard-bundles/Razer-Blade-15-Bundle-V5-Essential/RZHB-220912-11), cool audio gadgets, T-shirts and a cash prize.

There are several categories of open issues that are ideal for first-time developers, low-code, and no-code contributors for you to check out on [MindsDBs page](https://mindsdb.com/hacktoberfest?utm_medium=social&utm_source=facebook&utm_campaign=hacktoberfest2022&fbclid=IwAR2pEKOc7hDKVTt93uBHQ4NmLAvWRXa6nI26jolQKG8KhnKwafkEkBcrajo).

###Categories:

**Integration ideas**
Share a well-described idea of a new MindsDB integration. The authors of top upvoted ideas will get a T-shirt, cool audio gadgets, and a cash prize:

- 1st place: $500
- 2nd place: $300
- 3rd place: $200

**Code,Low & No-code**
Make as many contributions of your choice to win a high-end Razer Blade 15 Laptop or one of 10 cool audio gadgets:

- Contribute to Docs
- Share Social Media Posts
- Report and/or fix a Bug
- Make a QA/UX Test
- Develop an Architectural Diagram
- Write a Tutorial
- Submit a UX Design
- Build a Data-Source Integration
- Make a Video Tutorial
- Build ML Framework Integration

**Video Tutorials**
Make as many contributions of your choice to win a high-end Razer Blade 15 Laptop or one of 10 cool audio gadgets! Make video tutorials of using MindsDB and invite everyone to watch them on YouTube. The authors of the most popular videos will get a T-shirt, cool audio gadgets, and a cash prize::

- 1st place: $1000
- 2nd place: $500
- 3rd place: $300

For every 10 points, you will receive one entry into the draw for the awesome [Razer Blade 15 Laptop](https://www.razer.com/hard-bundles/Razer-Blade-15-Bundle-V5-Essential/RZHB-220912-11) powered by the top NVIDIA GeForce RTX 3080 Ti GPU, 14-core Intel i9 CPU and more. 

You can also win one of the 10 gadgets of your choice: 
**JBL Earbuds** or **Rugged Outdoor Speaker**.

To participate, you need to have your GitHub PRs merged and complete the form with your details.

Please complete the form below to participate in the prize draw. You should complete the form just once with all your contributions listed. You will be able to edit your responses after submission. [The form can be found here.](https://docs.google.com/forms/d/e/1FAIpQLSeyuQGpu-gmVAbXPXMsT5bfFQk28qGNHlsOjz9kkHmgyQEFOw/viewform)

Entries will close at midnight (PST) Monday, 31st of October with the winner announced on the first week of November.
Use tsx instead of nodemon
Tags: node, javascript, typescript, productivity
Published: 2022-10-07 15:21:49

> If you use **typescript**, **nodemon** and **ts-node** for development.
> You'll notice that it takes a while to recompile the code when it changes.

[**tsx**](https://github.com/esbuild-kit/tsx) is a Typescript execute which blazing fast ⚡️ with [esbuild](https://esbuild.github.io/).

## Installation

I prefer use [pnpm](https://github.com/pnpm/pnpm) but you can use npm, yarn, ...etc.
```bash
pnpm add -D tsx
```
Now you can uninstall nodemon and ts-node.

```
pnpm remove nodemon ts-node
```

Add script `tsx watch [file/folder]` in the package.json.
```json
{
  "name": "use-tsx",
  "version": "1.0.0",
  "main": "index.ts",
  "scripts": {
    "dev": "tsx watch src",
  },
  "devDependencies": {
    "@types/node": "^18.7.18",
    "tsx": "^3.9.0",
    "typescript": "^4.8.3",
  }
}
```
Let's start.

```bash
pnpm dev
```

**refs**:
- https://github.com/esbuild-kit/tsx
- https://github.com/privatenumber/ts-runtime-comparison
- https://github.com/remy/nodemon
- https://github.com/TypeStrong/ts-node
EmploymentJapan.com - Japan and Japanese centric global job board
Tags: jobs, recruiting, recruitment, japan
Published: 2022-10-07 15:21:10

EmploymentJapan-com is a Japanese-centric global job portal that connects employers with English-speaking tech (information technology) talent looking for a job in Japan and employers worldwide looking for Japanese-speaking candidates in their respective countries. 

We also bring rich and exclusive educational content related to life in Japan and also niche content about Information Technology. The continuously expanding educational resources on the website are our commitment to the people interested in Japan or Japanese. While we are always there to help with jobs and career searches, we are also committed to upskilling, education, and training for career growth.

[https://www.employmentjapan.com](https://www.employmentjapan.com)
Use Terraform to update kubeconfig
Tags: cloud, security, terraform, kubernetes
Published: 2022-10-07 15:17:22

Once way to provision [AWS EKS](https://aws.amazon.com/eks/) is by using Terraform and integrating EKS provisioning into your CI/CD build and pipeline workflows.

When managing EKS, you may then want to use the [kubectl](https://kubernetes.io/docs/reference/kubectl/) CLI....so you'll need to update your kubeconfig file.  

Here's how to do it using Terraform

1) In your Terraform output file, output 2 values to validate
```
output "region" {
  description = "AWS region"
  value       = var.region
}

output "cluster_name" {
  description = "Kubernetes Cluster Name"
  value       = local.cluster_name
}
```
These two values are used in the kubeconfig file

2) In your Terraform files, create a "null_resource" to run a  command on your computer that runs the Terraform files, in my case it's my Macbook Air.

```
resource "null_resource" "kubectl" {
    provisioner "local-exec" {
        command = "aws eks --region ${var.region} update-kubeconfig --name ${local.cluster_name}"
    }
}

```
That should be it - now when you run a kubectl command, you see see your AWS EKS objects.
Starting the Ethical Hacking Journey
Tags: ethical, hacking, beginners, codenewbie
Published: 2022-10-07 15:15:30

Hi Dev Community!

I am so excited to begin my journey onto Ethical hacking and I have set my baby steps in it.
Hopefully I can learn more about ethical hacking and share my info here.

So as first I have learnt who a hacker is and I am surprised to know that hackers are people who know more about computers rather than the common definition of hackers which is gaining unauthorized access to data, these people are known as crackers.

Then the thing is that to become an ethical hacker we must think in the way of a cracker to solve bugs or loopholes.

Then I installed VMvare and installed Kali Linux into it!

These are my current updates!
Starting My Full Stack Web Developer Journey
Tags: webdev, beginners, programming, codenewbie
Published: 2022-10-07 15:02:51

Hi Dev community!

Excited to share that I plan to start my full stack web development journey!

I have thought of to start at front end then focus on back end , as well as create some projects during the journey

So here is my planning 

## **Front-End**

1. HTML
2. CSS
3. JavaScript
4. ReactJs

## **Back-End**

1. Node
2. mongodb

These are my plans and I am a newbie in web development so seeking help and if I have to add any tech stack in front or back end please comment and help me out.

Thankyou for your support dev's!
3 Days Before Hack Reactor Technical Assessment
Tags: beginners, codenewbie, devjournal
Published: 2022-10-07 14:50:10


And all my friends -- especially the friends who are Hack Reactor grads -- are telling me to relax.

Easy for them to say, they don't currently have a six-hour juggernaut of a test impatiently waiting to smash their fragile programmer egos.

The Technical Assessment (TA) is the midpoint, high-stakes exam that all Hack Reactor students must survive in order to move on into the Senior portion of the 13-week software engineering immersive program. One either passes and takes another step toward a high-reward career as a programmer, or instead is forced to reevaluate life decisions and consider stepping off the software engineering path. 



![A man pondering a complicated maze](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ubdfixqpx4rxtoeya1jt.jpeg)



At fifty-three years old, I am not possessing of a wealth of chances to try out this whole midlife-crisis-change-careers-and-hope-for-the-best thing -- it's pretty much this works out now, or I will go back to doing what I was doing before.

The 'before' refers to my previous life as a Substance Use Counselor. As someone in recovery from substance use, I found the work personally and professionally rewarding -- unfortunately, it is alarmingly difficult to survive in a city (San Francisco at the time) on a counselor's salary. The lack of financial security coupled with significant burnout after working in a large metropolitan hospital emergency room for the bulk of the pandemic, I needed a change.

I had several friends who took the software engineering path and they all encouraged me to give it a go. So, I started with some Udemy, some FreeCodeCamp, some CodeWars, and a lot of misunderstanding regarding what programmers actually do. A year and a half later I quit my job, moved to a new city with my partner, and -- relying on her for financial and emotional support -- applied to Hack Reactor.

I passed the entrance assessments and began my 13-week immersive in September 2022. Since then, my understanding has grown exponentially -- and [Dunning-Kruger] (https://www.britannica.com/science/Dunning-Kruger-effect) has been banished. 

All joking aside, Hack Reactor has done their best to prepare me to take this exam -- I am neither over- or under-confident; I am prepared to tackle this juggernaut (of my imagining) and move on to whatever lies ahead.
Elxis CMS v5.3 released
Tags: release, cms, opensource, elxis
Published: 2022-10-07 14:37:50

**Elxis** is a free **Content Management System** (CMS) that allows you to easily create websites of any scale from small personal websites and blogs to complex corporate websites and portals without the need of having programming skills!

Download [Elxis CMS v5.3 Atlas](https://www.elxis.org/download.html).

---

## Elxis is open source

Elxis CMS is an open source project released for free under the [Elxis Public License](https://www.elxis.org/elxis-public-license.html) (EPL) license. Elxis CMS is provided for free and without any guarantee. The license allows you to develop software that extends Elxis built-in functionality and adapt Elxis to your needs. 

Since 2006, when Elxis project begun, Elxis has been downloaded and installed on thousands of websites in all over the world and translated in more than 40 languages. Elxis has been approved a flexible, secure and reliable platform.

## Elxis Team

Elxis CMS is being developed by the Elxis Team. Elxis Team is a small team that develops and coordinates the Elxis project. The eldest member and the chief developer of Elxis Team is [Ioannis Sannos](https://isopensource.com). [Stavros Stratakis](https://webgift.dev) is also very active member of Elxis Team. 

Our headquarters are located in Athens, Greece. Besides this team there are the Elxis Community Team members that also participate in Elxis development, provide new ideas, report bugs, write documentation, make translations, and many other tasks. Elxis community Team members are vital to the Elxis project. 

In Elxis family also belong all of you that use, promote and support Elxis CMS. Elxis project is open to new ideas and people.


## Elxis history

Elxis CMS born on December 2005 and its first release, Elxis 2006.0, was on June 2006. Read more about all [Elxis releases](https://www.elxis.org/releases/) and the [history of Elxis](https://www.elxis.org/releases/elxis200xx-series.html) in the Elxis 200x.x series page.

```php
<?php echo 'Welcome to our Elxis CMS world'; ?>
```

References:
Elxis CMS - [Official website](https://elxis.org)

Support:
Elxis [Community - forum](https://forum.elxis.org)
Brief Intro to the Variable Keywords in Javascript
Published: 2022-10-07 14:09:42


In Javascript, there are three different variable keywords, which include var, let, and const. Each variable keyword acts differently, so it is important to know how they will affect your code.

###Var###
When declaring a variable using the var keyword, it makes a global scoped variable. Global scoped variables can be accessed throughout your code due to hoisting. Var declared variable can also be reassigned new values.
```
var name = 'Jack';

function printName() {
  console.log(name);  // accessing global var name
}

printName(); // 'Jack' will be logged to the console
```
Here we reassign the var name to be a different value:
```
name = 'Gracie';
console.log(name); // 'Gracie' is now logged to the console
```




###Let###
Unlike var, let is a block scoped variable, meaning when you declare a variable using let, that variable cannot be accessed out the block of code where it was created. The only way you could access that variable, is if it was put in the global scope of your code. The let keyword however can be reassigned a new value.

Variables assigned with let cannot be accessed if put within a block of code:
```
let x = 20
if(x > 10) {
  let message = 'greater than 10';
}
console.log(message); // ref error: message is undefined
```

They can be reassigned though:
```
let y = 30;
y = 5;
console.log(y); // 5 will print to the console
```


###Const###
The const keyword is also considered a block scoped variable, but variables declared with const cannot be reassigned a new value.

Trying to assign a new value to a const variable will give the following error:
```
const number = 50;
number = 100; // typeError: assignment to constant variable
```

###Know which to use###
It is important to understand when to use each of these keywords because they act so differently from one another. It is now more common practice not to use the var keyword, due to it being globally scoped along with the possibility of accidentally reassigning a variable. If you want to be able to reassign a variable, you can use the let keyword, otherwise use const. Even though both of these keywords are block scoped, you can always just put the variables in the global scope of your code to make them globally accessible.

Even though the concepts and examples shown here are very basic, it is good to get a grasp of the fundamental traits and characteristics of the these three variable keywords and understand when each should be used.
Important Rules of Go
Tags: beginners, tutorial, programming, go
Published: 2022-10-07 14:01:30


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

Golang has strict coding rules that are there to help developers avoid silly errors and bugs in your golang code, as well as to make your code easier for other to read(for the Golang community).
This article will cover two such Important Rules of Golang you need to know of it.

## 1. Use of Golang package

Golang has strict rules about package usage. Therefore, you cannot just include any package you might think that you will need and then not use it afterward.
Look at the following program and you’ll understand after you try to execute it.

```go
// First Important Rules of Golang
// never import any package which is
// not going to be used in the program
package main
import (
    "fmt"
    "log" // imported and not used log error
)
func main() {
    fmt.Println("Package log not used but is included in this program")
}
```

If you execute your program(whatever name of the file), you will get the following error message from Golang and the program will not get execute.

```
Output:

~/important-rules-of-go$ go run main.go
# command-line-arguments
./main.go:8:2: imported and not used: "log"
```

If you remove the log package from the import list of the program, it will compile just fine without any errors.
Let’s try to run program after removing log package from program.

```go
// valid go program
package main
import (
    "fmt"
)
func main() {
    fmt.Println("Package log not used but is included in this program")
}
```
If you execute this code you will not get any error on compile time.

```
Output:

~/important-rules-of-go$ go run main.go
Package log not used but is included in this program
```

Although this is not the perfect time to start talking about breaking Golang rules, there is a way to bypass this restriction. This is showcased in the following code

```go
// alternative way to bypass this 
// imported and not used rule
// just via adding underscore
// before the name of the package
// if you are not going to use that
// package
package main
import (
    "fmt"
    _ "log"
)
func main() {
    fmt.Println("Package log not used but is included in this program")
}
```

So, using an underscore character in front of a package name in the import list will not create an error message in the compilation process even if that package will not be used in the program
If you execute the above code you’ll see no error as we got in before this example:

```
Output:

~/important-rules-of-go$ go run main.go
Package log not used but is included in this program
```

You can read full article on this site
[programmingeeksclub.com](https://programmingeeksclub.com/important-rules-of-golang/)

Thanks for reading :)