teleren/devto huggingface dataset:
Tabs
Published: 2024-06-09 06:30:53

```
<div class="tabs_wrap">
  <div class="tabs_container">
    <button class="btn tab tab--1 tab--active" data-tab="1">
      tab button 1
    </button>
    <button class="btn tab tab--2 tab--active"  data-tab="2">
      tab button 2
    </button>
  </div>
  <div class="content content--1 content--active">
    <div>
      contents 1
    </div>
  </div>
  <div class="content content--2 content--active">
    <div>
      contents 2
    </div>
  </div>
</div>  
```

```
const tabs = document.querySelectorAll('.tab');
const tabsContainer = document.querySelector('.tabs_container');
const tabsContent = document.querySelectorAll('.content');
```

```
tabsContainer.addEventListener('click', function (e) {
  const clicked = e.target.closest('.tab');

  // Guard clause
  if (!clicked) return;

  // Remove active classes
  tabs.forEach(t => t.classList.remove('tab--active'));
  tabsContent.forEach(c => c.classList.remove('content--active'));

  // Activate tab
  clicked.classList.add('tab--active');

  // Activate content area
 
 document.querySelector(`.content-${clicked.dataset.tab}`).classList.add('content--active');
});
```

Avoid using `forEach` to attach events to each tab. Instead, leverage event bubbling to set an event listener on the parent element and determine which child element it corresponds to.
Dress Your Style: Winter, Summer, Party & Casual with FEMKE BOUTIQUE
Published: 2024-06-09 06:21:55

A quintessential ensemble for the sun-kissed days, a summer outfit embodies breezy elegance. It's a harmonious blend of comfort and style, often featuring lightweight fabrics like cotton or linen. With vibrant colors or soothing pastels, it exudes an aura of relaxation, perfect for picnics in the park or strolls along the beach.

