teleren/devto huggingface dataset:
How to Allow Remote Connections to MySQL Database on Ubuntu 20.04
Tags: ubuntu, database, server, mysql
Published: 2020-07-13 03:08:32

In this article we will see how we can allow remote connection to MySQL database installed in our ubuntu 20.04 server. This can help you to manage your database from you desktop or laptops or even application running on your PC’s.

Before we begin, you have to know how to establish an SSH connection to your server using putty. Here I am using a windows desktop. Open putty and provide IP address of your server and click open.

It will ask for your username and password, provide it and click enter.
Yeah! you just logged into your server.

What’s next?
It’s quite simple. First you have to change your MySQL configuration as by default MySQL will not be listening for external connections. For that just follow the bellow steps.

#### 1. Determine the location of you MySQL config file. Run the below command to find the same.

` mysql --help | grep "Default options" -A 1`

Your will get an output like

*Default options are read from the following files in the given order : /etc/my.cnf   /etc/mysql/my.cnf   ~/my.cnf*

It’s the order in which MySQL looks for config file and let’s take the first dir path /etc/my.cnf.

#### 2. We will edit the **/etc/my.cnf** file, for that run the below command. 

Note:- if you are not logged in with a user having root access, add **sudo** before the command.

`sudo nano /etc/my.cnf`

#### 3. Locate the line that contain [mysqlid]. 

*Don’t worry if your file is blank. Just add the following line to the file.*

`bind-address= xxx.ip.xxx`

replace **xxx.ip.xxx** with your server ip. *Example 192.168.0.100*


#### 4. Save the file by typing **CTRL+O** will ask for confirmation click enter and the exit the editor by pressing **CTRL+X**.


Well that’s it. But for the config changes to take action, restart your MySQL server by running 

`sudo systemctl restart mysql`

### **That’s all with the MySQL side, now we have to open MySQL port (default 3306) in the firewall for external connections. For that follow the below steps.**


#### 1. Run the command below.

`iptables -A INPUT -i enp1s0 -p tcp --destination-port 3306 -j ACCEPT`

Alternatively you can grant access to specific ip address.

`iptables -A INPUT -i enp1s0 -s xxx.xxx.xxx.xxx -p tcp --destination-port 3306 -j ACCEPT`

replace xxx.xxx.xxx.xxx with ip of the system from which you need to establish the connection. In my case I have provided the ip of my desktop.

** Make sure the you replace enp1s0 with your network interface name. To find your network interface name, run ifconfig on terminal/putty, you can find it out.


#### 2. Run the below command and save the iptables configuration.

for IPv4 : `sudo iptables-save`

for IPv6 : `sudo ip6tables-save`


It all done. Just reboot your system and try connecting from a deferent system.

To reboot you can run sudo init 6 or sudo reboot.

Thanks for reading,

If you find any issues or corrections please update on the comment. I love to improve. 😊
Regex Cheat Sheet
Tags: regex
Published: 2020-07-13 02:58:07

