teleren/devto huggingface dataset:
Truth about Functional Programming
Tags: lisp, functional, oo, objectoriented
Published: 2019-09-01 13:43:13

---
title: Truth about Functional Programming
published: true
description: Truth about Functional Programming
tags: Lisp, functional, oo, object oriented
---


```
(defun save-system (system)
           (let ((op 'asdf:monolithic-concatenate-source-op)
               (c (asdf:find-component system nil)))
           (asdf:operate op c)
           (asdf:output-file op c)))
```

There are 2 popular paradigms of programming for organizing code today. Object Oriented Programming and Functional Programming. Lately, more and more articles are springing up, pushing you to rethink objects (you know, the logical way to simulate real world people, places or things) and starting considering functional programming. 

But you need to know the bias and the drawbacks. The bias is clear, it's an academic, geek-inspired, mathematical idea that is more whimsical than practical -- to show how uber and "Lispy" it looks, how smart one is at calculus, to adorn and lift up the ego about ones intellect.

That is the bias. An ugly splash of function calls embedded inside function calls, calling other functions and never destroying or creating state with side-effects, that is the benefit. An abstract, math-like mentality of algorithms dumped into your editor and executed in almost a primitive, cave-man style procedural flow. How horrible. We came a long way from that. Why not just go back to Assembly or C?

What is scary is that these geeks are pushing functional programming as the ideal paradigm for AI/Machine Learning. Reason about the devastation.

Object Oriented Programming is on the opposite side of the see-saw. It is a paradigm that organizes reality and thought-processes by simulating the real world using tangible objects. It's that clear. It's that logical. It models the world that we interact with. Objects are composed of objects, they communicate with each other, responsibilities are clear, dependencies are seen, system parts can be replaced, enhanced or debugged. There is nothing that cannot be simulated.

The drawbacks of functional programming is self evident:

1. It's awkward
2. mathematical
3. almost procedural in nature
4. ends up relying on objects eventually (contradiction of idea)
5. a syntax nightmare
6. harder to read
7. difficult to debug
8. complex to understand
9. not natural

Be careful.
JMeter, acquaintance and installation
Tags: jmeter, test
Published: 2019-09-01 12:58:51

I am intending to challenge a new project which includes a series of concurrent issues. Debugging the problem is hard as result of it not being reproduced easily. In other words, the back-end guy does not know how this happens. Hence, as a solution, I am thinking of a simulation scenario. To be more clear, I want to simulate a lot of simultaneous mobile applications which call the APIs. Hopefully, this can help the back-end party how the defect is created. Additionally, this scenario will help a lot in testing and quality assurance once the issue is declared as resolved.

After all, I decided to find out a way to test the APIs. Obviously no **unit test** could help here. Because, the procedure was working fine when only one user was using the system. Postman **API testing** was not helpful in a similar way, so the **integration test** was not helpful either. Finally, it was the **integration test** which came to my mind as the solution. This kind of test could reveal the system behavior in a real usage scenario. 

