teleren/devto huggingface dataset:
Static Variables and Methods (Java) 
Published: 2021-07-02 21:00:40

## Variables 
Static variables are tied to the Class itself. Each object of a class shares the static variable. 

Non-static variable (instance variables) are tied to the object. In the example below, every object of the Cat class has its own name variable. However, every object *shares* the catCount variable. 

When you see the static keyword in front of a variable name think of a *shared* variable.


```
Class Cat 
{
String name; // Non-static variable (each object has it's own copy) 
static int catCount; //Static variable (each object of the class Cat shares this variable

Cat(String name){
this.name = name; // Non-static variables can be referenced with "this" keyword 
Cat.catCount++; // Static variables are referenced using the class name 
}
```
## Methods 
Java methods are divided into two categories. *Instance methods* and *Static methods*. 

### Instance Methods 
These methods are called on an object and they have access to an objects data (non-static variables). This makes sense. Since an object is an *instance* of a class, an instance method works on objects. 

The reason that instance methods are able to access an objects data is because they have a reference to the object. That reference is stored in the keyword "this". "this" holds a reference that tells us where the object we are referencing is. Without "this" we can't refer to the object. 

When you call an instance method, the object that you called the method on is actually passed along to that method as the first argument, we just don't see it. 
What we see: 
```
Cat sally = new Cat(); 
String name = sally.getName(); 
```
What is actually happening: 
```
Cat sally = new Cat(); 
String name = Cat.getName(sally); 
```
The object sally is being passed into the getName method. Then inside the method, the object sally will be referred to as "this". 

### Static Methods 
These methods do not have access to an objects data. Since they don't have an object reference. Static methods don't have "this". Instead a null value is passed to static methods. But, static methods can reference the static variables of the class and other static methods. 

Static methods allow us to call a method before we create any objects because they are tied to the class not the object. This is how the main() method works for example.
How to restart an Apache 2 server or service in Linux?
Tags: resource
Published: 2021-07-03 00:00:00

---
  title: How to restart an Apache 2 server or service in Linux?
  published: true
  tags: Resource
  date: Sat Jul 03 2021 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/restart-reload-apache2-server-service-linux
  cover_image: https://melvingeorge.me/_next/static/images/main-3887c0ca860ca35707aeece4927dc6e2.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/restart-reload-apache2-server-service-linux)
  
To restart an apache 2 server or service, we can use the `systemctl` command-line utility followed by the `restart apache2.service` command in Linux.

```bash
# Restarts Apache 2 service
sudo systemctl restart apache2.service
```

### What is `systemctl`?

- The `systemctl` is a command-line utility that is used to control and manage the `systemd` services.
- It is widely used with web server services like Apache, Nginx, etc.

### Feel free to share if you found this useful 😃.

---
.sh: The poor man's Infrastructure-as-Code
Tags: iac, infrastructure, code, bash
Published: 2021-07-06 07:05:38

---
title: .sh: The poor man's Infrastructure-as-Code
published: true
date: 2021-07-03 00:00:00 UTC
tags: iac,infrastructure,code,bash
canonical_url: https://jhall.io/archive/2021/07/03/.sh-the-poor-mans-infrastructure-as-code/
---

Infrastructure as Code (IaC) is all the rage. And for good reason. It can simplify many common tasks.

But first, for the uninitiated, what is it?

In a nutshell, it’s the process of managing computers (servers, VMs, even entire data centers) via code, as opposed to the “old way”: manual configuration.

This has the potential to provide a number of clear benefits. Two I’ll highlight:

1. **Scaling** Perhaps most obvious, it helps with scaling. If you need to install 1,000 servers, doing it manually would take weeks or longer. If you can do it with some code, then at least the human interaction probably takes just a few minutes, then you can walk away to play Fallout or something, while the servers chug away in the background.

2. **Reproducibility** Even with a small number of servers (like, I don’t know… one?) there can be a benefit in reproducibility. Think back to the last time you got a new laptop and you had to configure everything _just_ the way you like it. You probably installed your favorite browser. Your favorite music player. Your favorite text editor. Then you had to enable dark mode. Oh, and you had to configure your mail client again… If you had all of this configuration _as code_, then in principle you could just run your code, and have a working environment.

