fabiochiu/medium-articles huggingface dataset:
Less Redux Boilerplate Using Typescript Template Literals
By: Mikhail Boutylin
Tags: Typescript, React, JavaScript, Redux

Typescript 4.1 introduced an incredibly powerful feature called Template Literal Types . It allows developers to write better typing for strings, so typescript can check them to match certain template:

In the example above a variable of type Percent can accept a string value, that starts with a numeric string and terminates with % .

Another, even (in my opinion) more important use case is possibility to map keys of an object.

Let get a step back to explain what happens in detail. Suppose Getters would have the following definition:

K in keyof T means that interface transformed with Getters will have same keys as initial one. () => T[K] means that values corresponding to those keys will be functions that return T[K] . And T[K] is the original type of value corresponding to the key K . This will return an interface like:

However it’s not a conventional naming for get functions. Prior to TS 4.1 there was no way to solve this issue (other than explicitly mapping each key in the code). But now with addition of Template Literal Types we can transform keys in a reusable way. To transform a key you need to use as operator which on the left has selection of keys and transformation of keys on the right.
Building a React-Redux-NodeJS-Mongo application using Material-UI
By: Hamza Naveed
Tags: React, Material Ui, Mongodb, Mongoose, Redux

The article describes how I worked through a technical assessment. Keeping in mind the criteria for the assessment, I’ve concealed all the relevant information about the assessment provider.

Recently, I was working on an exciting application scenario; where I was provided with a mission to create a web app where users can check-in with how they are feeling. The requirements of the project were to have an understanding of Javascript across the stack and knowledge of REST APIs and a modern Javascript framework.

Cover photo is designed using Sketch app.

The Backend

I started with the bottom-up approach; with working on back-end first. Setting up a MongoDB using mLab cloud database service featuring automated provisioning and scaling of MongoDB databases.

Next, I set up a server using ExpressJS. Express comes with a myriad of HTTP utility methods and middleware at your disposal, creating a quick, easy and robust API. For establishing a connection between NodeJS and MongoDB, I used MongooseJS, which is ODM (Object Data Modelling) Library and provides a straight-forward, schema-based solution to model your application data. Since it is a basic application with basic functionality; only two routes were defined for reading from writing to the db; get and post.

ExpressJS comes with built-in security features, which I utilised to make my server application more secure. Some of the important security features considered were;

Preventing DOS Attacks.

Preventing XXS Attacks.

Preventing Brute Force Attacks

Preventing SQL/NoSQL Injection Attacks

Tada! By the end of it, I was able to see a nice dataset of mood checkins, coming through my locally set up API.
Understanding redux-thunk
Tags: Redux Middleware, Redux, Redux Thunk

Redux-thunk 原始碼

短短14行到底做了什麼呢XD?

開始之前我們先看一下 redux 的 applyMiddleware 做了什麼，這樣回過頭來看redux-thunk的原始碼才更清楚。

Redux API: applyMiddleware() api

Each middleware receives Store 's dispatch and getState functions as named arguments, and returns a function. The last middleware in the chain will receive the real store’s dispatch method as the next parameter, thus ending the chain. So, the middleware signature is ({ getState, dispatch }) => next => action

每個 middleware 會接收 Store 的 dispatch 和 getState functions 作為具名參數，並回傳一個 function。最後的 middleware 會接收到 store 的 dispatch 作為 next 傳入，最後結束。

這樣回頭看 redux-thunk 就相當簡單了，thunk 把宣告成 function 的 action 攔截下來在包了一層，可以想成是 closure 的應用，繼續往下傳遞，由最後我們所宣告的 function action 來執行內容，那正常的 action (我相信應該會是 object)，就會由 next 直接執行 (即 dispatch )。

如果有人還是覺得一定要看一下 source code呢 …

那我們就來看Ｒ，我截去ts的部分，這樣比較乾淨一點

function applyMiddleware(...middlewares) { return (createStore) => (reducer, ...args) => {

const store = createStore(reducer, ...args);

let dispatch = () => {

throw new Error('Apply Middleware Error');

}

const middlewareAPI = {

getState: store.getState,

dispatch: (action, ...args) => dispatch(action, ...args)

}

const chain = middlewares.map(

middleware => middleware(middlewareAPI));

dispatch = compose(...chain)(store.dispatch);

return {

...store,

dispatch

}

} }

一個個來看看



let dispatch = () => {

throw new Error('Apply Middleware Error');

}

先設置如果後面dispatch 在 compose middlewares 只傳回自己時，throw error，就是 chain 為空的意思。

middlewareAPI

很 Ez，就是前面 ({ getState, dispatch })，要收到所準備的參數。

const chain = middlewares.map(

middleware => middleware(middlewareAPI));

每個middleware 都包裝 getState, dispatch 進入產生 middleware 陣列。

dispatch = compose(...chain)(store.dispatch);

compose 是個啥呢

function compose(...funcs) { return funcs.reduce((a, b) => (...args) => a(b(...args))) }

假設有三個 middleware 好了

