teleren/devto huggingface dataset:
เปรียบเทียบการจัดการข้อมูลของ ภาษาแบบ Functional อย่าง Elixir ด้วย Immutable Data กับ Go ที่เป็น Mutable Data
Tags: elixir, go, programming
Published: 2020-12-10 09:56:34

เราจะเทียบกันกับโจทย์ง่ายๆคือมีตัวเลขอยู่ชุดหนึ่งเช่น [1, 2, 3, 4, 5] ให้สร้างฟังก์ชันเพื่อแปลงข้อมูลในลิสต์ให้เป็น [2, 4, 6, 8, 10] ซึ่งภาษาที่เราจะเอามาเทียบกันให้ดูคือ Elixir ที่เป็น Functional และจัดการข้อมูลแบบ Immutable กับ Go ที่ถึงแม้จะมีฟังก์ชันเป็น value ได้ก็จริง แต่ตัวภาษาก็จัดการข้อมูลแบบ Mutable

## Elixir

ข้อมูลในลักษณะนี้สำหรับ Elixir จะเก็บเอาไว้ใน list ซึ่งเราสามารถใช้ฟังก์ชัน Enum.map เพื่อให้ทำการเพิ่มค่าในลิสต์เป็น 2 เท่า แล้วได้ list ที่เป็นผลลัพธ์กลับออก

```elixir
// fp_style.exs
defmodule FPStyle do
  def double_element_value(nums) do
    Enum.map(nums, fn x -> x * 2 end)
  end
end

FPStyle.double_element_value([1, 2, 3, 4, 5])
|> IO.inspect
```

เมื่อสั่ง `elixir fp_style.exs` ก็จะได้ผลลัพธ์เป็น `[2, 4, 6, 8, 10]`

## Go

สำหรับ Go เก็บข้อมูลแบบนี้ใน slice ของ int ซึ่งเราสามารถส่ง slice ให้กับพารามิเตอร์ function ซึ่งมันจะแชร์สมาชิกของ slice ร่วมกันทำให้แก้ไขค่าของ slice ได้

```go
package main

import "fmt"

func doubleElementValue(nums []int) {
	for i := range nums {
		nums[i] *= 2
	}
}

func main() {
	nums := []int{1, 2, 3, 4, 5}

	doubleElementValue(nums)

	fmt.Println(nums)

}
```

## เปรียบเทียบ

จากโค้ดทั้งสองแบบ เราจะเห็นแนวคิดที่ทั้งสองภาษาใช้แตกต่างกัน Elixir ที่มี Immutable data ให้ใช้ จะช่วยให้เราคิดในลักษณะ functional ได้ง่ายมาก โดยที่การจัดการข้อมูลนั้นเป็นการสร้างฟังก์ชันที่รับข้อมูลเข้าไป แล้วส่งผลลัพธ์กลับออกมา

ในขณะที่ Go ยังคงเป็น mutable data ที่ให้เราคิดว่าเราจะจัดการข้อมูลในตัวแปรหรือในหน่วยความจำอย่างไร ดังนั้นเวลาเขียนฟักง์ชันของ Go เลยเป็นการมานั่งคิดว่าเราจะส่ง slice เข้าไปแล้วเราจะแก้ไขค่าแต่ละช่องใน slice แบบไหนแล้วผลลัพธ์ที่ได้คือค่าที่เปลี่ยนแปลงใน slice ไม่ใช่ slice ใหม่ที่ส่งกลับออกมา
Excel Formulas to Find the Maximum Value That Ignores all Errors!!
Tags: excelformula, excelformulas
Published: 2020-12-10 11:48:16

---
title: Excel Formulas to Find the Maximum Value That Ignores all Errors!!
published: true
date: 2020-12-10 09:45:31 UTC
tags: ExcelFormula,Excelformulas
canonical_url: https://geekexcel.com/excel-formulas-find-maximum-value-ignores-all-errors/
---

