teleren/devto huggingface dataset:
Comparar dos objetos || Javascript
Tags: javascript, objects, algorithms
Published: 2022-01-21 04:28:19

En algún momento tendremos que validar si dos objetos son iguales y un “===” no servirá puesto que al trabajar con objetos esta igualdad solo será verdadera si se los dos objetos esta en la misma posición de memoria, ya que en este caso no compara valores como pasa con los tipos de dato primitivo (String, number, boolean)
Existen varias formas de hacer estas validaciones, como convertir el objeto a un string con JSON.stringify(obj1) === JSON.stringify(obj2) pero puede que los atributos de los objetos estén en diferente orden y fallará.
Y como el anterior, hay varios método de validar que un objeto es igual que otro, pero la que considero que es una mejor forma es realizando una función que hace diferentes validaciones puesto que podemos tener diferentes tipos de dato, a continuación les presento la función.

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

Esta función valida diferentes escenarios que se pueden tener al momento de comparar dos objetos como:
- Objetos con atributos en diferente orden
- Objetos con diferentes cantidades de atributos
- Objetos con valores null
- Objetos con otro objeto como atributo (allí se aplica Recursividad, invocando a la misma función) 

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

Realizando la validación de estos dos objetos con la función propuesta nos indica que ambos objetos son iguales, con todo tipo de dato y con orden diferente.
Por ultimo les dejo el github con el código de la prueba.
https://github.com/davidyero/javascript-tricks/blob/master/js-compare-object.js
Sedot WC Malang
Tags: sedotwc, sedotwcmalang
Published: 2022-01-21 04:22:13

