teleren/devto huggingface dataset:
How to write this SQL select the best way?
Tags: discuss, sql, help, performance
Published: 2019-04-04 15:42:07

Hey guys,

I know there are some SQL specialists in my home feed and I want to find the best way to write a SQL statement to my task.

Let's dive right in what my structure is. I will sketch the table structures and include only the fields needed for my case.

**HEADER TABLE (HDR)**:

| BOMId         | RecId         |
| ------------- |:-------------:|
| FirstBOM      | 0515151848480 |
| SecndBOM      | 0525091647216 |

**LINES TABLE (LINE)**:

| BOMId         | ItemId        | RecId |
| ------------- |:-------------:|:-----:|
| FirstBOM      | CoolItemHere  | 984986541 |
| FirstBOM      | KetchupBottle | 515105685 |
| FirstBOM      | RubberDuckey  | 541980894 |
| FirstBOM      | TesaBandRoll  | 976512058 |
| SecndBOM      | SideProduct12 | 896414986 |
| SecndBOM      | KetchupBottle | 324858715 |
| SecndBOM      | FreezerLabels | 321054879 |
| SecndBOM      | MagnetHolder  | 980489541 |
| SecndBOM      | WoodenStick   | 261456696 |

**Relation:** HDR (1) - (N) LINE

Task:
I need to retrieve **only the first** *(maybe single one)* `BOMId` of table `HDR` where a combination of items in `LINE` exists to this `BOMId`.

Example:
I want to retrieve `FirstBOM` when I search for a combination of `ItemId`'s "KetchupBottle" && "RubberDuckey". This statement should not return `SecndBOM` also, because "KetchupBottle" is there but not "RubberDuckey".

I tried grouping it, but with no luck.

Kinda hard to explain with words... Hope this is understandable!


## How would you write a select for this?
Learning to love software development books 💙
Tags: books, discuss, learning, programming
Published: 2019-04-04 15:34:54

I have always loved to read, but my experience with technical books is more complicated than with other kinds of reading.

When I first started to code, I found reading programming books boring. It seemed like many of them were just repeating documentation.
I was mostly learning by practicing then: reading and writing code, googling and reading language documentation. I still read some books on software development every once a while, but I tended to choose the more "stable" and general-purpose ones, like "Code Complete", "The Mythical Man-Month" or "Joel on Software" (which are great). I thought that most of the books will get outdated soon, so I haven't read any books on the languages I used.
Several years and jobs passed, but I was still mostly learning by coding on the job, reading blog posts, and working on my pet projects.

Later, I had a very busy couple of years: maternity leave + part-time work, then full-time work + learning to drive. When I was able to return to a more steady schedule, I gained a great will to learn and fill blanks in my knowledge, but still hadn't much spare time to learn.

Around that time I stumbled upon a Sandi Metz's book ["Practical Object-Oriented Design in Ruby"](https://www.poodr.com/). I decided that reading will be a nice way to complement my professional life. It took me a long time to finish the book (like 3 months :D), though it is really interesting. After reading POODR and doing some research I realized that actually there are many great books that don't get outdated instantaneously. Later I've built a habit and started reading much faster (which is a topic for another post I'm working on).

What I like about the books is: they provide structured knowledge. You don't need to search for the information on the topic each time. If you have a spare half an hour or even less, you can just return to the book and start reading. Over time you will notice how much knowledge you've got.

I found reading highly effective when accompanied by practice at work. It helped me to fill a lot of blanks in my knowledge and even gain more confidence. I would definitely advise my previous self to start reading tech books earlier in my career.

What about you? Do you see reading software development books as an effective way to learn?
What is missing in the ClassicPress project that you could contribute to?
Tags: classicpress, opensource
Published: 2019-04-08 10:03:00

---
title: What is missing in the ClassicPress project that you could contribute to?
published: true
tags: ClassicPress, opensource
canonical_url: https://www.classicpress.net/blog/2019/04/04/what-is-missing-in-the-classicpress-project-that-you-could-contribute-to/
---

Every open source project has an amazing community where individuals can use their particular skillset to help the project evolve. To ensure the project is managed and promoted in a way that maintains its primary objective, it needs feedback and help from the ever-growing user base.

One of the reasons we created ClassicPress was because WordPress was not listening to its users. We do not want to make the same mistake. This project has a simple motto, “The business-focused CMS. Powerful. Versatile. Predictable”.

And we need you!


