teleren/devto huggingface dataset:
Create your custom Spring Boot app banner
Tags: spring, springboot, guide, customization
Published: 2022-12-04 11:25:57

---
title: Create your custom Spring Boot app banner
published: true
date: 2022-12-03 08:10:08 UTC
tags: spring,springboot,guide,customization
canonical_url: https://yonatankarp.com/create-your-custom-spring-boot-app-banner
---

Today, I'd like to share a fun feature of Spring with you. It's not new or crucial, but it's definitely enjoyable!

Normally, when you launch your Spring Boot app, you see a standard banner in the logs like this:

![Spring Boot Banner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t5nmo46md85a7r1b7hmv.png)

But have you ever thought about replacing that Spring banner with your own custom banner? If you have, then this article is for you!

To begin, let's visit [https://patorjk.com/](https://patorjk.com/), a website that helps us create custom text. You can enter the desired text for your log and choose from a variety of fonts. For example:

![Custom Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q761ue4i9255loilukv8.png)

You can also click the **Test All** button to explore all the available options.

Now, let's copy our text and place it inside the application under `/resources/banner.txt`, as shown below:

![Copy Custom Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wirns47fnm5ip064fiss.png)

Next, let's relaunch our app:

![Custom Banner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bmehyhm8q2pt5jg96rw2.png)

As you can see, our custom banner has been successfully replaced! Great job! :)

If you're using Spring Boot 2, you can even convert images into [ASCII art](https://en.wikipedia.org/wiki/ASCII_art). However, please note that this functionality is deprecated and has been removed in Spring Boot `3.0.0`, which was released recently.

To convert images into ASCII art, follow these steps:

* Add your image to the resources directory. For this article, we'll use the following logo:

![sumup logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i6dlc4vn0amss4471gx3.png)  

