teleren/devto huggingface dataset:
Daily Developer Jokes - Tuesday, Jun 1, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-06-01 12:00:00

---
title: "Daily Developer Jokes - Tuesday, Jun 1, 2021"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Tuesday%2C%20Jun%201%2C%202021"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e125905d1ad3.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*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:___ Why do programmers always mix up Halloween and Christmas?

___A:___ Because 31 OCT == 25 DEC
 -->
clean code : add meaningful context
Tags: cleancode, programming
Published: 2021-06-01 11:36:13

I am not gonna talk to much just look at the *meaningful context* differences between these two examples.

# Example 1
```
private void printGuessStatistics(char candidate, int count){

 String number;
 String verb;
 String pluralModifier;

if (count == 0) {
 number = "no";
 verb = "are";
 pluralModifier = "s";
} else if (count == 1) {
 number = "1";
 verb = "is";
 pluralModifier = "";
} else {
 number = Integer.toString(count);
 verb = "are";
 pluralModifier = "s";
}
  String guessMessage = String.format(
   "There %s %s %s%s", verb, number, candidate, 
   pluralModifier
  );
  print(guessMessage);

}

```

# Example 2

```
public class GuessStatisticsMessage {

private String number;
private String verb;
private String pluralModifier;

public String make(char candidate, int count) {
   createPluralDependentMessageParts(count);
  return String.format(
   "There %s %s %s%s",
   verb, number, candidate, pluralModifier );
}

private void createPluralDependentMessageParts(int count) {
  if (count == 0) {
   thereAreNoLetters();
  } else if (count == 1) {
   thereIsOneLetter();
  } else {
    thereAreManyLetters(count);
  }
}

private void thereAreManyLetters(int count) {
  number = Integer.toString(count);
  verb = "are";
  pluralModifier = "s";
}

private void thereIsOneLetter() {
  number = "1";
  verb = "is";
  pluralModifier = "";
}

private void thereAreNoLetters() {
  number = "no";
  verb = "are";
  pluralModifier = "s";
 }

}

```

this is absolutely :heart_eyes:
How to make Bootstrap Collapse heading as hyperlink?
Published: 2021-06-01 11:16:22

If you see the uploaded image, I expanded "Getting started", then clicked on "Introduction" - This is fine.

Next I expanded "Customize", here it got expanded, but In my case I also want to make "Customize" as hyperlink to some other .html page, but when I make it as Hyperlink in my practice example, the actual collapse is not working( not expanding), but hyperlink( a tag) works.

Hope you understood, I want to make "Customize" as hyperlink to some other page and also want to expand the menu.

Please help - As of now I'm just trying with Bootstrap only, next want to implement using React-Bootstrap.

Thank you.
Knapsack Variation
Tags: algorithms, python, rust, knapsack
Published: 2021-06-01 11:08:23

An investor has saved some money and wants to invest in the stock market. There are a number of stocks to choose from, and they want to buy at most 1 share in any company. The total invested cannot exceed the funds available. A friend who is a stock market expert has predicted the value of each stock after 1 year. 
Determine the maximum profit that can be earned at the end of the year assuming the predictions come true.

## In Python
```Python
def knapsack(w, v, W, n, t):
    if n == 0 or W == 0:
        return 0
    if t[n][W] != -1:
        return t[n][W]
    if w[n - 1] <= W:
        t[n][W] = max(
            v[n - 1] + knapsack(w, v, W - w[n - 1], n - 1, t),
            knapsack(w, v, W, n - 1, t),
        )
    else:
        t[n][W] = knapsack(w, v, W, n - 1, t)
    return t[n][W]


def main():
    saving = 250
    current_value = [175, 133, 109, 201, 97]
    future_value = [200, 125, 128, 228, 133]

    # This is a 0/1 knapsack based algorithm
    t = [[-1 for i in range(1000)] for j in range(saving)]  # n x W matrix

    profits = [
        0 if j < j else j - i for i, j in zip(current_value, future_value)
    ]
    print(knapsack(current_value, profits, saving, len(current_value), t))


if __name__ == "__main__":
    main()
```

