teleren/devto huggingface dataset:
How to Get Better in Design Patterns?
Tags: designpatterns, softwaredesign, learning, beginners
Published: 2023-07-25 21:28:55

The main idea is that studying a bunch of design patterns or general design ideas in bulk is useless, because your brain has to dissect those abstract things and learn to detect them as "symptoms" on concrete problems when you are doing real tasks on real code.

If you want your brain to naturally come up with a certain design pattern as a solution, it has to try use it in repeat, through iterations. Just like how you learn new vocabulary in a language: you review words a few times until they become second nature and you can naturally use them when you speak.

I have been trying this method on myself and programmers I was mentoring in real-world production environments. And it's proven to be working. It's really simple and fundamental in principle.

**Here's the method:**

1) Acquire the knowledge of _the existence_ of a **single** design idea.
2) Write a piece of code the way you normally do.
3) Review your own code and try to detect bad things about it. 
4) Refactor your code. Think of all the design ideas you can come up with for that specific piece of dirty code.
5) goto 1 (enough times).

"Enough times" is totally relative. Relative for each design pattern, and relative with one's fundamental knowledge of software design.

Maybe after all, this is simple, but it takes some time. The truth is becoming genuinely and fundamentally good at programming needs time and mindfulness. I am also far away from ideal and do practice this on a daily basis. It's a fun part of the process.

Also you can easily find the failed examples of "learning in bulk" within the college students who study a bunch of design patterns for exams but forget all of them a week after. Moreover, they aren't also taught to use the abstract ideas in real world and concrete problems.

I hope this will be helpful to someone out there.
My Comprehensive Car Insurance Claim Journey
Tags: insurance, scam
Published: 2023-07-25 21:03:09

Hello readers,

I wanted to share my recent experience with my comprehensive car insurance claim and how it unfolded. The incident happened while I was traveling with my family. A driving school car abruptly stopped in front of us, and I had to apply sudden brakes. However, a lorry coming from behind couldn't stop in time due to worn-out tyres and ended up hitting the back of our car.

### Reporting The Incident

As the responsible driver, I reported the accident to the police and filed a General Diary (GD). I also documented the scene of the accident and gathered witnesses to support my claim. I informed my insurance company, ICICI Lombard (Policy No: 3001/290417455/00/000), about the incident and filed a claim.

### The Claim Dispute

The repair estimate given by the service center was INR 55,274. However, my insurance company only approved INR 34,195 under the claim, which was due to the depreciated value of certain car parts. The remaining INR 21,079 was expected to be paid by me out-of-pocket. 

### Legal Action and Insurance Company's Role

I decided to dispute the claim amount by involving legal consultation. The legal experts advised me that the third party (the lorry driver or owner) should be responsible for the accident as per the Motor Vehicles Act, 1988. 

As per the Act, the insurer of the vehicle at fault should compensate for the damages caused by their insured vehicle. However, ICICI Lombard informed me that it is not their responsibility to contact the third party or their insurance company, which is a common practice in India. I was advised to pursue the matter independently or through legal channels.

### Contacting The Third Party

I contacted the lorry driver, informing him about his legal liability to pay for the damages or to inform his insurance company about the accident. He said he would discuss the matter with the lorry owner and get back to me.

### Current Situation

Currently, my situation can be best described as a "subrogation claim dispute." Subrogation refers to the right of the insurance company to recover the money paid out in a claim from a third party that was actually at fault. 

As of now, I have not received any response from the lorry driver or owner, and the service center is waiting for the remaining payment for the repair works. I have decided to escalate the matter by filing a formal written complaint to the police station, asking for assistance in recovering the remaining amount from the third party.

Stay tuned for the next update on how the situation evolves. Remember, understanding your rights and responsibilities is key in navigating such insurance claim disputes.
Open source JavaScript Quiz App
Tags: javascript, webdev, tutorial, opensource
Published: 2023-07-25 20:51:30