* Add the following configuration to your [`application.properties`](http://application.properties) or `application.yml` file to specify the location of your image:
    

```yaml
spring:
  banner:
    image:
      location: sumup.png
      height: 20 # can be adjusted to resize your banner
```

* Make sure there's no `banner.txt` file in your resource directory.
    

Let's run our app again...

![Custom Logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5cesp6lsvppepjivk1h0.png)

As you can see, our new logo magically appears!

### Summary

In this short article, I've shown you how to customize your Spring banner using text or even images (for Spring Boot `2.x.x`) in just a few minutes.

---

Stay updated with my latest thoughts and ideas by registering for my [newsletter](https://yonatankarp.com/newsletter). Connect with me on [LinkedIn](https://www.linkedin.com/in/yonatankarp/) or [Twitter](https://twitter.com/yonatan_karp). Let's stay connected and keep the conversation going!
Variables in CSS / Custom Properties
Tags: css, webdev, tutorial, programming
Published: 2022-12-03 08:05:33

## 🌟Intro

CSS variables are a new addition that works the same as variables in any language where you store some data and reference it by the variable name later in the code.

*Previously this feature was one of the things that made CSS preprocessors famous but now it is natively available in CSS to be used without any setup*

Now same in CSS you can store different CSS property values and then use them in with respective CSS properties.

**Now let's see how to define and use CSS variables:**

### 🌟Defining the Variable:

```css
   --var-name: value;
```

As you can see you need to start the variable name with a double `dash(-)` and use the kabab case for the variable name then `colon(:)` and finally the value you want to store

Ex:

```css
   --background-color : Lightblue;
```

Now comes the topic of where to define the variable, because you'll need a scope for variables and in HTML/CSS the elements are the scope.

Ex:

```css
.container{
    --background-color: black;
}
```

now all the elements in this element with container class can access the background color variable.

The best practice here would be to define all variables in the `:root` scope. Because in the HTML document it is the root of the element tree or parent element of all elements in HTML, so this way you will have access to variables in the whole CSS file.

### 🌟Using the variable:

After defining the variable it's just a matter of using it and here's how you do it,

Ex:

```css
element {
    background: var(--background-color);
}
```

As seen in the example whenever you want to use the custom property/variable you write it inside `var()` and that's it.

This way you can nearly save any property in a variable and reference the variable name without typing it.

This comes in very handy when is a style change or some component upgrade where you'd have to go and find those properties and change them one by one, and in this case, you just change the values where you defined variable and that's it, the change will be reflected all over CSS.

* * *

**If you found the content I share useful then share it with your developer friends and also follow me on** [Instagram](https://www.instagram.com/gaurav_vaala/) **and** [Twitter](https://twitter.com/gaurav_vaala)
NoFollow Links Code
Published: 2022-12-03 08:02:18

Hey,

I'm looking for a VS code script that can apply all WhatsApp group links from [https://whatslinkhub.com/](https://whatslinkhub.com/) to nofollow tag. I've used some plugins that apply all links to nofolow. But I just want to nofollow whatsapp links not all.

Can some one have the script?
What I've been reading (week 48, 2022)
Tags: watercooler, news, discuss
Published: 2022-12-03 08:00:18

I [keep a record](https://wolstenhol.me/#reading) of articles, blog posts, videos etc that I've enjoyed this week. Here's a sample of seven of them:

## [Developing a focus style for a themable design system](https://adhoc.team/2022/02/08/creating-focus-style-for-themable-design-system)

A deep-dive into picking an approach to focus outlines. The end result is similar to what I've used before, a two-colour box-shadow approach with special treatment for links to avoid breaking-across-lines issues.

## [Why you should never use px to set font-size in CSS](https://joshcollinsworth.com/blog/never-use-px-for-font-size)

A reminder to avoid shipping CSS that uses pixels for font sizes or media queries as it affects text zoom users. I hate the mental maths or using mixins to convert pixels to [r]em so I author in px but let `postcss-pxtorem` & `postcss-em-media-query` handle the conversion for me.

## [Speeding up the JavaScript ecosystem - one library at a time](https://marvinh.dev/blog/speeding-up-javascript-ecosystem)

It's really impressive how the author was able to find, fix, and explain so many JavaScript performance issues in one blog post. This kind of runtime performance isn't something I know a lot about, so it's really interesting how seemingly small changes can have such an impact.

## [Software Engineering at Google](https://abseil.io/resources/swe-book/html/toc.html)

"A candid and insightful look at how Google construct and maintain software. This [free, HTML] book covers Google’s unique engineering culture, processes, and tools and how these aspects contribute to the effectiveness of an engineering organization."

## [Capture, debug and mock all Docker HTTP traffic](https://httptoolkit.com/docker)

This looks great, especially being able to rewrite incoming requests to simulate backend behaviour without the backend having to be in that particular state (or even exist!)

## [Designing a sustainable front-end toolset for FT.com]( https://link.medium.com/09WucD4Zovb)

I'd share this article just for this quote alone (sorry non-UK people): "Our 'No next Next' tech strategy means we are continuously replacing parts of our stack (like the Ship of Theseus or The Sugababes)"

## [Making microservices accessible](https://www.craigabbott.co.uk/blog/making-microservices-accessible)

A great article on the accessibility pitfalls of using standalone services within an organisation. The blog post focuses on government but this also applies to commercial sites that redirect you to a separate 'account' or 'auth' service/application to log in.

---

I also [tweet these as I find them (@philw_)](https://twitter.com/philw_) and post them on my personal site at https://wolstenhol.me/#reading.

What were your favourites? Was there anything you found useful?

{% user philw_ %}
Enjoy Programming-Themed Humor? Here's today's daily developer joke!
Tags: jokes, dailydeveloperjokes, watercooler
Published: 2022-12-03 08:00:16

---
title: "Enjoy Programming-Themed Humor? Here's today's daily developer joke!"
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, #watercooler
---

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/5e12597d4e1c1.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:___ What accommodations did the JavaScript developer request at the hotel?

___A:___ A room with a Vue.
 -->
First class functions in Go
Tags: go, github, gonuts, functions
Published: 2022-12-03 06:38:45

# 1. Higher Order functions
In Go,language, a function is called a Higher order function it should full fills one of the below conditions. 

**1. Passing function as an argument to other function.**

```go
func(f) f
```

Note : passing function as an argument is also known as a `callback function` or `first-class function`



**2. Returning Functions From Another Functions**

```go
func fun(f) f{
 return func(){
     //body
  }
}
```

**Ex:1**

```go
func sum(add func(a,b, int) int){
	fmt.println(add(30,20))
}
func main(){
	f := func(a, b int) int {
		return a+b
	}
	sum(f)
}
```

**Ex:2**

In this example we defined simple as return function
```go
func simple() func(a,b int) int{
	f := func(a,b int) int{
		return a+b
	}
	return f
}

func main(){
	s:= simple()
	fmt.println(s(20,30))
}
```

# 2. Anonymous functions

A function without any name is called antonymous function 

**Ex:1**

```go
first := func(){
	fmt.Println("inside the anonymous function")
}
first()
fmt.println("%T", first)
```

**Ex:2**

```go
func(str string){
	fmt.println("inside the anonymous function", str)
}("sk")
```

# 3. User defined function type

in the below example add is the user defined type as function 

```go
type add func(a, b int) int

func main(){
	var a add = func(a , b int) int{
		return a+b
	}
	s :=a(50,5)
	fmt.println("sum", s)
}
```
Adding Hover Effect to Link in WordPress Posts if Your Site is Built with Elementor
Tags: elementor, wordpress, css
Published: 2022-12-03 07:15:33

There are lots of ways to make your website looks more appealing to visitors. One of which is by adding hover effect to links. Some WordPress themes might have a built-in setting to add link hover effect. In case your theme doesn't have one, you can simply add yourself by adding custom CSS to theme customizer.

As you have known, CSS has a built-in option to add hover effect to an element selector, including the `a` selector which is used to target hyperlink. You can simply add the `:hover` to the element selector you want to add the hover effect to. That said, to add hover effect to hyperlink, you can type `a:hover` before the opening curly bracket on your CSS code.

Here is a code snippet for a simple hover effect for hyperlink:

```
a: hover{
	  text-decoration: none;
    box-shadow: inset 0 -.5em 0     #FD63FD;
    color: #B017B0;
}
```

## Adding Link Hover Effect in WordPress

As mentioned earlier, if your theme has no built-in setting to add link hover effect, you can add one yourself by adding custom CSS to theme customizer. Theme customizer itself can be accessed by going to **Appearance -> Customizer** on your WordPress dashboard. On theme customizer panel, you can open the **Additional CSS** block and add your CSS code here.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/amdtxoklse2jciinl8on.png)

If you paste the above code snippet to the **Additional CSS** block without modifying it, the hover effect will be applied to all hyperlinks on your website.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qi2t9cty33eag9bj6tm8.gif)

If you want the hover effect to be applied to blog posts only, you can add the class selector of `.single` before the `a` element selector. So, your code would look like this one:

```
.single a: hover{
	  text-decoration: none;
    box-shadow: inset 0 -.5em 0     #FD63FD;
    color: #B017B0;
}
```

## Adding Link Hover Effect in WordPress If Your Website is Built Elementor

Elementor has a theme builder feature to create custom templates for your site parts, including the blog post template. If you use this feature for your blog posts, you need to replace the class selector on the above code. You can replace the `.single` class selector with the `.elementor-widget-theme-post-content` class selector.

`.elementor-widget-theme-post-content` is a pre-defined class selector from Elementor for the Post Content widget. Post Content itself is an Elementor widget to style up the body of your content (e.g. blog post). So, your code would look like:

```
.elementor-widget-theme-post-content a:hover{
	  text-decoration: none;
    box-shadow: inset 0 -.5em 0     #FD63FD;
    color: #B017B0;
}
```
If you want to apply the hover effect to other custom Elementor templates (e.g. archive page templates) on your website, you can simply replace the class selector with the selector of the widgets you use on your templates.
451. Leetcode solution in cpp
Tags: cpp
Published: 2022-12-03 06:40:54

```cpp
class Solution {
 public:
  string frequencySort(string s) {
    const int n = s.length();
    string ans;
    vector<int> count(128);
    // bucket[i] := stores chars that appear i times in s
    vector<vector<char>> bucket(n + 1);

    for (const char c : s)
      ++count[c];

    for (int i = 0; i < 128; ++i) {
      const int freq = count[i];
      if (freq > 0)
        bucket[freq].push_back((char)i);
    }

    for (int freq = n; freq > 0; --freq)
      for (const char c : bucket[freq])
        ans += string(freq, c);

    return ans;
  }
};
```
#leetcode
#challenge
here is the link for the problem:
https://leetcode.com/problems/sort-characters-by-frequency/
Write response from a rust function to a file
Tags: rust, programming
Published: 2022-12-03 06:22:38

If you want to save the response from a function for later, you can use the `std::fs::write` function to write the response to a file on your local file system.

For example, suppose you have a Rust function named `my_function` that returns a String containing the response you want to save. You can use the following code to write the response to a file named `response.txt`:

```
use std::fs;

fn my_function() -> String {
    // function body goes here
}

fn main() {
    let response = my_function();

    fs::write("response.txt", response).expect("Failed to write response to file");
}

```

This will create a new file named `response.txt` in the current directory, and write the response from the `my_function` function to the file. If the file already exists, it will be overwritten with the new response.

You can then use the `std::fs::read_to_string` function to read the saved response from the file at a later time:

```
use std::fs;

fn main() {
    let response = fs::read_to_string("response.txt").expect("Failed to read response from file");

    // use the response here
}

```

I hope this helps! Let me know if you have any other questions.
Hindi Jokes API MongoDB Atlas Hackathon 2022 on DEV
Tags: atlashackathon22, mongodb, node, api
Published: 2022-12-03 06:03:35

## What I built
I created a REST API using node Js , express and MongoDB. It uses the Hindi Jokes API to fetch random jokes in Hindi language. The app is deployed on Render.
 
### App Link
[https://hindi-jokes-api.onrender.com](https://hindi-jokes-api.onrender.com)


### Screenshots

![ScreenShot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/au0e3m0ze2ytawz7x1mb.png)


![API Request](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/814o1izwd4bhn95zkpwu.png)

 

## <u>Custom Endpoints</u>

### Random joke
Endpoint: [/jokes](https://hindi-jokes-api.onrender.com/jokes?api_key=YourApiKey)

Example: [https://hindi-jokes-api.onrender.com/jokes?api_key=YourApiKey](https://hindi-jokes-api.onrender.com/jokes?api_key=YourApiKey)

Response:

```jsonc
{
    "_id": "631c381d798f9e2887b4cba1",
    "status": "Success",
    "jokeContent": "आओ 2 Min मौन रखे उन लड़कियों के लिए.. जिनकी शक्ल Nokia 1100 जैसी है और घमंड Iphone14 जैसा…. 😆🤣😋😉",
    "jokeNo": 116,
    "created_by": "Amit Sharma"
}
```
### Specify count (MAX 50)

In order to get multiple jokes in a single request specify the count with the following endpoint.

Endpoint: [/jokes/{count}](https://hindi-jokes-api.onrender.com/jokes/2?api_key=YourApiKey)

Example: [https://hindi-jokes-api.onrender.com/jokes/2?api_key=YourApiKey](https://hindi-jokes-api.onrender.com/jokes/2?api_key=YourApiKey)

Response:

```jsonc
{
"status": "Success",
"created_by": "Amit Sharma",
"totalJokes": "2",
"data": [
   {
      "_id": "63199fb5f02231a5ee2965a5",
      "jokeContent": "शादी के दो दिन बाद दूल्हा उस ब्यूटी पार्लर में गया जहां से उसकी बीवी ने शादी के लिए मेकअप करवाया था उसने पार्लर वाली मैडम को आईफोन 7 गिफ्ट किया और थैंक्यू बोलकर चला                         आया मैडम ने खुशी खुशी आईफोन का डब्बा खोला तो उसमें नोकिया 1100 पड़ा था साथ में एक पर्ची भी थी जिस पर लिखा था मुझे भी ऐसा ही महसूस हुआ था😆🤣😋😉 ",
       "jokeNo": 71
   },
  {
       "_id": "63217239def3f928de48b025",
       "jokeContent": "थप्पड मारने पर नाराज वाईफ से हसबंड बोला:  ...आदमी उसी को मारता है जिससे वो प्यार करता है.   ..वाईफ ने हसबंड को 2 थप्पड मारे और बोली  ...आप क्या समझते है मै                          आपसे प्यार नही करती ... 😆🤣😋😉",
       "jokeNo": 141
   }
 ]
}
```
 

### Link to Source Code
Check source code on github
[https://github.com/amitSharma7741/Hindi_jokes_api](https://github.com/amitSharma7741/Hindi_jokes_api)

### Permissive License
#### MIT License
[https://github.com/amitSharma7741/Hindi_jokes_api/blob/add-license-1/LICENSE.md](https://github.com/amitSharma7741/Hindi_jokes_api/blob/add-license-1/LICENSE.md)
Amazon DevOps Engineer Interview Questions and Answers
Tags: amazon, amazondevops, interview, interviewquestions
Published: 2022-12-03 05:58:29

Practice Interview questions are designed to test your skills in [Amazon DevOps Engineer Interviews](https://www.onlineinterviewquestions.com/amazon-devops-engineer-interview-questions/). They help you prepare for the real interview where they will be asked by hiring managers and technical directors.
1)  What is iNode on Linux and more details on that?
2) How do you check physical memory on Linux?
3) How do you copy a local file to HDFS?
4) What steps happen when a copy of the local file to HDFS run?
5) Explain the steps/channels When the user accesses a URL via a browser?
6) What is distributed cache in Hadoop?
7) How do you measure network packet?
8) If there are no cookies how do you make your application work?
9) How did you make your application work without cookies?
10) How do you make your database work for a high number of requests at peak hours?
11) How do you make a background process run?
12) How do you optimize database?
Send a HashMap as parameters to a rust smart contract
Tags: rust, near, web3, webdev
Published: 2022-12-03 05:57:20