In this tutorial, we will guide you to learn the simple **formulas used to find the maximum value that ignores all errors in Excel Office 365**. Let’s get into this article!! Get an official version of ** MS Excel**  from the following link: [https://www.microsoft.com/en-in/microsoft-365/excel](https://www.microsoft.com/en-in/microsoft-365/excel)

[!["Formulas](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/12/Formulas-to-find-the-maximum-value-that-ignores-all-errors.png)](https://geekexcel.com/excel-formulas-find-maximum-value-ignores-all-errors/formulas-to-find-the-maximum-value-that-ignores-all-errors/#main)
## General Formula:

- To find the maximum value that ignores errors in Excel.

**=[AGGREGATE](https://geekexcel.com/how-to-find-average-using-aggregate-function/)(4,6,values)**

## Syntax Explanations:

- **AGGREGATE** – In Excel, the [**AGGREGATE Function**](https://geekexcel.com/how-to-find-average-using-aggregate-function/) returns the result of the aggregate in a list or database of values.
- From the above formula, the **number 4** specifies the **maximum value** , and the **number 6** is an option for **ignoring the error**.
- **Values** – It represents the input values from the given worksheets.
- **Comma symbol (,)** – It is a separator which helps to separate a list of values.
- **Parenthesis ()** – The main purpose of this symbol is to group the elements.

## Example:

- Let’s consider the below example image to get the maximum value that ignoring the errors.
- First, we will give the input values in **Column B**.
- Then, enter the given formula in the formula bar section.
- Finally, we will get the result in **Cell D3**.

![Example](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/12/Example-42.png)<figcaption id="caption-attachment-19254">Example</figcaption>

## Closure:

From this article, we guided you to learn the simple **formulas used to find the maximum value that ignores all errors in Excel Office 365**. Hope you like this article. If you have any **suggestions,** feel free to share it with us. To know further updates keep in touch with our website **[Geek Excel](https://geekexcel.com/)** and [**Excel Formulas**](https://geekexcel.com/excel-formula/) **!!**

 

### Read Also:

- **[Formulas to Count with COUNTIF Function in Excel Office 365!!](https://geekexcel.com/wp-admin/post.php?post=17648&action=edit)**
- **[Excel Formulas for Running Count of Occurrence in a List!!](https://geekexcel.com/wp-admin/post.php?post=17602&action=edit)**
- **[Excel Formulas to Create a Two-way summary Count with COUNTIFS!!](https://geekexcel.com/wp-admin/post.php?post=17707&action=edit)**
- **[Formulas to calculate the running total from a range in Excel!!](https://geekexcel.com/wp-admin/post.php?post=17791&action=edit)**
Quirrel Newsletter #3 - Incident Dashboards, Cron RFC
Tags: vercel, nextjs, javascript, react
Published: 2020-12-10 09:40:21

---
title: Quirrel Newsletter #3 - Incident Dashboards, Cron RFC
published: true
description: Quirrel now catches application errors. Also, I published an RFC on improved CRON jobs!
tags: 
  - vercel
  - nextjs
  - javascript
  - react
cover_image: https://pbs.twimg.com/media/EonwhvgXIAEDuWp?format=jpg&name=4096x4096
---

Welcome to the third episode of the Quirrel Newsletter.

This one is a quick one, I just want to let you know about a new feature: The *incident dashboard*.

*"incident"* is what Quirrel calls an error in your application code.
Until now, Quirrel didn't do anything when it encountered one - not exactly optimal, eh?
Fear no longer! Quirrel will now send you an e-mail whenever one of your job handlers fails:

![Incident E-Mails](https://pbs.twimg.com/media/EonwhvgXIAEDuWp?format=jpg&name=4096x4096)

You'll then be able to see the incident's full job payload in the *incident dashboard*:

![Incident Dashboard](https://dev-to-uploads.s3.amazonaws.com/i/0er3sagt7dh88aps3gqs.png)

Since Quirrel jobs are end-to-end-encrypted, the dashboard also allows you to decrypt your job's payloads on the client-side :)

> Quirrel users with on-premise hosted instances can specify how they want to receive incidents using the `INCIDENT_RECEIVER_ENDPOINT` environment variable.

But the incident dashboard is not the only thing that's changed.
I'm currently preparing a big improvement to Cron jobs and published an RFC:

<https://github.com/quirrel-dev/quirrel/issues/31>

If you've got a spare minute (and you most certainly have, if you're reading this), I'd love to get some feedback on that.

Alright, that's it for this episode - a quick one, as promised!

Thanks to all the nice people who helped bring these changes into existence, especially [Max](https://twitter.com/maxfinke)! Really appreciate your support :D 

Best
Simon
How You Learn New Programming Language?
Tags: discuss, beginners, watercooler, webdev
Published: 2020-12-10 09:38:53

# Introduction

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3vyhlv2q94h46ne6ag8g.gif)

Everyday we came to know new programming languages, framework that needs to understand and implement. Sometime we might be stuck on How to begin learning something new technology/language. So here we can discuss methods and techniques that help you to learn and implement.

## My  Method

Whenever a technology/language grab my attention and I have decided to learn it then 
- I tried to know more about it through blogs and video showing the pros and cons and uses.
- After deciding to learn then I tried to find any course for the beginners.
- Along with learning, I tried to make projects that help me to retain knowledge for a longer time.

## Discuss 
- Your way of learning new technology

I am excited to know your method of learning something new.
[Symfony]: Empty token storage when injecting service in an event listener
Tags: symfony, dependencyinjection, php
Published: 2020-12-10 09:38:22

Another Symfony mistery

You might have been struggling to fetch the logged-in user from a listener that includes a UserService class which contains the logic of fetching the logged-in user.

Let's take the below code as an example:

```
//UserService.php

<?php

namespace App\Service;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;


class UserService {

  private $tokenStorage;

  private $currentUser;

  /**
  * @required
  */
  public function setSecurityContext(TokenStorageInterface $tokenStorage) {
    $token = $tokenStorage->getToken();
    if ($token) {
      $this->currentUser = $token->getUser();
    }
  }

  public function getCurrentUser() {
    return $this->currentUser;
  }
}

?>
```


```
//MyListner

<?php
namespace App\Listener;
use Doctrine\Persistence\Event\LifecycleEventArgs;

class MyListener {

  private $userService;

  public function __construct(UserService $userService) {
    $this->userService = $userService;
  }

  public function onFlush(LifecycleEventArgs $args) {

    $currentUser = $this->userService->getCurrentUser();

    var_dump($currentUser); // prints NULL
  }

}
?>

```

**Why the currentUser is NULL ?**

The answer: Doctrine listeners are called whenever a corresponding event occurs. Initialization of them may occur before the security context.

You have two options here:

**The first one**: inject your TokenStorage directly in your Listener and retrieve the token inside your event handler.


```
//MyListner

<?php
namespace App\Listener;
use Doctrine\Persistence\Event\LifecycleEventArgs;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;


class MyListener {

  private $tokenStorage;

  public function __construct(TokenStorageInterface $tokenStorage) {
    $this->tokenStorage = $tokenStorage;
  }

  public function onFlush(LifecycleEventArgs $args) {

    $currentUser = $this->tokenStorage->getToken()->getUser();

    var_dump($currentUser); // prints a UserInterface object
  }

}
?>

```

**The second one**: Fetch the token inside the `getCurrentUser` method.


```
//UserService.php

<?php

namespace App\Service;

use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;

class UserService {

  private $tokenStorage;

  private $currentUser;

  public function __construct(TokenStorageInterface $tokenStorage) {
    $this->tokenStorage = $tokenStorage;
  }


  public function getCurrentUser(TokenStorageInterface $tokenStorage) {
    $token = $tokenStorage->getToken();
    if ($token && is_null($this->currentUser)) {
      $this->currentUser = $token->getUser();
    }

    return $this->currentUser;
  }

}

?>
```

The hidden trick is that you have to call the `getToken` method in order to get a fresh token.


That was it, I hope this blog post was helpful.

Cheers
Excel Formulas to Find the Maximum Value from a Set of Numbers!!
Tags: excelformula, excelformulas
Published: 2020-12-10 11:47:58

---
title: Excel Formulas to Find the Maximum Value from a Set of Numbers!!
published: true
date: 2020-12-10 09:32:45 UTC
tags: ExcelFormula,Excelformulas
canonical_url: https://geekexcel.com/excel-formulas-maximum-value-from-numbers/
---

This page will explain the simple **formulas used to find the maximum value from a set of numbers in Excel Office 365**. Further, you can get to know the basic syntax with the best example. Let’s get started!! Get an official version of ** MS Excel**  from the following link: [https://www.microsoft.com/en-in/microsoft-365/excel](https://www.microsoft.com/en-in/microsoft-365/excel)

[!["Formulas](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/12/Formulas-to-find-the-maximum-value.png)](https://geekexcel.com/excel-formulas-maximum-value-from-numbers/formulas-to-find-the-maximum-value/#main)
## General Formula:

- The below formula will help to get the maximum value.

**=[MAX](https://geekexcel.com/how-to-use-excel-max-function-in-office-365-with-examples/)(range)**

## Syntax Explanations:

- **MAX** – The [**MAX Function**](https://geekexcel.com/how-to-use-excel-max-function-in-office-365-with-examples/) helps to return the largest numeric value from the range of input values.
- **Parenthesis ()** – The main purpose of this symbol is to group the elements.
- **Range** – It represents the input ranges.

## Example:

- Let’s consider the below image to find the maximum value from a set of numbers.
- Here, we will give the input values from **Column C** to **Column G**.
- Then, enter the given formula in the formula bar section.
- Finally, we will get the result in **cell I4**.

![Example](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/12/Example-47.png)<figcaption id="caption-attachment-19333">Example</figcaption>

## Bottom-Line:

In this article, we guided you to learn the simple **formulas to find the maximum value from a set of numbers in Excel Office 365**. Hope that this article is useful to you. If you have any **suggestions,** feel free to share it with us. To know further updates keep in touch with our website **[Geek Excel](https://geekexcel.com/)** and [**Excel Formulas**](https://geekexcel.com/excel-formula/) **!!**

### Read Ahead:

- **[Formulas to Count Sold and Remaining Things in Excel Office 365!!](https://geekexcel.com/wp-admin/post.php?post=17382&action=edit)**
- **[Excel Formulas to Count Visible Rows Only with Criteria!!](https://geekexcel.com/wp-admin/post.php?post=17519&action=edit)**
- **[Formulas to Count Multiple Criteria and OR Logic with COUNTIFS!!](https://geekexcel.com/wp-admin/post.php?post=17550&action=edit)**
- **[Excel Formulas: Histogram with Frequency in Office 365!!](https://geekexcel.com/wp-admin/post.php?post=17567&action=edit)**
Arrays vs Lists
Tags: differences, arrays, lists, python
Published: 2020-12-10 09:31:12

Arrays and Lists are almost similar but a little different.
Array is a container which can hold a fix number of items and these items should be of the same type. 
List are used to store multiple items in a single variable. 

1. SIZE: 
Array - Fixed size, as resizing is expensive.
List - It has dynamic size.

2. INSERSIONS/DELETIONS:
Array - Elements are usually shifted, they are inefficient.
List - There is not shifting, hence, efficient.

3. ACCESS:
Array - Random access is suitable, i.e. efficient indexing.
List - It is not suitable for operations requiring accessing elements by index such as sorting.

4. MEMORY ALLOCATION:
Array - No memory is wasted if the memory is full or almost full, otherwise the memory is wasted.
List - Since memory is allocated dynamically, there is no wastage.

5. SEQUENTIAL ACCESS:
Array - It is faster, because the elements are in contagious memory locations.
List - It is slower, because the elements are not in contagious memory locations.

6. SEARCHING:
Array - It uses binary and linear search.
List - It uses linear search only.

7. ORDER & SORTING:
Array - Elements are stored consecutively.
List - Elements are stored randomly.
Animated glassmorphism login in css and html
Tags: css, html
Published: 2020-12-10 09:23:43

I really like this blury glass effects, so I try to implement something in css and html.

I did't use any thirdparty js lib for the animation as well and it looks awesome (imo) and it was really simple to implement.

Here is jsfiddle:

{% jsfiddle https://jsfiddle.net/mafflerbach/8ervpqw4/5/ result,html,css %}
removeEventListener not working.
Tags: webdev, javascript, beginners
Published: 2020-12-10 09:11:28


I don't seem to understand why I can't remove the event listener where I added a text through insertAdjacentText when clicked. I really hope someone helps me. I've gone through hours trying to debug it.

```javascript
const header = document.querySelector(`header h1`);
const button = document.querySelector(`header button`);

function addText() {
   header.insertAdjacentText(`afterend`, `Yeah`);
   console.log(`yeah`);
}

header.addEventListener(`click`, addText);
button.removeEventListener(`click`, addText);

```
Stack vs queue
Published: 2020-12-10 09:09:30

Stack and Queue are non-primitive data structures. They are used to store data. There are a few differences between them like

1. Working Principle:
Stack: LIFO(Last In First Out)
Queue: FIFO(First In First Out)

2. Operations:
Stack: Pop and Push. Pop operation removes element from list whereas, push operation inserts element in a list.
Queue: Dequeue and Enqueue. Dequeue operation removes element from queue whereas, enqueue adds element to a queue

3. Structure:
Stack: Has only one end from where both insertion and deletion takes place, known as a top
Queue: Has two ends i.e., front and rear end. Front end is used for deletion whereas, rear end is used for insertion

4. Number of points used:
Stack: Contains only one pointer known as the top pointer. It holds the addresses of the last inserted element of the stack
Queue: Contains two pointers, front and rear. Front pointer holds address of first element whereas rear pointer holds address of last element in the queue

5. Visualization:
Stack: It is visualized as a vertical collection
Queue: It is visualized as a horizontal collection

6. Variants:
Stack: It doesn't have any types
Queue: It has three types- priority queue, circular queue and double ended queue.

7. Implementation:
Stack: It is more simple compared to queue
Queue: It is comparatively more complex than stack
Advent of Code 2020 - Day 10
Tags: adventofcode, overthinking, ruby, solution
Published: 2020-12-10 08:59:12

Day 10 started out relatively easy especially using Ruby's `.each_cons(2)` to grab pair and find the difference. the meat of my solution for part 1 is:
```ruby
input.each_cons(2) do |a,b|
  if b-a == 1
    oneJoltCount += 1
  elsif b-a == 3
    threeJoltCount += 1
  end
end
```

Since the product of those 2 counters is the answer, I was done!

# Part 2 - What am I doing?!?
This part was messy since I didn't feel like writing a path or tree like algorithm to count up all the valid options. I did attempt to use Ruby's combination method and test the output for validity, but this was incredibly memory intensive and didn't feel like setting my computer ablaze this evening.

After doing some combination building by hand, a way of checking for "runs" of consecutive integers for a multiplier became the cleanest way to solve this. I would love to put more detail into this post, but I am far too tired and I still have work tomorrow... *gulp*

Anyways, my part two solution:
```ruby
# Part 2 madness
# using chains in order to calculate final total
# chain of 3 = *2, chain of 4 = *4, chain of 5 = *7
input.push(builtIn)
input.unshift(0)
i = 1
previousVal = 0
runCount = 1
product = []
while i < input.count
  if input[i] - previousVal == 1
    runCount += 1
  else
    case runCount
    when 3
      product.push(2)
    when 4
      product.push(4)
    when 5
      product.push(7)
    end
    runCount = 1
  end
  previousVal = input[i]
  i += 1
end
  
puts "Part 2: #{product.inject(:*)}"
```
Packers and Movers Cost Calculator & Estimate
Tags: packers, movers, cost, calculator
Published: 2020-12-10 08:51:47

Packers and Movers Cost Calculator & Estimate - Movingsolutions.in provides cost calculator tool to find the best packers and movers charges, rate & Price in India. Get instant quotes to compare and select our services. Packers and Movers Cost Calculator is easy to use. It saves you from lots of hassles and gives you an approximate price estimate so that you can know if any moving company is giving you expensive moving quote. 

Visit Link: https://www.movingsolutions.in/cost-calculator.html
lazy_names gem, ease console operations
Tags: ruby, rails, opensource
Published: 2020-12-10 08:30:04

Hello guys!

I just wrote a gem which can help with console routine.

A little bit of history, I caught myself mostly redefining constants to shorter versions but by hand, because I needed from time to time models, or some services, or operations and all of them were hidden by some modules (and that's ok you must put your code in namespace modules).   
But I was asking myself do I really needed to type something like `App::SomeEntity::Services::ServiceNamespace::ServiceAction.new.perform` or even bigger.   
Before I was just assigning it to shorter version on my `pry` console load, but that again led to same actions every `pry` console load. So I decided to wrap it in gem. So you have configuration where you put your map real constant => easy/lazy name.  

So I looking for some feedback/critique. Maybe it was already implemented by someone and you could point me. I was using it only localhost for some period of time and finally decided to put in [github](https://github.com/zhisme/lazy_names) and [rubygems](https://rubygems.org/gems/lazy_names), maybe some of you were struggling same issues in your ruby console

Also I inspired by some ideas given to me by other devs, like auto-redefining const on some reducer, so for example
```ruby
# the default one
def shortener(klass_name)
  klass_name.to_s.gsub('::', '')
    .split(/[a-z]/).select { |lt| !lt.empty? }.join
end

shortener(MyClass)
# => MC
shortener(MyModule::MyClass)
# => MMMC
shortener(MyModule::MyModelsNamespace::Module)
# => MMNM
```

The main usage for the gem I see as **Hexagonal Architecture**, where you code highly decoupled by the modules. 

What do you think about the gem, share thoughts with me! :)
Bluetooth connection via HID/HSP profiles (Smartphone/PWA to IoT device)
Tags: pwa, bluetooth, ios, android
Published: 2020-12-10 08:28:57

We are developing an IoT device and face issues with automatic connectivity to the smartphone via Bluetooth, as we have to use a PWA instead of a native app. We consider using a standard profile (e.g. Headset Profile (HSP), Human Interface Device Profile (HID))  to enable communication via Bluetooth between device and PWA. 

 

We now require a workaround for the following issue:

When using HSP/HID, existing connections to the smartphone's hardware (e.g. headset, keyboard) can be interrupted.

 

Have you faced similar issues and do you know workarounds for this?

Are you knowledgeable about alternative connection mechanisms (e.g. NFC, SIM) to connect IoT with PWA incl. pros and cons?