teleren/devto huggingface dataset:
How to create and delete a folder in Python using Pathlib?
Tags: python, automation
Published: 2022-01-21 10:27:59

![Pathlib in Python](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hr6du3xc14crxeyqvnnj.png)
 
## Folder Manipulation

These are the codes that I'm implementing for creating and deleting a folder.

What I like with Python for automating stuff is the language simplicity. With a few lines of code, you can do amazing things. I can also use PowerShell scripts, but I like writing cross-platform scripts or applications wherever possible.

This time I'm not using a class but calling the functions directly, as I see the case in many examples on YouTube tutorials. Perhaps that's more efficient for quick and dirty ad hoc projects.

## Box

For the name, I choose Box as a synonym to file because it might be confusing. I'm already using files classes or modules from libraries such as pathlib. So this is a good way to keep things simple with the naming.

The aim is this code is to:

- create a "posts" folder
- place the number of transformed posts
- zip the folder
- delete the "posts" folder

I've yet to test the whole flow due to a lack of time.

When dealing with OS and external operations such as API calls, I like using `try except` in any language I'm coding with.

The reason is so that I can better track these types of errors and plan a countermeasure for them, such as retrying.

This makes the programs more resilient. On the other side, I also want in most situations that the script completely stops. For instance, if there is no Ghost JSON file in my current side project, there is no point in continuing.

## Codes

box.py

```python
from pathlib import Path

def folder_exists(folder_name):
    return Path(folder_name).is_dir()

def create_folder(folder):
    try:
        if not folder_exists(folder):
            Path(folder).mkdir(parents=True, exist_ok=True)
    except OSError as e:
        print(f"Error: {e.strerror}")

def delete_folder(folder):
    try:
        if folder_exists(folder):
            Path(folder).rmdir()
    except OSError as e:
        print(f"Error: {e.strerror}")

def sync_folder(folder):
    delete_folder(folder)
    create_folder(folder)

def zipFolder():
    return None
```

main.py

```python
folder_name = "posts"
box.sync_folder(folder_name)
```

There are two ways of writing codes in my opinion:

1. Typing the flow in a single function and then refactoring into relevant classes/methods/functions (if needed)
2. creating the classes/methods/functions first (you can even write their unit tests) and then stitching everything together

In this case, I choose the second variation as it's easy to progress with the project with one quick file at a time. I also like the abstraction.

I would nevertheless recommend, especially if you're still learning the language or the programming stack, to do it as simple as possible. This is how I usually proceed when working on Java or C# for enterprise systems.

