teleren/devto huggingface dataset:
Running WordPress on Docker
Published: 2022-05-09 13:57:12

---
title: Running WordPress on Docker
published: true
date: 2020-07-14 00:00:00 UTC
tags: 
canonical_url: https://carl-topham.com//articles/running-wordpress-docker
---

WordPress runs on a variety of platforms, but last time I was developing I was using a MAMP stack - Mac Apache MySQL & PHP. It's been a while since I was working on WordPress sites and I no longer have MAMP installed on my machine, however I do have Docker running. Since I can create a LAMP stack (Linux... AMP) running on my Mac. This is a bit closer to what the site would be running on in the real world, plus I can deploy the Docker app to something like a DigitalOcean Droplet quickly.

Let's start by creating a folder for this to contain all the configs and data.

```
mkdir wordpress-docker && cd wordpress-docker

```

Then add a Docker Compose file, which is used to define and run multiple containers easily.

```
touch docker-compose.yml

```

Next we need to configure the file itself, so in your favorite editor open up `docker-compose.yml`. A few things are configured in the Docker Compose:

- The version of Docker Compose to use
- The services (containers) we are configuring. These consist of the database and the code.
- The image for each container to use
- What ports to open and bind to the host (your machine). This allows each container to speak to the other when needed
- An env file, where variables like database passwords can be stored so they can be exempt from being committed to source
- And in the case of the `wp` container a link to the database container so it can be accessed by name as `mysql` since the `wordpress` container image uses this to connect.

```
version: "2"
services:
  db:
    image: mariadb
    ports:
      - "8081:3306"
    env_file:
      - .env
  wp:
    image: wordpress
    volumes:
      - ./html/:/var/www/html
    ports:
      - "8080:80"
    env_file:
      - .env
    links:
      - db:mysql

```

Create a `.env` files for the variables (You could also use 2 `.env` files, one for each container). Note that both passwords MUST be the same!

```
 MYSQL_ROOT_PASSWORD=SuperSecretTellNobody!
 WORDPRESS_DB_PASSWORD=SuperSecretTellNobody!

```

That's it for config, now it's time to start your Docker containers. The following command will start to download and build the images and then boot them up. Running it with `-d` runs it in the background once

```
docker-compose up -d

```

Once it's booted up and is ready to go you will see something like this:

```
Starting wordpress-docker_db_1 ... done
Starting wordpress-docker_wp_1 ... done

```

In your browser head over to `http://localhost:8080/` and you'll be welcomed by the initial setup screens.

If you take a look in your directory you'll have a `./html` sub-directory that contains all your WordPress files just like a normal WordPress install.

Note: You can stop docker by running `docker compose down`
No, you do not have to use Mongodb with Node.js
Tags: node, mongodb
Published: 2022-05-09 19:41:40

---
title: No, you do not have to use Mongodb with Node.js
published: true
date: 2020-05-13 09:00:00 UTC
tags: node, mongodb
canonical_url: https://jovandjukic.com/no-you-do-not-have-to-use-mongodb-with-nodejs
---

Vast majority of beginner nodejs tutorials use mongodb for the database. For simplicity sake, this is fine for beginners. It saves them the hassle of dealing with SQL table relations, so they can just stick any data in and get it out to render it on the page.

## So, you need to persist some data

After learning the basics of building apps with Node.js, you may decide to build an app on your own. The courses and tutorials you learned from taught you Mongodb. It seems like next logical step:

- It has a nice Javascript API, just like Node.js
- It stores all data in JSON format
- You can easily fetch any data from the database
- You easily send that data to the client
- It's blazing fast, just like Node.js
- You don't have to learn another language just for databases

It seems like Mongodb is hand crafted for Javascript environment. For the first time ever, we can use one the same language in all 3 layers of our applications:

- Javascript in the browser (User interface)
- Javascript on the server (Business logic)
- Javascript in the database (Data persistance)

Knowing this, its easy for beginners to fall into a trap of thinking Mongodb is the only database to use to persist data in Node.js apps. Experienced developers, coming to Node.js from other technical backgrounds, often ask: "Can I use Postgres/Mysql with Node.js?"

