teleren/devto huggingface dataset:
Relationships in Flask SQL-Alchemy
Published: 2023-10-20 13:18:47

## What is Flask SQL-alchemy?


Flask SQL-alchemy is an extension of Flask web framework that simplifies the integration of relational databases with Flask application. SQLAlchemy is a Object-Relational-Mapping (ORM) library for Python. With SQLAlchemy, you can define database models as Python classes, and extensions take care of translating these models into SQL commands for database operations. One of the key benefits is the ability to support multiple databases on the backend. Flask-SQLAlchemy also offers features like database migrations, session management, and query building that streamline the process of database development. In Flask-SQLAlchemy, relationships can be modeled between databases using SQLAlchemy’s ORM. Relationships between databases can be represented as one-to-one, one-to-many, and many-to-many.

## One-to-Many Relationship


In a one-to-many relationship, one record in the first table is associated with multiple records in the second table. For example, a simple blog application with two tables **‘User’** and **‘Post’**. A user can create multiple posts, but each post is associated with only one user.



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

In the example above, the **‘User’** class defines a **‘posts’** attribute using the **‘db.relationship’** function. This establishes the one-to-many relationship with the **‘Post’** class. 


## Many-to-Many Relationship


In a many to many relationship, records in both tables are related to multiple records between **‘Song’** and **‘Playlist’**. Where a song can be in multiple playlists and a playlist can have multiple songs. 



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


We define a **‘playlists’** attribute in the **‘Song’** class to establish the many-to-many relationship with the **‘Playlist’**. The **‘secondary’**  argument specifies the association table that connects the two classes. 

## One-to-One Relationship

In a one-to-one relationship, one record in the first table is related to one record on the second table and vice versa. For example, **‘User’** have exactly one **‘UserProfile’** where they have a one-to-one relationship.



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

In the **‘User’** class, we define a **‘profile’** attribute using the **‘db.relationship’**  function. To indicate that it’s a one-to-one relationship, we use the **‘uselist=False’**. The **‘backred’**  argument creates a virtual column name **‘user’** on the **‘UserProfile’** class, this allows access to the user associated with the profile.
event.target in React
Published: 2023-10-20 12:38:37

In React, using event.target is essential and will be used a lot through out your project. Event.target is used to access a DOM Element, for example this is done when a user clicks a button and when its clicked event.target would be the reference to that button element. You can also think of it as a detective that its job is to identify what element the user has taken action with. Once the detective knows what element the user has triggered it then can also get you information of what has changed in that element. For example if you have a text input, event.target will refer to the input field when the user starts typing text, but before you can see that information you need to call a event handler like onChange. So it can look something like this:

`<input type="text" onChange={handleInputChange} />`

You can either write all your code inside onChange but it is usually neater if you make a separate function to handle the onChange, especially if you plan to use it multiple times. Here is what the handleInputChange function would look like:

`function handleInputChange(event) {
  const input = event.target;
  const text = input.value;
  console.log("You typed:", text);
}
`
Here you can see that event.target is the input field and you can then access the text that the user has typed by getting the value. So we pass down the variable input and get the value with .value. The const variable text is the same as event.target.value, that's why we can then return text as the value of the input change. Understanding this crucial into making sure your app reacts the way you want it to.
Build like a chad🗿 #1.1
Tags: coding, cpp, math, gamedev
Published: 2023-10-20 13:08:03

So, i am starting a  small blog series on dev.to 
**BUILD LIKE A CHAD🗿 **
- Episode-1.1

So i wanted to create a physics engine in c++ from SCRATCH (*not Mit) so i wanted to create a physics engine .
*hard*
I .. had no idea how to start ?
So , i searched ... a lot ..(*for3days)
And planned to use a graphics library .
I heard about something called a graphics library (GL)

I downloaded SFML.. but (it failed badly) 
Idk why sfml files or something was not working properly .
So .. i deleted it.
*pain*
..
Then i downloaded SDL (*yeah)
It worked ..
BUT ,
Now What?
What should i do next ?
How do i start ?
Hoowow can a nub coder code a physics engine ???

