teleren/devto huggingface dataset:
For Loops Pyramid
Tags: java, beginners, tutorial
Published: 2023-05-03 05:02:46

Lately I decided to learn a new programming language. I decided to go with Java because there is so many resources and it is relatively easy to learn. One of the first problems I solved using Java was to print a pyramid shape using for loops. It was a fun little problem so I would love to share my thought process.

This is what the pyramid shape is supposed to look like.
```java
    \*  
   \*\*\*  
  \*\*\*\*\*  
 \*\*\*\*\*\*\*  
\---------
```
I broke this down into multiple for loops. First I needed a for loop that would print a whole layer of the pyramid one by one. So let’s keep it simple and start with that.
```java
int num = 4;

for (int i = 1; i <= num; i++) {

  
  System.out.println("");

}
```
The num variable represents the number of layers that the pyramid will have. In the for loop we are printing a new line after each layer is created. Now we take another look at our pyramid and see that every layer starts with spaces first. The spaces are decremented after each layer. Also notice that num is equal to the number of spaces the pyramid starts with. We can use another loop to first print the spaces. It should look like this.
```java
int num = 4;

for (int i = 1; i <= num; i++) {

  for (int j = i; j <= num; j++) {  
    System.out.print(" ");  
  }

System.out.println("");  
}
```
Very simple right? In this new for loop we set the variable j equal to our variable i from the outer for loop. This is so that the correct number of spaces prints out after every layer is done. Next we need to actually print out the stars that will represent the body of the pyramid. Another simple for loop will do the trick. This for loop will start once the spaces for loop is done. It will look like this.
```java
int num = 4;

for (int i = 1; i <= num; i++) {

  for (int j = i; j <= num; j++) {  
    System.out.print(" ");  
  }

  for (int k = 1; k < (i \* 2); k++) {  
    System.out.print("\*");  
  }

System.out.println("");  
}

System.out.println("-----------");
```
Awesome! This new loop prints a star for every iteration. The difference here is that in the condition we check to see if k is less than i times 2. This is because each layer increments the number of stars being printed by 2. Notice we also added a line at the end that prints out the base of the pyramid once the body is done printing.

Nice pyramid! This is such a simple problem that helps you get used to using loops in different ways. There are other shapes you can try to print using loops in Java. For an extra challenge try inverting the pyramid. Have fun and happy coding. 😎
Excited to Join the Dev Community!
Tags: programming, webdev, beginners, learning
Published: 2023-05-02 22:58:38

Hey everyone, I'm thrilled to be joining the Dev community! My name is Karthikeyan and I'm an Undergrad Student in Computer Science who's passionate about tech and development.

I stumbled upon Dev while searching for a community of like-minded individuals who share my interests in software development, web development, and tech in general. I was immediately drawn to the vibrant and engaged community here and can't wait to get involved.

As I embark on my learning journey, I'm looking forward to sharing my experiences, insights, and challenges with you all. I'm particularly interested in Web Development at present, and I'm eager to explore many other tech stacks and learn from the diverse perspectives and expertise of this community.

I'm also excited to connect with other developers, share resources, and collaborate on projects. If you have any tips or advice for a newcomer like myself, please feel free to share them in the comments!

Thanks for welcoming me to the community. I can't wait to see what we can achieve together!
1Gom - Website liên kết tổng hợp mới nhất
Published: 2023-05-03 04:59:00

https://1gom.info/ 1Gom - Trang tổng hợp liên kết và link vào nhà cái cá cược lớn✔️ Đây là thương hiệu lớn nhất giúp người chơi yêu thích cá cược có thể tìm link vào nhà cái nhanh chóng✔️✔️✔️
13 Phố Tân Mai, Tân Mai, Hoàng Mai, Hà Nội, Việt Nam
093 2551 552
#1gom #1gominfo #1gomcom
https://velog.io/@1gominfo
https://pbase.com/1gominfo/1gominfo
https://plaza.rakuten.co.jp/1gominfo
https://penzu.com/p/4f5dfdd7
https://peatix.com/user/17140789
Understanding JavaScript Closures
Tags: javascript, beginners, tutorial, programming
Published: 2023-05-03 04:48:56

Today I am going to talk about a very confusing but fundamental topic in JavaScript programming. I had a hard time wrapping my head around JavaScript closures. After a very painful interview question on this topic I decided to really try and understand closures and why they can be useful. I will also do my best to explain it in a clear way. Let’s get started.

So what is a closure? A closure is a function bundled with references to its surrounding state. In clearer terms we could say that a closure is a function inside an outer function that has access to the outer function’s scope. The closure has access to its own variables, the outer function’s variables and the global variables. Just reading this might not make much sense so let’s look at an example.