## In Rust
```Rust
use std::cmp;

fn knapsack(w: &Vec<i32>, v: &Vec<i32>, W: i32, n: usize, t: &mut Vec<Vec<i32>>) -> i32 {
    if n == 0 || W == 0 {
        return 0;
    }
    if t[n][W as usize] != -1 {
        return t[n][W as usize];
    }
    if w[n - 1] <= W {
        t[n][W as usize] = cmp::max(
            v[n - 1] + knapsack(w, v, W - w[n - 1], n - 1, t),
            knapsack(w, v, W, n - 1, t),
        );
    } else {
        t[n][W as usize] = knapsack(w, v, W, n - 1, t);
    }
    return t[n][W as usize];
}

fn main() {
    let saving: i32 = 250;
    let current_value = vec![175, 133, 109, 201, 97];
    let future_value = vec![200, 125, 128, 228, 133];
    let mut t = vec![vec![-1; 1000]; saving as usize + 1]; // (n+1) x W matrix

    let mut profits = Vec::new();
    for (i, j) in current_value.iter().zip(future_value.iter()) {
        profits.push(if j < i { 0 } else { j - i });
    }
    println!(
        "{}",
        knapsack(
            &current_value,
            &profits,
            saving,
            current_value.len(),
            &mut t
        )
    );
}
```
Web Programming Badges HTML/CSS
Tags: css, beginners, webdev, uiweekly
Published: 2021-06-01 11:08:08

The programmer is more passionate to do code and they mostly like badges on laptops/PC. But here we made Badges in HTML and CSS with the help of font-awesome icons.

In this element, we simply used font awesome icons related to web programming languages. Also, we modify font awesome classes with CSS properties. Here we also used hover for transition effects with an amazing color combination.

Make it yours now by using it, downloading it, and please share it. we will design more elements for you.