I had many questions but 0 ideas to start .
So i downloaded an ebook to learn how to make a physics engine from scratch .. so now im reading it to start my project .
If you have any suggestions (pls i need them) you can help a junior code (*me) .
You may ask , but why i want to do this .... i have godot on my computer or i can use any other library , why i will create a physics engine .
So the answer is ........





I want 

I want to make it because im dont want to be a ideal programmer in the eyes of a mnc staff engineer who knows react, graphql, (*some fancy techs) 
I want to be a unique , independent , indie dev .
Who works at very low level , and build things from scratch(*not mit scratch)

I wnat to be a developer who's projects which are some library or frmework are used in big tech companies (*ooooooo thuglife)

..
So 






Help me






Join FreeDevs .... (*my community to be a independent developer)
Github: https://github.com/rudransh61 
FreeDevs : https://github.com/rudransh61/FreeDevs
Converting React CSS styles to CSS classes
Tags: react, css
Published: 2023-02-05 17:26:04

---
title: Converting React CSS styles to CSS classes
published: true
date: 2023-10-20 13:00:00 UTC
tags: ["react", "css"]
canonical_url: https://friendlyuser.github.io/posts/tech/css/how_to_convert_inline_jsx_styles_to_css_styles/
---


Converting React CSS styles to CSS classes is important for several reasons:

Separation of Concerns: By using CSS classes, the styling and layout of a React component can be separated from its functionality. This makes the code easier to maintain and update, as changes to the styling don't affect the component's behavior.

Reusability: CSS classes can be reused across multiple components, making it easier to maintain consistency in the appearance of a website or application.

Performance: Inlining styles in a React component can lead to slow performance, as the styles need to be recalculated every time the component is re-rendered. Using CSS classes instead can improve the performance, as the styles are cached by the browser.

Better Tooling: CSS class-based styles can be optimized and minified using tools such as CSS preprocessors and postprocessors, making the code more efficient and faster to load.

For example the following inline styles can be posted to chatgpt
```jsx
  border: "1px solid #fff",
  paddingRight: "4px",
  paddingLeft: "4px",
  paddingTop: "5px",
  paddingBottom: "5px",
  minWidth: "75px",
  backgroundColor: "white",
  boxShadow: "0 0 2px 0 rgba(0, 0, 0, 0.5)",
  fontSize: "14px",
  textAlign: "center",
```

Pasting that to chatgpt, it gives me this:

```css
.some-class {
  border: 1px solid #fff;
  padding-right: 4px;
  padding-left: 4px;
  padding-top: 5px;
  padding-bottom: 5px;
  min-width: 75px;
  background-color: white;
  box-shadow: 0 0 2px 0 rgba(0, 0, 0, 0.5);
  font-size: 14px;
  text-align: center;
}
```

This illustrates how simple it can be to build useful tools that boost developer productivity and make life easier for everyone.


In conclusion, converting React CSS styles to CSS classes is a best practice that can lead to better maintainability, performance, and overall organization of code.
The power of reduce : Counting letters frequencies.
Tags: javascript
Published: 2023-10-20 12:59:59

Reduce is certainly one the most powerfull method we have at our disposal.

