teleren/devto huggingface dataset:
JBOD (Just a Bunch of Drives)
Published: 2022-06-27 19:05:59

If you have been dealing with hardware storage configuration, you may have heard the work JBOD along with RAID. JBOD stands for Just a Bunch of Disks or Just a Bunch of Drives. Either way it is a multilevel configuration of disks, be it HDD or SSD. 
  JBOD is a collection of disks so when assembled are regarded as one logical volume.  It is still a form of RAID in a sense that the data is stored redundantly in several disks that are set together to form one logical unit or LUN 
      As mentioned earlier, companies have the option to go JBOD or RAID, so when is the usage of JBOD is preferable to a RAID configuration?   I won’t be making side by side comparison of JBOD and RAID in a letter article, but I will rather focus on when to use JBOD by laying out its advantages and drawbacks.
How does it work?
 JBOD does its magic by turning combined drives in to a LUN and then filling them with order through a process called spanning.  Think of a multilevel water fountain, the water will only flow to the level bellow only when the level above is full.
When to JBOD?

     JBOD should be considered when there is a need for an efficient and cost-effective storage method preferably for on-prem storage. Unlike RAID, JBOD allows the full utilization of every single disk the array. 
   When dealing with JBOD, disk size’s parity is also not a requirement.  A 2TB and a 16 TB drives can be combined to make a 18TB storage capacity. 
When not to JBOD 

JBOD is not meant to hold primary data but rather as a temporary backup due to its lack of reliability. In fact, if a disk containing data is damaged, the data is permanently gone and a failure of a disk in the array end up killing it.
It is important to note that JBOD does not convey the advantage of fault tolerance of performance improvement, therefore it is not advisable to implement JBOD when looking for data integrity for high availability.
Also unused disks in a JBOD are just a waist in term of capacity and energy usage and each new disk added to do its hot “swapability” create a potential point of failure.
Git: ¿Cómo eliminar un archivo de la historia?
Tags: git, github, tutorial, eliminar
Published: 2022-06-27 20:29:26


Git es una herramienta asombrosa, y que ciertamente cambió la forma en que desarrollamos software, y la llegada de Github años atrás cambió la forma en que compartimos nuestros desarrollos.

Pero - siempre hay un pero - al hacer nuestro código fuente público, es fácil caer en ciertos errores o problemas relacionados con información sensible.

¿Cuántas veces has agregado a un commit y subido al repositorio un archivo que se supone no debería ser público?

> Para evitar esto existe el archivo `.gitignore` que te permite configurar que archivos ignorar a la hora de hacer commits

Y si esto te ha pasado, sabes que no sólo sirve eliminar el archivo en un nuevo commit, ya que `git` almacena todo el historial de tu repositorio, lo que permite el acceso al achivo de igual manera.

  
Entonces, ¿Cómo eliminas totalmente esta información?



Lo que realmente quieres es, re-escribir la historia de tu repositorio para así eliminar toda referencia a dicho archivo.

Para esto necesitas  


1. Encontrar la ubicación o "path" del archivo dentro del repositorio
2. Recorrer cada branch y commit
3. Eliminar el archivo en cada branch

> Dependiendo del tamaño de tu repositorio esto puede tomar bastante tiempo.



Supongamos que quieres remover un archivo `.env` que agregaste por equivocación, y este se encuentra en el directorio `web/.env`.



En tu terminal, en el directorio root de tu repositorio ejecuta:



`$ git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch ./web/.env" HEAD `



Al ejecutar esta operaicón verás que en la terminal se mostrará un mensaje indicando que esta herramienta podría traer algunos problemas (hasta ahora no he notado ninguno)



`WARNING: git-filter-branch has a glut of gotchas generating mangled history  
rewrites. Hit Ctrl-C before proceeding to abort, then use an  
alternative filtering tool such as 'git filter-repo'  
(https://github.com/newren/git-filter-repo/) instead. See the  
filter-branch manual page for more details; to squelch this warning,  
set FILTER_BRANCH_SQUELCH_WARNING=1.`



