teleren/devto huggingface dataset:
How to create a boolean arrow function in Java 🏹
Tags: java, programming, development, algorithms
Published: 2021-08-13 00:13:36

---
title: How to create a boolean arrow function in Java 🏹
published: true
date: 2021-07-29 23:15:00 UTC
tags: java, programming, development, algorithms
canonical_url: https://www.benjaminrancourt.ca/how-to-create-a-boolean-arrow-function-in-java
cover_image: https://www.benjaminrancourt.ca/images/how-to-create-a-boolean-arrow-function-in-java.jpg
---
Since I am more experienced with JavaScript than Java, I often search on the Web to find out `how to do X in Java` when working on Java projects. I guess this is common among people who are able to code in a lot of languages. 😛

Recently, I was just looking to create an **arrow function** , to add more readability to my Java code. In JavaScript, it's pretty simple:

```javascript
const isUdeSCategory = (category) => category.displayName === "UdeS";

```

But, as always, in Java, you have to know the right class to do the same... In this case, after discovering the `Predicate` class, I was able to quicly adapt my code as I wanted:

```java
final Predicate<OutlookCategory> isUdeSCategory = category -> category?.displayName == "UdeS";

// To keep things simple, I used the equal comparison, but in reality, the function looks like as
// final Predicate<OutlookCategory> predicate = category -> Objects.equals(category.displayName, "UdeS");
// to be null-safe.

```

If you want to know more about the `Predicate` interface, JournalDev has a quick article on it named [Java Predicate](https://www.journaldev.com/17072/java-predicate).

I'm pretty sure there are other interfaces for other types of arrow functions in Java, but I guess I'll learn them when I need to! 😉
Check if go package installed + "uninstall go package"
Tags: go
Published: 2021-07-29 23:06:41

In a directory where there is a go.mod file, you can discover the install path:

```
$ go list -f '{{.Target}}'
```

I don't come up with this, just found it at https://golang.org/doc/tutorial/compile-install .

One liner:

```
$ go list -f '{{.Target}}' | if xargs ls -la &> /dev/null ; then echo "Installed"; else echo "Not installed"; fi
// Outputs "Installed" or "Not installed"
```

Remove it:

```
$ go clean -i
```
Function Currying - JavaScript
Published: 2021-07-29 22:45:45

Currying is a technique of writing function having multiple arguments, into sequence of functions with single argument. Thus it keep returning the function until all the fucntions are exhausted, arguments are remembered via Closure.

> Don't know about Closure, then ignore it ;)

Let go through this simple example:
```javascript

// without arguments
let dish = function () {
  return function () {
    console.log("Chicken Curry ;) ");
  };
};

dish()();
// console
// Chicken Curry ;


// with arguments
let dish = function () {
  return function (y) {
    console.log(y);
  };
};

dish()("I had crush on JS");
// console
// I had crush on JS

let multiply = function (x) {
  return function (y) {
    console.log(x*y);
  };
};

dish(2)(3);
// console
// 6
```

Now a complex example

```javascript
let employee = 
  name =>
    role =>
      company =>
        name + " is  a " +
        role + " in " +
        company

let output = employee('Jack')('Frontend Engineer')('Google')
console.log(output)
// console
// Jack is  a Frontend Engineer in Google

// we can also write it as 
let person = employee('Jack')
let designation = person('Frontend Engineer')
console.log(designation('Google'))
// console
// Jack is  a Frontend Engineer in Google
```
## Benefits
1. It will make out function look sleek when it has multiple arguments
2. I avoids the frequent calling of a function with the same argument, Let's see how
 
We have a function to calculate the volume of a cylinder
It happens that all the cylinders in your house are of height 100m.
```javascript
function volume(l, w, h) {
    return l * w * h;
}

volume(200,30,100); // 600,000l
volume(32,45,100); //144000l
volume(2322,232,100); // 53870400l
```
We are repeatedly using the same height in all 3 invocations.
Let's solve this using currying

```javascript
function volume(h) {
    return (w) => {
        return (l) => {
            return l * w * h
        }
    }
}

const hCylinderHeight = volume(100);

hCylinderHeight(200)(30); // 600,000l
hCylinderHeight(32)(45);   //144000l
hCylinderHeight(2322)(232); // 53,870,400l
```
Day 419 : Stormy Weather
Tags: hiphop, code, coding, lifelongdev
Published: 2021-07-29 21:51:23

_liner notes_:
- Professional : Had a bunch of meetings today. Basically spent my day doing that. I demoed an application I made to the team. I got so tired from the meetings, I didn't even really work. Plus it's stormy weather outside and that didn't help. haha Need to really finish the week out strong tomorrow. I don't have any meetings scheduled.

- Personal : Uploaded some videos to the backup site. Added some more functionality to the dashboard. Now I can get the ids after sending a link of the archived video to the API and then use the ids to get the video details generated. Also, got updating the data to the backend working. Started working on getting the video uploaded to Vimeo from the dashboard. Went through some tracks for the radio show. Watched "Fire Force" and went to bed.

![Overhead view of the coast off Langkawi, Malaysia with a forest at the top and goes to large rocks that go into the turquoise colored ocean](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fzs41dkr4ydk9ievyjha.jpg)

I want to finish up being able to upload to Vimeo from the dashboard and get generating a thumbnail working. There's another functionality I was thinking about implementing. Generating highlight video from some clips.  I was thinking if the video wasn't automatically created after the live broadcast was complete, I would be able to do it from the dashboard, but thinking about it, right now I'm the only one making the highlight videos and it's only really useful for when I post to Twitter and Instagram right after. I may put it on the back burner until I see a greater need for it. I'm pretty excited to see if the video details will be automatically generated and show up on the videos detail page. We'll see on Sunday. For the rest of the night, I want to watch "Fire Force" while eating dinner and then go through tracks for the radio show.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube 2CV7wtLvi7w %}
What are your biggest performance engineering hacks? Answer to be featured on our podcast 🎧
Tags: podcast, discuss, performance
Published: 2021-07-29 21:48:59

