teleren/devto huggingface dataset:
Abstract Syntax Tree (AST)
Tags: opensource, java, contributorswanted, testing
Published: 2021-06-27 14:03:10

###What is AST?

 It is a tree representation of the abstract syntactic structure of source code written in a programming language. Each node of the tree denotes a construct occurring in the source code.







###Application in compilers

Abstract syntax trees are data structures widely used in compilers to represent the structure of program code. An AST is usually the result of the syntax analysis phase of a compiler. It often serves as an intermediate representation of the program through several stages that the compiler requires, and has a strong impact on the final output of the compiler.



###For Example, This is a Source Code.

```
class GFG {
    public static void main (String[] args) {
        System.out.println("Hello World!");
    }
}
```


###AST of above source code:

```
CLASS_DEF -> CLASS_DEF [1:0]
|--MODIFIERS -> MODIFIERS [1:0]
|   `--LITERAL_PUBLIC -> public [1:0]
|--LITERAL_CLASS -> class [1:7]
|--IDENT -> GFG [1:13]
`--OBJBLOCK -> OBJBLOCK [1:17]
    |--LCURLY -> { [1:17]
    |--METHOD_DEF -> METHOD_DEF [2:4]
    |   |--MODIFIERS -> MODIFIERS [2:4]
    |   |   |--LITERAL_PUBLIC -> public [2:4]
    |   |   `--LITERAL_STATIC -> static [2:11]
    |   |--TYPE -> TYPE [2:18]
    |   |   `--LITERAL_VOID -> void [2:18]
    |   |--IDENT -> main [2:23]
    |   |--LPAREN -> ( [2:27]
    |   |--PARAMETERS -> PARAMETERS [2:34]
    |   |   `--PARAMETER_DEF -> PARAMETER_DEF [2:34]
    |   |       |--MODIFIERS -> MODIFIERS [2:34]
    |   |       |--TYPE -> TYPE [2:34]
    |   |       |   `--ARRAY_DECLARATOR -> [ [2:34]
    |   |       |       |--IDENT -> String [2:28]
    |   |       |       `--RBRACK -> ] [2:35]
    |   |       `--IDENT -> args [2:37]
    |   |--RPAREN -> ) [2:41]
    |   `--SLIST -> { [2:43]
    |       |--EXPR -> EXPR [3:26]
    |       |   `--METHOD_CALL -> ( [3:26]
    |       |       |--DOT -> . [3:18]
    |       |       |   |--DOT -> . [3:14]
    |       |       |   |   |--IDENT -> System [3:8]
    |       |       |   |   `--IDENT -> out [3:15]
    |       |       |   `--IDENT -> println [3:19]
    |       |       |--ELIST -> ELIST [3:27]
    |       |       |   `--EXPR -> EXPR [3:27]
    |       |       |       `--STRING_LITERAL -> "Hello World!" [3:27]
    |       |       `--RPAREN -> ) [3:41]
    |       |--SEMI -> ; [3:42]
    |       `--RCURLY -> } [4:4]
    `--RCURLY -> } [5:0]
