teleren/devto huggingface dataset:
#8 of 100DaysOfCode 
Tags: 100daysofcode, react
Published: 2021-04-19 14:28:32

Eighth Day,
Today I am revisiting react states in greater detail.

And here is what I have learned so far.

#Eight ways to handle state in a React application

### URL
* Current app. location/settings.
* Enables support for deep linking.
* Avoids redundantly storage of data in your beautiful app.
* 3rd Party Enhancement - React router

### Web Storage
* To persist states between reloads.
  + Cookies
  + Locale
  + IndexedDB
* ⚠ *Watchout* !!!
  + Tied to a single browser - i.e. If the same app. will be accessed from a different browser then you have to again store all the data. (we all are familiar with cookies, right!)
  +  Avoid storing sensitive data.
* Use Cases
  + Items in a shopping cart.
  + Partially filled form data.

### Local State
* Store state inside a React component. (used when a component needs it)
* Use Cases
  + Forms
  + Toggles
  + Local lists

### Lifted State
It's literally what its name says. When a state is used by multiple components then we just lift a state to common parent and pass'em down via props.

### Derived State
* Derive state from existing states/ props.
* Example: Like using Array.length rather than assigning a length of the list to a new state variable.
* That was a simple example but what derived states?
  + Not because it makes code "slick" but to simplify code and avoid **sync bugs**.

###Refs
* The DOM reference 
  + For uncontrolled elements like inputs and other components where React don't control their properties
  + Interfacing with non-react libraries.
* State that isn't displayed
  + Like to track if a component is mounted or not.
  + Hold timers.
  + Store previous state values **(Helps in making features like undo and redo)**

