teleren/devto huggingface dataset:
Using Array Methods in JavaScripts (filter, sort, reverse, pop, push) 
Tags: programming, functional, react, firstpost
Published: 2021-01-16 21:09:49

Hello and welcome to my first dev.to blog post! Recently I've been working with react a lot and I wanted to review the `filter()` function for those that may need a little help with it! 

As I'm proceeding with this tutorial I will be using the console. First, I'm going to start by creating and array on peoples names `const names = ["Randy", "Kristy", "Brady", "Toby", "Kashton"]` ok, sweet now we have some people in our names array. Now I'm going to filter the array to see if we can find a person from our array that pass a particular test. Let's check it out. `names.filter(name => name.includes('R'))` Here I am calling filter on the names array and looking for anything that matches the letter 'R'. Here are the results `["Randy"]` notice we are only getting the results for the capital letter R not the other names that have 'r'. So what if we wanted to find both 'R' and 'r'? Let's see how we can make that work. If we try something like 'names.filter(name => name.includes('R', 'r'))` will this give us the results for 'r' and 'R'? nope, that does not work. Let's try this `names.filter(name => name.includes('R') || name.includes('r'))` Alright, cool this is what we need, now we have `["Randy", "Kristy", "Brady"]` as our filtered results.  

Now that we have seen a very simple example of filtering in JS, let's take a look at a simple sorting example. We will be using the same example from the filtering example. We can sort alphabetically very simply by `names.sort()` our results are: `["Brady", "Kashton", "Kristy", "Randy", "Toby"]` Now let's say you want this in the opposite order, how can we achieve this? Let's try a slightly different method to achieve this. `names.reverse()` results: `["Toby", "Randy", "Kristy", "Kashton", "Brady"]` Now I want to add a name to my array. I'm going to do that by `names.push("Ashley")` now lets sort again `names.sort()` results: `["Ashley", "Brady", "Kashton", "Kristy", "Randy", "Toby"]` Next let's remove someone from our array. `names.pop("Toby")` results: `["Ashley", "Brady", "Kashton", "Kristy", "Randy"]`

These are some simple way to filter and sort your arrays in Javascript. Obviously there lot's more you can do with these methods but this is a start and you can accomplish quite a bit with just learning these few basic methods. To learn more about array methods in Javascript, I recommend visinting ["W3 Schools]("https://www.w3schools.com/js/js_array_methods.asp")

Thank you very much for reading my blog and happy coding!
Jan 16: DEV Daily Discovery
Tags: discuss, bestofdev
Published: 2021-01-16 20:39:35

Third thread!!

***

Please make a comment to this thread with a DEV post that you think deserves to be read more broadly. If it's your own post that's fine.

It could be recent, or it could be classic.

And then read through the thread and ❤️ posts where you like. I'm hoping that the wisdom of the crowds can help unearth some great content every day.

Use the post's link liquid tag to display it fully, i.e.:

```liquid
{% link https://dev.to/devteam/for-empowering-community-2k6h %}
```

And feel free to add why you want to want to give it more love.

Don't worry about whether you've picked the best post, let the readers decide if it should rise to the top.
Why use virtual environments?
Tags: python
Published: 2021-01-16 20:31:06

A virtual environment (venv) in [Python](https://python.org) is isolated from the rest of the system. This is necessary, because packages can conflict and sometimes packages are malicious.

First install the program *virtualenv*

```python
sudo apt install virtualenv
```

Then you can create a new project (hello):

```
virtualenv -p /usr/bin/python3 hello  
cd hello
source bin/activate
```

On my machine:

```
C:\home\frank\example> ls
hello
C:\home\frank\example> cd hello 
C:\home\frank\example\hello> ls
bin  lib  pyvenv.cfg
C:\home\frank\example\hello> source bin/activate        
(hello) C:\home\frank\example\hello> ls             
bin  lib  pyvenv.cfg
(hello) C:\home\frank\example\hello> 
```

Then you can add any Python files you want. Install modules with [pip](https://pythonbasics.org/how-to-use-pip-and-pypi/), they will exist only in this virtual environment. 

This prevents package conflicts. You can even set a custom Python version. Added bonus: Even if the module contains malware, it won't affect your operating system. 

To exit your virtual environment, just type exit.

```
(hello) C:\home\frank\example\hello> exit
```

## Automatic venv

If you use an [IDE](https://pythonprogramminglanguage.com/python-ide/), then the IDE will create the virtual environments for you. For beginners, that's the recommended way. 

In PyCharm for example, you don't have to do anything except create a new project or open an existing project. It takes care of everything for you. 

![pycharm virtual environment](https://dev-to-uploads.s3.amazonaws.com/i/9m1jse8rp0x488vyewnu.png)

I'm not 100% sure what other Python IDE's do in terms of the virtual environment, but I'm quite sure they set it up too.

An IDE will also help you with [debugging](https://pythonspot.com/python-debugging/), but you can do that from the terminal too.
My LocalHackDay 2021 Experience By Major League Hacking
Tags: localhackday, mlh, majorleaguehacking
Published: 2021-01-16 20:22:15

Hello everyone. I am Rida Ayaz, Senior doing BS-Software Engineering. 
I have currently participated in MLH Local Hack Day: Build 2021.
Major League hacking's local hack day Build is a global day-long hack day, which brings ideas to life with a worldwide community.
The Local Hack Day Build was scheduled from the Sunday, January 10th to Monday, January 18th across the globe even in this pandemic.  
It's absolutely amazing experience for me. I found some really unexpected but interesting challenges. I built some really good mini-projects and learnt some amazing new skills. 

I hope to attend a hackathon like this by MLH in future too
#MLH #MajorLeagueHacking #LocalHackDay
What do you think of the Serverless Framework?
Tags: discuss, webdev, microservices, javascript
Published: 2021-01-16 20:15:35

This week, {% user luckybusted %} shared a link to the [serverless stack website](https://serverless-stack.com/), that goes deep into building full stack web applications with serverless technologies, like Lambda, and I started reading about the [Serverless Framework](https://www.serverless.com/).

It got me thinking that it may be a pretty sweet method of building my next application.

**What do you think about it?** I love the idea, but I started with Laravel first, and the MVC methodology, so it is hard to get my head around.

**Do you think that the future of web development is around microservices?** and do you think the Serverless framework is the way to go?
Any other advice/ thoughts?
React Recipe App
Tags: react, javascript, firebase
Published: 2021-01-16 20:10:06

So Today, we're gonna start what we planned yeasterday: the ReactJs Projects, and we're gonna beggin with Recipe App.

So For The Api, we're gonna be using th MealDb Api, it has some good stuff, although somethings mught be tricky to get, but it's fine,

for the features the app will provide, basically it:
  -will have a sign in  and login/ log out to the app.
  -each user will have a personal section for the favorites 
   meals.
  -it will have a search for meals input:
      -this will be many filtering methods: by name, by region, 
       maybe by ingredients and so on...
  -mealas will be displayed as cards, each card will be showing 
   onClick a modal showing the details of the meal.

Big Bonus Feature: -user can create his own recipies, and we will another section for user's created recipies.

note: initialy: not all the features will be avialble, but by time we will work on them one by one, the projects will be commited to github with each feature added, so you can get a look at it, we'll look for a nice design and we'll satrt working tomorow.

Thank you all,
This has been done before!
Tags: java, productivity, beginners
Published: 2021-01-16 20:04:11

A small reminder for me. This week gave in to the temptation to implement something myself, before properly checking if somebody of my colleagues already had done the work. I Mean i did check, found nothing and gave up too early.

So if your are considering if you should implement a certain piece of code, your assumption should always be that this was done before. And then try to prove your assumption with the following checklist:

- I did a search with our company's ticket system and wrote down the terms I searched for.
- I spoke directly with colleagues who were working on the same project.
- I talked to the user / business people who are using the software I work on.
- I did check the standard library of the language I'm using for solutions.
- I did check the most important frameworks / libraries of the language.

But be careful with the last point. Adding a new framework or library because you don't want to implement a small piece, might come back to bite you in the butt because of the additional complexity addition brings. Have a good weekend everyone! :-)
Scale your containers with ansible on a non kubernetes/swarm environment
Tags: devops, docker, ansible, nginx
Published: 2021-01-16 19:23:35

Scaling containers on Kubernetes with Replicatsets or scale services with docker swarm is a very easy task! but what about scaling containers in a non managed environment, when you have high traffic, absolutely you need to scale and load balance the traffic among multiple containers. In this article, we will use Ansible and nginx to scale containers.

Original post: [here](https://hatembentayeb.hashnode.dev/scale-your-containers-with-ansible-on-a-non-kubernetesswarm-environment)
The Worst Blogging Advice I Ever Received
Tags: blogging
Published: 2021-01-16 18:56:26

_Canonical URL: https://nickpalenchar.com/worst-blogging-advice/_

---

No annoying intro here. This is it:

## "When starting a blog, be sure to update it regularly"

I've actually heard or read this general "nugget" many times. It is as ubiquitous as it is terrible. One reason is that it's only applicable to one type of blog. The kind that is monetized, relying on a large group of subscribers, with aspirations of generating a livable wage for the author. Obviously, there are many types of blogs.

Back in 2018 I had set a goal to publish one post a month. I thought it was modest at the time (some authors seem to post weekly at least), but it turned out to be GRUELING. It also didn't produce work I was most proud of. The result of this goal is most of the 2018 posts on this site (you might notice there's less than 12).

The fact that I couldn't commit made me question if I should even host a blog at all. I felt like a blog with large gaps in the timeline would give the same impression a "streaky" resume gives off. As a matter-of-fact, the aforementioned terrible advice is often paired with a warning that you will look like you lack a drive for commitment, which could turn off recruiters during the job search, if you don't post regularly.

This is equally misguided. When I look at my blog, I see a collection of articles that generally represents my thoughts on coding, and general values in the industry. These are topics that are valuable to me, the topics I want to talk about. I don't want it cluttered with noise that is less helpful to readers or myself. Form the viewpoint of a recruiter, wouldn't they rather find content that supports the author's expertise in the field?

I'm not really sure what my blog is. Heck why does it matter? I just enjoy my tiny space on the corner of the internet I can call my own! Maybe it's a subtle rebellion against larger platforms (blog and social media based). But the autonomy makes me feel warm and fuzzy inside.

For me, it's helpful to write my thoughts whenever I'm moved to do so. And I hope the result is a collection of genuine thoughts and advice that others might find helpful, too.
Simple Accordion using HTML, CSS, and JavaScript
Tags: html, css, javascript, cwb
Published: 2021-01-16 18:50:39

The accordion is made with HTML, CSS, and JavaScript and It is very useful to hide content and show it on click, you can also use it by copy-pasting the code from this site.
<a rel="nofollow" href="https://codewithbishal.com/example/how-to-create-an-accordion-with-html-css-and-javascript">View it on our website</a>
View More :
<ul>
<li><a rel="nofollow" href="https://codewithbishal.com/example/contact-us-form-using-html">Contact us form</a></li>
<li><a rel="nofollow" href="https://codewithbishal.com/example/css-button-glow-effect">Glowing Buttons on hover</a></li>
</ul>
At first, on our webpage, there is a preview of our accordion, then there are a few QNA and an overview of the blog. There is a button to copy and Download the codes (HTML, CSS, and JavaScript). You can also try it on our website.

You can view and copy the source code files through the link given below. <a rel="nofollow" href="https://codewithbishal.com/example/how-to-create-an-accordion-with-html-css-and-javascript">View and Download Source Code</a>
filter object from an array
Tags: typescript, angular, javascript
Published: 2021-01-16 18:48:29

I have json data like this.

   

     Object
    date1: {enabled: false, label: "Date1 Label", eformVisible: false, mandatory: "NOT_MANDATORY", order: 20}
    date2: {enabled: false, label: "Date2 Label", eformVisible: false, mandatory: "NOT_MANDATORY", order: 21}
    date3: {enabled: false, label: "Date3 Label", eformVisible: false, mandatory: "NOT_MANDATORY", order: 22}
    date4: {enabled: false, label: "Date4 Label", eformVisible: false, mandatory: "NOT_MANDATORY", order: 23}
    date5: {enabled: false, label: "Date5 Label", eformVisible: false, mandatory: "NOT_MANDATORY", order: 24}
    dropdown1: {enabled: true, label: "Country", eformVisible: false, mandatory: "NOT_MANDATORY", order: 30, …}
    dropdown2: {enabled: false, label: "Dropdown2 Label", eformVisible: false, mandatory: "NOT_MANDATORY", order: 31, …}
    dropdown3: {enabled: false, label: "Dropdown3 Label", eformVisible: false, mandatory: "NOT_MANDATORY", order: 32, …}
    dropdown4: {enabled: false, label: "Dropdown4 Label", eformVisible: false, mandatory: "NOT_MANDATORY", order: 33, …}
    dropdown5: {enabled: false, label: "Dropdown5 Label", eformVisible: false, mandatory: "NOT_MANDATORY", order: 34, …}
    email1: {enabled: false, label: "Email1 Label", eformVisible: false, mandatory: "NOT_MANDATORY", order: 25}
    email2: {enabled: false, label: "Email2 Label", eformVisible: false, mandatory: "NOT_MANDATORY", order: 26}

from this json data i need to get only value of enabled:true. based on this value textbox or dropdown should enabled.
first i tried to separate an arrya based on the ebaled:true value but not getting exact solution.because
formate is object[][] show its not giving exactly what i want.
provide solution how to get object only enabled true using typescript or html
A coding maintainable life balance
Tags: coding, programmers, inspiring
Published: 2021-01-16 18:38:13

---
title: A coding maintainable life balance
published: true
description: 
tags: #coding #programmers #inspiring
cover_image: https://miro.medium.com/max/2400/1*OlvM1I9C6Ip0u2ds0aLMgA.jpeg
---

Programming is like solving a puzzle or building a structure, you would never be bored if you are a creative type of person who loves to get involved with the building process and the final result but sometimes it turned into a frustrated and exhausting process but never forget that programming has to be fun, free to be, inspiring and simple. Fun to build, free to choose a way to solve a problem, inspiring to do the best we can, and simple to implement.

Despite some programmers saying that coding is always a frustrating, stressful activity, it doesn’t! All human activities have a part of that, n’ coding it’s not the exception but its a beautiful experience like make a great dish for a passionate chef or execute a surgery for a talented doctor and when it turns into a stressful activity, take a break, get a cup of something, make a draw, express yourself in other ways, listen to some music, play a game, take a short walk, n’ go back later it helps, sometimes pushing n’ again, isn’t the correct way, programming is, first of all, a creative process, get used to it to see it in that way.

Nowadays is very common to wrap this beautiful activity with money/project deadlines, pay bills needs, but is necessary to give its time and space for our brain to processing and get the best results and most important a coding maintainable life balance.
emoji picker that can convert emoji into meme (MacOS, Windows)
Tags: productivity
Published: 2021-01-16 18:21:25

Started as a fun project to troll my colleagues, we now publish ememeji, a fusion of an emoji picker and a meme generator. 

⚡ Launch with no delay
😎 Easily search emojis with modern vocabulary
😎 Access various funny memes at your finger tips
😎 Personalize your meme with text
🛠 Works on Mac and Windows

I would love to have you guys check it out.
Join the Discord community https://discord.gg/8VWm7S7DQq
More info: [ememeji.com](https://ememeji.com)
UIengine project setup
Tags: designsystem, css
Published: 2021-01-16 18:18:24

[UIengine](https://github.com/dennisreimann/uiengine) is an awesome tool I used few times to document design systems with living pattern libraries. Here it is my basic UIengine setup.
### Prerequisites

Styles configuration from scratch is available in this post: [📒 styleguide setup](https://giuliachiola.dev/posts/styleguide-setup/).

## UIengine

- [UIengine](https://github.com/dennisreimann/uiengine)

> Workbench for UI-driven development: A tool for developers and designers to build and document web sites and apps.

```shell
npm install @uiengine/core --save-dev
```

UIengine supports lot of [template languages](https://uiengine.uix.space/adapters/). After choosing one of them, for instance _EJS_, we have to install the adapter for this language

```shell
npm install @uiengine/adapter-ejs --save-dev
```

- [module-alias](https://github.com/ilearnio/module-alias)

> Create aliases of directories and register custom module paths in NodeJS like a boss!

```shell
npm install module-alias --save-dev
```

_module-alias_ comes in handy in _component.config.js_ files, where we need to call JS functions contained in the root folder `/scripts`:

Require `module-alias`

```javascript
const moduleAlias = require('module-alias')
```

Register the alias with the method `addAlias`

```javascript
moduleAlias.addAlias('@scripts', process.cwd() + '/scripts')
```

Example: we want to populate component fileds with data contained in _scripts/content.js_. Using  `module-alias` we can use the shortcut `@scripts` to get the content file, from anywhere we made the call.

```javascript
// Debug to run it in nodeJS
const moduleAlias = require('module-alias')
moduleAlias.addAlias('@scripts', process.cwd() + '/scripts')
// Config
const content = require('@scripts/content.js')
```


## Run parallel tasks

- [npm-run-all](https://github.com/mysticatea/npm-run-all)

> A CLI tool to run multiple npm-scripts in parallel or sequential.

```shell
npm install npm-run-all --save-dev
```

- [nodemon](https://github.com/remy/nodemon)

> nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected.

```shell
npm install nodemon --save-dev
```

### Dev scripts

- _nodemon_ checks if any file has changed
- UIengine runs in `--serve` mode to hot-reload changes
- _npm-run-all_ runs in parallel UIengine build and styles build

```json
"scripts": {
  "_____________________________Dev_______________________________": "",
  "watcher": "nodemon -e scss -x \"npm run styles:dev\"",
  "build:serve": "node ./scripts/uiengine build --watch --serve",
  "dev": "npm-run-all -l clean:dev --parallel build:serve watcher"
}
```

## UIengine configuration

- Add CSS file to customize UIengine layout

```javascript
// uiengine.config.js

customStylesFile: '/css/uiengine.css',
```

Now that my basic UIengine setup is done, I can start to develop my components! 💪🏻
System Design Basics: Getting started with Caching
Tags: systemdesign, softwareengineering, programming, technology
Published: 2021-01-16 19:12:54

---
title: System Design Basics: Getting started with Caching
published: true
date: 2021-01-16 18:12:44 UTC
tags: systemdesign, softwareengineering, programming, technology
canonical_url: https://towardsdatascience.com/system-design-basics-getting-started-with-caching-c2c3e934064a
---

[![](https://cdn-images-1.medium.com/max/2600/0*1EzBZAdG1HfYaJOX)](https://towardsdatascience.com/system-design-basics-getting-started-with-caching-c2c3e934064a?source=rss-577e2119c7f2------2)


Caching is an essential topic of system design. It is one of the essential techniques of system design. In almost all the systems, we might need to use caching. It is a technique used for the performance improvement of a system.

##What is Cache?
The cache is a piece of hardware or software that stores data that can be retrieved faster than other data sources. Caches are generally used to keep track of frequent responses to user requests.

We need to increase the number of cache hits and decrease the cache miss rate for performance improvement. 

##Cache Invalidation:
In the case of data modification in DB, if the cache contains the previous data, then that is called stale data. So, we need to have a technique for invalidation of cache data. Else, the application will show inconsistent behavior. As cache has limited memory, we need to update data stored in it. This process is known as Cache Invalidation. Some techniques for cache invalidation are Write-through Cache, Write-back Cache, Cache-Aside, Read-Through Cache, etc.

##Cache Eviction policy:
A cache is a backup of primary data storage; It has a limited amount of space. We may need to remove them from the cache. These are called eviction policies. Some well-known policies are First In First Out, Last In First Out, Least Recently Used(LRU), Least Frequently Used (LFU), etc. According to the requirements, we have to select an eviction policy for the system.

[Continue reading on Towards Data Science »](https://towardsdatascience.com/system-design-basics-getting-started-with-caching-c2c3e934064a?source=rss-577e2119c7f2------2)
If you don't have a medium account check [this link](https://towardsdatascience.com/system-design-basics-getting-started-with-caching-c2c3e934064a?sk=dd4e6d96a768481d68e3b0bd80227f1f)
Build A Data Platform For Millions
Tags: devops, webdev, aws, webinar
Published: 2021-01-16 17:55:57

if you are interested in development and DevOps  and free this Sunday Evening for 3 hrs. (5 to 8 Pm IST) then this is Good place to invest your Valuable time with Ex- HotStar Senior SDE expert Mohit Yadav to Build A Data Platform For Millions: Inside India's Largest Streaming Service. 


Limited Seats Register Now : http://bit.ly/book_your_seat_now 

Thanks and regards
Arya