[Check the full article!](https://www.classicpress.net/blog/2019/04/04/what-is-missing-in-the-classicpress-project-that-you-could-contribute-to/)
Introduction
Tags: firstissue, beginners, firstpost
Published: 2019-04-04 14:06:56

---
title: Introduction
published: true
description: A short post just to say hello...
cover_image: https://thepracticaldev.s3.amazonaws.com/i/4q6o4exyo4b07z8nhnfs.jpg
tags: #firstissue #beginner #firstpost
---

So while I'm having a slow coding day, I thought this might be a good time to sit down and finally start my blog!

Since starting is always the hardest part, this really just serves as me saying "Hi, I'm here and I will be hopefully contributing meaningful content to this great community".

The why behind it so to speak, is two-fold.

Explaining something has always been key for a greater understanding of subject matter. At least for me. 

So repeating and explaining something I've learned, will help me understand it better and it leads nicely into the next goal.

![blogger](https://thepracticaldev.s3.amazonaws.com/i/vjwbmj3lf5t7s4bymgkt.jpg)

There are always edge cases not easily resolved by a quick google or a look at the docs. Equally, there are many solutions to the programming problems we encounter.

Hopefully writing down and sharing what I learn will lead to another programmer being able to solve a problem with a little more ease. 

Learning to code the hard way is not required!

I invite you to follow along on my coding journey, you never know what we will learn!

Thank you for reading, I'll be back soon.
How to Read Local JSON Files In Angular 9|8|7?
Tags: angular, angular987, angularjsonfile, localjsonfiles
Published: 2020-01-31 21:34:19

---
title: How to Read Local JSON Files In Angular 9|8|7?
published: true
tags: Angular ,Angular 9|8|7 , angular json file, Local JSON Files
canonical_url: https://www.positronx.io/read-local-json-files-in-angular/
---

The post [How to Read Local JSON Files In Angular 7 | 8?](https://www.positronx.io/read-local-json-files-in-angular/) appeared first on [positronX.io](https://www.positronx.io).

In this tutorial, I am going to teach you how to read local JSON files in Angular  9|8|7  application. There are various methods available to read local JSON files in Angular. Let me show you the easiest way to read local JSON files in Offline Angular app.



 [Click here to read more](https://www.positronx.io/read-local-json-files-in-angular/)
Day 8 - Random Wallpaper Changer - 100 days 100 python scripts
Tags: python, productivity, beginners, career
Published: 2019-04-04 12:34:30

---
title: Day 8 - Random Wallpaper Changer - 100 days 100 python scripts
published: true
description: Day 6 - Converts PDF to CSV, Day 7 - Automatically pushes the code the Github
tags: python, productivity, beginners, career
cover_image: https://cdn-images-1.medium.com/max/1600/0*GEsDQGQ1BucUNW1g
series: 100 days 100 python scripts
---

##Day 8: update_gnome_wallpaper 

This script will randomly select an image file from a folder of files and update the wallpaper in ubuntu

```python
import os,random
import constants

WALLPAPER_DIR= constants.WALLPAPER_DIR # Wallpaper Location 

images=[item for item in os.listdir(WALLPAPER_DIR) if os.path.isfile(os.path.join(WALLPAPER_DIR,item)) and item.split(".")[-1].lower() in ["png",'jpg']]

if len(images) >0:
    wallpaper=random.choice(images)
    os.system("gsettings set org.gnome.desktop.background picture-uri file://"+os.path.join(WALLPAPER_DIR,wallpaper))
```


Please Visit my Git Repo to check out all the previous day challenges.

[https://github.com/ganeshraja10/automated-python-scripts](https://github.com/ganeshraja10/automated-python-scripts)
nohup for running remote scripts
Tags: devops, bash, shell, commandline
Published: 2019-05-10 05:52:46

---
title: nohup for running remote scripts
published: true
tags: devops, bash, shell, commandline
canonical_url: https://blog.chilcutt.com/2019/04/04/nohup-for-running-remote-scripts.html
---

I’ve been aware of `nohup` for a while, but never took the time to do a deeper dive until today.

**tl;dr** run a command that won’t die when you log out (useful for tasks on a remote server)

```
$ nohup my_long_running_script > script_results.out 2>&1 &
```

![](https://cdn-images-1.medium.com/max/2428/1*vpv1N6DEHAW-alSBREEZSg.png)

The `nohup` utility lets your run another command that is immune to hangups, meaning that it won’t die when you log out of the machine. This is particularly useful for when you’re connected to the terminal of a remote machine (e.g. using `ssh`).

Let’s break down the example from the beginning:

<pre>
$ <b>nohup</b> my_long_running_script > script_results.out 2>&1 &
</pre>

The `nohup` utility causes the script being run to be immune to [`SIGHUP`](https://en.wikipedia.org/wiki/SIGHUP), the signal which is sent to a process when the terminal controlling it is closed.

![](https://cdn-images-1.medium.com/max/2840/1*USBgmRf4noGAv1-ydENpfQ.gif)

<pre>
$ nohup <b>my_long_running_script > script_results.out</b> 2>&1 &
</pre>

The next part is running the command as usual and sending the output to a text file. Because we’re going to disconnect from this terminal session, we’re not going to be observing the output live as the script runs. To capture the output, we direct the output to a file `script_results.out`.

<pre>
$ nohup my_long_running_script > script_results.out <b>2>&1</b> &
</pre>

`2>&1` redirects `STDERR` to `STDOUT`, which will allow us to capture both normal output and error output in our results file.

<pre>
$ nohup my_long_running_script > script_results.out 2>&1 <b>&</b>
</pre>

The final `&` causes the nohup command to be run in the background, so that we’re returned immediately to the shell once the command has been started.

* * *

_Prior to this, I might have started a `tmux` or `screen` session on the remote machine to make sure the script cannot be interrupted, but nohup feels a lot more straight-to-the-point._
Tech notes: how to have it all in one place
Tags: career, contributorswanted, learning, technology
Published: 2019-04-04 11:50:42

---
title: Tech notes: how to have it all in one place
published: true
description: 
tags: career,contributorswanted,learning,technology
---

Last year I began to write down tech notes in a Google Sheet. I actually write about anything related to technology and programming: TDD, Version Control, Clean code, Programming Paradigms, DevOps, AWS, etc. And I use different sources: videos, articles, books, or even talks.

![img](https://thepracticaldev.s3.amazonaws.com/i/tlm1ywx57w5r9ejemonv.png)

Check it out [here](https://docs.google.com/spreadsheets/d/1T5ohNFg8p-wcG2apNXTqyinBfFVSmOPwTOfvD2_y9Mk/edit?usp=sharing)!

##How it all started...
I was hanging with a friend and he told me that while he attended University, he had created an Excel with relevant concepts he had learned everyday during his lectures. I thought it was an excellent idea, a place to write a short explanation regarding a lot of different subjects!

So I did the same. I created a Google Drive Sheet, and started putting down technical notes.

Although I felt this was a great idea, I still needed to find the way to add every week more tech notes, and not giving up. And also, of course, read them.

It's funny because when I started developing these “Tech Notes” I had recently began using [Habitica](https://habitica.com/). So I gathered courage and created tasks to help me out. On Monday, Wednesday and Friday I must write a new item, and on Tuesday and Thursday I must read one randomly (on weekends I rest).

I hope you enjoy it and can help me by adding more notes!

Thanks to [Sofía Cortés](https://github.com/SofiCortes) who helped me enhancing the document.
Hands on with Publii, a Free Static CMS Generating HTML Sites
Tags: javascript, webdev, tutorial, beginners
Published: 2019-04-04 17:35:01

---
title: Hands on with Publii, a Free Static CMS Generating HTML Sites
published: true
tags: javascript, webdev, tutorial, beginners
canonical_url: https://snipcart.com/blog/publii-static-cms-html
---

![Hands on with Publii, a Free Static CMS Generating HTML Sites](https://snipcart.com/media/204243/publii-static-cms.png)

Building a website used to be easy.

You’d code some HTML, throw in a little CSS, spice it up with JS, and *voilà*!

You’d then push these static files to any server, and **BAM**, a live site would appear.

Today, you can easily get lost in tooling to build “modern” sites: JS frameworks, task runners, module bundlers, package managers, testing frameworks, linting, pre-processors…

But it doesn’t ALWAYS have to be that way:

**Some web projects are *really simple*, and so should their tooling be**

At Snipcart, for instance, we receive lots of requests for adding e-commerce to static sites.

While our [Jekyll](https://snipcart.com/blog/static-site-e-commerce-part-2-integrating-snipcart-with-jekyll), [Hugo](https://snipcart.com/blog/hugo-tutorial-static-site-ecommerce), [Gatsby](https://snipcart.com/blog/react-ecommerce-gatsby-tutorial), and [11ty](https://snipcart.com/blog/11ty-javascript-static-site-generator-tutorial) tutorials help developers, another, recurring request often pops up later on:

> How can I add a CMS to my static site?

Recently, I asked that question myself.

See, I had this project: build a website to show how disappointed I was with Apple (long story).

My goal? Create a static HTML site I could manage with a CMS, with as little coding and $ as possible. And do all of that in a single weekend—tops.

**(The tutorial section further down shows you exactly how I did this. Step. By. Step.)**

First, I looked at the static CMS space a bit.

  

→ Read the full post [here](https://snipcart.com/blog/publii-static-cms-html)
Attaching actions to rollbacks in Spring
Tags: database, transactions, spring, java
Published: 2019-04-04 09:34:08

---
title: Attaching actions to rollbacks in Spring
published: true
description: How to attach actions to Spring @Transactions to be executed on commit or rollback
tags: databases, transactions, spring, java
canonical_url: https://virtualmackem.blog/2019/04/03/attaching-actions-to-rollbacks-in-spring/
---

We have a problem in a Spring Boot app where some files are created during a database transaction and they need to be deleted if the transaction rolls back. This is my solution...

When a file is created, we publish an event containing the filename:

```java
applicationEventPublisher.publishEvent(new FileCreatedEvent(this, filename));
```

We have another component which listens for the event:

```java
@TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK)
public void handleRollback(FileCreatedEvent event) {
    fileDeleter.delete(event.getFilename()); 
}
```

As you can see, Spring Framework provides a pub/sub event management feature where you can publish an event using [ApplicationEventPublisher](https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/ApplicationEventPublisher.html) (which can easily be autowired). You can then subscribe to the event using a [@TransactionalEventListener](https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/transaction/event/TransactionalEventListener.html) annotation[ ^1](#1), which can be tailored to fire only after a rollback by setting the phase parameter on the annotation to [AFTER_ROLLBACK](https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/ApplicationEventPublisher.html) (as shown).

Crucially, the events are not delivered to the listener until the transaction resolves. This makes logic around transactions much simpler.Also, this works with multiple simultaneous events attached to the same transaction, which means you can fire discrete events for each file and the events will each be delivered when the transaction completes.

One other potential use for this pattern would be to prevent misleading log/audit entries by triggering an event for a new entry but only recording the event if and when the transaction commits successfully. This way you wouldn't see log messages saying "created new entity in database" unless the new entity had really been created.

<a name="1">^1</a> This pattern also works without transactions if you subscribe using a simple [@EventListener](https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/event/EventListener.html). In this case, the event would be handled immediately by the listener, rather than waiting until the end of the transaction.
Underrated Articles on Dev.to Last week
Tags: top7, webdev, bestofdev
Published: 2019-04-04 08:52:25

---
title: Underrated Articles on Dev.to Last week
published: true
description: 
tags: icymi, webdev, meta, bestofdev
cover_image: https://thepracticaldev.s3.amazonaws.com/i/lcsg9z6ntmgb5ms2kion.png
series: Underrated Articles
---
Hello! I'm back with another installment of underrated posts of last week! A little late this week, I know. Things have been hectic for our team lately with the launch of [Dragula](https://www.producthunt.com/posts/dragula-2) and everything that has followed. The response has been phenomenal and we're over the moon. Try Dragula if you haven't yet. 😃

![](https://thepracticaldev.s3.amazonaws.com/i/iypql1u5mrey1qm8jsrf.gif)

Anyway, without wasting any more time, let's check out the articles.

## 1. Set Tasks and Boost Productivity

Project management includes developing a project plan, which involves defining the project goals, strategy to achieve them, identifying tasks and quantifying the resources needed, and determining timelines for completion. This article by Django Stars is a complete guide to starting a project and building a quality product on time. 
{% link https://dev.to/djangostars/how-to-successfully-set-tasks-and-boost-your-development-team-s-productivity-48eg %}

## 2. Guide for Remote Employees

We are in a flexible workplace revolution. More employees than ever before want to work remotely. In this article, David gives basic tips to employees who are new to remote work. This guide will help them work effectively, avoid the common pitfalls of remote work, and stay 100% productive.
{% link https://dev.to/theelectricdave/a-basic-survival-guide-for-the-new-remote-employee-225p %}

## 3. Simple Styling Tricks
This is the first article of Joris's series "styling tricks and way to css them".
In this one, image overlays are explained well along with examples. I'm looking forward to read the next articles from this series.
{% link https://dev.to/joruch/simple-styling-tricks-and-how-to-css-them-image-overlays-ioh %}

## 4. Spend Time on Opensource Software

In this post, Mohammed gives reasons why he spends so much time on open source software. Spending time on these projects helps him in building his own tools, staying connected to technology, continuous improvement, and many more benefits.
{% link https://dev.to/myterminal/12-reasons-why-i-spend-time-on-open-source-software-14l9 %}

## 5. List of Productivity books Worth reading

There are many ways to reduce stress, and different activities work best for different people. The kind of focus you experience while reading can translate to your work – greater attention can help you concentrate on one task and boost productivity. In this article, Gio lists ten books which helped him boost his productivity. 
{% link https://dev.to/mokagio/ten-productivity-books-you-won-t-regret-reading-38bh %}

---
*That's all for this week. These were my personal favorite underrated posts from last week. I hope you liked this post. Tell me about your favorite posts that went underrated in the comments below!* ❤️
ESLint not working in VS CODE?
Tags: eslint, vscode, json, javascript
Published: 2019-04-04 08:45:12

---
title: ESLint not working in VS CODE?
published: true
description: A note to myself.
tags: eslint, vscode, json, javascript
---
*(check out [my blog](https://raffaelepizzari.com/))*

Hi Raffaele,

this a note from your old self.

I know that ESLint is not working in VS Code.
You have already installed all the plugins, probably reinstalled VSCode, checked your VSCode Settings and double-checked your .eslintrc several times and perhaps you are sitting in a corner thinking about quitting your job.

I know how you feel, you have already been there but you won't die on this hill.

Just open VSCode Settings (./vscode/settings.json) and add this:
 
```json
"eslint.validate":[  
    {  
        "language":"vue",
        "autoFix":true
    },
    {  
        "language":"html",
        "autoFix":true
    },
    {  
        "language":"javascript",
        "autoFix":true
    },
    {  
        "language":"typescript",
        "autoFix":true
    }
]
```

Restart VSCode and enjoy.

Sincerely yours,
You.
I am a middle aged junior developer, Ask Me Anything!
Tags: ama, beginners, career
Published: 2019-04-04 08:11:12

I recently [wrote an article](https://dev.to/tomasforsman/being-a-middle-aged-junior-58eo) about being an unemployed junior developer, coming back into the industry after 20 years at the age of 40.

Now I'm about to write the second article in that series, the "perseverance wins" article I was hopeing to be able to write at this point. First I thought I'd host an ama to get some insight in what topics would be interesting to hear more about.

I'm hoping for some good discussions in the comments that I can draw from when writing the article.

Some background:

* I live in Sweden
* I have a wife, two dogs, three kids and four letters; ADHD
* I got many job offerings after posting the article, from both big and small companies
* None of the many people that contacted me was from HR or a recruiter, they were all management or developers
* I now work with web development and hoping to move into game development in the future
Tech Lead Talk, a Community of Practice
Tags: dailywriting
Published: 2019-04-09 01:24:09

---
title: Tech Lead Talk, a Community of Practice
published: true
tags: daily-writing
canonical_url: https://marcusblankenship.com/tech-lead-talk-a-community-of-practice/
---

A few months ago I started www.TechLeadTalk.com.

It’s a free forum where tech leaders can swap ideas and help each other with real problems.

We’re taking it one step farther to turn it into a Community of Practice. One of our moderators, Peter, wrote up a summary that explains it nicely.

Check it out, and consider joining if you’d like to contribute.

[https://www.techleadtalk.com/t/what-is-this-thing-anyway/266](https://www.techleadtalk.com/t/what-is-this-thing-anyway/266)

Take care,

Marcus

The post [Tech Lead Talk, a Community of Practice](https://marcusblankenship.com/tech-lead-talk-a-community-of-practice/) appeared first on [Marcus Blankenship](https://marcusblankenship.com).
Request for Post: Differences Between React, Angular, and Vue
Tags: requestforpost, react, angular, vue
Published: 2019-04-04 07:59:36

This comment, left on one of my recent posts

{% devcomment 9p84 %}

which quotes [this Quora answer](https://qr.ae/TW1i2w), suggests that React and Angular are very different things. Or that the functionality of React is a subset of the functionality of Angular. Can someone shed some light on the differences between these two, and some of the other big JavaScript frameworks / libraries, like Vue?