So, after deciding on what sort of testing will help the situation, I started my search of **integration test** solutions. Though, it was not a difficult task, as I just wanted open-source/free solutions which could be run on-premises. Consequently, I chose **JMeter** as it is open source, it is free and  it runs on-premises. Moreover, its statistics on [SQA](https://sqa.stackexchange.com/questions/tagged/jmeter) and [SO](https://stackoverflow.com/questions/tagged/jmeter) is much higher than its competitors. 

My actual trail of **JMeter** started by installing it on my *Windows 10* machine. First thing first, I installed *Java Run Time*. I bumped into wall in my first try as the *Java* I installed was too old for **JMeter**. After installing version 10.0.2 of *Java* the problem solved. Next, I moved **Jmeter** folder to my *Program Files (x86)* folder, and put the *bin* directory path in the system's *Path* variable. But, this time I get error:

*\apache-jmeter-5.1.1\bin\ was unexpected at this time.*

Adding *lib, lib\ext and extras* directory paths to the *Path* variable did not helped either. I also granted *full access* control to the current user and opened *command prompt* as administrator which was did not come to help either. Even a system restart did not help the situation.

Beginning from here, I began to suspect of the *bat* file responsible to run **JMeter**. I dig into *for/do* batch statements, and suddenly found a [link](https://gist.github.com/tclancy/cf1a1ed00ebc4b2da613) which was talking about a space in the *Program Files (x86)* folder name. Yes! It is the root cause. The *jmeter.bat* could not handle the space in the *Program Files (x86)* directory name correctly. I just preferred not to correct it, and instead, moved the entire *apache-jmeter-5.1.1* directory to the root of *C:* drive. After updating the *Path* variable, the problem solved, and **JMeter** was able to run in the command prompt in any path I wanted.

My next step in this journey will be an exploration on **JMeter**, and what features it has for me.
Image Relative Path in React
Tags: beginners, relativepath, css
Published: 2019-09-01 03:42:35

---
title: Image Relative Path in React
published: true
description: How to access an image through relative path in react.js
tags: #beginner #relativepath #css #discussion
---

Throughout my Bootcamp experience, I relied heavily upon bootstrap and Semantic UI  to make my projects look and operate the way that I wanted them to. 

When you're going 100 mph (cruising through the Bootcamp's curriculum) there's not much time to stop and really dive into the CSS and get into the nitty-gritty of your websites design structure. I've decided to challenge myself by using purely CSS in order to get a better understanding of how to manipulate the screen into displaying what I envision without the beautiful crutch of semantic or bootstrap. 

There are so many tutorials on CSS out there, but I decided to write this in order to keep track of what I had a hard time with so that I can return to it if needed, or even better if I can help someone stay out of the deep dark hole of Q and A's that is Stack Overflow. 

The first thing I came across that took me an absurd amount of time to figure out was creating a relative path to an image for my current react project. A relative path, for those that are unfamiliar with this topic, refers to pointing to a specific location in a file system _relative_ to the current directory you're working on (i.e. dragging and image into one of your files on your project and referring to it there). This is more costly in terms of memory, so for the majority of my projects, I have used an absolute path for an external web image(A google Image).
Anyway, I was pulling my hair out at this as this is *such* an easy thing to do but the answer ended up being something I had never seen before. Instead of looking at the file structure:
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/b8fijmje1zfn1xckv0ur.png)
and typing something like: `<img src={require('../components/moab2.png')} className="home-img"/>` 

I came across the solution: 
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/or9n14wjzkuy85fm8bm3.png)

The reason I gathered from this was that when you're using Webpack (a module bundler), you need to `require` an image for the Webpack to properly process it(or them, if multiple). External images work fine due to this, but relative paths will need you to `require` them in order to work the way they would in a Ruby on Rails project. 

