teleren/devto huggingface dataset:
HOW TO GENERATE AWS IAM POLICY FOR AN S3 BUCKET
Published: 2023-08-10 08:07:31

Securely accessing cloud resources is one of the most critical requirements for IT teams. To achieve this, cloud administrators leverage web services that assist with managing access to cloud environments. 

**AWS Policy Generator** simplifies the process of creating policy documents for the Amazon Simple Queue Service (SQS), Amazon S3, VPC Endpoint Policy, the Amazon Simple Notification Service (SNS), and AWS Identity and Access Management (IAM).

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

Now, we are going to walk trough the AWS Policy Generator Service to Generate public access to an S3 Bucket called "mycanvapage".

First navigate to [AWS Policy Generator ](http://awspolicygen.s3.amazonaws.com/policygen.html). You will also have the link on your S3 Bucket Permissions Page.


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


There will be 3 steps to follow: 

**Step 1: Select Policy Type**: We are going to create an S3 bucket policy. Therefore, Select S3 Bucket Policy.

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

**Step 2: Add Statement(s)**: Effect will be "Allow". Click on Principal field and enter "*". 

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

Click "-- Select Actions --" dropdown.

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

Click on "GetObject"


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

Click on the "Amazon Resource Name (ARN)" field. You will find your ARN number in your S3 bucket Details. Enter your ARN number which is similar to _arn:aws:s3:::mycanvapage_ 


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


And Click on Add Statement 

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





**Step 3: Generate Policy** Now that the stament is ready Click on "Generate Policy"


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

Your policy will be generated:


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

You can now add your policy to your S3 Bucket and Save Changes.


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


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


Hope it was useful! See you in my next blog post!
Seasoned Software Engineer
Tags: hire, softwareengineering, react, nextjs
Published: 2023-08-10 08:06:04

## Hello Dev Community! 👋

I'm Jeffrey Nwankwo, a seasoned software engineer with over 5 years of extensive experience in developing, deploying, and managing intricate applications. My expertise lies in JavaScript technologies like React, Next.js, TypeScript, Node.js, and Express.js. However, that's not all – I've also mastered MongoDB and MySQL for robust data management, and I'm well-versed in Azure for cloud-powered solutions.

🔧 Technologies I Excel In:
- React
- Next.js
- TypeScript
- Node.js
- Express.js
- MongoDB
- MySQL
- Azure

💼 Throughout my career, I've deployed applications that cater to the needs of thousands of users. My projects aren't just about coding; they're about creating exceptional user experiences that make an impact.

🌐 As a passionate advocate of remote work, I'm actively seeking new opportunities to collaborate with diverse teams around the globe.

💬 My strong communication and leadership skills enable me to seamlessly collaborate and lead projects, ensuring the successful delivery of high-quality solutions.

🤖 Beyond coding, I have a deep-rooted love for robotics, where innovation meets technology in exciting ways.

🎬 On weekends, you'll find me immersed in a movie, enjoying my alone time and drawing inspiration from different stories.

Let's connect and drive innovation together! If you're looking for top-tier expertise in software engineering, I'm your go-to. Feel free to reach out and let's discuss how we can make great things happen. 🚀

Learn more at [https://www.jeffreynwankwo.com](https://www.jeffreynwankwo.com)
Kotlin Code Smell 27 - Protected Attributes
Tags: kotlin, codesmells, cleancode, programming
Published: 2023-08-11 07:27:28

---
title: Kotlin Code Smell 27 - Protected Attributes
published: true
date: 2023-08-10 08:00:09 UTC
tags: kotlin,codesmells,cleancode,programming
canonical_url: https://yonatankarp.com/kotlin-code-smell-27-protected-attributes
---

## Problem

- [**Sub-classification**](https://maximilianocontieri.com/code-smell-11-subclassification-for-code-reuse) for code reuse purposes.
- [**Liskov substitution**](https://en.wikipedia.org/wiki/Liskov_substitution_principle) violation ([**SOLID**](https://en.wikipedia.org/wiki/SOLID) principle).
- Possible subclass overrides.

## Solution

1. Favor composition
2. Avoid subclassifying attributes.
3. Extract behavior to separate objects.

## Sample Code

### Wrong

```kotlin
abstract class ElectronicDevice(protected val battery: Battery)

abstract class IDevice(
    battery: Battery,
    protected val operatingSystem: OperatingSystem
) : ElectronicDevice(battery)

class IPad(
    battery: Battery,
    ios: OperatingSystem
) : IDevice(battery, ios)

class IPhone(
    battery: Battery,
    ios: OperatingSystem,
    val phoneModule: PhoneModule
) : IDevice(battery, ios)

```

### Right

```kotlin
interface ElectronicDevice {
    //...
}

interface PhoneCommunication {
    //...
}

class IPad(
    private val battery: Battery,
    private val operatingSystem: OperatingSystem
) : ElectronicDevice {
    // Implement iPad-specific functionality here
}

class IPhone(
    private val battery: Battery,
    private val operatingSystem: OperatingSystem,
    private val phoneModule: PhoneModule
) : ElectronicDevice, PhoneCommunication {
    // Implement iPhone-specific functionality here
}

```

## Conclusion

Protected attributes are yet another tool we should use carefully. Every decision is a smell, and we should be very cautious with attributes and inheritance.

* * *

I hope you enjoyed this journey and learned something new. If you want to stay updated with my latest thoughts and ideas, feel free to register for my [**newsletter**](https://yonatankarp.com/newsletter). You can also find me on [**LinkedIn**](https://www.linkedin.com/in/yonatankarp/) or [**Twitter**](https://twitter.com/yonatan_karp). Let's stay connected and keep the conversation going!

* * *

## Credits

- [Code Smell 37 - Protected Attributes](https://maximilianocontieri.com/code-smell-37-protected-attributes) by [Maxi Contieri](https://hashnode.com/@mcsee)
C# da safe va unsafe code haqida
Tags: safecode, unsafecode, csharp, beginners
Published: 2023-08-10 07:49:16

Assalomu alekum do'stlar bugun sizlarga **C#** dasturlash tilida _safe_ va _unsafe_ codelarning farqini tushintirishga harakat qilaman.

Safe codga tarif:
**.Net** dasturlarini ishga tushiradigan virtual mashina bor uning nomi _CLR_ => Common Language Runtime deyiladi. Mana shu mashina orqali compile qilinadigan va execute qilinadigan jamiyki codelarni _safe code_ deyiladi.

Safe code ning bazi sifatlarini ko'rib chiqamiz.

- Safe code CLR tomonidan qo'yilgan cheklovlarga va 
   - Xotirani boshqarishdagi qoidalrga
   - tiplarning xafsizligi qoidalariga
   - exceptionlarni handl qilish qoidalariga
   - xafsizlik qoidalariga

amal qilishga majbur.
- Safe code .Net tomonidan qo'llab quvvatlanadigan barcha web dasturlar, mobil dasturlar, serverlarda ishga tusha oladi.
- Safe codelarni debug qilish va maintain qilish juda oson bo'ladi.
- Safe code shuningdek xatolardan qochishda ham qulay ular:
   - xotira isrofi
   - overflow
   - nul pointer

larda uchraydigan xatoliklar.
- Safe code muqobil va dasturchilar tomonidan tavsiya etiladigan code yozish usulidir.

Unsafe code ga tarif:
Unsafe code bu CLR tomonian boshqarib bo'lmaydigan lekin dasturchilar tomonidan boshqarsa bo'ladigan code hisoblanadi.

Unsafe code ning bazi sifatlarini ko'rib chiqamiz.

- Unsafe code _pointer_ dan foydalanib xotira bilan to'g'tidan to'g'ri ishlash imkoniyatini beradi. Shu o'rinda pointer =>
    - o'zgaruvchining address ini saqlaydigan o'zgaruvchidir.
- Unsafe code ham xotira bloklarini ajrata oladi va pointerga kerak bo'ladigan native funksiyalrni chaqirib ishlata oladi.
- Unsafe code bazi holatlarda safe code ga nisbatan tez va samarali bo'la oladi, jumladan low-level ma'lumotlar structurasida.
- Shuni ham unitmaslik kerakki unsafe code bazi risklarga olib kelishi mumkin.
   - xafsizlik
   - muqobillik
   - xotira buzilishi
   - crushlar
   - ma'lumotlar fosh bo'lishi
- Unsafe code faqatgina ishonchli environment larda ishga tushirilishi kerak.
- Unsafe code C# da **unsafe** modifier bilan yozilishi kerak.
- Unsafe code ehtiyotkorlik bilan va juda zarur bo'lgan holdagina ishlatilishi kerak.
[Digest] Java, Kotlin, Spring, Cloud, and More - Episode 7
Tags: digest, java, spring, cloud
Published: 2023-08-10 07:39:54

Hey folks, I'm back from the holiday, and here is what I have for you this time:

⛑️ [From Technical Debt to Technical Health with HealthCheck](https://mikaelvesavuori.medium.com/from-technical-debt-to-technical-health-with-healthcheck-3e7fdc132f58): how to move from the technical debt to the technical health and calculate it in numbers.

⚙️ [Hexagonal Architecture: What Is It? Why Should You Use It?](https://www.happycoders.eu/software-craftsmanship/hexagonal-architecture): a comprehensive overview of the Hexagonal Architecture - what is it and what pros and cons does it have.

🏗️ [Is Two-Step Initialization a Solution or a Symptom?](https://www.yegor256.com/2023/08/08/two-step-initialization.html): the author shows which issues may arise with two-phase object initialisation.

🌱 [Quick Guide on Loading Initial Data with Spring Boot](https://www.baeldung.com/spring-boot-data-sql-and-schema-sql): how to populate a database with data in a simple Spring Boot application that does not use Liquibase or Flyway.

🛠️ [JDBC Profiling with VisualVM](https://vladmihalcea.com/jdbc-profiling-visualvm/): how to find slow SQL queries and N+1 problems in your application with VisualVM.

---

*Dream your code, code your dream.*
VIM / NeoVim and the clipboard (in Linux)
Tags: neovim, vim, clipboard
Published: 2023-08-10 07:32:18

First check is your vim installation is enabled to access to the system clipboard.

```
:checkhealth
```

This show posible warnings like 

```
Clipboard (optional)
- WARNING No clipboard tool found. Clipboard registers ("+ and "*) will not work.
  - ADVICE:
    - :help clipboard
```
try to put in `~/.config/nvim/init.vim`

```
set clipboard=unnamedplus
```
If the clipboard still isn't working and your graphical environment uses Wayland, install:
wl-clipboard

```
sudo apt install wl-clipboard
```

At least in my case the clipboard between applications already works.

And remember, in VISUAL mode
`y` for copy
`p` for paste
Manager Handbook for Centralized AntDB-T - P2
Published: 2023-08-10 07:19:33

Manager Handbook for Centralized AntDB-T - P2
Error Troubleshooting
If starting patroni or stopping patroni service fails, please troubleshoot the error according to the log information in the log file.

```
# Patroni's logs are in the system logs. If there are issues, they can be investigated by checking the error logs.
tail -f /var/log/messages 

# check patroni logs：
sudo systemctl status patroni -l
sudo journalctl -f -u patroni
```
Cluster maintenance commands
We can do the following operations with the patronictl command for cluster maintenance and query.

```
Usage: patronictl [OPTIONS] COMMAND [ARGS]...

Options:
  -c, --config-file TEXT  Configuration file
  -d, --dcs TEXT          Use this DCS
  -k, --insecure          Allow connections to SSL sites without certs
  --help                  Show this message and exit.

Commands:
  configure    Create configuration file
  dsn          Generate a dsn for the provided member, defaults to a dsn of...
  edit-config  Edit cluster configuration
  failover     Failover to a replica
  flush        Flush scheduled events
  list         List the Patroni members for a given Patroni
  pause        Disable auto failover
  query        Query a Patroni PostgreSQL member
  reinit       Reinitialize cluster member
  reload       Reload cluster member configuration
  remove       Remove cluster from DCS
  restart      Restart cluster member
  resume     Resume auto failover
  scaffold     Create a structure for the cluster in DCS
  show-config  Show cluster configuration
  switchover   Switchover to a replica
  version      Output version of patronictl command or a running Patroni...
```
Status query
Centralized high availability supports checking the status of the whole cluster and confirming whether the cluster or individual hosts are running normally by querying the results. The command can be executed on any host in the cluster, and the result is the same.

```
#query the cluster status：
patronictl -c /etc/patroni.yml list

For example, after executing the following command, if it is found that all three nodes - Leader, Sync Standby, and Replica - exist in the cluster, and their states are running, it indicates that the cluster is in a normal state.。
adbpuq@adb06:~$ patronictl -c /etc/patroni.yml list
+----------+----------------------+--------------+---------+-----+-----------+
| Member   | Host                 | Role         | State   |  TL | Lag in MB |
+ Cluster: postgres-cluster (7174281124415946912) ---------+-----+-----------+
| pgnode01 | 192.168.10.101:55551 | Replica      | running | 188 |         0 |
| pgnode02 | 192.168.10.106:55551 | Sync Standby | running | 188 |         0 |
| pgnode03 | 192.168.10.103:55551 | Leader       | running | 188 |           |
+----------+----------------------+--------------+---------+-----+-----------+
```
Getting Started with the Vue Kanban Component
Tags: webdev, vue
Published: 2023-08-10 07:17:05

Learn how easily you can add the Syncfusion Kanban component to a Vue application. The Vue Kanban board is a task scheduling control that provides a clear user interface representation to manage multiple stages of work. 

This video demonstrates how to bind data to the Kanban component from local and remote data sources. It also shows you how to set a custom height and width, add a tooltip, enable swim lanes, and validate columns in the Kanban component. The Kanban board is widely used in real-time applications such as task scheduling, project management, software and product development, and manufacturing processes. 

Vue Kanban has a highly responsive layout and a finely optimized design for desktops, tablets, and smartphones. Users can bind data seamlessly with various local and remote data sources, such as JSON, RESTful services, OData services, and WCF services. Vue Kanban also loads data on demand to reduce transfer and load times. 

**Product overview**: https://www.syncfusion.com/vue-components/vue-kanban-board

**Example project**: https://github.com/SyncfusionExamples/getting-started-with-the-vue-kanban-component

{% youtube 4W5mUhEzYqY %}
Things to carry for a trip to Dharamshala in Himachal Pradesh?
Tags: hotel, resort, hotelandresort
Published: 2023-08-10 07:08:29

If you have a long-awaited plan to spend a holiday at Dharamshala in Himachal Pradesh as a solo traveller or with a group of friends, then hold on till the Winter season sets in. It will be an excellent time to explore the snow-clad hills of Himachal Pradesh and its scenic beauty. 

To make your journey convenient, book a [five-star hotel in Dharamshala](https://www.justahotels.com/justa-birding-dharamshala/). One such hotel with all modern amenities is jüSTa Birding Resort & Spa. It is the best mountain view hotel in Dharamshala. 

**Why visit Dharamshala?**

Apart from the scenic view of hills, stunning lakes, and sparkling waterfalls, Dharamshala is also famous for the abode of the spiritual saint Dalai Lama; you will see the blend of Tibetan and Kangra cultures. Apart from these, you can also visit colourful temples, museums, monasteries, and vintage forts. 

By finding a [hotel near Dharamshala stadium](https://www.justahotels.com/justa-birding-dharamshala/), it will be easy for you to visit Dharamshala cricket stadium and other city attractions, including Mall Road, McLeod Ganj, Indrunag Temple, Tea gardens, and other unexplored hidden gems. 

**What to carry for the Dharamshala trip?**

Before you embark on your journey to Dharamshala, better know what you must carry with you. 

- Walking shoes
- Extra pair of socks
- Gloves
- Thermal wears
- Rain jackets
- Hiking shoes
- Woollen caps
- Hot water bottle
- Power bank
- ID card
Improving Ruby on Rails Test Suite Performance by Disabling Animations
Tags: programming, tutorial, productivity, testing
Published: 2023-08-10 07:07:41

Have you ever encountered random failing tests using the Ruby on Rails system tests? If so, you may be surprised to learn that animations could be the culprit. We’ll explain why animations can cause random failing tests and how disabling them can improve test performance.

## Understanding the problem
Animations introduce an unpredictable timing factor that complicates test control. During testing, animations may take longer to finalize than anticipated, resulting in failures. This can frustrate developers trying to build reliable and efficient test suites.

In addition to driving failing tests, animations can also impact test performance. The playback time of an animation can add up throughout a test suite, leading to slower test execution times.

This can be a problem for teams that value quick feedback and continuous integration.

## Disabling animations in Ruby on Rails
Fortunately, disabling most of the animations in the Ruby on Rails test suite could be achieved by a minor layout update:

```html+ruby
<% if Rails.env.test? %>
  <script>
    $.fx.off = true
    $.ajaxSetup({ async: false })
  </script>

  <style>
    *, *::after, *::before {
      animation: none !important; /* 0*/
      animation-duration: 1ms !important; /* 1 */
      animation-delay: -1ms !important; /* 2 */
      animation-iteration-count: 1 !important; /* 3 */
      transition-duration: 1ms !important; /* 4 */
      transition-delay: -1ms !important; /* 5 */
    }
  </style>
<% end %>
```

> Those disabling animations might cause specific tests to fail if they hinge on animation timing. Nevertheless, these tests can be revamped to utilize alternate timing mechanisms such as sleep or wait.

## Benefits of disabling animations

Disabling animations can have several benefits for test suites. First and foremost, it can prevent random failing tests caused by animation timing.

Additionally, it can improve test performance by reducing the playback time of animations.

This can lead to faster test execution times and quicker feedback for developers.

## Conclusion

If you’re experiencing issues with failing tests or slow test execution times, we encourage you to try disabling animations in your test suites. With a little effort, you can create more reliable and efficient test suites that help you ship better code faster.

---

**Paul Keen** is an Open Source Contributor and a Chief Technology Officer at [JetThoughts](https://www.jetthoughts.com). Follow him on [LinkedIn](https://www.linkedin.com/in/paul-keen/) or [GitHub](https://github.com/pftg).

If you enjoyed this story, we recommend reading our [latest tech stories](https://jtway.co/latest) and [trending tech stories](https://jtway.co/trending).
What's an Achievement You Were Initially Nervous to Share?
Tags: codenewbie, beginners, discuss, career
Published: 2023-08-10 07:00:00

We all have moments of doubt, even when achieving something significant. Describe a coding accomplishment you were hesitant to share but ended up being proud of. How did you celebrate that achievement?

Follow the [CodeNewbie Org](https://dev.to/codenewbieteam) and [#codenewbie](https://dev.to/t/codenewbie) for more discussions and online camaraderie!

*{% embed* https://dev.to/codenewbieteam *%}*  

Image by <a href="https://www.freepik.com/free-vector/flat-hand-drawn-web-developers-illustration_12302679.htm#query=new%20coders&position=2&from_view=search&track=ais">Freepik</a>
Deploying AWS Load Balancer Controller In Elastic Kubernetes Service
Tags: aws, kubernetes, eks, microservices
Published: 2023-08-10 06:49:51

🚀 Excited to Share: Deploying AWS Load Balancer Controller in Kubernetes 🚀

Are you looking to enhance the performance and availability of your applications in a Kubernetes environment on AWS? Look no further! 🌐

In my latest article, I've put together a step-by-step guide on how to deploy the AWS Load Balancer Controller in your Kubernetes cluster. This controller is a game-changer when it comes to efficient load balancing, ensuring seamless user experiences and optimized resource utilization.

🔗 Read the full guide here: [Deploy AWS Load Balancer controller on Elastic Kubernetes Service](https://sofreview.vercel.app/posts/deploy-aws-load-balancer-controller-ingress-eks)

🔍 In this guide, you'll learn about:

📌 Prerequisites: Get your Kubernetes cluster and AWS IAM credentials in place to set the stage for successful deployment.

📌 Creating an IAM Role: Learn how to establish an IAM role to grant the controller the right permissions for managing AWS resources.

📌 Deploying the Controller: I walk you through using Helm to deploy the AWS Load Balancer Controller. It's simpler than you might think!

📌 Associating Load Balancers: Discover the crucial step of connecting your Load Balancers with Kubernetes services for effective traffic routing.

This guide is aimed at simplifying the deployment process and helping you harness the power of AWS Load Balancer Controller for your Kubernetes applications.

Make your Kubernetes workloads shine on AWS with this comprehensive guide. Let's navigate the world of load balancing together! 🌐🎉

👉 https://sofreview.vercel.app/posts/deploy-aws-load-balancer-controller-ingress-eks

#AWS #Kubernetes #LoadBalancing #CloudInfrastructure