To send a HashMap as a parameter to a Rust function from the `near-cli`, you can use the `--arg` flag to specify the key-value pairs of the map as command-line arguments. The `--arg` flag takes two arguments: the key and the value, separated by a `=` sign.

For example, suppose you have a Rust function named `my_function` that takes a `HashMap<String, String>` as an argument. You could call this function from the `near-cli` using the following command:

```
near call <contract_name> my_function --arg key1=value1 --arg key2=value2

```

This would pass a HashMap with two entries to the `my_function` function, where the keys are "key1" and "key2", and the corresponding values are "value1" and "value2", respectively.

Inside the my_function function, you can access the HashMap argument using the `std::env::args` method, which returns an iterator over the command-line arguments passed to the function. You can then use the `Iterator::filter` method to filter the arguments for those with the `--arg` flag, and the `Iterator::map` method to map each argument to a tuple containing the key and value. Finally, you can use the `Iterator::collect` method to collect the tuples into a HashMap:

```
use std::collections::HashMap;
use std::env;

fn my_function(map: HashMap<String, String>) {
    // function body goes here
}

#[near_bindgen]
impl MyContract {
    pub fn call_my_function() {
        let args: Vec<String> = env::args().collect();
        let map: HashMap<String, String> = args
            .iter()
            .filter(|arg| arg.starts_with("--arg"))
            .map(|arg| arg.split("=").collect::<Vec<&str>>())
            .map(|parts| (parts[0].to_string(), parts[1].to_string()))
            .collect();

        my_function(map);
    }
}

```
I hope this helps! Let me know if you have any other questions.
Creating A Virtual Assistant Using Python
Tags: python, programming, beginners, tutorial
Published: 2022-12-03 05:23:19

