teleren/devto huggingface dataset:
↔️ A Matter of Left and Right
Tags: programming
Published: 2023-12-01 15:39:00

Pragmatic Thinking and Learning: Refactor Your Wetware is a must-read book for anyone interested in improving their cognitive abilities. The knowledge about our cognitive abilities could help us greatly sculpt our workflow, enhancing efficiency and output.

Written by Andy Hunt, this book delves into the intricacies of human thinking and provides practical advice for individuals seeking to enhance their learning and problem-solving skills.
One of the most fascinating concepts introduced in the book is the idea of R-mode and L-mode thinking. These two modes of thinking are characterized by different approaches to problem-solving and decision-making.

R-mode thinking, also known as "right-brained" thinking, is intuitive, imaginative, and holistic. It is often associated with creative endeavors like art, music, and writing. As someone who enjoys writing, I can attest to the fact that R-mode thinking plays a significant role in my creative process. When I'm brainstorming ideas for a new article or blog post, I rely heavily on my R-mode thinking to generate new and exciting ideas.

On the other hand, L-mode thinking, also known as "left-brained" thinking, is analytical, logical, and linear. It is often associated with fields like mathematics, science, and engineering. As a former engineering student, I know firsthand how important L-mode thinking can be when solving complex mathematical problems.

While these two modes of thinking may seem like opposites, they are not mutually exclusive. In fact, the most effective problem-solvers and decision-makers are those who can seamlessly switch between the two modes of thinking as needed.
The book emphasizes the importance of developing both R-mode and L-mode thinking to achieve a more balanced approach to problem-solving and decision-making. I found this concept particularly intriguing because, as someone who believes that interdisciplinary thinking is needed to create astonishing results, I often think to myself how I can utilize each better.

The book suggests several activities that can help individuals develop their R-mode and L-mode thinking. For example, meditation, creative writing, and exploring new hobbies can help develop R-mode thinking, while solving puzzles, studying mathematics and logic, and learning programming can help develop L-mode thinking.

In conclusion, the concept of R-mode and L-mode thinking introduced in Pragmatic Thinking and Learning is both fascinating and practical. By understanding the strengths and weaknesses of each mode and developing both R-mode and L-mode thinking, individuals can enhance their cognitive abilities and achieve a more balanced approach to problem-solving and decision-making.
C# - File-scoped Namespaces
Tags: csharp, programming, tutorial, beginners
Published: 2023-12-01 15:30:00

C# 10.0 introduced the concept of file-scoped namespaces, allowing you to define a namespace for the entire file without needing additional indentation. This feature leads to less nesting and cleaner code, especially in large projects with many files.

Here's how you can use file-scoped namespaces:

1. **Declare a File-scoped Namespace:**
   Instead of wrapping your classes, structs, and other types in a namespace block, you can declare a namespace that applies to the entire file. This is done using the `namespace` keyword followed by the namespace name and a semicolon.

2. **Reduce Nesting and Indentation:**
   Since the namespace declaration is file-scoped, there's no need for additional indentation for the entire file's contents.

Example:

Instead of:

```csharp
namespace MyProject.Models
{
    public class UserModel
    {
        // Model properties and methods here
    }

    public class ProductModel
    {
        // Model properties and methods here
    }
}
```

You can write:

```csharp
namespace MyProject.Models;

public class UserModel
{
    // Model properties and methods here
}

public class ProductModel
{
    // Model properties and methods here
}
```

By using file-scoped namespaces, your code becomes cleaner and more readable, reducing the amount of boilerplate and indentation required. This is especially helpful in projects with a deep directory structure and many files, making it easier to understand the file's scope at a glance.
Multiple window 3d scenes using three.js and localStorage.
Tags: webdev, javascript, programming, beginners
Published: 2023-12-01 15:23:46

**Frontend is beyond just UI** 🚀

A Programmer Presents a Mind-Blowing Multi-Window Experience 😱

Bjorn Staal, an independent Artist, Programmer, and Researcher, recently unveiled a magical-looking setup that allows the "synchronization" of a 3D scene across multiple browser windows. This innovative system, powered by Three.js and localStorage, was specifically made for developers eager to explore advanced web graphics and window management techniques.


### Made by [𝕭𝖏ø𝖗𝖓 𝕾𝖙𝖆𝖆𝖑](https://twitter.com/_nonfigurativ_)


---

### Demo

{% youtube 4LwHH3r2qNY %}

---

---

### Source Code 


