teleren/devto huggingface dataset:
Machine Learning for Beginners
Tags: machinelearning, tensorflow, beginners, python
Published: 2022-06-16 11:48:19

It's amazing how in the tech world and the non-tech world, everywhere you turn, people say AI(Artificial Intelligence), ML(Machine Learning) etc. I know for some, it's more or less thought to be buzz words while others have really gotten interested in knowing what this is all about and what they can do with Machine Learning. The question is, is ML as cool as people(techies) make it sound? YES it is!!!! Is there a barrier to entry? NO there is none!!!. There is room for basically everyone! 

Main Question, How do i learn how to code and design ML algorithms?

1. The first thing, i'd advice is learn the basics or just learn the history. I have written an article on [the history of neural network](https://dev.to/sandrameshack/history-of-neural-network-3ele).

2. Learn python!!! Python is the most used language for ML in the industry and if you want to go into machine learning, you should learn python. There are numerous sites you could learn from and there are numerous youtube videos. However, one i've always given to my students and they have come back better is [the learn python.org.](https://www.learnpython.org/)

3. Practice Practice Practice!!!: Learning to code is more or less learning to use your hands at all times. Practicing and having pet projects will make you the better.

4. Google is your best friend: as a techie, you should learn to research. Learn to look at other people's codes, learn to look for solutions when you get stuck- getting stuck is a good thing and you should learn to ask questions.