Are you attempting to obtain a Python project that will familiarize you with particular Python libraries? A project that could undoubtedly help you with that is a virtual assistant.

The Python libraries used in this project can help you improve your Python programming skills. Working on this project is also enjoyable because having a virtual assistant is incredible.[read more](https://oyedeletioluwani.hashnode.dev/creating-a-virtual-assistant-using-python)
Unique Number of Occurrences
Tags: javascript, leetcode
Published: 2022-12-03 05:05:16

[ Unique Number of Occurrences](https://leetcode.com/problems/unique-number-of-occurrences/)
```js
/**
 * @param {number[]} arr
 * @return {boolean}
 */
var uniqueOccurrences = function(arr) {
     const hashmap = {};
    
    for (let i = 0; i < arr.length; i++) {
        const item = arr[i];
        if (hashmap[item]) {
            hashmap[item] = hashmap[item] + 1;
        } else {
            hashmap[item] = 1;
        }
    }
    
    const values = Object.values(hashmap);
    const set = new Set(values);
    return set.size === values.length;
};

```
Element Appearing More Than 25% In Sorted Array
Tags: javascript, leetcode
Published: 2022-12-03 04:57:08

[Element Appearing More Than 25% In Sorted Array](https://leetcode.com/problems/element-appearing-more-than-25-in-sorted-array/)

```js

/**
 * @param {number[]} arr
 * @return {number}
 */
var findSpecialInteger = function (arr) {
  let numMap = new Map();

  for (let i = 0; i < arr.length; i++) {
    if (numMap.get(arr[i])) {
      numMap.set(arr[i], numMap.get(arr[i]) + 1);
    } else {
      numMap.set(arr[i], 1);
    }
  }

  for (let [num, count] of numMap) {
    if (count / arr.length > 0.25) {
      return num;
    }
  }
};

console.log(findSpecialInteger([1, 2, 2, 6, 6, 6, 6, 7, 10]));


```