teleren/devto huggingface dataset:
Find the Last Row In Google Sheets With Google Apps Script!
Tags: googleappsscript, spreadsheets, automation, findlastrow
Published: 2023-06-09 18:15:00

Hello!, I wrote a blog on finding the [last non-empty rows](https://dev.to/kcl/how-to-find-the-last-row-in-a-column-with-google-apps-script-3npa
) a couple of months ago. Since then, I have found a better, faster, and easier method, which works in most cases.

## Find the Last Row & Column
You can copy and paste one of the following functions as per your needs.

1. `FindLastRowNColBoundScript()`, is meant for a bound script, is very easy to implement, and works on the currently active worksheet.

2. `FindLastRowNColIndependentScript()` should be used with an independent script. The given code is very simple. You can modify this function and pass variables such as ID and Worksheet names as parameters to make this function more dynamic.

```
/**
 * Function should be used for bound script.
 * Function use getDataRange().getValues() method to 
 * find lastRow and LastColumn of that Spreadhseet.
 */
function findLastRowNColBoundScript() {
  const sheet = SpreadsheetApp.getActiveSheet();

  const data = sheet.getDataRange().getValues();
  const lastRow = data.length;
  const lastCol = data[0].length;

  console.log(lastRow);
  console.log(lastCol);

  return [lastRow, lastCol];
}

/**
 * Function should be used for independent script.
 * Function use getDataRange().getValues() method to 
 * find lastRow and LastColumn of that Spreadhseet
 */
function findLastRowNColIndependentScript() {
  const ss = SpreadsheetApp.openById("<Your Spreadsheet's ID>");
  const sheet = ss.getSheetByName("<Name of the worksheet>");

  const data = sheet.getDataRange().getValues();
  const lastRow = data.length;
  const lastCol = data[0].length;

  console.log(lastRow);
  console.log(lastCol);

  return [lastRow, lastCol];
}


/**
 * This script is for finding last non empty rows and columns in a spreadsheet. 
 * This works in most cases but not in some cases such as columns with checkboxes
 * It is created in such a way that it only works with bound script.
 *
 * Created by: Nibesh Khadka.
 * linkedin: https://www.linkedin.com/in/nibesh-khadka/
 * website: https://nibeshkhadka.com
 */

```
_This strategy of using [DataRange()](https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet#getdatarange) to find the last row and columns works in most cases but few such as columns filled with checkboxes on their entire rows._

## Thank You for Your Time

My name is Nibesh Khadka, and as a freelance automation expert, I specialize in automating Google products with Apps Script. If you need my services let me [know](https://nibeshkhadka.com/contact/).

Don’t forget to like and share this blog.


![Like and Share the Blog](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ifgfep9koji3bhm5egdt.png)
Implementando Testes End-to-End: Por que eles são importantes
Tags: testes, e2e, qualidade, sistema
Published: 2023-06-09 17:46:41

Os testes end-to-end (E2E) desempenham um papel crucial na garantia da qualidade e na validação completa de sistemas de software. No entanto, pode ser frustrante quando as equipes consideram os testes E2E desnecessários. Neste artigo, exploraremos a importância dos testes E2E e forneceremos razões convincentes para sua implementação.

**Cobertura abrangente**

Os testes E2E verificam o funcionamento correto de todos os componentes do sistema, desde a integração de serviços até a interface do usuário. Eles ajudam a identificar problemas que podem surgir na interação entre diferentes partes do sistema.

**Fluxos de uso do mundo real**

Os testes E2E simulam fluxos de uso do mundo real, proporcionando uma visão completa da funcionalidade e do comportamento do sistema como um todo. Isso ajuda a descobrir problemas que podem surgir apenas quando diferentes partes do sistema estão em execução.

**Identificação de problemas complexos**

Os testes E2E podem detectar problemas complexos que não são facilmente identificados por meio de testes unitários isolados ou testes de integração. Eles podem ajudar a identificar problemas de comunicação, erros de configuração, comportamento inesperado do usuário e outras situações complexas que podem afetar o sistema em produção.

**Confiança no lançamento**

A execução de testes E2E abrangentes antes do lançamento de uma nova funcionalidade ou atualização do sistema ajuda a aumentar a confiança na qualidade do software entregue aos usuários. Isso pode resultar em menor incidência de erros e maior satisfação do cliente.

**Detecção precoce de problemas**

Os testes E2E podem ajudar a identificar problemas em um estágio inicial, permitindo que a equipe de desenvolvimento os resolva antes que se tornem mais complexos e caros de corrigir.

**Melhoria contínua**

Os testes E2E fornecem feedback valioso para a equipe de desenvolvimento, permitindo que eles identifiquem áreas de melhoria e aprimorem a qualidade do sistema.

---
Ao discutir a implementação de testes E2E com sua equipe, destaque esses pontos e enfatize os benefícios que eles trarão para a qualidade do sistema e para a experiência do usuário. Além disso, compartilhe exemplos e estudos de caso que demonstrem a eficácia dos testes E2E em outros projetos ou organizações.

Os testes E2E desempenham um papel fundamental na garantia da qualidade e na validação completa de sistemas de software. Eles proporcionam uma visão abrangente do sistema, identificam problemas complexos e ajudam a aumentar a confiança no software entregue. Portanto, é importante que as equipes reconheçam a importância dos testes E2E e os incorporem em suas práticas de desenvolvimento.

Espero que este artigo tenha fornecido insights valiosos sobre os benefícios dos testes E2E e ajude a convencer sua equipe sobre sua relevância. Lembre-se de que a implementação de testes E2E contribui para a qualidade e o sucesso geral do projeto de software.

*Artigo postado usando [bloggu.io](https://bloggu.io). experimente de graça.*
Why I opted for Technical Writing?
Published: 2023-06-09 17:18:17



## Introduction

Each person who chose technical writing appreciates technical writing for a variety of reasons.

Here are our top reasons for loving technical writing for me who entered the area of technical writing either voluntarily or unintentionally but chose to stay.

 

##  Passion for Technology
 Technical writing enables me to combine my enthusiasm for these subjects with my writing abilities following the fact that i have a natural interest in technology, software, or scientific topics ever since i was young. It offers the chance to delve deeply into a variety of technical fields and effectively communicate them to others.

##  Opportunities for Employment
 Due to its July 9, 2011, independence from Sudan following a protracted civil war, South Sudan is the youngest nation. There are numerous job paths available in technical writing. Technical writers are used by a wide range of businesses to provide documentation, manuals, training materials, and more, including technology, engineering, healthcare, and manufacturing. Technical writers are in high demand, which frequently creates solid employment and career opportunities.

##  Writing Ability
 An individuals like me who have a natural talent for writing often find technical writing appealing. I want to enjoy the process of crafting well-structured, informative documents, producing technical content such as user manuals, paperwork, guides other materials that assist customers in comprehending and utilizing complicated goods or services in high-quality content.

## Conclusion

Now imagine a meal without a good cook, not going to be a sweet-smelling savour? now you know why!

It's time that you have been able to know why I transitioned into technical writing, you can now tell that writing has already been part of me.

I know this information was at least a little bit helpful to you.

Now, don't let anything hinder you from starting your technical writing journey today, I am rooting for you!

Feel free to find me around the web for questions and clarifications
Classe em C#
Published: 2023-06-09 17:30:15

Classe é um dos **conceitos** fundamentais na linguagem de programação C#. 

> Uma classe
 é uma estrutura que define as características e comportamentos de um objeto. Ela pode ser considerada como um molde ou uma planta para a criação de objetos.

Em C#, uma classe é definida usando a palavra-chave "class", seguida pelo nome da classe e um bloco de código entre chaves. Aqui está um exemplo básico de uma classe em C#:

```csharp
public class Carro
{
    // Campos (variáveis) da classe
    public string Marca;
    public string Modelo;
    public int Ano;

    // Construtor da classe
    public Carro(string marca, string modelo, int ano)
    {
        Marca = marca;
        Modelo = modelo;
        Ano = ano;
    }

    // Métodos da classe
    public void Ligarr()
    {
        Console.WriteLine("O carro está ligado.");
    }

    public void Desligarr()
    {
        Console.WriteLine("O carro está desligado.");
    }

    public void ExibirInformacoes()
    {
        Console.WriteLine($"Marca: {Marca}");
        Console.WriteLine($"Modelo: {Modelo}");
        Console.WriteLine($"Ano: {Ano}");
    }
}
```

Neste exemplo, temos uma classe chamada "Carro" que possui três campos (variáveis): "Marca", "Modelo" e "Ano". Ela também possui um construtor, que é um método especial utilizado para inicializar os valores dos campos quando um objeto é criado. No caso, o construtor recebe os valores da marca, modelo e ano e os atribui aos campos correspondentes.

Além disso, a classe "Carro" possui três métodos: "Ligar", "Desligar" e "ExibirInformacoes". O método "Ligar" exibe uma mensagem indicando que o carro está ligado, o método "Desligar" exibe uma mensagem indicando que o carro está desligado e o método "ExibirInformacoes" exibe as informações do carro (marca, modelo e ano).

Agora que a classe "Carro" está definida, podemos criar objetos dessa classe e utilizar seus campos e métodos. Veja um exemplo de como criar e usar objetos da classe "Carro":

```csharp
Carro meuCarro = new Carro("Ford", "Fiesta", 2020);
meuCarro.Ligar();
meuCarro.ExibirInformacoes();
meuCarro.Desligar();
```

Neste exemplo, criamos um objeto chamado "meuCarro" da classe "Carro" e passamos os valores "Ford", "Fiesta" e 2020 para o construtor. Em seguida, chamamos os métodos "Ligar", "ExibirInformacoes" e "Desligar" do objeto "meuCarro".

As classes em C# permitem organizar e estruturar o código de forma modular e orientada a objetos. Elas facilitam a reutilização de código, pois é possível criar múltiplos objetos de uma mesma classe, cada um com seus próprios valores e comportamentos. Além disso, as classes permitem a implementação de encapsulamento, herança e polimorfismo, que são conceitos avançados da programação orientada a objetos.

Em resumo, as classes são componentes fundamentais na linguagem de programação C#. Elas definem a estrutura e o comportamento dos objetos e permitem a criação de instâncias desses objetos
DAY 6 - Longest Consecutive Sequence
Tags: programming, learning, cpp, beginners
Published: 2023-06-09 17:14:05

Hello to anyone reading this. I am still relatively new to coding and this platform as well, so please feel free to drop any corrections/advice for me.
I am trying to do the 100 Day-Challenge of consistent coding and this is Day-.6Looking forward to a positive interaction with all of you.

## DAY 6 Problem 1: Longest Consecutive Sequence

_Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence._
_You must write an algorithm that runs in O(n) time._

**Example 1:**

> Input: nums = [100,4,200,1,3,2]
> Output: 4
> Explanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4.

## Intuition:
To find the longest consecutive sequence, we will need to get the elements in order.

**Approach:1 Brute Force Approach**

- We can sort the array.
- After sorting the array we can maintain a count for the longest sequence we can find.
- In a case there is no sequence every number is a sequence in itself hence we return 1.

**Code:**

```cpp
int longestConsecutive(vector<int>& nums) {
if(nums.size() == 0)
        {
            return 0;
        }
        if(nums.size() == 1)
        {
            return 1;
        }
sort(nums.begin(),nums.end());
        int ans = 1;
        int prev = nums[0];
        int cur = 1;

        for(int i = 1;i < nums.size();i++){
            if(nums[i] == prev+1){
                cur++;
            }
            else if(nums[i] != prev)
            {
                cur = 1;
            }
             prev = nums[i];
             ans = max(ans,cur);
        }
 return ans;
}
```
**Complexity Analysis**
> Time Complexity: O(nlogn)
> Space Complexity: O(1)

**Approach 2: Optimal**
We are going to take a hashSet which will basically store each value one time in an order eliminating any duplicates.
Following this we will check if the sequence's next element is available in the set. If it is, we will move to the next element.

**Code:**

```cpp
int longestConsecutive(vector<int>& nums) {
        if(nums.size() == 0)
        {
            return 0;
        }
        if(nums.size() == 1)
        {
            return 1;
        }
        set<int> hashSet;
        int longestStreak = 0;
        for(int num: nums)
        {
            hashSet.insert(num);
        }
        for(int num: nums)
        {
            if(!hashSet.count(num-1))
            {
                int currentNum = num;
                int streak = 1;
                while (hashSet.count(currentNum + 1)) {
                    currentNum += 1;
                    streak += 1;
      }
            longestStreak = max(longestStreak,streak);
            }
        }
       return longestStreak; 
    }
```

**Complexity Analysis**
> Time Complexity: O(n)
> Space Complexity: O(n)
> Assuming lookup for an element in hashSet is O(1).
How to use your AWS credits
Tags: aws, cloud, learning, credit
Published: 2023-06-09 17:06:21

If you are a new AWS user, you may have received some credits to use on the platform. Here are some steps to help you get started:

1. Log in to your AWS account and go to the Billing and Cost Management dashboard.
2. Click on "Credits" in the left-hand menu.
3. Here, you will see the amount of credits you have available.
4. To use your credits, go to the AWS service you want to use and create a new instance or start a new project.
5. During the process, you will be prompted to select a payment method. Choose "Credits."
6. If your credits are not enough to cover the full cost of the service, you will need to provide another payment method for the remaining balance.
{% embed https://youtu.be/b8szkwe5TxE %}

It's important to note that AWS credits expire after a certain amount of time, so be sure to use them before they expire. Also, check the terms and conditions of your credit to see if there are any restrictions on how they can be used.

You may not sell, license, rent, or otherwise transfer Promotional Credit. Promotional Credit may be applied only to your own AWS account. Promotional Credit has no intrinsic value, is not redeemable for cash, has no cash value, is nonrefundable, and serves merely as a means to provide an incentive to use AWS Services. Promotional Credit may not be purchased for cash.

With these simple steps, you can start using your AWS credits to get the most out of the platform. Happy computing!

If you are interested in the AWS cloud, check my blog and [A beginner’s guide. How to start your adventure with the AWS cloud ??](https://lepczynski.it/en/aws_en/a-beginners-guide-how-to-start-your-adventure-with-the-aws-cloud/)
isinstance()
Published: 2023-06-09 17:02:35

The isinstance() function is used to determine the type of an object, allowing us to check whether the object belongs to a specific type, such as an integer or string. The isinstance() function returns True if the specified object is of the specified type; otherwise, it returns False.

For example, if you want to check if an object is an integer, you can use the isinstance() function as follows:


`def set_rating(self, rating):
    if isinstance(rating, int) and 1 <= rating <= 5:
        self._rating = rating
    else:
        raise Exception("Invalid rating")`


In this example, isinstance() is used to validate whether the rating argument is an integer within the range of 1 to 5.

Similarly, you can use isinstance() to verify if a variable is an instance of a specific class. Here's an example:


`def set_customer(self, customer):
    if isinstance(customer, Customer):
        self._customer = customer
    else:
        raise Exception("Invalid customer")`


In this case, the isinstance() function is used to check if the customer argument is an instance of the Customer class.

By utilizing isinstance(), you can conditionally execute certain actions based on the type of an object. It is important to note that isinstance() is distinct from the modulo operator; the modulo operator calculates the remainder, while isinstance() checks if an object is an instance of a particular class.
Gaming application
Published: 2023-06-09 16:49:07

**On the other hand, we denounce with righteous indignation and dislike men who are so beguiled **

1. and demoralized by the charms of pleasure of the moment, so 
2. blinded by desire, that they cannot foresee the pain and 

- trouble that are bound to ensue; and equal blame belongs to those 
- who fail in their duty through weakness of will, which is the same as

 saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and 

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

**owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted.**

The wise man _therefore always_ holds in these matters to this principle of selection:

>  he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
Soft Tabs Are Hard
Tags: indentation, bikeshedding, terminology
Published: 2023-06-08 13:03:41

Every time I hear people saying “hard” or “soft” when talking about indentation style, I feel it's the other way around, because what people call the “soft” way is to bake the visual width of indentation into the file, which can be thought as a typical instance of hardcoding, like in analogy with “hard wraps”.

Actually, they're saying “hard” or “soft” about “tabs”, not about “indentation”, so I understand it's okay to say baking tabs into the file as “hard tabs”. But wait...

Strictly speaking, what exactly we want to do is to *perform indentation*, not to *insert tabs or spaces* specifically. Tabs or spaces are just two naïve implementations of indentation. It sounds unnatural to me to use the words like “hard *tabs*” and “soft *tabs*” when talking about indentation. I don't know who has started such wording, but this is the time to reconsider what those words mean.

Instead I propose this wording: “**soft indentation**” and “**hard indentation**”. Just like the “soft wrapping” leaves where to insert line break to the renderer, “soft indentation” leaves how much width a single level of indentation takes to the renderer. On the other hand, “hard indentation” hardcodes it by encoding the width to the number of spaces. Quite natural, isn't it?

TL;DR, the correspondence is:

- **Soft indentation = Hard tabs**
- **Hard indentation = Soft tabs**

So, remember, **soft tabs are hard**.
Bean vs Component in Spring
Tags: springboot, spring
Published: 2023-06-09 16:45:06

## @Bean in Spring

1. more than one instance of class can be added to spring context
2. we can create bean of any class, from libraries classes as well as user defined classes
3. need to write specific code methods to create the instances
4. developer is in control of how to create & configure the objects
5. spring will create the beans based on the instructions, configuration specified by the developer

## @Component in Spring

1. only one instance of class can be added to spring context
2. only user defined class can be marked as component to instantiate as bean, library class objects can not instantiated
3. only the `@Component` annotation is required to add on class, no more code is required
4. developer will not have control on how to create & configure bean
5. spring framework is in charge of creating the bean & post that developer will have access to bean

------

> Sometimes you want to create bean based on the certain conditions are met. Developer can create the objects manually and register them to spring context with help of `context.registerBean("<name_of_bean>", <class_of_bean>.class, <Supplier>)` basic method. There are multiple ways you can register a bean.
How to determine which Python version your Jupyter notebook is using
Published: 2023-06-09 16:42:24

Have you ever spent an incredible amount of time trying to understand which version of Python your Jupyter Notebook is using, or how to install a library on it? The solution is actually quite simple.

All you need to do is run the following code block in your Jupyter Notebook:

```
import sys
print(sys.executable)
print(sys.version)
print(sys.version_info)
```

This will return information about the version of Python being used, as shown below:

```
/usr/local/opt/python@3.9/bin/python3.9
3.9.16 (main, Dec  7 2022, 10:15:43) 
[Clang 14.0.0 (clang-1400.0.29.202)]
sys.version_info(major=3, minor=9, micro=16, releaselevel='final', serial=0)
```

Ah!! Now everything is clear! You can also find pip3.9 in the `/usr/local/opt/python@3.9/bin/` directory, and there is also `pip3.9` that you can use to install library like :

`/usr/local/opt/python@3.9/bin/pip3.9 install dotenv`

Stay tuned for future improvements and next episodes on how to use an environment in Jupyter Notebook