teleren/devto huggingface dataset:
Database Notes 📖
Tags: database, sql, rdbms, tutorial
Published: 2020-02-13 19:02:41

# Unit 1: Introduction to Database

---

## Chapter 1: Introduction to Database System

**What will be covered in this chapter ?**

Basic definitions, advantage of DB systems, DB systems vs File systems etc.

Let's begin 🤗

### 1.0 Basic Definitions

#### 1.0.1 File

A file is a collection or set (ordered or unordered) of data elements stored on storage media. 
A file can be described as a logical collection of records.

#### 1.0.2 Record

A record is a set of logically related fields. Typically a file has a number of records in it.

A record may consists of more than one **Field**.

#### 1.0.3 Data

Data are Known facts that can be recorded and that have implicit meaning.

#### 1.0.4 Database

Database is a collection of related data with some inherent meaning.

#### 1.0.5 Schema

Complete definition and description of the database is known as database schema.

OR

The logical structure of the database (e.g., set of customers and accounts and the relationship between them)


#### 1.0.6 DBMS

It is a collection of programs that enables to create and maintain database. It is an application Software system that facilitates the process of defining, constructing and manipulating data bases for various applications.

There were many problems in the traditional file system and to overcome them **DBMS** came into existence.

* **Problems of traditional file system:**
  1. Data redundancy and inconsistency
  2. Concurrent access by multiple users
  3. Difficulty in accessing data
  4. Data isolation – multiple files and formats
  5. Integrity problems
  6. Atomicity of updates
  7. Security problems

* **Types of DBMS**:
  1. Hierarchical
  2. Network DBMS
  3. Object-oriented
  4. Relational DBMS or RDBMS

#### 1.0.7 RDBMS

**Definition:** A database system made up of files with data elements in two-dimensional array (rows and columns). This database system has the capability to recombine data elements to form different relations resulting in a great flexibility of data usage.

* **The Relational DB Concept was proposed by Dr. Codd in 1970**
* *The relational model contains the following components:*
  1. Collection of objects or relations
  2. Set of operations to act on the relations
  3. Data integrity for accuracy and consistency

* *Relational Database Management System (RDBMS) consists of:*
  1. A set of tables
  2. A schema:
     * is a description of data in terms of data model
     * defines tables and their attributes (field or column)

* **Examples of RDBMS**
  * Client/Server Databases
    * MySQL (open-source)
    * Oracle
    * SQLServer (Microsoft)
  * Personal Databases
    * MS Access
    * MS Excel
  * Embedded Databases
    * SQlite

---

**What will be covered in the next chapter ?**

* Database System Concepts and Architecture
  1. Data Models
  2. Schemas and Instances
  3. Three schema architecture
  4. Data independencies

---

>Thank you !!
How to: Show Jasmine test results in TeamCity
Tags: testing, jasmine, teamcity, automation
Published: 2020-02-16 01:33:17

---
title: How to: Show Jasmine test results in TeamCity
published: true
date: 2020-02-13 19:00:00 UTC
tags: testing,jasmine,teamcity,automation
canonical_url: https://seankilleen.com/2020/02/how-to-show-jasmine-test-results-in-teamcity/
---

A colleague wanted to surface their jasmine tests in a TeamCity build system. Wanted to document the steps I used to help them solve their problem.

## Setting up the Jasmine Output

- Add the `jasmine-reporters` package: `npm -i jasmine-reporters --save-dev`
- Add an `index.js` to set up the tests if you haven’t already:

```javascript
var Jasmine = require('jasmine'); 

var reporters = require('jasmine-reporters');

var jasmine = new Jasmine();

// Load configuration from a file or from an object. jasmine.loadConfig({
    "spec_dir": "spec",
    "spec_files": [
      "**/*\[sS]pec.js" ],
    "helpers": [
      "helpers/**/*.js" ],
    "stopSpecOnExpectationFailure": false,
    "random": true
  });

jasmine.execute();

```

- Prior to executing the steps, add the TeamCity reporter:

```javascript
var teamCityReporter = new reporters.TeamCityReporter();

jasmine.configureDefaultReporter(teamCityReporter);

```

- Update the “test” or “tests” command in your `package.json`:

```json
"tests": "node .path/to/specs/index.js"

```

- Prior to executing, add an additional NUnit XML Reporter:

```javascript
var nunitXmlReporter = new reporters.NUnitXmlReporter();

jasmine.addReporter(nunitXmlReporter);

```