m1 = ({ getState, dispatch }) => (next) => (action) => { console.log('m1'); return next(action);

} m2 = ({ getState, dispatch }) => (next) => (action) => { console.log('m2'); return next(action);

} m3 = ({ getState, dispatch }) => (next) => (action) => { console.log('m3'); return next(action);

} 還記得剛剛包裝過 getState, dispatch了嗎？ m1Middleware = m1(middlewareAPI); m1Middleware = (next) => (action) => { console.log('m1'); ..., return next;

} m2Middleware = (next) => (action) => { console.log('m2'); ..., return next;

} m3Middleware = (next) => (action) => { console.log('m3');



..., return next;

}

就會變成 m1Middleware(m2Middleware(m3Middleware(store.dispatch)))

log

m3 -> m2 -> m1 const m1 = (next) => (action) => { console.log("m1"); return next(action); } const m2 = (next) => (action) => { console.log("m2"); return next(action); } const fakeDispatch = (action) => { console.log("Final Dispatch this action", action); } const fakeActionYouInput = { type: "fakeType" } m1(m2(fakeDispatch))(fakeActionYouInput); m1

m2

Final Dispatch this action { type: 'fakeType' }

本來以為可以更簡短，結果越寫越多，希望日後回來看不會一頭霧水。
“mapDispatchToProps” VS “useSelector” in react-redux
By: Syket Bhattachergee
Tags: React, Useselector, React Redux, Mapstatetoprops, Redux

Hi! Hope you are well. The reason is Redux. If you are new to redux and you going to a project using redux I know that boss this situation how annoying.

So Don’t worry! I will help a little bit to understand the x hook. Which is make our life very easy.

Today I discuss mapStatToProps and useSelector. Firstly you know that why you using mapStateToProps and useSelector. Ok. Lesson. Why we are using redux? Because its easy to manage complicated state right?. If you understand the opening structure and core features I will guarantee you redux will be your next favourite state management library.

So, please don’t ignore that when you do not understand properly anything. Firstly waste your time to understand folder structure and core features. Then you don't think about it. Because I told you before if you know that core feature and basic things redux will be your next favourite state management libraries.

Ok, come to the point. When we create a store in our project Its need to call lots of files. That time we are using mapStateToProps cause get the state value.

This is the way to write mapStateToProps. Now to Question is how to simplify that. That’s why come to useSelector hooks. It is one of my favourite hooks in the react-redux library. I love to code with simplifying. So, you can use these hooks to get your redux state value with simplifying code.

Look at that!. This is very easy to understand. So I hope you understand mapStateToProps and useSelector who’s very simple easy to write.

So, That’s it for today.

Thank you.
How to validate an image in redux-form? 🖼
By: Pourya Da
Tags: JavaScript, React, Validation, Redux Form, Redux

Step 1:

First, let’s import all the necessary stuff at the top, such as React , PropTypes , Field , reduxForm , Button and Form . As mentioned before, using Semantic UI is totally optional. In our Field we’ll have to pass our own component so that we can catch onChange events in the code below- it is written as this.renderFileInput and is explained later in this post.

Next, add the prop types and default props. And then a simple tiny form, a field and a submit button, as in the code below:

Step 2:

Let’s add those validation methods. First the easiest (file size); to do that just get the input file object and retrieve size from it. Then you can convert the size to kilobytes, megabytes or anything you want! Add your validation criteria and send an error message.

Next, file format; this one’s really simple too; to do that just retrieve type from file object and validate it. 😊 #lazywriting

Next, width and height. To achieve this, we’ll have to catch any onChange event from our redux field, construct a URL object (let’s call it imageObject ) with our input file object (let’s call this imageFile ), check image width and height from the URL object and finally store width and height in our input file object.

Field Component:

Change Handler:

Width and Height Validations:
Building a CQRS + ES App With reSolve
By: Rajat S
Tags: JavaScript, React, Web Development, Programming, Redux

A couple of days back, someone asked me if I have worked with CQRS and ES. And honestly, I had no idea what that person was talking about. I quickly got in front of my laptop and started my quest of learning about these things.

CQRS stands for Command Query Responsibility Segregation. It is a programming principle that was originally introduced by Bertrand Meyer during his work on the Eiffel programming language.

In simple terms, CQRS states that everything in our code should either be a command that performs some action, or a query that that returns some data to the caller. CQRS provides a clear separation of concerns. The command can only change the application state and the query can only get the state to the user.

ES here stands for Event Sourcing. In event sourcing, the changes made to the state are stored as a sequence of events, where each event describes a change made to the application state.

Both ES and CQRS are most often grouped together. By applying event sourcing above CQRS, we can easily persist each event on the command side of the application. The query side of the app can then be easily derived from the sequence of events.

After getting a basic understanding of what Event Sourcing and Command Query Resposibility Segregation are, I set out to look for something that could help me easily build applications using these interesting principles.

That is when I came across reSolve!

reSolve is an awesome new framework for building apps based on CQRS and ES.

