teleren/devto huggingface dataset:
Go: Netflix Conductor Worker
Tags: microservices, go, opensource
Published: 2021-12-05 16:43:23

## What is Conductor
[Conductor](https://github.com/Netflix/conductor) is a Microservices orchestration platform from Netflix, released under Apache 2.0 Open Source License.

## Download and start Conductor server in 5 minutes
[Quickstart] (https://orkes.io/content/docs/getting-started/install/running-locally)

## Install Golang package
```
go get github.com/netflix/conductor/client/go
```

## Implementing a Task a Worker#
task package provides the types used to implement the worker. Here is a reference worker implementation:

```
package task

import (
    "fmt"
)

// Implementation for "task_1"
func Task_1_Execution_Function(t *task.Task) (taskResult *task.TaskResult, err error) {
    log.Println("Executing Task_1_Execution_Function for", t.TaskType)

    //Do some logic
    taskResult = task.NewTaskResult(t)
    
    output := map[string]interface{}{"task":"task_1", "key2":"value2", "key3":3, "key4":false}
    taskResult.OutputData = output
    taskResult.Status = "COMPLETED"
    err = nil

    return taskResult, err
}
```

## Worker Polling
Here is an example that shows how to start polling for tasks after defining the tasks.

```
package main

import (
    "github.com/netflix/conductor/client/go"
    "github.com/netflix/conductor/client/go/task/sample"
)

func main() {
    c := conductor.NewConductorWorker("http://localhost:8080", 1, 10000)

    c.Start("task_1", "", sample.Task_1_Execution_Function, false)
    c.Start("task_2", "mydomain", sample.Task_2_Execution_Function, true)
}
```

### NewConductorWoker parameters
1. baseUrl: Server address.
2. threadCount: No. of threads. Number of threads should be at-least same as the number of workers
3. pollingInterval: Time in millisecond between subsequent polls



See 
[https://github.com/Netflix/conductor/tree/main/polyglot-clients/go](https://github.com/Netflix/conductor/tree/main/polyglot-clients/go)
for the source code and follow us on GitHub for updates.
Is My Car a Passenger Vehicle or MPV?
Published: 2021-12-05 16:34:34

Is My Car a Passenger Vehicle or MPV?  Window tint laws in many states are different depending on the type of [vehicle ](https://www.thetintlaw.com/is-my-car-a-passenger-vehicle-or-mpv/)you have. Where applicable, window tints can be significantly different when driving a passenger or multi-purpose vehicle.
𝑯𝑻𝑻𝑷 𝑨𝒓𝒄𝒉𝒊𝒗𝒆’𝒔 𝒂𝒏𝒏𝒖𝒂𝒍 𝒔𝒕𝒂𝒕𝒆 𝒐𝒇 𝒕𝒉𝒆 𝒘𝒆𝒃 𝒓𝒆𝒑𝒐𝒓𝒕 2021
Tags: webdev, webperf, mobile, javascript
Published: 2021-12-05 16:29:57

Strongly recommend read for #webperformance 𝑯𝑻𝑻𝑷 𝑨𝒓𝒄𝒉𝒊𝒗𝒆’𝒔 𝒂𝒏𝒏𝒖𝒂𝒍 𝒔𝒕𝒂𝒕𝒆 𝒐𝒇 𝒕𝒉𝒆 𝒘𝒆𝒃 𝒓𝒆𝒑𝒐𝒓𝒕 2021:
https://almanac.httparchive.org/en/2021/table-of-contents

written by 112 contributors/industry experts ! Free ! A lot of good and useful best practices ! I read it yesterday and already learned a LOT in #http2/3, #js, #optimization, #WebAssembly, #priority, #CDN, #css, #SEO, #Accessibility, #Security, #Privacy, #PWA, #CMS, #Ecommerce, #Jamstack, #Resource Hints, #Compression, ... etc !

Thanks a lot to project leads and many contributors, Rick Viscomi, Paul Calvano, Barry Pollard, David Fox, Jasmine Drudge-Willson, Shaina Hantsis, Pankaj Parkar, Julia Yang, Patrick Meenan, Tim Kadlec and many many !

[ simultaneous post at https://www.linkedin.com/posts/walterwlee_table-of-contents-web-almanac-2021-activity-6873296125563150336-TEEt/ ]
🗃️ Filecheck GitHub action
Tags: actionshackathon21
Published: 2021-12-05 16:12:29

### My Workflow
A simple GitHub action to check the list of files on a push and pull request.


### Submission Category: 

Wacky Wildcards


### Yaml File or Link to Code

{% github divyakelaskar/filecheck-github-action %}


### Additional Resources / Info

- [actions/checkout@v2](https://github.com/actions/checkout/releases/tag/v2.0.0)
- [GitHub Actions Official Docs](https://docs.github.com/en/actions/quickstart)
😎 Convert Video To Text 😍
Tags: python, ffmpeg, deltainc, script
Published: 2021-12-05 16:29:38

Hi There!
I'm Phoenix. This Is My Frist Post
DVTT-Delta Video To Text-Is a Script Run In Console.
If You Want To Convert Your Video To Text You Cannnnn! Use This Script.
For More Details Go To My [Github Page](https://github.com/DeltaInc/Video-To-Text)
Buy Until The Next Post🖐🖐🖐😘
AI Robot Hand with Raspberry Pi
Tags: actionshackathon21
Published: 2021-12-05 15:50:42

[Instructions]: # (To submit to the GitHub Actions x DEV Hackathon 2021, please fill out all sections.)


### My Workflow
Since it is a project that combines a wide range of fields such as computer vision, machine learning, deep learning, electronic control, and embedded systems, all source codes and contents cannot be included, so please refer to the link below.

What I introduce here is some of the built-in software (functions). I introduce you because you can see the progress process and results with your own eyes by writing them on the Jumpyter Notebook. The description of the source code was annotated and written in English for versatility.

The software recognizes a person's face through a camera and allows the robot to move its hand according to whether or not to wear a mask to stop/pass motion.

**Google Colab:** https://colab.research.google.com/drive/1lIUMgEGuxMQnUnG-7kwvn2p90z00Xy_m
**Used Dataset:** https://www.kaggle.com/omkargurav/face-mask-dataset
**Download Latest Repository:** https://github.com/DEVHEE/ai-robot-hand-with-raspberry-pi/archive/refs/tags/v0.2.0-alpha.zip
**Download Latest Software:** https://github.com/DEVHEE/ai-robot-hand-with-raspberry-pi/releases/download/v0.2.0-alpha/software-v0.2.0-alpha.zip

### Submission Category: 

Interesting IoT


### Yaml File or Link to Code

{% github https://github.com/DEVHEE/ai-robot-hand-with-raspberry-pi %}


### Additional Resources / Info
**GitHub:** https://github.com/DEVHEE/ai-robot-hand-with-raspberry-pi
**English Docs:** https://ai-robot-hand-with-raspberry-pi.kimdonghee.dev/
**Korean Docs:** https://kimdonghee.dev/categories/robot/
**Google Colab:** https://colab.research.google.com/drive/1lIUMgEGuxMQnUnG-7kwvn2p90z00Xy_m
Spring Boot optional request params
Tags: spring, boot, optional, java
Published: 2021-12-05 16:05:18

Sometimes the job description forces us into a scenario where the request param (or query params) are not always needed or required. The obvious way to get the job done is to check simply if the param is null or not. Let's try this and another smarter way using Optionals which come with Java since its version 8.


## Method 1: Using required attribute

As simple as the following, we'll set the required attribute to false and check if there's a value in the associated variable: 

```
@GetMapping("/params")
public String getWithParam(@RequestParam(required = false) String name){
    if(name == null){
        return "Hello Anonymous";
    }
    return "Hello "+name;
}
```

## Method 2: Using Java 8 Optionals

This time we'll be doing the same using Optionals:

```
@GetMapping("/params")
public String getWithParam(@RequestParam Optional<String> name){
    if(name.isPresent()){
        return "Hello "+name.get();
    }
    return "Hello Anonymous";
}
```
Or even in an advanced way:
```
@GetMapping("/params")
public String getWithParam(@RequestParam Optional<String> name){
    return  "Hello "+ name.orElse("Anonymous");
}
```


More articles [Here](https://elattar.me/).
Creator Nation
Published: 2021-12-05 15:56:57

[Instructions]: # (To submit to the GitHub Actions x DEV Hackathon 2021, please fill out all sections.)


### My Workflow
[Note]: # (Please make sure the project links to the appropriate GitHub Actions repository, and includes [an open source license](https://choosealicense.com/) and README.)
https://github.com/actions/javascript-action



### Submission Category: 
[Note]: # (Maintainer Must-Haves, DIY Deployments, Interesting IoT, Phone Friendly, or Wacky Wildcards)
DIY Deployments


### Link to Code
[Note]: # (Our markdown editor supports pretty embeds. Try this syntax: `{% github link_to_your_repo %}` to share a GitHub repository)
https://github.com/kakarots-bro/CreatorNationOfficial.git


### Additional Resources / Info
[Note]: # (Be sure to link to any open source projects that are using your workflow!)
Website: https://www.creatornation.net/
App Link: https://drive.google.com/file/d/1qZ9Ldwd2qMbD6nDm5z1C4jieaMZK08cV/view

[Note]: # (Be sure to include the DEV usernames of your collaborators, if any. )
Please help me 🙏😊
Tags: promotingmychannel
Published: 2021-12-05 15:53:34

> Hello guys, yes from title you already know what i wanted to say. Guys please help me grow in youtube i want to help people share my knowledge and i also want to be big youtuber + a great coder in my life

**Subscribe please 🙏🙏** - [CodingFire](https://www.youtube.com/c/CodingFire?sub_confirmation=1)

**About me** - I am a 14 years old coder.

I want to share 🎇 my knowledge with you and wanted to help you with my tutorials i made. Want to make things easier for you .

This small things can help you with your big projects Thanks for giving your time 😊


Previous Blogs ( Might Help You ) -

- [Best Website Every Developers should know](https://dev.to/official_fire/best-website-every-developers-should-know-42e2)

- [Pro VSCODE Themes For Pro Developers](https://dev.to/official_fire/pro-vscode-themes-for-pro-developers-d5h)

- [Add Confetti Effect in 5 minutes](https://dev.to/official_fire/creating-a-confetti-effect-in-5-minutes-16h3)

- [Top 5 Best Online Code Editors](https://dev.to/official_fire/top-5-best-online-code-editors-1ei2)

Anyways, Happy Coding And Yes Be Safe! 😊
21st weekly post, memory search. Also, EC2 M1.
Tags: node, design, aws
Published: 2021-12-05 15:47:40

## Items of the week

- **Node.js** - we could get an object describing the memory usage of a Node.js process using `process.memoryUsage()`. The numbers returned represent the usage in bytes, as described in [the official documentation page](https://nodejs.org/api/process.html#processmemoryusage).

- **Design** - a content is what a user needs right now, regardless of what a search form is designed for. If it's not feasible to have a universal search, label a search form explicitly, e.g. Search products. Got that from chapter 6 of [Form Design Patterns](https://www.goodreads.com/book/show/42272974-form-design-patterns).

- **On the week 48 of 2021**, AWS announced the preview of EC2 M1 Mac instances. There is [an official blog post on this with details on pricing and example usage](https://aws.amazon.com/blogs/aws/use-amazon-ec2-m1-mac-instances-to-build-test-macos-ios-ipados-tvos-and-watchos-apps/).

This is a weekly bite-sized post on web app development from JavaScript to UX and technology in general. Thank you for reading and have a nice day!
Announcing 12 Days of Web
Tags: news, webdev, css, html
Published: 2021-12-05 15:39:28

> [12daysofweb.dev](https://12daysofweb.dev) is a year-end celebration of fundamental web technologies: HTML, CSS, and JavaScript.

Between December 13-24, I'll be releasing a new article. You can subscribe to receive daily email updates so you don't miss one!

You're sure to learn something new about web technologies, and hopefully even be surprised about what the native web can offer. We'll be covering HTML elements you may not have used, web APIs you may have missed, and modern CSS features that you can start using today.

Head over to [12daysofweb.dev](https://12daysofweb.dev) to subscribe, and please share this project!

## About the author

Hey! I'm [Stephanie Eckles @5t3ph](https://twitter.com/5t3ph), author of [ModernCSS.dev](https://moderncss.dev), [SmolCSS.dev](https://smolcss.dev), [11ty.Rocks](https://11ty.rocks), and more [open source resources for front-end developers](https://thinkdobecreate.com).
React encapsulating data fetching logic with container components
Tags: react, javascript, statemanagement, datafetching
Published: 2021-12-05 15:16:57


Container components are components that encapsulate the data loading and data management for the child application.

Let’s say you have a component called `StarShipInfo` component which lists the information about starship

```
const StarShipInfo = (id) => {
 const [starShip, setStarShip] = useState(null);
 useEffect(() => {
   const fetchStarShip = async () => {
     const response = await fetch(`https://swapi.dev/api/starships/${id}/`);
     const data = await response.json();
     setStarShip(data);
   };
   fetchStarShip();
 }, [id]);
 return (
   starShip && (
     <div>
       <p>Name: {starShip.name}</p>
       <p>Hyper Drive Rating: {starShip.hyperdrive_rating}</p>
       <p>Manufacturer: {starShip.manufacturer}</p>
       <p>Class: {starShip.starship_class}</p>
     </div>
   )
 );
};
```

By using container component pattern we can separate out the data fetching logic into a separate container.
First, let’s create a separate component called `StarShipInfoLoader`. The purpose of this component is to create a fetch request, wait for the request to be completed, and then render the `StarShipInfo` component. The `StarShipInfo` component is passed as a children prop to this component, we access the passed component and render it with data.

```
const StarShipInfoLoader = ({ id, children }) => {
 const [starShip, setStarShip] = useState(null);
 useEffect(() => {
   const fetchStarShip = async () => {
     const response = await fetch(`https://swapi.dev/api/starships/${id}/`);
     const data = await response.json();
     setStarShip(data);
   };
   fetchStarShip();
 }, [id]);
 return (
   <>
     {starShip &&
       Children.map(children, (child) => {
         if (isValidElement(child)) {
           return cloneElement(child, { starShip });
         }
       })}
   </>
 );
};
```

This is how we can use the `StarShipInfoLoader` and `StarShipInfo` together.

```
 <StarShipInfoLoader id={id}>
   <StarShipInfo />
 </StarShipInfoLoader>
```
Confessions: How I Got Addicted to Clean Code Principle - DRY
Tags: refactorit, productivity, programming, tutorial
Published: 2021-12-05 15:16:06

Hello folks, hope you are doing well! This is my first blog after a long break😞 Hope you have read my previous blogs. This is my first blog in clean code series, I will be posting everything about clean code practice and code smells. 
![i](https://media.giphy.com/media/mJ2GuB3I0vNGLs4EmO/giphy.gif)

###Don't Repeat Yourself
**DRY** stands for Don't Repeat Yourself is a basic software development principles implying reducing code repetition. As it states "*Every small piece of code or logic should be single or unambiguous within system*".

###Guidelines
When you need to use similar logic at different location, it's definitely a sign of wet code. If in future the requirement changes and you need to modify the logic. Obviously logic needs to be modified at multiple locations and lots of test cases needs to be updated and might be new test cases needs to be created .......
*Another hill to climb though!*
 So determine the identical patterns in code and extract them into common functionality and reference this common logic. Any future changes in code can be easily incorporated with less changes, Makes code easily maintainable.

###Advantage
- Less code: Less code implies less code to maintain and less code to be tested. Number of test cases will be reduced with less code.

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

- Readability: Functions will be refactored to include only necessary code and common code will be extracted to utils function. Code won't be repeated at many places and will be more easily readable to other developers.

- Maintainence: Code becomes more maintainable since single code updation place. Future updation in code can be easily incorporated with less changes.

Happy coding!..
![](https://media.giphy.com/media/fWgQH01z4rjwrZckyM/giphy.gif)
Starting With Laravel
Published: 2021-12-05 14:48:19

Laravel is really an interesting framework that solves a lot of problems such as emailing, authentication sessions and more. 
one great tool for coding laravel is using VSCODE and also using a local server such as wamp or xamp.
Using laravel, one needs to download and install first a local server and then downloading a very important tool called composer which is more like a bed rock of using laravel.
Responsive Animated Login Form Using HTML CSS & GSAP
Tags: html, css, javascript, webdev
Published: 2021-12-05 14:33:54

Hello Guys,

Today I Created an Animated Responsive Login Form using HTML CSS & GSAP For Animation. I hope you like this also comments about your thoughts. also For more content **follow me on Instagram**  [@developer_nikhil27](https://www.instagram.com/developer_nikhil27/).

Thank you 🙂!

{% codepen https://codepen.io/NikhilBobade/pen/xxXwvqO %}
Advent.js🎅🏼| #4: ¡Es hora de poner la navidad en casa!
Tags: adventjs, webdev, javascript, spanish
Published: 2021-12-05 14:25:43

## [¡Es hora de poner la navidad en casa!](https://adventjs.dev/challenges/04)

¡Es hora de poner el árbol de navidad en casa! 🎄

Para ello vamos a crear una función que recibe la altura del árbol, que será un entero positivo del 1 a, como máximo, 100.

Si le pasamos el argumento 5, se pintaría esto:

```js
____*____
___***___
__*****__
_*******_
*********
____#____
____#____
```

Creamos un triángulo de asteríscos `*` con la altura proporcionada y, a los lados, usamos el guión bajo _ para los espacios. Es muy importante que nuestro árbol siempre tenga la misma longitud por cada lado.
Todos los árboles, por pequeños o grandes que sean, tienen un tronco de dos líneas de `#`.

Otro ejemplo con un árbol de altura 3:

```js
__*__
_***_
*****
__#__
__#__
```
Ten en cuenta que el árbol es un string y necesitas los saltos de línea `\n` para cada línea para que se forme bien el árbol.

Completa el reto!

--- 

Mi solución:

{% jsitor https://jsitor.com/embed/ZtqjCHHJN %}

---
Puedes seguir a @midudev y estar pendiente de los retos de Advent.js 

{% twitter 1466086678507008003 %}
Next JS – what’s new ?
Tags: nextjs, javascript, webdev, programming
Published: 2021-12-05 14:24:51

NextJS is an easy-to-use frontend development framework that was developed on top of React. Next. js is based on ReactJS, & has many of the same core features.

NextJS 12 is the current version, it comes with many new features , such as, performance optimization, React 18 support, middleware, and more.

## Rust compiler x5 faster !
NextJS 12 includes a brand new Rust compiler, faster for production, that takes advantage of native compilation.

NextJS Rust compiler is built on SWC, an open platform for the next generation of fast tooling. Optimized bundling and compiling with ~3x faster refresh locally and ~5x faster builds for production. 

## Middleware
According to the official documentation, middlewares enables developers to use code over configuration. This means you can run code before a request is completed, and based on the request, you can modify the response by rewriting, redirecting, adding headers, etc.

Middleware can be used for anything that shares logic for a set of pages, including:

- Authentication
- Bot protection
- Redirects and rewrites
- Handling unsupported browsers
- Feature flags and A/B tests
- Server-side analytics
- Advanced i18n routing requirements
- Logging
- And more!

## React 18 support
React 18 is still in beta realease ( at time of writing this article.)

However, React 18 features such as server-side suspense and the automatic patching of updates are now available in Next.js 12 under an experimental flag as Next prepares for React 18 when it moves toward a stable release.

## Images Optimization using AVIF
built-in Image Optimization API now supports AVIF images, enabling 20% smaller images compared to WebP.

AVIF images can take longer to optimize compared to WebP images, so NextJS team made this feature opt-in using the new images.formats property in next.config.js

## Other improvments
List of other improvments comes with Next12 includes:

ES module support and URL import.
Bot-aware ISR fallback.
Output file tracing
And more..

If you are interested in NextJS framwork, you can find the full article + code examples + usefull links here:
[https://bit.ly/31gmdDg](https://bit.ly/31gmdDg)

I hope this article can helps you get new information & to learn new things.
See you in the next article.
Automating MySQL backups to S3 using Laravel
Tags: aws, laravel
Published: 2022-01-03 07:47:27

---
title: Automating MySQL backups to S3 using Laravel
published: true
date: 2021-12-05 13:59:58 UTC
tags: aws,laravel
canonical_url: https://adithya.dev/automating-mysql-backups-to-s3-using-laravel/
---

Having already [setup automatic S3 snapshots for Kibana,](https://adithya.dev/s3-snapshots-for-elasticsearch-via-kibana/) the next item on the list is to automate MySQL backups. There are a couple of services like Snapshooter that can do this but I prefer doing it on my own.

To automate **MySQL backups to AWS S3** with Laravel, I'm using [Laravel Backup](https://github.com/spatie/laravel-backup) package by Spatie.

### Setup

- Install the package using  `composer require spatie/laravel-backup`  
  
If you see a similar error message like this, your PHP version is probably not supported by the package / dependencies. You might want to use `composer require spatie/laravel-backup ^6` 

```
Argument 2 passed to Symfony\Component\Translation\Translator::addResource() must be an instance of Symfony\Component\Translation\mixed, array given, called in /var/www/html/vendor/nesbot/carbon/src/Carbon/AbstractTranslator.php on line 165
```

- To publish the configuration file, run `php artisan vendor:publish --provider="Spatie\Backup\BackupServiceProvider"` - this will create a file under config called `backup.php`
- Go to your AWS Console, create a new IAM User (you can see the steps linked on the Kibana guide) and add   **AmazonS3FullAccess** to the permissions attached to the user.
- Grab the **AWS\_ACCESS\_KEY\_ID** and **AWS\_SECRET\_ACCESS\_KEY**
- Create a S3 Bucket from AWS console (the bucket name goes under **AWS\_BUCKET** and your default region under **AWS\_DEFAULT\_REGION)**
- On the `config\backup.php` file, under `destination` key, change the value of `disks` array to include `s3`

```
'disks' => [
	's3',
],
```

- Ensure that the default database is set to `mysql`

```
'databases' => [
	'mysql',
],
```

- Now if you run the command on your command line `php artisan backup:run --only-db --only-to-disk=s3` the process should kick off and you should see similar messages.

```
Starting backup...
Dumping database database_name...
Determining files to backup...
Zipping 1 files and directories...
Created zip containing 1 files and directories. Size is 900 MB
Copying zip to disk named s3...
Successfully copied zip to disk named s3.
Backup completed!
```

- Once this is done, you can setup to run it using the scheduler on a frequency that you prefer. Go to your `Console\Kernel.php` and add an entry

```
protected function schedule(Schedule $schedule)
{        
    $schedule->command("backup:run --only-db --only-to-disk=s3")->weeklyOn(6, '7:00');

    //Other commands
}

```

### Error messages  

The problem was incorrect permissions assigned to the IAM User

```
Copying zip failed because: There was an error trying to write to disk named s3.

Copying zip failed because: Error executing "ListObjects" on....
AWS HTTP error: cURL error 6: Could not resolve host:
```