teleren/devto huggingface dataset:
Um resumo sobre: deque.
Tags: algorithms, python
Published: 2023-02-23 19:46:14

Deque é uma abreviação de Double Ended Queue (fila de duas pontas), ele pode ser utilizado para implementar estrutura do tipo [fila(FIFO)](https://dev.to/costamateus7/um-resumo-sobre-fila-25b1) e [pilha(FILO)](https://dev.to/costamateus7/um-resumo-sobre-fila-25b1). Caso não saibam o funcionamento dessas duas estruturas de dados, sugiro que leiam. Entretanto, vou abordar algumas características de ambas, a fim de comparar com o deque. Na fila de modo geral, nós adicionamos os elementos na cauda e tiramos na cabeça. A inserção dos dados é do tipo constante, o que agiliza o processo, entretanto, quando tratamos da exclusão dos dados, o [Big-O](https://dev.to/costamateus7/um-resumo-sobre-big-o-2hpk) passa a ser O(n) - linear, porque precisamos remanejar todos os dados para que a primeira posição não fique vazia. Enquanto isso, o deque adiciona e remove itens em qualquer direção com o desempenho aproximado O(1), segundo o [python collections](https://docs.python.org/pt-br/3.9/library/collections.html#collections.deque:~:text=Deques%20s%C3%A3o%20uma,em%20qualquer%20dire%C3%A7%C3%A3o.). Sendo assim, quando comparamos a inserção e remoção de elementos, o deque ganha em questão de performance. O deque pode se comportar como fila(até mesmo as filas de prioridade) ou pilha, com isso, nós podemos excluir e adicionar elementos tanto no início, quanto no final da estruturas.
Veja esta imagem que mostra a diferença entre as três:

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

 A implementação de exclusão e inserção de dados nos deques podem ser realizadas de forma estática ou circular. A forma circular é muito parecida com a da fila que vimos nos resumos passados. Basicamente, a implementação deste tipo é formado por um ponteiro indicando o início e o final da fila, sendo que esta é a forma mais indicada para este tipo de estrutura de dados. Já a forma estática, não é tão indicada por ter sua notação linear O(n), devido ao reajuste das casas para inserção e exclusão de itens do início do vetor. 

[Aqui está um algoritmo em python com a ideia de deque. 
](https://colab.research.google.com/drive/1aUox84-6ZnU9ic4lMVBIGVjahPKfyWRf?usp=sharing)
Caso tenha alguma sugestão sobre o tema, mande mensagem. Será muito bom evoluir com sua ajuda! Obrigado por chegar até aqui e espero ter ajudado!

Este resumo é baseado no curso: [Estruturas de dados e algoritmos em python](https://www.udemy.com/course/estrutura-de-dados-e-algoritmos-python-guia-completo/)
GraphQL Codegen Web Wrapper{TypeScript}.
Tags: graphql, nextjs, typescript
Published: 2023-02-23 19:11:38

Creating graphql result types for a web application can be done by adding an extra step to your application's development process. 
That step has been extensively covered by the guys at [The Guild](https://the-guild.dev/graphql/codegen). 
However, I've created a [codegen web wrapper](https://dendekky-graphql-codegen.vercel.app/) that serves a slightly different purpose which includes but might not be limited to:

- Skipping an extra step of adding the codegen to your development process but still wanting to know what result types the graphql api returns.

- Getting all the return types from a graphql endpoint without setting up anything extraneous.

The wrapper guide and source code can be found on [github](https://dendekky-graphql-codegen.vercel.app/).

Let me know what you think. 
If you have any questions regarding this, I am available in the comment section. Also, feel free to correct or add anything I might have missed. Do not hesitate to send me a message by email or on [twitter](https://twitter.com/dendekky)
Why Linux is the Go-To Operating System for Developers and Servers?
Tags: server, operatingsystems, developer, linux
Published: 2023-02-23 18:58:58

Looking for a reliable, customizable, and cost-effective server operating systems ? Look no further than Linux ! This open-source platform has become the go-to choice for developers and businesses alike, thanks to its stability, security, flexibility, and low resource usage.
In my latest [blog post](https://www.oliver-joisten.se/why-linux-is-the-go-to-operating-system-for-developers-and-servers/), I explore the advantages of Linux for servers and developers, and why it continues to dominate the server market. From its availability of development tools to its compatibility with other open-source software, Linux offers a wide range of benefits that make it an ideal choice for a variety of use cases.
So, whether you're a developer looking for a reliable operating system for your projects or a business in need of a server solution that won't break the bank, be sure to check out my latest blog post on why Linux is the go-to operating system for developers and servers.

###THANK YOU FOR READING
I hope you found this little article helpful. Please share it with your friends and colleagues. Sharing is caring.
Please visit also my [website](https://www.oliver-joisten.se/blog/) to read more informative blogposts
Connect with me on [LinkedIn](https://www.linkedin.com/in/oliver-joisten/) to read more about C/C++, Git, Github, and more…!
SRE book notes: Embedding an SRE to Recover from Operational Overload
Tags: sre, books
Published: 2023-02-23 18:33:39

These are the notes from [Chapter 30: Embedding an SRE to Recover from Operational Overload](https://sre.google/sre-book/operational-overload/) from the book [Site Reliability Engineering, How Google Runs Production Systems](https://sre.google/sre-book/table-of-contents/).

This is a post of a series. The previous post can be seen here:

{% embed https://dev.to/bitmaybewise/sre-book-notes-dealing-with-interrupts-4gib %}

---

> Your job while embedded with the team is to articulate why processes and habits contribute to, or detract from, the service's scalability.

---

> Remember that your job is to make the service work, not to shield the development team from alerts.

---

> After scoping the dynamics and pain points of the team, lay the groundwork for improvement through best practices like postmortems and by identifying sources of toil and how to best address them.

---

> Sort the team fires into toil and not-toil. When you're finished, present the list to the team and clearly explain why each fire is either work that should be automated or acceptable overhead for running the service.

---

> Your first goal for the team should be writing a service level objective (SLO), if one doesn't already exist. The SLO is important because it provides a quantitative measure of the impact of outages, in addition to how important a process change could be.

---

> Once your embedded assignment concludes, you should remain available for design and code reviews. Keep an eye on the team for the next few months to confirm that they're slowly improving their capacity planning, emergency response, and rollout processes.

---

As you might have guessed already, the quotes with recommendations above are not just applicable to SREs but any experienced engineer that finds himself/herself in a position that needs to mentor or guide one or multiple teams at the company.

If you haven’t been into this situation before, pay attention to them as they might come in handy when the time comes.

---

If you liked this post, consider subscribing to my newsletter [Bit Maybe Wise](http://bitmaybewise.com/).

You can also follow me on [Twitter](https://twitter.com/bitmaybewise) and [Mastodon](https://mastodon.online/@bitmaybewise).

---

Photo by [Daria Nepriakhina](https://unsplash.com/@epicantus) on Unsplash
Leverage Markdown and GitHub to Manage Your Resume with Resume-md
Tags: github, markdown, career, resume
Published: 2023-02-23 18:17:14

Many developers are very familiar with benefits of markdown. It has a simple syntax which makes it easy to learn, read, and write. It's also very easy to version control and with a tool like `Pandoc`, can be combined with `css` to build stylized outputs in multiple formats like PDF and HTML.

This, combined with GitHub Actions and GitHub Pages can be leveraged to automatically build a stylized PDF for download, and deploy a stylized HTML as a static web page.

## Resume-md
[`Resume-md`](https://www.github.com/siph/resume-md) is a project that automates resume management and does all these things for you.

### How To Use
- Generate a new project using [`resume-md`](https://www.github.com/siph/resume-md) as a template.  
  ![template](https://github.com/siph/blog/raw/master/04/template.png)

- **Make sure to include all branches**.  
  ![branches](https://github.com/siph/blog/raw/master/04/branches.png)

- Enable read/write workflow permissions.  
  ![permissions](https://github.com/siph/blog/raw/master/04/permissions.png)

- Edit `resume.md` and push commits. Optionally, you can also edit
  `style.css`.

- Once finished, download your PDF/HTML from the `Actions` tab.  
  ![artifacts](https://github.com/siph/blog/raw/master/04/artifacts.png)

- The HTML is automatically deployed to
  `https://<your-github-username>.github.io/<repository-name>`

## Conclusion
This approach has a lot of benefits especially to developers who are already comfortable with markdown and using git. Adding the automated processes using GitHub's tooling is an added layer of convenience and speaks to the power of the platform. This makes it trivial to keep your resume looking good and up to date.
Lightning-Fast Portfolio Site in Just 3 Hours
Tags: javascript, opensource, portfolio, astro
Published: 2023-02-23 18:09:34

Just launched my personal portfolio website using astro.build and the open source template astrowind.

It has a blazing-fast performance with a perfect 100 score in Performance, Accessibility, Best Practices, and SEO. 

Check it out here: https://www.seeratawan.me/ 🚀

Excited to showcase my skills and talents to the world!
Pure Functions in Solidity
Tags: solidity, ethereum, web3, blockchain
Published: 2023-02-23 17:44:29

>Pure functions in Solidity are functions that do not read or modify the state variables.

Pure functions do not read or modify state variables; instead, they return values that are derived solely from the parameters supplied to the function or from local variables that are contained in it. The compiler issues a warning in such circumstances if any of the statements that read the state variables, access the address or balance, access any global variable block or msg, call a function that is not pure, and so on, are present in pure functions. 

Pure functions are those that do not read or modify the state of the system. It is possible to declare a function to be pure.

 If any of the following statements are present in the function, they are regarded as reading the state, and the compiler will issue a warning in such circumstances:

- State variables are being read.

- Using the address(this).balance or <address>.balance functions.

- Using any of the special variables of block, tx, or msg (msg.sig and msg.data can be read).

- Calling any function that has not been declared as pure.

- Using inline assembly that contains specific opcodes.

- If an error occurs, pure functions can utilise the reverse() and require() procedures to undo any potential state changes that may have occurred.

##Example 1:
```
//SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
  
// Defining a contract
contract Test {
  
    // Defining pure function to 
    // calculate product and sum
   // of 2 numbers
   function getResult(
   ) public pure returns(
     uint product, uint sum){
      uint num1 = 2; 
      uint num2 = 4;
      product = num1 * num2;
      sum = num1 + num2; 
   }
} 
```
##Example 2:
```
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract ViewAndPure {
    uint public x = 1;

    // Promise not to modify the state.
    function addToX(uint y) public view returns (uint) {
        return x + y;
    }

    // Promise not to modify or read from the state.
    function add(uint i, uint j) public pure returns (uint) {
        return i + j;
    }
}
```
For more content, follow me at - https://linktr.ee/shlokkumar2303
How can I convert Pine Script to MQL4?
Tags: pinescript, mql
Published: 2023-02-23 17:42:03

Pine Script and MQL4 are both programming languages used in financial trading. Pine Script is the programming language used for trading view while MQL4 is used in MetaTrader 4 platform. Sometimes, traders may have to switch between these two programming languages for their trading needs. This can be due to various reasons like the need to use a specific indicator or strategy that is only available in one platform. In such cases, it becomes important to know how to convert Pine Script to MQL4 or vice versa. In this article, we will discuss how to convert Pine Script to MQL4.

Step-by-step guide to converting Pine Script to MQL4:

1.Understand the Differences between Pine Script and MQL4:
Before converting Pine Script to MQL4, it is important to understand the differences between these two programming languages. Pine Script is a relatively simple language and is used for developing scripts for TradingView. MQL4, on the other hand, is a more complex language and is used for developing Expert Advisors (EAs) and indicators for MetaTrader 4. MQL4 has a vast library of functions and features that are not available in Pine Script.

2.Analyze the Pine Script Code:
The first step in converting Pine Script to MQL4 is to analyze the Pine Script code. This involves understanding the logic and the purpose of the code. It is important to know what the code does and what its output is supposed to be. Once the code is understood, it becomes easier to convert it to MQL4.

3.Translate Pine Script to MQL4:
The next step is to translate the Pine Script code to MQL4. This involves replacing the Pine Script functions and features with their equivalent MQL4 functions and features. It is important to ensure that the syntax and logic of the code remain the same. This can be a tedious process, especially if the Pine Script code is complex.

4.Test the MQL4 Code:
After translating the Pine Script code to MQL4, it is important to test the MQL4 code. This involves compiling and running the MQL4 code in the MetaTrader 4 platform. The purpose of testing is to ensure that the MQL4 code produces the same output as the Pine Script code. Testing can also help to identify any errors or bugs in the code.

5.Debug and Optimize the MQL4 Code:
Once the MQL4 code has been tested and any errors have been identified, it is important to debug and optimize the code. This involves fixing any errors and optimizing the code for better performance. It is important to ensure that the code runs smoothly and efficiently.

6.Final Testing and Deployment:
The final step is to perform a final test of the MQL4 code and deploy it in the MetaTrader 4 platform. This involves running the code in a live trading environment to ensure that it works as expected. It is important to monitor the code and make any necessary adjustments to ensure that it continues to work properly.
Junior Developers NEED to Hear This!
Tags: webdev, beginners, podcast
Published: 2023-02-23 17:37:29

{% spotify spotify:episode:4SY0d15GVpZyQpCtPX3G4v %}

## What is HTML All The Things?

HTML All The Things is a [web development podcast](https://www.htmlallthethings.com/) and [discord community](https://discord.com/invite/jweMCx9) which was started by Matt and Mike, developers based in Ontario, Canada. 

The podcast speaks to web development topics as well as running a small business, self-employment and time management. You can join them for both their successes and their struggles as they try to manage expanding their Web Development business without stretching themselves too thin.

---

## What's This One About?

Tech layoffs are in full swing right now, with companies shrinking their teams for a variety of reasons. This is a stark contrast to the hiring spree that we experienced and grew used to during the chaos that was the COVID-19 pandemic. Does this mean that junior developers should pack up and find work elsewhere? Should people that are still learning web development leave the field entirely?

## Show Notes

### Tough Times in Tech
- Tech pricing disparity may cause a loss in tech dominance (ie you can get some plumbing done for $300, but a simple app could cost $30k to make)
- Many layoffs from major tech giants including Microsoft, Meta, Google, Amazon, Salesforce, Dell, Cisco, and more
- AI may be coming for developer jobs faster than we thought possible (ie ChatGPT is a major advancement into "uncanny valley" that largely came out of nowhere)

### Where to Start

- Keep learning and improving at your fundamentals
 - HTML, CSS, JS
 - React, TypeScript, etc.
- Build projects (and dabble into full-stack if you haven't already)
- Practice leet code
- Practice interviews (etiquette + Q&A)

### How to Differentiate

- Build a small SaaS (whether it's actually functioning as a business, or just a practice one to show off your skills)
Contribute to open source projects
- Find a community and get involved (you may be able to skip the entire job interview process if you meet someone and they need help)
- Don't overwork yourself to stand out (work within reason, some overtime is fine - but working until burnout is no good)

## Thank you!

If you're enjoying the podcast consider giving us a review on [Apple Podcasts](https://podcasts.apple.com/us/podcast/html-all-things-web-development-web-design-small-business/id1412209136) or checking out our Patreon to get a shoutout on the podcast. 

**[Support us on Patreon](https://www.patreon.com/htmlallthethings)**


You can find us on all the podcast platforms out there as well as

[Instagram (@htmlallthethings)](https://www.instagram.com/htmlallthethings/)
[Twitter (@htmleverything)](https://twitter.com/htmleverything)
[TikTok](Html All The Things)
Horizontal Scroll with Padding.
Tags: css
Published: 2023-02-23 16:56:44

Today, let's try to implement the horizontal scrolling component.

<p align="center">
  <img alt="Final Result" src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1z70cq723v9kil19tkkf.gif">
</p>

We start from trying to implement it in a naive way. First, we make the red boxes to be `inline-block` to allow them to sit next to each other. Then we apply `white-space: nowrap;` and `overflow-x: auto;` to the wrapper of these boxes to make them horizontally scroll.

```html
<div class="wrapper">
  <h1>Header</h1>

  <div class="row">
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
  </div>
</div>
```

```css
.row {
  white-space: nowrap;
  overflow-x: auto;
}

.box {
  display: inline-block;
}

/* These are for cosmetics  */
.wrapper {
  border: 1px solid black;
  width: 350px;
  padding: 32px;
}

.box {
  width: 100px;
  height: 80px;
  background-color: red;
  margin-right: 8px;
}
```

And here is the result of the naive approach.

<p align="center">
  <img alt="Naive Result" src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xq7g8zn3cyfbk9vgnr23.gif">
</p>

The content (red boxes) does not go to the left border of the wrapper when we scroll. The same goes for the right border too. This is because the padding of the wrapper forces these boxes to live inside their confined space. Another not-so-nice thing about this is that the horizontal scroll bar is too close to the boxes, making it look ugly.

## Fix padding problems.

In the past, to fix these problems, I would have removed the padding of the wrapper and apply padding to `<h1/>` and `.row` one by one. However, I just learned another way of fixing these problems by only applying styles to the relevant element, which is `.row` class. Much easier, right?

The technique here is to use a <b>negative margin</b> to remove the effect of padding from the wrapper. I learned this technique from Josh Comeau's [CSS for JavaScript developer course](https://css-for-js.dev/).

```css
.row {
  white-space: nowrap;
  overflow-x: auto;

  /* remove wrapper's padding effect */
  padding-left: 32px;
  padding-right: 32px;
  padding-bottom: 32px;
  margin-left : -32px;
  margin-right: -32px;
  margin-bottom: -32px;
}

...
```

Here's a [codepen link](https://codepen.io/chansk131/pen/abaZywr) to play around with the final result.

To sum up, this negative margin technique can be applied to remove the padding effect of the wrapper. In other words, use it on the element that want to ignore the padding of the wrapper. This can also be the case of the image element that wants to go full width while other elements still want to respect that margin.
Building with Industry 4.0
Tags: hardware, industry4, engineering, news
Published: 2023-02-23 16:55:12

Welcome to the future, where Industry 4.0 reigns supreme. The Fourth Industrial Revolution is upon us, and it's changing the game of manufacturing like never before.

Imagine a world where machines aren't just automated but are also interconnected, constantly communicating with each other and the internet. This level of connectivity opens up a world of possibilities for a smarter, more efficient, and flexible manufacturing system. With advanced technologies like IoT, AI, and machine learning, the factory floor has become a cybernetic organism - alive, constantly adapting, and always hungry for more data.

The benefits of Industry 4.0 are too great to ignore. With the ability to optimize processes and resource usage, factories can reduce waste and energy consumption, making them more sustainable and environmentally friendly. And with the power of data at our fingertips, we can predict machine failures before they occur, minimizing downtime and maintenance costs.

Enginuity Inc, a [high-tech engineering firm](https://enginuityinc.ca/) that operates on the East Coast of North America has been leading the charge on Industry 4.0 solutions for businesses. 


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

While there are all kinds of examples of solutions that can be applied my introducing IoT to manufacturing processes, Enginuity Inc has taken it to another level by implementing things like SCADA systems and Vision grading systems for [Industry 4.0](https://enginuityinc.ca/project/automating-sea-cucumber-grading/).


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

One of the most significant impact of Industry 4.0 is on the workforce. As machines become more intelligent and connected, traditional jobs are becoming redundant, and new roles are emerging that require a whole new set of skills. It's a world where the line between man and machine is becoming increasingly blurred, and those who can adapt and thrive in this new cyberpunk reality will be the ones who come out on top.

Welcome to the future of Industry 4.0.