teleren/devto huggingface dataset:
Database Storage
Tags: beginners, database, todayilearned, sql
Published: 2019-11-27 14:54:01

Indexing is a term used in DBMS which is used to reduce the number of operations or lookups to find a record in a database.

Before, we dive right into the concept of indexing lets first understand why we needed it in the first place?

To understand Indexing we need to understand first the disk structure and how the data is stored in the disk.

A disk is divided into  sectors ,tracks and blocks .

Each sector consist of multiple tracks->Intersection of tracks and sectors is called blocks ->Each byte of the block is called offset.

To locate a block address we need track id and sector id.

Block address = (sector id, track id)
Typically for study purpose we assume size of block as 512 bytes

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/rrgueobc3fkqujx03gwu.png)



To reach particular byte we need -> track id, sector id, block id
By spinning  the disk the sectors are changed and by moving  the disk tracks are changed

• Typically the entire database is stored on disk.
• Data must be moved from disk to main memory in order for the data to be operated on.
• After operations are performed, data must be copied back to disk if any changes were made.
• Disk storage is called direct access storage as it is possible to read data on the disk in any order (unlike sequential access).
• Disk storage usually survives power failures and system crashes.

Organizing the data on the main memory is done by  Data Structures whereas , organizing the data on the disk efficiently so it can be utilized is done by  DBMS.

Tables are stored on the hard disk of the database server. The database tables are usually divided into column and  rows, just like a regular graphic table. 

In a database table, the columns specify the information category and the data type and the rows hold the actual information.

How data is stored in disk
For eg : 
Consider a tables with n columns with 100 records
Total size of each row  in the table is 128 bytes

If the block size is 512 bytes then,
No of records per block = 512/128 = 4 
Means we can store 4 rows in 1 block and next 4 in next block and so on

100 records = 100/4 = 25 
25 blocks for 100 records

The time to search a record in a table depends upon the number of blocks.
As the number of records increases so will the number of blocks so to access an block with less time we use Indexing 

We will see Indexing in Next blog post!


Resources
https://www.ntchosting.com/encyclopedia/hosting/database-storage/
2019 Automation Testing & Tools Survey [Giveaway worth $2148]
Tags: testing, devops
Published: 2019-11-27 12:07:46

Have you ever played a minute role in software testing? This is for you.