In this post, I will show you how to get started with building applications with reSolve.

You can get the entire source code of this post here:

Tip: Use Bit to share and reuse React components. Create a collection you and your team can share, and use the components to build new apps faster. Try it.
Asynchronously updating redux state using middleware
By: Vladislav Stepanov
Tags: JavaScript, React, Frontend, Front End Development, Redux

Sometimes you may encounter a situation where you want to constantly update data from the server. And if WebSockets or Server-Sent Events are not available, then your only friend is polling.

The simplest example in which the latest data really matters is the messaging application in which we wanted to show the latest messages to the user without having to update the entire site. (Keep in mind that our server does not support WS \ SSE.) Therefore, we will request updates from the server every 30 seconds (short polling). To implement this functionality in the React \ Redux application - the easiest and most naive way is to set the interval in the componentDidMount method.

setInterval in Component

Here is the version with the interval, getNewMessages — a thunk action that will dispatch redux actions and update newMessages state.

But this is bad for various reasons, first of all we have to replace setInterval with setTimeout and call the next interval only after we receive a response from the server.

setTimeout in Component

Let’s rewrite it!

Now our code is better! But it still has a big problem — our update logic is in a component, in fact, this is business logic, which has nothing to do with the presentation layer. Plus updates will occur only if the NewMessages component is mounted.

initialActions in Root

So there is a problem — we need to update our data, despite what view or rote we have now! And for this we have two options. First, we can create an initialActions module where we place our update logic and call it in the root component.

This is a simplified version and there are still problems, the main of which is that we are still dependent on the presentation layer.

Middleware

Our solution here is middleware! It does not depend on the view or rote and it is connected right to the state!

This is our code, only 10 lines and without any dependencies. All it does is update messages every 500 ms from the moment the application is launched.

All we need to do now is just to connect the new middleware to the state.

Hope you enjoyed the article and find it useful, I also recommend that you look at using middleware with WebSockets:

https://gist.github.com/dmichael/9dc767fca93624df58b423d01e485402 — tip how to write WS middleware;

https://github.com/giantmachines/redux-websocket/blob/master/src/index.js — source code for Redux-WebSocket package;
Learn Redux: The most simple and tiniest example
By: Ahmad Sharif
Tags: JavaScript, React, Front End Development, State Management, Redux

Before landing this page, I guess you have already read a plethora of tutorials, watched Youtube videos but still you are confused about how redux is working. I was in the same position as like you when I started to learn Redux.

Even the most simple Counter react-redux example, which is flying around, did not help me to understand the concept.

What is redux

Redux is a Javascript library that says itself “A predictable state container for JavaScript apps”.

Here, I am going to describe an analogical example of redux and then write the most simple and tinniest example that is less than 20 lines. So, I hope it will help to understand the concept at first.

What You should already know before learning redux

install React Application, npm

props, state, setState, onClick, Constructor

ES6: array function, import, export, destructure

React is not a part of Redux. However, at first, be familiar with react: props, state and so on. Otherwise, you can’t realize why a state management library is required in your react app as you can build a javascript-app without using Redux.

Redux

There are mainly three things to understand in the Redux library.

1. Action: A simple JS Object

2. Reducer: A pure JS function. That returns value and it has no side effects.

3. Store: A place where all the data are stored.

Soap Factory

This is an analogy of redux to consume the concept. Imagine, A soap factory where soap is made by a machine. When the machine is trigger on by the operator, the machine shapes the soap and then puts the soap into a basket. Look at the figure to visualize the flow of the mechanism.
Getting started with Redux: Redux-saga with React
By: Dina Elghndour
Tags: React Redux, Front End Development, Middleware, React Saga, Redux

Installation:

install redux-saga

npm install --save redux-saga

2. Connect your sagas to store

import { createStore, applyMiddleware } from 'redux'; import createSagaMiddleware from 'redux-saga'; import rootReducer from '../reducers'; import rootSaga from '../sagas'; const saga = createSagaMiddleware(); const store = createStore( rootReducer, applyMiddleware(saga) ); saga.run(rootSaga); export default store;

3. In your API file “./apis/posts.js”

import axios from 'axios'; const axiosInstance = axios.create({ baseURL: 'http://localhost:3001' }); const getPosts = async () => await axiosInstance.get(`/posts`); export default { getPosts };

4. In your typs file “./Types.js”

export const FETCH_POSTS = 'FETCH_POSTS';

export const FETCH_POSTS_REQUEST = 'FETCH_POSTS_REQUEST';

5. In your action file “./action/index.js”

import * as actionTypes from './Types'; export const fetchPosts = posts => ({ type: actionTypes.FETCH_POSTS, payload: posts, }); export const fetchPostsReq = () => ({

type: actionTypes.FETCH_POSTS_REQUEST });

6. In reducers file “./reducers/posts.js

import * as actionTypes from './Types'; export default (state = {}, action) => { switch (action.type) { case actionTypes.FETCH_POSTS: return { ...state, ...action.payload }; default: return state; }

}

Don’t forget to combine your reducers.