[Shop Now](https://femke-boutique.nl/)
AI CSS Animations
Tags: webdev, design, css, ai
Published: 2024-06-09 06:04:27

I released a free AI CSS animation generator a month ago, my first software in the animation space.

As a dev/designer, I was frustrated with the annoying & tedious process of writing keyframe animations. The lack of good tools available led me to build my own solution.

It’s finally real that it’s live and getting sales, what a wild feeling this is. Now, I'm reaching out to the Reddit community for feedback and beta testers to help refine things further :) I want to make this product as fully-featured and helpful as possible!

If you're interested in making some slick animations for your site, I'd love for you to try it out and share your thoughts! Looking for harsh criticisms here, don’t hold back!

[Aicssanimations.com](Aicssanimations.com)
Must Join Discord Servers for Developers 💬
Tags: webdev, learning, beginners, javascript
Published: 2024-06-09 06:00:00

## What is Discord?

[Discord](https://discord.gg/) is a community-based chatting app that allows you to connect directly with people within your niche. Initially built for gamers, Discord has grown to serve a diverse user base, empowering connectivity across various interests and professions.

Among these are the developer communities. I say communities, plural because there are multiple sub-communities within Discord. One group might focus on web development, while another might concentrate on game development. Each sub-community provides a space for like-minded individuals to share knowledge, collaborate, and support each other.

Here are my top Discord servers to join as a developer. These communities offer valuable resources, support, and networking opportunities for developers of all levels. Whether you’re looking to improve your coding skills, collaborate on projects, or simply enjoy some programming humor, these servers have something for everyone:

* [Little Software Planet](https://discord.gg/hFZFC8zy)
    
* [Programmer’s Hangout](https://discord.gg/programming)
    
* [Devcord](https://discord.gg/devcord)
    
* [The Coding Den](https://discord.gg/code)
    
* [SpeakJS](https://discord.com/invite/dAF4F28)
    
* [CodeSupport](https://discord.gg/codesupport-240880736851329024)
    
* [Nodeiflux](https://discord.com/invite/y5ksVAS)
    
* [TensorFlow](https://discord.com/invite/64MVzQX)
    
* [Programmer Humor](https://discord.com/invite/rph)
    

Feel free to share your top Discord servers in the comments below 👇

Before you go please consider supporting by giving a **Hart, Share,** or **Follow**! 👏

**Visit My Site & Projects**: **[Travis Lord](https://travislord.xyz/)** | **[Projects](https://travislord.xyz/projects)** | **[About me](https://travislord.xyz/about)**
    
**Follow:** **[DEV](https://dev.to/lilxyzz)** | **[GitHub](https://github.com/lilxyzz)** | **[Linkedin](https://au.linkedin.com/in/travis-lord-16b947108/)** | **[Medium](https://medium.com/@travis.lord)**
49. Group Anagrams
Published: 2024-06-09 05:41:36

Topic: Arrays & Hashing

Soln 1 (dictionary):

- create a dictionary
- iterate through the string of wordsa
- sort the word alphabetically
- if the key[sorted word] is not in the dictionary then add it and use the original word as its value 
- else append the word to the already existing key

```
    word_dict = {}

    for word in strs:
        sorted_word = ''.join(sorted(word))
        
        if sorted_word not in word_dict:
            word_dict[sorted_word] = [word]
        else:
            word_dict[sorted_word].append(word)
            
    return list(word_dict.values())
```

Soln 2 (tuples + defaultdict):

1. Initialize a Dictionary: Create an empty dictionary.
2. Iterate Through the List of Strings: Loop through each string in the input list.
3. Sort Each String and Convert to a Tuple: For each string, sort the characters and convert the sorted list to a tuple.
4. Use Tuple as Key and Append String as Value: Use the tuple as the key in the dictionary. Append the original string to the list corresponding to this key.
5. Return the Values of the Dictionary: Extract the values from the dictionary which are the groups of anagrams.
```
from collections import defaultdict

def group_anagrams(strs):
    count = defaultdict(list)
    
    for i in strs:
        count[tuple(sorted(i))].append(i)
    
    return count.values()
```
Note: **defaultdict** is a sub-class of the dictionary class that returns a dictionary-like object. The functionality of both dictionaries and defaultdict are almost same except for the fact that defaultdict never raises a KeyError. It provides a default value for the key that does not exists.

**Tuple** is an ordered, immutable collection of elements.
[Flutter] Future 대신 void 를 사용하는 이유
Tags: flutter, developer, void, future
Published: 2024-06-09 05:40:11

### void를 사용하는 경우:
메서드가 의미있는 데이터를 반환하지 않거나 주요 목적이 작업을 수행하거나 앱 상태를 업데이트하는 경우 void를 사용합니다.
예를 들어, 사용자 상호 작용을 처리하거나, 환경 설정을 설정하거나, 특정 결과를 반환하지 않고 시간이 걸리는 복잡한 계산을 수행하는 메서드 등이 있습니다.  

### Future를 사용하는 경우:
메서드가 비동기 작업을 수행하고 미래에 값 또는 결과를 반환하는 경우 Future를 사용합니다.
예를 들어, 네트워크에서 데이터를 가져오거나, 저장소에서 파일을 로드하거나, 시간이 걸리는 복잡한 계산을 수행하는 메서드 등이 있습니다.

### 추가 고려 사항:
값을 반환하지 않는 메서드에 void를 사용하면 코드가 더 간결하고 읽기 쉽습니다.
진정으로 값 또는 결과를 반환하는 메서드에 Future를 사용하면 비동기 작업 및 결과 처리를 구조적으로 처리할 수 있는 방법을 제공합니다.

### 정리
void와 Future의 선택은 메서드의 특정 목적과 값을 반환하거나 작업을 수행하는지에 따라 다릅니다.
값을 반환하지 않고 작업 수행 또는 상태 업데이트에 중점을 둔 메서드에는 void를 사용합니다.
비동기 작업을 수행하고 미래에 값 또는 결과를 반환하는 메서드에는 Future를 사용합니다.  

### 목적성
일반적으로 void 대신 Future<void>를 비동기 함수에 사용하는 것이 좋습니다.
Future<void>는 작업 연결 또는 오류 처리가 필요한 경우 특히 더 많은 유연성과 제어 기능을 제공합니다.
void는 이러한 기능이 필요하지 않은 간단한 비동기 작업에 적합합니다.
White screen issue occurs ?. It could assist you while integrating Firebase with your Flutter app (Android).
Tags: flutter, firebase, dart, programming
Published: 2024-06-09 05:32:57

These instructions can assist you if you are experiencing white screen issues when integrating your Flutter app with Firebase.
Go to :-
Project Folder/android/app/src/main/res/values

Now you have to find values.xml
if it is there then edit according to my steps as shown below or if it is now there just create values.xml (code is provided in last of this Post)


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

Required things :-
1.firebase_database_url (open firebase console and go to real time database and copy the url .


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


2.gcm_defaultSenderId (open firebase console and go project overview >> project setting >>cloud messaging >> senderId)


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


3.google_api_key (open goolgle_services.json , you will get it)
4.google_app_id (open goolgle_services.json , you will get it)
5.project_id (open goolgle_services.json , you will get it)
6.firebase_storage_bucket (open goolgle_services.json , you will get it)

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

value.xml code :- 

```
<resources>
    <string name="firebase_database_url" translatable="false">Write your firebase_database_url</string>
    <string name="gcm_defaultSenderId" translatable="false">write your Sender id</string>
    <string name="google_api_key" translatable="false">write your google_api_key</string>
    <string name="google_app_id" translatable="false">write your google_app_id</string>
    <string name="project_id" translatable="false">write your project_id</string>
     <string name="firebase_storage_bucket">write your firebase_storage_bucket</string>
</resources>
```


Hope these steps will works for you 
Thank you :)
String Stream in C++
Tags: cpp, programming, stl, string
Published: 2024-06-09 05:31:15

**What is Stringstream Class in C++?**

stringstream is a part of the C++ Standard Library, included in the sstream header, and is used for performing input and output operations on strings. It allows you to treat a string like a stream (such as cin or cout), enabling formatted input and output operations.


**Commonly Used Methods of Stringstream Class in C++**

1. clear() :- To clear the stream.
2. str()  :-  To get and set string object whose content is present in the stream. 
3. operator <<  :-  Add a string to the stringstream object. 
4. operator >>   :-  Read something from the stringstream object.


```
#include <iostream>
#include <sstream>
#include <string>

using namespace std;

int main() {
    // Create a stringstream object
    stringstream ss;

    // Using operator<< to add data to the stringstream
    ss << "123 456 789";
    
    // Output the current content of the stringstream using str()
    cout << "Initial stringstream content: " << ss.str() << endl;

    // Variables to hold extracted values
    int a, b, c;
    
    // Using operator>> to extract data from the stringstream
    ss >> a >> b >> c;

    // Display the extracted values
    cout << "Extracted values: " << a << " " << b << " " << c << endl;

    // Clear the stringstream using clear()
    ss.clear();

    // Check the content after clearing (should be empty)
    cout << "After clear() - current stringstream content: " << ss.str() << endl;

    // Set a new string to the stringstream using str()
    ss.str("987 654 321");
    
    // Output the new content of the stringstream
    cout << "After str() set new content: " << ss.str() << endl;

    // Extract data from the stringstream again
    ss >> a >> b >> c;

    // Display the newly extracted values
    cout << "Newly extracted values: " << a << " " << b << " " << c << endl;

    // Clear the stringstream and reset the stringstream content
    ss.clear();
    ss.str("");

    // Verify that the stringstream is cleared
    cout << "Final stringstream content after clear and str reset: '" << ss.str() << "'" << endl;

    return 0;
}

```




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

` n` represents the size of the string content in the stream, and `m` represents the size of the data being inserted or extracted.

```
// C++ program to demonstrate use of stringstream to count frequencies of words.
#include <bits/stdc++.h>

using namespace std;

void printFrequency(string st)
{
	// Each word it mapped to it's frequency
	map<string, int> FW;

	// Used for breaking words
	stringstream ss(st);

	// To store individual words
	string Word;

	while (ss >> Word)
		FW[Word]++;

	for (auto m : FW)
		cout << m.first << "-> " << m.second << "\n";
}


int main()
{
	string s = "May the force be with you";
	printFrequency(s);
	return 0;
}

```
Learn In Public!
Tags: devops, learning, aws, cloud
Published: 2024-06-09 05:16:42

Hello People,
I am starting a **"Learn In Public"** challenge. I will share my learning on Linkedin and write detailed blogs about it. In the LinkedIn post, you can expect details about free learning resources and a summary of the technology I learned. 
**Stay tuned!**

Don't forget to connect with me on LinkedIn for more updates.
**LinkedIn Profile:** https://www.linkedin.com/in/gous30/
Web Component
Published: 2024-06-09 05:01:00

Membuat web komponen atau suatu yang sangat penasaran agar bisa terwujud karena terkait dengan materi yang berkaitan dengan alat pengembangan website yaitu mudah dan cepat. 

Contohnya web [ku](https://andyux01.github.io/work/tugas-remidi/)

Di situ dibuat menggunakan drupal yang statis dengan mudah dan digabung dengan web komponen dari HAX.
The Science Behind Successful Learning Strategies
Published: 2024-06-09 04:59:51

## Introduction

The process of learning is complex and multifaceted. It involves a countless of cognitive functions and neurological processes. Understanding the science behind learning can enhance our ability to acquire and retain knowledge. It can also help us develop effective learning strategies.

## Types of basic learning

People also ask for what are the 3 basic type of learning? Visual, auditory, and kinesthetic learning are three common learning styles. They refer to the preferred way of receiving and processing information
   

1. -  Visual learners prefer to see and read information. They benefit from diagrams, charts, and written notes.
2. -     Auditory learners prefer to hear information. They benefit from lectures, discussions, and audio recordings.
3. -     Kinesthetic learners prefer to learn by doing. They benefit from hands-on activities, experiments, and real-world applications.

To read complete article please go through: **[Types of basic learning](https://generalknowledgequestion.com/successful-learning-strategies/)**
HIRE PROFESSIONAL CRYPTO RECOVERY AGENT WITH BRUNOE QUICK HACK/ WhatsApp: + 1- 705 -784- 2635
Tags: webdev, python, opensource, career
Published: 2024-06-09 04:29:03

BRUNOE QUICK H A C K GOT MY SCAMMED FUNDS BACK

Attention, scam victims: Brunoe Quick Hack is your savior! With their unmatched cyber solutions expertise, they have successfully recovered stolen cryptocurrency, including my own Bitcoin. This remarkable achievement not only brings solace to countless individuals who have fallen victim to scams but also renews faith in justice. Brunoe Quick Hack's Crypto Recovery Service is the sanctuary you've been seeking, a haven for scam victims in dire need of a refund. As esteemed hackers armed with cutting-edge technology, we guarantee the secure and successful retrieval of your scammed funds - no compromises. Together, let's unite against scammers and reclaim what is rightfully ours. [BRUNOEQUICKHACK GMAIL DOT COM] From infiltrating databases to monitoring social media accounts, Brunoe Quick Hack is your trusted partner in all hacking endeavors. You can find out more at brunoequickhack.com or reach out on WhatsApp at +1./705./78/.426/.35 for great assistance.
What are The Things To Do Alone in Seattle?
Published: 2024-06-09 04:10:26

Planning a solo trip can be daunting, but Seattle, the Emerald City, welcomes travelers with open arms – especially those flying solo. With its vibrant coffee culture, stunning natural beauty, and friendly locals, adn other things to do alone in seattle, Seattle is an ideal destination to explore at your own pace. Whether you crave a day at the Pike Place Market sampling fresh seafood or a quiet afternoon wandering through the Museum of Pop Culture, Seattle has something for every kind of adventurer With Type Writer Tale. So, ditch your worries and pack your bags – Seattle awaits!

https://typewritertale.com/what-are-the-things-to-do-alone-in-seattle/
Top 5 Best Solo Travel Destinations Europe
Published: 2024-06-09 04:05:27

Imagine yourself strolling down the cobblestone streets of Prague (One of the Best Solo Travel Destinations Europe), mesmerized by the architectural grandeur of the Charles Bridge. Perhaps you crave the energy of London’s bustling markets, or the serenity of the Greek isles beckons. Europe, a tapestry woven from rich history, breathtaking landscapes, and vibrant cultures, is a dream destination for solo travelers. But with so many incredible options, choosing where to start can be overwhelming. Fear not, intrepid explorer! This curated list unveils the top 5 best solo travel destinations in Europe, taking into account factors like safety, affordability, ease of navigation, and the abundance of solo-friendly activities.

https://typewritertale.com/top-5-best-solo-travel-destinations-europe/
How to validate constructor arguments when using constructor property promotion
Tags: php
Published: 2024-06-09 04:01:13

I have written a post about the php 8.4 [property hooks](https://dev.to/xwero/php-property-hook-alternatives-5c4a). Where I didn't understand what it did. 

And I added validation code examples that have nothing to do with it. So I did rewrite the post. But I didn't want to lose the valid example code. And that is why this post exists.

## What is the desired result?

We want to create a user by first and last name. The name parts should not be empty because we assume everyone has a first and last name.

## Validation with a class method

```php
class User
{
    public function __construct(private string $firstName, private string $lastName) {
    	$this->validate($firstName, 'firstName');
    	$this->validate($lastName, 'lastName');
    }

    public function validate(string $value, $argumentName) {
    	if (strlen($value) === 0) {
            throw new ValueError("$argumentName must be non-empty");
    	}
   }
}
```
This is the method I use when there are one-off validations

## Validation with trait

```php
trait Validation {
	private function notEmpty(mixed $value, $argumentName) {
		if(is_string($value) && strlen($value) === 0) {
			throw new ValueError("$argumentName must be non-empty");
		}
	}
	
}

class User
{
	use Validation;
	
    public function __construct(private string $firstName, private string $lastName) {
    	$this->notEmpty($firstName, 'firstName');
    	$this->notEmpty($lastName, 'lastName');
    }
}
```
This is the method that I use to centralize validation methods, because there are patterns that are recurring.

## Validation with attributes
When your code has a lifecycle event in place that can process attributes, or you use a package like [laravel-data](https://spatie.be/docs/laravel-data). This is how the code might look like.

```php
use Spatie\LaravelData\Data;

class User extends Data
{
    public function __construct(
      #[Min(1)]
      private string $firstName, 
      #[Min(1)]
      private string $lastName
    ) {}
}
```
When I have multiple cases with multiple repeating patterns, then this is the method I use.
lá số tử vi
Published: 2024-06-09 03:13:16

Tử Vi, hay Tử Vi Đẩu Số, là một bộ môn huyền học được dùng với các công năng chính như: luận đoán về tính cách, hoàn cảnh, dự đoán về các " vận hạn" trong cuộc đời của một người đồng thời nghiên cứu tương tác của một người với các sự kiện, nhân sự.... Chung quy với mục đích chính là để biết vận mệnh con người.

Lấy lá số tử vi để làm gì ?
Xem lá số tử vi trọn đời có bình giải chi tiết sẽ giúp cho quý bạn mệnh biết về tương lai, vận hạn theo các năm. Khi lấy lá số tử vi theo giờ sinh và ngày tháng năm sinh thì quý bạn cần khám phá phần luận giải lá số để nắm bắt vận mệnh của chính mình. Lá số tử vi trọn đời mang yếu tố tham khảo giúp quý bản mệnh tránh việc không nên, tăng cường việc tốt từ đó có một cuộc sống suôn sẻ và nhiều may mắn.

Lá số tử vi trọn đời thể hiện điều gì ?
Trên mỗi lá số tử vi sẽ thể hiện các phương diện cuộc sống của quý bản mệnh theo từng năm tuổi cụ thể như: công danh, sự nghiệp, gia đạo, tình duyên, tiền tài, sức khỏe, anh chị em, quan hệ xã hội...
Để tra cứu và lấy lá số tử vi trọn đời trực tuyến miễn phí quý bạn cần cung cấp đầy đủ và chính xác nhất về họ tên, giờ sinh, ngày sinh, tháng sinh, năm sinh và giới tính.
Ngoài ra: cách xem lá số tử vi có thể thay đổi theo các năm. Vì vậy để luận đoán và có cái nhìn chính xác nhất về tương lai và vận mệnh của mình trong năm Kỷ Hợi 2019 cũng như trong năm Canh Tý 2020. Quý bạn nên lấy lá số tử vi 2019 và cách lập lá số tử vi để tham khảo chi tiết tử vi năm 2020 của mình, cũng như phân tích và khám phá lá số tử vi trọn đời của các năm khác.
Xem thêm tại: https://tuvi.vn/lap-la-so-tu-vi
How To Access Web Camera Using JavaScript And Capture Images And Record Video With Audio
Tags: webdev, javascript, frontend, programming
Published: 2024-06-09 02:27:26

                         🚀 New Tutorial Alert! 🚀


How To Access Web Camera Using JavaScript And Capture Images And Record Video With Audio



I’m excited to share my latest video tutorial on Building a Webcam Capture and Video Recorder with JavaScript. Whether you're a beginner or looking to enhance your web development skills, this step-by-step guide is perfect for you!



🔍 In this tutorial, you'll learn:



How to set up the HTML structure for webcam capture and video recording.



Using the navigator.mediaDevices.getUserMedia API to access your webcam.



Capturing images from the video stream and displaying them using a canvas.

Implementing video recording functionality with the MediaRecorder API.



Managing recording states (start, pause, resume, stop) with JavaScript.



🎥 Key Features:

Capture high-quality images directly from your webcam.

Record videos seamlessly, with options to pause and resume.

Display the recorded video within the browser.

User-friendly interface with intuitive controls for capturing and recording.



By the end of this tutorial, you’ll have a fully functional webcam capture and recording system that you can integrate into your own projects or use as a learning tool. Perfect for anyone looking to dive deeper into web development with practical, hands-on experience!



🔗 Watch the full tutorial here: (https://lnkd.in/dVXBuyTT)



Don't forget to like, share, and subscribe for more tutorials! If you have any questions or need further clarification, feel free to leave a comment below. Your feedback is always appreciated!



#WebDevelopment #JavaScript #Coding #TechTutorial #WebcamCapture #VideoRecording #HTML5 #MediaRecorder #LearnToCode #TechSkills #Programming
Smooth Scroll
Published: 2024-06-09 02:27:18

Conventional way

```
const hoge = hoge.getBoundingClientRect();

window.scrollTo({
  left : hoge.left + window.pageXOffset, 
  top: hoge.top + window.pageYOffset,
  behavior: 'smooth',
})
```

Recently way

```
hoge.scrollIntoView({behavior: "smooth"})
```


Viewport version
```
document.documentElement.clientHeight
```