teleren/devto huggingface dataset:
Microsoft is returning the Blue Death Screen to Windows 11
Tags: windows, microsoft
Published: 2021-11-22 12:30:36

According to reports, Microsoft intends to replace the new Black Screen of Death (BSoD) in Windows 11 with the previous Blue Screen of Death (BSoD) (BSoD). If you encountered a serious error while upgrading from Windows 10 to Windows 11, you may have noticed that the traditional blue screen had been replaced by a black one. This is because Microsoft decided to shut down the old and update the experience to match the new logo design.

The Blue Death Screen appears when the system encounters an uncontrollable fault. When an error occurs, the screen turns blue, creating a dump file on the computer and displaying an error code that network administrators can use to analyze and resolve software and hardware issues.

The blue screen bug (also known as bug check) first appeared in the 1990s with the release of Windows 3.0, and while it has evolved since then, Microsoft has always kept it blue. It was later updated to black for Windows 11 before returning to blue.

> Source : [Tech News - Uvindu Bro] (https://techuvindubro.blogspot.com/2021/11/microsoft-is-returning-blue-death.html).
Code Reviews on IPC Project
Tags: opensource
Published: 2021-11-16 22:38:28

# Introduction
This week, I have done 2 code reviews on classmates' pull requests on the project operated by my school Seneca College. It is an open source project - built in contents of IPC144 (Introduction To C Programming) course. You can take a look at the [GitHub Repo](https://github.com/Seneca-ICTOER/IPC144) and the [website](https://cghub.ca/).

# First Code Review
* First, I take a look at this [Pull Request #76](https://github.com/Seneca-ICTOER/IPC144/pull/76). This commit audits and fixes the *arrays.md* file.
* I take a look carefully at every changes of the pull requests and I found 2 issues that needed to be fixed.
* First, there is a hyperlink on the line 19 displayed in the web on:
```
[structures](../C-Data-Structures/structures "Structures")
```
* When I try to click the link, it leads to an error link so I put a comment for the maintainer to fix that link.

* The second issue is on line 118, there are code displayed as below:
```
for (i = 0; i < NGRADES; i++) {
	printf("%d" , grade[i]);
}
```
* I leave a comment that the maintainer can add *int i = 0* so it would make more senses for the code.

# Second Code Review
* I take a look at this [Pull Request #83](https://github.com/Seneca-ICTOER/IPC144/pull/83). This commit audits and fixes the *Operators.md* file.
* I take a closer look at changes of this pull request and I found 2 issues that needed to be fixed for better display.
* The page is currently displayed like this:
![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eka1kkynilgxs4vfxvea.JPG)
* Section 5 and 6 should be in code block syntax which makes the it looks similarly to the Code Block of Section 1-4.
* I left a comment for the maintainer to fix and he successfully put them into the code blocks.
* The page is now displayed like this:
![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uq2zm22jwck2v0za9jr7.JPG)

# Conclusion 
This is the first time that I reviewed someone code and it is interesting to do that. The more I dig in to the open source world, I cannot deny the fact that GitHub is really useful tool for the coders to work together, add code, review code, etc. It is so convenient and I love it!
The two Sum problem
Tags: algorithms, datastructure, programming, computerscience
Published: 2021-11-22 12:26:21

A popular array problem is the two sum problem. The problem states that given an array find two numbers that their sum is equal to a target value. There are several ways of solving this using:
- The naive approach
- Two pointer technique
- Hash maps 

```python
array = [1,2,3,4,5]
targetSum = 5
```

## The naive approach 
This technique involves using two **for loops** to iterate over the array to find the target sum. The time complexity for this method is O(n^2) and space complexity of O(1)

```python
def twoNumberSum(array, targetSum):
    for i in range(len(array)):
        for j in range(len(array)):
            if array[i] + array[j] == targetSum and array[i] != array[j]:
                return [array[i], array[j]]
    return []
```

```python
twoNumberSum(array, targetSum)
[1, 4]
```

## The two pointer technique

This technique involves having **two pointers** one at the beginning of the array and one at the end of the array. If the value of both pointers is less than the target then move the left pointer to the right but if their is value is greater move the right pointer to the left.

Time Complexity is O(nlog(n)) and space complexity is O(1)

```python
def pointerSum(arr, tar):
    l = 0
    r = len(arr) - 1
    while l < r:
        if arr[l] + arr[r] == tar:
            return [ arr[l], arr[r] ]
        if arr[l] + arr[r] < tar:
            l += 1
        if arr[l] + arr[r] > tar:
            r -= 1
            
    return []
```

```python
pointerSum(array, targetSum)
[1, 4]
```

## Hashmap technique

This technique stores the array in a hash map then uses the constant look up capability of hash maps to find the the corresponding two sum numbers.

```python
def hashSum(arr, tar):
    hashmap = {}
    for i in range(len(arr)):
        hashmap[i] = arr[i]
        complement = tar - arr[i]
        if complement in hashmap.values() and complement != arr[i]:
            return [ arr[i], complement]
    return []
```

```python
hashSum(array, targetSum)
[3, 2]
```
[TIL] a little number formatter in Javascript
Tags: javascript, beginners, programming, tutorial
Published: 2021-11-22 12:13:51

For those who want to transform numbers into to nicer strings, here's a little snippet of code that can help you out:
```js
const isItANumber = (str) => {
  return /^-?[0-9]+(e[0-9]+)?(\.[0-9]+)?$/.test(str);
};

const formatNumber = (value, format = true) => {
  if (!format) {
    return value;
  }

  // This use case is specific to my project, you can delete it
  if (!isItANumber(value)) {
    return value;
  }
  const number = Number.parseFloat(value);
  if (typeof number !== 'number' || Number.isNaN(number)) {
    return value;
  }

  // 'en-US' is my specific use case, you can choose whatever you want, or leave it empty for client specific locale
  return number.toLocaleString('en-US');
};

console.log(formatNumber(717140.87)); // '717,140.87'
console.log(formatNumber(-717140.87)); // '-717,140.87'
// This use case is specific to my project, you can delete it
console.log(formatNumber('-71,714,087 units')); // '-71,714,087 units'
```
Setting up a Ceph posix filesystem in your cluster
Published: 2021-11-22 12:06:46

---
title: Setting up a Ceph posix filesystem in your cluster
published: true
description: We look into how a Ceph filesystem works and how to add a filesystem to your Ceph cluster. Configuration, authentication and other important topics you need to know in order to run a cluster with a filesystem.
tags:
cover_image: https://i.ytimg.com/vi/mbHi3WJpSbI/maxresdefault.jpg
---

{% youtube mbHi3WJpSbI %}

We look into how a Ceph filesystem works and how to add a filesystem to your Ceph cluster. Configuration, authentication and other important topics you need to know in order to run a cluster with a filesystem.
How to install software or packages without Internet?
Tags: ubuntu
Published: 2021-11-25 10:07:31

---
title: How to install software or packages without Internet?
published: true
date: 2021-11-22 11:58:43 UTC
tags: Ubuntu
canonical_url: https://stackallflow.com/ubuntu/how-to-install-software-or-packages-without-internet/
---

<header>
<p><span style="font-size: 1.2em; color: initial;">package-management</span></p>
</header>

I have a friend who has got a computer that is not connected to the Internet. Is there any way to install software offline easily?

#### Accepted Answer

Check out [Keryx](https://launchpad.net/keryxproject); it’s an offline repository manager.

**How does it work?** It lets you download updates and new programs (with dependencies) to your **flash drive**.

Its interface is similar to synaptic, but **it works from a pendrive** (it doesn’t need installation). Unfortunately, the GUI needs wxwidgets, which don’t come preinstalled on Ubuntu (they’re cross-platform and installable from [here](http://www.wxwidgets.org/downloads/#latest_stable) and Ubuntu repository [here](http://wiki.wxpython.org/InstallingOnUbuntuOrDebian)). It can only install software in a Ubuntu system, but you can download the updates or new packages in any Linux, Windows or OS X.

Here you can find [a tutorial](http://beatofthegeek.com/2011/07/keryx-tutorial-download-software-for.html).

Another detailed step-by-step tutorial is in [this answer](https://askubuntu.com/a/181913/58950).

Launchpad also hosts [downloadable files](https://launchpad.net/keryx/+download).

**A screenshot:**

![Screenshoot](https://i.stack.imgur.com/OaaLW.png)

The post [How to install software or packages without Internet?](https://stackallflow.com/ubuntu/how-to-install-software-or-packages-without-internet/) appeared first on [Stack All Flow](https://stackallflow.com).
Unable to correct problems, you have held broken packages
Tags: ubuntu, apt
Published: 2021-11-25 10:05:30

---
title: Unable to correct problems, you have held broken packages
published: true
date: 2021-11-22 11:55:27 UTC
tags: Ubuntu,apt
canonical_url: https://stackallflow.com/ubuntu/unable-to-correct-problems-you-have-held-broken-packages/
---

<header>
<p><span style="font-size: 1.2em; color: initial;">apt</span></p>
</header>

After upgrading from 10.04 to 12.04 I am trying to install different packages.  
For instance ia32-libs and skype (4.0).

When trying to install these, I am getting the ‘Unable to correct problems, you have held broken packages’ error message.

Output of commands:

```
sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

```

After running this:

```
sudo dpkg --configure -a
foo@foo:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
```

#### Accepted Answer

That particular error message may indicate that you have held packages, but it may also indicate a different problem.

You can get a list of _actual_ held packages with:

```
dpkg --get-selections | grep hold

```

If there are none, or none look related, then it’s probably something else. Check carefully the output of the command you were trying when you got the error message, as there may be other clues in the full output from that command, aside from the error message.

Another method of troubleshooting may be to use aptitude rather than apt-get to try to install your package:

```
sudo aptitude install <packagename>

```

Aptitude will give up less easily, and will attempt to find solutions which may involve modifying other packages. It may give you more explanation of the problem and options for fixing it.

Occasionally aptitude will be too eager to remove or downgrade large numbers of packages to satisfy your request, in which case retrying with `-f` changes its priorities and helps it come up with solutions that involve removing/downgrading fewer packages even if it means not all changes you requested can go ahead:

```
sudo aptitude -f install <packagename>

```

_Edit: this is an old answer, and since it was written a newer APT front end, simply titled `apt`, has become the preferred command line APT interface for end users. It is still not the Swiss army knife that `aptitude` is, but it’s a bit more human-oriented than `apt-get`. I haven’t taken the time to investigate how it would help in the above scenario, but it’s worth using._

The post [Unable to correct problems, you have held broken packages](https://stackallflow.com/ubuntu/unable-to-correct-problems-you-have-held-broken-packages/) appeared first on [Stack All Flow](https://stackallflow.com).
Unable to boot into Windows after installing Ubuntu, how to fix it?
Tags: ubuntu, bootgrub2windows
Published: 2021-11-25 10:05:33

---
title: Unable to boot into Windows after installing Ubuntu, how to fix it?
published: true
date: 2021-11-22 11:54:11 UTC
tags: Ubuntu,bootgrub2windows
canonical_url: https://stackallflow.com/ubuntu/unable-to-boot-into-windows-after-installing-ubuntu-how-to-fix-it/
---

<header>
<p><span style="font-size: 1.2em; color: initial;">boot</span><span style="font-size: 1.2em; color: initial;">grub2</span><span style="font-size: 1.2em; color: initial;">windows</span></p>
</header>

I installed Windows on my computer, followed by an installation of Ubuntu. However, now I’m unable to boot into my Windows install.

What can I do to fix this?

#### Accepted Answer

I am going to make some assumptions:

1. That Windows is installed and configured to boot via UEFI.
2. Ubuntu is installed and configured to boot via UEFI.
3. You’re currently seeing the grub menu at boot.

If any of those assumptions is false, then the following advice will not help you (though it won’t hurt anything either):

Create a file, `/boot/grub/custom.cfg` (by running `sudo -H gedit /boot/grub/custom.cfg`) with these contents:

```
#This entry should work for any version of Windows installed for UEFI booting

menuentry "Windows (UEFI)" {
 search --set=root --file /EFI/Microsoft/Boot/bootmgfw.efi
 chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

```

(Copy and paste the above into the Gedit window that comes up, then save and quit Gedit)

Reboot and you should see an entry titled “Windows (UEFI)” and if you select it then Windows should boot. If that does not work, please run boot info script ([http://bootinfoscript.sourceforge.net/](http://bootinfoscript.sourceforge.net/) ) and post the `RESULTS.txt` that it produces so that I have the information needed to give you proper advice.

The post [Unable to boot into Windows after installing Ubuntu, how to fix it?](https://stackallflow.com/ubuntu/unable-to-boot-into-windows-after-installing-ubuntu-how-to-fix-it/) appeared first on [Stack All Flow](https://stackallflow.com).
How to enable the “Universe” repository?
Tags: ubuntu, centersoftware
Published: 2021-11-25 10:05:14

---
title: How to enable the “Universe” repository?
published: true
date: 2021-11-22 11:51:04 UTC
tags: Ubuntu,centersoftware
canonical_url: https://stackallflow.com/ubuntu/how-to-enable-the-universe-repository/
---

<header>
<h1>Ubuntu – How to enable the “Universe” repository</h1>
</header>

package-managementsoftware-centersoftware-sources

How do I get to the Universe Repository in supported versions of Ubuntu?

#### Accepted Answer

If you want in one command and not use Software source ticking then in terminal put:

```
sudo add-apt-repository universe

```

On older versions of Ubuntu, you might have to use a full source line:

```
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"

```

To enable all Ubuntu software (`main universe restricted multiverse`) repositories use

```
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"

```

you can add also `partner` repository with different link (see difference is ubuntu to canonical)

```
sudo add-apt-repository "deb http://archive.canonical.com/ubuntu $(lsb_release -sc) partner"

```

Then update the package list:

```
sudo apt-get update

```

p.s.

`$(lsb_release -sc)` checks your Ubuntu version and puts its name in the source link. Since 12.04 is called `precise`, you can test in a terminal that `lsb_release -sc` gives `precise`. That adds the precise name of your Ubuntu release in Software sources. Wrong word and nothing will work.

For all differences in repositories read [https://help.ubuntu.com/community/Repositories/Ubuntu](https://help.ubuntu.com/community/Repositories/Ubuntu)

The post [How to enable the “Universe” repository?](https://stackallflow.com/ubuntu/how-to-enable-the-universe-repository/) appeared first on [Stack All Flow](https://stackallflow.com).
How to install a .tar.gz (or .tar.bz2) file?
Tags: ubuntu, from, install, installation
Published: 2021-11-22 12:01:51

---
title: How to install a .tar.gz (or .tar.bz2) file?
published: true
date: 2021-11-22 11:48:23 UTC
tags: Ubuntu,from,install,installation
canonical_url: https://stackallflow.com/ubuntu/how-to-install-a-tar-gz-or-tar-bz2-file/
---

 

install-from-sourcesoftware installation

I have downloaded tar.gz files. But I don’t know how to install it. How do I install this kind of file?

#### Accepted Answer

The first thing you need to do is extract the files from inside the tar archive to a folder. Let’s copy the files to your desktop. You can extract an archive by right-clicking the archive file’s icon inside your file browser and pressing the appropriate entry in the context menu.  
Extracting the archive should create a new folder with a similar name. e.g. `program-1.2.3`.  
Now you need to open your terminal and navigate to that directory using the following command:

```
cd /home/yourusername/Desktop/program-1.2.3

```

Make sure you read a file called `INSTALL`, `INSTALL.txt`, `README`, or something similar if one was extracted. You can check if such a file exists from the terminal by using the `ls` command. The file can be opened and read with the command:

```
xdg-open INSTALL

```

Where INSTALL is the name of your file.  
This file will contain the right steps to follow to continue the installation process. Usually, the three “classical” steps are:

```
./configure
make
sudo make install

```

You may also need to install some dependencies if, for example, running `configure` prompted you with an error listing which dependencies you are missing.

You can also use [`checkinstall` instead of `make install`](https://help.ubuntu.com/community/CheckInstall).

Remember that your mileage may vary.

The post [How to install a .tar.gz (or .tar.bz2) file?](https://stackallflow.com/ubuntu/how-to-install-a-tar-gz-or-tar-bz2-file/) appeared first on [Stack All Flow](https://stackallflow.com).
How to re-fetch data when something changes in React.js?
Tags: react, javascript
Published: 2021-11-22 11:41:48

![React.js Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p4jgsi4iiljev1i86362.png)

Assume you have a list in your web application which you would allow the clients to manipulate the list records by removing, editing and adding. What happens if data would change?!
Often we should update data behind the scene and silently.
There are 2 ways which I'll be showing you.

## Method 1
*In fact, this method is not the subject of our article but I'll explain.*

Consider you would fetch data from an API. You would use **state management** systems like Redux, Redux Toolkit and etc. After that, you would manipulate data there and the list would be updated. But wait a minute...
What about a list which is needed to be updated synchronously?! Sure! The list is outdated and is not efficient.

## Method 2
Re-fetching is the key of our process. But the main question is:
**How should I know data would change?!**

1- OK! First of all, you must declare a state by using `useState`, `Redux` and etc. The default value should be boolean which in my case is a `false`.
```javascript
const [toggle, setToggle] = useState(false);
```

2- Consider the clients commence to add records. When `POST` method of an API executed, the state should be toggled by *negating* the previous state value.
```javascript
setToggle(prevState => !prevState);
```

3- What now?! Write `useEffect` for fetching the data again while *dependency* variable has been set to `toggle` state.
```javascript
useEffect(() => {
    // Fetching
}, [toggle])
```

BOOM! Because of changing the `toggle` state after every change you've specified, the data will be fetched again and nicely without doing this manually by for example clicking on a button and etc.

***You can or may want to connect with me through the networks I've put on my website:*** [Ali Bahaari's Website](https://alibahaari.github.io)
Don't panic when using CLI
Tags: linux, bash, productivity, sre
Published: 2021-11-22 11:23:05

## Intro

When using the Command Line Interface, we often find a few long and / or confusing commands. And this post intends to ease the pain of getting along with that.

When things start to get complicated, there are some things that can be done. In this post, we are talking about three of them:
- Aliases
- Functions
- Comments

---
## Development

### Aliases
An alias is exactly what it means: a nickname. It is very useful when running commands that take too much arguments. For example: 

```
alias lah=ls -ltrah
```

Now, when running the `lah` command, it will be exactly like running `ls -ltrah`.

### Functions
A function is probably the best way to run a group of commands. When adding a `if` or a `for` statement, it gets even more interesting. Let's suppose we want to connect to a server which is still being provisioned or rebooted:

```
function keeptrying() {
    until $@
    do
        sleep 1
        echo -e "Trying to run $1 again"
    done
}
```

Now, this function can be called like this:

```
keeptrying ssh myserver -l myuser
```

Due to the `until` statement, this function will keep trying forever to run any command given, until it is successful. Possibilities are infinite, limited only by our imagination. Be creative.


### Comments

This resource is more useful when searching for commands on history logs. While aliases can be useful to shorten a complex command, comments can be useful in another way: finding those damn complex commands. When relying on CLI, a lot of useful commands are run and often revisited. For this, we can use Control + R and start typing the command we want to find. But... what if we could search for it's description instead of the command itself? Very useful when we can't even remember the command, isn't it?

All we have to do is:

```
ls -ltrah # list hidden files
```

Now, we can revisit this command by pressing Control + R and typing `list hidden files`, or even only `hidden`. Pressing Control + R again will show the next other search result. Pretty neat, isn't it?

---
## Conclusion

There are plenty of things we can do by mastering such techniques. As said before, the most important thing is to *be creative*. First, start by playing with these guys until getting used to them. Then, start doing real things that will change your life forever.

Hope to have helped. 

Cheers.
Lazy Collections in Laravel
Tags: php, laravel, programming, beginners
Published: 2021-11-22 10:50:13

Let's take a look at Collection
```php
use Illuminate\Support\Collection;
new Collection([1, 2, 3, 4, 5]); // [1, 2, 3, 4, 5]
```
Let's use too times with Collection
```php
return Collection::times(100); // [1, 2, 3, ... 98, 99, 100]
```
```php
$res =  Collection::times(50)->map(fn ($number) => $number * 2)->filter(fn ($number) => $number % 20 == 0); 
dd($res);
/*
    #items: array:5 [▼
       9 => 20
       19 => 40
       29 => 60
       39 => 80
       49 => 100
    ]
*/
```
what if it is found
```php
Collection::times(1000 * 1000 * 1000);
```
Now Switching to Lazy Collections Because when you use Collection you will get an error
" Allowed memory size of 536870912 bytes exhausted (tried to allocate 34359738376 bytes) "
```php
$collection = LazyCollection::times(1000 * 1000 * 1000)->filter(fn ($number) => $number % 2 == 0)->take(1000);
return $collection;
```
Source :- 
https://josephsilber.com/posts/2020/07/29/lazy-collections-in-laravel
I hope you enjoyed the code.