[Sedot WC Malang](https://sedotwcsidoarjoonline.com/sedot-wc-malang/) area kota Dan Kabupaten harga Murah & Ekonomis. Hubungi kami sekarang juga untuk info lebih mengenai harga Rp80 ribuan seluruh layanan Sedot WC khanza jaya Murah sedot WC / Limbah.Kebersihan lingkungan tentunya harus sangat diperhatikan guna menambah kenyamanan saat Anda tinggal.Baik itu rumah, sekolahan, rumah sakit, Apartemen dan lain sebagainya.


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

Malang merupakan kota Metropolis terbesar kedua di Jawa Timur dan juga daerah pariwisata yang sangat indah.Masalah kebersihan limbah tinja atau limbah STP tentu menjadi prioritas utama agar tidak mengganggu keindahan, kami telah hadir untuk mengatasi semua masalah yang berkaitan dengan limbah tinja, limbah domestik, dan limbah restoran.Anda harus segera membersihkannya, dan Jika Anda berada di kawasan jangkauan kami, beberapa.Jasa Kuras septictank Murah & Ekonomis Tukang Sedot limbah Kota Malang Paling banyak direkomendasikan oleh Dinas terkait untuk pembersihan septic tank atau pelancaran saluran.

Source : https://sedotwcsidoarjoonline.com/sedot-wc-malang/
What is multisignature wallet?
Tags: multisignature, ethereum, blockchain, smartcontracts
Published: 2022-01-21 03:48:58

Before jump to multisignature wallet, we need to know, what is the difference between the two different types of accounts on Ethereum: externally owned accounts (EOAs) and contract accounts?

## Externally-owned account

Externally-owner account is account which controlled by anyone with the private keys.

You need a private key to verify every transactions with defined events.

## Contract account

A smart contract deployed to the network, controlled by code.

Using logic that executed when specific condition met in the Ethereum blockchain to verify transactions and can define whos has the access rights and how to control every transactions with defined events.

Both account types have the ability to:

- Receive, hold and send ETH and tokens
- Interact with deployed smart contracts

Key differences of both account types is:

- Externally-owned

  - Creating an account costs nothing
  - Can initiate transactions
  - Transactions between externally-owned accounts can only be ETH/token transfers

- Contract

  - Creating a contract has a cost because you're using network storage
  - Can only send transactions in response to receiving a transaction
  - Transactions from an external account to a contract account can trigger code which can execute many different actions, such as transferring tokens or even creating a new contract

---

## Multisignature wallet account

Multisignature wallet require multiple (two or more) parties to confirm every transaction with defined events before it can be executed, each parties, represented by the same unique ethereum address characteristics, with 42 alpha-numeric characters long, each parties defined as multisignature wallet owners, hence, the single point of failure associated with private key is no longer automically result in a loss of all funds controlled by the account.

Multisignature wallet has different types, for example:
- **n-of-n**: This type of multisignature requires all of the private keys signature.
- **n-of-m**: This type of multisignature only require 2 signature from 3 private keys for example.

![Multisignature wallet example from gnosis](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y2ppgg75olyq2wda4oa3.png)

---

## Multisignature (or similar scheme) tools and services

### Bitcoin

- Blockstream
- Casa
- Unchained Capital
- Caravan
- Electrum
- Lily
- Nunchuk
- Specter

### Ethereum

- Gnosis
- Edgehog (built for use-cases involving low-to-no financial value, similar scheme to multisignature)

References :

- https://en.bitcoin.it/wiki/Multi-signature
- https://ethereum.org/en/developers/docs/accounts/
- https://docs.gnosis-safe.io/introduction/the-programmable-account/eoas-vs.-contract-accounts
Laravel 8 Export Buttons In Datatables Example
Tags: laravel, laravel8, datatable, export
Published: 2022-01-21 03:41:13

In this tutorial I will give you example of laravel 8 export buttons in datatables example. If you want to export data in excel, pdf or csv file format in datatable then you have to add export button in your datatable. So, here I am show you how to add export button in datatable using jquery or  how to enable export button in datatable.

Datatables provides datatable buttons plugin for add export buttons in datatable using jquery. After adding of export button, you can easily export data to CSV, Excel and PDF file also you can copy all datatable data in html format.

So, let's see how to add export button in datatable using jquery.

You need to add below javascript file cdn to add export button in datatable.

    https://code.jquery.com/jquery-3.5.1.js
    https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js
    https://cdn.datatables.net/buttons/1.6.2/js/dataTables.buttons.min.js
    https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js
    https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js
    https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js
    https://cdn.datatables.net/buttons/1.6.2/js/buttons.html5.min.js

And also add following CSS library files are loaded for use in this example to provide the styling of the table.

    https://cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css
    https://cdn.datatables.net/buttons/1.6.2/css/buttons.dataTables.min.css

Add below javascript code in your script tag.

```
$(document).ready(function() {
    $('#export_example').DataTable( {
        dom: 'Bfrtip',
        buttons: [
            'copyHtml5',
            'excelHtml5',
            'csvHtml5',
            'pdfHtml5'
        ]
    } );
} );
```

---

You might also like :

- [Read Also : Laravel 8 Remove/Hide Columns While Export Data In Datatables](https://techsolutionstuff.com/post/laravel-8-remove-hide-columns-while-export-data-in-datatables)

- [Read Also : How To Convert PHP Array To JSON Object](https://techsolutionstuff.com/post/how-to-convert-php-array-to-json-object)

- [Read Also : How To Increase Session Lifetime In Laravel](https://techsolutionstuff.com/post/how-to-increase-session-lifetime-in-laravel)
Getting started FeathersJS
Tags: feathersjs, node
Published: 2022-01-21 03:22:37

Feathers is a real-time, micro-service web framework for NodeJS that gives you control over your data via RESTful resources, sockets and flexible plug-ins.


install featherjs/cli

```
npm install @feathersjs/cli -g
```

Generate a feathers back-end API server

```
feathers generate app
```
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m8qtcb58b04qpnb0ec3j.png)

Open file config and setup database

> backend/config/default.json
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qu8ct4s20tg7sx3ylccb.png)

create service

```
feathersjs generate service
```

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

set up model

```
// See https://sequelize.org/master/manual/model-basics.html
// for more of what you can do here.
const Sequelize = require('sequelize');
const DataTypes = Sequelize.DataTypes;

module.exports = function (app) {
  const sequelizeClient = app.get('sequelizeClient');
  const aboutUs = sequelizeClient.define('about_us', {
    text: {
      type: DataTypes.STRING,
      allowNull: false
    }
  }, {
    hooks: {
      beforeCount(options) {
        options.raw = true;
      }
    }
  });

  // eslint-disable-next-line no-unused-vars
  aboutUs.associate = function (models) {
    // Define associations here
    // See https://sequelize.org/master/manual/assocs.html
  };

  return aboutUs;
};
```

get data form database

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r4tuujno16cjpoburiq8.png)
JavaScript type detection
Tags: watercooler, javascript, discuss
Published: 2022-01-21 02:44:13

This is one of those annoying things I have to relearn every time I come back to writing something in JS.

```javascript
$ [] instanceof Array
true

$ '' instanceof String
false

$ typeof []
'object'

$ typeof ''
'string'

$ typeof new String('')
'object'

$ wow right of course
```

That, and [`this`](https://dev.to/search?q=javascript%20this).
100 días de código: 57, pagina de portafolio casi finalizada
Tags: spanish, 100daysofcode, webdev
Published: 2022-01-21 02:34:46

¡Hey hey hey!

Hoy realmente no tuve la productividad que me hubiera gustado pero, a pesar de lo anterior, logre hacer algunas tareas y escribir esto aunque fuera casi al final del día.

He realizado algunos cambios en algunos estilos para mejorar algunas , también he creado una aparición de elementos con manejo del DOM con Javascript en un evento de scroll y he creado un logotipo con ayuda de [canva](https://www.canva.com/) para ponerlo como favicon de la pagina. 

Pueden ver una vista previa de [mi portafolio](https://darito97.github.io/portafolio3/) y cualquier comentario sera bienvenido.

Espero que tengan mucho éxito en sus proyectos.

¡Adiós mundo!

Foto cover de [Kevin Mueller](https://unsplash.com/@kevinmueller?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) en [Unsplash](https://unsplash.com/s/photos/animal?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText).
January 20th, 2022: What did you learn this week?
Tags: weeklylearn, discuss, weeklyretro
Published: 2022-01-21 01:25:04

It's that time of the week again. So wonderful devs, what did you learn this week? It could be programming tips, career advice etc.

<center>

![Hackerman from Kung Fury putting on a Nintendo Power glove](https://media.giphy.com/media/W1ecIq4sEofza/giphy.gif)

</center>

Feel free to comment with what you learnt and/or reference your TIL post to give it some more exposure.

{%tag todayilearned %}

And remember, if something you learnt was a big win for you, then you know where to drop it as well.👇👇🏻👇🏼👇🏽👇🏾👇🏿

{%link https://dev.to/devteam/what-was-your-win-this-week-1h0b %}

<center>

![Little kid making a fist as if to say "Yes!"](https://media.giphy.com/media/6brH8dM3zeMyA/giphy.gif)
</center>
Using win-usbipd with several distros
Tags: wsl, help, windows, linux
Published: 2022-01-21 00:50:30

Lately, I've been wanting to test [postmarketOS](https://postmarketos.org/), a project with the intention of giving smartphones a longer life, porting Linux to them and keep those devices supported with newer software for longer. 

To install it to your device, you can either download a prebuilt image (easiest, only several devices with mostly complete/complete support) or building an image with `pmbootstrap` (slightly harder), this last one needs a Linux machine. Oh surprise, it also supports WSL! That day I also learnt that there's a tool to do USB over IP to WSL2, [win-usbipd](https://github.com/dorssel/usbipd-win).

So I set it up following these instructions and when trying to attach my tablet to WSL from Windows. I ended with this error:
```
$ usbipd wsl attach --busid 4-2
usbipd: error: The specified WSL distribution cannot be reached via the WSL virtual switch; try restarting the WSL distribution.
```
The reason for this error is that I also have Docker installed in this machine, and docker sets up it's own distro, which is set as default, not Ubuntu, the distro that I wanted to use. Also Docker seems to have a few networking gotchas.
Do note, I'm running these commands on prompt with administrator privileges.
Looking around with `--help`, I stumbled upon with the `--distribution` parameter:
```
$ usbipd wsl attach --busid 4-2 --distribution Ubuntu-20.04
```
Note, you can find the name for all the installed linux distros with `wsl --list`.

Cover photo by <a href="https://unsplash.com/@6heinz3r?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Gabriel Heinzer</a> on <a href="https://unsplash.com/s/photos/linux?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
Wordle solver
Tags: go
Published: 2022-01-21 17:28:21

---
title: Wordle solver
published: true
date: 2022-01-21 00:00:00 UTC
tags: Go
canonical_url: https://defer.cc/b/wordle-solver/
---

Just for fun tool to search in the Wordle wordlist.

Usage

```
Usage of ./wordle-solver:
  -except string
        Characters to except (e.g.: "aeou")
  -match string
        The string to match (placeholder: .) (default ".....")
  -wordlist string
        Wordlist to use (default "Wordlist")

```

Example Todays Worlde is “BRAND” for example and we started with “IRATE”.

`wordle-solver -match ".ra.." -except "ite"`

You got a list of 27 possible words.

[Wordle solver on GitHub](https://github.com/mnlwldr/wordle-solver "Wordle solver on GitHub")

```go
package main

import (
	"bufio"
	"flag"
	"fmt"
	"log"
	"os"
	"regexp"
)

func main() {
	wordlistFlag := flag.String("wordlist", "Wordlist", "Wordlist to use")
	matchFlag := flag.String("match", ".....", "The string to match (placeholder: .)")
	exceptFlag := flag.String("except", "", "Characters to except (e.g.: \"aeou\")")
	flag.Parse()

	file, err := os.Open(*wordlistFlag)
	if err != nil {
		log.Fatal(err)
	}
	defer file.Close()

	scanner := bufio.NewScanner(file)
	for scanner.Scan() {
		match, _ := regexp.MatchString(*matchFlag, scanner.Text())
		except, _ := regexp.MatchString(fmt.Sprintf(`[%s]`, *exceptFlag), scanner.Text())
		if match && !except {
			fmt.Println(scanner.Text())
		}
	}
}

```
Add an Azure static disk with Azure disk CSI driver in Kubernetes
Tags: azure, cloud, aks, kubernetes
Published: 2022-01-31 20:50:30

---
title: Add an Azure static disk with Azure disk CSI driver in Kubernetes
published: true
date: 2022-01-21 00:00:00 UTC
tags: azure,cloud,aks,kubernetes
canonical_url: https://www.mourtada.se/add-an-azure-static-disk-with-azure-disk-csi-driver-in-kubernetes/
---

The in tree storage drivers for Kubernetes is planned to be removed in version 1.26-1.27. The new Container Storage Interface(CSI) is the way forward for handling persistent storage inside Kubernetes and it’s been GA since 1.13. For Azure disk the in tree driver is deprecated since 1.19.

Recently I’ve setup a new AKS cluster and the documentation how to setup and azure static disk volume with Azure disk CSI was a bit hard to find. So I’ll document how I did here.

## Create the static disk

The official docs recommends to create disk in the node resource group of your AKS cluster.

```
az disk create \
--resource-group my-node-resource-group \
--name disk-aks-something \
--location swedencentral \
--os-type linux \
--sku Premium_LRS \
--size-gb 8 \
--query id --output tsv

```

This command will output the disk id that you’ll use for as the `volumeHandle` in the next step.

## Add the persistent volume

```
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-my-volume
spec:
  capacity:
    storage: 8Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  csi:
    driver: disk.csi.azure.com
    readOnly: false
    volumeHandle: /subscriptions/subscription-id/my-node-resource-group/my-resource-group/providers/Microsoft.Compute/disks/disk-aks-something
    volumeAttributes:
      fsType: ext4
      #partition: "1" # optional, remove this if there is no partition

```

## Add the persistent volume claim

```
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pvc-my-volume
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 8Gi
  volumeName: pv-my-volume
  storageClassName: ""

```

## Add the pvc to your pod

```
kind: Pod
apiVersion: v1
metadata:
  name: nginx-azuredisk
spec:
  nodeSelector:
    kubernetes.io/os: linux
  containers:
    - image: mcr.microsoft.com/oss/nginx/nginx:1.17.3-alpine
      name: nginx-azuredisk
      command:
        - "/bin/sh"
        - "-c"
        - while true; do echo $(date) >> /mnt/azuredisk/outfile; sleep 1; done
      volumeMounts:
        - name: azuredisk01
          mountPath: "/mnt/azuredisk"
  volumes:
    - name: azuredisk01
      persistentVolumeClaim:
        claimName: pvc-my-volume

```

And that’s it!
How to get a property type from another type alias or an interface in TypeScript?
Tags: typescript
Published: 2022-01-21 00:00:00

---
  title: How to get a property type from another type alias or an interface in TypeScript?
  published: true
  tags: TypeScript
  date: Fri Jan 21 2022 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/get-property-type-from-another-type-alias-or-interface-typescript
  cover_image: https://melvingeorge.me/_next/static/images/main-5de12a0479654817838a04874d57a883.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/get-property-type-from-another-type-alias-or-interface-typescript)
  
To get a property type from another `type alias` or an `interface`, you can use the `indexed access types` feature in TypeScript.

Indexed access types are written after the type or the interface name in the form of an opening and closing square brackets symbol `[]`, Inside the brackets we can specify the property name we need to get the type of inside quotes symbol `" "`.

### TL;DR

```ts
// a simple interface
interface Car {
  name: string;
  yearMade: number;
}

// get the `name` property's
// type from `Car` interface
type CarName = Car["name"]; // CarName -> string
```

For example, let's say we have an interface called `Car` with a property of `name` having the type of `string` and another property called `yearMade` having the type of number like this,

```ts
// a simple interface
interface Car {
  name: string;
  yearMade: number;
}
```

Suppose we want to get the type of the `name` property from the `Car` interface. To do that let's use the `indexed access type` feature in TypeScript.

It can be done like this,

```ts
// a simple interface
interface Car {
  name: string;
  yearMade: number;
}

// get the `name` property's
// type from `Car` interface
type CarName = Car["name"]; // CarName -> string
```

Now if you hover over the `CarName` type you can see that its type is of `string` type which is the same as that of the `name` property's type in the `Car` interface.

We have successfully got the property type from another `interface` in TypeScript. Yay 🥳!

See the above code live in [codesandbox](https://codesandbox.io/s/get-property-type-from-another-type-alias-or-interface-typescript-ogqnut?file=/src/index.ts).

That's all 😃!

### Feel free to share if you found this useful 😃.

---
What makes an agile tool "good"?
Tags: tools, jira, agile
Published: 2022-06-18 19:48:19

---
title: What makes an agile tool "good"?
published: true
date: 2022-01-21 00:00:00 UTC
tags: tools,jira,agile
canonical_url: https://jhall.io/archive/2022/01/21/what-makes-an-agile-tool-good/
---

I was recently discussing with someone whether I think Jira is a “good tool” for agile teams. (Spoiler alert: I don’t—I’ll explain why later)

But what makes a tool “good”?

There are different ways to look at it, but two key things I think are important:

- It should make useful things easier to do

- Possibly it should make unuseful things harder to do

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._
Increment an Atomic Counter
Tags: javascript, webdev, aws
Published: 2022-01-20 23:03:50

Disclaimer: This is not an original writing. I am just summarizing from [here](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.NodeJs.03.html#GettingStarted.NodeJs.03.03)

What is an atomic counter?

> you use the update method to increment or decrement the value of an existing attribute without interfering with other write requests. This method is called an atomic counter

```javascript

/**
 * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * This file is licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License. A copy of
 * the License is located at
 *
 * http://aws.amazon.com/apache2.0/
 *
 * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
*/
var AWS = require("aws-sdk");

AWS.config.update({
  region: "us-west-2",
  endpoint: "http://localhost:8000"
});

var docClient = new AWS.DynamoDB.DocumentClient()

var table = "Movies";

var year = 2015;
var title = "The Big New Movie";

// Increment an atomic counter

var params = {
    TableName:table,
    Key:{
        "year": year,
        "title": title
    },
    UpdateExpression: "set info.rating = info.rating + :val",
    ExpressionAttributeValues:{
        ":val": 1
    },
    ReturnValues:"UPDATED_NEW"
};

console.log("Updating the item...");
docClient.update(params, function(err, data) {
    if (err) {
        console.error("Unable to update item. Error JSON:", JSON.stringify(err, null, 2));
    } else {
        console.log("UpdateItem succeeded:", JSON.stringify(data, null, 2));
    }
});

```

Notice the value from *ExpressionAttributeValues* and *UpdateExpression*. They are being incremented by value of the value in expressionAttributeValues where above is by 1. You can change the value by inputting value by yourself.