Needless to say, I was stoked to have something so simple, but so vital to my project finally work the way I intended for it. I'm curious what other CSS hurdles and solutions will come up next, and they might make for another blog post! 
![CSS GIF](https://media.giphy.com/media/yYSSBtDgbbRzq/giphy.gif)
If you have any you'd like to share I'd love to hear about them in the comments!
WhatsApp vs Telegram
Tags: healthydebate, whatsapp, telegram
Published: 2019-09-01 12:19:36

---
title: WhatsApp vs Telegram
published: true
tags: healthydebate, whatsapp, telegram
cover_image: https://i2.wp.com/www.dignited.com/wp-content/uploads/2017/06/whatsapp-e-telegram.jpg?fit=640%2C360&ssl=1
---
Which of these two do you go for and why?

I go for WhatsApp and my simple explanation is **quality services over quantity services**
O que é o Flutter e Dart
Tags: flutter, google, dart, development
Published: 2019-09-01 11:58:38

---
title: O que é o Flutter e Dart
published: true
description: Saiba o que é o Flutter e o porque usar o Dart
tags: Flutter, Google, Dart, Development
---

![Intro](https://thepracticaldev.s3.amazonaws.com/i/dw3ywov879915vzzn7aw.png)

**Mas afinal o que é o Flutter?**
Flutter é um SDK para desenvolvimento de aplicativos multiplataforma e aplicações web, criada pela Google, a ferramenta tem o seguinte princípio:

Desempenho: o app desenvolvido tem performance de app nativo;
UI rica e nativa, com experiência do usuário natural de cada plataforma;
Desenvolvimento rápido por meio do uso de widgets e do hot reload (aquele lance de atualizar a aplicação quando você salva seu código no editor e já poder testar as alterações).

A primeira versão do Flutter foi lançada em maio de 2017 e atualmente (2019), está na versão 1.7 com recursos para desenvolvimento Web.

###*O Flutter é dividido em duas camadas principais:*

Engine, escrita em C/C++ e responsável pela estrutura de execução. Ela é composta pela [Skia](https://skia.org/), uma biblioteca de renderização 2D e de texto, e pelo Dart, que é a linguagem utilizada no desenvolvimento;

Framework, utilizando a linguagem [Dart](https://dart.dev), é onde criamos a implementação das Widgets da nossa aplicação. 
Ele é responsável pelos componentes visuais, incluindo aqueles específicos para Android e para iOS, além da renderização de layouts responsivos.

###*Mas afinal porquê o Dart?*

Dart é uma linguagem de programação apresentada pelo Google, em 2011, com o objetivo de substituir o JavaScript como principal linguagem embutida nos navegadores. 

É possível citar como algumas de suas características o fato de ser orientada a objetos, declarativa, mantida majoritariamente pelo Google e por ser tipada. Além disso, o que foi o mais importante e decisivo na escolha dessa linguagem para Flutter é que ela pode ser compilada em ahead-of-time e just-in-time.

* O Dart é AOT (Ahead Of Time) compilado em código nativo rápido, previsível, que permite que quase todo o Flutter seja escrito no Dart. Isso não apenas torna o Flutter rápido, praticamente tudo (incluindo todos os widgets) pode ser personalizado.

* O Dart também pode ser compilado com JIT (Just In Time) para ciclos de desenvolvimento excepcionalmente rápidos e fluxo de trabalho que muda o estado (incluindo a popular sub-second stateful hot reload do Flutter).

Se você ja é familiarizado com o TypeScript ou até mesmo Java e/ou .net você vai lidar facilmente com o Dart, porque ele é uma linguagem tipada como disse aqui em cima além de trabalhamos com Classes, Async/await.

E tipar seus dados pode te ajudar muito na hora do desenvolvimento porque você sabe realmente o dado que entra e que sai para cada método que vai criar. 

*Vamos falar mais das particularidades do Dart nos próximos artigos, não se preocupe.*


Agora que você já sabe o que é o Flutter e o Dart já podemos ir mais a fundo com nossos artigos e entender mais do que essa linguagem/framework pode nos oferecer.

Nos vemos nos próximos artigos!
Creating API files based on shared state
Tags: redux, react, javascript
Published: 2019-09-01 11:35:41

This past week I had an interesting challenge, take some regular methods, called APIs, that relied on state values to make request. Those methods used to just go straight to the store observable and do a `getState()` to access the latest state of redux (but, would they?).

Since I was in a saga of removing all direct access to state through store observable, I had to find a way to deal with such methods. It's kind strange to realise that those kind of files would make sense, since:
- If you'r full down on redux, then, the place to do requests would be the middlewares, in our case, sagas;
- If you have your requests isolated in there, there is no reason to have yet another abstraction called API;
- If you'r relying on state for those calls, you should be using middlewares.

But, as React evolved and Redux too, there are pieces of the state, specially in such massive apps like ours, that should not be stored in the global state and could, or even must, be stored in the local state in a short lived memory. So, in order to keep the APIs centralised in a single place, we came up with those API files.

So, I had to come up with a solution to remove the direct access AND that could be used both, in sagas and in components, tricky.

And then it hit me, S E L E C T O R S :)

With them I could simply access the API in Components with mapStateToProps and do a yield select in sagas. 

So, I created the so called `APIgenerator` methods, that would accept the state as input and, using createSelector to have some memoization, read all pieces of the state that the API relied on and return in the final method an object containing methods to be called inside of the consumer, something like this:

https://gist.github.com/FrancoSirena/94f956b9c4a2e1c380d2919b3c01c622

:)

OBS: If your methods depend on different chunks of the state you could expose as many selector as you want to, having the final method return another function to be called in the Component, such as, `(stateChunk) => () => fecth`.

I tend to keep most of my state under a context or even in the component itself, but, there are ton of situations that we may need to store it in redux and even though react APIs are getting better and better, redux is one hell of a powerful pkg.

So, don't doom redux, use it carefully and most of all, know how to use it and how to take advantage of it
Escape plan (from JS to TS) - Simple project - PART #1
Tags: javascript, typescript, lebab, webpack
Published: 2019-09-01 11:17:54

Here is a simple escape plan that will help you to move from old code base to modern TypeScript. This plan may not work for your project, but at least you can use it as a good starting point.

1) Move `.js` files to `src` folder (if not already)

2) For really old code base (ES3/ES5), apply Lebab (https://lebab.unibtc.me/). Lebal is an awesome tool to modernize your code base ES3/ES5 => ES2015/2016 automatically.

```
npx lebab --replace src/ --transform let,class,arrow,arrow-return,commonjs,template,obj-method,obj-shorthand ,for-of,for-each,arg-rest,arg-spread
```

3) Rename extension of JS files to TS files