```





***
##How to Make an AST:


1. Run the Source Code in your local Environment.

2. Download the Checkstyle Command line: checkstyle-8.43-all.jar from [Here] (https://checkstyle.org/cmdline.html).

3. Audit the Program with the help of Checkstyle in your Terminal: java -jar checkstyle-8.43-all.jar -c /google_checks.xml YourFile.java

4. After Audit, Run this command in your terminal to get the AST of your preferred  Code: java -jar checkstyle-8.43-all.jar -t YourFile.java

5. Your AST is Ready.
***


---
To learn More about AST and Checkstyle: [Click Here] (https://checkstyle.org/cmdline.html)
---
Branching Out (With Git)
Published: 2021-06-27 14:02:36

When thinking of a branch: the first thing to come to mind is the part of a tree that is growing out from another part of the same tree. As a tree grows, branches are sent out from the trunk or from other branches. They grow leaves and help with supplying nourishment to the tree to become a better tree. When a specific branch dies, it might fall off or be pruned so another branch can grow in its place.

When it comes to git: branches work similarly. You have your trunk: but it's called Main (or Master if your repository was created before Oct 2020) that is the primary living portion of your code. You can create branches that copy the current Main code to allow you to build on it, make changes, and test things without effecting your live environment. Once you're done and successfully made changes, you can merge them into your Main. Branches can also be used to create other branches, and can be areas to merge other code into as well. After you're done with the branch, it can be deleted.

To get started with branches: there's a few common commands to learn:
`git branch` Will list all branches, with an indicator on which one you're on. (Depending on your system this can be a symbol or different coloring)

`git branch <nameOfBranch>` Will create a branch by the name of <nameOfBranch>

`git checkout <nameOfBranch>` Will change your *pointer* to the branch specified at <nameOfBranch>

Using `git checkout -b <nameOfBranch>` will create and switch you over to the new branch in one line!

`git merge <nameOfBranch>` will combine content of branch specified in <nameOfBranch> with the branch you're currently on. In the case of changes in the same areas from when both points were at similar states, you'll be notified of a merge conflict where you'll either be directed to select which changes to keep or have to manually correct the conflicting area.

`git branch -d <nameOfBranch>` removes/deletes the specified branch. You do need to be on a different branch than the one you're trying to delete.

If you want to learn more about git branches be sure to check out additional documentation on branches. This includes different flags you can use, which can give more visibility to how you're displaying information about your branches, as well as extra things you can do!
Node Modules — What does require() do?
Tags: node
Published: 2021-06-27 14:02:06

## Introduction

[Node.js](http://nodejs.org) allows code to be written and stored in (preferably) small modules.  These modules can then be referenced from other modules to build up larger applications.  What exactly is a module though, and how can code be accessed from within a module?

## Exporting functions

Let's take a look at a small piece of code that we can easily turn into a Node.js module.  Consider we have a method that allows us to drink tea.

``` javascript
function drinkTea() {
    console.log("Mmm, delicious.");
}
```

If this method was placed within a large JavaScript file, we could simply invoke the function `drinkTea()` to enjoy a warm beverage.  To create a module however, we simply place this function within its own file and tell Node about any functions we wish callers of the module to access.

Within Node.js, we could therefore create a file called `drink.js` with the following contents:

``` javascript
function drinkTea() {
    console.log("Mmm, delicious.");
}

module.exports.drinkTea = drinkTea;
```

You'll notice that this file isn't that different from the original definition of our code.  All that we've done to convert this code into a module is to add the `module.exports` statement to the end of the file.  This statement tells Node what methods to export from the module.

From a different file, we could then load our tea drinking module and enjoy a cuppa by executing the following code:

``` javascript
var drinker = require('./drink');

drinker.drinkTea();
```

## Exporting objects

The example above shows how to export and use a function from a module, but what if we want to export an object?  Fortunately, the procedure here is exactly the same.  We can create a `Tea` object and export it from a Node module using the following code:

``` javascript
var Tea = function(blend) {
    this.blend=blend;
    var that = this;

    return {
        drink: function() {
            console.log('Mmm, '+ that.blend+ ', delicious.');
        }
    };
}

