teleren/devto huggingface dataset:
Ubuntu setup
Tags: ubuntu, development
Published: 2020-01-02 06:58:49

---
title: Ubuntu setup
published: true
date: 2019-12-08 00:00:00 UTC
tags: ubuntu, development
canonical_url: http://jamessessford.com/blog/ubuntu-setup
---

I'd set aside a couple of days to get my laptop fully up and running; I hadn't had much Linux experience outside of Raspbian and thought it may have been challenging to get the tools I was used to setup and working together. I was very happy to be proven wrong.

To get started, I grabbed the image of Ubuntu 16.04, burned it to a USB key and booted the machine into Ubuntu. After following the install steps through and unpinning everything from the Launcher that was attached, I was ready to start exploring!

Let's fast forward a couple of hours.

The laptop is now set up and running a test project I had configured on my Windows machine. The programs I have installed are:

```
- Git
- Terminator
- ZSH
- oh-my-zsh
- MySQL
- MyCLI
- PHP 5.6
- PHP 7.3
- Composer
- Node.js
- npm
- Supervisor
- VSCode
- Nginx
- Redis
```

I instantly feel like my productivity has increased with Terminator and Nginx alone. Terminator giving me split screen tabs is phenomenal, as is the tab less I now require from having a server run my applications instead of serving them via Artisan.

It's nice to also be able to use VSCode, Firefox and webpack without my computer freezing as well!
Shout-out to the doers, the creators, the makers
Tags: node, javascript, cms
Published: 2019-12-07 22:36:55

Just wanted to quickly say how impressed I am with the nodeJS developer community. It's been less than a week since we published the first tiny [node-sdk](https://www.npmjs.com/package/blua-blue-node-sdk) and people came back with beautiful integrations.


If you are among the people building templates/generators with it, please share.
Introdução ao Desenvolvimento Mobile com Framework7
Tags: javascript, framework7, mobile, webdev
Published: 2019-12-07 22:25:33

<p><b>O que é o Framework7?</b></p>

<p>
É um framework para o desenvolvimento de aplicações mobile com <b>HTML</b>, <b>CSS</b> e <b>Javascript</b>. Pra fins didáticos vamos dizer que ele é meio que uma fusão do <b>JQuery</b> (biblioteca Javascript que ajuda a manipulação do HTML) com o <b>Bootstrap</b> (framework para desenvolvimento de interfaces responsivas), adicionado de features para lidar com o ambiente mobile/desktop. Um similar muito popular é o 
<a href="https://ionicframework.com/">Ionic</a>.
</p>

<p>
Inicialmente, nós vamos trabalhar apenas no navegador, pra que possamos por a mão no código mais rápido e evitar a chatisse da preparação do ambiente toda de uma vez. Mas não se preocupe, aprenderemos a instalar nossos aplicativos nos dispositivos para que possamos mostrar nosso app por aí.
</p>
<p>
<img src="https://minervainfotech.com/blog/wp-content/uploads/2019/10/native-vs-hybrid1200.jpg" />
</p>
<p><b>O que é interessante saber desde já?</b></p>

<p>Cada plataforma tem sua forma exclusiva de desenvolvimento de apps. Sua forma <b>nativa</b>. Que no caso do Android é utilizando as linguagens Java ou Kotlin, e do iOS é utilizando Objective-C ou Swift. Só de ler isso você já deve imaginar o quanto de trabalho não dá escrever um aplicativo <b>nativo</b> para as duas plataformas.</p>
<p>A vantagem é a proximidade que você está do dispositivo, isso é: você tem um melhor acesso a todas as funcionalidades - isso sem falar da peformance. Nesse contexto, existem diversas ferramentas que tem essa ideia de programar só uma vez e rodar nos dois ambientes.</p> 
<p>E é nessa categoria que o Framework7 se encaixa, a do <b>desenvolvimento híbrido</b>.</p>
<p>Do lado de cá, abrimos mão de um app totalmente fluido e com acesso a tudo que o dispositivo disponibiliza para reduzir o custo de produção.</p>
<p><img  src="https://media.giphy.com/media/94EQmVHkveNck/giphy.gif"/></p>
<p>Para que fique claro: <b>a melhor alternativa vai sempre depender do contexto.</b></p>
<p>Por hoje é só, mas fique atento que no próximo artigo vamos preparar o ambiente para usar o framework7 e começar a <b>codar</b>. Até lá.</p>
Advent github repo cleanup
Tags: github, archive, delete, actionscript
Published: 2019-12-07 21:53:23

