teleren/devto huggingface dataset:
Gerenciando as muitas versões do Java com SDK MAN!
Tags: java, sdkman
Published: 2023-05-14 16:48:30

Para esse artigo vamos gerenciar as muitas versões do Java que cada das suas aplicações podem ter, isso com SDK MAN!

> SDKMAN! é uma ferramenta para gerenciar versões paralelas de vários Kits de Desenvolvimento de Software.

Antes de tudo vamos instalar o SDK, basta seguir os comandos na Doc do SDK MAN!

```sh
curl -s "https://get.sdkman.io" | bash
```
```shell
source "$HOME/.sdkman/bin/sdkman-init.sh"
``` 
![Imagem da Versao do SDK instalado](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xibvn0km8t3ur0byxgzz.png)

Agora vamos listar as versões disponíveis para instalação do Java.

```shell
sdk list java
```
![Lista de Versoes do Java disponiveis no SDK](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jhzw8xifdmi5j0lgmn09.png)


Vamos escolher a Distribuição da Oracle na versão 17.0.7-oracle. Você também pode vê-las no link → https://sdkman.io/jdks

Para instalar basta executar o comando abaixo:

```shell
sdk install java 17.0.7-oracle
```

![Imagem instalando Java 17 com SDK](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nrtaubyyx6arkg9s1zb3.png)


No final da instalação haverá uma pergunta, se desejamos SETAR a nova versão instalada como default (JAVA_HOME), Digite Y(es).


![Imagem com Java --version](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ww2ergb8x6ixm6sdbt7.png)

Você pode estar criando uma nova aplicação Java com a versão mais atual, nesse momento é a 20, basta você instalar da mesma forma utilizando o próprio SDK MAN como nos passos anteriores.

![Imagem instalando Java 20](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xp4avbx85kdpwvkpd5xi.gif)

Para voltar o JAVA_HOME para a versão Java 17:

```shell
sdk default java 17.0.5-oracle
```

Removendo uma versão instalada.

```shell
sdk uninstall java 20.0.1-oracle --force
```

Ref.:

https://sdkman.io/jdks
Project Iconic-Desserts
Tags: webdev, javascript, flatirion
Published: 2023-05-14 16:42:49

Hello everyone! My name is Renardo Williams and this blog is about my web application Iconic Desserts. Iconic Desserts is a work in progress eCommerce web application that I am building for my wife. She has started a pastry company and wanted me to build a web page for her. The main purpose for web application is to View, Rate and order different desserts in different categories.

Behind the scenes of my web application is a db.json file which uses JSON (JavaScript Object Notation) API is an application programming interface designed for lightweight data interchange (text-based data exchange format) between two computer applications operating on the same hardware device or between different computers in different geographical areas.

In the context of Iconic Desserts, I used API to retrieve data for the different Dessert categories
```
fetch(`http://localhost:3000/${key}`)
   .then(data => data.json())
