teleren/devto huggingface dataset:
A is for Algorithms
Tags: algorithms, basics, concepts, abcdev
Published: 2023-02-10 22:00:33

---
title: A is for Algorithms
published: true
description: Letter A of the series ABCDev
tags: #algorithms #basics #concepts #abcdev
# cover_image: https://pbs.twimg.com/media/Fooy3geWYAo4Nns?format=jpg&name=medium
# Use a ratio of 100:42 for best results.
# published_at: 2023-02-01 16:19 +0000
---
Algorithm is a set of steps to solve a problem. It can be implemented in activities such as crossing the street and it is divided into steps, for example:

1.  Start the process.
    
2.  Make sure you are standing up in front of the crosswalk.
    
3.  Wait till the sign turns red.
    
4.  Make sure all the cars stopped.
    
5.  Look both ways.
    
6.  Start walking.
    
7.  Get to the other side of the street.
    
8.  Terminate the process.
    

That’s an algorithm! It may not be exactly written in a programming language, but it is still an algorithm and it shows some important concepts of it:

-- Start/Terminate: All algorithms have a start and a terminate step. An algorithm can run repeatedly but it needs a start and end. It takes at least one input at the start and it always terminates with at least one output, making it finite.

 -- Clear: The instructions are easy to understand and follow, and it is descriptive, basic and simple.

 -- Language Independent: The output is the same, even if you translate the instructions to other languages (this applies to programming languages too).

Understanding algorithms help us to understand better our code. What are the steps needed to make our code function? How it can be improved?

Here is an algorithm example of finding out if a number is even or odd:

#### In English:

1.  Start
    
2.  Ask for a number
    
3.  Hear the answer
    
4.  Divide the number that you just heard by two
    
5.  If the number has no remainder after the equation, then the number is even
    
6.  If the number has remainder after the equation, then the number is odd
    
7.  End
    
#### In Java:

	import java.util.Scanner;
	public class JavaExample
	{
		public static void main(String args[])
		{
			int num;
			System.out.print("Enter an Integer number: ");
			Scanner input = new Scanner(System.in);
			num = input.nextInt();
			if ( num % 2 == 0 )
				System.out.println(num+" is an even number.");
			else
				System.out.println(num+" is an odd number.");
		}
	} 

Algorithms can also be divided on different types such as recursive, brute force, backtracking, searching, sorting, hashing, divide and conquer, greedy, dynamic programming and randomined.

Personally, I like to think about the algorithm of the code on English and write it down on VSCode as comments, making it a pseudo-code. From there, I start designing my code.
date for wassce 2023
Published: 2023-01-18 19:03:50