Full [Regex Cheat Sheet](https://simplecheatsheet.com/tag/regex-cheat-sheet/)

## Basics
* / expression / flags, i.e /[A-Z]+/g basic format
* / hello\?\*\\/ escape special characters with backslashes
* () group with parentheses
* | logical OR

## Character classes

* \w word \d digit \s whitespace (tabs, line breaks)
* \W NOT word \D NOT digit \S NOT whitespace
* \t tabs, \n line breaks
* . any character (except newline)

## Brackets

* [xyz] match any x, y, z
* [J-Z] match any capital letters between J & Z.
* [^xyz] NOT x, y, z

## Quantification

* bob|alice match bob or alice
* z? zero or one occurrences
* z* zero or multiple occurrences
* z+ one or multiple occurrences
* z{n} n occurrences
* z{min,max} min/max occurrences

## Anchors

* hello world exact match
* ^hello start of the strings
* world$ end of the string
Music is my coding buddy
Tags: productivity, music
Published: 2020-07-13 02:40:00

People do have a different kind of stress reliever when it comes to coding. Whenever I want to breathe and keep my head clear, I listen to music. It smooths my mood and aura to keep me going every day. 

According to Dr. Masha Godkin, “Music activates both the left and right brain at the same time, and the activation of both hemispheres can maximize learning and improve memory.” 

Somehow, it's like a **magic wand** that can help anyone to feel relax and good. As a programmer, you can rest for a while. Take a deep breath. Maybe a good 5 minutes so you can restart and find a new perspective. It really helps a lot. :) 

I'm a fan of the following music genre:
1. Rhythm and Blues
2. EDM (Electronic Dance Music)
3. Country Music
4. Jazz
5. OPM (Original Pilipino Music)


_______________________________________________________________


##Let's wrap up things!
Whatever your profession is, music is something you can really depend on. Have it try sometimes, you'll see.

Happy Coding!

_______________________________________________________________
Reference:
[Can Music Help You Study and Focus?](https://www.ncu.edu/blog/can-music-help-you-study-and-focus)

#####Photo by Daniel Reche from Pexels
What I've Been Up To
Published: 2020-07-13 02:16:45

---
title: "What I've Been Up To"
published: true
description: "A couple simple projects to level up"
tags:
//cover_image: https://direct_url_to_image.jpg
---
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/qotzro1lr63gm3bj2n5l.jpg)

In many respects, I know this isn't a big deal, but I do like to toot my own horn every once in a while. I'm fairly technical for a non-technical person. I was a computer science major for 3 years back in the late '90s. I worked in non-tech work from then until about 2006. From that time, I've learned HTML, CSS, Javascript, and then a few years later, Python. I'm not an engineer, but I do lots of little scripts: ETL scripts, bash scripts, data cleaning, cron jobs, etc. I'm not an engineer, but I sometimes joke that I play one on TV.

As I move into more technical product management, I realize the importance of really, deeply understanding the work I am engaging engineers to do.

Lately, I've decided to undertake some projects and tutorials to help me level up my technical skills. I don't want to understand these concepts abstractly, but as tactile realities.

So lately I have:
1. Set up a Lightsail instance and a load balancer on AWS
2. Used AWS Route 53 to configure DNS settings
3. Deployed a Ghost CMS (one of my favorite) blog to the instance
4. Started learning the basics of Flask to build a simple set of REST API service
5. Set up a MongoDB instance so I have someplace to store and fetch data from for my little service

Anyway, I know these aren't rocket science level accomplishments, but I'm pretty happy with what I've been up to the last few weeks.


(<span>Photo by <a href="https://unsplash.com/@bernardhermant?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Bernard Hermant</a> on <a href="https://unsplash.com/s/photos/finger-paint?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></span>)
Day 42 : #100DaysofCode - The Planning of a Project
Published: 2020-07-13 02:11:00

Today I planned my next project and it was STRESSFUL! I have an idea, but the process of building it is difficult. I realized that I need a lot of practice with rails associations. There are two things that I want a user to be able to do. 

I want a user to be able to leave comments and I also want a user to have the ability to like a post. 

I am still in the process of creating a schema for my project and look forward to learning how to connect everything. For now, this is what my schema looks like:

```
  create_table "comments", force: :cascade do |t|
    t.string "content"
    t.integer "user_id"
    t.integer "post_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["post_id"], name: "index_comments_on_post_id"
    t.index ["user_id"], name: "index_comments_on_user_id"
  end

  create_table "favorites", force: :cascade do |t|
    t.boolean "like"
    t.integer "user_id"
    t.integer "post_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["post_id"], name: "index_comments_on_post_id"
    t.index ["user_id"], name: "index_comments_on_user_id"
  end


  create_table "posts", force: :cascade do |t|
    t.string "title"
    t.text "description"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

  create_table "users", force: :cascade do |t|
    t.string "username"
    t.text "email"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end
```

When I complete my schema I will update this article with the updated version. Wish me luck.

Sincerely, 
Brittany
Running PouchDB Server on Android
Tags: pouchdb, termux, android
Published: 2020-07-13 01:07:39

**PouchDB Server** is a drop-in replacement for CouchDB, using PouchDB and Node.js. **Termux** is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required.
With the ability to run a linux terminal on Android, we can get a running instance of PouchDB Server on it.

### Goal

Having a PouchDB Server running on your Android phone.

### What you will need
An Android phone with [Termux](https://play.google.com/store/apps/details?id=com.termux&amp;hl=en_US) installed

### Instructions

At the command line in Termux, run the commands below in the following order:

```bash
pkg install python
pkg install nodejs
npm -g install node-gyp
npm install -g pouchdb-server
```

*A ton of warnings and errors may pop up. These can be ignored as long as we get it up and running successfully.*

Finally, run:
```bash
pouchdb-server --sqlite
```

If it didn't work, install SQLite:
```bash
pkg install sqlite
```

If all goes well, the PouchDB Server admin interface should be available at <code>http://localhost:5984/_utils</code>, in any browser on your phone:

#### Some finishing notes
* *At first, PouchDB Server will only be available locally. To enable access from other devices connected to the same network access point, change configuration setting httpd bind_address to 0.0.0.0*

* *It starts in admin party-mode (no authentication = open to any one editing.). Be sure to create an admin user if the server is made available on the network to prevent unintended access.*

[Source article](https://lybekk.tech/guide/pouchdb-server-termux)
Learning to Code : Roadmap. ( Tip for beginners) 
Tags: beginners, javascript, webdev, html
Published: 2020-07-13 00:46:27

I put out this tweet on twitter yesterday
{% twitter 1282155977815535617 %}
and I got asked from someone :
> Can you please share the roadmap to start with..

And, I replied to that person in a series of tweets. 
Then, I thought I could turn those tweets into an article and it might help more people. (What better place than #DEV). 

So, here it is:
1. ) 
> So, the First thing I recommend to anyone starting out is to watch this CS50 video. 
{% youtube jjqgP9dpD1k %}
It will help you get excited about computer science in general.
Don't get overwhelmed with the content, just try to get the gist out of it.

2. ) 
> Next thing, I recommend is learning `HTML` and `CSS`. (I may be a bit biased XD) 
They are easy to start with and you see your learning being applied very early. 
So, it keeps you motivated. 

3. )
> Now, onto resources to learn these. 
First, watch this video (Web Development lecture of CS50)
{% youtube uEmF74eHRO8 %}
Don't worry if you do not get everything mentioned in the video, just try to get hang of the syntax and it will help you when learning further.

4. )
> Now,  you can head over to:
 [Freecodecamp](https://freecodecamp.org) 
This is avery good resource for learning web development and it has played a major role in me being able to learn web development. So, what freecodecamp does is it provides you with an introduction in the beginning (very short) and then you jump into their online editor and solve challenges. So, you can see your learning being applied. 

5. )
> If you have trouble with any of the challenges, you can ask for help on the forum of freecodecamp or any other platform and there are people more than willing to help you.
Remember, Google has to be your best friend from now on.

### Some Other Tips from top of my head:
* Don't get overwhelmed.
* Reach Out to people, most of them will be nice to you. Don't get discouraged if some of them are mean to you.
* Practice, Practice, and Practice.
* Get your hands dirty, don't fall into tutorial hell (watching random tutorials on youtube).
* Learn to love frustrations cause there'll be many instances you wouldn't be able to solve a problem for days, so persistence is required.
* "Don't Panic" - Douglas Adams.
* Finally, Don't Give up. You can do it. :)

Remember, this is all from my personal experience and may not work for some people and I am also not that experienced in programming, so feel free to reach out to more experienced and your domain-specific people on different platforms to get a more robust plan. For now, this is all I got. :)