The same is nice for servers. Most companies have multiple environments. Production, staging, and dev are common. Some companies have many more. In principle, these should be as close to identical as possible (otherwise your testing may not validate that your application will work in production).

There are many tools to tackle this problem, at different layers of the technology stack.

But you don’t need to learn any new tools to start taking advantage of IaC.

I’m helping a small startup right now configure their production and staging environments on Google Cloud. And the main tool I’m using to ensure that these two environments are identical is a simple bash script.

The script is little more than a list of commands necessary to provision and configure one of their environments. It executes the necessary `gcloud`, `kubectl` and `helm` commands to create a Cloud SQL database, set up some networking, and launch the necessary services.

IaC _can_ be very complex. But it doesn’t need to be. Start small. Start with the tools you know today.

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._
🎬Amazing Social Media Buttons Hover Effects| HTML & CSS✨
Tags: html, css, webdev, beginners
Published: 2021-07-02 22:08:15

Hey Devs, in this video you will learn how to create an **Amazing Social Media Buttons Hover Effects** with just HTML & CSS (No JavaScript).
 We'll walk you through step-by-step on how to create it and how to add it to your websites. 

---
{% youtube P9pi4hq7BBA %}

---
**🏆 Recommended Projects 🏆**

🎬 Neumorphism Login Form | HTML & CSS 
➤https://youtu.be/QWh0S-3D7uY
🎬 Animated Sidebar Menu with HTML & CSS 
➤ Watch: https://youtu.be/QPZrQ_xPVs4 
🎬 Amazing Social Media Buttons Hover Effects | HTML & CSS 
➤ https://youtu.be/P9pi4hq7BBA 
🎬 Animated Login Form | HTML, CSS & JavaScript 
➤ Watch: https://youtu.be/ogNwc45qHKo 
🎬 Slider Sign In / Sign Up Form | HTML CSS Vanilla JS 
➤ Watch: https://youtu.be/Wz5THk0-Y1s 

---
Java 17 - Clean Power
Published: 2021-07-02 21:33:11

---
title: Java 17 - Clean Power
published: true
description: In this video we look into Java 17, what is new with the 17 release of java that will come to a download site near you on the 14th of september.
tags:
cover_image: 
---

{% youtube SfKQleVKGXs %}

In this video we look into Java 17, what is new with the 17 release of java that will come to a download site near you on the 14th of september.
Day 401 : Long Story Short
Tags: hiphop, code, coding, lifelongdev
Published: 2021-07-02 21:32:13

_liner notes_:
- Professional : A good way to end the week. Pretty much got everything I wanted to get done to a place where my part is done. Long story short, the end of a pretty productive week.

- Personal : Didn't really work on my side project last night. Just went through tracks for the radio show this week.

![View from a lake looking at a mountain at sunset in Vestrahorn, Iceland](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lw9o4atognal0icznop9.jpg)

Going to finish putting together the radio show. Then work on some stuff for the show on Sunday. May need to put make some quick presentations.

Have a great night and weekend!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube zUOUlcqIFi4 %}
rapid development tips
Tags: beginners, webdev, vscode, codenewbie
Published: 2021-07-02 21:08:58

Some of my time saving Shortcuts 

Alt + Tab. -> Shift Screens 
Windows + Arrowkey -> Screen Split
Windows + E -> Open File Explorer
Ctrl + Alt +T -> Open Terminal  ( linux only )
In Command Prompt(Terminal)
 mkdir 'folder_name' -> create folder
 cd 'folder_name' -> go inside folder
 cd .. -> go one level up 
 try to do things with COPY = cp and   MOVE   =  mv 

Fastest way to Start Project ( windows )

Windows + E -> open file explorer
In search bar type cmd -> this will open terminal in that directory 

Type code . -> this  will open visual studio code with that folder 

Visual Studio Code Tips