![Quiz Appp](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6tdbaiy6zenvwcl0zeol.png)

Last days I was applying on JS by making some JS tutorials. I started building a simple Quiz App using vanilla js. I decided to make it `open-source` so any js developer can contribute to it on github or learn new things from it.

## Features
The project contains the following features:

1. Beautiful UI
2. Responsive UI
3. Quiz page
4. Results Page
5. Basic quiz app features:
   - next\previous btns
   - move between questions
   - choose answer
   - timer 
   - submit btn
   - question points 
   - number of questions
   - see results

## Logic
1. Quiz content is rendered from `JSON` file  - to `HTML` page -  that will contain every thing (time, questions, options, true answers ...etc) using `API` fetch. "_Simulating calling quiz data from server_"

2. The answers will be putted in a new `JSON` file  - Copy of the Quiz `JSON` file - that will be sent to another `html` page  - called results.html -  where the answers file will be rendered in it with the same quiz data.

3. The Answers `JSON` will be sent to the results Page using `postMessage` and message `EventListener`. then rendered.

**NOTE:** the only different between Quiz `JSON` and Answers `JSON`, is that the answers `JSON` will includes the user answers.

**Last Note:** This project is completely built on `FP` (Functional Programming) Concept. I'll continue developing it from time to time and improve the code and make it cleaner.

### Finally
This project is completely `open-source`, under `MIT license`. You can contribute on it and learn from each others.

👉 Source Code: https://github.com/HamzaElkotp/Quiz-Answers_Project
🌐 Live Preview: https://quizanswersproject.netlify.app/quiz.html
🐱 My GitHub: https://github.com/HamzaElkotp
👕 To get Coding Shirts: https://my-store-c54a10.creator-spring.com/
Roadmap, Addressing Risks and Mitigations, Wireframes
Published: 2023-07-25 19:58:46

The day kicks off with the team members dedicating their creative energy to sketching wireframes of the main app pages and screens. These hand-drawn sketches allow for quick exploration of design ideas and layouts before diving into the digital realm. Once completed, team members submit their wireframes to a shared folder, enabling everyone to view and provide feedback.

After a productive morning, the team reconvenes to plan the project's roadmap. This roadmap serves as a guiding document that outlines the planned sprints and key milestones for the GitHub project's development. 

An integral part of any project is identifying potential risks and devising strategies to mitigate them. The team compiles a document listing all identified risks, their potential impact, likelihood of occurrence, and the corresponding mitigation strategies. This proactive approach ensures that the team is well-prepared to handle challenges as they arise.

Then we submitted a document that introduces each team member and their designated responsibilities. This document helps prevent confusion and ensures everyone knows their tasks and accountabilities, fostering a collaborative and cohesive work environment.
Professional Mobile Notary in Texas, Your Trusted Signing Partner
Tags: legal, notary, service, notarization
Published: 2023-07-25 19:50:19

Need reliable notary services? Look no further! BlackTie Notary offers professional, efficient, and secure notarization solutions. Visit us now!

For More Details - https://www.blacktie-notary.com/
Call us @ +12818921149
Kaggle Coleridge 52nd Solution
Tags: kaggle, huggingface
Published: 2023-07-25 19:01:23

This article is translated from my Japanese tech blog.
https://tmyoda.hatenablog.com/entry/20210628/1624883322


## About the Coleridge Competition
https://www.kaggle.com/c/coleridgeinitiative-show-us-the-data

This is a Competition to predict the dataset names that are shown in academic papers. The only data provided is the text of the papers and GT.


## How I Split into the Dataset to the Validation
In this competition, there are about 130 dataset names (targets) in the training set, but the test set includes dataset names that do not appear in the training phase.

Therefore, it must be divided without any duplication of the dataset names. So, I implemented a BFS and divided it into an 8:2 ratio to avoid any duplication.

## Pipeline

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


### Classifier
This classifier worked better than I thought, and most of our team's top submissions included this classifier.

