teleren/devto huggingface dataset:
Twitter Chat: Chapter 3 Recap
Tags: bookclub, documentation
Published: 2021-12-14 20:38:48

Cover photo by <a href="https://unsplash.com/@chrisjdavis?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Chris J. Davis</a> on <a href="https://unsplash.com/@chrisjdavis?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>

We started a book club! Each week, we host a Twitter chat on Thursdays to discuss a chapter of Docs for Developers.

On Thursday Dec. 9th, we had our third Twitter chat, hosted on the @DevEdBookClub Twitter account about Chapter 3, Drafting Documentation.

This post is a recap of the chat and a place to continue the conversation.

## Writing Process

**What does your writing process typically look like? How do you get from idea to first draft?**

**What practices does your organization have around templatizing your docs?**

**How do you prioritize your work if you need to write multiple docs at once?**

Several of us identified with [Sarah Rainsberger](https://twitter.com/sarah11918)'s tendency to hold onto an idea until it all spills straight out into a draft.

{% twitter 1469129223277363206 %}

It turns out that this practice is actually described in a writing lecture given by Larry EcEnerney at the University of Chicago! 

> You are using your writing process to help yourself think.

{% twitter 1469131084247932929 %}

[Portia Burton](https://twitter.com/AgencyCecil) described her own process for figuring out what the docs should say.

{% twitter 1469132753388163075 %}

Her approach ties in well with the theme of [writing empathetically](https://twitter.com/seancdavis29/status/1466603220592066560) that we discussed in the previous week.

## Writer's Block

**How do you get unstuck when you have writer’s block?** 

**What’s usually the thing blocking you?**

Several folks mentioned that they're usually blocked by a lack of knowledge (or confidence in their knowledge) of the subject. Amber Matz shared how she tackles that feeling.

{% twitter 1469131932411707393 %}

I like to say what I'm thinking out loud to focus my thoughts on a topic and to get past the point of staring at a blank page.

{% twitter 1469133117529145349 %}

It works _really_ well for me and my answer to this question seems to have inspired some to try it for themselves. Remember, though, that the best writing process is the one that works for you!

{% twitter 1469138103310946310 %}

## Favorite Takeaways

**What takeaways from this chapter can you apply to your own documentation practice at work?**

**Any quotes or ideas that resonate with you?**

[Megan](https://twitter.com/meganesulli) shared the following quote and how the paradox it describes is reason for us to care in everything we write because we can't know which part will resonate with someone.

{% twitter 1469136088685899776 %}

## Join the Conversation 🗣

You can see the full conversation on the DevEdBookClub Twitter account.

{% twitter 1469124757660467205 %}

Add a comment on the Twitter thread or share your thoughts here to continue the conversation.

What did you think about Chapter 3 of Docs for Developers?
[Binary Search]Perfect Squares
Tags: programming, java, 100daysofcode, algorithms
Published: 2021-12-14 20:24:12

# [Description](https://binarysearch.com/problems/Perfect-Squares/solutions/7048713)

Write a program that determines the smallest number of square numbers that sum up to `n`.

**Constraints:** 

- `1 ≤ n ≤ 100,000`

## Example 1

### Input

```
n = 4
```

### Output

```
1
```

### **Explanation**

```
4 is already the square of 2.
```

---

## Example 2

### Input

```
n = 17
```

### Output

```
2
```

### **Explanation**

```
16+1
```

---

## Example 3

### Input

```
n = 18
```

### Output

```
2
```

### **Explanation**

```
9+9
```

---

# Intuition

dp solution

1. `dp[i]` means the smallest number of square numbers that sum up to `i`
2. Update the `dp[i + j * j]`, which is come from `dp[i]+1`
3. `dp[0]` = 0

# Implementation

```java
import java.util.*;

class Solution {
    public int solve(int n) {
        int[] dp = new int[n + 1];
        Arrays.fill(dp, Integer.MAX_VALUE);
        dp[0] = 0;
        for (int i = 0; i <= n; i++) {
            for (int j = 1; i + j * j <= n; j++) {
                dp[i + j * j] = Math.min(dp[i + j * j], dp[i] + 1);
            }
        }
        return dp[n];
    }
}
```

## Time Complexity

- Time: O(nlogn)
- Space: O(n)
Are you still using Java in 2021?
Tags: green, security, java, rust
Published: 2022-08-17 09:10:34

---
title: Are you still using Java in 2021?
published: true
date: 2021-12-14 20:21:48 UTC
tags: green,security,java,rust
canonical_url: 
---

![](https://cdn-images-1.medium.com/max/1024/0*8wrPwi0nUXFw-FJ4)
_Photo by Ryan Quintal on Unsplash_

Bad guys are coming for you:

One more reason to stop using Java in 2021 [https://www.schneier.com/blog/archives/2021/12/on-the-log4j-vulnerability.html](https://www.schneier.com/blog/archives/2021/12/on-the-log4j-vulnerability.html) use Rust instead, it’s [Greener](https://medium.com/@loraxman/rust-a-green-language-for-21st-century-9935303db91f)and [more sustainable.](https://foundation.rust-lang.org/posts/2021-12-06-love-for-rust-at-reinvent/)

Seriously, can anyone present a compelling reason to start a new project in Java? Other than maintaining legacy software.

Mind though: in the past for any software written in Java I could faster, cheaper more memory efficient product in another language, with two exceptions: Drools and Camunda, although this gap is [closing](https://github.com/bpxe/bpxe).
14 frontend technologies you don't need with low/no-code
Tags: webdev, productivity, technology, development
Published: 2021-12-14 19:57:01

With low-code, web app development and internal tools building take days instead of weeks. Learning new frameworks and wrestling with UI libraries is not a must anymore.


Check out [14 frontend technologies you don’t need to learn](https://uibakery.io/post/top-frontend-technologies-you-dont-need-with-low-code?utm_campaign=ui_bakery%20-%20article%20-%20blog%20-%20cacq%20-%20frontend_technologies%20-%20views&utm_source=DevTo&utm_medium=webdev&utm_content=article_announce) if you opt for low-code.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r9dl0ud2pkashiglal5q.png)
Code Coverage with Cypress & Angular
Published: 2021-12-14 19:36:50

Forking a new HOWTO from https://dev.to/muratkeremozcan/combined-unit-e2e-code-coverage-case-study-on-a-real-life-system-using-angular-jest-cypress-gitlab-35nk

IN PROGRESS...  COMING SOON...   FIRST POST...

## Istanbul w/Unit Tests

As you know, you might configure unit test code coverage and then run your code coverage report like so:

`ng test --browsers=ChromeHeadless --codeCoverage=true --watch=false --sourceMap=false`

From that you will generally get a `coverage` folder in the root of your project that contains a `src` instrumented code folder.   Next to that will be your report results files.

## Instanbul w/Cypress

TODO
Less is more: The Pareto principle.
Tags: beginners, programming, career, motivation
Published: 2021-12-14 19:21:57

When one has an interest in the area of software development it can be common to feel daunted by the number of themes and topics that are said to be necessary to become a good professional. In fact, I went through this situation when I first became interested and ventured into the area. The shock for me was so big that I felt lost, as if I was going round and round and always stopping at the same place, I started courses, boot camps, read dozens of tutorials and articles that didn't make me feel more confident, I ended up falling into what is known as tutorial hell. Fortunately, I traveled these paths in parallel with my college of Information Systems, which forced me to follow a certain structure of learning, but the frustration in these twists and turns I took was not less because of this.

Recently I got my first job in the area, and in a little over three months I understood that, although no knowledge is wasted, the practice of what we study is what leads us to evolve and assimilate the knowledge better. You can compare this observation to a book, there is nothing that has more transforming power than a book, in it there may be concepts capable of changing the world, but if no one reads them and applies them, they will be nothing more than words with great potential.

A remarkable principle that fits perfectly into this relationship between study and practice is the Pareto principle. Here is some context: In 1895, the economist Vilfredo Pareto demonstrated in an article that approximately 80% of the land in Italy belonged to only 20% of the population. Although it may seem unfair, this idea only quantified what we know today as the 80:20 rule: "80% of results come from 20% effort. In reality the exact numbers may vary a lot, but the idea behind it does not, and the idea is that a small amount of effort results in a large amount of results, and this relationship is not balanced.

Applying this principle to the study of programming, we can see that, although it is tempting to learn everything that is available in the area, we can build large projects with a small part of this knowledge, not to mention that the effort to learn everything would be unfeasible, both in time required and in results obtained. Another way to apply this knowledge is the idea that more than studying a certain topic from this list, it is necessary to put it into practice.

Therefore, when studying a certain subject, take this principle into consideration. When we get interested in some content we are extremely excited to devour any material that exists about it for hours and hours, but like books, we need to take the words off the paper and bring them to life so that they can produce some result in the real world.

References:

[Ways To Apply The Pareto Principle To Learning](https://elearningindustry.com/pareto-principle-to-learning-ways-apply)

[What is Tutorial Hell, and How to Get Out?](https://www.youtube.com/watch?v=wq8F-Bg-GzI&ab_channel=StefanMischook)
Instalação e configuração inicial do Git
Tags: git, github, beginners, programming
Published: 2021-12-14 19:11:25

## O que é git?

É um sistema de controle de versão.

**E o que é controle de versão?**

<p>Controle de versão é um sistema que registra alterações em um arquivo ou conjunto de arquivos, isso possibilita que você lembre o que fez, pode desfazer ou refazer alterações que modificou no arquivo ao longo do tempo, ou mesmo comparar as alterações e evolução do projeto. É possível recuperar modificações feitas erroneamente evitando que estrague o projeto.</p>

## Vantagens do controle de versões:

**Sistemas Distribuídos de Controle de Versão - Distributed Version Control Systems**

<p>Possibilita a colaboração entre desenvolvedores em outros sistemas diferentes. Eles podem duplicar localmente o repositório completo, para que os sistemas possam colaborar por meio dele, se em algum momento qualquer servidor morrer os repositórios podem ser copiados de volta para restaurará-lo. Cada clone que é feito é um backup completo com todos os dados.</p>

### Instalando o Git no linux

**Fedora**

```bash
yum install git (até Fedora 21)
dnf install git (Fedora 22 e posterior)
```

**Debian / Ubuntu**

```bash
apt-get install git
```

**Arch Linux**

```bash
pacman -S git
```

Para outras distribuições acesse o link abaixo:

[Git--distributed-even-if-your-workflow-isnt](http://git-scm.com/download/linux)

### Instalação no Mac

### **Homebrew**

Instale [homebrew](https://brew.sh/) se você ainda não tiver, então:

```bash
brew install git
```

Outras formas de instalação no mac segue o link:

[Git - Downloading Package](http://git-scm.com/download/mac)

### Instalação no Windows

Basta baixar o arquivo de download no link abaixo e siga as etapas:

[Downloading Git](http://git-scm.com/download/win)

### Configuração inicial

<p>A primeira coisa que devemos fazer é configurar o git com seu nome de usuário e e-mail. É assim que o git identifica sua identidade para cada commit.</p>

Vá até o terminal do seu sistema favorito e digite:

```bash
$ git config --global user.name "Fulano de Tal"
$ git config --global user.email fulanodetal@exemplo.br
```

<p>Você precisará fazer isso somente uma vez pois estamos configurando de forma global, se precisar utilizar somente para o um projeto específico é só rodar o comando dentro do projeto sem --global.</p>

Feito isso sua identidade estará configurada.

Para verificar rode o comando:

```bash
git config --list
# O retorno será mais ou menos assim:
user.name=Fulano de Tal
user.email=fulanodetal@exemplo.br
color.status=auto
color.branch=auto
color.interactive=auto
color.diff=auto
...
```

**Para pedir ajuda.**

```bash
git help<comando de ajuda>
#exemplo
git help config
#Ele retornará a documentação do comando com todas as opções que você pode utilizar.
```

<p>Pronto! Já sabemos o que é o git, instalamos no nosso sistema e fizemos a configuração inicial. Espero ter ajudado alguém que teve dificuldades no início assim como eu! Em breve vou criar um post com os principais comandos do git.<p/>

##Vamos evoluir juntos, porque juntos somos melhores!

Referências:

[Documentation](https://git-scm.com/doc)
Is it safe to cross the streams (er, cloud providers)?
Tags: azure, aws, refactorit, discuss
Published: 2021-12-14 19:05:52

Hello, fellow technophiles!

I'm tasked with rearchitecting an existing app for a start-up. There are 3 top priorities: <u>**_speed_**</u> to rebuild a crippled tech stack and created needed functionality, _**<u>stability</u>**_ to said crippled stack as we are currently wooing investors and clients, and **<u>_security:_</u>** build the new stack right (and right now).

The former team mismanaged a DotNet stack on Azure (like, think diaper fire mishmash of misused VMs and outdated sdks/packages), and I have a ton of confidence and experience in AWS space. 

If I were to say "let's take a 6-week hiautus), I and the other dev could rebuild what they have now with a pgsql, documentdb, and some lambdas in node or python or go. But the reality is we will be using the current dotnet stack until we've moved over to a new one (and likely using both as new features will be built in new Thing-X).

All that said, what is y'alls experience in coming in new and rebuilding better? 

My concern in holding steady on Azure and building new on AWS mirror's Egon's warning about crossing the streams: "Try to image all life as you know it stopping instantaneously and every molecule in your body exploding at the speed of light."

Thank you for any advice, or for at least listening as I get my thoughts out on e-paper.

Excelsior!

DoctorEw
what i learned last week: if/else statements 
Tags: javascript
Published: 2021-12-14 18:56:47

I'm happy to share that I've officially completed week one of General Assembly's Java Immersive program. We dove into the command line, HTML/CSS and JavaScript. I haven't written in about two months so lets get right to it! I'll be going over `if/else` statements to solidify my knowledge in JavaScript.

The `if` statement [executes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else) a statement if a specified condition is truthy. If the condition is falsy, another statement can be executed.

```if () {}```

Let's dive into the above piece of code. Within the parentheses you'll need to write a [conditional expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#expressions). 

```if (condition) {
statement1
}```

First, I've declared a [variable](https://developer.mozilla.org/en-US/docs/Glossary/Variable) and stored the number `400` inside of it. Next, I created an `if` statement and added a condition inside of the parentheses. 

```let x = 400
if (x > 50) {
console.log("I'm larger than the number 50!");
}```

Within the curly brackets I've gone ahead and created a statement. In this case I've written code that will show in the console **ONLY** if the condition returns a `truthy` value. 

Remember, a [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) value is a value that is considered true when encountered in a Boolean context. See below for the group of values that are considered `falsy` in JavaScript. Note, all values outside of the group below are considered `truthy`.

![falsy](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9zj8ylt6dr2bug6qfp56.png)

What do you think will be the output when I run the above block of code. To confirm let's head over to the browser console. 

INPUT 
```let x = 400
if (x > 50) {
console.log("I'm larger than the number 50!");
}```

OUTPUT
`I'm larger than the number 50!`

Since `400` is larger than `50` the statement is displayed in the console. What if I want to display a different output if the number is less than 50? How would I set that up? In this case we can add an `else` statement to the above code.

```let x = 41
if (x > 50) {
console.log("I'm larger than the number 50!");
} else {
console.log("I'm smaller than the number 50!");
}```

Output

`I'm smaller than the number 50!`

The reason why we get the above output is because when the first condition was executed it resolved as `falsy`. 

Let's check out a real world example.
 
```function startAdventure() {
    let local = prompt('Captian Picard has a mission for you in the Delta Quadrant. Do you take along riker or data?')
    if (local === "riker") {
        riker();
    }  else if (local === "data") {
        data();
    } 
}```

Above I have a function that allows the client to navigate prompts depending on their response.
Living in the Shell #15; sed (Text Stream Editor) (Part 2)
Tags: productivity, linux, bash, devops
Published: 2021-12-14 18:55:59

## `sed` 🖊️

Edits streams by applying commonly used modifications.

## Replace substring `s`

```sh
cat some-file.txt | sed 's/me/you/g'
```

> Replaces all occurrences of "me" with "you".

## Replace pattern `s`

```sh
echo "about\nabuse\namount" | sed 's/a\(\w*\?\)\w/\1/g'
```

> ```text
> bou
> bus
> moun
> ```
>
> `\1` refers to the first captured group.

## Transform to lowercase `\L`

```sh
echo "HELLO THERE\nHI THERE\nGOODBYE" | sed 's/H\w*/\L&/g'
```

> ```text
> hello There
> hi There
> GOODBYE
> ```
>
> - Transforms words beginning with "H" to lowercase.
> - `&` is the place holder for "entire match".

## Transform to uppercase `\U`

```sh
cat some-file.txt | sed 's/.*/\U&/g'
```

> Transforms all letters into uppercase.
Apama Advent Calendar - 14 Dec 2021 - Deploying Apama projects
Tags: apama, iot, cumulocity, streaminganalytics
Published: 2021-12-16 14:21:53

---
title: Apama Advent Calendar - 14 Dec 2021 - Deploying Apama projects
published: true
date: 2021-12-14 18:49:02 UTC
tags: apama, iot, cumulocity, streaminganalytics 
canonical_url: https://tech.forums.softwareag.com/t/apama-advent-calendar-14-dec-2021-deploying-apama-projects/253914
---

_This is Day 14_ _of a short series of brief tips, tricks, hints and reminders of information relating to the Apama Streaming Analytics platform, both from Software AG as well as from the community._ 

Once you’ve finished your Apama project, you likely want to utilize it in a different environment than where you developed it. Check out this edition of the Apama Advent Calendar, in the [Software AG Tech Community](https://tech.forums.softwareag.com/t/apama-advent-calendar-14-dec-2021-deploying-apama-projects/253914) where some of the ways that you can take completed projects and turn them into deployable packages for Apama are explored.
 
_Note that some posts may be published a day or two early or late (e.g. Mon-Fri) so you may find you have bonus days with more than one post!_
Singleton Pattern
Tags: beginners, java, codenewbie, computerscience
Published: 2021-12-14 18:33:11

> Singleton pattern allows creation of only a single instance from a class

## Motivation

Consider a case where your application needs to access a shared resource from different places at various times. And also keep a consistent state between each access.

The Singleton pattern solves this problem by creating a class that is responsible for creating and insuring only a single instance is created, while allowing direct access to the instantiated object.

## Applicability

The Singleton pattern can be used in cases where:

- The class have exactly one accessible instance


## Structure

![Singleton pattern class diagram](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6jd7ve17stwg8eak3919.png)

### Participants
- **Singleton:** defines an Instance operation that lets clients access its unique instance

### Collaborations
- Clients access a Singleton instance only through the `getInstance` method.


## Advantages
- Can be sure of the number of instances
- Can globally access instance 

## Disadvantages

- Violates single responsibility principle. It is responsible for making sure that one instance is being created and also provide the core functionalities of the object itself.
- It is hard to unit test because global states are hard to isolate.
- Causes an object to be globally mutable which may not be desired in some cases.

## Implementation

Singletons can be implemented in numerous ways:

1. **Eager initialization:** Object of class is created when it is loaded to the memory
1. **Lazy initialization:** In this method, object is created only if it is needed.
1. **Thread Safe Singleton:** A thread safe singleton in created so that singleton property is maintained even in multi-threaded environment.


## Demo

> The money received by customers of the cafe is stored in a cash register. It is important that there is only one cash register per cafe, so that the income of the cafe is accurately known.

To solve this problem, we implement `CashRegister` as a singleton. we make the constructor private so nobody can instantiate the class. And we implement a method `getInstance` to be called by user to obtain instance of the class.

{% replit @eyuelberga/Singleton-Pattern %}
PNPM install smart
Tags: yarn, pnpm, npm, javascript
Published: 2021-12-14 18:19:59


Let's think about installing and node module.
Installation takes some time, and you will find some shared packages on a local computer in many projects. 
Consider the cost of storage and processing for the CI docker virtual machine.
So how can we get some speed and efficiency?

pnpm for the rescue. pnpm is a fast, disk space-efficient package manager.
pnpm will be stored in a content-addressable store.

In the video below you can see the comparison between npm and pnpm

{% youtube 4w4WWJ7YG4Q %}

What pnpm gives:

1. If you depend on different versions of the dependency, only the files that differ are added to the store. For instance, if it has 100 files, and a new version has a change in only one of those files, pnpm update will only add 1 new file to the store, instead of cloning the entire dependency just for the singular change.

2. All the files are saved in a single place on the disk. When packages are installed, their files are hard-linked from that single place, consuming no additional disk space. This allows you to share dependencies of the same version across projects.

As a result, you save a lot of space on your disk proportional to the number of projects and dependencies, and you have a lot faster installations!

Also, pnpm has some features. You can create a workspace to unite multiple projects inside a single repository.

Next, I will write with the combination using pnpm with turborepo.