Ctrl + `  to Shift OPEN OR CLOSE TERMINAL 
!   To Boiler plate html code 
(Favorite) Ctrl + d to select multiple cursor and can do anything at same time

Install Emmet plugin and then

Create div with class 
div.class_name   hit tab / enter it will create
Create div with Id
div#div_name hit tab / enter it will create 
Create multiple elements 
div*3 
3 Div Tags 

And another thing type fast 😉 ~ 60WPM 

You can also do (what I do is ) (Advanced Stuff)

git add .
git commit -m " some message "
git push 

Instead of typing these commands 

Bundle this up in Bash file replace "msg" with variable at the time of executing bash file pass as parameter . Note : ( don't forget to set origin )

So you will end up running 3 commands in 1 !...


and this is how you will do fast coding + navigation
How to autoload Stimulus within every controller file
Tags: stimulus, javascript
Published: 2021-07-02 20:59:59

If you're familiar with [Stimulus](https://stimulus.hotwire.dev) at all, the below bog standard controller should look very familiar. In fact I've nicked it from their homepage!  
  
```javascript
import { Controller } from "stimulus"

export default class extends Controller {
  static targets = ["name", "output"]

  greet() {
    this.outputTarget.textContent =
      `Hello, ${this.nameTarget.value}!`
  }
}
```
  
I'm a Rubyist and unashamedly rather lazy; so having that `import` statement at the top of every Stimulus controller always irked me. If you're using Webpack, there's a super simple way of circumventing this annoying `import` statement.  
  
First thing you need to do is create a file called `application_controller.js` and place it in your `controllers` directory. This is good practice nevertheless as you can put app specific utilities in there; such as getting some data out of `meta` tags for example.  
  
```javascript
// application_controller.js
import { Controller } from 'stimulus'

export default class extends Controller {
}
```
  
And then change your controllers to inherit from `ApplicationController` and remove the `import` statement. So the above controller would become:  
  
```javascript
export default class extends ApplicationController {
  static targets = ["name", "output"]

  greet() {
    this.outputTarget.textContent =
      `Hello, ${this.nameTarget.value}!`
  }
}
```
  
And finally we need to make a change to our Webpack configuration so the controllers know where to find `ApplicationController` without the `import` statement. We'll use the [Webpack Provide plugin](https://webpack.js.org/plugins/provide-plugin/) to accomplish this.  
  
Add the following lines to the `plugins` array in your `webpack.config.js`:  
  

```javascript
new webpack.ProvidePlugin({
  ApplicationController: ['./application_controller', 'default']
})
```

If you're using [Webpacker](https://github.com/rails/webpacker/) 5 or older, add the following lines to your `config/webpack/environment.js`:  
  
```javascript
const webpack = require('webpack')

environment.plugins.append('Provide', new webpack.ProvidePlugin({
  ApplicationController: ['./application_controller', 'default']
}))
```
  
And if you're using Webpacker 6, change your `config/webpack/base.js` to:  
  
```javascript
const { webpackConfig, merge } = require('@rails/webpacker')
const webpack = require('webpack')

const customConfig = {
  plugins: [
    new webpack.ProvidePlugin({
      ApplicationController: ['./application_controller', 'default']
    })
  ]
}

