teleren/devto huggingface dataset:
Sizing shards using time-based indices
Tags: sharding, elasticsearch
Published: 2023-02-01 11:41:36

This post lists a few advantages of making use of time-based indices (as well as [DataStreams](https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams.html)) in Elasticsearch.

1. [Increasing / Decreasing the number of shards becomes easy](#point-1)
2. [Helps to plan cluster capacity and growth size](#point-2)
3. [Easily determine optimum number of shards](#point-3)

##### 1. Increasing / Decreasing the number of shards becomes easy <a name="point-1"></a>
Say, an [index template] (https://www.elastic.co/guide/en/elasticsearch/reference/current/index-templates.html) that makes use of `day-wise` indices is configured with `1 shard` in index settings. In case the indexing rate is slow or the shard size becomes too large (> 40-50 GB), the index template can be easily modified to increase the `number_of_ shards` to `3` or `5` or `n`. And this gets effected from the **next day**. Similarly, if a day-wise index pattern is configured with more than required number of shards [oversharded](https://www.elastic.co/guide/en/elasticsearch/reference/current/size-your-shards.html), reducing the number of shares becomes pretty easy as it's just a matter of changing the template which would be effected next day (unless re-indexing is done).

##### 2. Helps to plan cluster capacity and [growth size] (https://www.elastic.co/blog/benchmarking-and-sizing-your-elasticsearch-cluster-for-logs-and-metrics) <a name="point-2"></a>
Let's say `100 events per second` flow into an Elasticsearch cluster and `each event` averages about `1 KB` in size. Thus, per day, there would be: 
`86400 seconds * 100 events/second = 8,640,000` events. 

Since each event averages about 1 KB, the total size of 8,640,000 events = `8,640,000 * 1 KB = 8,640,000 KB / (1024 * 1024) = ~8.24 GB`.

Thus, with a `day-wise index`, we could see that the day-wise index size would be `~9 GB per day` without any replicas. Considering 1 replica, the size per day would be `~18 GB` and size for `30 days` would be `~540 GB`. This helps with capacity planning and estimating cluster growth rate.

##### 3. Easily determine optimum number of shards <a name="point-3"></a>
With data set of about `9GB per day`, for a `day-wise index`, we could start by setting `"number_of_shards" : 1` in the [index template] (https://www.elastic.co/guide/en/elasticsearch/reference/current/index-templates.html) since each `primary shard` would be about 9 GB which is pretty reasonable for a single shard. Shards for `time-based` indices can be in the range of `10-50 GB` as mentioned [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/size-your-shards.html#shard-size-recommendation). With a bit of trial and error based on the daily ingestion rate, we can arrive at Optimum shard size that helps in stabilizing the cluster and boosting performance.
Recruiting IT Product Owner/Manager
Published: 2023-02-01 11:32:44

Would you like to build applications that will positively impact the health and fitness industry?
Our client is a high-tech company that provides a service that improves the daily health & life of customers in Germany.
We are looking for a Product Owner/Product Manager for the software & hardware stack for the product team in Berlin. Apply here 👇
https://hr-champ.com/it-product-owner-manager/
So far, so good !
Tags: istbq, qa, beginners
Published: 2023-02-01 11:26:43

So far, so good. The software testing bootcamp with QA is quite full on with a lot of self learning through digital content.

Saying that, right now, that suits me. We covered test cases in the live session. The differences between detailed, vague and no script was explored. 

I'm also planning to attend an event with 'Meetup' tonight. It's on current software testers' experiences. 

I've joined a weekly mindfulness arts and crafts session. This week I'm making a mosaic art piece. It's a great escape and break for me. 

Considering it's a Wednesday hump day, I'm feeling good !
Resolvendo problemas no HackerRank: Criando uma escadaria!
Tags: javascript, programming, beginners
Published: 2023-02-01 11:19:40

Continuando a série: _Resolvendo problemas no HackerRank_ , hoje nós trataremos de uma resolução que exige um pouco do cognitivo, você está preparado? Aliás,já existem alguns artigos anteriores que vale a pena dar uma olhada. Vamos iniciar!!!


**StairCase -**

Neste episódio , nos é pedido para fazer um problema de escada. COMO ASSIM? Com base em espaços e #, nós devemos fazer uma ordem decrescente onde sua base tem um valor específico, e seu início tem a menor razão.

Suponhamos que exista uma escada com valor _N_, e nesse _N_ se é guardado um valor 4.

Antes de iniciar a resolução desse problema, é prudente fazer uma análise do que precisamos fazer primeiro, antes de começar a escrever para o computador.

Por exemplo:

```
xxx#
xx##
x###
####    // Os x nesse caso representam a área vazia.
```
(Conseguimos ver as 4 posições de # e como elas devem ser executadas).

O que fazer então?

Vejamos a resolução que fiz:

```
function staircase(n) {
    // Write your code here, N agora valerá 6
    let result = '';
    const space = ' ';
    const hashtag = '#';

    for (let i = 1; i <= n; i++) {
    result += `${space.repeat(n - i)}${hashtag.repeat(i)}\n`;
  }
    console.log(result);
}
```

Nesse caso, separamos o que seria necessário pra executar esse código, declarando as variáveis `result`,`space`, e `hashtag`. Com base nisso, utilizamos o laço `for` e declaramos um index 'i', que começara com o valor 1 e que caso seja inferior ou igual ao valor de N( que sabemos que agora valerá 6), ele adicionará +1 ao index.

Logo após isso, chamamos a let result adicionando(+= e ++ tem diferença, enquanto o += adiciona a alguma coisa que virá posteriormente, ++ acrescenta +1), variável space.repeat pegando N,que vale 6 - i que é 1. Isso se repetirá e a cada repetição, o index i irá aumentar +1, enquanto ele não for igual a 6. E também utilizamos a var hashtag que irá repetir 1x a cada chamada.

Com isso, nosso resultado se dá como:

```
     #
    ##
   ###
  ####
 #####
######
```

Existem claro, soluções alternas a essa,encontrei uma que se assimila bastante a superior . Veja:

```
function staircase(n) {
    let s = '';
    for(let i=1; i<=n;i++){
        let blank = ' '.repeat(n-i);
        let star = '#'.repeat(i);
        s += blank + star + '\n'
    }
    console.log(s)
}
```
Assim finalizamos mais um desafio deste HackerRank. Até a próxima!!!
Our Journey In The Open Source World - event-versionator
Tags: javascript, typescript, opensource, github
Published: 2023-02-01 11:00:00

[Link to the repo](https://github.com/JointlyTech/event-versionator)

## What is it?

This is a library for versioning given events. It's used to
ensure that we are able to monitor the number of iterations of a given event and to
ensure that we can re-build the original order.

## How do I install it?

You can install it by using the following command:

```bash
npm install @jointly/event-versionator
```

## Tests

You can run the tests by using the following command:

```bash
npm test
```

## How does it work?

Just call the `getVersionedEvent` function with the event you want to version and it will return a new event with the versioning information.  
the function expects to receive an object with the following properties:

- `event` - the event you want to version
- `payload` - the payload of the event

The return value is an object with the following properties:

- `event` - the given event
- `version` - the version of the event
- `payload` - the payload of the event
- `createdAt` - the date when the specific event version was created

```js
const { getVersionedEvent } = require('@jointly/event-versionator');
getVersionedEvent({ event: 'ev1', payload: 'ev1-1' }); // { event: 'ev1', version: 1, payload: 'ev1-1', createdAt: '1970-01-01T14:00:00.000Z' }
getVersionedEvent({ event: 'ev1', payload: 'ev1-2' }); // { event: 'ev1', version: 2, payload: 'ev1-2', createdAt: '1970-01-01T14:00:03.123Z' }
getVersionedEvent({ event: 'ev1', payload: 'ev1-3' }); // { event: 'ev1', version: 3, payload: 'ev1-3', createdAt: '1970-01-01T14:00:06.246Z' }
getVersionedEvent({ event: 'ev2', payload: 'ev2-1' }); // { event: 'ev2', version: 1, payload: 'ev2-1', createdAt: '1970-01-01T14:00:09.369Z' }
getVersionedEvent({ event: 'ev2', payload: 'ev2-2' }); // { event: 'ev2', version: 2, payload: 'ev2-2', createdAt: '1970-01-01T14:00:12.492Z' }
```

## Other Info

You can also call the `getNextEventVersion` function to get the next version of a given event.  
By passing a `false` as the second argument, you can get the next version of the event without committing (saving it) in the function internal state.  
You can also call the `getNextEventVersion` passing the `EVENT_VERSIONING_RESET_STRING` exported constant as the first argument to reset the internal state of the function and consequently resetting all saved version values.
How redux and context helps managing global state
Tags: react, designpatterns, javascript, webdev
Published: 2023-02-01 10:39:01

_Why we need redux and react context to manage global states ?_
**Answer**: To avoid anti-pattern pitfall of singleton

_What is singleton?_
Singleton are classes instantiated once and used globally.

_For example:_

```
let click = 0;

class catchClick {
  getInstance() {
    return this;
  }

  incrementClick() {
    return ++click;
  }

  decrementClick() {
    return --click;
  }
}

const click1 = new catchClick();
const click2 = new catchClick();
```


Both weren't the same because of different reference points ! 

****Solution**: Freeze the object ** 

Introducing **Object.freeze()**

const singletonClick = Object.freeze(new catchClick());

This freezes the object and creates a single copy across all.

But, what if I am using catchClick in multiple places ? It will cause "hidden dependency". 

Basically, singleton pattern is of mutable state and can cause unknown behavior. Think about you are sending money from you account and also receiving money at the exact same split of millisecond and directly you are modifying the bank balance. Creates confusion right ?

**_So how redux and context is different ?_**
It may look like singleton (IMO) but also with read-only option which covers the mutable-state pitfall and in redux only reducer can update the state via action.

**End-note**: In order to avoid direct global state modification, we are using the readonly context and redux and they are amazing
Review my first Vue app
Tags: webdev, javascript, beginners, programming
Published: 2023-02-01 10:34:12

I was learning Vue.js and created my first project: [Dev Cards 360][1].

Dev Cards 360 is a web app that showcases your skills and weaknesses in an inventive and fun way. As you may have guessed, the main inspiration was Pokemon cards.

![Screenshot of Dev Cards 360.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bab16q9p8nswoyedvu0u.png)

My site's source code is publicly available, but I thought it would be easier to extract the code to a separate repository. So, here's the link in case you want to file an issue or open a pull request: https://github.com/maliMirkec/dev-cards.

I want to learn the correct way to build applications with Vue.js. Any suggestion or feedback would be highly appreciated.

_Remember that the project is made for entertaining and learning purposes and should be considered as such._

[1]: https://www.silvestar.codes/side-projects/dev-cards-360/
F/OSS Spotlight: 🧑‍💻 Zuul
Tags: ci, devops, codequality, opensource
Published: 2023-02-01 10:26:38

[Zuul](https://zuul-ci.org/) ([code](https://opendev.org/zuul/zuul/)) helps your team stop merging broken code -- the best kind of gatekeeping.

In a world where most people use GitHub Actions or GitLab CI (fantastic tools in their own right) and call it a day, there are enlightened beings out there who seek out CI systems that fully gatekeep commits alltogether. That's Zuul.

![Zuul Homepage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fhml639nr9yj62fbm8bl.png)

Zuul is used by huge organizations like Ampere, Redhat, OVHCloud, and OpenStack, and trusted by many more. Zuul even runs on Volvos, according to [an article from ZDNet](https://www.zdnet.com/article/10-years-of-zuul-continuous-integrationcontinuous-delivery-rises-to-new-successes/).

What's important is that Zuul gates your codebase, whereas other tools sometimes let faulty commits go through. Unfortunately there's a bit of a name collision with [Netflix Zuul gateway service](https://github.com/Netflix/zuul), but that's awesome F/OSS for another day.

If you're ready to give another CI system a try, check out Zuul.

This was [originally posted on AWSM FOSS](https://awsmfoss.com/zuul/)
[Tổng hợp] Những cách trị quầng thâm mắt đơn giản hiệu quả tại nhà
Published: 2023-02-01 10:13:47

Theo đó, bạn hoàn toàn có thể áp dụng các mẹo [trị thâm quầng mắt](https://nhathuoclongchau.com.vn/bai-viet/tong-hop-nhung-cach-tri-tham-quang-mat-tai-nha-don-gian-va-hieu-qua-51097.html) tại nhà vì đây đều là những phương pháp vừa đơn giản, vừa hiệu quả lại tiết kiệm chi phí đáng kể.

## Sử dụng lòng trắng trứng để trị quầng thâm mắt

Trong lòng trắng trứng có chứa rất nhiều **protein** và **vitamin** rất phù hợp cho việc chăm sóc da. Chính vì điều đó mà đã có rất nhiều người thường dùng trứng để loại bỏ những vết thâm quầng mắt. Bạn chỉ cần tách lấy phần lòng trắng của trứng rồi bôi lên vùng da ở dưới mắt. Để như vậy trong khoảng 5 phút sau đó dùng nước ấm để rửa lại là xong.

## Sử dụng thìa lạnh để trị thâm quầng mắt

Bạn hãy dùng một chiếc thìa được làm từ inox hoặc bằng chất liệu bạc và để trong tủ lạnh trong khoảng 5 đến 10 phút. Sau đó, bạn hãy lấy chiếc thìa này ra và để ở dưới vùng mắt bị quầng thâm. Bạn nhấn giữ thìa trong vòng khoảng 5 - 7 phút rồi dừng lại. Hãy duy trì cách làm này vào mỗi buổi sáng, bạn sẽ thấy kết quả rõ rệt chỉ sau một thời gian ngắn.

## Sử dụng trà túi lọc

Trà túi lọc thường có chứa một lượng lớn tannin. Đây là chất có tác dụng kháng khuẩn, hỗ trợ giảm quá trình oxy hóa đồng thời giúp da được săn chắc. Tannin tỏ ra rất hiệu quả trong việc giảm tình trạng thâm quầng mắt. Nếu sử dụng thường xuyên, bạn chắc chắn sẽ thấy các vết thâm quầng được cải thiện đáng kể, vùng da cũng sẽ trở nên sáng đẹp hơn.

Cách làm là bạn lấy 2 túi trà và đặt vào hai bên vùng da dưới mắt. Giữ như vậy trong khoảng 5 - 10 phút sau đó dùng nước ấm để rửa sạch lại.

## Dùng dưa chuột trị thâm quầng mắt

Dùng dưa chuột để chữa thâm quầng mắt là một công thức vô cùng đơn giản, dễ thực hiện. Trong dưa chuột có đến 95% là nước cùng với các loại vitamin khác như vitamin A, vitamin C và phytochemical. Nhờ các chất này mà tình trạng thâm quầng mắt sẽ được cải thiện đáng kể, bên cạnh đó còn giúp làn da sáng đẹp hơn.

## Trị thâm quầng mắt bằng quả bơ

Trong bơ có các chất chống oxy hóa có khả năng làm giảm thâm quầng mắt rất hiệu quả. Cách làm rất đơn giản, bạn chỉ cần cắt nhỏ một miếng bơ rồi nghiền nát ra. Sau đó, bạn bôi bơ lên vùng da ở dưới mắt rồi để trong khoảng 10 phút, sau đó dùng nước ấm để rửa sạch lại.

## Dùng đá lạnh

Bên cạnh tác dụng giải nhiệt trong những ngày hè thì đá lạnh cũng có tác dụng làm giảm những vết thâm quầng hiệu quả. Khi được tiếp xúc với vùng da dưới mắt, độ lạnh từ đá sẽ giúp da được làm dịu và loại bỏ những vi khuẩn có hại. Từ đó bạn sẽ thấy dễ chịu hơn.

Một mẹo nhỏ là để đạt hiệu quả cao hơn, bạn có thể dùng nước đá được làm từ sữa tươi và trà xanh thay vì nước đá làm từ nước lọc đơn thuần nhé.

Nguồn: [Nhà thuốc Long Châu](https://nhathuoclongchau.com.vn/)
Unlocking the Power of Operating Systems: A Guide to Understanding the Heart of Modern Computing
Tags: systems, computerscience
Published: 2023-02-01 10:00:00

Operating systems (OS) are the backbone of modern computing, providing the foundation for all software and applications to run on. Understanding operating systems is crucial for building robust, efficient, and user-friendly software and systems. In this article, we'll explore the importance of operating systems, how they affect other areas of computer science, and what they are.

---

First, let's talk about why operating systems are important. Operating systems provide a layer of abstraction between the hardware of a computer and the software that runs on it. This abstraction allows software to interact with the hardware in a consistent and predictable manner, regardless of the specific hardware being used. Operating systems also provide a wide range of services to software, such as managing memory, managing I/O operations, and managing processes and threads. Without operating systems, software would need to be written specifically for each different type of hardware, making it much more difficult to develop and run software on different computers.

Operating systems also play a crucial role in the security and performance of a system. Operating systems provide mechanisms for protecting the system and the data stored on it, such as file permissions, firewalls, and intrusion detection. Additionally, the way that an operating system manages resources such as memory and CPU can have a significant impact on the performance of a system.

In addition to its importance for individual systems, operating systems also affect other areas of computer science. For example, it is a key aspect of computer architecture, as the design of an operating system can have a significant impact on the performance and efficiency of a system. Operating systems also play a crucial role in distributed systems, where multiple machines work together to perform a task, and in embedded systems, where real-time requirements and limited resources make efficient operating system design critical.

## So, what are operating systems? 

Operating systems are the software that manages the hardware and software of a computer, providing a consistent and predictable interface for software to interact with the hardware. This includes managing memory, managing I/O operations, and managing processes and threads. It also provides a wide range of services to software, such as security, management of resources and file system.

---

In conclusion, operating systems are the backbone of modern computing, providing the foundation for all software and applications to run on. Understanding operating systems is crucial for building robust, efficient, and user-friendly applications. This field is really profound and if you want to know more about it, let me know down in the comments section.
Agile Testing Challenges
Tags: testing, codequality, environment, storybytes
Published: 2023-02-01 09:32:35


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hk4sxctmo0fjnm24mb6d.png)Quality stands at the core of the products we deliver. As much as we wish to keep this core strength, there are common challenges the team faces in Agile Testing. But, there is a solution to overcome almost every challenge. In Addition to the solution, there is an effect on the Team. An Agile testing team does become quality-minded, addresses the risks in the beginning, and explores around to strengthen the implementation. Agile methodology is necessary to create high-quality software amid frequent releases of new functionalities in today’s market environment. In agile testing, everyone on the team is a tester. Therefore, everyone needs to retain a high-level understanding of the project's purpose and the capacity to manage customer expectations. As the project scales, the tiresome part comes when the same issue has to be repeatedly fixed, and everyone wonders why? This is where we need to get back to the agile ceremonies, such as check-in, Review, and Retrospective. Each such ceremony can help identify the bottlenecks that hinder creating a quality Effect. And with that, Quality is built-in from the beginning and sustained until the end.
Simple Python Version Management: pyenv
Tags: python, programming, beginners, tutorial
Published: 2023-02-01 09:24:44

pyenv lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well.

## Installation

In this topic, we will install pyenv on macOS.

### Install pyenv

pyenv builds Python from source, which means you’ll need build dependencies to actually use pyenv. On macOS, you can install these dependencies with Homebrew:

```bash
brew install openssl readline sqlite3 xz zlib
```

After you’ve installed the build dependencies, you’re ready to install pyenv itself. I recommend using the [pyenv-installer project](https://github.com/pyenv/pyenv-installer):

```bash
curl https://pyenv.run | bash
```

This will install pyenv along with a few plugins that are useful:

1. pyenv: The actual pyenv application
2. pyenv-virtualenv: Plugin for pyenv and virtual environments
3. pyenv-update: Plugin for updating pyenv
4. pyenv-doctor: Plugin to verify that pyenv and build dependencies are installed
5. pyenv-which-ext: Plugin to automatically lookup system commands

Then add the following to your `~/.zshrc`:

```bash
# Python Version Manager
export PATH="$HOME/.pyenv/bin:$PATH"
alias brew='env PATH="${PATH//$(pyenv root)\/shims:/}" brew'

export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
```

## Usage

### List available Python versions

```bash
pyenv install --list
```

### Install Python

```bash
pyenv install 3.11.0
```

### Set Python version globally

```bash
pyenv global 3.11.0
```

### Set Python version locally

```bash
pyenv local 3.11.0
```

### Uninstall Python

```bash
pyenv uninstall 3.11.0
```

### List installed Python versions

```bash
pyenv versions
```

### Update pyenv

```bash
brew upgrade pyenv
```

## PIP

### Install PIP

```bash
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
```

## References

- [pyenv/pyenv: Simple Python version management](https://realpython.com/intro-to-pyenv/#installing-pyenv)
- [how to install pip on macos](https://phoenixnap.com/kb/install-pip-mac)
Microsoft Power Apps Tutorial | Create the App & Screen Navigation | Episode 1
Tags: powerfuldevs, beginners, tutorial, productivity
Published: 2023-02-01 09:13:22

In this first episode of this BEGINNER training course on Microsoft Power Apps, we will guide you through the very first steps of making your own app! Creating a low code app within a solution, setting up app screens with navigation, adding & grouping controls, images...and much more!

{% embed https://www.youtube.com/watch?v=mXAEBIqf960 %}

In the other videos in [this playlist](**url**) we will tackle more Powerapps building blocks:

✅ Galleries & Data sources (Sharepoint!)
✅ Variables
✅ Collections
✅ Forms
✅ Overlays & Pop-ups
✅ ...and so much more!

💻 Developing on a low code platform is so much fun, so join us for the ride! Use these videos as a tutorial to build and develop your own apps!