teleren/devto huggingface dataset:
How to Send a Notification to a Group of People Based on a Department
Tags: nocode, automation, workflows, okta
Published: 2022-08-16 23:02:27

---
title: How to Send a Notification to a Group of People Based on a Department
published: true
date: 2022-08-16 04:31:53 UTC
tags: nocode, automation, workflows, okta
canonical_url: https://maxkatz.net/2022/04/25/how-to-send-a-notification-to-a-group-of-people-based-on-a-department/

---

The Workflows team holds weekly community [office hours](https://calendly.com/oktaworkflows/group-office-hours-okta-workflows) where you can ask questions about your flows, ask about potential uses cases, and share what you are working on.

{% embed https://dev.to/oktaworkflows/all-okta-workflows-how-to-guides-4nl9 %}

I am a starting a new series where I will be sharing questions and answers from the office hours as they are available how-to’s.

So here is the first questions.

**_How to send a notification to a group of people based on a department_?**

You are onboarding an employee and based on their department you want to send an email to a group of people associated with that department. It can be one group or multiple groups. For example, if the person is in the Engineering department an email should go to to that person plus a copy to eng1@company.com and eng2@company.com. And if the person is in the Marketing department, an email will go to that person plus a copy to marketing1@company.com

A flow to do that is below:

[![Send email based on department flow](https://katzmax.files.wordpress.com/2022/04/workflows_questions_email_deparment_flow_overview.png?w=1024)](https://katzmax.files.wordpress.com/2022/04/workflows_questions_email_deparment_flow_overview.png)
<figcaption>Send email based on department flow</figcaption>

The flow uses a table to hold department emails and looks like this:

[![Department emails table](https://katzmax.files.wordpress.com/2022/04/workflows_questions_email_department_table.png?w=1024)](https://katzmax.files.wordpress.com/2022/04/workflows_questions_email_department_table.png)
<figcaption>Department emails table</figcaption>

This is how the flow works:

1. The first card **On Demand – Helper Flow** makes this a helper flow. The helper flow has two inputs `Department` and `Primary email`. A helper flow can be reused with other flows
2. The second card **Tables – Search Rows** retrieves all emails associated with the particular department
3. The result from **Tables – Search Rows** is a JSON object with five key/value pairs. The **List – Pluck** card removes (plucks) all key/value pair except the one specified in the **key** input (`Email`). After this step you have a list of email(s) to copy
4. The last card **Gmail – Send Email** sends an email to the person who was onboarded (`Primary email`) and one or more department groups are copied ( **CC** input) on the email

* * *

Have a question about Workflows? Not sure how to build a flow? Join the weekly community [office hours](https://calendly.com/oktaworkflows/group-office-hours-okta-workflows) to get help.
First Unique Character in a String
Tags: javascript, leetcode
Published: 2022-08-16 04:20:00

```
var firstUniqChar = function(s) {
    const map={}
    for(let i=0; i<s.length; i++){
            map[s[i]]= (map[s[i]]||0)+1;
    }
// if want to return character Index;
    for(let i=0; i<s.length; i++){
           if(map[s[i]] === 1)
            return i
    }
// if you want to return character

 // for (let val in map) {
  //   if (map[val] === 1) {
  //     return val;
  //   }
  // }
    return -1
    
};
```
check if string is palindrome using recursion in javascript
Published: 2022-08-16 04:19:00

using one two pointer
```js
let s = "madam";

let reverseArray = (s, left, right) => {
  if (left >= right) {
    console.log("it's palindrome");
    return true;
  }

  if (s[left] == s[right]) {
    reverseArray(s, left + 1, right - 1);
  } else if (s[left] != s[right]) {
    console.log("it's not palindrome");
    return false;
  }
};

reverseArray(s, 0, s.length - 1);
```

using one pointer
```js
let s = "madam";

let reverseArray = (s, left) => {
  if (left >= s.length / 2) {
    console.log("it's palindrome");
    return true;
  }

  if (s[left] == s[s.length - left - 1]) {
    reverseArray(s, left + 1, s.length - left - 1);
  } else if (s[left] != s[s.length - left - 1]) {
    console.log("it's not palindrome");
    return false;
  }
};

reverseArray(s, 0);

```
Python NoteTaker
Tags: python, beginners, webdev, productivity
Published: 2022-08-16 04:19:00

I have recently made a Note Taker in Raw Python. It is really simple but also really useful. I hope more people check it out, because it took me a lot of time to optimize. I am really open to changes, so if you want, please add to it and make it better :) https://github.com/MatthewTamYT/NoteTaker/tree/main
JavaScript program to reverse an array using recursion
Tags: javascript, beginners, programming, tutorial
Published: 2022-08-16 04:00:00

```js
let arr = [1, 2, 3, 4, 5];

let reverseArray = (arr, left, right) => {
  if (left >= right) {
    console.log(arr);
    return;
  }

//swapping first element to last element
  [arr[left], arr[right]] = [arr[right], arr[left]];

//callling the function again
  reverseArray(arr, left + 1, right - 1);
};

reverseArray(arr, 0, arr.length - 1);

```
Will Carbon language replace C++ fully in the future ?
Tags: discuss, tutorial, beginners, opensource
Published: 2022-08-16 03:51:40

Reading through this post on [Carbon vs Rust](https://tipseason.com/carbon-language-vs-rust) 
Rust is definitely a well established language as a potential successor to C++. But then Carbon language is announced with a goal to become a successor to C++. 

Going through some of the basics of Carbon, syntax wise it feels similar to Rust but Carbon has different goals compared to C++ in terms of interop. 

If any one else has tried Carbon, 
Do you think Carbon language will fully replace C++ in the future if all things go as planned ?
MariaDB Quick-tip #9 - Number of rows in all tables
Published: 2022-08-16 03:36:39

## MariaDB tips and tricks

This is part of a series of quick tips and tricks I have accumulated over the year, that I think can be useful for others.
If you have similar short tips and tricks please leave a comment.

### Number of rows in all tables
When you start to work on a project for a new customer, a good piece of information is how many tables does the database contain and how many rows are there in each table. Or maybe you don't have access to the production database and need to send a service request to the IT operations department to get information about the production database.
Then the query below will be useful to you.

```sql
SET @DatabaseName := 'test_db';

SELECT t.TABLE_NAME, t.TABLE_ROWS 
  FROM INFORMATION_SCHEMA.TABLES t
 WHERE t.TABLE_SCHEMA = @DatabaseName
   AND t.TABLE_TYPE = 'BASE TABLE'
```

![DBeaver screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r3wps0bmddbjswjr2spb.png)
React + Redux the perfect combo
Tags: react, redux, javascript
Published: 2022-08-16 03:26:30

During this week I started to learn more about how React js works at low level, including how it manage the state. Redux is a state management library that will help us to store and manage all the application states. 
It also provides some APIs using which we can make changes to the existing state as weel as fetch the current state of the application.

### How does Redux works?

There’s something called Redux store this is the main central bucket which stores all the states of an application. The store has to be provided to the App.js wrapping it with a provider tag, with this all its children can access the state of the application from store allowing it to act as a global state. 

Actions inside Redux must have at least a type associated with it and extra details is optional depending on the type of action. 

Reducers inside Redux are uses to specify how the state three is transformed by actions, taking 2 things: Previous State and an action. Then they reduce it to one entity known as the new updated instance of state. 

Understanding Redux is complex, on the next weeks I’ll be completely focused on learning more about this library.
isIsomorphic
Tags: javascript, leetcode
Published: 2022-08-16 03:18:32

check isIsomorphic
```
var isIsomorphic = function(s, t) {
    let firstOccurance = {};
    let secondOccurance = {};
    if(s.length !== t.length) return false;
    for(let i=0; i<s.length; i++){
        let char1=s[i];
        let char2=t[i];
        
        if(!firstOccurance[char1] && !secondOccurance[char2]){
            firstOccurance[char1]= char2;
            secondOccurance[char2]= char1;
        }
        
        if(firstOccurance[char1] !== char2 && secondOccurance[char2] !== char1){
            return false
        }
    }
    return true;
    
};
```
Big O
Tags: beginners, algorithms, bigo, javascript
Published: 2022-08-16 02:04:29

Big O used to classify algorithms according to how their run time or space. 

<u>**Big O shorthand**
</u>
**1.** Arithmetic operators are constant.
**2.** Variable assignment is constant. 
**3.** Accessing elements in an array (by index ) or an object (by key ) is constant. 
**4.** in loop the complexity is the length of the loop times the complexity of whatever happens inside this loop.

<u>**Space complexity rules**
</u>
**1.** Most Primitives (Boolean, numbers , undefined , null ) are constant space . 
**2.** string require O(N) space where n is length of  the string.
**3.** Reference type are generally O(N) space where n is the length (for arrays or the number of keys for objects )  

<u>**Big O for _Objects_**
</u>
**1.** insertion **O(1)**
**2.** Removing **O(1)**
**3.** Searching **O(N)**
**4.** Accessing **O(1)**

<u>**Big O for _Objects_ Methods**
</u>
**1.** Object. Keys **O(N)**
**2.** Object. Values **O(N)**
**3.** Object. entries **O(N)**
**4.** has Own Property **O(1)**

<u>**Big O for _arrays_**
</u>
**1.** insertion **O(1)** if we insert at the end but at beginning of array **O(N)** 
**2.** Removing **O(1)** if we remove at the end but at beginning of array **O(N)** 
**3.** Searching **O(N)**
**4.** Accessing **O(1)**

<u>**Big O for _arrays_ Methods**
</u>
**1.** push **O(1)**
**2.** pop **O(1)**
**3.** shift **O(N)**
**4.** unshift **O(N)**
**5.** concatenate **O(N)**
**6.** slice **O(N)**
**7.** splice **O(N)**
**8.** sort **O(N Log N)**
**9.** forEach / map / filter / reduce **O(N)**
Controllable Templating in PHP
Tags: php, webdev
Published: 2022-08-16 01:54:17

## It's been a while

I have been using my own templating engine for a while now as I wasn't happy with how blade & co handle certain things. Additionally, any kind of logic within the view is a violation of separation of concerns in my view.

However, after living with a few issues for a while, I finally decided to rewrite it completely:

{% embed https://github.com/sroehrl/neoan3-template %}

## Happy accidents

I have had a way of adding project-specific functionality to the engine and wanted to keep it open for special needs. 
By simplifying the hook-process, I noticed something interesting:

In theory, one can now use this package to create specific behavior utilizing two capabilities:

### customFunctions

We are usually under full control of the data we are sending to the rendering mechanism when dealing with SSR sites, but sometimes we want to leave e.g. a model as is. So let's build a salutation template function:

```php
Template\Constants::addCustomFunction('salutation', function($gender)
{
   $salutation = 'Mrs.';
   if($gender === 1){
      $salutation = 'Mr.';
   } elseif($gender > 1){
      $salutation = 'Mx.';
   }
});

```

In our template, we can now use this function:

```html
<!-- profile.html -->
<div>
   <p>Hello, {{salutation(user.gender)}} {{user.lastName}}</p>
</div>
```
```php
$user = [
   'gender' => 0,
   'firstName' => 'Samantha',
   'lastName' => 'Smith',
   'birthDay' => '1990-06-06',
   'website' => 'https://sam-smith-1990.com'
];
echo Template\Template::embraceFromFile('/profile.html', ['user' =>$user]);
```
**output**
```html
<div>
   <p>Hello, Mrs. Smith</p>
</div>
```

This is, of course, a very constructed example, but you get the idea. Another way of implementing additional functionality is via the method

### customAttributes

With this we can hook into attribute-interpretation of the template engine. Let's have a look:

```php
Template\Constants::addCustomAttribute('secure-link', function($attr)
{
   $href = $attr->parentNode->getAttribute('href')->nodeValue;
   // external?
   if(
      !str_contains($href, $_SERVER['HTTP_HOST'] && 
      str_starts_with($href, 'http'))
     )
   {
      $attr->parentNode->setAttribute('target', '_blank');
      $attr->parentNode->setAttribute('rel', 'noopener noreferrer');
   }
});
```
```html
<!-- profile.html -->
<div>
   <p>Hello, {{salutation(user.gender)}} {{user.lastName}}</p>
   <a href="{{user.website}}" secure-link>{{user.website}}</a>
</div>
```
**output**
```html
<div>
   <p>Hello, Mrs. Smith</p>
   <a href="https://sam-smith-1990.com" target="_blank" rel="noopener noreferrer">https://sam-smith-1990.com</a>
</div>
```

I know these examples are rather strange, but due to the reusability one could easily build together a templating mechanism suited to personal needs. 
As usual, leaving a star when playing around with the repo is appreciated.

## Discussion

Now to the fun part: What has always bothered **you** when having to deal with passing data to your templating mechanism? What do you wish was less of a hassle?
[Ruby][Sorbet] Using T.unsafe to escape type constraints
Tags: sorbet, ruby, rails
Published: 2022-08-21 04:10:22

---
title: [Ruby][Sorbet] Using T.unsafe to escape type constraints
published: true
date: 2022-08-16 01:52:51 UTC
tags: ["Sorbet", "Ruby", "Rails"] 
canonical_url: https://note.hiko1129.com/posts/1660614771/
---

<a href="https://note-hiko1129-com.translate.goog/posts/1660614771/?_x_tr_sl=ja&_x_tr_tl=en&_x_tr_hl=ja&_x_tr_pto=wapp" target="_blank" rel=”noopener noreferrer”>Translate ja to en</a>

typed: trueでもtyped: strictであってもT.unsafeを使うことで特定部分のみ型に基づかない状態で記述できます。

自分がよくやる（やるなよって話であるがTODOつけて一旦通すという意味でよくやる）のは下記のパターンです。

```
T.unsafe(self).hoge # selfにhogeメソッドは型定義上存在していないが実際には存在するとき
```

RBIファイルに追記するまで、あるいは何かしらのconfigを書いてメソッドを生やす、あるいは型生成gemのバグ修正待ち、あるいはそもそも事前定義されている型が間違っているときには、上記のようにして一時対応したりしています。

## 参考
* https://sorbet.org/docs/troubleshooting#escape-hatches
Can you draw lines on the terminal?
Published: 2022-08-16 01:10:44

An application I've been working on would be made sooooo much better, with a lot less code, if it were possible to draw a line on the screen. I'd imagine the drawing grid to coincide with the characters in the terminal, so <1, 1> would be the top-left pixel of the top-left character, and <5.5, 5.5> would be in the middle of the fifth character across, fifth character down.

I've struck out with Google, which I usually take to be a "no", but this would make so many things I do so much easier that I'm amazed I've never thought of it before. I realize that much of what terminals do is derived from the vt100 days, but iTerm does a LOT that would never have been considered back then, so fingers crossed...
Can you create custom glyphs for iTerm? (Strongly prefer on-the-fly so users don't have to install a font.)
Published: 2022-08-16 00:51:51

I have a network stats application that is showing good promise, but suffers from a lack of screenspace. It shows timeseries graphs of ping RTT, packet loss %s, and a bunch of other stuff. I'd like to expand it to show not just max RTT on the appropriate graph, but max, 90th percentile, average, and mean.

For the moment, I'm using the `▂▃▄▅▆▇█` characters, stacked up about 10 rows high, to give a graph of max RTT. I'd rather use characters that are simply straight lines across the glyph but they already exist at a code point that is rarely supported anymore (U+1FB76-U+1FB7B). Most importantly, I can't combine them to draw 2, 3, or 4 horizontal lines through a character if multiple data series occupy different values in that same block of the graph.

I did some fiddling with the overdraw code points (U+0300-U+03F) that are usually used for diacriticals, but that's a deep rabbit hole with nothing but dead ends for my application.

If there's a way that, from within python, I can construct a custom glyph set to do what I need, that would be the easiest solution to my problem. iTerm2 seems to have everything else in it, and it wouldn't surprise me if there was a way that code could interface with the environment to produce this effect.

Any thoughts?
[Ruby][Sorbet] What to do when the RBI generated by tapioca does not have the expected type
Tags: sorbet, ruby, rails
Published: 2022-08-21 04:13:57

---
title: [Ruby][Sorbet] What to do when the RBI generated by tapioca does not have the expected type
published: true
date: 2022-08-16 00:47:44 UTC
tags: ["Sorbet", "Ruby", "Rails"]
canonical_url: https://note.hiko1129.com/posts/1660610864/
---

<a href="https://note-hiko1129-com.translate.goog/posts/1660610864/?_x_tr_sl=ja&_x_tr_tl=en&_x_tr_hl=ja&_x_tr_pto=wapp" target="_blank" rel=”noopener noreferrer”>Translate ja to en</a>

`sorbet/tapioca/require.rb`を用意していない状態だと、Gemfileでrequire: falseとしているものやGem側がオプショナルなrequireとしているものなどは読み込まれず、RBIファイルには含まれないようです。
`sorbet/tapioca/require.rb`に読み込まれていないものを追加することでRBIファイルに型定義(というか雛形)が含まれる模様。

better_htmlのBetterHtml::Parserの型定義が必要にも関わらずRBIファイルに含まれていない場合には、`sorbet/tapioca/require.rb`に下記のように`better_html/parser`を追加する必要があります(better_htmlはbetter_html/parserをデフォルトでは[読み込まない](https://github.com/Shopify/better-html/blob/main/lib/better_html.rb))。
```
# typed: strict
# frozen_string_literal: true

require 'better_html/parser'
```

## 参考
* https://github.com/Shopify/tapioca#manually-requiring-parts-of-a-gem
JavaScript and DOM
Tags: javascript, dom, beginners
Published: 2022-08-16 00:06:00

1. `.innerHTML` provides the access to change the contents of an element; `.style` provides the access to change the style of an element.
2. `document.body.innerHTML = '<h1>this is a new heading</h1>'`;
3. `document.getElementById('').innerHTML. = ''`;
`document.getElementsByClassName('')[0].innerHTML = ''`;
`document.getElementsByTagName('')[0].innerHTML = ''`;
4. `document.body.style.backgroundColor = 'black'`;
5. `document.body.children[0]` refers to the first element in body.
  `document.getElementById('').parentNode` represents the parent of the element with id ''
6. Create an element:

```
let newHeading = document.createElement('h2');
newHeading.id = 'heading';
newHeading.innerHTML = 'This is a heading';
document.body.appendChild(newHeading);
//Output: add a h2 heading at the bottom of body
```
7.Remove an element:

```
let elementToRemove = document.getElementById('sign');
document.getElementById('parent id').removeChild(elementToRemove)
//Output: remove the element with id='sign' from the parent node.
```
8.Hide an element:
`document.getElementById('').hidden = true`;
9.Add click:

```
let element = document.querySelector('.classname');
element.onclick = function(){
  element.style.backgroundColor = 'black';
  element.style.color = 'white';
  element.innerHTML = 'I turn white';
}
//Output: first element with class='.classname' will change color and bicolor and text content once clicked.
```
Posix error handling in Kotlin/Multiplatform with Angelos Project™
Tags: programming, kotlin, devjournal
Published: 2022-08-15 23:30:23

We recently released the sharp v1.0.0 of [angelos-project-errno](https://github.com/angelos-project/angelos-project-errno), a package used for handling _errno_ numbers in stdlibc. These numbers can be read in Kotlin/Native but not reset because of the compiler using a `val` instead of `var`.

Because of this it is hard, if not impossible to work with POSIX functions properly, especially when it may be required to reset `errno` before making a system function call.

For this purpose we developed a tiny framework to look for posix error handling using simple error predicate functions. Those functions are easy to use higher-order functions that may throw a `PosixError` exception telling the `errno` constant with error message and implemented errno code.

For this to work we had to utilize both JNI for the Jvm side of KMP, and cinterop for the native side thereof. In both cases a PosixError is thrown with proper message telling the nature of the problem. This type of micro framework design lets developers work close to the original methods used in POSIX implementations and at the same time handle as much logic as possible in Kotlin, and as little as possible in C/C++.

Thereby being able to focus on learning only one universal programming language for allround use, everything from hidden servers to modern mobile applications and other similar uses.
From Local Deploy to Graph Data Science Using Neo4J!
Tags: datascience, database, opensource, machinelearning
Published: 2022-08-15 23:21:36

#Neo4J: About, Cases, Query Language, Integrations, AI!

This post briefly summarizes Neo4J, what it is, who uses it, what it’s for, and much more!

Find out more at:

https://medium.com/mlearning-ai/from-local-deploy-to-graph-data-science-using-neo4j-1cb68f1ac2

Thanks for reading; share this post! :)
Day 128: The Paper done!
Published: 2022-08-15 22:43:06

Hi!
The paper I was working on is finally done! whew! I can now focus on my stuff there is a lot going on with my new personal project coming in, Flutter level up scheduled, and work related tasks making time for all of them will be challenging but there is no other choice really. 
Tomorrow I plan to look into Flutter since it's Tuesday I will try to add new changes on the personal project and work on one task for this week work tasks I think that would be enough for the Day 

Signing off...