module.exports = merge(webpackConfig, customConfig)
```
  
And that should do the trick! You no longer need to import `Controller` manually within every Stimulus controller!  
  
Shout out to [Konnor Rogers](https://twitter.com/RogersKonnor) for showing me how to do this :)

This post was originally published on [my blog](https://binarysolo.chapter24.blog/how-to-circumvent-importing-stimulus-within-every-controller/)
How to build a podcast website or blog
Tags: podcast, devops
Published: 2021-07-02 20:57:39

With 13 years in professional programming I've already seen a lot of failed hypes & undelivered promises. It's rare to see an innovation that actually tackles more issues then it's introducing. One of those rare occasions seems to be developing right now - the move towards [JAM stack](https://jamstack.org/) - which is an umbrella term for many technologies, that used together creates a different approach to put content online.

If I were to build a blog, or podcast website I would go with following technologies:
* github or gitlab for hosting the repository
* netlify for hosting the website itself, and building the code
* next.js or other JAM stack framework to build my code upon
* some git-based cms, if we want to have more content-author friendly access

There are several advantages of approach this problem this way:
* both git hosting can be used for free for both public & private repos
* netlify has reasonable free tier - it comes with 300 build minutes (about 75 & 100 build) per month; adding a custom domain is very easy & cost below 20$ per year. They only register .com domains for you, for any other you have to go through other provider
* next.js/JAM stack/static site generators provides really fast user experience with DevOps way simpler then you could dream with any other cms or blogging platform. Don't let the 'static site' fool you - it can be as dynamic as any other configuration - it's just the matter of correct set up & maybe embedding some 3rd party integrations.
* git-based cms will integrate both sources of changes on the website - content & code - into one flow. With the correct set up, your content authors should be a confident use it as they would be with wordpress.

I think, even though that is very workflow based on some very technical tools, it could be prepared to be approachable for non-technical creators. So for example, you get your set up by following some tutorial & then jump straight into creating your content - in a quick & dirty aproach. And, when you will be ready to upgrade your page, you just get some designer/IT person to the project & they update the page without touching the basic set up.

Let me know in the comments below if you were interested in such a guide - I'm curious to investigate it myself, and if others are interested I can try sharing it here too.
Biometric authentication with Python
Tags: python
Published: 2021-07-02 20:31:28

**Initial Setup**
The LoginID Server SDK enables you to perform operations which are protected, enabling much more robust functionality for your users.

**Create API Credential on the Dashboard**
An application must be created on the [LoginID Dashboard] (https://usw1.loginid.io/en/integration) in order to correctly configure the Server SDK.

Once logged into the dashboard, navigate to the Applications tab in the sidebar, select “Add Application,” and select Management.

In the resulting form, you must create a name for your application and provide an API credential to be associated with this application. If you have already created an application, we suggest using the naming convention of “{my-app) server.”

When adding the API credential, you can either upload your own public key, or have us generate a key pair on your behalf.

>NOTE: All API calls made from a Management integration type require an API Service Token

**Add SDK to Existing Application**
PIP
```
pip install -e .
```
Create an SDK Instance
```
from loginid import LoginID
lid = LoginID(CLIENT_ID, PRIVATE_KEY)
```

>NOTE: If using a custom base_url, you can initialize the SDK with that base_url. Otherwise, it will default to the main LoginID production environment.
How to add loader to NuxtJs configuration
Tags: webpack, nuxt
Published: 2021-07-02 20:22:45

If you worked with webpack, you know how confusing it's configuration can become. Because of this, many frameworks & code generators abstract it away from the application developer. It works nice in simple case - like demo apps, but can become painful in when we want to customize the set up. Not only we have to know webpack & it's loaders, but on top of that we need to the quirky way of changing the config, without breaking the framework.

# Application

The example application we have here, was created following the [npm example for getting started doc](https://nuxtjs.org/docs/2.x/get-started/installation)

```sh
$ npm init nuxt-app webpack-nuxt
```

The code created by this command you can find here:
https://github.com/marcin-wosinek/webpack-nuxt/tree/eb44c5a85eaf421b50bfe53b9e07b7e27e4ec34c

As of now, we are limited to webpack in version 4 - it's previous version. And based on [this discussion](https://github.com/nuxt/nuxt.js/issues/8252#issuecomment-720954965) you shouldn't expect update to webpack 5 before major release of nuxt.

# Adding loaders

As you can see on [extend webpack config](https://nuxtjs.org/docs/2.x/features/configuration#extend-webpack-config), the correct place to tweak webpack config is `nuxt.config.js`. Let's say we want to load `.weird` files as just a string. In webpack it's achieved with `raw-loader`.

You should add inside `export default {` of `nuxt.config.js` following code:
```js
  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    extend(config) {
      config.module.rules.push({
        test: /\.weird$/,
        loader: "raw-loader"
      });
    }
  }
```

Note! We are `push`ing new object to `config.module.rules`. If we were overriding the whole array, we would drop all the rules defined by the framework, therefore break our build.

Most likely this will fail, so you should install the raw-loader:
```sh
$ npm install --save-dev raw-loader
```

With all that in place, you should be able to have `pages/index.vue`:
```js
<template>
  <div>
    {{ info }}
  </div>