En este mensaje se indica que existe una herramienta alternativa llamada `filter-repo` que [puedes encontrar en github](https://github.com/newren/git-filter-repo/)   
  
Una vez instalada (puedes usar `brew` para macOS o `pip`) puedes utilizarla con el siguiente comando en tu terminal  


> [Revisa más sobre la instalación](https://github.com/newren/git-filter-repo/blob/main/INSTALL.md)



`$ git filter-repo --path ./web/.env --invert-paths `



Después de esta operación puedes actualizar tu repositorio remoto

`git push --all -f`
![Footer Social Card.jpg](https://cdn.hashnode.com/res/hashnode/image/upload/v1615457338201/5yOtr5SdF.jpeg)
✉️ [Únete a Micro-bytes](https://microbytes.matiashernandez.dev)         🐦 Sígueme en [Twitter](https://twitter.com/matiasfha)           ❤️ [Apoya mi trabajo](https://buymeacoffee.com/matiasfha)
My Top 4 Open Source CRM. What are Yours?
Tags: crm, discuss, opensource, yetiforce
Published: 2022-06-27 20:22:28

The CRM space would forever be relevant. 

And why is that? Because the customer is always right!!!! 

Here are my top 4 Open Source CRM:

###4. Suite CRM

Yes. I know you want that CRM that gives you a 360 degree view of the customer and major integration capabilities. And many other features. I think SuiteCRM does just that and it is quite lightweight, perfect for SMEs. It is a fork of SugarCRM.


<a href="https://suitecrm.com/" rel="SuiteCRM">![SuiteCRM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k42yksmxb7r3e36i8k8n.png)</a>

###3. Odoo
Now, Odoo is one of the oldest players with several CRM features. For me, the learning curve is quite longer but it is great for large enterprises. Solid features for  product and services management. sales, order fulfilment, support and retention.

<a href="https://www.odoo.com/app/crm" rel="Odoo">![Odoo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fdgv56nt5k82da6ap5sk.png)</a>

###2. VTiger
It has the largest community, I guess. With a lot of developer effort in building several plugins. Also, a fork of SugarCRM, the self-hosted open source version caters for a large number of features for SMEs and medium-sized companies. It could become buggy if not properly understood. Download [here](https://sourceforge.net/projects/vtigercrm/files/vtiger%20CRM%207.4.0/). The VTiger-one pilot is a free-forever cloud version which is more stable and perfect for SMEs. [Explore](https://www.vtiger.com/free-pilot-edition/)

<a href="https://www.vtiger.com/free-pilot-edition/" rel="VTiger">![Vtiger](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/963bxz28o0ytd3a9cxeg.jpg)</a>


###1. Yetiforce
I love Yetiforce. It is fully featured and every new release comes with wonders. Native integrations with popular projects such as Magento, CalDav, Outlook, PBX, LDAP, RoundCube. The Yetiforce team’s consistency is top-notch and the administrative capabilities are awesome. Almost everything is configurable! Hopefully, it has more opportunities to adopt a more cloud-native approach and be disruptive. It’s a fork of VTiger. And yes! Thanks to SugarCRM again. Well, finding documentation and support would be your first major hurdle while using Yetiforce though.

<a href="https://yetiforce.com/en/download" rel="Yetiforce">![Yetiforce](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xm8v4a5qtqzhyj12kt4t.png)</a>

Those are my favorite!!! What are yours?
Own reduce method using Typescript
Tags: typescript, javascript, arrays
Published: 2022-06-27 20:05:28

---
title: Own reduce method using Typescript
published: true
description: 
tags:
- typescript
- javascript
- arrays
canonical_url: "https://geodev.me/blog/own-reduce-method-using-typescript/"
# Use a ratio of 100:42 for best results.
---

In my <a href="https://michalmuszynski.com/blog/own-higher-order-functions-implementation/" target="_blank">previous post</a> I presented my approach to implement my own versions of some higher order functions in JavaScript. I covered three of them and one, a very powerful one was missing.
The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce">Array.prototype.reduce</a>.

In this short post, I'd like to show you my take on this higher order function using Typescript.

First, let's extend the Array prototype types. That's the part I'm not sure of. The Typescript compiler does not complain, but I feel that's something's wrong here. If you know what, let me know.
```javascript
interface Array<T> {
    myReduce(cb: (previousValue: T, currentValue: T, index: number, array: T[]) => T, initialValue: T): T;
}
```

And the function itself should look like this:

```javascript
Array.prototype.myReduce = function<ReducedElem, ReducedValue>(callback: (previousValue: ReducedValue, currentValue: ReducedElem, index: number, array: ReducedElem[]) => ReducedValue, initialValue: ReducedValue): ReducedValue {
    let i = 0;
    let reduced = initialValue;

    if (arguments.length < 2) {
        i = 1;
        reduced = this[0];
    }
    for (i = 0; i < this.length; i++) {
        reduced = callback(reduced, this[i], i, this)
    }

    return reduced;
}
```

I've tested this solution with a few examples.

```javascript
// Classic usage - sum the numbers in the array
const numbers = [1, 10, 100, 1000];
numbers.myReduce((sum, curr) => sum + curr, 0) // Result: 1111

// Find the most recent date
const dates = [
  '1999/01/01',
  '2022/12/01',
  '2010/05/01',
  '2022/01/01'
];
dates.myReduce((max, curr) => curr > max ? curr : max, dates[0]) // Result: '2022/12/01'

// Flatten an array
const persons = [['Andrew', 'Joe'], ['Margaret', 'Sylvia'], ['Andrew', 'Rebecca', 'Joe', 'Sylvia']];
persons.myReduce((flatArray, currArray) => flatArray.concat(currArray), [])
/* [
      'Andrew', 'Joe', 'Margaret', 'Sylvia', 'Andrew', 'Rebecca', 'Joe', 'Sylvia'
   ]
*/
```

These examples work fine and gave me the expected results. The Typescript compiler is not complaining about these examples as well.
For more information about typing function I recommend to get familiar with a <a href="https://www.typescriptlang.org/docs/handbook/2/functions.html" target="_blank">Functions chapter</a> on the Typescript official site.
package.json & package.lock.json Explained
Tags: npm, webdev, programming, node
Published: 2022-06-27 19:38:37

![package.json](https://miro.medium.com/max/1400/1*eS_S4iOGJS_frF4d6n8L6w.png)

The first question is “Should I commit package-lock.json files?”.

Let us talk about this and then answer this question.

**What is package.json?**

Basically, we can say that is the heart of any node project. This file stores the metadata about the project and manages the project’s dependencies, version, scripts, etc.

**What is package-lock.json?**

When you install some packages this file is created automatically. It stores the exact versioned dependency tree and this guarantees the dependencies for other developers. Actually, it is a very important feature of npm but some people don’t understand this.

**What about semantic versioning?**

```
"dependencies": {
"my_dep": "^1.0.0",
"another_dep": "~2.2.0"
}
```

 * Patch releases: `1.0` or `1.0.x` or `~1.0.4`
 * Minor releases: `1` or `1.x` or `^1.0.4`
 * Major releases: `*` or `x`

**What’s the difference between tilde(~) and caret(^)?**

In our first example, you can see we started with the ^ symbol and this means something different.

This **caret(^)** symbol basically says, the program can upgrade the patch releases and also minor releases but it can’t get the major releases.

If my\_dep has new patch releases and minor releases when we run npm install it will automatically upgrade to the last version. But it will not upgrade to major releases.

**tilde(~)** means the program can upgrade for patch releases but it will not upgrade to minor or major releases.

**What is the npm ci command?**

When you use **tilde(~) or a caret(^)** in your dependencies, if you run the npm install command it will automatically override your package-lock.json. If you just want to use exact dependencies without upgrading them, you can easily run this command. And basically, that’s why you need to commit the package-lock.json file.

**Resources**

*   [https://docs.npmjs.com/about-semantic-versioning](https://docs.npmjs.com/about-semantic-versioning)

_This article orginally published at [medium](https://medium.com/@atakde/package-json-package-lock-json-explained-2f9342a50e69)._
Full-Stack React & Node.js - Get data from server
Tags: react, node, javascript, webdev
Published: 2022-06-27 19:37:41

---
series: Simply Learn Full-Stack React & Node.js
---

Inside folder **node-server**, create a new folder called "controllers."  Inside add a file called **note.controller.js** and add the following code:

```javascript
const note = {
    id: 1,
    title: 'A Note',
    content: 'Lorem ipsum dolor sit amet',
    author: 'neohed',
    lang: 'en',
    isLive: true,
    category: '',
}

async function getNote(req, res) {
    res.json({ note });
}

module.exports = {
    getNote
}
```

> Why **.controller.js**? In a complex app, you will have many entities and associated route, controller, middleware and data files.  Tagging each file with **.controller**, **.route**, **.middleware**, **.data**, etc., makes it much less confusing when you have many files open in your editor.

Next, inside folder **node-server**, create another folder called "routes."  Inside add a file called **index.js** and add the following code:

```javascript
const express = require('express');
const noteRouter = express.Router();
const noteController = require('../controllers/note.controller');

noteRouter.get('', noteController.getNote);

const routes = app => {
  app.use('/note', noteRouter);
};

module.exports = routes;
```

Finally, change **app.js** to this:

```javascript
const express = require('express');
const cors = require('cors');
const morganLogger = require('morgan');
const bodyParser = require('body-parser');
const initRoutes = require('./routes/index');

const env = process.env.NODE_ENV || 'development';
const app = express();

if (env === 'development') {
  app.use(cors());
}

app.use(morganLogger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));

initRoutes(app);

app.use(function (req, res, next) {
  const error = 'Here be dragons. Route not found';
  console.info(`404 error! ${error}`)
  res.status(404).send(error);
});

const port = 4011;

app.listen({port}, async () => {
  const baseUrl = `http://localhost:${port}`;

  console.log(`Server running at: \t @ ${baseUrl}/`);
});
```

Now run your Node.js server with this command:

```shell
npm run start
```

When the console outputs a message saying the server is running, paste this URL into a browser: "http://localhost:4011/note" and you should see the following object displayed:

```json
{
  note: {
    id: 1,
    title: "A Note",
    content: "Lorem ipsum dolor sit amet",
    author: "neohed",
    lang: "en",
    isLive: true,
    category: ""
  }
}
```

You now have a working client and server. [Next](https://dev.to/neohed/full-stack-react-nodejs-get-client-server-talking-of9), we will finally get the client and server to communicate...

Code repo: [Github Repository](https://github.com/neohed/node-react-stack)
Typescript Count Substring of a String Literal Type
Tags: webdev, typescript, programming, tutorial
Published: 2022-06-27 18:05:16

Ever wonder how can you count certain characters of a string literal type?

here is how:

```ts
type GetCountOfSubString<
	String_ extends string,
	SubString extends string,
	Count extends unknown[] = []
> = String_ extends `${string}${SubString}${infer Tail}`
	? GetCountOfSubString<Tail, SubString, [1, ...Count]>
	: Count['length']


type NumberOfA = GetCountOfSubString<"a--a--aa--a","a"> // 5
```

[playground](https://www.typescriptlang.org/play?#code/C4TwDgpgBA4hwGED2BXAdsA8gMwMooCNdgAnASzQHMAeAWACgBIY8qgfSggA9gI0ATAM5RBpCpQA0DZoRbjOPPkJFiqUpsnTAFvAcPQBrNEgDuaANoBdKAF4oVhgD5bUOex1LhAAwAkAb1FWSgBff3wiVRD-CmwIEigAFQBDMgAbYK9pAH5YeE0MHHC3GmS0iVdZSPLzAEZygDpG-OBLR2kALihm8wByVL5KYAALHssGcfpQSCgAORQAWwI4nABBFzhEVAK8SqDqACIkgFoj49OzpP2JQ-3nAHo7qABWIA)

limitation: the count cannot exceed 999 because the max depth of TS recursion is only 1000
Failure
Published: 2022-06-27 19:31:15

I practice css, JavaScript a lot and I have given effort to learn them as much as I can.But when it's comes to a new project of my own it's like my brain gets blank.I can't think how to use them to create a new project of my own.so,it will be very helpful,if anyone gives me some tips that I can make a project of my own idea rather than copy it from YouTube.
for...of Loop in JavaSript
Tags: javascript, beginners
Published: 2022-06-27 19:17:50

You may have probably encountered different types of loops in JavaScript while learning to code or writing lines of codes to perform an action based on an iteration. There are two major type of loops in JavaScript that are used in iteration, the **for loop** and the **while loop**. You might be thinking of **do...while** loop as a separate loop but for now I'll classify it under the **while loop**. There are a variety of **for loops** based on the data type we are looping through or iterating over. These varieties are, the ordinary **for loop**, **for...of** to iterate over an array or a collection of html nodes, and **for...in** to iterate over objects. In this post, We shall focus on the for...of looping technique to iterate over arrays in JavaScripst. 

**for...of**
At this point you may have interacted with different data types in JavaScript such as strings, float, objects, arrays...etc. In this part, we shall only focus on arrays. Well, you might be familiar with arrays at this moment. Arrays are a collection of items packed together. These items can be numbers, strings, nested arrays, boolean, or even the objects. We shall use the for...of to iterate through an array of strings and numbers. The **for...of** loop is not in any way complicated, in fact, it is pretty straight forward. The for...of uses the format of for (let item of items){code to execute}. Let's put this into practice by looping through an array of numbers and strings.
```javascript
//create a variable using const to store the array of numbers
const numbers = [24, 67, 84, 38, 39, 92,37];

//loop through the numbers to check it is an even or odd number

for (let number of numbers) {
//code to execute
//checks if number is even or odd
    if (number%2===0){
        console.log(`${number} is even`)
    }else {
        console.log(`${number} is odd`)
    }
}
/*
24 is even
67 is odd
84 is even
38 is even
39 is odd
92 is even
37 is odd
*/
```

**For...of** loop can as well be used to loop through an array containing items of any data type. Let's use the **for...of** loop to loop through an array of strings. We shall capitalize each word in the array.

```javascript
//create a variable using const to store the array of countries
const countries = ["Kenya", "Sudan", "Nigeria", "Tanzania", "Brazil", "Germany", "India"];

//loop through the countries and convert each country name to uppercase

for (let country of countries) {
    console.log(country.toUpperCase())
}
/*
KENYA
SUDAN
NIGERIA
TANZANIA
BRAZIL
GERMANY
INDIA
*/
```

Up to this you have learned how to loops through an array using the **for...of** loop. The **for...of **loop can be used to loop through a collections of html nodes. That's it for this post. Hope you enjoyed reading and happy coding
STORAGE Basics: RAID 0
Tags: storage, aws, raid, hdd
Published: 2022-06-27 19:09:58

 **RAID**, acronym for Redundant Array of Independ Disks.   It is a well-known data storage technology that uses stripping, mirroring or parity to store data on a set of drives or disks. A RAID is implemented when two or more disks or drives are combined together in a logical unit to increase the performance, or redundancy or both.  

The term was coined by David Patterson and some a couple of his colleagues from the University of California Berkeley in the late 80’S.
      There are different levels of RAID that can implemented according to the user’s specific need ranging from RAID 0 to RAID 10. In this article we I will be going in depth on RAID 0 also known as “striping “.  I will also be skipping any hardware or software requirement need to implement a RAID. That will be covered in a different blog post in depth. The other type of RAID will also be covered in later blog posts. 

 **Requirement:** 
   Before implementing a RAID 0, there is a minimum of two drives or disks that are required. 
    When RAID 0 is implemented, when data is stripped into a block and then spread across at least 2 disks drives or (HHD/SSD) in the array.  Just like any technology implementation, RAID 0 has its advantages and drawbacks.

 The main advantage of RAID 0 is speed. In a RAID 0 configuration, you have fast write and read. Let’s say you have a set of Data A.B, C, D, E. In RAID 0 configuration with 2 drives 1 and 2. Data A will written to Disk 1, data B, on disk 2, data C on disk 1, so one and so forth. All the data will be stripped across the drives thus increasing the read and write speed.  
 Let’s say you have a RAID 0 made of 2 drives each having 150 IOPS (Input/output Operation per Second), you will end up with a read and write speed of both drivers combined therefore, a 300 IOPS.
It is also worth mentioning that in RAID 0, there are no waisted storage space. 100% of the disk are utilized unlike in the other RAID configuration.

The Drawbacks of RAID 0 is the lack of reliability due do the lack of redundancy.  If one drive fails, all the data will be lost. As a result, RAID 0 is suitable for use cases where speed is valued more than reliability and should not be used for mission critical storage.
Storage made Simple: Block VS File Storage
Tags: aws, storage, filestorage, blockstorage
Published: 2022-06-27 19:03:41

File and block storage are probably being overlooked by the new and shining storage solution that are currently on the market but they are still being used by millions of those who can’t afford to break the bank.  
Storing the right data at the right place is critical and here I will briefly go over the difference between file and block storage and when to use them
Block Storage 
Block storage also knows as block level storage is a type of storage commonly used in SAN (Storage Area Network) environment.  In block storage the data is written in a form of raw blocks also referred as volumes and are accessed via the SAN.  In that configuration, each block is given a unique address. So, let’s see what are the main advantages of using block storage.
 The area of application where block storage is preferred are the following ones due to the low latency it offers 

•	Databases 
•	Email servers
•	Virtual Machines file system (Boot Volume)
•	RAID Arrays (High Redundancy)
•	High performance compute 

 In addition to that, applications that require server-side processing suck as Java, PHP AND .NET are the best candidate for Block Storage since they need to be as close as possible to the storage to reduce latency 
 File Storage
  File store or also known as file-level or file-base storage is a type of storage where data are stored in a hierarchical file and folder structure.  Here, unlike in Block storage, files are storages as whole instead of being broken down into blocks.  This also limited the number of metadata that can be attached to created files. Also, here NAS system is preferred as opposed to SAN when using block storage 

![FilevsBlock](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k772q3ngbr8w9c934eon.JPG)