Here is a way to count get letters frequencies: [Demo](https://flems.io/#0=N4IgZglgNgpgziAXAbVAOwIYFsZJAOgAsAXLKEAGhAGMB7NYmBvEAXwvW10QICsEqdBk2J4hcYgAIccOBgDmMSQF5JAHRAAVQhDiTdkjJIBuMAE4BPSXEK0zUmXMUa1aV+KmxijM3tWOFGHw4AAcoCGIACgByaIBKfEgoH0ioFQA+STSAQlVoyXy4gG5Xd3oJSTAzGABHAFcmaitVLx84fGqAEzrqGEjIjGpqCklqOrNqhjiMyWBXSUMh5DGJkQBdFUkBpZXJ4g2AHwPJAAZpgGpJAEZ5yWricbRF6hK0dlnWONK3NHFaWHwUFo8kiVVqDV+FjilBAcBgsGoxAg5TwVxOiAATBiALTok5sDggTA4PD4aiyGFCRjMHhsNasIA)

```js
const message = "This is a very short message"

const letters = message.split('').filter(l => l != ' ' );

const frequency = letters.reduce((acc, current) => {
  acc[current] = (acc[current] || 0) + 1
  return acc;
}, {})


console.log(frequency)
```
Unveiling Infosys Lex Certification Dumps: Access for Free
Published: 2023-10-20 12:54:53

In conclusion, Infosys Lex Certification is a pivotal milestone in your IT career. To succeed, it's essential to prepare comprehensively and utilize valuable resources like free Infosys Lex Certification dumps. By following <a href=" https://dumpsmedia.com/education/infosys-lex-certification-dumps-free/"> infosys lex certification dumps free </a> our guide, you'll be well on your way to dominating your certification exam and advancing your career in the software industry.
In the digital age, staying competitive and up-to-date in your field is crucial. Professionals are constantly seeking ways to enhance their skills, making certifications a significant aspect of career development. Among the most sought-after certifications is the Infosys Lex Certification, which offers immense value in the information technology and software industry. This article will delve into how you can obtain these certifications and explore valuable resources to help you succeed.
Unlocking Infosys Lex Certification: The Key to Your Success
What is Infosys Lex Certification?
Infosys Lex Certification is a prestigious recognition in the IT industry. It validates your expertise in various software technologies, ranging from programming languages to database management. Infosys, a global leader in consulting and technology services, offers this certification to <a href=" https://dumpsmedia.com/education/infosys-lex-certification-dumps-free/"> infosys lex certification dumps free </a> individuals who wish to showcase their proficiency in the software world.

Click Here For More Details>>>>>>>:https://dumpsmedia.com/education/infosys-lex-certification-dumps-free/
Taxi Dispatch Software Development Service By SpotnRides
Tags: taxidispatchsoftware, taxidispatchsystem, business, taxiservice
Published: 2023-10-20 12:35:05

Spotnrides, a specialized software development company with an experienced team, can create custom software solutions with **[taxi dispatch software](https://www.spotnrides.com/taxi-dispatch-software)** features a driver & passenger app. With our cloud-based taxi dispatching system, you can book & manage your fleets. Upgrade your taxi business with SpotnRides.


Visit: https://www.spotnrides.com/taxi-dispatch-software

Contact: hello@spotnrides.com

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/onvbl2vncpiln3psds33.jpg)
6. Git Configuration
Published: 2023-10-20 12:31:44

A slightly busy day at work, an intense fitness training workout (legs today!), [roasted some potatoes with cheese](https://unrecipes.net/23-roasted-cheesy-potatoes/), a virtual call with a web developer overseas, and then 2 hours of coding study.

This is what I accomplished today:

1. A GitHub account
2. Git Configuration
3. Configure SSH access to GitHub

And these too:
4. Practice command line arguments
5. Daily journaling

If you would like to read how I went about with 1-3, please check this post on my other blog:
https://emanoj.hashnode.dev/8-git-configuration
 
It's now 11:30 p.m., and I am sleepy. Tomorrow is a 4.5-hour of LIVE coding lectures!
On-Premises Employee Monitoring Software: Enhancing Workplace Oversight
Published: 2023-10-20 12:27:52

With this software, you gain real-time visibility into employee activities, ensuring that work is being carried out efficiently and securely within your organization. This user-friendly tool empowers you to monitor computer usage, track tasks, and even enhance data security by keeping a close watch on sensitive information.
Visit -
[https://www.workstatus.io/workforce-management/on-premise-teams-management](https://www.workstatus.io/workforce-management/on-premise-teams-management)
Hello everyone!!
Tags: welcome
Published: 2023-10-20 12:01:22

Hello everyone! 
This is Toni from Andalusia, Spain.
First and foremost, I must share that I have a deep appreciation for craft beer, absurd humor, and the beginnings of apocalyptic films. I studied philosophy a few years ago, but I've always been immersed in the tech world as well. Even during my philosophy studies, I had programmer friends who passed on their passion to me, and I've always been intrigued by this field. Currently, I'm in my second year of backend training and am eager to learn as much as I can from the community. Perhaps, if my expertise permits, or if there's a topic where I can be of assistance, I hope to contribute and be of help too. It's a pleasure to be here.
What was your win this week?
Tags: discuss, weeklyretro
Published: 2023-10-20 12:00:00

Hey peeps 🙌

Hope you all had a wonderful week.

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
- Watching scary movies 😱

---

![Zack Galifianakis flying through the sky with the caption, "Winning"](https://media.giphy.com/media/3ohryhNgUwwZyxgktq/giphy.gif)
Are Apple App Association Files Risky?
Tags: mobile, security, devops
Published: 2023-10-20 11:56:57

How do attackers choose which sites to hit?

They typically don’t. They use automated scanning tools to rip through a giant list of domains and do “subdomain enumeration” to find your servers and launch attacks against them. 

One way they do this is to look for [Apple App Association](https://developer.apple.com/documentation/xcode/supporting-associated-domains) files, which are files. Hosted on your website that indicates where/how deep linking into iOS apps is allowed or should happen. 

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

We found this in a [Wafris](https://wafris.org) report as the business operated only in the midwest but was repeatedly scanned by a 🇳🇱 Dutch server.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jlkrmj2topo2lhn97hem.png)
Hacktoberfest23: First Experience as a Project Maintainer
Tags: hack23maintainer, hacktoberfest23, hacktoberfest, opensource
Published: 2023-10-20 11:43:52

### Intro
This was my first time participating in hacktoberfest. After making 2 PRs in a repository that was excluded 😕 I decided to make one that would be easy for beginners and also adhere with the hacktoberfest guidelines 🙌

### Project
I created a repository to contain the solutions for the [CSES problemset](https://cses.fi/problemset) in any programming language for each problem 🌐
I wrote a long, decriptive readme so that everyone despite their experience can start contributing 🤗

### Growth
This really helped my documentation skills and also taught me how to write a good readme 💟 I took inspiration from a few other readme.md files and created my own version. This was a very simple project as it did not use any techstack and just needs a single file for contribution.
I resolve merge conflicts for the first time and that the whole month was really fun. 🍷💃
Newsletter Repost - OpenLampTech issue #101
Tags: php, mysql, webdev, programming
Published: 2023-10-20 11:41:03

SQL NULLs | Vim in Linux | Eloquent JOINs | Tough week for MariaDB. OpenLampTech is a content and media source for PHP, MySQL, and the LAMP stack.

---
Thanks so much for reading. Don’t miss out on the weekly OpenLampTech developer newsletter.

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

If you’re not already subscribed, grab [_**your free subscription**_](openlamptech.substack.com) today and join the community.

OpenLampTech has sponsorship opportunities for your brand, product, or service in the weekly newsletter. As an independent publication, collaboration is very affordable. Inquire by email at openlamptech@substack.com for more information on how you can reach the OpenLampTech readership.

I write about SQL, PHP, WordPress, and Shopify regularly on my technical blog, [Digital Owl’s Prose](joshuaotwell.com). Follow me there for similar content and be sure to sign up for my free weekly newsletter (and eBook), OpenLampTech, the newsletter for PHP/MySQL Developers. Thank you!
Hacktoberfest2023 Contributions
Tags: hack23contributor, hacktoberfest23, hacktoberfest, opensource
Published: 2023-10-20 11:15:30

### Intro
Hi everyone ✨
This was my 1st Hacktoberfest and I had a lot of fun 🎉
You can also check out my contributions on my [github account](https://github.com/pypimo) and even get to know about more hacktoberfest-accepted repositories!

### Growth
Since this was my first time contributing, I contributed to simple small projects. 👼 I used languages I was already familiar with, and used them to create something I hadn't done before like CSS Animations. 

### Highs and Lows
I really wanted to get a tree planted in my name so I quickly made my first PR on the first day of October, only to find that the repository was excluded from the challenge as it did not obey hacktoberfest's guidelines 😔

But I am glad I didn't give up 😊, made my 4PRs and was also among the first 50,000 participants to make the first PR 😎
 
Finding quality repositories and the ones that would match my skillset was challenging for sure 🏋️‍♀️. But at the end I had a lot of fun learning all this stuff and finally completing the challenge. 🎇🥂
Hacktoberfest2023 Pledge
Tags: opensource, beginners, hacktoberfest23, hacktoberfest
Published: 2023-10-20 10:57:19

Hello everyone!👋
I am Prapti, a coder based in India. 👩‍💻

**Background**
I am just beginning with opensource and this is my first time participating in Hacktoberfest! 💻

**Goals**
My goals for Hacktoberfest 2023 are:
1. To create a public repository for everyone to contribute to
2. Make 4PRs in 4 different public repositories that and complete the challenge 💪
GEPS Energy: A Leading Solar Panel Dealers in Kannur
Tags: solarkannur, solarpaneldealerskannur, solarservices, solarcompany
Published: 2023-10-20 10:23:42

GEPS Energy stands itself as a reputable and trustworthy supplier among **[solar panel dealers in Kannur](https://gepsenergy.com/blog/solar-panel-dealers-kannur.html)**. GEPS Energy has made a name for itself in the sector as a leader thanks to its many years of expertise and dedication to sustainability.

**Options & Customization for Solar Panels**
Customers can choose from a variety of solar panel alternatives from GEPS Energy to find the one that best suits their individual requirements. Their crew can create solar panels to match your needs, whether you're seeking for home or commercial solutions.
**
Quality Control and Warranties**
The continuous dedication to quality is one of GEPS Energy's distinguishing characteristics. The long-term protection of your investment is guaranteed by the strong warranties that come with all of their **[solar services.](https://gepsenergy.com/blog/solar-services-geps.html)**

**Installation Methodology**
The installation procedure is hassle-free thanks to GEPS Energy. Their team of professionals guarantees that the panels are installed effectively and safely, enabling you to quickly start receiving the benefits of solar energy.

**Cost savings and effectiveness**
Solar panel acquisition is a smart financial move. The initial cost is more than offset by substantial long-term electricity bill savings. The analysts at GEPS Energy can give you a thorough cost-benefit analysis that illustrates the considerable savings you can realize.

**Environmental Advantages**
Your choice of solar panels from GEPS Energy helps to keep the environment cleaner. By lowering greenhouse gas emissions, solar energy contributes to sustainability and the fight against climate change.

Installation Methodology
The installation procedure is hassle-free thanks to GEPS Energy. Their team of professionals guarantees that the panels are installed effectively and safely, enabling you to quickly start receiving the benefits of **[solar company](https://gepsenergy.com/blog/solar-services-mattanur.html)**.

Preservation and Assistance
To guarantee that your solar panels continue to operate at their peak efficiency, GEPS Energy offers routine maintenance and support services. This proactive strategy ensures continuous energy production.

Public Incentives
The government provides a number of incentives, such as tax breaks and subsidies, to encourage the use of solar panels. You can get help from GEPS Energy to take advantage of these advantages.

Reviews and testimonials from clients
GEPS Energy values having happy customers. Numerous satisfied customers who have reaped the rewards of having solar panels have left glowing reviews and testimonials online.
Placeholder Contributor
Tags: hack23contributor
Published: 2023-10-20 10:22:43

<!-- ✨This template is only meant to get your ideas going, so please feel free to write your own title, structure, and words! ✨ -->

### Intro
<!-- Share a bit about yourself as a contributor. Is this your first Hacktoberfest, or have you contributed to others? Feel free to embed your GitHub account by using {% embed LINK %} -->

### Highs and Lows
<!-- What were some of your biggest accomplishments or light-bulb moments this month? Did any problems come up that seemed impossible to fix? How did you adapt in those cases?  -->

### Growth
<!-- What was your skillset before Hacktoberfest 2023 and how did it improve? Have your learning or career goals changed since working on these new projects? -->
Constant Lag in CDC Pipeline (JDBC Sink Connector)
Tags: kafkaconnect, jdbc, debezium, help
Published: 2023-10-20 10:22:24

I  am running a CDC Pipeline (data streaming) with source DB as PostgreSQL (Debezium Source Connector) and target DB also PostgreSQL with JDBC Sink Connector reading data from Kafka. I am experiencing a constant lag around 40 messages. And publishing rate is 5 messages per second. I also a another JDBC Sink Connector running to a different PostgreSQL DB but lag is around 10 messages.

Even though i tried to modify the following properties still lag didn't reduced:

`max.poll.records=5000
max.poll.interval.ms=300000 
fetch.min.bytes=100000
fetch.max.wait.ms=500
fetch.min.bytes=100000
consumer.override.auto.commit.interval.ms=100
consumer.override.offset.flush.interval.ms=200
batch.size=4000`

How do i reduce the lag, so that pipeline works in real time or near real time?