![Closure Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g2z2o8jld03k00y6lu10.png)

We have two functions here. The outer function has a variable named ‘a’ and returns the inner function. The inner function has a variable named ‘b’ and accesses the variable from the outer function. After that we save the results of the execution of the outer function into a variable ‘myFunc’. That means that ‘myFunc’ is now holding the inner function. When executed we actually get the sum output on the terminal. Why? At first it might not make sense that this code actually works. In other programming languages, the local variables within a function exist for just the duration of that function’s execution. You might expect that after the outer function executes the ‘a’ variable would no longer be accessible. This is not the case in JavaScript thanks to closures. A closure is the combination of a function and the lexical environment where the function was declared. This environment consists of any local variables that were in-scope at the time the closure was created. This feature of JavaScript allows code like this to run. Things get a lot more interesting when these functions start taking arguments. Let’s take a look at an example.


![Closure Implementation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q8chitixt8c8m165bh9j.png)

Closures let you associate data with a function that operates on that data. This can be compared to how in object-oriented programming objects allow you to associate data with methods. As you can see we can save the closure into two different variables and the operation on different values. Even though the outer function already ran the environment within it is still accessible to the inner function because it was saved in memory. The environment is stored by the closure for its own later use.

I hope this will help anyone out there understand the basics of closures. It is a very interesting topic and there is still many more things I need to learn about it. Practicing with them will only help more. Questions about closures are frequently asked during interviews so it is very important to understand this concept in order to ace the interview. Happy coding! 😎
Bagaimana Cara Kerja Cost Per Impression (CPM)
Tags: jasabuatweb, website, jasapembuatanwebsite, jasawebsitebiz
Published: 2023-05-03 04:41:53


Cost Per Impression (CPM) adalah metrik pengukuran iklan online yang mengacu pada biaya yang dibayarkan untuk setiap ribu kali iklan ditampilkan atau tayang di depan pengguna. CPM adalah salah satu model pembayaran yang umum digunakan dalam iklan online, khususnya untuk kampanye branding. Dalam artikel ini, kita akan membahas cara kerja CPM dan faktor-faktor yang mempengaruhinya.

## Cara Kerja Cost Per Impression (CPM)

CPM adalah model pembayaran iklan online yang paling umum digunakan. Dalam model ini, advertiser membayar publisher atau platform per ribu tayangan iklan. Misalnya, jika CPM iklan Anda adalah $5, maka Anda akan membayar $5 setiap kali iklan Anda ditampilkan seribu kali di depan pengguna.

Setiap kali iklan Anda muncul di halaman web atau aplikasi, itu dihitung sebagai satu impresi. Impressions dihitung berdasarkan jumlah kali iklan ditampilkan ke pengguna, bukan jumlah pengguna yang melihat iklan.

## Faktor-faktor yang Mempengaruhi CPM
Ada beberapa faktor yang mempengaruhi CPM, di antaranya adalah:

## Niche

CPM dapat bervariasi tergantung pada niche atau industri dari iklan Anda. Niche dengan persaingan yang ketat mungkin memiliki CPM yang lebih tinggi.

## Target pasar: 

Platform iklan dapat menawarkan CPM yang berbeda-beda tergantung pada target pasar Anda. Misalnya, platform iklan yang lebih fokus pada target pasar B2B mungkin memiliki CPM yang lebih tinggi.

## Jenis iklan

Jenis iklan yang Anda gunakan juga dapat mempengaruhi CPM. Iklan video cenderung memiliki CPM yang lebih tinggi daripada iklan banner.

## Musim

CPM dapat bervariasi tergantung pada musim atau waktu tahun. Misalnya, CPM pada musim liburan mungkin lebih tinggi karena persaingan lebih ketat.

## Lokasi geografis

CPM dapat bervariasi tergantung pada lokasi geografis dari target pasar Anda. Beberapa wilayah mungkin memiliki CPM yang lebih tinggi daripada yang lain.

## Kelebihan dan Kekurangan CPM

Kelebihan CPM adalah advertiser dapat memperoleh banyak tayangan iklan dalam satu kampanye. Selain itu, advertiser dapat menentukan budget dengan lebih mudah karena mereka sudah mengetahui harga per ribu impresi.

Namun, CPM juga memiliki kekurangan. Karena advertiser hanya membayar untuk tampilan iklan, tidak ada jaminan bahwa iklan akan diingat atau memberikan hasil yang diharapkan. Selain itu, jika pengguna hanya melewati iklan tanpa memperhatikannya, advertiser akan tetap membayar untuk tampilannya.

