teleren/devto huggingface dataset:
A Quick 10-Second Programming Joke For Today
Tags: jokes, dailydeveloperjokes
Published: 2021-10-23 12:00:17

---
title: "A Quick 10-Second Programming Joke For Today"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
published: true
tags: #jokes, #dailydeveloperjokes
---

Hi there! Here's today's Daily Developer Joke. We hope you enjoy it; it's a good one.

![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12593f93b65.png)

---

For more jokes, and to submit your own joke to get featured, check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/). We're also open sourced, so feel free to view [our GitHub Profile](https://github.com/dailydeveloperjokes).

### Leave this post a ❤️ if you liked today's joke, and stay tuned for tomorrow's joke too!

_This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit._

<!--
Joke text:
___Q:___ I love you and I only love you. Does that turn you on?

___AND GATE:___ No.
 -->
Why You Should Use NVM (Node Version Manager) and How to Install It
Tags: javascript, node, productivity, beginners
Published: 2021-10-23 11:51:34

###Backstory

Have you ever experience difficulties in software development due to unsupported / different version ? Recently I was facing the same issue. The issue was a different Node.js version from my machine (Node v14.18.0) with my company project repository (Node v10 required). The first solution that instantly pop up in my mind was "I think downgrade my current node by uninstalling it will do the work", But what if you need another version for another project in the near future? Do you want to endure the pain of installing and uninstalling Node.js every time you need a different version of it ? 

#Node Version Manager

![Node Version Manager](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/udz5vnnvog98sw77cz01.png)

