teleren/devto huggingface dataset:
Automating Database Population in Rails Testing with Runners and FactoryBot
Tags: rails, testing, ruby
Published: 2023-02-18 17:54:50

## TLDR
To populate your Rails database with test data, for manual testing using FactoryBot, create a Ruby file and add : 
```
FactoryBot.create(:coffee)
``` 
Assuming you have a coffee model and a coffee factory. This will create a new record in the database with the values defined in your factory. You can also create a new factory specifically for this purpose if needed. 
Finally, run the Ruby file using :
```
rails runner path/to/my/runner
``` 
This will execute the code in your Rails application context and populate your database.

## Introduction

When you need to populate your database for manual testing, using Rails runners and FactoryBot can save you a lot of time and effort. In this article, I will explain how I use runners and FactoryBot to create test data and populate my database in my development env.

## Runners

Runners is part of rails CLI, it enables you to run code in you rails application context. Runners loads the Rails environment and then runs the specified Ruby code. This allows you to access your Rails models, controllers, and other application code from a standalone Ruby script.

This means you can easily run scripts that interact with your application's data, or perform complex tasks that require access to your application's functionality.

## FactoryBot

FactoryBot is a Ruby gem that provides simple and flexible way to create test data for a Ruby or Rails application. 
This gem is maintained by Toughbot, inc.

I will not dig deep here on how to use FactoryBot, since I aim to make a comprehensive guide of it soon in another article. 
But here's a example, let's say you have a Coffee model with name and origin as attributes.

```
Factory.define do
  factory :coffee do
    name { "Guji" }
    origin { "Ethiopia" }
  end
end
```

## Populating database with FactoryBot

Create a ruby file in your tmp directory in this example I'll call it my_runner.rb.

Then in the script of your runner you can add the following lines :

```
FactoryBot.create(:coffee)
```
Then in your terminal execute your runner with the rails runner cli you can run your ruby code in your rails context.

```
rails runner /path/to/my_runner.rb
```

After at the end of the runner, your database will be populated with a new coffee row with the name "Guji" and the origin "Ethiopia".

##Conclusion

In conclusion, using Rails runners and FactoryBot can be a great way to save time and effort when you need to populate your database for manual testing. 
By using runners, you can easily run scripts that interact with your application's data, while FactoryBot enables you to create test data quickly and easily. 
So, give it a try and see how runners and FactoryBot can make your manual testing faster and more efficient.
Verifbox: Protecting AI-Generated Images with Ethereum Blockchain NFT Certification
Tags: webdev, javascript, nft, ethereum
Published: 2023-02-18 18:38:31

Artificial Intelligence has revolutionized the world of digital images, but with this revolution comes a new challenge – image theft. The ease with which AI-generated images can be replicated and used without proper credit has resulted in a surge in image theft, leading to lost revenue and damage to the reputation of creators.