---
title: What are your biggest performance engineering hacks? Answer to be featured on our podcast 🎧  
published: true
description: 
tags: podcast, discuss, performance
---

The [DevDiscuss Podcast](dev.to/devdiscuss) begins with an interview and ends with commentary from listeners — and we like to feature the _actual_ voices from our community!

To inform an upcoming episode of the show, we'd like to know...

> ### **What are your biggest performance engineering hacks?**

For your chance to hear your actual comments on an upcoming episode, answer the question above by:

- Calling our Google Voice at +1 (929)500-1513 and leave a message 📞

- Sending a voice memo to pod@dev.to 🎙

- OR, leaving a comment here (we'll read your response aloud for you) 🗣

Please send in your recordings by Wednesday, August 4th at 1 PM, ET (5 PM UTC, 10 AM PT)

#### Voice recordings will be given priority placement 😉

Catch up on recent episodes of the show [here](https://dev.to/devdiscuss). The new season premieres soon 👀
Got Bots? 4: Making Bots with the Azure Portal
Tags: beginners, codenewbie, webdev, showdev
Published: 2021-07-29 21:42:49

---
title: Got Bots? 4: Making Bots with the Azure Portal
published: true
description: In part 4 of this series, we continue work on our Clippy Azure QnA maker bot, live!
tags: beginners, codenewbie, webdev, showdev
series: "Got Bots?"
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wmwjymjqoux7duk2w0k2.jpeg
---

Thanks to everyone who joined me live for my 4th episode of [Got Bots?](https://dev.to/azure/got-bots-a-weekly-bots-series-with-the-microsoft-reactor-2b2h) with the Microsoft Reactor last week. It was such a joy to have y'all give your bot suggestions for our Clippy bot, and taking your questions on bots!

If you missed the fun live, don't worry- you can watch the replay [here](https://youtu.be/2oAsXTS92LM), and in the embedded video below! 🤖⤵️

{% youtube 2oAsXTS92LM %}

_Pssst! 🙋‍♀️ If you've missed any previous episode, check out my **Got Bots?** [series summary dev.to post](https://dev.to/azure/got-bots-a-weekly-bots-series-with-the-microsoft-reactor-2b2h) to get caught up!_

**On this episode we cover:**

-  [3:55](https://youtu.be/2oAsXTS92LM?t=235) Previously on... _Got Bots?_ (a short recap)

-  [9:40](https://youtu.be/2oAsXTS92LM?t=580) A review of [QnA Maker](https://docs.microsoft.com/en-us/learn/modules/build-qna-solution-qna-maker/?WT.mc_id=academic-33454-chcondon)

-  [10:46](https://youtu.be/2oAsXTS92LM?t=646) [Daniel](https://twitter.com/learnwdaniel) joins the stream for a brief cameo!

-  [20:40](https://youtu.be/2oAsXTS92LM?t=1240) We talk about my [Azure Functions Turnip Timer](https://dev.to/azure/building-an-animal-crossing-turnip-timer-video-2dni)!

- [25:13](https://youtu.be/2oAsXTS92LM?t=1513) Testing and training out QnA Maker bot

- [26:19](https://youtu.be/2oAsXTS92LM?t=1579) Selecting [chit-chat](https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/how-to/chit-chat-knowledge-base/?WT.mc_id=academic-33454-chcondon) for your bot

- [46:39](https://youtu.be/2oAsXTS92LM?t=2799) Follow-up prompts with [QnA Maker](https://docs.microsoft.com/en-us/learn/modules/build-qna-solution-qna-maker/?WT.mc_id=academic-33454-chcondon)!

_Did you have fun? Thanks for joining me this month for [Got Bots](aka.ms/gotbotslinks)! Join me next month for Beep Boop: an AI/ML series (more details coming soon!)_
Flatiron School Graduate: Reflections and Future Goals
Tags: codenewbie, firstyearincode
Published: 2021-07-29 20:53:43


As I reach the end of the Flatiron School coding bootcamp, I would like to share my thoughts and plans for the future.

#Tech learned 

Flatiron school gave me the tools I needed to learn how to code. I learned Ruby first which I think is easier to learn than javaScript. Next I learned SQL and learned how to manipulate the database with activeRecord and Ruby on Rails. I completed classes to learn the backend, and then Javascript to display information and interact with users in the frontend. I also learned React and Redux for the state management.


#Future plans

For now until I find a job, I will work on my own projects. I hope to start making websites for small businesses. I know many construction businesses and they all want their own website. Now I can provide that service to them. I want to get better especially in the backend because I really like it. I want to get better in authenticating and protecting the user information. I want to improve my skills with Ruby and I want to learn another backend programming language. I already know how to work with an object-oriented language and I think will be easier for me to learn another language.

#Final thoughts

This is the start of a new career. I'm glad I learned how to code because I like coding. I've done a lot of different type of jobs for a living. Most of the them I do because I have to pay bills. I'm currently working in the electrical field. I like to fix things and I like to know how things work. Everything has a logic and once you understand it, you'll never forget. Coding is the same way. You have to solve problems and that is not boring for me. The time go so fast when I'm coding and sometimes when I can't figure out something, I fall asleep thinking about it. I drive thinking about it, I walk thinking about it until I figure it out. I will keep pushing myself to get better at this because I don't want to be an average programmer I want to be one of the best.
How to get current user location, city, country in laravel
Tags: laravel, geolocation, programming, php
Published: 2021-07-29 19:26:59

In this tutorial, we will see how you can get the current user location, city, country, country code, postal code, zip code, region, longitude and latitude using IP Address in laravel.

So we will be using stevebauman/location package in order to get that information.

So let’s get started.

# Step 1: Install Laravel

First, we will install laravel into the project. I am installing it in user_location folder.

```
composer create-project --prefer-dist laravel/laravel user_location
```

#Step 2: Install stevebauman/location package
Then we need to install the stevebauman/location package.
```
composer require stevebauman/location
```

#Step 3: Add the Service Provider and Alias
Then we need to add the service provider in config/app.php in providers array:
```
Stevebauman\Location\LocationServiceProvider::class,
```

And also add following alias in aliases in config/app.php:

```
'Location' => Stevebauman\Location\Facades\Location,
```
So your final providers array will look like this:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0vadhopzw0riuyv3n7qc.png)

And aliases array will look like this:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9sjktzzhgus3edtaobp9.png)

[Read Complete Blog Post Here](https://impulsivecode.com/get-current-user-location-city-country-in-laravel/)
You Don't Know JS -p1
Tags: javascript, transpiler, babel, polyfill
Published: 2021-07-29 19:19:51

## The book series "You don't know JS" is listed in the following six parts :

1. Up and going 

2. Scope and Closures

3. This & Object Prototypes

4. Types & Grammar

5. Async & Performance

6. ES6 & Beyond

### Up and going 

To get one started and pretty much __Up__, the first book deals with just the basics of the language. 

The variables, scope, module model, closures, strict mode, etc. are listed and explained in brief. Most of these topics will be covered in-depth in the upcoming books of this series.

Throwing lights on the topics I found to be the most interesting.

#### Polyfilling :

Let me quote the definition from MDN : 

> A polyfill is a piece of code used to provide modern functionality on older browsers that do not natively support it

An interesting example listed in chapter 2 is :

```
if (!Number.isNaN) {
    Number.isNaN = function isNaN(x) {
        return x !== x;
    };
}
```
##### Understand what is happening ->

We are all aware of the fact that with ES6 came some life-saving features such as _async/await, arrow functions, literals, destructuring_... the list goes on.

Let's see what the ECMAScript Language Specification has to say about isNan() :
> It Returns true if the argument coerces to NaN, and otherwise returns false.

The same is shown in the example above. Here, the function isNan() is already available in the ES6 browsers hence, the _if_ _statement_ is guarding against applying polyfill in such browser engines and defining it for only those browsers that do not support ES6 yet.

######Intersting Fact:

>NaN is the only value in the whole language that is not equal to itself and thus would make x !== x be true.


#### Transpiling

_Transforming_ + _Compiling_

Let us quote Kyle Sampson to understand Transpiling better.

>There’s no way to polyfill new syntax that has been added to the language. The new syntax would throw an error in the old JS engine as unrecognized/invalid.

Okay, what to do now? How to tell the old browsers about the newer form of code that we are so much in love with, maybe because of the performance upgrade offered or how easy it is to use and understand it.

_Worry not !! Transpilers to the rescue_

Transpiler converts our source code authored in the new syntax form to its older code equivalent. As other tools (linters and hooks) are embedded into the build process using the scripts in our 'package.json' file. Transpiler requires no extra effort ( apart from configuring package.json, Of course !! ) and our code is automatically transformed to the older syntax and compiler to be used by the older engines. 

Commonly used Transpilar -> _Babel _

Thanks for reading.
CIAO !! 👋
Full Stack Netflix App (7 hours free tutorial)
Tags: react, javascript, webdev, node
Published: 2021-07-29 18:55:43

Hi, I'm Safak. I am a full-stack web developer and I'm sharing open source web projects on my YouTube channel. After [Full Stack Social Media App](https://dev.to/safak/social-media-app-using-mern-stack-4ic6) project, I decided to share my 7 hours "MERN Stack Netflix Clone with an Admin Panel" tutorial. 

For this project I used Express API, MongoDB, React functional components, hooks with context API. I hope you will enjoy.

## Design Part of the Netflix App

In this section, we are going to design Netflix clone using React.js and Sass.

{% youtube FzWG8jiw4XM %}

## MERN Stack Part

In this section, we are going to create an Express server with the MongoDB connection. And we are going to make API requests on the client side using axios, hooks and context API.

{% youtube tsNswx0nRKM %}

I hope it was useful. If you want to learn more about web development and practice with real-world projects, you can check my channel out.

📹 [Full Stack Youtube Clone (5 Hours free tutorial)](https://dev.to/safak/full-stack-youtube-clone-5-hours-free-tutorial-2kfg)
🛍️ [Full Stack E-Commerce App (+8 Hours free tutorial)](https://dev.to/safak/full-stack-e-commerce-app-8-hours-free-tutorial-10pb)
🧑‍🤝‍🧑 [Full Stack Social Media App (+7 Hours free tutorial)](https://dev.to/safak/social-media-app-using-mern-stack-4ic6)

🔥 [Lama Dev YouTube Channel](https://www.youtube.com/c/lamadev)
⚡️ [Lama Dev Facebook](https://www.facebook.com/groups/lamadev)
👾 [Source Code](https://github.com/safak/youtube/tree/mern-netflix-app)
ts-faker - Generating fake data using TypeScript interfaces
Tags: showdev, github, nextjs, typescript
Published: 2021-07-29 18:51:21

I recently built a Next.js website that generates fake data. Regularly, I perform routine tasks like this. Rather than manually go through the process, I decided to automate it. You just need to define your schema as TypeScript interfaces, and the test data will be generated automatically. I thought it would be a good idea to share the source code with you so that you can learn something from it. I hope you enjoy it.

source: https://github.com/SirwanAfifi/ts-faker
website: https://ts-faker.vercel.app/
Having the rick power!!! Pt.2
Tags: javascript, webdev, react
Published: 2021-07-29 18:33:47

HUHUHUHU let's continueeeeeee :)


What are we going to do today? Don't know, but something like this:

## Table of Contents
1. [Making home](#making-home)
    1. [Design](#design)
    2. [Components](#components)
    3. [Process](#process)

## Making home <a name="making-home"></a>
So... this is what we have from yesterday...

![Photo from yesterday](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hmeixkcq8r94hrqnxnwm.png)

Is it a shit???
<img width="100%" style="width:100%" src="https://media.giphy.com/media/Lbp2zfSdpo2viXMtt3/giphy.gif" />

Now is time to change it :D

### » Desing <a name="design"></a>
Well... I am going to show you how I want it to be, or at least, what I see in my mind... I know there are a lot of programs where I can design the web like _figma_, but I like more paint!!! I am waiting for **GIMP** to install, so that I can draw it.

![Home page image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4pubrp324u2898yu35z8.png)

Something like this... (?) Maybe (?) Don't know, we will see how everything goes.

what, we can see that we have 3 components:
  1. Welcome (heading)
  2. Search bar
  3. Cards place

Everything is going inside `App.jsx`, so that we live `index.js` cleaner.

### » Components <a name="components"></a>
Now we know how many and which components we have. The next step is to place the components the right way. As we see, we want the **Search bar** at the top, so it is going to be the first element, then the **heading** and the last one the Cards place which we will create a new component, called **CardContainer** (Is it a good name?).

### » Process <a name="process"></a>
I've finished for today, so I'll explain how it has been...

A lot of fight with CSS, nothing from another world, but I like it how it is, well not everything, because the colors doesn't match too much, but I am not too worried about it, because it can be changed later.

The web is fully responsive.

The worst thing was styling the **CardContainer** because it was a lot of work, first I thought about `flex` and **rows** and **cols** but I didn't like it, because it was not what I wanted, so I dig in my head, and found a solution, a `grid`!!!! and there it is, a perfect grid (or I think so).

And... nothing more... I was like 1h+ with the f* `CardContainer` styling it.


So here you have your screenshot
![Home page image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/en7e2wo552avxlj6aeq7.png)

So... tell me!!! How do you see it??

--- Repeating...
I know the colors match are a shit, but we will see, if we change it or not 😁
--- Shutting down...

PD: See you tomorrow... I guess

OOOOHHHH waittttt......... I have to push it to [GitHub](https://github.com/blitty-codes/rick-power.git) 😵 I just want to go to the sofa :(

Done.
See you!

---

## Follow me!
(I liked more the red bird :_()
🐦 [Twitter](https://twitter.com/blit12_)
🐙 [GitHub](https://github.com/blitty-codes)
👥 [LinkdIn](https://www.linkedin.com/in/blitty/)

---
7 CSS Tricks you should know!
Published: 2021-07-29 18:25:42

As I am learning Development, I would like to share this **7 *CSS* tricks that you should know for better results.**

If you know this before hit heart below!

So let's begin...
#1. Disable a link#
![Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ql5cpnisgsmoq1riyg25.jpg)

~You can disable any link using css and no action will take place while you click on the link.

#2. Disable Text Selection#

![Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bqdnhztg5ev2opr4z68o.jpg)

~The property user-select says whether the use can select the element or not.

#3. Resize images to fit#


![Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b6q82jigsytp6h2c3pwd.jpg)

~when you get in a pinch where images need to fit a certain width, while scaling proportionally. An easy way to do this is to use max width to handle this.

#4. Custom caret color#

![Images](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sk5q1efgwzkjh3hp0wex.jpg)

~The caret-color property sets the color of the insertion carpet, the visible marker where the next character types will be inserted.

#5. Disable Text Area resize#

![Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yjp9xu1444frcqkbfii8.jpg)

~Resize property will resize the textarea, inorder to disable textarea you should give none value.

#6. Making image fit#

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ructscyg34tb5w2q92s6.jpg)

~This object-fit property sets how the content of a replaced element, such as an img or video, should be resized to fit its container.
 
#7. Placeholder's color#

![Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/atp7ffu0mxd313hnhxdq.jpg)

~The ::placeholder selector selects fork elements with placeholder text. This will let you style the placeholder text.

Thanks for reading.
Do read my previous posts you will love it.
RDoc questions
Tags: ruby, rdoc, documentation, questions
Published: 2021-07-29 18:21:16

---
title: RDoc questions
published: true
description: 
tags: ruby, rdoc, documentation, questions
---

I have an open (draft) documentation PR for RDoc over at GitHub (https://github.com/ruby/rdoc/pull/824) that has six unanswered questions. These are embedded in the committed text itself, and each is labelled as "Reviewers: ...."

If you know an answer, please add it as a comment.