teleren/devto huggingface dataset:
Instance Methods in Ruby
Published: 2023-10-06 15:10:44

##Defining an Instance Method:

Instance methods are defined using the def keyword inside a class. If you prepend the class name before the method, it becomes a class-level method.

## Method Return Values:

Ruby methods implicitly return the value of the last statement executed. This return value can be assigned to variables or used in further operations.

## Composing Methods:

Smaller methods can be combined or used within other methods to construct more complex functionality.

## Attribute Accessors:

`attr_accessor` creates a method to get and set a new value

## Using Existing Instance Methods in New Methods

- A method can use the results or behaviors of other methods within the same class
- `self` refers to the object the method was called on
- Used to reference other methods or attributes of that instance

Efficiently build Ruby classes with methods that interact with one another by utilizing attribute accessors, method composition, and the self keywords.
Decoding the Preference: Linux vs. Windows – Why Companies Lean Towards Linux for Business Solutions?
Tags: linux, windows, opertingsystem
Published: 2023-10-06 15:05:19

I am going to share facts as well as my personal opinions about this subject. So keep in mind some of the things I mention here will be based on my own experience and analysis of the topic.
**first of all we have to learn about what is Operating system.
**
You can think an OS as an medium to communicate with our computer to manage basic task such as file management, memory management and controlling hardware of our computer.

Linux: -Linux is an open-source operating system that’s been around since the early 1990s. It’s known for its flexibility and is used in everything from smartphones and home computers to powerful servers that run the internet.

Windows: — Windows, developed by Microsoft in early 1990s, is one of the most popular operating systems globally. It’s known for its user-friendly interface and compatibility with a vast array of software.

so in above explanation we can see that windows and Linux released in early 90s, windows have a great Graphical User Interface (GUI), while Linux mostly works on command line.

here comes the question why companies using Linux despite windows which has a great GUI to interect with devices.

the answer is their architecture. Linux is UNIX based operating system which helps it to do better multitasking, network capabilities, scripting and automation and many more.
In simple words it Linux has more control over the devices while Windows is successor of MS-DOS which follows the hybrid architecture which gives us a GUI with limited control over the device.
there is also some reason why we use Linux over Windows:-\
1. Open-source: Linux is Open-sourced and free operating system which makes it costomisable as per needs while Window is close source operating system.
2. File System Management: It provides support for various file systems, allowing users to store and retrieve data from storage devices efficiently. common file systems like ext4, XFS, and Btrfs are supported. while window support only NFTS file system.

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

3. Stability and Reliability: Unix-based operating systems are renowned for their stability and reliability. They are engineered to minimize system crashes and failures, making them a solid choice for mission-critical applications and server environments where up-time is paramount.

4. System Requirement: Windows has a large collection of GUI based apps and services that is why Windows require more hardware to carry his load, on the other hand linux has a small collection of apps and it’s mainly works within terminal that is why Linux can be run on minimal system requirement.

these are the some reasons why big organisation uses Linux over Windows
Visual Regression testing with Playwright
Tags: webdev, react, testing, playwright
Published: 2023-10-06 15:02:51

Visual Regression Testing is a software testing technique used to identify and prevent unintended visual changes in a web application or user interface (UI). It helps ensure that the visual appearance of a website or application remains consistent across different versions or updates.


### How Visual Regression Testing typically works ? 
- capturing a baseline or reference screenshot of the UI (expected)
- take second screenshot after changes to the code
- testing pixel by pixel or at higher level (based on tools)
- visual diff and report


## What Visual Regression Testing is valuable for:
- visual consistency
- cross-browser and cross-device testing
- automated testing

## Which tool can be used for: 

- **Applitools Eyes:**
Popularity: High
Year of Introduction: 2014

- **Percy:**
Popularity: High
Year of Introduction: 2015


- **Cypress with Cypress Image Snapshot:**
Popularity: High
Year of Introduction: Cypress Image Snapshot is a plugin for Cypress.

- **Selenium with WebdriverIO:**
Popularity: High
Year of Introduction: Selenium is older (introduced in 2004), WebDriverCSS and WebdriverIO are plugins/extensions.


- **Playwright with Playwright Test Runner:**
Popularity: Growing
Year of Introduction: Playwright introduced in 2019; Playwright Test Runner is a testing framework built on top.


## An Visual Regression testing with React and Playwright

- Install Playwright and other necessary dependencies:
```bash
npm install playwright
```