[Source Code](https://w3hubs.com/web-programming-badges-html-css/)
30+ Free eBooks for all developers
Tags: beginners, webdev, programming, javascript
Published: 2021-06-01 11:03:03

_If you found value in this thread you will most likely enjoy my tweets too so make sure you follow me on [Twitter](https://twitter.com/VladPasca5)  for more information about web development and how to improve as a developer. This article was first published on my [Blog](https://vladpasca.hashnode.dev/)_


A Visual Git Reference - http://marklodato.github.io/visual-git-guide/index-en.html

Conversational Git - http://blog.anvard.org/conversational-git/

Introduction to Git and Github eBook - https://github.com/bobbyiliev/introduction-to-git-and-github-ebook

A beginner's guide to HTML&CSS - http://learn.shayhowe.com/html-css/

Dive into HTML5 - http://diveinto.html5doctor.com/

Learn CSS Layout - http://learnlayout.com/

Magic of CSS - https://adamschwartz.co/magic-of-css/

Basic JavaScript for impatient programmer - http://www.2ality.com/2013/06/basic-javascript.html

Exploring ES6 - http://exploringjs.com/es6/

You don't know JS - https://github.com/getify/You-Dont-Know-JS

Oh my JS - https://web.archive.org/web/20150317231950/https://leanpub.com/ohmyjs/read

Angular.js Guide - https://docs.angularjs.org/guide/

Introduction to Node.js - https://nodejs.dev/learn

Full-Stack React Projects - https://www.packtpub.com/free-ebooks/full-stack-react-projects

Hacking with React - http://www.hackingwithreact.com/

Programming React Native - https://leanpub.com/programming-react-native

30 Days of Vue - https://www.newline.co/30-days-of-vue

MySQL - http://www.techotopia.com/index.php/MySQL_Essentials

Clean Code PHP - https://github.com/jupeter/clean-code-php

PHP Best Practices - https://phpbestpractices.org/

Learn PowerShell in Y Minutes - https://learnxinyminutes.com/docs/powershell/

100 Page Python Intro - https://learnbyexample.github.io/100_page_python_intro/

A Beginner's Python Tutorial - https://en.wikibooks.org/wiki/A_Beginner%27s_Python_Tutorial

CodeCademy Python - https://www.codecademy.com/learn/python

Effective Django - https://web.archive.org/web/20181130092020/http://www.effectivedjango.com/

SQK For Web Nerds - http://philip.greenspun.com/sql/

Learn TypeScript in Y Minutes - https://learnxinyminutes.com/docs/typescript/

A byte of vim - http://www.swaroopch.com/notes/vim/

Explore Flask - https://exploreflask.com/

Learn Markdown - https://www.gitbook.com/book/gitbookio/markdown/details

Getting Started with Ubuntu - http://ubuntu-manual.org/

3D Programming in Java - http://www.mat.uniroma2.it/~picard/SMC/didattica/materiali_did/Java/Java_3D/Java_3D_Programming.pdf

IoT in five days - https://github.com/marcozennaro/IPv6-WSN-book/tree/master/Releases

Btw, did you know that I also have a free eBook?

It contains a Roadmap for Web Developers with free resources and a guide on how to grow your Twitter audience

You can get it from here for FREE - https://gumroad.com/l/2-free-sections

### The end

_I hope found this useful and if you did please let me know. If you have any question feel free to DM me on  [Twitter](https://twitter.com/VladPasca5) ._
FulL Stack Development training in gurgaon
Tags: fullstackdevelopment
Published: 2021-06-01 10:31:19

Full Stack Development is a domain that always guarantees to be in trend. No matter how many new languages come into the market or how many new technologies come in, this domain is always going to hold its royalty. Full Stack Development consists of different parts and there is a different way to approach each.
To start off we have to understand that learning Web Development should be planned in three phases:- Beginners, Intermediate, and Advance. 

I would suggest you check Gyansetu for the Full Stack web development online training because I have been a part of their training, and the quality of the training was excellent. They also provide job assistance help with a 100 % Guarantee.
Why join Gyansetu?
Instructor-Led Training | Free Course Repeat | Placement Assistance | Job-Focused Projects | Interview
Preparation Sessions
 
Gyansetu has a good setup in terms of faculty which have good industry expertise (from companies like Microsoft, Barclays, SunLife, Amazon, etc) and course content that is being offered here. They prepare students with industry-level projects so that they get a good exposure in the field.
 
Gyansetu also has a dedicated placement team which helps in getting a good job out there in the field.
 
Contact: - 9999201478/ 8130799520
Website- www.gyansetu.in
Azure CLI: Get Azure repositories list in 4 steps
Tags: azure, git, todayilearned
Published: 2021-06-01 10:29:37

If you're looking for an azure cli command to get a list of repositories, you can follow the steps:

#Step 1:
Download Azure CLI from [here](https://docs.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest)

#Step 2:
Add the Azure DevOps extension
`az extension add --name azure-devops`

#Step 3:
Configure defaults. Give YOUR organization and project names
`az devops configure --defaults organization=https://dev.azure.com/<ORGANIZATION_NAME> project=<PROJECT_NAME>`

#Step 4:
Get list by running either of the below commands

`az repos list --org "https://dev.azure.com/<ORGANIZATION_NAME>" -p "<PROJECT_NAME>" -o tsv --query [].name`

or

`az repos list --query '[].{Name:name, Url:remoteUrl}' -o json`


Cheers!
Thanks for reading!<span> &#128155;</span>
Do you have a YouTube channel? If so share it here
Tags: discuss, showdev
Published: 2021-06-01 10:18:48

Do you have a YouTube channel?

Please share a link 🔗 to it here so that we all can see it, and watch some of your videos!

Thank you! 🎉

I will start.

Here is the link to [my channel](https://www.youtube.com/channel/UCQWmdHTeAO0UvaNqve9udRw).

Feel free to share your feedback!
I made 100 more CSS loaders for your next project
Tags: css, webdev, beginners, html
Published: 2021-06-01 10:15:30

not 100, not 200 but 300! Yes, a new collection and a total of 300 CSS loaders. 

This time, I am going to rely on more elements to create the loaders ... No, I am joking 😜, still only **one** `<div>` per loader, nothing more!

Let's go!

----

<center>Also available online 👇</center>
## <center>[css-loaders.com](https://css-loaders.com/)</center>

---

## Table of content

* [The Classic III](#the-classic-iii)
* [The Dots III](#the-dots-iii)
* [The Hypnotic II](#the-hypnotic-ii)
* [The Bars II](#the-bars-ii)
* [The Spinner III](#the-spinner-iii)
* [The Dots vs The Bars](#the-dots-vs-the-bars)
* [The Nature](#the-nature)
* [The Time](#the-time)
* [The Shapes III](#the-shapes-iii)
* [The Hungry](#the-hungry)
* [The Discord](#the-discord)
* [The Ben](#the-ben)

---


### The Classic III

{% codepen https://codepen.io/t_afif/pen/WNpddpq  %}

### The Dots III

{% codepen https://codepen.io/t_afif/pen/mdWppmj %}

### The Hypnotic II

{% codepen https://codepen.io/t_afif/pen/gOmooRQ %}

### The Bars II

{% codepen https://codepen.io/t_afif/pen/zYZppdN %}

### The Spinner III

{% codepen https://codepen.io/t_afif/pen/ZEevvXW %}

<sup>The last spinner is detailed in a [Stack Overflow answer I gave](https://stackoverflow.com/a/55159993/8620333)</sup> 
 
### The Dots vs The Bars
They start as friends but ...

{% codepen https://codepen.io/t_afif/pen/gOmooGQ %}

To be continued ...


### The Nature 

{% codepen https://codepen.io/t_afif/pen/qBrppVV %}

### The Time

{% codepen https://codepen.io/t_afif/pen/eYvyyyd  %}

### The Shapes III

{% codepen https://codepen.io/t_afif/pen/bGqaaaP %}

### The Hungry

{% codepen https://codepen.io/t_afif/pen/abJEEqw %}

### The Discord
Someone challenged me so I had to do it.

{% codepen https://codepen.io/t_afif/pen/BaWJJre %}

It's not a perfect replicate but close enough 😁

### The Ben

A last one for the fun. I added a click handler to avoid the spoils. Click and wait until the end 

{% codepen https://codepen.io/t_afif/pen/MWprrGe %}

A small joke to remind you that even if you use a loader, your website need to be fast 😉 and yes Ben is done with pure CSS, I am not using any image. I know it's crazy...

---

### That's it!

I hope you enjoyed this 3rd collection. If you want more don't forget to ❤🦄! If you have some funny or crazy ideas of loaders you want me to do, leave a comment 👇

I don't do only loaders if you want more fun:

{% post https://dev.to/afif/100-more-underline-overlay-animations-the-upgraded-css-collection-4c25 %}
The Untold Secret of End-to-End Testing and Test Case Design
Tags: testing
Published: 2021-06-01 10:11:26

Continuing the topic of end-to-end testing, you may find useful one of our previous posts on this topic. Who should be responsible for the test case design? What test cases should be included in the process of E2E testing? When to introduce this type of testing?
Answers to all these and many other questions you'll find following the link: https://hiretester.medium.com/the-untold-secret-of-end-to-end-testing-and-test-case-design-a4bf68cce0cc
Why I'm blogging on DEV now
Tags: firstpost, devjournal, developerdiary, devlog
Published: 2021-06-01 09:56:24

After my previous blogging attempts on GitHub Pages and Medium, I'm giving DEV a try. I've been noting down ideas and content for blogs, but never found time to complete those drafts and publish them. So, this time I'm trying a different approach. I'll be using DEV kinda like a developer journal, to write about interesting technical stuff I find daily. This will be a quick blogging platform for me, where I can note down and share my ideas and experiences. That was the original plan for [my (now discontinued) blog on GitHub Pages](https://HEXcube.github.io/blog).

As for [my Medium blog](https://medium.com/@HEXcube), I'll be continuing it parallelly. However, I'll reserve it for more polished content, not necessarily technical or development related. So, I'll be writing here on DEV more frequently, and on Medium only when I have enough time to curate the content. That'll keep the flow of writing blogs, I hope.

---

## Credits & Sources
Cover image from [person using laptop](https://unsplash.com/photos/vZJdYl5JVXY) by <a href="https://unsplash.com/@kaitlynbaker?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Kaitlyn Baker</a> on <a href="https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
Upgrade to Ruby 3 - update projects 🔩
Tags: jekyll, ruby, upgrade, tutorial
Published: 2021-06-01 09:42:49

Now, you should have Ruby 3 ready. 

Your Ruby projects will have stale gems and lockfiles though, so you need to make changes to them.

I'm going to walk you through how to update your projects to get them using Ruby 3. This will be similar across projects but I will focus on Jekyll projects. I like to build websites using [Jekyll](https://michaelcurrin.github.io/dev-resources/resources/jekyll/) as a static site generator. I have a demo [here](https://github.com/MichaelCurrin/jekyll-blog-demo) if you are interest - including an update to the `Gemfile` to support Ruby 3.

Repeat the steps below for each Ruby project of yours.


## Remove old gems 🙅‍♂️ 💎

```sh
$ rm -rf vendor
```

This is not strictly necessary, as 2.7 and 3.0 gems are kept in separate directories in the `vendor` directory. But if you are never going to use those old gems again, then you can reclaim some space now.


## Remove lockfile 🙅‍♂️ 🗃

```sh
$ rm Gemfile.lock
```

I found that that I got errors running Jekyll, unless I dropped the old lockfile and started over with a fresh set of the latest gems.


## Install gems

```sh
$ bundle install
```

Then commit your lockfile.


## Install missing gems 🚛 📦

For Jekyll in Ruby 3, you'll get this error on serving.

```
Load error: cannot load such file – webrick
```

Fix that by installing Webrick, as per Jekyll issue [#8523](https://github.com/jekyll/jekyll/issues/8523). Perhaps this will be fixed in newer releases of Jekyll.

Run this to add the gem to your `Gemfile` and install it.

```sh
$ bundle add webrick
```

Commit your lockfile.


## Start Jekyll

Your Jekyll site should be ready to use now.

```sh
$ bundle exec jekyll serve --trace
```

---

Thanks for reading. I hope that eases your journey to using Ruby 3.


## Credits 📸

Cover image created with Google Jamboard.

Photo by <a href="https://unsplash.com/@joshuafuller?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Joshua Fuller</a> on <a href="https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
Upgrade to Ruby 3 - upgrade ⚙️
Tags: ruby, upgrade, install, tutorial
Published: 2021-06-01 09:39:00

## Install Ruby 3 ⚙️ 💎

### Linux

```sh
$ sudo apt-get update
$ sudo apt-get install ruby ruby-dev
```

### macOS

```sh
$ brew install ruby@3.0
```


## Set up Ruby path ➡️

In the case of macOS, you'll have to add this to your `PATH` to run the custom Ruby.

If you had Ruby 2 running before you can leave this as is when using Ruby 3.

```sh
export PATH="/usr/local/opt/ruby/bin:PATH"
```

Note that both `ruby` and `bundler` exist there.

```sh
$ which ruby bundler
/usr/local/opt/ruby/bin/ruby
/usr/local/opt/ruby/bin/bundler
```

Test with:

```sh
$ ruby -v
```

```sh
$ bundle -v
```


## Set up gems path 📦

This is to allow user level gems to run from anywhere.

If you like to install gems at the shared system level, like this, then you can _skip_ this step.

```sh
$ gem install GEM_NAME
$ # OR 
$ sudo gem install GEM_NAME
```

But if you like to install gems at the user level, like this, then you _do_ need this step.

```sh
$ gem install GEM --user-install
```

Add the following to `.bashrc` or `.zshrc` file:

```sh
if which ruby >/dev/null && which gem >/dev/null; then
  GEM_PATH="$(ruby -r rubygems -e 'puts Gem.user_dir')/bin"
  export PATH="$GEM_PATH:$PATH"
fi
```

Then start a new terminal tab to load the changes.

That shell command will figure out that path to your user gems, like this:

- `~/.local/share/gem/ruby/3.0.0/bin`

Then it will add the path to your `PATH` variable.

The best part is that it is _dynamic_ - it does not have a hard-coded path. So Ruby can change where it decides to install gems (like it did between Ruby 2 and 3 from `~/.gem` to `~/.local`). And you can upgrade from Ruby 3.0 to 3.1 or 4.0. Yet the shell command will figure out the correct path, _without_ needing a manual update or causing head scratching when Ruby projects break one day.
Upgrade to Ruby 3 - uninstall 🙅‍♂️
Tags: ruby, delete, gem, uninstall
Published: 2021-06-01 09:31:24

How to remove Ruby and gems from your system


## Remove gems ❌ 📦

Delete custom gems installed at the user level - only your user could run them.

```sh
$ rm -rf ~/.gem
```

Delete system-wide custom gems - any user could run them. If only root has access to modify this directory, then you'll need to run with `sudo`.

```sh
$ rm -rf /usr/local/lib/ruby/
```

That directory contains `gems/` and `site_ruby` by the way.


## Remove Ruby 🙅‍♂️ 💎

Remove the custom Ruby using your package manager.

### macOS

```sh
$ brew uninstall ruby
```

### Linux

```sh
$ sudo apt remove ruby ruby-dev
```

Or, if you installed as `ruby-full`, then run:

```sh
$ sudo apt remove ruby-full
```
Upgrade to Ruby 3 - intro 💎
Tags: ruby, install, tutorial, upgrade
Published: 2021-06-01 09:29:00

I regularly build websites using Jekyll, which is built on Ruby. So I need to have control over my Ruby environment and gems.

I recently upgraded to Ruby 3. And now I want to share steps for others, using macOS or Linux. 

This series covers

1. Deleting the old gems and old Ruby.
2. Setting up a new Ruby and updating the path.
3. Fixing up gems for projects.


## What is Ruby?

If you've never heard of Ruby, this post is not for you. But check out the [Ruby](https://www.ruby-lang.org/en/) homepage to learn more about the language.


## Why upgrade to Ruby 3? 🤔

According to the first post below, there are some improvements around performance, concurrency and type checking. Plus changes in syntax and gem updates, as covered in the _Other notable changes since 2.7_ section.

- [Ruby 3.0.0 Released](https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/) post - 🚀 Dec 2020.
- [Ruby 3.0.1 Released](https://www.ruby-lang.org/en/news/2021/04/05/ruby-3-0-1-released/) post - 🚀 April 2021.

See also this [blog post](https://www.fastruby.io/blog/ruby/upgrades/upgrade-ruby-from-2.7-to-3.0.html) as a friendlier summary of changes.

Since Ruby 3 has been out about 6 months and has a patch release out, I feel comfortable using it. I would avoid using a major release too soon after it comes out.
 

## Linux warning ⚠️

For Linux users - _before_ your uninstall Ruby in the post, save yourself some trouble and make sure that Ruby 3 is actually available for your distribution. Using your system's package manager UI to browser can help here. 

If you're stuck, then you can install a Ruby environment manager and use that to install Ruby 3.

- [Ruby Env (rbenv)](https://github.com/rbenv/rbenv) - see [blog post](https://richstone.io/where-is-ruby-3-0-0-on-rbenv/)
- [Ruby Version Manager (RVM)](https://rvm.io/)

See also this [post](https://www.linuxhowto.net/how-to-install-ruby-3-on-ubuntu-20-04/) which covers using `rbenv` or `rvm` to install Ruby 3 on Ubuntu.