teleren/devto huggingface dataset:
Reducing the cost of SSE-KMS with Amazon S3 Bucket Keys
Published: 2022-08-31 13:14:49


Encrypting objects in S3 buckets is one of the best security practices to date. However, encrypting can lead to additional costs when AWS Key Management Service (KMS) is used with S3 objects. And it may also impact S3 performance if your application communicates too often with KMS. What if you could reduce traffic between S3 and KMS and still get the benefits of KMS for your security compliance?

On December 1st 2020, AWS announced a new S3 bucket key feature for bucket encryption. By enabling it we can reduce the request costs of Amazon S3 server-side encryption (SSE) with AWS Key Management Service (KMS) by up to 99% by decreasing the request traffic from S3 to KMS without making changes to client applications. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9o80re9p78dapsh9pe54.png) Various applications, websites and mobile apps access millions of objects encrypted with SSE-KMS and this understandably generates large volumes of requests from S3 to AWS KMS. When we use SSE-KMS to protect data without an S3 Bucket Key, Amazon S3 uses an individual AWS KMS data key for every object. It makes a call to AWS KMS every time a request is made against a KMS-encrypted object.

By configuring an S3 Bucket Key for SSE-KMS on new objects, AWS KMS generates a bucket-level key that is used to create unique data keys for objects in the bucket. This key is used for a time-limited period within Amazon S3, reducing the need for Amazon S3 to make requests to AWS KMS to complete encryption operations. This reduces traffic from S3 to AWS KMS, allowing you to access AWS KMS-encrypted objects in S3 at a fraction of the previous cost.
We can enable the keys with no additional cost and it is available in all regions, allowing a cost saving potential for all customers.
**Before you enable an S3 Bucket Key**
When you enable an S3 bucket key, S3 uses the bucket Amazon Resource Name (ARN) as the encryption context instead of the object ARN. If you have IAM policies or AWS KMS key policies, use your object Amazon Resource Name (ARN) as the encryption context to refine or limit access to your AWS KMS CMKs, as these policies won’t work with an S3 Bucket Key. Again, these keys use the bucket ARN as encryption context. Before you enable an S3 Bucket Key, update your IAM policies or AWS KMS key policies to use your bucket ARN as encryption context.
**Enabling S3 Bucket Keys via AWS Console** 
We can use the AWS S3 Console to enable a bucket key for a new or existing bucket. In order to do so, go to your bucket and select Properties scroll down till Default Encryption.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/srygxwne7y5u2vq7eulv.png)
LIFE CYCLE OF ANGULAR COMPONENTS
Tags: javascript, beginners, webdev3, angular
Published: 2022-08-31 13:12:40


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


Let's discuss one by one

## Constructor()

-  It is called on component/directive Instantiation.
-  It also allows centralizing the dependency injections.

**YOU MUST AVOID SUBSCRIPTIONS IN CONSTRUCTOR**

## ngOnChanges

- It allows to set or reset data-bound input properties.
- You use it if you are using @input decorator in your component.


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

## ngOnInIt

- It is called once after the first ngOnChanges()
- It allows initializing the component/directive

**Here you can do subscriptions**

## ngDoCheck

-   Detect and act upon changes that Angular can't or won't 
    detect on its own.
-  It is called after every ngOnChanges and just after 
   ngOnInit() first run.

## ngAfterContentInit

- Respond after Angular projects external content into the 
  component's view, or into the view that a directive is in.
-  It's called once after ngDoCheck()
-  If you use @contentChild to get contentchild ,they are 
   initialized here.

## AfterContentCheckedMethod

- Respond after Angular checks the content projected into the 
  directive or component.
- It is same as ngDoCheck but for contentChild properties

## AfterViewInItMethod

- Respond after Angular initializes the component's views and 
 child views, or the view that contains the directive.
- It is called only once after first ngAfterContentChecked

## AfterViewCheckedMethod

- Respond after Angular checks the component's views and 
  child views, or the view that contains the directive.
