teleren/devto huggingface dataset:
A Quick Puzzle to Test Your Problem Solving
Tags: beginners, devjournal
Published: 2023-03-25 01:27:08

The main takeaway I got from this exercise, is that it's okay to admit that sometimes the easiest answer to a problem is the simplest one. Instead of coming up with a million options for a more complicated answer which in turn will make the process of fixing the problem more tedious. This honestly helped me to step back because I am a big offender of always looking for the hardest answer when the answer is either 0 or "No."



https://www.nytimes.com/interactive/2015/07/03/upshot/a-quick-puzzle-to-test-your-problem-solving.html
Animation -16 : Pure CSS Rotating Loader
Tags: css, programming, animation, design
Published: 2023-03-25 00:54:00

Are you looking for animations to enhance your website? We've got you covered with our wide selection of creative and engaging #animations. Say goodbye to endless searching and hello to seamless integration on your website!

#### We're excited to introduce our latest YouTube series, which features diverse creative and inspiring website animations.

---

In our short videos, you'll find a variety of #animations that can be easily implemented on your website to enhance user experience.


---

### Pure CSS Rotating Loader 

---

{% youtube K4SkSyHnm3o %}

 ---
### [Source code](https://democoding.netlify.app/loaders/pure-css-rotating-loader)


---
## For more information