- Create a Visual Regression Testing script using Playwright and Jest. For this example, let's assume you want to test a simple React component.

Create a test file, e.g., visual-regression.test.js, with the following content:

```js
import { test, expect } from'@playwright/test';

test('Visual Regression Test', async ({ page }) => {
  // Navigate to your React application or component
  await page.goto('http://localhost:3000'); // Change the URL as needed

  // Capture a screenshot of the React component
  const screenshot = await page.screenshot();

  // Compare the screenshot with the baseline image
  expect(screenshot).toMatchSnapshot('react-component-screenshot.png');
});

```
- run the jest by `npm run test`

Jest will execute the test script, and Playwright will launch a browser, capture a screenshot, and compare it to the baseline image. If there are any visual differences, Jest will report them.

After running the test, Jest will generate a folder named __image_snapshots__ containing the baseline and compared images. You can review and approve any changes as needed.

Remember to replace the URL and adjust the test script to match your specific React component or application. This example demonstrates a basic setup for Visual Regression Testing with Playwright and React, and you can expand upon it to suit your project's needs.

if you would like to watch a video, there is another example: https://www.youtube.com/watch?v=Y1eTK-j66PU

Thank you for taking the time to read the article. let me know in the comments your approach to visual regression testing?

HASH
how to add keyboard sound effects to your videos easily with Python and MoviePy
Tags: python, programming, coding, tutorial
Published: 2023-10-06 15:00:00

