teleren/devto huggingface dataset:
Prettify JSON with IntelliJ scratch files!
Tags: java, programming, beginners
Published: 2021-11-08 18:17:41

---
title: Prettify JSON with IntelliJ scratch files!
published: true
description: IntelliJ is not just a great Java editor!
series: IntelliJ Life Hacks
tags: java,programming,beginners
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/onwfyw57970drsygytnv.jpg
---

If you develop web services and you're an IntelliJ IDEA user, then here's a simple tip that can save some time.

Let's say you have an ugly JSON response that came from a log, the output from a cURL command, or elsewhere.

It might look something like this example response from [jsonapi.org](https://jsonapi.org/examples/):

```json
{ "data": [{ "type": "articles", "id": "1", "attributes": { "title": "JSON:API paints my bikeshed!", "body": "The shortest article. Ever.", "created": "2015-05-22T14:56:29.000Z", "updated": "2015-05-22T14:56:28.000Z" }, "relationships": { "author": { "data": {"id": "42", "type": "people"} } } }], "included": [ { "type": "people", "id": "42", "attributes": { "name": "John", "age": 80, "gender": "male" } } ] }
```

Try these steps:

1. Copy it.
1. Open IntelliJ.
1. Go to File > New > Scratch file... or use the shortcut key  Shift + Command (Apple) + N.
1. Choose "JSON" (hint: you can type "json").
1. Paste.
1. Go to Code > Reformat code or use the shortcut key Alt + Option + L.

> Note: The above shortcut keys are for macOS. Review the IntelliJ Keymap reference for the corresponding shortcuts in your operating system.

The result will now be that you have nicely-formatted / prettified JSON:

```json
{
  "data": [
    {
      "type": "articles",
      "id": "1",
      "attributes": {
        "title": "JSON:API paints my bikeshed!",
        "body": "The shortest article. Ever.",
        "created": "2015-05-22T14:56:29.000Z",
        "updated": "2015-05-22T14:56:28.000Z"
      },
      "relationships": {
        "author": {
          "data": {
            "id": "42",
            "type": "people"
          }
        }
      }
    }
  ],
  "included": [
    {
      "type": "people",
      "id": "42",
      "attributes": {
        "name": "John",
        "age": 80,
        "gender": "male"
      }
    }
  ]
}
```

And that can help a lot with your dev and support tasks! 👍
What to expect from Java interview in 2021
Tags: java, interview, career
Published: 2021-11-08 18:05:35


In my previous job, I did a lot of interviews for our Java developer positions. We had a typical modern Java stack based on Spring framework and relational database. We usually hired junior devs right after school so our interview process was designed to find talented people with potential, not encyclopedical knowledge.

We had one in-person round and take a home coding assignment. This article will try to cover both.

## In-person round

This was the more important round of our process. Basically usually a team lead of the team that was hiring and one senior dev was conducting it. The goal was to determine if the person would be a good fit for a team, had some technical thinking capabilities and the most important could communicate.

In the first part, we had a small talk portion, that was around previous experiences, either their current job or a school project.

Typical questions here would be:
- What was the last project you worked on?
- What have you learned recently?
- What would be your dream project?

In the second part we did few technical questions. Around some basic Java or Spring things.

Typical questions here:
- Explain static keyword.
- Explain how to compare objects in Java. Equals and hasCode.
- Inversion of control and dependency injection.

In the third part, we had a technical challenge to solve. It was a simplified real problem we had to solve during last year (we were changing this to keep it interesting). It did not have one solution. Involved designing a simple alghoritm that strongly suggested use of recursion, but could be solved numerous ways.

The ultimate goal was to for the candidate to design a data structructure and use it in the simple alghoritm. We wanted  candidate to communicate what they are doing and we usually helped them talk through everything. We never looked at the syntax or cared what language they used. We wnated to see the capabilities to design the structure to store the data and some basic thinking to see of they at least were able to talk through what should be done.

In the last part we gave space for any questions.

## Take a home coding challenge

We had a very easy take a home coding challenge that was basically to implement CSV parser. Parse data in the CSV we provided and print it as HTML table and excel file.

We looked at theese concepts in the final code:
- Polymorphism
- Logging
- Library usage
- Comments
- Unit testing

We did not require a perfect solution, we even did recomend to implement as much as they are feel like and then just write comments explainging how to finish it. We did not had a time constrain and ultimate goal here was to see if the candidate would be able to write code at our standards.

---

Hope this article helped you can always ask me about anytihng on my [Twitter](https://twitter.com/pavel_polivka).
How to change the database in a Rails application ?
Tags: ruby, rails, database, generators
Published: 2021-11-08 17:56:04

## Hello guys !

sometimes I came across the need to change the application's database, because many times we start with a study project with Sqlite3 and then the project ends up getting bigger with another need and then we decided to change to another one like (PostgreSQL, MySQL, etc ...)!

So here's a nice little tip:

```bash
rails db:system:change --to=postgresql
rails db:system:change --to=mysql
rails db:system:change --to=sqlite3
rails db:system:change --to=oracle
rails db:system:change --to=frontbase
rails db:system:change --to=sqlserver
rails db:system:change --to=jdbc
```

**obs: only works from rails version 6 onwards
Flask Atlantis Lite - Product Update
Tags: webdev, flask, dashboards, opensource
Published: 2021-11-08 17:54:21

---
title: Flask Atlantis Lite - Product Update
published: true
description: Open-source Flask Dashboard crafted on top of a really nice dark-themed design: Atlantis Lite. The product can be downloaded directly from Github without a registration lock.
tags: webdev, flask, dashboards, opensource
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k3i9nm3s06dnjde5qdul.gif
canonical_url: https://blog.appseed.us/flask-atlantis-lite-free-dashboard/
---
Hello Coders!

This article presents [Flask Atlantis Lite](https://appseed.us/admin-dashboards/flask-dashboard-atlantis-dark), a popular open-source seed project coded on top of a beautiful dark-themed design. The product was recently updated to use the latest Flask stable version, plus a new codebase structure and Gulp tooling for SCSS compilation. For newcomers, **Flask** is a popular Python web framework actively supported by many open-source enthusiasts.

> *Thanks for reading!* - Content provided by **[App Generator](https://appseed.us/)**.

--- 

- ✨ [Atlantis Lite Flask](https://appseed.us/admin-dashboards/flask-dashboard-atlantis-dark) - product page
- ✨ [Atlantis Lite Flask](https://flask-atlantis-dark.appseed-srv1.com/) - LIVE Deployment

---

![Flask Atlantis Lite - Open-Source Starter](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z6e5adpte9cwa9ube5xq.png)

---

## Product Features

- 👉 Up-to-date dependencies: Flask 2.0.1
- 👉 SCSS compilation via Gulp
- 👉 DBMS: SQLite, PostgreSQL (production)
- 👉 DB Tools: SQLAlchemy ORM, Flask-Migrate 
- 👉 Deployment scripts: Docker, Gunicorn / Nginx, Heroku
- 👉 Support via Github and [Discord](https://discord.gg/fZC6hup).
- 👉 Fix: [Import error of TextField from wtforms](https://docs.appseed.us/content/how-to-fix/cannot-import-name-textfield-from-wtforms)

The product can be used in a local environment via a manual build by following the classic setup for a Flask/Python project or with fewer commands via **Docker** Scripts.

> Get the code

```bash
$ git clone https://github.com/app-generator/flask-dashboard-atlantis-dark.git
$ cd flask-dashboard-atlantis-dark
```

> Start the app in Docker

```bash
$ docker-compose pull   # download dependencies 
$ docker-compose build  # local set up
$ docker-compose up -d  # start the app 
```

Visit `http://localhost:85` in your browser. The app should be up & running.

![Flask Atlantis Lite - Widgets Page.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nfkzuo3xskpoyd1ktmtk.png)

---

> Flask Atlantis Lite - Timeline Page

![Flask Atlantis Lite - UI Buttons Page.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gzxpz26l3iv7lo1po7uq.png)

---

> Thanks for reading! For more resource, please access:

---

- ✨ More [Flask Dashboards](https://appseed.us/admin-dashboards/flask) - index provided by AppSeed
- ✨ [Atlantis Lite Django](https://appseed.us/admin-dashboards/django-dashboard-atlantis-dark) - open-source seed project
The revolution in Front-end Development is here
Tags: vscode, webdev, productivity, beginners
Published: 2021-11-08 17:34:00

Hi everyone, 
I’m Bruce and I’m a DevRel at blox. Me and my team are excited to bring you the alpha release of [blox](https://www.vsblox.com/)

##What is blox?
blox is a VS code extension that lets you drop code snippets with a single click. It’s aimed at fast tracking the developer workflow through the ease of adding pre-built UI components without ever having to leave VS Code.

![blox vscode demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1yq6k1n0ra88tl2d5m5b.gif)

##The blox story
I started using Tailwind CSS a couple years ago, I fell in love with the ease and seamlessness of the experience that comes with it. As someone who was managing a team of quite a few devs at that time, I started noticing the need to fast track our workflow as our clientele grew. We gave more than a couple of UI kits/libraries (for Tailwind CSS) a shot and we were over the moon with the difference they made, in the form of quicker dev hand-offs. 
As time passed, I started pondering over the fact that we were spending too much time switching over windows, setting up frameworks, and applying configs for the UI components of the excellent resources we were using. 
Then one day in the midst of a caffeine rush, I had a crazy yet simple idea that what if I could skip the copy-pasting and just do everything where I spend most of my time. I ran some ideas over with my team in the next Monday's meeting. And after spending a week or so on coming up with a product development strategy we went right into it. 
I’ll dive deep into our product development journey and the ups and downs of building blox some other time. For now, I just wanted to share a glimpse of our journey and how we got here.  

##Integrations and supported frameworks
Currently, blox supports Tailwind CSS with Angular, Vue, and React at the moment. In the future, we have plans of gradually releasing support for MaterialUI, Bootstrap, Svelte, Alpine.js, and Laravel. Blox comes with an extensive code snippets library of more than 1500 codeblocks for a wide collection of categories. There are three component categories of Web Application UI, Ecommerce UI, and Marketing UI for fully functional and responsive web applications, landing pages, and web stores. There are a bunch of component categories that are built by expert designers after an extensive UX research. We’ve arranged the code block in an intuitive way 
The code blocks require no configuration, and they’re also completely functional and responsive. So, once you’ve installed blox, you’re all set and good to go.
  
##Try blox
Currently we’re doing a soft launch  and you can install the alpha version of blox from its VSIX file. It’s available on [blox's official website](https://www.vsblox.com/). Once you install it in your VS code, the “b” (blox) icon appears on the left side, along with your other installed extensions. Just open it up and start dropping the code blocks in your projects!

![blox vscode demo 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/koj09v7tc1nik1usvkjq.gif)
Shortened URL Service: Low-Code Development
Tags: php, lowcode
Published: 2021-11-08 17:25:33

The ShortLinks project was finished in 28 hours. Of which 1.91 hours was competitive research and 5.17 hours was spent on Project Management. So less than 21 hours was spent in actual coding to complete an entire SaaS including ecommerce.

Video shows details of finished website, charting and PayPal functionality.
{% youtube iGacpfghQiU %}

This was built using the Wizards Toolkit, a low-code development library built on PHP, SQL, Javascript and MaterializeCSS.

The finished product includes dynamic charting to display referer domains, browser types, operating systems and more using pie, bar, line and area charts.

For ecommerce, PayPal was used utilizing their latest JavaScript API.

Wizards Toolkit - Low-code library of PHP, SQL and JavaScript
https://WizardsToolkit.com

WizBits.me - short links SaaS
https://wizbits.me

HTML/CSS/JS Framework
https://materializecss.com
1 line of code: How to get the length of the longest string of an Array
Tags: javascript, webdev, productivity, codequality
Published: 2021-11-08 17:23:58

 ```javascript
     const longestStringLength = (arr, curr = 0) => (arr.forEach(el => { if (el.length > curr) curr = el.length }), curr);
```
---

Returns the length of the longest string entry of an Array of strings.


## The repository & npm package

You can find the all the utility functions from this series at [github.com/martinkr/onelinecode](https://github.com/martinkr/onelinecode)
The library is also published to [npm as @onelinecode](https://www.npmjs.com/package/@onelinecode/onelinecode) for your convenience.

The code and the npm package will be updated every time I publish a new article.

---
Follow me on [Twitter: @martinkr](http://twitter.com/_martinkr) and consider to [buy me a coffee](https://www.buymeacoffee.com/martinkr)

Photo by [zoo_monkey](https://unsplash.com/@zoo_monkey) on [Unsplash](https://unsplash.com/s/photos/fuji)

---
HTML Cheatsheet
Tags: html, webdev, beginners, css
Published: 2021-11-08 17:11:36

My journey from Back-End Python developer to a Front-End React Developer was not a piece of cake. I have a long way since I joined my first job at [Diya Interactive](https://diyainteractive.com/) back in Feb, 2021. I have started from the scratch my Front-End journey, and I am still learning.
Based on my own personal learning experience, I have prepared a list of most widely used HTML Tags, that you should know of, if you want to pursue a career as a Front-End Developer.

## HTML Basic Structure
- `<!DOCTYPE>` Defines the document type
- `<html>` Defines an HTML Document
- `<head>` Contains the metadata/information for the document
- `<meta>` 
- `<title>` Defines a title for the document
- `<body>` Defines the document's body
- `<!--`...`-->` Defines a comment in HTML
- `<hr>` Defines a thematic change in the content with a horizontal rule/line
- `<br>` Inserts a single line break

## Styles and Semantics
- `<style>` Defines style information for a document
- `<div>` Defines a section in a document
- `<span>` Defines a section in a document on the same line
- `<header>` Defines a header for the document or the section
- `<footer>` Defines a footer for the document or the section
- `<main>` Specifies the main content of the document
- `<section>` Defines a section in a document with references to other elements
- `<article>` Defines an article

## Lists
- `<ul>` Defines an unordered list
- `<ol>` Defines an ordered list
- `<li>` Defines a list item in both, `<ol>` & `<ul>` tags
- `<dl>` Provides a description to the list
- `<dt>` Gives a term/name to the description list
- `<dd>` Defines a description of a term/name in a description list

![Bore Meme](https://memegenerator.net/img/instances/65123091.jpg)

I hope I didn't bore you with all this :wink:
Next time, we will be covering the basic elements you NEEEEEEEEEED to know about **Forms & Inputs**
Share your GitHub Actions Hackathon 2021 Updates!
Tags: actionshackathon21, githubactions, opensource, discuss
Published: 2021-11-08 17:10:56

---
title: Share your GitHub Actions Hackathon 2021 Updates!
published: true
description: Use this thread to share progress updates on your GitHub Actions hack!
tags: actionshackathon21, githubactions, opensource, discuss
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ym1895b2rtpyselgw3pi.png
---

We’d love to know what you’re building and how things are going throughout the [GitHub Actions Hackathon 2021](https://dev.to/devteam/join-us-for-the-2021-github-actions-hackathon-on-dev-4hn4) on DEV.

> **Please use this thread for sharing ideas, gathering feedback, and to get to know other participants in the hackathon!** 

If you have a big update or just worked through a tough problem, we encourage you to publish a standalone post. Just be sure to add the [#actionshackathon21](https://dev.to/t/actionshackathon21) tag so we can easily find it. 

If you need help with a specific problem, check out the [help thread](https://dev.to/devteam/github-actions-hackathon-2021-help-thread-1lk0) where members of the DEV and GitHub teams are standing by to answer your questions.

Have a happy hackathon!
GitHub Actions Hackathon 2021 Help Thread
Tags: actionshackathon, githubactions, opensource, help
Published: 2021-11-08 17:10:34

---
title: GitHub Actions Hackathon 2021 Help Thread
published: true
description: Comment here if you need any help during the GitHub Actions Hackathon 2021!
tags: actionshackathon, githubactions, opensource, help 
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/to1ka6a691t63tqxn933.png
---

**If you're participating in the [GitHub Actions Hackathon](https://dev.to/devteam/join-us-for-the-2021-github-actions-hackathon-on-dev-4hn4) and you need some help with your submission, this is the place to be!**

If you have any questions about how this hackathon works (_ex: due dates, how to post your submission, picking a category, etc._) the DEV team will be available to help out.

If you are running into issues or get stuck when it comes to GitHub Actions and workflows, @blackgirlbytes and @mishmanners  from team GitHub will be closely monitoring this thread. Be sure to tag them if you need any GitHub guidance.  

> ## Please comment below if you need asynchronous assistance with the GitHub Actions Hackathon 2021!

If you'd like to share an update on the progress you're making on your project or if you'd like to connect with other participants, please do so in the [community update thread](https://dev.to/devteam/share-your-github-actions-hackathon-2021-updates-57k)!
[C/C++] How to get scope_id of IPv6 Link local Address on Linux.
Tags: socket, ipv6, linux
Published: 2021-11-08 17:08:28

---
title: [C/C++] How to get scope_id of IPv6 Link local Address on Linux.
published: true
description: When binding a socket or connecting to IPv6 Link Local address, you need to use "Scope ID". Or operation would fail. But how to get "Scope_ID" in C/C++? This article help you to get "Scope_ID" in C/C++.
tags: socket, IPv6, Linux,
//cover_image: https://direct_url_to_image.jpg
---

A well-known way is to use `getaddrinfo()` such like:

```c++
#include <arpa/inet.h>
#include <cerrno>
#include <cstring>
#include <iostream>
#include <netdb.h>
#include <string>
#include <sys/socket.h>
#include <sysexits.h>

int main(void)
{
    struct addrinfo hints;
    memset(&hints, 0, sizeof(struct addrinfo));
    hints.ai_family = AF_INET6;
    hints.ai_socktype = SOCK_DGRAM;
    hints.ai_protocol = IPPROTO_UDP;

    struct addrinfo* result_addrinfo = nullptr;
    auto result = getaddrinfo("fe80::dabb:c1ff:fe0a:17f2%enp39s0", std::to_string(12345).c_str(), &hints, &result_addrinfo);
    if( result != 0 ){
        std::cout << "`getaddrinfo()` failed: " << gai_strerror(errno) << std::endl;
        return result;
    }

    for(
        struct addrinfo* info = result_addrinfo;
        info != nullptr;
        info = info->ai_next
    ){
        char ipv6addr_human_readable_form[INET6_ADDRSTRLEN] = {0, };
        inet_ntop(info->ai_family, &((struct sockaddr_in6*)(info->ai_addr))->sin6_addr, ipv6addr_human_readable_form, info->ai_addrlen);
        auto ipv6_scope_id = ((struct sockaddr_in6*)(info->ai_addr))->sin6_scope_id;

        std::cout << "IPv6 address = " << ipv6addr_human_readable_form << std::endl;
        std::cout << "Scope-ID = " << std::to_string(ipv6_scope_id) << std::endl;
    }

    freeaddrinfo(result_addrinfo);
    return EX_OK;
}
```

Of course, the Scope-ID can also be obtained as previously. But is there an easier and shorter?

## Solution using `if_nametoindex()`

Fortunately, Linux provides a function called [`if_nametoindex()`](https://man7.org/linux/man-pages/man3/if_nametoindex.3.html). It returns the index number of the network interface, which is currently equal to the Scope-ID.

```c++
#include <net/if.h>
#include <iostream>
#include <sysexits.h>

int main(void)
{
    auto scope_id = if_nametoindex("enp39s0");
    std::cout << scope_id << std::endl;

    return EX_OK;
}
```

Now, the code became much shorter and easier. Also, there is no need to care to free memory!
Quick Tip: Kotlin, Spring Data, and Optionals
Tags: java, kotlin, springdata, spring
Published: 2021-11-08 17:11:35

---
title: Quick Tip: Kotlin, Spring Data, and Optionals
published: true
date: 2021-11-08 17:01:18 UTC
tags: java,kotlin,springdata,spring
canonical_url: https://medium.com/@cr0wst/quick-tip-kotlin-spring-data-and-optionals-e84c401b5f8b
---

### Quick Tip: Kotlin Extension Functions and Spring Data

![](https://cdn-images-1.medium.com/max/1024/0*0Hey9oOyDfy2vmDg)
_Photo by Diego PH on Unsplash_

When working with [Spring Data](https://spring.io/projects/spring-data) and Kotlin, you may have noticed that the default findById returns an Optional<T> . This super-short post will show you how you can leverage Kotlin [extension functions](https://kotlinlang.org/docs/extensions.html#extension-functions) to customize this logic.

#### What is Optional ?

Optional was introduced in Java 8 as a solution to handle nullability. It serves as a container that _might_ contain a value, freeing you up from using null to mean optionally defined.

Kotlin addresses this using a different approach: [being null-safe](https://kotlinlang.org/docs/null-safety.html).

#### What are extension functions?

Extension functions allow you to extend a class with additional functionality without using decorators or having direct access to modifying the class.

They can be really useful when you want to add things to third-party libraries as if the function was part of the library.

#### Extending Spring Data

Spring Data added an extension function in 2.1.4 to CrudRepository called findByIdOrNull . However, this method doesn’t work in some of the other interfaces, like JpaSpecificationExecutor .

Here’s one I use for JpaSpecificationExecutor that wraps the findOne method:

{% gist https://gist.github.com/cr0wst/8bdd1704e3eba5ae5a77b6e661de131d %}

By defining this extension function, I can now bypass the optional entirely and work directly with the nullable return value:

{% gist https://gist.github.com/cr0wst/7def325b7a05d0b224e0eb22f3f8ea90 %}

#### Conclusion

While Kotlin is fully interoperable with Java, we can do some things to improve the overall user experience. Stay tuned for more **Quick Tips** to help you on your Kotlin journey.
Meet the Tanukis: John Coghlan
Tags: community, techtalk, gitlab, devrel
Published: 2021-11-08 16:39:29

Meet the Tanukis is a stream about the amazing Team members at GitLab. Each episode focuses on a team member discussing issues in tech that are important to them. This episode features John Coghlan, Manager of Developer Evangelism. 

{% youtube uXm0TDaph-M %}

Links: 
[Devrelcon 2021](https://2021.devrel.net/)

[Free Licenses for Education/Research Institutions!](https://about.gitlab.com/solutions/education/join)