teleren/devto huggingface dataset:
AI-TDD: you write the test, GPT writes the code to pass it ✅
Tags: ai, testing, programming, productivity
Published: 2023-03-27 07:31:17

_first — let's grow [my twitter](https://twitter.com/_sukharev_), so i can tell about my inventions quicker and make the world even better place (or not, idk)_

---

[AI-TDD](https://github.com/di-sukharev/AI-TDD) — GPT4 CLI for TDD. You write the test, GPT writes the code to pass it ✅.

Yes, I know. It's a simple yet brilliant idea and open-source of the millennium. So feel free to fork and feature.

— Why?
— TDD is the only right way of..
— Wowow, man.. wait.. really.. don't..
— (Hits vape): Ok, ok... GPTs are not so good when prompted to generate code from a free text input, BUT when you prompt it with a test — GPT4 is killing it with impressive accuracy.
— Hmm.. And the more clearly you formulate a test, the cleaner and wiser you write the code?
— Yep, and so does GPT 🤖

This is probably it.

I won't tell you the whole 10 commandments of "why and how testing software is a blessing", just one thing — tests are like your friends, they tell you what you want to hear, but you can only trust them, and they save your a$$ anyway. You better have friends.

With AI-TDD, you adjust the tests, and the code is written for you. You leave the low level of "how to code this feature" and move above to the level of "what the feature should do". You clean your head from "implementations" and start operating "ideas" as the pro maximum deluxe engineer.

As [AITDD](https://github.com/di-sukharev/AI-TDD/blob/master/README.md) is open-sourced, I'm happy to merge your PRs, so feel free to fork and feature!

---

There is one more good tool — [OpenCommit](https://github.com/di-sukharev/opencommit#readme) — a GPT CLI to auto-generate conventional commits in 1 second.

---

I'll probably change the world with other extraordinary inventions and enlightenment, not sure yet, but anyway, follow the Twitter account https://twitter.com/_sukharev_ (or don't).
How to Recover from Burnout as a Developer 💻
Tags: webdev, programming, beginners, productivity
Published: 2023-03-27 07:29:56

Burnout is a serious problem, but it's also one that can be overcome. If you're feeling burned out and need some help getting back on track, try these tips:[Read Full Blog](https://technicave.hashnode.dev/how-to-recover-from-burnout-as-a-developer)
OpenCommit: GPT generates impressive commits in 1 second 🤯🔫 (open-source)
Tags: git, ai, productivity, opensource
Published: 2023-03-27 07:27:09

_first — let's grow [my twitter](https://twitter.com/_sukharev_), so i can tell about my inventions quicker and make the world even better place (or not, idk)_

---

I've been struggling making commit messages since 2017.

When you think of a commit message — you switch context from writing code. When you switch context — you waste time. Wasting time is lame.

I usually made 1 line commits like "amends", "fixed bug", "refactoring", "refactoring 2", "final refactoring" and then tried to come up with a good general message when merging a branch to production.

It has changed with THE FIRST AI REVOLUTION :)) I mean all this GPTs..

Two weeks ago I open-sourced [OpenCommit](https://github.com/di-sukharev/opencommit). It can answer WHY the change was done if you change model to GPT-4 in settings! Insane.

![opencommit — comparison](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fdik9aq5iwk3e4bqsqbk.png)

The lib uses [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) convention which makes commits meaningful. You can also turn on [GitMoji](https://gitmoji.dev/) setting if you like. And select different languages and many other features (I got 12 PRs so far)

Simply install it with npm:
```sh
npm i -g opencommit
```

After installing type `oc` and hit "Enter" in a terminal:
```sh
oc
```

If you want OpenCommit to be used by your IDE do:
```sh
oc hook set
```

That's it.

For more features [read the docs](https://github.com/di-sukharev/opencommit#setup).

![opencommit.gif](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m58jycy84s4jak2gfcl2.gif)

you may follow my [twitter](https://twitter.com/_sukharev_) or not

---

btw, i have one more great tool for making GPT write extremely accurate code for you https://dev.to/disukharev/aitdd-ai-cli-for-tdd-you-write-the-test-ai-makes-it-green-32bn
Unit testing private functionality in Unreal Engine C++ classes
Tags: ue5, unittesting, programming, unrealengine
Published: 2023-03-27 07:24:48

Unreal Engine has a pretty extensible suit of [automation features](https://docs.unrealengine.com/5.1/en-US/automation-system-in-unreal-engine/). For instance, we run unit tests in our continuous integration system upon merge of new code.

For these unit tests we utilize UE's `IMPLEMENT_SIMPLE_AUTOMATION_TEST` or potentially `IMPLEMENT_COMPLEX_AUTOMATION_TEST`. Here is a minimal test from Unreal's documentation:

```cpp
IMPLEMENT_SIMPLE_AUTOMATION_TEST(FPlaceholderTest, "TestGroup.TestSubgroup.Placeholder Test", EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter)

bool FPlaceholderTest::RunTest(const FString& Parameters)
{
    // Make the test pass by returning true, or fail by returning false.
    return true;
}
```

This is all well and good but pretty soon after implementing your first test you realize that you will want to reach `private` functionality in the class that you are testing.

After pondering different more or less ugly solutions I talked to my colleague [Tomas Hübner](https://www.linkedin.com/in/tomas-hubner/) and he showed me this old trick that does not  make this pretty but at least not terrible. And after pre-compiler is done the class we are testing is actually unaffected.

We do not want to make this private functionality public just for testing and we do not want to pollute the tested class with for instance a friend class that the original class should know nothing about. So, here is the trick: 

We add an empty macro `UNIT_TEST_FRIEND` to the class we want to test:

```cpp
#pragma once

#include "CoreMinimal.h"

#ifndef UNIT_TEST_FRIEND
#define UNIT_TEST_FRIEND
#endif

class FMyTestedClass : public FCoolUnrealClass
{
public:
    FMyTestedClass();

private:
    float PrivateFloat;
    void PrivateMethod();

    UNIT_TEST_FRIEND;
};
```
And then in the test class, we make sure to define the `UNIT_TEST_FRIEND` macro. The test class from above then becomes:
```cpp
#include "Misc/AutomationTest.h"

#if WITH_AUTOMATION_TESTS

#ifdef UNIT_TEST_FRIEND
#undef UNIT_TEST_FRIEND
#endif
#define UNIT_TEST_FRIEND friend class FPlaceholderTest

#include "MyTestedClass.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(FPlaceholderTest, "TestGroup.TestSubgroup.Placeholder Test", EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter)

bool FPlaceholderTest::RunTest(const FString& Parameters)
{
    FMyTestedClass TestedClass;

    // Using private member here
    float MyValue = TestedClass.PrivateFloat;

    // Calling private function here
    TestedClass.PrivateMethod();

    return true;
}
```
Note how we include `MyTestedClass.h` after defining the macro! Otherwise the `UNIT_TEST_FRIEND` will be empty when we parse the `MyTestedClass.h` header.

Tada!
Why PostgreSQL over MySQL? brief
Tags: database, mysql, postgres, devops
Published: 2023-03-27 07:23:14

Both PostgreSQL and MySQL are popular relational database management systems (RDBMS) that are widely used in various applications. However, PostgreSQL is often preferred over MySQL for several reasons:

1. **Advanced features:** PostgreSQL has a more advanced feature set compared to MySQL. For example, it supports complex data types, table inheritance, and transactional DDL (data definition language), while MySQL does not.

2. **Data integrity:** PostgreSQL provides a high level of data integrity by supporting advanced locking mechanisms, data validation, and foreign key constraints.

3. **Scalability:** PostgreSQL can handle large datasets and complex queries more efficiently than MySQL due to its advanced query optimizer and support for parallel query execution.

4. **Extensibility:** PostgreSQL has a well-developed ecosystem of extensions and plug-ins, making it easier to customize and extend its functionality.

5. **Community support:** PostgreSQL has a large and active community of users and developers who contribute to its development and support.

These are just a few of the many factors that might influence someone's choice between PostgreSQL and MySQL. Ultimately, the best choice will depend on the specific needs and constraints of your application.

PostgreSQL is widely used by many large applications and organizations, including:

Apple, Fujitsu, Instagram, Skype, Uber, Reddit, Yelp, and many more.

#happyCoding #developerslab101 #mysql #postgresql
トレサカJリーグの解説記事を更新致しました
Tags: トレサカ
Published: 2023-03-27 07:22:55

「トレサカJリーグ」は、公式ライセンス許諾のサッカークラブ経営ゲームであり、fillメディア編集部では、トレサカの始め方・遊び方の解説記事を公開しています。

[トレサカＪリーグの始め方・稼ぎ方－ゲームのレビュー・評判や、選手カードNFTの仕組み、仮想通貨との関係等を検証](https://social-lending.online/nft-games/toresaka/what-is-toresaka/)

以下、記事をお読みいただく時間がない方のために、トレサカの基本的な遊び方を要約してお届けします。

まず、トレサカを始めるには、公式サイトからLINEアカウントで新規登録をする必要があります。ただし、メールアドレスでのアカウント作成には対応していません。アカウント作成が完了したら、チーム名を決め、クラブエンブレムを選択してゲームを開始することができます。

ゲームを始めたら、チーム編成を進めます。ゲーム序盤から入手できる「トレサカポイント」を消費することで、「ガチャ」を引くことができます。ガチャで入手できるのは主にNクラスの選手カードですが、Rクラスのカードも入手可能です。SRクラスの選手を入手すれば、チーム編成が一気に捗ります。

選手の強化には、トレチケを消費するか、他のカードと合成するか、のいずれかの手法があります。また、「自分用」という制限がないチケットは、ゲーム内の取引所で売却して「トレサカコイン」に交換することもできます。トレサカコインは、選手カードパックの購入に使用できます。

基本的な課金要素は、ゲーム内で日本円で購入できる「トレサカコイン」です。1コイン＝1円で購入でき、選手カードパック（5枚1セット）の購入や、他チームに所属している選手カードの獲得交渉（オファー）、自チームの所属選手との契約更新などに使用します。

「リミテッド」タイプの選手カードは、所定の条件（例：チーム編成に組み込まれていないなど）を満たすことで、NFT化が可能です。NFT化したカードは、LINE NFTにて出品・販売することもできます。逆に、NFTマケプレで任意の選手カードを購入して、チーム強化に使用することもできます。
Why I don't use enum in Typescript?
Published: 2023-03-08 19:34:57

Enums are a powerful feature of TypeScript, allowing developers to define a set of named values with corresponding numeric or string values. While enums can be useful in certain scenarios, there are some reasons why a developer might choose not to use them. In this article, we will explore some of the reasons why I, as a developer, don't use enums in TypeScript.

**Enums can be limiting
**One of the limitations of enums is that they are static. Once defined, the set of values is fixed, and cannot be extended at runtime. This can be a problem in cases where new values need to be added, or when values need to be dynamically generated based on data. In such cases, using an enum can lead to more complex and less flexible code.

**Enums can cause maintenance issues
**When using enums, it is common to define them in a separate file or module. This can be useful for organizing code, but it can also cause maintenance issues. For example, if a developer needs to change the name of an enum value, they must do so in the enum definition file as well as in any files that use the enum. This can be time-consuming and error-prone, especially in large codebases.

**Enums can lead to tight coupling
**Enums can lead to tight coupling between different parts of a codebase. For example, if an enum is used to represent different states of an object, any changes to the enum can affect all parts of the code that use it. This can make it difficult to make changes to the codebase without affecting other parts of the system.

**Enums can be hard to test
**Because enums are static, it can be difficult to test code that uses them. For example, if an enum is used to represent different HTTP status codes, it may be difficult to write unit tests that cover all possible values. This can lead to incomplete test coverage and lower confidence in the code.

**Enums can be overkill
**In some cases, using an enum can be overkill. For example, if there are only a few possible values for a variable, it may be simpler and more straightforward to use a string or number literal instead of an enum. This can lead to cleaner, more readable code.

**Conclusion
**
While enums can be a useful feature of TypeScript, there are some reasons why a developer might choose not to use them. Enums can be limiting, cause maintenance issues, lead to tight coupling, be hard to test, and be overkill in some cases. As a developer, I consider these factors when deciding whether to use an enum or another approach in my code.
Good Morning, World! ☕️ What’s Your Routine?
Tags: discuss, beginners, codenewbie
Published: 2023-03-27 07:00:00

What's the first thing you do when you sit down at your desk in the morning? ☀️ (or night 🌛, or whenever you like to work).

Do you check your email? Dive straight into your work? Or take a moment to plan out your day? Maybe you do some deep breathing, check your word-a-day calendar, or pick out a music mix to get you going.

Share your morning routine with us in the comments! Let's get motivated and tackle this week together! 💪🏼
openGauss Starting and Stopping openGauss
Tags: opengauss
Published: 2023-03-27 06:47:18

Starting openGauss
Log in as the OS user omm to the primary node of the database.

Run the following command to start openGauss:

""
gs_om -t start
 NOTE: An HA cluster must be started in HA mode. If the cluster is started in standalone mode, you need to restore the HA relationship by running the gs_ctl build command. For details about how to use the gs_ctl tool, see the openGauss Tool Reference.

Stopping openGauss
Log in as the OS user omm to the primary node of the database.

Run the following command to stop openGauss:

""
gs_om -t stop
 NOTE: For details about how to start and stop nodes and availability zones (AZs), see “Server Tools > gs_om” in the openGauss Tool Reference.

Examples
Start openGauss:

""
gs_om -t start
Starting cluster.
=========================================
=========================================
Successfully started.
Stop openGauss:

""
gs_om -t stop
Stopping cluster.
=========================================
Successfully stopped cluster.
=========================================
End stop cluster.
Troubleshooting
If starting or stopping openGauss fails, troubleshoot the problem based on log information. For details, see Log Reference.

If the startup fails due to timeout, you can run the following command to set the startup timeout interval, which is 300s by default:

""
gs_om -t start --time-out=300
Creating Animated Typing Effects in React using react -typing-animator
Published: 2023-03-27 06:45:24


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bbr140r8sd0brotpud6b.jpg)
Have you ever come across a typing animation on a website and thought, “Wow, that’s cool! I wish I could use that in my project.” If so, you’re in luck! The react-typing-animator package is a lightweight and easy-to-use component for adding a typing animation to your React projects.

## Installation

To use react-typing-animator in your project, simply install it via NPM or Yarn:


`npm install react-typing-animator`

or

`yarn add react-typing-animator`

## Usage

Using react-typing-animator is incredibly simple. Just import the component, pass in an array of texts, and watch as the typing animation loops through them.

Here’s a basic example:


```
import React from 'react';
import TypingAnimator from 'react-typing-animator';

function App() {
  const textArray = ['Welcome', 'to', 'the', 'React', 'Typing', 'Animator'];
  return (
    <TypingAnimator textArray={textArray} />
  );
}

export default App;
```

This will create a looping typing animation of each word in the textArray prop.

## Customization

You can customize the animation by passing additional props to the TypingAnimator component. Here are the available props and their default values:

```
interface Props {
  textArray: string[];
  cursorColor?: string;
  textColor?: string;
  fontSize?: string;
  typingSpeed?: number;
  delaySpeed?: number;
}
```

You can set the colour of the cursor with the cursorColor prop, the text colour with the textColor prop, and the font size with the fontSize prop. You can also adjust the typing speed and delay between each word with the typingSpeed and delaySpeed props, respectively.

```
import React from 'react';
import TypingAnimator from 'react-typing-animator';

function App() {
  const textArray = ['Welcome', 'to', 'the', 'React', 'Typing', 'Animator'];
  return (
    <TypingAnimator
      textArray={textArray}
      cursorColor="#ff0000"
      textColor="#0000ff"
      fontSize="2rem"
      typingSpeed={50}
      delaySpeed={500}
    />
  );
}

export default App;

```
This will create a typing animation with a red cursor, blue text, a font size of 2rem, a typing speed of 50ms and a delay of 500ms.

Give react-typing-animator a try and see how it can enhance your website or web application. If you have any suggestions or feedback, feel free to leave them in the comments below.
Different ways to check if an array includes a value in javascript 🤔🤔
Tags: javascript, react, angular, webdev
Published: 2023-03-27 05:47:25

#𝐉𝐚𝐯𝐚𝐬𝐜𝐫𝐢𝐩𝐭 ✍️ 𝐩𝐨𝐬𝐭 - 8 :
👉 There are several ways to check if an array includes a value in javascript. Here are some of the most common methods. 🤔🤔

💎 𝐢𝐧𝐝𝐞𝐱𝐎𝐟(): The indexOf() method returns the first index at which the given element can be found in the array. or -1 if not present.

💎𝐢𝐧𝐜𝐥𝐮𝐝𝐞𝐬(): The includes() method returns a boolean value which indicates whether the element is present in the array or not.

💎 𝐟𝐢𝐧𝐝(): The find() method will return the value of first element in the array that satisfies the provided condition. If no values satisfies the condition, undefined is returned.

💎𝐬𝐨𝐦𝐞():The some() method will test whether atleast one element in the array passes the condition. It returns a boolean value.

All these methods have their own advantages & disadvantages.
💡 The best method to choose will depend on the specific use case.

Hope this helps ✅ Do Like 👍 

Follow us on Linkedin:
[https://www.linkedin.com/in/sai-krishna-nangunuri-bba504180
](https://www.linkedin.com/in/sai-krishna-nangunuri-bba504180
)
Follow us on Fb page:
[https://www.facebook.com/profile.php?id=100064154822848
](https://www.facebook.com/profile.php?id=100064154822848
)
Follow us ⚡ for more:
Tips💡+ Guides📜 + Resources 💎 related to Web Development 🧑‍💻

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/owjkblkeifa263pds24v.JPG)
Restrict Unauthorized people to run my react application on local systems
Tags: react, security
Published: 2023-03-27 05:15:54

I want to restrict unauthorized people to run my application on there local systems . Is there a way or industry standard for similar kind of problem ? 

For example - I am an authorized user and took checkout from Azure devops and run the react project on my system . Now someone else got access to this code and can run it on there local system . How can I restrict that ?
How to use Rust on Arduino (Windows Rust)
Tags: rust, arduino, embedded, systems
Published: 2023-03-27 05:13:07

1 - Install Rust nightly compiler:

`rustup toolchain install nightly`

2 - Install Scoop via PowerShell:

`Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iex`

3 - Install avr-gcc and avrdude using Scoop:

`scoop install avr-gcc
scoop install avrdude`

4 - Install ravedude for flashing the microcontroller:

`cargo +stable install ravedude`

5 - Create a new project using cargo-generate:

`cargo install cargo-generate
cargo generate --git https://github.com/Rahix/avr-hal-template.git`

6 - Navigate into the project directory and open the folder in your preferred code editor.

7 - Edit the main.rs file to include your desired program.

main.rs
```
#![no_std]
#![no_main]

use panic_halt as _;
use arduino_uno::prelude::*;

#[arduino_uno::entry]
fn main() -> ! {
    let dp = arduino_uno::Peripherals::take().unwrap();
    let mut pins = arduino_uno::Pins::new(dp.PORTB, dp.PORTC, dp.PORTD);
    let mut led = pins.d13.into_output(&mut pins.ddr);
    loop {
        led.toggle().void_unwrap();
        arduino_uno::delay_ms(1000);
        //Or Your Other Code Here
    }
}
```

Cargo.toml
`[dependencies]
arduino_uno = "0.2"`

8 - Build the project:

`cargo build`

9 - Connect your Arduino board to your computer via USB.

10 - Set the serial com port for ravedude (replace COMx with the actual port number):

`$env:RAVEDUDE_PORT="COMx"`

11 - Build and flash the program into the Arduino:

`cargo run`

12 - After these steps, the Arduino should execute the program as intended.
Check if a user has enough internet speed for uploading a photo in JavaScript
Published: 2023-03-27 05:06:05

## For chrome browser
We can use the navigator.connection API to get the estimated data transfer rate, and compare it with the size of the photo that the user wants to upload.

Here is an example code snippet that checks if the user has enough internet speed to upload a photo of a certain size:


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

In this example, we assume that the minimum required upload speed is 2 Mbps, and the photo size to upload is 5 MB (5000000 bytes). We calculate the maximum upload time in seconds based on the photo size and minimum required speed, and then calculate the maximum allowed photo size based on the estimated speed and maximum upload time. If the photo size to upload is less than or equal to the maximum allowed size, we consider that the user has enough internet speed to upload the photo. Otherwise, we consider that the user does not have enough internet speed.
Критическое мышление
Published: 2023-03-27 05:03:00

Мы ежедневно сталкиваемся с огромным потоком данных, новостей, мнений и рекомендаций.

Чтобы избежать манипуляций и логических ошибок, нам нужно научиться тщательно фильтровать информацию. Необходимо оценить и проанализировать, прежде чем принимать её за истину.

На наших глазах происходит нечто невообразимое. Мы начинаем чаще спрашивать что-то у ChatGPT и его “друзей”, чем искать самостоятельно в гугле. И под всем этим мы не замечаем, что начинаем полностью доверять его ответам.

Здесь есть большой риск.

Хотя AI-модели и обучаются на огромных массивах информации, мы не можем быть уверены в том, что они не подвержены влиянию специально подобранных данных или предвзятых алгоритмов. 

Навык критического мышления сейчас становится намного востребованнее, чем любой hard skill.

Попробуй следовать следующим правилам:

- _Полностью понимай, о чём идёт речь_. Если непонятно, задавай вопросы. Вопросы - ключ к истине.
- _Не спеши принимать утверждения за истину_. Ищи доказательства, факты, статистику, мнения экспертов и реальные примеры, подтверждающие аргументы.
- _Подумай об альтернативных решениях_. Так примешь более взвешенные и обоснованные выводы.

С появлением AI мы должны стать более эффективными, но не стоит бездумно делегировать всю ответственность на него.

**Доверяй, но проверяй.**

Критическое мышление - это нечто, что мы развиваем и совершенствуем на протяжении всей нашей жизни.
Начни с сегодняшнего дня.