teleren/devto huggingface dataset:
How to use Spring Batch Restartable Function
Tags: springboot, springbatch, restartable
Published: 2021-04-26 13:20:33

https://grokonez.com/spring-framework/spring-batch/use-spring-batch-restartable-function

How to use Spring Batch Restartable Function


<strong>SpringBatch</strong> provides a <strong>restartable</strong> mechanics with a Job, in the <a href="http://dsds">How to use Spring Batch Restartable Function</a> tutorial, <a href="https://grokonez.com/" target="_blank"><strong>JavaSampleApproach</strong></a> will present to you the principle of this function with <strong>SpringBoot</strong>.

Related Post:
1. <a href="https://grokonez.com/spring-framework/spring-boot/configure-spring-batch-step-restart" target="_blank">How to configure Spring Batch Step for restart</a>
2. <a href="https://grokonez.com/spring-framework/spring-boot/start-spring-batch-using-spring-boot" target="_blank">How to start with Spring Batch using Spring Boot – Java Config</a>
3. <a href="https://grokonez.com/spring-framework/spring-batch/spring-batch-xml-config-spring-boot" target="_blank">Spring Batch XML Config by Spring Boot</a>
4. <a href="https://grokonez.com/spring-framework/spring-batch/spring-batch-job-parallel-steps" target="_blank">Spring Batch Job with Parallel Steps</a>
5. <a href="https://grokonez.com/spring-framework/how-to-import-csv-data-to-postgresql-database-using-spring-batch-job" target="_blank">How to import CSV data to PostgreSQL Database using Spring Batch Job</a>

<!--more-->
<iframe width="853" height="480" src="https://www.youtube.com/embed/evYcfUA64EE?rel=0" frameborder="0" allowfullscreen></iframe>
<div id="tuttoc" class="jsa-toc"></div>

<div id="tutcontents">
<h2>I. Technologies</h2>
– Java 1.8
– Maven 3.3.9
– Spring Boot: 1.4.3.RELEASE
– Spring Tool Suite – Version 3.8.1.RELEASE

<h2>II. Overview</h2>

Create a Batch Job which has a simple step with a <strong>Reader</strong> & <strong>Writer</strong>.
<strong>Reader</strong> reads a list file-paths then pass them to a <strong>Writer</strong>. The <strong>Write </strong>uses file paths to process content of each file. 
With created JOB, test a <strong>restartable</strong> function base on <strong>FileNotFound</strong> Error.
<strong>Note</strong>: a Batch Job is created with <strong>restartable</strong> default. Spring Batch also supports configuration to <strong>prevent</strong> the <strong>restartable</strong> function.

<h3>1. Project Structure</h3>
<img src="https://grokonez.com/wp-content/uploads/2017/01/spring-boot-springbatch-restartable-project-structure-1.png" alt="spring boot springbatch restartable project structure" width="687" height="548" class="alignnone size-full wp-image-2515" />

<h3>2. Step to do</h3>
- Create SpringBoot project
- Create simple step
- Config a Batch Job
- Create a Job Launch controller
- Config Batch Job Database
- Enable Batch Job
- Scenario Test

https://grokonez.com/spring-framework/spring-batch/use-spring-batch-restartable-function

How to use Spring Batch Restartable Function
Kubernetes Docker container application delivery
Tags: docker, kubernetes
Published: 2021-04-26 13:20:11

Let’s look at a timeline from the time Docker and container technology first debuted back in 2013 to the year 2017. Container adoption has grown from 0% to 20% and is predicted to see an adoption of 50% by the end of the year 2020 as per reports. Container technology has seen a journey from small scale test deployments to large scale production deployments in enterprises across industries.
Custom Site Preferences and Custom Global Preferences in SFRA 📝
Published: 2021-04-26 13:04:48

#### INTRO

How many times do you have thought where you can store properties about configurations? Salesforce Commerce Cloud provides Site and Global Custom Preferences where we can store properties divided into groups. Global Custom preferences affect all sites instead Site Preferences affect only site where it's configurated.
Store properties in preferences allows us retrive it every time we need.
Setting a site custom preferences or a global custom preferences is practically the same. We are going to set up a group that contains properties that we will then use within our app.

### LET’S SET UP A CUSTOM PREFERENCES 💾

If you don’t have **system-objecttype-extensions.xml** file you must create it under _sites/sites_template/meta/_.

Initialize xml and create a xml node `<type-extensions type-id=“SitePreferences”> </type-extensions>`.
In `<type-extensions type-id=“SitePreferences”> </type-extensions>` we can crate other two xml nodes called `<custom-attribute-definitions> </custom-attribute-definitions>` and `<group-definitions> </group-definitions>`.

