teleren/devto huggingface dataset:
Milepost: From a GitHub User to a GitHub Star
Tags: github, githubstar, journey, milestone
Published: 2021-03-15 04:29:10

#### Hello World :wave:

I'm writing with a blissful bright smile that I have been recognized by GitHub as a [GitHub Star](https://stars.github.com/profiles/vinitshahdeo). For those of you who got caught up in the jargon, the honour of becoming a part of the **GitHub Stars Hall of Fame** is not any less than getting a Gold Play Button from YouTube.

![vinitshahdeo - GitHub Star](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/50yqnp8q8khz0x750n0m.png)

> _The GitHub Stars program thanks GitHub’s most influential developers and gives them a platform to showcase their work, reach more people, and shape the future of GitHub. Till now, there are just **46 GitHub stars worldwide**. [Learn more](https://stars.github.com/program/)._

![Vinit Shahdeo - GitHub Star](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6m5gm01z4j1pn5esubks.png)

Three days ago, my usual work-day Friday unfolded into a surprising evening, which was matched by the thrill of receiving an email that read out the *'few magical words'* every developer wants to hear - ***"Congrats, you're a GitHub Star!"*** :star_struck:

I am grateful to GitHub for recognizing the work I have done and my journey as a developer. Not only has GitHub helped me hone my skills but it has [introduced](https://github.com/vinitshahdeo/vinitshahdeo/discussions/1) me to some exceptional developers, who are now my closest pals. **Give me a cheer if our meet-cute story includes GitHub**. :beer:

[![vinitshahdeo - github profile](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pvtxuccsch15qg6kbc03.png)](https://github.com/vinitshahdeo)

As I always say the green dots on my GitHub profile represent [my wandering expeditions](https://dev.to/vinitshahdeo/my-journey-from-0-to-1k-followers-on-github-1n6h) - from one repo to another. Five years ago I was just a curious soul wondering how Facebook works and back in 2019, my curiosity and the open source community led me to become a [Software Engineer at Postman](https://medium.com/@vinitshahdeo/software-engineering-internship-experience-at-postman-182df16ef33f), the world's leading collaboration platform for API development.

{% twitter 1371454887796617217 %}

**Open Source kept me on my toes and encouraged me to always strive better.** The *['GitHub' way of life](https://www.opensourceforu.com/2020/07/if-you-are-a-techie-your-home-page-should-be-github-not-instagram/)* has boosted my motivation and reciprocating all that I have received, I now strive to give more to the open-source community.

{% twitter 1371672584400560129 %}

No need to **`git commit`** just yet - I still have my GitHub Stars Swag box to unpack.

[![Vinit Shahdeo | GitHub Star](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r4sncmx7v1i95k5w0c76.png)](https://stars.github.com/profiles/vinitshahdeo/)
> **Find my GitHub Star Profile [here](https://stars.github.com/profiles/vinitshahdeo/)**.

Happy Open Sourcing!
Say Hi on [Twitter](https://twitter.com/Vinit_Shahdeo).
Announcement of Latest Sarkari Result of SSC
Tags: sarkariresult
Published: 2021-03-15 04:20:01

Get Everything From Sarkari Results, Syllabus, Pattern, Cutoff
Sarkariresultsin.info is a job news portal where it provides free information about the latest jobs, government jobs, notification, admit card, defence jobs, bank jobs, police jobs etc. If you are a student and preparing for the government job. You can get syllabus, pattern, cuttoff marks, Sarkari Result etc. of exams. You also will get a link to the official website of government exam, which you can download by clicking the admit card from there.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0q8zj4vol4rnysuczcqs.jpg)

Also, visit:
https://www.sarkariresultsin.info
How to Connect MySQL Database Using PHP 2021 | MySQL Database connection with PHP code
Tags: php, database, mysql, webdev
Published: 2021-03-15 04:18:36

How to Connect MySQL Database Using PHP 2021 | MySQL Database connection with PHP code
How do you connect MySQL database with PHP?
How do I connect to a MySQL database?
Which of the following methods connect MySQL database using PHP?
How do you connect to a MySQL database using MySQLi?

Watch Video Here:

{% youtube 7ctJ7YqrQjE %}

Create MySQL Database at the Localhost. Create Database. Now return to the homepage of PHPMyAdmin. Create a Folder in htdocs. Create Database Connection File In PHP. Create a new PHP file to check your database connection. Run it! Create Database Connection. MySQLi Procedural Query. Connect MySQL Database with PHP, database connection in php with mysql,  how to connect mysql database in php,
how to connect mysql database from webserver, how to connect to phpmyadmin database in php, php database connection example program, how to connect html form to mysql database using php,
how to connect database with mysql,
mysql_connect in php.

-------------------------------------------------------------------------------------------------
Please have a look at my website for more details!
https://hmawebdesign.com
JavaScript SPA Project: Dessert Reviews
Published: 2021-03-15 04:08:58

For my first JavaScript project, I made a SPA (single page application) consisting of HTML and JavaScript for the front end and a back-end API made with Ruby and Rails. One of the requirements was to use Object Oriented JavaScript (classes) to encapsulate related data and behavior. JavaScript is not a class-based object-oriented language but there are ways of using object oriented programming in it. I learned much about object oriented JavaScript when refactoring my code to include it and I would like to share that now.

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

The application only had two tables, Author and Review. The Author model only had one attribute, so I decided to only make a Review class in JavaScript. First I made a new file to keep things organized, "models/review.js". After that I needed to make a constructor method inside the class. This is a special method used to initialize objects. It is called on when an object of a class is created. In the class I can create objects that have data and function, after I define them within the class. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/02jw2jffhruwrnjljbj6.png)

Next I needed to add functionality to my elements so I could render them. So I defined each element and assigned some attributes for styling. Next I put what I wanted into a "cardDiv" so they would all show in the "card" I got from bootstrap. 

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

I made some functions to save all my elements into an array so I could call on them easier. I needed to make a create function with an argument that would refer to all of the elements when they were initialized. That is why you see "(attr)" as an argument.

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

For the rest of the class functions, it was mostly a matter of concern when deciding what to put where. I was taught that you make your best judgement call and that would be good enough. So the rest of my class has a form and completed reviews template, the ability to render the forms and reviews, a submit function, and delete function.

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

Lastly I decided to make a function to support a search bar. I found it very hard to find code that functioned similar to mine so I could get a good example of how I needed to do this. I finally found it and after setting it up.....it did not work. So I spent some time trying to implement conditional statements to get it to full functionality. It turns out, there are many different event listeners that sound similar but execute differently. In the end I needed to use the "keyup" event listener instead of "keydown". When using "keydown", it would not register the last deleted letter so it would continue to display anything with that letter in the title.
Add Vuex
Tags: vue, webdev, javascript, firebase
Published: 2021-03-12 12:59:14

---
title: Add Vuex
published: true
date: 2021-03-05 10:19:00 UTC
tags: vue, webdev, javascript, firebase
series: Vue Full Application Build
canonical_url: https://hiltonmeyer.com/articles/series/pantry/5-vuex.html
---

_Code for this can be found in the [Github Branch](https://github.com/bikingbadger/pantry/tree/6-vuex)_

This is a short one but will lay the foundation for saving ingredients, recipes and any other state of the app.

```
vue add vuex

```

Once the package has been installed you should see a new folder called `store` under `src`. In `main.js` the file will also be imported and used by the App. I like to break my modules up in separate folders that hold each store and I name space them but more of this shortly. In the store directory I create a new folder called `auth`. Within this folder I have 4 files

- authIndex.js
- authActions.js
- authMutation.js
- authGetters.js

This is probably huge overkill for now but later on and as the project grows it just makes it easier to handle. For now the only files I'll flesh out in `authIndex.js`

```
import authActions from './authActions.js';
import authMutations from './authMutations';
import authGetters from './authGetters';

export default {
  namespaced: true,
  state: {},
  mutations: {
    authMutations,
  },
  actions: {
    authActions,
  },
  getters: {
    authGetters,
  },
};

```

And then import the module into the `store/index.js`

```
import { createStore } from 'vuex';

import authModule from './auth/authIndex';

export default createStore({
  state: {},
  mutations: {},
  actions: {},
  modules: { auth: authModule },
});

```

The skeleton of the store is ready for handling the next thing to tackle which is login and registration of a user. That way we can manage the router paths of what users can do while logged in and also what they can only read when not.
Coefficient of Determination R squared
Tags: datascience
Published: 2021-03-15 03:52:24

To measure the 'goodness of fit' of the line, when we do the linear regression analysis, Coefficient of Determination (R squared) could be calculated. R squared can measure how well our model explains the correlation. Here we measure percentage of variance explained by the linear model vs baseline model(in this case it is simply mean value of the target). 



We can visualize it on the simple example. If we have some target, e.g. number of sales of the item during 5 days and we fitted a line. Now we want to check how good is our fit, basically how well we perform compare to naive prediction: calculating mean value of the sales.



```python
from sklearn.metrics import r2_score
import numpy as np
import matplotlib.pyplot as plt

# given target
y_true = [5, 10, 11, 16, 19]

# base line
y_mean = [np.mean(y_true) for i in range(len(y_true))]

# fit a line
from sklearn import linear_model
X = [1, 2, 3, 4, 5]
X = np.asarray(X).reshape(-1, 1)
Y = y_true
model = linear_model.LinearRegression()
model.fit(X, Y)

print(model.intercept_)
print(model.coef_[0])
```
model_intercept = 2
model_coef = 3.4

```python
# regression line
y_pred = [3.4*i+2 for i in range(1,(len(y_true))+1)]
```
```python
# calculate R squared using formula
var_mean = sum([(y_true[i]-y_mean[i])**2 for i in range(len(y_true))])
var_pred = sum([(y_true[i]-y_pred[i])**2 for i in range(len(y_true))])
r2 = (var_mean-var_pred)/(var_mean)
print(r2)
```
0.9730639730639731

```python
# calculate R squared using scikit learn
r2_score(y_true, y_pred)
```
0.9730639730639731

```python
# calculate using pearson correlation
correlation = np.corrcoef(y_true, y_pred)[0][-1]
correlation**2
```
0.9730639730639731

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

In this example regression line explained 97% better than just predicting mean value.
Microservices in 4 minutes - Introduction to Microservices
Tags: webdev, career, beginners
Published: 2021-03-15 03:29:18

Learning microservices can be intimidating for any developer, but it's especially true for junior developers or frontend engineers with little exposure to how things work on the backend. 

The most confusing aspect is that there is really no 100% standard textbook definition about what a microservice truly is.

In this video I'll try to quickly go over the what, why, and how of microservices so you can get a general understanding of the core principles of microservices and why they are so hyped in the tech world. 

**Even if you don't have any interest in working on backend programming it's a good idea to at least be exposed to these concepts**

{% youtube l4tQ66mDfxU %}

Summary of video:
## What are microservices
They are a software architecture style that involves breaking an application down into individual pieces that are able to be deployed and developed independently from each other.

##Benefits and Downsides
So why are companies using these things? Obviously there are some benefits to justify moving from the monolithic app style that has worked for a long time

* Faster development time - Teams can make their own decisions and for the most part don't need to coordinate new deployments with other teams 
* Easier to onboard new hires - New engineers don't need to learn the entire application before contributing, they can start off working on a single microservice
* Scaling- Microservices can be scaled independently depending on traffic demands. Don't have to scale the entire monolith if a single chokepoint is slowing down the app
* Reliability - Because microservices are separated from each other, if a bug is deployed it can be isolated and rolled back without taking down other services

That's not to say microservices are perfect, there are plenty of tradeoffs that come with using microservices and monoliths are generally recommended for small apps and small companies until they start encountering problems with scaling.

* Complexity - A poorly designed microservice architecture can end up being worse than the average monolith
* Communication between microservices - Entire new set of problems created by the fact that microservices are broken up, they need some standard way of communicating with each other

##Where to learn more
This was just a quick summary, I plan on doing more in depth tutorials on microservices so follow or subscribe if you are interested in that. 

Until then here are some good resources if you are interested in learning more:
* https://martinfowler.com/articles/microservices.html
* https://www.nginx.com/blog/introduction-to-microservices/
* https://www.scalyr.com/blog/api-vs-microservices/
Someone hack my Wordpress site!
Tags: laravel, wordpress
Published: 2021-03-15 03:25:41

My server was hacked by someone on the Internet last week and I didn't notice about this. When I randomly visit my customer's WordPress website, it redirects to a page that I don't know. I realize that they were hacked.

I checked the source code and found there was a problem with my Laravel source (deployed a year ago and not maintained anymore). The package which causes the bug is 'facade/ignition'.

![Facade/ignition](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ot62hrzplejjf3lozpp.png)

After hours of searching, I found a simple solution that I missed when deploying to production. Here is the install command that fixed my error.

```composer install --no-dev --optimize-autoloader```

Thank you for reading.
Best Tools For Web Development
Tags: webdev, html, css, javascript
Published: 2021-03-15 03:17:40

Hi guys! I am just a beginner in web development and don't know much, but I am sure these tools will help you a lot!

# 1. Glitch — glitch.com
![Glitch Screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/agmqckx3py2ldqyfqndv.png)
Glitch is a tool that you can use to host your websites. Just sign in, create a project, put in your code and it will instantly be available on the internet for anyone to view! Don't worry, you won't be stuck with the glitch.me subdomain, you can easily add up to 5 custom domains to each project. If you want to make your code and/or hosted app private you will need to upgrade to their paid plan.

# 2. CSS Gradient — cssgradient.io
![CSS Gradient](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0yy1cqove05kf3s0p3hh.png)
CSS Gradient is an amazing tool for creating gradients for your websites. It also has a gallery of premade gradients for you to use in your web development projects.

# 3. GitHub — github.com
![GitHub](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tgka9ido6gzq3ttkqdcu.png)
GitHub is a tool you can use to share your projects online and allow others to contribute. It is also a great place to find code if you are someone like me and are very new to web development (or you're just lazy and you can't be bothered coding).

# 4. W3Schools — w3schools.com
![W3Schools](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q5n7gmq1z5odekya7hdv.png) 
If you are just like me and don't know much HTML, then you need to go to W3Schools! W3Schools is an amazing tool because it really helps us new coders to learn code that we can use in our websites.

### That's all folks! I'll be adding more soon!
Forklifts
Published: 2021-03-15 03:17:15

MEASURES TO REDUCE OR AVOID Pedestrian ACCIDENT

Read more: <a href="https://xenangthienson.com/xe-nang-dau-2-tan/">https://xenangthienson.com/xe-nang-dau-2-tan/</a>

Build a private walkway for pedestrians and forklifts.

Restrict people in areas where forklifts are operating.

Keep a safe distance from the forklift.

Read more: <a href="https://xenangthienson.com/xe-nang-dau-25-tan/">xe nâng dầu 2.5 tấn giá rẻ</a>

A pedestrian should always let the driver know they are in the area. Make eye or voice contact with the driver to make sure your presence is known.
Make sure the area is well-lit and clear of obstacles.

Read more: <a href="https://xenangthienson.com/xe-nang-dau-3-tan/">xe nang dau 3 tan</a>

Be cautious near blind corners, entrances and walkways. Use the forklift horn at the right time.

Use workwear, reflective vests when standing near the vehicle position to lift dark positions.

Limiting the speed of the forklift.

Do not operate the forklift when handling cargo in excess of the allowable limit.

Avoid forklifts near pedestrian traffic areas (eg Canteen, entrance / exit).
10 Useful Python One-Liners You Should Know
Published: 2021-03-15 02:48:09

The day I wrote my first line of code in Python, I become fascinated with the simplicity, popularity, and its famous one-liners. In this post, I want to present some python one-liners.
**1. Swapping Two Variables**

```python
# a = 4 b = 5
a,b = b,a
# print(a,b) >> 5,4

```
Let’s start with a simpler one by swapping two variables with each other. This method is one of the most simple and intuitive methods that you can write with no need to use a temp variable or apply arithmetic operations.

**2. Multiple Variable Assignments**

```python
a,b,c = 4,5.5,'Hello'
#print(a,b,c) >> 4,5.5,hello

```
You can use commas and variables to assign multiple values to the variables at a time. Using this technique, you can assign multiple data types var at a time. You can use a list to assign values to variables. Below is an example of assigning multiple values to different var from a list.

```python
a,b,*c = [1,2,3,4,5]
print(a,b,c)
> 1 2 [3,4,5]

```

**3. Sum of Even Numbers In a List**
There can be many ways of doing this, but the best and simplest way is to use the list indexing and sum function.

```python
a = [1,2,3,4,5,6]
s = sum([num for num in a if num%2 == 0])
print(s)
>> 12

```

**4. Deleting Multiple Elements from a List**
del is a keyword used in python to remove values from a list.

```python
#### Deleting all even
a = [1,2,3,4,5]
del a[1::2]
print(a)
>[1, 3, 5]

```

**5. Reading Files**

```python
lst = [line.strip() for line in open('data.txt')]
print(lst)

```
Here we are using list comprehension. First, we are opening a text file, and using a for loop, we are reading line by line. In the end, using strip we are removing all the unnecessary space. There is one much simpler and shorter way of doing this using just the list function.

```python
list(open('data.txt'))
##Using with with also close the file after use
with open("data.txt") as f: lst=[line.strip() for line in f]
print(lst)

```

**6. Writing data to file**

```python
with open("data.txt",'a',newline='\n') as f: f.write("Python is awsome")

```
The above code will first create a file data.txt if not already there, and then it will write Python is awsome in the file.

**7. Creating Lists**

```python
lst = [i for i in range(0,10)]
print(lst)
> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
or 
lst = list(range(0,10))
print(lst)

```
We can also create a list of strings using the same method.

```python
lst = [("Hello "+i) for i in ['Karl','Abhay','Zen']]
print(lst)
> ['Hello Karl', 'Hello Abhay', 'Hello Zen']

```

**8. Palindrome**

A palindrome is a number or a string that looks the same when it gets reversed.

```python
text = 'level'
ispalindrome = text == text[::-1]
ispalindrome
> True

```

**9. To Check The Existence of a number in a list**

```python
num = 5
if num in [1,2,3,4,5]:
     print('present')
> present

```

**10. Simulating Toss of a coin**
It may be not that important, but it can be very useful whenever you need to generate some random choice from a given set of choices.

```python
import random; random.choice(['Head',"Tail"])
> Head
```
The NFTwist
Tags: codepen, codepenchallenge
Published: 2021-03-15 02:16:37

<p>Do the NFT twist, an homage to the explosive rise of non fungible token art. A submission for the Color Harmonies challenge, Mar 2021 week 2.</p>

{% codepen https://codepen.io/ericrosedev/pen/qBqvjaO %}
Things I'm Embarrassed I Don't Know, pt. 2
Published: 2021-03-15 01:56:45

##### (Last month, I wrote a [post about package managers](https://dev.to/jacobfromm/things-i-m-embarrassed-i-don-t-know-pt-1-1c97) and how I was embarrassed I didn't know about them. This is part 2 of that series.)

---

Never before have software developers had to rely on their own personal computing devices for work. For developers who are either freelancers or just plain unemployed, using your personal laptop as your work device can be difficult with limited storage. Here's what I've done to make space.

###### ***Author's note***: I'm working with a 2013 Macbook Pro with 16GB of RAM and a 500GB SSD running macOS Catalina v10.15.16. If you're not a Mac user, you can go ahead and stop reading now.

This helped me, so maybe it'll help you! I recently learned how to manage storage on my own device without downloading any pesky cleanup software.

#### Resources:
1. https://support.apple.com/en-us/HT206996
Day 41: String Case
Tags: 100daysofcode, javascript
Published: 2021-03-15 01:24:51

**Title Case**

```javascript
function toTitleCase(str) {
  return str.replace(
    /\w\S*/g,
    function(txt) {
      return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
    }
  );
}
```

**Camel Case**
```javascript
function camelize(str) {
  return str.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function(match, index) {
    if (+match === 0) return ""; // or if (/\s+/.test(match)) for white spaces
    return index === 0 ? match.toLowerCase() : match.toUpperCase();
  });
}
```