teleren/devto huggingface dataset:
Developer Dictionary: Data Structures
Tags: beginners, computerscience, codenewbie, firstyearincode
Published: 2020-09-17 18:26:34

**This post is part of a resource called Developer Dictionary. More about why I'm writing this [here](https://connectthedots.dev/developer-dictionary/)**

When you go to the grocery store, do you make a list of things you need to buy? If it's a physical list on a piece of paper, likely you use that during the trip, mentally check off the items and then recycle the paper once you're done. The list serves as temporary storage of items from our working memory. A data structure serves a similar purpose for a program.

Imagine you're writing a program to keep track of books you've read. You'll eventually need to make a list. Maybe you'll want to go through the list and rate each book. For this you would store the book titles in the computer's working memory for the duration of your program (temporary storage).

Each value stored in a computer's memory has an address so that the operating system can find it later. It has a name as well – a variable name given by our program – so that our program can refer to its value. It looks something like this:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/viep98c7bravfwphbm1q.jpg)

So `0x0001` is the address for the operating system. Within our program, instead of `0x0001` we can use `book_one` as the name. But typing `book_one`, `book_two` feels a bit clunky right. And if we can imagine that we're using a continuous block of addresses, could we just use one variable name but have a way to refer to the entire book list? Yes, that is called an array in most programming languages. If we created an array named books, we could refer to each book with `book[1]`, `book[2]`, `book[10]`, etc. That's all there is to it. An array is one type of data structure. Data structures are a shorthand for referring to memory addresses on the computer.