1. Check my GitHub profile
[https://github.com/amitSharma7741](https://github.com/amitSharma7741)

2. Check out my Fiver profile if you need any freelancing work
[https://www.fiverr.com/amit_sharma77](https://www.fiverr.com/amit_sharma77)

3. Check out my Instagram
[https://www.instagram.com/fromgoodthings/](https://www.instagram.com/fromgoodthings/)

4. Check out my Facebook Page 
[Programming memes by Coder](https://www.facebook.com/programmingmemesbycoders)

5. Linktree
[https://linktr.ee/jonSnow77](https://linktr.ee/jonSnow77)

6. Check my project

- EVSTART: Electric Vehicle is the Future
[https://evstart.netlify.app/](https://evstart.netlify.app/)
-  News Website in react
 [https://newsmon.netlify.app/](https://newsmon.netlify.app/)
-  Hindi jokes API
 [https://hindi-jokes-api.onrender.com/](https://hindi-jokes-api.onrender.com/)
- Sudoku Game And API
[https://sudoku-game-and-api.netlify.app/](https://sudoku-game-and-api.netlify.app/)

---
---
How to Validation Credit Card PHP Laravel ??
Tags: creditcard, validation, mastercar, laravel
Published: 2023-03-25 00:50:03

How to Validation Credit Card PHP Laravel ??


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5vbcaz5bxpimidwgn5le.jpg)

there is a question in mind for some Developers How do some Websites check the type of Credit Card and then Submit it to the API Visa or Master Card, etc. … How is this Working?

I will today offer a library in Laravel to Provide the Solution in just 2 lines of Code !! 

https://github.com/sfyanbel/CreditCardValidation 
How to install it in your Laravel Project?
`composer require sfyanbel/credit-card-validation`

 How to use

```
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use sfyanbel\CreditCardValidation\CreditCard;

class TestController extends Controller
{
    
    function test(){
      
        $ob = new CreditCard();
        return $ob->getTypeCreditCard("43943418067844");
        
    }

}
```
in This Example, we use this Card "43943418067844" and this will return the Following `['Visa',2]`
first index name of the Card
second index id of the Card
and for other Card, you will find this


```
['AmericanExpress',1] , ['Visa',2] , ['MasterCards',3] , ['Discover',4]
```

and for other numbers not Defined

```
['String incorrect'];
```
This is in case the length of the card numbers is incorrect

```
['The count of digits is incorrect'];
```
TIL. I started to collaborate with some teammates on some projects.
Tags: rails, ruby, webdev, programming
Published: 2023-03-25 00:44:43

Today, I started to collaborate with some other developers like myself that are looking for a more collaborative approach at creating apps from scratch. Also, we want to get in tune with the work flow of being in a team and how to work off of branches and how to task each other with responsibility and commit to deadlines.
Graph Databases in PostgreSQL: Apache AGE
Tags: apacheage, database, cypher, postgres
Published: 2023-03-25 00:32:15

Graph databases have gained popularity in recent years due to their ability to handle complex relationships between data. Unlike traditional relational databases, which store data in tables, graph databases represent data as nodes, edges, and properties. Nodes represent entities, edges represent the relationships between those entities, and properties represent the attributes of both.

PostgreSQL, a popular relational database, can also function as a graph database through the use of an extension called [Apache AGE](https://age.apache.org/). With Apache AGE, users can leverage the flexibility and scalability of graph databases while still utilizing PostgreSQL's advanced SQL querying capabilities and transaction support.

To use Apache AGE, users must first install it as an extension and then model their data as nodes and edges. Apache AGE comes with its own set of SQL extensions, similar to Cypher, that allows users to query their graph database. However, users can also still use SQL to query their graph database if desired.

For those new to graph databases, Apache AGE comes with a [tutorial](https://age.apache.org/age-manual/master/intro/overview.html) to help them get started. Additionally, you may use the #apache-age tag for questions on Stack Overflow, join the [project's Discord channel](https://discord.com/invite/NMsBs9X8Ss/), or open an issue on GitHub, the Apache AGE community is readily available to provide support and answer questions.

Overall, graph databases offer a new way of thinking about how to store and query complex relationships between data. With Apache AGE, users can easily transform their PostgreSQL database into a graph database and take advantage of the benefits that come with this type of database.

https://age.apache.org/
https://github.com/apache/age
Git e Github para iniciantes: entendendo de forma simples
Tags: webdev, github, braziliandevs
Published: 2023-03-24 23:39:14

Se você é novo no mundo do desenvolvimento, provavelmente já ouviu falar de Git e Github. Essas ferramentas são essenciais para gerenciar código, colaborar com outras pessoas, registrar a sua evolução como desenvolvedor e mais! Só que, no começo a gente pode pensar que são as mesmas coisas e pode ser complicado entender como funciona. Neste artigo, vou explicar de forma simples essas ferramentas.

## Github: a rede social

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



Github é uma plataforma de hospedagem de código que funciona como uma rede social. Seu objetivo é permitir a colaboração de desenvolvedores em projetos de software. Com o Github você pode criar repositórios (que por enquanto podemos chamar de pastas) que armazenam arquivos de um projeto. É possível criar quantos pastas (ou repositórios) que quiser e, se desejar, colocar as aplicações online. Muitos recrutadores usam essa rede social para ver quais projetos o candidato já fez.

Por exemplo, se você estiver criando um site com HTML e CSS, poderá enviá-lo para sua página no Github. Quando o recrutador abrir seu perfil, verá todos os projetos/códigos que você já fez e poderá avaliar suas habilidades. Além disso, você pode colaborar em projetos de outras pessoas, "puxar" alguns códigos para sua máquina e disponibilizar os seus.

## Git: o versionador de códigos

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



Git é um versionador de códigos que você instala em sua máquina. Ele permite que você salve versões de um projeto e recupere-as facilmente quando necessário. Isso significa que você pode criar várias versões de um projeto, trabalhar em novas funcionalidades e voltar a uma versão anterior se algo der errado.

**Mas o que é é versionador?**

Vamos para um exemplo prático. Suponha que você esteja trabalhando em um site e, de repente, uma nova funcionalidade que você adicionou causa problemas em outras partes do site. Com o Git, você pode voltar facilmente à versão anterior do código onde tudo estava funcionando. Isso é versionar, ter várias verões do seu código. Isso é possível porque o Git armazena todas as alterações em "branches" (ramificações), permitindo que os desenvolvedores trabalhem em novas funcionalidades sem mexer no código original.



Agora você já sabe o que é Git e Github! Ambas as ferramentas são essenciais para qualquer desenvolvedor de software. Agora você pode instalar e criar uma conta no [Github] (http://github.com/) (a rede social) e caso não tenha, [instalar o git] (https://git-scm.com/). É importante já se aventurar um pouco nso dois. Crie pastas, entre em diretórios, volte e teste tudo. Vai sem medo, viu? Até a próxima.




![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xn6iw7qrx4gcpct5xq07.gif)
Zerando HackerRank ( 22 )
Published: 2023-03-24 23:35:20

E no vigésimo segundo episódio desta serie que queima os miolos, vamos abordar um problema envolvendo um problema descrita como rotação circular reta em uma matriz de números inteiros.

Neste desafio temos John Watson, um personagem que conhece uma operação chamada rotação circular reta em uma matriz de números inteiros. Uma operação de rotação move o último elemento da matriz para a primeira posição e desloca todos os elementos restantes para a direita.

Para testar as habilidades de Sherlock, Watson fornece a Sherlock uma matriz de números inteiros. Sherlock deve executar a operação de rotação várias vezes e determinar o valor do elemento em uma determinada posição.

Para cada array, devemos executar um número de rotações circulares à direita e retornar o valor do elemento em um determinado índice.

Para resolver este problema, vamos completar a função "circularArrayRotation", ela deve retornar uma matriz de inteiros representando os valores nos índices especificados.

Esta função vai receber os seguintes parâmetros:

**a**: uma array de números inteiros.

**k**: um número inteiro necessario para a contagem de rotação.

**queries**: uma lista de índices para relatar.

Nossa função fara 2 ações para resolver o problema:

Primeiro ela realiza uma rotação circular da matriz "a" para a direita "k" vezes, ou seja, o último elemento da matriz passa a ser o primeiro elemento e os demais elementos são deslocados para a direita. A função utiliza um loop "for" que executa "k" vezes e a cada iteração, remove o último elemento da matriz "a" utilizando o método "pop" e adiciona esse elemento no início da matriz "a" utilizando o método "unshift".

Segundo a função retorna uma nova matriz (array) que contém os elementos de "a" nos índices especificados na matriz "queries" após a rotação da matriz "a". Para isso, utiliza o método "map" que percorre a matriz "queries" e retorna um novo array contendo os elementos da matriz "a" nos índices especificados em "queries" após a rotação.

Resumindo, essa função recebe uma matriz, realiza uma rotação circular para a direita "k" vezes e retorna um novo array contendo os elementos da matriz original nos índices especificados em "queries" após a rotação.

Nossa função vai ficar assim:

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

E assim fechamos mais um desafio.
Python If/else statements
Tags: python, javascript, programming
Published: 2023-03-24 21:40:28

Today I decided to tackle one of my first Python labs on conditional statements. At first glance the simpleness of Pythons syntax writing really stands out compared to JavaScript. 

In JavaScript a developer has to know operators like "||"(or) as well as "&&"(and), in Python its as simple as using the words and/or. While it doesn't seem like a huge difference maker, when I first started learning JavaScript, I saw that I would often times overlook the operators or forget which were which.


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

Even though the examples above are straight forward and not complex, i'm still proud of my ability to translate what I know from JS so easily into writing Python functions. With Python, we don't need parenthesis or curly brackets left and right. If you are like me thats a small difference that can go a long way when writing a lot of code and debugging.

In Python, prior to version 3.10, there was no equivalent to a switch/case statement, we are able to flawlessly integrate a regular if/else statement, as shown with the calculator function example.

One aspect of Python functions that is new to me and I am excited to learn is the use of Dictionary Mapping. With Dictionary Mapping we are able to take a long list of conditions and instead of writing if/else statements until our hands hurt we are able to group all the conditions and values into a dictionary.

`dog = "cuddly

dict_map = {"hungry": "Refilling Bowl",
            "Playful": "Play a game",
            "Cuddly": "Snuggle"}

owner = dict_map.get(dog, "Reading Newspaper")
`

With this above method, we are able to apply the state of the dog to the dictionary keys and apply the state of the owner to the values of the dictionary.

So far for my first week with Python, I can see why this is considered one of the most popular programming languages, I am excited as I continue down the path of mastering Python!
Should I Choose Tailwind or Vanilla CSS?
Tags: webdev, css, discuss, frontend
Published: 2023-03-24 23:23:28

So lately, I've started to break some habits.  I am not great at managing CSS but I've really pushed myself to keep myself organized.  I've tried to use inline styles only sparingly and I've really seen the benefit of using a separate stylesheet and working with classes to give style individual elements.  This for the most part has worked pretty well and I like it.  One of the main things that I like about this method is that it pushes me to be more organized.  Everything has its place and everything looks cleaner and more organized.

Now more recently, I started to look into Tailwind CSS because of course it's the newer trendier thing that seems like everyone is using.  I've used a bit of the other CSS libraries out there, of course especially Bootstrap, but I wanted something that can of course make things easier but also give me some flexibility.  I don't know about you but I'm kind of tired of everything looking like Bootstrap.

Lately, as I dive into Tailwind, there are of course many things to like about it.  While I like the idea of keeping everything very clean, I do like the idea that I don't need to leave the HTML or JSX to see changes.  Also, it seems as though I can make changes to style much quicker than with the old way of doing things.  There is much less typing than there is in Vanilla CSS to accomplish some of the same things.  Also, there are so many more options than there is with Bootstrap and even if I don't like the built in options, which there are very many, I can very easily adjust the style to how I like it.

All of this being said, I'm not exactly sure if I'm sold on Tailwind, and this is for one reason.  Tailwind definitely makes the HTML or JSX a bit more difficult to read because now there are many more classes that are written into the elements.  It doesn't look as clean nor as organized as it was before and there is a part of that that bothers me.  I'm not sure if I just need to get over that or move on and find a different alternative.

Let me give an example, let's say that I want to adjust the margin and the padding of a div.  With Vanilla CSS I would create a class in a separate CSS file, and inside of this class I would put all of my adjustments. Then I add the class to that div element which applies that style.

```
.vanilla {
  margin-top: 12px,
  margin-bottom: 12px,
  padding-left: 12px,
  padding-right: 12px
}

<div class="vanilla"></div>

```

In Tailwind the same can be achieved by putting everything into the div element.

```
<div class="mx-3 py-3"></div>

```
When I insert mx-3, this adjusts the margin of the element on the x axis by 12 pixels, and py-3 adjusts the padding on the y axis by 12 pixels.  This is much less code than the Vanilla CSS.  Also, if you want to have a separate CSS file you can but it's not necessary.  It's also very fast to change styling on the fly.

I know that many people will tell me about Sass or many different libraries, and I think that's all great but right now for me, I think I'm going to try Tailwind for a while.
What is Kotlin Reified Type Parameter?
Tags: kotlin, beginners, android
Published: 2023-03-24 23:00:00

**Simple example to understand reified type parameters in Kotlin**

One of the most common uses of this `reified` type parameter is [view model creation](https://vtsen.hashnode.dev/view-model-creation-in-jetpack-compose). For example, the following code is the `viewModels()` composable helper function to create the view model.

```kotlin
@Composable
public inline fun <reified VM : ViewModel> viewModel(
    viewModelStoreOwner: ViewModelStoreOwner 
        = checkNotNull(LocalViewModelStoreOwner.current) {
        "No ViewModelStoreOwner was provided via LocalViewModelStoreOwner"
    },
    key: String? = null,
    factory: ViewModelProvider.Factory? = null
): VM = viewModel(VM::class.java, viewModelStoreOwner, key, factory)
```

It has 3 parameters, and it calls another `viewModel()`, but let's simplify this view model creation for the sake of understanding this `reified`.

Assuming you have

```kotlin
class MyViewModel {}
```

## Class Type Parameter

and you want to create an instance of `MyViewModel` by its class type (i.e. `MyViewModel::Class.java`), you want to call `(MyViewModel::class.java).getDeclaredConstructor().newInstance()`.

To make it a helper function, you create the following:

```kotlin
fun <T>viewModel(classType: Class<T>): T {
    return classType.getDeclaredConstructor().newInstance()
}
```

To create the view model, you call `viewModel(MyViewModel::class.java)`

```kotlin
val viewModel = viewModel(MyViewModel::class.java)
```

You cannot use `T::class.java` directly, thus you need to pass in as `Class<T>` parameter into the `viewModel()` function.

> This limitation is called **Type erasure** because the JVM platform doesn't support generic types. The generic type is lost when we compile Kotlin to JVM bytecode.
> 
> However, Kotlin overcomes this limitation with `Reified` type parameter.

## Reified Type Parameter

Instead of using the class type parameter above, you can use the reified type parameter. So you change the `viewModel()` helper function to the following.

```kotlin
inline fun <reified T> viewModel(): T {
    return (T::class.java).getDeclaredConstructor().newInstance()
}
```

> Please note that you must specify the `inline`.

With `reified T`, you can access the class type (i.e.`T::class.java`) and you don't need to pass it in as in the previous example.

To create a view model, you call `viewModel<MyViewModel>()`

```kotlin
val viewModel = viewModel<MyViewModel>()
```

or you can also call `viewModel()` direction without passing the class name, but you need to declare the `viewModel` variable type which allows the Kotlin compiler to infer it.

```kotlin
val viewModel: MyViewModel = viewModel()
```

## Conclusion

Inline `reified` type parameter is another fancy way of passing class type(i.e. `Class<T>`) in your function. The caller no longer needs to explicitly pass in the class type parameter anymore into a function.

---

*Originally published at [https://vtsen.hashnode.dev](https://vtsen.hashnode.dev/what-is-kotlin-reified-type-parameter)*.
FREE AWS Cloud Project Bootcamp Week 5 Part 4
Tags: aws, cloud, awscommunity, 100daysofcloud
Published: 2023-03-24 22:59:39

[83/100] #100DaysOfCloud Today, I did a part of the Week 5 of the FREE AWS Cloud Project Bootcamp by Andrew Brown.

Here's what I completed:
- I completed implementing the code for Pattern A, B and C but ended up with an error. I think the error is due to the cognito user and the user in the local being different or something. I will be checking on it tomorrow and updating it here with pictures once solved.
    - Implement (Pattern A) Listing Messages in Message Group into Application.
    - Implement (Pattern B) Listing Messages Group into Application.
    - Implement (Pattern C) Creating a Message for an existing Message Group into Application.
    - Implement (Pattern D) Creating a Message for a new Message Group into Application.

[GitHub](https://github.com/aaditunni/100DaysOfCloud/blob/main/Journey/083/Readme.md)

You can watch the Bootcamp through this YouTube playlist : [FREE AWS Cloud Project Bootcamp playlist](https://youtube.com/playlist?list=PLBfufR7vyJJ7k25byhRXJldB5AiwgNnWv)
How to Create a Windows Virtual Machine in Azure
Published: 2023-03-24 22:43:58


In the early days of computing, systems were always physical, meaning that a computer was a discrete collection of hardware that ran an operating system and often used various input and output devices.
Imagine a data center where every computer is a separate, physical device. You can also imagine that the requirements for power, cooling, networking, and management would be significant.

Virtualization changed that model. Although physical computers are still a major component of many organizations’ IT infrastructure, organizations are increasingly moving toward the use of virtual machines (VMs).
A virtual machine is an emulation of a computer system that provides the functionality of a physical computer.

**Below is a step by step on how to create a windows virtual machine in Azure**

1. Log in to your Azure account at https://portal.azure.com

2. From the Azure Portal dashboard, click on the "Create a resource" button in the upper left-hand corner of the screen.

3. Type "Virtual Machine" in the search bar and select "Virtual Machine" from the search results.

4. On the "Basics" tab, select the subscription you want to use, and then create a new resource group or select an existing one.

5. Give the virtual machine a name and choose the region where you want to create the virtual machine.

6. Select the image for the virtual machine. You can choose from a list of pre-configured images provided by Microsoft or use your custom image.

7. Choose the size of the virtual machine by selecting the desired number of cores and amount of RAM.

8. On the "Settings" tab, configure the desired settings for your virtual machine, such as storage options, network settings, and administrative account details.

9. Customize any additional settings, such as extensions or boot diagnostics.

10. Finally, review all the settings and click on the "Create" button to create the virtual machine.

11. You have now created a virtual machine in the Azure Portal. You can now access your virtual machine via Remote Desktop, SSH or Azure PowerShell, depending on your desired configuration.

The image below illustrate a windows virtual machine created in Azure.

**fig. 1.1 shows the illustration on how windows virtual machine in Azure is being created.**

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

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

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

**fig1.2 shows a virtual machine created in Azure which is ready for use.**

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

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