For further help or conversation or just to connect, feel free to reach out to me on [Twitter](https://twitter.com/aditya___pandey), [LinkedIn](https://www.linkedin.com/in/aditya-pandey-782103105/) and [Github](https://github.com/aditya-pandey)

I Will request Senior Developers to recommend additions that they think should be made here and will edit the post accordingly. 

Happy Coding !!!
My First #dataviz 
Tags: beginners, datascience, codenewbie, javascript
Published: 2020-07-13 00:45:02

This is my first public #dataviz and I used #JavaScript to convert seconds into MPH using my dog's 100 yard dash time. The best part about coding camp is not the ideas being sparked but that they are going to be realities. 
 
{% twitter 1282084402881847298 %}

Check me out! [Shelly Millet Blogspot](https://shellymillet.blogspot.com/)
Count Number of Substrings with Only 1s
Tags: cpp, python, interview, career
Published: 2020-07-14 04:36:29

---
title: Count Number of Substrings with Only 1s
published: true
date: 2020-07-13 00:00:00 UTC
tags: cpp, python, interview, career
series: Interview Problems
canonical_url: https://csposts.com/posts/count-no-of-substring-with-only-1s
---

Given a binary string, count no of substrings with only 1’s. Since the resulting count could be huge, print it modulo {%katex inline%} 10^9 + 7 {%endkatex%}.

**Example** :

Input: “11101101”  
Output: 10  
Explanation: “1” occurs 6 times, “11” occurs 3 times and “111” occurs 1 time. Thus number of substrings with only 1’s = 6 + 3 + 1 = 10.

## Approach: Sliding Window

### Intuition

We can see that a ‘0’ divides two blocks of ‘1’s. For a block of ‘1’ with length `l` has {%katex inline%} 1 + 2 + 3 + ... + l = l * (l + 1) / 2 {%endkatex%} substrings. Thus, we only need to count the length of each block of 1’s and use the above formula.

For example, the string “11101101” can be divided into blocks of 1’s having 3 characters, 2 characters and 1 character which will give 3 * (3 + 1) / 2 = 6, 2 * (2 + 1) / 2 = 3 and 1 * (1 + 1) / 2 = 1 substring respectively.

### Implementation

C++ code:

```cpp
#include <iostream>
#include <string>
using namespace std;

int subCount(string s) {
    const int MOD = 1e9 + 7;
    int i = 0, l = s.length();
    int ans = 0;
    while (i < l) {
        int count = 0; // count gives length of block of 1's
        if (s[i] == '1') {
            while(i < l and s[i] == '1') {
                ++count;
                ++i;
            }
            long substringCount = 1L * count * (count + 1) / 2 % MOD;
            ans = (ans + substringCount) % MOD;
        } else {
            ++i;
        }
    }
    return ans;
}

int main() {
    cout << "Number of substring with only 1's for 11101101 is " << subCount("11101101") << endl;
    return 0;
}
```

Python code:

```python
def sub_count(s):
    MOD = 10**9 + 7
    i = 0
    l = len(s)
    ans = 0
    while i < l:
        if s[i] == '1':
            count = 0 # count gives length of block of 1's
            while i < l and s[i] == '1':
                count += 1
                i += 1
            substring_count = count * (count + 1) // 2 % MOD
            ans = (ans + substring_count) % MOD
        else:
            i += 1
    return ans

if __name__ == ' __main__':
    print("Number of substring with only 1's for 11101101 is", sub_count('11101101'))
```

### Complexity Analysis

- **Time Complexity**: {%katex inline%} O(n) {%endkatex%} where n is the length of string.  
- **Space Complexity**: {%katex inline%} O(1) {%endkatex%} as we are not using any extra space.
Crea tu propia comunidad

Tags: javascript, career
Published: 2020-07-12 23:42:57

Comunidades de desarrolladores hay cientos, miles alrededor del mundo y en muchos idiomas.

Es, más soy parte de muchas. Y siempre pensé que alguien debía hacer una en mi ciudad.

Vivo en Mar del Plata, ciudad en la Provincia de Buenos Aires, Argentina desde que nací. Tengo 28 años, pero solo 3 trabajando como desarrollador web. Soy apasionado de mi trabajo. A pesar de ser una ciudad de mediana demografía, tiene mucho movimiento en la industria tecnológica. Hay empresas multinacionales que apuestan a poner sus oficinas acá e incluso muchas personas trabajan de manera Freelance.

Frecuentemente hay meetups (cuando podíamos salir de nuestras casas), pero siempre una software factory se hace cargo de hostearla. Esto porque claramente tienen el respaldo económico para hacerlo, pero principalmente para promocionarse y atraer a aquellas personas que quieran sumarse a la compañía. Lo cual no lo veo mal, aportan conocimiento y ofrecen oportunidades.

Pero ¿Que tal si en una meetup podrías encontrar, quizás una persona de cada compañía? O incluso Freelancers que busquen compañeros. Gente que esté comenzando a desarrollar, igual que vos y puedan intercambiar números y juntos, crear algo nuevo.

No podía creer que en esta ciudad no haya una comunidad propia, local.

Con unos amigos, nos dimos cuenta que todos estábamos pensando en lo mismo y en seguida nos pusimos en la meta de hacer nacer lo que tanto soñamos.

Lo primero y principal es organizarse. Como todo sueño o meta, si no lo planeas y te lo tomás en serio, no vas a ningún lado.
Miramos lo que otras comunidades hacían, como manejan sus diseños, como interactúan con los miembros, como manejan la horizontabilidad.

Empezamos tímidamente una cuenta de Instagram. Lo que pasó fue el indicio de que no eramos las únicas personas que necesitaban una comunidad local. Sin tener siquiera una primera publicación, llegamos en un día y medio a los 100 seguidores ¡Increíble! Que 100 personas estén interesadas en lo que hacés es un montón y nos sirvió para darnos el envión necesario para no detenernos. Usamos esa red para publicar Quizes y post explicativos de features de JS.

Lo siguiente fue Twitter, crecía tímidamente, hasta que no me preguntes por que @codeAR hizo un post con unas cuantas comunidades IT nuevas y entre ellas estaba Viernes.js
Lo siguiente fue una lluvia de seguidores, que en horas superó los que teniamos en Instagram.

Ahora estamos preparando un podcast (spoiler alert), que tiene buena pinta.

Lo importante y que quería comunicar es, hagan su propia comunidad, adáptense a su ciudad, a lo que necesita.
No hay nada mas lindo que compartir una pasión con personas de tu lugar y más, si es entre amigos/as.
Three free beginner coding resources. One you know. Two you didn't. One's a game!
Tags: beginners, html, css, javascript
Published: 2020-07-12 23:19:42

#You've got nothing to lose and so much to gain.
- Learn test-driven development
- Write code yourself
- Build your portfolio
- Pick-up a new habit
- Join a community full of mentors willing to help, critique and collaborate
- Set the difficulty of your education each day

##Here are the three free resources
1. [FreeCodeCamp.org](https://freecodecamp.org)
2. [FreeCodeGame.com](http://freecodegame.com) <-- A game! I made it, too!
3. [FrontEndMentor.io](https://frontendmentor.io)
DevFest WI 2020 CFP Is Open
Tags: inclusion, a11y, techtalks
Published: 2020-07-12 23:09:34

---
canonical_url: https://devfestwi.com/blog/posts/RFUjSfVwMjYqdzPk814E/
---
We want YOU to speak at [DevFest WI](https://devfestwi.com/)!

This year, DevFest WI is an online conference for all technologists, organized by GDG Madison and volunteers from the Madison tech community.

DevFest WI will take place on October 24, 2020, and feature a collection of live talks, pre-recorded talks, panel discussions, and more.

The conference theme is inclusivity: how to create development teams and software products that are welcoming to everyone. We are seeking presentations on a broad range of topics related to inclusivity, including, but not limited to:

- online privacy and security
- accessibility
- localization
- web performance
- diversifying teams
- tech interviews
- empathetic code review
- mentoring and teaching
- cross-cultural design
- AI and ML
- neurodiversity
- tech talks/public speaking

We are particularly interested in talks on topics that the you, the speaker, are excited about and that can be understood and appreciated by non-specialists.

Presentations with more than one speaker are welcome. First-time speakers are encouraged to apply. All speakers will be assigned a mentor who will be happy to help you develop your presentation.

[Click here](https://devfestwi.com/cfp) to submit a proposal. The CFP will close on August 15th and talks will be accepted on a rolling basis so submit early.

As part of your submission, you will be asked to read and agree to the DevFest WI [Code of Conduct](https://devfestwi.com/coc).
Leetcode - Intersection of Two Arrays (with JavaScript)
Published: 2020-07-12 23:04:30

Today I am going to show how to solve the Leetcode Intersection of Two Arrays algorithm problem.

Here is the problem:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/w6c668wefpf9nmh4gnf3.png)

Solution:
There are no built-in methods in JavaScript for computing an intersection. That's why I use a new data structure, **Set**, which was introduced in ECMAScript 2015. As you know, set objects are collections of unique values.

First, I use Set to store both arrays. Then, I create an array from a set1 using the spread operator. I filter through the array to select the elements that are also in the second set object (set2). 

``` javascript
var intersection = function(nums1, nums2) {
    
    let set1 = new Set(nums1);
    let set2 = new Set(nums2);
    
    let output = [...set1].filter(x => set2.has(x))
    
    return output

};
```