7. In your root sagas file “./sagas/index.js”

import { takeEvery } from 'redux-saga/effects'; import * as actionTypes from './Types'; import { fetchPostsSaga } from './posts'; export function* watchAll() { yield takeEvery(actionTypes.FETCH_POSTS_REQUEST, fetchPostsSaga); }

takeEvery: allows multiple instances of these sagas to run at the same time. takeLatest: if you dispatch the action before the previous API call finishes, it will stop that call and return only the latest one.

8. In saga file for posts “./sagas/posts.js”

import { put, call } from 'redux-saga/effects'; import { fetchPosts } from '../actions'; import API from '../apis/posts'; export function* fetchPostsSaga() { try { const response = yield call(API.getPosts); yield put(fetchPosts(response.data)); } catch (error) { console.log(error); } }

Sagas effects

Put: it dispatching an action for the reducer to handle the response. Call: call a ‘API’ function that executes a server call and returns a promise, which will hold the response content when successful. Generators functions: The function* declaration (function keyword followed by an asterisk) defines a generator function, which returns a Generator object. This method will return the next element in the sequence. Yield: The keyword yield is used to suspend and resume a generating function.

9. Then all what you need is to call the action in you component.
Still using redux in 2021? Clean your codebase using Modern React
By: Deepak Kumar
Tags: React, React Js Development, Reactjs, React Js Tutorials, Redux

The Redux way

“Redux has a lot of boilerplate” — said by every other redux tutorial on internet.

Unfortunately it is true, BUT that is not the end of the story.

Yes, learning redux first time is a headache, specially if you did it a couple of years back. Setting up redux first time in you project will take a lot of boilerplate code.

BUT After you are done with above steps, you get SUPER POWERS.

The brilliant flux architecture that redux is based on which simplifies your codebase in into small organized bits of actions and reducers and the global store.

The architecture is based on the idea that frontend user interface need updates only due to certain actions happening in browser. These actions could be website loading for first time or user clicking on a button or pressing enter to submit a form.

These actions sends signal to the store that calls the relevant action handler, which updates the state. The changes in state reflects as changes in UI to user. The components that needs update state from store are subscribed to store and receive updates as soon as any changes are made to state by reducers. Pub-Sub architecture you know.

Most of the heavy lifting is done by redux and react-redux libraries for you. But you still have to type a lot more than Pure React Way.

Notice the store import in line 11 & 12, We now don’t need to pass any props to any component. They are available in every component.

So, Is it magic or what ?

Sadly it is no magic, but a ton of code that you have to write to make this possible. Yeah, just take a look at the Posts & PostForm component code below and notice the last lines where I export the components —

Notice last two above. It is needed in every component. See below too —

Wait a minute, this is almost the same code as in Pure React Way with only a few lines modified here and there. Where is the so called BOILERPLATE of redux???

Here it is, you asked for it —

The full code for redux way is here.
Power BI — Visual Story Telling. Visual Story Tellers — The Power BI…
By: Harish Gopalan
Tags: Storytelling, Power Bi, Visualization, Customer Experience

Visual Story Tellers — The Power BI Experience Series #1

We are sharing our customer success stories and can help you with our amazing talent in simple Visual Story Telling and insights.

Problem: Customer a leading retailer requested for root cause analysis of job failures in production and do retrospective analysis

Challenge: With over 500 jobs running, multiple categories, groups, technologies, and failures, needed a single snapshot image with a summary and understanding of the failures. So Many Data Items in one page!!!! How do we do it???

Regular Solution: Build a bunch of bar charts, line charts, grids etc?

Visual Story Teller Experience: Our visual story teller experts jumped in and built a decomposition chart which showcased the entire root cause summary in a single visual. A consolidated view of about 6–9 charts in a single landscape view.

Outcome: Customer rejoiced with the one pager summary view with numbers and insights.

To know more or if interested feel free to reach out to me on how we can assist

Hkgopalan@netlink.com
Why Trump lost the battle of Pennsylvania
By: Nikolay Vashkevich
Tags: Trump, Elections, Politics, Pennsylvania, Power Bi

Karl Pearson used to say that “statistics is the grammar of science.” In a world where quintillion bytes of data are processed daily, statistics play an increasingly major role in many aspects of our life. In politics, they offer insights on such important events as the presidential race. In the US, shortly after the officials announced the preliminary election results, it became clear that it would be enough for Joe Biden to win in Pennsylvania to gain 270 electoral votes, the minimum required to win the presidency. As we all know now, the traditional support of the Democratic Party in Philadelphia and adjacent areas have secured the eventual results.

So today let’s look at the reasons why ex-president Trump has lost the battle of Pennsylvania. Why Pennsylvania though? The Keystone State is the closest state to the US average in terms of education and income, the important metrics when analyzing the voting process:

The median income

In Pennsylvania, the median household income is average. Median across all states is $59.116 while it is $59.445 in Pennsylvania.

A bachelor’s degree

The state averages on people with four-year college degrees. The median is 31% — the same figure for Pennsylvania.