{% embed https://www.youtube.com/watch?v=bbksNEzNMzc %}
how to add keyboard sound effects to your videos easily with Python and MoviePy.

In this video, I'll show you how to add keyboard sound effects to your videos using Python and MoviePy. This is a great way to add some extra flair and excitement to your videos, and it's also a lot of fun.


```python

import moviepy.editor as mp

def add_keyboard_sound(video_path, sound_path):
    video = mp.VideoFileClip(video_path)
    sound = mp.AudioFileClip(sound_path)
    audio_list = []
    
    if video.duration > sound.duration:
        
        vd = video.duration
        ad = 0
        while ad < vd:
            ad += sound.duration
            audio_list.append(sound)
            
    # write audio file
    final_audio = mp.concatenate_audioclips(audio_list)
    final_audio.write_audiofile('audio.mp3')
    
    ## add this audio to the video
    video.audio = mp.AudioFileClip('audio.mp3')
    video.write_videofile('out.mp4')
    
    

add_keyboard_sound('test.mp4', 'keyboard-typing.mp3')

```
Hactoberfest 2023 Pledge
Tags: hack23contributor
Published: 2023-10-06 14:58:16


### Intro
Hey fellows!
I am Mannu from India and I am happy to part of hactoberfest 2023. This is actually my first time doing hactoberfest so preety much excited for that.

### Pledge
I pledge to be helpful contributor. I won't stop here. I will continue contributing to opensource.
Tutorial To Add Real-time Call Features To Your Client App In 30 mins
Tags: flutter, android, ios
Published: 2023-10-06 14:45:08

Creating a chat app using Plugin can be a great way to add real-time chat features to your Flutter app. 

In this tutorial, I will guide you through the process step by step, making it clean and simple to understand.

## Step 1: Prerequisites
Before we begin, ensure you have the following prerequisites:

- Flutter SDK 
- Flutter Project
- Basic knowledge of Flutter and Dart programming
- MirrorFly Flutter Plugin

## Step 2: Set Up Your Flutter Project
Start by creating a new Flutter project or using an existing one.

## Step 3: Add the Plugin Dependencies

Open your **pubspec.yaml** file and add the following dependencies:

`dependencies:
  mirrorfly_plugin: ^0.0.7
`
Run **flutter pub** get in your project directory to fetch and install the dependencies.

## Step 4: Initialize MirrorFly Plugin

In your **main.dart** file, initialize the MirrorFly Plugin in the **main** function before calling **runApp**. Replace '**Your_Mirrorfly_Licence_Key**' with your actual MirrorFly license key and '**Your_iOS_app_Group_id**' with your iOS app group ID if you're targeting iOS.
`void main() {
  WidgetsFlutterBinding.ensureInitialized();
  Mirrorfly.init(
      baseUrl: 'https://api-preprod-sandbox.mirrorfly.com/api/v1/',
      licenseKey: 'Your_Mirrorfly_Licence_Key',
      iOSContainerID: 'Your_iOS_app_Group_id');
  runApp(const MyApp());
}
`

## Step 5: User Registration

To register a user in the chat, use the **Mirrorfly.registerUser** method. Replace '**userIdentifier**' with a unique user ID, and optionally pass an FCM token if needed.
`Mirrorfly.registerUser('userIdentifier').then((value) {
  var userData = registerModelFromJson(value);
}).catchError((error) {
  debugPrint(error.message);
});
`

## Step 6: Send a One-to-One Message

To send a one-to-one text message to another user, you need to get their JID (Jabber ID) first using **Mirrorfly.getJid. **Then, use **Mirrorfly.sendTextMessage **to send the message.
`var userJid = await Mirrorfly.getJid('username');
Mirrorfly.sendTextMessage('message', userJid).then((value) {
  var chatMessage = sendMessageModelFromJson(value);
});
`

## Step 7: Receive One-to-One Messages

To receive one-to-one messages, you can listen for incoming messages using **Mirrorfly.onMessageReceived.**
`Mirrorfly.onMessageReceived.listen((result) {
  var chatMessage = sendMessageModelFromJson(result);
  // Handle the received message here
});
`
That's it! You've successfully set up a basic chat app using the [MirrorFly Chat Plugin for Flutter](https://www.mirrorfly.com/flutter-chat-api.php). You can expand upon this foundation to create a full-featured chat application with features like group chats, multimedia messages, and more.

Remember to handle user authentication, message storage, and other essential aspects of a chat application as your project evolves. Additionally, check the [official plugin](https://pub.dev/packages/mirrorfly_plugin) documentation for more advanced features and customization options.
We're open to Hacktoberfest
Tags: webdev, javascript, react, typescript
Published: 2023-10-06 14:32:04

Hey there! 😊

Guess what? We just had a big spring cleaning session (well, not exactly spring, but you get the idea) and set up some fun tasks for #Hacktoberfest. If you've got a soft spot for supporting lively Open Source adventures, come on in! We're a big tent here, and every level of contribution gets a warm welcome.

[![Available on GitHub](http://www.fabglib.org/github.png)](https://github.com/webcrumbs-community/webcrumbs)

Heads up: We'll sprinkle in more issues daily. So, keep an eye out!

Feeling the buzz? Give us a little ⭐ on our repo. Let's make something spectacular, together! [Pop over to our GitHub Repository](https://github.com/webcrumbs-community/webcrumbs)
Intro - reconversion
Published: 2023-10-06 14:24:35

**J'ai dû faire une reconversion.**
Je voulais devenir président quand j'étais petit, ensuite docteur, ensuite chef d'entreprise 🤣
**Je m'appelle David Jonathan, je suis développeur web front-end pro, débutant devops et pentester web**, et dirai-je content creator ? On parlera bien sûr de tout ça plus tard mais pour le moment...
Je devais répondre à une question d'un de mes followers: comment trouver sa passion ?
Eh bien, devrais-je dire de tout essayer ? Non sans blague 😅

Bah ce qui est sûr, c'est que tu aimes faire quelque chose ou réciproquement. Faire le développement web et tout ce qui va avec pour moi, c'était juste une question d'amour pour des choses: une série (Nikita) m'a inspiré et je me disais que je voulais faire comme le geek
(hacking etc). Puis j'ai lu des trucs sur le design. J'ai commencé avec photoshop mais vite ça m'ennuyait, ce n'était sûrement pas pour moi 😂 . Du coup j'ai fait des recherches et j'ai découvert qu'on codait les jeux qu'on jouait, les sites sur lesquels on allait, les applications qu'on utilise tout le temps, etc... ( oui j'aimais trop jouer aux jv et trop naviguer, du genre curieux), alors je suis bizarrement allé sur le site openclassrooms.com et j'ai commencé à coder un exemple du site du zero avec html css avec le cours de openclassrooms. C'était bien mais pas assez pour moi. J'en voulais plus. Des mois plus tard, J'ai assisté à des conf, J'ai exploré, fait des découvertes incroyables. J'ai eu à m'énerver, à connaitre mon lot de frustration qui n'est pas fini j'imagine, en vrai à cause des erreurs bizarres comme des virgules de moins ou de trop par ex dans les bails de programmation😂. Bref, Je codais seulement par plaisir ou par amour, je n'avais pas faim, je restais devant le pc et j'écrivais seulement. J'aimais, j'aime bien ça. Tu t'évapores du monde extérieur. Ensuite j'ai avancé et appris les technologies comme le web3, vue JS, JavaScript, ça prenait un temps fou mais bon.. j'aimais bien. En programmation j'ai fait du C++ et je débute le React Native (les deux langages que j'aime bien en programmation). Les gars que je rencontrais et aussi sur les différents sites de design ils faisaient des design de ouf, des masterclass ça m'excitait beaucoup d'en apprendre plus et je le fais 😅 ... une passion !

Du coup, pour répondre, je te dirai que tout viendra au bon moment.. fais ce que tu aimes et aimes ce que tu fais. 😍
À plus !
#devperso #design #site #web #contentcreator #storytelling

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hdqylsuwvtl7hltefyfl.png)
UNIX - DIRECTORIES
Tags: unix, directory, commands
Published: 2023-10-06 14:19:11

Directories provide a better way of organizing files within the system. As we have file system in UNIX System, the directories can further contain sub directories too!

When we log in to the system, we are located into a particular directory that is our **HOME** Directory.

We can freely navigate in between different directories but the directory we are positioned at a particular point of time, that is referred to as **CURRENT WORKING** DIRECTORY.

SOME OF THE COMMANDS!

1) PWD
Pwd command displays the full path of your present/current working directory.

SYNTAX:
`$ pwd`

Sample Output:
/home/tina 

**ABSOLUTE AND RELATIVE PATHNAME**

There are two ways a file can be accessed:
1) ABSOLUTE PATH NAME
2) RELATIVE PATH NAME

