teleren/devto huggingface dataset:
Servlets & Filters - SpringSecurity
Tags: springsecurity, java, backend, codenewbie
Published: 2023-10-27 16:23:56



### Servlets

In Java web apps, Servlet container (web server) takes care of translating the HTTP messages for 
java code to understand. One of mostly used servlet container is Apache Tomcat.

Servlet Container converts the HTTP messages into ServletRequest and hand over to Servlet method as a parameter

Similarly, ServletResponse returns as an output to Servlet Container from Servlet. So everything we write inside the Java web apps are driven by Servlets

---

### Filters

Filters inside Java Web Applications can be used to intercept each request/response and do some pre-work before our business logic. So using the same filters, Spring Security enforce security based on our configurations inside a web application

---

### Spring Security Internal Flow


#### Spring Security Filters

A series of spring security filters intercept each request and work together to identify if authentication is required or not.

If authentication is required, accordingly navigate the user to login page or use the existing details stored during the initial authentication

#### Authentication
Filters like _UsernamePasswordAuthenticationFilter_ will extract username/password from HTTP request and prepare Authentication type object. Because Authentication is the core standard of storing authenticated user details inside Spring Security Framework

#### AuthenticationProvider
AuthenticationProviders has all the core logic of validating user details for authentication

#### UserDetailsManager/UserDetailsService
UserDetailsManager/UserDetailsService helps in retrieving, creating, updating, deleting the User details from the DB/storage systems

#### PasswordEncoder
Service interface that helps in encoding and hashing passwords. Otherwise we may have to live with plain text passwords

#### SecurityContext
Once the request has been authenticated, the Authentication will usually be stored in a thread-local SecurityContext managed by the SecurityContextHolder.

This helps during the upcoming requests from the same user

---


