teleren/devto huggingface dataset:
Produtividade com Makefile
Tags: bash, make, shell, productivity
Published: 2022-07-14 21:43:34

## 1. O que é Makefile?

> makefile é um arquivo (por padrão chamado de "Makefile") que contém um conjunto de diretivas (linkers) usadas pela ferramenta de automação de compilação **GNU Make** para executar um alvo/meta/script.

### 1.1 Instalação
Primeiro vamos verificar se o make já esta instalado em sua distribuição:
```shell
$ make -v
```
O seu resultado, caso o GNU Make já esteja instalado em sua distro, será similar ao mostrado abaixo:
```shell
$ make -v
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
...
```
Se por acaso, o comando make não for reconhecido, você pode instalar com o seguinte comando:
```shell
$ sudo apt install make
```

### 1.2 Como usar?
Crie um diretório com nome de sua escolha, e dentro dele crie um arquivo de nome **Makefile**, com o seguinte conteúdo:
```shell
hello:
	@echo "Hello World"
```
Na primeira linha, temos a diretiva (linker), e na segunda o comando a ser executando quando essa diretiva for acionada, para isso basta usar o comando **make + a diretiva desejada**, como no exemplo a seguir:
```shell
$ make hello
Hello World
```
#### Comando **@**
O **@** no inicio da linha indica que você deseja ocultar o comando durante a execução, ou seja, caso você não inicie o comando com @ no script do comando, ele será exibido antes do resultado durante a execução, como no exemplo abaixo:

Makefile:
```shell
hello:
	echo "Hello World"
```
Resultado:
```shell
$ make hello
echo "Hello World"
Hello World
```

#### Parâmetros
É possível também usar parâmetros, como por exemplo:
```make
hello:
	@echo "Hello World $(name)"
```  
Resultado:
```shell
$ make hello name=Antonio
Hello World Antonio
```

#### Include:
As vezes o arquivo Makefile, pode ser torna bem grande, uma das formas de organizar isso, é separar os comandos de acordo com o contexto que melhor se encaixe e usar o comando **include**.
Por exemplo:
```
include= .targets-docker
include= .targets-sqs
```

