teleren/devto huggingface dataset:
Akka.NET Bootcamp Notes: Unit 1 - Fundamentals of the Actor Model
Tags: microservices, csharp, softwareengineering, actors
Published: 2019-09-29 16:47:56

In an effort to reinforce my personal learning and summarize the wonderful Akka.NET bootcamp that is provided by Petabridge, I am going to cover each unit in the series as I go through it. I will continue to edit the page if the information is incorrect or not available. Since the topics can be complex, I will provide a **[TL;DR at the bottom](#tldr)** and sources for people who are interested in learning more. So let's get right into it!
 
# Unit 1.1 - How to create your own ActorSystem and actors
What is the Actor model?
* In an actor model, everything is an actor (similar to OOP) and each actor does one task
* Actors communicate via messages and message passing is asynchronous and immutable
* Actors pass the message to ActorReferences, not directly to actors. The ActorReferences take the messages and place them in a mailbox (Queue data structure meaning FIFO) and pushes the messages to OnReceive() when the actor is ready to process them. 

![Taken from Petabridge - What is an Actor article](https://thepracticaldev.s3.amazonaws.com/i/oet5jhvqkw1wd287hf98.png)

One of the guarantees of actors in Akka.NET is that an actor's context and internal state are always thread-safe when processing messages. This is because the messages are immutable and processed serially. 
Actors can have an internal state which means when an actor is destroyed or restarted, the actor instance is lost and a new instance is created via Props. This is important to know because an Actor's Life Cycle **can** be rebooted whenever a problem is encountered:
![Petabridge Actor Life Cycle](https://thepracticaldev.s3.amazonaws.com/i/b5n7220fuff88z7f07hp.png)
In the event an Exception is thrown, the actor's mailbox is retained and processed with the new actor instance.
Every Actor has a Parent and Children
An actor has to be created by another actor. This is important because an actor is restarted by it's parent (the terminology is Supervisor). Every parent comes with a default SuperviserStrategy object (but a user can define it's own strategy) that decides to either restart, stop or escalate to the grandparent actor. With a restart, all the children of the parent will be restarted as well. 


---

## <a name="tldr"></a>TL;DR 
Concurrency and Location Transparency.

Since actors are lazy, cheap and single tasked, they can easily be scaled so even though you have one message per actor, you can have 10,000 actors -> 10,000 messages occurring at once. Due to messages being immutable and running asynchronously, this is really powerful. 


---

####Sources:
[Petabridge: What is an Actor](https://petabridge.com/blog/akkadotnet-what-is-an-actor/)
[Petabridge Akka.NET Bootcamp](https://github.com/petabridge/akka-bootcamp)
Help With Interrelated Data Files for MongoDB?
Tags: help, graphql, mongodb
Published: 2019-09-29 16:11:21

Hi all :wave:

I have been wrestling with this issue for ages and getting slightly closer, but the progress is painfully slow. Hopefully someone can help me... :pray:

**How can I write interrelated data populate a mongodb database?**

Here's an example, I have a series of JavaScript files:

**Weapon File** - (to go to weapon collection)
```javascript
[
    {
    name: "Sword",
    damage: 8,
    damageType: ObjectID
    }
]
```
**Damage Type File** (to go to damage type collection)
```javascript
[
    {
    name: "Slicing",
    weapons: [ObjectID, ObjectID]
    }
]
```
Where **ObjectID** would refer to the **_id** of the interrelated data. In this case a weapon would have a damageType and a Damage Type would have a series of weapons.

How would I write those javascript files since the **_id** field is generated by mongodb?

Any help would be greatly appreciated :smile:

Cheers
Pete
What music gets you in your headspace?
Tags: discuss, webdev
Published: 2019-09-29 16:04:50

---
title: What music gets you in your headspace?
published: true
description: Do you prefer one type of music while designing and another while coding?
tags: discussion, webdev
cover_image: https://thepracticaldev.s3.amazonaws.com/i/y5jwo2ixkd9faly4x1ry.png
---

When I need to get amped up and start coding I usually rock NF. It reminds me to "Make it or make it"!

https://music.youtube.com/playlist?list=OLAK5uy_nkiW8jxcMFfW-cMj1bIssQ72wMKbZl74w

If I am in the zone, less words the better, so I switch over to Asthenic

https://music.youtube.com/watch?v=wOMwO5T3yT4&feature=share

What do you listen to?

Don't feel comfortable chatting here, drop me a line:
🎥 YouTube: https://link.ajonp.com/youtube
🌎 Site: https://link.ajonp.com/😺
📦 GitHub: https://link.ajonp.com/github
💬 Slack: https://link.ajonp.com/slack
🐦 Twitter: https://link.ajonp.com/twitter
Adwaita Icon for Website
Tags: html, icon, webdev
Published: 2019-09-29 15:59:44

Just update Adwaita Icon for website using Adwaita-Icon-Theme for Gnome 3.34. Get it here https://github.com/nitipit/adwaita-icon-web

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/t00cqsf264b938pk0517.png)
What does CSS property auto do in margin and how it calculate free space
Published: 2019-09-29 15:41:51

---
title: What does CSS property auto do in margin and how it calculate free space
published: true
cover_image: https://thepracticaldev.s3.amazonaws.com/i/7x4qi0z5mfulk3in6xvz.jpg
description:
tags: #css #html #webdev #frontend #beginners
---

This what we’ll learn in this short video tutorial:

- How the CSS Property `margin` manage the free space for positioning an element
- How `margin` can be used to center an element
- The difference between using a **fixed** value for the `margin` property versus **auto**
Payment Made Easy - Flutterwave
Published: 2019-09-29 15:33:03

Payment Made Easy -Flutterwave

Imagine walking around the store,  cinema, or even bus station trying to pay for services rendered to you but stranded because your friend could not make a transfer to you. A good Samaritan could not even pay because there is no means of payment; and your debtor could not make any payment to you. This traditional way of making payment and receiving payment (through physical appearance) became obsolete since the invention of technology. It is this problem that gave rise to Flutterwave.

What is Flutterwave?

Flutterwave is an online payment platform created by Iyinoluwa Aboyeji (the co-founder of Angela program) and Olugbenga Agboola (current CEO of Flutterwave) in 2016. The vision is to solve the problem of payment and reduce the financial exclusion in the global economy. Ever since its creation,  the company has processed $2.5billion in payment  and 100million transactions in Africa and across the border through POS,  mobile, web, and ATM.  This payment gateways has grown and proved to be one of the best payment platform in Africa having licensed in the United Kingdom and Zambia.

Products

Flutterwave Rave
Rave was the first platform created in 2017 for small and large scale business owners (NGOs, Sole traders, Freelancers, Entrepreneurs etc) that accepts a range of payment methods from customers around the world and help monitor the customer's transaction habit. To receive payment, login to  www.rave.flutterwave.com to get started.

Flutterwave Getbarter
GetBarter or Barter is an everyday platform for all customers. It help ease personal and small payment across border which includes paying of bills,  buying tickets, transferring money. The Web app give the ease to create an instant VISA and MasterCard for everyday Merchant payment and help track transactions with local and international sales. Visit www.flutterwave.com/barter. Barter app also help manage finances by saving as low as N50 Naira to N500, 000.

In conclusion, the company has gone global by smoothing the exchange of funds in +150 currencies. It has partnered with 50 African banks with over 1200 developers and raise $20 million in investments. It has also partnered with many companies which includes Alipay, Amazon,  Xero, Uber,  Jumia, Flywire, Booking.com, MarketHub, Arikair.com, BroadPay, PennySmart, Quick books, Sage, Zoho, and Dusupay. Hence, the essence of technology has come to play from the development of flutterwave and is, no doubt, the best payment gateway every man should utilize.
ascii-themes - Node.js CLI Interface to Generate VSCode Themed ASCII Art
Tags: showdev, node, javascript, cli
Published: 2019-09-29 15:05:53

---
title: ascii-themes - Node.js CLI Interface to Generate VSCode Themed ASCII Art
cover_image: https://thepracticaldev.s3.amazonaws.com/i/7r5trhf5nmva9xg16nou.png 
published: true
description: CLI Interface to Generate Themed ASCII Art. Supports 287 fonts from Figlet and 18 themes from VS Code. To see supported fonts and themes run `npx ascii-themes support`.
tags: showdev, node, javascript, cli
---

I've built a Node.js CLI interface this weekend to generate themed ASCII art. It supports 287 fonts from [Figlet](http://www.figlet.org/) and 18 themes from [VS Code](https://code.visualstudio.com/).

[![asciicast](https://asciinema.org/a/271448.svg)](https://asciinema.org/a/271448)

This all started because of [a tweet Wassim did](https://twitter.com/manekinekko/status/1176856568685563904), and I tried to replicate that. I've managed to do [a passable version](https://twitter.com/lakatos88/status/1176862119121174529) using online tools but it was a manual process. So I tried recreating it in Node.js using Figlet, and the Monokai Dimmed theme from VS Code. I should have [stopped here](https://twitter.com/lakatos88/status/1176922434135396357), it was good enough.

But I went too deep down the rabbit hole, so I built a customizable CLI with more than 5000 options to generate ASCII art in the terminal. Enjoy! And do comment below with whatever cool thing you end up generating with it.

## Usage

```
npx ascii-themes generate dev.to
```

![npx ascii-themes generate dev.to](https://thepracticaldev.s3.amazonaws.com/i/irg0g09b1zfumnlgihx7.png)

- Optional flags:
  - `--font` The Figlet Font to use. Defaults to 'Slant Relief'.
  - `--themeName` The VS Code theme to use. Defaults to 'Monokai Dimmed'.
  - `--horizontalLayout` The horizontal layout to use for the Figlet Font. Defaults to 'default'.
  - `--verticalLayout` The vertical layout to use for the Figlet Font. Defaults to 'default'.

## Interactive Mode

The CLI has 2 interactive modes:

```
npx ascii-themes -i
```

Will allow you to select from the available commands (generate, support, interactive) and input the flags for them via text prompts.

![npx ascii-themes -i](https://thepracticaldev.s3.amazonaws.com/i/wd43fe20te0bwaabt0ib.png)

```
npx ascii-themes interactive
```

Will allow you to input the text and select from a list of the available fonts, themes, and layouts.

![npx ascii-themes interactive](https://thepracticaldev.s3.amazonaws.com/i/btbmw963upvqxwy8zxo6.png)

## Options

To see supported fonts and themes run `npx ascii-themes support`.

Or you can watch this video tweet I did while building the CLI, it shows you all available fonts in one minute.

{% twitter 1177976750787031040 %}
Flutterwave: Payment Gateway in Nigeria 
Tags: flutterwave, rave, bvn, visa
Published: 2019-09-29 15:02:30


Flutterwave is a payment technology company whose main purpose is helping banks and businesses provide seamless and secure, hence Flutterwave is in the business of providing payment processing services that support connecting Nigeria and the rest of Africa to the global economy. Flutterwave accepts payments, make payments and manage business funds from one integrated platform which helps customers connect globally. Flutterwave works with prepaid card issuers in the U.S. and in Africa. Flutterwave, which also offers an in-store payment processing service, can process any consumer payment method used in Nigeria and major regions in Africa
Iyinoluwa Aboyeji is CEO at Flutterwave in San Francisco, California

Flutterwave calls its payment platform Rave. The payment gateway component of Rave offers connections to the more than 90 payment methods used in more than 30 African countries
Rave aggregates all 90+ global and local payment methods into a single API (application programming interface). Those methods include Visa, MasterCard, Amex, Diners Club, JCB, PayPal, and Amazon Pay, as well as Centre Monetique Interbancaire, M-Pesa, Tigo Cash, MTN MM, Verve, and other local card and mobile (QR code and USSD) money brands. In addition, it provides an interface for funds disbursements, vendor payments, and salary payments directly to bank accounts in five countries. 

Rave accommodates consumer payments from 150 currencies. Payouts to merchants can be made in 25 currencies. Those funds are held in wallets (rave wallet) and payments are displayed in real time on the Rave dashboard. If merchants want settlement, they can receive their funds in Nigerian naira, Kenyan shilling, Ghanaian cedi, South African rand, and U.S. dollar. Rave is PCI DSS (Payment Card Industry Data Security Standard) compliant and has better than 99.9% availability. 
Trustwave provides QSA (qualified security assessor) support.

Rave Social is a feature of the Flutterwave acquiring service. It supports vendors selling products on Instagram. Barter is an expense management product. Barter is offered to business travelers to Africa.
how to join open source projects?
Tags: opensource, tips, webdev
Published: 2019-09-29 14:53:35

---
title: how to join open source projects?
published: true
description: 
tags: #opensource #tips #webdev 
cover_image : https://thepracticaldev.s3.amazonaws.com/i/q7af224vzas6j6do7ufz.png
---

For beginners, what are the tips for getting started in open source projects? Tell us about the difficulties, the first projects you participated in and what is the experience of participating in this type of project.

**``What opportunities did this activity bring you: portfolio, job, network, knowledge ...?
``**
**``Right now for beginners what languages ​​would be cool for beginners to start with ?
``**

**``Tell us if you would have any projects to recommend for beginners``**

**thanks for all !!** :metal: :smile:
Dev Journey - roughly 6 years until a serious developer exposure
Published: 2019-09-29 14:33:07

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

6 years, but during those times I did not stop of having a serious career path and have that exposure. I never gave up, not that I just waited and see if things would happen. I did my homework - those sleepless nights watching video tutorials, reading some articles and blogs, googling and searching other's approach in Stackoverflow. I did not stop improving myself until I got an offer.

How about you, how long did it tested you until you got your dev exposure?

Feel free to share :)
What learning path should I take to learn underlying concepts and principles?
Tags: discuss, help, beginners, computerscience
Published: 2019-09-29 13:41:05

Hey there,
I'm Louis. I've been programming since about a year and a half after pivoting from an apprenticeship in banking. Now I'm back in school and I spent a lot of my free time coding.

In the past year I dove into FrontEnd Development, as I started with HTML & CSS and naturally moved to JS and React. 
I know a bit of PHP and mySQL from school, but I feel like I'm still not getting the big picture and have a huge knowledge gap when it comes to algorithms, data structures and low level programming.

To pick up these concepts in a "learning by doing style", I want to learn a backend, maybe low-level programming language to apply all these theoretical but underlying techniques and practises. 

I mean, I heard of them. Pointers, hashtables, linked lists and big-O. But I really don't know much about them because I never needed them in my FrontEnd projects.

What language or even learning path do you recommend for my situation? Is there anyone who experienced the same? Are there any topics _every_ programmer _should_ know?

I'm really looking forward to hear about your opinions!
JavaScript Promises - Building a Simple Promise Example
Published: 2019-09-29 13:36:36


Promises are one of the most important topics in Javascript. This post is simply to help us understand the basics of Javascript Promises.

As per https://mozilla.org, a Promise is an object representing the eventual completion or failure of an asynchronous operation. Essentially, a promise is a returned object to which you attach callbacks, instead of passing callbacks into a function.

Promises are processes that are already happening while you execute the code block. These are very useful when we work with asynchronous operations. Prior to the advent of Promises, we had been using events and callbacks but these had limited functionalities and while the callbacks grew larger, the operations became unmanageable. This is termed as ‘Callback Hell’. Here the return value of one function is dependent on another function and so forth.

Promises can help us operation on multiple asynchronous tasks easily and provide better error handling than what we had with callbacks and events.

A Promise has four states:
__1. pending:__ Initial state, Promise is still pending i.e not fulfilled or rejected yet
__2. fulfilled:__ Action related to the promise succeeded or the operation has been completed successfully
__3. rejected:__ Action related to the promise failed or failed operation

A Promise is usually created via a constructor.

_let promiseObject = new Promise(executor);_

Here “__executor__” is a function that is passed with the arguments “__resolve__” and “__reject__”. The “__executor__“ function is executed immediately by the Promise implementation thereby passing “__resolve__” and “__reject__” functions. In fact the “__executor__” function gets called before the Promise constructor returns the created object. Then the “__executor__” performs the asynchronous operations and once done, it calls either the “__resolve__” function or “__reject__” function depending upon what the returned object is. The return value of the “__executor__” function is ignored.

Promises can be consumed or used by registering methods like __.then__ and __.catch__.

__1. _.then_ __ is invoked when a promise is resolved
__2. _.catch_ __ is invoked when a promise is either rejected or some error has occurred in execution.


__Creating a Promise:__

_function getNewTemperature() {
	return new Promise((resolve, reject) => {
		let result = 'Testing';
		const delay = Math.floor(Math.random() * 10000);
		const temp = Math.floor(Math.random() * 300 + 1);
		setTimeout(function() {
			if(temp > 200) {
				result = `Too Hot | Delay: ${delay} | Temperature: ${temp}`;
			} else if(temp < 100) {
				result = `Too Cold | Delay: ${delay} | Temperature: ${temp}`;
			} else {
				result = `Just Right | Delay: ${delay} | Temperature: ${temp}`;
			}
			resolve(result);
			reject('Error displaying data');
		}, delay);
	});
}_


__Consuming a Promise:__

_getNewTemperature().then((res) => console.log("res: ", res)).catch((err) => console.log("err: ", err));_


{% codepen https://codepen.io/sachindra149/pen/LYPomdY default-tab=js,result %}
React: Method Component vs Class Component
Tags: react, javascript, vscode
Published: 2019-09-29 12:45:17

There are some differences between method component and class component. I'll try to highlight some of it, and when to use it.

### **Method Component**

The simplest way to declare a component in React. We only need to declare a method that returns a jsx syntax and it's done. Below is an example:

{% gist https://gist.github.com/prabangkoro/4497c76b277f7c2fb3cad87c02f1ff6e %}

We can also pass something into the component using _props_. This _props_ will be the first parameter on the method component.

{% gist https://gist.github.com/prabangkoro/6aea948d85273b5279bad4991ccb5ae6 %}

### **Class Component**

This is the robust version of the component. With class component you can do more. _Props_ will by default, included in the class (this.props). You can use _state_, kinda local variable for your component. You may intruduce many class' method that share the same state. And don't forget to be careful with object binding, I often use the arrow method to avoid object binding problem.

{% gist https://gist.github.com/prabangkoro/c21c3f11e9cff218223c0184c40ee050 %}

Class component also allows you to use lifecycle method. It's kinda bunch of methods that will be called in particular event like component mount, updated, unmount, etc.

{% gist https://gist.github.com/prabangkoro/e60eb446aee03d4426a2209e0d85e0b6 %}

You can see the diagram of lifecycle here:

http://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/


### **When to Use Class Component or Method Component**

The major reason to not using class component is when you only need a simple component or dumb component like a button, card, or representational component. If your component doesn't need a complex state, not using lifecycle, method component is best for you. And vice versa.

Sometimes, I'm not sure if my component will suits method or class component. In this case, I prefer to use class component from the beginning, so I don't need to change anything if I need more robust component.

---

### **Bonus**

If you are using VS Code, you can install a React plugin:

https://marketplace.visualstudio.com/items?itemName=dsznajder.es7-react-js-snippets

This plugin will save your time a lot. There are tons of shortcut that make your life easier, such as `rcc` to create React Class Component, and `rfc` to create React Method Component.

_stay hungry, stay foolish_
GOTO sentence in Python
Tags: python
Published: 2019-09-29 12:22:43

---
title: GOTO sentence in Python
published: true
description: 
tags: python
---

`GOTO` sentence is known as evil. I think so.


And Python has `try ... except ...` which works similar to `GOTO` sentence.

Suddenly I want to try to implement `GOTO` sentence like functionality in Python without using `try ... except ...`.

Looks like below.

```python
from functools import wraps
from contextlib import contextmanager


class AlreadyRegistered(Exception):
    ...


class UnknownLabel(Exception):
    ...


class GOTO:
    goto_funcs = {}
    current_label = None

    def __init__(self, name=None):
        self._name = name

    def jump(self, label: str):
        func = self.goto_funcs.get(label)
        if not func:
            raise UnknownLabel(label)
        self.current_label = label
        func()

    def __call__(self, label: str):
        def _inner(func):
            if label not in self.goto_funcs:
                self.goto_funcs[label] = func
            else:
                raise AlreadyRegistered(label)

            @wraps(func)
            def __inner(*args, **kwargs):
                return func(*args, **kwargs)
            return __inner
        return _inner

    def __str__(self):
        return f'{self.__class__}: {self._name}'


if __name__ == '__main__':
    goto = GOTO('mygoto')
    count = 0

    @goto('loop')
    def loop():
        global count
        print(f'current count = {count}')
        count += 1
        if count >= 2:
            return goto.jump('end')
        goto.jump('loop')


    @goto('end')
    def end():
        print('all done')


    loop()
```

This maybe very very limited and clearly very useless!

Bye.
Javascript Learning From Scratch -00004
Tags: javascript, beginners, deliaslan, khanacademy
Published: 2019-09-29 11:54:32

****face draw and coloring

noStroke(); // it means no border for shapes. *şekillerin kenar kalınlığı olmayacağını ifade eder. 

// face
fill(255, 255, 0); //filling with this color inside of the shape
ellipse(202, 208, 300, 300);

// eyes
fill(46, 46, 41); // each new fill command disables the previous same command.
ellipse(157, 151, 40, 40);
ellipse(304, 142, 40, 40);

// mouth
fill(252, 65, 65);
ellipse(257, 240, 120, 136);


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