teleren/devto huggingface dataset:
How to password protect zips on Mac 🔑
Tags: mac, zip, bash
Published: 2020-09-29 05:35:00

If you're on Windows, you might think, but why? 
Well, Mac doesn't offer a GUI interface for password protecting zips.

Yes, bizarre, right?

We can right-click a file/folder and `compress` it into a zip.

But we can, by using our best friend `The Terminal` password, protect our zip files!

![Mac default zip function](https://cdn.hashnode.com/res/hashnode/image/upload/v1600846448840/dXvloRc86.png)

## Using terminal to password protect zip files on Mac

So let's open our favourite terminal program ([mine is iTerm2](https://daily-dev-tips.com/posts/my-personal-top-15-mac-apps-%F0%9F%91%A8%E2%80%8D%F0%9F%92%BB/)) and enter the following command.

```bash
zip -er ~/Desktop/super_secure.zip ~/Desktop/secure.csv
```

The parameters are as follows:

- `zip` - The actual zip command
- `-er` - Encrypt Recursive
- `~/Desktop/super_secure.zip` - Output zip name
- `~/Desktop/secure.csv` - Input file/folder

Once we run this, we get prompted to type a password.

> You don't see any input on these password fields!

Press enter, and you need to verify the password.

![Secure-zip on Mac](https://cdn.hashnode.com/res/hashnode/image/upload/v1600846834806/wWUvlZPCt.png)

We now created a secure zip.

If we try to open this zip, we see the following prompt.

![Zip with password on Mac](https://cdn.hashnode.com/res/hashnode/image/upload/v1600846881656/BMLjjDVqP.png)

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
Best VSCode Extensions for Software Development
Tags: vscode, software, developer, learning
Published: 2020-09-29 05:34:47

There are many VSCode extensions in the market store. Today I am bringing you the extensions which I personally use while coding an app in VSCode.


- [Auto Close Tag](https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-close-tag)
- [Auto Import](https://marketplace.visualstudio.com/items?itemName=steoates.autoimport)
- [Babel JavaScript](https://marketplace.visualstudio.com/items?itemName=mgmcdermott.vscode-language-babel)
- [Beautify](https://marketplace.visualstudio.com/items?itemName=HookyQR.beautify)
- [Bracket Pair Colorizer](https://marketplace.visualstudio.com/items?itemName=CoenraadS.bracket-pair-colorizer)
- [Color Highlight](https://marketplace.visualstudio.com/items?itemName=naumovs.color-highlight)
- [Dart](https://marketplace.visualstudio.com/items?itemName=Dart-Code.dart-code)
- [Debugger for Chrome](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome)
- [Deno](https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno)
- [Docker](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker)
- [EditorConfig](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig)
- [ES7 React/Redux/GraphQL/React-native snippets](https://marketplace.visualstudio.com/items?itemName=dsznajder.es7-react-js-snippets)
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
- [Flutter](https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter)
- [Git Blame](https://marketplace.visualstudio.com/items?itemName=waderyan.gitblame)
- [Git History](https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory)
- [GraphQL for VSCode](https://marketplace.visualstudio.com/items?itemName=kumar-harsh.graphql-for-vscode)
- [Highlight Matching Tag](https://marketplace.visualstudio.com/items?itemName=vincaslt.highlight-matching-tag)
- [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
- [QuokkaJS](https://marketplace.visualstudio.com/items?itemName=WallabyJs.quokka-vscode)
- [REST Client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client)
- [Settings Sync](https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync)
- [TSLint](https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-tslint-plugin)
- [Visual Studio Intellicode](https://marketplace.visualstudio.com/items?itemName=VisualStudioExptTeam.vscodeintellicode)
- [WakaTime](https://marketplace.visualstudio.com/items?itemName=WakaTime.vscode-wakatime)
- [MongoDB](https://marketplace.visualstudio.com/items?itemName=mongodb.mongodb-vscode)

##Themes

- [Cobalt2](https://marketplace.visualstudio.com/items?itemName=wesbos.theme-cobalt2)
- [Material Theme Kit](https://marketplace.visualstudio.com/items?itemName=ms-vscode.Theme-MaterialKit)


What are your favorite extensions!!
Let me know in the comments...
String important points
Tags: java, cpp, codenewbie, csharp
Published: 2020-09-29 05:34:04

String s1="java";
String s2="coder";

//Sop means System.out.println(for print)

Sop(s1+s2);  //output-javacoder

Sop(s1+10); // java10
//10 is treated like a string.

Sop(s1+10+20);  //java1020

Sop(10+20+s1);   //30java
//First 10 and 20 were added and then 30 concat with s1.

note-Left to right operation takes place with the plus operator ... first addition will happen and then concat.

Sop(10+s1+20);  //10java20

Sop(s1+20/10);  //java2
//First division took place and then concat method was used

Note--BODMAS rule is used in Java ... if you do not know the bodmas rule then do a Google search.

Sop(s1+10-5);   //error

//first s1+10 =java10
then java10-5
java10 -5 is not possible, so we will get error.


If you found this post useful, then follow me❤️
Overcoming Serverless challenges with Durable Functions
Tags: mscreate, serverless, azure
Published: 2020-09-29 05:26:52

---
title: Overcoming Serverless challenges with Durable Functions
published: true
description: Learn about how Durable Functions makes serverless functions at Create: Serverless
tags: mscreate, serverless, azure
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/gzuwir2258wlu8v4ul5m.png
---

Serverless functions are great for running code without worrying about managing infrastructure. You can create stateless functions that run for short periods of time. However, there are times when you need longer-running functions that persist state, such as a workflow that runs for hours, days, or longer.

[Azure Functions](https://docs.microsoft.com/azure/azure-functions/functions-overview) has a feature called [Durable Functions](https://docs.microsoft.com/azure/azure-functions/durable/durable-functions-overview?tabs=javascript) that was designed to solve some of these challenges by adding support for useful, new patterns to serverless functions.

A few patterns made possible by Durable Functions include:

- **Function chaining** - Orchestrate a serverless workflow composed of many functions. These orchestrations can run for extended periods of time.
- **Fan out / fan in** - Call a bunch of functions that all execute in parallel, taking advantage of the highly-scalable compute provided by Azure Functions, then aggregate the results.
- **Monitor** - Call a function repeatedly until a condition is met.

These are just a sampling of capabilities provided by Durable Functions. To learn more join me, Durable Functions expert [Marc Duiker](https://dev.to/marcduiker), and many others at this week's [**Create: Serverless**](https://aka.ms/createserverless) virtual event!

[![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/tw3rxca4nqbph3eit7q6.png)](https://aka.ms/createserverless)

Create: Serverless is a half day of conversations with serverless community members to discuss how you can run code for any application without having to manage servers.

Sign up for Create: Serverless: [https://aka.ms/createserverless](https://aka.ms/createserverless)
When i try to fetch data(ONLY FOR RECORD : - “having forward slash in it”) from mongoDB , it is showing Undefined
Published: 2020-09-29 05:14:21

**I stored my data in mongodB , And it successfully done But when i try to fetch particular record  ("ResumePath" : "28092020/Test Folder 4/Alekhyakasireddy[7_0].docx")  through nodejs it is show undefined. enter image description here I am trying to store the aws S3 file uploaded fullname in mongodb column, when I try to print this value in console through node js...it is not getting the column value and when I check it's type..showing as undefined.

I guess the issue is with forward slash. Am I missing anything while storing aws S3 file name in mongo?**


##CODE##

 user_data.find({_id:requestId},function(err,data){
            if(err){
                console.log(err);
            }else{
               console.log(data[0].ResumePath)
               console.log(typeof data[0].ResumePath)
});
I am getting data for all fields expect ResumePath. ("ResumePath" : "28092020/Test Folder 4/Alekhyakasireddy[7_0].docx")
[Multiple Image Upload] With Preview and Delete jQuery - Step by Step
Tags: javascript, jquery, laravel
Published: 2020-09-29 05:07:59

This tutorial is a multiple image upload with preview and delete jquery very easy to use.
[[Multiple Image Upload] With Preview and Delete jQuery - Step by Step](https://www.phpcodingstuff.com/blog/multiple-image-upload-with-preview-and-delete-jquery.html)
How to Dynamically Validate Form Input Using RegExp and Object Evaluator | RegExp | Form Validation
Tags: javascript, beginners, html
Published: 2020-09-29 05:03:02


Welcome to my dynamic form validation tutorial using object evaluator.

**Note:** this tutorial is not for RegExp but to help you understand the best use case of “[ ]” to access object properties.

Quick information: there are two possible ways to access an object which includes:

    objName.objProperty
    objName[objProperty]

But the question here is what is the best use case?

The answer is: use the "dot" syntax when you want to access a property directly(that is static) and use the square bracket when you want to access a property dynamically. Dynamically means the property to be accessed changes as the user changes the value. E.g:

    const STAFF_NAMES ={
          staffOne:”CreativeAdams”,
          staffTwo:”CreativePerete”,
          staffThree:”CreativeJerry”
    }

    const getStaffName=staffKey=>{
       return STAFF_NAMES[staffKey]
    }

##Below example is simply one of the dynamic ways to access properties

    getStaffName(“staffOne”);//CreativeAdams 
    getStaffName(“staffTwo”);//CreativePerete

Link to the complete code on how to dynamically validate your form using RegExp and object evaluator syntax.
[Click Me](https://codepen.io/CreativeJerry/pen/WNwWmBz)

Quick note: the form validation could be performed in many ways e.g: 
By validating each of the inputs which is a pain to developers.
By Looping through the inputs element and accessing their type or name, then deciding on the validation. But I bet you, that will cause a time-complexity issue.
The best solution is provided here by me: [Click Me](https://codepen.io/CreativeJerry/pen/WNwWmBz)

##Quick Explanation
The most important thing inside the code is at **line 13**, that’s where the evaluation and validation happens. 

So this **RegExp[e.target.name]** is what enables the dynamism. This is a javascript syntax for **object/variable evaluation**. Also, if you are from React community you definitely have come across *dynamic input value-handling to state* by simply doing this:
this.setState({…this.state,
[event.target.name]:event.target.value})
///So this is simply same thing(evaluation).

Thanks and have a wonderful day.
What Makes Ruby on Rails A Good Choice In 2020?
Tags: ruby, webdev, beginners
Published: 2020-09-29 04:29:30

Ruby on Rails is being used by some of the top-known web applications such as Github, Airbnb, Basecamp, Slideshare, etc. It's very quick to get started with Ruby on Rails and there's no trouble at all. There is at least a prospectus dedicated to Ruby & Ruby on Rails for any software development business. 

However, as any technology encounters many challenges over time, Ruby on Rails has also faced some heavy criticism and competition from new technologies in recent years. As a consequence, many modern-day developers doubt its usefulness in the future. But it can prove to be a good choice in 2020, here’s why:
<ol>
<li>Ruby on Rails is a programming language that allows rails to run the code or components as a platform in accordance with the requirements. In addition, it is open source and can be accessed at no cost. </li>

<li>Due to its ease of access and reliability, Ruby on rails is the most established and esteemed platform so far and is always a priority among developers. </li>

<li>Ruby on Rails is a structured language, and if you already have any knowledge of JavaScript, it's super easy to understand. It's a lot simpler than other high-level languages, like C # or Java. Its object-oriented approach makes it cooler than other business technology, and the first technique of the client is Ruby on Rails. </li>

<li>Ruby on Rails is extremely stable and efficient as it needs to be combined with other languages whenever we need it. It offers different additional features that a developer can depend on easily.</li>
</ol>

It also offers:
<ul>
<li>Accelerated development with optimized cost</li>
<li>Efficient options for start-ups and demonstrating proof of concept</li>
<li>Merits in the e-Commerce domain</li>
<li>Additional security measures</li>
<li>Active and effective community support</li></ul>

In <I>conclusion</i>, if you want to venture into programming, you can certainly experience how Ruby & Ruby on Rails will speed up the application and improve it. Ruby will provide you with the basis of Rapid Application Development (RAD) as an open-source object-oriented programming language, which will obviously position you in the field of web development in 2020.
Team 9 Recap
Tags: javascript, react, css, thecollablab
Published: 2020-09-29 04:19:03

Every time a Collab Lab cohort wraps up, I swear it flew by faster than the one that came before it. The August 2020 cohort was no exception -- it went so quickly and I can’t believe we’ve tossed our tassels with another amazing group of developers! :mortar_board:

In the early days of The Collab Lab we only ran one team at a time. We’ve grown up quite a bit since then and we’re not stopping anytime soon. Our August 2020 cohort included 3 teams and I was lucky enough to mentor Team 9 alongside [Yves Gurcan](https://twitter.com/yvesgurcan), a first-time Collab Lab mentor and the head of our Tech Talk initiative, and [Scott Bergler](https://twitter.com/ScottBergler), a former Collabie who couldn’t get enough so he decided to hang around and offer his experience to help other developers grow! 

![Team 9 at The Collab Lab](https://dev-to-uploads.s3.amazonaws.com/i/mzgddol805qhrq5pca0v.png)

**Our participants included:**
 
* [Leigh-Ann Crivella](https://twitter.com/lacrivella), whose organizational skills and forward thinking led the team to so much success and, without a doubt, played a role in her landing her first developer role! Congrats, Leigh-Ann. We’re so proud of you.  
* [Lia Chen](https://twitter.com/basil_chicken), who always demonstrates such curiosity when approaching code and tackles building new features and squashing bugs with great calculation. Nothing is gonna get by her! 
* [Mabel Hernandez](https://www.linkedin.com/in/mabel-h-574025171/), who is incredibly thoughtful when it comes to solving problems and is always digging deep to understand her code. She is always ready to fill you in on the technical details during Q&A after demos! 
* [Fabrice Innocent](https://twitter.com/Hsensation88), who came to the team with such ambition and blew us away with his dedication and tenacity. Fabrice totally crushed learning a new programming language and contributed some wonderfully fresh perspective to the team. 

This team’s collaboration skills were so impressive. They kicked off the program and immediately started building a solid team that worked together to organize the work that needed to be done, squash tricky bugs, and build a really fantastic app. 

If you’re in search of some really incredible developers who have experience collaborating with great success in a remote and agile environment, these are your people. :white_check_mark: :sparkles: :clap:
Recursion
Tags: javascript, typescript
Published: 2020-09-29 04:06:15

Most of the time people struggle working with recursive functions.  So here is the trick - 

A recursive function should always have at least 2 things - 

1. Condition where function ends.
2. Recursion where function calls itself.


Let's see some examples - 

1. Let's try reversing a string using recursion. 

```
function reverseString(str){
  if (str === '') return '';
  return reverseString(str.substr(1)) + str[0];
}
```

1. `if (str === '') return '';` this is the condition where function ends/exits. When our string becomes empty it will stop the function.
2. `return reverseString(str.substr(1)) + str[0];` this is Recursion logic where we modify string and call function again with updated string. Let's see the execution of above function for string `'dev'`  

`reverseString('dev');` this will execute in following steps -  

1. `reverseString('ev') + 'd';`
2. `reverseString('v') + 'e';`
3. `reverseString('') + 'v';`
4. `if (str === '') return ''`

final output would be **'ved'**

Sometimes people get confused with when to use recursion and when to use loops. For the above example, we can also use a loop. And of course we can also use a simple javascript `str.reverse()` method. 

But let's see another example where recursion would be the better choice. 

Suppose we have a complex nested object and suppose you are generating this object dynamically and you don't know the complexity of object in advance. For example - 

```
const data = {
  'person' : {
     'name' : {
       'fname' : 'Dwight',
       'lname' : 'Schrute'
     },
     'age' : 38
  }
}
```

Now you need to get the value of `'person.name.fname'`. Here the path of the key is string and we don't how nested the key would be. So let's create a function which will return a value -
 
```
function findValue(obj, path) {
    const keysArr = path.split('.');
    if (keysArr.length === 1) {
      return obj[parts[0]];
    }
    return findValue(obj[keysArr[0]], keysArr.slice(1).join('.'));
  }
```


`findValue(data, 'person.name.fname');` this will execute in following steps -   

```
1. const keysArr = path.split('.'); // ['person', 'name', 'fname']
2. findValue(obj['person'], 'name.fname');
3. const keysArr = path.split('.'); // ['name', 'fname']
4. findValue(obj['name'], 'fname');
5. const keysArr = path.split('.'); // ['fname']
6. if (keysArr.length === 1) {
      return obj[parts[0]];
    }  // return obj[fname]
```

final output would be **'Dwight'**

If you have any questions or suggestions please let me know. Thank you for reading.
Auto Purge Old Docker Images
Tags: containers
Published: 2023-01-06 01:15:03

---
title: Auto Purge Old Docker Images
published: true
date: 2020-09-29 03:30:22 UTC
tags: Containers
canonical_url: https://brandonrozek.com/blog/autopurgedocker/
---

I use [Watchtower](https://github.com/containrrr/watchtower) to automatically update the docker images I use. After leaving it for several months, I’ve realized that I have been storing over 100GB of old docker images. I needed a way to automatically purge old images and [Systemd Timers](https://opensource.com/article/20/7/systemd-timers) is the solution.

First it’s useful to know the docker command that purges unused images that are older than 24 hours old.

```
docker image prune -fa --filter "until=24h"

```

Then we can create a oneshot service file that will describe its dependencies and descriptions for Systemd to manage. This file is `/etc/systemd/system/docker-purge.service`.

```
[Unit]
Description=Purge Docker Images Older than 24 Hours
Requires=docker.service
Wants=docker-purge.timer

[Service]
Type=oneshot
ExecStart=/usr/bin/docker image prune -fa --filter "until=24h"

[Install]
WantedBy=multi-user.target

```

Now we can create the systemd timer that will hook to this service. This is `/etc/systemd/system/docker-purge.timer`.

```
[Unit]
Description=Purge Docker Images Older than 24 Hours
Requires=docker-purge.service

[Timer]
Unit=docker-purge.service
OnCalendar=*-*-* 00:00:00
AccuracySec=24h

[Install]
WantedBy=timers.target

```

This tells Systemd to run the service every day if enabled/started, though not necessarily at midnight. Systemd will schedule a time to run the service within the `AccuracySec` parameter. That is, it will schedule a time to run sometime everyday.

Finally, let’s enable and start the timer.

```
sudo systemctl enable docker-purge
sudo systemctl start docker-purge

```

We can check the time that docker-purge is scheduled to run next by asking Systemd to list its timers.

```
systemctl list-timers

```

If you want to play around with the `OnCalendar` parameter. A useful command is

```
systmed-analyze calendar --iterations=$N "$TIME"

```

Where you replace `$N` with an integer, and `$TIME` with your sample time string.
Build Better Cyber Security Contests With HackerEarth's Cyber Security Setter Challenge
Tags: challenge, hackathon, cybersecurity, problemsetter
Published: 2020-09-29 04:03:30

Cyber Security competitions are becoming popular by the minute. These include CTFs, VAPT contests, bug bounties, and many more! At [HackerEarth](https://www.hackerearth.com/challenges/), we're all about empowering developers to participate and build better contests and challenges. That being said, we launched our first-ever [Cyber Security Problem Setter Challenge](https://www.hackerearth.com/challenges/hackathon/cybersecurity-problem-setter-challenge-2/?utm_source=devto&utm_medium=referral&utm_campaign=cs-setter-challenge)!

HackerEarth is looking for Cybersecurity problem setters across the globe to come, collaborate together, and build better contests in the domain of Cybersecurity.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9gi29hmoc5hnnadwgni9.png)

Like any challenge or hackathon, this setter challenge also has a couple of themes to nudge you in the right direction! There are two specific themes in the challenge:

1) [Core Concepts](https://www.hackerearth.com/challenges/hackathon/cybersecurity-problem-setter-challenge-2/?utm_source=devto&utm_medium=referral&utm_campaign=cs-setter-challenge)

Come up with problem statements in Web Application Security, PWN, Malware Analysis, Reverse Engineering, Network Security, Computer Forensics, and Steganography.

2) [Open Innovation](https://www.hackerearth.com/challenges/hackathon/cybersecurity-problem-setter-challenge-2/?utm_source=devto&utm_medium=referral&utm_campaign=cs-setter-challenge)

Any other domain that we missed out on in theme 1!

Top 5 problem setters will win a chance to interview at HackerEarth and work as a remote **Subject Matter Expert** with HackerEarth's Cybersecurity team!

Certificates and gift cards to be won as well!

If you love thinking out of the box and creating challenges, you don't want to miss this!

[Click here to register and know more!](https://www.hackerearth.com/challenges/hackathon/cybersecurity-problem-setter-challenge-2/?utm_source=devto&utm_medium=referral&utm_campaign=cs-setter-challenge)