#### Help
Essa é uma sugestão bem legal, é possível criar um comando help no makefile, para nos ajudar a entender para que server cada comando que criamos. 
Existem varias formas de fazer isso, buscando um pouco na comunidade, encontrei alguns exemplos, e customizei da seguinte forma:
1. Crie um arquivo .help no mesmo diretório do Makefile em questão, com o conteudo abaixo:
{% embed https://gist.github.com/antonio-motta/622d0c058f86f8be37b9f32afff4a865 %}

1. Inclua esse arquivo iniciando seu makefile com o seguinte comando: ```make
include .help
```
Agora basta fazer seus comandos, com comentario acima com ##, por exemplo:
```shell
## Escreve Olá Mundo!
hello:
	echo "Hello World"
```
### Referências e links úteis
[Make Docs](https://www.gnu.org/software/make/manual/)
[Introdução ao Makefile](https://embarcados.com.br/introducao-ao-makefile/)
[Samples Makefile](https://makefiletutorial.com/)
[repo from example in the post](https://github.com/antonio-motta/makefile-sample)
Remote or back to the office? Think about the commute time.
Published: 2022-07-14 21:38:48

Hey fellow devs!

It seems that more and more of us are delicately prompted to go back to the office. Most managers are justifying it by lack of spontaneous interactions (which can be easily tackled with by [using flat.social for online socials](https://flat.social/spatial-chatting) as a [zoom alternative](https://flat.social/blog/zoom-alternative)), need of physical space for [virtual socials and happy hours](https://flat.social/virtual-happy-hours) and problems with mentoring junior members.

Rarely though we take commute times into account. Assuming an average commute time of 90 minutes a day, in around a decade one will spend ~450 days of full-time work being a train passenger. That's 3600 hours.

Thinking long term, in 25 years this will amount to 9000 hours.

Want to calculate how many hours will you waste over a decade on commute? I just build a simple calculator alongside a blog post - [Should my remote team be back in an office? ](https://flat.social/blog/get-a-remote-team-back-in-the-office)
The browser console has a count method
Tags: browser, tip, javascript, console
Published: 2022-07-14 21:26:54

---
title: The browser console has a count method
published: true
description: Quick tip for the browser console. Instead of using an own counter to log how often a method is called, use this.
tags: browser, tip, javascript, console 
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g9sz4ffa65mr1uovw6or.jpg
canonical_url: https://christianheilmann.com/2022/07/14/the-browser-console-has-a-count-method/
---

When debugging or analysing JavaScript, you often see people trying to find out how often a certain function is called. The common way to do that is to use a global counter variable to increment and log in the function. 

``` JavaScript
var i = 0;
function test(){
  // other functionality
  i++;
  console.log(i);
  // other functionality
}
```

There is, however, a better method. The Console of the browser has a `count()` and `countReset()` method that event takes a label. That means you can avoid the global.

```JavaScript
function bettertest(){
  console.count('bettertest');
}
```

You can see it in action in this screencast. 

![Screencast of the two ways to count how often a method was called in comparison](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4plkqxaawt80mom50xii.gif)

This is [part of the standard Console API](https://docs.microsoft.com/microsoft-edge/devtools-guide-chromium/console/api#count) and should be supported in all browsers.
C++ Client SDK v0.6.0 has been released
Tags: news, database, cpp
Published: 2022-07-14 21:18:18

Hey everyone!

C++ Client SDK [v0.6.0](https://github.com/reduct-storage/reduct-storage/releases/tag/v0.6.0) have been released!
It supports Reduct Storage HTTP v0.6 and introduces some new features:

## Data Streaming

Now you can write and read data in chunks:

```cpp

# Read
std::ofstream file("some.blob");
auto err = bucket->Read("entry", ts, [&file](auto data) {
    file << data;
    return true;
});

# Write
const std::string blob(10'000, 'x');
bucket->Write("entry", ts, blob.size(), [&blob](auto offset, auto size) {
    return std::pair{true, blob.substr(offset, size)};
})l
```

The storage engine has no limitation for record sizes.
So, you can stream your data of any sizes maximal efficiently. 

<!--more-->

## Get Or Create?

When your application needs to create a bucket in the storage engine before writing there, it caused boilerplate code to check if the bucket already exists.
Now it is way easier with the `IClient::GetOrCreateBucket` method:

```cpp
auto [bucket, err] = client->GetOrCreate("bucket");
if (err) {
  std::cerr << "Error: " << err;
  return;
}

std::cout << bucket->GetSettings();
```

### Links

* [Full Changelog](https://github.com/reduct-storage/reduct-cpp/blob/main/CHANGELOG.md)
* [Getting Started](https://docs.reduct-storage.dev/)
Join us at our next Coding Bootcamp 🦊 💻
Tags: beginners, bootcamp, javascript, css
Published: 2022-07-14 21:14:55

Are you interested in Front-end development and would like to start coding for <b>free</b>? Then, our next cohort is waiting for you! 💖

...and we're delighted to announce that we will be sponsored by ✨<a href="https://www.reddit.com/" target="_blank">Reddit</a>✨, who will be providing support and touch points during the cohort. How awesome is this?

But first, a little history 

##What are Front-end Foxes? 🦊
Front-End Foxes was founded by Jen Looper in February 2018. The goal of the program is to familiarize people who identify as women with front-end technologies in a supportive, cool and inclusive environment.

![Frontend Foxes Classes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8kui2qyf1oj6zr7zd5cq.png)
 

##What will you learn? 📚
You will learn the basics of web development starting with HTML, CSS, JavaScript, and a JavaScript framework. You will also learn GitHub basics so you can add create your own portfolio and show it to the world!

##Bootcamp duration ⏰
The classes will happen twice a week, 1.5 hours each, for 5 weeks. We truly recommend you to not skip any class, so you can take the most benefit of each topic.

##Classes format 💻
The classes are fully online, and each class will have 20 students, four mentors, and one teacher. For each group of 5 students, there will be a mentor that will support you and help you out with any doubts that you may have!

## Where to apply?
Are you ready to join us? Then we are looking forward to your 👉 [application](https://docs.google.com/forms/d/e/1FAIpQLSeGUBSR3FaeDwI3n0b8mjpatycpxPRvkg_SEulwI-1NBscENQ/viewform)

We can't wait to see you there!

![Cute fox coding illustration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7r8wx0pmlakb3qszhkgc.png)


#### Can't apply for this edition?
Don't worry, we will have more dates! Subscribe our [newsletter](https://mailchi.mp/b7c4bc4325fb/newsletter-landing) and stay updated
GPG claim
Published: 2022-07-14 21:12:36

This is an OpenPGP proof that connects [my OpenPGP key](https://keyoxide.org/B69AD555C27B9F3016799D002AE5223CF6862C06) to [this dev.to account](https://dev.to/ErnestNoga). For details check out https://docs.keyoxide.org/advanced/openpgp-proofs/

[Verifying my OpenPGP key: openpgp4fpr:B69AD555C27B9F3016799D002AE5223CF6862C06]
I'm new here. Please handle with care.
Published: 2022-07-14 21:08:42

Welp, I made it. 

As a kid growing up in the 90s, I always admired the computer programmer. To a 10-year-old, its magical. And I wanted to learn how to do the magic things.

The first book I picked up unveiled the ugliness of code. 

I just assume that whoever wrote the book was from mars. No one I knew spoke the way the book presented itself. Honestly, I could not grasp the concept of this magic. 

So, I gave up.

Many years later after failing to graduate art college, I made my way back to my hometown. I took this time to reevaluate life. After working in the IT field for 6+ years, I decided to give it another try. 

This time it was different.

Something inside me wanted to understand that ugly code. Honestly, it was the hardest topic I've ever tried to study. So far, I am enjoying the challenge. 

And so, I've decided to become a software engineer. 

My software engineering apprenticeship has been very rewarding so far. I am one week in and I'm enjoying every moment. It feels so alien to be a part of a group of like-minded individuals. Hopefully my journey will lead me to where the grass is always greener.
Intro to Android Development
Tags: android, bootcammp, tutorial, installandroidstudio
Published: 2022-07-14 20:56:00

![Android Development Bootcamp](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vh7ced94xz1i32d5xz55.png)

**TODAY'S CONTENT**: Course overview and Android Studio Setup

<u>What you'll learn in this Bootcamp:</u>

[] How to build a variety of Android apps in Kotlin
[] Kotlin language essentials
[] Best practices for app development
[] Resources to keep learning
[] You will build a lot of apps during this whole Bootcamp and some will be of Industry Standard


![course structure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9grv2y3c0cskwqowpuan.png)

![Prerequisites to start learning](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3xymsrmogl7pt9yg2gkw.png)
**What is Android Studio?**
To write code for your Android application, you need some kind of environment or code editor that will make your task easy. No doubt, you can write the same code by using any normal text editor but Android Studio is required to build Android applications.You can surely code in other IDE'S(Integrated Developer Environment)
but cannot build apps on them. As the course is structured in teaching what is necessary to be a proficient developer we will not waste time on unnecessary knowledge.

So, Let's Setup Android Studio on your machine!

**How to install Android Studio?**
In order to install Android Studio in your system, make sure to download the latest version of the Android Studio from [Android Studio website](https://developer.android.com/studio/). Also, check the system requirements of Android Studio here.

To install Android Studio, you can follow the steps mentioned in the [Android Developer website](https://developer.android.com/studio/install) for Android Studio Installation.

After installing, Open Android Studio and it should show you this screen.
Click on "Start a new project"
![Android Studio welcome screen](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/boc75pbw7lwcldtl2wdx.png)

That's all for today!! Today was just a overview of this Bootcamp. 

**Stay Connected and keep learning🙌**
Zen Core 2.0 - Git-based Package Management System for Linux Systems
Tags: python, linux, git
Published: 2022-07-14 20:46:12

Hi, I'm Ekin. In this article, I will give information about the package management system called Zen, which I developed myself.

## What is Zen?
Zen is a package management system built on the git system. It install applications from services that use Git (eg github, gitlab, gitea).

## Docs
https://github.com/eknvarli/zen/docs/DOCS.md

The installation script is available in the repo. I wish you a good day.
How to add a retry policy to a Timer Function
Tags: azure, webdev, tutorial, programming
Published: 2022-07-14 20:25:40

If you liked what you read feel free to connect with me on [linkedin](https://www.linkedin.com/in/albert-bennett/) or follow me on dev.to :)
<br/>

Hi and welcome to my blog post.
It's a quick one today. I'm going to show you how to add a retry policy on a timer function. I had seen an article shared on Microsoft's twitter account a short while ago and wanted to share some of the info. It seems like a really cool feature and, one that I am excited about. Having worked with function apps on an off for the past 5 years or so. Also I'll link their article on it below.
<br/>

**What is a retry policy**
A retry policy is an action that retries a request a number of times until either the maximum number of retries has occurred or the endpoint returns a successful response.
It is mostly used to handle transient errors in an application. Things such as drops in connections, minor unexpected errors that kind of thing.
<br/>

**Implementation**
This retry policy isn't available on all kinds of Azure functions. For the example today, I'll be showing it on a timer function but. To my knowledge this binding only works for Timer, Event Hubs functions but, there are other ways of adding a retry policy to an Azure function.
For timer functions adding a retry policy is very straight forward. Simply add the following 'FixedDelayRetry' binding to your function app:
```csharp
        [FunctionName("Function1")]
        [FixedDelayRetry(5, "00:00:10")]
        public void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, ILogger log)
        {
            log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");

            int i = Random.Shared.Next(4);

            if (i < 4)
            {
                log.LogError($"Thrown an error because number generated was < 4: {i}");
                throw new FunctionException("Not working :(");
            }
        }
```
I've added extra logic to the function simply to test out the retry policy.
Important things to note is that in the binding you need to specify the number of retries that you want to be attempted and also the time delay between them. For this example I have set it to retry a maximum of 5 times with a 10 second delay between each attempt.
![timer trigger retrying](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aev4jy89rhfp26lgi19u.png)
It's also worth noting that this feature is only available on version 3 function apps and above.
<br/>

As promised here is the original article:
https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-error-pages?tabs=fixed-delay%2Cin-process&pivots=programming-language-csharp

Or if you want to find out more about the retry pattern:
https://docs.microsoft.com/en-us/azure/architecture/patterns/retry

Thanks for reading and I hope to see you guys next time.
IPython q to exit
Tags: python
Published: 2022-07-14 20:17:11

---
canonical_url: https://waylonwalker.com/til/ipython-q-exit/
cover_image: https://images.waylonwalker.com/til/ipython-q-exit.png
published: true
tags:
- python
title: IPython q to exit
---

So many terminal applications bind `q` to exit, even the python debugger, its muscle memory for me.  But to exit ipython I have to type out `exit<ENTER>`. This is fine, but since q is muscle memory for me I get this error a few times per day.

```
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ <ipython-input-1-2b66fd261ee5>:1 in <module>                                                     │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
NameError: name 'q' is not defined
```

After digging way too deep into how IPython implements its `ExitAutoCall` I realized there was a very simple solution here.  `IPython` automatically imports all the scripts you put in your profile directory, all I needed was to create `~/.ipython/profile_default/startup/q.py` with the following.

```
q = exit
```

It was that simple.  This is not a game changer by any means, but I will now see one less error in my workflow.  I just press `q<Enter>` and I am out, without error.
Best Practices for Securing Your Vulnerable REST APIs
Published: 2022-07-14 17:53:30

Why API security is a typical issue. Most web and versatile applications are security tried sooner or later yet APIs barely stand out. This implies you might have weaknesses in your creation APIs.

For instance, suppose you have a fintech application. It does things like records, moves, and so forth. It has portable/web UIs for playing out these tasks. You could have tried all the UI ways are simply open to a validated client. Some of the time API endpoint like the one beneath is left unstable on the grounds that without acknowledgment and any programmer/bot can get it and consistently make a point to focus on a feed of late exchanges. The best way to fix these sorts of imperfections is to recognize them before they're taken advantage of.

Example endpoint with the flaw: GET: /transactions - Any bot can access it without authentication because it has a broken authentication flaw.

One easy way to detect an OWASP API2 vulnerability or security flaw in your APIs is to use open-source tools like Burp and EthicalCheck. Using these tools is very simple. All you need is your OpenAPI Specification/Swagger URL and get an instant report.

https://ethicalcheck.apisec.ai
AlmaLinux and the Top 500 HPC Supercomputers
Tags: opensource, linux, performance, almalinux
Published: 2022-07-14 19:15:43

The [Top500 Supercomputers](https://top500.org/) list released for the [June 2022](https://www.top500.org/lists/top500/2022/06/) update came out a short while ago and some community members spotted a familiar name on the list--**AlmaLinux**! CentOS was such a large part of the HPC community and AlmaLinux is continuing that tradition. We've been working closely with many in the HPC space including software and hardware vendors, super computer operators and researchers to make sure things continue to run smoothly for those in the HPC space looking for their next steps and providing a drop-in replacement.

We'd like to give a special thank you to our friends at [MEGWARE](https://www.megware.com/en) for their support on these deployments.

AlmaLinux Installations List in Top500:

* [#184 "Alex"](https://www.top500.org/system/180075/) at Universitaet Erlangen - Regionales Rechenzentrum Erlangen, Germany - AMD EPYC™ 7713 (Milan) with NVIDIA A100 HGX - MEGWARE NF5488A5 - Running AlmaLinux 8.5 - [System's Home Page](https://hpc.fau.de/systems-services/systems-documentation-instructions/clusters/alex-cluster)

* [#301 "VSC-5"](https://www.top500.org/system/180056/) at Vienna Scientific Cluster, Austria - AMD EPYC™ 7713 (Milan) - MEGWARE SlideSX®-LC - Running AlmaLinux 8.5 - [System's Home Page](https://vsc.ac.at/home/)

* [#323 "Fritz"](https://www.top500.org/system/180074/) at Universitaet Erlangen - Regionales Rechenzentrum Erlangen, Germany - Intel® Xeon® Platinum 8360Y Processor (Ice Lake) - MEGWARE Server System D50TNP Family - Running AlmaLinux 8.5 - [System's Home Page](https://hpc.fau.de/systems-services/systems-documentation-instructions/clusters/fritz-cluster)

* [#339 "HSUper"](https://www.top500.org/system/180076/) at Helmut-Schmidt-Universitaet/Universitaet der Bundeswehr Hamburg, Germany - Intel® Xeon® Platinum 8360Y Processor (Ice Lake) - MEGWARE Server System D50TNP Family - Running AlmaLinux 8.5 - [System's Home Page](https://www.hsu-hh.de/hpc/en/)

The 184th ranked system also ranks 16th in the [Green500](https://www.top500.org/lists/green500/) which currently makes it the most energy-efficient HPC system in Germany.

AlmaLinux is proud to be powering scientific research all over the world. It is part of the mission we set out to accomplish, not merely an OS--a community and platform for building the future **together**.

Stay tuned for more exciting HPC news, including more systems coming soon. If you'd like to help out please join us on The [AlmaLinux Community Chat](https://chat.almalinux.org/), [#almalinux on libera.chat](irc://irc.libera.chat/almalinux), [Twitter](https://twitter.com/almalinux) or [Reddit](https://reddit.com/r/almalinux).
Build error SQL46005: Expected FILESTREAM_ON but encountered object instead
Tags: devops, azure, sql
Published: 2022-07-14 19:15:21

I am trying to build a database project with azure synapse sql pool as the target database but i get `Build error SQL46005: Expected FILESTREAM_ON but encountered object instead` error every time single.
I investigated as noticed there are couple procedures where I am using the data swapping approach to stage and load the data. Here is an example of the pattern;

```
CREATE PROC [schema].[some_proc] AS

-- Drop temp table if exists
if object_id(N'schema.t_dim_temp_table') is not null
drop table schema.t_dim_temp_table;

create table schema.t_dim_temp_table
with (   distribution = hash (somecol)
        ,clustered columnstore index
     )
as
select
*
,CURRENT_TIMESTAMP AS last_update_date
from stgschema.v_dim_stage

-- Rename and remove temp objects
rename object schema.t_dim_table            to schema.t_dim_table_old;
rename object schema.t_dim_temp_table       to schema.t_dim_table;
drop table schema.t_dim_table_old;
```

Any ideas about how to get around this error will be appreciated