teleren/devto huggingface dataset:
Message driven react
Tags: react
Published: 2020-03-07 11:32:14

I am here for feedback/suggestions/comments.
I have developed a tiny messaging library and its glue to react. The aim of this library is to help writing message driven react apps.
The relevant links are as follows
[message Xchange library - jsmxq](https://github.com/ladder-b/jsmxq)
[jsmxq - react glue](https://github.com/ladder-b/jsmxq-react)
[A todo app jsmxq-react-todo](https://github.com/ladder-b/jsmxq-react-todo)
[A small demo](https://github.com/ladder-b/jsmxq-react-demo)

Sometime back, In my personal capacity, I was developing a web app using react, but it became too complex, I had to stop development. I felt I am writing too many wrapper components, editing multiple files to add actions, component interdependence became a problem. I am sure I must be doing something wrong with frameworks I used.
Now when starting development again after gap of almost a year, I came up with jsmxq and jsmxq-react. I hope it will help me in writing loosely coupled components. When writing todo app, library was really helpful.

I will be interested to have your comments/suggestion or may be pointer to something similar for react.

Thanks And Regards
Use an original domain when authenticating with Google in Firebase
Tags: firebase
Published: 2020-03-07 11:12:49

---
title: Use an original domain when authenticating with Google in Firebase
published: true
description: 
tags: firebase
---

Not major problems but I have spent a little bit on solving this. So let me leave how to solve it.

The issue is to remain `****.firebaseapp.com` when Google authentication built-in FIrebase.

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

My friend pointed out this. But I didn't care it because it was not too critical and it seems to be complicated to fix it out. But not difficult to solve. You can see this in the official document [here](https://cloud.google.com/identity-platform/docs/how-to-customize-auth-handler).

Two points you have to change.

1) Authorized redirect URIs

Set up in Firebase, it's easy. But you have to check `Google Cloud Platform` when you solve this issue. See Credentials > Oauth 2.0 Client IDs. WebClient generated.

Update to an original domain in authorized redirect URIs.

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

2) Firebase settings

Change `authDomain` section on the app to an original domain.

Done!
How to retrieve the fastest walking route using HERE Routing API
Tags: php, api, sdk, routing
Published: 2020-03-07 11:12:02

With this short article I would like to show you how to calculate routes with PHP language.
We are going to use HERE APIs so for that you need to have a *Free*mium account https://developer.here.com/. There you can obtain your API KEY for REST API, that we will use later.
In order to make our life easier we are going to use Milk SDK PHP library. This library is not the official SDK, it is part of my personal side project and I'm writing this SDK to consume HERE APIs to calculate route, to retrieve weather forecast etc.

Now, it is time to jump on the code...

Create your new directory:
```
mkdir  milk-sdk-example
cd milk-sdk-example
```
In the new directory, create a new composer.json file like this one:
```json
{
    "name": "milk-sdk-example",
    "require": {}
}
```
The you can instal a PHP SDK:
```sh
composer require rbit/milk-sdk-php
```
Now you can define your .env file, and fill HERE_API_KEY with your API KEY:
```
XYZ_ACCESS_TOKEN="your_access_token"
HERE_API_KEY="your_access_token"
```

Create an index.php file

```php
<?php

// 001 Autoload for yuor packages
require __DIR__ . "/vendor/autoload.php";
// 002 Use the Routing class
use Rbit\Milk\HRestApi\Routing\Routing;
// 003 load your env file and the APP KEY
Dotenv\Dotenv::createImmutable(__DIR__)->load();
$hereApiKey = getenv('HERE_API_KEY');

// 004 Instance Routing class and get instructions
// for the fastest walking route
$r =Routing::instance($hereApiKey)
  ->byFoot()
  ->typeFastest()
  ->startingPoint(52.5160,13.3779)
  ->destination(52.5185,13.4283)
  ->getManeuverInstructions(); 

// 005 parse and list the instructions
foreach ($r as $key => $value) {
  echo strip_tags($value->instruction) . PHP_EOL;
}

```

Let me walk through the code:
- 001: Autoload all packages;
- 002: use the Routing class;
- 003: load your env file and your HERE Api key;
- 004: do the magic ;) instance Routing class and get instructions for the fastest walking route;
- 005: list the instructions (i stripped some html tags in the instruction via strip_tags function)

Now you can calculate your route:
```sh
php index.php
```
Here the result:
```
Head north on Pariser Platz. Go for 33 m.
Turn slightly right onto Pariser Platz. Go for 1.4 km.
Take the street in the middle, Am Lustgarten. Go for 273 m.
Turn right. Go for 19 m.
Turn left. Go for 18 m.
Turn left. Go for 185 m.
Turn left. Go for 10 m.
Turn right onto Spandauer Straße. Go for 39 m.
Turn left onto Platz. Go for 70 m.
Head northeast. Go for 24 m.
Turn slightly right. Go for 12 m.
Turn slightly right. Go for 120 m.
Turn left onto Rathausstraße. Go for 548 m.
Turn right onto Alexanderplatz. Go for 962 m.
Walk right around the roundabout and turn onto Strausberger Platz. Go for 39 m.
Arrive at Strausberger Platz. Your destination is on the left.
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/nwctipeswvb6zt3j9yn7.png)

How easy was it? :)
Traversy Media Tutorial Transformed into Angular
Tags: angular, tutorial
Published: 2020-03-07 10:55:52

The plain javascript version of this tutorial:  https://mydev-journey.blogspot.com/2020/02/expense-tracker-from-traversy-media.html

The application is live: https://ng-expenses.zoltanhalasz.net/

Zipped Repo: https://drive.google.com/open?id=1RXt8BJyN2djsvfLlV6HGq1PA_mjFajxw

**Prerequisites:**
1. intermediate javascript/typescript
2.  before you check my tutorial, please check the following material: https://www.positronx.io/angular-7-httpclient-http-service/
3. back-end for this angular app is identical with the javascript version backend.
Why you should keep away from cyclic imports in Python
Tags: python, showdev, webdev
Published: 2020-03-07 10:51:42

Cyclic imports are something that every new programmer faces someday and spends a pretty good amount of time fixing whatever the bug, only to later find out it was a such a simple fix.

Let's first understand what cyclic imports are

## Cyclic Imports

Let's take two different python files named __test1.py__ and __test2.py__

```python
# Test 1

import test2

def disp1():
    print("Test 1")

disp1()


```

And

```python
# Test 2

import test1

def disp2():
    print("Test 2")

disp2()


```

Once that's done, let's try running one of the files.

It worked like a charm right.

For eg: If I run the __test1.py__ file, I get the following output

```
Test 1
Test 2
Test 1
```

The above output seems legit, however, let's make a small change to our code.

Let's import the functions particularly instead of the whole file.

```python
# Test 1

from test2 import disp2

def disp1():
    print("Test 1")

disp1()
disp2()

```

And

```python
# Test 2

from test1 import disp1

def disp2():
    print("Test 2")

disp2()
disp1()

```

Let's try running the __test1.py__ file again.

Now, we get the following error

```
Traceback (most recent call last):
  File "test1.py", line 1, in <module>
    from test2 import disp2
  File "/home/deepjyoti30/Python/tempf/test2.py", line 1, in <module>
    from test1 import disp1
  File "/home/deepjyoti30/Python/tempf/test1.py", line 1, in <module>
    from test2 import disp2
ImportError: cannot import name 'disp2' from partially initialized module 'test2' (most likely due to a circular import) (/home/deepjyoti30/Python/tempf/test2.py)
```

If you read the error properly, Python is suggesting we are doing a cyclic import.

## Why?

So, when we called just the __import test1__, it was working fine but when we tried importing a particular function then it threw that error.

That is because, when we write an __import__ statement, the whole file is not executed unlike when we write an __from test import something__ which actually needs to make sure the file is executed so that the name we are importing exists.

It's as simple as that.

But in this example we just had two files with like 10 lines in each.
Let's consider this happening in a project of 1000's of lines where by mistake you made a cyclic import.

One cyclic import line like that can break the whole project and Python being Python, you might not even find the bug way until an user actually points it out (since it runs on an interpreter, duh).

This is why, we should be wary of making a cyclic import in a project by mistake.

I personally faced this way back when I was working on my __first__ big python project and I have seen fellow developers not being able to fix this issue to the extent of actually adding __help needed__ label in the GitHub issue.

So, be careful when you make imports in Python from now on ;-P

### I also write on my [personal page](https://deepjyoti30.github.io). Do check it out for my other posts. Cheers.
Let's Get Started With Angular and Angular CLI
Tags: angular, tutorial, javascript
Published: 2020-03-07 10:34:22

---
title: Let's Get Started With Angular and Angular CLI
published: true
description: In this tutorial we will see how we can set up angular in our computer. This is purely for beginner who wants to try out angular.
tags: beginner, angular, tutorial, javascript
---
Note: This tutorial is not for AngularJs but for Angular 2+. Here instead of saying Angular 2+ everytime, we will be refering Angular as Angular 2+.

If you haven't yet tried out Angular, wants to know how to install it and build your first app with it then you are in the right place.Here, We will be discussing the process of installing it in your workspace. Lets get started.

###Things to Install
1. [Nodejs](https://nodejs.org/en/download/)
2. [Angular Cli](https://angular.io/cli)

Go ahead and install nodejs on your desired machine. Click on the installer based on your platform and it will be downloaded.

After installing node, go ahead and open cmd then type `npm -v`(-v for version). You'll get something like this(you'll get version number based on your installation).
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/shb92hbmceqm7gmqu7us.PNG)
If not, try installing node again and try again the `npm -v` command.

Now go ahead and type `npm install -g @angular/cli`.
It will install angular cli on your machine globally(-g for global installation).

At this stage, you are all setup for Angular app. 
Now go type `ng new getting-started-with-angular`, here `getting-started-with-angular` is your projects name.
It will ask you for angular routing, type `y` and then hit enter
It will again ask you to choose stylesheet format, select one and hit enter.
Now it will create intial files for your Angular apps.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/dhsq78eox9hxezbyxg9y.JPG)

After it finishes just type `cd getting-started-with-angular` then hit enter.
Now type `ng serve -o`.
ng serve runs the server and serves your projects file to the localhost:4200, by default. `-o` is used to open browser after it finishes compiling files.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7vvjw6n69o359x8cl7vp.JPG)

`ng serve -o` should automatically open your browser and you can see this.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gjhih2iwjihjms9yjkry.JPG)

Congratulations on setting up Angular and serving your first app Angular app.

>This is a first blog on Angular Series. We will discussing more about it in our upcoming blogs.
> > This is my very first blog post here on dev.to. I am open for suggestions. I hope I will do better on my upcoming tutorials/blogs.
How to work on side projects when you are mentally fatigued?
Tags: discuss
Published: 2020-03-07 09:36:49

I have been thinking of starting side projects since I see some benefits of doing it.

- Helps keep off the drudgery and boredom at work. Not that my work is boring, but doing the same things for a period will eventually wear you down.
- Personal development and fulfillment. You have the freedom to choose what to work on. Things that are fun and you care about.
- Personal Branding. Doing side projects shows that you can manage projects and your time enough to be able to deliver. It also signals that you do the walk, not just talk.


However, the biggest problem that I encounter is fatigue. I love coding and I try to give me 100% at work. This leads me to being mentally drained after work. I usually don't have the mental energy to tackle somme hard coding problems after that.

Another problem is that there are some equally important things competing for my time. Whether it is socializing or exercise, it gets pretty hard trying to fit in time to do side projects.

So how do you guys do it? How do you get the energy and time to do side projects when you are mentally fatigued.
How to Gain Social Media following simply from being a dev?
Tags: discuss, career, watercooler
Published: 2020-03-07 09:32:49

So I have been a developer for a few years now but cannot seem to figure out how to grow a social media following.

I see devs out there with similar or fewer credentials than myself with hundreds or even thousands of followers.

So I guess my question is: how do I gain more followers on my personal dev twitter account? 

Any and all support would be greatly appreciated.

Hope to hear from some of you soon,

Andrew Truex

{% user ajtruex %}
Python World
Tags: python, tutorials, tips, tricks
Published: 2020-03-07 09:05:11

---
title: Python World
published: true
description: "Tutorials/Tips/Tricks for Python" 
tags: python, tutorials, tips, tricks
---

Hey everyone! This is my effort for make a Big Guide for Python and anything for it.
I will uploading content frequently and upgrading the old.

https://github.com/SeijinD/Python-World

Thanks! :)
Nevertheless, jeegar123 Coded
Tags: wecoded
Published: 2020-03-07 08:53:25

<!-- ✨This template is only meant to get your ideas going, so please feel free to write your own title & narrative! ✨ -->

## Equality in tech looks like… 

## I’m an expert at…

## My advice for allies to support self-identifying women and non-binary folks who code is...

<!-- Once your post is published, it will not appear on the /t/shecoded page until an admin approves it. This is an extra step to ensure there is no abuse on this important tag. -->
Reading and Writing JSON using Python
Tags: python, json, filehandling, howto
Published: 2020-06-23 10:55:51

---
title: Reading and Writing JSON using Python
published: true
date: 2020-03-07 08:45:22 UTC
tags: python, json, filehandling, howto
canonical_url: https://ncot.uk/compsci/python-reading-writing-JSON/
series: python
---

JSON is a standard for storing data in a human readable format. It’s the modern world’s version of XML. Python comes with a JSON library that will parse the data and turn it into a regular Python dictionary. The library will also turn dictionaries into JSON data that can be written to a file.

Using this library is easy, these notes are mostly a reference for me, but you might find them useful too. The only thing to be aware of is the JSON library doesn’t do file handling, you need to do that yourself.

## Reading Data

```
#!/usr/bin/env python3

import json

filename = "/path/to/file.json"

try:
    jsonFile = open(filename)
    jsonData = json.load(filename)
except:
    print ("Can't parse file", filename)
    exit(1)
```

After doing this, you can now treat `jsonData` as a regular Python dict, that matches the format of your JSON file. This means JSON arrays are arrays inside `jsonData` and JSON objects/associative arrays are Python dictionaries inside it.

If you print the `jsonData` variable out, and compare it to the JSON file, it’ll match up in sensible and logical ways.

## Writing Data

This is pretty much the same, but the text needs manually writing to a file afterwards.

```
#!/usr/bin/env python3

import json

filename = "/path/to/file.json"

jsonData = dict()
# Fill the dict with data, as you would normally

try:
    outfile = open(filename,"w")
except:
    print ("Can't open output file", filename)
    exit(1)
jsonTest = json.dumps(jsonData, sort_keys=True, indent=4)
print(jsonTest, file=outfile)
```
Some Women contribution in CrytpoCurrency Infographic
Tags: wecoded
Published: 2020-03-07 08:45:10

Here is one infographic shared sometimes long on my blog, showing women having contributions to technology. 

Some Women having contribution in tech:

Sandra Ro: she was the CEO of Global block chain business council,global valve to enhanse the generous of blockchain technology craft federation, merging universal innovative organizations and business leaders.

Mona El Isa: she was the precursor of Melonport, a Melon (blockchain) protocol for digital resource management software that is forged on the Ethereum platform. She has been virtuous for winning the “Hottest Blockchain /Crypto Startup Founder” at the Europas, which awards the newest, contemporary European startups.

Katherine Wu: she was the Manager of Business progress and Community Management for Messari , it is a NYC-based crypto startup. Through data gathering into a tabulated and structured database It promotes precision and smarter decision-making in the crypto ecosystem.

Elizabeth Stark: she was the CEO of Lightening cabs,to make any transaction bargain and abrupt, it provides a more scalable blockchain. In individual transactions the number of nodes are decentralized protocol streamlines.

Theryne Nicholson: Nicholson is the CEO and block cypher Co-Founder, in a web service company and industry-leading blockchain. Nicholson is a rich background in software product management and as well as in product marketing,he is also an engineer and enterpreneur. BlockCypher allows corporations to build blockchain applications in a facilitated manner.

Overall, BEAM is one of the only engagers within the crypto industry who is standing up to support reputation and have been ardently standing by this movement and advocating for its further development.

For multiple asylum across different categories the crypto neighborhood is still new relative,they act’s as the acquiring gateways to buy 70-80% of the world’s products.

We need to assure that are being brought into the industry whether i.e. from a business, venture or progress perspective. This is a stimulating world, but it can only get victory in truly disrupting if it is inclusive. From blockchain start-ups We definitely see a gesture of talented women bagging authority positions.

To advance it in the long term women have the powerful ability to reshape the crypto field. We see the current ability of women to leave such profound impacts on the industry. However,to take part in progression process we must continue to boost this ideology by motivating more women.

<br>

<img src="https://mrbtc.org/wp-content/uploads/2018/11/Women-in-Crypto_new-4.png" alt="Women in Cryptocurrency">

At last i congrats All Womens on this Women Day and Salute to them for ther contribution to society on this womens day.
What kind of programming tutorials do you prefer? Videos or text?
Tags: help, discuss, research, tutorial
Published: 2020-03-07 07:32:59

What kind of programming tutorials do you prefer? Videos or text?

I personally prefer using text/blog based tutorials because I can approach them at my own (variable) speed and have the ability to copy text from it. And even though I can increase the speed of the video tutorial, I find it a bit annoying.

So what do you prefer? Video or text? and why?
Reading Snippets [50 => HTML] 📝
Tags: html, beginners, todayilearned, codenewbie
Published: 2020-03-07 06:54:59

Link tags define the relationship between a document and other resources. They are typically used to link a page to a CSS files, however link tags can be used to link a page to resources other than css files. For example, you can use a link tag to include an RSS feed in your page. 

<kbd><small><a href="https://flaviocopes.nyc3.digitaloceanspaces.com/html-handbook/html-handbook.pdf">Flavio Copes,The HTML Handbook</a></small></kbd>
Nevertheless, Al Rubel Rana Coded
Tags: wecoded
Published: 2020-03-07 06:35:58

<!-- ✨This template is only meant to get your ideas going, so please feel free to write your own title & narrative! ✨ -->

## Equality in tech looks like… 

## I’m an expert at…

## My advice for allies to support self-identifying women and non-binary folks who code is...

<!-- Once your post is published, it will not appear on the /t/shecoded page until an admin approves it. This is an extra step to ensure there is no abuse on this important tag. -->
Nevertheless, Eevis coded
Tags: wecoded
Published: 2020-03-07 06:29:21

As a coder coming from a minority group in tech, my career path was not that straightforward. Though, as a Finnish woman working in Finland, I must admit, I am very privileged. Had I, for example, had a name that is not Finnish, the path could have been even harder. 

When I was something like 14, I spent a summer learning HTML, CSS and some JavaScript. At that time, virtual Hogwarts was a thing and there were so many people having their wizarding schools on the internet, or attending one. I was one of them, and it encouraged me to get into the wonderful world of web development for the first time. It was so much fun, and I learned a lot - and loved it.

I wish I could insert the phrase "Nevertheless, she coded" here, but I can't. Where I grew up, girls did not code, so there was no support for me to continue with coding. My path led me to university to study the Russian language, and the whole time I knew this is not what I want to do. All the years studying, I was looking for something else. I took a minor in Youth studies and education and went to study sports instructing for a semester. 

Finally, when writing a master's thesis, I found my way back to the magical world of programming. Starting with some tutorials in [FreeCodeCamp](https://www.freecodecamp.org/) and then continuing with other sites and [Programming MOOC from Helsinki University](https://java-programming.mooc.fi/), I ended up learning a little from a lot of things. That process was so enjoyable, that when I finally graduated, I started looking for programming jobs, and soon after started in a small consultancy with the job title Web Developer.

I have been working as a developer for about three years now. During these years my learning curve has been exponential, and I have fallen love even more with what I do. Yet, there have been situations when someone has questioned me based on my gender or the fact I do not have a CS-degree. Even I have questioned myself based on these and it has been a long way to accept, that I really am a professional. And good at what I am doing. So...

Nevertheless, Eevis coded.
DQ lesson 18
Published: 2020-03-07 06:24:20

In this lesson we created apps that where on an Iphone 4. We learned how to add constraints so that we can have a nice view no matter what device we used. We also learned about adding images and sounds to an app. We learned about auto layout constraints and stack view. Auto layout is when you set the disance between items to always be the samee no matter the device you are working from. Constraints is used in auto layaout to determne how views should be laid out or sized. Stack view you literally stack items eiher vertically ot horizotally.