![automation testing and tools survey](https://www.simform.com/wp-content/uploads/2019/11/Untitled-design-1.png) 

We, from Simform, are running a short survey on **automation testing and tools** to better understand what's working these days and what isn't. Things like which is the commonly used automation tool, what tests people prefer automation, what is the tool selection criteria, etc.  

**Can you help by taking the survey?** [https://www.simform.com/state-automation-testing-tools/](https://www.simform.com/state-automation-testing-tools/?utm_source=dev.to)

To gather more responses we are doing a giveaway worth $2148 in automation tools which will be given to the randomly selected winner.

**This isn't a promotion though. There is no sales pitch. You don't have to subscribe to anything.**

Naturally, we'll be making an in-depth blog post: A CTO's Guide to Software Test Automation Tools, so that we can all learn from the results. The more results, the more we learn. 

Here are the prizes: 

* 1-year subscription to Boozang that provides AI-powered automation testing tools (worth $1788)
* 1-year subscription to LambdaTest, a cross-browser testing platform with more than 2000 browser configurations (worth $180)

We'll get a lot of information from this and we'll be sure to post the results here. Thank you!
Bringing a new approach to tech events
Tags: javascript, react, eventsinyourcity, devops
Published: 2019-11-27 14:38:31

Tech conferences are great. Hundreds of participants, amazing speakers and lots of content to digest in a lot of topics and introducing lots of features and tricks. A lot of them have optional workshops the days before or after, but not everyone can take so many days off...

So we thought: what about an event that focuses only on tech workshops? 

So we launched Workshop Summit (http://workshop-summit.com/) for the community in Belgium (and around!).

What is Workshop Summit?

It is a full week with 1-day workshops on different trendy technologies by experts in the field and active members of the community.


Who will be joining and which topics will be covered?

- Asim Hussain with a workshop on Machine Learning & Tensorflow
- Stéphanie Walter on UX Mobile 
- Kristijan Ristovski Kitze with a focus on (Advanced) React
- Benjamin Coenen with two workshops: one on Golang and another one Continuous Delivery 
- Manfred Steyer with a workshop on Software Architecture
- Nikolas Burk with a workshop on GraphQL
- Antonio Goncalves introducing Quarkus (Java)
- Sani Yusuf with a workshop on Ionic
- Brecht Billiet and Kwinten Pisman with Advanced Angular & RxJS
- Guillaume Chau on VueJS
- Fabio di Vita presenting Openshift
- Gill Cleerens on .NET Core 3.0
- Cassie Evans on SVG Animation 
- Aidan Finn on Azure Secure Networks 

Want to know more?

Check out http://workshop-summit.com/!
Tips: CSS Variables for styled-components
Tags: javascript, react, css, styledcomponents
Published: 2019-11-27 14:35:59


In styled-components, custom property can use with `props` 

```js
const Item = styled.div`
  color: ${({color}) => color};
  background: ${({bgCbolor = "red"}) => bgColor};
`
```

but this syntax is redundant.

## Solution: use CSS Variables

In modern browser, we can use CSS Variable. It’s very useful.

I found more useful that convert react props to CSS Variables.

```js
export const Vars = styled.div`
  ${(props) => {
    return Object.entries(props)
      .filter(([_, v]) => typeof v === "string" || typeof v === "number")
      .map(([k, v]) => `--${k}: ${v};`)
      // You can convert to kebabCase if need.
      // .map(([k, v]) => `--${_.kebabCase(k)}: ${v};`)

  }}
`
```

Usage

```jsx

const Item = styled.div`
  color: var(—-color);
  background: var(—-bgColor, "blue");
`

const FooComponent = () => (
  <Vars color="red" bgColor="yellow">
    <Item />
  </Vars>
)
```

Additionally, Be careful that variable effect to all component children. This behavior has pros and cons.
Reduce your terminal prompt size in Mac/Linux
Tags: linux, terminal, macos
Published: 2019-11-27 14:34:00

I really hate how much space the terminal in Macos eats.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/t9kom0urmp0bqqpdvmy0.png)

That's eating some times like 60 to 80% of my terminal space, which on itself (the terminal) I like to keep small.

Easy solution though, edit your ~/.bashrc and add this line at the end:

```
export PS1="[..]/\W:"
```

Then using source against that file should get your changes:

```
source ~/.bashrc
```

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ux5laty31hyw7wfa7z3c.png)

And you can always use pwd, as you can see in my terminal, for whenever you need a reminder of the whole path where you are.

Much better, isn't it? :)
Can you answer this google interview question?
Tags: career, puzzles, algorithms, programming
Published: 2019-11-27 14:27:01

### The Problem Statement 👨🏾‍💻
There is a continuous stream of numbers that you are supplied with, wherein you get to know the new number added to that stream one at a time. At any given moment, you will be asked the question: **what is the median in the current stream of numbers that you have seen so far?** and you have to solve the problem with the most efficient solution. 

### Key Points to consider 🔑
* What data structure would you use to store the stream?
* What would be the time complexity of adding a number to the stream data structure that you are using?
* What would be the time complexity of fetching the real-time median at any given moment?

After giving it a try yourself, watch this video where I cover one of the most optimum solutions for the same problem:

{% youtube 1CxyVdA_654 %}

Hope that helped, cheers!✌🏾
Google Keywords When I Learn Programming
Tags: beginners
Published: 2019-11-27 08:05:10

---
title: Google Keywords When I Learn Programming
published: true
description: 
tags: discuss, beginner
---

Sometimes you can not wrap your head around concepts from official doc when you just wanna try it out.

Sometimes you are confused when people are engaged in lively conversations in the post or comments.

Sometimes you google a topic and jargon pops up one after another.

Isn't there a simplified version of page where author talk with you, not explaining something with terminology from another world?

Seeking answers, I've been collecting these keywords whenever I wanna learn something without fuss.

Note that we can understand concepts more deeply in official doc after we grasp basics of them. So official doc is pretty important. After all, some docs are also awesome for us to learn something quickly. 

p.s. Following list is not limited to programming.

#### Get an overview of a subject to get your feet wet

- basics
- introduction
- starter/beginner
  - get started in xxx
- learn xxx in x minutes
- learn xxx the right way
- glossary/terminology
- ipynb/notebook
- hello world

#### Learn a concept quickly

- explained
- understand
- ⭐eli5
  - Reddit has many eli5-related threads. So does dev.to!
- visualize
  - If you struggle to understand git commands, you can learn it visually.
  - There is an awesome project for algorithm visualization.
- layman
- ⭐gist

#### Miscellaneous

- curated
- best practices
- project
- hands-on
- hand book
- hitchhiker
- intuitive
- roadmap
- guide
- ⭐blog
  - There are a ton of personal blogs waiting for you to find!
- ⭐101
- ⭐cheatsheet
  - You can revise something quickly with cheatsheet.
- step by step
- end to end
- from scratch
- template
- boilerplate
- review
- crash course
- infographic
- snippets
- kit	

#### bonus-tips

- Check out image tab in google search results to visualize something.
- Make sure you know exactly what are you gonna search for before you dive into a concept.
- ⭐Type `thank`, `work`, or `solve` in `CTRL+F` input field in a community question thread.
  - `save my day`
  - `awesome`
- `kaggle` and `datacamp` is awesome places to find nice tutorials for data science.
- ⭐xxx site:github.io
Working with Axios in React
Tags: react, axios, promise, javascript
Published: 2019-11-27 14:15:21

---
title: Working with Axios in React
published: true
description: Axios is a library that helps us make http requests to external resources
tags: reactjs, axios, promise, javascript
cover_image: https://ferrariwebdevelopment.s3.us-east-2.amazonaws.com/assets/20191011-axios.jpeg
---

## Axios is a library that helps us make http requests to external resources

In our React applications we often need to retrieve data from external APIs so it can be displayed in our web pages.
One way to build this feature is to use the Javascript *Fetch* API. Fetch is quite capable of retrieving external data, but it has some limitations.

A more popular way of performing this operation is to use the *Axios* library. Axios is designed to handle `http` requests and responses.
It's used more often than Fetch because it has a larger set of features and it supports older browsers.

Axios deals with responses using *Promises*, so it's streamlined and easy to use in our code. Axios uses methods like `get()` and `post()` that perform http `GET` and `POST` requests for retrieving or creating resources.

We install Axios in our project in the usual way, with the npm command:

```
npm install axios
```

We have seen before that the best way to load external data in a React component is to do it inside the `componentDidMount()` function that gets executed right after our component has mounted.
After we retrieve the data, we typically add it to the state, so it's ready to be used by our application.

### A `get` request

Here's the basic syntax for a `GET` request for a resource:

```js
axios.get('http://localhost:3333/items')
```

We use the `get()` method and we pass in the URL where the resource lives.
Axios does its magic and returns us back a promise.
If the promise is successful, it's passed to the `then()` method where we use it to set state.
If the promise is not successful we get back an error that is passed to the `catch()` method where we can display it on the console or in some other fashion.
Here's the full call to Axios inside `componentDidMount()`:

```js
componentDidMount() {
  axios.get('http://localhost:3333/items')
    .then(response => this.setState({items: response.data}))
    .catch(err => console.log(err))
}
```

In our case, the items we requested live in the `response.data array`, so we update the state of our application with it.

As you can see, it's very easy to work with external data inside our React application. All we have to do is make a quick call to Axios.

---
I write daily about web development. If you like this article, feel free to share it with your friends and colleagues.

You can receive articles like this in your inbox by [subscribing to my newsletter](https://cesare.substack.com).
Lunch break talks #1: Simplicity is complicated
Tags: techtalks, computerscience, codequality
Published: 2019-11-27 13:59:41

---
title: Lunch break talks #1: Simplicity is complicated
published: true
description: simplicity is hard to get, but - if you get it right - makes doing complicated things easy to achieve
tags: #techtalks #computerscience #codequality
cover_image: https://thepracticaldev.s3.amazonaws.com/i/h8cdz9r6gsosdukkewb9.jpg
---

I sometimes like to watch a talk during my lunch breaks, so I decided to share some of the best ones I bump into, along with my notes.
I try to keep the topics fairly language agnostic (after all it's a lunch break). 

In this case the talk is from [Rob Pike](https://en.wikipedia.org/wiki/Rob_Pike), one of the creators of **Go**. It still resonates with me, even if I am writing JavaScript pretty much all day. Simplicity is a goal at any level you're writing (not just when writing a language!) and it is a hard thing to achieve.

I really like that Rob Pike makes everyone think about how hard it is to architect the grammar of a language, and how hard it is to take decisions and make tradeoffs when designing a new one. Funny how just a few days ago I was wondering why Go was not providing a filter or map method for arrays or slices, and he actually answers it during this talk.

Such an inspiring video that I think every programmer should see, even if not interested in Go! 

{% youtube rFejpH_tAHM %}

My key key take aways:

## New features
- a lot of languages are adding new features (coff... coff.. JavaScript...)
- a lot of this new features are the same ones across languages
- these languages are starting to look very similar one another
- if programmers use very similar languages, they will start to all think the same way
- in reality, what you ideally want, is a language that is **very good at solving domain specific problems**

## Complexity
- more features equals more complexity 
- Go has added a very small set of features
- how to pick the right feature to add? By [picking only the right ones](https://youtu.be/rFejpH_tAHM?t=263)!


## Readability
- more features means more time spent thinking about **how** to write something
- ideally you want a language to allow for [one way - or at least not many ways - of writing a thing](https://youtu.be/rFejpH_tAHM?t=371)
- a smaller feature set makes it more maintainable in the long run

## Simplicity
- a lot of thinking has to be put to achieve simplicity
- GC is one example of it in Go. A very difficult feature to implement that is 100% hidden from the end user, or even from the spec
- the interface to the user might be simple, even the implementation in the language might be simple, but the design of a feature is very likely to be a long, difficult process
- a lot of complexity might lie behind very simple code. He makes a fantastic walkthrough of a simple server written in Go and what's happening behind the scenes [here](https://youtu.be/rFejpH_tAHM?t=1266)

Bottom line is, **simplicity is hard to get**, but - if you get it right - makes doing complicated things easy to achieve for your users.
How to plan an impactful git log
Tags: git
Published: 2019-11-27 13:52:58

You have decided that you would rather have your git log be concise and informative than a minute-by-minute log of everything you did. But your commit log still doesn't feel as useful as it should be. Some changes seem random or unrelated to the commit message it was introduced in. Squashing everything is a chore.

Git provides you with some features for creating great messages that will even tie into a [gitlab feature.](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/8124)

### Step zero

Setup your gitconfig with the following.

```
[alias]
  fu = commit -a --fixup
  fuh = commit -a --fixup HEAD
  sq = commit -a --squash
  sqh = commit -a --squash HEAD
  squash = "!f() { git rebase -i --autosquash ${1:-master}; }; f"
```

### Starting your work

Do some work and commit it with a message describing what the feature is.

### When you make a decision or major change

Run `git sqh` and provide a message explaining your decision or change.

### When you need to push or make some trivial changes

Run `git fuh` to commit without a message.

### Multiple final commits

You may be working and need to make a change that is tangential to the feature and want to be considerate to future devs by splitting the work into multiple final commits. In this instance we will be using `fu` and `sq`.

`git fu (commit)`
`git sq (commit)`

### When you are done with the feature

Run `git squash` to clean up the commit history. You will first be presented with the interactive rebase prompt and you probably wont need to do anything and just save and exit the prompt. Then you will be presented with a final commit message with the initial commit message and all the squash messages you made before and you can use all that information to write an informative commit message for future developers.

### Appendix

For more information read the documentation at `man git-commit` and `man git-rebase`.
Workshop Summit coming to Belgium in 2020
Tags: events
Published: 2019-11-27 13:41:53

Looking for a new event to attend in Europe where you really get to code and learn by doing?

Check out Workshop Summit (http://workshop-summit.com/) and join the first edition of an event with only hands-on workshops!

Confirmed topics include: Golang, Continuous Delivery, React, VueJS, Angular & RxJS, Tensorflow.JS and ML, Azure, Software Architecture, UX Mobile, SVG Animation, Openshift, Ionic, Quarkus, GraphQL, and .NET Core.
Create Your First Flutter App
Published: 2019-11-27 13:32:34

In this Flutter Tutorial, we will help you build and install your very first flutter app that will be Personal Expense with rich UI and complete functionalities. After this tutorial, you can make your own apps and can publish them on the App Store and Play Store.

So What Is Flutter?
Flutter is Google’s mobile app SDK for crafting high-quality native interfaces on iOS and Android in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source. Flutter works on one codebase but results in building native apps for both Android and iOS.

Basic Requirements Before Starting With Flutter
Knowledge of Dart, which is essential for developing Flutter Applications. Learn more about Dart from https://dart.dev/guides.

Architecture of Flutter
<img src="https://codersera.com/blog/wp-content/uploads/2019/08/Screen-Shot-2019-08-02-at-12.53.55-PM-1024x321.png">

Everything is a widget in Flutter App. Flutter gives you a plethora of widgets for building rich UI with powerful functionalities. There may be more than one way of achieving the same UI or functionality in Flutter. Flutter embrace Platform Differences, that means if you want to make your app function in one way in Android but differently in iOS and even if you want to make your app function differently in different device sizes. Flutter works on One Codebase but results in having an app for both iOS and Android, it is just same as Learn Once Write Anywhere.

Create your <a href="https://codersera.com/blog/first-flutter-app/">flutter App</a>
How do you handle burning out?
Tags: discuss, mentalhealth, productivity
Published: 2019-11-27 13:28:43

---
title: How do you handle burning out?
published: true
description: a discussion about burning out in tech
tags: discussion, mental health, productivity
---

Hey there, I just want to start a little discussion about burning out in tech, I feel that is something that happens a lot, and I have struggled with it too.

Share your thoughts about it, how do you keep yourself motivated, how do you keep focused on your work without feeling bored or tired.
Running a script as part of an msix package
Tags: help
Published: 2019-11-27 13:05:43

Has anyone tried to run a script before (after, or even during) a Windows MSix installation (Windows Application Packaging Project)?  Unless I'm missing something, there's nothing in the <a href="https://docs.microsoft.com/en-us/windows/msix/">docs</a> that mention you being able to do this.  Is it even possible?
API design; test automation tips; & unwritten rules of software engineering
Tags: todayilearned, testing, programming
Published: 2019-11-27 13:00:12

*TL;DR style notes from articles I read today.*

### [Just starting out with test automation? Don't make this mistake](http://bit.ly/2OLYSiN)

- Whittle down big tests into smaller, shorter ones.
- Don’t wait for the perfect tool, perfect use case, perfect resources. Just start with small automation. 
- Smaller tests let you learn faster, contribute sooner, create forward momentum, and get more frequent feedback. 
- Let teams focus on learning test automation first before you ask them to focus on complex business logic. 
- Automate in small sprints so you can gauge progress, iterate and gather feedback on them from testers, developers and product owners. 

*[Full post here](http://bit.ly/2OLYSiN), 5 mins read* 

---

### [10 rules for good API design](http://bit.ly/34pAHgS)

- Make the API modular so it is easy to separate experimental pieces from stable ones. Also, make it extensible. 
- Use the same style and conventions for each class. Document those conventions and impose them as a required standard for contributors.
- Grow your API by layering new APIs on top of it. Avoid exceeding the current one’s scope.
- Minimize the visible surface area of the API.
- Keep your API portable across OSes and don’t let system concepts leak into it. 

*[Full post here](http://bit.ly/34pAHgS), 4 mins read* 

---

### [“Don’t deploy on Friday” and 3 other “unwritten rules” of software engineering](http://bit.ly/2slonA9)

- Even if you have continuous deployment, Fridays are the worst day to push to master. You only get half a day to fix bugs. 
- Keep a couple of backups (for redundancy) of your database, cryptographic keys, configuration files, VM images, images and videos, even imported packages. Git is not enough. 
- Wait for complete specs before you begin a build. Avoid assumptions and ask lots of questions, to pinpoint requirements as precisely as possible. Especially, probe corners and edge cases.
- Try to gently stop or prevent unproductive discussions. It is okay to ask for a longwinded discussion to be shelved for more productive work. 

*[Full post here](http://bit.ly/2slonA9), 4 mins read* 

---

*[Get these TL;DR style notes directly to your inbox every weekday by signing up for my newsletter, in.snippets(), here.](https://mailchi.mp/appsmith/insnippets?utm_source=devto&utm_medium=post08&utm_campaign=is)*