module.exports = Tea;
```

We can then invoke this code from a separate `main` module using code such as:

``` javascript
var Tea = require('./drink');
var cupOfTea = new Tea('Assam');
cupOfTea.drink();
```

``` bash
>node main
Mmm, Assam, delicious
```

The only difference here between the two examples is that in the first example, we exported a named function from our module (`module.exports.drinkTea = drinkTea`).  In the second example, we exported the object without any wrapper (`module.exports = Tea`).  This allows us to directly create an instance of the module's `Tea` object, i.e. we can call `new Tea...` rather than `new tea.Tea...`

## Credits

Photo by [Volodymyr Hryshchenko](https://unsplash.com/@lunarts?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com/?utm_source=medium&utm_medium=referral)
My full stack developer coding journey so far...
Tags: javascript, html, codenewbie, beginners
Published: 2021-06-27 13:46:48

Hi all! This is the start to my coding journey from working in HR/finance to becoming a full time coder! I'm planning to write a blog which I aim to update weekly :)

My name is Benjamin Hood, I'm based in Leeds, UK and I'm currently working through a 13 week full stack developer bootcamp with Northcoders! It's really challenging having come from a background with zero coding experience but super enjoyable!

I'm going to start by looking back on my time leading up to the bootcamp and my decision process on why I ended up signing up with Northcoders.

I'm a total novice at this sort of thing so please be kind :)
Macbook Flapdown (Lid) settings
Tags: osx
Published: 2021-06-27 13:45:35

You can use the command line utility pmset to change the behavior of the lid closed/open state.

To disable wake/sleep on lid state:
```
sudo pmset -a lidwake 0
```
To undo the last setting
```
sudo pmset -a lidwake 1
```
By default, closing the lid will put the Mac to sleep. Setting the lidwake 0 value will disable it meaning closing the lid will do nothing.
Understanding Kubernetes in a visual way (in 🎥 video): part 18 – Pod & Node (Anti) Affinities
Tags: kubernetes, devops, docker, beginners
Published: 2021-06-27 13:19:24

---
title: Understanding Kubernetes in a visual way (in 🎥 video): part 18 – Pod & Node (Anti) Affinities
published: true
description: Serie of videos about Kubernetes. Explaining in a visual way Kubernetes principles.
tags: Kubernetes, DevOps, Docker, beginners
series: Understanding Kubernetes in a visual way - (in video) in video
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rt08i3214grzawjhp600.jpg
---

Understanding Kubernetes can be difficult or time-consuming. In order to spread knowledges about Cloud technologies I started to create sketchnotes about Kubernetes, then I've auto-published a book and since now I've started a new serie of video! :-)

I imagined a serie of short videos with a mix of sketchnotes and speech.

I think it could be a good way, more visual, with audio & video to explain Kubernetes (and others technologies).

In this new episode, let's talk about Pod & Node Affinities and Anti Afinities.

{% youtube 2_nQGrO6New %}

The video is in French BUT I done the subtitles in english (and french too).

If you liked the video and are interested to watch another ones, please give me some feedbacks (and you can also subscribe to [my Youtube channel](https://www.youtube.com/channel/UCrRk0kOP58lBMl9B8ZS8Vlg), if you want to ❤️).

If you are interested, I published all the sketchnotes on Kubernetes (and new ones!) to make a "book" of 165 pages: ["Understanding Kubernetes in a visual way"](https://gumroad.com/aurelievache#uCxcr).

If you like theses sketchnotes, you can follow me, I will publish others sketchs shortly :-).
Run creat-react-app with HTTPS
Tags: javascript, webdev, webpack, security
Published: 2021-06-27 13:19:00

## Introduction

In current days we host websites on [Vercel](https://vercel.com) and [Netlify](https://www.netlify.com) and we are automatically assigned a generated SSL to provide with Secured connection(HTTPS), but in the development period we are unaware of the process to run it with HTTPS and we miss out on some testing which works only on HTTPS like google apis, etc.

## Steps
1. Configure creat-react-app project to handle https
2. Generate SSL Certificates for localhost
3. Add certificates to the project
4. Trust certificate in browser
5. Run the project secured

### Configure creat-react-app project to handle https
Add a file `.env` in the root directory of the project with the line
```
HTTPS=true
```
### Generate SSL Certificates for localhost
Follow this article to generate a SSL certificate for localhost. and place the certificates in the root directory.
{% link https://dev.to/pranjaljain0/generate-an-ssl-certificate-with-the-root-certificate-for-localhost-18je %}
after following this article you must have 8 new files in your directory, which are
```
rootCA.key
rootCA.pem
rootCA.srl
server.crt
server.csr
server.csr.cnf
server.key
v3.ext
```
### Add certificates to the project
in the `.env` file add these two properties and there paths.
```
SSL_CRT_FILE=server.crt
SSL_KEY_FILE=server.key
```
Here you will be using the `server.crt` as your certificate file & `server.key` as your key for certificate.
### Trust certificate in browser
[Follow this article](https://www.techrepublic.com/article/how-to-add-a-trusted-certificate-authority-certificate-to-chrome-and-firefox/) to trust the certificate on your browser 
### Run the project secured
Hence you have HTTPS enabled for your project.
![HTTPS Enabled](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z1310j6p88oh03b0nqrx.png)

If you're stuck anywhere do leave a comment.

Follow me on Twitter at [Twitter/pranjaljain0](https://twitter.com/pranjaljain0)
Follow me on Github at [github/pranjaljain0](https://github.com/pranjaljain0)

Happy Hacking!
Application & Component Instances
Tags: vue
Published: 2021-06-27 13:15:18

####What Is the Root Component?
The root component is simply the starting point for when a Vue app is rendered. To understand this we have to know that a Vue app needs to be mounted into a DOM element for it to work and that root component is mounted to the DOM by using the *mount* method. We will get into more detail in the following part of the series.

####What Are Component Instance Properties?
Component instance properties are data, methods, props, computed, etc. that add component options. This will be further discussed in the following part of the series but basically it is the data and methods that can be accessed in the component's template.

The word instance may confuse some people including me. To my understanding, when you use the *new* constructor function in JS you are creating an instance of a class or another object. If we apply that understanding in the context of Vue, each component instance would simply be a component with a parent or grandparent of the root component.

####What Are Lifecycle Hooks?
Each component instance goes through a series of steps when it is created. The series of steps include being mounted, updated, and unmounted. You can add code to be applied in these specific stages.
Some basics of Markdown
Tags: markdown, github, beginners
Published: 2021-06-27 13:13:26

#### What exactly is Markdown?
Well, here’s how google defines Markdown,
*“Markdown is a lightweight markup language for creating formatted text using a plain-text editor.”*
In simple words, it is just an easy syntax that helps to format texts on the web page. The text we see on the web page is written in HTML which is a bit difficult for a normal user to understand, especially the ones who are not very familiar with it. To avoid these struggles markdown was introduced by John Gruber and Aaron Schwartz IN 2004. You can write in any text editor like Typora, Draft, MacDown, and VSCode(it is not a text editor but provides functionality to write markdown and preview it.
#### Where is markdown used?
It is used in blogging, README files, online forums, etc.
Now that we know what markdown is, let’s dive into its basics….
Things you can format in markdown are headings, links, blockquotes, images, blocks of code, and more. We’ll go through each one by one.
#### 1. Headings 
<p>Heading sizes can be formatted using hash symbol like </p>
<p># Heading 1</p> 
<p>## Heading 2</p>
<p>### Heading 3</p>
<p>#### Heading 4</p>
<p>#####Heading 5</p>
<p>###### Heading 6</p>
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6

#### 2. Italics  
<p>Use simple asterisk to make your text italic or you can use underscore. Example: *text* , _text_.</p>
 *Italic with asterisk*
  _italic with underscore_
#### 3. Bold

<p>Use double asterisk for bold or you can also use double underscore for bold. Example **text** or __text__</p>
**text**
__text__
#### 4. Strikthrough
<p>Use '~~' for strikethrough.
~~This text is strikethrough~~</p>
~~This text is strikethrough~~
#### 5. Horizontal Rule
Use '---' or '___(triple underscore)' for horizontal rule.
#### 6. Blockquote
<p> Use greater than symbol('>') for blockquote. It gives a background and blue line on the left side.</p>
> Blockquote

#### 7. Links
<p>[Link text ] (https://link-address.com)
You can navigate to the given url by clicking on ‘Link’.</p>
 
#### 8. Unordered lists

* Element 1
* Element 2
    * element 1
    * element 2
* Element 3

#### 9. Ordered lists

1. Item 1
1. Item 2
1. Item 3

#### 10. Image
<p> For image reference syntax is :
![Image text](https://image-address-here.com/img/icon256.png)</p>
So, these were some basics of markdown. 
You can also check out the syntax I used above in the README.md file 
[here](https://github.com/divyangana98/Basic-markdown)

<p>I hope this article was helpful. I’ll keep documenting my journey of learning through these blog posts.</p>
<p>Thank you !
Happy Learning!</p>
LAUNCHING MATLAB MONDAYS💥, a Crash Course✨🌟
Tags: matlab, matlabmondays
Published: 2021-06-27 12:58:37

Hello everyone⭐ Get ready for the blast💣❤️‍🔥 Launching the all new MATLAB crash course. 💎
---
____

So dear friends ✔️ I have decided to launch a crash course 🧲 to cover all the basics of MATLAB 😇. This course will be launched on this platform every Monday😊 I will quickly 💨 cover all the basics required.🌤️ 

This is ideally a binge-course for fast-tracking through MATLAB.🏃‍♀️🏃 All the blogs are 2-3 minutes read. 🎲

In case you want more advanced topics to be covered, please put them in the comment box below 👇 and I will cover them 💦 after the basics🎈🎈🎈

____
Before learning MATLAB, I would like to share a few words of caution.😵 MATLAB is neither free nor open. 😞 Unless you are a student ✍️ affiliated to any university 🏫 MATLAB might not be the best fit for you. However, there are good alternatives to MATLAB as mentioned [here](https://perso.crans.org/besson/matlab-clones.en.html).😎
Among these options, I would however advise two alternatives✋- Python (with scientific add-ons) and the Julia language. Julia is a better alternative 👌 to MATLAB with syntax very similar to it.🔆 You can read more about the benefits of Julia [here](https://www.linkedin.com/posts/wonderbiz-technologies_julia-programming-language-the-rising-star-activity-6812722852954017793-NDEd).👏 
However one point of advantage 🪔 is that the syntax of MATLAB is very similar to that of GNU Octave 🌈, so in case you want to proceed your research there🥕, you might find this course of advantage.🌞
franchisingusamagazine
Published: 2021-06-27 12:47:09

I do not have even a single clue on how do people figure out what to do with their free time and still fail everything they're assigned to do, because it's just so weird and peculiar... https://franchisingusamagazine.com/latest-news/how-manage-operational-business If they want to manage a successful business they should just go to franchiseusamagazine and get the info they need, so that they can become the new best.
I bought new Macbook Air M1 (one of my goals completed)
Tags: watercooler
Published: 2021-06-27 12:36:56

Hello Guys!

Buying a new macbook is one of my goals in this year.
And I got it. This is my very first macbook. 
I'm ready to use this for my educational & career purposes.

I uploaded vlog on my YouTube Channel.
If you want to see my happiness, please go for it. 

YouTube link
==============
{% youtube neagi_Pej1g %}
Git ve Github Nedir, Nasıl Kullanılır - Örnekler
Tags: github, git
Published: 2021-06-27 12:34:50

## Fork Örnek
Github üzerinden **Fork** butonuna basarak **repo**yu **fork**luyoruz. Daha sonrasında bu **repo**nun kendi hesabımızda bir **fork**unun oluştuğunu görebiliriz.
```
https://github.com/<YourName/<Repository>
```

### Uygulama
Öncelikle **fork**ladığımız **repo**yu **clone**luyoruz
```
git clone https://github.com/<YourName/<Repository>
```
Daha sonrasında istediğimiz değişiklikleri yerel **repo**muzda yaparak, aşağıdaki adımlar ile kendi uzak **fork**umuza **push**luyoruz
```
git checkout -b <BranchName>
git add .
git commit -m "commit mesajı"
git push -u origin <BranchName>
```
Bu adımdan sonra Github üzerinden **Compare & pull request** butonuna basarak **Pull Request** oluşturuyoruz.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6mx91ve39ll3ui71l686.png)

Aşağıdaki ekran görüntüsünde de gözüktüğü gibi, asıl **repo**daki **merge**lemek istediğimiz **branch**i seçiyoruz, istersek *Leave a comment* kısmına yaptığımız değişiklikler hakkında detaylı bilgi veriyoruz ve **Create pull request** butonuna basıyoruz
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dh16xtqv9cg9pnfdlqhs.png)

İşlemleri doğru bir şekilde yaptıysanız, aşağıdaki gibi bir ekran göreceksiniz
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p2f7wa2d6zdcc2wervvm.png)


### Stash Örnek
Eğer yerel **repo**nuzda bir değişiklik yaptıktan sonra ve commitlemeden önce, **asıl repo**da, sizin son **pull**unuzdan sonra değişiklik yapılmış ise, değişiklikleri kaydetmeden **asıl repo**yu **pull**lamak isterseniz aşağıdaki gibi bir hata alırsınız
```
Please commit your changes or stash them before you merge.
```

Bunun çözümü olarak da aşağıdaki yol izlenir
```
git stash
git pull upstream <BranchName>
git stash pop
```
Bu komutlar sırasıyla, önce yaptığınız değişiklikleri **stash**e atar. Daha sonrasında **asıl repo**daki değişiklikleri **yerel repo**nuza çeker. Son olarak da, öncesinde **stash**lediğimiz değişiklikleri **pop**layarak, değişiklikleri kaybetmemizi engellemiş olur.