## Updating TeamCity

- Open the build in question
- From the Menu, add a build feature:

![TeamCity build menu showing the option to add a build feature](https://seankilleen.com/images/post-images/jasmine_tests_teamcity/AddBuildFeatureMenu.png)

- Select the “XML Report Processing” feature, choose an NUnit-style report, and point it to `nunitresults.xml` (the default location for the jasmine NUnit output):

![XML report processing options](https://seankilleen.com/images/post-images/jasmine_tests_teamcity/XMLReportProcessingFeature.png)

- Double-check the saved feature:

![The added build feature](https://seankilleen.com/images/post-images/jasmine_tests_teamcity/BuildFeatureResult.png)

## The Results

We see our tests listed in the build list:

![Tests in the build list](https://seankilleen.com/images/post-images/jasmine_tests_teamcity/TestsPassing.png)

And we see the test output in the overview tab:

![Tests in the overview page of the build](https://seankilleen.com/images/post-images/jasmine_tests_teamcity/TestsPassing_OnOverview.png)

And we see the a tests tab with the output of each individual test:

![Tests in the build's tests tab](https://seankilleen.com/images/post-images/jasmine_tests_teamcity/TestsTab.png)

Hope this helps! Happy testing!
Beacon API
Tags: webdev, javascript, beginners, todayilearned
Published: 2020-02-13 18:59:41

---
title: Beacon API
published: true
description: A brief explanation about the browser's Beacon API
tags: webdev, javascript, beginners, TIL
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/a8bcn781dbfogfj0mxre.jpg
---

Modern browsers are increasingly venturing into the native interaction with the hardware, they offer us an small, but helpful [list of APIs](https://developer.mozilla.org/en-US/docs/Web/API) to have fun.

Some of them have a more native interactions, and some of them are more like utilities that can help developers.

This is the case for the **Beacon API**


## The Problem

It's very likely you'll find yourself, at some point of your web developer career, working with **analytics.** This type of scripts often need to do something (eg. reporting) when the `document` triggers an `unload` event, normally would be a call to a server maybe to let know that a user just left the page just before checkout (ouch!)

The first piece of code that comes to my mind when I encounter this scenario looks like this:

```js
window.onunload = function userLeave() {
  // Do the http request to my analytics server
}
```

Well, turns out that browsers, ignore asynchronous http calls that happen during an `unload` event.

Again, first solution that comes to my mind: **let's make it synchronous**. Well, although it works, doing a synchronous action inside the `unload` event will force the browsers to **wait** until this event has completely finish, therefore the next page will feel slow to load.

There are other techniques to handle this scenario, but they all involves a **bad code practice** and affect the user navigation

## Send a Beacon! 🗼🗼

To solve this issue, the browsers offers us the `Beacon API`.

The `navigator` object has a method called `sendBeacon()`, this method receives 2 parameters: `url` and `options`.

The `url` parameter represents the url of the server you want to send the request, and the `options` parameter (**optional**) can be a simple **String**, or if you want to send more complex data, you could also pass an `ArrayBufferView`, `Blob`, `DOMString`, or `FormData`.

This function schedules an http **POST** request using the parameters you passed in (url and options), it returns `true` if the http call was successfully scheduled, returns `false` otherwise

```js
window.onunload = function userLeave() {
  const crashData = new FormData()
  const url = 'https://my-analytics-server/'

  crashData.append('userID', '123');

  navigator.sendBeacon(url, crashData)
}
```

> * Beacon requests use  only HTTP POST and do not require a response.
>
> * Beacon requests are guaranteed to be initiated before the page unloads.

You should check out all the [examples](https://developer.mozilla.org/en-US/docs/Web/API/Beacon_API/Using_the_Beacon_API) from the docs to see how this can help you in many other cases!


Thanks for reading 🤚
Fission Drive Preview
Tags: fission, fissiondrive, ipfs
Published: 2020-02-15 07:43:50

---
title: Fission Drive Preview
published: true
date: 2020-02-13 18:51:41 UTC
tags: FISSION,Fission Drive,IPFS
canonical_url: https://blog.fission.codes/fission-drive-preview/
cover_image: https://s3.fission.codes/2020/02/fission-drive-preview-ramen.png
---

We're pleased to present the Preview release of **Fission Drive** , the web native file system browser that we're including as a base component of the Fission stack.

We've been hosting files, static websites, and client-side apps on Fission since we launched our CLI tool in October of 2019.

Underneath, we use IPFS, but increasingly that's a detail that we don't think most users of our service should have to care about. It's a dependency, just like using MySQL or Redis.

Of course, if you **do** know what IPFS, great! We want to make it as easy to use as any existing Web2 component, while having capabilities at the protocol level – like file de-duplication, a global CDN, peer-to-peer sync, immutability, and offline support, to name a few– that let us empower all developers to build new and interesting tools.

Fission Drive is the app that we're building to showcase what the entire Fission stack can do, hosted on our own infrastructure.

[Steven @icidasset](https://twitter.com/icidasset) joined the team in December and has been full time since January. He designed and built Fission Drive, as well as our [slick new home page](https://fission.codes), which is also now running on Fission. Next up for Steven is building out web-based passwordless login for Drive, as well as the TypeScript libraries that will let all developers build apps like this.

Drive has a few features to play with, like image previews and support for dark mode. We'll keep the [guide docs updated](https://guide.fission.codes/drive) as we add features.

<!--kg-card-begin: image-->

![Fission Drive Preview](https://s3.fission.codes/2020/02/fission-drive-dark-mode.png)<figcaption>Fission Drive in Dark Mode, with an image preview</figcaption>

<!--kg-card-end: image-->

This preview release supports browsing any public IPFS hash, not just those on Fission. You can use this example hash `QmbCLefkFuXbhHBWSW7PWmJzBL7W7e8zm41HK4DGJ1RDwV` to see it in action at [drive.fission.codes](https://drive.fission.codes).

Want to add your own files? Follow the [install instructions for the Fission CLI](https://guide.fission.codes/apps/installation) to easily upload using `fission up`.

You can [subscribe to keep up to date with Fission Drive and other product updates](https://5d04d668.sibforms.com/serve/MUIEAD0fi3_BJE-4eieeuK6_0_XZaOPiu1_nfh56jvP1pV9uWy9OLxWLrHtjC148osZF2vcRb0XAymSdzFxhVD7XgvvODjbrp5ClBvQLmY70hyvU1JKu7ucoOP5KFJVRcfNgYN-3qvVppxg72KGyYZlWAJr2IkO7Ae9CIhnjpufaP7npZGPrBFzpmyEaKKLGYyqu0dnQIobGLAMM).
Access the OpenShift Internal Registry
Tags: 100daysofcode, devops, kubernetes, tutorial
Published: 2020-02-13 17:56:51

OpenShift has a really handy feature called Image Streams.  It also has a built-in Docker V2 registry which is also very useful.  However, the registry isn't really exposed outside the cluster.  ***So how do you do rolling updates of images?***

## 1. Ensure you have the needed RBAC policies

In order to push/pull from the internal OpenShift registry, your OpenShift user needs to have a few permissions.  As either another *cluster-admin* user or via the Master OpenShift node in the **system:admin** user context, apply the following policies to your **intented_user**:

```bash
$ oc adm policy add-role-to-user system:registry <intended_user> -n <namespace/project>
$ oc adm policy add-role-to-user system:image-builder <intended_user> -n <namespace/project>
## or for cluster-wide access...
$ oc adm policy add-cluster-role-to-user system:registry <intended_user>
$ oc adm policy add-cluster-role-to-user system:image-builder <intended_user>
```

With those policies, you can access the internal registry with the **intended_user** and perform `docker push/pull` commands.

## 2. Log into your OpenShift application node

This is really the only trick to it - you don't want to do this on your Master nodes as that's in the **system:admin** context.  You also can't do this on your local machine since it doesn't have access to the routed **default.svc** domain inside the cluster.  So scoot on over to one of your infrastructure nodes and run the following:

```bash
$ oc login
$ sudo docker login -u openshift -p $(oc whoami -t) docker-registry.default.svc:5000
```

## 3. Pull n Push it Real Good

Now that we're logged into our internal OpenShift registry from an OpenShift application node, we can continue to push a new image to the Image Stream and Registry.  When you have a Deployment Configuration that updates upon Image Change, this action will perform a Rolling Update as well.

```bash
$ sudo docker pull yourUser/someContainer:latest
$ sudo docker tag yourUser/someContainer:latest docker-registry.default.svc:5000/<namespace|project>/<image-stream-name>:<tag>
$ sudo docker push docker-registry.default.svc:5000/<namespace|project>/<image-stream-name>:<tag>
```

Now if your deployment is updated upon an Image Change you should see a rolling update happen very quicky - *ultra-quick* if you happen to be on the node that is running that pod since the image layers are already on the system from your `docker pull` command!

***If only someone were able to make this into an Ansible playbook that could be fired off as part of a script locally or via Ansible Tower...***
What makes some engineering teams so successful?
Tags: discuss, productivity
Published: 2020-02-13 18:32:06

Be it small or large engineering teams, what is it that makes them more efficient than others? How do they collaborate so well?
Could it be their manager or their tech lead who has years of experience and understands how to lead the other engineers? 

What are the variables that make them successful?

Yes, every team has its challenges, how do they overcome them? I could make use of some examples in your various teams. 

Lately, these questions have been running through my mind. I would be grateful if I get some inputs here as to how this comes by. 

Links and books related to this can also be shared.
Auto Redirect Vue 401 
Tags: vue, axios, 401, redirect
Published: 2020-02-13 18:05:48

This is a quick note so I don't lose this. If you need to redirect based on a status code and are using vuex this might be helpful. I have a getter I call api that returns an Axios instance so I can add the JWT to the headers. I needed to handle 401's for bookmarks etc. You will need to import axios and router at the top of your store so you can re-direct. I redirect to log out which takes care of wiping out the old token on the way to the login page. You will want to remove the Authorization header and either set SET_ME values or remove the lines they appear in as well.  I think it may help to have them in the code since it's a sample of what can be done. I set the SET_ME values using dot env file variables and process.env if that helps anyone.

```js
api: function (state) {
    const axiosInstance = axios.create({
        baseURL: 'SET_ME',
        timeout: 5000,
        withCredentials: false,
        headers: {
            "Content-Type": "application/json;charset=UTF-8",
            "Accept": "application/json",
            "Access-Control-Allow-Origin": 'SET_ME',
            "Authorization": state.jwt
        }
    });
    axiosInstance.interceptors.response.use(function (response) {
        return response;
    }, function (error) {
        if (401 === error.response.status) {
            router.push("/logout");
            return Promise.resolve(error.response);
        } else {
            return Promise.reject(error);
        }
});
    return axiosInstance;
}
```

You can access the api with. __this.$store.getters.api__ but I have it included as api using a mixin the bring common things to each page. Hope this helps.
Plug the Shiv App Into Nginx - Building SaaS #27
Tags: python, django, saas, nginx
Published: 2020-02-13 18:05:28

{% youtube xvCw-WCPOck %}

In this episode, we finally connected the Shiv app into Nginx.  This completes the whole process of converting to a Django Shiv and using that to run the site.

Show notes for this stream are at [Episode 27 Show Notes](https://www.mattlayman.com/building-saas/plug-shiv-app-nginx/).

To learn more about the stream, please check out [Building SaaS with Python and Django](https://www.mattlayman.com/building-saas/).
A quick question for people who use version control
Tags: git, versioncontrol, help, watercooler
Published: 2020-02-13 17:40:45

---
title: A quick question for people who use version control
published: true
description: 
tags: git, versioncontrol, help, watercooler
---


In my team, we use git branching to keep different features separate (of course). However, one co-worker insists on keeping these features in different files as well to avoid merge conflicts. For example, we may have a FormView.java on master, but in have both a FormView.java and a ValidatedFormView.java on the form-validation branch. I suggested that rather than duplicating files to "work around" git, we should let git do its thing and merge features when we want to. He also wants to keep duplicates in order to be able merge some parts of a feature into other branches without having to deal with merging the FormView.java file itself.

What should we do? If he is right, why? If I am right, how can I convince him as such?
Code Smell: Side Effects
Tags: codesmells, productivity, webdev, computerscience
Published: 2020-02-13 17:39:15

When people say the term “side effects” we immediately think of functional programming. Having no side effects is a well-known rule of good functional programming. But the “No Side Effects” advice actually applies just as much to typical Object-Oriented Programming. It just requires a more nuanced definition of what a side effect is.

Let’s look at a few examples of functions. Just glance at this list and see if you can determine from the name what the functions actually do.

![image](https://miro.medium.com/max/220/1*Cv6JGyf6EiBXociUfzFbqA.png?)

Those functions are fairly straightforward. They give us a description that we can interpret and make some pretty reasonable assumptions about what they do.

Now let’s imagine an implementation of one of these. We’ll use loadUser:

![image](https://miro.medium.com/max/543/1*SUKMCoGw3mpZsyLDIeXjyQ.png?)

Now look closely at this function. There’s something fishy going on. Let’s break it down. First, it sets user data. Exactly what a loadUser function should do. Then it sets a loaded status of some kind on the user. Ok, we just loaded our user, so that makes sense as well. But THEN it empties out the cart. That’s our problem.

When we just look at the function name loadUser, and if we saw it being called somewhere, knowing that it empties out the shopping cart is not in any way communicated. Sure, where it’s called, it may be completely reasonable that we empty out the cart because in that call we are loading a new user. But the function doesn’t communicate that. That opens us up to some insidious problems.

What if we later on call loadUser to refresh the user data from the server? Or for some other reason, but we DON’T want the cart to be emptied when we do. Since we don’t know it’s doing that, we won’t know that we caused this problem possibly until it shows up in production with users complaining that every so often their cart just gets emptied out.

THAT is a side effect. In OO programming, side effects are when a function does something it doesn’t communicate, something that might not be anticipated. Those are side effects.

Good functions don’t have side effects, whether you’re doing OO or functional. Good functions communicate what they do so that you don’t have to dig in and read them to know what’s going on. Cognitive load is one of the biggest hurdles to programmer productivity. This practice helps keep that in check.

So keep your eyes out for this code smell, and fix it where you find it.

Signup for my newsletter at [here.](https://is-tracking-link-api-prod.appspot.com/api/v1/click/4616255200034816/5570275139911680)
Visit Us: [thinkster.io](https://thinkster.io/) | Facebook: @gothinkster | Twitter: @GoThinkster
SOC and JSON Sections
Published: 2020-02-13 17:20:28

In our prior article we introduced the idea of *Allowing JSON to determine which components to create*.  

**JSON Maps to the GUI**

Consider this response from your back-end:

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

In our last article, we created a component "Controls" which handles the array of values as seen in the JSON above.

And this result in the GUI (after a recent change):

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/822z6rjmlupni3if1c7f.png)

The top bar *without any text* is bound to a different component than the "Test Group Name" (Control section which is showing just fine). We want to quickly find out why there's no text showing up in that empty bar.

**HTML Binding**
 
```html

 <section class="Panel">
      <h2>{{ user }}</h2>
      <button (click)="onSaveClicked()" [hidden]="hideButton">Save</button>
      <div class="mainSettingArea">
         {{ setting.FunctionalGroupName }}
      </div>
      <div class="settingsContainer">
         <div
            class="card"
            *ngFor="let currentSetting of setting.FunctionalSettings"
         >
            <p class="groupNameHeader">
               {{ currentSetting.SettingsGroupName }}
            </p>
            <div
               class="controls"
               *ngFor="let control of currentSetting.Controls"
            >
               <display
                  [settingGroupName]="currentSetting.SettingsGroupName"
                  [control]="control"
               ></display>
            </div>
         </div>
      </div>
   </section>

```

In the HTML above we see a demarcation of concerns, we can see the button, which is right above our "blank bar". The text; of which, is an interpolation of *setting.FunctionalGroupName*

We note that our control section is working fine, so we are not interested in the HTML component named 

```html 
<display> 
```
Which is a component that handles all Controls. Nor are we concerned with the section just above the display markup.

```html
 <p class="groupNameHeader">
     {{ currentSetting.SettingsGroupName }}
 </p>
```

So we keep traveling upward and we spot this section:

```html
<div class="mainSettingArea">
    {{ setting.FunctionalGroupName }}
</div>
```

Must be the root cause of nothing showing up!  Can you spot the reason why it's not working.  Please post answer below.

**Take Away**

[By following the SOC principal](https://en.wikipedia.org/wiki/Separation_of_concerns), we've made debugging issues simple. In addition, any changes we make are limited to only that concern!

BTW: There is one other "bug" in the GUI can you spot it? 

JWP2020
Is it ethically correct to ask a candidate to build a better landing page version of the own company?
Tags: discuss, hiring, beginners, webdev
Published: 2020-02-13 16:53:20

From my point of view, they will have a bunch of different ideas for free. And still, there is no way of knowing if they really want to take advantage of it or it is just a reliable test to know if you can match their requirements.

What do you think?