Dalam kesimpulannya, CPM adalah metrik penting dalam industri iklan online. Dengan mengetahui cara kerja dan faktor-faktor yang mempengaruhinya, advertiser dapat memperkirakan biaya iklan yang diperlukan dan menyesuaikan strategi iklan mereka.

[jasa buat website bandung](https://jasawebsite.biz/)
Instalación y configuración de Jest + React Testing Library - Vite
Tags: tutorial, react, testing, vite
Published: 2023-05-03 04:35:36

Configuración rápida de Jest y react Testing Library en proyectos de React creados con Vite

### 1. Instalación de Jest:

```sh
pnpm i -D jest babel-jest @babel/core @babel/preset-env @babel/preset-react
```

### 2. Instalación de React Testing Library:

```sh
pnpm i -D @testing-library/react @types/jest jest-environment-jsdom
``` 

### 3. Opcional: Si usamos Fetch API en el proyecto con node inferior a la versión 18:

```sh
pnpm i -D whatwg-fetch
```

### 4. Actualizar los scripts del package.json

```json
"scripts: {
  ...
  "test": "jest --watchAll"
```
### 5. Crear la configuración de babel: babel.config.cjs en la raiz del proyecto:

```javascript
module.exports = {
    presets: [
        [ '@babel/preset-env', { targets: { esmodules: true } } ],
        [ '@babel/preset-react', { runtime: 'automatic' } ],
    ],
};
```
### 6. Opcional, pero eventualmente necesario, crear Jest config y setup en la raiz del proyecto:
#### jest.config.js

```javascript
module.exports = {
    testEnvironment: 'jest-environment-jsdom',
    setupFiles: ['./jest.setup.js']
}
```
#### jest.setup.js

```javascript
// En caso de necesitar la implementación del FetchAPI
import 'whatwg-fetch'; // <-- yarn add whatwg-fetch

```
Why I Created a Portfolio Checklist for JavaScript Engineers
Published: 2023-05-03 03:23:46

---
title: Why I Created a Portfolio Checklist for JavaScript Engineers
published: true
description: 
tags: 
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-05-03 03:22 +0000
---

## Introduction

As someone who has been in the tech industry for a while, I have noticed that many students and new professionals struggle with creating a portfolio that showcases their skills and experience. I have often been approached by students who have questions about how to create a portfolio that stands out and gets noticed by potential employers. This is why I decided to create a portfolio checklist that focuses on the most frequently asked questions that students ask me. My goal was to help newer students ask better questions and get better results.

## The Importance of a Portfolio

In the tech industry, a portfolio is crucial for showcasing your skills and experience to potential employers. It's your chance to show what you can do and what you have accomplished. However, many students struggle with creating a portfolio that stands out and accurately represents their skills. With my portfolio checklist, I aim to guide students through the process of creating a portfolio that accurately represents their skills and experience.

## The Most Frequently Asked Questions

When creating the portfolio checklist, I focused on the most frequently asked questions that I have received from students. These questions include:

- What should I include in my portfolio?
- How do I showcase my skills?
- How do I choose the right projects to showcase?
- How do I make my portfolio stand out?
- What do I need on my portfolio that I might not think of?

I hope to help students create portfolios that accurately represent their skills and experience by addressing these questions and providing detailed answers.

## Conclusion

Creating a portfolio can be a daunting task, especially for students and new professionals. However, with the right guidance and resources, it can be a great opportunity to showcase your skills and experience to potential employers. By creating a portfolio checklist that focuses on the most frequently asked questions, I hope to guide newer students through the process of creating a portfolio that accurately represents their skills and experience. I encourage all students and new professionals to check out my portfolio checklist and use it as a guide to creating their own successful portfolios.

Check out my portfolio checklist for JavaScript Engineers [here](https://www.notion.so/Portfolio-Checklist-for-Javascript-Engineers-44e9b849bf6d4c5db8273993dfd748c3).
Creating a Virtual Machine within 60 seconds using Quickstart Template in Azure
Published: 2023-05-03 04:15:07

CREATING VIRTUAL MACHINE WITHIN 60 SECONDS USING Quickstart Template IN AZURE

## Step 1
Login to Azure portal, search and click on Custom deployment, after that select Linux Virtual Machine and then select Quickstart template

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

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



## Step 2
Create a resource group, add username and password then leave other information as default, next click on Review+ create; finally click **create**

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

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

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




Note after deployment a simple Linux Virtual Machine is created

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

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



The Linux Virtual Machine is running

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yejv0kzp715wxdi8u6kj.png)
How To Set Up Rails Devise
Published: 2023-05-03 03:52:54

Usually when I implement authentication I build it from scratch. Most of my projects have been like that. Even though I heard about devise I just felt comfortable building it this way because I felt that I had more choice. Finally after looking for more things to learn about I decided to give devise a try. I was very surprised with how easy it is to implement devise into rails. It makes authentication so painless. Today I am going to show how I set up devise using rails.

First we are going to start with a new application so run rails new like this.
```bash
$ rails new rails\_devise rails
```
First we are going to go inside of our Gemfile and add the devise gem and then bundle. After that run the generator.
```bash
$ bundle install
$ rails g devise:install
```
When you run the second command you will get a set of instructions that will need to be completed. First you will have to define default url options in your environment file. This is the example that is given in the instructions and will work just fine. Make sure to copy and paste it in config/environments/development.rb
```ruby
config.action\_mailer.default\_url\_options = { host: 'localhost', port: 3000 }
```
Next we have to make sure that we define a root route. So go to routes.rb and add this.
```ruby
root to: "home#index"
```
Next we have to add flash messages in our views layout. This is to make sure we get an alert if something is not right when entering the information into our form. Add this line of code in the body of app/views/layouts/application.html.erb
```erb
<p class="notice"><%= notice %></p>  
<p class="alert"><%= alert %></p>
```
The final instruction is optional but I am going to use it to set up the devise views. This will make it easier to get started and show how devise works.
```bash
$ rails g devise:views
```
We don’t have a home controller yet so let’s get that set up before we run the server.
```bash
$ rails g controller Home index  
$ rails s
```
We have a home controller with and index action now. Now to finally start signing in users let’s generate a user model with the devise command and migrate.
```bash
$ rails g devise User  
$ rails db:migrate
```
Now we have to look for the appropriate route. To easily see the needed route for the sign up page type this into the terminal.
```basg
$ rails routes | grep users
```
Travel to the new\_user\_registration path and you will see a fully functioning sign up form thanks to devise views.

That was very straightforward and painless. I will be using devise for many of my projects in the future. Thanks for reading and happy coding! 😎
Implementing an Azure Function App
Published: 2023-05-03 03:13:52



## Definition
Azure Functions is an event driven server less computer platform; with Azure Functions application can be deployed and scaled in the cloud. Note automatic scaling is possible depending on the workload volume. It supports several programming languages like python, Java, JavaScript, C# etc. Azure function apps houses the execution of functions hence allows functions to be grouped for convenience in deployment, management, resource sharing and scaling as a logical unit. Below are steps for creating Function  App

## Step 1
Login to Azure portal and click create a resource
Find Function App on the search bar in the marketplace and click on Function App
Click on create under the function app plan
Fill in the instance details to create the function app that are the function app name, the method of publishing choose code, runtime stack choose  .Net, version and region. Then select windows the operating system and consumption (server less) for the plan type
To enable the Application Insights select yes under monitoring then click **Review + Create**

## Step 2
Click on **create** which initializes the deployment process
Completion of the deployment provides us with the **'Go to Resource**' button to access the service instance we created.
Now the details of the Azure Function are obvious and the URL showcased to explore. The Metrics visualized for memory functions execution count and time duration of the execution unit. 

 

## Creating the trigger

## Step 3
Under the function in the left menu click on **Functions**, next click **create** button. Now we are provided with the Development Environment via the portal, note we are given the choice of the template we want to use options as HTTP trigger, Azure Queue, String Trigger, Azure Event Hub Trigger etc
Select the HTTP trigger  then name New function and set the authentication level to function, after setting all click on **create**

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


## Step 4
 The notification is updated about the creation of the function  [ new function name] visit the details page of the function to see visualization in details, also note here that status is enabled that is currently running

## Function testing

## Step 5
Go to developer menu, select Code + Test. Now we have the HTTP trigger code. Click to **Get function URL**. Set key to default and copy the URL

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


## Step 6
Go to your browser and paste the URL. We can now see the HTTP trigger success message that the HTTP triggered function has been created successfully
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4zk9l9opaaa2czjdf9p4.png)


then add your name or a name at the end after ==
Hello Okonkwo. This HTTP triggered function executed successfully.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k6km75yi1g1o1spev5i5.png)
Java Spring OSIV
Tags: java, spring, programming, development
Published: 2023-05-03 03:01:09

OSIV, the Spring implementation of a transactional pattern that links persistence sessions and requests life cycles, can cause significant issues in production. It's enabled by default and issues will only appear when software systems are to be scaled. This blog addresses common questions related to OSIV and provides effective solutions to resolve them.

Please check it out and let me know your thoughts.
[https://blog.devgenius.io/osiv-lazyinitializationexception-46a0b630b421]
(https://blog.devgenius.io/osiv-lazyinitializationexception-46a0b630b421)