## You can use any database you want

Node.js is Javascript runtime environment. It is a symbiosis between a Javascript interpreter and some C++ code that let's you write server or desktop apps with Javascript language.

This was not possible before, since Javascript is a language meant to be use in the context of a browser, thus confined within it for security reasons. Node.js sets Javascript free.

Having Javascript execute outside of browsers allows us to do things such as networking, file system manipulation, getting operating system information, multi-threading (even though Javascript is a single-threaded language) and much more that was done with most other languages like Java, C#, PHP, Ruby, Python, etc.

Since a Node.js app runs in the memory, a node app would need to preserve data in the database so it doesn't get lost. Which database can you use with node? Any database that you can find a driver for, which is all of them.

There is nothing in Node.js that dictates your choice of database. It does not favor any particular database system, neither relational nor non-relational.

Database is an external service from the point of view of a node app. You only need a driver and a running instance of a database to use it. Node.js doesn't care about that at all.

Use whatever database you want.
Meet The Board: Chris M. Christi
Published: 2019-08-14 16:51:23

---
title: Meet The Board: Chris M. Christi
published: true
description: 
tags: 
---
Chris Christi brings more than 20 years experience in Information Technology to his current role at Thales Defense and Security, Inc. working with Department of Defense clients on data security projects.  He started his technology career managing tactical networks as an Army Signal Officer.  He served in various technology leadership roles and deployed to Bosnia and Iraq earning military awards including the Bronze Star Medal, Army Commendation Medal, Army Achievement Medal and Combat Action Badge. 

 

Chris has private sector business development experience with technology companies including  Dell, Secure Computing, Veeam Software and Forcepoint.  Chris co-founded data security firm AxiosTec where he was selected twice by Inc. for the Military Entrepreneur Program at GROWCO.  His company was also recognized by the White House for partnership with the Nashville Technology Council’s Tech Hire designation for work with veterans as part of workforce diversity. 

Chris graduated from the University of Tennessee as a Distinguished Military Graduate.  He resides in Nashville, Tennessee with wife Sara and children Megan and Miles.  He is a leader in the Nashville veterans community where he previously served as Vice President  Board of Directors of Operation Stand Down Tennessee.  He also serves as a mentor to veterans at the Nashville Entrepreneur Center, Nashville Technology Council Veterans Peer Group, Bunker Labs and Veterans Coordinating Council.

Chris primary focus with Vets Who Code is evangelizing the mission and bridging opportunities for their impact in the local Nashville area.
Day 33: Back in action!
Published: 2022-05-11 22:56:52

Hi!
so I'm back two after almost two days without coding, but I didn't do much I feel so tired and lazy. I managed to finish my task for the week but I think I still need time for more rest. I said said something about taking a rest and watching a movie yesterday but there was no time :)
tomorrow I want to work on an article about `testing with jest` or `ci and cd` at least publish one by the end of the day I think I'm also falling behind with the personal project so I need to take a look into it too
off to sleep
No more to-do lists please
Published: 2022-06-05 01:14:21

---
title: No more to-do lists please
published: true
date: 2022-01-05 21:56:06 UTC
tags: 
canonical_url: 
---

We need to start creating real coding projects right now.

Everybody knows we, in some random moment got stuck, especially when you really want to build something cool, memorable, useful, the next big thing, but have no idea on what the freaking hell you can do.

This happens to me more than I really want to admit. It’s kind of disappointing to have the knowledge, have the tools, but don’t know what to do or where to go.

Clock’s clicking around and time’s running, but you are still stuck in what app should I create, or sometimes you already have the idea, but can’t figure out how to implement that idea.

Today, I want to share with you some of my experiences on this topic.

Many years ago, I got stuck. In simple terms, I’d be starting to learn python and wanted some ideas to program, and get better at coding. I decided to open up Google Chrome and type ‘coding projects ideas’ and hit enter. Around 10 minutes later, found a post in a forum about ‘Beginner project ideas’, and were not that bad, actually, I liked it.