```
for file in src/**/*.js; do mv "$file" "${file%.*}.ts"; done

```

4) Create webpack config with Webpack CLI. Don't forget to choose TS when asked

```
npx webpack-cli init
```

5) Create tsconfig.json in root of your project. It's a loose config that will help you to start quickly. It will do for now.

```
{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "resolveJsonModule": true,
    "downlevelIteration": true,
    "lib": ["es2015", "dom"],
    "module": "es6",
    "target": "es5",
    "allowJs": true,
    "strict": false
  },
  "include": [
    "src/**/*"
  ],
  "exclude": [
    "node_modules"
  ]
}
```

6) If your code base doesn't have any import/require statements (you where using global scope and file concatenation). Add export to all top level function and classes, it will help us with the next step.

```
find src/ -name "*.ts" -exec sed -i '' "s/^function/export function/g;s/^class/export class/g" {} \;

```

7) Use modern IDE (WebStorm, VSCode). Fix missing imports and property declarations. In any other hard to solve case use `any`. Do not worry. We will fix that later, in next post. Repeat until `npm run build` stops reporting errors.

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

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


8) PROFIT!


# Realworld example

I used this plan to modify a game called unicorn-runner. If you interested on how code based changed thanks to that plan:

This is code before https://github.com/obenjiro/unicorn-runner/tree/fccc2f57470dde0f76850522c3e7e6abe8157789

This is after https://github.com/obenjiro/unicorn-runner/tree/88157915758c4c270fa64ccd4fd2427a68bcba7a

# About PART #2

In the next part I will tell you how to add missing types automatically and make your `tsconfig.json` little bit stricter :)
Flutter Grocery Shopping App UI template kit.
Tags: showdev, ios, android, dart
Published: 2019-09-01 10:55:38

So I saw a Grocery Shopping App UI design at Uplabs, then I decided to write it in Flutter because I really liked it. ✌

