teleren/devto huggingface dataset:
Transaction not getting rolledback in Micronaut
Tags: micronaut
Published: 2021-07-13 06:23:54

Hi,

I am trying to make a method transactional like this:

`@Transactional
   private void loadListIntoDb(Stream<EmpDto> lines) {
       try {
            empRepository.deleteAll();
            throw new Exception("test exception");
        } catch (Exception ex) {
            throw new RuntimeException("error while loading file into db", ex);
        }
    }`

but even after throwing exception, deleted records are not rolled back. Can anyone please suggest if i am doing anything wrong here.

Thanks,
Manish
List of Issues
Tags: beginners, webdev, npm, react
Published: 2021-07-13 06:22:12

Hello Dev Friends.While coding we often run into repetitive issues and find ourselves Googling again.So here I have made a blog post to capture the common issues we run into.I will be updating the post regularly.

## Issue 1:Error while creating react app-
Invalid response body while trying to fetch https://registry.npmjs.org/eslint-plugin-jest: ENOENT: no such file or directory, lstat 'C:\Users\Kritika\AppData\Local\npm-cache\_cacache\content-v2\sha512\0e\da\b8126639b9463e48742ecea7388f266acb9fee5fdd478a932b0a282a3a514f006180f3996c00ed971578c0f6524fbd5166f9ad7829bb492af47ad233159e'
OR
npm ERR! invalid json response body at http://registry.npmjs.org/ansi-escapes reason: Unexpected end of JSON input

## Solution:
```npm cache clean --force```

Solution link:
https://stackoverflow.com/questions/64625539/npm-err-invalid-json-response-body-at-http-registry-npmjs-org-ansi-escapes-re

## Issue 2-Error while deploying react app to Netlify
Failed to compile: Cannot find file './containers/App/App' in './src'

## Solution:

```git rm -r --cached .
 git add .
 git commit -am 'Removing cached files'```

Solution link:
https://stackoverflow.com/questions/55754231/failed-to-compile-cannot-find-file-containers-app-app-in-src

#Issue 4-Link-https://stackoverflow.com/questions/71835697/create-react-app-dependency-version-issues-with-react-18/71836035#71836035

Please share the issues in comments which you have encountered recently.

Happy Coding :)
You can follow me on [Twitter](https://twitter.com/kritikasri27) and [Github](https://github.com/kritika27).
Write your first TypeScript code today with this simple setup
Published: 2021-07-13 06:09:16

*Writing your first TypeScript code might feel intimidating. Don't worry, i got you! 🤝 *

## 1 - Create a folder 

I name it tstest.
You can use the command mkdir like this or create it manually.
![Capture d’écran 2021-07-11 à 12.08.04.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625998087143/IKV-XNqf6.png)


## 2 - Open it and initialise your project

Run the command  `npm init -y ` to initialise your project and create the package.json file.

## 3 - Install parcel

Run the command `npm i -g parcel-bundler` to install parcel globally

## 4 - Create a new file 

-in your terminal type `touch index.html`

## 5 -Open Visual Studio Code 

-in your terminal type the command `code .` to open the folder in vs code

## 6- Create a html document

-Use the emmet snippet like in the image below

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625998502034/tmqqti6iD.png)

## 7- Add a script tag with a source index.ts

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625998587314/5pr773tq-.png)

## 8- Create the file index.ts

- Create the file index.ts and write this in it 

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625998657373/_lCZxNh12O.png)

## 9-  Then typescript can handle anything for us 

## 10 - Type in the terminal `parcel index.html`

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625998827136/D07-BFfGd.png)


## 11- It will install typescript and start a server at port 1234


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625998866000/GqpGAUE5T.png)


As you can see everything is working!!!


## 12- You can now try to experiment TypeScript : Have Fun 🤝
HTML tags | datalist
Tags: html, tags, datalist
Published: 2021-07-13 06:06:28

It is used to **specify a list of predefined options** for an `<input>` element, thus providing **autocompletion**. The user will see a drop-down with the corresponding options as they enter data.

The `id` attribute of the `<datalist>` must be equal to the `list` attribute of the `<input>` to which it is linked.

- Type: *block*
- Self-closing: *No*
- Semantic value: *No*