</template>

<script>
import info from "./raw.weird";
export default {
  async asyncData() {
    return { info };
  }
};
</script>
```

loading content from a `raw.weird` file next to it.

# Links
* [webpack video course](https://bit.ly/WebpackCourse)

# Summary

In this article, we have seen how to customize which loader is used for a given file extension in nuxt. If you want to see the whole code base, you can find it here:
https://github.com/marcin-wosinek/webpack-nuxt
Zero To Blockchain
Tags: kingsland, fullstackdeveloper, blockchain, techie
Published: 2021-07-02 20:17:32

I am @ the half way mark for my program, well the full stack portion of it.  The amount of information that has been uploaded into my brain is CRAZY.  Mind you, I have ALWAYS been in healthcare and 2020 brought A lot of changes starting with a complete career path change.  I dove into the deep end and now I am swimming a long with the other new Devs in my class.  Networking/making connections that all will lead to a successful career.
Head First Design Pattern: 3 or 10
Published: 2021-07-02 20:16:01

I just learnt my third design from the Head First Design Pattern book. Today, I learnt about the Abstract Factory method and Factory Method.

According to Head First Design Patterns, the Factory Method pattern is a pattern that allows you to defer the instantiation of an object to a subclass. It does so by defining an interface and letting its subclasses design which class to instantiate.
The Abstract Factory is a design pattern that provides an interface for creating a family of related objects without specifying their concrete classes.

These two design patterns help you decouple your code from concrete classes. Thereby promoting loose coupling between your classes. The Factory method relies on inheritance to achieve this loose coupling. It delegates the logic of creating concrete classes to its subclasses while the Abstract Factory pattern relies on object composition. 

Whenever you have a family of related objects to create, you should use the Abstract Factory Pattern else use the Factory Method pattern.
TabPal : My first Chrome extension
Tags: react, javascript, browser, chrome
Published: 2021-07-02 19:10:14

I'm always on the look to extend or add new features to the tools that I use. This time I decided to make a simple extension for Chrome after getting tired of the way it handles the next active tab when you close a tab.

## Current features
For now, the extension simply allows you to choose whether to select the left or the right tab after you close a tab, as well as adding a few shorcuts for some features you only get by right clicking a tab. 

Shorcuts: 

* Alt + Shift + T: Open a new tab to the right

* Alt + Shift + P: Pin selected tabs

* Alt + Shift + M: Mute selected tabs (the tab, not the whole site)

* Alt + Shift + S: Go to the first tab playing sounds

Options page:
![Options page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bk65wo460hpex5gy9kvf.png)

## Next steps
If you find this interesting or useful, I'd like you to give it a try and tell me what you think about. 

In the future I plan to add more interesting features such as choosing the last active tab from the same domain after closing a tab or the last active, if there is none from the same domain. Useful when you go back and forth between a set of tabs. 

Link to the extension: [TabPal] (https://chrome.google.com/webstore/detail/tabpal/kaaidgmlmkcafpheocflaeblnolaiecc?hl=en)
Don't make your SQL requests like this! Dont get hacked: SQL Injection
Tags: sql, cybersecurity, javascript, node
Published: 2021-07-02 19:06:10

Link to original article with code snippets and videos (recommended): https://gabriellazcano.com/blog/dont-make-your-sql-requests-like-this-dont-get-hacked/

## Introduction
So I’ve been learning SQL and something came to my mind. How safe is this, I won’t lie I’ve heard of SQL injections before but never really got into it. But now I know it’s really a dangerous tool if you are not doing things correctly, and the best way of preventing this is knowing how to do it. Also for what I’ve investigated it seems that a lot of sites are vulnerable to this kind of attacks so we have to make awareness of the topic.

## The vulnerability 
The vulnerability is because we are concatenating to the SQL request, making it possible for people to modify the request using their knowledge on how it works. This is further explained in the original article. Sorry for the inconvenience but I found it impossible to structure it here in dev.to