Just classify whether a dataset name exists or not.

### MLM

We almost re-use of the kernel below.
https://www.kaggle.com/tungmphung/coleridge-predict-with-masked-dataset-modeling


## Jaccard filter
This is also re-use of the kernel as well.
```python
def jaccard_filter(org_labels, threthold=0.75):
    assert isinstance(org_labels, list)

    filtered_labels = []
    for labels in org_labels:
        filtered = []

        for label in sorted(labels, key=len):
            label = clean_text(label)
            if len(filtered) == 0 or all(jaccard(label, got_label)
                                         < threthold for got_label in filtered):
                filtered.append(label)

        filtered_labels.append('|'.join(filtered))

    return filtered_labels

```
## What I tried

- Using DiceLoss, FocalLoss which is good at imbalanced data: The score decreased
- NER (Named Entity Recognition): It didn't seem to be effective
- SciBERT: No change
- Increasing external datasets csv: Extraneous strings were hit: decreasing the score
- Switching BERT to Electra: The score decreased
- Changing CONNECTION_TOKEN: The number of target documents increased, and the score decreased
- Beam search with k-fold: It was hard for us to run because of the time
TIL 3
Published: 2023-07-25 19:01:13

CSS Time

CSS Ruleset:
```
p{
   color:blue;
}
```
CSS inline style(used in html):
```
<p style='color:blue;'>Hello World!</p>
```
Style section(nested in header uses CSS Ruleset):
```
<head>
  <style>
     p {
      color: red;
      font-size: 20px;
     }
  </style>
</head>
```
Linking CSS file to HTML:
```
<link href='https://www.codecademy.com/stylesheets/style.css' rel='stylesheet'>
```
or
```
<link href='./style.css' rel='stylesheet'>
```
Building a Simple Calculator Bot with Discord.py - A Beginner's Guide
Published: 2023-07-25 18:56:57

**Step 1: Setting Up the Project:**

To get started, create a new directory for your project. Inside this directory, create a Python script (e.g., math_bot.py) using your preferred text editor. Now, let's begin coding the math bot.

**Step 2:** 

Installing Discord.py and Importing Modules:
In your Python script, start by importing the necessary modules:

`import math
import discord
from discord.ext import commands
import random
`

**Step 3: Creating the Bot and Math Functions:**

Next, create the Discord bot and define the math functions. The math functions will handle different arithmetic operations like addition, subtraction, multiplication, division, generating random numbers, and calculating square roots.


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

**Step 4: Defining Command Functions:**

Now, we'll define command functions that will allow users to perform math operations through Discord commands. For each operation, we'll calculate the result using the corresponding math function and send it back to the Discord channel.

@client.command()
async def mathadd(ctx, x: float, y: float):
    res = add(x, y)
    await ctx.send(res)

@client.command()
async def mathsub(ctx, x: float, y: float):
    res = sub(x, y)
    await ctx.send(res)

@client.command()
async def mathdiv(ctx, x: float, y: float):
    res = div(x, y)
    await ctx.send(res)

@client.command()
async def mathmul(ctx, x: float, y: float):
    res = mul(x, y)
    await ctx.send(res)

@client.command()
async def mathrandom(ctx, x: int, y: int):
    res = rando(x, y)
    await ctx.send(res)

@client.command()
async def mathsqrt(ctx, x: float):
    res = sqrt(x)
    await ctx.send(res)


**Step 5: Discord Bot Event and Running the Bot:**

Lastly, we'll add an event that will be triggered when the bot connects to the Discord server. In this event, we'll set the bot's presence status to "Watching Calculating."

@client.event
async def on_ready():
    await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name='Calculating'))
    print(f'{client.user.name} is online')

--Replace "YOUR_BOT_TOKEN" with your actual bot token from the Discord Developer Portal
client.run("YOUR_BOT_TOKEN")


##**Conclusion:**