5. There are numerous courses on learning ML. Use number 4 above to find one you like. One interesting course i always ask my students or new techies to use is [introduction to tensorflow for deep learning](https://www.udacity.com/course/intro-to-tensorflow-for-deep-learning--ud187).

6. As a learner forget about downloading an IDE(integrated development environment) for now. Also, use number 4 to figure out what an IDE is. What i'd suggest you use for learning is either Jupyter lab or google Colab. However, i strongly recommend google colab. 

7. All you need is a good internet and your laptop for this.

8. PET PROJECTS!!!!- have a pet project!. There should be something you are working. Practice really does make perfect.

On the next blog post, i'd be sharing one of my pet projects and also sharing my thought processes with you.

Goodluck!!! Looking forward to seeing your projects!
Divide Two Integers
Tags: leetcode, dsa, theabbie
Published: 2022-06-16 11:30:40

Given two integers `dividend` and `divisor`, divide two integers **without** using multiplication, division, and mod operator.

The integer division should truncate toward zero, which means losing its fractional part. For example, `8.345` would be truncated to `8`, and `-2.7335` would be truncated to `-2`.

Return _the **quotient** after dividing_ `dividend` _by_ `divisor`.

**Note:** Assume we are dealing with an environment that could only store integers within the **32-bit** signed integer range: `[−231, 231 − 1]`. For this problem, if the quotient is **strictly greater than** `231 - 1`, then return `231 - 1`, and if the quotient is **strictly less than** `-231`, then return `-231`.

**Example 1:**

**Input:** dividend = 10, divisor = 3
**Output:** 3
**Explanation:** 10/3 = 3.33333.. which is truncated to 3.

**Example 2:**

**Input:** dividend = 7, divisor = -3
**Output:** -2
**Explanation:** 7/-3 = -2.33333.. which is truncated to -2.

**Constraints:**

*   `-231 <= dividend, divisor <= 231 - 1`
*   `divisor != 0`

**SOLUTION:**

    class Solution:
        def divide(self, dividend: int, divisor: int) -> int:
            sign = [1, -1][(dividend >= 0) ^ (divisor >= 0)]
            dividend = abs(dividend)
            divisor = abs(divisor)
            res = 0
            while dividend >= divisor:
                temp, i = divisor, 1
                while dividend >= temp:
                    dividend -= temp
                    res += i
                    temp = temp << 1
                    i = i << 1
            return min(max(-2147483648, sign * res), 2147483647)
Learning Cumulocity IoT | Playlist
Tags: cumulocity, iot, dataanalytics, deviceconnectivity
Published: 2022-07-12 08:02:38

---
title: Learning Cumulocity IoT | Playlist
published: true
date: 2022-06-16 11:24:58 UTC
tags: Cumulocity, IoT, DataAnalytics, DeviceConnectivity
canonical_url: https://tech.forums.softwareag.com/t/learning-cumulocity-iot-playlist/258350
---

[![image](https://aws1.discourse-cdn.com/techcommunity/original/3X/d/7/d778f70e41c877d395ed216af6b399b1d696afcb.jpeg)](https://aws1.discourse-cdn.com/techcommunity/original/3X/d/7/d778f70e41c877d395ed216af6b399b1d696afcb.jpeg "image")

## Getting Started with Cumulocity IoT

<iframe src="https://www.youtube.com/embed/videoseries?list=PLexm-BA6Wrr84s_08JopRy91q21_uBkZ9&amp;wmode=transparent&amp;rel=0&amp;autohide=1&amp;showinfo=1&amp;enablejsapi=1" width="480" height="360" frameborder="0" allowfullscreen="" seamless="seamless" sandbox="allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation"></iframe>

Visit the [original post](https://tech.forums.softwareag.com/t/learning-cumulocity-iot-playlist/258350) in the Software AG Tech Community to find all the videos from this playlist.
How to find useless foreign keys in a database
Tags: sql, database, tutorial
Published: 2022-06-16 11:01:51

With times, old databases tend to overgrow with unnecessary or just empty fields. Whilst regular fields are not much of a concern, those with foreign key constraints, especially in tables with millions of records, would needlessly inflate the database file and put performance penalty on every insert/update/delete operation, as appropriate index need to be updated.

For example, an index on a field that holds nothing more than NULL values over a table with 100 000 000 records has a size approximately of 600 MB (true for Firebird 3 database file structure).

The query below helps to spot fields with foreign keys, which contain no more than a given count of unique values (by default, the variable **maxuniqvalues** is set to 1 to find all fields which are empty or contain exactly one value). Additionally, the condition on minimal record count in a table in question could be set through variable **minreccnt**.

The result data set includes the following columns: name of the relation, number of records in the relation, name of the field, value (only the first value is shown), and a list of objects dependent on the field. The latter will help a lot if the field to be deleted later.

Though the code is written in **Firebird SQL** flavor, it could be easily adapted to any modern SQL server.

```sql
EXECUTE BLOCK
  RETURNS(
    rn VARCHAR(31),
    reccnt INTEGER,
    fkfieldname VARCHAR(31),
    val INTEGER,
    dependent VARCHAR(8192)
  )
AS
  DECLARE VARIABLE minreccnt DOUBLE PRECISION = 1000000;
  DECLARE VARIABLE maxuniqvalues DOUBLE PRECISION = 1;
BEGIN
  FOR
    SELECT
      rc.rdb$relation_name,
      CAST((1 / idx.rdb$statistics) AS INTEGER),
      idxsfk.rdb$field_name,
      (SELECT
         LIST(TRIM(d.rdb$dependent_name))
         FROM rdb$dependencies d
         WHERE 
           d.rdb$depended_on_name = rc.rdb$relation_name
           AND 
           d.rdb$field_name = idxsfk.rdb$field_name)
    FROM
      rdb$relation_constraints rc
      JOIN rdb$indices idx
        ON idx.rdb$index_name = rc.rdb$index_name
      JOIN rdb$index_segments idxs
        ON idxs.rdb$index_name = idx.rdb$index_name
        AND idxs.rdb$field_position = 0
      JOIN rdb$relation_constraints rcfk
        ON rcfk.rdb$constraint_type = 'FOREIGN KEY'
        AND rcfk.rdb$relation_name = rc.rdb$relation_name
      JOIN rdb$indices idxfk
        ON idxfk.rdb$index_name = rcfk.rdb$index_name
      JOIN rdb$index_segments idxsfk
        ON idxsfk.rdb$index_name = idxfk.rdb$index_name
        AND idxsfk.rdb$field_position = 0
    WHERE
      rc.rdb$constraint_type = 'PRIMARY KEY'
      AND
      (idx.rdb$statistics > 0 
        AND idx.rdb$statistics < (1.0 / :minreccnt))
      AND
      idxfk.rdb$statistics >= (1.0 / :maxuniqvalues)
    ORDER BY
      idx.rdb$statistics ASC
    INTO
      :rn, :reccnt, :fkfieldname, :dependent
  DO BEGIN
    EXECUTE STATEMENT 
      'SELECT FIRST 1 ' || 
      :fkfieldname || 
      ' FROM ' || 
      :rn
      INTO :val;
    SUSPEND;
  END
END
```
Check if Every Row and Column Contains All Numbers
Tags: leetcode, dsa, theabbie
Published: 2022-06-16 11:00:47

An `n x n` matrix is **valid** if every row and every column contains **all** the integers from `1` to `n` (**inclusive**).

Given an `n x n` integer matrix `matrix`, return `true` _if the matrix is **valid**._ Otherwise, return `false`.

**Example 1:**

![](https://assets.leetcode.com/uploads/2021/12/21/example1drawio.png)

**Input:** matrix = \[\[1,2,3\],\[3,1,2\],\[2,3,1\]\]
**Output:** true
**Explanation:** In this case, n = 3, and every row and column contains the numbers 1, 2, and 3.
Hence, we return true.

**Example 2:**

![](https://assets.leetcode.com/uploads/2021/12/21/example2drawio.png)

**Input:** matrix = \[\[1,1,1\],\[1,2,3\],\[1,2,3\]\]
**Output:** false
**Explanation:** In this case, n = 3, but the first row and the first column do not contain the numbers 2 or 3.
Hence, we return false.

**Constraints:**

*   `n == matrix.length == matrix[i].length`
*   `1 <= n <= 100`
*   `1 <= matrix[i][j] <= n`

**SOLUTION:**

    class Solution:
        def checkValid(self, matrix: List[List[int]]) -> bool:
            n = len(matrix)
            for i in range(n):
                row = set(matrix[i])
                col = set([matrix[j][i] for j in range(n)])
                if len(row) != n or len(col) != n:
                    return False
            return True
Android — Spring & Fling Animations with Jetpack compose
Tags: android, kotlin, animations, jetpackcompose
Published: 2022-06-16 10:37:52


How to create physics-based animation such as fling and spring animation in jetpack compose?

We will explore Compose [animations](https://blog.canopas.com/animations-in-jetpack-compose-with-examples-48307ba9dff1) API to create physics-based cool animations.

**What we’re going to implement**

1. Spring release animation
2. Fling animation
3. Chain spring animations

But first, let’s get familiar with spring animation. Spring is physics-based animation, unlike other animations, it adds a more natural and smooth effect in motion.

In [Jetpack compose](https://blog.canopas.com/progress-animations-in-jetpack-compose-with-examples-eb76cc28fbb6), we have spring AnimationSpec to customize animations. SpringSpec takes three parameters.

1. DampingRatio — define the bouncy of spring. The lower the damping ratio, the higher the bounciness. The default value is DampingRatioNoBouncy

2. Stiffness — is something like animation duration, it defines the speed of spring to the final position. The default value is Spring.StiffnessMedium

3. VisibilityThreshold — specifies the visibility threshold.

Check out the project on [github](https://gist.github.com/cp-radhika-s/b0920ec0d27dcb04816cb9ef226cec7b) for the complete working solution and example.

For full version of this post, visit [canopas blog](https://blog.canopas.com/android-spring-fling-animation-in-jetpack-compose-64b2a2e54c88) .
PHP: Array filtering by allowed key list
Tags: php, array, recipe
Published: 2022-06-16 10:35:17


[[👀DEMO](https://onlinephp.io/c/019e5)]


```PHP
<?php

// PHP Versions and Options (7.3.33)

class Tools
{
    public static function filter_keys_allowed_list(
        array $arr = [],
        array $allowed = []): array
    {
        return array_filter(
            $arr,
            function ($key) use ($allowed) {
                return in_array($key, $allowed);
            },
            ARRAY_FILTER_USE_KEY
        );
    }
}
$arr = [
    'EUR' => '€96.06',
    'GBP' => '£82.42',
    'JPY' => '¥13,287.09',
    'USD' => '$1',
];
$allowed = ['EUR', 'GBP', 'JPY'];

var_dump(Tools::filter_array_keys_list($arr, $allowed));

```
Keep Multiplying Found Values by Two
Tags: leetcode, dsa, theabbie
Published: 2022-06-16 10:30:41

You are given an array of integers `nums`. You are also given an integer `original` which is the first number that needs to be searched for in `nums`.

You then do the following steps:

1.  If `original` is found in `nums`, **multiply** it by two (i.e., set `original = 2 * original`).
2.  Otherwise, **stop** the process.
3.  **Repeat** this process with the new number as long as you keep finding the number.

Return _the **final** value of_ `original`.

**Example 1:**

**Input:** nums = \[5,3,6,1,12\], original = 3
**Output:** 24
**Explanation:** 
- 3 is found in nums. 3 is multiplied by 2 to obtain 6.
- 6 is found in nums. 6 is multiplied by 2 to obtain 12.
- 12 is found in nums. 12 is multiplied by 2 to obtain 24.
- 24 is not found in nums. Thus, 24 is returned.

**Example 2:**

**Input:** nums = \[2,7,9\], original = 4
**Output:** 4
**Explanation:**
- 4 is not found in nums. Thus, 4 is returned.

**Constraints:**

*   `1 <= nums.length <= 1000`
*   `1 <= nums[i], original <= 1000`

**SOLUTION:**

    class Solution:
        def findFinalValue(self, nums: List[int], original: int) -> int:
            nums = set(nums)
            while original in nums:
                original*= 2
            return original
Free, Opensource Tailwind CSS Devtools
Tags: webdev, opensource, css, tailwindcss
Published: 2022-06-16 10:22:21

👋 Hey here, I just created Tails Devtools ... A Browser extension for Tailwind CSS Developer.

https://github.com/vechai/tails-devtools

Features 🔥
🗂 Easily debugging with Tailwind utility class
✨ Support autocompletion for JIT mode.
✔️ Custom config support.

Hope it will make it easier for developers to use Tailwind CSS  😄
Find Resultant Array After Removing Anagrams
Tags: leetcode, dsa, theabbie
Published: 2022-06-16 10:00:44

You are given a **0-indexed** string array `words`, where `words[i]` consists of lowercase English letters.

In one operation, select any index `i` such that `0 < i < words.length` and `words[i - 1]` and `words[i]` are **anagrams**, and **delete** `words[i]` from `words`. Keep performing this operation as long as you can select an index that satisfies the conditions.

Return `words` _after performing all operations_. It can be shown that selecting the indices for each operation in **any** arbitrary order will lead to the same result.

An **Anagram** is a word or phrase formed by rearranging the letters of a different word or phrase using all the original letters exactly once. For example, `"dacb"` is an anagram of `"abdc"`.

**Example 1:**

**Input:** words = \["abba","baba","bbaa","cd","cd"\]
**Output:** \["abba","cd"\]
**Explanation:**
One of the ways we can obtain the resultant array is by using the following operations:
- Since words\[2\] = "bbaa" and words\[1\] = "baba" are anagrams, we choose index 2 and delete words\[2\].
  Now words = \["abba","baba","cd","cd"\].
- Since words\[1\] = "baba" and words\[0\] = "abba" are anagrams, we choose index 1 and delete words\[1\].
  Now words = \["abba","cd","cd"\].
- Since words\[2\] = "cd" and words\[1\] = "cd" are anagrams, we choose index 2 and delete words\[2\].
  Now words = \["abba","cd"\].
We can no longer perform any operations, so \["abba","cd"\] is the final answer.

**Example 2:**

**Input:** words = \["a","b","c","d","e"\]
**Output:** \["a","b","c","d","e"\]
**Explanation:**
No two adjacent strings in words are anagrams of each other, so no operations are performed.

**Constraints:**

*   `1 <= words.length <= 100`
*   `1 <= words[i].length <= 10`
*   `words[i]` consists of lowercase English letters.

**SOLUTION:**

    class Solution:
        def removeAnagrams(self, words: List[str]) -> List[str]:
            stack = []
            for w in words:
                if len(stack) == 0 or sorted(w) != sorted(stack[-1]):
                    stack.append(w)
            return stack
Remove Duplicates From Sorted Linked List.
Tags: c, linkedlist, beginners
Published: 2022-06-16 09:59:06

Suppose you are given a sorted linked list, you need to traverse a linked list, remove the duplicates from the list if exists and then print the resultant sorted linked list.

**Example 1 :**

Input : Linked List : 1, 2, 2, 3, 3, 4, 5
Output : Linked List after removing duplicates : 1, 2, 3, 4, 5

**Example 2 :**

Input : Linked List : 5, 5, 6, 7, 8, 8
Output : Linked List after removing duplicates : 5, 6, 7, 8

## Steps :
 

* Declare two pointers `currentNode` and `nextNode` of type `struct  node`.

* Make `currentNode` to point the `head` node of the linked list.

*  Keep iterating through the linked list until last node is reached. 

* Compare the data of current node with the data of next node.

* If they are equal, then detach one of the node(which is considered as duplicate) from the list by saving its neighbour node's address into pointer `nextNode` i.e., `nextNode = currentNode->next->next`. Then break the link between current node and the duplicate node and attach the current node to the node pointing to by pointer  `nextNode` i.e.,  `currentNode->next = nextNode`. 

* If not, then continue traversing the linked list.

* Finally, print the linked list.

## C program that removes the duplicates from sorted linked list : 

```
*******************************************************************************/
#include <stdio.h>
#include <stdlib.h> 
  
struct node
{
    int data;
    struct node * next;
};
  
void displayLL(struct node * head)
{
    struct node * temp;
    temp = head;
    temp=head;
    while(temp!=0)
    {
       printf("%d ",temp->data);
       temp = temp->next;
    }
}
 
void removeDup(struct node *head)
{
    struct node *currentNode = head;
    struct node *nextNode;
        
    while(currentNode != NULL && currentNode->next != NULL)
  {
       if(currentNode->data == currentNode->next->data )
       {   
           nextNode = currentNode->next->next;
        if(nextNode == NULL)
           {
             currentNode->next = NULL;
             break;
           }
           currentNode->next = nextNode;
       }   
       if(currentNode->data != currentNode->next->data)
       {
           currentNode = currentNode->next;
       }
   }
    printf("\n--------------------------------\n");
    printf("Linked List after removing duplicates : ");
    displayLL(head);
}
 
int main()
{
   struct node *head = 0, *newnode, *temp; 
   int n, choice, newdata;
 
// Create Linked List // 
 
   printf("Enter the number of nodes in the list : ");
   scanf("%d", &n);
   for(int i = 1; i<=n; i++)
   {
     newnode = (struct node *)malloc(sizeof(struct node));
     printf("Enter the data%d : ", i);
     scanf("%d", &newnode->data);
     newnode->next = 0;
     if(head == 0)
     {
        head = temp = newnode;
     } 
     else
       { 
        temp->next = newnode;
        temp = newnode;
       }
    }
   printf("--------------------------------\n");
   printf("Linked list : ");
  
   displayLL(head);
   removeDup(head);
}
```

### For more detail watch this [video](https://www.youtube.com/watch?v=U6ZbrYQVYzA).
Remove Duplicates From Array
Tags: javascript, beginners
Published: 2022-06-16 09:52:59

Assume we have a list of numbers that looks like this:

```js
[1, 2, 4, 5, 4, 2];
```

## How can we remove the duplicates?
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2z4qrs3lfe2p1uz277lp.gif)
 

In this short tutorial, we are going to learn two methods that we can use to remove duplicates from an array.


## 1. Use a `for-loop`?

```js
let numbers = [1, 2, 4, 5, 4, 2];
let numbersWithoutDuplicates = [];
for (let i = 0; i < numbers.length; i++) {
  if (!numbersWithoutDuplicates.includes(numbers[i])) {
    numbersWithoutDuplicates.push(numbers[i]);
  }
}

console.log(numbersWithoutDuplicates);
// => [ 1, 2, 4, 5 ]
```

### What are we doing here?

1. We have declared a `numbersWithoutDuplicates` and assigned to an empty array. This variable will finally hold our numbers after removing duplicates

1. We are iterating through all the numbers using a for-loop

1. For each iteration, we are checking if the current number is in our `numbersWithoutDuplicates` array.

1. If the current number is in the array, we do nothing, otherwise we add the number

1. Finally, we are printing out our non-duplicate array

The for-loop can be re-written much more succinctly using a `for-of` loop as below:
```js
let numbers = [1, 2, 4, 5, 4, 2];
let numbersWithoutDuplicates = [];
for (let number of numbers) {
  if (!numbersWithoutDuplicates.includes(number) {
    numbersWithoutDuplicates.push(number);
  }
}

console.log(numbersWithoutDuplicates);
// => [ 1, 2, 4, 5 ]
```

## 2. Use Set?
We can use a set to automatically exclude duplicates from our array.

> Mathematically, a set is a collection of items where order and repetition is ignored.

In JavaScript we can create a set out of an array object and this will simply eliminate the duplicates.

Let us see how this works:

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

let numbersWithoutDuplicates = [...new Set(numbers)];
// populate a new array with non-duplicate numbers
// using the spread operator

console.log(numbersWithoutDuplicates);
// => [ 1, 2, 4, 5 ]
```

## Yaahs! 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vm9yga2vnq3dy31j82iz.gif)
We just learned two methods on how to remove duplicates from an array. 

Which other cool ways do you know how to remove duplicates from arrays?
Adabas & Natural in the Cloud | Playlist
Tags: adabas, natural, naturalone
Published: 2022-07-11 11:00:50

---
title: Adabas & Natural in the Cloud | Playlist
published: true
date: 2022-06-16 09:35:16 UTC
tags: Adabas, Natural, NaturalONE
canonical_url: https://tech.forums.softwareag.com/t/adabas-natural-in-the-cloud-playlist/258347
---

[![image](https://aws1.discourse-cdn.com/techcommunity/original/3X/8/5/8508293dc6e4e81f6a18eadaca0a59b04c11cb20.jpeg)](https://aws1.discourse-cdn.com/techcommunity/original/3X/8/5/8508293dc6e4e81f6a18eadaca0a59b04c11cb20.jpeg "image")

## Adabas & Natural in the Cloud

<iframe src="https://www.youtube.com/embed/videoseries?list=PL3HwmrSYjxiMLL434uBzNoD_uaTmnM3FR&amp;wmode=transparent&amp;rel=0&amp;autohide=1&amp;showinfo=1&amp;enablejsapi=1" width="480" height="360" frameborder="0" allowfullscreen="" seamless="seamless" sandbox="allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation"></iframe>


Visit the [original post](https://tech.forums.softwareag.com/t/adabas-natural-in-the-cloud-playlist/258347) in the Software AG Tech Community to find all the videos from this playlist.
Next Greater Element II
Tags: leetcode, dsa, theabbie
Published: 2022-06-16 09:30:38

Given a circular integer array `nums` (i.e., the next element of `nums[nums.length - 1]` is `nums[0]`), return _the **next greater number** for every element in_ `nums`.

The **next greater number** of a number `x` is the first greater number to its traversing-order next in the array, which means you could search circularly to find its next greater number. If it doesn't exist, return `-1` for this number.

**Example 1:**

**Input:** nums = \[1,2,1\]
**Output:** \[2,-1,2\]
Explanation: The first 1's next greater number is 2; 
The number 2 can't find next greater number. 
The second 1's next greater number needs to search circularly, which is also 2.

**Example 2:**

**Input:** nums = \[1,2,3,4,3\]
**Output:** \[2,3,4,-1,4\]

**Constraints:**

*   `1 <= nums.length <= 104`
*   `-109 <= nums[i] <= 109`

**SOLUTION:**

    class Solution:
        def nextGreaterElements(self, nums: List[int]) -> List[int]:
            n = len(nums)
            op = []
            for i in range(n):
                found = False
                for j in range(i + 1, i + n + 1):
                    if nums[j % n] > nums[i]:
                        op.append(nums[j % n])
                        found = True
                        break
                if not found:
                    op.append(-1)
            return op