## Sequence Flow

 --> Request --> \[\<Authentication Filters> {AuthorizationFilter, DefaultLoginPageGeneratingFilter, UsernamePasswordAuthenticationFilter}] --> Extract User Credentials --> \[\<Authentication>{UsernamePasswordAuthenticationToken}] --> authenticate() --> \[\<AuthenticationManager>{ProviderManager}] --> authenticate() --> \[\<AuthenticationProvider>{DaoAuthenticationProvider}] --> loadUserByUsername() -->\[\<UserDetailsService>{InMemoryUserDetailsManager}] --> UserDetails -->  \[\<AuthenticationProvider>{DaoAuthenticationProvider}] --> Authentication --> \[\<AuthenticationManager>{ProviderManager}] --> Authentication --> \[\<Authentication>{UsernamePasswordAuthenticationToken} --> Authentication --> \[\<Authentication Filters> {AuthorizationFilter, DefaultLoginPageGeneratingFilter, UsernamePasswordAuthenticationFilter}]  --> Response
My third Pull Request in Hacktoberfest23
Tags: hacktoberfest, hacktoberfest23
Published: 2023-10-27 18:09:19

I have finished two PRs before, here is my third!
1. [My First Pull Request in Hacktoberfest23](https://dev.to/wanggithub0/my-first-pull-request-in-hacktoberfest23-34d5)
2. [My second hacktoberfest PR](https://dev.to/wanggithub0/my-second-hacktoberfest-pr-158a)

This time I worked on project [Klaw-docs](https://github.com/Aiven-Open/klaw-docs), which is a cool [project](https://www.klaw-project.io/) to handle Governance, Security and meta storage and it's Klaw Cluster API can handle the connections to the Apache Kafka, Apache Kafka Connect and Schema Registry servers.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vgtrcpqkpkepwnkifbpb.png)
 
I worked on the [issue](https://github.com/Aiven-Open/klaw-docs/issues/101) Update docs to use the term "API" correctly. First, the issue description is clear, I knew I should change all the "api" to "API", and I also learned they can use Vale config to get all the error places and I can check by using `npm run spell:error`. 

In order to finish this work, I also searched [Vale](https://github.com/errata-ai/vale) and get Vale is a powerful tool designed for spell checking and style enforcement in written content, including documentation, code, and more. It helps ensure that text is free of spelling errors and conforms to specific writing style guidelines, making your documentation and content more polished and professional. Vale can be a valuable asset in maintaining the quality and consistency of written materials, making it a useful addition to your writing and documentation toolkit.

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

After understanding these, I began to create the [PR](https://github.com/Aiven-Open/klaw-docs/pull/136) and add `API ("(?i)api")` from branding-warning-temp.yml to branding.yaml, and revised all the errors, I thought I have finished the issue, but author told me there were some file path which should not change and also add the backticks to ensure the directory and link. After author reviewing again, I still got an error, so I revised and push the third time. But I still got some errors after review. At last, I revised and push the forth time. 


Throughout the entire process, I learned about various other software tools, which significantly broadened my horizons. I also went through the process of updating my Pull Request (PR) four times. This experience taught me the importance of thinking comprehensively and paying attention to details. What truly touched me was the author's diligent reviews and their consistent encouragement and gratitude in each review. I learned a lot from this experience, not only about software development but also about the value of thoroughness and collaboration.
AdMob Banner Ads Impacting Android Vitals: Seeking Solutions and Alternatives
Tags: android
Published: 2023-10-27 20:07:45

We are encountering the following Android vitals issues:

- Slow warm start (4%)
- Excessive frozen frames (12%)

These issues are more prevalent on devices with xhdpi screen density (DPI).

We believe the root cause is the banner ads from AdMob. When we disabled the banner ads from AdMob, we noticed a decline in these issues.

I suspect that AdMob might be using the WebView component for rendering, which is known to be resource-intensive and can affect performance.

AdMob accounts for 50% of our total revenue, so disabling it entirely would have a significant impact on our earnings. However, we also recognize the importance of Android vitals for our app's ranking in the Google Play store.

Has anyone else experienced similar problems with AdMob? And would switching to native ads potentially address these concerns?

Thank you.
React Search Using-Debounce
Tags: javascript, react
Published: 2023-10-28 04:05:02

```js
import React from 'react'

class App extends React.PureComponent {
  state = {
    name: 'Zeeshan',
    todo: [],
    filteredTodo: [],
    query: '',
  }

  componentDidMount() {
    fetch('https://jsonplaceholder.typicode.com/todos')
      .then((resp) => {
        return resp.json()
      })
      .then((jsonResponse) => {
        this.setState({
          todo: jsonResponse,
          filteredTodo: jsonResponse,
        })
      })
  }

  debounceTodoSearch(func, delay) {
    let timer
    return function () {
      let context = this
      let args = arguments
      clearTimeout(timer)
      timer = setTimeout(() => {
        func.apply(context, args)
      }, delay)
    }
  }
  seachTodo = (val) => {
    let todoTemp = [...this.state.todo]
    let todos = todoTemp.filter((eachTodo) => eachTodo?.title.includes(val))
    this.setState({
      filteredTodo: todos,
    })
  }

  handleSearch = (event) => {
    let val = event?.target?.value
    this.setState({
      query: val,
    })
    this.debounceTodoSearch(this.seachTodo, 5000)(val)
  }

  render() {
    return (
      <>
        <div>
          Seach Todo
          <input
            type="text"
            value={this.state.query}
            onChange={this.handleSearch}
          />
        </div>
        <div>List of Todo's</div>
        <ul>
          {this.state.filteredTodo?.map((eachTodo) => {
            return <li key={eachTodo.id}>{eachTodo.title}</li>
          })}
        </ul>
      </>
    )
  }
}

export default App

```
Placeholder Contributor
Tags: hack23contributor
Published: 2023-10-28 08:49:38

<!-- ✨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? -->
how to improve logic building in programing
Published: 2023-10-28 17:58:19

 **Here are some tips on how to improve logic building in programming in JavaScript:**

- 
**Practice regularly.**
The more you practice, the better you will become at building logic. Try to set aside some time each day to practice coding, even if it's just for a few minutes.

- 
**Find good resources.**
There are many great resources available to help you learn how to improve your logic building skills. Books, websites, and even online courses can all be helpful.

- 
**Work on challenging problems.**
Once you have a basic understanding of logic building, start working on more challenging problems. This will help you to stretch your skills and learn new things.

- 
**Don't be afraid to ask for help.**
If you are struggling with a particular problem, don't be afraid to ask for help from a friend, mentor, or online forum.

- 
**Be patient**.
It takes time to develop strong logic building skills. Don't get discouraged if you don't see results immediately. Just keep practicing and you will eventually see improvement.
Here are some additional tips that may be helpful:

- 
**Break down problems into smaller steps.**
When you are faced with a large problem, try to break it down into smaller, more manageable steps. This will make it easier to solve the problem and less likely to make mistakes.

- 
**Use diagrams or flowcharts.**
Diagrams and flowcharts can be helpful for visualizing the logic of a program. This can be especially helpful for complex problems.

- 
**Test your code.**
Once you have written a program, be sure to test it thoroughly. This will help you to catch any errors or bugs before they cause problems.

- 
**Don't be afraid to experiment.**
Sometimes the best way to learn is by experimentation. Try different things and see what works best.
With practice and patience, you can improve your logic building skills and become a better programmer.

##
Hacktoberfest2023 - completion!
Tags: hacktoberfest, hacktoberfest23, opensource, hack23contributor
Published: 2023-10-29 19:02:45


And just like that..

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

Being a first time Hacktoberfest participant, I feel super proud of myself!
Just a few days back I shared my Hacktoberfest goal of submitting 2 valid PRs. To my surprise I was able to submit them very easily, so decided to keep going further!

Which led me here, having completed the challenge with 4 valid PRs!

[![An image of @aggarwaltanushree's Holopin badges, which is a link to view their full Holopin profile](https://holopin.me/aggarwaltanushree)](https://holopin.io/@aggarwaltanushree)

[Pull Request 1](https://github.com/inuad/movie-night/pull/4)
[Pull Request 2](https://github.com/Astha369/CPP_Problems/pull/97)
[Pull Request 3](https://github.com/Shariar-Hasan/QuoteVerse/pull/82)
[Pull Request 4](https://github.com/himanshu-03/Python-Data-Structures/pull/134)

While I may not have made a significant contribution to the opensource community with these PRs, this is just the beginning of my opensource journey!
I am already looking forward to participate in next year's Hacktoberfest and make some constructive contributions!
香港服务器的优势
Tags: webdev
Published: 2023-10-30 01:46:49

香港服务器的优势
1.免备案,免除繁琐的备案流程及长达半个月的备案等待时间
因为现在国内的虚拟主机市场查处很严格,而且还需要头疼国内备案等复杂手续。据互联先锋统计,近年大部分站长选择海外服务器的主要原因是国内ICP备案工作较为繁琐。
2.国际宽带,速度快,媲美国内主机
香港环球机房国际出口带宽充足,适合企业级外贸网站、邮件服务、数据交换等应用,语音视频应用之第一选择。对于企业级用户,如果客户仅仅是香港、台湾、日本、大陆客户,那么香港服务器无疑的最佳选择,因为香港大部分机房的香港服务器针对大中华区市场速度都较快。

3.速度快又稳定,对网站内容的限制相对宽松
我们非常认同香港主机与双线主机在中国的市场前景,目前海外主机运营商从技术、流程、服务上面讲做得相当好的几乎没有,同时,随着互联网的发展以及国内从事国际业务的企业需求膨胀,海外虚拟主机市场将迎来爆炸式的发展,我们十分看好这个市场,并对占有一席重要之地有充分的信心！
OAuth 2.0 - What is it?
Tags: security, webdev, beginners, programming
Published: 2023-10-30 10:05:44

OAuth is not as complicated as it sounds! 😅 Let's break it down in a fun and simple way so even beginners can grasp it.

**What is OAuth 2.0? 🤔**

OAuth 2.0 is like the VIP pass for your online accounts. It lets you share your Facebook pics, Twitter tweets, or Spotify playlists with other apps **without giving away your super-secret password.** 🤐

**Why is it Necessary? 🤷‍♀️**

Imagine you have a cool fitness app 🏋️‍♀️ that wants to post your workout achievements on your Facebook. Without OAuth, you'd have to give your fitness app your Facebook login and password 😱. That's a big NO-NO for security!

OAuth 2.0 solves this problem by acting like a bouncer at the club. It keeps your password safe and only lets in the app you choose, **just for the things you want to share**. 🤗

**Where is OAuth 2.0 Used? 🌐**

1. **Social Media Login**: You've seen those "Log in with Google" or "Sign in with Facebook" buttons? That's OAuth 2.0 at work. No need to create new accounts everywhere.

2. **API Access**: Many apps use OAuth to let you access their data or services, like your favorite weather app fetching data from a weather website.

3. **Mobile Apps**: If you use apps on your phone, chances are they're using OAuth behind the scenes to connect to your other accounts.

**How Does OAuth 2.0 Work? 🕵️‍♂️**

Let's use the example of your fitness app and Facebook:

1. You open your fitness app and click on "Share on Facebook."

2. The app says, "Hey, I want to share your workouts on Facebook."

3. Facebook, like a vigilant gatekeeper 🛡️, asks you, "Are you cool with this fitness app sharing your data?"

4. You say, "Sure, I trust my fitness app."

5. Facebook gives the fitness app a special token. This token is like a one-time access card to post on your behalf. It's not your password, and it can't be used to log in.

6. The fitness app uses this token to post your achievements on Facebook.

**Why Is OAuth 2.0 Important? 🌟**

- **Security**: Your passwords stay locked in a vault. No more sharing them with every app you use. 🔐

- **Convenience**: Easier access to your favorite apps. No more remembering a zillion passwords. 🤯

- **Control**: You decide what data you want to share and with whom. Your data, your rules! 🙌

So, there you have it! OAuth 2.0 makes your online life simpler, safer, and more connected. Next time you see "Log in with..." or "Authorize this app," you'll know what's going on behind the scenes. 

Follow me for more such content:
LinkedIn: https://www.linkedin.com/in/shameeluddin/
Github: https://github.com/Shameel123
16. Sleep and Coding Productivity (Day 14)
Published: 2023-10-30 09:39:49

Monday, Day 14 of my study journey, took an unexpected turn – I didn't study at all. But don't worry; I'm not here to make excuses. We all have days when we can't bring ourselves to hit the books, and today was one of those days for me. So, why did I skip my study session on Monday? Let's get into it.

**The Daily Grind Takes Its Toll**

To put it simply, I had an exceptionally busy day at work. The demands of my job left me feeling drained and exhausted. Even worse, I hadn't enjoyed a good night's sleep the previous night, which only exacerbated my fatigue.

It's no secret that sleep is essential for our overall well-being and productivity. Experts recommend getting at least 8 hours of sleep a night and for a good reason. Sleep allows our bodies to recover and recharge, preparing us for the challenges of the day ahead. When we're well-rested, we have more energy and are better equipped to tackle life's adventures.

**The Connection Between Sleep and Productivity**

Whether you're working a demanding job or tackling a complex coding project, your mental faculties play a pivotal role in your success. Sleep is a critical factor in maintaining mental acuity, focus, and creativity. When we don't get enough rest, our cognitive functions suffer. This can lead to a decrease in productivity and a lower quality of work.

If you're a coder like me (even a beginner!), you know just how mentally taxing the work can be. Solving intricate problems, debugging, and writing clean, efficient code all require intense mental effort. When you're fatigued due to insufficient sleep, you're not doing yourself or your projects any favors.

**Balancing Work and Play**

In my case, the choice to skip a day of studying was more about self-care than procrastination. I recognized that pushing myself on a day when I was exhausted wouldn't yield the results I wanted. It's crucial to understand your body's needs and listen to them. On days when you're feeling especially drained, it might be more productive to focus on rest and self-care, allowing your body and mind to recover.

So, what's the takeaway here? Eat well, rest well, play well, and code well! Remember, taking care of yourself, including getting enough sleep, is an integral part of maintaining your productivity and achieving your goals. As much as we want to power through our to-do lists every day, there are times when our bodies need a break. Recognizing and respecting those moments can make all the difference in the long run.

**Conclusion**

We all have off days, and that's perfectly normal. What's important is how we respond to them. Prioritizing self-care and understanding the link between sleep and productivity is a critical step in ensuring our long-term success. So, if you ever find yourself in a similar situation, don't be too hard on yourself. Instead, take a step back, get some rest, and come back refreshed and ready to tackle your goals with renewed vigor.
Hotel room reservations in Pearl, MS
Tags: hotelpearlms, roominpearlms, roomreservationpearlms, luxuryhotelspearlmississippi
Published: 2023-10-30 10:37:15

The [hotel room reservations in Pearl, MS](https://fairfieldpearl.com/), have just been kicked up a notch because Fairfield has come to elevate the luxury level. When you reserve your spot with us, you experience the epitome of abundance. So, let us spot you for this and all the other trips to this city.
Understanding Web Accessibility
Tags: webdev, opensource, frontend, a11y
Published: 2023-10-30 14:58:13

In our digital age, the internet is essential for basically everything we do, from shopping, learning, and connecting. But what if it's not open to everyone? Web accessibility is all about making sure that everyone can use the web, no matter their abilities. In this article, I’ll discuss about understanding web accessibility and how to make the digital world more inclusive.

## Understanding Accessibility: The Basics
Accessibility is about designing and developing websites and applications in a way that everyone can perceive, navigate, and interact with them. This includes individuals with disabilities, such as visual, auditory, motor, or cognitive impairments. Accessibility is not just a rule; it's a matter of inclusion and respect for all users.

### The Importance of Color Contrast
One fundamental aspect of web accessibility is color contrast. It may seem like a small detail, but the choice of colors can greatly impact the readability of web content. Ensuring that text has sufficient contrast against its background is essential. For instance, if you've ever adjusted text colors to ensure readability, you're practicing web accessibility. Remember that not everyone has perfect vision, and color choices matter.

### Basic Accessibility Features
Here are some basic accessibility features I consider when developing websites to ensure inclusivity:
1. **Alt Text for Images:** I always ensure to add alternative text (alt text) for images to convey their content to users who are visually impaired.
2. **Semantic HTML:** Using semantic HTML tags like headings, lists, and paragraphs to structure my content for screen readers and other assistive technologies.
3. **Keyboard Navigation:** Ensuring that all interactive elements can be navigated and activated using a keyboard for users who cannot use a mouse.
4. **Color Contrast:** I also maintain a sufficient color contrast between text and its background to make text readable for users with visual impairments.
5. **Responsive Design:** I take responsiveness really important as not everyone has access to laptops, so I ensure the website is mobile-friendly responsive and adaptable to different devices and screen sizes, benefiting users with various assistive devices.

### How I Practice Web Accessibility
To improve color contrast, I do the following:
1. I use online tools to check my design's colors.
2. Pick colors that follow accessibility guidelines.
3. Ask people with vision issues to test my website.

### The Impact of Accessibility
Web accessibility is about making a web for everyone, not just a few. When we design with accessibility in mind, we create a digital space that welcomes everyone. This inclusive design benefits not only those with disabilities but also a broader audience. Improved accessibility leads to better user experiences, increased reach, and a positive brand image.


To wrap it up, don’t think of web accessibility as something trivial, It's a really important. We need to learn the basics, make simple changes, and welcome everyone to the digital world.
Will Google's $2 Billion Investment In Anthropic Be A Game-changer?
Published: 2023-10-30 16:03:52

Read the full news article [here](https://www.techdogs.com/tech-news/td-newsdesk/will-googles-2-billion-investment-in-anthropic-be-a-game-changer). 

Like what you read? Head to the [TechDogs ](https://www.techdogs.com/)homepage to find the latest tech content infused with drama and entertainment. We've got [Articles](https://www.techdogs.com/resource/td-articles), White Papers, Case Studies, Reports, [Videos](https://www.youtube.com/channel/UCZ0lgIRSVraU14O9bp3bMCQ), [News ](https://www.techdogs.com/resource/tech-news)and [Events & Webinars](https://www.techdogs.com/resource/events) - the complete lot to help you Know Your World of Technology.
Day 1: 100 Days Of Code Challenge
Published: 2023-10-30 17:09:51

Today I finished the Small Music Player Android App that I was working on. It has 5 buttons to play up to 5 songs, pause, reset and stop buttons too. 

> I want to make a Spotify clone in the future. 

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