* In `<custom-attribute-definitions> </custom-attribute-definitions>` we can define our custom attribute

* In `<group-definitions> </group-definitions>` we can create `<attribute-group group-id="SiteCustomAttributeGroupID">`  which contain `<display-name xml:lang="x-default">Site Custom Attribute Group</display-name>` and  `<attribute attribute-id="SiteCustomAttributeID" />` refers to attribute-id which I specified earlier.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pzikqqesnht4ycxk0ywz.png)


Now we can upload **system-objecttype-extensions.xml** in business manager under _Administration -> Site Development -> Site Import & Export_.

After uploaded xml you can find your site custom preferences in Business Manager under _Merchant Tools -> Site Preferences -> Custom Preferences_.


Now you can access to preferences value through:

`dw.system.Site.getCurrent().getCustomPreferenceValue('SiteCustomAttributeID’);`


But how i explained earlier you can create also a Global Custom Preferences, but the unique difference is in `<type-extensions type-id=“SitePreferences”> </type-extensions>`, you have to replace **type-id=“SitePreferences”** with **type-id="OrganizationPreferences"**. 

And you can find your Global Custom Preferences in Business Manager under _Administration -> Global Preferences -> Custom Preferences_.
Why Software Engineering?
Tags: bootcamp, coding, beginners, javascript
Published: 2021-04-26 13:01:48

Hey guys, Sheridan here! I wanted to hop on and talk about my journey in software engineering, why I'm here, what makes me want to do this, so on and so forth.

First, let me start out with saying I am not someone who knows a lot about computers or computer programs. I am a total beginner when it comes to coding. Anything beyond the basics of control C and how to minimize and maximize a webpage is beyond my scope of understanding. But, I have friends who have gone through coding boot camps and talked about how much freedom it allows. I see how much fun they have with the people they work with, and how they just seem to be having a good time doing their job. they recommended the flatiron boot camp, now here we are.

Anyway, all that to say I dabbled in HTML on my own time just to see what I thought... and holy crap was it fun! I was able to dabble in HTML, CSS, and Java script to create a basic website. 

I will go ahead and state that this is the hardest thing I have ever done by far. Total cluster ~you know what ~ when you're in the middle of coding. But, once you get it, it's similar to the feeling of hiking up a steep mountain and finally reaching the top and seeing those beautiful mountain views. 

I have an educational background. Meaning, I graduated with a bachelors degree in Anthropology and a minor in History. I know what you're thinking. Sheridan what the heck made you want to make a 360 and go to coding... on a computer... when all you were doing was scientific based nerd things. To be honest I don't even know. I want to eventually dabble in van life and I quickly realized the path I was on was not gonna be able to transfer on the road.

I'm excited to continue this journey, and see what other doors are opened along the way!
What is VS Code Johnny❓ 🤔
Tags: discuss, watercooler, webdev, javascript
Published: 2021-04-26 12:41:01

Hello comrades! 👋

I decided to show off. And I'll show you my VS Code setup. 