**1) ABSOLUTE PATH NAME**
It is the complete path name right from the root that UNIX follows to reach a particular file. 
It starts with a slash ("/").

For example: to access a file named "newfile" which resides under sub directory "files", which is in the home directory, the absolute path will be : /home/files/newfile

**2) RELATIVE PATH NAME**
A Path name which is shortened and related to your current working directory. Relative path name is represented by a dot (.)
So to access a particular file, we will start from our present directory. Giving a relative reference starting from the current 
directory rather than searching from a root.

SAMPLE: ./files/newfile

If similarly we want to specify the parent directory of the current directory, we can use double dots ("..") 

../../files/newfile

Now that we know where we are currently using *pwd*, let us see how we can change to a new directory from our present working directory.

2) CD

SYNTAX:

`cd [directory]`

where **directory** is the name of the directory that we want to change to.

Let us assume the present directory is /user/tina

Example:
`_$ pwd_`
/user/tina

- To move to the root directory

`$ cd /`
where the slash denotes the root directory as already discussed.

To move to another directory we will use the path name such as:

`$ cd /user/stud`

To move to the home directory:

`$cd`

- We can use either absolute or relative pathnames to change directory.

NOTE:
1) cd ../ will take you to the parent directory.
2) cd ../../ takes you to the parent's parent directory


...To be continued! :)
Help wanted at WebCrumbs
Tags: hacktoberfest23, hacktoberfest, opensource, help
Published: 2023-10-06 14:15:34

Hello, everyone! 

We finally did some (necessary) house cleaning and defined a few quick tasks for #hacktoberfast. So if you want to support a super cool Open Source project, you are very much welcome to the community! All levels of contributions are accepted.