Let’s take a closer look at numbers. Here’s the voting history for the presidential race in Pennsylvania.

There is how Pennsylvanians voted in 2020:
Power BI DAX #2: Meet the most popular DAX formula — CALCULATE
By: Michael Olafusi
Tags: Dax, Power Bi, Data Science

Anyone wanting to do any serious data analysis with Power BI must be very good friends with CALCULATE. Most books and online resources will tell you that CALCULATE gives you power over the filter context, enabling you to modify it as you wish. Example of one such online resource is Microsoft Documentation: https://docs.microsoft.com/en-us/dax/calculate-function-dax

I, however, have an easier to digest way of explaining it to people entirely new to Power BI and don’t know what context means.

I assume you are already very familiar with Microsoft Excel.

In Microsoft Excel, when you need to do a formula, you simply go into one cell and type out formulas that typically give you back one result which will show in that cell.

That is the usual usage pattern. However, there is another way of inputting formulas in Excel. If you convert the Excel data into table (Format as Table), any formula you type in the table works across the table entire rows. You don’t have to drag down the formula.

How does all these relate to Power BI?

Well, the more intuitive way of entering formulas in Power BI is the second way I mentioned. Any formula you enter gets computed for the entire rows in the table. It’s called New Column.

But what if you want to calculate the total sales for Enugu branch, like I did in the first Excel screenshot? Well, one has to do a New Measure, as that is what gives you one value rather than values as many as the number of rows in our table. In Excel, this would be easily solved with a SUMIF.

In Power BI, there is no SUMIF nor COUNTIF nor AVERAGEIF nor SUBTOTAL. Rather what you have is this amazing formula called CALCULATE. It makes it possible to extract out the rows/records that meet conditions you specify and then you run any normal aggregation/expression on the extract (like SUM, AVERAGE etc). So it is your SUMIF, COUNTIF, AVERAGEIF and many more common formulas you use in Excel. In fact, it is more than all of them. It does near magical things.

So how does CALCULATE work?

You specify the aggregation/expression you want and then put in filter conditions to narrow down to just the very records you want to run that expression on.

In this very example I have shown via screenshots, here is the CALCULATE formula I entered:

Enugu Sales = CALCULATE(SUM(‘Pizza Sales Data’[Amount Sold]),’Pizza Sales Data’[Branch]=”Enugu”)

And that’s how CALCULATE works.

However, don’t be deceived by the simple straightforward example I have used. As you progress in your Power BI journey you will definitely have to get comfortable mixing CALCULATE with FILTER, ALL, ALLEXCEPT and many other DAX formulas. That’s where the true mastery and magic lie. Also, you should read up on row context and filter context in Power BI.

You can watch the YouTube tutorial: https://youtu.be/Vzro-tgDr_8

Enjoy!

And to join our training class, visit https://www.urbizedge.com/powerbi
Power BI DAX #1: The Magic of CROSSJOIN
By: Michael Olafusi
Tags: Microsoft, Dax, Power Bi

Last week I facilitated a training where the participants were staff of Nigeria Bottling Company (makers of Coca-Cola in Nigeria). After my usual prepared practice, we delved into making the types of reports they need. CROSSJOIN is a DAX formula that generates the cartesian product of all the rows in tables inputted into the formula argument. You can go through Microsoft’s official documentation on it at https://docs.microsoft.com/en-us/dax/crossjoin-function-dax

One of the reports had a very interesting twist that CROSSJOIN was perfect for. For confidentiality, I won’t tell you the exact situation we had regarding the said report but I have created a simpler and easier to relate with example that I will use to show you the magic of CROSSJOIN.

CASE STUDY

ABC Limited has five branches across Nigeria and sells four products. Each product has same target across all the branches.

You are to generate a new table that will combine these two tables into one — having all four products with assigned targets showing for all the five branches.

So how do we achieve this?

ANSWER: CROSSJOIN

If you want to follow along and recreate this tutorial, just launch Power BI. And under Home menu, click on Enter Data. Copy paste or type in the Branch table data.

Repeat same steps for Product table.

And to the magic step: under Modeling menu, click on New Table and type CrossJoin Table = CROSSJOIN(‘Branch Table’,’Product Table’)

And voila! You are done.

BONUS: What if you needed to do this in Excel?

You will have to use PowerQuery’s Unpivot, and maybe more than once if both tables have more than 2 columns of relevant data.

You can watch the YouTube tutorial: https://youtu.be/A_2GM4Ig24k

Enjoy!

And to join our training class, visit https://www.urbizedge.com/powerbi
Global crude steel production in 2018
By: Manuel Silva Robalinho
Tags: Economics, Power Bi, Machine Learning, Steel

The objective of this study is to analyze the world production of steel, and use visualization tools like PowerBI to present the information.

