teleren/devto huggingface dataset:
OpenBSD pkg_add didn't work due to ocsp verify failed
Tags: openbsd, server, virtualbox, troubleshooting
Published: 2022-02-13 07:54:13

## What happened

Just after installing [OpenBSD](https://www.openbsd.org/) onto [VirtualBox](https://www.virtualbox.org/), I couldn't use `syspatch` and `pkg_add` due to the error:

```console
$ doas pkg_add -u 
https://cdn.openbsd.org/pub/OpenBSD/7.0/packages-stable/amd64/: TLS handshake failure: ocsp verify failed: ocsp response not current
https://cdn.openbsd.org/pub/OpenBSD/7.0/packages/amd64/: TLS handshake failure: ocsp verify failed: ocsp response not current
https://cdn.openbsd.org/pub/OpenBSD/7.0/packages/amd64/: empty
```

Nevertheless `ping cdn.openbsd.org` was successful.

## Solution

I modified `/etc/installurl`:

```console
$ doas vi /etc/installurl
```

to switch to the FTP server:

```diff
- https://cdn.openbsd.org/pub/OpenBSD
+ https://ftp.openbsd.org/pub/OpenBSD
```

Then it turned successful.

```console
$ doas pkg_add -u
quirks-4.54 signed on 2022-02-12T18:54:43Z
quirks-4.54: ok
```

## Why happened (guess)

After a while (an hour), I reverted `/etc/installurl`:

```diff
- https://ftp.openbsd.org/pub/OpenBSD
+ https://cdn.openbsd.org/pub/OpenBSD
```

It didn't bring any error:

```console
$ doas pkg_add -u
quirks-4.54 signed on 2022-02-12T18:54:43Z
```

To my surprise, It may have been fixed over time. Apart from it, the first success may have done.

I guess it was because ntp status. I perhaps had never met the failure when installing OpenBSD onto physical server.

For information, the ntp status was below after the failure had been fixed:

```console
$ doas ntpctl -s status
5/5 peers valid, constraint offset -32564s, clock unsynced, clock offset is -32561707.819ms
```
Node & Mongo Blogs
Published: 2022-02-13 07:47:01

CRUD Operations:
In MongoDB basic programs and methods are called CRUD. CRUD stands for create, read, update and delete. By this method, we will manage the primary data in our database.

JWT:
JWT token stand for JSON WEB TOKEN on of the best use of JWT is sharing information between two parties are client and server. They signed for using a cryptographic algorithm to ensure that the claims cannot be altered after the token is issued.

Mongoose:
Mongoose is an object data modeling library for MongoDB and node js. It’s the middle man to connects the data and provide the client. It can translate the object in code and the representation of those objects in MongoDB.

Relational database (MySql):
The relational database is a system that is maintained a relational database sometimes called MySql.  In SQL structure data is stored in a table and NoSQL use “Beson” to store data. NoSql will be global data that can take different locations and can easily be accessed. 

Aggregation:
In MongoDB, Aggregation operation means an operation that helps process the data records/documents and then return the data computed the results. Aggregation collects the data and placed them together then uses a different type of operation like sum, average, minimum, maximum return the computed result.

Express:
Express helps us to specify which kind of function we gonna call like the post, get, update, delete of URL pattern, and specify that templet view we will use for this render a response, and also where is locked. 

Replication:
In a simple way replication is a simple process of creating a copy of the same data set in more than one MongoDB server. Replication help people from losing data of a single server.

Why node mongo in react project:
Every react developer knows about javascript so we haven’t learned any kind of new language for the backend server. We can use node and mongo by javascript language so we use node mongo in our react project. And MongoDB is a NoSql type database and NoSql is javascript friendly structure provide us that is also a matter for using mongo in react projects.
Differences between SQL and NoSQL databases:
SQL means Structured Query Language. SQL is a relational database on the other hand NoSQL is a nonrelational database. In SQL structure data is stored in a table and NoSQL use “Beson” to store data. NoSql will be global data that can take different locations and can easily be accessed. SQL only stores structured data but NoSql will be unstructured, semi-structured, and all kinds of data can be stored.
Any other devs looking into an early retirement? (F.I.R.E)
Published: 2022-02-13 07:20:40

As much as I love firmware development I’m really not looking forward to coding until I’m 65 and my eyes can no longer take the strain of staring at my monitor. (Some days they already feel like that tbh) Looking forward to retiring by 50 now that I have my fire number figured out.
[How to Fire](https://www.askthesavingsguy.com/2021/09/18/why-youll-never-retire-unless-you-f-i-r-e/)
Intro
Tags: coding, java, 100daysofcode
Published: 2022-02-13 07:07:45

Hey folks, 

This being my first ever blog, I will briefly tell about who I am, what I am doing and what I am planning to do. 
I won't be writing about coding each day, but some development that I did today and also some outdoor fun, as I love going out and exploring new places!!
So here it goes...  ^_^

**About me:**
Final Year Masters student in Computer Science at Concordia University, Montreal, Quebec, Canada.

**What I am doing:**
Coding | Development | Artificial Intelligence | Deployment.
Basically everything from development till deployment :)
My tech stack includes `Java, React, AWS, Docker, Python for AI`
Currently learning about Terraform, Kubernetes, SalesForce, ServiceNow

PS: If you are preparing for a certain certification and looking for a prep buddy, loop me in, as I am also planning to do some in coming few months.

**Planning to do:**
Equipping myself each day with some technical, business, investment knowledge. 
I want to learn and grow each day.


Happy Hacking ^_^
Weekly Challenge 151
Published: 2022-02-13 06:54:46

[Challenge](https://theweeklychallenge.org/blog/perl-weekly-challenge-151/), [My solutions](https://github.com/manwar/perlweeklychallenge-club/tree/master/challenge-151/sgreen)

## TASK #1 › Binary Tree Depth

### Task

You are given binary tree.

Write a script to find the minimum depth. The minimum depth is the number of nodes from the root to the nearest leaf node (node without any children).

### My solution

Like with the eertree task in [challenge 145](https://theweeklychallenge.org/blog/perl-weekly-challenge-145/), I'm unashamedly short cutting this task to get the desired result.

The hardest thing about these binary tree tasks is not working with tree itself, but to convert a meaningful input into a tree object. If I decided the input, it would be a three item (value, left, right) nested array (parsed by YAML or JSON from the input) For example the first example would be `[1, [2, 4, 5], 3]`, and the second example would be `[1, [2, [4, null, 6]], [3, null, 5]]`.

However for this task, we are given the expected input format, which each line is separated by the pipe characters, and values are separated by white space.

In my solutions, I split the input into the `rows` variable. For each row, I split them by white space, fill out the array if it is short, and exit when I find a pair of `*` in that row.

### Examples

```
$ ./ch-1.py "1 | 2 3 | 4 5"
2

$ ./ch-1.py "1 | 2 3 | 4 *  * 5 | * 6"
3

$ ./ch-1.pl "1 | 2 3 | 4 *  * 5 | * 6"
3
```

## TASK #2 › Rob The House

### Task

You are planning to rob a row of houses, always starting with the first and moving in the same direction. However, you can’t rob two adjacent houses.

Write a script to find the highest possible gain that can be achieved.

### My solution

I'd love to be the second house. They never get looted :-)

I really like these types of challenges, because it makes you think about the best way to solve it. So as an explanation, after looting the first house, we can either visit the third house (because you can't rob two adjacent houses) or the fourth house. If we were to loot any further houses after the first, it would have been more beneficial to visit an intermediate house. For example, if looted house five, we should have done house 3 as well.

So with that in mind, I used a recursive function `rob` that takes the haul so far and a list of remaining houses as input, and returns the largest haul. For each call, I skip either one or two houses, and return the result that results in the maximum haul.

### Examples

```
$ ./ch-2.py 2 4 5
7

$ ./ch-2.py 4 2 3 6 5 3
13

$ ./ch-2.pl 4 2 3 6 5 3
13
```
Create a Web Api using Minimal Api in .NET 6
Tags: csharp, minimalapi, net6, webapi
Published: 2022-02-13 06:51:55

**.NET 6** brings many language improvements in C# 10. Minimal Api is one such feature which allows to create a web api with less boilerplate code. Here is the example which uses Minimal Api for creating an AES Encryption and Decryption api.

```
using AESEncryptDecrypt;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseHttpsRedirection();

app.MapPost("/encrypt", (string value) =>
{
    string key = app.Configuration["AES:Key"];
    string iv = app.Configuration["AES:AES_IV"];
    return Results.Ok(AESEncDec.AESEncryption(value, key, iv));
});
app.MapPost("/decrypt", (string value) =>
{
    string key = app.Configuration["AES:Key"];
    string iv = app.Configuration["AES:AES_IV"];
    return Results.Ok(AESEncDec.AESDecryption(value, key, iv));
});

app.Run();
```

Full Code can be found here on [Github](https://github.com/raviranjanpandey/aesencdec)
Getting Segmentation Fault by Debugger in C.
Published: 2022-02-13 06:43:43

I'm Getting **Segmentation fault** by debugger in `partition()` function at commented variable...following code is a complete implementation of _Quick Sort_ algorithm.

```c
// Sorting Algorithms

void quick_sort(int arr[],int length);
int partition(int a[],int low, int high);
void quick_sort_recursion(int arr[], int low, int high);
void swap(int *x, int *y);

void quick_sort(int arr[],int length){
    quick_sort_recursion(arr,0,length-1);

}

void quick_sort_recursion(int arr[],int low, int high){

    if(low<high){
        int pivot_value = partition(arr,low,high);
        quick_sort_recursion(arr,low,pivot_value - 1);
        quick_sort_recursion(arr,pivot_value+1,high);
    }
}

int partition(int arr[], int low, int high){

    int pivot_value = arr[high]; //getting 'segmentation fault' here
    int i = low;

    for (int j = low; j < high; j++)
    {
        if(arr[j] <= pivot_value){
            swap(&arr[i],&arr[j]);
            i++;
        }
    }
    swap(&arr[i],&arr[high]);
}

```

![see image here...](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wbejb8qibmcbicpogezi.png)
How to generate Permutations in SQL?
Tags: sql, sqlserver, interview
Published: 2022-02-14 05:16:02

---
title: How to generate Permutations in SQL?
published: true
date: 2022-02-13 06:35:43 UTC
tags: sql, sqlserver, interview
canonical_url: https://blog.rajanand.org/how-to-generate-permutations-in-sql
series: SQL Interview Questions and Answers
---

## Question:

You are planning to go for a summer vacation and finalized the cities you want to visit. But you have not finalized in which order you want to visit them yet.

Write a SQL query to list out all different possible order you can visit these cities.

Note that you don't want to visit the same city again and you don't want to skip any city in your travel plan either.

![03-permutations-table.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1644727361179/R1v_xwyGG.png)

Expected output: ![03-permutations-output.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1644727369565/rokHTbXtb.png)

## Solution:

Let us create the test data first for the demo.

```
-- test data
use demo;
if object_id (N'dbo.city', N'u') is not null 
drop table dbo.city
go

create table dbo.city (
    id int identity(1,1),
    city_name varchar(100)
)

insert into dbo.city (city_name) values 
  ('Oslo'),
  ('Helsinki'),
  ('Stockholm'),
  ('Copenhagen')

select id, city_name from dbo.city

```

This solution is implemented using the Recursive CTE in SQL Server. If you are using other database engines, you can implement it in similar way.

```
-- solution
declare @total_cities int = (select count(1) from dbo.city);
with travel (travel_path, level) as (
    select cast(city_name as varchar(200)), 
    level = 1 
    from dbo.city
    union all
    select cast(travel.travel_path + ' -> ' + city.city_name as varchar(200)), 
    level = level + 1
    from dbo.city
    inner join travel on level < @total_cities
    where charindex(city.city_name, travel.travel_path) = 0
    )

select 
id = row_number() over(order by travel_path),
travel_path
from travel
where level = @total_cities
order by id

```

If you like this interview question, you may also like this interview question and answer [series](https://blog.rajanand.org/series/sql-interview-questions).
I am Build TO-DO-list app using Node.js Express.js MongoDB Database.
Tags: javascript, webdev, node, mongodb
Published: 2022-02-13 05:30:34


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uo0bt095vx7wwqw1ex88.png)
**Live Project** : https://mighty-earth-03444.herokuapp.com/

**Souce Code** : https://github.com/Alokoct21/TO-DO-App

I just make a to-do-list App using node.js express.js Mogodb atlas to store data on cloud using a ejs template engine to design the frontend and custom Css.
error: Pulling is not possible because you have unmerged files. How to solve?
Tags: github, discuss
Published: 2022-02-13 05:29:18

when i try to pull in my local directory, i got error like this.
```yaml
$ git pull
error: Pulling is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
```

So, i solved this problem by use this command
```yaml
git reset --hard HEAD
```
:star: do you have other suggestions? Please write in  below
Getting started with CSS Custom Properties
Published: 2022-02-13 04:54:40

Do you know that you can use Variables in Vanilla CSS without any preprocessors like SASS or LESS
Let's Find out How...

But first the question arises that Why should you even use these Custom properties when You have Preprocessors.
Well,

## Why use CSS Custom Properties over SASS variables

1. Learning SASS for only using Variables is much of an effort, so why do it.

2. No need for a compiler to convert your SASS files into normal CSS.

3. Native, therefore fast and browser compatible.

Now, let's understand What the heck are these CSS Custom Properties.

## What are Custom Properties
If you ever used a Programming language before, you know what a variable is.
If not, A variable is something that is defined once, usually at the top of the code, and then can be referenced later anywhere in the code.

So Basically, the custom properties are the variables of CSS which minimizes code repetition and saves time. The custom properties are very helpful in large projects.

In normal CSS you have to redefine a property like color or font repetitively for different elements and it is a hazard.



![Code Snippet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nddmv106hfwbgvpyzc3k.jpeg)

Well not anymore, 
Define once, use anywhere from now on.
A custom property is written with a preceding `--` sign before its name with no spaces and called(used) with the `var()` keyword.

![Code Snippet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x8ep9wxv55a9gnk8rcqe.jpeg)

## Features of CSS Variables

1. **Flexibility:**
 One great benefit of Custom properties is that you can structure and combine different variables for more flexibility. 
Any value you can think of can be converted into a variable.

![Code Snippet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vu0z1hax6ze5oj3h5q54.jpeg)

2. **Redefining Your Variables:**
An Environment is like a world within itself for a code block.
The Code within a environment doesn't care anything about anything outside it's environment and obeys the rules of it's own Environment.

With CSS variables, You can also redefine or change the value of a custom property with a new value within a specific element and it will work with that value in its local environment instead of the globally defined custom property.

![Code Snippet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kg9l5tfnvs8ywosyf9wt.jpeg)

1. **Using `calc()` function with your variables:**
The `calc()` function can perform basic mathematical operations in CSS.
Make your whole layout responsive by using it with predefined custom properties which helps in structuring the sizes of your elements.
![Code Snippet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mn8fxj6cvwlvzenb5byu.jpg)

You can do so much more with custom properties. 
Comment how you utilize and make the best use of CSS custom properties.
This post is a result of my Twitter Thread on the Custom Properties, if you like to see more follow me on my twitter handle.
The Chaos of a Creator
Tags: video, podcast, blog, speaking
Published: 2022-02-13 04:49:30

It’s infrequent that there's a straightforward answer to even the simplest of questions in tech. You'll often get the standard "it depends" response a lot of the time. I prefer to say that context is everything. To set the context for this post, you'll need to know two things.

1. I have dyslexia
2. I also have ADHD

Those two things explain why this post is so short and why I'm constantly losing something I've done.

Now, I've been a fan of [Polywork](https://www.polywork.com) since the very beginning and have just been named an advisor for them, also known as a [Polynaut](https://polynaut.polywork.com/). Let me tell you why I'm so bullish on Polywork.

Because of the context above, I don't create much content myself due to executive function issues; also, most of that content is not text. I don't really have my own blog, newsletter, or website. All of this content was scattered on different sites around the internet. If I want to show my work, I usually tweet it out. [Twitter](https://twitter.com/wesley83) is great, but it's not ideal for searching for past content or using it to showcase multiple pieces of work.

Polywork has helped me capture and place [all of my digital scraps](https://www.wesleyfaulkner.com/) in one place without the burden of summarizing or recreating those events in a text format. Sites like LinkedIn and personal blogs stress being verbose and writing detailed prose. That's actually a pretty significant barrier for me. I like Polywork because I can be as brief or as complex as I want to be. I can add collaborators, images, or post a link to where that content lives. That's it. That's the point I wanted to make. Polywork scales to the amount of effort I want to put into it, and for me, that's not a lot right now. I'm a very busy creator, so that means that I need one place to catalog all of my work, but that also means that I don't have time to put in a lot of effort to maintain some custom site. That's why, for me, Polywork is an ideal solution for my workflow.

If Polywork sounds like it would be a good fit for you, please use my [invite code](https://www.polywork.com/invite/wesley) to skip the line.
#30 - Multiplication table CodeWars Kata (6 kyu)
Tags: javascript, webdev, tutorial, 100daysofcode
Published: 2022-02-13 04:39:46

##Instructions
Your task, is to create NxN multiplication table, of size provided in parameter.

for example, when given size is 3:

> 1 2 3
> 2 4 6
> 3 6 9

for given example, the return value should be: [[1,2,3],[2,4,6],[3,6,9]]

---

##My solution:

```javascript
multiplicationTable = function(size) {
  let r = []
  for(let i = 1; i<=size; i++){
    let x = []
    for(let j = 1; j<=size; j++){
      x.push(i*j)
    }
    r.push(x)
  }
  return r
}

```
---

##Explanation
First I declarated the variable "r" with an empty array, wich will contain the last result.

After that I used a for loop to iterate the array, and for every iteration I did a "x" variable with an empty array and another for loop, inside of this loop I will iterate through the size value, and in every iteration I will push to x the result of the multiplication of i by j, that way for example if I'm in the first value of the array in the first for loop, I will always be equal to 1 in the second loop, but j will be changing in every iteration, so I can get [1*1,1*2,1*3] in the x array, and at the end I just returned r

---

**What do you think about this solution? 👇🤔**

[My Github](https://github.com/Cesardlr)
[My twitter](https://twitter.com/cesar__dlr)
[Solve this Kata](https://www.codewars.com/kata/534d2f5b5371ecf8d2000a08)
Flutter llega a Windows | Flutter 2.10
Tags: flutter, dart
Published: 2022-02-13 04:33:56

Cree aplicaciones de Windows de alta calidad con este increible SDK de Google 🪟

![Flutter decktop](https://storage.googleapis.com/cms-storage-bucket/66cde34aa26469a0676f.svg)

- Sin necesidad de activar flags en el proceso
- Con soporte de la comunidad
- Con un motor de C++
- Una capa de interoperabilidad con C
- Comunicación con las API Win32, COM y Windows Runtime.

Se agrega compatibilidad a las bibliotecas de `camera`, `file_picker` y `shared_preferences`.

Y si quieres que tus aplicaciones tengan el sabor windows; haz uso de los paquetes [fluent_ui](https://pub.dev/packages/fluent_ui) y [flutter_acrylic](https://pub.dev/packages/flutter_acrylic).

Y de lo mas esperado... un poderoso empaquetador ([MSIX](https://pub.dev/packages/msix) 📦) que nos permitirá incluso publicar nuestras aplicaciones a Microsoft Store. 

### Bueno bueno... Y a todo eso que opina Microsoft? 🤔

**Kevin Gallo**, vicepresidente corporativo de Windows Developer Platform en Microsof compartio:

> “Estamos encantados de ver que Flutter agrega soporte para crear aplicaciones de Windows. Windows es una plataforma abierta y damos la bienvenida a todos los desarrolladores. Estamos emocionados de ver a los desarrolladores de Flutter traer sus experiencias a Windows y también publicar en Microsoft Store. El soporte de Flutter para Windows es un gran paso para la comunidad, ¡y estamos ansiosos por ver lo que traerá a Windows!“

El equipo de diseño de Fluent de Microsoft han contribuido con un paquete de iconografía para las aplicaciones de Flutter en Windows [FluentUI System Icons](https://pub.dev/packages/fluentui_system_icons). 

Asi como la inversion que Microsoft ha realizado en torno a la accesibilidad para Windows con la ayuda de un equipo para garantizar que Flutter sea compatible con los lectores de pantalla desde el primer día. Como ilustra este diagrama del [kit de herramientas de diseño inclusivo de Microsoft](https://www.microsoft.com/design/inclusive/).

> Si lo que quieres es ver mas a fondo las mejoras de rendimiento en Flutter 2.10 esta con mas detalle este [Blog](https://medium.com/flutter/whats-new-in-flutter-2-10-5aafb0314b12). O si quiere leer la [nota completa de Flutter](https://medium.com/flutter/announcing-flutter-for-windows-6979d0d01fed).

#### Happy Hacking 👨‍💻🎉

Y nos vemos del lado desk.