[Definition and example](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist) | [Support](https://caniuse.com/datalist)
Poke: A Super Handy HTTP Request Library
Tags: node, javascript, typescript, opensource
Published: 2021-07-13 05:30:44

'Request/request' was my favorite library all the time when i need to make http request in node, however it's deprecated for some time. 

I have tried a lot of alternatives but none of them gives me the similar experience as `request` does.

Finally, I decided to make one, that will be my pleasure to have you guy's feedback : )

[https://github.com/LawsonCheng/poke](https://github.com/LawsonCheng/poke)

```
import poke from 'js.poke'

// Using promise
poke('https://httpbin.org/anything')
.promise()
.then(result => {
    // response body here
    console.log(result.body)
    // get result in json format
    return result.json()
})
.then(json => {
    // here is the json object
    console.log('json: ', json)
})
.catch(err => {
    console.log('> Error: ', err)
})
```
Slowing Down
Published: 2021-07-13 05:11:26

I wrote a note to myself a couple days ago and saw it as I was scrolling through my list of saved blog post topics.

>I'm taking a full lunch break. as recently as a few days ago, or maybe late last week i wouldve worked through liunch given where i am in this sprint.

>this would be advice for future HR students. slow down. youre probably going to eventually anyway. besides what's the rush? this is the *start*.

I've kept up that perspective and why not? It's always better to feel better. To be less stressed out and to work in a way that's sustainable.

The last line of that note stands out.

This really is the start. Fifth week of a thirteen-week program. Maybe 26 weeks of job hunting afterwards (hopefully much less of course). Then 520 weeks, maybe 1040, or more, of a career working with code.

Of course, we all feel the drive to maximize our time in the program. This is an expensive program so of course we'd want to get everything out of it - write every line of code, take on every problem and stretch goal. And that pressure isn't all internal - not nearly. When the allotted work time is up, but you only made it halfway through the 'Bare Minimum Requirements', it's hard to hear the call to step away from the computer.

Yet part of laying the foundation for career-long success is building habits that can last. Problem solving strategies and time management tools that will sustain us beyond our time in a coding bootcamp.

##Advice for Future HR Students
If I could share some advice with future students, it'd be: work hard, but don't over do it.

How do you know if you're overdoing it? That's pretty simple. If you think you might be, you probably are.

Are you skipping lunch to get ahead on the afternoon sprint block? Are you staying up past your normal bedtime to finish that evening's toy problem? Are those healthy decisions? There's too much to learn to think that one extra hour a day is going to make more than a marginal difference in your technical ability or knowledge. But that hour or two can save you stress, or help you feel more rested, or allow you to spend quality time on the things or people that are meaningful to you. Those things are going to make you even more productive  when you're working.

So I've embraced the pomodoro method. I'm down to enjoy my one day off. Although, in all honesty, I did do some work yesterday, a Sunday, but it was relaxed and rewarding work.
Learning Python-Basic course: Day 15, More about try-except
Tags: python, learningpython, beginners, tutorial
Published: 2021-07-13 05:03:32

Today we will do some practice related to the `try`  error handling we learnt yesterday.
---
____

Sample program-

1) **Tuple or List?** Remember we covered basics of tuples on [Day 11](https://dev.to/aatmaj/learning-python-basic-course-day-11-multidimensional-lists-and-tuples-3bfl)? Now we write a program to check if a data type is a List or a Tuple.
```python
a=[1,2,3] #list
b=(1,2,3) #tuple
c=[b,2,4] #list
d=(1,b,c) #tuple
check=[a,b,c,d] 
for i in check:
    try:
        i.append(1)
        print(i," is a List")
    except:
        print(i," is a Tuple")
```
> This example needs strong understanding of Tuples and multidimensional Lists, so in case you are not comfortable with  either of them, please refer to [Day 11](https://dev.to/aatmaj/learning-python-basic-course-day-11-multidimensional-lists-and-tuples-3bfl)

Output-
```
[1, 2, 3, 1]  is a List
(1, 2, 3)  is a Tuple
[(1, 2, 3), 2, 4, 1]  is a List
(1, (1, 2, 3), [(1, 2, 3), 2, 4, 1])  is a Tuple
``` 

The logic behind this code is that when we try operations like pop, append, push etc. on tuples, they generate errors. We exploit this non-mutable property of Tuples to distinguish between the two. If error generated, it is a Tuple else a List.



# Nested `try` `except`

We can generate a nested `try` `except` in a similar manner,  however there is a glitch
```python
try:
    try:
        #statament 1
    except:
        pass
except:
     #statement 2
```

Here, statement 2 won't ever run. Can you think why? 

This is because the first `try` will not give any error. This is because any no error will be given by the nested `try` `except pass`

Here is when we need a nested `try` is useful.

```python
try:
    #statement 1
    try:
        #statament 2
    except:
        #statement 3
except:
     #statement 4
     # executed if error is in statements 1 or 3
```

# Exercise-
Write a program to check if a number if less than, greater than or equal to 15 without using if -else. (hint use `chr()` along with `try` )
[Do-Not-See-This-Answer](https://github.com/Aatmaj-Zephyr/Learning-Python/blob/f50437e11abb103b0f7411beba5da413045d812a/Basic/Day%2015/Exercise%20solutions/Exercise%201.py)

Comment your answers below. Let's see who can solve this one. 🗡️🛡️ Beware, it is harder than it seems....😉
How to fix missing dependency warning when using useEffect React Hook?
Published: 2021-07-13 04:45:30

[How to fix missing dependency warning when using useEffect React Hook?](https://pretagteam.com/question/how-to-fix-missing-dependency-warning-when-using-useeffect-react-hook.html)

[check this link for detailed info](https://pretagteam.com/question/how-to-fix-missing-dependency-warning-when-using-useeffect-react-hook.html)
Getting Started in PHP
Tags: programming, php
Published: 2021-07-20 05:45:03

---
title: Getting Started in PHP
published: true
date: 2021-07-13 04:07:56 UTC
tags: programming, PHP
canonical_url: https://dils.blog/getting-started-in-php/
cover_image: https://images.unsplash.com/photo-1599507593362-50fa53ed1b40?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wwfDF8c2VhcmNofDN8fHBocHxlbnwwfHx8fDE2MjYxNDkyMDQ&ixlib=rb-1.2.1&q=80&w=2000
---
[PHP](https://www.php.net/) is a general purpose scripting language. It was created to build dynamic web sites by [Rasmus Lerdorf](https://en.wikipedia.org/wiki/Rasmus_Lerdorf) back in 1995.

According to the StackOverflow developer survey of 2019 over 26% of developers use it and its said to be used in almost 80% of websites today.

PHP has come a long way from writing flat PHP pages to having decent object oriented features, frameworks, content management systems and command line tools.

If I may recommend a few;

- [Laravel](https://laravel.com/)
- [Symfony](https://symfony.com/)
- [Symfony Components](https://symfony.com/doc/current/components/index.html)
- [The League of Extraordinary Packages](https://thephpleague.com/)
- [WordPress](https://wordpress.org/)
- [Drupal](https://www.drupal.org/)

Tools like [composer](https://getcomposer.org/) have made package management a breeze.

I would recommend starting with [PHP: The Right Way](https://phptherightway.com/) because there are a lot of outdated material out there.

Start with the [latest stable version](https://www.php.net/supported-versions.php) PHP 8.0 at the time of writing. Anything before 7.2 is **really should be updated** and pose a security risk to keep around.
O FUTURO da performance no CSS
Tags: css, performance, productivity
Published: 2021-07-13 03:49:56

Para fazer uma imagem responsiva sempre foi um desafio, é ideal que imagens sempre tenha a mesma resolução do dispositivo do usuário.
Uma maneira de solucionar esse desafio é usando a função CSS `image-set()` , os navegadores baseados no Chromium já tinha suporte para ela desde 2012 e o Safari desde o Safari 6. Recentemente o Firefox passou a dar suporte a partir da versão 88, então vamos aprender mais sobre essa função que será a próxima geração de performance do CSS.

No HTML já se tinha o atributo `srcset`, o `image-set()` é equivalente a esse atributo onde confiamos no próprio navegador decidir qual melhor imagem para a resolução que o usuário está.

Image-set pode ser usado em três propriedades CSS diferentes, que são:

- content
- cursor
- background-image

O mais usado é o `background-image`, um exemplo de uso:

```css
.point {
  background-image: image-set("inflection.png" 1x, "inflection-2x.png" 2x);
}
```

Sendo o "1x" para telas com menores resoluções e o "2x" para telas com maiores resoluções. `x` vem de `dppx` que em inglês é **dots per pixel unit**, traduzindo seria algo em torno de pontos por pixel.
No Chrome/Edge/Opera e Samsung Internet é necessário adicionar o prefixo `-webkit-`. Já no Safari não precisa utilizar esse prefixo porém necessita usar a função `url()` para adicionar o caminho da imagem.

```css
.point {
  /* Safari */
  background-image: url("platypus.png");

  /* Chrome/Edge/Opera/Samsung, Safari com função url() */
  background-image: -webkit-image-set(url("inflection.png") 1x, url("inflection-2x.png") 2x);

  /* Padrão */
  background-image: image-set("inflection.png" 1x, "inflection-2x.png" 2x);
}
```

Essa funcionalidade não é tão nova porém com o aumento do suporte é considerada a próxima geração de performance no CSS e que vai possibilitar usuários com dispositivos mais caros visualizarem a imagem mais nitidamente e também melhorar a performance para usuários que tem uma internet mais lenta ou com telas que requerem uma resolução menor.
How to create an app with vue cli without a global installation
Tags: vue, cli
Published: 2021-07-13 03:47:55

If you check out the [official doc](https://cli.vuejs.org/) the process of generating new app has 2 steps:
```sh
# install globaly
npm install -g @vue/cli
# create app
vue create my-project
```

If you use vue cli only form time to time global installation doesn't make much sense - you probably will upgrade npm before running the `vue` command again. In this case, you can generate your code with:
```sh
$ npx -p @vue/cli vue create my-project
```

Example run:
[![asciicast](https://asciinema.org/a/425180.svg)](https://asciinema.org/a/425180)

# Summary
In this article, we have seen how to run vue cli without a global installation & adding vue executable to our system.
🎯How To Stay Focused While Coding?
Tags: beginners, webdev, productivity, devjournal
Published: 2021-07-13 03:43:44

![Stay focused](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2n81chytk3vnd4na6q61.gif)
Every developers loves to code. It is one of the most basic parts of the job but many developer struggle with focusing and staying on task. Here's some tips to help for stay focused while coding.

**1. Keep Your Desk Clean**
There are a number of benefits that come from keeping a clean desk.
• Improve mental stability
• Increase productivity
• More likely to sleep better
• Improve focus
• Reduce stress
• Clean desk equals fewer sick days

**2. Learn To Manage Stress**
Everyone experiences stress at daily lives. However, It's important to learn manage stress and it's more helpful to improve their health and mood, And everyone knows good mood good productivity. As well as help to boosting their immune system. 
**👇For More Tips check post👇**
{% link https://dev.to/chetan_atrawalkar/how-to-avoid-stress-during-coding-56f1 %}

**3. Practice Meditation And Mindfulness** 
Meditation and Mindfulness can help programmers to stay focus and reduce stress, and help create new neuronal pathways in the brain. Meditating can change the structure and function of the brain through relaxation, which can:

• Reduce stress, anxiety, and depression
• Increase focus and learning concentration
• Improve memory and attention span
• Build stronger immune system and greater physical or psychological resilience

**4. Listen Music When You Work**
Music can help to keep the brain alert and prevent it from switching off.
Music can also be a motivator. If someone listens to epic soundtracks while working, they might be inspired to complete a big project.

**5. Separate Your Code And Your Life**
When your coding life is balanced, you will feel happier and more productive.
There are many reasons why separating your code and your life is so important.
• To maintain your mental health.
• Separating your personal life from your coding life can also increase your work productivity.
• More Relaxation and Less Burnout.
• Never Miss Out Memorable Moments of Life.
• Improve Overall Health and Well-being

**6. Turn Off Social Media Notification**
If your work does not require you to be online on social media platforms because while working social media notification distract you. 

**🤔What Do You Think?**
I hope you like this post.

**😎Keep Focused And Just Code It!**
Deploy a Custom Resource using Cloudformation: A Conversational CRM (SFDC) using Amazon Connect and Lex
Tags: aws, sfdc, terraform, devops
Published: 2021-07-13 03:35:36

I have been working on implementing CRM applications for most of my career. All the CRM applications which I have worked with have a common pattern for access where users login to the application and then look through stuff to find what they need to work on. So I thought why not streamline that process a little bit. With current boom in AI, why not add some AI flavor to the CRM application.

So I came up with this solution to have a Conversational interface for the CRM where one can get info from the CRM just like chatting with someone. Makes it interesting for the user to interact with the application too. In this post I am describing the solution which I built to give a conversational interface to Salesforce application. Also while at it, I cover steps about deploying Infrastructure using Terraform and Jenkins. Hope it will be a good learning for some of you.

A demo of this in action can be found below:

Get a Lead to work on: https://youtu.be/3PyTiSLxctM
Create a Lead: https://youtu.be/EdNAfLaBNlM  

For more details: https://amlanscloud.com/lexconnectchat/
How to Add a Flutter PDFViewer Widget to a Flutter App
Tags: flutter, pdf, webdev, dart
Published: 2021-07-13 03:21:23

Get an overview of Syncfusion's [Flutter PDFViewer widget](https://www.syncfusion.com/flutter-widgets/flutter-pdf-viewer "Flutter PDFViewer widget"). This video explains how to add the Syncfusion Flutter PDFViewer widget to a Flutter project. It also explains how to load a PDF document from the network. You will also learn how to perform zooming, navigation using the page navigation, and bookmark navigation programmatically.

Example project: https://bit.ly/3qG7A4N

SYNCFUSION FLUTTER PDFVIEWER
--------------------------------------------------
**Flutter PDF Viewer: View PDFs Seamlessly**
* Reliable PDF rendering.
* Easy navigation and interaction.
* Customizable appearances.

Product overview: https://www.syncfusion.com/flutter-widgets/flutter-pdf-viewer
Documentation: https://bit.ly/2UXccrA
API Documentation: https://bit.ly/2Qw1JBa
Examples – GitHub: https://bit.ly/3cG5f57
Tutorial videos: https://bit.ly/3Ai1IDk
Demo - Web: https://bit.ly/3caH7GO
Demo - Android Play Store: https://bit.ly/3cAX75x
Demo – Apple App Store: https://apple.co/2vP4aVa
Download free trial: https://bit.ly/3AkGIeX
Package in pub.dev: https://bit.ly/3qEGDyo

{% youtube f1zEJZRdo7w %}
Turning in my badge to become a software developer
Tags: beginners, codenewbie, bootcamp
Published: 2021-07-13 02:32:52

Starting Out

I thought I had life all figured out . I spent my years in college studying criminal justice soon after graduating I joined a department near home. 

At first it was awesome. Working in a big city you learn so much in a small amount of time. You see things that many people will never see in their lifetime. ( Both good and bad) At times,  only the people you work with will understand the shift you just had.(The things you saw, heard, smelled). Yep, I said smelled... It's completely normal to crack open a beer at 6 am with your coworkers and just talk. Then you go home and sleep to prepare to do it all over again.

My Why

It wasn't until after my first child was born I started to think maybe I don't want to do this forever.  I worked overnights for most of my career and having a child made me want to keep it that way. No way was I going miss Christmas morning because I had to work or any other holiday/celebration for that matter. Physically I was there but mentally I was exhausted. With irregular schedules, court, mandatory overtime I reached a point in my life where I was ready for a change. 


I thought I would give my department 20 .. maybe 25 years of my life. Here I am 6 years later with 2 kids ,headed into my 30's and starting over. 

Decisions...Decisions 

I'v  had been sitting around on my phone , on my computer,  watching TV, playing  video games......then I realized wow my life revolves around technology but not only my life but most of the world population involves/relies on technology.  After taking a  deep dive into a warm hole of information and research I made my decision on what I wanted to do!  Figuring all this out was just step one  for me. Then realizing going back to college wasn't really in the cards for me. After speaking to some current folks In the field  Iv started to teach myself Java and Python in the meantime. After even more deep diving and research iv decided to start a bootcamp in a few weeks. 

Follow My Journey

I hope  to have some of you follow along on my journey. I am eager to learn and connect with others. Tips/advice are always appreciated.