Not only is steel one of the most common metal alloys, but it is also one of the most extensively applied materials, particularly in shipbuilding and car manufacturing, as well as building construction and infrastructure development. Beginning in 2009, the steel industry has been experiencing challenging years including the upheaval in the U.S. financial markets, slowing construction spending in China in tandem with a glut of Chinese steel, political instability in Russia and Ukraine, as well as the eurozone sovereign debt crisis, which continues to persist with Greece on the verge of a debt default and a possible exit. It is expected that 2021 will see a moderate recovery in worldwide steel demand. In 2017, Luxembourg’s ArcelorMittal was ranked as the world’s largest steel producer.

In an effort to save cost and make the energy-thirsty steel industry more environmentally benign, steel scrap is collected from waste streams, wrecked automobiles, dismantled buildings or other industrial sources and is melted into new products. Steel has one of the highest recycling rates among metals.

The revenue of leading industrial metals companies in Europe in 2018, according to the Financial Times, Dutch company Arcelormittal recorded the highest revenue of European industrial metals and mining companies, amounting to 74.5 billion U.S. dollars.

Next graph statistic represents global stainless steel production between 2005 and 2017. In 2017, around 48.1 million metric tons of stainless steel was produced worldwide. Stainless steel is used in architecture as well as the construction, manufacturing and arts industries.

In 2018, worldwide apparent steel use is estimated to grow to around 1.6 billion metric tons. The increase will likely be spurred by gains in the NAFTA and EU regions, as well as growing demand in emerging economies. Meanwhile, China is expected to experience flat growth apparent steel use between 2016 and 2017. The market for steel scrap and steel recycling is predicted to spell trouble for the steel production sector.

Using PowerBi to create some graphs with www.statista.com/ information:

The top ten countries in steel production in 2018 and 2017:

We see China as the world’s largest producer of steel, accounting for more than 50% of the steel produced worldwide.

We see Brazil having its production practically unchanged between 2017 and 2018, occupying the 9th place in the world ranking of production.

South America ranks fifth in the largest steel producing regions, a position due to Brazil’s 9th place in world production.

By countries, Germany’s excellent position as the world’s leading producer of steel is Europe’s second largest producer. The spectacular steel production in China is one of the main facts of this study.
What is the Power BI and what is it used for?
By: Erdem Yazan
Tags: Data, Dataset, Report, Data Visualization, Power Bi

Business analytics Solution that lets you visualize your data and share insights across your organization or embed them in your application or website.

Visualization example

Connect to hundreds of data sources and bring your data life with live dashboards and reports.

Get Data — I

You can connect to your databases from Get data section and upload your tables and observe relationships between them. You can also import Excel, Text, XML, and CSV files.

Get Data — II

There are multiple Power BI products. I use both web and desktop product. You can download here Power BI Desktop.

Recommend Hardware for Power BI Desktop:

Available RAM 1.5 GB + recommended(1 GB minimum)

CPU: 1 GHz or faster x86, or x-64

Display : 1440 x 900 or 1600 x 900

Display setting for text: 100 % less

Windows 7 / Server 2008 R2 or later

.NET 4.5

Menu

Relationships

Data

Report-I

Report — II

You can create a report with visualizations and also you can modify and print a report. You can download and use a custom visual from the gallery.

Marketplace

Power BI Web View

Create app workspace — I

Create app workspace — II

After creating Workspace, you will see a screen.

Workspace

You can create Dashboard, Report, Dataset, Streaming dataset and Dataflow.

Create

Get Data

You can get Samples, Partner Showcase, Service Content Packs and more ways to create your own content.

Samples

Service Content Packs

Files

Databases

Note: I tried and used trial version.

My Workspace

(Sales and Marketing Sample)

Click More Options

You can go to the report, open in focus mode, export to Excel and more options.

Datasets

You can create a report from Datasets.

Sample Report — I

You can export to PowerPoint, publish to web, embed and rename and delete your reports.

Sample Report — II

You can Pin a report tile to a dashboard, pin a live report page to a dashboard, pin a tile from another dashboard.

Pin

You can share your reports.

Share

You can generate QR Code.

QR Code

Personal Storage

I told about web and desktop product of Power BI. Briefly, I will mention its features.

-Power Query to extract and transform.

-Power pivot to model and analyze.

-Dashboards, reports, and datasets are at the heart of Power BI.

-Interactive reports and geo-map visualizations.

-Consistent reporting and analyses.

-Three separate national cloud data centers.

-Excel spreadsheets, Github mail chimp, Sharepoint and google analytics.

-Managers simply need to create an API KEY, Power BI will feel natural as it integrates easily with office 365 groups and Microsoft teams.

-Simple to use.

-Fast turnarounds and low costs.

-Constant innovation.

Who can Use it?

IT Professionals

Business analysts

Users

You can learn more here..
Refresh (any) OAuth2 API from PowerBI Online / Dataflows, using Azure Functions
Tags: Azure Functions, Power Bi, Oauth, Exact

Some time ago, I had an intake with a new client; he wanted to analyze his financial data coming from Exact Online, using Power BI. After a quick search, I thought there was no problem. There were many other companies who offered this service and the API documentation was comprehensive. I even found a step-by-step tutorial.

