teleren/devto huggingface dataset:
Sorry, but Functors are not a means to map over an Array
Tags: functional, javascript, learning
Published: 2020-04-26 18:27:08

---
title: Sorry, but Functors are not a means to map over an Array
published: true
description: 
tags: #functional, #javascript, #learning
---

...because they are much more general: Functors lift any ordinary function into numerous structures and effectful contexts.

See how we lift the pure function `inc = x => x + 1` in a context that either produces an Array asynchronously or yields nothing at all. All it takes is the composition of these three functions:

```javascript
const tMap = f => tx =>
  Task((res, rej) => tx.task(x => res(f(x)), rej));

const optMap = f => tx =>
  match(tx, {
    None: _ => None,
    Some: ({some: x}) => Some(f(x))
  });

const arrMap = f => xs =>
  xs.map((x, i) => f(x, i));
```
Consider what it means in terms of code reuse in general if you can reuse all your simple functions in dozens of scenarios.

[Read the full story about functors](https://github.com/kongware/scriptum/blob/master/ch-13.md) including the complete, runnable code of the given example.
5 Ways To Quickly Grow Your Dev Blog
Tags: blog, growth, visibility, writing
Published: 2020-04-26 18:15:56

## #1 Post On Your Own Domain


Sites like Dev.to are fantastic for reposting your content, or growing a second follower base. If you really want to own your own content however, you should be posting it first on your own site.

Don't worry about getting published for duplicate content by search engines, just set the [canonical URL](https://www.shopify.com/partners/blog/canonical-urls) back to your own site.

## #2 Guest Post

Find other developers who write about similar content and offer to post content on their site. This exposes your content to new readers and helps you gain more followers and backlinks.

For example, [we are currently looking for more guest-posters over on Qvault!](https://qvault.io/guest-post/) Submit an article or two and we'll get back to you as quick as we can!

![Qvault Logo](https://qvault.io/wp-content/uploads/2019/05/QVault-app.png)

## #3 Engage With Your Audience - Fix Mistakes

When people comment or reach out about your articles, be sure to engage with them. Follow up on emails and responses, and make sure to acknowledge when you make mistakes, then fix them. No one expects perfection, but humility and a willingness to admit screw-ups goes a long way.

## #4 Get On Social

If you are serious about growth, be sure to share links and encourage your readers to engage with you on social media. Twitter and Dev.to are my favorites currently as developer-related social platforms.

[![Twitter Follow](https://img.shields.io/twitter/follow/wagslane.svg?label=Follow%20Lane&style=social)](https://twitter.com/intent/follow?screen_name=wagslane)

[![Twitter Follow](https://img.shields.io/twitter/follow/q_vault.svg?label=Follow%20Qvault&style=social)](https://twitter.com/intent/follow?screen_name=q_vault)

[Follow Lane on Dev](https://dev.to/wagslane)

## #5 Blog About New Stuff

Whenever you google a question, and you don't find a satisfactory answer within the first few pages, that is probably something great to write about! Once you find the answer, make a note to yourself to circle back and post about it. 

If there are already 50,000 posts about "Hello World" In React Native, not many people will care about your 50,001st post.

## Thanks For Reading

Hit me up on twitter [@wagslane](https://twitter.com/wagslane) if you have any questions or comments.

Follow me on Dev.to: [wagslane](https://dev.to/wagslane)
Serve huge file with RxJava2 in Micronaut
Tags: micronaut, rxjava2, groovy
Published: 2020-04-26 18:11:33

I'm working in a pet project where I'll serve large files (gif animated files arround 2mg each)
I'm using groovy and Micronaut because it is really very easy to create this kind of application

First version of the controller was very simple:

```
@Controller('/files')
FileController{
    @Get(value = "/{file}", produces = MediaType.IMAGE_GIF)
    byte[]image(@PathVariable String file) {        
       new File(file).bytes
     }
} 
```

Main problem of this approach is you are blocking the request thread meanwhile you read the full file and send all the bytes with the consume of memory it implies

So we want to serve the resource in a "flowable" way using RxJava and sending chuncks of bytes without block the controller

{% gist  https://gist.github.com/jagedn/2b53004603922241073f6f8b915f654e %}

In this way what we return to Micronaut is a Promise who will be subscribe and consume in another thread. When the subscriber is consuming the Promise it will send chunck of bytes calling `onNext` many times and `onComplete` at the end

Using Flowable I've reduced the memory and the time required to show the gif because as soon the browser receives the first bytes it can start to show them
Placeholder title
Tags: twiliohackathon
Published: 2020-04-26 18:06:29

[Comment]: # (All of this is placeholder text. Use this format or any other format of your choosing to best describe your project.)

[Reminder]: # (Make sure you've submitted the Twilio CodeExchange agreement: https://ahoy.twilio.com/code-exchange-community)

[Important]: # (By making a submission, you agree to the competition's terms: https://www.twilio.com/legal/twilio-dev-hackathon-terms)


## What I built
#### Category Submission: 
I have built a simple app used to prevent Covid-19. It reminds you every 30 minutes to wash your hands either by SMS or a Phone Call


## Link to Code
https://github.com/ontstudios/twilio-hackathon
LeetCode: Arrays 101: Introduction – Solutions
Tags: beginners, programming
Published: 2020-04-26 18:01:11

---
title: LeetCode: Arrays 101: Introduction – Solutions
published: true
description: Solutions for Arrays 101 - Introduction card on LeetCode.
tags: beginner, programming
---

Hello,

LeetCode is a good place to practice programming by solving problems of all levels!

After you solve a problem, you’ll get access to all submitted solutions, sorted by time and memory usage. That’s a nice way to compare your code to others and see what you did well and where you can improve.

Here’s my solutions for the [Arrays 101: Introduction](https://leetcode.com/explore/learn/card/fun-with-arrays/) card:

## Max Consecutive Ones

https://leetcode.com/problems/max-consecutive-ones/

```python
class Solution:
    def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
        max_counter = 0
        counter = 0
        for i in nums:
            if i == 1:
                counter += 1
            else:
                if counter > max_counter:
                    max_counter = counter
                counter = 0
        if counter > max_counter:
            max_counter = counter
        return max_counter
```

## Find Numbers with Even Number of Digits

https://leetcode.com/problems/find-numbers-with-even-number-of-digits/

```python
class Solution:
 
    @staticmethod
    def is_even(value):
        return len(str(value)) % 2 == 0
 
    def findNumbers(self, nums: List[int]) -> int:
        return_value = 0
        for number in nums:
            if self.is_even(number):
                return_value += 1
        return return_value
```

## Squares of a Sorted Array

https://leetcode.com/problems/squares-of-a-sorted-array/

When writing code like this be careful because you’re altering the A list in place.

```python
class Solution:
    def sortedSquares(self, A: List[int]) -> List[int]:
        for index, num in enumerate(A):
            A[index] = num ** 2
        return sorted(A)
```

Thanks for reading!
Using Live Reload w/ Reactjs and Ionic Framework Capacitor For Developing & Debugging
Tags: javascript, react, ionic, video
Published: 2020-04-26 17:56:52

Working with Ionic Framework Capacitor and Ionic Framework ReactJS Web Components when coupled with live reload functionality is am amazing way to build native hybrid mobile applications.

When you get the development workflow right, changes in the code immediately deployed to simulator or device, it allows you to be extremely comfortable and efficient.

You can continue to debug the web code in your browser just like you are use to.

### Video Covers
- Show How Live Reload Works
- Show Integration of Capacitor Geolocation Plugin
- Show How to Debug Application w/ Safari and Live Reload

{% youtube Sx1LlavDgMg %}

####Official Ionic Documentation On Live Reload and React JS
- https://ionicframework.com/docs/react/your-first-app/7-live-reload


###🔥 Related Tutorials 🔥
- [Ionic Framework & ReactJS Video Playlist](https://www.youtube.com/playlist?list=PL2PY2-9rsgl3OHIMYb1AzVG5wADUxOmUW)
- [Ionic Framework & ReactJS Hooks Series](https://dev.to/ionic/react-ionic-framework-and-hooks-5135)
Use Keyboard Shortcut to Focus alacritty in Gnome
Tags: commandline, deno, linux, productivity
Published: 2020-04-26 17:48:24

---
title: Use Keyboard Shortcut to Focus alacritty in Gnome
published: true
description: 
tags: commandline, deno, linux, productivity
---

# Use Keyboard Shortcut to Focus alacritty in Gnome

[alacritty](https://github.com/alacritty/alacritty) is a 🔥 hot, fast terminal emulator 🔥 written in rust.  We've been using it for the last 38 microseconds and really enjoy it. It pairs nicely with [tmux](https://github.com/tmux/tmux). 

We want to hit a single key and focus on `alacritty` while using GNOME.  If `alacritty` isn't already open, it should start up.  This would give us functionality somewhat equivalent to [Guake](http://guake-project.org/).

As a bonus, we'll use [deno](https://deno.land/) to write a quick helper script and 😇 avoid learning `bash`. 😇

Here's what we did to accomplish this task.

## Install wmctrl

Install `wmctrl` so that we can focus on an existing `alacritty` window using a program.

For debian & ubuntu-flavored linux:

```sh
sudo apt install wmctrl
```

For the redhats:

```sh
sudo yum install wmctrl
```

Start `alacritty` up for just a moment and take note of its handle as given by `wmctrl -xl`:

```text
...snip...
0x04800002  1 Alacritty.Alacritty   mybox Alacritty
...snip...
```

We can then use `wmctrl` to focus on a running instance of `alacritty`:

```sh
wmctrl -xa Alacritty.Alacritty
```

## Create script to raise or start-up terminal

Create a `deno` script to either focus on the existing `alacritty` window, or start a new one:

```ts
// saved to /home/nope/bin/raise_alacritty.ts
const p = Deno.run({
    cmd: [ "/usr/bin/pgrep", "alacritty" ]
});

const { code } = await p.status();

if (code === 0) {
    await Deno.run({ cmd: [ "wmctrl", "-xa", "Alacritty.Alacritty" ] }).status();
} else {
    await Deno.run({ cmd: [ "alacritty" ] }).status();
}
```

## Bind keyboard shortcut

Finally, in gnome settings,
add a keyboard shortcut which runs our script.

![keybinding](https://user-images.githubusercontent.com/38859656/81819687-a3904800-94fd-11ea-8f4e-d66c07d600ad.png)

In our case, we assigned the special MENU button on our keyboard to focus on `alacritty`.  We use the default GNOME shortcut (`Super H`/`WindowsKey H`) to hide the window when we're done with it. 

## Updated for deno 1.0.0-rc3

Please note that as of deno 1.0.0-rc3, the command line invocation needed to make this work has changed. You now need to use the `run` subcommand:

```sh
deno run --allow-run /path/to/raise_alacritty.ts
```

This article was originally published under an older version, which did not require the subcommand.

```sh
deno  --allow-run /path/to/raise_alacritty.ts
```

If you're having trouble getting this to work under the new version of Deno, try adding `run`!
React UI component libraries you need! 
Tags: react, beginners, javascript, webdev
Published: 2020-04-26 17:33:08

React is great at utilizing Javascript for making user-interfaces and for web development in general.
Here are some really handy React.js component libraries that may help you out as a React developer .

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

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

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

http://react-toolbox.io/
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0fg1d2oeej99yd7rj0xh.png)

https://react-bootstrap.github.io/
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/qkdxspd490ff84z2gphb.png)

https://www.creative-tim.com/product/material-kit-react/?partner=91096
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0gvkp8chr6zxzakg5qiv.png)
Syntax highlighting in Jekyll
Tags: code, syntax, jekyll, blog
Published: 2020-04-26 17:32:44

---
layout: post
title: Syntax highlighting in Jekyll
description: Highlighting code using markdown in Jekyll
author: bitsmonkey
tags: code, syntax, jekyll, blog
published: true
---

<br/>

Here is a way to highlight your code on Jekyll site using the same Markdown syntax that github supports. I have been using [github markdown](https://guides.github.com/features/mastering-markdown/) day-in & day-out mostly with [github gists](http://gist.github.com/).

To use the same markdown syntax for highlight the code syntax in your Jekyll site. First intall the rouge gem.

```shell
    gem install rouge
```

Now in your `_config.yml file`

```yml
    markdown: kramdown
    highlighter: rouge
    kramdown:
      input: GFM
```
The above setting sets [kramdown](https://kramdown.gettalong.org/) as my markdown and for syntax highlighting use the `rouge` the gem you just installed. Also GFM says to use the [Github Flavoured Markdown](https://guides.github.com/features/mastering-markdown/).


Now download the default css for the code styling from [Github](https://raw.githubusercontent.com/mojombo/tpw/master/css/syntax.css) and copy to the css directory of your site and add the reference in `_layout/default.html`.

```html
    <link rel="stylesheet" href="/css/syntax.css" type="text/css" />
```

Done!

*Image by [Lorenzo Cafaro](https://pixabay.com/users/3844328-3844328/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=1857236) from [Pixabay](https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=1857236)*
*Originally shared on [Bitsmonkey Blog](https://unrealnerd.github.io/blog/2020/04/26/syntax-highlighting-jekyll)*
Do you pay for any indie software?
Tags: discuss, watercooler, tips
Published: 2020-04-26 17:22:40

---
title: Do you pay for any indie software?
published: true
description: Do you pay for any indie software?
tags: discuss, watercooler, tips
---

My everyday devices are mostly Apple products and just recently realized that I barely use any software built by independent devs (or small companies). Most of what I consistently use falls in one of the following categories:

- Shipped with the OS (XCode, Notes, Reminders, etc)
- Open source (Atom editor, Docker, OSS frameworks, etc)
- Big tech (Chrome, Slack, Zoom, G suite, etc)

*Note: There will be some overlap in the above*

In my case I'm a happy customer of [Better Touch Tool](https://folivora.ai/) which "allows you to customize various input devices on your Mac".

So, do you pay for any indie software?

(I'm referring to any product like licensed tools, SaaS, mobile apps or anything in between for that matter)
Efficient Automation Testing With FREE Tool(ChroPath)
Tags: testing, beginners, tutorial, webdev
Published: 2020-04-26 17:22:13

In this article, We are discussing the Automation Tool Chropath That can save you time while creating Automation Scripts and help you find better locators(XPath and CSS).

✅ Feature of Chropath :
✅ Single Click Locators Generation
✅ Verify and Modify Locators
✅ iframe Support & SVG element support
✅ Multiple XPath and Automation command
✅ Dynamic attribute Support
✅ Save config in local
✅ChroPath Studio
✅Smart Maintenance: Verify all XPath in the single-shot!!

Download Chropath: https://autonomiq.io/chropath

[![ChroPath Tutoria](https://i.imgur.com/SRDxOWb.png)](https://youtu.be/5KOdrtG4sKY "ChroPath Tutoria")

🔴 We have discussed, How to find the XPath and CSS Locators using Chropath within few seconds. Sanjay has discussed How You can use the Chropath to create manual test scripts and can create automation scripts page objects within minutes.

❤️ Thanks for the support guys

🚀 What is ChroPath?
ChroPath is a development tool to edit, inspect, and generate XPath and CSS selectors. ChroPath makes it easy to write, edit, extract and evaluate XPath and CSS queries on any webpage and saves at least 40–50% manual effort in automation script writing. ChroPath is the highest rated (4.6+) xpath tool.

🚀 How do you get ChroPath?
Search for ChroPath in the Find add-ons search area and Add to Firefox. Now, load the web page you want to check for, Right click and select 'Inspect Element' to launch the developer tools. The ChroPath tab will be available in your dev tools panel on the extreme right side as shown below.

🚀What is ChroPath in Chrome?
ChroPath is one of the best chrome extension which gives the unique xpath (absolute/relative) and CSS value. XPath extension is available for Chrome, FIrefox, Safari and Edge browsers. ChroPath also used as best CSS locator chrome extension.

🚀 Tools and services I recommend:
Some of the courses that I recommend to become better Automation Tester 🙌🙌

✅Selenium Training and Certification -
https://scrolltest.com/go/edureka

✅Learn Jenkins for QA -
https://bit.ly/learnjenkins-p1

✅Programming Java -
https://bit.ly/learnjava2020-p1

✅Test Automation - 
https://bit.ly/learnautomation2020

✅API Testing - 
https://www.learnapitesting.com

✅Cypress Tutorial with LIVE Projects -
http://cypresstutorial.com

-----------------------------------------------------
👪 Join our Community - http://bit.ly/learntesting2019
✅ Automation Tester Community - https://thetestingacademy.com
🐦Follow us on Twitter  - https://twitter.com/itstechmode
📖 Like us on Facebook - https://www.facebook.com/scrolltest
🎤 Listen to our Podcast - https://anchor.fm/thetestingacademy
------------------------------------------------------

#chropath #automationtesting #manualtesting #testautomation #thetestingacademy #scrolltest

--
Be sure to subscribe for more videos like this!

[![ TheTestingAcademy](https://dev-to-uploads.s3.amazonaws.com/i/r7vcy6wbvyjbk1y1uu0o.png
)](https://www.youtube.com/TheTestingAcademy?sub_confirmation=1 "TheTestingAcademy")
Basic Types in TypeScript
Tags: typescript
Published: 2020-04-26 17:15:57


TypeScript adds optional static types to JavaScript. A Type in TypeScript means a reference to the value and all its methods and properties. And a Value in JavaScript (and TypeScript) is anything that can be assigned to a variable. That includes String, Boolean, Array, and so on. There are two value categories: 
- Primitives: Boolean, Number, String, Symbol, null
- Objects: Array, Object, Function, Class

If we take for example a String data type, it includes many methods and properties, such as `length`, `toUpperCase()`, `indexOf()`, `split()` and many more. And if we create value by assigning that string to a variable, we will get a Type that will reference to all properties and methods of the string.

All values have a type:
```ts
"red car" // a type of String
42        // a type of Number
["one"]   // a type of Array
true      // a type of Boolean

interface Car {
  color: string;
  year: number;
}

{ color: "red", year: 1973 } // an object, a type of Car
```

Types are essential to TypeScript because the compiler is using them to search and analyses for possible bugs and errors. If you have defined a type of Car with properties color and year, the compiler will make sure that only these properties will exist in a value that you assign the Car type.

### Type Annotations

TypeScript also uses types to annotate values. If we create a value of Date and hover over that value, the code editor will show you what type does this value belong to:

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

Also, it recognizes all the methods and properties this type has. When referencing this value with a dot, and autocomplete will list you all the properties this type has:

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

And will notify if you try to access undefined methods for this type. It is the best part of Typescript. You will be notified before running your code:

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

Another example of type annotation when values do not have a predefined type name, just a plain object. Then by default the compiler list all the methods in that object with values and not a short name:

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

## Summing up

TypeScript is based on types. Everything you write, you'll be using types, and a compiler will make sure you won't leave errors and get pretty and helpful annotations.
How to Backup MySQL Databases on Ubuntu VPS Server Automatically
Tags: mysql, database, security
Published: 2020-04-26 17:10:33

---
title: "How to Backup MySQL Databases on Ubuntu VPS Server Automatically"
published: true
description: "Learn How to Backup MySQL Databases on Ubuntu VPS Server Automatically"
tags: mysql, database, security
cover_image: https://images.unsplash.com/photo-1460925895917-afdab827c52f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60
---

Originally posted on [my blog](https://rapidpython.com/how-to-backup-mysql-database-on-ubuntu-vps-server-automatically/)

## Introduction

> Backing up your customer's data regularly is very important and you should do it. This article shows you how to backup MySQL database at regular bases.

**MySQL** is an open source Relational Database Management System (RDBMS) that uses Structured query Language(SQL).
MySQL is very popular and used by many companies and Websites.

## Why you should backup your database

There are many reasons why you should backup your database :

- Have a copy of your data
- Increase the level of security

## Backup database manually using mysqldump

Most developers prefer creating and downloading the database manually.

```shell
mysqldump -u username -p database_name > data-dump.sql
```

This command will create a file called **data-dump.sql** , keep it in safe location.

To restore the database

```shell
 mysql -u username -p database_name < data-dump.sql
```

You've done the backup and the restoration, let's make it great again 😍

## Backup database automatically using automysqlbackup

**AutoMySQLBackup** is a program that lets you take daily, weekly and monthly backups of your MySQL databases using mysqldump. It can back up multiple databases, compress the backups, back up remote databases, and email the logs.

Features :

- Email notification of backups
- Backup Compression and Encryption
- Configurable backup rotation
- Incremental database backups

Type the following command into the terminal to install the program:

```shell
sudo apt-get install automysqlbackup
```

A following prompt will ask you which mail configuration you prefer. Select “internet site” if you’re going to set up email notification. If not, just select “no configuration”.

Start the program

```shell
sudo automysqlbackup
```

The default location for Backups is **/var/lib/automysqlbackup.**

You should see three directories : daily, weakly, monthly.

The configuration file for automysqlbackup is located at /etc/default/automysqlbackup.

You can Open it in your favorite editor:

```shell
sudo nano /etc/default/automysqlbackup
```

You can do some customization, in many cases the defaults configurations can be left intact.

## Conclusion

Now You are able to sleep well at night, knowing that your customer’s data will be backed up at regular bases.

Thank you for reading 💓 see you next.