So, I just copied-and-pasted in a blank text file and dropped it on my desktop, and start building all those one by one. A week later, every ‘project’ was finished.

Next, I just decide to try again the same thing, and guess what, The other projects I found were almost exactly the same, just a dirty copy of the book where the first group of projects was extracted from.

Several days have passed, and all the ‘project ideas’ I see are the same, that’s why I’m writing this right now. We need to address a difference, be creative, create real and useful software we feel proud of.

To reach my point, I want to say this:

It’s the perfect time to stop doing the same shitty apps and start creating awesome masterpieces of software.
Paracetamol.js💊| #147: Explica este código JavaScript
Tags: javascript, webdev, spanish, beginners
Published: 2022-06-19 16:55:26

## **<center>Explica el siguiente código JavaScript</center>**
#### <center>**Dificultad:** <mark>Intermedio</mark></center>

```js
const { 0: x, 2: y } = ['a', 'b', 'c'];
console.log(`0:${x}, 2:${y}`)
```

A. `0:a`, `2:a`
B. `0:a`, `2:c`
C. `0:a`, `2:b`
D. `0:b`, `2:c`

Respuesta en el primer comentario.

---
lazy load with http header?
Tags: react
Published: 2022-06-13 17:16:05

Hey.... I'm working on an app, I want to lazy load a separate bundle, but want to make sure the lazy load contains a specific http header (a bearer token). 