[https://multischolar.com/waec-timetable/](https://multischolar.com/waec-timetable/#utm_source=backlinks&utm_medium=search&utm_campaign=darry+ring+us&utm_content=Michelle)
https://plaza.rakuten.co.jp/chenlee/diary/202301190000/
https://www.provenexpert.com/date-for-wassce-2023/
https://www.producthunt.com/@dateforwassce
https://www.divephotoguide.com/user/dateforwassce2023/
https://www.diggerslist.com/dateforwassce2023/about
https://wakelet.com/@dateforwassce2023323
https://vocal.media/authors/dateforwassce2023
https://www.lifeofpix.com/photographers/dateforwassce2023/
https://seedandspark.com/user/dateforwassce2023
https://rosalind.info/users/dateforwassce2023/
http://phillipsservices.net/UserProfile/tabid/43/userId/194886/Default.aspx
https://app.roll20.net/users/11525099/dateforwassce2023
http://uid.me/dateforwassce2023
https://speakerdeck.com/dateforwassce2023
https://social.msdn.microsoft.com/Profile/dateforwassce2023
https://www.iheart.com/podcast/269-date-for-wassce-2023-107472195/
https://active.popsugar.com/@dateforwassce2023/profile
https://unsplash.com/@dateforwassce2023/likes
https://camp-fire.jp/profile/dateforwassce2023
https://plazapublica.cdmx.gob.mx/profiles/dateforwassce2023/activity
https://www.metal-archives.com/users/dateforwassce2023
https://artmight.com/user/profile/925944
https://storium.com/user/dateforwassce2023
https://trabajo.merca20.com/author/dateforwassce2023/
https://telegra.ph/date-for-wassce-2023-01-18
https://www.intensedebate.com/people/dateforwassce
https://www.mifare.net/support/forum/users/dateforwassce2023/
https://pinshape.com/users/2556743-dateforwass
http://foxsheets.com/UserProfile/tabid/57/userId/118503/Default.aspx
https://www.kompasiana.com/dateforwassce2023
https://www.credly.com/users/date-for-wassce-2023/badges
https://www.myminifactory.com/users/dateforwassce2023
https://www.speedrun.com/user/dateforwassce2023
https://www.sqlservercentral.com/forums/user/dateforwassce2023
https://www.longisland.com/profile/dateforwassce2023
https://leanin.org/circles/dateforwassce2023
https://myanimelist.net/profile/dateforwassce202
Better Folding✨ - All you ever wished from VSCode folding.
Tags: vscode, webdev, tooling, javascript
Published: 2023-02-10 21:42:05

Hello everyone, I would like to introduce Better Folding, a VSCode extension inspired by the most requested folding-related features in the VSCode repo all in one.


The extension in action:


![Preview](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8uzy6erzp9f2e5ephny1.gif)


Features:

- Including the closing bracket in folded ranges ([requested for 7 years](https://github.com/microsoft/vscode/issues/3352))

![Including the closing bracket in folded ranges](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2irsbbg0g97rx465pkml.png)

- Show folded brackets in the collapsed text


![Show folded brackets in the collapsed text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3p3vc7dgr662txp1a4aj.png)


- Including closing tags in folded ranges ([requested for 6 years](https://github.com/microsoft/vscode/issues/24515))
- Fold self-closing tags


![Including closing tags in folded ranges](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9fz3mbkwuclnkak60y8r.png)



- Showing the number of folded lines

![Showing the number of folded lines](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/njwfwhqd9u3p0y3yz9zp.png)

- Chain multiple folds together
- Showing only the function params names in folded functions

![Chain multiple folds together](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/12bbotsyp2s0zsic12tj.png)

- Showing object previews

![Showing object previews](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qcx1z4fs0j5xjbocaba7.png)


You can find it here on the [marketplace](https://marketplace.visualstudio.com/items?itemName=MohammadBaqer.better-folding)


Let me know what you think, and if you find any bugs or have an feature requests, please don't hesitate to submit an issue on the [GitHub repo](https://github.com/mtbaqer/vscode-better-folding).

Cheers 👋
My functional journey
Tags: functional, beginners
Published: 2023-02-10 21:25:20

My functional journey went a bit like this:

"Oh wouldn't it be nice if I could do functional programming with javascript because I already know that!"

"Argh, javascript libraries are terrible."

"Oh no every sublanguage has its own broken transpiler (or whatever you call this)."

"And the documentation is all over the place and often half finished."

"So the only serious options for hardcore functional programming are Haskell and Scala."

"Scala, just no. Bah."

"Haskell is nice but you can't do anything serious with it."

"Extensions? Why is this stuff not documented?"

"Running Haskell? Start doing a PhD on Nix and then we'll talk."

"OK. I guess I'll write Clojure which has a nice syntax and takes advantage of the maturity of the JVM."

"Ah, another small language with a fragmented and stagnant ecosystem."

"I give up. Whatever functional features Rust has will have to be good enough."

"Let me learn some category theory for fun."

"So category theory has almost no relationship to practical functional programming and all that endofunctor stuff is just a fancy way of saying 'Screw you!'??"

"No desire to ever touch this stuff again. Maybe I'll try logic programming instead."
BigCommerce Developers Community Update: We’re On Youtube!
Tags: bigcommercecommunity, bigcommerce, bigcommercedevelopme, youtube
Published: 2023-02-13 17:35:39

---
title: BigCommerce Developers Community Update: We’re On Youtube!
published: true
date: 2023-02-10 20:59:06 UTC
tags: bigcommercecommunity,bigcommerce,bigcommercedevelopme,youtube
canonical_url: 
---

![](https://cdn-images-1.medium.com/max/1024/1*9ypU_JQ_7yxr2F3YpTheqw.jpeg)

### BigCommerceDevs YouTube is LIVE!

If you’ve been patiently waiting for BigCommerce Developers to start [our own YouTube channel](https://www.youtube.com/@bigcommercedevelopers), you’re in luck!

Last week, we debuted our channel and [our first video series, “Getting Started with BigCommerce”](https://www.youtube.com/watch?v=vNHVIF_HhxM&list=PLoZHrc75wI_SfZlS0-is8tQzmKDsuUs_A), filmed and edited by our Developer Advocate Stephen Hilliard.

This is our first series, with many more coming your way! We hope our YouTube page becomes a helpful, informative resource for any developers building apps, widgets, storefronts, and anything else on BigCommerce’s platform.

### What Do We Need From You, the Developers?

In a word: _feedback_!

These videos are one of our initiatives toward making BigCommerce the absolute best eCommerce platform for developers. We’d love to hear your thoughts on the videos, the types of videos you’d like to see, and anything in between.

These videos are for you, our developer community, and we hope we can continue our video initiative by listening to and implementing your input.

### What’s Next?

Head on over to [our new YouTube page](https://www.youtube.com/@bigcommercedevelopers), subscribe, and stay up-to-date on the videos we’re posting.

We’ll continue to create video content, and if there’s a specific topic you’d love a video or series on, comment on this article, email us at [devrel@bigcommerce.com](mailto:devrel@bigcommerce.com), or [tweet at us](https://twitter.com/BigCommerceDevs)!

* * *
Learning Ruby and Active Record: Struggles and Benefits
Published: 2023-02-10 21:10:32


Ruby is a dynamic, general-purpose, object-oriented programming language that has gained widespread popularity in recent years. One of the key features of Ruby is its simplicity and readability, making it a popular choice for beginner programmers. However, this does not mean that learning Ruby is easy, and there are many challenges that you will face along the way.

One of the biggest challenges in learning Ruby is getting used to its syntax. Unlike other programming languages, Ruby has a more relaxed syntax that can take time to get used to. For example, you can put an "end" statement anywhere on the line, instead of always having to put it at the end of the line. This can make it difficult for someone who is used to the strict syntax of other programming languages to quickly pick up Ruby.

Another challenge in learning Ruby is getting used to its dynamically typed variables. In other programming languages, you declare the type of a variable when you define it. For example, you might declare a variable to be an integer or a string. In Ruby, however, variables are dynamically typed, which means that the type of a variable can change at runtime. This can be both a blessing and a curse, as it makes your code more flexible, but also makes it more prone to errors if you're not careful.

Active Record is a Ruby gem that provides a simple and elegant way to interact with databases. It is often used in the Ruby on Rails framework and provides a higher level of abstraction over the underlying database, making it easier for developers to interact with databases in a more intuitive way. However, there are also challenges in learning Active Record, particularly in understanding the underlying SQL syntax that is being used.

One of the benefits of learning Ruby and Active Record is that they are both widely used and well-supported. Ruby has been around for over two decades and has a large and active community of developers who are constantly working to improve it. Similarly, Active Record is widely used in the Ruby on Rails framework and has a large community of users and developers who are constantly working to improve it.

Another benefit of learning Ruby and Active Record is that they are both very flexible and can be used for a wide range of applications. Ruby can be used for a variety of tasks, from web development to data analysis, while Active Record can be used with a wide range of databases, making it a versatile tool for working with data.

In conclusion, learning Ruby and Active Record is both a challenging and rewarding experience. Although there are challenges in getting used to the syntax and features of Ruby, as well as the underlying SQL syntax of Active Record, the benefits of learning these tools far outweigh the challenges. With a large and active community of developers, flexible and widely-used tools, and a wide range of applications, Ruby and Active Record are excellent choices for anyone looking to improve their programming skills.
The top 10 features of Total.js Flow
Tags: node, iot, javascript, programming
Published: 2023-02-10 21:03:05

Total.js Flow is a web-based graphical programming interface that provides a user-friendly and modern experience for low-code development through the use of a web browser. You can use it as an alternative to __Node-RED__.

- [Total.js Flow website](https://www.totaljs.com/flow/)
- Open-Source (MIT)

[![Total.js Flow on Product Hunt](https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=377673&theme=light)](https://www.producthunt.com/posts/total-js-flow?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-total&#0045;js&#0045;flow)

---

![Total.js Flow](https://www.totaljs.com/download/snoo002gi40d.jpg)

---

## 1. Low hardware requirements

Total.js Flow can be used anywhere you are able to provide the Node.js Platform. You can run the Flow on devices like [Raspberry Pi](https://www.raspberrypi.org/).

## 2. Without third-party dependencies

In the core, Total.js Flow does not use any external third-party dependencies, but it does not restrict you from using any external dependencies used in the components.

## 3. Multithreading

This is a key feature. Each flow design (called FlowStream) is provided as an independent worker process, with its own components, memory and CPU resources.

## 4. Component's editor

You can create your own Flow components or customize existing Flow components directly in the Flow. You don't need any special tools, compilers for creating components.

## 5. Real-time traffic indicator

You can see traffic between components with flowing data.

![Real-time traffic indicator](https://www.totaljs.com/download/f870001sj41d.gif)

## 6. Bundling Flows to components

You can easily bundle a Flow design as a Flow component and use it multiple times in other Flows.

## 7. Beautiful user interface

Total.js Flow offers a really nice UI built on top of Web components technology.

## 8. Running

You can evaluate flow design either as a server-less app or as an application without a UI.

## 9. Fully integrated with Total.js OpenPlatform

Total.js Flow is fully optimized for use on the [Total.js OpenPlatform](https://www.totaljs.com/openplatform/). The OpenPlatform is a portal solution for integrating third-party apps.

- [Total.js OpenPlatform](https://www.totaljs.com/openplatform/)

## 10. Usability

Total.js Flow can be used almost everywhere. Industry/home automation, data processing, monitoring, as a configuration tool, for creating REST services, etc.

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

---

- [__Make the Total.js Platform better, support it!__](https://www.totaljs.com/support/)
- [Have any questions? Contact us](https://www.totaljs.com/contact/)
Benefits of using useReducer() over useState() in React.js applications
Tags: react, webdev
Published: 2023-02-10 20:40:54


![Cover](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3qh4s8mtg8q1la7woyaa.png)

In React.js (a popular open-source front-end JavaScript library for building user interfaces) we use `useState()` and `useReducer()` to manage the state of our components. While `useState()` it’s easy to understand and use. But `useReducer()` is more suitable in complex state management scenarios.



## What is useReducer()?
`useReducer()` is a hook that allows us to manage the state of our components using a reducer function. A reducer is a pure function that takes the current state and an action, and returns a new state. The new state replaces the old state, causing the component to re-render.

---

## Example Code: Increment / Decrement the count using useReducer()

```javascript
import React, { useReducer } from "react";
function reducer(state, action) {
switch (action.type) {
case "ADD":
return { count: state.count + 1 };
case "SUBTRACT":
return { count: state.count - 1 };
default:
return state;
}
}
function Counter() {
const [state, dispatch] = useReducer(reducer, { count: 0 });
return (
<>
Count: {state.count}
<button onClick={() => dispatch({ type: "ADD" })}>Add</button>
<button onClick={() => dispatch({ type: "SUBTRACT" })}>Substract</button>
</>
);
}
```

## Output
![Output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f4myf9yj9bsla64nj2nb.PNG)

---

## Benefits of using useReducer() over useState() :

1. **Better complex state management**: When the state becomes complex, it can be difficult to manage using only `useState()`. `useReducer()` is better suited for complex state management as it allows us to break down the state into smaller pieces and manage them separately.

2. **Centralized state management**: With `useReducer()`, we can centralize the management of our state, making it easier to debug and understand.

3. **Better scalability**: As our application grows, we may need to add more and more states to our components. `useReducer()` makes it easier to manage and maintain the state as our application grows.

4. **Improved performance**: `useReducer()` performs optimally when compared to `useState()` because it batches updates to the state. This means that multiple updates to the state can be combined into a single update, improving the overall performance of our application.

5. **Ability to manage multiple states**: `useReducer()` allows us to manage multiple pieces of state using a single reducer function. This can simplify our code and make it easier to maintain.

6. **Better code reuse**: `useReducer()` allows us to extract logic from the components into a separate reducer function. This makes it easier to reuse the same logic in multiple components.

In summary, `useReducer()` is a powerful hook that provides a more scalable, performant, and flexible way to manage the state in our React JS applications.
Use Laravel with OpenAI to validate inappropriate content
Tags: laravel, openai, webdev, php
Published: 2023-02-10 20:40:29

Recently I stumbled across [OpenAI Moderations API](https://platform.openai.com/docs/api-reference/moderations) which gives you a way to query OpenAI in order to detect if input text contains inappropriate content such as hate, violence, etc.

API is completly free - you just need to create an OpenAI account and issue a fresh API token.

Since I'm primary a Laravel PHP Framework developer, I decided to [make a package](https://github.com/rcerljenko/laravel-openai-moderation) which will provide a way to validate request payload fields against OpenAI Moderations API.

### Installation

Standard [Composer](https://getcomposer.org/download) package installation:

```sh
composer require rcerljenko/laravel-openai-moderation
```

### Usage

1. Publish config and translation files.

```sh
php artisan vendor:publish --provider="RCerljenko\LaravelOpenAIModeration\LaravelOpenAIModerationServiceProvider"
```

2. Set your OpenAI API key and enable package via newly created config file => `config/openai.php`

3. Use provided rule with your validation rules.

```php
<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use RCerljenko\LaravelOpenAIModeration\Rules\OpenAIModeration;

class StoreText extends FormRequest
{
 /**
  * Determine if the user is authorized to make this request.
  */
 public function authorize(): bool
 {
  return true;
 }

 /**
  * Get the validation rules that apply to the request.
  */
 public function rules(): array
 {
  return [
   'text' => ['required', 'string', new OpenAIModeration],
  ];
 }
}
```

And that's it! Your content can now be validated with powerfull (and yet free) OpenAI Moderations API.

Thank you for reading this! If you've found this interesting, consider leaving a :heart:, :unicorn: , and of course, share and comment on your thoughts!

Lloyds is available for partnerships and open for new projects. If you want to know more about us, [check us out](https://lloyds-digital.com).

Also, don’t forget to follow us on [Instagram](https://instagram.com/lloyds.digital) and [Facebook](https://facebook.com/lloydsdigital)!
通过在Wirex X 账户上质押代币(USDT 等)赚取被动收入
Tags: cn, crypto, blog, passiveincome
Published: 2023-02-10 20:30:43

<a href="https://steemyy.com/out/wirex" rel="noopener" target="_blank">Wirex</a> 是受英国金融行为监管局（FCA）监管的。

[caption id="attachment_152159" align="alignnone" width="639"]<a href="https://helloacm.com/wp-content/uploads/2023/02/is-wirex-fca-regulated-google-search.jpg"><img src="https://helloacm.com/wp-content/uploads/2023/02/is-wirex-fca-regulated-google-search.jpg" alt="Wirex is FCA Regulated" width="639" height="295" class="size-full wp-image-152159" /></a> Wirex is FCA Regulated[/caption]

我们可以<a href="https://justyy.com/archives/6379" title="公司今天上市,  我用比特币买了午餐 – Wirex 银行卡超级好用!">在Wirex X-Accounts</a>上抵押币（USDT等），并开始获得<a href="https://justyy.com/archives/31554" title="被动收入可遇不可求">被动收入</a>。利息每周发放。您可以选择以WXT币获得利息，以获得额外的2％奖金。例如，<a href="https://justyy.com/archives/46556" title="被动收入: 虚拟货币可以挣得12%年利率的利息 (DeFi 区块链金融产品)">抵押USDT</a>可以获得每周7％的APR以USDT支付，或以WXT支付每周9％的APR。

[caption id="attachment_152160" align="alignnone" width="1226"]<a href="https://helloacm.com/wp-content/uploads/2023/02/wirex-earn-passive-income-on-x-accounts.jpg"><img src="https://helloacm.com/wp-content/uploads/2023/02/wirex-earn-passive-income-on-x-accounts.jpg" alt="Earning Passive Income using Wirex Crypto X Accounts" width="1226" height="926" class="size-full wp-image-152160" /></a> Earning Passive Income using Wirex Crypto X Accounts[/caption]

这种 Stake & Earn (质押<a href="https://justyy.com/archives/31213" title="浅谈虚拟货币交易所三角套利的算法">虚拟货币</a> 获得比传统金融产品更高的利息) 也是比较常见的 DeFi 产品 (Decentralized Finance 去中心化金融产品), 不过还是有风险的，尽量选择被监管的公司和产品，否则很有可能是你惦记着它的利息，它却盯上你的本金。

<blockquote>
提取时需要30天：您的X-Account有一个滚动的30天赎回期，这意味着一旦申请提款，您将在30天后收到资产及<a href="https://justyy.com/archives/47497" title="被动收入之开通 Chase/大通 银行卡挣2.7%利息">利息</a>。
Your X-Account has a rolling 30-day redemption period, meaning that once withdrawal is requested you will receive your assets plus accrued interest at the end of 30 days.
</blockquote>

[caption id="attachment_152161" align="alignnone" width="589"]<a href="https://helloacm.com/wp-content/uploads/2023/02/wirex-card.jpg"><img src="https://helloacm.com/wp-content/uploads/2023/02/wirex-card.jpg" alt="Wirex Card Crypto Card" width="589" height="357" class="size-full wp-image-152161" /></a> Wirex Card Crypto Card[/caption]

申请<a href="https://steemyy.com/out/wirex" rel="noopener" target="_blank">Wirex</a> 卡并开始获得被动收入！今天加入并赚取30 NXUSD！
Apply <a href="https://steemyy.com/out/wirex" rel="noopener" target="_blank">Wirex</a> card and start earning passive income! Join today and earn $30 in NXUSD!

英文: <a href="https://helloacm.com/earning-passive-income-by-staking-coins-usdt-etc-on-wirex-x-accounts/" rel="noopener" target="_blank">Earning Passive Income by Staking Coins (USDT etc) on Wirex X-Accounts</a>

博客: [https://justyy.com/archives/61224](https://justyy.com/archives/61224)