teleren/devto huggingface dataset:
Is Angular Dead?
Tags: discuss, watercooler
Published: 2021-01-17 21:55:56

It's been almost two years since I've used Angular. The last thing I used it for is a web app that is likely to be revived this year. It feels like I haven't heard much about Angular these past couple years, and I know I've seen complaints about the latest updates to the framework slide across my feed. 

So is Angular still in the ring? Should I polish up my ng skills and bring old projects up to speed? Or should I keep learning React like I was throughout 2020 and let Angular drift away?
Testing JPQL queries straight from Intellij
Tags: intellij, java, tips
Published: 2021-01-17 21:39:04

In my current project, most of the queries are written in Java Persistence Query Language ([JPQL](https://javaee.github.io/tutorial/persistence-querylanguage.html#BNBTG)). As with any *QL (that eventually gets translated to SQL), it’s cumbersome to do the translation of the *QL to SQL and vice-versa. This translation is generally done when you’re creating a new query or trying to debug an existing query. It would be great to be able to send JPQL queries directly to the DB.

One way to do this is to configure the [JPA console](https://www.jetbrains.com/help/idea/using-jpa-console.html) in IntelliJ IDEA. Note that this feature is only available in the Ultimate Edition (paid).

For those that are in a rush, this is the minimal configuration needed to get the JPA console going. To keep things simple, let’s assume that you have a single module project, called test-jpa:

1. Add a new data source to the project (View | Tool Windows | Database). This data source should point to the same DB that your entities use.
1. Add “JavaEE Persistence” framework support to test-jpa (right click module | Add framework support…). Click OK
1. Open the Persistence Window (View | Tool Windows | Persistence)
1. In this window, you will assign a data source to test-jpa (right click module | Assign data sources)
1. In the Assign Data Sources window, you will see a line with the value “Entities” which points to an empty Data Source field. Click on this field and select the data source from step 1. Click OK.
1. In the Persistence Window, expand the module and right click on Entities | Console. You have a choice between JPA and Hibernate Console.

Some cool features that both Consoles support:
- Navigating to the declaration of a class or field
- Auto-completion
- Parameterized queries

Reference: https://www.jetbrains.com/help/idea/using-jpa-console.html
Inspecting in-memory HSQLDB
Tags: java, tips, hsqldb
Published: 2021-01-17 21:20:56

Sometimes, for automatic testing of your Java application, you need to configure a DB connection. Most of the time the decision is to go for an in-memory database and HSQLDB is a prime candidate.

Some other times, your tests will be failing and it would be great to see the DB status before the failure. I already knew of the option of running HSQLDB as a server, but a colleague showed me a simpler way, with less configuration.

Simply add the following lines to the beginning or the test:

```
System.setProperty(“java.awt.headless”, “false”); // to prevent an exception related to awt running headless
DatabaseManagerSwing.main(new String[]{“--url”, “jdbc:hsqldb:mem:testdb”, “--user”, “sa”, “--password”, “”}); //to launch a separate a simple DB-inspector window
```
Normally, you’re going to put a breakpoint in your test right before the failing assertions. If the DB-inspector window freezes it’s because the breakpoint is configured to stop all threads. You will need to configure your IDE to not stop the DB-inspector thread (on IntelliJ IDEA, right-click on the breakpoint and you’ll get the menu that allows you to change this).

References:
- https://stackoverflow.com/questions/2697341/inspect-in-memory-hsqldb-while-debugging
- https://stackoverflow.com/questions/8174408/does-a-breakpoint-halt-all-threads
Postgres backup using Docker
Tags: postgres, docker, s3, backup
Published: 2021-01-17 21:07:28

Postgres is one of the most popular open-source Relational database. You can read more about it [here](https://www.postgresql.org/). The purpose of this blog to explain how you can take a backup of your Postgres database running with and without docker using the docker image and why I have created this image.

## Problem

Running Postgres inside the docker is very easy. Docker hub has an official [postgres image](https://hub.docker.com/_/postgres) that we can run. With a single command, we can start using Postgres database. The issue happens when we want to run a backup with cron. There are many ways to do this. We can follow [official documentation](https://wiki.postgresql.org/wiki/Automated_Backup_on_Linux) as well to automate the backup on Linux. The advantage of using docker is flexibility and no platform dependency. The official document only shows us how to run cron job on Linux. This will add the os level of dependency that we wanted to ignore. When searching for the backup docker image, I was not able to find any Docker image that supports Postgres 13 with S3 backup support. Existing images are not up-to-date.

## Solution

To tackle the problem, I have created my own docker image. To start the backup, follow the below instruction.

**Required Environment Variables**

All the environment variables from https://www.postgresql.org/docs/current/libpq-envars.html are supported because we are using native postgres-client binary for backup.

- PGHOST: behaves the same as the [host](https://www.postgresql.org/docs/9.3/libpq-connect.html#LIBPQ-CONNECT-HOST) connection parameter. eg. postgresql
- PGHOSTADDR: behaves the same as the [hostaddr](https://www.postgresql.org/docs/9.3/libpq-connect.html#LIBPQ-CONNECT-HOSTADDR) connection parameter. This can be set instead of or in addition to `PGHOST` to avoid DNS lookup overhead.
- PGHOST: postgresql
- PGPORT: 5432
- PGDATABASE: database
- PGUSER: postgres
- PGPASSWORD: password
- S3_HOST: https://storage.googleapis.com || s3.eu-west-1.amazonaws.com || nyc3.digitaloceanspaces.com
- S3_BUCKET: BUCKET
- S3_ACCESS_KEY: ACCESS_KEY
- S3_SECRET_KEY: SECRET_KEY
- CRON_SCHEDULE: "* * * * *". Read more [https://crontab.guru/](here)

**Docker Run Command**

```shell
docker run -d \
      --name postgres-backup \
      -v $(pwd)/backups:/backups \
      -e PGHOST=postgresql
      -e PGPORT=5432
      -e PGDATABASE=db_name
      -e PGUSER=postgres
      -e PGPASSWORD=password
      -e S3_ACCESS_KEY=ACCESS_KEY
      -e S3_SECRET_KEY=SECRET_KEY
      -e S3_BUCKET=BUCKET
      -e S3_HOST=https://storage.googleapis.com || s3.eu-west-1.amazonaws.com || nyc3.digitaloceanspaces.com
      -e CRON_SCHEDULE="@daily"
      docker.pkg.github.com/thakkaryash94/docker-postgres-backup/docker-postgres-backup:latest
```

That's it, now the container should be up and running.



Links:

- [Github Repo](https://github.com/thakkaryash94/docker-postgres-backup)

- [Environment variables](https://www.postgresql.org/docs/current/libpq-envars.html)
Deploy Vue.js app on Vercel
Tags: javascript, vue, tutorial, opensource
Published: 2021-01-17 21:05:18

# Introduction

**What is Vue.js?**

[Vue.js](https://vuejs.org/) is an open-source model–view–view model (MVVM) front end JavaScript framework for building user interfaces and single-page applications. The core library is focused on the view layer only and is easy to pick up and integrate with other libraries or existing projects. To learn more **Why Vue.js** [click here](https://vuejs.org/)

## Deploy Vue.js app on Vercel

[Vercel](https://vercel.com/home) is the best place to deploy any frontend app.

To start a new project you can Import Git Repository (Deploy your own Vue.js app) or Clone Vue.js Template from many [available Templates](https://vercel.com/new/templates). 


To Select Vercel Scope and Clone Vue.js Template whether you create a new Vercel Team and deploy the Git repository to it, or deploy it to your existing Personal Account it's just a few steps job and it's **FREE**.

This is a brief example of a Vue.js app that can be deployed with Vercel and zero configuration.

# Steps
##### 1. Create Git Repository 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9a9aguq6ktzx35dlxb7f.png)
##### 2. Import Project

### Congratulations!
Your project has been successfully deployed.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5hata23bcf6qjesm697d.png)

Welcome to Your Vue.js App
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/u7o3csxiaqonl2iahu9q.png)

Live Example is here: https://vue.now-examples.now.sh

To get started with Vue.js deployed with Vercel, you can use the Vue CLI to initialize the project:
```vue create```
#### If you are deploying From Your Terminal
You can deploy your new Vue.js project with a single command from your terminal using Vercel CLI:

``` vercel ```

Learn more about Vue.js on [Github] (https://github.com/vuejs/vue).

#### That's it!
Welcome to Your Vue.js App, easy as that!

### To connect with me
Please check my [Github](https://github.com/ivanadokic), [LinkedIn](https://www.linkedin.com/in/ivana-dokic/) and follow me on [Twitter](https://twitter.com/LloydPile). 

Thanks for reading!
Simple Chakra UI Card
Tags: react, javascript, css
Published: 2021-01-17 20:56:42

---
title: Simple Chakra UI Card
published: true
date: 2021-01-17 20:55:53 UTC
tags: React,JavaScript,CSS
canonical_url: https://h.shadowtime2000.com/simple-chakra-ui-card
---

## Simple Chakra UI Card

I am currently creating a blog with Chakra UI, so I need a card which can be created with it. This is just basically a small snippet.

### The Card

```jsx
function BlogPost() {
  return (
    <Box maxW="sm" borderWidth="1px" borderRadius="lg" overflow="hidden">
        <Box m="5" as="a" href="/blog-post-thing">
          <Heading m="5" mb="0" as="h4" size="md">Blog Post</Heading>
          <Text m="5" mt="0">My cool blog post</Text>
        </Box>
    </Box>
  )
}
```

### Demo

{% codesandbox o8f34 %}

## Conclusion

Yeah, that's basically it. This is my first time using Chakra UI so if you have any suggestions please share them.
3 Consejos para empezar a Programar 💻️💜️
Tags: programar, beginners, programming, spanish
Published: 2021-01-17 20:48:19

:gem: Pregunté esto por twitter y recibí las siguientes [respuestas](https://twitter.com/MaferMazu/status/1349096345483816962)

Fue muy interesante esta dinámica, y estoy de acuerdo con varios consejos, sin embargo ahorita voy a comentarte los que a __mí me parecen más importantes__.

## :alarm_clock: Date tu tiempo 

Siempre pensé que era mala programando... síndrome del impostor.

Me tomó varios años aprender las bases y no fue hasta que me tocó trabajar con alguien a quién admiraba, alguien que yo consideraba un "duro programando", que me dí cuenta de que yo era muy capaz y tenía buen nivel.

Al final todo conocimiento suma; y todo el estudio y la práctica en algún momento dá sus frutos. Así que: No te rindas.

## :trophy: ¡Divide y vencerás! 

¡Me encanta! Sirve para muchas cosas. Si tienes un problema, divídelo. Hazlo lo más chiquito que puedas y ve resolviendo sus partes para así lograr conseguir la solución completa.

Considero que es una de las cosas más útiles que he aprendido.

## :mag: Aprende a googlear 

No estás solo; y actualmente hay mucho contenido en internet que te permite ver lo que otras personas hacen para resolver problemas. 

Si hay algo que te de curiosidad, o te trabas en algún momento, googlea.

Busca de muchas maneras, y acostúmbrate a googlear en inglés (hay más contenido)

## :dart: ¡That's it!

Esos son los 3 consejos que yo me daría a mí misma si estuviera empezando. Espero que te hayan sido útiles.

:hearts: Déjame en los comentarios si tienes más consejos o si te gustó alguno que leíste aquí.
New Beginnings
Published: 2021-01-17 20:35:22

I have made a choice to change careers.. Getting out of retail management and into something that I truly thought that I could be good at. Is it too late for an old dog to learn new tricks? I learned to type on one of the first apple computers while in middle school back in the 80's, I thought that this would be something easy to comprehend. Turns out "not so much", learning is slow and I feel like when I lived in Germany and didn't speak any German.
Long time tech folks, what's your story?
Tags: agedlikefinewine, programming, tech, decades
Published: 2021-01-17 20:28:44

---
title: Long time tech folks, what's your story?
published: true
description: I want to hear stories from people who've been in tech for a long time
tags: agedlikefinewine, programming, tech, decades
//cover_image: https://direct_url_to_image.jpg
---

How long have you been in tech?

In what capacity?

What are you doing now?

How has tech changed since you started?

If you could change tech today, what would you do?

What are some negatives and positives of the current tech landscape?

What advice do you have to give to others?

Or just chat about your experiences in general. I love reading them
Job seekers - how are you coping?
Tags: jobs, developers, coping, community
Published: 2021-01-17 20:27:22

---
title: Job seekers - how are you coping?
published: true
description: Curious how people are coping with employment issues right now
tags: jobs, developers, coping, community
//cover_image: https://direct_url_to_image.jpg
---

To everyone out there who's currently looking for work and having a hard time: how are you coping? If someone offered you something to dramatically help you right now, what would it be?
Autosave logic with React Functional Components
Tags: react
Published: 2021-01-17 20:15:24

What is the best way to model a simple autosave logic with Functional components? Using Class Components my logic looked like this:

```js
class MyEditor extends React.Component {
  constructor (...args) {
    super(...args)
    this._debouncedAutosave = debounce(this._save, 1000)
    this._saving = false // while saving is in progress
    this._scheduled = false
  }

  onContentChanged() {
    this._debouncedAutosave()
  }

  async _save() {
    if (this._saving) {
      this._scheduled = true
      return // no new saves until current one has finished
    }

    this._saving = true
    await saveArticle(this._getEditorContent())
    this._saving = false
    
    if (_scheduled) {
      this._scheduled = false
      this._save()
    }
  }

  render() {
    ...
  }
}
```

I failed miserably trying to model this as a Functional Component with useState, useCallback etc.

How would you go about this? Any help much appreciated!

Michael
PHP Laravel Developer who wants to learn Python quickly? You have to look at Masonite.
Tags: laravel, php, python, beginners
Published: 2021-01-17 20:13:05

---
title: PHP Laravel Developer who wants to learn Python quickly? You have to look at Masonite.
published: true
description: 
tags: laravel, php, python, beginner
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/whk42ck6wq0yrlzv3fea.png
---

If you are familiar with PHP and Laravel and would like to learn Python, it is good to know that there is a Python web framework out there that is very similar to Laravel: Masonite. 

Masonite is a Python MVC web framework which is very close to Laravel. So in a few hours you will be able to develop your own Python web application :-)

  Here is the documentation and the starting instructions: https://docs.masoniteproject.com/

There are also some getting started videos: https://masonitecasts.com/timeline/getting-started/introduction

Here are some examples of Python Masonite.

Routing
```python

ROUTES = [
    Get('/contacts', 'ContactsController@index').name('contacts.index'),
    Post('/contacts', 'ContactsController@store').name('contacts.store'),

]
```

Controller
```python
def index(self, view: View, request: Request):
    contacts = Contact.all()
    return view.render('contacts.index', {'contacts': contacts})

```

Migrations
```python
def up(self):
    with self.schema.create('Contacts') as table:
        table.increments('id')
        table.string('last_name')
        table.string('first_name')
        table.timestamps()

```

As you can see your Laravel knowledge will be very useful :-)

If you have any questions do not hesitate.

For those who like the concept and want to encourage the developer please don’t hesitate to give a little star for Masonite on Github: https://github.com/MasoniteFramework/masonite

Good development!
Cancelling a stripe subscription on 'period end'
Tags: webdev, ruby, rails, todayilearned
Published: 2021-01-17 19:11:01

Stripe's documentation on cancelling a subscription at the end of a period isn't entirely up to date.

[https://stripe.com/docs/billing/subscriptions/cancel](https://stripe.com/docs/billing/subscriptions/cancel)

For cancelling at end of period, the docs say to do the following: 

```jsx
Stripe::Subscription.update(
  'sub_',
  {
    cancel_at_period_end: true,
  }
)
```

Easy enough, right? 

WRONG.

When actually doing this we were getting the following error: 

```jsx
{
  "error": {
    "message": "The subscription is managed by the subscription schedule `sub_sched_`, and updating any cancelation behavior directly is not allowed. Please update the schedule instead.",
    "type": "invalid_request_error"
  }
}
```

After contacting stripe support, if you wish to cancel at the period end you need to do the following:  

1. Update phases on subscription schedule object to pass only current phase.
2. Set end_behavior to 'cancel'

```jsx
Stripe::SubscriptionSchedule.update(
  'sub_sched_',
  {end_behavior: 'cancel'},
)
```

Links: 

[https://stripe.com/docs/billing/subscriptions/subscription-schedules#updating](https://stripe.com/docs/billing/subscriptions/subscription-schedules#updating)

[https://stripe.com/docs/api/subscription_schedules/update?lang=ruby](https://stripe.com/docs/api/subscription_schedules/update?lang=ruby)
Loopstudios Landing Page (Locomotive Scroll & Gsap)
Tags: html, css, javascript, gsap
Published: 2021-01-17 19:11:00

Loopstudios Landing Page Using HTML5, CSS3 & JS (Locomotive Scroll & GSAP)

Demo : https://loopstudios-lp.netlify.app/

Repo : https://github.com/saidMounaim/100DaysOfCode/tree/main/Day28
Lambda functions in Python
Tags: lambda, python
Published: 2021-01-17 19:07:27

---
title: Lambda functions in Python
published: true
description: A Python lambda function looks like a normal function in Python.
tags: lambda, python
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/l035fr6ujqm217t0eiup.png
---

A lambda function is a small anonymous function that returns an object. This function is assigned to a variable o it is part of a function bigger.

Just as in a normal function the def keyword is needed, for lambda functions we need the lambda keyword.

The function lambda is more legible when we have to do small things.

##Structure

The structure of the lambda functions is:

`lambda args: expression`

* lambda: keyword to express that a function is a lambda function
* args: are arguments separated for commas
* expression: is an expression that returns an object

## Examples

Here some examples for we obtain a better understanding of lambda functions.

### Sum

sum = lambda x, y: x + y
total = sum(3, 5) // 8

### Difference

difference = lambda x, y: x -y
value = difference(8, 5) // 3

### Map

primes = [1, 2, 3, 5, 7]
primes_squared = map(lambda n: n*n, primes) // 1, 4, 9, 25, 49

### Filter

numbers = [1, 2, 3, 5, 8]
odd = filter(lambda n: n%2 == 1, numbers) // [1, 3, 5]

It is my first post in Dev.to, I hope that it will be helpful for you.
What's a promise? Exactly...
Tags: javascript, programming, codenewbie, beginners
Published: 2021-01-17 17:55:59

## What is a promise

If you have been learning Javascript or writing Javascript you have come across a piece of code called a promise. A promise is a foundation tool for writing Asynchronous Javascript. A promise is an object that is a proxy for an asynchronous task to be resolved and returned.

## Why do we use promises 

One purpose of using promises in your code is to preserve the execution of the lines of code to be processed when your data is ready. Javascript is single-threaded and a lot of use cases for the language are to process lots of user interactions. Promises help to keep those processes from unnecessarily blocking any other interactions while your promises are being fulfilled.   

## How to create a promise

```javascript

let orderFood = new Promise((resolve, reject) => {
// a promise has three possible states = [Pending, Fulfilled, Rejected]
// upon creation the state is "Pending"
if (ingredients === "available") { 
resolve("Order coming right up!") // state is "Fulfilled"
} else {
reject("We are all out of ingredients for your order.") // state is "Rejected"
}
}
.then("Your food is ready") // Chaining - This is an instance method that runs an async task when run after our promise has been fulfilled 
.catch(Error("Here's a refund for your order we couldn't fulfill") // Chaining - This is an instance method that will provide error handling after a rejection in our promise. 

```

So now you have more than a few things about how to use promises in Javascript. If you enjoyed this post feel free to leave a comment about your thoughts and experiences working with promises in Javascript. 

Happy Coding, 
Terry Threatt
My Local Hack Day - BUILD 2021 Experience | Major Hacking League | Guild: Devscript Winter Of Code
Tags: localhackday, mlh, majorleaguehacking, hack
Published: 2021-01-17 18:37:08

Hey everyone! Here I am attending another awesome event organized by the Major League Hacking Community.

It was a lovely experience, full of energy! We(I along with my guild mates) came together every day and completed these super creative, crazy tasks and try to finish all of the challenges in the amount of time allotted.

There were many localhost workshops one of my favourite was Create a personal site with GitHub Pages. It was my first MLH event and it helped me to to know some new skills and technologies. My guild  bagged the 5th position among other 100 guilds of MLH!. Team leaderboard each day gave us a sense of competency and that was quite good as it prepared us for next day with full enthusiasm and energy.

MLH Local Hack Day is a fantastic learning opportunity. It forces me to get out of my comfort zone and grow. It helped me to network with relevant people. It helped me to Showcase My Skills and It has been also a platform to Challenge myself.

All thanks to Major Hacking League for organizing such a fantastic event and Devscript Winter Of Code for letting me be a member and adding a little something from my part to this community! I hacked for 7 days straight and learnt a lot of new things. The event was very impactful, totally loved the challenges and not to forget the amazing stickers that each person will be rewarded with!
LHD: Build 2021
Tags: localhackday, majorleaguehacking, mlh
Published: 2021-01-17 18:19:30

This week I participated in the Local Hack Day: Build organized by _MLH_.<br>
Daily challenges and weekly challenges were fun to complete and introduced me to a lot of new techs, hack, and fun stuff. It gave me the chance to meet amazing people from the community in my guild, _Wind In Our Chest Hair_, and other guilds too.
<br>
I got the chance to add some projects to my portfolio and skill up. Some highlights were: 
* [To-do list web app](https://devpost.com/software/to-do-webapp?ref_content=user-portfolio&ref_feature=in_progress)
* [Snake game](https://devpost.com/software/snake-game-n28pau?ref_content=user-portfolio&ref_feature=in_progress)
* [WellnessHub](https://devpost.com/software/wellnesshub-pdbgy2?ref_content=user-portfolio&ref_feature=in_progress)<br>
_This was my team's submission for the weekend hackathon: **Hack the Northeast Beyond:2021**_

Feel free to check out these and others on [Devpost](https://devpost.com/tawishisharma1?ref_content=user-portfolio&ref_feature=portfolio&ref_medium=global-nav)

Also, my social media for the week highlights these. Feel free to check them out too:
[Twitter](https://twitter.com/Tawishi1)
[Linkein](www.linkedin.com/in/ 
tawishisharma
)

<br>Great year start for my [_Github_](https://github.com/Tawishi) activity!
![Github activity](https://dev-to-uploads.s3.amazonaws.com/i/i4miu9jq0zjghh3jdxzt.png)

Thank you, Ryan, Mary & Team for organizing this amazing event!