teleren/devto huggingface dataset:
Query with jsonpath
Tags: webdev
Published: 2021-12-02 11:38:04

If you work with REST interfaces for any amount of time, you'll run into "[json path](https://github.com/json-path/JsonPath)". You can extract and manipulate the json received with an API call. 

If you take a look at the above-linked repo, or perhaps an [online evaluator](https://jsonpath.com/), you'll see some examples that are easy to grok, but one thing that's a little hidden is the way you can query for one thing, but return another. 

For instance, if you have json which lists folders and files in a given folder, something like: 

```
{
  "total_count": 3,
  "entries": [
    {
      "type": "folder",
      "id": "15136111",
      "sequence_id": "0",
      "etag": "0",
      "name": "202110"
    },
    {
      "type": "folder",
      "id": "15136222",
      "sequence_id": "0",
      "etag": "0",
      "name": "202111"
    },
    {
      "type": "file",
      "id": "8913111",
      "file_version": {
        "type": "file_version",
        "id": "958222",
        "sha1": "45cd8db245a5bd3ab79b6f5150a928ff7d0d18bc"
      },
      "sequence_id": "0",
      "etag": "0",
      "sha1": "45cd8db245a5bd3ab79b6f5150a928ff7d0d18bc",
      "name": "combofile3.pdf"
    }
  ],
  "offset": 0,
  "limit": 100,
  "order": [
    {
      "by": "type",
      "direction": "ASC"
    },
    {
      "by": "name",
      "direction": "ASC"
    }
  ]
}
```
Say you want the id of the folder that is named "202111", which you know because all your folders are named consistently like that. Use this `json path` to get it: 

```
.entries[?(@.name=="202111")].id
```

(you might need `.0.entries...` or `0.entries` depending on the circumstances)

In "entries", that looks for an entry with a name of "202111", and returns its id. Then you can use that id to, say, post new items to that folder. Sweet.
Apama Advent Calendar - 02 Dec 2021 - Apama anywhere from multi-cloud to ThinEdge
Tags: apama, iot, cumulocity
Published: 2021-12-03 11:55:43

---
title: Apama Advent Calendar - 02 Dec 2021 - Apama anywhere from multi-cloud to ThinEdge
published: true
date: 2021-12-02 11:50:07 UTC
tags: #apama, iot, #cumulocity
canonical_url: https://tech.forums.softwareag.com/t/apama-advent-calendar-02-dec-2021-apama-anywhere-from-multi-cloud-to-thinedge/253649
---

It´s Day #2 of a short series of brief tips, tricks, hints, and reminders of information relating to the Apama Streaming Analytics platform, both from Software AG as well as from the community.

Did you know that Apama Streaming Analytics is available for deployment in so many different scenarios? Visit the original post in the [Software AG Tech Community](https://tech.forums.softwareag.com/t/apama-advent-calendar-02-dec-2021-apama-anywhere-from-multi-cloud-to-thinedge/253649) to learn more about every scenario.
_  
_Note that some posts may be published a day or two early or late (e.g. Mon-Fri) so you may find you have bonus days with more than post!_
System Design : Maintainability
Tags: systemdesign, architecture
Published: 2021-12-02 11:49:43

Hello :smile:
Today we are going to present an important concepts in system design which is Maintainability . It is a small introduction we will go deeper in others posts.



## What is Maintainability ?
There is not a single definition but in the context of system design , a system is maintainable when maintainance operations are done with no pain . Saying that you can ask to me but how to build a system and keep in mind maintainability ? There is three core concepts **Operability** , **Simplicity** , **Evolvability**.

So How to achieve these three concepts ? :disappointed_relieved:



## 1. Operability 
> “THE MOST AMAZING ABSTRACTIONS, CLEANEST CODE, OR BEAUTIFUL ALGORITHMS ARE MEANINGLESS IF YOUR CODE DOESN’T RUN WELL ON PRODUCTION.”

DAVID COPELAND

Here it is about operate on unplanned interventions , for example when there is a problem in our system , ho much time does it take us to make the system running normally ?
this is why we talk about minimizing time and effort when there is a bugs or error in the system . if this time decrease every time our system become more operable .

Clearly said:

> A highly operable software system is one that minimizes the time and effort needed for unplanned interventions (whether manual or automated) in order to keep the system running; similarly, a software system with good operability will make diagnosis and anticipation of errors straightforward.


## 2. Simplicity 
Make a system simple , it is one of the hardest thing possible because make something simple is much harder than making it difficult. So The simplicity is important for the maintainability because it aims to push us doing things not only for us but also for the others persons that will integrate and work on our system . Google or Facebook are here for many years now how have they make their system simple to understand for the newest person that will work with them . The response is **Abstraction** , it is the tool that breaks large system in small components.

look what M. Kleppmann says 
>One of the best tools we have for removing accidental complexity is abstraction. A good abstraction can hide a great deal of implementation detail behind a clean,
simple-to-understand façade. A good abstraction can also be used for a wide range of different applications. Not only is this reuse more efficient than re-implementing a similar thing multiple times, but it also leads to higher-quality software, as quality improvements in the abstracted component benefit all applications that use it.



## 3. Evolvability 
This simply means **making change easy** , and we know how much it is important in a system . Evolvability is highly link to Simplicity more a system is simple more we can modify it as simple as that . In the agile community to make a software evolve there is the so called TDD . But what are the tools to helps us achieve evolvability at the Data System Level ? :wink: stay tuned we will respond to that question.




Thanks for Reading :blush:
If you want to talk to me , email me at devbyjesus@gmail.com
See you next time by the grace of JESUS.
Day 53 of 100 Days of Code & Scrum: Finished First Prototype of my Business Page
Tags: 100daysofcode, beginners, javascript, productivity
Published: 2021-12-02 11:28:54

Good day, everyone!

I finally finished deploying my [business website](https://www.rammina.com/) prototype.

![Rammina Hero Banner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bx11dlxumub8yaguur7u.jpg)

It's nothing amazing, and it is only the homepage so far. I am pretty happy with the color scheme and the functional e-mail contact form, and I think it contains the necessary information for clients to interact with me. I will most likely move on to my personal blog, unless there are urgent bugs that need fixing.

Anyway, let's move on to my daily report!

## Yesterday

I did the initial set up on Netlify deployment for my business website, but it didn't work out because of incompatibility with `next/image`.

## Today

Here are the things I learned and worked on today:

### Company Website

- decided to deploy it to Vercel instead of Netlify, because it natively supports `Image Optimization`.
- fixed production bugs with AWS API Gateway CORS (I didn't add the domain address to the allowed list).
- add custom Error 404 page.
- replace favicon image with the company logo.
- add optimized link tag for Google fonts.
- fixed missing image placeholders.
- remove unnecessary files.

### Scrum

- I did some practice flashcards for Scrum.
- reviewed some of the things I've learned before.

Thank you for reading! I hope everyone's doing well.

![Rammina Thank You Banner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x9ayfxxxaz2g2hfcqbsk.png)

### Resources/Recommended Readings

- [Deployment | Next.js](https://nextjs.org/docs/deployment)
- [Scrum Master learning pathway | Scrum.org](https://www.scrum.org/pathway/scrum-master)
- [The 2020 Scrum Guide](https://scrumguides.org/scrum-guide.html)
- [Mikhail Lapshin's Scrum Quizzes](https://mlapshin.com/index.php/scrum-quizzes/)

### DISCLAIMER

**This is not a guide**, it is just me sharing my experiences and learnings. This post only expresses my thoughts and opinions (based on my limited knowledge) and is in no way a substitute for actual references. If I ever make a mistake or if you disagree, I would appreciate corrections in the comments!

<hr />

### Other Media

Feel free to reach out to me in other media!

<span><a target="_blank" href="https://www.rammina.com/"><img src="https://res.cloudinary.com/rammina/image/upload/v1638444046/rammina-button-128_x9ginu.png" alt="Rammina Logo" width="128" height="50"/></a></span>

<span><a target="_blank" href="https://twitter.com/RamminaR"><img src="https://res.cloudinary.com/rammina/image/upload/v1636792959/twitter-logo_laoyfu_pdbagm.png" alt="Twitter logo" width="128" height="50"/></a></span>

<span><a target="_blank" href="https://github.com/Rammina"><img src="https://res.cloudinary.com/rammina/image/upload/v1636795051/GitHub-Emblem2_epcp8r.png" alt="Github logo" width="128" height="50"/></a></span>
[Binary Search]Skydivers
Published: 2021-12-02 11:10:47

https://binarysearch.com/problems/Skydivers
You are given a list of integers `nums` where each value represents a group of people looking to skydive together. You are also given `k` representing the number of days the skydiving facility is open for.

Return the minimum capacity of the plane you need to be able to fulfill all requests in `k` days. Note that requests should be fulfilled in the order they were given and a plane can only have one flight per day.

**Constraints**

- `n ≤ 10,000` where `n` is the length of `nums`.

### Example 1



#### **Input**

```
nums = [13, 17, 30, 15, 17]
k = 3
```

#### **Output**

```
32
```

#### **Explanation**

A `32` person airplane can group the requests by `[13, 17], [30], [15, 17]`.

---


# Intuition

Binary Search

1. left is the maximum group of people
2. right is the whole people of groups
3. need to calculate minimal capacity, so it needs binary search left boundary

# Implementation

Binary Search Left Boundary Template

```java
class Solution {
    public int search(int[] nums, int target) {
        int left = 0;
        int right = nums.length - 1;
        while (left < right) {
            int mid = left + (right - left) / 2;
            if (nums[mid] < target) {
                left = mid + 1;
            } else {
                right = mid;
            }
        }
        return nums[left] == target ? left : -1;
    }
}
```

## Time Complexity

O(*n*log*n*): every time you change capacity, you need to loop the nums again

## Space Complexity

O(1): just few varieties to store left, right and capacity days

---

```java
import java.util.*;

class Solution {
    public int solve(int[] nums, int k) {
        int max = 0, sum = 0;
        for (int num : nums) {
            max = max > num ? max : num;
            sum += num;
        }
        int left = max, right = sum;
        while (left < right) {
            int capacity = (left + right) / 2;
            int day = 1, peopleOnTheDay = 0;
            for (int groupOfPeople : nums) {
                if (peopleOnTheDay + groupOfPeople <= capacity) {
                    peopleOnTheDay += groupOfPeople;
                } else {
                    peopleOnTheDay = groupOfPeople;
                    day++;
                }
            }
            if (day > k) {
                left = capacity + 1;
            } else {
                right = capacity;
            }
        }

        return left;
    }
}
```
Dockerize Vite+ReactJS application
Tags: vite, react, docker, typescript
Published: 2021-12-02 11:08:01

This post shows how to dockerize a ReactJS app created with Vite using `react-typescript` template. 
## Implementation
In my opinion, the best way to do this goal, is using **nginx** image
## Project config
*package.json*

     "scripts":  {
     "dev":  "vite",
     "build":  "tsc && vite build",
     "serve":  "vite preview"
     },
   Folders structure

       | --dist
       | --src
       | --.dockerignore
       | --Dockerfile
       | --package.json
       | --package-lock.json
       | --deploy 
       ----| --nginx
       --------| --nginx.config
    
   *nginx.config* file in folder `deploy/nginx`

    map $sent_http_content_type $expires {
     default                    off;
     text/html                  15m;
     text/css                   15m;
     application/javascript     15m;
     ~image/                    15m;
    }
    server {
      
     listen 80;
     root   /usr/share/nginx/html;
     index  index.html;
     etag on;
     expires $expires;
     location / {
     try_files $uri @prerender;
     }
     location @prerender {
     proxy_set_header X-Prerender-Token GsMLRmorzgxywljuDowD;
      
     set $prerender 0;
     if ($http_user_agent ~* "googlebot|bingbot|yandex|baiduspider|twitterbot|facebookexternalhit|rogerbot|linkedinbot|embedly|quora link preview|showyoubot|outbrain|pinterest\/0\.|pinterestbot|slackbot|vkShare|W3C_Validator|whatsapp|Screaming Frog SEO Spider") {
     set $prerender 1;
     }
     if ($args ~ "_escaped_fragment_") {
     set $prerender 1;
     }
     if ($http_user_agent ~ "Prerender") {
     set $prerender 0;
     }
     if ($uri ~* "\.(js|css|xml|less|png|jpg|jpeg|gif|pdf|doc|txt|ico|rss|zip|mp3|rar|exe|wmv|doc|avi|ppt|mpg|mpeg|tif|wav|mov|psd|ai|xls|mp4|m4a|swf|dat|dmg|iso|flv|m4v|torrent|ttf|woff|svg|eot)") {
     set $prerender 0;
     }
      
     #resolve using Google's DNS server to force DNS resolution and prevent caching of IPs
     resolver 8.8.8.8;
      
     if ($prerender = 1) {
      
     #setting prerender as a variable forces DNS resolution since nginx caches IPs and doesnt play well with load balancing
     set $prerender "service.prerender.io";
     rewrite .* /$scheme://$host$request_uri? break;
     proxy_pass http://$prerender;
     }
     if ($prerender = 0) {
     rewrite .* /index.html break;
     }
     }
     error_page   500 502 503 504  /50x.html;
     location = /50x.html {
     root   /usr/share/nginx/html;
     }
    }

## Dockerfile

    FROM mhart/alpine-node:12 AS builder
    WORKDIR /app
    COPY . .
    RUN yarn install
    RUN yarn run build
    FROM nginx:1.16.0-alpine
    COPY --from=builder /app/dist /usr/share/nginx/html
    RUN rm /etc/nginx/conf.d/default.conf
    COPY deploy/nginx/nginx.conf /etc/nginx/conf.d
    EXPOSE 80
    CMD ["nginx", "-g", "daemon off;"]

## Documentation
[Docker](https://www.docker.com/)
[NGINX](https://www.nginx.com/)
[Vite JS](https://vitejs.dev/)
Top 3 Anime Websites
Published: 2021-12-02 11:05:35

Anime’s popularity has come a long way from just being specific to Japan. The anime industry in Japan has already exceeded $15 billion USD in revenue, thanks to the unprecedented rise of anime popularity overseas. Since a lot of people are getting hooked up to anime, they are also looking for credible websites where they can look for what anime movies/series to watch.

It has since been a long question especially for those outside Japan since anime was originally made for the Japanese only. For the benefit of everyone, here’s a shortlist of top anime websites where you can get credible information about your favorite anime movies and series. 

## **1. Chasing Anime**

Chasing Anime is one of the new and uprising websites when it comes to anime information. They cover all anime genres and even put in important information about what you can find on some anime movies and series. You can check them out and if you’re an avid anime follower, you can even get your content up on their site and get more exposure out of your work.

The website also offers information about your favorite anime characters, so if you’re curious about a backstory of someone in the current anime you’re watching, they are a good place to start. And if you're into [isekai anime](https://chasinganime.com/isekai-anime/best-isekai-anime-list/), they surely have lots of info about them.

## **2. Netflix**

Do I even need to explain them? Apart from the fact that you can watch your favorite animes on [Netflix](https://www.netflix.com/), they also preview anime information for their viewers including a summary of each episode. The only downside with the animes on Netflix is that they cycle through what animes they would be showing.

However, despite them cycling through anime movies and series, they tend to show those that are more favorable to their viewers. Meaning, they base it on the anime’s popularity so you can be sure that they will show your favorites.

## **3. My Anime List**

Perhaps the Wikipedia of animes, [My Anime List](https://myanimelist.net/) has been a long-time go-to source for anime information, even including your favorite mangas. You can even exchange ideas and stories with other people via their community channel. The site has already a lot of followers so you can also be sure that they give out the best information.

Apart from these, they also have a section of upcoming anime episodes so you can easily keep track of when the next episodes of your favorite anime will air.

## **Takeaway**

There are certainly a lot of websites if you are wanting anime information, though you really have to be careful with some. With all the websites out there, only a handful give out credible information regarding your favorite animes. These websites are just a shortlist of some of them, but you can certainly look for other ones if you feel that they lack information.
Introduction To Dot Net: Why Is Angular Better Than Dot Net.
Tags: cromacampus, cromacampusplacement, dotnetonlinecourse, dotnettraininginnoida
Published: 2021-12-02 10:54:04

Introduction:
Dot Net is an open-source software created by Microsoft that offers a developer platform. It lets a developer create and execute programs in C#, F#, Visual C++, or Visual Basic. In other words, it is software by Microsoft that acts as a programming framework and lets other applications run. It is a massive program that consists of both backend and frontend programming languages. To further know about the workings of this software, one can visit [Dot Net Training in Noida](https://www.cromacampus.com/courses/dot-net-training-in-noida/).

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

Features of Dot Net:

The Dot Net framework allows the designing of portable, scalable, and robust applications within its framework. It is loaded with the features that are required by a developer in building applications according to business needs. Its features make it one of the most recommended software worldwide. One can learn this software from various institutions such as **[Dot Net Online Course](https://www.cromacampus.com/courses/dot-net-online-training-in-india/)**. Here are some of its key features.

Common Environment- There is a common environment for all the Dot Net applications in order to run them. This execution environment is termed the Common Language Runtime. It assures the capability to exchange and make use of information between its different languages.

Common System: - It lets the system maintain data integrity with the code written in different languages. It also protects the data from getting lost while it's being transferred to its equivalent types in other languages.

Multi-language support: - It manages the compilers and provides multi-language support. The datatypes used by the Common Language Runtime are common for all the languages. Therefore, there isn't anything like conversation issues.

Supports Tools: - It provides assistance to several tools like debuggers and profilers. Therefore, it makes it easier for the developer to operate on it.

Manages Security: - Security is one of the major characteristics of Dot Net. The CLR supports the security of the system by checking the code identity.

Why Is Angular Better Than Dot Net?

Angular is a JavaScript framework whereas Dot Net is a web development framework. However, Angular facilitates a developer with better-automated testing for the client as well as the server. Angular comes with an inbuilt set of tools that helps a developer in testing the applications in a much easier way.
Angular also makes designing UI/UX much easier. Above all Angular provides customizations to libraries and extensibility. It also has huge community support on the internet. Apart from these, Angular also lets the developers support the applications.
Abstract Factory Method Pattern
Tags: algorithms, computerscience, beginners, java
Published: 2021-12-02 10:54:54

> Abstract Factory Method(kit) provides an interface for creating suits of related objects without specifying their concrete classes

## Motivation 

Consider an application which supports different standard of appearance and behavior. Each component in a standard should be used together. Hard-coding this standards will pose a problem as it will not be portable. We also should not mix the components that make up the standard.

The Abstract Factory method pattern solves this problem by providing the necessary interface for creating an appropriate class instance. And also enabling clients to work with interfaces, without worrying about the concrete classes.

## Applicability

The abstract factory method pattern can be used in cases where:
- Configuration of the system requires a suite of products.
- Implementation of products must be hidden and only their interface disclosed
- Suites of objects must be used together


## Structure

![Abstract Factory Class diagram](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yvkgcgwt95vctr019bp3.png)

### Participants
- **AbstractFactory:** Interface for methods that create abstract products
- **ConcreteFactory:** Implementation for methods that create abstract products
- **AbstractProduct:** Interface for Product object
- **ConcreteProduct:** Implementation of the AbstractProduct interface.
- **Client:** Use interfaces declared by AbstractFactory and AbstractProduct classes.

### Collaborations

- AbstractFactory transfers the responsibility of product object creation to its concrete sub-
classes

## Advantages

- Promotes loose-coupling between client and concrete 
 products
- Increased flexibility in code as new variants of products can be integrated without changes in client code

## Disadvantages

- Increased complexity in code due to increase in new interfaces and classes

## Implementation

Applications generally need one instance of a Factory, so they are typically implemented as Singletons. The AbstractFactory does not have an implementation for product creation and the `ConcreteProduct` sub-classes commonly define factory methods for this purpose.

## Demo

Following up on our cafe example: 

> There are now several new branches of the cafe and we have managed to change the language of the menu for each branch. But the owners now want each branch to have unique interior design. Each branch will have a different look, the pictures on the wall and the staff uniform should be different.

To solve this problem, we create interfaces for `WallPicture` and `StaffUniform`. Then we create concrete classes that implement these interfaces. After that, we create an abstract `BranchFactory` class that will return `WallPicture` and `StaffUniform` objects. Lastly we will create a static class `FactoryCreator` to generate `BranchFactory` object based on the information passed.

{% replit @eyuelberga/Abstract-Factory-Method-Pattern %}