teleren/devto huggingface dataset:
A Short Introduction to Vectors
Tags: computerscience
Published: 2019-05-11 20:24:46

---
title: A Short Introduction to Vectors
published: true
tags: Computer Science
canonical_url: https://skerritt.blog/open
---

### What is a vector?

A vector is a container where order matters and repititions are allowed. An N-vector has n components (elements), each component called Different values in a vector can be the same, so:

![A Short Introduction to Vectors](https://cdn-images-1.medium.com/max/800/1*Ni5sW5wzKXtXj1KvLrh5mw.png)

is entirely possible with Vectors.

![A Short Introduction to Vectors](https://cdn-images-1.medium.com/max/800/1*jNFBSGysOBxgS0I6vEaALg.png)

A 2-vector represents 2 dimensional space and a 3-vector represents 3-dimensional space.

### Doing maths with vectors

Two vectors can be added like so:

![A Short Introduction to Vectors](https://cdn-images-1.medium.com/max/800/1*1qCtyQtRl5pE253StarNrg.png)

The resultant is a new vector, called W.

You can only add two vectors if the vectors have the same number of components.

Scalar multiplcation is where you increase every item in a vector by R. Let R be a real number then:

![A Short Introduction to Vectors](https://cdn-images-1.medium.com/max/800/1*4rxXRqaTEPWNkPQH9_9cOg.png)

Vector length can be defined using cardinality. The length of a vector, A, is |A|. The length of a vector has uses this formula:

![A Short Introduction to Vectors](https://cdn-images-1.medium.com/max/800/1*cLhJUkS6A7OjRmGKYk4KLw.png)

If you try to calculate the length of a negative vector, you get the length of the positive vector.

![A Short Introduction to Vectors](https://cdn-images-1.medium.com/max/800/1*uW79OVDXNYCXVPyQeBlaSw.png)

Another thing to note is:

![A Short Introduction to Vectors](https://cdn-images-1.medium.com/max/800/1*Ws8lbvI2bySYZ4ujiT-fMw.png)

To reverse a vector you times each component by -1, making everything negative, and

![A Short Introduction to Vectors](https://cdn-images-1.medium.com/max/800/1*ummIijJ6Gj89wKitnkO46Q.png)

### Vector Space

Start with some set of numbers such as real numbers, integers, whole numbers, rationals etc.

![A Short Introduction to Vectors](https://cdn-images-1.medium.com/max/800/1*7QwBJhyNjgkDgnAQeFjk3w.png)

The superscript number ontop of a set of numbers such as is the set of all real valued (numbers that are in the real numbers) n-vectors where each component is in the set of Real numbers.
How to rename a local and remote branch in git
Tags: git, showdev, webdev, tutorial
Published: 2020-01-08 13:32:02

---
title: How to rename a local and remote branch in git
published: true
date: 2019-01-08 00:00:00 UTC
tags: ['git', 'showdev', 'webdev', 'tutorial']
canonical_url: https://learnwithparam.com/blog/how-to-rename-local-and-remote-branch-in-git/
description: Often, we want to rename the branch in Git. Totally we will see, one of the easiest way to do it for both local and remote branch
---

Before going into the details, let's look at some of the reasons why we want to rename a branch,

- typos in the branch name
- created a branch with a name and then realize, that branch does more than that (e.g, `add-client` to `crud-client`)
- created a dummy name (eg., `yet-another-branch` to `fix/reports`)
- Also to add more details about the branch (e.g, `feat/branch-name`, `fix/branch-name`)

and so on

### How to rename a branch locally

In this example, we are going to rename the branch from `old-reports` to `new-reports`.

```bash
## go to the old branch
git checkout old-reports

## Rename the branch to a new name
git branch -m new-reports
```

`-m` in git denotes, move this old branch to new branch and remove the old branch.

### How to rename the branch remotely

What if the old branch is pushed to remote origin. Its very simple, delete the old remote branch first and push the new local branch to remote origin.

For deleting a remote branch,

```bash
git push origin -d old-reports
```

Here `-d` or `--delete` will delete the old branch remotely. If you specify `-D`, it will only delete locally not in the remote origin.

then push the current branch to origin,

```bash
git push -u origin new-reports
```

Hope you learned a trick to rename a local and remote branch in your git repository 😎
The history behind "grep"'s name
Tags: linux, bash, grep
Published: 2019-01-07 23:54:38

---
title: The history behind "grep"'s name 
published: true
description: A quick historical tour over the reasons behind grep's name
cover_image: https://thepracticaldev.s3.amazonaws.com/i/033ixdnhwksic8n5g7wl.PNG
tags: linux, bash, grep
---

*Originally posted in [my portfolio](https://hamza-tam.gitlab.io).*

**grep**, a tool that is widely used in the Unix world, a tool that no one could live without. It's one of the first command to which every linux beginner is introduced from its start, so its function is no secret to no one. However, what's the history behind its weird name ?

The answer to this question requires us to go back to the early days of Unix, days of resource scarcity, may they be processing power or memory resources. Software developper of the time had to play by the rules and develop very light programs that get the job done. And one of those tools was the **ed** text editor. But this editor is nothing like the modern editor we have today (VIM looks like JetBrains IDEs next to it). To see a line of text from the text buffer you needed to type __p__ preceeded by the line number. And for searching the buffer for an occurence of a regular expression we could use like in VIM __/regularexpression__. But for us to search for all the occurences and print them we'll use __g/regularexpression/p__, written simply __g/re/p__. And that's how the world **grep** was born.

The history of Unix is full of these stories. Amazing stories about those early days of computing.
First Post 
Tags: hello, introduction
Published: 2019-01-07 22:55:51

---
title: First Post 
published: true
description: Introductory Note
tags: hello, introduction
---

Hi, this is me, Mithun. I am just another developer who aspires to build something useful and great for people to use and enjoy, at the same time keeping it open source so may be others can also engage and contribute and criticize me to do it better.
Hope to build something great and work with people. 
Cheers,
Mithun
How do you automatize tests that need visual confirmation?
Tags: discuss, web, testing
Published: 2019-01-07 22:31:00

---
title: How do you automatize tests that need visual confirmation?
published: true
tags: discuss, web, testing
---
Imagine the following scenario: you have a mockup or a **definition** about how should look some user interface (in a web application). The definition says: the user name must be centered in big screens and placed 10% from the left side when it is displayed in a small screens. It also has definitions for font size and other stuff.

I know this could be achieved with tools like **puppeteer** and DOM manipulation to get the CSS and comparing values but what if I want to automatize this kind of tasks giving an image to a magical **tool** and tell it "this user interface should look like this image"?

I know there are already some tools that can convert images into HTML, but does some magic tool exist that can actually determine if a user interface looks like a mockup? Would it improve the timings for tests that needs visual confirmation having in mind the time that could be needed to write such tests?

I'm eager to read your thoughts.
Learning Algorithms with JS, Python and Java #11: Count the Vowels
Tags: algorithms, javascript, python, java
Published: 2019-01-07 22:27:42

---
title: Learning Algorithms with JS, Python and Java #11: Count the Vowels
published: true
description: 
tags: algorithms, javascript, python, java
---

This series of articles follows Stephen Grider's [Udemy course](https://www.udemy.com/coding-interview-bootcamp-algorithms-and-data-structure/) in three different languages.

Today's question is a simple introduction to regular expressions.

> --- Directions
> Write a function that returns the number of vowels
> used in a string.  Vowels are the characters 'a', 'e'
> 'i', 'o', and 'u'.
> --- Examples
>   vowels('Hi There!') --> 3
>   vowels('Why do you ask?') --> 4
>   vowels('Why?') --> 0

#1: Iterative Solution

JavaScript:
```
function vowels(str) {
  let count = 0;
  let checker = ['a', 'e', 'i', 'o', 'u'];
  for (char of str.toLowerCase()) {
    if (checker.includes(char)) {
      count++;
    }
  }
  return count;
}
```

Python:
```
def vowels(string):
    count = 0
    checker = ['a', 'e', 'i', 'o', 'u']
    for char in string.lower():
        if char in checker:
            count += 1
    return count

```

Java:
```
import java.util.Arrays;
import java.util.List;

static int vowels(String str) {
	int count = 0;
	List<Character> checker = Arrays.asList('a', 'e', 'i', 'o', 'u');
	for (char chr : str.toLowerCase().toCharArray()) {
		if (checker.contains(chr)) {
			count++;
		}
	}
	return count;
}
```

#2: Using Regular Expression

JavaScript:
```
function vowels(str) {
  const matches = str.match(/[aeiou]/gi); // an array or null
  return matches ? matches.length : 0;
}
```

Python:
```
import re

def vowels(string):
    matches = re.findall('[aeiou]', string, re.IGNORECASE)  # a list
    return len(matches)

```

Java:
```
import java.util.regex.Matcher;
import java.util.regex.Pattern;

static int vowels(String str) {
	Pattern pattern = Pattern.compile("[aeiou]", Pattern.CASE_INSENSITIVE);
	Matcher matcher = pattern.matcher(str);
	int count = 0;
	while (matcher.find()) {
		count++;
	}
	return count;
}
```

Java 9+:
```
import java.util.regex.Pattern;

static long vowels(String str) {
	return Pattern.compile("[aeiou]", Pattern.CASE_INSENSITIVE)
			.matcher(str)
			.results()
			.count();
}
```
My Case for D
Tags: dlang
Published: 2019-01-07 21:51:31

---
title: My Case for D
published: true
description: I ask my self, is there a reason I shouldn't use D.
tags: dlang
---

D has been a part of my programming life almost from the beginning. I started with ZZT an ascii computer game, HTML played a role in my development but ultimately chose perl as my first programming language while a friend picked up BASIC. I read through most of "Teach Yourself C++ in 21 Days." All of this was in High School. I finally took a course in Java and on of the things I did was look for a better language than C++, I came across D and I'm talking [old docs](https://web.archive.org/web/20021205114505fw_/http://digitalmars.com:80/d/index.html). But I wasn't ready for a language this young. Finally a few years later I went to look for that better language again (couldn't remember the name for the life of me) and it has been with me ever since.

[D](https://dlang.org/) has become my scripting language. When others would reach for a dynamic language, I grab D. It is also a language I get to use to explore other areas of programming: different programming techniques, different programming layers (compile time vs runtime), manual memory management, C, DLLs, COM, Webservers, GUI.

See, the graphical side of D still hasn't reached a reasonable state even today. But there are bindings and it can be done. Outside of that though, D has created a rich capability as a Swiss army knife. I have to test our software, which means doing some very innovative stuff like writing a [MSI Custom Action DLL](https://he-the-great.livejournal.com/58420.html). On top of that I need to inject it into the MSI and Orca wouldn't do when the setup would be automated and that meant oven more Win32 API calls for MSI manipulation. While I know I could write the DLL in C# I'm not sure if manipulating the MSI could have been done outside C, C++, D.

[Programming in D](http://ddili.org/ders/d.en/index.html)
GitHub Private Repos are Now Free
Tags: news, opensource
Published: 2019-01-07 20:52:57

---
title: GitHub Private Repos are Now Free
published: true
description: It comes with up to three collaborators per repo.
tags: news, opensource
---

[GitHub announced unlimited free private repos today.](https://blog.github.com/2019-01-07-new-year-new-github/)

{% twitter 1082345362503938049 %}

You can add up to three collaborators to each private repo. There's also some other news related to the other pricing levels they have.

Personally the main reason I made a GitLab account was for the private repos. Think I'll stick with GitHub just because of familiarity. What are your thoughts?
An Introduction to Graylog
Tags: blog, devops, english, graylog
Published: 2019-01-07 21:05:03

---
title: An Introduction to Graylog
published: true
tags: Blog,DevOps,English,Graylog
canonical_url: https://globalelements.ch/2019/01/07/an-introduction-to-graylog/
---

Graylog, recently released in [version 2.5](https://www.graylog.org/post/announcing-graylog-v2-5), is an alternative to the well-known ELK stack (Elasticsearch, Logstash, Kibana). In comparison to the ELK-stack, Graylog uses MongoDB as a storage backend for settings and authentication, and leverages Elasticsearch as a document store.

This post is going to be a part of a series that will explore Graylog in detail. Stay tuned!

![](https://globalelements.ch/wp-content/uploads/2019/01/graylog_dashboard-300x203.png)<figcaption>The sample dashboard as shown in the graylog documentation.</figcaption>

If you’re looking for an easy-to-go application, that is yet quite powerful and can be customized quite well – and on top of that, is [Open Source](https://github.com/Graylog2/graylog2-server) – Graylog might be your solution. Additionaly compared to the „classic“ ELK stack, Graylog provides a fully-fledged authentication backend, and also allows to integrate with any LDAP directory (for example, ActiveDirectory).

The key concept of Graylog are inputs, which are nothing else than definitions of „how to receive messages“. It supports the well-known Syslog format and the GELF format, which is a JSON-definition maintained by Graylog itself. GELF is supported through UDP and TCP, which makes Graylog quite powerful – delivering log messages through the internet is not an issue at all, as the TCP connection does support TLS for encrypted transfer. Graylog can also easily be configured to act as a relay and forward any (or messages matching a pattern) to another instance.

Inputs are routed into streams, which represent a collection of messages. Streams can be configured to be filled by messages matching a pattern (e.g. a regular expression). If you ever require to extract information from a log message, extractors come to help. Extractors allow to, well, extract data from a messages by applying regular expressions, and the converting the data to various formats, like date or IP-adresses.

If that is not enough, Graylog provides a concept called pipelines. Pipelines basically allow you to „code“ a custom, complex process on how an incoming log message might be processed. This can include modifying and routing a message. A classic example would be that a message is routed into a stream based on an IP address, but the IP address must be removed from the message before it is stored (e.g. any GDPR compliance).

Having implemented Graylog in multiple projects, we would [love to assist you](https://globalelements.ch/kontakt/) on your next project requiring a scalable, centralized and powerful logging application.

Der Beitrag [An Introduction to Graylog](https://globalelements.ch/2019/01/07/an-introduction-to-graylog/) erschien zuerst auf [Global Elements GmbH](https://globalelements.ch).
Did I try looking for a job too fast?
Tags: anonymous, career, discuss
Published: 2019-01-07 20:41:09

---
title: Did I try looking for a job too fast?
published: true
tags: anonymous, career, discuss
---
_This is an anonymous post sent in by a member who does not want their name disclosed. Please be thoughtful with your responses, as these are usually tough posts to write. Email sloan@dev.to if you'd like to leave an anonymous comment._

I'm a bit confused right now. I think I messed up a perfectly good opportunity to find work because I ran too fast towards looking for a job. Here are the details.

I graduated from code boot camp in mid-November. I spent extra hours after regular working hours were over, grinding away. My camp runs a career fair where kind people from the surrounding area with ties to our business development branch come in and interview students. Camp grads can only attend one, ever. I took the one taking place 3 weeks later. In retrospect, I feel like I should have bided my time and attended the later career fair but it's in February and at the time, I thought that was too far away. I feel dumb. Of the 4 interviews I did, I got 2 email confirmations and then 1 invite to a hiring day. 

I go to the event. There are 3 other candidates. My interview was alright and then we received a practical test. We were to build out a project as much as we can, add documentation in a readme, and a way to build out the project from the repo. I did my best but in the end, I got passed over. No problem. But then I find out one of the other 3 guys was a dead ringer. This dude had 3 months of previous experience in the same role! He was a good guy and he definitely deserved it. I bear no ill will.

So I started looking inward. I don't have a traditional background. My repo has a decent number of commits but I  haven't had a code review, ever. I might suck, I don't know! Did I screw up by not biding my time and "launching" during the later career fair a few months later?

I can't help but feel like career fairs are just like meet and greets. They are formalities and the only people anybody wants already has enough experience to do the job anyways. Nobody wants juniors, ever. Maybe I should just work a regular job and for the next few months on nights and weekends contribute to open source or non-profits. Maybe after a few months, I can break into the industry. I'm lost right now. Can I get some advice?
The 7 Most Popular DEV Posts from the Past Week
Tags: top7, bestofdev
Published: 2019-01-07 20:00:44

---
title: The 7 Most Popular DEV Posts from the Past Week
published: true
description: A round up of the most-read and most-loved contributions from the community this past week.
tags: icymi, bestofdev 
cover_image: https://thepracticaldev.s3.amazonaws.com/i/sfwcvweirpf2qka2lg2b.png
---
Every Monday we round up the previous week's top posts based on traffic, engagement, and a hint of editorial curation. The typical week starts on Monday and ends on Sunday, but don't worry, we take into account posts that are published later in the week. ❤️


#1. It's the little things.

Antonin shares a list of tasks and goals for devs to consider in the new year. Suggestions range from catching up with an ex-colleague to publishing a package to cleaning your keyboard.

{% link https://dev.to/antjanus/10ish-teeny-tiny-resolutions-to-become-a-better-developer-in-2019-54f5 %}

#2. Understanding the process.

Emma walks us through a typical front-end interview process and shares some tips for success -- from the 'culture' conversation to the take home challenge.

{% link https://dev.to/emmawedekind/decoding-the-front-end-interview-process-14dl %}

#3. Make your life easier!

Darren showcases some of the best command line tools they've discovered. Hopefully they will help you too!

{% link https://dev.to/_darrenburns/10-tools-to-power-up-your-command-line-4id4 %}

#4. Bright Future

Ross shares why they think the future is looking bright for this framework and community. Vue.js is just plain fun!

{% link https://dev.to/rossta/seven-reasons-learn-vuejs-in-2019-2n9o %}

#5. Short & Simple (JavaScript)

A quick explanation of how to use  `AmbientLightSensor`. 

{% link https://dev.to/ananyaneogi/enabling-dark-mode-on-websites-based-on-surrounding-light--3jel %}

#6. GraphQL > REST

A comprehensive introduction to GraphQL. 

{% link https://dev.to/leonardomso/a-beginners-guide-to-graphql-3kjj %}


#7. #BaseDS

Vaidehi is back with a new series on distributed systems! What more is there to say?! This is an introductory post on _what_ distributed systems are.

{% link https://dev.to/vaidehijoshi/many-nodes-one-distributed-system-kl9 %}


_That's it for our weekly wrap up! Keep an eye on dev.to this week for daily content and discussions...and if you miss anything, we'll be sure to recap it next Monday!_
Using JS Teach JS, A Cool Editor
Tags: javascript, editor, cool, tool
Published: 2019-01-07 20:00:11

---
title: Using JS Teach JS, A Cool Editor
published: true
description: 
tags: js, editor, cool, tool
---
In this video the editor is cool. The pic shows while coding. I want to know if I can get it.

{% youtube H4sSldXv_S4 %}
Reading and Writing Files in C: Part 2
Tags: c, io, file
Published: 2019-01-07 19:59:32

The last article in this series dealt with characters and using loops with `fgetc()` and `fputc()` to read and write a series of characters or strings. Reading or writing a series of characters is such a common operation it would make sense that the C standard file I/O library has this functionality available for us.

Our demonstration program will write one line of text using `fputs()`.

`fputs()` is almost exactly the same as `fputc()` except, as you could have guessed, it writes a string instead of a single character. The return value for `fgets()` is a nonnegative number on a successful write or `EOF` on error.

Example:

```cpp
#include <stdio.h>

int main(void)
{
    FILE *f = fopen("test", "w");
    char *message = "I am a line with in a file\n";
    fputs(message, f);
}
```

Output:

```cpp
~/Desktop 
➜ clang main.c 

~/Desktop 
➜ ./a.out 

~/Desktop 
➜ cat test 
I am a line with in a file

~/Desktop 
➜ 
```

We wrote a line of text in a file and it would make sense to read it back into the program. On the reading side of file I/O we have a string version of `fgetc()`: `fgets()`.

The first argument of `fgets()` takes a pointer to a char array that can hold the string you're going to read in from the file. The second argument tells how many characters to read in and whatever is specified will be subtracted by 1. For example, if you want to read 100 characters, `fgets()` at most will read in 99 characters. The third and last argument is a pointer to a `FILE` object.

The return value of `fgets()` on success is the pointer to the char array provided as the first argument. On error, a NULL pointer is returned.

Example:

```cpp
#include <stdio.h>

int main(void)
{
    FILE *f = fopen("test", "r");
    char message[100];
    if(fgets(message, 27, f) == NULL)
    {
        printf("Error when reading string!\n");
        return 1;
    }
    printf("%s\n", message);
}
```

Output:

```cpp
~/Desktop 
➜ clang main.c 

~/Desktop 
➜ ./a.out 
I am a line with in a file

~/Desktop 
➜ 
```

## Next

For the next entry in this series, we will talk a little more about EOF and the errors that could happen and how we can differentiate between the two.
[Comic] Debugging vs Icecream
Tags: webdev, culture, art, comics
Published: 2019-01-07 18:54:05

---
title: [Comic] Debugging vs Icecream
published: true
description: A cartoon peach thinks about ice cream while he debugs python code.
tags: webdev,culture,art,comics
canonical_url: https://www.instagram.com/p/BsTeMCGg2Fb/
series: Peche
---

{% instagram BsTeMCGg2Fb %}