The reason for this question (in case I'm barking up the wrong tree) is that I want my login bundle to be publically accessible, but the main app to only be accessible once the login has been successful. Using React.lazy(() => import("./pages/Dashboard")); sounds promising, but I'm not sure if there's a way to add my header (I also looked at react-loadable.... same issue)
[pt-BR] Desmistificando algoritmos - Thomas H. Cormen
Tags: beginners, algorithms
Published: 2022-06-14 00:45:00

Irei compartilhar as minhas anotações e highlights sobre o o livro "Desmistificando algoritmos" do Thomas H. Cormen.

Se eu fosse dar uma breve introdução, eu usaria algumas frases do autor, em que ele menciona as seguintes definições e para quem o livro é destinado:

- Quem está interessada(o) em saber como os computadores resolvem problemas;
- Saber como avaliar essas soluções...

No capítulo 1, já vejo o título nomeado como "O que são algoritmos e por que você deve se importar com eles?". Nos cursos mais básicos, aprendemos que os algoritmos são conjuntos de etapas com o propósito de executar uma tarefa (seja qual for ela). Os algoritmos estão mais presentes em nosso cotidiano do que imaginamos e são executados em todos os lugares.

Também é bom relembrar que não existe o "óbvio" para o computador. Ele precisa da exatidão. Inclusive, isso é o que difere a execução feita por nós e a por outro lado, a execução feita pelo computador.

> 
É necessário haver precisão no algoritmo de computador

Uma outra pergunta boa a ser feita é: "Para que queremos esses algoritmos?" pelo simples fato deles nos trazerem soluções.
3 benefits interviews bring you
Tags: career
Published: 2022-06-14 04:09:58

---
title: 3 benefits interviews bring you
published: true
tags: 
 - career
canonical_url: https://petermekhaeil.com/3-benefits-interviews-bring-you/
---

Not only do interviews open doors to new opportunities, they also help you sharpen your skills with new learnings. Interviews keep your career moving forward and I will share some learnings from experience.

## Learn about what you know

When you answer questions during the interview, be aware to what level you understand the topics being discussed. Speaking out loud about what you know helps you articulate those past career learnings and experiences. With each interview, the more you can improve your confidence in talking about what you know.

## Learn about what you do not know yet

You may not have an answer to some questions during the interview and that is totally fine - this will be an opportunity to learn something new! Ask the interviewer for the answers to those questions. Now whether or not you decide to continue with the interview rounds, you have now learnt something new that you can take to your existing job or you take to your next interview. With each interview, you are building up your knowledge base.

## Learn to negotiate

When you get to the offer stage of the interviews, you have the opportunity to practice negotiation, a very handy skill to have at any level in your career. With each interview, sharpen your negotiation skills and pick up experience in handling those situations.

_A great book on this topic is [The Coding Career Handbook](https://learninpublic.org/) - a chapter is dedicated to salary negotiation where you’ll learn that you have an upper hand simply because the best alternative is staying at the job you already have._

## Each experience will be unique

Each person will have their own learning experience. With each interview, practice a useful skill for your career, such as building your confidence, expanding your knowledge and salary negotiating.
Git VS GitHub
Tags: beginners, programming, productivity, opensource
Published: 2022-06-14 07:20:15

Git vs GitHub is one of the things that beginners find tough to understand. So in order to understand their differences let's first look at them individually.

- **What is Git?**
    
    Git is a version control system for tracking changes in computer files. It is used to coordinate work among several people on a project and track progress over time. It is used for Source Code Management in software development.
    
    A version control system is a system that records all the changes made to a file or set of files, so a specific version may be called later if needed. This helps in collaboration with all team members.

**Advantages of using git:**

- Git favors both programmer and non-technical users by keeping track of their project files.
- It allows multiple users to work together.
- Large projects can be handled effectively.

---

- **What is GitHub?**
    
    GitHub is a Git repository hosting service, which provides a web-based graphical interface.
    
    GitHub helps every team member to work together on the project from anywhere and makes it easy for them to collaborate.

---
**GIT VS GITHUB**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ja45sczfs1yfn8ero3yz.png)
---

| Git  | GitHub |
| --- | --- |
| | |
| Installed locally on the system. | Hosted on the cloud. |
| Git can be used offline and does not need an internet connection for use. | GitHub cannot be used offline and needs an internet connection. |
| Git can be used without GitHub. | GitHub cannot be used without Git. |
| Used for version control system and works as source code management in software development. | Used for centralized source code hosting. |
| Git has no GUI. | GitHub has GUI. |
| Code changes like commit, merge, etc. are done using commands from the command line.  | Everything is done through a web-based interface. |
| Open source licensed. | Includes free and pay-for-use tiers. |
---
Quick Recap of Modern JS App
Published: 2022-06-14 07:39:55

I'm currently making a instagram clone app based on tutorials by [NomadCoders](https://www.youtube.com/c/%EB%85%B8%EB%A7%88%EB%93%9C%EC%BD%94%EB%8D%94NomadCoders )

It uses various stacks and modern backend technologies - graphQL, Apollo, Prisma, Babel, React, Styled Component, etc. I used Java Spring framework few years ago, but recently I have been focusing on frontend and javascript web dev. So it was quite refreshing to learn all these new libraries and frameworks that allow you to build web app mostly in javascript as much as you can..

Just to clarify all these packages in my brain, I drew a simple structure map. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ex1h7a90mpqpkwqxvir.JPG)
 
