teleren/devto huggingface dataset:
Pratica - Monadic Library, now fully in Typescript!
Tags: pratica, typescript, javascript, functional
Published: 2019-10-18 15:28:08

**[Pratica](https://github.com/rametta/pratica) is now written completely in Typescript!**

### What is Pratica?

[Pratica](https://github.com/rametta/pratica) is a super tiny _720B_ monadic library, comparable to Crocks or Monet JS.

### Why would I use Pratica?

If you want to start writing more functional code in Javascript or Typescript, this is a great library for learning some FP fundamentals, while also making your code safer and more resilient to runtime bugs. It's super tiny size and easy to read dot-chaining syntax makes it easy to get started in any project.

### How do I start?

You can install it with: `yarn add pratica` or `npm i pratica`. Then you can import the main functions like:

```js
import { nullable } from 'pratica'
```

Create small, safe and easy to read programs by composing functions together, like:

```ts
// Typescript

import { Maybe, nullable, get, parseDate } from 'pratica'

const getPersonAge = (person?: Person): Maybe<number> =>
  nullable(person)
    .chain(get<string>(['birthday']))
    .chain(parseDate)
    .map(birthday => Date.now() - birthday.getTime())
    .chain(parseDate)
    .map(date => Math.abs(date.getUTCFullYear() - 1970))


getPersonAge({ birthday: '1994-06-08' }) // -> Just(25)
getPersonAge({ birthday: 771033600000  }) // -> Just(25)
getPersonAge({ birthday: null }) // -> Nothing
getPersonAge(null) // -> Nothing
```

Pratica works great with React too! Use it in your JSX for handling cases with missing data.

```jsx
const viewPersonAge = ({ person }) =>
  getPersonAge(person).cata({
    Just: age => <div>{age}</div>
    Nothing: () => <span>No age available</span>
  })
```

### Try it out

Try it out in an online browser sandbox [here!](https://fpjs.surge.sh/?script=const%20%7B%20nullable%20%7D%20%3D%20P%0A%0Anullable(12)%0A%20%20.map(x%20%3D%3E%20x%20%2B%208)%0A%20%20.cata(%7B%0A%20%20%20%20Just%3A%20x%20%3D%3E%20x%2C%0A%20%20%20%20Nothing%3A%20()%20%3D%3E%20%27%F0%9F%A7%A8%27%0A%20%20%7D))

or check it out on Github below!

{% github rametta/pratica %}
webMethods DevBytes
Tags: webmethods, devbytes, tutorial
Published: 2019-10-31 12:56:52

---
title: webMethods DevBytes
published: true
date: 2019-10-18 14:48:00 UTC
tags: #webmethods, #devbytes, #tutorial
canonical_url: http://techcommunity.softwareag.com/techniques-blog/-/blogs/webmethods-devbytes
---

# New webMethods video tutorials to jumpstart your platform exploration

![](http://techcommunity.softwareag.com/documents/10157/10893595/devbytes.png/eef1c744-14c8-479c-b1ac-2ee3c9939eef?t=1571642497509)

What if we told you that you can explore the latest features and functionality of webMethods in just 3 minutes?

webMethods DevBytes are a new short video tutorial series designed to easily onboard you with webMethods and the platform’s multiple and powerful features. Learn how to [set up trading partners](https://www.youtube.com/watch?v=KsXSmq2_Flc&list=PL3HwmrSYjxiMZsT_TsDa4qdLP3BZ5zjo8&index=3&t=3s) in webMethods.io B2B, [integrate](https://www.youtube.com/watch?v=hbPB4d8r1Gg&list=PL3HwmrSYjxiMZsT_TsDa4qdLP3BZ5zjo8&index=4) Cumulocity with webMethods API or [process rules](https://www.youtube.com/watch?v=-VKLR29Q2fQ&list=PL3HwmrSYjxiMZsT_TsDa4qdLP3BZ5zjo8&index=3) with webMethods.io B2B. And that’s just the start of it!

With webMethods DevBytes you can not only see webMethods in action, but also discover multiple uses of the platform - presented to you directly by our product managers. Be the first to hear about the latest enhancements and planned improvements and grow your platform knowledge as you go.

<iframe allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" frameborder="0" height="400" src="https://www.youtube.com/embed/YQVqUheXkI8" width="750"></iframe>

**Feel free to send us your feedback - your opinion matters to us!** Let us know what features and functionality you’d like to see explained in the series – just add your topics in the comments section below. Who knows – your DevByte may come along very soon!

And last, but not least, if you want to see a more detailed demo of a webMethods product, you can always explore our bi-monthly DevCast demos. See what demos are [coming up](https://www.softwareag.com/us/company/events/webinars/default.html) and explore our [DevCast library](https://www.youtube.com/playlist?list=PL3HwmrSYjxiMsxqulgV8PxJY9flm8EC8K) here.

[Get started with webMethods DevBytes today.](https://www.youtube.com/playlist?list=PL3HwmrSYjxiMZsT_TsDa4qdLP3BZ5zjo8)
What was your win this week?
Tags: discuss, weeklyretro
Published: 2019-10-18 14:27:42

---
title: What was your win this week?
published: true
description: Got to all your meetings on time? Started a new project? Fixed a tricky bug?
tags: discuss, weeklyretro
cover_image: https://cl.ly/188e843c2985/download/Image%202019-02-15%20at%202.36.37%20PM.png
---

👋👋👋👋

Looking back on your week -- what was something you're proud of?

All wins count -- big or small 🎉

Examples of 'wins' include:

- Getting a promotion!
- Starting a new project
- Fixing a tricky bug
- Cleaning your house...or whatever else that may spark joy 😄

![spongebob-patrick-friday](https://media.giphy.com/media/26tnb3iL3E9OG5v0c/giphy.gif)
Getting my foot in the door
Tags: career, beginners
Published: 2019-10-18 14:23:22

Hi Everyone,

This is my first post. I am 23 and currently living in NYC. I have a great job but still feel as if I am missing something. I want to pursue a career in software as I went to college from 2014-2016 majoring in this. I unfortunately was unable to finish due to health complications with my mother. I currently am considering attending a coding boot camp (specifically Hackreactor, Flatiron School, and General Assembly). I have also been considering the option of using online resources like Udemy to teach my self. Just looking for any advise, warnings, or personal experience the community may be able to provide for me. 

Thank you,
Justin Valdez
Functions invoked as methods
Tags: javascript
Published: 2019-10-18 14:08:51

---
title: Functions invoked as methods
published: true
description: The value of "this" when a Javascript function is invoked as a method of an object
tags: javascript
cover_image: https://ferrariwebdevelopment.s3.us-east-2.amazonaws.com/assets/puffins.jpg
---

## The value of "this" when a Javascript function is invoked as a method of an object.

Functions are called methods when they are assigned to an object property.
In the following code, we create a person object and assign a couple of properties: `name` and `age`.
Later, we assign a new property, called `ability` to the object. This property is set to a function that returns a string.
We can invoke `person.ability()` and this function call is said to be a method call of the `person` object.

```
const person = {
  name: 'John',
  age: 50
}

person.ability = function () {
  return 'I can play the piano'
}

console.log(person.ability()); // => I can play the piano
```

When we call a function as a method, the related object on which the function is defined becomes the context of the function and within the function, the this parameter is set to this object.
We can verify this by printing out the value of `this` from within the `ability` function. From within the function, `this` returns the object that invoked the function, which is the `person` object.

```
person.ability = function () {
  console.log(this);  
  return 'I can play the piano';
}

// Prints out the value of this, that is the object that called the function
// => { name: 'John', age: 50, ability: [Function] }
```

It's important to note that the same function can have different contexts depending on how it's invoked.
As an example, in the following code, we define a `myAbility` function and then assign this *same* function to two different objects.
When we print out the value of `this` from inside the function, we see that `this` refers to two different objects, depending on where the function is invoked.

```
const myAbility = function (ability) {
  console.log(this);
  return `I can ${ability}`;
}

const mary = {
  name: 'Mary',
  ability: myAbility
}

const pedro = {
  name: 'Pedro',
  ability: myAbility
}

mary.ability('play the piano');
// Value of this: { name: 'Mary', ability: [Function: myAbility] }

pedro.ability('eat hot dogs');
// Value of this: { name: 'Pedro', ability: [Function: myAbility] }
```

When we call `myAbility` on the object *mary*, the value of `this` is the object `mary`:

```
{ name: 'Mary', ability: [Function: myAbility] }
```

When we call `myAbility` on the object *pedro*, on the other hand, the value of `this` is the object `pedro`:

```
{ name: 'Pedro', ability: [Function: myAbility] }
```

In the next article we will explore what happens to the `this` parameter when we invoke constructor functions.
Modulation version 1.0
Tags: ruby, modulation
Published: 2019-10-18 14:06:00

---
title: Modulation version 1.0
published: true
description: Modulation
tags: ruby, modulation
---

Modulation, an explicit dependency management tool for Ruby, has just reached version 1.0. Modulation is already used in production, and personally I find it a great help in managing the code bases of my different Ruby projects.

Modulation provides the following features:

- Complete isolation of each module
- Explicit exporting and importing of methods and constants
- Lazy Loading of modules
- Hot module reloading for a faster development process
- Module mocking for testing
- Dependency introspection at runtime
- Packing tool for packing entire applications into a single Ruby file

You can find the project documentation at https://github.com/digital-fabric/modulation.
Fixing development flow after Catalina's update
Tags: tips, macos, setup
Published: 2019-10-18 13:59:26

---
title: Fixing development flow after Catalina's update
published: true
description: After MacOS Catalina a step might be required
tags: tips, macos, setup
---

The MacOS Catalina update for some reason removed some necessary libs that usually are installed to development purposes.

# Checking the requirements

I figured out this issue when working in a Ruby project, more specifically with Nokogiri gem.

The issue was pretty easy to solve after find what is the problem.
I had to reinstall the `xcode-select` tool. Simple as that I managed to fix my issue.

I heard other people having issues with other gems and other projects. Most of them are having issues because of something that was uninstalled in the update.

The advice is *check the requirements*, possibly you had something removed.
Vue.js OAuth2 authentication / Backend: Vert.x, Auth server is Keycloak
Tags: hacktoberfest, contributorswanted, vue
Published: 2019-10-18 13:53:50

Hi all,

**If anyone wants to contribute for instance because of #Hacktoberfest, I've added an issue, which might be particularly useful when finished, as authentication is the first step 🐬**

{% github https://github.com/sirixdb/sirix-web-frontend/issues/31 %}

However there are plenty of issues you can work on for the [**frontend**](https://github.com/sirixdb/sirix-web-frontend/issues) and the [**backend**](https://github.com/sirixdb/sirix/issues).

Have a great weekend :+1:

Kind regards
Johannes
Tools for Web Development
Tags: beginners, web
Published: 2019-10-18 13:53:33

---
title: Tools for Web Development
published: true
description: Tools for web development
tags: beginners, web
series: FrontEnd Development Zero to Hero 
---

This section covers the tools you will need to start your web development journey.

The two main tools you will need to follow along:

1. A Web Browser
2. A Text/Code Editor

Check the previous section if you still need to download a web browser

You can use a code editor of your choice, but I will be using [Sublime Text]( https://sublimetext.com).

![Sublime Text](https://thepracticaldev.s3.amazonaws.com/i/zp0aodmjkdtopohyrdf7.PNG)

Some editors for your consideration:

##__ATOM__

![Atom Code Editor](https://thepracticaldev.s3.amazonaws.com/i/ch9ftqbguz9yts5ao6fl.png)

Atom is made by [GitHub](https://github.com) and you can download it [from the application's website](https://atom.io/).

##__NOTEPAD++__

![Notepad++ Code Editor](https://thepracticaldev.s3.amazonaws.com/i/usm1spnjw2qsu9w79uio.png)

Notepad++ can be downloaded from the [application download page](https://notepad-plus-plus.org/downloads/).

Another tool that will be useful to you is the Browser Developer tools that's available in modern Desktop Browsers. If you have a Modern Browser installed (Firefox or Chrome), this is will be available to you.

![Developer Tools opened in Firefox 69 on Windows 10](https://thepracticaldev.s3.amazonaws.com/i/wi0fkzm46xnt7y5dmzqv.PNG)

The _Developer Tools_ can be accessed in Firefox and Chrome Browsers using `Ctrl + Shift + I` (for Windows OS) and `Option` + `Command` + `I` (for macOS).

<hr>

_Updated December 1, 2019: The shortcut for accessing Developer Tools in macOS thanks to [voidedmain](https://dev.to/voidedmain)._

{% devcomment icje %}

_Edited September 19, 2020: Grammar fix._

Up Next, lets learn some HTML.
Daily Challenge #95 - CamelCase Method
Tags: challenge
Published: 2019-10-18 13:51:28

---
title: Daily Challenge #95 - CamelCase Method
published: true
series: Daily Challenge
description: Write a simple .camelCase method for strings, words must have their first letter capitalized without spaces.
tags: challenge
---

Write simple .camelCase method (`camel_case` function in PHP, `CamelCase` in C# or `camelCase` in Java) for strings. All words must have their first letter capitalized without spaces.

For instance:

`camelcase("hello case") => HelloCase`
`camelcase("camel case word") => CamelCaseWord`


***
_This challenge comes from bestwebua on [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
What is Git?
Published: 2019-10-18 13:26:04

One of the truly exceptional things about the 21st century is the way that humans have begun to amass human knowledge and how we share it widely.  We have evidence of humans doing this as far back as 5000 years ago in Mesopotamia where over 30,000 clay tablets were found in a single collection.  There have been unfortunate setbacks like the destruction of the Library of Alexandria, the greatest collection of human knowledge to that date, but ultimately, one of the reasons for human success is this drive to offer education to the collective.

The internet is a truly great library of knowledge (and lets face it, cute cat videos) and its important to protect it.  One of the best ways we protect the loss of knowledge is through version control.  Git is able to record each iteration of a project and share it.  

In Git, there are 3 states your documents can be in. You can think of it in the same way one might prepare to present a theatrical performance.  There is the point at which your files and folders are strictly available to you.  They haven’t been saved.  These are the documents you haven’t deemed worthy of sharing to the great library of humanity. This is similar to learning your lines for a script and determining the best costumes and backgrounds to use in the performance. The advantage to this is that you can test code and check for bugs on your local computer. 

 When you think you’ve done what is needed for that folder, you’ll take it to the second state, known as the staging area.  This is like assembling everyone behind the curtain for the dress rehearsal.  You’re making sure each character that is meant to be presented is properly placed and those you won’t be presenting are still tucked safely away from audience view.

The third stage is known as committing.  Its taking a snapshot of the current iteration of your project.   Git is recording each update you make to these documents, so if you royally screw up... its ok.  Breathe, go back to a previous version and start again.  Not from scratch, but from experience!

When your folder is ready to place into the library of the internet, your audience has assembled, the lights have gone dim, and the curtain is getting drawn back.  This is when you are ready to “push” your project out of your local git space and present it to the wide audience of the world.  You have added something (of quality?) to the collective knowledge of mankind.  Congratulations!
Express Validator Tutorial with Input Validation Examples
Tags: expressjs, node, javascript, expressvalidator
Published: 2020-02-01 19:44:49

---
title: Express Validator Tutorial with Input Validation Examples
published: true
date: 2019-10-18 12:45:21 UTC
tags: Express JS,Node JS, JS,Express Validator
canonical_url: https://www.positronx.io/express-validator-tutorial-with-input-validation-examples/
---

The post [Express Validator Tutorial with Input Validation Examples](https://www.positronx.io/express-validator-tutorial-with-input-validation-examples/) appeared first on [positronX.io](https://www.positronx.io).

Today we are going to learn how to use Express Validator in a Node.js app to implement server-side validation to validate user data.

In this blog post, we will understand how to use **express-validator** module to make the input validation from the server side. We will build a basic Node/Express app with the help of a couple of npm packages such as **express-session** , **express-validator** , **cookie-parser** , etc.

[Click here to read more](https://www.positronx.io/express-validator-tutorial-with-input-validation-examples/)
RxJava - Make your Async Task Synchronous
Tags: android, rxjava, threading, java
Published: 2019-10-18 12:21:39

In Android framework, We have to do all the time consuming work in background thread. It sounds easy but believe me implementation is pain. If you are using kotlin you can use doAsync or Coroutine but if you are using RxJava you can achieve this without much changes in your code.
 
I have a use case where I have to download the given files in background using WorkManager. Well, here comes the pain, "We have to download all the images and then return success or failure or retry Result to the work manager". How do we hold the thread until Download is complete? 
Initially I have solved this with  the CountDownLatch, I implemented and got a working code with that. But it was messy code.

If you are using RxJava, We can do this with operator "blockingGet()" for this your Observable should be "Single". 

https://gist.github.com/BalakrishnanPT/ea6281f15f5dc7882c2e74b3ec46b848
error on rendering an array of items using redux
Published: 2019-10-18 12:02:19

ive trying to render an array of items using redux and encountered the error below. the following is what ive done 

Objects are not valid as a React child (found: object with keys {userlist}). If you meant to render a collection of children, use an array instead.

1) search actions file

![search action](https://thepracticaldev.s3.amazonaws.com/i/9xzw5kf1zq5lue8qzb4u.png)

![search reducer](https://thepracticaldev.s3.amazonaws.com/i/beyz6vioy95kldk3rr6x.png)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/hjbylr9uf53bung73vqh.png)
Posting to Medium and Dev?
Tags: discuss
Published: 2019-10-18 11:58:57

---
title: Posting to Medium and Dev?
published: true
tags: discuss
---

I was wondering how many of you post to both Medium and Dev?

I do both, but enjoy the writing experience on Dev a lot more, since I am writing more code pieces.

I included my twitter poll, but I’d also like to read some thoughts and opinions about it. 

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Poll time! Do you only post to your own blog, to <a href="https://twitter.com/Medium?ref_src=twsrc%5Etfw">@Medium</a>, to <a href="https://twitter.com/ThePracticalDev?ref_src=twsrc%5Etfw">@ThePracticalDev</a>, or a combo of the options?</p>&mdash; Maegan 🏳️‍🌈👩‍💻📱 (@maeganwilson_) <a href="https://twitter.com/maeganwilson_/status/1185163744747425792?ref_src=twsrc%5Etfw">October 18, 2019</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
Three Ways to Start an Elixir Program
Tags: elixir
Published: 2019-10-18 11:43:13

---
title: Three Ways to Start an Elixir Program
published: true
description: Simple ways to start an Elixir program and when to use each.
tags: Elixir
series: Elixir Quick Tips
---

### The `elixir` command used to run a single Elixir source file.
```elixir
> elixir source.ex
```

When you run this command two things happen:
1. The file source.ex is compiled in-memory, and the resulting modules are loaded to the VM.
2. Every code outside of a module is executed.


### The `mix` tool
```elixir
> mix run
```
When you want to run a project created by `mix` (`mix new project_name`)

### `iex` Elixir's interactive shell.
```elixir
> mix my_source_file.ex
```

When you want to load a module to the VM in interactive mode. 
**Note that code outside of the module will not be executed.**

You can also use `mix` and run a project and load the interactive shell with `iex -S mix run`
Recompile Elixir Module in iex
Tags: elixir, iex
Published: 2019-10-18 11:04:49

---
title: Recompile Elixir Module in iex
published: true
description: How to recompile a module in iex
tags: elixir, iex
series: Elixir Quick Tips
---
When you want to view your changes for a module `iex` can recompile it on the fly.

### Loading a source file with MyModule
```elixir
> iex <<path to your file>>
```

### Recompile the module's source file
```elixir
iex> r MyModule
```
Twitch Bot 101 (Python) [Live Coding Recap]
Tags: python, twitch, streaming, beginners
Published: 2019-10-18 10:59:43


## Streamed: 10/18 on Twitch

**Topic(s):** We created a **[bare-bones Twitch chat bot]()** & **[companion tutorial post](http://bit.ly/twitchbot101)** on dev.
**Language:** [Python](http://bit.ly/nb9kPython)
**Tech & libs used:** [VSCode](http://bit.ly/vscodenb9k), [TwitchIO](https://github.com/TwitchIO/TwitchIO)

⭐ **Star** ⇒ [Project Repository](http://bit.ly/pythontwitchbot)
💜 **Follow** ⇒ on [Twitch](http://bit.ly/nb9kTwitch) and [GitHub](https://github.com/NinjaBunny9000)
🔴 **Watch** ⇒ [Twitch VOD](https://www.twitch.tv/videos/496123267) (replay)

## During the stream we...
✔ took a few minutes to get everything up and running cuz what hte heck is going on i got home from work late and im so disoriented 😨
✔ set up the project and started outlining the tutorial
✔ jigo ate almonds on mic and i wanted to die
✔ was then sent unsolicited door pics (r00d)
✔ finished writing the first draft of the tutorial
✔ tested and reviewed the tutorial.. so far so good!
✔ put some polish on the tutorial and edited a bit more
✔ remembered i forgot do kit.com setup & post.. gotta do that soon!
✔ and then i remembered forgot to do laundry.. AGAIN!
✔ published draft to dev & reviewed
✔ chat helped a ton with typos & grammer! ty!
✔ signed off and raided [InGameAsylum](https://www.twitch.tv/ingameasylum).. amazing stream production!

## We also came up with some ideas...

- Doing a git/repo basics stream
- Advanced topics w/TwitchIO like wrapping event_message and other listeners in decorators so we can use them like @bot.commands - `@meortel`
I need your suggestion to align the images in my website properly
Published: 2019-10-18 10:52:08

Currently, I am working for a project called Acero crowns which is a reputed pediatric dental crowns manufacturer in the USA. I am confused about aligning images properly inside my content. Interesting suggestions are appreciated. Here is the page:- www.acerocrowns.com/acero-3s-posterior-crowns