teleren/devto huggingface dataset:
Migrate to Mojolicious 9 - Quick feedback
Tags: perl, mojolicious
Published: 2021-03-25 07:11:59

Today I migrated one application to [Mojolicious 9](https://mojolicious.org/) :tada:

![Mojolicious 9](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0wk9a9c05a3sntlwkydv.png)

Since I had some errors, I just wanted to share if it could help others to migrate quickly.

EDIT: as commented by @grinnz, there is the [upgrading document](https://github.com/mojolicious/mojo/wiki/Upgrading) that should be checked for tips before any attempt to migrate.

It's not a big application (~2000 lines of code) but it has authentication, external calls, DB access and a flat config loaded at startup. It uses some plugins like [Authentication](https://metacpan.org/pod/Mojolicious::Plugin::Authentication), [Status](https://metacpan.org/pod/Mojolicious::Plugin::Status), [Config](https://metacpan.org/pod/Mojolicious::Plugin::Config) and [AccessLog](https://metacpan.org/pod/Mojolicious::Plugin::AccessLog). 

I like to think it is a *small but good coverage* of Mojolicious features.

I said I had errors, but actually very few and I will give my solutions right below.

#### Can't locate object method "route" via package "Mojolicious::Routes"

In my case it was a matter of replacing something like:
```perl
my $auth = $r->route('/members')->over(authenticated => 1);
```
per something like:
```perl
my $auth = $r->under('/members')->requires(authenticated => 1);
```
I wonder if code snippets shown on [Mojolicious::Plugin::Authentication doc](https://metacpan.org/pod/Mojolicious::Plugin::Authentication) are still valid for Mojolicious 9 (?).

#### Undefined subroutine &App::Controller::App::decode_json called

This sub seems to have moved, I fixed by simply adding:

```perl
use Mojo::JSON qw(decode_json encode_json);
```

## Conclusion
I like Mojolicious :heart: and the way it is so actively developed. It's true that there is sometimes some small breakages (I remember in the past a breakage about [slurp](https://github.com/mimosinnet/presentation/pull/1/files)) but it is always well documented and painless :+1:

Long live to [Mojolicious](https://mojolicious.org/)!
What is DuckDuckGo? Google Vs DuckDuckGo Search Engine
Published: 2021-03-25 05:49:13

Branding itself as the search engine that doesn’t store your personal info and follow you around with ads or track you DuckDuckGo has managed to undercut its rivals, not on price but privacy.

What if I say that DuckDuckGo is an excellent search engine compared to Google. Would you believe it? DuckDuckGo Today has an estimated 65 million monthly users on the Internet. And it is attracting millions of Internet users around the world. If we talk about earlier days, DuckDuckGo was not a famous search engine. But ever since it was launched, it has been attracting the attention of most internet users. And if you worry about your privacy, DuckDuckGo Would be the first choice.

Table of Contents	
<a href="https://www.clubinfonline.com/2021/01/21/what-is-duckduckgo-google-vs-duckduckgo-search-engine/ "> What is DuckDuckGo?  </a>

A Brief Intro to DuckDuckGo: How it takes place as a Search Engine 
DuckDuckGo VS Google: The Better Search Engine?
Why Should I Use DuckDuckGo Instead of Google?
Advantages of DuckDuckGo Search Engine:
How to Set DuckDuckGo as your default Search Engine
What Google and Facebook Do With Your Data:
Facebook Off-Page Activity: 
What Data WhatsApp Collect from You:
Start MySQL database server on Mac startup
Tags: dbdb, database, mysql
Published: 2021-03-25 06:47:22

---
title: Start MySQL database server on Mac startup
published: true
description: Start MySQL database server on Mac startup 
tags: dbdb, database, mysql
series: dbdb
//cover_image: https://direct_url_to_image.jpg
---

# Set cron by crontab
- You can use `@reboot` in crontab.
- [crontab osx man page](https://www.unix.com/man-page/osx/5/crontab/)
```bash
crontab -e

# Start MySQL 8.0.23 with port 13306 on startup
@reboot cd ~/tmp/path-to-your-dir && cd mysql/versions/8.0.23 && dir=`pwd` && $dir/basedir/bin/mysqld --defaults-extra-file=$dir/datadir/mysql8-name1/my.cnf --daemonize --user=_dbdb_mysql --port=13306 --socket=/tmp/dbdb_mysql_13306.sock --basedir=$dir/basedir --plugin-dir=$dir/basedir/lib/plugin  --datadir=$dir/datadir/mysql8-name1 --log-error=$dir/datadir/mysql8-name1/mysqld.err --pid-file=$dir/datadir/mysql8-name1/mysql.pid

# Start MySQL 8.0.23 with port 23306 on startup
@reboot cd ~/tmp/path-to-your-dir && cd mysql/versions/8.0.23 && dir=`pwd` && $dir/basedir/bin/mysqld --defaults-extra-file=$dir/datadir/mysql8-name2/my.cnf --daemonize --user=_dbdb_mysql --port=23306 --socket=/tmp/dbdb_mysql_23306.sock --basedir=$dir/basedir --plugin-dir=$dir/basedir/lib/plugin --datadir=$dir/datadir/mysql8-name2 --log-error=$dir/datadir/mysql8-name2/mysqld.err --pid-file=$dir/datadir/mysql8-name2/mysql.pid

# Start MySQL 5.7.31 with port 33306 on startup
@reboot cd ~/tmp/path-to-your-dir && cd mysql/versions/5.7.31 && dir=`pwd` && $dir/basedir/bin/mysqld --defaults-extra-file=$dir/datadir/mysql5-name3/my.cnf --daemonize --user=_dbdb_mysql --port=33306 --socket=/tmp/dbdb_mysql_33306.sock --basedir=$dir/basedir --plugin-dir=$dir/basedir/lib/plugin  --datadir=$dir/datadir/mysql5-name3 --log-error=$dir/datadir/mysql5-name3/mysqld.err --pid-file=$dir/datadir/mysql5-name3/mysql.pid

# Start MySQL 5.7.31 with port 43306 on startup
@reboot cd ~/tmp/path-to-your-dir && cd mysql/versions/5.7.31 && dir=`pwd` && $dir/basedir/bin/mysqld --defaults-extra-file=$dir/datadir/mysql5-name4/my.cnf --daemonize --user=_dbdb_mysql --port=43306 --socket=/tmp/dbdb_mysql_43306.sock --basedir=$dir/basedir --plugin-dir=$dir/basedir/lib/plugin  --datadir=$dir/datadir/mysql5-name4 --log-error=$dir/datadir/mysql5-name4/mysqld.err --pid-file=$dir/datadir/mysql5-name4/mysql.pid
```
Who do your freelancing clients think you are?
Tags: freelance, freelancing
Published: 2021-03-25 06:36:19

Are you good at what you do?
Are your technical skills excellent?
Do you have the knowledge and the experience to amaze and delight your clients?

You know you do.  

So make sure your clients know this. 

Don’t hide behind low prices. 
Don’t ask for small projects. 
Don’t say you’ll do any work for anyone at any price. 

Tell them that you’re the person they can believe in.
Tell them that you're amazing at what you do. 
Tell them that you can deliver the results they need.  
 
You know it’s true. So make it happen.
Matthew Brannelly | Online Fundraising Tools
Tags: fundraising, nonprofits, digitaltools, charities
Published: 2021-03-25 06:34:28

People like Matthew Brannelly, who have a keen interest in developing NGOs for public welfare, come up with charitable foundations, companies, agencies, and individuals to collectively gather funds for the nonprofits.

Know with Matthew Brannelly, how is digitalization a boon for fundraising and best digital fundraising tools for nonprofits.

http://matthewbrannelly.com.au/digital-fundraising-tools
Inheritance in Java
Tags: java, oop, computerscience
Published: 2021-03-25 06:23:34

#Java and Inheritance
Inheritance is a mechanism in java by which one object inherits the features(methods and fields) of the parent object. Inheritance is an important pillar of OOPs(Object Oriented Programming systems). Inheritance represents IS-A relationship.

#Terminology
* **Sub Class:** The class that inherits features of another class is known as sub class. It is also called extended class, derived class, or child class. Sub class can add new methods and fields as well.
* **Super Class:** The class that is inherited by other class is known as super class. It is also known as base class or parent class.

#Syntax:
```java
class derived-class extends base-class
{
    //methods and fields
}
```

#Example
![Inheritance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cpzebcirw39o38n13fz5.png)

#Implementation
```java
class Person{  
 String name= "John";  
}  
class Employee extends Person{  
   float salary = 10000;  
   public static void main(String args[]){  
     Employee e =new Employee();  
     System.out.println("Name of Employee is:"+ e.name);  
     System.out.println("Salary of Employee is:"+ e.salary);  
   }  
} 
```

#Types of Inheritance

* **Single Inheritance:** It refers to a child and parent class relationship where a class extends the another class.
![single](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9bk36lyufc7w7sogs2lz.png)
 

* **Multilevel Inheritance:** It refers to a child and parent class relationship where a class extends the child class. For example class C extends class B and class B extends class A.
![multilevel](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m3h8q4m4tqoe8389xczr.png)
 

* **Hierarchical Inheritance:** It refers to a child and parent class relationship where more than one classes extends the same class. For example, classes B, C & D extends the same class A.
![hierarchical](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rj4up30iteo809n651d5.png)


* **Multiple Inheritance:** It refers to the concept of one class extending more than one classes, which means a child class has two parent classes. For example class C extends both classes A and B. Java doesn’t support multiple inheritances with classes.Though we can achieve multiple inheritances through interfaces in java.
![multiple](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/abw6olbdy6pttja6xigi.png)


* **Hybrid Inheritance:** Combination of more than one types of inheritance in a single program. For example class B & C extends class A and another class D extends class B then this is a hybrid inheritance example because it is a combination of single and hierarchical inheritance.
![hybrid](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8865oiyprsm73jb08z24.png)
 
#Conclusion
I hope this article is helpful to you in learning Inheritance in Java.
Made a GitLab code search tool, try it
Tags: opensource, java, githunt, showdev
Published: 2021-03-25 06:17:00

Kooder is an open source code search project, offering code, repositories and issues search service for code hosting platforms including Gitee, GitLab and Gitea.

![UI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nizkmob6d62rrmiiobp5.png)

There are two modules, gateway and indexer. Gateway is integrated inside gateway under default config.

Gateway:

* Accept index tasks from HTTP requests and put them in the queue after examing it
* Accept search requests and return their results back to the client

Indexer:

* Monitor the index tasks inside the queue
* Update these add, delete and update index tasks back to the index library

### Logic Flow
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p2r1j6q5tya0cqato3cq.png)

### Use it in Gitlab

Config following properties：

```
gitlab.url = http://gitlab-host:gitlab-port/  
gitlab.personal_access_token = <root user personal access token>  
git.username = root  
git.password =  
```

Kooder will use access token as the password if you don't offer one.

### Use it in Gitea
1.Site Administration

2.Add Gitea Webhook

3.Set up Webhook

* Set Target URL to  `http://kooder-ip:kooder-port/gitea`
* Set POST Content Type to `POST + application/json`
* Check`All Event` or `Custom Events` for the `Trigger On` option. ( If you choose `Custom Events`, you need to check `Repo`, `Push` and `Issue`)



2.Config following properties.

```
gitea.secret_token = <webhook secret token>
gitea.url = http://gitea-ip:prot/
gitea.personal_access_token = <admin user personal access token>
git.username = <admin username>
git.password = <admin password>
```
 
### More Info
GitHub: https://github.com/oschina/kooder
Gitee: https://gitee.com/koode/kooder
237. Delete Node in a Linked List
(javascript solution)
Tags: algorithms, javascript
Published: 2021-03-25 06:14:51

###Description:
Write a function to delete a node in a singly-linked list. You will not be given access to the head of the list, instead you will be given access to the node to be deleted directly.

It is guaranteed that the node to be deleted is not a tail node in the list.

###Solution:
Time Complexity : O(1)
Space Complexity: O(1)

```javascript
// Change node's val to the next node and then point node.next to node.next.next
// Because we never have to worry about node being tail we can always count on node.next.val and node.next.next to never be null
var deleteNode = function(node) {
    node.val = node.next.val
    node.next = node.next.next
};
```
How to upload and play Unity WebGL games on IPFS using Slate
Tags: slate, ipfs, unity3d
Published: 2021-03-25 05:58:58

[Slate](https://slate.host) is an open-source storage network which makes it possible for people to store, collect, organize, and link files together. In this short tutorial, I will show you how to upload and play Unity WebGL games on IPFS using Slate in 4 simple steps. Let's dive right into it.  

Zip the folder which contains your Unity WebGL game build. 
![pixel-invaders](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q9xmld1ofww6l4srd7a3.jpg) <figcaption>Folder contents of a sample Unity WebGL game build</figcaption>


![pixel-invaders-zip](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sbrkcdm6ax09v2okizxm.jpg)<figcaption>Folder content after ziping Unity WebGL game files</figcaption>


<hr>

If you do not have an account already, visit https://slate.host/_ and create an account on Slate. If you have an account already, log in to your Slate account.
 
![sign-up-page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cq2rwpzc0inmz3250kiz.jpg) <figcaption>Image showing Slate sign-up page</figcaption>



<hr>

In the Welcome page, drag the game zip file into Slate to upload it. 
![uploaded-game](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pkb2al3snaj1zraf56qw.jpg) <figcaption>Image showing upload Unity WebGL game zip</figcaption>


<hr>


Click on the game to open and enjoy.![opened-game](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7knxqfsxh8d3myc28gio.jpg) <figcaption>Image showing opened Unity WebGl game in Slate. To try out this game, visit [here](https://slate.host/daniel86/games/cid:QmNPGWnMrTfPXcivJzt9YJqEWBMjzehtytnqpKjuSj3wku)</figcaption>
Simple caching class for your PHP projects
Published: 2021-03-25 05:41:22

# Intro

[Mezon](https://github.com/alexdodonov/mezon) provides simple cache class. Wich will help you to test how caching will affect performance of your code. If the performance will be boosted, then you can implement more complex solutions for caching.

# Installation

Just print in console

```
composer require mezon/cache
```

And that's all )

## How to use?

First of all we need to create single instance of cache ("singleton" pattern is used):

```php
$cache = Cache::getInstance();
```

Then we can add data to cache:

```php
$cache->set('key', 'data to be stored');
```

After all data was added you need to store it to be able using it within other requests.

```php
$cache->flush();
```

And then you can check if the key exists:

```php
var_dump($cache->exists('key')); // bool(true)
var_dump($cache->exists('unexisting-key')); // bool(false)
```

And then you can fetch data by it's key:

```php
var_dump($cache->get('key')); // string('data to be stored')
```

That's all for now )

# Learn more

More information can be found here:

[Mezon Framework](https://github.com/alexdodonov/mezon)
[Twitter](https://twitter.com/mezonphp)

# It will be great if you will contribute something to this project. Documentation, sharing the project in your social media, bug fixing, refactoring, or even **[submitting issue with question or feature request](https://github.com/alexdodonov/mezon-cache)**. Thanks anyway )
Day 5 of #100DaysOfCode
Published: 2021-03-25 05:41:16

So, yesterday was my day 5 of #100daysofcode, 
I made a "Simple Music App" Using JavaScript, it was a tutorial on beginners from Dev Ed

Things I learned: 
-- got more into eventHandlers
-- learned about arrays, objects, etc. 

This was an awesome project for me, watched this project on YouTube, here’s a link of it: https://youtu.be/2VJlzeEVL8A

Here’s my GitHub repo:
Code :- https://github.com/ashuydv/javascript-5
Preview :- https://ashuydv.github.io/javascript-5/
Thanks for your precious time !!
Life saving Git commands
Tags: git
Published: 2021-03-25 05:22:40

If you've committed some files in your local repository by mistake, you can undo it without losing your changes using the below command
1)Don't remove staged files
```
git reset --soft HEAD^
```
2)Remove staged files
```
git reset HEAD^
```
If you want to undo commit and lose all the changes, you can use
```
git reset --hard HEAD^
```
How to have better, more fun virtual meetings with Gather Town
Published: 2021-03-25 05:18:59

So we've been in this pandemic for a while now... most people are still working from home, and all our meetings are virtual. I think most people are now Zoom'd out. Sick of simply seeing people through a camera. What if you could make your meetings a little more fun? A little more enjoyable, and less "bleh".

Last week, I discovered [Gather Town](https://gather.town/). Yes, it's still a virtual meeting, but it's way more fun. Think about how fun it is playing video games and chatting to your friends on comms. That's what Gather Town is like.

You select your avatar on load and you walk around in a virtual environment, interacting with touch points, and seeing other people as avatars. Gather Town uses proximity chat, so if you're close enough to someone you can start having a conversation with them. It can be voice only, or both video and voice.

![ezgif-3-1378a7de7701](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oehc8qvt7n9nbci913ws.gif)
 
There's scope for having larger meetings in different spaces, and the whole experience feels like a top down dungeon explorer video game. It's really fun. Not only is it fun, but it's fully customisable.

The sky's the limit when it comes to Gather Town. You can build your own environment, customise a existing one, and even add interactable objects like white boards, video games, signage, websites, and heaps more.

Think about all the things you'd do at a physical event. You can pretty much do them in Gather Town. Visit a merch booth, check out various exhibitors, sit down with someone for coffee :coffee: you name it. There's been a tonne of events that have used Gather Town in the past including [BostonFIG](https://www.bostonfig.com/), [Filecoin](https://liftoff.filecoin.io/), [EATEL](https://ea-tel.eu/ec-tel-conference) and lots more.

But it's also great for team or personal use. I built a customised Gather Town space for myself and my team to meet in. It was super fun and way more exciting than our usual Zoom meetings. I've also heard people using it for their family chats, friend catch ups, uni meetups and more. As you'll probably know, I'm a streamer too. I'm already thinking about all the ways I could use Gather Town on stream: hosting co-streams, having my chat hang out in Gather Town, building my own Kingdom, and having tonnes of things to interact with.

![Gather Town MishManners](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hyt53uw8fxrjuckdebni.PNG)

You can even upload custom graphics too. It's a little bit more in depth, so check out this YouTube video to resize and use your own images:

{% youtube 2XjTLK6aNz0 %}

Next time you're thinking about a fun alternative for a team meeting, think about Gather Town. You don't need to be a designer or creative to use Gather Town. Just use one of the pre-build rooms to meet in.

Have you used Gather Town yet? Did you like it? Let us know your thoughts in the comments below.
How to Download All The Images From a Website using Scrapy
Published: 2021-03-25 05:15:23

Scrapy is one of the most accessible tools that you can use to crawl and also scrape a website with effortless ease.

So let's see how we can crawl Wikipedia data for any topic and download all the images and save it to our disk.

Here is the URL we are going to scrape https://en.wikipedia.org/wiki/Lists_of_animals, which provides a list of lists of different types of animals. We are going to try and spider through this by first downloading this page and then further downloading all other images.
First, we need to install scrapy if you haven't already.
Then create a file called fullspider.py and paste the following.
It loads scrapy and the Spider library. We will also need the LinkExtractor module so we can ask scrapy to follow links that follow specific patterns for us.

The allowed_domains variable makes sure that our spider doesn't go off on a tangent and download stuff that's not on the Wikipedia domain. Also, the upload.wikimedia.org is where all the images sit. We also just provide the start_url

Now, lets set up the rules.

This ruleset makes sure it downloads anything with the extension .jpg in it and also removes the deny_extensions default setting.
This tells scrapy to download all images and then call the function parse_item

so in parse item, we are just going to save images downloaded to the disk
Now lets put the whole thing together
And run it with.
It should output that the files have been saved successfully.


This technique will work on almost any website. But if you want to scale this, you will need to overcome the inevitable IP block.

Consider using a professional Rotating Proxy Service like Proxies API to route requests through millions of anonymous proxies to scale your web projects.

Proxies API also handles automatic retries, automatic User-Agent-String rotation, solves CAPTCHAs behind the scenes using a simple one-line API call.
I made google docs clone but with a twist
Tags: webdev, showdev, react, postgres
Published: 2021-03-25 04:56:47

When I used to discuss data-structure and algorithm problems with a friend while in college (yea thank covid for closing all the colleges D:), it was a pain in the neck since both of us were coding on different computers and different code-editors, and more often than not resorted back to just using pen and paper.

I attempted to solve this problem by creating a real-time collaborative editor in which once you enter a room you just need to share the URL with a friend and he can join your room and both of you can collaborate together.


## Technologies used:

- **React** for the front-end of caucus.
- **NodeJS** for the back-end of caucus.
- **Postgresql** database for storing and retrieving leetcode questions.
- **socket.io** for real-time communication.
- [convergence](https://convergencelabs.com/) for handling real-time collaboration.
- Heroku🤮(I hate Heroku) for hosting the nodejs server and Azure 🥰 for hosting the docker container.

## Features

- Real-time collaboration for practicing for coding interviews
- All free leetcode questions to practice.
- You can also load any question from codeforces or atcoder by pasting the problem URL
- Real-time messaging.
- Remote code execution in 5 different languages (C++, Java, Python, Javascript and GO.
Try it live: [live demo](https://caucus-app.herokuapp.com/)

This project is available at GitHub -


{% github https://github.com/rishabh-malhotraa/caucus %}

If you liked what the project, **please consider leaving a star ⭐ on the [GitHub repo](https://github.com/rishabh-malhotraa/caucus) it means a lot.**