{% github bgstaal/multipleWindow3dScene %}

---


---

Check my website [Demo coding](https://democoding.in/) for updates about my latest CSS Animation, CSS Tools, and some cool web dev tips. Let's be friends!

Don't forget to subscribe to our channel : [Demo code](https://www.youtube.com/@democode)
How to read XLS Spreadsheets with React js.
Tags: webdev, tutorial, react, beginners
Published: 2023-12-01 15:11:38

**Intro**
React, is one of the most popular frontend framework. Thanks to the great community we can easily read and process data directly from an xls file. 
In this guide i will walk you through the steps on how to read data from a spreadsheet and display it on your react application.

**Prerequisites**
Before you begin make sure you have,
 Node and npm installed on your system.

**Step 1**
Install Sheet JS. 

```js
npm install xlsx
```


**Step 2**
Import Sheet js into your jsx file. 
```js
import * as XLSX from 'xlsx';
```

**Step 3**
Create a function to handle upload of the xls file.
Start by creating a reader variable using a file reader constructor. 

```js
const reader = new FileReader();
```

Utilize the readAsBinaryString method to initiate the reading process for the specified file from the event argument.

```js
reader.readAsBinaryString(e.target.files[0]);
```

 Once the file has been successfully read, the load event is triggered. Proceed to extract the data following the steps and assign it to a variable.

```js
    reader.onload = (e: any) => {
      const data = e.target.result;
      const workbook = XLSX.read(data, { type: 'binary' });
      const firstSheet = workbook.SheetNames[0];
      const secondSheet = workbook.SheetNames[1];
      const firstSheetData =
       XLSX.utils.sheet_to_json(workbook.Sheets[firstSheet]);
      const secondSheetData =
 XLSX.utils.sheet_to_json(workbook.Sheets[secondSheet]);
  console.log({first_sheet: firstSheetData, second_sheet: secondSheetData})
    };
```

After following these steps, you should have a function similar to this.

```js
const handleFileUpload = (e)=> {
const reader = new FileReader();
reader.readAsBinaryString(e.target.files[0]);
    reader.onload = (e: any) => {
      const data = e.target.result;
      const workbook = XLSX.read(data, { type: 'binary' });
      const firstSheet = workbook.SheetNames[0];
      const secondSheet = workbook.SheetNames[1];
      const firstSheetData =
       XLSX.utils.sheet_to_json(workbook.Sheets[firstSheet]);
      const secondSheetData =
 XLSX.utils.sheet_to_json(workbook.Sheets[secondSheet]);
  console.log({first_sheet: firstSheetData, second_sheet: secondSheetData})
    };
```
Leave a like if this helped, Thanks
Happy Coding!
🤔 Python Quiz: Snake Comprehensions 🐍
Tags: python, beginners, tutorial, pep
Published: 2023-12-01 15:10:54

Follow me to learn 🐍 Python in 5-minute a day fun quizzes! Find [previous quiz here](https://dev.to/vladignatyev/python-quiz-364-dive-into-pythons-pep-484-type-hints-1ac8).

Did you know, that questions about List Comprehensions in Python are among the most popular interview question? You'll meet list comprehensions question in every test of Python proficiency no matter who you are or gonna be: engineer or data scientist!

[PEP 202, titled "List Comprehensions,"](https://peps.python.org/pep-0202/) is a significant PEP that introduced a concise and efficient way to create lists in Python. Authored by Barry Warsaw, this PEP proposed a syntax for list comprehensions that drew inspiration from similar constructs in other programming languages like Haskell and SETL. This feature quickly became one of the most beloved aspects of the Python language for its elegance and utility, profoundly influencing Python's approach to iterable transformations and functional-style programming.    

# Quiz
Which code sample is done right when using list comprehensions in Python?

## Sample 1
```python
numbers = [1, 2, 3, 4, 5]
squared_numbers = [for number in numbers: number ** 2]
print(squared_numbers)
```

## Sample 2
```python
numbers = [1, 2, 3, 4, 5]
squared_numbers = [number ** 2 for number in numbers]
print(squared_numbers)
```

Post your answer in the comments! **0** if you think that Sample 1 is correct, **1** otherwise. As usually, the correct answer will be explained in the first comment.
How to Install Anaconda in Windows?
Tags: python, programming, tutorial, beginners
Published: 2023-12-01 14:53:52

[Installing Anaconda on Windows](https://www.almabetter.com/bytes/articles/how-to-install-anaconda-in-windows) is a straightforward process, especially for those following a Python tutorial or pursuing a data science course. Here's a step-by-step guide:

Download Anaconda:
Visit the official Anaconda website (https://www.anaconda.com/products/distribution) and navigate to the "Download" section.

Select Python Version:
Choose the appropriate version of Anaconda based on your operating system (Windows) and the desired Python version. Anaconda typically supports the latest Python 3.x version.

Download Installer:
Click on the download button for the selected version. The installer file will be downloaded to your system.

Run Installer:
Locate the downloaded installer file (usually named something like "Anaconda3-xxxxx-Windows-x86_64.exe") and double-click to run it.

Begin Installation:
The installer will launch, presenting you with options. Click "Next" to proceed.

Read and Accept License Agreement:
Carefully read the license agreement, and if you agree, select the "I agree" option and click "Next."

Choose Installation Type:
Select the installation type. For most users, the default option "Just Me (recommended)" is appropriate. Click "Next."

Choose Installation Location:
Specify the installation location for Anaconda. The default location is usually recommended. Click "Next."

Advanced Installation Options:
Optionally, you can choose to add Anaconda to your system PATH environment variable. This is recommended for easier access to Anaconda from the command line. Click "Next" after making your selection.

Install:
Click the "Install" button to begin the installation process. This may take a few minutes.

Installation Complete:
Once the installation is complete, you will see a screen indicating success. Click "Next" to finish.

Anaconda Navigator:
Optionally, you can choose to install Anaconda Navigator, a graphical user interface for managing your environments and packages. Check the box if desired and click "Next."

Completing the Installation:
Click "Finish" to complete the installation process.

Verify Installation:
Open the Anaconda Navigator or a command prompt and type conda list to verify that Anaconda and Python are installed correctly. If the installation was successful, you are ready to start using Anaconda for your Python and data science projects.

By following these steps, users can seamlessly install Anaconda on Windows, creating a robust Python environment for their [data science course](https://www.almabetter.com/courses/full-stack-data-science) or [Python tutorial](https://www.almabetter.com/bytes/tutorials/python).
✓ Hire a Hacker for Website Hack and Database Hack
Tags: hacker, upgrade, cybersecurity, blockchain
Published: 2023-12-01 14:40:16

Technocrat Recovery isn't just a tool – it's a game-changer. It has the power to transform struggling students into academic wizards. With improved grades, enhanced study habits, and the wisdom to conquer any academic challenge, Technocrat Recovery is the ultimate secret weapon for unlocking your academic success. Technocrat Recovery is designed to cater to students across various subjects and grade levels. Whether you're a high school student struggling with math or a college student seeking to improve your writing skills, Technocrat Recovery offers tailored solutions and resources to support your specific academic needs. Technocrat Recovery is not a substitute for hard work and effort. It is a tool designed to complement students' efforts and provide them with the necessary support to improve their grades. While Technocrat Recovery offers valuable resources and guidance, success ultimately depends on the student's dedication, commitment, and active engagement in their studies. Technocrat Recovery takes privacy and data security seriously. The platform adheres to strict privacy protocols and safeguards student data. Any personal information shared with Technocrat Recovery is kept confidential and used solely for the purpose of providing personalized academic support. So go forth my fellow students and let the wizards guide you to greatness. It is evident that this tool has the potential to transform academic performance and help students excel in their studies. By leveraging the features and benefits of Technocrat Recovery, students can overcome challenges, improve their grades, and develop crucial study skills. Whether it's tracking progress, setting realistic goals, or enhancing time management, Technocrat Recovery provides a comprehensive solution to support students on their academic journey. So, why wait? Unlock your academic success and unleash your full potential with Technocrat Recovery today, Your grades will thank you.

Visit Technocrat Recovery on their official Website: www. technocratrecovery(.)site

Email:technocratrecovery(@)contractor.net also on WhatsApp: +1(573)356-3708

Warmly Regards....
Adventofcode 🎄: Day 1 - React Components
Tags: beginners, react, codenewbie, learning
Published: 2023-12-01 14:29:33

Happy 1st of December developers! Each day of advent I will be writing a short/revision-like blog to help you along the way with React, and for Day 1 we will be talking about React Components. 

**React Components**

Components serve as a self-contained and reusable building blocks of code, functioning independently. While sharing a similar purpose with JavaScript functions, components operate in isolation and produce HTML. There are two main types of components: Class components and Function components and now I will explain the difference:

A functional component is essentially a straightforward Javascript function. It accepts data in the form of props and, in return, yields a React element. Conversely, a class component involves the use of the class keyword,. It extends React.Component, thereby transforming the class into a fully-fledged React component. 

**Conclusion**

So, think of React components like those handy building blocks you use. They're bits of code that you can use over and over again, making your websites dynamic and interactive. Whether you're into functional components (kind of like straightforward JavaScript functions) or class-based ones (a bit fancier with the class keyword and all), these components do specific jobs, take in data through props, and give you back those neat React elements.

Day 1 of adventofcode is complete. You have learnt something 🎄

KEEP CODING!!
It is time to get personal. We used #BCMS, #Nuxt, and #Tailwind to make code starter for Portfolio websites.
Published: 2023-12-01 14:21:36

Everyone who deals with front-end and graphic design knows how important a good portfolio is for sharing information and demonstrating your technological skills. Even if you have little work experience, you can leverage a website to build a better picture of your capabilities and yourself as a candidate. 

That's why we are introducing the Personal Code Starter for BCMS, Nuxt & Tailwind this Friday.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8xjea0jzvwa08c51yvh9.jpg)


Use the weekend to build the life you want instead of trying to escape the life you have.

👀 Demo: https://thebcms.com/starters/personal

📁Code: https://github.com/bcms/starters/tree/master/nuxt/personal

📖 Read more:https://thebcms.com/blog/announcing-nuxt-personal-starter

Support ❤️: If you like the project, hit that ⭐ [button on GitHub.](https://github.com/bcms/starters)
What was your win this week?
Tags: discuss, weeklyretro
Published: 2023-12-01 14:00:00

Hey folks 

Hope y'all are ready for the weekend! 🙌 

Looking back on this past week, what was something you were proud of accomplishing?

All wins count — big or small 🎉 

Examples of 'wins' include: 
- Starting a new project
- Fixing a tricky bug
- Finishing a good book 📖

---

![Spongebob wearing glassesand flipping through pages of a book.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vncyi2jfcpdn08v5thy0.gif)

---

**_Did you know we feature wins in our "Wins of the Week" email every Friday? [Subscribe to our weekly newsletter emails](https://dev.to/settings/notifications) to get wins delivered right to your inbox!_** 💌
A Merry Delight: Discovering the Best Christmas Cookies in Edmonton at A Worthy Cookie
Published: 2023-12-01 13:45:21

## Introduction:

As the festive season approached, I embarked on a quest to find the perfect Christmas cookies in Edmonton, and my journey led me to the delectable offerings at A Worthy Cookie. Their divine creations not only surpassed my expectations but also became the highlight of my holiday celebrations. Iw ould like to [buy christmas cookies](https://www.aworthycookie.ca/holiday-shop) from Worthy Cookie.

## Unwrapping Joy: A Worthy Cookie's Christmas Cookies Collection:

A Worthy Cookie's commitment to crafting exceptional holiday delights shines through in their Christmas Cookies Collection. Each cookie is a miniature work of art, capturing the essence of the season in both taste and presentation. From classic sugar cookies adorned with festive icing to gingerbread masterpieces, the variety is as impressive as it is delightful.

## Exceptional Quality: Elevating the Christmas Cookie Experience:

The quality of ingredients used by A Worthy Cookie is evident in every bite of their Christmas cookies. The flavors are rich and nuanced, showcasing a perfect balance of sweetness and seasonal spices. The texture is impeccable, striking that ideal balance between chewy and crumbly. A Worthy Cookie's commitment to excellence truly shines in the quality of their Christmas cookies.

## Buy Christmas Cookies: A Worthy Investment in Festive Bliss:

_**Craftsmanship Beyond Compare:**_
When you choose to buy Christmas cookies from A Worthy Cookie, you are investing in unparalleled craftsmanship. Each cookie is meticulously decorated by skilled artisans, ensuring a visual feast that adds a touch of elegance to your holiday spread. The attention to detail in every design reflects the passion and dedication that goes into creating these festive masterpieces.

**_Variety to Suit Every Taste:_**
A Worthy Cookie understands that holiday preferences vary, and their Christmas cookies collection reflects this diversity. Whether you prefer the classic shapes and flavors or are looking for unique twists on traditional recipes, A Worthy Cookie's selection has something to cater to every palate. The ability to customize your order further ensures a personalized and memorable holiday treat.

## Conclusion:

A Worthy Cookie has undoubtedly secured its place as the go-to destination for the best Christmas cookies in Edmonton. The combination of exceptional quality, exquisite craftsmanship, and a diverse selection makes every bite a celebration of the season. To elevate your holiday festivities, don't miss the opportunity to buy Christmas cookies from A Worthy Cookie—where joy is baked into every delicious creation.
Day 4 - 30 Days learn Web Dev
Tags: javascript, beginners, programming
Published: 2023-12-01 13:42:08

**1 Dec 2023**

Finished [2723. Add Two Promises](https://leetcode.com/problems/add-two-promises/)

**What I learn:**
- Promise.all()
- Promise.allSettled()
- promise start executing at creation.
How to find mean, median & mode of the elements of a tuple or list (no statistics module used) ?
Tags: python, programming
Published: 2023-12-01 13:41:15

Today we will learn the easiest way to find the mean, median and mode of the elements of a tuple using normal concepts.

Note: No statistics module has been used

```python
t = ()
n = int(input("Enter the number of elements: "))

for i in range(n):
    num = int(input("Enter the element: "))
    t += (num,)

mean = 0
median = 0
mode = 0

length = len(t)
s = sum(t)
mean = s / length

st = sorted(t)

if (len(st)%2 != 0):
    medInd = int(len(st)/2)
    median = st[medInd]
else:
    medInd1 = int(len(st)/2)
    medInd2 = int(len(st)/2) - 1
    median = (st[medInd1] + st[medInd2])/2

d = {}
for i in t:
    d[i] = t.count(i)

max_occur = max(list(d.values()))

for i in t:
    if t.count(i) == max_occur:
        mode = i

print(f'Mean: {mean}')
print(f'Median: {median}')
print(f'Mode: {mode}')
```
Custom ordering without custom SQL with Ruby on Rails 7
Tags: ruby, rails, webdev, sql
Published: 2023-12-01 13:32:16

![Custom order SQL](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g9kyft9312dd3d6u0lv3.png)

**The problem**
It's a common case for Rails applications to have `enum` fields on a model like:
```ruby
class Review < ApplicationRecord
  enum status: [:pending, :processing, :completed]
end
```
All's good until we need to sort records by their status in a specific order. For example, on reviews page records should be ordered by status in alphabetical order, but internally in DB status values are stored as integers.
We can't just add `order(status: :asc)`. Previously we'd have to write some custom SQL for the task:
```ruby
Review.order("
  CASE status
  WHEN 2 THEN 1
  WHEN 0 THEN 2
  WHEN 1 THEN 3
  END
  ASC
")
```

**The solution**
Ruby on Rails 7.0 provides a new query method `#in_order_of` which accepts as arguments a column name and an array of values in order we want the records to be ordered by:
```ruby
Review.in_order_of(
  :status, [:complete, :pending, :processing]
)
```
Which translates to SQL query like:
```sql
SELECT "reviews".* FROM "reviews" 
WHERE "reviews"."status" IN (2, 0, 1) 
ORDER BY CASE "reviews"."status"
  WHEN 2 THEN 1 
  WHEN 0 THEN 2 
  WHEN 1 THEN 3 
END ASC
```
This works well, as long as we don't have/care about reviews with `NULL` as their status.
If we try to pass `nil` to the values array:
```ruby
Review.in_order_of(
  :status, [nil, :complete, :pending, :processing]
)
```
Following SQL would be created:
```sql
SELECT "reviews".* FROM "reviews" 
WHERE "reviews"."status" IN (NULL, 2, 0, 1) 
ORDER BY CASE "reviews"."status"
  WHEN NULL THEN 1
  WHEN 2 THEN 2
  WHEN 0 THEN 3
  WHEN 1 THEN 4
END ASC
```
But since `NULL` in SQL is a special value and `NULL != NULL`, then this query simply won't return records with `NULL` as a status at all.

**The improvement**
Ruby on Rails 7.0.7 further improves the method: now it correctly handles the `NULL` values, so the resulting query would be:
```sql
SELECT "reviews".* FROM "reviews" 
WHERE (
  "reviews"."status" IN (2, 0, 1)
  OR "reviews"."status" IS NULL
)
ORDER BY CASE 
  WHEN "reviews"."status" IS NULL THEN 1
  WHEN "reviews"."status" = 2 THEN 2
  WHEN "reviews"."status" = 0 THEN 3
  WHEN "reviews"."status" = 1 THEN 4
END ASC
```
Now it does exactly what we need without writing any custom SQL queries.