teleren/devto huggingface dataset:
Creational Design Patterns
Tags: java, design, designpatterns, programming
Published: 2023-10-14 17:56:11

Creational design patterns are a category of design patterns in software development that deal with the process of object creation. They provide ways to create objects in a manner that is more flexible, controlled, and efficient. Here's a list of all the creational design patterns:

1. **Singleton Pattern:**
   - Purpose: Ensures that a class has only one instance and provides a global point of access to that instance.
   - Use Case: When you need to ensure that there is only one instance of a particular class in your application, such as a database connection or a configuration manager.

2. **Factory Method Pattern:**
   - Purpose: Defines an interface for creating objects but allows subclasses to alter the type of objects that will be created.
   - Use Case: When you want to delegate the responsibility of object creation to subclasses or when you need to create objects without specifying the exact class at compile time.

3. **Abstract Factory Pattern:**
   - Purpose: Provides an interface for creating families of related or dependent objects without specifying their concrete classes.
   - Use Case: When you need to ensure that a set of related objects (e.g., GUI components) are created consistently and work together.

4. **Builder Pattern:**
   - Purpose: Separates the construction of a complex object from its representation, allowing the same construction process to create different representations.
   - Use Case: When you need to create complex objects with many optional parts or configurations, and you want to keep the construction logic separate from the actual object.

5. **Prototype Pattern:**
   - Purpose: Creates new objects by copying an existing object (the prototype).
   - Use Case: When you need to create new objects that are similar to existing objects, and copying is more efficient than creating them from scratch.

These creational design patterns offer solutions to common problems related to object creation in software development. Novice developers can benefit from understanding these patterns because they provide structured approaches to managing object creation, leading to more maintainable and flexible code. The choice of which pattern to use depends on the specific requirements of your project and the problem you're trying to solve.

😍 If you enjoy the content, please 👍 like, 🔄 share, and 👣 follow for more updates!
Want to help with Cardboard? JS/TS Vanilla Reactive Framework
Tags: hacktoberfest23, typescript, javascript
Published: 2023-10-14 17:53:41


### Intro

What's up, I'm Manolo from Spain! I've been a professional developer for almost a decade. I've worked professionally for almost all that time. I'm now currently unemployed and have started to work on some side projects. 

I'm in the process of building [Cardboard](https://github.com/nombrekeff/cardboard-js) on my own, as a side project. 

It's a very simple, yet powerful reactive framework, to create web applications without the need to write any HTML. You don't need to build, use JSX, or compile. It works out of the box, and it's plain JS. Similar to [VanJS](https://vanjs.org/) in philosophy but with another flavour, and different features.

Cardboard provides most stuff other bigger frameworks offer:
Here is a list of some of the features it offers (_there more though_):
* **[showing/hiding elements]**: You can conditionally add and remove items from the DOM whenever a state changes.
* **[enabling/disabling elements]**:  enable and disable elements manually, or based on a state.
* **[add/remove classes]**: add and remove classes from elements manually, or based on a state.
* **[add/remove attributes]**: add and remove classes from elements manually, or based on a state.
* **[templates]**: It allows you to create text templates that interpolate some state values, and update whenever the state changes.
* **[custom reactions]**: If there isn't a built-in method that handles some reactions for you, there are methods that allow you to build your own.
* **[reusable components]**: You can create reusable components, like in any other framework.
* **[CSS in JS]**: You can create `style` tags, and write the CSS directly as a JS object.
* **Typed**: Cardboard aims to be 100% typed, meaning it will suggest any suggestable properties, methods, etc...(i.e. style `properties`, etc...)

**Here's a sneak peek**
```ts
const Counter = () => {
  let counter = state({ count: 0 });

  return button()
    .text(`Clicked $count times`, counter)
    .clicked((_) => counter.count++);
};

// Counter will be added to the body, as it's the attached tag.
attached().append(Counter());
```

That's just the peak of the iceberg, for a better vision of what it does, head over to the [repo](https://github.com/nombrekeff/cardboard-js) and check out the README and examples!