```    

I also use API to record and update the ratings on items the db.json file using a PATCH.

```
function updateRating(item, key) 
fetch(`http://localhost:3000/${key}/${item.id}`, { method: "PATCH", headers: { "Content-Type": "application/json", Accept: "application/json" }, body: JSON.stringify({ "rating": item.rating 

```

Now, that we have data from our .json file we can go ahead and display each item on the webpage. I do this by storing each element of the db.json in an array of objects. Then from there I can Loop through this array using a forEach() method and create each card to display on the webpage.

```
.then((item) => { item.forEach(item => generateItem(item, key)); })
```

Once we have all our items showing on the webpage we can view an image, brief description, rating and price. we are also able to add the item to a cart for a checkout process.


![Card Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u545q1jzywhed7pm96cx.png)

##
I used an array of objects to store each element in the Cart. If an item is added to the cart the item will have an attribute quantity with a value of 1, if the same item is added again instead of duplicating the item test is run to see if the item already exist in the array and then increments the quantity value by 1.

```
let index = -1
for (let i = 0; i < cart.length; i++) {
    if (cart[i].name === data.name) { index = i }
    }
    if (index >= 0) { cart[index].quantity += 1; }
    else { data.quantity = 1; cart.push(data); }
```

With the combination of API and JSON this has giving me the opportunity to create this beautiful website. 
The link to my project Repo is here:

https://github.com/Renardo1985/project-iconic-desserts.

I always appreciate feedback on my project  as this is my very first project. looking forward to growing and doing a lot more projects in the future! Thank you and enjoy!


Credits
https://rapidapi.com/blog/api-glossary/what-is-json-api-json-vs-graphql-vs-rest-api-comparison/#:~:text=JSON%20(JavaScript%20Object%20Notation)%20API,computers%20in%20different%20geographical%20areas.
Standing Together for Palestine: A Call to the Open-Source Community
Tags: community, nakba, discuss, contributorswanted
Published: 2023-05-14 16:29:58

Hello Dev.to community! 🙌

As we approach Nakba Day, a significant day in the history of Palestine, it's crucial to remember the humanitarian needs of our brothers and sisters in Palestine 🇵🇸. In response to this, I've initiated an open-source project on GitHub called [Help_Palestine](https://github.com/ranggakd/Bantu_Palestina) aimed at gathering and spreading information about aid sources available.

{% embed https://github.com/ranggakd/Bantu_Palestina %}

While the repository is primarily in Indonesian 🇮🇩, we truly believe in the global impact and power of our open-source community. We invite everyone, regardless of their geographical location, to contribute to this cause.

How can you help, especially if you're a non-Indonesian speaker? Here's how:

1. **Translate**: Help us translate the content to other languages, making it more accessible to a wider audience.
2. **Add More Sources**: If you know of any credible aid sources that accept international donations, feel free to add them to the list.
3. **Spread the Word**: Share this repository with your networks. The more people know about it, the more help we can gather for Palestine.

Remember, the beauty of open source is that everyone can make a significant impact, regardless of where they are. No contribution is too small; each one can make a real difference.

Let's harness the collective power of our community to support and stand in solidarity with Palestine. 🇵🇸🤝🌏

Thank you greatly for your support and contributions! 🙏
I Tried Blogging as a Developer for 7 Days 🧑‍💻
Tags: beginners, career, learning, devjournal
Published: 2023-05-14 16:22:41

Here's what I learned in the first 7 days of actively blogging as a developer.

## Introduction
Saying I'm new to blogging wouldn't be entirely correct. Before signing up on dev.to, I had already written a handful of blog posts on my own domain.

But even though they've been online for years, they never really reached any audience.

Last week, while reading an article on dev.to, I thought:

> "Hmm... Why not try writing an article here to see how much (if any) attention it gets?"

To start things off, I decided to write a helpful, tutorial-ish article about something I came across while working on a side project.

## My first post on dev.to

And there it was, [my first post](https://dev.to/fabiancdng/redirect-http-to-https-and-www-to-non-www-with-traefik-3-40i6) (exclusively) on dev.to:

![Screenshot of my first dev.to post](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6jnm356hkfh3qtdm6c6s.jpg)

At first, not much was happening.

But **_3 days later_**:

The Twitter account behind dev.to ([@ThePracticalDev](https://twitter.com/ThePracticalDev)) gave me a shout-out on Twitter:

{% twitter 1656256770573053953 %}

I immediately saw people reading my post and following me on the platform.

## Cross-posting

I stumbled across an article on ["cross-posting" articles on dev.to](https://dev.to/conermurphy/maximising-blog-post-impressions-by-cross-posting-the-correct-way-2ij3).

I decided to cross-post one of my previous articles ["Automatic Deployment using Docker and GitHub Actions"](https://fabiancdng.com/blog/automatic-deployment-using-docker-and-github-actions) on dev.to.

The same thing that had happened to my first post, happened to the second one:

{% twitter 1657576971453210624 %}

## 3 posts later...

After posting another article exclusively on dev.to, this is how my stats look like, 7 days after creating my first post on dev.to:

![Screenshot of dev.to statistics](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cjb1km6kgdikntx92hcz.jpg)

* 1,069 reads
* 200 followers
* 9 reactions

## Conclusion
Posting or cross-posting on blogging platforms like [dev.to](https://dev.to), [Hashnode](https://hashnode.com) or [Medium](https://medium.com) can help your blog reach an audience.

However, keep in mind that blogging is about so much more than just clicks. Blog posts document your projects, personal journey, and growth as a developer.

Your posts don't need to be perfect and even if they're just a digital diary/glossary for yourself, they serve a very important purpose.

But still... There's a chance that your posts can help someone out there. So why not share your projects, research, and experience with others?

**I'm curious what you think. Do you have a blog as a developer?**
Feel free to share your experience in the comments!

Cheers.
Do Not Optimize Code
Tags: sdlc, webdev, beginners, programming
Published: 2023-05-14 15:28:34

It is important to optimize code only after completing all essential stages of software development. Changing requirements, focusing on functionality, testing, and the risk of over-optimization are some key reasons for this. By doing so, we can ensure the software meets requirements, performs optimally, and is easier to maintain and modify.


If we optimize the code at the first stage of software development, we may end up wasting time and resources on features that may change or be removed later due to changing requirements. Additionally, optimized code can be more difficult to test and debug, making it harder to identify and resolve errors. There is also a risk of over-optimization, which can lead to issues with maintainability, complexity, and performance. Therefore, it is important to complete all essential stages of software development before optimizing the code.
Converter
Tags: codepen, beginners, programming, learning
Published: 2023-05-14 15:18:01

{% codepen https://codepen.io/safikumar00/pen/yLREmEp %}

I have made this project by me please review it if you can I need feedback. 

The purpose of this project is to create a user-friendly web page that can quickly and accurately convert binary, octal and hexadecimal number to decimal equivalents. One of the fundamental aspects of web development is the ability to convert numbers between different number systems.
NodeJs & UTF-8
Published: 2023-05-14 15:15:30

<p>UTF-8 is a character encoding system that is widely used in computers and on the internet. It is a variable-length encoding system, which means that it can represent every character in the Unicode character set. UTF-8 has become the de facto standard for encoding text on the web, and it is used by many programming languages and software applications.</p><p>When working with Node.js, one of the most common tasks is reading and writing files. The `fs.readFile()` method is used to read the contents of a file asynchronously. When reading a file, it is important to specify the encoding to use. If the encoding is not specified, Node.js will use the default encoding, which is usually UTF-8.</p><p>UTF-8 is important because it allows us to represent any character in the Unicode character set, which includes characters from almost every language in the world. This means that we can use Node.js to read and write files in any language, including languages that use non-Latin scripts such as Chinese, Japanese, and Arabic.</p><p>To specify the encoding when using `fs.readFile()`, we need to pass the encoding as the second argument to the method. For example, to read a file in UTF-8 encoding, we would use the following code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*kK6oW1y_JTQL9lVx-zDfFQ.png" /></figure><p>In this code, the first argument is the path to the file we want to read, the second argument is the encoding UTF-8 in this case, and the third argument is a call back function that will be called when the file has been read.</p><p>It is important to note that when reading and writing files in Node.js, the default encoding is not always UTF-8. For example, when reading and writing binary files such as images or audio files, we would not want to use UTF-8 encoding. In these cases, we would need to use a different encoding, such as `base64`.</p><p>In conclusion, UTF-8 is a crucial component of modern computing and the internet, allowing us to represent text in any language and enabling cross-language communication. When working with Node.js, it is important to specify the correct encoding when reading and writing files to ensure that we can work with text in any language. By using the `fs.readFile()` method and specifying the encoding as UTF-8, we can easily read and write text files in Node.js, making it a versatile tool for developers working on projects that require cross-language support.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de782c0930d3" width="1" height="1" alt=""></br><p style="color:#757CF9;">This article is published w/ <a target="_blank" href="https://scattr.io?ref=dev">Scattr  ↗️</a></p>
Using .map() Method To Copy An Array
Published: 2023-05-14 15:01:52

   

  I started this journey on 2023-02-27 with a basic knowledge of computer programming.
  When I see a web page and look at the "source code", I am wondering how the web page works. Now, after 11 weeks of study, I found that the JavaScript coding is the "source" that does most things to the web page behind the scenes.

  Moving forward with JavaScript, I learned essential skills on creating documents with HTML, styling/positioning the documents' content with CSS, and using JavaScript to respond to events. 

  Breaking down the JavaScript part of web programming into three "pillars" that constitute the heart of web programming:

1) Recognizing events.
2) Manipulate DOM.
3) Communicate with server. 






  One interesting thing I learned about copying an array nondestructively (leaving the original array intact) is using the map method to copy an array, as in this example:

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






  The way that JavaScript works to manipulate HTML and CSS in real-time allows for the creation of dynamic and interactive web pages, enhances the user experience, and makes web pages more engaging.
  In conclusion, JavaScript is a versatile and powerful language that is essential for building modern web applications. Its ease of use, support for OOP and functional programming, and vast ecosystem of libraries and frameworks make it a popular choice for developers worldwide. Whether you are a beginner or an experienced developer, learning JavaScript is a must if you want to build dynamic and interactive web applications.
Graph Database Breakthroughs
Published: 2023-05-14 14:48:43

Graph databases are an 18th century concept with a host of modern applications.

Used for tasks as diverse as dating sites and fraud detection, graph technology works by looking at relationships, not just data. But the idea behind them – or, at least, their theoretical basis – is attributed to Swiss-born mathematician Leonhard Euler, in 1735.

For almost 300 years, graph theory remained a mostly academic pursuit. But graphs have turned out to be an ingenious way of dealing with large volumes of data, and especially complex relationships between data.

In recent years, technologists have taken graph theory and created the graph database, a type of database where connections, as well as data, are first class citizens.

Graph databases are designed to efficiently store and query connected data by using a node and relationship-based format, making them particularly equipped to solve problems when understanding those connections are critical.

One of the key advantages of graph databases is that they can mimic the way the human brain processes and understands associations. By representing data as nodes and relationships, graph databases provide a more intuitive and natural way of working with connected data.

By recording links between data, as well as data itself, graph-based systems can quickly mine information and identify trends, making them a powerful tool for real-time analytics, as well as for mapping social networks, supply chain patterns, or even crime waves.

As a graph database looks at connections and relationships – known as edges – it takes just minutes, or even seconds, to answer queries that might take days using a conventional database system.

Graph databases (and specialized versions called native RDF triplestores that embody reasoning power) show great promise in knowledge discovery, data management and analysis.   They reveal simplicity within complexity.  When combined with text mining, their value grows tremendously.   As the database ecosystem continues to grow, as more and more connections are formed, as unstructured data multiplies with fury, the need to analyze text and structure results inside graph databases is becoming an essential part of the database ecosystem.  Today, these combined technologies are available and not just reserved for the big search engines providers.  It may be time for you to consider how to better store, manage, query and analyze your own data.  Graph databases are the answer.

It seems that it is only a matter of time before other industries that deal with huge amounts of data such as banking and finance, pharmaceuticals, defense and intelligence will also be using graph databases. In fact, detecting crimes and identifying insurance fraud with the help of networks, relationships and entities with graph data is sure to be an interesting task.

Apache AGE has taken a new type of approach to implement Graph database with PostgreSQL underlying.
[Apache AGE](https://age.apache.org/)
[Apache AGE Github](https://github.com/apache/age)
Finishing off my GuestBook
Tags: nextjs, javascript, webdev, react
Published: 2023-05-14 14:38:19

More than 2 months ago, I decided to create my own GuestBook.
I originally made this project so I could improve on my Next.js/React skills and it has definitely made me better with web development.

The finished off version of my guestbook is here: https://vulcanwm-guestbook.vercel.app 

### The features I have added since the last time are:
- Adding OAuth: GitHub/Google/Replit
- Deleting your own comment
- Admins for the board so they can delete all comments
- Ratelimit on username as well as browser

---

The GitHub repo is here, so contribute to help me on my Next.js journey!

{% embed https://github.com/VulcanWM/guest-book %}
Understanding Bit Manipulation in C: A Byte-sized Guide
Tags: c
Published: 2023-05-14 14:37:46

# Understanding Bit Manipulation in C: A Byte-sized Guide

**Introduction**

In the bustling city of bytes, bits are the unsung heroes, the atoms of our digital universe. Understanding how to manipulate them, especially in the C programming language, is like having the city's map in your pocket. It's a skill that can make your code faster, smaller, and even more fun to write.

## What is Bit Manipulation?

Bit manipulation involves the direct interaction with individual bits in a block of data. In C, this is often accomplished through bitwise operations like AND (&), OR (|), XOR (^), NOT (~), as well as shifts (<<, >>). 

Let's get our hands dirty and dive into the practical side of bit manipulation in C.

## Bitwise Operators in Action

**AND Operator (&)**

The AND operator takes two bits and returns 1 if *both* bits are 1. Otherwise, it returns 0.

```c
int a = 12;  // Binary: 1100
int b = 10;  // Binary: 1010
int result = a & b;  // Binary: 1000, Decimal: 8
```

**OR Operator (|)**

The OR operator returns 1 if *either* of the two bits is 1. If both bits are 0, it returns 0.

```c
int a = 12;  // Binary: 1100
int b = 10;  // Binary: 1010
int result = a | b;  // Binary: 1110, Decimal: 14
```

Once you've mastered these operations and their siblings - XOR and NOT, you can start combining them for more complex manipulations. Happy coding!

## Conclusion

Bit manipulation can seem daunting, but once understood, it can be an incredibly powerful tool in your C programming toolbox. By directly interacting with the binary data, we can write more efficient, more precise code. So why not give it a try and unlock the next level of your programming journey?
How to implement Countries List API in your project
Tags: webdev, tutorial, programming, php
Published: 2023-05-14 14:21:16

## Hello, in this article we will learn how to implement Countries List inside your project (website, android app, etc).
<br/>
here's an example of android app:

![android app](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k9vegro7w2t1aihtf1ul.jpg)

first, we will use **CountriesList** library from Github:
**[github.com/kimoandroid/CountriesList](https://github.com/kimoandroid/CountriesList)**

<br/>
**Why this library**

- Easy to use anywhere.
- You can add unlimited translation for the same file without editing the main function or use Hardcoded.
- You can use country_code key to use it in your sytem for calling codes.
- you can display country name with it's flag easily.

<br/>
You can easily use the ready api  directly by using this link: [**https://api.encept.co/countries/index.php?lang=en**](https://api.encept.co/countries/index.php?lang=en)


* api parameters: lang=ar OR lang=en

<br/>
* api response: JSON Encode.

<br/>
* JSON response example:
```json
[{
"code":"US",
"calling_code":"+1",
"flag":"🇺🇸",
"name":"United States"
}]
```
<br/>
You can use this api directly and call this link from your project and get the JSON response.

Or you can create your api from zero at your own server & use your own link.

First, Download The Library Files That I Mentioned Before From Github: **[github.com/kimoandroid/CountriesList](https://github.com/kimoandroid/CountriesList)**

This Library is very flexable and easy to use & edit.

Inside [Localization](https://github.com/kimoandroid/CountriesList/tree/master/localization) folder you will find the translation of the countries name you can add new translation file by creating file called **country_[lang symbol].php** such as spanish, you will create a file named **country_sp.php**.

and after that copy all content that inside **[default_strings.php](https://github.com/kimoandroid/CountriesList/blob/master/localization/default_strings.php)** file 'this is the translation schema'

now if anyone called the api url and put this parameter: 'lang=sp' the api will return the countries list with spanish.

<br/>
**That's all, Follow For More :)**
Conditional Expressions in JavaScript | JavaScript #6
Tags: javascript, programming, devops, tutorial
Published: 2023-05-14 14:10:22

let a = prompt("hey whats is your age?");
a = Number.parseInt(a); // converting number into a string 
if (a < 0) {
  alert("This is an invalid age");
}
else if (a < 9) {
  alert("You are kid and you cannot drive now")
}
else if (a < 18 && a >= 9) {
  alert("You are kid and you can think of driving after 18  ")
}

else {
  alert("you can drive now as you are above 18");
}

// Ternary operator eg in Js 

console.log("you can", (a < 18 ? "not dive" : "drive"))[](https://replit.com/@SkSage/Conditional-expressions-in-JavaScript-7#index.js)