In addition to being a convenient shorthand, most data structures also support useful operations for adding items, finding an item, removing an item, and going through the entire collection of items [Keep reading](https://connectthedots.dev/data-structures/)
Serve a JSON API with GitHub
Tags: github, javascript, html, showdev
Published: 2020-09-17 18:44:22

---
title: Serve a JSON API with GitHub
published: true
date: 2020-09-17 18:18:28 UTC
tags: ["github", "javascript", "html", "showdev"]
canonical_url: https://www.joshkasuboski.com/posts/stats-from-github-file/
---

I wanted to add stats to a site, but I already capture them in a GitHub Repo. Let's just pull from there.

## The Stats Repo

I made a repo that pulls in stats ([kasuboski/stats](https://github.com/kasuboski/stats)). It uses a GitHub Action I made for a [Dev.to](https://dev.to/kasuboski/dev-to-article-stats-github-action-30n4) Hackathon that pulls post stats from Dev.to.

The repo gets periodically updated with a `stats/dev-to.json` file. GitHub lets you browse the contents of files at `raw.githubusercontent.com`. In my case, this file is at [https://raw.githubusercontent.com/kasuboski/stats/main/stats/dev-to.json](https://raw.githubusercontent.com/kasuboski/stats/main/stats/dev-to.json).

## Fetching the data

I have a [landing page](https://joshcorp.co) served from my [Raspberry Pi Cluster](https://www.joshkasuboski.com/posts/home-k8s-raspberry-update/). It was a placeholder with a link to my [personal site](https://www.joshkasuboski.com). Now it also shows stats from my [Dev.to posts](https://dev.to/kasuboski).

[![Stats on the landing page](https://www.joshkasuboski.com/posts/stats-from-github-file/landing-page-stats.png) ](landing-page-stats.png)

The landing page itself is just vanilla HTML/CSS/JS. It uses [mvp.css](https://andybrewer.github.io/mvp/) to get quick styles. You can find the code at [kasuboski/joshcorp-site](https://github.com/kasuboski/joshcorp-site). The javascript needed to add the stats is below. It's just in a `script` tag in the body.

```javascript
function getStats() {
  const stats = document.querySelector('#stats');
  const reactions = document.querySelector('#reactions-value');
  const views = document.querySelector('#views-value');
  const url = 'https://raw.githubusercontent.com/kasuboski/stats/main/stats/dev-to.json';
  fetch(url)
    .then(res => res.json())
    .then(data => {
      console.log(data);
      reactions.innerText = data.public_reactions_count;
      views.innerText = data.page_views_count;
      stats.style.display = "block";
    })
    .catch(err => {
      console.error('Error fetching stats: ', err);
    })
}

window.onload = getStats;
```

I'm sure this probably isn't something GitHub exactly recommends… but as long as you don't have too much traffic it should be fine.
Kamenetsky's Algorithm
Tags: cpp, competitiveprogramming, numbertheory, algorithms
Published: 2020-09-17 18:16:21

**Problem Statement:** *Given an integer n and base B, the task is to find the length of n! in base B.*

**Sample Problem Link:** http://lightoj.com/volume_showproblem.php?problem=1045 

*In this problem set you can use Kamnestsky's Algorithm*

**Approach:**
In order to solve the problem we use Kamenetsky’s formula which approximates the number of digits in a factorial:
*f(x) =    log10( ((n/e)^n) * sqrt(2*pi*n))*

The number of digits in n to the base b is given by-
**logb(n) = log10(n) / log10(b)** 

Hence, by using properties of logarithms, the number of digits of factorial in base b can be obtained by -

**f(x) = ( n* log10(( n/ e)) + log10(2*pi*n)/2  ) / log10(b)**

This approach can deal with large inputs that can be accommodated in a 32-bit integer and even beyond that!

**Solve Link:** https://github.com/Remonhasan/algorithm/blob/master/Kamenetsky%20-Algorithm.cpp
Bread and Butter Django - Building SaaS #58
Tags: python, django, saas
Published: 2020-09-17 18:11:28

{% youtube SVrJayVduiM %}

In this episode, I worked on a views and templates.  There are a number of core pages that are required to flesh out the minimal interface for the app. We're building them.

I began by showing the page that we were going to work on.  I outlined the changes I planned to make, then we started.

The first thing we added was data about the school year, the main model on display in the page.  I showed how to mock in the elements before adding real data.

Once the data was mocked in, I wrote some model methods on `SchoolYear` to get the data that I needed to display.  I created a `display_days` method that will show the days that the school year runs on.

After I had the new method, we plugged it in and continued to expand the remainder of the template.  I used the Django `date` template tag to format some dates.

Then we added buttons for the action elements that the page will have.

To finish the stream, we set the grid layout of where the courses will display for each grade level.

This article first appeared on [mattlayman.com](https://www.mattlayman.com/building-saas/bread-and-butter-django/).
Coding Potions
Tags: codepen, css, pixelart
Published: 2020-09-17 18:09:40

---
title: Coding Potions
published: true
tags: codepen, css, pixelart
---

Coding Potions avatar CSS Pixel Art

{% codepen https://codepen.io/nucliweb/pen/WNrqKYV %}


### You can follow me on...

- **Twitter:** [@nucliweb](https://twitter.com/nucliweb)
- **YouTube:** [JoanLeon](https://www.youtube.com/c/JoanLeon)
- **Instagram:** [@nucliweb](https://www.instagram.com/nucliweb/)
- **GitHub:** [@nucliweb](https://github.com/nucliweb)
Glad to be here!
Published: 2020-09-17 18:06:44

I have been contributing at Colonist.io for the last year writing maps and helping out answering questions on their Discord. I have enjoyed playing Settlers of Catan for many years and have found Colonist as an online source to play remotely with friends during the Covid Quarantine. I like their concept of being able to play for free, or purchase an expansion and then create and host games with your friends (without your friends having to own the game).

For the last 5 years I have been involved in coaching First Lego League (FLL) as a volunteer. Volunteering as Coordinator for the Robotics Club has been a rewarding experience. We do FLL for the first part of the year, then teach programming for the balance of the year. We are training 5th thru 8th graders to code in Javascript, C#, and OpenSCAD (3-D object drawing). We purchased and built a 3-D printer kit (JGAurora). We are hoping to start teaching the kids to do game programming using Canvas, HTML, Typescript, and Javascript.
Serverless Eventing: Google Native with PubSub
Tags: cloudnative, googlecloud, kubernetes, serverlesseventing
Published: 2020-09-23 00:20:50

---
title: Serverless Eventing: Google Native with PubSub
published: true
date: 2020-09-17 18:00:00 UTC
tags: CloudNative,GoogleCloud,Kubernetes,ServerlessEventing
canonical_url: 
---

We have been talking about using an [Eventing Bus](https://thejaysmith.com/titles/serverlessjay/severless-eventing/serverless-eventing-why-you-need-an-eventing-bus/ "Eventing Bus") in this Serverless Eventing series. We have seen examples of using [Kafka](https://thejaysmith.com/titles/serverlessjay/severless-eventing/serverless-eventing-modernizing-legacy-streaming-with-kafka/ 
"Kafka Eventing") and [NATS](https://thejaysmith.com/titles/serverlessjay/severless-eventing/serverless-eventing-cloud-native-messaging-with-nats-streaming-server/") as an Eventing Bus. Both are great solutions in their own right but you know my take, there are a ton of tools in the toolbox.

It's no secret that I work for [Google Cloud](https://cloud.google.com "Google Cloud"). I enjoy it because I get to help users explore some great cloud native technology. One really cool offering that fits perfectly into my Serverless Eventing paradigm is [Cloud PubSub](https://cloud.google.com/pubsub/ "Cloud PubSub"). 



The post [Serverless Eventing: Google Native with PubSub](https://thejaysmith.com/titles/serverlessjay/severless-eventing/serverless-eventing-google-native-with-pubsub/) appeared first on [Jason (Jay) Smith](https://thejaysmith.com).
Task Scheduler in Node app 
Tags: node, npm
Published: 2020-09-17 17:51:18

# Install cron job npm in your project
 you have to install cron on your  nodejs application
you can install the cron by 
     `npm install cron`

# Use cron On your project

```javascript
var CronJob = require('cron').CronJob;
var job = new CronJob('* * * * * *', function() {
  console.log('You will see this message every second');
}, null, true, 'America/Los_Angeles');
job.start();
```
#cron vlaue range

|Name	|Required |Allowed Values|Allowed Special |
|-------|---------|--------------|----------------|
|Seconds|Y        |   0-59     |, - * /.        |
|Minutes|Y       |0-59       |, - * /
|Hours |Y      |0-23         |, - * /
|Day of month|Y  |1-31         |, - * ? / L W C
|Month| Y | 0-11 or JAN-DEC | , - * /
|Day of week| Y |1-7 or SUN-SAT |, - * ? / L C #
|Year|N|empty or 1970-2099|, - * /

these value are going to use use in the cron job

# Some example of creating cron


|Expression                  | 	Means|
|----------------------------|----------|
|0 0 12 * * ?|	Fire at 12:00 PM (noon) every day
|0 15 10 ? * *|	Fire at 10:15 AM every day
|0 15 10 * * ?|	Fire at 10:15 AM every day
|0 15 10 * * ? *|	Fire at 10:15 AM every day
|0 15 10 * * ? 2005|	Fire at 10:15 AM every day during the year 2005
|0 * 14 * * ? |	Fire every minute starting at 2:00 PM and ending at 2:59 PM, every day
|0 0/5 14 * * ?	|Fire every 5 minutes starting at 2:00 PM and ending at 2:55 PM, every day
|0 0/5 14,18 * * ?|	Fire every 5 minutes starting at 2:00 PM and ending at 2:55 PM, AND fire every 5 minutes starting at 6:00 PM and ending at 6:55 PM, every day
|0 0-5 14 * * ?|	Fire every minute starting at 2:00 PM and |ending at 2:05 PM, every day
|0 10,44 14 ? 3 WED |	Fire at 2:10 PM and at 2:44 PM every Wednesday in the month of March
|0 15 10 ? * MON-FRI|	Fire at 10:15 AM every Monday, Tuesday, Wednesday, Thursday and Friday
|0 15 10 15 * ?| Fire at 10:15 AM on the 15th day of every month
|0 15 10 L * ?|	Fire at 10:15 AM on the last day of every month
|0 15 10 ? * 6L|	Fire at 10:15 AM on the last Friday of every month
|0 15 10 ? * 6L|	Fire at 10:15 AM on the last Friday of every month
|0 15 10 ? * 6L 2002-2005|	Fire at 10:15 AM on every last friday of every month during the years 2002, 2003, 2004, and 2005
|0 15 10 ? * 6#3 |	Fire at 10:15 AM on the third Friday of every month
|0 0 12 1/5 * ?	| Fire at 12 PM (noon) every 5 days every month, starting on the first day of the month
|0 11 11 11 11 ? |	Fire every November 11 at 11:11 AM


# Use cases
 there are total 7 corn fields but the year field is optional. You need to fill atleast 6 cron field to execute.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6kawcixfbww5usjiokh3.png)
My #100DOC - Day 22
Tags: challenge, 100daysofcode, log
Published: 2020-09-17 17:47:01

### Day 22: September 17, 2020

#### **Today's Progress**: 
1. **[Continued with Confección y Publicación de Páginas Web Course](https://github.com/pablohs1986/confecci-nYpublicaci-nDeP-ginasWeb_SEPE)** (2h 30min):<br>I continued with Unit 1 and did most of its exercises, reviewing tables, lists, frames, and layering.
    
#### **What I learned**: 
* Review of HTML tables, lists, frames and divs.

#### **Total time**:
2h 30min.
Web Dev Wednesday: Docker!
Tags: docker, webdevwed, dockercompose
Published: 2020-09-17 17:43:47

Yesterday's Web Dev Wednesday covered Docker and Docker-compose

{% youtube BEYZ6VTjnh0 %}

Discord: [https://discord.gg/PVr2jwq](https://discord.gg/PVr2jwq)
Twitter: [https://twitter.com/sublimegeek](https://twitter.com/sublimegeek)
Facebook: [https://facebook.com/sublimegeek](https://facebook.com/sublimegeek)
Watch live at [https://www.twitch.tv/sublimegeek](https://www.twitch.tv/sublimegeek)
Web Dev Wednesday: Git
Tags: git, webdevwed
Published: 2020-09-17 17:40:04

First-ever Web Dev Wednesday!  Naturally, I choose to discuss Git!

{% youtube TW5Mlz7hoX8 %}

Discord: [https://discord.gg/PVr2jwq](https://discord.gg/PVr2jwq)
Twitter: [https://twitter.com/sublimegeek](https://twitter.com/sublimegeek)
Facebook: [https://facebook.com/sublimegeek](https://facebook.com/sublimegeek)
Watch live at [https://www.twitch.tv/sublimegeek](https://www.twitch.tv/sublimegeek)
Multi-tenancy Leaks IRL
Tags: multitenancy
Published: 2020-09-17 17:39:54

---
title: Multi-tenancy Leaks IRL
published: true
description: You can obsess over your multi-tenancy database design, but that probably isn't why you'll have a cross-tenant leak.
tags: multitenancy 
---

The dozen or so articles and threads I've read over the years regarding implementing multi-tenancy in SaaS platforms fail to cover areas outside of the database itself. When it comes to a cross-tenant data leak, chances are it won't be an issue at the database level that gets you.

# Cache Layer

Most architectures have a caching layer (e.g. Redis) in use for all sorts of purposes. Chances are you are not deploying a redis/memcache server for each tenant, so you're probably using the common practice of putting the unique tenant id in the key, maybe at the beginning, such as "1234:users" for tracking users of each tenant.

1. What happens if the variable used to put the tenant is wrong? Such as an undefined variable in JS: `${teantId}:users` instead of `${tenantId}:users`. Subtle typo, but it will work, and produce `undefined:users` as the key that all your tenants will access. Well, there's a cross-tenant leak that your days/weeks of obsessing over your database design didn't capture.

2. Or maybe you have the correct variables, but in the wrong order: `${accountId}:${tenantId}:users` instead of `${tenantId}:${accountId}:users`. Good luck catching either of these in a code review!

A basic way to prevent these issues is to have the tenantId passed in as a param to all cache layer requests. Don't just directly access redis. Instead, create some interface to abstract away redis and force the tenantId to be passed in, and then validate the value.

# External Services

You can't just obsess over a leak in your code... you need to guard against an external service having their own leak as well! Yes, this happens, even for major cloud providers. Oh the stories some of us can tell.

Anyway, if the response from the external call provides the tenant identifier somewhere then check that it is what you expected. Otherwise, if you just take it as is, you've just possibly polluted your database with someone else's data, and that isn't gonna be easy to clean up.

*Added bonus to anyone who goes back to their code and makes sure their API includes a field in the body or headers to identify the tenant for the response.*

# Wrap up

Be paranoid! Everyone is out to get you. And chances are, the place you obsessed the most about multi-tenancy issues isn't gonna be the place that ultimately burns you. Put guards and alerts in your code if there's even a hint of a leak. And remember, if you don't store data then it can't be leaked. :-)
What is Firebase? How to build better app using Firebase?
Tags: android, machinelearning
Published: 2020-09-17 11:48:07

Firebase is a platform developed by Google for creating web and mobile applications development that helps you build, improve, and grow your app.

Firebase is a toolset to “build, improve, and grow your app”, and therefore the tools it gives you cover an outsized portion of the services that developers would normally need to create themselves, but don’t actually need to create, because they’d preferably be that specialize in the app experience itself. This includes things like authentication, push messaging, databases, analytics, file storage, configuration, and therefore the list goes on. The services are hosted in the cloud, and scale with little to no effort on the part of the developer. Client SDKs provided by Firebase interact with these back end services directly, with no need to establish any middle ware between your app and the service. So, if you’re using one of the Firebase database options, you typically write code to query the database in your client app.

There’s really no limit to the types of apps that can be helped by Firebase products. There are only limits to the platforms it can be used on. iOS and Android are the primary targets for the Firebase SDKs, and there’s increasing support for web, Flutter, Unity, and C++. You should also know there’s an Admin SDK available for a variety of languages, to be used with any backend components. On top of these SDKs, there is a library called FirebaseUI (Android, iOS, web) that gives a lots of helpful utilities to form of development with Firebase even easier.

How to build better app using Firebase?

1. Firebase Cloud Firestore
2. Firebase Machine Learning
3. Firebase Cloud Function
4. Firebase Authentication
5. Firebase Hosting
6. Firebase Cloud Storage
7. Firebase Realtime Database

Read more here: https://medium.com/@rlogicaltech/firebase-a-comprehensive-app-development-platform-305398d77bbb
Echo Go - Middleware 
Tags: go, google, backend, webdev
Published: 2020-09-17 17:39:06

Middleware is a block code when we call it before or after http request in proccess. Middleware usually made per functions, example: Middleware authentication, logging, and gzip compression, etc.

# Custom Middleware 
Middleware making in go is very simple, just used method .Use() belong object echo for middleware registrations.

Ok so create new folder project main.go, and follow this code

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4d96bkzjk0liopzpcnfa.JPG)

Next, create two middleware, middlewareOne & middlewareTwo, it displays log.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/etpsmtx00fgp406qx598.JPG)

Registration two middlewares in above, this is example code.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/emyqmq6ez3pj5dq9lnuy.JPG)

_Testing_

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/zz55z8yrkpj65djscd7a.JPG)

Finally! Grats.
Distributed Storage Cluster and Hadoop
Published: 2020-09-17 17:32:31

**How big giant *MNC's like Google, Facebook, Instagram*, etc stores, manages, and manipulates thousands of Terabytes of data with High Speed and High Efficiency.**

The story starts with the buzzword Big data, which refers to a large volume of data that is large, fast, or complex and with different variety, variability, veracity – both structured and unstructured. The importance of big data doesn’t revolve around how much data you have, but what you do with it. 

**Sources of big data:** Streaming data(Youtube, Twitch, Netflix), Social media(Twitter, Facebook), Publicly available data(US government and other agencies data), others come from data lakes, cloud data sources, suppliers, and customers.

**How to Access, Manage, and Store Big Data:** 

Modern computing systems like Distributed Storage Cluster and Hadoop provide the speed, power, and flexibility needed to quickly
manages and manipulate Thousands of Terabytes of data with High Speed and High-Efficiency. Along with reliable access, companies also need methods for integrating the data, ensuring data quality, providing data governance and storage, and preparing the data for analytics. Some data is stored on local premises in a traditional data warehouse and data center – but there are several flexible, low-cost options for storing and handling Big Data via Cloud solutions, Data Lakes, and Hadoop.

**Big Data analytics** is the technique with which companies gain value and insights from data. With the coming of AI, Augmented Analytics, and Augmented Data Management the problem can be solvable and be managed easily.

**Tip:** *follow https://twitter.com/SubhashTyler for creating Hadoop master-slave architecture or Distributed Storage Cluster on your system in next blog.*
 #ARTH #bigdata #hadoop
Aleksandra Zagulyaeva  | Biochemist
Published: 2020-09-17 17:31:51

[Aleksandra Zagulyaeva](https://AleksandraZagulyaeva.com  "Personal website project to list scientific research").

# Website Project

Hi! This is a personal website project geared toward aesthetic presentation of existing scientific publications and research of Aleksandra Zagulyaeva. We used about a dozen different JavaScript sources to implement the design of this website. The project could not have been accomplished without jquery-3.5.1.min.js, OwlCarousel.min.js, and particles.min.js with their respective repositories. There are also a number of additional resources in place for further expansion  and development in the future.
Distributed Storage Cluster and Hadoop
Published: 2020-09-17 17:30:27

How big giant MNC's like Google, Facebook, Instagram, etc stores, manages, and manipulates thousands of Terabytes of data with High Speed and High Efficiency.

The story starts with the buzzword Big data, which refers to a large volume of data that is large, fast, or complex and with different variety, variability, veracity – both structured and unstructured. The importance of big data doesn’t revolve around how much data you have, but what you do with it. 

Sources of big data: Streaming data(Youtube, Twitch, Netflix), Social media(Twitter, Facebook), Publicly available data(US government and other agencies data), others come from data lakes, cloud data sources, suppliers, and customers.

How to Access, Manage, and Store Big Data: 

Modern computing systems like Distributed Storage Cluster and Hadoop provide the speed, power, and flexibility needed to quickly
manages and manipulate Thousands of Terabytes of data with High Speed and High-Efficiency. Along with reliable access, companies also need methods for integrating the data, ensuring data quality, providing data governance and storage, and preparing the data for analytics. Some data is stored on local premises in a traditional data warehouse and data center – but there are several flexible, low-cost options for storing and handling Big Data via Cloud solutions, Data Lakes, and Hadoop.

Big Data analytics is the technique with which companies gain value and insights from data. With the coming of AI, Augmented Analytics, and Augmented Data Management the problem can be solvable and be managed easily.

Tip: 
follow https://twitter.com/SubhashTyler for creating Hadoop master-slave architecture or Distributed Storage Cluster on your system in the next blog.
#ARTH #bigdata #hadoop