teleren/devto huggingface dataset:
Custom JDK Versions Per Project With SDKMAN!
Tags: java, jdk, sdkman
Published: 2021-07-13 20:57:24

[SDKMAN!](https://sdkman.io) allows us to easily install and use different JDKs.  It can become frustrating to have to change JDK versions manually for different projects.  Fortunately, SDKMAN! has a solution to this in the form of the `sdk env` command.  This command allows us to define a different JDK per project which can be easily switched to, without having to remember the JDK version.  Additionally, it can be configured to automatically change to the required JDK when changing directories.

For more information about installing and using SDKMAN!, check out my article - [Managing JDK Versions With SDKMAN!](https://dave-s.medium.com/managing-jdk-versions-with-sdkman-bb20618c854e)

## Updating SDKMAN!

Before we can start using the `sdk env` command, we must first ensure we are using the latest version of SDKMAN!  The software can be updated by using the `sdk selfupdate` command

``` sh
% sdk selfupdate
No update available at this time.
```

## Specifying a JDK Version For A Project

SDKMAN! uses a hidden file called `.sdkmanrc` which contains a parameter specifying which JDK version to use for a project.  To configure and use this file is a simple 3 step process.

1 **Create the `.sdkmanrc` file**.  This can easily be created by navigating to the required directory and executing `sdk env init`

``` bash
% sdk env init
.sdkmanrc created.
```

2 **Configure the version**. Once we've created the file, edit it and add a line `java=x.x.x.x` specifying the version of Java to use.  For example to use Adopt Open JDK version 11, the file would look like:

``` bash
% cat .sdkman
java=11.0.2.hs-adpt
```

3 **Initialize the environment**.  After editing the `.sdkmanrc` fille, we can configure the environment by executing the `sdk env` command.

``` bash
% sdk env

Using java version 11.0.2-open in this shell.
%
% java -version
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode
```

## Specifying a JDK Automatically

Finally, we can get SDKMAN! to automatically change JDK to the version defined within `.sdkmanrc` by changing configuration.  To do this, edit the `~/.sdkman/etc/config` file and add/edit the property `sdkman_auto_env=true`.  This will probably already exist and be set to `false`, so make sure you edit this setting if it is there rather than duplicating it.

Now, whenever you change into a directory containing a `.sdkmanrc` file in it, the JDK will automatically be changed to your desired version.  Fantastic !

``` bash
% cd project1 

Using java version 11.0.2-open in this shell.
%
% cd project2

Using java version 14.0.1-open in this shell.
```

## Credits
Photo by [Octavian Dan](https://unsplash.com/@octadan?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com/?utm_source=medium&utm_medium=referral)
What s useState? 
Tags: react
Published: 2021-07-13 21:12:10

well is a hook. Which in other words, is a function, which is imported from react 

```
import { useState } from 'react' 
```

but which is your function?

Help us to controller a state, recive a first param which is the initial state

```
useState(initialState)
```

But what a the initial state?
It is the value which initiates our state 

For example:
```
 A object useState({}) or Array useState([]) 
 A string useState('whil')
 A number useState(5)
 A Boolean useState(true) 
```
every time our functional  component Renders. Begins  with the initial state 

But what a return?
Returns us two values. Which is a current  state and a function for update

```
const [state, setState] = useState(false)
```

But which is our current state?

Well is our initial state which is your current state. Why?
Remember that Provide a initial state. That initial state is our current state during the first rendering

How update our current state?

Remember that useState return a function which we can update the current state

```
setState
```
the shape for update our current value is like that.
```
const handleState = () =>{
  setState(true)
} 
Or
JSX. 
Return(
   <button onClick={() =>setState(true)} > Click Me </button>
) 
```

because is not called createState?

Because it wouldn't be right. Because the state Only Be create one-time when our functional component Be render for first time 

setState is not function async. Just calling to enqueueState or enqueueCallback when update and your execution  feels how If it were async
All PHP Releases
Published: 2021-07-14 11:17:50

Some time ago, i'm writed an article about laragon.

https://dev.to/alexandrefreire/laragon-the-dev-environment-for-web-artisans-40em

With laragon you can have many php versions, other softwares relateds too have this. What i want to show is this page with all releases of php, for you choose easily, sometimes we work with older php projects, and if you not work with docker its is a solution.

https://windows.php.net/downloads/releases/archives/
Targeted Ads: A rare, good experience
Published: 2021-07-24 13:57:08

![Background](https://images.unsplash.com/photo-1596526131083-e8c633c948d2?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=967&q=80)
On this week's episode of tech is just an enabler.
I want to share something I have come across this week that I find interesting.

So you know how banks, - I live in Nigeria - So I can say something about how banks around here send you targeted emails for salary advance almost everytime - Access Bank does this to me a lot.

Anyways, there is this platform I use [https://app.letsdeel.com](Deel) to receive payments. They handle everything for managing contracts. From drawing up contracts, signing it, generating invoices, remittances to any destination account in the entire universe, they even support payments in crypto. You should check them out if you are looking for something really nice to manage your contractors or you need somewhere to get your funds moved across to your local bank accounts.

Let me get right on before I head down the path where I keep sounding like this is a promo article for Deel.

I was supposed to receive payment for last month's invoice some few days ago but I got word from the company I work with that the payment was going to come in a bit later than expected. Ideally, the payment should have been made to Deel already by the company that way, it enables Deel to make remittance to my account the exact day and date I have on the contract.
But since this month's didn't arrive already and they couldn't credit me, I got an email subtly letting me know that while I was waiting for the payment, I could apply for an advance if I needed it.

![Deel Email](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rocpy0gtxsbpbrxh7992.jpg)

I wasn't surprised when the email came in, but I was really impressed and was all smiles, laying on my bed reading it when it came in. The timing was perfect because when I was expecting to get an email that I received a payment, I got one instead telling me about an advance payment option they had. 

For me, it just reminds me of the following:
1. Building a product is the happy and simple part. Marketing it is another ball game entirely.
2. Just like people we meet everyday, we remember products for the tastes they leave in our mouths.
3. Data is powerful and could be used to great effects.

Another side to this is having to deal with data privacy and it just makes me wonder the good and amazing things companies could do with the user data they have access to. I have seen videos on the internet and responses to polls that suggest that people really don't mind targeted Ads/emails suggesting to them, stuffs to buy based on their needs or spending/shopping patterns. But for companies to be able to serve useful stuffs, they need to keep collecting data about their users and basically trusting them to do the right thing with the data.
Out of this World: Virgin Galactic Makes a Giant Leap for Mankind
Published: 2021-07-15 13:24:40

From vinyl records to tech and travel, Richard Branson has pretty much got us covered in every aspect of daily life.

This may not be a custom software development based blog this week, but at [Clever Software Group](https://cleversoftwaregroup.com/services), we like to keep our finger on the pulse when it comes to revolutionary moments in history. What took place last Sunday afternoon was most certainly one of those moments (and no, we are not talking about THAT Euro’s final).

Richard Branson and a crew of talented individuals embarked on Virgin Galactic’s first out of this world adventure. Having already conquered the music, telecommunications and health industries, it only seems natural that the next steps for the founder of one of the world’s most iconic brands, was to explore space travel.

At 3.30pm on Sunday 11th July 2021, Branson and the crew of Unity 22, were launched into the great unknown. The flight was a great success and in the dawn of a new age space race, Branson and the Virgin Galactic team entered the stratosphere 9 days ahead of Amazon founder, Jeff Bezos. Coined the ‘Billionaire Space Race’, Bezos founded Blue Origin in 2000, with Virgin Galactic following suit 4 years later. 2 decades have passed since two of the world’s wealthiest men began their space odyssey mission, with Branson just pipping the post with his flight last week.

The launch not only marked the spaceline’s fourth space flight, but its first fully crewed test flight. Having reach an altitude of 53.3 miles, the flight took place from Spaceport America, located in New Mexico, Texas. Spaceport America is the first purpose-built commercial space port. It seems that Branson is still continuing to add to the already gigantic number of ‘firsts’ he already has under his belt.

With a rich legacy now behind him, Branson originally founded Virgin Records in the 1970s, as a company that sold records via mail order. Having crossed literal oceans and broken many records throughout his outstanding career, the groundbreaking entrepreneur was hungry for his next big challenge. Branson has even described Virgin Galactic as being “the greatest adventure of them all”.

Virgin Galactic is intended to be the world’s first commercial spaceline. Although it may seem like a sci-fi idea to many, the dream is that space travel will become an everyday occurrence for everyday people. Just like popping on a flight from Bristol to Edinburgh, space travel will be accessible for all. Humankind has been venturing into space for just shy of 65 years. What was unimaginable over half a century ago, has become run of the mill in today’s digital society. The general public being able to experience space travel first hand, will be a very poignant aspect of the not-so-distant future. Now, it is more about when it will become a daily occurrence, instead of how and by what means.

Virgin Galactic’s first fully crewed test flight one small step towards a bigger advancement in space travel, but one giant leap towards an exciting new adventure of humankind.
Day 409 : In The Middle
Tags: hiphop, code, coding, lifelongdev
Published: 2021-07-15 22:34:37

_liner notes_:
- Professional : Today was the day! Had my workshop that I've been preparing. Before that, I had a couple of meetings. A little after lunch it was time. I had everything set up. I was using 3 screens, everything was working. Awesome! About half way, everything is going fine, people seem to be interested, then my computer starts to get slower until it finally shuts off in the middle of my presentation. I thought the dongle was charging the laptop while powering the devices I had plugged into it. Apparently not. Had to wait a couple of minutes for it to charge up enough to turn on. Longest couple of minutes of my life. Luckily a co-worker was also there and was able to talk about something else. Got back on and continued where I left off. Still managed to get everything done within the time limit. Needless to say, I was tired and needed to take a nap after. haha.

- Personal : Watched the 'Loki' season finale. It was really good. I kind of knew already how it was ending but didn't know I would like it that much. Looking forward the the new season. Also watched an episode of "Fire Force". That's a good anime series and can't wait to catch up. Haven't heard back from that company that I was using their API to analyze my recorded videos from https://untilit.works to get a summary automatically created.

![Large rock formations sitting in the water in Hallet Cove, Australia at sunset](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ai0rtzyda1ppizkjgstq.jpg)

Just got up from a nap. Going to eat dinner and watch an episode of "Fire Force" and then probably finish putting together the radio show for this week and put together stuff for Sunday. Not sure if I'll do any coding.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube cegTk1FZa1c %}
Learn Coding With Pomodoro Technique
Tags: beginners, watercooler, learn
Published: 2021-07-16 06:15:29

Pomodoro. Have you heard it? The Pomodoro Technique is a time management method developed by Francesco Cirillo in the late 1980s. The technique uses a timer to break down work into intervals, traditionally 25 minutes in length, separated by short breaks. Each interval is known as a pomodoro, from the Italian word for 'tomato', after the tomato-shaped kitchen timer that Cirillo used as a university student.

And, here it's a practice example: 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o4dxkb4n16mu4mfqd0h2.png)

So, based on this technique, i modify a bit to help you learn coding. So let's start. 

## What all you need
- one project concept.
- code editor.
- any timer, you can use analog or digital. 

## The rule
So, here it's the rule. I have classify this technique with 3 steps. First, read. Second, write. Last, read+write. 

Read
At first, we read all documentation that we need. In this step, you are prohibited from doing any coding stuff, you also prohibited to note anything from the documentation that you read. This step duration is 5 minutes. 

Write
After read the documentations, you need to write the code now. In this step, you are prohibited to read any type of documentation. This step duration is 10 minutes. 

Read + Write
Lastly, in this step, you can read documentations and write the code at the same time. You can correct your wrong code, or write the forgotten syntax. This step duration is 10 minutes. After this step, you can take a short break (5-10 minutes).

You can do that 3 steps for some cycles. So here it's the technique conclusion:
- read 5 minutes
- write 10 minutes
- read+write 10 minutes 
- break 5-10 minutes

This technique help me 2x faster to learn a new language. That's all, Thanks for reading!
Best Makefile for Docker project (M1 Compatible)
Tags: docker, devops
Published: 2021-07-16 07:13:07

Hi !

Here is the best Makefile ever,

It's now easy to use Registry Gitlab to push your docker images and use repo name as image name.

```makefile
REGISTRY_ID=$(shell grep gitlab.com .git/config|sed 's/url = https:\/\//registry./g'|sed -e "s/\.git$$//g"|xargs)
TAG=$(shell git symbolic-ref --short -q HEAD|sed -e 's/master$$/latest/g'|sed 's/\([a-zA-Z]*\)\//\1-/g')

build:
	docker build -t $(REGISTRY_ID):$(TAG) .

run: build
	docker run --rm $(REGISTRY_ID):$(TAG) 

dev:
	docker run --rm $(REGISTRY_ID):$(TAG) 

push:
	docker push $(REGISTRY_ID):$(TAG)

pushm1:
	docker buildx build --platform linux/amd64 --push -t $(REGISTRY_ID):$(TAG) .

buildm1:
	docker buildx build --platform linux/amd64 -t $(REGISTRY_ID):$(TAG) .
```

Realy easy to use:

Build images
`make build`

Push images
`make push`

Run images
`make run`

Test images
`make dev``

For Mac M1 Chip, to use for build AMD64 images

Build for amd64 when your use macbook m1
`make buildm1`

Push for amd64
`make pushm1`
Tips for creating a good post
Tags: post, content, tips, article
Published: 2021-07-16 19:25:44

[[Clique aqui para ler em português]](https://medium.com/walternascimentobarroso-pt/dicas-para-criar-um-bom-post-a5c69143f3d)

## TITLE

Write an attention-grabbing headline that will draw an audience to your text.

## IMAGES

Use an image to reflect what your post means.
some sites with free images:
https://stocksnap.io/
https://www.pexels.com/
Website that searches for free images on other websites https://farejadordeimagens.com.br/
Site to change image dimension
https://www.easy-resize.com/
Website to reduce image weight
https://compressor.io/

## TABLES

Whenever possible, adjust your content in tables, so the information is more organized, by comparison tables.

To help assemble the tables, use the website

https://ozh.github.io/ascii-tables/

## CODES

Whenever you need to put in some code that is too extensive, use some of the tools below:
https://carbon.now.sh/
https://codepen.io/
https://gist.github.com/

## TAGS

Always add tags to your post, so it’s easier to find

## EMOJIS

To convey more feelings and expressions in your posts, use 
emojis
http://emojipedia.org/
http://www.iemoji.com/

***

## Thanks for reading!

If you have any questions, complaints or tips, you can leave them here in the comments. I will be happy to answer!

😊😊See you! 😊😊
JS Quiz: Practise Arithmetic Skills
Tags: javascript, beginners, html, css
Published: 2021-07-17 05:39:21

Check out this website I created, where you can practice basic addition, subtraction, multiplication and division. It is made using pure HTML, CSS and JavaScript. Any suggestions for improvement are most welcome.
Check out the main website here:
[Click to visit sankhya: website to practise mental maths](https://swati-gwc.github.io/sankhya)

Below was the first version of the above website.
{% codepen https://codepen.io/swati_gwc/pen/YzNxdGE %}
chemistry tutor
Tags: organicchemistrytutor
Published: 2021-07-17 10:28:55

In addition to one-to-one organic chemistry tutoring, I extend my support to the interested students who are in the need of short and crisp learning material for any organic chemistry topics.
Every year I tutor at least a hundred organic chemistry students from all over the country. Also, I taught organic chemistry topics at the graduate level for other country students who are residing in the USA. Some of the students are from Colorado State University, Georgetown University, Allen University, Augustana University, and few community colleges in the US.
GZIP on the Browser
Tags: javascript, webdev, codepen, snippet
Published: 2021-07-27 15:57:20

---
title: GZIP on the Browser
published: true
date: 2021-07-27 15:50:12 UTC
tags: javascript, webdev, codepen, snippet
canonical_url: https://blog.okikio.dev/gzip-on-the-browser
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pl0dt9jbk20cagxet6e1.png
---

Out of curiosity I created a small demo detailing how you can implement GZIP in the browser, I used [`fflate`](https://npmjs.com/fflate) for the GZIP compression, and [`pretty-bytes`](https://npmjs.com/pretty-bytes) to convert bytes into human readable format, the demo is really small but as an example it should be more than good enough. I based it on [bundlejs.com](https://bundlejs.com). Interestingly, I have yet to find a website that lets you see the GZIP size of some random text, all the ones I have found so far expect you to upload a file, the little demo takes a string as an input compresses it, and gives you the final size.

{% codepen https://codepen.io/okikio/pen/ExmQwPM %}

I suggest checking out [bundlejs.com](https://bundlejs.com) it's a specialized for bundling, minifying and compressing js, all locally, right on your browser.

Check out the [product hunt](https://www.producthunt.com/posts/bundle-6) page for [bundlejs.com](https://bundlejs.com).
The New Leaders of Remote Engineering Event - August 11th
Tags: eventdriven, discuss, inthirtyseconds, remotework
Published: 2021-07-28 13:55:24

Everyone loves free stuff, right?

Even better when that free stuff is both fun and adds value. That’s what Dev Interrupted’s upcoming event - [The New Leaders of Remote Work](https://linearb.io/new-leaders-remote-work-panel/) -  is all about. Helping engineering leaders and developers to get the most out of their remote or hybrid work situtions. 

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

Join us from **9am-10am PST on August 11th** for another great panel discussion with:

* Darren Murph Head of Remote at GitLab & Guinness World Record Holder as the most prolific blogger ever
* Lawrence Mandel Director of Engineering at Shopify & Hockey Enthusiast
* Shweta Saraf Director of Engineering at Equinix & Plato Mentor
* And the Panda himself, Chris Downard VP of Engineering at GigSmart

Dan Lines, COO of LinearB, will be moderating a discussion with our guests on how they lead their teams remotely, how the current workplace is changing, and what's next as the pandemic continues to change.

Want to learn from the new leaders of remote work? Then this livestreamed Dev Interrupted Panel is the event for you.

[Register here](https://linearb.io/new-leaders-remote-work-panel/?__hstc=75672842.ea2a35812d5192739a119c7ab37040a0.1624488310794.1627418140391.1627422268722.36&__hssc=75672842.9.1627422268722&__hsfp=1224415886)

We're excited for the future and very thankful to have you on this journey with us. You can always reach me for feedback (or site bug reports!) via our developer Discord community or on our Twitter.

Thanks for everything -

Conor Bronsdon

Community & Content Lead, Dev Interrupted

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xor9pdk5aulrzdo1dwa4.png)*If you haven't already joined the best developer discord out there, WYD?*

Look, I know we talk about it a lot but we love our developer discord community. With over 1400 members, the Dev Interrupted Discord Community is the best place for Engineering Leaders to engage in daily conversation. No salespeople allowed. [Join the community](https://discord.gg/devinterrupted)
LeetCode 300. Longest Increasing Subsequence
(javascript solution)
Tags: algorithms, javascript
Published: 2021-07-28 01:56:30

###Description:
Given an integer array nums, return the length of the longest strictly increasing subsequence.

A subsequence is a sequence that can be derived from an array by deleting some or no elements without changing the order of the remaining elements. For example, [3,6,2,7] is a subsequence of the array [0,3,1,6,2,2,7].

###Solution:
Time Complexity : O(n^2)
Space Complexity: O(n)

```javascript
// Dynamic programming
var lengthOfLIS = function (nums) {
    // Create dp array
    const dp = Array.from(nums, () => 1);
    // Max subsequence length
    let max = 1
    // Check all increasing subsequences up to the current ith number in nums
    for (let i = 1; i < nums.length; i++) {
        // Keep track of subsequence length in the dp array
        for (let j = 0; j < i; j++) {
            // Only change dp value if the numbers are increasing
            if (nums[i] > nums[j]) {
                // Set the value to be the larget subsequence length
                dp[i] = Math.max(dp[i], dp[j] + 1)
                // Check if this subsequence is the largest
                max = Math.max(dp[i], max)
            }
        }
    }
  return max;
};
```