[![Available at GitHub](http://www.fabglib.org/github.png)](https://github.com/webcrumbs-community/webcrumbs)

We'll be adding more issues everyday, so keep posted!

Intrigued? Show some love and ⭐ star our repo. Let's build something amazing together! [Go to GitHub Repository](https://github.com/webcrumbs-community/webcrumbs)
Still redirect custom domain in github pages.
Published: 2023-10-06 14:14:00

Hello, @everyone.
I have issue in github pages. my username is smartnftcoder1003.
So repo name was smartnftcoder1003.github.io.
First I set custom domain, and then I removed it.
But still site redirect the custom domain.
And I cleard browser cache.
Who can solve this problem?
Thanks for your time.
Running a scheduled task with Nitric in GO
Tags: go, cloudcomputing, tutorial
Published: 2023-10-06 14:06:13

Setting up a scheduled job is a common requirement for many modern applications. 

With the Nitric SDK, this task is simplified, and you can even test your scheduled jobs offline without needing Terraform. 

In this tutorial, we'll walk through setting up a scheduled job that aggregates data every three days using the Nitric SDK in Go.

> If you haven't used the [Nitric SDK](https://nitric.io) before, then start with this [tutorial](https://dev.to/rsiv/your-first-api-with-go-nitric-39b7).

Pre-Requisites:
1. Go installed on your machine.
2. Nitric SDK for Go.

## Step 1: Import Necessary Libraries

Start by importing the necessary libraries into your Go script. In this tutorial, we'll use the `nitrictech/go-sdk/nitric` and `nitrictech/go-sdk/faas` libraries which provide the needed functions to create and manage scheduled jobs.

```go
import (
  "fmt"

  "github.com/nitrictech/go-sdk/faas"
  "github.com/nitrictech/go-sdk/nitric"
)

func main() {
  
  // TODO: implement your scheduled job here.

  if err := nitric.Run(); err != nil {
    fmt.Println(err)
  }
}

```

## Step 2: Define Your Scheduled Job
Next, define a function for your scheduled job. In this example, we're creating a new scheduled job named "aggregate-data" that will run every three days. 

Inside the function, we've added a simple print statement "aggregating data" to demonstrate the job's activity.

```go
nitric.NewSchedule("aggregate-data").Every("3 days", func(ctx *faas.EventContext, _ faas.EventHandler) (*faas.EventContext, error) {
  fmt.Println("aggregating data")

  return ctx, nil
})
```

## Test Your Scheduled Job Offline

One of the advantages of using the Nitric SDK is the ability to test your scheduled jobs offline. This is particularly useful for debugging and ensuring your jobs are working as expected before deploying them to the cloud.

![Testing schedules offline with the Nitric Dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eoj1bpzcc5mv0yemi331.png)

In just a few steps, you've now created a scheduled job that aggregates data every three days, here are a few more examples showing you how to set up other frequencies.

```go 
nitric.NewSchedule("process-often").Every("5 minutes", func(ctx *faas.EventContext, next faas.EventHandler) (*faas.EventContext, error) {
  return next(ctx)
})

nitric.NewSchedule("process-sometimes").Every("2 hours", func(ctx *faas.EventContext, next faas.EventHandler) (*faas.EventContext, error) {
  return next(ctx)
})

nitric.NewSchedule("process-rarely").Every("30 days", func(ctx *faas.EventContext, next faas.EventHandler) (*faas.EventContext, error) {
  return next(ctx)
})
```

> Note: [CRON expressions are also supported!](https://nitric.io/docs/schedules#using-cron)
Why Ready-Made Airbnb Clone Software is Your Shortcut to Success in 2023
Tags: airbnbclone, airbnbclonescript, airbnbcloneapp, airbnbclonesoftware
Published: 2023-10-06 13:55:48


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x5r9rj9myk7pyblwifik.jpg)
In the world of tech and entrepreneurship, time is precious. Save months of development time and launch your platform faster than ever.

Choose a proven model, reduce costs, and receive ongoing support. Focus on growing your business, not development challenges.

Seize the opportunity in the thriving vacation rental market. Ready-made **[airbnb clone](https://cron24.com/airbnb-clone)** software is your strategic shortcut to success!

Read the full blog: https://cron24.com/blog/why-ready-made-airbnb-clone-software-is-your-shortcut-to-success-in-2023

Thank you.
No Code vs. Low Code: What's the Difference?
Tags: programming, nocode, productivity, codenewbie
Published: 2023-10-06 13:51:08

🚀 Want to automate your business processes without being a coder? 

No-code and low-code platforms are here to save the day! 🙌

🔹 No-code development: Create applications without writing any code. Perfect for business users and non-technical folks. Examples: Wix, Zapier, Airtable.

🔹 Low-code development: Requires some coding knowledge, but much less than traditional methods. Ideal for IT professionals and developers. Examples: Mendix, OutSystems, Microsoft Power Apps.

🏆 Benefits:
1. Increased speed and agility
2. Reduced costs
3. Improved accessibility

🌟 Use cases:
- Business process automation
- Workflow automation
- CRM systems
- Mobile and web apps

🔍 Limitations:
- Limited customization (especially for no-code)
- Vendor lock-in
- Performance and scalability concerns

Start with a no-code platform and upgrade to low-code if needed. 📈

👇 Have you tried any no-code or low-code platforms? Share your experiences below! #nocode #lowcode #automation #businessprocesses

{% embed https://developnsolve.com/no-code-vs-low-code-whats-the-difference %}