But, during development, there were many problems to overcome in order to make it work. To share my experience with the rest of the world, I decided to write this blog (my first one!). I’ll show you how to connect an API which uses OAuth2 authentication to PowerBI, refresh the data online and probably the most beautiful part: for free*. Key to this solution is the use of Azure Functions, to act as a gateway between the PBI Service and the API.

Note: all assumptions and conclusions about (the lack of) technical features are subject to change. Power BI is developing very fast, and by the time you read this, it could be obsolete.

The Problem

The first problem is that PowerBI out-of-the-box doesn’t support OAuth2 API sources. It can’t handle the authentication flow, using the standard Get Data > From Web option. There are some options get the data via complex M (PowerQuery) code, but then online refresh would still be an issue. If you want to use OAuth2, you must write (or buy) a Custom Connector. Unfortunately, with a custom connector, you can only refresh the data with an On-Premise Data Gateway, which requires a (windows) pc online at refresh time. I was looking for a solution to connect a SaaS application to Power BI, without the need of any resource on-premise.

The Solution

To refresh the data directly and get rid of the OAuth2 auth flow, I’ve used Azure Functions. In short: with Azure Functions, you can execute code in the cloud (Azure). More beautiful; it can act as an API which you can use to send or receive data.

In plain text: the original request will not be sent directly to the API, but to the Azure Function. This piece of code will handle the authentication and sends the original request to the API. The response will be returned as result of the Azure Function. The Azure Function acts as a gateway between the caller (PowerBI) the service.
Respite — Allowing the Slowness in Labor
By: Renée Lepreau
Tags: Birth, Maternal Health, Labor, Midwifery, Home Birth

The pauses in labor can be hard to appreciate. After all the waiting for labor to start, the months of anticipation, the anxious texts from loved ones, it’s finally happening, and then… it’s not.

The art of midwifery is knowing — or guessing — when to resist the troughs of a long labor with the tools in our midwife bag (herbs, breast pump, dance music, lunges, stairs — and yes, pitocin) and knowing when to surrender. To turn off the lights and draw the curtains, arrange the pillow fortress, and allow the body to float among the lapping waves of contractions, languid as they may be.

Labor can be a marathon, and the turtle can win the race. Trying to rush it can push someone over the edge into true exhaustion. At other times a slowdown represents a normal developmental phase of birth.

Often people experience a natural pause between the first stage of labor (dilation of the cervix) and the second (pushing). Midwives call it the “rest and be thankful” phase. The intensity of transition has come and gone and the reflexive urge to push hasn’t kicked in yet. The contractions space out and lighten. The birthing person, and their support team, can easily feel anxiety — what is happening?

Nothing is happening and everything is happening: the cervix is open, the baby is perhaps rotating and preparing for the final descent, the uterus is gathering its reserves for the energy required to push. On the outside it doesn’t look like much. But after a while, the moans transition into grunts, and the grunts produce a head, millimeter by millimeter, or in the singular whoosh of a baby barreling into the world.

Of course, there are times to step in, times when the clock is ticking and it’s necessary to get that labor rocking and rolling. But just as often it’s our work to give ourselves, as Ellen Bass says, to the stillness.
Working Families United, a Powerful Coalition of Labor Unions, Continues to Fight Alongside TPS Holders
By: Tps Alliance
Tags: Labor

Washington DC — Working Families United will be joining the National TPS Alliance in a rally on Tuesday February 12th in Washington DC and throughout the halls of congress lobbying and engaging legislators towards a permanent solution. WFU has been a key ally in the fight for TPS Worker Justice and for a permanent solutions for TPS working families across the country. They have played a key role in mobilizing labor leaders in the fight for immigrant workers rights.

Jose Palma, TPS Holder and spokesperson for the National TPS Alliance issued the following statement:

“Immigrants rights are workers rights, that is no question. We stand together and will take on these battles one step at a time. It has never been more crucial to support our union brothers and sisters, and their solidarity with immigrants across the country is vital. We are not just TPS holders, we are workers and we have contributed to this country for decades. As we fight for permanent protections, we must ensure that all workers know that we are in this together.”

Reyna Sorto, a member of International Union of Painters and Allied Trades District Council 51 and the Working Families Coalition of unions participating in the mobilization says:

“I’ve been a member of my union for years and together we’ll be marching to protect the future of workers with TPS and the rights of all workers. To attack those of us with TPS is to try to lower the rights of everyone and that’s not something we’re going to allow.”

Visuals: Hundreds of union workers with banners, signs, rallying, walking halls of Congress

Working Families United is a coalition of labor unions, including the International Union of Painters and Allied Trades, UNITE HERE, the Ironworkers, the International Union of Bricklayers and Allied Craftworkers, the United Food and Commercial Workers (UFCW), Teamsters, and Laborers International Union of North America (LIUNA) seeking immigrant worker justice. Together, we represent 4 million U.S. workers.

***MEDIA ADVISORY***

WHEN: Tuesday, February 12th