[github repo](https://github.com/sosunnyproject/instaClone)
Install multiple versions of same package using yarn
Tags: yarn, npm, alias
Published: 2022-06-15 05:54:14

---
title: Install multiple versions of same package using yarn
published: true
description: Using alias in yarn to install multiple version of same package
tags: yarn, npm, alias
---

I had an issue in react native with libraries: `react-native-picker-select` and `@react-native-picker/picker`. `react-native-picker-select` uses `@react-native-picker/picker` internally, and the version is far behind the current version. So I tried installing the latest version of `@react-native-picker/picker` separately but got an error saying: `RNCAndroidDialogPicker` was declared twice or something similar. 

Anyways, I couldn't solve the issue but found aliases in npm/yarn. 

With aliases you could add node packages with a different name and import them without any issues. 

```
yarn add your-custom-name@npm:@react-native-picker/picker
```
This way I can define a new name for the latest version of the `@react-native-picker/picker` library and import it in my components with the new name. The same name will be added to the package.json file.
Maximum Bags With Full Capacity of Rocks
Tags: leetcode, dsa, theabbie
Published: 2022-06-15 10:00:46

You have `n` bags numbered from `0` to `n - 1`. You are given two **0-indexed** integer arrays `capacity` and `rocks`. The `ith` bag can hold a maximum of `capacity[i]` rocks and currently contains `rocks[i]` rocks. You are also given an integer `additionalRocks`, the number of additional rocks you can place in **any** of the bags.

Return _the **maximum** number of bags that could have full capacity after placing the additional rocks in some bags._

**Example 1:**

**Input:** capacity = \[2,3,4,5\], rocks = \[1,2,4,4\], additionalRocks = 2
**Output:** 3
**Explanation:**
Place 1 rock in bag 0 and 1 rock in bag 1.
The number of rocks in each bag are now \[2,3,4,4\].
Bags 0, 1, and 2 have full capacity.
There are 3 bags at full capacity, so we return 3.
It can be shown that it is not possible to have more than 3 bags at full capacity.
Note that there may be other ways of placing the rocks that result in an answer of 3.

**Example 2:**

**Input:** capacity = \[10,2,2\], rocks = \[2,2,0\], additionalRocks = 100
**Output:** 3
**Explanation:**
Place 8 rocks in bag 0 and 2 rocks in bag 2.
The number of rocks in each bag are now \[10,2,2\].
Bags 0, 1, and 2 have full capacity.
There are 3 bags at full capacity, so we return 3.
It can be shown that it is not possible to have more than 3 bags at full capacity.
Note that we did not use all of the additional rocks.

**Constraints:**

*   `n == capacity.length == rocks.length`
*   `1 <= n <= 5 * 104`
*   `1 <= capacity[i] <= 109`
*   `0 <= rocks[i] <= capacity[i]`
*   `1 <= additionalRocks <= 109`

**SOLUTION:**

    class Solution:
        def maximumBags(self, capacity: List[int], rocks: List[int], additionalRocks: int) -> int:
            n = len(capacity)
            diff = [capacity[i] - rocks[i] for i in range(n)]
            diff.sort()
            print(diff)
            i = 0
            while additionalRocks > 0 and i < n:
                additionalRocks -= diff[i]
                i += 1
            if additionalRocks < 0:
                return i - 1
            return i
897. leetcode solution in cpp
Published: 2022-06-15 17:43:04


```

class Solution {
 public:
  TreeNode* increasingBST(TreeNode* root, TreeNode* tail = nullptr) {
    if (!root)
      return tail;

    TreeNode* ans = increasingBST(root->left, root);
    root->left = nullptr;
    root->right = increasingBST(root->right, tail);
    return ans;
  }
};
```
Tired of creating virtual environement each time?
Tags: python, pip, pipx, env
Published: 2022-06-16 02:00:30

pipx is a package manager that you can use to create sandboxes and you can call them everytime you need them, no need to create a virtual environement evrytime you create a new project.

```
python3 -m pip install --user pipx

python3 -m pipx ensurepath
```
you can start using it like pip with the command :


```
python3 -m pipx install ?PACKAGE2INSTALL?
```
Day 19 - Function Modifiers
Tags: 100daysofcode, solidity, web3, blockchain
Published: 2022-06-16 17:29:00

{% embed https://github.com/Envoy-VC/30-Days-of-Solidity noreadme %}

This is Day `19` of `30` in Solidity Series
Today I Learned About Function Modifiers in Solidity.

Modifiers assist in the execution of a function’s behavior. The behavior of a function can be changed using a function modifier, they can also be called before or after a function is executed.

Solidity function modifiers help in the following:

- To access restrictions
- Input accuracy checks
- Hacks protection

Example:
```solidity
contract Owner {
   modifier onlyOwner {
      require(msg.sender == owner);
      _;
   }
}
```

The function body is inserted where the special symbol "_;" appears in the definition of a modifier. So if condition of modifier is satisfied while calling this function, the function is executed and otherwise, an exception is thrown.

Example:
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

contract Mint {
    constructor()  {
        owner = msg.sender;
    }
    modifier onlyOwner {
      require(msg.sender == owner);
      _;

    function _mint(address to , uint tokenId) onlyOwner {
      mint(to, tokenId);
    }
}
```