However, with the advent of blockchain technology, [VerifBox](https://verifbox.com/) has emerged as a solution to this issue. The company utilizes the Ethereum blockchain to certify images as non-fungible tokens (NFTs), providing proof of ownership and a clear chain of custody.

[VerifBox](https://verifbox.com/) offers a quick and simple certification process, where the creator uploads the image, and [VerifBox](https://verifbox.com/) certifies it as a unique, one-of-a-kind item. This certification process provides a secure, tamper-proof record of the image’s creation and ownership, ensuring that it cannot be stolen or duplicated without proper credit being given to the original creator. In addition, [VerifBox](https://verifbox.com/) also provides a complete PDF certificate, including a transaction identifier, transaction timestamp, metadata, certificate number, smart contract address, and QR codes.

The certification of images as NFTs on the Ethereum blockchain not only protects the rights and revenues of creators but also provides a secure, tamper-proof record of the image’s history. [VerifBox](https://verifbox.com/) offers peace of mind to creators, giving them the assurance that their creations are protected and credited properly.

In conclusion, image theft is a growing concern in the digital world, and [VerifBox](https://verifbox.com/) offers a solution that provides protection to AI-generated images. Don’t let your creations go unprotected, certify them as NFTs with Verifbox today! 

Visit [VerifBox](https://verifbox.com/) to protect your creation and receive a complete PDF certificate.”


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cn2w357b5in31po1dksm.png)
I Got Caught Cheating While I Do My Exam, Here's What Happened?
Tags: exam, beginners, computerscience, testing
Published: 2023-02-18 18:37:54

Cheating in exams is a major problem in the academic world. Not only does it undermine the integrity of the educational system, but it also harms the students who cheat in the long run. Getting caught cheating in an exam can have serious consequences, and it's important to know what to do if you find yourself in that situation.

In this article, [Do My Exam](https://domyexamsforme.com/) will discuss what to do if you get caught cheating on an exam, the consequences of cheating, and how to avoid cheating in the first place. We will also provide tips for how to study effectively and manage test anxiety, so you can perform your best on exams.

## Consequences of Cheating

Cheating in exams can have serious consequences, both in the short and long term. In the short term, you may receive a failing grade on the exam, which can affect your overall grade for the course. In more serious cases, you may be suspended or expelled from school [1]. Moreover, cheating can leave a permanent mark on your academic record, which may affect your future educational and career opportunities.

If you are caught cheating on an exam, it's important to take responsibility for your actions and accept the consequences. It's also important to learn from your mistakes and take steps to ensure that you don't cheat again in the future.

## What to Do If You Get Caught Cheating

If you are caught cheating on an exam, the first thing you should do is be honest and take responsibility for your actions. This means admitting what you did, apologizing, and accepting the consequences. It's also important to cooperate with any investigations or disciplinary actions that are taken.

If you are unsure of what to do, seek the advice of a trusted teacher, academic advisor, or student services office. They can provide guidance and support during this difficult time.

## Avoiding Cheating

The best way to avoid cheating is to prepare adequately for exams and to manage test anxiety. This can be achieved through effective study habits, such as breaking up study sessions into manageable chunks, taking regular breaks, and using a variety of study techniques [2]. Additionally, managing test anxiety can help you to perform better on exams and reduce the likelihood of cheating.

## Tips for Effective Studying

Make a study plan and stick to it.
Use a variety of study techniques, such as reading, writing, and practice tests.
Break up study sessions into manageable chunks and take regular breaks.
Use flashcards or other memory aids to help you remember key concepts.
Find a study group or study partner to help keep you accountable and provide support.

## Managing Test Anxiety

Get plenty of sleep the night before the exam. Eat a healthy breakfast and stay hydrated. Arrive at the exam early and take a few deep breaths to calm your nerves. Visualize yourself doing well on the exam and feeling confident. Use relaxation techniques, such as deep breathing or visualization, to manage anxiety during the exam.
Websockets: Real-Time updates
Published: 2023-06-12 17:15:03

---
title: Websockets: Real-Time updates
published: true
date: 2023-02-18 18:20:39 UTC
tags: 
canonical_url: 
---

Real-time updates are a must-have feature in many modern web applications. From chat applications to online marketplaces, providing users with the ability to receive immediate updates is crucial to creating a seamless experience.

One way to implement real-time updates in a web application is by using WebSockets. WebSockets provide a full-duplex communication channel between the client and server, allowing for real-time data transfer in both directions. In this article, we'll go over how to use WebSockets to implement real-time updates in a web application.

1. 
### Getting started with websockets

To get started with WebSockets, you'll need to use a WebSockets library, such as `socket.io` for Node.js or `Pusher` for PHP. These libraries provide a convenient API for working with WebSockets, making it easy to get up and running quickly.

1. 
### Setting Up the Server

To set up the server for WebSockets, you'll need to create a WebSockets endpoint and configure the server to listen for WebSockets connections. The following code sets up a WebSockets endpoint using Socket.io in Node.js:

```
const io = require("socket.io")(server);

io.on("connection", socket => {
  console.log("A user connected");
});

```

This code sets up a WebSockets endpoint using the socket.io library and listens for connections. When a user connects, the code logs a message to the console.

1. 
### Setting Up the Client

Next, you'll need to set up the client to connect to the WebSockets endpoint. The following code sets up a WebSockets connection using it in the browser:

```
const socket = io();

socket.on("connect", () => {
  console.log("Connected to the server");
});

```

This code sets up a WebSockets connection to the server and listens for the `connect` event. When the client successfully connects to the server, the code logs a message to the console.

1. 
### Sending and Receiving Messages

With the server and client set up, you can now send and receive messages over the WebSockets connection. The following code sends a message from the client to the server:

```
socket.emit("newMessage", { text: "Hello, World!" });

```

And the following code receives the message on the server:

```
io.on("newMessage", data => {
  console.log("Received message:", data);
});

```

This code sends a message from the client to the server using the `emit` method, and the server receives the message using the `on` method. When the server receives the message, it logs the data to the console.
Fly, you fools!
Tags: github, opensource, php
Published: 2023-02-18 18:13:54

<center>
<img src="https://media.tenor.com/OH5xvZBe_dYAAAAM/gandalf-lotr.gif" width="400px">
</center>

## FOSS recommand to leave github

Here is an article from software freedom conservancy about the FOSS position since github abuses and broke trust of many developers (me too) :
[Give Up GitHub: The Time Has Come](https://sfconservancy.org/blog/2022/jun/30/give-up-github-launch/)

The FOSS recommending to leave github and forces its members to do so.

## "Small" project migrate to framagit

FramaGit is a French alternative of github.

FramaGit is managed by FramaSoft, an organisation with legal status that guaranties freedom of users and no profit.

And, I decided to migrate my Small project to FramaGit, and it's now done.

You can have an overview of Small project on this new site : https://small-project.dev

My github repos are now abandoned and relocated to https://framagit.org/small

For the occasion, I rename prefix of the composer packages from sebk to small : https://packagist.org/users/small/packages

## Contribute to small project

You easily create account on FramaGit from GitHub, GitLab or BitBucket single sign on :
https://framagit.org/users/sign_in

The contribution process is described on small-project.dev
Playbook for Remote Development Teams
Tags: remote, team, culture, developer
Published: 2023-02-18 18:01:18

This is a short version of my blog post: https://lessthan12ms.com/remote-teams-playbook.html

This list contains my distilled ideas that came from working in quite a few teams and observing the industry, there are no two identical companies so I am aware of my limited exposure and probable naiveness. However, these insights came from my real experience and I can truly say that these things work and work well. I have worn many hats. Worked many years as a contractor/freelancer, then switched to small saas/mobile app startups (as CTO or a backend developer). I enjoy the most working at the backend with only two tools open: my IDE and my terminal (the rest is optional).

The playbook contents:
- Practices to deliver high-quality code in the long run.
- Cultural fit
- No Backlog
- Developers Autonomy
- Share Knowledge And Progress
- Clear Technical Standards And Expectations
- Supervised Onboarding
- Foreman
- Multi-phase code quality control
- CI/CD
- TDD
- SOLID principles
- Hexagonal(Clean) Architecture
Amazing Bootstrap Card Examples for Your Next Web Project
Tags: bootstrap, css, design, webdev
Published: 2023-02-18 18:01:12

Here is a stunning collection of cards that have been built with Bootstrap 5's new version. Weather cards, cards with charts, animated cards, and many other types of cards are available. All of them are responsive and work with the new Bootstrap 5. 

## Video Tutorial

If you would prefer to watch a beginner-friendly step-by-step video tutorial instead, here is the video tutorial that I made.

{% youtube  pCqptenyZyY %}

---
 
### 1. MINIMAL STATISTICS CARDS

{%  codepen https://codepen.io/lesliesamafful/pen/oNXgmBG %}

---

### 2. Card hover effect 

{% codepen https://codepen.io/kalpeshpurohit/pen/ZEWVrKj %}

---

### 3. BOOTSTRAP PROFILE CARDS

{% codepen https://codepen.io/mrsahar/pen/jRjmdL %}

---

### 4.  [Bootstrap snippet. Note cards](https://www.bootdey.com/snippets/view/Note-cards)


![Bootstrap snippet. Note cards](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3zkgytpjkg1ioji44u67.png)

---

### 5. [Map card](https://mdbootstrap.com/snippets/standard/mdbootstrap/2898271?view=side) 
 
![ Map card ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fo3nx7395bjb9t51lc91.png)

---

---
## For more information

1. Check my GitHub profile
[https://github.com/amitSharma7741](https://github.com/amitSharma7741)

2. Check out my Fiver profile if you need any freelancing work
[https://www.fiverr.com/amit_sharma77](https://www.fiverr.com/amit_sharma77)

3. Check out my Instagram
[https://www.instagram.com/fromgoodthings/](https://www.instagram.com/fromgoodthings/)

4. Linktree
[https://linktr.ee/jonSnow77](https://linktr.ee/jonSnow77)

5. Check my project

- EVSTART: Electric Vehicle is the Future
[https://evstart.netlify.app/](https://evstart.netlify.app/)
-  News Website in react
 [https://newsmon.netlify.app/](https://newsmon.netlify.app/)
-  Hindi jokes API
 [https://hindi-jokes-api.onrender.com/](https://hindi-jokes-api.onrender.com/)


---
---
Using Quadratic Equations to Analyze Trends in BTC/USDT Prices in Excel
Tags: trade, tradingbot, btc, technicalanalysis
Published: 2023-02-18 17:47:28

`Analyzing BTC/USDT prices using quadratic equations in Excel involves fitting a quadratic curve to a set of historical price data to identify trends and potential future price movements. The quadratic equation is a mathematical function that can be used to model a curve in a 2-dimensional space.

To perform this analysis in Excel, you will need to have historical price data for BTC/USDT. Once you have the data, you can follow these steps:

- Open Excel and import the historical price data into a worksheet.
- Create a scatter chart that displays the price data as points on a chart.
- Right-click on the chart and select "Add Trendline" from the drop-down menu.
- In the "Format Trendline" dialog box, select "Polynomial" as the trendline type.
- Enter "2" as the order of the polynomial (_For example, the polynomial expression 2x^3 - 5x^2 + 3x - 1 consists of four terms, each with a coefficient and variable raised to a power. The highest power of the variable in this polynomial is 3, which gives it a degree of 3_).
- Check the "Display Equation on Chart" box to display the quadratic equation on the chart.(_To display the quadratic equation on the chart, we can add a text box to the chart and use Excel's CONCATENATE function to create a string that contains the equation. We can then set the text box's text to this string_)
- Check the "Display R-squared value on chart" box to display the coefficient of determination, which measures how well the equation fits the data.
- Click "Close" to close the dialog box.

The resulting chart will display the historical price data as points, with a curve overlaid on top of the points. The equation for the curve will be displayed on the chart, along with the coefficient of determination.

Using this information, you can interpret the trend of the curve to identify potential future price movements. For example, if the curve is trending upward, it may indicate that prices will continue to rise in the future. If the curve is trending downward, it may indicate that prices will continue to fall.

Keep in mind that quadratic equations are not a foolproof method for predicting future price movements, and other factors such as market sentiment, news events, and global economic conditions can also have an impact on prices. However, analyzing BTC/USDT prices using quadratic equations in Excel can provide valuable insights into market trends and potential future price movements.`
Eu me associei à OWASP
Tags: owasp, appsec, community, security
Published: 2023-02-18 13:57:07

# Quem é a OWASP?

A **Open Web Application Security Project ® (OWASP)** é uma fundação sem fins lucrativos que trabalha para melhorar a segurança do software. Por meio de projetos de software de código aberto liderados pela comunidade, centenas de comunidades locais em todo o mundo, dezenas de milhares de membros e importantes conferências educacionais e de treinamento, a OWASP Foundation é a fonte para desenvolvedores e tecnólogos protegerem a web.

## Por que se associar?

Para responder a essa pergunta podemos ter os mais variados motivos. Primeiramente, é uma forma de colaborar financeiramente com a Fundação para que possam continuar desenvolvendo atividades que agregam enormemente na missão de proteção da web.

Eu particularmente decidi me associar por achar que pode ser um alavancador para a carreira na área de segurança e desenvolvimento. Ao se tornar membro você tem a possibilidade de aumentar sua rede de contatos, ter descontos em treinamentos e eventos, oportunidades de voluntariado, contribuição em projetos, etc.

Após me associar, tive acesso a benefícios que, particularmente, achei muito interessantes. Passei a ter gratuitamente conta de dois ambientes de treinamentos online chamados **[SecureFlag](https://www.secureflag.com/)** e **[Security Journey](https://www.securityjourney.com/)** e  uma conta na **[Ubiq](https://www.ubiqsecurity.com/)**.


**SecureFlag**

Os desenvolvedores localizam, exploram e corrigem manualmente o código de aplicativos vulneráveis ​​executados em ambientes de desenvolvimento acessados ​​por meio de um navegador da web. A plataforma oferece treinamento 100% prático, sem perguntas de múltipla escolha, e usa um mecanismo capaz de testar ao vivo as alterações do código para medir a eficácia, exibindo instantaneamente se o código foi corrigido e concedendo pontos após a conclusão do exercício.

**Security Journey**

Por meio de desafios e competições, o Security Journey ajuda você a progredir em uma **missão orientada por mapas** para obter **cinturões e conquistas de nível superior** . Os alunos podem ver seu progresso em sua jornada à medida que aumentam seus conhecimentos de segurança.

**Ubiq Security**

Criptografe seus dados mais confidenciais antes que eles saiam do aplicativo, para que a camada de armazenamento – e os adversários – vejam apenas o texto cifrado. A criptografia nativa do lado do cliente do aplicativo protege os dados contra invasores sofisticados, ataques à cadeia de suprimentos e ameaças internas.

## Como encontrá-los

Se você também achou interessante e gostaria de saber mais sobre o trabalho feito pela OWASP, visite os links que deixei abaixo:

[Projetos OWASP](https://owasp.org/projects/)
[Comunidades Locais](https://owasp.org/chapters/)
[OWASP Top 10](https://owasp.org/Top10/)
[OWASP SAMM](https://owaspsamm.org/)
Python Lists tutorial
Published: 2023-02-18 17:46:00

[**Python list**](https://www.programdoc.com/python/lists) is a collection of items of any data type. Lists are mutable, which means they can be modified. Python provides various operations that can be performed on lists like insertion, deletion, and sorting.

## Creating a List

A list can be created in Python by enclosing a sequence of items inside square brackets `[]`, separated by commas.

```py
# empty list
my_list = []

# list with items
fruits = ['apple', 'banana', 'cherry']
``` 

## Accessing List Items

Items in a list can be accessed by using the index value. The first item in the list has an index of 0, the second item has an index of 1, and so on.

```py
fruits = ['apple', 'banana', 'cherry']
print(fruits[1])  # Output: banana
``` 

## Modifying List Items

List items can be modified by accessing the item using its index and assigning a new value.

```py
fruits = ['apple', 'banana', 'cherry']
fruits[1] = 'orange'
print(fruits)  # Output: ['apple', 'orange', 'cherry']
``` 

## List Loop

A `for` loop can be used to iterate through the items in a list.

```py
fruits = ['apple', 'banana', 'cherry']
for fruit in fruits:
    print(fruit)
``` 
output:
```
apple
banana
cherry
``` 


## Explore Other Related Articles
[Python dictionaries comprehension tutorial](https://dev.to/max24816/python-dictionaries-comprehension-tutorial-3bda)
[Python comparison between normal for loop and enumerate](https://dev.to/max24816/python-comparison-between-normal-for-loop-and-enumerate-p4a)
[Python if-else Statements Tutorial](https://dev.to/max24816/python-if-else-statements-tutorial-3p25)
[Python set tutorial](https://dev.to/max24816/python-set-tutorial-hcp)
[Python tuple tutorial](https://dev.to/max24816/python-tuple-tutorial-3m62)