- It is called after the ngAfterViewInit() and every 
  subsequent ngAfterContentChecked()

## OnDestroyMethod

- Cleanup just before Angular destroys the directive or component. Unsubscribe Observables and detach event handlers to avoid memory leaks.
- It is called immediately before Angular destroys the component/directives
SEED AND HASH PASSWORD IN MONGODB BASED APPLICATION
Tags: node, javascript, mongodb
Published: 2022-08-31 12:56:38

_Seeding is the process of providing an initial set of data to a database.

It is useful when we want to insert data into a database that we intend to develop in the future._


However, when seeding our password, we want it to be secure and not in plain text. Here is how to properly seed a database.


#### Stack: NodeJS, MongoDB, and Express

```javascript
// =====================SEED AND HASH PASSWORD========================================
const User = require('./models/models.user');
const mongoose = require('mongoose');
const bcrypt = require('bcrypt');

const connectDB = async () => {
  try {
    await mongoose.connect(process.env.MONGODB_URL);
    console.log('Connected to mongodb');
  } catch (error) {
    console.log(error);
  }
};

connectDB();

(async () => {
  let data = {
    name: 'Abraham Jujin',
    email: 'abe@gmail.com',
    password: 'abe1234',
    phoneNumber: '08168623107',
    role: 'admin',
  };
  let saltRounds = 10;
  let hashedPassword = await bcrypt.hash(data.password, saltRounds);

  data.password = hashedPassword;
  console.log(data.password);

  const seedDatabase = async () => {
    try {
      await User.deleteMany({});
      await User.insertMany(data);
      console.log('Seeding successful');
    } catch (error) {
      console.log(error);
    }
  };

  seedDatabase().then(() => {
    mongoose.connection.close();
  });
})();

```

Thanks for reading
Meteor Community survey 2022
Tags: javascript, meteor, survey
Published: 2022-08-31 12:45:35

September is here and it is time for another Meteor Community survey!