This is the whole [repo](https://github.com/abdallahYashir/GhostToHashNode).

---
The 15 Must-Read Remote Work Blogs for a Great Remote Career

Tags: remotework, wfh, blogs
Published: 2022-01-21 10:22:19

Imagine this: You are sitting on a lounge chair at a beach shack as the light breeze at dawn gently brushes against your face, disheveling your hair while the sound of waves rushing to the shore lulls you into a state of Nirvana. 

With your sunglasses on, iced coffee in your hand and lo-fi music playing in the background, you swift back into work mode as the beautiful sunsets into the horizon. 

Sounds like a dream, right? 

Thanks to our dear friend, the internet, this dream is becoming a reality now. 

Worldwide connectivity and technological advancements have opened up new possibilities in terms of work. 

The traditional system of travelling to the office is shattered by the leisure of [remote ](https://remoteverse.com/blogs-on-freelancing/)working from anywhere you want in the world. 

With the onset of Covid, remote work has seen a massive boom as more and more companies are shifting to work from home setup. 

This has made people realize that their work can be performed from anywhere in the world as the veil of the necessity of work from office has been lifted. 

Travelling to exotic hidden locations that are yet to be commercialized, enjoying the serenity and tranquillity of a mountainside cabin or the breezy vibes of a beachside villa while making enough dough to sustain this lifestyle has become a reality for numerous people now. 

Although remote work is a lucrative option with more and more people shifting towards it, it does come with its share of downfalls that can cost you your livelihood if not kept in check. 

With all this jazz surrounding it, sometimes it gets challenging to keep track of time. 

Next thing you know, you are throwing your phone in the garbage to avoid that scary ringing tone of your bosses’ repeated calls. 

Hence, we’ve curated a list of remote work blogs that will help you adjust to this lifestyle in no time. 

These remote work blogs are filled with tips, tricks, [software ](https://remoteverse.com/notion-alternatives/)recommendations, and more that will help you maintain an optimum work-life balance in your remote work journey. 

## The 15 Must-Read Remote Work Blogs for a Great Remote Career in 2022

Here’s our list of the 10 Best remote work [blogs](https://remoteverse.com/remote-work-blogs/): 

1. WeWorkRemotely
2. RemoteYear
3. Coworkaholic
4. Remote.co
5. NomadicMatt
6. Remotive.io
7. Nodesk.co
8. Blog.Trello.com
9. Shut Up and Go
10. Hubspot Blog
11. Remote-How
12. Hobo With a Laptop
13. WorkfromHomeHappiness
14. Home Office Life
15. Out of Office Gal
Zsh/Zimfw: Fix bug prompt-pwd
Tags: ubuntu, tutorial, zsh, zim
Published: 2022-01-21 10:19:30

# Ubuntu
**1. Open `.zimrc` in Home**

**2. Paste these lines**
```
zmodule prompt-pwd
zmodule git-info
```

![Those 2 lines in .zimrc file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zgz0klhsmy2zdcpeecd3.png)
 

**3. Save**
There are a few things that can be done to improve responsiveness:
Tags: webdev, css, productivity, codenewbie
Published: 2022-01-21 10:12:48


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wggswt620c32urwpdoq1.jpg)

1. CSS3 effects such as transforms and transitions to make elements more responsive.

2. Use a responsive grid system to layout your content.

3. Percentages and ems instead of pixels for font sizes and other measurements.

4. Flexible or responsive images that will resize as the screen size changes.

5. Use media queries to target different screen sizes and resolutions.
I’m a release manager for PHP 8.1!
Tags: php
Published: 2021-05-09 18:58:14

> My permanent blog at [benramsey.com](https://benramsey.com) is in a state where I am unable to update it. It’s a long story that involves versions of Ruby gems removed from the repository, trapping me in a tangled web of [Jekyll](https://jekyllrb.com) dependency hell, and I haven’t had the stomach to unravel it. In the meantime, I’ll be posting here at [dev.to/ramsey](https://dev.to/ramsey).

Last year, I tossed my hat in the ring to volunteer as a release manager for PHP 8.0, but I lost the vote to [Gabriel Caruso](https://github.com/carusogabriel), who has shown himself to be a very capable RM for the 8.0 series (congrats, Gabriel, and great work!). This year, when [Sara announced the RM selection process](https://externals.io/message/113334) for PHP 8.1, I almost decided against volunteering, but I finally decided to go for it, and I’m glad I did.

Each set of release managers is usually comprised of a veteran RM and a rookie. This year, when [Joe Watkins](https://twitter.com/krakjoe) volunteered as the veteran RM, he asked to take on two rookies. As a result, [Patrick Allaert](https://github.com/patrickallaert) and I were [both selected as rookie RMs for the 8.1 series](https://wiki.php.net/todo/php81).

PHP release managers manage the release process, create a roadmap for the release, facilitate discussions and decisions about what goes into a release, package the releases, etc. It’s a commitment of about three-and-a-half years, as they shepherd their minor version from alpha to beta to RC to GA to active support to security support and, finally, end-of-life. The [supported versions](https://www.php.net/supported-versions.php) page at php.net provides a good overview of this cycle.

You can read more about the PHP release process here:

* [Request for Comments: Release Process](https://wiki.php.net/rfc/releaseprocess)
* [PHP release process](https://github.com/php/php-src/blob/master/docs/release-process.md)

Additionally, [Eric Van Johnson](https://twitter.com/shocm) has published a three-part interview in *php\[architect\]* magazine with PHP 8.0 release managers Sara Golemon and Gabriel Caruso. They go into a lot of the specifics.

* [Community Corner: PHP 8 Release Managers: Interview with Sara Golemon and Gabriel Caruso, Part 1](https://www.phparch.com/article/community-corner-php-8-release-managers-interview-with-sara-golemon-and-gabriel-caruso-part-1/)
* [Part 2](https://www.phparch.com/article/community-corner-php-8-release-managers-interview-with-sara-golemon-and-gabriel-caruso-part-two/)
* [Part 3](https://www.phparch.com/article/community-corner-php-8-release-managers-interview-with-sara-golemon-and-gabriel-caruso-part-three/)

Thank you so much to everyone for entrusting me to serve as one of the release managers for  PHP 8.1! I look forward to working with Joe and Patrick over the next three-and-a-half years.
Mobile App Developers 
Published: 2022-01-21 10:01:47

Hello , am hiring 2-3 mobile app developers for an upcoming huge social median app project , if you are keen , contact me or send me a private msg on my telegram @Nabeelxo or contact me on my email at nabeeloptic@gmail.com about your name , where your from , whats ur experience with app development and what coding languages are you familiar with.
How to Build Minimum Viable Persona to Filter User Needs for MVP Software Development?
Published: 2022-01-21 09:50:54

MVP software development is an effective way to get the product to the market. It helps the team by validating the product assumptions and assessing users’ behavior towards features that would add value. Considering the example of a B2B audience, building a user persona clarifies which product will work best for which industry. Further, user personas can help in selling the story of the product as they inspire empathy for the customers. 

![MVP Software Development Services to Filter the Actual Needs of the User](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jr1an7sebq7px5wne64u.jpg)

**Steps to Build a Minimum Viable Persona**

The rationale behind building a persona is to cover the process from research to the development of a product that will resonate with the target audience. The core areas to be considered are:

- Finding Users
- Building a Hypothesis
- Verification
- Finding Patterns
- Constructing Personas
- Defining Situations
- Validation and Buy-in
- Dissemination of Knowledge
- Creating Scenarios
- On-Going Development

![Build a Minimum Viable Persona](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dyltx1vfbmpd0iai228i.png)
Note: These steps need not be followed in a project if the team is aware of the outlines and consequences.

So, just like Minimum Viable Product, Minimum Viable Persona brings the most actionable information about users to the fore by fictionally representing different user types. Seeing how users react helps funnel features for future iterations of the MVP software development. 

For more insights, read our blog “[How MVP Development Filters User Needs](https://dzone.com/articles/how-does-mvp-development-filter-user-needs).”
YOU SHOULD REMEMBER THESE ADVICES
Tags: motivation, codenewbie, career
Published: 2021-05-09 23:56:49

As a programmer you should take note of these simple but very important things or you will feel bad or noob.

1) Master the basics.

2) First solve a problem, then code.

3) Practice consistently, Build Projects.

4) Join an online developer community.

5) Use tools to save time.


Give a reaction. Something in your mind? Comment.
How to Lazy Load Images using JavaScript
Tags: javascript, css, lazyload, webdev
Published: 2022-01-21 09:41:03

<b>Explained</b> how to implement Lazy Loading of Images using JavaScript.
🔥🔥🔥🔥🔥🔥🔥
Timeline :
00:00 Teaser
00:15 Defining Markup Setting datasrc
02:25 implement Lazy Loading
05:50 Define Threshold to see lazy loading effect
06:20 Applying Lazy Loading to All Images
07:40 Adding Blur Effect
10:50 Behind the Scenes
11:19 Unsubscribing or UnObserving

{%youtube rENxM-2Ek9E%}
How to turn on Rails 7 framework defaults (part 1)
Tags: rails, webdev, tutorial
Published: 2022-01-21 09:39:06

This tutorial inspects turning on each setting of `new_framework_defaults_7.0.rb` file. The intended goal is to fully migrate to Rails 7's default set-up.

1. [button_to_generates_button_tag](#1-buttontogeneratesbuttontag)
2. [apply_stylesheet_media_default](#2-applystylesheetmediadefault)
3. [verify_foreign_keys_for_fixtures](#3-verifyforeignkeysforfixtures)

---

## 1. button_to_generates_button_tag
```rb
Rails.application.config.action_view.button_to_generates_button_tag = true
```

### What
The __button_to__ helper had inconsistent behaviour. [Rails PR](https://github.com/rails/rails/pull/40747).
- string argument: `<input type="submit">`
- block argument: `<button type="submit">`

```rb
# 'new' is the string argument
<%= button_to "New", new_task_path %>
```

### Before
```erb
<input type="submit" value="New">
```

### After
```erb
<button type="submit">New</button>
```

---

## 2. apply_stylesheet_media_default

```rb
Rails.application.config.action_view.apply_stylesheet_media_default = false
```

### What
A `stylesheet_link_tag` can specify a [media type](https://developer.mozilla.org/en-US/docs/Web/CSS/@media#media_types). When omitting a media attribute, `screen` is no longer set as the default media value [Rails Guide](https://edgeguides.rubyonrails.org/configuring.html#config-action-view-apply-stylesheet-media-default).

```erb
<%= stylesheet_link_tag "application" %>
```

### Before
```html
<link rel="stylesheet" href="...css" media="screen">
```

### After
```erb
<link rel="stylesheet" href="...css">
```

---

## 3. verify_foreign_keys_for_fixtures
```rb
Rails.application.config.active_record.verify_foreign_keys_for_fixtures = true
```

### What
Ensures all foreign key constraints are valid after fixtures are loaded in tests. [Rails PR](https://github.com/rails/rails/pull/42674?hmsr=joyk.com&utm_source=joyk.com&utm_medium=referral)

### Before

```rb
# test/fixtures/parrots.yml
george:
  name: "Curious George"
  pirate: redbeard

# test/fixtures/pirates.yml
blackbeard:
  name: "Blackbeard"
```

Fixtures can refer to a missing association.
`parrots(:george).pirate` will be `nil`

### After

An error is raised when fixtures are loaded in tests.
`"Foreign key violations found in your fixture data. Ensure you aren't referring to labels that don't exist on associations."`
postman vs hopscotch
Published: 2022-01-21 09:16:06

I am trying out hopscotch for the first time. Yes I heard it right. It's so light.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8gptyg32yt27gv28d9vk.png)
But don't know why the tool  is giving me a 404 for google.
Deploying a WordPress Website in AWS using EC2 and RDS
Tags: aws, ec2, rds, wordpress
Published: 2022-01-21 09:01:54

Hello! If you're here to get a feel of AWS and its commonly used services, you are in the right place! This guide will get your feet wet with the basic structure of an AWS Application and will surely be an amazing experience to see your own website deployed. While this is not the most secure way of deploying a WordPress application, this is certainly one of the best ways to explore the AWS console, hands-on! Check out our architecture to see an overview of this series.

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

For all of you out there who are new to AWS, gear up because this will be an eye-opener of how amazing AWS can be! I will be providing cost estimates and warnings whenever we provision our resources and make sure that everyone is able to follow without worry.

Before we start, I would like to tell you a little bit about myself. I am Jeremy, and I am currently working as a Cloud Engineer. I am a certified Solutions Architect Associate and basically use the AWS Console everyday for my job. This is my first blog post and my goal is to help every AWS user out there as much as I can.

Enjoy the journey!
Auto typing text animation in JavaScript
Tags: javascript, webdev, tutorial, programming
Published: 2022-01-21 08:50:16

Demo:- https://codepen.io/iammanojrathod/pen/PoJLExZ

This is Auto typing text effect using simple JavaScript.

CSS code: -

```
body{
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: #1C6DD0;
  color: #000;
  font-size: 30px;
  font-weight: 700;
}
```

JavaScript: -

```
const text = "This is the typing text effect in JavaScript";

let index = 0;

function writeText() {
document.body.innerHTML = text.slice(0, index);
  
  index++;
  
  if (index > text.length) {
    index = 0;
  }
};

setInterval(writeText, 100);
```
Starport CLI
Tags: blockchain
Published: 2022-01-21 08:34:44

เป็น CLI ที่ build อยู่บน cosmos SDK

# มันคืออะไร
มันเป็นเครื่องมือที่ใช้ในการสร้าง บำรุงรักษา blockchain โดยเฉพาะโดยใช้ Cosmos SDK และ Tendermint ตัวมันเองถูกเขียนด้วยภาษา go

# Install Starport
```
curl https://get.starport.network/starport! | bash
sudo mv starport /usr/local/bin/
```

# เริ่มต้นสร้าง chain เบื้องต้น (ทำตามตัวอย่างที่เค้าให้มา)
```
starport scaffold chain github.com/cosmonaut/hello
sudo mv starport /usr/local/bin/
```
คำสั่งนี้สร้าง Cosmos SDK blockchain ที่เรียกว่า Hello ใน dir hello ประกอบด้วย blockchain ที่พร้อมใช้งานเบื้องต้นให้เรา

- staking (opens new window)(for delegated proof of stake)
- bank (opens new window)(for fungible token transfers between accounts)
- gov (opens new window)(for on-chain governance)

# ภายใน hello ประกอบด้วย
| File/directory        | Purpose           |
| ------------- |:-------------:|
| app/      | Files that wire together the blockchain. The most important file is app.go that contains type definition of the blockchain and functions to create and initialize it. |
| cmd/ | The main package responsible for the CLI of compiled binary. |
| docs/ | Directory for project's documentation. By default, an OpenAPI spec is generated.|
| proto/ | Protocol buffer files describing the data structure. |
| testutil/ | Helper functions for testing. |
| vue/ |.A Vue 3 web app template. |
| x/ | Cosmos SDK modules and custom modules. |
| config.yml | A configuration file for customizing a chain in development. |

ในตอนนี้เราก็สามารถทำให้บล็อกเชนของคุณทำงานบนโหนดเดียวได้แล้ว (แค่ node.เดียวนะ)

# Start a Blockchain
```
starport chain serve 
```
เสร็จแล้วแค่นี้ละ
🌍 Tendermint node: http://0.0.0.0:26657
🌍 Blockchain API: http://0.0.0.0:1317
🌍 Token faucet: http://0.0.0.0:4500

0.0.0.0 ไปหา ip เครื่องมาใส่ลองเข้าไปดู เล่นได้เล่นดี
🚀 Ride the Cloud Wave: ReactJS Authentication with AWS Amplify, Demystified!
Tags: react, authentication, aws, javascript
Published: 2022-01-21 08:31:37

Hey Cloud aficionados of dev.to! 🌩️

Dipping your toes into the vast ocean of authentication can be... well, a bit daunting. But, let's make it smoother than your favorite cappuccino foam! ☕ In this guide, we're going to bolt through setting up solid-as-a-rock authentication for your React apps using AWS Amplify. No more sleepless nights over security woes! Let's set sail! 🌊

## **🚀 Why AWS Amplify?**

Amplify isn't just another tool from AWS's magical toolshed. It's a full-fledged development platform, tailored to make your cloud-powered app-building journey both exciting and efficient. From APIs to auth, storage to analytics, it's got you covered! And today? We’re diving into the Auth part! 🔒

**🚀 Setting the Stage**

Hey, before we summon the cloud gods, ensure you've got Node.js singing on your machine. If not, [grab it here](https://nodejs.org/en/download). Oh, and an AWS account is our ticket to the Amplify show.

🚀 **Summoning the Amplify CLI**

Done with the basics? Great! Fire up that terminal and let's beckon the Amplify CLI:

```bash
sudo npm install -g @aws-amplify/cli
```

Once done, we've got to sync Amplify with our AWS realm:

```bash
amplify configure
```

You'll be waltzing through some steps to grant the right permissions. A mini dance with the AWS console, and you're set! 🕺

🚀 **Setting Amplify Vibes in our React App**

Add the Amplify packages with a sprinkle of React goodness:

```bash
sudo npm install aws-amplify @aws-amplify/ui-react
```

🚀 **The Auth Magic!**

Ready to weave in authentication? Awesome! Under the hood, Amplify dances with Amazon Cognito to bring you this magic.

```bash
amplify add auth
```

Answer a few prompts, and voilà, your app knows auth now! Deploy your majestic creation to the AWS realm:

```bash
amplify push
```

Oh, and confirm with a firm YES when asked. This conjures all the necessary cloud resources and blesses your app with an `aws-exports.js` config.

🚀 **Bringing it All Home in React**

Time to integrate the cloud with our app. Update your `index.js`:

```javascript
import Amplify from 'aws-amplify';
import awsconfig from './aws-exports';
Amplify.configure(awsconfig);
```

Spruce up your `App.js` to showcase your shiny new authentication:

```javascript
import { withAuthenticator, AmplifySignOut } from "@aws-amplify/ui-react";

function App() {
  return (
    <div>
      <AmplifySignOut />
      Greetings from the Amplify & React Auth realm! 🌍
    </div>
  );
}

export default withAuthenticator(App, true);
```

Fire up your app and witness the magic:

```bash
npm run start
```

## **🚀 Sail to the Horizon**

That’s it, cloud navigators! From setting up Amplify to embedding authentication in React, we've journeyed through it all. AWS Amplify surely makes our cloud adventures thrilling. Here’s to more secure and scalable apps! 🍻

Keep soaring, keep coding, and see you in the cloud! 🌩️🚀

---
Confused Dev Need Advice.
Tags: help, programming, productivity
Published: 2022-01-21 08:16:58

## **Backstory:**

I am a self taught developer and been developing for over 4 years now with a recent introduction to real world experience as the company I work for is asking more and more from me to develop things for them. It's allowed me to upgrade my career. Although I feel like I am trying to learn too much.

## **The issue:**
I feel like as a self taught developer that started as a hobby and now evermore becoming what is a job, the issue I feel is that I feel like I do not specialists in one specific language. I can be developing in python (preferred language) one day and the next develop in php/ golang ect. So although I have a good grasp of python for example I don't take it to its full potential.

Secondly this is also my hobby I enjoy to dabble onto many different projects and as a creative I have thousands of ideas and want to build them all but I feel like doing this I never really learn as I know a lot of very little and not a lot about one. I like python but I feel like i should learn something like java and specialise in that as most job opportunities in my location are involved with java.

## **Conclusion:**
I understand that being in the work environment and in a small company I will have to take on many different roles, but when I am coding at home. Should I just stick to one specific language?

Has this or does this happen to anyone else?