WHERE: 10:00am Rally Outside of White House (Lafayette Park)

March to Capitol Steps

1:00pm Rally & Press Conference Outside Capitol (Section 10, front of house side of Capitol bldg)

###
Does ‘Meaning’ Substitute for Money?
By: Alyssa Alfonso
Tags: Labor, Job Hunting, Work Life Balance, Washington DC, Nonprofit

As I write this article, my Safari is littered with open tabs for half-finished applications to nonprofit jobs in DC. How did I get here, to month ten of my job search?

Growing up in the Maryland suburbs, the soccer moms supplying snacks every Saturday were also career women: national security advisors, nonprofit tech developers, government consultants. In the summer my mother brought her work to the beach, right alongside the sand pail and towels.

While I was an undergrad at Georgetown, friends either found summer internships in banking and private equity or received meager stipends and course credit to work on education and prison reform. Every visit to the career counseling center either recommended I apply to the Jesuit Volunteer Corps or review cases for consulting interviews.

Now, coming out of college with an ostensibly prestigious undergraduate degree, well-employed classmates, and high expectations, I am searching for jobs. According to concerned grandparents, nagging uncles, or even the practical voice in my head, I feel like I have two options available to me: find a job in the for-profit sector, or look for purpose-driven work at a nonprofit. At the latter, I’d be guaranteed to make less, but it would be in exchange for something. Meaning? Purpose? I’m not sure.

As Jill Lepore details in “What’s Wrong with the Way We Work,” the expectation that work gives us ‘meaning’ is a relatively new concept. “‘Meaningful work’ is an expression that had barely appeared in the English language before the early nineteen-seventies,” she says. Slowly, business executives and tech gurus started leaning into purpose as a tenet of job satisfaction, supporting a broad decoupling of wages from labor. “Meaning” was dropped in as a substitute, and “doing what you love” emerged as a new imperative to seek out in work.

Confused and very unemployed, I reached out to Rosita Choy, a DC-based workshop facilitator and coach with over 25 years of experience in the nonprofit sector who works with folks experiencing nonprofit burnout. She sees clients consistently overwhelmed by their work. Scores of young professionals walk through her door ready to throw in the towel. “It’s hard at my job,” Choy hears on repeat, “I don’t feel 100% happy. My boss is terrible! I work too much.”

Choy is adamant these symptoms signal a deeper affliction.

She sees the root of burnout in nonprofit’s huge aspirations: “Nonprofit [workers] are primed for burnout and exploitation because they want to solve these big problems in the world that really have no finish line: end poverty, end racism, make the world a more inclusive place.” With smaller budgets and bigger scope, nonprofits rely on people willing to accept the mission in exchange for less pay and longer hours.

Is that a fair, or sustainable, bargain?
Recommended Daily Interview Problem Newsletter
By: Vidya Bhandary
Tags: Interview Questions, Algorithms, Technical, Newsletter, Interview

TLDR — Subscribe to the daily interview problem newsletter at Quastor Daily. It is a wonderful newsletter to help prepare for technical interviews.

This is not a paid recommendation !!! All opinions are my own.

I don’t know where I came across this newsletter first but I have not regretted signing up for it. In fact I have now removed most other algorithm subscriptions in favor of this one.

What’s in the newsletter ?

One gets an interview problem in the mail along with the solution to the previous day’s problem (In Python3). Curated Tech News is also a part of the mail.

So why do I like it ? Let me list the reasons -

1. No sign-in required to view the solutions.

Yes, yes this is not a deal breaker if the content is really good but I like that even this small (grain in the shoe type of friction?) hindrance is removed. All solutions are found at a public repl.it link. No logging in required!!

2. Explanation of the logic

A through explanation of the logic followed in the code solution is part of the mail. Some oft repeating tips are very helpful in understanding how to approach particular type of problems. Basic test cases are also part of the solution.

3. Not restricted to only coding questions

Map Reduce, Rate Limiting, ACID, Leader Election etc. — the questions are not restricted solely to coding.

4. Clean Design

I like that the design is clean and not cluttered. After the recent change in the order of items it is even better.

5. Tech Dives

Newly added — this really helps round one’s preparation as well as understand concepts in greater depth.

6. Almost a one-stop solution

Because the questions are not limited to coding, it is almost like a one-stop solution to prepare for a programming interview. I say almost because language specific idiosyncrasies are not covered ! I think it should remain as is in this aspect.

7. Misc

- I was not able to get my head around a dynamic programming solution (work in progress) but the author responded with relevant links towards understanding this. Other queries were also met with helpful suggestions.

- I really like the Tech News section. Did not know Cryptokitties were a thing !!

- There was a recent chance to have a mock interview with a google engineer.

- I feel the newsletter improves a little bit everyday. Hope it continues to do so !

It is said the power of your routine is built in your daily habits.

I am happy to have found this newsletter which has helped me make this a daily habit ! (almost! I do miss a few days).

Stuck somewhere ? Check out program visualization of code at this awesome website. Support for other languages is also present but I have not checked them out.

Have fun !