teleren/devto huggingface dataset:
Day 30: Quick Sort
Tags: 100daysofcode, java
Published: 2021-03-02 23:49:19

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

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;

 

public class Day30 {

    static int partition(int[] array, int low, int high) {

        int j, temp, i = low + 1;

        Random random = new Random();

        int x = random.nextInt(high - low) + low;

        temp = array[low];

        array[low] = array[x];

        array[x] = temp;

        for (j = low + 1; j <= high; j++) {

            if (array[j] <= array[low] && j != i) {

                temp = array[j];

                array[j] = array[i];

                array[i++] = temp;

            } else if (array[j] <= array[low]) {

                i++;

            }

        }

        temp = array[i - 1];

        array[i - 1] = array[low];

        array[low] = temp;

        return i - 1;

    }

    static void Day30(int[] array,int low,int high){

        if(low<high){

            int mid = partition(array,low,high);

            Day30(array,low,mid-1);

            Day30(array,mid+1,high);

        }

    }

    public static void main(String[] args) {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int size;

        System.out.println("Enter the size of the array");

        try {

            size = Integer.parseInt(br.readLine());

        } catch (Exception e) {

            System.out.println("Invalid Input");

            return;

        }

        int[] array = new int[size];

        System.out.println("Enter array elements");

        int i;

        for (i = 0; i < array.length; i++) {

            try {

                array[i] = Integer.parseInt(br.readLine());

            } catch (Exception e) {

                System.out.println("Error");

            }

        }

        System.out.println("The initial array is");
        System.out.println(Arrays.toString(array));
        Day30(array,0,array.length-1);
        System.out.println("The sorted array is");
        System.out.println(Arrays.toString(array));

    }

}
```
🔎🕵What's your best/worst experiences collaborating with UX/UI designers?
Tags: ux, frontend, discuss
Published: 2021-03-02 23:49:15

I personally think the collaboration process between designer/developer can be extremely fun and gratifying...I'm really curious from the developer perspective, when working with a UX/UI designers:
- What is an excellent experience🤩?
- What is a nooooot excellent experience😬?
- What are some workflow changes you've done in your team to make the collaboration work well🚀?

I'm wondering if there are any universal best practices in the workflow (oorrr not).
React Calculator (Oh god...)
Tags: javascript, react, venting
Published: 2021-03-02 23:42:10

# Introduction
Calculators are all fun and games until you start thinking about all the ridiculous edge cases. Travel down this rabbit hole with me...

# Operators & Parenthesis
Let's start off with talking about why these edge cases are so important. Let's assume you have an equation: `34+45*(34`

Now, when you try to evaluate this... What do you think happens? It's a no brainer, you're gonna get an error. How do we fix it then? End users are creative, oblivious, and they definitely wont use our calculator in the exact way we created it to be used. At the very least, they wont all follow a logical pattern. So, one method you might go with is something along the lines of `eval(result + ")")`. Awesome, that solves the problem!

Well... it solves that VERY NARROW problem. What happens when they type `34+45*(7)*(`. Chances are, your fix accounted for whether `(` and `)` exist. They both exist now, and we've run into the same problem as before, but now it's advanced. So we now check to see if the very END of our equation includes a `(` or with a number like `(4`. Depending on the case, we either remove the `(` or add a `)`.

# Operators (+, -, *, /)
Operators are a bit easier to handle. We basically check if the most recent item in the equation is an operator. If it is, either we replace it or keep it the same (if we chose the exact same operator again). 

This is how I handled it:
```react
const handleOperator = e => {
        let newResult = result.split("");
        let checker = newResult[newResult.length - 1]

        // Checks if an operator already exists at the end of the operation
        // If it does, replace it with the one that was clicked
        if(checker === "+" || checker === "-" || checker === "*" || checker === "/") {
            newResult.pop()
        }
        const joiner = newResult.join("")
        setResult(joiner + e.target.value)
    }
```

# Conclusion
Okay, today this post was a very quick one. But I believe it highlights the complexity in simplicity. Once of the easiest projects we've ever worked on as developers has been a calculator. However, I strongly believe we underestimate just how complex calculators can be. It's not as easy as mapping buttons and having a great 'ol time. There are so many use-cases that need to be accounted for, and I've likely not truly covered them all today. If there is anyone else out there reading this and going through the same thing, I hope this post provides some perspective. It's the result of hours of headache and burnout trying to think things through.

Happy Tuesday, everyone!
What's something you wish you could teach your younger self?
Tags: discuss, watercooler, culture
Published: 2021-03-02 23:40:25

---
title: What's something you wish you could teach your younger self?
published: true
description: I'm curious what you wish you'd known earlier
tags: discuss, watercooler, culture
//cover_image: https://direct_url_to_image.jpg
---

What's one thing you wish you could teach your younger self? Learn RegEx? Take time to go hiking once in a while? Buy Apple stock?

What's the one lesson you wish you could send back in time to your younger self?
How to setup an SSH tunnel on Linux and use it to connect to remote mysql server using nodejs/php 🔥
Tags: webdev, linux, tutorial, ssh
Published: 2021-03-02 23:31:52

This article is a tutorial on how to setup an ssh tunnel -and reliably ensure it's running, automatically restart it when necessary- to forward local traffic to remote destination. This works on servers running Linux and is intended to help people setup an ssh tunnel to connect to external services ie. mysql that's running on remote server. To follow along, a basic knowledge of ssh, Linux shell and cron is highly recommended.

<strong>Basics</strong>

During your programming/IT career, there is a high chance that you've already used SSH. Whether connecting to a remote server or cloning a git repository. Either way, both involving SSH on a basic level. But beyond these two uses-cases, SSH offers some others functionalities and purposes which may boost your workflow and sometimes are necessary. We are talking about SSH tunneling -aka local or remote port forwarding. In this article our main focus is the local port forwarding, especially when trying to connect from your application/script code to an external remote server; as an example, connecting nodejs script to mysql database in a remote server through ssh. Finish talking, let's get the hands dirty! <a href='https://www.azaytek.com/2021/03/linux-ssh-tunnel-nodejs-php-mysql-tutorial.html' >Read more</a>
(Javascript) My learning journey: Modules Import/Export
Tags: javascript, beginners, tutorial
Published: 2021-03-02 23:08:07

---
title: (Javascript) My learning journey: Modules Import/Export
published: true
description: 
tags: javascript, beginner, tutorial
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ik1c8mr2sz8zi3g466dq.jpg
series: (Javascript) My learning journey
---

If you want to miss nothing click follow and you are welcome to comments and discuss with me.

Without further ado here is a summary of my learning notes for today.

<h2>Modules</h2>
Modules is a reusable piece of code store into a standalone file. Putting modules together we can build a complex application.

Module in Javascript:
- All variables are scope/private to module
- To use other modules variables we need to use <i>import</i>
- To expose/share variables to other modules we need to use <i>export</i>
- Module are load in asynchronous mode
- Module always run in strict mode
- <i>this</i> keyword at top level is <i>undefined</i>

Module creation exemple (index.html)
```html
<script type="module" defer src="main.js">
</script>
```

Name Export
To use name export simple put export keyword in front of variables or functions you want to export
```js
export const message = 'Hello World'
// or after declaration
const hello = 'Hello World'
const bye = 'Bye World'
export { message, bye }
// Also possible to use alias 
export { message as msg, bye } 
```

Import
Import are not a variables copy they are live connection to that variable.
```js
// import the module 
import './display.js'
// import specific export
import { message } from './display.js'
// multiple import and alias
import { message, bye as goodBye } from './display.js'
// import all export im one object
import * as display from '/.display.js'
// use import object
console.log(display.message)
```

Default Export
```js
export default function() {
  console.log('Hello World')
}
```
Import (default export)
```js
import hello from './display.js'
```

<h2>CommonJS Module</h2>
Use in NodeJS

```js
// Export
export.display = function() {
  console.log('Hello World')
}

// import
const { display } = require('./display.js')
```
Day 320 : Next Level
Tags: hiphop, code, coding, lifelongdev
Published: 2021-03-02 22:59:53

_liner notes_:
- Professional : Built out another Web Component pretty quickly. Then I decided to add a feature, that took forever to figure out. haha It all had to deal with how and when elements were being rendered and when they are available. Got it figured out though. Works pretty well. Also got to help out a coworker with some JavaScript issues they were running into. It was a good day.

- Personal : Last night I was able to get an early basic version of the upload application I was working on. You know you are in for a treat when the APIs documentation says "requires a high level of technical proficiency to use" haha. Feels even better that I got it working. Doing some next level coding! haha I want to see if I can add uploading multiple images at a time and previews of the images about to be uploaded. Wish me luck. haha.

![Overhead view of waves crashing on the orange sands of a a beach in Santander, Spain](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/38fz5ng9obotyqlvyu31.jpg)

Made it to may parking spot. Got some food. Going to work on my upload application and maybe watch some anime.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube iKzwlSMAXEM %}
How react-native-config make my life easier to steal secret keys of your React Native Application
Tags: reactnative, security, hack
Published: 2021-03-02 22:57:39

---
title: How react-native-config  make my life easier to steal secret keys of your React Native Application
published: true
description: 
tags: reactnative, security, hack
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8wy66jf6i5dpzxfmiv1w.png
---


**1)** First, you need to find out an `applicationId` of app. It easy to use a [Google Play](https://play.google.com/store) website, just search and copy `id` in the browser

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qetes1pui46ayg374vke.png)
 
**2)** The next step will be downloading a `.apk` file (for example using an [apk-downloader](https://apps.evozi.com/apk-downloader) website)

**3)** Finally, open that `.apk` in Android Studio (Build => Analyze APK...) then need to find `resources.arsc` and select `string` in the resource types panel

You should see something like that:


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

---


> Keep in mind this module doesn't obfuscate or encrypt secrets for packaging, so do not store sensitive keys in `.env`. It's [basically impossible to prevent users from reverse engineering mobile app secrets](https://rammic.github.io/2015/07/28/hiding-secrets-in-android-apps/), so design your app (and APIs) with that in mind.
JPA, MySQL and UUIDs are not friends, apparently...
Tags: java, mysql, webdev
Published: 2021-03-02 22:53:36

Today I was being myself as usual, creating an API with a UUID as a primary key. All was well, until JPA decided it wasn't. :expressionless: 

I had created a OneToOne relationship between one entity, and my User entity ( *which had a UUID as Id* ). In my defense ( *before you start judging* ) everything was working well. However, I started getting inconsistencies.

I had a method for retrieving paginated entities, and this method started throwing some `EntityNotFound` exception! After some hours of googling what was the problem, I found a work around, which was putting a `@NotFound` on the relationship. This is ... eh ... not quite a good idea, so I decided to screw it.

That's when I discovered the problem was that JPA could handle UUIDs, but MySQL had issues. Apparently, mysql stored UUIDs as binary, and JPA was trying to search using the UUID as a string, and that wasn't working.

What I didn't get though, was why on one method it was working perfectly, but on another, being inconsistent. If there's anyone who can explain to me WTF caused this issue, please feel free to say something.
New pricing plans make Payload CMS free for personal use
Tags: javascript, webdev, node, react
Published: 2021-03-02 22:33:23

> We are announcing new product tiers—most exciting of which is that Payload CMS now offers a free Personal plan

The Payload team has taken every piece of feedback to heart since we launched. We're elated with the positive reception overall. One recurring topic has been making Payload more accessible to individual, developers; we want Payload to be an easy choice for portfolio sites and individual projects. With that, we're announcing the brand new, free-forever Personal tier.

Every solo founder is faced with a ton of decisions—most critical of all is how to best use capital. We made one decision easy. Our personal plan is a completely free option for users to have a fully featured, headless CMS, on an individual basis.

**One major benefit of using Payload is the developer experience. We wanted to extend that all the way through, including the pricing model.**

## Pricing Philosophy

As a self-hosted CMS, Payload doesn't have any business in how many user roles, content types or API requests your app handles. We don't want to take away functionality from solo developers. So, we’re launching a new and totally free **Personal** plan for individual developers that places absolutely no restrictions on what Payload features you get. It’s perfect for portfolio sites, personal projects, or APIs that will only ever have one admin panel user.

Building on that, the **Team** tier gives access to the admin panel up to five users. For larger teams we have the **Pro** option that removes the user limits entirely. With Pro, you can add as many users to enjoy the authoring experience as you wish.

See our [pricing](https://payloadcms.com/pricing) page for all the details.

## Join the discussion

Come join the Payload [discussions](https://github.com/payloadcms/payload/discussions) on Github.

**Take a moment to share with us**
Week 1 - First Week of Learning; Summary!
Tags: diary, learning
Published: 2021-03-02 22:08:23

My first week of full-time studying completed! It seemed like it was a long week, which is testament to how much new information I absorbed and new skills I put into practice. But the feeling is a positive one, it was a productive week where I learned more than I initially anticipated. 

Drawing on my abilities to grapple with new software and technologies, getting to grips with VSCode was comparatively easy compared to AutoCAD as a Landscape Architect. At the end of the week, I was already utilizing various keyboard shortcuts to increase my workflow and not touching the mouse at all, and using the split-screen editing to see the live preview. 

The Git terminal was more intimidating at first glance; the command line functionality feels like the Latin language, an older but more revered power. However, this too was short lived for by the weekend I had already learned how to move around directories, create files, initialize a repository, add, commit, and finally push/pull contents to my GitHub repository online.

Learning the basics of HTML was straight forward enough, no real problems with that. Next week I’m going to complete some intermediate and advanced learning to round it off. I don’t think there’s much more to do except keep putting it into practice, and perhaps revisit it later when learning to maximize SEO on websites. 

I implemented a few basic CSS styles in my HTML practice explorations and I’m looking forward to learning more about it this coming week. One week in and I’m already tired of HTML’s basic visual rendering – it’s like Netscape, Windows 95, and the birth of internet all over again!

The first chapter of “Pragmatic Programming” was more riveting than I expected it to be in all honesty, as I anticipated it to be dry. In fact, it was really encouraging as I realized it was conveying aspects of professionalism that I was already implementing in my previous role as a Landscape Architect, such as the “Broken Window Theory”. It seems like this book will appeal to my meticulous and consistent proclivities.

I have found two courses I aim to complete during my studies:
* Harvard’s CS50 Course
* Udacity CS101 Course

These should give a nice background of the more formal learning that comprises Computer Science degree courses, helping to round out my knowledge base (and really test my cognitive ability!).

Plenty of resources and tutorials now on my list to research and learn from, lots of post-it notes stuck to my desk, lots to be getting on with! Onwards and upwards!
100 Bytes Of Wisdom: Day 17
Tags: career, journey, advice
Published: 2021-03-02 21:58:18

---
title: 100 Bytes Of Wisdom: Day 17
published: true
description: Bytes of Wisdom is a new project by Sam Jarman that brings together snippets of advice for software engineers
tags: career, journey, advice
//cover_image: https://direct_url_to_image.jpg
---

Today we start off a series of bytes about code review, perhaps the most important process to master for a company in terms of soft and hard skills, that when done right can foster better engineers and a better codebase.

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


When writing a large, or even small feature, it's important to have the approach you're going to take - before almost any code is written - heard by and approved by a colleague or senior. That way, if you've got the wrong approach, you can adjust then and there, without having to redo a lot of coding. Once you've started on the right track, you should then review every now and then to make sure you're doing what you agreed on and you're on the right track. This will save time and stress when it comes to code review - which should really be a final check, not a first look.

This approach may sound only suitable for junior developers, by it applies to developers at all levels. You are a team working on a codebase, so don't code alone.

Heads up: As with any terse bit of advice, there will be exceptions of course, and subtleties and nuance that can't possibly be captured in a Byte of Wisdom. This has been what I've experienced, I'd love to hear yours in the comments too!

You can catch up with all the other bytes at http://bytesofwisdom.com/
Weather App
Published: 2021-03-02 21:24:15

Tuesday:
temperature: 79 degrees Fahrenheit
humidity 69%
wind speeds 12 mph

Wednesday:
temperature: 87 degrees Fahrenheit
wind speeds 17 mph
humidity 63%

Thursday:
Temperature: 79 degrees Fahrenheit
humidity 58%
wind speeds 9 mph

Friday:
temperature: 79 degrees Fahrenheit
wind speeds 10mph
humidity 58%
The Overwhelmed Developer!
Published: 2021-03-02 21:19:20

Reading this site and Twitter you'd be right to think that being a developer is not a job but a lifestyle. That you can't progress unless you are involved in social groups, talks, podcasts, books, twitter communities and so on and so forth. But don't buy into this idea that you wont succeed unless you have all of the above. Dev Burnout is real, and trust me I feel it from time to time. It's enough to just try and keep up with the changing landscape of what we do, let alone be part from some new group that spreads love about a new stack or framework. 

I'm not saying don't be involved but make sure you do so whilst maintaining a work life balance. See after 20 years in this industry that is the most important part of the job. Being a developer is fun, and massively fulfilling, like know other job if you love what we do, but so is life. I hope in this current world we really have worked out what is most important to us all and that we take a moment to look away from the screens and look out the window. 

Right now I have a demanding senior developer role, I work 50 plus hours a week, I have a new site ready to launch next week and another that I have just started, on top of all that Im moving house and trying to learn Vue 3. I feel that burnout coming, see when I burnout I shut down, I literally have to not look at code and I have to move away from any screens and dive into a comic book or some music. Managing it is easy but it creeps up on you when you try and do too much. So all Im saying is find work and life balance, do not buy into the fairy tale that the social life gives us. 

But most of all, enjoy it all.
New: VS Code and Atom sections!
Tags: vscode
Published: 2021-03-02 20:57:27

Recently we added 4 new sections to Simple Dev: [VS Code Basics](https://simpledev.io/vscode/vscode-basics/), [VS Code Tips](https://simpledev.io/vscode/vscode-tips/), [Atom Basics](https://simpledev.io/atom-text-editor/atom-basics/), and [Atom Tips](https://simpledev.io/atom-text-editor/atom-tips/).

Technically speaking, these are not brand new sections. Previously, we had 2 sections that already covered VS Code and Atom: Text Editor Basics and Text Editor Tips. Each tutorial in those sections covered how to perform a certain action in both VS Code and Atom. However, we felt that now was a good time to split those tutorials up so that VS Code users could focus on their content and Atom users could focus on their own content.

The hope is that now we can add more tutorials on VS Code with this new structure. Acccording to the [Stack Overflow 2019 Developer Survey](https://insights.stackoverflow.com/survey/2019#development-environments-and-tools), VS Code is the most popular developer tool, and it's much more popular than Atom. Because of those facts, we feel that we should focus more on VS Code for now (although we may add some new Atom tutorials here and there).

One of our goals with Simple Dev is to teach developers how to code locally on their own devices, so these are very important sections to us. Not every course spends time explaining how to use a text editor. We pride ourselves in teaching coders how to code from the very beginning, starting with how to use a text editor.

If you have any questions or suggestions, leave a comment below!
Finding dev job as junior
Published: 2021-03-02 20:38:46

I don't know how long this situation will go. after I got bachelor of civil and working for more than 2 years, I got really frustrated of filling the excel shits... just tedious, meaningless works. I migrated to another country from Iran. I started learning front-end. It was hard, but I did my best during these couple months of luck-down. till now I have learned html,css, JS(not fully) and basics of react and its hooks. I applied for dozens of jr front-dev works but I got zero responses. They're all require 2,3 years of experience, at least. HOW AN ENTRY LEVEL DEV COULD HAVE 2 YEARS OF EXPERIENCE???