It's the first time I've shared a project in Hacktoberfest, but I thought that Cardboard could be a good candidate.


### Pledge
I would love to have some help with it, as I think it can be very powerful.

You can help me out in a couple of ways:
* Comment in this post and give me your feedback on Cardboard
* Go over to the [repo](https://github.com/nombrekeff/cardboard-js) and give it a star, so more people can find it!
* Test it and report bugs and feature requests!
* Help improve the docs and examples
* Open your IDE and start contributing to it. There are some issues open, but feel free to work on other stuff. Just drop a PR and we will take a look!


That's all! Hope to see you around. And happy coding :)
The magic of JWT tokens ✨
Tags: webdev, javascript, security, discuss
Published: 2023-10-14 17:36:13

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

How does a web app know you are authorized to use a resource or not after authentication?

That's where JWT tokens come into play ⚡️

Traditionally what used to happen?

When a client makes an authentication request (username/pass) to the server, the server stores the user info in the memory, generates an id which points to that location and sends that id as a session id (usually in browser cookies).

After that every time you request another resource, the browser verifies the session id and then sends a response.

Problems:

1. Traditional session IDs require server-side storage to maintain session state. This can be resource-intensive and challenging to scale in distributed systems.

2. CORS restrictions can make it difficult to share session IDs securely across different domains or APIs.

3. Since the information mapping to session id is stored in server, managing session state across multiple servers or instances can be complex.

How does JWT solve these problems? ⚡

Structure of a JWT token: [𝘏𝘌𝘈𝘋𝘌𝘙].[𝘗𝘈𝘠𝘓𝘖𝘈𝘋].[𝘚𝘐𝘎𝘕𝘈𝘛𝘜𝘙𝘌]

1. JWT tokens are stateless and contain all necessary information, like user roles and permissions, in the token itself. Servers can verify tokens without needing to store session information.

2. Since they contain all the info, they don't need to be stored on the server!

3. JWT tokens can be used as a standardized authentication mechanism, allowing users to access multiple services or APIs with a single token.

4. The signature is used to determine if the token was changed on the client's end.

- How is the signature made:
Algorithm: 𝘏𝘔𝘈𝘊𝘚𝘏𝘈256(𝘣𝘢𝘴𝘦64𝘜𝘳𝘭𝘌𝘯𝘤𝘰𝘥𝘦(𝘩𝘦𝘢𝘥𝘦𝘳𝘴) + "." + 𝘣𝘢𝘴𝘦64𝘜𝘳𝘭𝘌𝘯𝘤𝘰𝘥𝘦(𝘱𝘢𝘺𝘭𝘰𝘢𝘥), [𝘺𝘰𝘶𝘳_𝘴𝘦𝘤𝘳𝘦𝘵_𝘬𝘦𝘺]).

This is how the server validates the token, it decodes the `header` and `payload` and it uses the algo above to create the `new_signature` and then verifies the `new_signature` with the `signature` in the JWT token.

~ @prakharrai1609
Oracle Boot Camp 14 Aug 2023 - SlideDeck - DBCS and ExaCS
Tags: oci, oracle, oraclecloud, exadata
Published: 2023-10-14 17:26:03


Slide Deck for the contents of Oracle Boot Camp 14 Oct 2023

[https://github.com/abhilash-8/SlideDecks/blob/main/OracleBootCamp-14Oct2023.pdf]
Need Help with Free Programmers
Tags: programming
Published: 2023-10-14 17:04:01

Hi everyone,

I asked for help on the official forums for the Castle Game Engine, which I chose because all other 3D game engines I could find either required you to pay for them, didn't run at all or ran poorly on very old and slow machines with less than 2 GB of RAM, or lacked important features like particle systems or the ability to have separately animated multiple parts Quake 3 Arena style,

But got incredibly outrageous and contradictory responses, like "you shouldn't include two variables with the same name because it confuses the computer on which variable you are talking about when you use the name later on in the code" (which made sense to me as well),

but then immediately after "you have to include back the second variable cause otherwise the function doesn't know what variable you are talking about, despite me literally just telling you the opposite, and you're an idiot for not paying attention!"

So I figured it would be better to ask for help in a community like this.

I would like help with Castle Game Engine's language specifically, FreePascal, as well as I want the help
to be free and not paid, because I already know what
I am doing conceptually, like I know what a variable is or variable scope, or that you access
an object's properties using the dot like this . , it's just that I need help with very, very, small details that throw the whole program off like the example above.

Does anyone know who has the expertise whether they can kindly help?
Merging into Greatness: My DEV Contributor Badge Journey
Tags: hacktoberfest23
Published: 2023-10-14 16:42:37

Hello **DEV community**!

I'm Ishan, and I'm excited to share my achievement of the DEV Contributor Badge. Being a part of the DEV community and contributing to its repositories has been an enriching experience. It's not just a badge; it represents the collaboration, learning, and growth that comes from being actively engaged in a community-driven platform.

In this post, I'll talk about my journey of successfully merging a pull request into DEV's repositories. I'll discuss the project, the contributions made, and the impact it had on the larger community. Join me as I celebrate this achievement and encourage fellow developers to dive into the world of open source.

Thank you, DEV, for this opportunity, and here's to more contributions in the future!
Maintaining Momentum: My Hacktoberfest Maintainer Experience
Tags: hacktoberfest23, hacktoberfest
Published: 2023-10-14 16:41:27

Hey **DEV community**!

I'm Ishan, and I'm thrilled to have earned the Hacktoberfest 2023 Honored Maintainer Badge. Being a maintainer during this event was both challenging and rewarding. It taught me the importance of collaboration, communication, and the value of a strong open source community.

In this post, I'll share my journey of maintaining an active repository during Hacktoberfest 2023. I'll discuss the projects I managed, the amazing contributors I worked with, and the impact our collective efforts had on the open source ecosystem. Join me as I reflect on this experience and express my gratitude to everyone involved.

Let's continue to nurture the spirit of open source together!
Becoming a Honored Contributor: My Hacktoberfest Journey
Tags: hacktoberfest23
Published: 2023-10-14 16:40:45

Hello **DEV community**!

I'm Ishan, and I'm honored to have achieved the Hacktoberfest 2023 Honored Contributor Badge. This journey has been incredible, filled with challenges, learning, and most importantly, the joy of contributing to open source projects.

In this post, I'll be sharing my experiences of actively contributing during Hacktoberfest 2023. I'll talk about the projects I worked on, the hurdles I overcame, and the lessons I learned. Being a part of this vibrant community has been inspiring, and I can't wait to share my insights with all of you.

Thank you for the support, and here's to more open source contributions in the future!
My Hacktoberfest Pledge: A Journey into Open Source
Tags: hacktoberfest23, beginners, hacktoberfest
Published: 2023-10-14 16:39:05

Hey **DEV community**!

I'm Ishan, and I'm thrilled to be a part of Hacktoberfest 2023! I've taken the pledge to actively contribute to open source this October. As a software engineer passionate about creating meaningful projects, I believe in the power of collaboration and open source development.

In this post, I'll be sharing my Hackathon experiences and my goals for this Hacktoberfest. I'll be diving into the projects I plan to contribute to and the technologies I'm excited to work with. Join me on this journey as I embark on this exciting adventure of coding, learning, and giving back to the community!

Let's make Hacktoberfest 2023 memorable together!
how long does cabin air filter last
Published: 2023-10-14 16:34:08


The lifespan of a cabin air filter can vary depending on several factors, including the type of filter, the vehicle's usage, and the environmental conditions it's exposed to. In general, here are some guidelines for how long a cabin air filter typically lasts:
Mileage: Many experts recommend replacing your cabin air filter every 15,000 to 25,000 miles (24,000 to 40,000 kilometers). However, this can vary depending on your driving habits. If you frequently drive in dusty or polluted areas, you may need to replace it more often.
Time: If you don't drive your vehicle very often, it's still a good idea to replace the cabin air filter every 12 months or so. Over time, the filter can become clogged with dirt, dust, and other contaminants, even if you haven't driven many miles.
Environmental Conditions: If you live in an area with a lot of pollen, dust, or air pollution, your cabin air filter may become clogged more quickly. In such cases, you may need to replace it more often.
Filter Type: The type of cabin air filter you use can also affect its lifespan. Basic filters are typically made of paper or fabric, while higher-quality filters may be made of more durable materials and last longer.
Vehicle Specifics: Some vehicles have cabin air filters that are easier to access and replace than others. The ease of replacement can influence how often people are willing to change them.
It's important to consult your vehicle's owner's manual for specific recommendations on when to replace the cabin air filter, as the manufacturer may have their own guidelines. Additionally, regularly inspecting the filter can help you determine if it needs replacement sooner than the recommended intervals, especially if it appears visibly dirty or clogged. Replacing the cabin air filter on schedule can help maintain good air quality inside your vehicle and ensure that the HVAC system operates efficiently.
Click Here More Info: https://www.instantcarfix.com/services/cabin-air-filter
Hacktoberfest 2023: Uniting Coders, Celebrating Open Source, and Embracing Collaborative Brilliance!
Tags: hacktoberfest23, beginners, hacktoberfest
Published: 2023-10-14 16:32:26

Hello, **DEV Community**!

I'm Ishan, a passionate software engineer who finds joy in crafting meaningful code and contributing to the open-source community. I'm thrilled to be a part of the DEV platform and even more excited to participate in Hacktoberfest this year. The spirit of collaboration and the opportunity to give back to the open-source projects that have helped shape my skills are what motivated me to join this vibrant community.



While I may not be entirely new to coding, every day in the world of software development feels like an exciting journey. I've dabbled in various technologies, from React and Java to Python and Tailwind, each experience adding a new layer to my understanding of the vast coding universe. Hacktoberfest, with its celebration of open-source software, seemed like the perfect opportunity for me to dive deeper into the world of collaborative coding.



During this Hacktoberfest, my goal is twofold. As a contributor, I aim to refine my skills further, pushing my boundaries and learning from the talented developers within this community. I'm eager to take on challenges, tackle issues, and make meaningful contributions to projects that align with my interests.

Additionally, I'm open to stepping into the shoes of a maintainer. If you're working on an exciting open-source project and need an extra pair of hands, I'm here to help. Whether it's coding, documentation, or bug hunting, count me in! I believe in the power of shared knowledge and collaborative coding, and I'm enthusiastic about being a part of projects that make a difference.

This Hacktoberfest, I pledge to learn, to teach, and to collaborate. Let's make this month a celebration of not just code, but of the incredible community that stands behind it.

Feel free to connect with me and share your Hacktoberfest journey. Together, let's make this month memorable for all the right reasons!

Happy coding! 🚀✨
The AgeSQL Revolution: Unleashing the Power of Graph Data with PostgreSQL
Published: 2023-10-14 15:54:56

AgeSQL is a special computer tool that talks to PostgreSQL database. It's like a helpful friend for databases. Usually, databases understand commands in a language called SQL. But AgeSQL is extra special because it also understands a different language called Cypher.

Imagine AgeSQL as a tool that makes PostgreSQL even more powerful. It does this by using something called the Age extension, which helps it run special commands for working with graphs right inside the database.

Now, the main goal of AgeSQL is to be like another tool called psql, which people use a lot with PostgreSQL. AgeSQL wants to be just as good but also work smoothly with graphs. And it makes using Cypher commands in PostgreSQL easier.

To do this, AgeSQL faces a few challenges. First, it needs to figure out which graph you want to ask questions about. It's pretty smart and can handle different graphs based on what you tell it.

There are also challenges about what the answers look like. AgeSQL has to guess how many answers to expect and what type they are. Think of it like guessing how many cookies you'll get from a recipe.

All these challenges are important because they decide how well AgeSQL can understand and work with different types of commands. It's like making sure it speaks the right language to get the job done.

AgeSQL is like a language translator for databases. It joins Cypher and SQL together, so you can use both to talk to PostgreSQL. This makes it easy for people to explore and understand graph data using the familiar language of SQL while also using the special features of Cypher.

Here are some cool things AgeSQL can do:

**Blend Cypher In Smoothly:** AgeSQL mixes Cypher commands into PostgreSQL without any trouble. It handles both regular SQL and Cypher, making it easier for you to use.

**Run Cypher Commands Directly:** AgeSQL can execute Cypher commands right inside the PostgreSQL database. This lets you do things like follow paths in a graph or analyze complex graph patterns.

**Combine SQL and Cypher Powers:** AgeSQL brings together Cypher commands and regular SQL. It wraps Cypher commands in SQL language, making them work effortlessly in PostgreSQL.

**Graph Specialties:** AgeSQL is great at doing specific things for graphs, like moving between nodes and edges, getting properties, and doing detailed graph analysis.

**Easy for Users:** AgeSQL looks and feels a lot like psql, which many people are already used to. This makes it a friendly tool for anyone who wants to work with databases.

So, AgeSQL is a fantastic addition to PostgreSQL. It lets you use Cypher commands and gives you a powerful tool for exploring and studying data that follows a graph structure. It's like having a super-smart assistant for your database adventures!
Next.js Rendering
Tags: webdev, nextjs, react
Published: 2023-10-14 15:38:00

_Rendering = from code to HTML_

Next.js has three types of rendering:

1. Server-Side Rendering
2. Client-Side Rendering
3. Static Site Generation

These can be grouped into two categories: Pre-Rendering (Server-Side and Static site) and Client-Side Rendering.

Pre-rendering fetches the data and transforms the React components before the result is sent to the client (i.e. generates it in advance on a server). Whereas Client-Side Rendering does the process on the user's device.

Now what's the difference between the two types of Pre-rendering? Server-side rendering generates the HTML of the page **on a server for each request** and then sends it to the client. Static site generation also generates the page on a server however, content is generated **once and is stored then re-used for each request**.

So how do we decide which rendering method to use with Nextjs? Stay tuned for my next post!

Cheers,
Rosa
Asynchronous TCP server?
Tags: node
Published: 2023-10-14 15:31:22

I am trying to understand call stacks in Node.js. Or you could even stay in general because I don't really understand it at all. My question is, since Node.js is single threaded... will the function below be blocking or non-blocking? I am guessing its blocking. To make it non-blocking (I think) I have to assign the task to a worker thread by either adding it to a queue or by directly assigning it to a thread from thread pool.

Appreciate insight.

`const net = require('node:net');
const server = net.createServer((c) => {
  // 'connection' listener.
  console.log('client connected');
  c.on('data', () => {
    // do stuff like store in db, process, math, etc.
    // I think its blocking if done here. So child process maybe?
  });
});
server.on('error', (err) => {
  throw err;
});
server.listen(8124, () => {
  console.log('server bound');
}); `
Git - Use Aliases to Simplify Common Commands
Tags: git, programming, tutorial
Published: 2023-10-14 15:30:00

Git aliases allow you to create shortcuts for frequently used Git commands, making your Git workflow more efficient and saving you time. You can define aliases for complex or commonly used commands and even create custom abbreviations for your own convenience.

For example, you can create an alias to simplify the process of checking out a new branch and immediately switching to it:

```bash
git config --global alias.cb checkout -b
```

With this alias, you can now create and switch to a new branch in one command:

```bash
git cb new-feature
```

Here, `cb` is your custom alias for `checkout -b`, and `new-feature` is the new branch's name.

You can also define aliases for longer commands or workflows you use frequently, making your Git experience more user-friendly to your needs.

To list your current Git aliases, you can run:

```bash
git config --get-regexp alias
```

Using Git aliases can greatly improve your Git productivity by reducing the amount of typing and making your Git commands more intuitive and memorable.
Annotation/Handler driven REST API
Tags: lowcode, springboot, restapi
Published: 2023-10-14 15:27:52

Just a few lines of Annotation, would provide full fledged SQL Query Capabilities for your spring boot application.. 
Query capabilities to include - filter, order on any field (or limited fields) and pagination. 


Would you like to explore / validate the palmyra framework and influence the development..  please let us know in the comments.