![img](https://media.giphy.com/media/R2tImHqP1t5AzFBuzH/giphy.gif)

---

# First of all the theme 

I have been using the [morgan.codes](https://marketplace.visualstudio.com/items?itemName=morgan-codes.morgan-codes-vscode-theme) theme for a long time. But recently I changed it. I've always liked green and found my favorite in this style - [Borealis Theme](https://marketplace.visualstudio.com/items?itemName=eckertalex.borealis):

![my theme](https://res.cloudinary.com/danilnotorious/image/upload/v1619281730/notepadnowastoreapp_j4ipxa.jpg)

Also I prefer to use [LaserWave](https://marketplace.visualstudio.com/items?itemName=jaredkent.laserwave) and [Cobalt2](https://marketplace.visualstudio.com/items?itemName=wesbos.theme-cobalt2) and [City Lights](https://marketplace.visualstudio.com/items?itemName=Yummygum.city-lights-theme) themes.

# Icons are also important
Favorite the [Material Icons](https://marketplace.visualstudio.com/items?itemName=Equinusocio.vsc-material-theme-icons) of course:
![my icons](https://res.cloudinary.com/danilnotorious/image/upload/v1619283393/16_Notepad_1_ettwbs.png)
And [City Lights icons](https://marketplace.visualstudio.com/items?itemName=Yummygum.city-lights-icon-vsc).

#Font 
Top 3: [Agave Nerd Font](https://www.nerdfonts.com/font-downloads), [Fira Code](https://github.com/tonsky/FiraCode), [Operator Mono](https://rubjo.github.io/victor-mono/):
![my fonts](https://res.cloudinary.com/danilnotorious/image/upload/v1619283820/customize-notepad_yj7ov2.png)

# Extensions maybe
Nothing special. 

![extensions](https://media.giphy.com/media/baPIkfAo0Iv5K/giphy.gif)

Except: [Project manager](https://marketplace.visualstudio.com/items?itemName=alefragnani.project-manager), [Disable Ligatures](https://marketplace.visualstudio.com/items?itemName=CoenraadS.disableligatures), [Import Cost](https://marketplace.visualstudio.com/items?itemName=wix.vscode-import-cost), [Markdown Preview Enhanced](https://marketplace.visualstudio.com/items?itemName=shd101wyy.markdown-preview-enhanced), [Multiple clipboards](https://marketplace.visualstudio.com/items?itemName=slevesque.vscode-multiclip).

---

So, what does your VS Code setup look like? 🧐
Drop it in the comments 👇
Where to look for DevRel jobs
Tags: career
Published: 2021-04-29 20:31:56

---
title: Where to look for DevRel jobs
published: true
date: 2021-04-26 12:35:49 UTC
tags: Career
canonical_url: https://www.devocate.com/where-to-look-for-devrel-jobs/
---

 ![Where to look for DevRel jobs](https://images.unsplash.com/photo-1529717730488-7a2492983b2c?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wwfDF8c2VhcmNofDR8fGpvYnN8ZW58MHx8fHwxNjE5NDQwMjU5&ixlib=rb-1.2.1&q=80&w=2000)

Developer Relations roles have never been in demand more than they are now. Finding someone with developer advocacy experience, who likes talking to other developers, isn't the easiest to find. Here's the thing though, I wholeheartedly believe that many developers can easily pick up developer advocacy. Developers are passionate and they do really enjoy discussing tech with others who understand it.

If you're in the market for a new role in DevRel, or hiring someone, check out the list we curated below.

## Places to search for Developer Relations jobs
- [DevRel.jobs](https://www.devrel.jobs/)
- [DevRel Weekly Newsletter](https://devrelweekly.com/)
- [DevRel Collective](https://devrelcollective.fun/#jobs)
- [Jobs in DevRel](https://jobsindevrel.com/)
- [DevRelX jobs](https://www.devrelx.com/jobs)
- [Community Manager jobs](https://communitymanagerjobs.co/)
- [CMX Hub jobs](https://cmxhub.com/jobs/)
Wanna change the eCommerce market?
Tags: cybersecurity, ecommerce, cofounder, firewall
Published: 2021-04-26 12:32:04

Hi guys, I stumbled over this forum from an Indiehackers post. I am the Founder of fakescouts.com and I am basically looking for developers that want to help fighting fake products in the #eCommerce market. #startup #cofounder

I am a sales & marketing guy. FakeScouts has won several awards in the last 2 years, but we are missing developers that want to join a startup that has actual potential to CHANGE the eCommerce space for good. 

Investors are waiting for us to move on, but I am sick of having to pay agencies that have no other motivation but the next paycheck. 

Thought I might as well join a developer forum to find some people from all over the world eager to make a positive change in our world :)

Thanks, Thorsten from Germany (soon Spain :)
How to host node js for free with custom domain and (free) SSL
Tags: node, ssl, heroku, netlify
Published: 2021-04-26 12:28:54

**PROBLEM STATEMENT:**

Inability to host node js applications free of charge and use a custom domain with SSL enabled.

I have implemented this, and my site is running fine.

**SOLUTION:**

1. Make your nodejs app to be an API with endpoints that you can call from somewhere else. This is your backend.

2. Make your frontend call your nodejs backend.

3. Host your backend on Render.com . You will get a secured (SSL enable) url.

4. Host your frontend on Netlify. You will get a secured (SSL enabled) url like: myfrontend.netlify.app

5. Register your custom domain on on your myfrontend.netlify.com app, this comes with SSL enabling as specified by Netlify DOCS:

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q5n09nyn0y4tlh3s4v8a.png)

So your app could now be accessed via: https://myCustomDomain.com

Try this and let me know how it goes.

_E se pupo_
Learned the hard way: Enabling Quick Navigation for VoiceOver
Tags: todayilearned, a11y, webdev, webaccessibility
Published: 2021-04-26 12:27:02

While working on making a 180° degree video accessible, we added a progress bar to the player which is accessible by keyboard. Before, the only option for the user was to drag a button at the center of the viewport around to get a good view of the product, now, by using the indicator on the progress bar, the same can be done either through arrow keys or skipping a little faster by using arrow keys + shift. 

Additionally, the percentage value of the progress should be read out by screen readers upon change. So far, so good. All constraints considering, we were pretty happy with the implementation. 

Now, to the ~~challenging part~~ learning experience: 

Minutes before we were up for review with our client, I double checked the feature on my computer, and to my horror keyboard navigation did not work at all anymore. I could still tab through interactive elements, but there was no way for me to navigate our new progress bar with the arrow keys anymore as it was intended. Instead the arrow keys now mimicked the functionality of the tab key. 

<img width="100%" style="width:100%" src="https://media.giphy.com/media/WpaVhEcp3Qo2TjwyI1/giphy.gif">

I was - naturally - horrified and clueless how this could happen. When checking with my colleagues (it was still working for them) and keyboard navigation on [Able Player] (https://ableplayer.github.io/ableplayer/ ) (great, accessible video player we got a lot of inspiration from), it became clear that something had to be wrong. Not with our implementation, but with my settings.

With no time left to investigate further, we went into review. And so the inevitable happened: While it had worked seconds before, when presenting to the client, keyboard navigation on our player completely failed us. Of course we were embarrassed and slightly horrified. We tried a number of things, explained to the client best as we could and - a little startled - finished the review. 

If you are more experienced with VoiceOver, it’s probably already clear what happened here. We had accidentally enabled [Quick Nav ](https://www.apple.com/voiceover/info/guide/_1133.html) on Voice Over by (again, accidentally) pressing the right and left arrow key at the same time. With Quick Nav, you navigate a page mainly by using right and left arrow keys, which is why pressing an arrow key did not, like we expect, interact with our progress bar slider, but skipped to the next interactive item. 

Great feature - we simply didn’t know about it and -  in our ignorance - had to learn the hard way. Now, it’s already a bit of a laugh, but what we take away in all seriousness, is this: 
* We need to do our homework when it comes to VoiceOver (and other screen readers) - there are still too many things we don’t know. 
* Not being able to present in front of the client sucks. But it’s ok. Nothing too bad came out of it. That was a good reminder to take a little pressure off. 

Did something similar ever happen to you? Feel free to share it in the comments so we can learn from each others mistakes :)
Simple trick to make FactoryBot work with STI
Tags: rails, factorybot, rspec
Published: 2021-04-26 12:24:04

---
title: Simple trick to make FactoryBot work with STI
published: true
description: 
tags: Rails, FactoryBot, RSpec
//cover_image: https://direct_url_to_image.jpg
---

__TL;DR__
Override a factory's init strategy to have it start life as the STI class, avoiding the need to call `.becomes` or `.refind`.

```rb
FactoryBot.define do
  factory :invoice do
    initialize_with { type.present? ? type.constantize.new : Invoice.new }
```

__Discussion__
When I started work on the current project, there were no traits in use and work with STI models was cumbersome. Instead of traits there was a separate factory for every type. This arguably can be a reasonable setup, provided all STI factories inherit from the "abstract" base factory, and shared (or all) traits are defined there, rather than possibly repeated in each STI factory.

```rb
# how it started out
FactoryBot.define do
  # the abstract, not intended to be called
  factory :invoice do
    trait :paid do 
      status { "paid" }
    end
  end

  # STI factory, intended to be called
  factory(
    :additional_cost_invoice,
    parent: :invoice, class: "InvoiceAdditionalCost"
  ) do
    # not a fan of this trait that's available for this type of invoice, but could be a legit use-case.
    trait :only_for_additioanl_costs do
    end
  end
end

# call example
FactoryBot.create(:additional_cost_invoice, :paid)
#=> InvoiceAdditionalCost
```

Still, I believe that it's least surprising to just have one factory and traits for each type. 

```rb
FactoryBot.define do
  # no longer abstract, the one and only
  factory :invoice do
    trait :paid do 
      status { "paid" }
    end
    
    trait :additional_cost do 
      type { "InvoiceAdditionalCost" }  
    end

    # now have to remember not to use this elsewhere, a minor problem
    trait :only_for_additioanl_costs do
    end
  end 
end

# call example
FactoryBot.create(:invoice, :additional_cost, :paid)
#=> Invoice
FactoryBot.create(:invoice, :additional_cost, :paid).refind # or becomes
#=> InvoiceAdditionalCost
```

Passing in the type from trait *after* initialisation has several drawbacks. First is needing to manage the STI type either by reloading the record from DB or manually using `becomes`. The other problem is validations and callbacks - only those defined on base `Invoice` class get triggered, especially during creation.

To fix this problem, FactoryBot allows specifying a custom init block (as explained in [README's "Custom Construction" section](https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#custom-construction))

```rb
FactoryBot.define do
  factory :invoice do
    initialize_with { type.present? ? type.constantize.new : Invoice.new }
  end
end

# call examples
FactoryBot.build(:invoice) #=> Invoice
FactoryBot.build(:invoice, :additional_cost)
#=> InvoiceAdditionalCost
```

This fixes both problems and allows having one base factory with type traits.
Spring Batch XML Config by Spring Boot
Tags: springbatch, springboot, configuration
Published: 2021-04-26 12:04:24

https://grokonez.com/spring-framework/spring-batch/spring-batch-xml-config-spring-boot

Spring Batch XML Config by Spring Boot

How to start<strong> Spring Batch XML Config</strong> - use Spring Boot

Many business operations need to process with batch job for critical environment. Spring Batch is a lightweight framework to boot the batch application.

For starting, you can follow the<a href="https://grokonez.com/spring-framework/spring-batch/start-spring-batch-using-spring-boot" target="_blank"> How to start with Spring Batch using Spring Boot – Java Config</a>. In the tutorial I will guide you how to start with <strong>XML config</strong>.

Related Articles:
- <a href="https://grokonez.com/spring-framework/spring-boot/start-spring-batch-using-spring-boot">How to start with Spring Batch using Spring Boot – Java Config</a>
- <a href="https://grokonez.com/spring-framework/spring-batch/use-intercepting-job-execution-spring-batch">How to use Intercepting Job Execution in Spring Batch</a>
- <a href="https://grokonez.com/spring-framework/spring-boot/use-spring-batch-restartable-function" target="_blank">How to use Spring Batch Restartable Function</a>
- <a href="https://grokonez.com/spring-framework/spring-boot/spring-batch-programmatic-flow-decision" target="_blank">Spring Batch – Programmatic Flow Decision</a>
- <a href="https://grokonez.com/spring-framework/how-to-import-csv-data-to-postgresql-database-using-spring-batch-job" target="_blank">How to import CSV data to PostgreSQL Database using Spring Batch Job</a>

<!--more-->
<div id="tuttoc" class="jsa-toc"></div>

<div id="tutcontents">
<h2>I. Structure of project Spring Batch XML Config</h2>

<img src="https://grokonez.com/wp-content/uploads/2016/10/New-strucutre.png" alt="spring batch xml config" width="653" height="404" class="alignnone size-full wp-image-1622" />

<h2>II. Spring Batch XML Config</h2>

Follow <a href="https://grokonez.com/spring-framework/spring-batch/start-spring-batch-using-spring-boot" target="_blank">How to start with Spring Batch using Spring Boot – Java Config</a>, we have a <strong>BatchConfig</strong> class as below:

More at:

https://grokonez.com/spring-framework/spring-batch/spring-batch-xml-config-spring-boot

Spring Batch XML Config by Spring Boot
Getting the i3wm tiling experience in Gnome Desktop
Tags: linux, i3wm, shell
Published: 2021-04-26 12:02:37

## Introduction
Want a tiling WM but still require the capabilities of the fully fledged gnome desktop? 

**So what is a tiling WM?**
Tiling window managers provide a perfect to setup your windows on the screen so the whole screen real estate is used. i3WM is the best know tiling window managers. i3WM is generally highly dependent on keyboard use.

Using i3WM does require a learning curve and require some time to learn on how to setup and use it as a daily driver.


Learning how to use i3WM might be a story for another day but we want to use the features of a tiling WM on the GNOME Desktop.

## Installing the Pop shell
```
sudo apt install git node-typescript make
git clone https://github.com/pop-os/shell.git
cd shell
make local-install
```
## Setting up the Gnome Desktop to use Pop Shell

![Enable the Pop Shell Extension](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ne98z84anhtuyiink0sp.png)
Enable the Pop Shell extension in Gnome Tweaks under Extensions.
![Enable Window tiling](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q5qlpn617z61pgstrvnr.png)
Enable Window tiling to create window tiles so that they can automatically place themselves on the screen

![Default Shortcuts](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/asd8mnw1x4jb2v9e6b3m.png)
These are the default shortcuts for the pop shell. You can change them from the keyboard settings if you want to.

You can visit the pop shell settings to set the gaps between your windows if you find it too big or too small. 

# So what does this help with?
Gnome doesn't really support quarter tiling, on really huge screens those who use windows already know that how much quarter tiling helps. 
![Quarter Tiling with Pop Shell](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/up4rgz72u509qcodzk7e.png)