> Design screens are on [Uplabs](https://www.uplabs.com/posts/grocery-shopping-full-app). It’s premium, purchase it if you want to use it commercially.
> **Disclaimer:** I am not in anyway in affiliate with the designer of the screens. I just love the UI and decided to code it in Flutter😽

[Download Android App](https://github.com/ahkohd/FlutterGrocery-ShoppingAppUI/blob/master/app-release.apk)

# 🎥 Demo
{%youtube OB2OiXJxQ-A %}

Don’t forget to **star⭐** the repo if you like what you see😉. Source code available on GitHub.

[https://github.com/ahkohd/FlutterGrocery-ShoppingAppUI](https://github.com/ahkohd/FlutterGrocery-ShoppingAppUI)
How to remember the Android studio shortcuts
Tags: android
Published: 2019-09-01 10:48:12

Have you ever wondered as a Android developer, how to remember the Android studio’s shortcuts.

It’s really hard until you start using it :)

But the question is, how do I know whether I have a shortcut for it.

And the answer is pretty simple, there is an awesome plugin available in Android studio called **Key promoter**

So, what this will do, every time when you miss a shortcut, it will notify you that you could have used a shortcut instead. 

For eg, when you tap on the **Run** button using your mouse. It will throw you a pop up saying the shortcut for run button is **shift+F10**

It also keeps tracks of how many times you missed to use the shortcut.

Personally, I feel this is one of the best productivity tip that I can give to a Android developer.

My most used android shortcuts are,

**shift+F10**
**ctrl+alt+l**
**ctrl+alt+o**
**ctrl+Shift+backspace**
**ctrl+e**

Let me know yours too. 

Happy coding.
Will you meet me? if I were to travel to Europe to explore dev/startup communities! 
Tags: discuss, travel, help, laravel
Published: 2019-09-01 10:09:55

UPDATE: Hey, if any of you would like to talk with me, please ping me on skype[**meSingh90**]. Will love to know more about your local dev community and your city. 


## The short version : 
I'm going for [WebSummit](https://websummit.com) in Lisbon this November and have been thinking about extending my stay to explore Europe's dev/startup communities. If I were to travel to your city, would you be interested in meeting and sharing some thoughts with me?

## The extended version : 
I'm always fascinated by the way developers work in different locations, what approaches they take to solve the most common problems, and how they build their systems. 

I've been working as a [freelance consultant](http://linkedin.com/in/mesingh9/) from the last eight years and have been fortunate enough to work with more than 25 startups/companies in different scenarios and engagements. Although most of them have been near my location, still it has been fascinating to see how different they all have been. 

Not just how to tackle everyday problems in their business but also how to find solutions (mostly hacks) to fix these problems. 

These experiences have taught me a lot in my life, and now I want to expand my horizon and travel beyond my home country to see how developers all over the world do it and maybe work with them to understand them better. 

I'm planning to visit Europe this November for WebSummit, and after that,​ I would love to travel more in Europe to different locations. So, if you can spare some time in November, even for a few hours of the day, please reach out to me. I will plan my trip according to the response I get and would love to meet you all. 

> BTW: I'm pretty good at #Laravel, so if there are any Laravel communities out there in Europe​, I will ​like to visit them too.
Repo Rangler: Dockerised, microservice orientated develop package manager
Tags: php, docker, npm, microservices
Published: 2019-09-01 09:00:57

I recently was trying to install and configure satis and whilst I was doing it I had all these good ideas about how to do better. It's really strange to me why we don't have any better package manager for On-Premises private repositories. So I looked around and found Private Packagist, jFrog Artifact, etc. But they are all $$$$$ expensive and for a company that just wants to host about 20 packages. Total overkill.

So I'm having a go at writing a satis compatible package manager. It's called "Repo Rangler" and its supposed to be a dockerised, modular, service orientated and support other package types as well. I'm planning to integrate NPM after this.

The clear benefit over satis as it stands is that this project can authenticate your user against a database, or in the future, LDAP (for companies that like those things). 

You can take a look: 
https://reporangler.com
https://github.com/reporangler
Incident Management 101
Tags: programming, incident, management, security
Published: 2019-09-02 17:42:17

---
title: Incident Management 101
published: true
tags: Programming, Incident, Management, Security
canonical_url: https://domenicoluciani.com/2019/09/01/incident-management-101.html
---

What’s an incident? What to do in case of an incident? How to be a great incident commander? Are you a good incident responder? This is what I discover during my Incident Management workshop in ThoughtWorks this week, let’s take a look!


Continue to read the article [here](https://domenicoluciani.com/2019/09/01/incident-management-101.html)!