[NVM](https://github.com/nvm-sh/nvm) is a version manager for Node.js, it allows you to quickly install and use different versions of node via the command line.

Let's head to the tutorial !

#Instaling Node Version Manager Guide

If you happen to use UNIX, macOS, or WSL (Window Sub-system for Linux), you can install and read the official documentation [here](https://github.com/nvm-sh/nvm#installing-and-updating)

If you happen to use Windows you can install it at [NVM for windows](https://github.com/coreybutler/nvm-windows/releases) which is developed by [Corey Butler](https://github.com/coreybutler), download the **nvm-setup.zip** file.
![NVM for windows github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bnrg645478ndqxn0ly2g.png) 


###Important Note
![Installation Guide Github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nszt5bl3y1n7adxc6q7d.png)
It is stated that you need to uninstall pre-existing node version, but based on my experience it is not necessary to do so.

After the installation you can open your command prompt and check whether nvm is recognized

```
C:\Users\YourUsername>nvm -v

Running version 1.1.8.
```

If nvm is not recognized as internal command or external command, try to re-open your command prompt.

Then, You can type **nvm list** in order to see list of Node.js version on your machine.

```
C:\Users\YourUsername>nvm list

  * 14.18.0 (Currently using 64-bit executable)
    10.18.0
```

If you don't see your desired Node.js version in the list, you can use **nvm install** command, for example if you want Node.js version 8, you can type **nvm install 8.0.0**

To use the installed Node.js version you can simply type **nvm use 8.0.0**
 
###Note

If you see an error message *exit status 5: Access is denied.*, It is due to admin privilege issue. To solve it you can simply run your command prompt as administrator. 

Thank you for your time reading this short article / tutorial about Node Version Manager, hope it helps! and Have a great day.
[REPOST]-Bring AI to slackbots with Dialogflow CX!
Tags: hacktoberfest, opensource, developers, serverless
Published: 2021-10-23 11:50:08

Hi Folks!
I'm pretty excited to announce that [Dialogflow CX - Slack SDK](https://github.com/Sampriti-Mitra/dialogflow-slack-sdk) is accepting contributions this Hacktoberfest and has accepted the first contributing PR! 
We have 6 beginner friendly open issues that you can start working on today!

## Why do we need this SDK?
The motivation behind this SDK, was the slack community to be able to use dialogflow cx in the slack bots. 
Slack provides a multitude of rich features and APIs, including the bot kit UI, that gives life to conversations. 

## What is Dialogflow CX?
Google's [Dialogflow CX](https://cloud.google.com/dialogflow/cx/docs/basics) is a conversational AI development platform, suited for creating chat bot flows. The uniqueness and simplicity of this platform lies in defining conversation flows with the user through pages with intents and fulfillments.

## So ultimately it all boils down to... what?
Using Dialogflow CX you can get the intent of the conversation. Using dialogflow CX session context, you can maintain the flow of conversation between bot and user. And using this SDK you can have all of that on slack.

## That sounds cool, but why do you need contributions?
- As mentioned above, both Dialogflow CX and Slack provide a plethora of features, the full extent of which can be used in the SDK to build a strong base which the slack community can make full use of!
- Also currently, the SDK supports App Engine or Cloud functions deployment which can be extended to use other cloud providers as well!
- You are also welcome to add any issues/extensions as you feel would help.

## Great, great, how do I start contributing? And will my contributions be accepted?
You can start by checking out the [SDK](https://github.com/Sampriti-Mitra/dialogflow-slack-sdk) first. Do go through the [Contributing](https://github.com/Sampriti-Mitra/dialogflow-slack-sdk/blob/main/CONTRIBUTING.md) guideline as well.
All contributions are welcomed and will be accepted provided they follow the contribution guildelines.

So what are you waiting for? Contribute and earn your [Hacktoberfest](https://hacktoberfest.digitalocean.com/) Swag now!
Debouncing for beginners by a beginner
Tags: javascript, beginners, webdev
Published: 2021-10-23 11:41:00

I am a beginner and I recently learned **debouncing** and **throttling** ,their usage and differences. 

#Debouncing
Debouncing is a procedure in JavaScript(and possibly other programming languages) which helps us to reduce the number of function calls in response to an event.
For understanding and simplicity sake let us suppose we need to make API calls for "keyup" events on an input element.
```
function makeAPICall() {
   //Making API Call
}

document.querySelector("input").addEventListener("keyup",makeAPICall)
```
If we use the above method and suppose I typed "Hritick" in 1 go in the input element a total of 7 API calls will be made (for each character typed) but most probably the application should only make the API call for "Hritick" or "Hrit" but we made an API call for each new character inserted which is very **expensive**.
So to solve this problem we can use Debouncing - **by using debouncing we will make the API call only if the event (triggering the API call) hasn't taken place for a given iterval of time.**
```
function makeAPICall() {
   //Making API Call
}

function debounce(fn, delay) {
  let timer;
  return function () {
    clearTimeout(timer);
    timer = setTimeout(fn, delay);
  };
}

const optimisedFunction = debounce(makeAPICall, 500);

document.querySelector("input").addEventListener("keyup", optimisedFunction);
```
In the above code we created an "optimisedFunction" for debouncing. Instead of directly making API calls on every "keyup" event we will make the API call **500 milliseconds after every "keyup" event** and by using the concept of **closures** we will **cancel** every request for API call before the current "keyup" event by using **clearTimeout(...)**.
Thus making the API call only when the user has stopped typing or have slowed down typing.
As the title said I am a beginner so if I made any mistakes or anyone has any question please comment me. And I'll make sure I correct or answer the comment.
Hacktoberfest - 2nd contribution
Tags: opensource, hacktoberfest, osd600
Published: 2021-10-23 07:07:29

While looking for more issues to work on, I came across this cool project - [space-voyager](https://github.com/space-voyager-21/space-voyager/issues). I'm very interested in this project but there wasn't any open issue. Therefore, I decided to file one and contribute to it. 

This time, since I was filing an issue on my own, I read the contributing guide carefully and found that the project has an issue template. I followed the template closely to make sure that all issues were described in details

### The issue
I did walkthrough of the website and carefully note down any parts that needed fixing. I found a mistake which was probably due to copying and pasting content. When users search for **satellites** and no results are found, the error message would show 
> We don't know about the **planet** you searched for.

I also found some other styling issues on smaller screen sizes. Each of  them is a minor fix so I put all under one single [issue](https://github.com/space-voyager-21/space-voyager/issues/44).

### The fix
The issue related to copy/paste was in the error component. Instead of just hard coding the error message with the updated content, I decided to pass in the argument so that it's relevant to the error.
```html
<p className="error__wrapper__text">
   OOps!We dont know about the {type} you searched for
</p>
```
By doing this, the error message can be dynamically rendered and reused in different components.

Other issues were related to styling for smaller devices. I used the browser inspector to try out different screen sizes and identified some breakpoints to work on. With each breakpoint, I had to fix the animation of the planet so that when it's moving, it won't hide other components. I also added some text alignments so that buttons would look neat.

  
Issue-2 link: https://github.com/space-voyager-21/space-voyager/issues/44
PR-2 link: https://github.com/space-voyager-21/space-voyager/pull/45
Javascript Notları #4 - Fonksiyonlar (Functions)
Tags: javascript, webdev, beginners, programming
Published: 2021-10-23 11:35:06

Merhabalar, seriye fonksiyonlar ile devam ediyoruz. Hadi başlayalım :)

Fonksiyonlar bizleri kod tekrarından koruyan, kodu daha güvenilir ve düzenli hale getiren, işleri kolaylaştıran kod bloklarıdır. Fonksiyonlar sayesinde çok daha verimli yazılımlar-programlar üretilebilir. 

Fonksiyonlar aşağıdaki örnekte verildiği gibi tanımlanır ve çağrılırlar:
```
<script> 
    function greetings() {
        console.log("Merhabalar, Hoşgeldiniz ");
    }

    greetings();
</script> 
```
Bu fonksiyonun çağrılması ile konsoldaki output aşağıdaki gibi olacaktır.
![Function Call](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ok6l2sdg4f40w6w0fvul.png)
 
Fonksiyonlar parametre denen değişkenleri alabilir ve gerekli komutlarda kullanabilirler. Parametre tanımlarken fonksiyon ismi içerisinde herhangi bir veri tipinin belirtilmesine gerek yoktur. Çünkü Javascript parametre değişkenlerinin tiplerini dinamik olarak tutmaktadır.

Parametreli bir fonksiyonun tanımlanması aşağıda gösterilmiştir:
```
<script>
    function greetings2(name) {
        console.log("Merhabalar " + name + ", Hoşgeldiniz ")
    }
    
    function calculate(fiyat,borc) {
        console.log("Sepete eklenen ürünün fiyatı: " + fiyat 
        + "TL olup Toplam Borcunuz ise: " + borc + "TL 'dir.");
    }

    greetings2("Turan");
    calculate(10,50);
</script>

```
Bu fonksiyonun outputu ise aşağıdaki gibidir:
![Parametreli fonksiyon çağırımı Javascript](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6hwz9xf0rfvffaqq0big.png)

Ufak bir toplama fonksiyonu örneği:
```
<script>
    function toplama(a,b,c,d) {
        console.log("Verilen değerlerin toplamı: " + (a+b+c+d));
    }
    
    toplama(5,10,15,20);
</script>
```
Toplama fonksiyonun outputu aşağıdadır:
![Toplama fonksiyonu Javascript](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ccuwtv4yzwfhz3moz05.png)

İşlem gerçekleştiren fonksiyonlar olduğu gibi, değer tutan fonksiyonlar da oluşturulabilir. Yani bir işlem sonucunda ortaya çıkan değer bir değişkene aktarılabilir ve program içerisinde farklı yerlerde kullanılabilir:
```
<script>
    function toplama(a,b,c,d) { // fonksiyonun oluşturulması
        return a+b+c+d;
    }
    
    console.log("İşlemin sonucu: " + toplama(5,10,15,20)); // döndürülen değerin işlemde kullanılması
    var x = toplama(5,10,15,20); // döndürülen değerin değişkene atanması
    console.log("x'in değeri: " + x);
</script>
```
Bu kodun outputu ise aşağıdaki gibidir:
![Bir değer döndüren fonksiyon Javascript](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pfsjmobh3fzmcab3ok9b.png)
Flash USB stick for Windows from MacOS 🚀
Published: 2021-10-23 11:29:46

This article will should you how to create a bootable USB stick for installing Windows 10 / 11 from MacOS, [here](https://tb.rg-adguard.net) you can find ISO images for Windows.

## 🧹 Format your USB stick to NTFS

Format your USB stick to `Microsoft NTFS`, to do so install [ntfs-mac](https://www.paragon-software.com/us/home/ntfs-mac), this will install a ntfs driver for MacOS, now this format should be available for you inside of `Disk Utility`, erase the USB stick:

![erase window from Disk Utility](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3gte98wanr4iyhzjlxin.jpg) 

## 💿 Installing & opening unetbootin

Install unetbootin with brew:

```bash
brew install --cask unetbootin
```

Open it and allow it through `System Preferences / Security & Privacy`:

![Security & Privacy with Open Anyway button](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6poo3sy6z2qijwb91xpj.jpg)

For me unetbootin didn't recognize my usb device, but it worked by selecting it through the command line:

```bash
/Applications/unetbootin.app/Contents/MacOS/unetbootin installtype=USB targetdrive=/dev/disk2s1
```

Replace `/dev/disk2s1` with yours, you can find it out by `diskutil list`:

```bash
/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *31.5 GB    disk2
   1:               Windows_NTFS WIN                     31.5 GB    disk2s1
```

## 🚀 Flash it!

Select your Windows ISO image and flash it 🙌

![UNetbootin with ISO & USB stick selected](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8jwe9h72v6s01izdlpbw.jpg)
Make your shell scripts more bugproof with a few simple habits
Tags: bash, linux, terminal
Published: 2021-10-23 11:14:04

Your terminal can do some really cool things. The `|` operator was a stroke of genius. It lets you take the output of one command and feed it to another, chaining together a few simple tools to perform a bigger automated task.

Shell scripts are a natural extension of your terminal's power. Creating ready-to-run recipes for later use? Sweet. But once you start using these scripts for more advanced things, you run into some unfortunate Bash quirks. For example: when a part of your script produces an error, the rest of the script will still be executed, making its behavior unpredictable.

There are some habits that you can adopt right now to make writing shell scripts easier.

{% youtube -tSI7mjRGZs %}

Here's the gist of it if you don't need further explanation:

- Add `set -euo pipefail` to improve how your script deals with undeclared variables and non-zero exit codes.
- Add `IFS=$'\n\t'` so that array elements are split in a predictable way.
- When defining functions, return data with `echo` instead of `return`. The `return` keyword doesn't do the same thing as in other languages.
- Returning arrays from functions is not really possible. As a bad but easy workaround, you can pass array return values via a global variable.
- Keep your whitespace in mind. Confusingly, `if [ FOO=='bar' ]` will overwrite the value of `$FOO`. `if [ FOO = 'bar' ]` will perform a string equality check.

Alternatively, for complex tasks, you'll probably have an easier time using a different scripting language like Python, Ruby or Perl.

#### Additional reading
[Unofficial bash strict mode](http://redsymbol.net/articles/unofficial-bash-strict-mode/)
[Your bash scripts are rubbish, use another language](https://dev.to/taikedz/your-bash-scripts-are-rubbish-use-another-language-5dh7)
Is Rust going to Replace Java?
Tags: rust, java, programming
Published: 2021-10-23 11:12:29

Hey Coders!!

A lot of you have been telling me that rust is soon going to replace java.

Looking at the perspective of the number of people using java, I would say Rust isn't going to replace java.

I don't think a language can **fully** replace another one.

Oracle released Java in 1995. It is still used worldwide by so many developers out there.

I mean, sure, Java is pretty lengthy and we need another way to make it easier to write code.

Technologies such as Rust and Go function the same way as Java but they are written in shorter code.

Hello World Written in Java:

```java
class Simple{  
    public static void main(String args[]){  
     System.out.println("Hello Java");  
    }  
}
```

Hello World Written in Rust:

```rust
fn main() {
  println!("Hello world!");
} 
```

Well, Rust does have a lot of new more interesting ideas and concepts but we don't know whether they are going to be adopted universally.

There are also a lot of other companies that have java code written in their programs.

One advantage of using Java is that you have a lot of libraries and APIs available.

Well, Rust doesn't really have as many developers as Java does.

Rust might not be large enough to become a conventional language.

The Final Reason why I think Java won't be replaced is because the entire company of Android has a lot of servers that run on Java.

Overall, There is a possibility that Rust *could* replace Java but it most likely wont.

I hope I answered your question and I hope you enjoyed this blog!

And don't forget...

<h2>Keep Coding Y'All 👨🏻‍💻</h2>
What is SAML? | How does Microsoft Azure AD SAML work?
Tags: saml, azuread, azure, auth
Published: 2021-10-23 10:05:10

{% youtube 9rv3JG0XZV4 %}

If you have ever interacted with Azure AD, then you have definitely interacted with the process of SAML authentication.
If you've ever wanted to know What is SAML? and How does it work? then this video tutorial is definitely for you.

About me:
Project Enquiries: https://www.srajangupta.com/

Connect with me here:
LinkedIn: https://www.linkedin.com/in/srajangupta/
Twitter: https://twitter.com/srajangupta__
Dart Extensions Make My Heart Flutter 😇
Tags: flutter, dart
Published: 2021-10-23 10:04:38

Until Dart 2.7 introduced Extension methods,  it was often impractical or impossible to add some functionality to built-in classes or someone else’s API.

Well, now you can, and here are some useful examples.


Tired of calling
```dart
final theme = Theme.of(context)
```
Create extension on BuildContext
```dart
extension BuildContextExt on BuildContext {
  /// Usage: context.theme;
  ThemeData get theme => Theme.of(this);
}
```
You probably need to get textTheme
```dart
extension BuildContextExt on BuildContext {  
 /// Usage: context.theme; 
 ThemeData get theme => Theme.of(this);
 /// Usage: context.textTheme;
 TextTheme get textTheme => theme.textTheme;
}
```
Or getting device top padding
```dart
extension BuildContextExt on BuildContext {  
 /// Usage: context.topPadding; 
 double get topPadding {
  return MediaQueryData.fromWindow(window).padding.top;
 }
}
```
Or pushing a new page
```dart
extension BuildContextExt on BuildContext {  
 /// Usage: context.push(NewPage()); 
 Future push(Widget page) {
   return Navigator.of(this).push(CupertinoAppRoute(
     builder: (_) => page,
     settings: RouteSettings(name: '$page'),
   ));
 }
}
```
Wrap everything in one extension
```dart
extension BuildContextExt on BuildContext {  
 /// Usage: context.theme; 
 ThemeData get theme => Theme.of(this);
 /// Usage: context.textTheme;
 TextTheme get textTheme => theme.textTheme;
 /// Usage: context.topPadding; 
 double get topPadding {
  return MediaQueryData.fromWindow(window).padding.top;
 }
 /// Usage: context.push(NewPage()); 
 Future push(Widget page) {
   return Navigator.of(this).push(CupertinoAppRoute(
     builder: (_) => page,
     settings: RouteSettings(name: '$page'),
   ));
 }
}
```
Usage
```dart
import 'my_extensions.dart'
class CheckMyProfileWidget extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    final theme = context.theme;
    final textTheme = context.textTheme;
    final topPadding = context.topPadding;
    context.push(NewPage());
    return Container();
  }
}
```
And the list of extensions goes on… you can add extension on any class and create cool shortcuts and useful methods.
What is OAuth 2.0? How does Google OAuth work?
Tags: oauth, programming, webdev, googlecloud
Published: 2021-10-23 10:03:14

{% youtube B148DaPUEGc %}
This tutorial is all about OAuth 2.0.
If we take an example of Google OAuth, we shall learn in the video that what all are the different steps that are taken when a website logs us in using Google OAuth.

Project Enquiries: https://www.srajangupta.com/

Connect with me here:
LinkedIn: https://www.linkedin.com/in/srajangupta/
Twitter: https://twitter.com/srajangupta__