Congratulations! You've successfully created a simple Discord bot capable of performing various math operations. Through this guide, you've learned how to use Python and the Discord.py library to interact with the Discord API, define commands, and handle user inputs. As you continue to explore bot development, you can expand upon this project, add error handling, and even integrate more advanced features to make your bot even more functional and interactive.

Remember to keep your bot token secure and refrain from sharing it with others, as it grants access to your bot's capabilities within the Discord ecosystem. Happy bot building!


The Code is available on the following link:

https://github.com/vanshaj8/Discord.py/blob/main/calculator.py
Maximizing PostgreSQL Efficiency: Unraveling the TOAST Mechanism for Large Data Management
Tags: postgres, apacheage, database
Published: 2023-07-25 18:44:06

PostgreSQL, a versatile open-source relational database, boasts a powerful feature called TOAST (The Oversized-Attribute Storage Technique). TOAST efficiently handles large data objects like text strings and binary data, ensuring optimal storage and retrieval performance. This article delves into the intricacies of PostgreSQL TOAST and its impact on efficient large data management.

## Understanding TOAST
TOAST is PostgreSQL's innovative solution to tackle large data attributes that could cause storage bloat and query slowdowns. It specifically addresses variable-length data types, where traditional storage approaches struggle to cope with sizable content.

## Data Types in TOAST's Scope
TOAST targets certain data types deemed "out of line," including TEXT, BYTEA, and VARCHAR, where attributes may exceed a predefined size threshold. These data types are automatically subjected to TOAST compression.

## How TOAST Compression Works
Upon inserting or updating a row with a large attribute, PostgreSQL evaluates its size. When surpassing the TOAST threshold (typically 2KB), TOAST compression comes into play. The system compresses and stores the data in a dedicated TOAST table, while the main table retains a compact representation.

## Out-of-Line Storage Strategy
In cases where compressed data still exceeds the TOAST table's capacity, PostgreSQL adopts "out-of-line" storage. This approach involves storing the large data elsewhere and retaining a pointer to it in the main table. Such an arrangement ensures the main table remains streamlined.

## Performance Gains
TOAST yields significant performance improvements. By compressing data and employing out-of-line storage, the storage overhead for large data is substantially reduced. This results in swifter data retrieval and superior query execution

## In Conclusion 
By skillfully compressing and storing data, TOAST ensures smooth performance and streamlined storage in PostgreSQL databases. Understanding the nuances of TOAST empowers developers and administrators to optimize their databases and unleash the full potential of PostgreSQL in diverse applications.
Welcome Bot for Discord: A Step-by-Step Code Explanation
Published: 2023-07-25 18:38:14

Discord is a popular platform for gamers and communities to communicate and share their interests. It provides a powerful API that allows developers to create their own bots and add exciting functionalities to their servers. In this article, we will walk you through the process of building a simple "Welcome Bot" for Discord using Python and the Discord.py library.

## **Prerequisites**

Before we begin, make sure you have the following installed:

**Python:** You can download Python from the official website (https://www.python.org/) and install it for your operating system.

**Discord.py:** To interact with the Discord API, we will use the Discord.py library. You can install it using the following pip command:

`pip install discord.py`

**Creating the Welcome Bot**

Let's start by creating our Welcome Bot using the provided code snippet. This bot will send a welcome message to a new member when they join the server and respond with "!HELLO" when someone says "hi."


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


##**Code Explanation**
Let's break down the code to understand its functionalities:

1. We start by importing the discord library, which is the core library for creating Discord bots in Python.

2. We create an instance of discord.Intents and enable the members intent. Intents are used to specify which events the bot can listen to, and in this case, we want to listen for new members joining the server.

3. We create the Discord client using discord.Client(intents=intents). The client is the main interface through which the bot interacts with the Discord API.

4. We define an on_ready() event, which is triggered when the bot successfully connects to Discord. Inside this event, we set the bot's presence to "Watching Over This Server."

5. The on_member_join(member) event is triggered when a new member joins the server. We use this event to send a welcome message to the your_channel_id channel in the your_server_id server. The member parameter represents the new member who joined the server.

6. Additionally, we send a direct message to the new member using member.send(), welcoming them to the server.

7. The on_message(message) event is triggered whenever a message is sent in any channel the bot has access to. In this case, if a user sends the message "hi," the bot responds with "!HELLO."

8. Finally, we run the bot by passing the token of the bot to client.run("Your token"). Replace "Your token" with the actual token obtained from the Discord Developer Portal after creating your bot application.

##**Conclusion**
Congratulations! You have successfully built a simple Welcome Bot for your Discord server using Python and the Discord.py library. This bot will greet new members and respond with "!HELLO" when someone says "hi." You can further enhance this bot by adding more features, customizing the welcome message, or implementing additional event handlers. Happy coding!
Why developers & testers don't fully test their software
Published: 2023-07-25 18:32:02

I've learned that developers/testers at some unconscious level don't stress test their product as much as the end users.

Passing integration and end to end tests are great but the real test is having the end users test it. They will take a hammer and screwdriver too their software. If it holds after their assault, that's a real testament to good code.

What's a good method for assuring your code is solid and well tested?

I'm glad you asked, here are the best things you can do:

- TDD, use test driven development, it may seem counterintuitive or strange at first but once you get used to it it works really nicely
- Use Typescript, this will make your code very maintainable and type checking will work wonders for your development team
- in addition to performing integration tests, perform UAT tests and iterate over client feedback

UAT (user acceptance tests) will really bring to light, issues with the UX or UI, from a different perspective, but most importantly it helps your end clients decide for themselves if the product meets their business needs.

From a business perspective, it's about giving them that power and the satisfaction that you created an application that meets their every needs!
Test post for new member
Tags: beginners, indianexporter, metalwallart
Published: 2023-07-25 18:26:15

This is a test post. I can add images. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vc3dp18dltgjmewwhhyh.jpg)
I can also give hyperlinks. [Indian exporter of home decor](https://dhiman.org/home-decor-exporters-in-india/
).
Can someone Help?
Tags: tradeshow, automation, webdev
Published: 2023-07-25 18:21:14

Hi there!
I've started export business in India as an [Indian exporter](https://dhiman.org/). Have created this website on WordPress. 
I am creating a list of all the [decor trade shows](https://dhiman.org/home-decor-expo/
) globally, but now I'm doing it manually. Can someone suggest me something to automate the process. How can I scrape the data of all the expo and trade show website with least coding.
Introduce My Project | Outreachy Internship | QEMU
Published: 2023-07-25 17:59:36

If you're interested in improving the efficiency of programs running under QEMU, my project may be of interest to you. QEMU's user mode translation can slow down standard library functions that rely on optimization for the guest architecture. My project implements "native library bypass" to overcome this issue.

The basic idea is simple: for library functions with well-defined semantics, we can implement them natively instead of translating them. Memory-related and string functions tend to see the most performance gains from this approach.

To achieve native library bypass, I created a shared library containing native implementations of the targeted functions. Using the LD_PRELOAD environment variable, this library is loaded preferentially, overriding the default library functions. During translation, QEMU detects special instructions in the native functions and executes the corresponding native functions instead.

This approach allows functions to run natively, avoiding the performance overhead of translation. However, it requires identifying functions that are good candidates for optimization and encoding enough information for QEMU to properly translate the native functions.

I hope this summary provides a useful high-level overview of my project and sparks your interest in applying native optimization techniques within QEMU. Let me know if you have any other questions!
First React Project
Tags: webdev, beginners, jsx, react
Published: 2023-07-25 17:58:01

I've spent the past several months learning HTML, CSS, JavaScript, and how to use various things like Git and VS code and I've spent time sharpening those skills to get to this point!

I started tackling React a few days ago, learning through a course expertly taught by Scrimba. I was able to complete my first React project this morning and I'm super excited to continue along this path!



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