teleren/devto huggingface dataset:
await for Observables
Tags: subscription, rxjs, free, unittesting
Published: 2023-07-09 12:32:37

---
title: await for Observables
published: true
date: 2022-06-03 04:23:01 UTC
tags: subscription,rxjs,free,unittesting
canonical_url: 
---

[![](https://cdn-images-1.medium.com/max/1024/1*wAjL4H9zMOIABK9QGNCpjg.png)](https://gparlakov.medium.com/await-for-observables-234467302c4e?source=rss-8b336464cb11------2)

Subscribe for me, please!

[Continue reading on Medium »](https://gparlakov.medium.com/await-for-observables-234467302c4e?source=rss-8b336464cb11------2)
About Justnobz Admin
Published: 2022-06-03 04:13:10

My name is Nobz baba, i head contents on **Justnobz**. The website talks all about music and gist. My primary duty is music, so my day basically consists of trying to make music accessible to people who love music. so if you are looking for new website to download [Latest Music](https://justnobz.com/music), **Justnobz **got your back.
[One of our recent article](https://justnobz.com/wp-content/uploads/2022/05/American-actor-Ray-Liotta.jpg)
Want to Join a Rapid Growth Satellite Startup?
Tags: career, cpp, python
Published: 2022-06-03 04:11:48

I’m hiring. Know anyone who might be interested in joining a rapidly growing satellite startup company as a Flight Software Engineer? Want to help develop the latest satellite technologies? Feel free to shoot me any questions or referrals who might be interested!

If you are interested I'll love to talk and get to know you better. Shoot me a DM or email me at JohnGabriel.NguyenTruong@Igniterec.com.

Great company with rapid growth and a chance to earn equity.

Need at least 2-3+ years of C++ experience and must be US Citizen or permanent resident (U.S. Government space technology export regulations).

The salary range is between 105K-180K depending on experience and competency.


[Apply Here!](https://www.linkedin.com/jobs/view/3107459581)
Hamming Distance
Tags: leetcode, dsa, theabbie
Published: 2022-06-03 04:00:47

The [Hamming distance](https://en.wikipedia.org/wiki/Hamming_distance) between two integers is the number of positions at which the corresponding bits are different.

Given two integers `x` and `y`, return _the **Hamming distance** between them_.

**Example 1:**

**Input:** x = 1, y = 4
**Output:** 2
**Explanation:**
1   (0 0 0 1)
4   (0 1 0 0)
       ↑   ↑
The above arrows point to positions where the corresponding bits are different.

**Example 2:**

**Input:** x = 3, y = 1
**Output:** 1

**Constraints:**

*   `0 <= x, y <= 231 - 1`

**SOLUTION:**

    class Solution:
        def hammingDistance(self, x: int, y: int) -> int:
            return "{:b}".format(x ^ y).count("1")
go(golang) ORM 찾기 #1
Tags: go, orm
Published: 2022-06-03 03:54:28

## 시리즈
- [github 코드](https://github.com/ugabiga/go-orm-example)
1. **go(golang) ORM 찾기 #1**
2. [go(golang) ORM 찾기 #2 - sqlboiler](https://dev.to/vultorxyz/naega-sayonghal-gogolang-orm-cajgi-sqlboiler-2-3jej)
3. [go(golang) ORM 찾기 #3 - ent](https://dev.to/vultorxyz/naega-sayonghal-gogolang-orm-cajgi-ent-3-3anf)

## 서론

어떤 ORM을 사용하는가에 따라 백엔드 개발에서의 생산성이 크게 영향받는다고 생각합니다. 그래서 go 언어에서 여러 가지 ORM을 살펴보면서 추후 백엔드 개발에서 사용할 ORM을 찾아보겠습니다. 후보 중에서는 ORM이라고 부르기 어려운 기술들도 있는데 여기에서는 데이터베이스에 접근하는 라이브러리를 탐색한다는 생각으로 접근해보려고 합니다.

ORM을 비교할 기준을 먼저 정해보자면 아래와 같습니다.

### 1. 모델 정의 방법

Code first, Database first 전략이 대표적인데 개인적으로는 코드만 작성하면 나머지는 라이브러리가 알아서 해주는 Code first를 좀 더 선호합니다. SQL을 따로 작성하기보다는 항상 다루는 코드를 작성하는 것이 더 편하다고 생각하기 때문입니다. 그리고 저에게는 사용하기만 편하다면 Active record인지 Data mapper인지는 큰 상관이 없을 것 같습니다.

### 2. 관계 데이터를 다루는 방법

관계 데이터를 다루는 방법은 정답이 있기보다는 데이터 간 관계를 정의하는 방식이 작성하기 쉽게 되어있는지를 또 쿼리를 할 때 얼마나 쉽게 관계를 불러올 수 있는지를 중점적으로 볼 예정입니다. 부모-자식, many to many와 같은 관계들 그리고 Eager Loading과 같은 기능을 지원하는지가 자세히 봐야 할 것 같습니다.

### 3. 마이그레이션 처리 방법

데이터베이스의 구조를 변경하기 위한 마이그레이션이 어떤 식으로 처리되는지를 주요하게 볼 예정입니다. 사실 지원하지 않는 ORM들도 상당수 있는데 그 경우 ORM의 모델과 Migration을 따로 작성하는 불편함이 있기 때문에 어떤 툴을 사용하여 마이그레이션을 수행할 수 있는지 그리고 마이그레이션의 롤백은 어떤 식으로 동작하는지를 중점적으로 살펴볼 예정입니다.

### 4. 이벤트 지원

ORM을 사용하다 보면 어떤 모델이 수정되면 그에 대한 이벤트를 받아야 할 때가 있습니다. 이런 기능을 지원하는지 또한 중점적으로 살펴볼 예정입니다.

### 5. 지원 데이터베이스

어떤 데이터베이스를 지원하는지 살펴볼 예정입니다. ORM의 장점 중 하나는 여러 가지 데이터베이스에 대하여 동일한 코드로 접근을 할 수 있다는 것인데 과연 이것들이 잘 지원하는지 살펴보면 좋을 것 같네요.

### 6. 기타 기능들

pagination 관련 기능, 모델 transform 관련 기능, raw query 기능들 등 있으면 좋겠다고 생각하는 기능들에 대하여도 살펴볼 예정입니다.

---

## 검증용 데이터베이스 모델

위의 내용들을 검증하기 위한 모델을 작성하였습니다. 모델은 아래와 같습니다.
![orm_test_models](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tkodja7ej7jh78mce4vc.png)

---

## 후보

최근까지 업데이트 되고 있는지 github star가 적절한지에 따라 후보들을 추려보았습니다.

1. [sqlc](https://github.com/kyleconroy/sqlc) : database first 전략을 사용하며 각각의 쿼리도 sql로 작성하면 code를 만들어주는 방법을 사용하고 있습니다.
2. [sqlboiler](https://github.com/volatiletech/sqlboiler) : Rails에서 영감을 받은 것으로 보이고 database first 전략을 취하고 있습니다. 데이터베이스 테이블을 읽어서 모델을 만드는 형태이기 때문에 미리 테이블들을 만들고 이를 기반으로 코드를 생성해야 합니다.
3. [ent](https://github.com/ent/ent) : code first 전략을 사용하며 모델 코드를 작성하면 이를 기반으로 다른 필요한 구성요소를 생성하는 형태를 취하고 있습니다.
4. [gorm](https://gorm.io) : code first 전략을 취하고 있고 go 언어 orm을 찾으면 가장 많이 나오는 orm 중 하나입니다.

다음 포스팅부터는 각각의 후보들을 실제로 구현해 보면서 살펴볼 예정입니다.
Ugly Number II
Tags: leetcode, dsa, theabbie
Published: 2022-06-03 03:30:38

An **ugly number** is a positive integer whose prime factors are limited to `2`, `3`, and `5`.

Given an integer `n`, return _the_ `nth` _**ugly number**_.

**Example 1:**

**Input:** n = 10
**Output:** 12
**Explanation:** \[1, 2, 3, 4, 5, 6, 8, 9, 10, 12\] is the sequence of the first 10 ugly numbers.

**Example 2:**

**Input:** n = 1
**Output:** 1
**Explanation:** 1 has no prime factors, therefore all of its prime factors are limited to 2, 3, and 5.

**Constraints:**

*   `1 <= n <= 1690`

**SOLUTION:**

    import heapq
    
    class Solution:
        def nthUglyNumber(self, n: int) -> int:
            uglies = [1]
            uglySet = {1}
            while len(uglies) < n * 10:
                for num in uglies[:]:
                    for k in [2, 3, 5]:
                        p = num * k
                        if p not in uglySet:
                            heapq.heappush(uglies, p)
                            uglySet.add(p)
            return heapq.nsmallest(n, uglies)[n - 1]
Count Special Quadruplets
Tags: leetcode, dsa, theabbie
Published: 2022-06-03 03:00:43

Given a **0-indexed** integer array `nums`, return _the number of **distinct** quadruplets_ `(a, b, c, d)` _such that:_

*   `nums[a] + nums[b] + nums[c] == nums[d]`, and
*   `a < b < c < d`

**Example 1:**

**Input:** nums = \[1,2,3,6\]
**Output:** 1
**Explanation:** The only quadruplet that satisfies the requirement is (0, 1, 2, 3) because 1 + 2 + 3 == 6.

**Example 2:**

**Input:** nums = \[3,3,6,4,5\]
**Output:** 0
**Explanation:** There are no such quadruplets in \[3,3,6,4,5\].

**Example 3:**

**Input:** nums = \[1,1,1,3,5\]
**Output:** 4
**Explanation:** The 4 quadruplets that satisfy the requirement are:
- (0, 1, 2, 3): 1 + 1 + 1 == 3
- (0, 1, 3, 4): 1 + 1 + 3 == 5
- (0, 2, 3, 4): 1 + 1 + 3 == 5
- (1, 2, 3, 4): 1 + 1 + 3 == 5

**Constraints:**

*   `4 <= nums.length <= 50`
*   `1 <= nums[i] <= 100`

**SOLUTION:**

    class Solution:
        def countQuadruplets(self, nums: List[int]) -> int:
            n = len(nums)
            ctr = 0
            exists = {}
            for i, num in enumerate(nums):
                exists[num] = exists.get(num, []) + [i]
            for i in range(n):
                for j in range(i + 1, n):
                    for k in range(j + 1, n):
                        val = nums[i] + nums[j] + nums[k]
                        if val in exists:
                            for p in exists[val]:
                                if p > k:
                                    ctr += 1
            return ctr
Java Insights - Issue 13
Tags: java
Published: 2022-06-03 02:52:49

Originally posted at https://curatedjava.com

**🔥 Top Java Posts**

_1. Java Collections: Big-O Algorithm Complexity_
A cheat sheet for Java Collections Big-O algorithm complexity listing the cost for the main operations. As a bonus, it also lists the data structure used to implement each Java Collection. [Learn more >>](https://twitter.com/mimaraslan/status/1529200750609547265)

_2. The Future of Java_
Java enthusiasts share their opinions on what makes Java so great after 25 years Some highlights are the libraries, stability and the JVM. [Learn more >>](https://www.youtube.com/watch?v=5n9PqIUObLA)

**🖱️ Just Click It**
1. [Two Ways to Extend Enum Functionality](https://www.javacodegeeks.com/2019/03/two-ways-extend-enum-functionality.html)
2. [14 High Performance Java Persistence Tips](https://vladmihalcea.com/14-high-performance-java-persistence-tips/)
3. [Replacing Finalizers with Cleaners](https://inside.java/2022/05/25/clean-cleaner/)
4. [No Nonsense Guide to JVM Implementations: OpenJDK, OpenJ9, GraalVM](https://www.payara.fish/resource/no-nonsense-guide-to-jvm-implementations-openjdk-openj9-graalvm/?utm_content=209080688&utm_medium=social&utm_source=twitter&hss_channel=tw-2599580401)
5. [Thoughts on Why People Perceive Java as a Complex Programming Language](https://www.sivalabs.in/my-attempt-to-understand-why-people-perceive-java-as-complex/)
6. [Loom and Thread Fairness](https://www.morling.dev/blog/loom-and-thread-fairness/)
7. [Standardizing Native Java: Aligning GraalVM and OpenJDK](https://www.infoq.com/articles/native-java-aligning/)

**🤖 Java Interview Questions**
_1. What is the process of garbage collection?_
It is the process of identifying unused objects in order to reclaim memory space. Unused objects are objects for which there are no references by any part of the program. The garbage collection process takes place in the heap.

_2. What is the recommended data type to represent and process currency/money operations?_
BigDecimal, because it offers a higher level of precision compared with Double. When compared with Float, Double offers a higher level of precision.

**❓StackOverflow Java Question**
1. [Avoiding NullPointerException in Java](https://stackoverflow.com/questions/271526/avoiding-nullpointerexception-in-java)
2. [What are the differences between a HashMap and a Hashtable in Java?](https://stackoverflow.com/questions/40471/what-are-the-differences-between-a-hashmap-and-a-hashtable-in-java)
3. [How do I generate random integers within a specific range in Java?](https://stackoverflow.com/questions/363681/how-do-i-generate-random-integers-within-a-specific-range-in-java)

**⚙️ New Releases**
- [Spring Boot 2.7.0](https://spring.io/blog/2022/05/19/spring-boot-2-7-0-available-now)

[Previous Editions](https://curatedjava.com/java-weekly-newsletter/
)
Data table package for Laravel livewire.
Tags: laravel
Published: 2022-06-03 02:48:34

It’s an easy way to manage data and columns by GUI

![Laravel livewire data table](https://blog.bladetailui.com/wp-content/uploads/2022/05/livewire-datatable-screenshot-1024x493.png)

In this livewire data table, you can manage data efficiently in GUI. You can add and edit columns and make columns sortable, searchable, editable, and filterable. You can edit data inline and delete it!

## Install via composer
```php
composer require devaweb/livewire-data-table
```

## Use it...
```php
   @livewire('livewire-data-table', [ 
       'model' => \App\Models\User::class 
   ], key('table-1'))
```

[See full documentaion](https://bladetailui.com/livewire-data-table/home)
Currency Conversion With Fixer: Fixer's currency conversion and how to use it on your website
Tags: webdev, javascript, programming, api
Published: 2022-06-03 02:17:17

Since the number of currencies is constantly growing (more have been added since last week, and more are coming next month), it is essential that customers receive the latest currency data available to them. The API aims at helping users achieve this by providing up-to-date currency data regularly. Loading the API as a plugin enables website owners and developers to access currency conversion functionality easily and provide their audiences with an enhanced experience.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/utnepiae2l5krxjis237.jpg)
Imagine you are a developer, and you’re working on some software that will have users from all over the world. You need to provide your users with a way to choose their native currency so they can see their invoices in their local currency.

[Currency conversion API](https://fixer.io/) is a common practice for many businesses, especially online ones. Currency conversion helps them avoid spending extra funds on the foreign exchange rate by projecting their revenue in the base currency.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yz6uwodmi0tkcl4757ro.jpg)
If you're looking to make a currency conversion on your website, Fixer API is a good way to go. Being an international company, we know what it takes to deliver reliable exchange rate data. Our team of developers is always improving upon the API and adding new features to meet the diverse needs of different types of clients. You can start using our API free with a limit of 100 requests a day. Take it for a spin now!

All you have to do will be add the following code to your HTML template or within custom code on your site. Please note that the code below will work for both the Single Currency and Multiple Currencies plugins - depending on the plugin(s) you are using.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e1r2zq2b2w5i27it3k6s.jpg)
Conclusion
The Fixer API is a good way to use as [best free currency converter API](https://fixer.io/) in your website. It is a reliable, trusted and free-to-use API that provides exchange rate data to improve your customers' experience. If you're looking to build your currency converter or looking for an alternative, the Fixer API is worth a look.
Surrounded Regions
Tags: leetcode, dsa, theabbie
Published: 2022-06-03 02:00:42

Given an `m x n` matrix `board` containing `'X'` and `'O'`, _capture all regions that are 4-directionally surrounded by_ `'X'`.

A region is **captured** by flipping all `'O'`s into `'X'`s in that surrounded region.

**Example 1:**

![](https://assets.leetcode.com/uploads/2021/02/19/xogrid.jpg)

**Input:** board = \[\["X","X","X","X"\],\["X","O","O","X"\],\["X","X","O","X"\],\["X","O","X","X"\]\]
**Output:** \[\["X","X","X","X"\],\["X","X","X","X"\],\["X","X","X","X"\],\["X","O","X","X"\]\]
**Explanation:** Surrounded regions should not be on the border, which means that any 'O' on the border of the board are not flipped to 'X'. Any 'O' that is not on the border and it is not connected to an 'O' on the border will be flipped to 'X'. Two cells are connected if they are adjacent cells connected horizontally or vertically.

**Example 2:**

**Input:** board = \[\["X"\]\]
**Output:** \[\["X"\]\]

**Constraints:**

*   `m == board.length`
*   `n == board[i].length`
*   `1 <= m, n <= 200`
*   `board[i][j]` is `'X'` or `'O'`.

**SOLUTION:**

    class Solution:
        def DFS(self, board, v, i, j, m, n):
            v.add((i, j))
            for di, dj in [(-1, 0), (0, 1), (1, 0), (0, -1)]:
                if 0 <= i + di < m and 0 <= j + dj < n:
                    if board[i + di][j + dj] == "O" and (i + di, j + dj) not in v:
                        self.DFS(board, v, i + di, j + dj, m, n)
        
        def solve(self, board: List[List[str]]) -> None:
            m = len(board)
            n = len(board[0])
            for i in range(m):
                for j in range(n):
                    if board[i][j] == "O":
                        v = set()
                        self.DFS(board, v, i, j, m, n)
                        isEnclosed = True
                        for x, y in v:
                            if x == 0 or x == m - 1 or y == 0 or y == n - 1:
                                isEnclosed = False
                                break
                        if isEnclosed:
                            for x, y in v:
                                board[x][y] = "X"
Convert Binary Number in a Linked List to Integer
Tags: leetcode, dsa, theabbie
Published: 2022-06-03 01:30:41

Given `head` which is a reference node to a singly-linked list. The value of each node in the linked list is either `0` or `1`. The linked list holds the binary representation of a number.

Return the _decimal value_ of the number in the linked list.

**Example 1:**

![](https://assets.leetcode.com/uploads/2019/12/05/graph-1.png)

**Input:** head = \[1,0,1\]
**Output:** 5
**Explanation:** (101) in base 2 = (5) in base 10

**Example 2:**

**Input:** head = \[0\]
**Output:** 0

**Constraints:**

*   The Linked List is not empty.
*   Number of nodes will not exceed `30`.
*   Each node's value is either `0` or `1`.

**SOLUTION:**

    # Definition for singly-linked list.
    # class ListNode:
    #     def __init__(self, val=0, next=None):
    #         self.val = val
    #         self.next = next
    class Solution:
        def getDecimalValue(self, head: ListNode) -> int:
            curr = head
            val = 0
            while curr:
                val = 2 * val + curr.val
                curr = curr.next
            return val
Git Pushing to Multiple Remotes
Tags: git
Published: 2023-01-06 03:00:45

---
title: Git Pushing to Multiple Remotes
published: true
date: 2022-06-03 01:19:29 UTC
tags: Git
canonical_url: https://brandonrozek.com/blog/git-pushing-multiple-remotes/
---

Git’s greatest strength is its first-class support for decentralization. Sadly, GitHub has taken over as the sole location to store code for many people.

In order to not _put all my eggs into one basket_, I want to utilize multiple code hosting websites to store my public repositories. This is not only for the GitHub zombie apocolypse scenario, but local outages do in fact happen and its nice to have a backup.

Ideally this backup would not come at a cost of convinience. In fact, we can edit the remotes of our git repository so that a simple`git push` updates all of our remotes.

The following is an example from my website. Within your repository, use the command `git config -e` to open an editor with your repository’s git conifguration. Then edit the origin block to be configured with multiple push-urls.

```
[remote "origin"]
        url = git@github.com:Brandon-Rozek/website.git 
        fetch = +refs/heads/*:refs/remotes/origin/*
        pushurl = git@github.com:Brandon-Rozek/website.git
        pushurl = git@git.sr.ht:~brandonrozek/website

```

After this, typing `git push` every pushurl you have configured. For me, it updates both my [GitHub repository](https://github.com/brandon-rozek/website)as well as my [SourceHut repository](https://sr.ht/~brandonrozek/website/).

I only recently started using [SourceHut](https://sr.ht/). It’s designed by [Drew Devault](https://drewdevault.com/)and others to feature the original usage of git, via email. This method is still in use by the Linux kernel development team. I’m excited to try it out and hopefully write some future posts on this concept.
React - Add prop to component if matches specific condition
Tags: react, components, javascript, render
Published: 2022-06-03 01:01:28

When working with components, sometimes we need to send one specific property just when matches specific condition as an example:
```javascript
function MyComponent = () => {
  return (
   <Select 
    label="Countries"
    options={}
    required
   />
  );
}
```

if we want to send required just when matches specific conditions, we can spread the properties

```javascript
function MyComponent = () => {
  return (
   <Select 
    label="Countries"
    options={}
    {...(shouldBeRequired && { required })}
   />
  );
}
```
Binary Tree Inorder Traversal
Tags: leetcode, dsa, theabbie
Published: 2022-06-03 01:00:47

Given the `root` of a binary tree, return _the inorder traversal of its nodes' values_.

**Example 1:**

![](https://assets.leetcode.com/uploads/2020/09/15/inorder_1.jpg)

**Input:** root = \[1,null,2,3\]
**Output:** \[1,3,2\]

**Example 2:**

**Input:** root = \[\]
**Output:** \[\]

**Example 3:**

**Input:** root = \[1\]
**Output:** \[1\]

**Constraints:**

*   The number of nodes in the tree is in the range `[0, 100]`.
*   `-100 <= Node.val <= 100`

**Follow up:** Recursive solution is trivial, could you do it iteratively?**SOLUTION:**

    # Definition for a binary tree node.
    # class TreeNode:
    #     def __init__(self, val=0, left=None, right=None):
    #         self.val = val
    #         self.left = left
    #         self.right = right
    class Solution:
        def inorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
            if not root:
                return []
            left = self.inorderTraversal(root.left)
            right = self.inorderTraversal(root.right)
            return left + [root.val] + right
Labeling of Html Form Fields
Tags: a11y, react
Published: 2022-06-03 00:59:11

---
title: Labeling of Html Form Fields
published: true
description: A post describing how to label forms for screen readers in html/react.
tags: #accessibility #a11y #react
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---
Here is a [post](https://chriswestbrook.com/blog/labeling-forms-for-accessibility) I wrote on labeling of forms. I hope it helps someone.
Climbing Stairs
Tags: leetcode, dsa, theabbie
Published: 2022-06-03 00:30:37

You are climbing a staircase. It takes `n` steps to reach the top.

Each time you can either climb `1` or `2` steps. In how many distinct ways can you climb to the top?

**Example 1:**

**Input:** n = 2
**Output:** 2
**Explanation:** There are two ways to climb to the top.
1. 1 step + 1 step
2. 2 steps

**Example 2:**

**Input:** n = 3
**Output:** 3
**Explanation:** There are three ways to climb to the top.
1. 1 step + 1 step + 1 step
2. 1 step + 2 steps
3. 2 steps + 1 step

**Constraints:**

*   `1 <= n <= 45`

**SOLUTION:**

    class Solution:
        def climbStairs(self, n: int) -> int:
            a = 1
            b = 2
            if n == 1:
                return a
            if n == 2:
                return b
            for _ in range(n - 2):
                a, b = b, a + b
            return b