This year is probably the biggest and most advanced yet. Hopefully it is also the last one that takes place via Google forms and next year there will be enough time to build a dedicated survey similar to the [State of JS](https://stateofjs.com/). Fun fact those surveys are build with Meteor.

## So what has changed this year?

First the survey is split into 4 sections:

### Personal section
Just a slightly expanded section to get some basic information about you so that we can properly place your responses in the grand scheme of things.

### About Meteor itself
These questions focus on the basic questions about Meteor like "What front-end are you using" and this year expanded to include official resources like Documentation and Meteor University.

### Deployment
Similar to last year, this question focuses on running Meteor in production like where are you running your Meteor app, are you using APM and so on.

### Meteor Community Packages
The final section takes a look on stuff related to Meteor Community Packages to provide a feedback on which direction the community should be focusing in.

## New types of questions
There are new types of questions to rate satisfactions with different places of the Meteor ecosystem, resources and so on.

## Livestream
I will be filling the survey live, on a [livestream](https://youtu.be/bS3D6G1vQZ0) on September 15th! There I will give you some more details about why certain questions were asked and go into details about my answer, which will also include some Meteor history. I hope you will [join me](https://youtu.be/bS3D6G1vQZ0)!

## End date
Survey will close on 2nd October so that there is at least some time to get the initial results ready for [Meteor Impact](https://impact.meteor.com). So please share and let everyone know that this is happening!

## Results
As always the data will be cleaned of any identifiable data and open to public. First though you can expect a first look on the results at my [Impact talk about the survey](https://impact.meteor.com/meetings/virtual/ku9eMWE6sk2YXEweG). More details will come later with a full article. When? That will depend on how much time I will be able to put towards this.

# [Take the survey!](https://forms.gle/e4MqFVdsqGMcKzuG9)

PS: Sign-up for [Impact 2022](https://impact.meteor.com)!

--------
If you like my work, please support me on [GitHub Sponsors ❤️](https://github.com/sponsors/StorytellerCZ).
strange...
Published: 2022-08-31 12:35:11


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

anyways, yea this time im in it for good :)

Xent.fx 0.2 - September 22nd, 2022
Xent4Zig (not actually xent on the zig language that's too difficult but something else...) - 1st Quarter 2023.
A game.... 3rd Quarter 2023 (First Down is the hint)
Gri Portal
Published: 2022-08-31 12:30:31

[Gri Portal](https://www.griportal.com/) is a solution that enables businesses to view and track e-archive invoices from their business partners on a single platform.
Businesses can provide date range, company title, invoice number etc. on the portal. can filter e-archive invoices with filters. Users can either download the filtered e-archive invoices individually or export them in bulk in excel format.
Why Should You Contribute to Open Source? - Contributing to Open Source #1
Tags: opensource, codenewbie, beginners
Published: 2022-08-31 12:24:41

In this series of articles, I will share how you can be an open source contributor and make a career out of it.

I have been contributing to, building, and maintaining open source projects for the past three years. Everything I mention in this series is from my personal experience.

We will start the series by talking about _why_ you should contribute to open source.

Understanding the "why" is essential as you will spend your free time and a lot effort to contribute to open source projects. Without clear goals, you are likely to end up wasting your time.

So, here are some reasons why you should consider contributing to open source.

## Improve Your Skills

Learning new skills and improving existing ones is important if you are a student or a new developer.

While contributing to an open source project, you can implement your skills and improve them. You can learn from seasoned contributors in the community and have them review your contributions.

Even if you are not contributing code, you can improve other skills like writing, designing, managing, and more. There will always be a place for your talent in an open source project.

## Gain Real World Experience

You do not have to go through a whiteboard interview to contribute to an open source project.

If you are starting your career, you can contribute to an open source project and gain actual work experience. Instead of internships and boring jobs, work on top open source projects used by millions of people.

Also, you don't have to limit yourself to your city or country. You can choose to work on any open source project around the world, right from your home.

## Gain Recognition

Your contributions to open source is public. This means more people can see your work and recognize you for it.

Even if you don't become an open source superstar, building in public will do you good. What's better than hearing, "Oh, you are a contributor to ABC? I love ABC!".

## Build Your Network

Open source projects revolve around open source communities.

Being part of a community and contributing to a project is the best way to meet like-minded people and grow your network.

For your career, these networks can be game changers.

## Find New Opportunities

With improved skills, real-world experience, braggable contributions, and a solid network, more opportunities will find you.

You can continue to work in open source or showcase your open source contributions to recruiters. You can use your network to find jobs. And when they ask if you have experience, you can send them a link to your GitHub profile.

---

When working in open source, you are working with some of the smartest people, learning by looking through vetted lines of code, and contributing to something that a lot of people could use.

As open source projects become sustainable, working on one is turning out to be a stable career option. In the following article, you will learn how you can find a project to contribute to.
Computer Networking- Structure of the Network
Tags: beginners, productivity, computerscience, design
Published: 2022-08-31 12:19:53

## Introduction :page_with_curl:
The Structure of the Network basically tells us how do the things work internally.
It tells us about the protocols, the internal workings of an internet system, etc.

Let us take an example of a situation from our real lives.
For e.g:- you order something online.
Let us say that a person is living in India. He/She orders something from the US via an online shopping site.

How does the shipment of the order take place?

The online shopping site will send the ordered item to a delivery company in the US. It is now the duty of that delivery company to get the item transported from the ordered location (US here) to the destination (which is India here).

The delivery company's US branch will transport the ordered item from US to it's branch in India.
We can now say that the item has been **transported**. And the process is known as _**transportation**_.

After coming to the destination (India), the item will be handed over to the online shopping site's vendor, in the destination location, for delivery.

The online shopping site will then deliver the order to the person's doorstep.

Now the item is **received**.

![structure-of-the-network-anamika](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/po6b7mw1g8uizhsqfdj8.png)

The internet also follows a similar working system.

The layer from where we order and received the item, i.e, the layer from which a person is interacting is called the **Application Layer**.
E.g: WhatsApp
It is an application. Users interact with the app but how it works internally is not known to the users.

## Follow Up :zap:
This was just about the overall working of the internet. That is, the Structure of the Network. Here we have seen and understood how the Application Layer is different from the internal workings of the internet.
There are several other layers present inside the block, which works differently from the application layer(refer the diagram above).
There are different networking models which describes the architecture, components, and design used to establish communication between the source and destination systems

There exists predominantly two types of networking model-
* Open Systems Interconnection (OSI) Model.
* Transmission Control Protocol/Internet Protocol (TCP/IP) Model.

More light on these layers and models will be given in the upcoming posts. :bulb:
Thank you for reading :)
How many layers to fine-tune?
Published: 2022-08-31 12:06:51

Model fine-tuning allows you to improve the quality of the pre-trained models with just a fraction of the resources spent on training the original model.

But there is a trade-off between the number of layers you tune and the precision you get.

Using fewer layers allows for faster training with larger batch size, while more layers increase the model's capacity.

Qdrant team run experiments so you could make more educated choices.


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

Here are some highlights:

- Training only the head of a model (5% of weights) gives 2x boost on metrics, while full training gives only 3x.

- Training only a head layer allows using larger models with bigger batch sizes, compensating for the precision.

- If you only have a small dataset, full model tuning will give a more negligible effect

Read more in the [**article**](https://qdrant.tech/articles/embedding-recycler/) by Yusuf Sarıgöz.
Wednesday Links - Edition 2022-08-31
Tags: java, jvm, kafka, refactoring
Published: 2022-08-31 11:54:49

Defensive copying can sometimes be free (30 sec)🛡️
https://twitter.com/PMinborg/status/1562361122178711552

Confusing Java Strings (3 min)🤔
https://foojay.io/today/confusing-java-strings/

Local Class Improvements (2 min)🆙
https://inside.java/2022/08/22/sip065/

Null Keys and Values in Maps (10 min)🗺️
https://www.javaspecialists.eu/archive/Issue303-Null-Keys-and-Values-in-Maps.html

End-to-end tracing with OpenTelemetry (8 min)🔍
https://blog.frankel.ch/end-to-end-tracing-opentelemetry/

Testing Kafka Connectors (4 min)🔌
https://www.morling.dev/blog/testing-kafka-connectors/

Rollout Strategies with Feature Flags (10 min)🏁
https://reflectoring.io/rollout-strategies-with-feature-flags/

What is 'the Right' Amount of Refactoring? (1 min)🧹
https://blog.thecodewhisperer.com/permalink/what-is-the-right-amount-of-refactoring
Introduction to Python for Data Engineering
Tags: datascience, jupyter, python
Published: 2022-08-31 10:57:09

Python is one of the best programming languages for data analysis due to a variety of  packages e.g Pandas and Numpy, that enable its efficiency. 
For one to be an expert in data engineering,he or she needs knowledge in software development and data analysis.
Python works well with data analysis as Python code can be interpreted by Jupyter notebook.
For example, when trying to change a datatype of a column to integer data type
df['colName'].astype(int)
Data analysis is made easier through Jupyter notebook,an app that you can easily perform operations on data to get meaning from a collected dataset as it allows one to import packages.
One has to understand how Jupyter differs from Python data types.
Jupyter notebook stores strings as objects while python stores them as strings.
During data collection, it's advised to use API to get data and not web-scrapping. Reason being, with web scraping the underlying html structure can be changed and one cannot reproduce the same results on performing on the dataset.
To install python packages on any environment use "pip install package-name". To install any packages on a conda environment use "conda install package-name"
Uncino 🪝 Fast, tiny and solid hooks system for Javascript and NodeJS
Tags: javascript, node, opensource, github
Published: 2022-08-31 10:48:34

> Uncino is italian word for hook

[See on Github](https://github.com/riktar/uncino)

Do you know Wordpress hooks system? Uncino is a hooks system highly inspired to it!

- Async / Await support
- Node or Browser support
- Actions / Hooks system
- Easy to use
- No Dependencies

## Philosophy

Uncino permit to your code to interact/modify another piece of code at specific, pre-defined spots.

Uncino has two types of hooks: Actions and Hooks. To use either, you need to write a custom function, and then register for a specific action or hook.

Actions allow you to add data or change how your code operates. Actions will run at a specific point in the execution. Callback functions for Actions can perform some kind of a task, like echoing output to the user or inserting something into the database. Callback functions for an Action do not return anything back to the calling Action hook.

Hooks give you the ability to change data during the execution of your code. Callback functions for Filters will accept a variable, modify it, and return it. They are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. Filters expect to have something returned back to them.

With Uncino you can create your own hook spots so that other developers can extend and modify your code or you can create your pluggable core.

## Pull Requests?
I'd love them!

## Comments?
Let's hear them! (The nice ones please!)

## Me?
In case you're interested I'm @riktarweb
Data Structure Sketches
Tags: webdev, programming, beginners, tutorial
Published: 2022-08-31 10:31:39

Recently I launched the minimalistic online drawing app [okso.app](https://okso.app). I wanted it to be a place where people could do fast, ad-hoc, napkin-based-like explanations of any concept as if you are sitting with your friend and trying to explain him/her something during lunch. Don't ask me why it is needed, I was just experimenting.

> Btw, that's why the app name is "Ok! So...", because oftentimes these are the opening words after you pick up the pen and the piece of paper (or a whiteboard) and start drawing. I didn't see the study and the statistics of the opening phrases though, so I might be wrong here, here 😀

So, the first concept I've tried to explain with sketches was the Data Structures. Without further ado, here is the interactive ✍🏻 [Data Structure Sketches](https://okso.app/showcase/data-structures) showcase that you may play with.

![Data Structure Sketches](https://trekhleb.dev/okso-app/assets/demo/demo-12-showcase-data-structures-sm-x2.gif)

Here is a YouTube version of the GIF just in case:
{% embed https://www.youtube.com/watch?v=yaOWTOWOWGk %}

Of course, not all data structures are covered. And of course, this is not comprehensive material, but rather a cheatsheet that would create visual hints and associations for the following data structures:

- Linked List
- Doubly Linked List
- Queue
- Stack
- Hash Table (with hash collision resolution)
- Tree (including the Binary Search Tree)
- Heap (including Mean Heap and Max Heap)
- Trie
- Graph

Each box on the sketch is clickable, so you may dig into the data structure you're interested. For example `Heap → Max Heap`, or `Heap → Min Heap`, or `Heap → Array Representation`.

The sketches are split into so-called Pages just to make it easier to grasp them, so the users stay focused on one concept at a time, they see the relationship between the concept, and thus, hopefully, they are not getting overwhelmed with seeing a lot of information at the same time on one drawing/page.

Each page has a link to the source-code examples that are implementing the data structure on JavaScript.

Here are some examples of the sketches.

**Doubly Linked List**

![Doubly Linked List](https://trekhleb.dev/okso-app/assets/demo/demo-12-showcase-data-structures-02.png)

**Tree**

![Doubly Linked List](https://trekhleb.dev/okso-app/assets/demo/demo-12-showcase-data-structures-03.png)

**Hash Table**

![Doubly Linked List](https://trekhleb.dev/okso-app/assets/demo/demo-12-showcase-data-structures-05.png)

**Trie**

![Doubly Linked List](https://trekhleb.dev/okso-app/assets/demo/demo-12-showcase-data-structures-04.png)

**Graph**

![Doubly Linked List](https://trekhleb.dev/okso-app/assets/demo/demo-12-showcase-data-structures-06.png)

The full list you may find in the ✍🏻 [Data Structure Sketches](https://okso.app/showcase/data-structures) showcase.

I hope you find this showcase useful and I hope it will be a good visual cheatsheet-like complement to your data structure knowledge.