Today I went through the list of [my repositories on github](https://github.com/karfau?tab=repositories) to do some cleanup:

I [deleted](https://help.github.com/en/github/administering-a-repository/deleting-a-repository) forks that didn't have any (forks or) branches from me that I wanted to keep.

I [archived](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/archiving-a-github-repository) all repositories related to Actionscript/Flash.

It was a bit tedious but it also feels good. 

The biggest surprise was when I opened the no longer existing repository [karfau/bachelor-thesis](https://github.com/karfau/bachelor-thesis), since I expected to see some latex source code but instead it showed the well known instructions for the first commit. 

Since it was created at least nine years ago, that might be a new record for a repo not being initialized? (Since there is no trace of it in my activities I can not prove that one.)

I'm quite sure I used git when writing the thesis, but obviously I did never push that code. I wonder if I can still find a copy of it on some old hard drive or CD...


Feel free to share what kind of repos you archived/deleted and what interesting things you (re)discovered while doing that.
Multiplexing terminal sessions (orbjet.org)
Tags: terminal, linux, devops, sre
Published: 2019-12-07 21:48:14

Taking into consideration the UNIX philosophy (“Make each program do one thing well.”), the terminal multiplexer expands on this idea by doing several things quite well, giving the operator additional console agility and swiftness.

In order to formulate this activity better, multiplexing represents a process used to send multiple data streams over a single channel or medium which is called a multiplexer.

The post continues at the original site [here](https://www.orbjet.org/post/2019-12-07/multiplexing-terminal-sessions/) and covers GNU screen and tmux.
How to Write Emulator - Intro
Tags: c, devblog, emulator, corewar
Published: 2019-12-08 08:10:04

---
title: How to Write Emulator - Intro
published: true
date: 2019-12-07 21:41:24 UTC
tags: c++, devblog, emulator, Corewar
canonical_url: https://sausage-factory.games/dev-blog/how-to-write-emulator-intro/
---

To begin, this isn’t technically an emulator, the system I’m trying to model isn’t real. This is more of a simulator, but that’s less of a catchy search word on the Internet.

## What is Core War

“Core War is a 1984 programming game created by D. G. Jones and A. K. Dewdney in which two or more battle programs (called “warriors”) compete for control of a virtual computer. These battle programs are written in an abstract assembly language called Redcode.” [Wikipedia](https://en.wikipedia.org/wiki/Core_War)

There are some terms that are helpful to know, and which I will probably end up mixing together

- Core War - This is the programming game itself
- Warrior - A program written in Redcode
- Redcode - The assembly language
- MARS - Memory Array Redcode Simulator. The actual simulator.
- Core - The memory where the programs run

## What I’m Making

I’m making a version of the MARS in C++, which can run and interpret the Redcode programming language. The aim being to create a simulator that can load and execute Redcode programs, displaying the state of the simulator and possibly allow running programs to be debugged.

## Redcode

Redcode is a type of assembly language, modelled after CISC assembly languages of the 1980s. It looks like this:

```
ADD.AB # 4, $ 3
MOV.F $ 2, @ 2
JMP.B $ -2, $ 0
DAT.F # 0, # 0
```

Each instruction contains an opcode and two operands. The opcode can have an optional modifier, and the operands can have optional addressing modes. The combination of the simple opcodes with the modifiers and addressing modes allows complex “Warriors” to be created. The aim being to write a warrior that will outlast all the other running warriors in the simulation.

## Steps Required

To make this work, I need to create the following sections

- A simulation of the machine’s RAM (called the “core”). This is 8000 bytes of contiguous memory which is treated as a circular array. The ends wrap around.
- The MARS itself. A Redcode simulator follows a well defined Fetch-Decode-Execute cycle where each instruction takes one cycle to complete.
- A file parser for source code. A programmable machine is of no use if there’s no way to get code into it, after all!
- Visual display. Most CoreWar simulators show the core as a grid of blocks so you can watch the programs running. Some allow programs to be disassembled or stepped through.
Adapter Design Pattern
Tags: designpatterns, codequality, java
Published: 2019-12-07 21:39:14

We all have written code where we needed just few functionality from a class but because of object incompatibility we'll have to create a new class and duplicate this few functionality.

Well, that's where the adapter design pattern comes into play. It's a behavioral design pattern that allows us to use an incompatible class by creating an adapter class.

Say you have a VGA display and your laptop only has port for an HDMI display, then you couldn't connect the display to the laptop unless you connect them via an VGA - HDMI adapter. That's exactly what we to code in adapter pattern, because function is same either with HDMI or VGA display that is to display but the underlying mechanism for achieving it  between them is different, thus the adapter bridges the difference in the underlying mechanism, by introducing an adapter class which extends the adaptor class(HDMI) and takes the adapter(VGA) as a parameter. 

Because the adapter extends the the adaptor they can be substituted for each other. Now the function needed can be overridden to behave like the adapter or the similar function from the adapter class could be called in the overridden function, creating an illusion of using the incompatible class directly in place of the correct type.

I've modelled this in code using Java. link at: https://github.com/idawud/Adapter-design-pattern
Creating ASP.NET Core 3.0 React SPA with Entity Framework Core Identity Server for MySQL Database in 20 Minutes
Tags: identityserver4, aspnetcore3, mysqldatabase, react
Published: 2019-12-07 21:06:24

---
cover_image: https://thepracticaldev.s3.amazonaws.com/i/sbv18r48hbqd4kafkqqu.png
title: Creating ASP.NET Core 3.0 React SPA with Entity Framework Core Identity Server for MySQL Database in 20 Minutes
published: true
description: This tutorial uses .net core version 3.0 The web app has react as front end, MySQL as Database layer where the asp.net membership related schema will be migrated to.
tags: identity server 4, asp.net core 3, mysql database, react
---

This tutorial uses .net core version 3.0 The web app has react as front end, MySQL as Database layer where the asp.net membership related schema will be migrated to.


Pre-Requisites:
Microsoft Visual Studio 2019 Community Edition

.net core 3 https://dotnet.microsoft.com/download/dotnet-core

MySQL Tools for Visutal Studio https://dev.mysql.com/downloads/windows/visualstudio/

mysql-for-visualstudio-1.2.9.msi (https://dev.mysql.com/downloads/windows/visualstudio/)

Configurating ASP.NET Membership web app for MySQL
Step 1:
Delete Migrations Directory under the Data Directory

Step 2:
Uninstall the package Microsoft.EntityFrameworkCore.SQLServer Install the package Pomelo.EntityFrameworkCore.MySql

Step 3:
Create db in MySql

CREATE SCHEMA reactmembership;

Step 4:
Update value of DefaultConnection in appsettings.json to

server=localhost;port=3306;database=reactmembership;user=root;password=p@$$w0Rd;CharSet=utf8

Step 5:
In Startup.cs file update ConfigureServices method to replace UseSqlServer with UseMySql

Step 6:
Tools -~ Nuget Package Manager -~ Package Manager Console

In Visual Studio, use the Package Manager Console to scaffold a new migration and apply it to the database:

Add-Migration [migration name]
Update-Database

Full Code on Github Repo : http://bit.ly/2LWgacA
Video Tutorial : http://bit.ly/2rfxVN1
LinkedIn For Open Source Contributors and Kickstarter For Projects (openteams.com)
Published: 2019-12-07 20:09:29

After 20 years of working in open source, Travis Oliphant, the co-creator of Numpy, Scipy & Numba and the founder of PyData, NumFOCUS, & Anaconda, decided the economics of open source needed to change.
Organizations are disconnected from the communities and lack support and maintenance from the open source projects they depend on. Open source teams are burned out, underpaid, underrepresented. These problems have made open source software difficult to maintain.

This is the reason Travis started OpenTeams, a marketplace to connect open source communities with organizations. On one side of the marketplace, we connect companies with teams to help fund project development and maintenance. On the other side, we create a way for open source contributors to showcase their work, help them get recognized for their work and hired to work on projects they care about. Put simply, it’s like a Kickstarter for open source projects and a LinkedIn for open source contributors.

Please give us feedback to help make open source software sustainable.

Thank you!
My experience in Bootcamp so far
Published: 2019-11-28 21:58:55

Before the Bootcamp, I was very worried that I will not manage to complete at least half of the work (ADC challenge). And I had a curiosity to know what happens there and how they work.  Generally, many people worried about their inability to try something that they have never done before, especially in technology.

However, I have realized that it’s a common worry that everyone who is starting a new career has. Nowadays, technology is improving well and faster, when you join a company like Andela, you have to be able to be a faster learner and adapt to how to use those advanced tools. The first thing that surprised me is to hear during the pre-Bootcamp period, someone said that I was using the old version of javascript (es6)  Yet I was still struggling with the one that they call old. Yes, I was using it but I thought that what they want is the product which is completed no matter the way you have used to build it. 

In fact, when you are in a team of different people, it helps to learn from each other. Everyone brings his/her uniqueness and make a team strong, adds more skills to the whole team. I went in the pre-Bootcamp accepting to meet with amazing developers, but I was hoping that it will seem like I am in the group that we don’t speak some language. However, this is not how I found it. 

This period of Bootcamp taught me many things, the first thing I learned that people gain new best skills in any situation that includes team working. They gain knowledge, have time to practice by applying that knowledge,  get feedback from fellow team-mates, and reflect on what has been learned to make your task perfect. 

To sum up, I found that everyone can learn and become whatever you want to be. You can use your creativity and problem-solving skills to explore and build amazing things! Not just for but also helping the world to solve problems. And I would encourage everyone who is passionate about coding to join Andela and at least take a look at how everything works there!
QCObjects Hosting is available into the DigitalOcean Marketplace!
Tags: qcobjects, javascript, serverless
Published: 2019-12-07 20:03:37

Here is a good news for all! 

QCObjects is available into the DigitalOcean Marketplace! 

I've been showing a few weeks ago how to make your progressive web apps and accelerated mobile pages in just one step. Well, you can do it as well in your DigitalOcean web hosting!

Have a look at the live demo here:
[![QCObjects DO Hosting](http://img.youtube.com/vi/OppmqSunSc0/0.jpg)](http://www.youtube.com/watch?v=OppmqSunSc0 "QCObjects DO Hosting")
JS Array Manipulation Quirks
Tags: javascript, beginners
Published: 2019-12-07 19:54:27

---
title: JS Array Manipulation Quirks
published: true
description: Note to self
tags: javascript, beginner, discuss
cover_image: https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fwww.equivisionllc.com%2Fwp-content%2Fuploads%2F2016%2F12%2FHorse-Banner-6-Horses-All-Colors-1500x760-mod.png&f=1&nofb=1
---

In my previous post I mentioned I’d been practicing problem-solving by handwriting answers. It's taking much longer than on an IDE or cargo-programming, but bringing to light a lot of misunderstandings I had about JS methods:

##1 The difference between `slice()` and `splice()`
`.slice()` extracts `[0, n-1]` array items as a new array.
`.splice()` mutates the original array by deleting items from `[0, n]` positions and returning it in place of the initial array. It also offers a third param to add items.

This is explained [more thoroughly here](https://catalin.me/javascript-slice-vs-splice/) and [here](https://mostly-adequate.gitbooks.io/mostly-adequate-guide/ch03.html) from the functional programming perspective

##2 One cannot simply iterate through a string
Applying `.split('')` by empty string or `[...]` (spread operator) returns an array of discrete letters

Exception: using `charAt()` in a for loop
{% devcomment iilb %}


##3 The spread operator produces a shallow copy

If the array-to-copy is more than one level deep, thou shall not `[...spread]`. In a shallow copy, nested arrays (or objects) retain references to the original copy. Any changes of them affect initial and subsequent copy.

Shallow and deep copying in greater detail by [Laurie Barth](https://tenmilesquare.com/deep-vs-shallow-copy-with-examples/). 

##4 `for (i of ...)` vs `for (i in ...)` 

The former enables iteration over arrays, strings, DOM node collections, maps, sets and generators. The latter iterates through object properties such as keys. [for...of vs for...in](https://alligator.io/js/for-of-for-in-loops/)

##5 `.join()` vs. `.push()` vs `.concat()`
.push() mutates arrays and adds items to the end of the length
.concat() merges arrays, and runs faster than .join()

##6 Some of my faves are problematic: they mutate arrays

i.e. `shift()`, `unshift()`, `splice()`, `pop()`, `push()`

It's now become my hobby to find alternatives that *don't* mutate the state, such as `reduce()` `filter()`, `map()`, `some()` and `concat()`

##7 `find()` vs `filter()`

`find()` returns the first value that matches from a collection and stops unless I put it in a for loop.`filter()` returns an array of matched values.

##8 forEach is a void function
It wasn’t clear when I read the MDN docs, and it seemed there were arguments both ways on blogs that it would mutate the original array. It doesn’t return anything, and with the help of the DEV community ❤️ I was able to discover that!

##Related Reading

{% post https://dev.to/thomasaudo/advanced-array-manipulation-in-javascript--fhi %}
{% post https://dev.to/michi/array-methods-and-iterables---stepping-up-your-javascript-game-15bo %}

Are there any others you've come across that you'd like to add to this list? Let me know!
QCObjects on Amazon Web Services Marketplace!
Tags: qcobjects, aws, linux, ubuntu
Published: 2019-12-07 19:54:06

If you got an account in Amazon Web Services I got good news for you! 

Now, QCObjects is fully integrated with AWS so you can create your AMI and Private Image products to develop your high availability PWA and AMP in just one step. QCObjects is an Open Source Framework that allows Full-Stack developers to create create micro-services and micro-frontends into an N-Tier layered architecture based on JavaScript. Thousands of companies are trying QCObjects around the world and saving machine resource costs by coding fancy, clean and quick. QCObjects is available in the most used AWS regions including Free Tier. I invite you to try it and leave a review here: 

[Link on AWS](https://aws.amazon.com/marketplace/pp/B07YZRH7VB)


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/lpgemidkl2xi36y3al23.png)
Making a GraphQL Micro-service with QCObjects HTTP2 Built-In Server
Tags: qcobjects, javascript, microservices, graphql
Published: 2019-12-07 19:41:16

In the following step-by-step tutorial I'll show you how to make a fancy, clean and quick micro-service using QCObjects HTTP2 Built-In Server and GraphQL 

If you want to know more about GraphQL go to [https://graphql.org](https://graphql.org)

If you want to learn more about QCObjects go to [https://qcobjects.dev](https://qcobjects.dev)

1.- Create a progressive web app using the command line of QCObjects CLI Tool (you should be inside the project's folder):

```shell
> qcobjects create --pwa mynewmicroservice
```

2.- Install GraphQL inside the project's folder:

```shell 
> npm install graphql --save
```

3.- Create/Edit a config.json file inside the project's folder 

```shell
> vi config.json
```
4.- In the new config.json file add the following lines:

```json
{
  "relativeImportPath": "js/packages/",
  "domain": "0.0.0.0",
  "backend": {
    "routes": [{
      "path": "/helloworld",
      "microservice": "org.quickcorp.custom.backend.helloworld"
    }]
  }
}
```

5.- Then create/edit a new package inside the js/packages folder:

```shell 
> vi js/packages/org.quickcorp.custom.backend.helloworld.js
```

6.- The following animation shows the basic code of a Microservice using GraphQL and QCObjects HTTP2 Built-In Server 

![QCOBJECTS GRAPHQL Microservice Code.gif](https://cdn.hashnode.com/res/hashnode/image/upload/v1575682660790/4myNi0KFu.gif)

7.- Launch the QCObjects HTTP2 Built-In Server using the following command line:

```shell
> qcobjects launch mynewmicroservice
```

8.- Then open a browser in the address https://127.0.0.1/helloworld and you should see a result like this:



![QCObjects GraphQL Microservice Result.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1575747441007/TriqW76r8.png)
Charming the Python: Dictionaries
Tags: python, beginners
Published: 2019-12-07 18:55:43

*If coding tutorials with math examples are the bane of your existence, keep reading. This series uses relatable examples like dogs and cats.*

---
## Dictionaries


Dictionaries are collections on mutable/modifiable key-value pairs

### Creating
```python
empty_dictionary = {}
dict = {'key1':'value1', 'key2':'value2'}
```

In the following example, there are booleans, floats, integers, a dictionary, and a list. This list and the dictionary are referred to as  "nested" because they are inside another dictionary.
```python
dogs = {
    'name': 'Cheeto',
    'colors': ['tan', 'black'],
    'age': 4.5,
    'chipped': True,
    'breed': 'chihuahua',
    'weight': 12.8,
    'vaccines_due':{
        'rabies': 2022,
        'dhpp': 2020,
        'kennel_cough': 2020,
    }
    }


print(dogs.get('breed'))
>>> chihuahua
```

### Changing
```python
dogs = {
    'name': 'Cheeto',
    'colors': ['tan', 'black'],
    'chipped': True,
    'breed': 'chihuahua',
    'weight': 12.8,
    'vaccines_due':{
        'rabies': 2022,
    }
    }

dogs['fixed'] = True  # adds a new key-value pair
dogs['colors'].append('light tan')  # adds another value to the given key
dogs['name'] = 'Cheese'  # changes value of the given key

print(dogs)
>>> dogs = {
    'name': 'Cheese',
    'colors': ['tan', 'black', 'light tan'],
    'chipped': True,
    'breed': 'chihuahua',
    'weight': 12.8,
    'vaccines_due':{
        'rabies': 2022,
    }
    'fixed': True
    }
```

---
Series based on {% post https://dev.to/asabeneh/30daysofpyton-challenge-43ii %}