###Context
{% post https://dev.to/icecoffee/7-of-100daysofcode-2lbi %}
* Yep, the same thing that I mentioned the day before.
* Global/ broadly used state and functions.
  + Avoids prop drilling
* Use Cases:
  + Login key of the user.
  + Authorization settings.
  + Theming
  + Internationalization settings

### Third Parth States
* Handling state via third parties to make life chill.
* General Options:
  + Redux
  + Motex
  + Recoil
* Remote State:
  + SWR
  + Relay ---|--Both of them goes well with GraphQL
  + Apollo --|

Yep and that's all for today. 
I wasn't able to do enough today but I am working on it.

I'm sure most of you guys have used them before and this is just a general classification of possible use cases but since we are developers, innovation is in our middle name.😄
You know what I'm saying. 
  
If anyone wants to suggest some more use cases or any add on's or if there are some mistakes in the post, please let me know.
I'll really appreciate that.

Thanks for reading it.😊
Have a beautiful day.🌷
Codesphere vs. GitHub Codespaces: What's the Difference?
Tags: codequality, github, vscode, webdev
Published: 2021-04-19 14:28:10

>As we were recently asked how Codesphere differentiates itself from Codespaces, an online editor for Github, we thought we could help clear some things up. If you were ever wondering what makes Codesphere unique, continue reading to find out. 

**Codespaces** is an online code editor powered by VSCode specifically designed for Github. With the click of a button directly in your GitHub repository, it starts a remote VM, downloads the code, and lets users edit it with a special version of VSCode, which can be used from the browser.

This is really useful for making quick changes in some repo without the entire setup on your laptop, but it is still limited by the resources of the remote VM and does not solve the complexity of getting a user’s app live.

**Codesphere on the other hand aims to provide a much simpler experience compared to today's cloud providers while giving the opportunity to ad-hoc code in your browser**. 

The idea behind **Codesphere**  builds on a paradigm shift: Instead of creating apps on your computer and deploying them to a totally different infrastructure (e.g. AWS), you can now create the apps, using Codesphere’s web IDE, in the same environment in which you will run them in production.

Combined with our new distributed architecture, you can now use the power of the full cloud even while you are still coding (e.g. to run builds on hundreds of VM’s or seamlessly switch between dev and prod). Development is always tested and online alongside production. Neither deployment nor git is needed and the application scales automatically. 

Starting up with **Codesphere** is effortless as it provides you with everything needed to change the deployment or even take out the code without any lock-in. On the other hand, if you prefer your local VSCode, you can just mount the remote file system and work with that, getting the best of both worlds. We make scalable infrastructure easy to deploy and make starting up projects a lot faster, regardless if you are a single developer or a team. **Codesphere**  grows with you, from your very first experiments to building the next Spotify or Youtube. 

While there are really great tools out there, we felt there is a gap in the market when it comes to creating scalable apps, and this is why we created **Codesphere**.
A Better Way to Deploy Rails app on Heroku
Tags: rails, heroku, note
Published: 2021-04-19 14:27:55

> Time: 2021-04-03 23:44 UTC+8:00

> Author: vonhyou



This article introduces the professional way of deploying Rails app on Heroku.



## Force SSL

Modify the file `config/environments/production.rb` in your Rails app:

```ruby
# Uncomment this 
config.force_ssl = true
```

Heroku provide free ssl certificate and it's not necessary to do something else.



## Switch to Puma

1. Add a gem called `puma` to the `Gemfile` and install it. 
2. Rewrite the file `config/puma.rb`

```ruby
# Puma configuration file.
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count
port        ENV.fetch("PORT") { 3000 }
environment ENV.fetch("RAILS_ENV") { ENV['RACK_ENV'] || "development" }
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
workers ENV.fetch("WEB_CONCURRENCY") { 2 }
preload_app!
plugin :tmp_restart
```

3. Create `Procfile` 

```bash
$ touch ./Procfile
```

4. Write `Procfile`

```ruby
web: bundle exec puma -C config/puma.rb
```

5. Configurate database for production

```yml
# SQLite. Versions 3.8.0 and up are supported.
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
#
default: &default
  adapter: sqlite3
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

development:
  <<: *default
  database: db/development.sqlite3

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  <<: *default
  database: db/test.sqlite3

production:
  adapter:  postgresql
  encoding: unicode
  pool:     <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  database: <APPNAME>_production
  username: <APPNAME>
  password: <%= ENV['<APPNAME>_DATABASE_PASSWORD'] %>
```

## Declare Ruby Version

Modify `Gemfile`

```ruby
ruby '2.6.5' # your version
```
Update Essential Phone ph-1 to LineageOS 18.1
Tags: android, lineageos
Published: 2021-04-19 14:25:17

> Time: 2021-04-03 23:44

> Author: vonhyou


In this article, we will install LineageOS 18.1 (Android 11) on Essential Phone ph-1(mata)

## Preparation

1. Download [Android SDK Platform Tools](https://developer.android.com/studio/releases/platform-tools) for your system.

2. Unlock the bootloader

```bash
$ adb reboot bootloader
$ fastboot devices
$ fastboot flashing unlock
```

3. Download recovery, system

Official Website: [download.lineageos.org/mata](https://download.lineageos.org/mata)

4. Download Gapps and Magisk(Optional)

Mind the Gapps: [Official website](https://wiki.lineageos.org/gapps.html)

Magisk: [Official website](https://magiskmanager.com) [Github](https://github.com/topjohnwu/Magisk/releases)



## Flash Recovery

```bash
$ adb devices
$ adb reboot bootloader
$ fastboot devices
$ fastboot getvar current-slot
# Remember the current slot for next step
$ fastboot flash boot_SLOT <filename>.img
# If the current slot is _a, you should use boot_a
```

**Error: fastboot: error: Couldn't parse partition size '0x'**

If this error occurred, you should use command below

```bash
$ fastboot flash:raw boot_SLOT <filename>.img
```

and then next:

```bash
$ fastboot set_active other
```

Reboot to recovery.



## Sideload LineageOS

0. Tap **Factory Reset**, then **Format data / factory reset** and continue with the formatting process. This will remove encryption and delete all files stored in the internal storage, as well as format your cache partition.

1. Select “Apply Update”, then “Apply from ADB” to begin sideload.
2. Sideload 

```bash
$ adb sideload <filename>.zip
```

If the process succeeds the output will stop at 47% and report `adb: failed to read command: Success`



## Sideload Other packs

1. Reboot to make sure your system is installed correctly
2. Reboot to recovery mode 
3. Sideload packs like before

```bash
$ adb sideload <mindthegapps>.zip
$ adb sideload <magisk>.zip
```

**Error: Zip Signature Verification failed**

Just ignore it.



## References

1. Install LineageOS on mata. [wiki.lineageos.org](https://wiki.lineageos.org/devices/mata/install)
2. Mata readthedocs. [mata.readthedocs.io](https://mata.readthedocs.io/en/latest/)
3. XDA Guide. [How to Install TWRP & Root Essential PH-1(Method 2)](https://forum.xda-developers.com/t/guide-how-to-install-twrp-root-essential-ph-1-method-2.3841922/)
Discover DevUtils.app – Toolbox for Developers
Tags: utilities, devutils
Published: 2021-04-26 14:20:09

---
title: Discover DevUtils.app – Toolbox for Developers
published: true
date: 2021-04-19 14:15:42 UTC
tags: Utilities,DevUtils
canonical_url: 
---

I love finding great tools that solve problems I face everyday. I came across the [DevUtils.app](https://devutils.app/) recently which is a toolbox with lots of tools to make our day better.

![CleanShot 2021 04 18 at 20 58](https://accidentaltechnologist.com/wp-content/uploads/2021/04/CleanShot-2021-04-18-at-20.58.png "CleanShot 2021-04-18 at 20.58.png")

I’ve made use of several of these and it works great. 

The list of tools is pretty broad and I can imagine the author adding more to the toolbox as time goes on.

The toolbox is not free, $25 for use on two Macs. Seems like a bargain. I found the [source code is available too](https://github.com/DevUtilsApp/DevUtils-app) but I hope is if you find value, you support the author. As developers we know how much time it takes to create and support a nice piece of software.

The post [Discover DevUtils.app – Toolbox for Developers](https://accidentaltechnologist.com/utilities/discover-devutils-app/) appeared first on [Accidental Technologist](https://accidentaltechnologist.com).
Top Seven Project Management Issues Solved by the Right Tools
Published: 2021-04-19 14:10:25

Top Seven Project Management Issues Solved by the Right Tools
Project Management Software
What is better than on-time and successful completion of projects for a company? But, on the other hand, if a project fails, it impacts negatively on the entire company. Therefore, it is inevitable for project managers and teams of employees to put all effort to avoid any grave mistakes that lead to project failure. 

In this article, we are going to discuss the top seven project management issues that you need to solve by using the right tools. 

Seven Frequently Occurring Errors that Right Tools can Fix
Every project is unique and with different requirements. You can accomplish it either by using a traditional Waterfall Model or an Agile way, or in a combination of both these methods. They can be either small or big, and complex or lengthy. Therefore, there is no one-size-fits-all solution for it. Let’s discuss the seven most prevalent issues related to project management. 

1. Lack of Motivation
What if your team members are not motivated when you are ready to kickstart the project? Unhappy team members who always come late and work on the project for the sake of working are major hurdles in the way of successful project completion. Their negative attitude can cost your project and company high as you may miss the deadline or suffer a setback in the product performance. 

As a project manager, you need to address this issue as soon as possible to avoid any poor and unwanted results. The motivation matrix tool can be useful to address this issue effectively. It assists you to evaluate the most suitable form of motivation for every team member. All you need to find answers to two questions-

– Why does the employee remain unmotivated? 

– How can I motivate the team members in a positive way?

Original Source: https://www.taskopad.com/blog/seven-project-management-issues-solve-with-tools/
Experience unlimited superfast internet services in Panjim with DNAGOA Services

Tags: internetserviceprovidder, wifi, internetserviceprovideringoa
Published: 2021-04-19 14:06:20

The Internet has become a very vast network which is having a lot of benefits like staying in touch with people, paying the bills, spreading important information etc. You can experience the unlimited superfast internet speed services with DNA GOA ultimate plans and much more, also provides internet services in panjim. Its Speeds ranging from 2.5 Mbps to 20 mbps can be availed for 1,3,6 and 12 months under these ultimate plans. DNA Goa is ranked as the best internet service provider in Goa, delivering the high speed Broadband plans at an affordable cost. It also provides various services such as Home broadband, Enterprise broadband, Leased Line Services etc. Go through www.dnagoa.com for more information.
J.K. Rowling & blog by a "developer"?
Tags: testing, agile, watercooler, 5days5blogposts
Published: 2021-04-19 13:55:52

**I became a software tester in 2014, with no technical background**. 
I studied literature, languages and teaching. I'm pretty sure that lack of _any_ engineering degree is the pure reason for my [impostor syndrome](https://en.wikipedia.org/wiki/Impostor_syndrome) (yes, it's *7 years later* and I'm **still** dealing with it).

**Since I don't have that much experience with Markdown editor**, while writing this post, I wanted to add the link above and test, if it works. 
The link did not open in the new tab/ new window. It did not work, because I somehow forgot the colon. When I pressed *Back* in the browser, being used to working on Google Drive or Sharepoint, I discovered that the draft of *my first blog post* was not automatically saved... so I had to start writing it again.

**Instantly, I thought about J.K. Rowling** - author of the best selling series of books of our century - **_Harry Potter_** - and her four-hour delayed train trip from Manchester to London in 1990. The idea *came fully formed* into her mind for a story of a young boy attending a school of wizardry. She didn't have any pen and notebook, so she had to think about items and characters, and just remember. When she reached her flat, she began to write immediately. She later said: 
> _I couldn't write it all down, so I had to think about it. And I think it is good. **Back then, on this train, I had a lot of details on my mind, so if I didn't remember them, they probably weren't worth it.**_<sup>1</sup>

My mind works in mysterious ways. So, **why starting a *dev.to* blog when being a ~~_manual_~~ software tester?**

**Lisa Crispin** and **Janet Gregory** in their extensive book on agile testing define the testing role as follows:
>[...] we use the term **_tester_** to describe a person whose main activities revolve around testing and quality assurance. [...] We often use the word **_programmer_** to describe a person whose main activities revolve around writing production code. We don't intend that these terms sound narrow or insignificant. Programmers do more than just turn specification into program. We don't call them developers, because **_everyone involved in delivering software is a developer_**. Testers do more than just perform testing tasks.<sup>2</sup>

So... **why not?** :)

**How do _you_ define the roles of programmer and tester?** Share it in the comment :)

***

<sup>1</sup>L. Fraser. *Conversations with JK Rowling*.
<sup>2</sup>L. Crispin, J. Gregory. *Agile Testing: A Practical Guide For Testers And Agile Teams*.

*PS. When I finished this draft, I noticed, that you can see the first, _supposedly unsaved_, draft when you press the button "Write a post" in the menu on top. 
The saved one is in your Dashboard. Bug?*
Remove .DS_Store File from Git Repo
Tags: git, macos
Published: 2021-04-19 13:43:36

> Time: 2021-03-31 08:43 UTC+8:00

> Author: vonhyou



`.DS_Store` is a file that stores custom attributes of its folder (like icons).  `.DS_Store` is a abbr. of  *Desktop Service Store* .  This file is similar to the `desktop.ini` in Windows OS. So that, it's not necessay to add this file into a git repo. Let me tell you how to remove it by adding `.gitignore` rules.



> 1. If you had already add `.DS_Store` files into a git repo, you have to delete it using command below:

```bash
$ find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
```

> 2. Append a rule to `.gitignore` file

```bash
$ echo .DS_Store >> .gitignore
```

> 3. Update repo

```bash
$ git commit -am "remove .DS_Store files"
```



If you don't want to repeat it, it's possible to set this rule globally. 



> 1. Creat a new file called `.gitignore_global` (or any other you like )

```bash
$ touch ~/.gitignore_global
```

> 2. Assign this file as a global rule set

```bash	
$ git config --global core.excludesfile ~/.gitignore_global
```

> 3. Add the rule to `.gitignore_global`

```bash
$ echo .DS_Store >> ~/.gitignore_global
```



Done.
Titan, Fear of Success, frontend practice, Defi and free APIs
Tags: react, node, blockchain, programming
Published: 2021-04-19 13:40:37

Greetings..

Every Monday Morning I publish my newsletter/Blog. Throughout the week I try to gather some useful links and post them in a specific format and I believe this would help my readers and the community.

Read about this week's newsletter by clicking this link or using the below URL:

https://gokhale.me/titan-fear-of-success-frontend-practice-defi-and-free-apis
Don't underestimate development time.
Tags: webdev, devjournal
Published: 2021-04-19 13:36:54

Hi there, dev.to! 👋

I was supposed to launch my side project 20 days ago. I think you can see where i'm going with this, but long story short, i'm falling short of that promise. 

A little background: I'm a designer who's working on a side project with a developer friend. We started around early February and estimated that we would be able to launch by the end of March. 

Everything was going great, we wrapped up development and pushed to Netlify to test it out with a few users who have signed up to our waitlist. _Except:_

1- We use Github login, we completely forgot the permissions to be read-only. Lots of users pointed that out.

2- Edge cases for subscriptions were not handled properly. 

3- Some edge cases for our downloadable templates required design modification, so back to the drawing board we went.

4- Some of the templates were missing files (woops).

5- Solutions/comments showed the wrong timestamps. 

There's a ton of bugs that showed up during early user testing which if you think about it, isn't that bad. We avoided what could have been a disaster if we launched. 

The point is, we thought if we wrap up development, that's the project. User testing was always going to be after we launch and receive feedback from _actual users_, thankfully we did not go that route and it ended up to our advantage, but it's back to development for us.

I'm building this project in public on [Twitter](https://twitter.com/MamdouhMoemin) if you'd like to follow me on the journey :)
Migrate My Blog to dev.to
Tags: blog
Published: 2021-04-19 13:36:27

After wandering between different blog solutions, I tend to look for a stable platform to ensure that I am actually writing articles instead of writing blog framework or something.

About a month ago, I made a beautiful(maybe) prototype of my dream blog, and plan to implement it by Rails in six months. But the development process killed my interest, and made me realize how great a full-stack engineer really is.

Fortunately I learned a lot during the development process and accumulated a lot of articles, not just focus on Rails or ruby. Although some of the articles doesn't fit well on dev.to -- a platform where developers gather, I still want to use it to archive my words (I'll make sure that they'll not violate community rules)

As for that project ([toreality](https://blog-tr.herokuapp.com)), I choose to forget about it for the time being and wait until I have enough time and knowledge before making a decision.

The last word:

```ruby
puts 'hello, dev.to!'
```
Spring Data Redis CRUD Operations example with Spring Boot
Tags: springboot, springdata, crud, redis
Published: 2021-04-19 13:26:16

https://grokonez.com/spring-framework/spring-data/spring-data-redis-example-spring-boot-redis-example

Spring Data Redis CRUD Operations example with Spring Boot

Redis is an open-source, in-memory key-value data store, used as a database, cache, and message broker. In this tutorial, we're gonna look at how to do Redis CRUD Operations with Spring Boot using Spring Data Redis.

Related Post: <a href="https://grokonez.com/spring-framework/spring-boot/spring-data-redis-messaging-pubsub-spring-boot-spring-data-redis-example">Spring Data Redis Messaging – PubSub example | Spring Boot</a>

<!--more-->
<h2>I. Technology</h2>
- Java 1.8
- Maven 3.3.9
- Spring Tool Suite – Version 3.9.0.RELEASE
- Spring Boot: 1.5.9.RELEASE
<h2>II. Spring Data Redis</h2>
<h3>1. Maven Dependency</h3>
<pre><code class="language-html">&lt;dependency&gt;
	&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
	&lt;artifactId&gt;spring-boot-starter-data-redis&lt;/artifactId&gt;
&lt;/dependency&gt;</code></pre>
<h3>2. Redis Configuration</h3>
We use Jedis as a Redis client to define and establish the connection between our Spring Boot application and the Redis server instance.
<pre><code class="language-java">@Bean
JedisConnectionFactory jedisConnectionFactory() {
	return new JedisConnectionFactory();
}

@Bean
public RedisTemplate&lt;String, Object&gt; redisTemplate() {
	final RedisTemplate&lt;String, Object&gt; template = new RedisTemplate&lt;String, Object&gt;();
	template.setConnectionFactory(jedisConnectionFactory());
	template.setValueSerializer(new GenericToStringSerializer&lt;Object&gt;(Object.class));
	return template;
}</code></pre>
If we wanna configure connection details, just modify the jedisConnectionFactory configuration:
<pre><code class="language-java">
@Bean
JedisConnectionFactory jedisConnectionFactory() {
    JedisConnectionFactory jedisConFactory = new JedisConnectionFactory();
    jedisConFactory.setHostName("localhost");
    jedisConFactory.setPort(6379);
    return jedisConFactory;
}</code></pre>
<h3>3. Redis CRUD Operations with RedisTemplate</h3>
<code>RedisTemplate</code> provides <code>DefaultHashOperations</code> instance that can do hash-related operations for data manipulation.
To get <code>DefaultHashOperations</code> instance, we call <code>RedisTemplate.opsForHash()</code>:

More at:

https://grokonez.com/spring-framework/spring-data/spring-data-redis-example-spring-boot-redis-example

Spring Data Redis CRUD Operations example with Spring Boot