teleren/devto huggingface dataset:
Java Programming #1: Getting Started
Published: 2021-12-02 10:38:35

In this article, I will show you how to getting started in learning java programming language. Before doing anything related to programming, let us consider the environment in which will be use to writing the coding.

---

## 1. Text Editor or IDE
In general, people usually use either **Text Editor** (Visual Studio Code, Atom, etc.) or **IDE** (Intellij, Eclipse, etc.). But in this tutorial, we will use Intellij IDE for the coding environment. You can use either the **Community Edition** or the **Ultimate Edition**, as for a side note, Intellij Ultimate Edition is not free, however, if you have student mail account, you can register that account for a **free student license**. The following is the logo of the Intellij IDE.

![Intellij Logo, taken from https://commons.wikimedia.org/wiki/File:IntelliJ_IDEA_Icon.svg](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vnar2yzcc4jk0e0ajk7q.png)

---

## 2. Installation
To perform the installation, you can refer to this page from the official Jetbrain's Intellij IDE [here](https://www.jetbrains.com/help/idea/installation-guide.html#toolbox). After installation is completed, you can go create a new project (you can name the project as you like), and create a new _class_ file called `Main.java` inside the `src` folder. You can refer to the following screenshot for this step (Let me know if the text is too small or not).

![Step.1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m6qpdtngsgc5seu4zv81.png)

---

## 3. Your First Program
To confirm that you have installed the IDE successfully, you can type the following code inside the `Main.java` class that you have made previously.
```java
public class Main {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}
```
After typing the above code, you might notice that there will be a green play button on the leftside beside the line number. Click that green play button, choose `run`, and you will see an output "Hello World" in the terminal below. You can refer to the following screenshot for this step.


![Step.2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/135s4fdqcdio2tifo7ki.png)

If the above output match with your output, CONGRATS.. you are a Java Developer now :sunglasses:

---

I hope that my article helps you to getting started in learning Java programming language. You can give this article some comments, as any feedback is very valuable and important to me (also suggest me some ideas that you think I need to cover). Thank you for reading this article, and have a nice day :smiley:

---

**References**
- https://commons.wikimedia.org/wiki/File:IntelliJ_IDEA_Icon.svg
- https://www.jetbrains.com/help/idea/installation-guide.html#toolbox
- https://i.picsum.photos/id/8/1920/1080.jpg?hmac=ZWQsrAG-h-Ip98by6rfqjHRyvoEe1IKeeT2rbHCcoH4
Sample code to setup Selenium, chrome driver with a java project
Tags: java, testing, programming, testdev
Published: 2021-12-02 10:35:54

Slenium is popular open source project that consists of a range of tools and libraries. Here is the most basic example to get started selenium with a java project.

At the core of the selenium is [webdriver](https://www.selenium.dev/documentation/webdriver/). 

It is a powerful API that drives a browser natively, just as a user would do.

Major components of webdriver are - selenium client library, JSON wire protocol over HTTP, browser drivers, and browsers.

To get started first, [download](https://chromedriver.storage.googleapis.com/index.html?path=96.0.4664.45/) webdriver version 96. Select the webdriver version as per the chrome browser version where the tests will be executed.

Get `chromedriver_linux64.zip` file and unzip it the project directory. 

The project that I am using here is a java project created using gradle build.

The next step is to unzip and copy the driver the project directory.

`unzip /tmp/chromedriver_linux64.zip -d <PROJECT_DIR>/webdriver/v96/ `

Once the driver is ready, now it is time to write a sample program.

Make sure program should import the selenium related packages from [org.openqa.selenium](https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/package-summary.html)

```
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class SeleniumBasicExample { 
 final static String PROJECT_PATH = System.getProperty("user.dir");
  public void run() 
    throws Exception
     {
      System.setProperty("webdriver.chrome.driver", PROJECT_PATH + "/webdriver/v96/chromedriver");
      ChromeOptions chromeOptions = new ChromeOptions();
      chromeOptions
        .addArguments("--headless")
        .addArguments("--no-sandbox");

      WebDriver driver = new ChromeDriver(chromeOptions); 
      driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
      
      // set any url for test, here is an example with google
      driver.get("https://google.com");
      Thread.sleep(1000);
      if (driver.getPageSource().contains("I'm Feeling Lucky")) {
       log("pass");  
      } else {
       log("fail");
      }
      driver.quit();
     }
}
```


Here is the output of the above program -

![selenium output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f2nytr3qd1te2onxmc1h.png)

Download [SeleniumBasicExample](https://github.com/skypy/aqua/tree/main/app/src/main/java/aqua/samples)
Brand New Podcast for Engineering Managers 🎙️
Published: 2021-12-02 10:28:18

Hi everyone! 

I want to share our podcast "Grow This - Grow That", that we make for the dev community.

Ace launches a new series of episodes with Engineering Managers. In this season we touch upon such topics as Productivity, Growth, Leadership, Motivation & Retention in engineering teams. 
Here's [the link to the podcast](https://community.getace.io/) for you to check it out! 

Today I want to tell you more about our new episode. Our 3rd episode is definitely special. This time we invited Engineering Leaders from Y Combinator Top Companies - **André Luís** (GitLab), **David Stanley** (Webflow), **Andrey Rebrov** (Scentbird). Each one of our guest is the true specialist with extensive experience in software development and engineering management.

![YC Special Episode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qoubou7xfwmw91ig4ebs.png)

In this episode, we discussed Leadership in Engineering Teams. We talked about how to become a great leader for your team, what skills are required to become one and how to lead your team to a higher performance level. Our guests kindly shared their own experience in building the culture of trust and becoming the leader in their teams.   

Please Listen & Subscribe! 
[Anchor](https://anchor.fm/gtgt/episodes/Engineering-Leadership-with-Andr-Lus--David-Stanley--Andrey-Rebrov-YC-Special-Episode-e1apvjk)
[Spotify](https://open.spotify.com/show/20j5B5P2ISw9YiVcNBaIXp)
[Breaker](https://www.breaker.audio/grow-this-grow-that-1)
[Apple Podcasts](https://podcasts.apple.com/ru/podcast/grow-this-grow-that/id1554083171?l=en)
[Google Podcasts](https://podcasts.google.com/feed/aHR0cHM6Ly9hbmNob3IuZm0vcy80ZDMxMmM4Yy9wb2RjYXN0L3Jzcw==)

Enjoy listening!
Clean Loading Animation
Tags: css, webdev, beginners, tutorial
Published: 2021-12-02 10:24:28

In this article, we are going to build another loading animation with pure CSS. First, let's look at what are we building -

![preview](https://i.imgur.com/npSZAhG.gif)


Now let's look at the code now - 

### HTML
```html
<div class="loading_container">
  <div class="loading"></div>
  <h3>loading...</h3>
</div>
```


We have the main `div` with class `loading_container` and it has two children `loading` and `h3`. 

- `loading` - It is the main loader for this animation
- `h3` : it is the text which you can see in the preview


### CSS

```css
/* Outer Loading Container */
.loading_container {	
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 150px;
}

/* Loader */
.loading {
  width: 100%;
  height: 100%;
  border-radius: 150px;
  border-right: 0.3rem solid white;
  animation: animate 2s linear infinite;
}

/* Animation */
@keyframes animate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }

/* loading text */
.loading_container > h3 {
  color: #fff;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
```

{% codepen https://codepen.io/j471n/pen/gOWbjam %}

[![](https://imgur.com/MNtTdVp.png)](https://codepen.io/j471n/pen/gOWbjam)


## Conclusion

So after that you can use it anywhere in your project. And let me know what do you think about it. If you like it then consider a follow.

> You can now extend your support by buying me a Coffee.😊👇
[![buymecoffee](https://imgur.com/2QWo3cm.png)](https://www.buymeacoffee.com/j471n)

### Also Read 

- [Curved Timeline in CSS](https://dev.to/j471n/curved-css-timeline-5ab3)
- [How to use Web Storage API? ](https://dev.to/j471n/how-to-use-web-storage-api-3o28)
- [10 CSS Resources that you should bookmark](https://dev.to/j471n/10-css-resources-that-you-should-bookmark-46l6)
Github Wrapped 2021
Tags: github, yearinreview, awesome
Published: 2021-12-02 10:11:48

Hello everyone!
The year's coming to an end and with that the possibility to pass the last year in our heads and think about everything we have done, especially in tech and open source!
Hence, the ability to [generate](https://skyline.github.com) yourself a "skyline" made out of your individual contributions! 
You'd only need to change the year in the URL to 2021.

Another cool tool is GitHub Wrapped 2021 showing you stats of this year (https://lowcode.land/ghwrap).

I hope I could spark some nostalgia about this year already ;D
Bug or a simple error happened in dev.to
Published: 2021-12-02 09:58:44

Hi, I visited dev.to today and i found this in the home page, it can be some css styling issues but I'm bored right now so here you go:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2wx7xazjoq1vf4jublf5.png)
tell me if i have to delete this post.
Which is the Best online Sitecore training institute
Published: 2021-12-02 09:56:06

## Best Sitecore online Training institute

HKR Training is the best Sitecore online training institute. where you get the benefits of learning from the world-class trainers 

HKR trainings offers 100% real-time, practical and Job Oriented Sitecore Training online. Our Sitecore course focuses from fundamental level training to advanced level training. SiteCore CMS is organization content management system platform that allows a fully featured and linked user experience. It is one of the effective and protected CMS system for creating and fascinating enterprise Web alternatives. 

**About HKR Training:**

HKR Training excels at providing you with the best online classes with high-quality facilities at a low price without any compromise on quality. What can you expect from us? A dedicated learning platform with 24*7 support, best in class training materials to help you learn advanced techniques and practical knowledge of all IT Technologies.

Our courses are specifically curated for both professionals as well as job-seekers. Online classes conducted by the best knowledgeable and certified trainers help you earn certification at your convenience.

For information please visit our website:-
[(https://hkrtrainings.com)]

To Attend Free Demo (Or) for any Queries Write to us at
[email protected] (or) Call us on
USA:- 1 (818) 665 7216, INDIA - 91 9711699759

Schedule and Attend Free Demo here!
[(https://hkrtrainings.com/sitecore-training)]
Working With Remote Docker Using Docker Context
Tags: docker, beginners
Published: 2021-12-02 09:09:45

---
title: Working With Remote Docker Using Docker Context
published: true
date: 2021-12-02 08:36:25 UTC
tags: docker, beginners
canonical_url: https://clavinjune.dev/en/blogs/working-with-remote-docker-using-docker-context/
---

![Photo by @carrier_lost on Unsplash](https://images.unsplash.com/photo-1605745341112-85968b19335b?q=50&w=1920 "Photo by @carrier\_lost on Unsplash")

## Introduction

This is a cheatsheet for working with docker context to connect remote docker locally. Might help you to work with remote docker without manually SSH to the remote server.

## Add Context

```bash
$ docker context create my-remote-docker-machine --docker "host=ssh://username@host"
my-remote-docker-machine
Successfully created context "my-remote-docker-machine"
```

You can also utilize `SSH Config` file to connect to the remote docker. Especially when you need to define your `private key` or `password`.

```bash
$ cat ~/.ssh/config 
Host my-remote-docker-machine
  Hostname host
  User username
$ docker context create my-remote-docker-machine --docker "host=ssh://my-remote-docker-machine"
```

Besides `ssh`, you can also add your context using `tcp` protocol if you enable the `Docker API`.

## List All Context

```bash
$ docker context ls
NAME                       DESCRIPTION                               DOCKER ENDPOINT               KUBERNETES ENDPOINT   ORCHESTRATOR
default *                  Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                         swarm
my-remote-docker-machine                                             ssh://username@host
```

## Use Context

```bash
$ docker --context my-remote-docker-machine images -q
65dadc9c7fe7
f814fce55133
7a9b6da4328e
33655f17f093
d120da10b040
6d6859d1a42a
c19ae228f069
```

## Set New Context as Default

```bash
$ docker context use my-remote-docker-machine 
my-remote-docker-machine
Current context is now "my-remote-docker-machine"
$ docker context ls
NAME                         DESCRIPTION                               DOCKER ENDPOINT               KUBERNETES ENDPOINT   ORCHESTRATOR
default                      Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                         swarm
my-remote-docker-machine *                                             ssh://username@host

```

See the `*` is moved from `default` to `my-remote-docker-machine`. Now you can use your docker command without `--context` flag.

## Remove Context

```bash
$ docker context use default # back to default
$ docker context rm my-remote-docker-machine 
my-remote-docker-machine
```

## Conclusion

Using docker context might help to avoid SSH manually to the remote server. But, when it comes to build an image using a remote docker locally, you need to consider how much docker context that will be uploaded/downloaded.

Thank you for reading!
Setting up Nextjs with AirBnB style guides for react, Prettier, ESlint, Husky and GitHub Actions
Tags: actionshackathon21, opensource, nextjs, react
Published: 2021-12-02 09:36:38

### My Workflow

{% github https://github.com/miami78/nextjs-starter-pack %}

### Submission Category: 

Maintainer Must-Haves


### Yaml File

```
name: Code quality

on: push

jobs:
  code-quality:
    name: Lint source code
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - name: Install dependencies
      run: yarn

    - name: Run Prettier
      run: yarn prettier --ignore-path .prettierignore --write .
      
    - name: Run ESLint
      run: yarn eslint '**/*.js' --report-unused-disable-directives
```
Go simple rate limiter
Tags: go, concurrency
Published: 2021-12-02 15:54:01

---
title: Go simple rate limiter
published: true
date: 2021-12-02 08:58:38 UTC
tags: #go #concurrency
canonical_url: https://enzircle.com/go-simple-rate-limiter
series: "Go concurrency through problem solving"
---

![Titus Blair via Unsplash](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0z9a7vvzwsybltlbszqz.jpg)

So the first problem in this series is a straightforward one.

You are given a crawler that requests pages. But this crawler is very aggressive. Now, you do not want to burden the webserver too much. So you need to limit the crawler to at most one page per second while still doing it concurrently.

## The solution

In this solution, you need to use a ticker from the `time` package. The `time.NewTicker` will return a channel that sends the time on every tick. You specified the period of ticks by the duration argument; the duration parameter is in nanoseconds. In this case, you need to pass the `time. Second` because you need to limit the crawl to one page per second.

For the limiter to actually work, you need to understand the behavior of an unbuffered channel. Once you know that, you have solved the problem.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1638437673812/lnlBGiPba.png)

## Key Take Away

1. Execution will pause when you read from an empty channel. If you read from an empty channel, in this case `ticker`, the goroutine will pause. The execution will resume when the ticker writes to this channel on every tick (one second). 

2. Value written to a channel can only be read once. If multiple goroutines are reading from the same channel, a value written to the channel will only be read by one of them.

3. You need at least two concurrently running goroutines when you write to or read from an unbuffered channel.

## Wrap up

This is a simple problem that shows how unbuffered channels behave. This is relatively straightforward, but it shows how execution pauses and resumes as you read from and write to a channel.
Hiring - Candidate Personas
Tags: career, leadership, hiring, teams
Published: 2021-12-02 08:31:17


![An image depicting different people](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7w9a3voufunu0bw0aprc.png)
What candidate persona would add the most value to a team? 


Borrowing from the game of football, a strategy of hiring ***squad members*** and a ***playmaker*** is ideal for setting up and growing a team.
The two roles become critical in a team that is looking to balance sustenance activities along with innovation.


So, how does one identify these qualities in candidates and build them in team members? 
First, let's look at these two personas individually.

**Squad member**
Squad members perform in an individual capacity to deliver outputs on clearly defined requirements.


Their responsibilities mostly include
* Effectively delivering on individual tasks 
* Implementation of small projects


Look for hiring indicators and values like Efficient delivery, Well rounded execution of tasks, Communication, Collaboration, Code fluency and Empathy


A squad member has 
* The abilities to perform day to day individual tasks well (effectiveness is experience dependent)
* Clear and effective communication
* Dedication to continuously learn and improve
* Problem solving abilities (Nice to have)
* Good time management (Nice to have)
* Self Management (comes with experience)


**Playmaker (Expert member)**
These members are the creative force behind a team, they architect solutions and build them by engaging other squad members.


They can deliver on a diverse set of responsibilities like 
* Building solutions that are modular, scalable and forward looking 
* Effectively delivering projects through a large team with significant complexity 
* Training/coaching/mentoring team members to deliver on smaller tasks that come together as a larger solution


Look for hiring indicators and values like Forward looking, Strategic thinking, Critical thinking, Strong sense of ownership, Decision making, Passion for knowledge sharing, Creative problem solving, Team health, System Design, Empathy(very important)


A playmaker has
* The ability to work with nebulous asks and translate them into well defined smaller tasks
* Proven track record in architecting solutions that solve problems and address shortcomings in the near, mid and long term
* Understands the importance of coaching/mentoring squad members and facilitates knowledge distribution 

In the long term, they raise the bar for the entire team.

**Finally**, the distribution of squad and expert members is dictated by the nature and scope of the work in a team, more specifically the ratio of sustenance to new and innovative work.

In most situations, I have found this is to be an effective hiring strategy, with case-specific tweaks.  

What is yours? Please comment and share!
Laravel One of Many Eloquent Relationship (latestOfMany - oldestOfMany - ofMany)
Tags: php, laravel, programming, beginners
Published: 2021-12-02 08:29:36

Eloquent relationships is coming to Laravel 8.42
Many times you will see that a model may have many related models, yet you want to easily retrieve the "latest" or "oldest" related model of the relationship. For example, a  User model may be related to many  BrowserHistory models.
```php
// Get Latest Browser History
public function latestBrowserHistory(){
    return $this->hasOne(BrowserHistory::class)->latestOfMany();
}
```
```php
// Get Oldest Browser History
public function oldestBrowserHistory(){
    return $this->hasOne(BrowserHistory::class)->oldestOfMany();
}
```
This new eloquent relationship  ofMany the method accepts the sortable column as its first argument and which aggregate function ( min or  max) to apply when querying for the related model
```php
public function highestPriceProduct(){
    return $this->hasOne(Product::class)->ofMany('price','max');
}
```
I hope you enjoyed the code.