teleren/devto huggingface dataset:
Mac installing MySQL
Tags: mysql
Published: 2021-01-04 05:21:21

In this article, I'll be guiding you through the installation process for MySQL on a Mac.

It's a pretty straightforward installation, and we will need this when setting up our Mac for web development.

## Download MySQL for Mac

To install MySQL, we need to visit the MySQL website and pick the download we need.

[MySQL download page](https://dev.mysql.com/downloads/mysql/)

For most people, the top DMG archive will work.

If you click the download button you'll get an annoying screen because they want you to signup. Just click the No thanks button at the bottom.

![MySQL download page](https://cdn.hashnode.com/res/hashnode/image/upload/v1609343289381/DfrXsgMN5.png)

## Installation of the MySQL server

Once the download is done you can click the DMG file and in there you'll find the `pkg` file.

Double-click this file.

![MySQL pkg file](https://cdn.hashnode.com/res/hashnode/image/upload/v1609343449753/nu9G0UfCp.png)

This will open up the installer for MySQL.

![MySQL installer Mac](https://cdn.hashnode.com/res/hashnode/image/upload/v1609343492102/scVd5-KKn.png)

Click Allow on the above step.

Follow all the steps it prompts.

At one stage it asks for the install location, you can go ahead and use the default one.

![MySQL install location](https://cdn.hashnode.com/res/hashnode/image/upload/v1609343570222/qFlHmjXSJ.png)

After clicking this, you'll be prompted for your password, enter it and the installation begins.

Then you get a configuration screen, you can select the strong password encryption.

It will then ask you to set the default password for the root user.

![MySQL set password](https://cdn.hashnode.com/res/hashnode/image/upload/v1609343665314/pqvAL6aTk.png)

Once we set the password the installation is done.

## Find the MySQL server on Mac

You can now find your MySQL server by opening the Settings application on your Mac.

![Mac Settings -> MySQL](https://cdn.hashnode.com/res/hashnode/image/upload/v1609343785344/NXFSHfpCk.png)

If you click that you have the option to Start and Stop the server.

![MySQL start/stop](https://cdn.hashnode.com/res/hashnode/image/upload/v1609343837498/8jOWSg-vn.png)

## Connecting to the MySQL server

We can also use graphic tools to connect to this MySQL server.

In my case, I'll be using [TablePlus](https://tableplus.com/), but any tool will work the same.

Add a new connection using the following settings

- `host`: 127.0.0.1
- `user`: root
- `password`: You choose this in the installation
- `port`: 3306 (default)

Then you can test the connection and connect to it.

![Mac MySQL Connection](https://cdn.hashnode.com/res/hashnode/image/upload/v1609344081846/fVSQiM7uy.png)

That's it we installed MySQL and are able to connect to it!

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
Ruby CLI App
Tags: ruby, cli, project
Published: 2021-01-04 05:15:05

I wrote a CLI application that grabs info about dogs from an API.
This was a very rushed project as I had fallen behind, but was able to get everything working how I wanted them to be. The file structure was pretty simple and straightforward.
  This was the first time I had worked with an API so I did not really know what I was doing with this at first. After understanding the iron plate code used in the API class, I was able to define the class variable which was the endpoint for the API and send a get request which was to be parsed to JSON format. I had a few days playing with this to misunderstand where each breed object was being stored (inside the Breed class I made on day one). This was my biggest trouble spot after which helped make namespacing make more sense. 
  The app has simple phrases that tell the user plainly what is happening and being asked. All the data is ready and objects created are all listed out to show the user each breed that can be selected by entering the corresponding number. Any information that is available is shown and the user is prompted if they would like to run more queries of a different breed. Most breeds would be able to show all data while others would have some extra details that were omitted for continuity. It was nice to see the API included both imperial and metric measurements for height and weight. Although imperial measurements were used, it could be swapped and possibly have both shown to not leave any question regarding the general size of a given breed.
  For each breed object that was created, I used mass assignment as each breed had different attributes to be added (more or less) between them. Much of the error correction was used to point the user back to the request.
Journey to writing better code - #2
Tags: architecture, software, webdev, ddd
Published: 2021-01-04 05:11:44


This is part 2 of the series ___Journey to writing better code.___ You can read the previous posts in this series by clicking the links below:

*  [Part 1](https://blog.hannanhamza.com/journey-to-writing-better-code-1)

---

> we have two points we'll be talking about in this post
* when should you use Domain-Driven Design?
* where can you learn Domain-Driven Design from?

#### When Should you use Domain-Driven Design?

In the last post, I talked about how I started learning DDD and why Transaction Script was the cause of a lot of pain for me. Before I talk about that, I should clarify that like everything in life Transaction Script has its own use-cases and DDD has its own use-cases. For example, if the project you are working on is mostly CRUD based then you do not need to add the complexity of DDD. Another scenario where DDD is not suitable is projects where speed is of importance (single, double-digit response). But, if the project you are working on has a lot of domain rules and invariants that you need to enforce and you expect more invariants/rules to be added or existing ones to be modified then DDD could be what you need.

#### Where can you learn Domain-Driven Design?

Luckily, DDD is a very famous approach and you can find a lot of resources about it on the internet. From Blog Posts to Video Courses, no matter what kind of a learner you are, you can find resources teaching you DDD. I'm going to list some of the resources that helped me understand DDD better and thus made me a better developer (arguable).

* [Khalil Stemmler](https://khalilstemmler.com/)
  Khalil's blog has been an absolute godsend for me. He talks about DDD with typescript which is a very valuable resource in the JS world we live in. His blog is a great way to familiarize yourself with DDD's core concepts and layered Architecture. I'm  eagerly waiting for khalil's  [Book](https://solidbook.io/)


* [Vladimir Khorikiv](https://enterprisecraftsmanship.com/) 
Valdimir's blog is another great resource to learn DDD and TDD among other things. He has a couple of courses on pluralsight on DDD, CQRS and TDD. His blog has been a great help in recognizing how to model complex scenarios into DDD. 

I'll be starting another series talking about the core concepts of the DDD and modeling common scenarios with DDD which I expect to be more hands on. if you'd like to read that, do follow me and shoot me an email at  [hey@hannanhamza.com](mailto:hey@hannanhamza.com) with any questions you may have.
Gradient Boost for Classification
Tags: machinelearning, datascience, beginners
Published: 2021-01-04 04:41:55

<span>Photo by <a href="https://unsplash.com/@spacex?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">SpaceX</a> on <a href="https://unsplash.com/s/photos/rocket?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></span>

Here I would like to go through the steps of the Gradient Boost for Classification. Gradient Boost Classification is very similar to the Gradient Boost Regression algorithm with a few differences: 
- Target values in binary classification are 0s and 1s
- Log Loss function(similar to logistic regression problems). 
- Using Log of odds and probabilities based on the Log Loss Function.
So we can apply the same mathematical algorithm, we used in the previous [post](https://dev.to/xsabzal/gradient-boost-for-regression-1e42) taking into account the above differences. 

Below are the steps of Gradient Boost Classification algorithm when used with Logistic Loss Function L(y,F(x)).
I also tried to avoid mathematical notations and simplified all the steps.

1) Get the initial prediction logarithms of odds and probability of class = 1, so basically we count numbers of class 1s and class 0s and calculate P(class=1) and log(odds=1)=log(P/(1-P)). 
Example: if we have balanced data we will have equal (or similar) numbers of 0s and 1s, so initially:
Predicted_Probability(class_1)=0.5
log(odds_1) = 0.

2) m is the number of weak learners. So we do the below steps for each decision tree (e.g. m=1 to m=100, when n_estimators=100):

a. Compute residuals (True-Predicted_Probability) for each tree iteratively (meaning previous residuals used as a target for the next decision tree).

Example: for the first tree, Residual = True - 0.5 (Predicted in the previous step) and True = 0 or 1 (per Target class)

b. Fit decision tree to the residuals

c. Compute the output value for each leaf in the tree. We cannot take simply an average of all the values in the leaf as we did in regression. Here we will use the following formula:
predicted_leaf_output = (sum of residuals in the leaf) / [sum of the (Predicted_Probability*(1-Predicted_Probability)]

d. First, update the predicted log of odds for each row of data:
log(odds) =  Previously_predicted_log(odds) + leraning_rate * predicted_leaf_output

e. Then, calculate the Probability for each row of data using log(odds):
P= odds/(1+odds) or P = exp(log(odds))/[1+exp(log(odds)].

3) Compute the final prediction F(x).
Linux awk command cheatsheet
Tags: linux, awk, command, cheatsheet
Published: 2021-01-04 04:29:16

This is a quick reference cheat sheet to the GNU awk command, which covers commonly used awk expressions and commands.

[![awk command quick reference cheat sheet](https://dev-to-uploads.s3.amazonaws.com/i/ego0g610cbmzv2uaezya.png)](https://quickref.me/awk)
Fun with React and Styled Components
Published: 2021-01-04 03:51:26

I need to make a React component that enables users to create tags on their profile. It's for a [React project](https://www.namjai.io/) of mine, still a work in progress.

So I went looking to see if anyone had already created such a component. I did find this component on CodePen by Fabio here is a [link to his pen]
(https://codepen.io/fabioioio/pen/mmZZVo)  

I decided instead of Willy Nilly cutting and pasting into my project, I would instead refactor to use Functional Components managing state with Hooks and styling with Styled Components.

I have found that refactoring other people’s code really forces you to understand how the code actually works instead of just following along.
 
Here is [My CodeSandbox](https://codesandbox.io/s/ui-styledtags-9x3cl) of my refactor have a look let me know what you think or if you have any optimization suggestions.

Here is a link to [my repository](https://github.com/Ongomobile/Lets_Share_Code) with a few other styled-components would be cool if others wanted to contribute I could add some more also.
Cheatsheet for Vim Navigation
Tags: vim, shortcuts, beginners, tutorial
Published: 2021-01-04 04:18:36

This picture shows the vim navigation shortcut keys. The first ascii character picture shows how to shuttle in a row, and the second ascii character picture shows how to shuttle in multiple lines or even multiple screens!

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kt3pejqcjr1j37allxhm.png)
Learn Cloud Bioinformatics
Tags: cloudnative, genomics
Published: 2021-01-04 04:09:40

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

Even before COVID, there has been demand which outstrips supply for cloud architects, devops and developers in cloud-based genomics/bioinformatics analysis.

I've been working in this vertical for ~4 years and find it to be incredibly challenging and rewarding.  Applying cloud native patterns (like the Data Lake shown above) in support of researchers working to improve human health is fantastic.

I am self-taught in the area of genomics.  I recently updated my study Repo on GitHub.  If you are interested in working in this domain, you may find my compilation helpful.

The Repo is named ['Team Teri'](https://github.com/lynnlangit/TeamTeri) and includes info about bioinformatics tools, platforms as well as genomic services and architecture patterns from AWS, Azure and GCP.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6zwy4jc8jy8vzqogjy5t.png)
XOR Encryption in Python3
Tags: python, security
Published: 2021-01-04 01:19:29

Hi Folks, In my article I will explain to you how to encrypt texts with XOR encryption using python 3.

first we have to import those modules
# 1- importing area
![importing area](https://dev-to-uploads.s3.amazonaws.com/i/9uzxe43lcv899gs3dqrn.png)
In the previous section we import the string module to be able to use all upper and lower case letters, numbers and signs to generate the encryption/decryption key.

We also import the random module to generate a random string of those letters, numbers and symbols so that we can create a random decryption key every time.
 
# 2- Generate Random Key Function.
![gen](https://dev-to-uploads.s3.amazonaws.com/i/51l2x7eamf90hdee3fv3.png)
In the previous section, we created a function that:
– Receive parameter named size which is considered the length of the encryption key to be generated.
– Then it generate the key from a set of letters, numbers and signs that we typed in the previous code
– Returns the generated key.

[ The length of the key is very important, for example if you want to encrypt a text consisting of 100 characters and the length of the key consists of 50 characters, then only 50 characters of the text will be encrypted ]

# 3- XOR Encryption Function.
![function](https://dev-to-uploads.s3.amazonaws.com/i/nin4z5mdjzzm8joxthle.png)

 Now the most important part of the article is the encryption and decryption function.
here the enc_XOR function receive 2 parameters: Text, Key.

Bitwise operators works on bits and performs bit-by-bit operation. For each character in text and another one of the key It will be processed through the XOR (^) Bitwise Operator and you can read more about the XOR Bitwise Operator in python @ Python Bitwise Operators

We will talk about XOR operator example:
0 XOR 0 = 0
0 XOR 1 = 1
1 XOR 0 = 1
1 XOR 1 = 0

[1] An example about encryption:
a(Text) = 0011 1100
b(Key) = 0000 1101
a^b(Encrypted Text) = 0011 0001

[2] An example about decryption:
c(Encrypted Text) = 0011 0001
b(Key) = 0000 1101
c^b = 0011 1100 = a(Clear Text)

So if we pass a clear text with a key it will be encrypted & If we pass the encrypted text with the same key it will be decrypted.

# 4- Output Area.
![output](https://dev-to-uploads.s3.amazonaws.com/i/1rfdgp57l5z2mo5vo3lt.png)

Actually, In this section we are only print the outputs 😂
But notice something that we pass the encrypted text(encrypted_text) and key in the encryption function to reverse its effect.

# [+] The End.
I hope you understood the article well and achieved the benefit you hoped for.
You will find the script on my GitHub Account @nullx33F

Thanks for reading. 💙
Unbox some Unity fun; finding your learning style
Tags: unity3d, gamedev
Published: 2021-01-04 03:59:08

There's a reason I started using Unity to learn C#. First of all, [Unity Premium Learn](https://unity.com/products/unity-learn) was free during the COVID-19 first wave. If you're a student, studying at a university institution or tafe, you can still get Unity Premium Learn for free. Sign up for the [GitHub Student Developer Pack](https://education.github.com/pack) and you'll have a free Unity Student Plan. This gives you access to Unity Premium Learn and also Unity's dark mode - because _everyone_ loves dark mode!

Secondly, I've been using Unity to learn C# because you can visually see what you are building. You can physically see your code changing. In the same way front end devs are able to easily see their changes on a website, game development gives you the opportunity to see your changes in action instantly.

![learn-meta-hero](https://dev-to-uploads.s3.amazonaws.com/i/1jcoai8am85vdt7javwg.jpg)
 

## Find your learning style

This is the thing I really love about learning C# through Unity. If you're struggling to learn something, try and visualise it in a way you understand. For example, front end dev or game dev might suit you if you are a visual learner.

Concepts might be easier to learn if you put them into terms you already understand. For example, when I'm learning C# through Unity, I'm often putting the code challenges into terms I understand; like gaming. I play a fair bit of _Elder Scrolls Online_ over on my [Twitch Channel](https://twitch.tv/MishManners). So when I'm learning something like Dictionaries in C#, I think:
"How would this look if I was playing _ESO_?"

From there I end up coding my character and weapons builds and it makes a whole lot more sense.

It might take some time for you to find your learning style. Some people like to learn on their own. Others can only learn in a more professional setting like a classroom. And there's those who can jump on a YouTube video and learn very easily. Finding your learning style will help you take the next step in learning all the new things you want to take up in 2021.

![photo-1488190211105-8b0e65b80](https://dev-to-uploads.s3.amazonaws.com/i/j9tjqi7lxqli8klnsxk9.jpeg)
_Photo by Thought Catalog via [Unsplash](https://unsplash.com/)_
 

## Learning Online

If you're a little stuck for ideas, you can check out some of the [cool places to learn online](https://hackathonqueen.com/2020/04/23/where-to-learn-for-free/). Most of these are casual and there's a few more formal learning sessions.

Learning online can be tough. Don't be discouraged if the first thing you try and learn doesn't work. You might need to find what clicks for you. A learning buddy can help or someone who works in the field. Whatever you choose to learn this year, I wish you all the best.

Come and join my live learning to code streams on [Twitch](https://twitch.tv/MishManners) or follow me on [Twitter](https://twitter/MishManners) for lots of fun content.
Start creating your website using Fire UI, a user-friendly and reliable CSS framework.
Tags: css, framework, showdev, contributorswanted
Published: 2021-01-04 03:56:22

Fire-UI is an open-sourced project aimed to help developers to design frontend page quickly. 

[![Fire UI documentation site](https://dev-to-uploads.s3.amazonaws.com/i/rn0qmgacsnt9xb0muti6.png)](https://fire-ui.netlify.app/)

Writing almost-same CSS files for the frontend page every time creates a web page is laziness for developers, at least for me. However, existing frameworks like Bootstrap and others don't really fit my type. Hence, I decided to start a CSS framework aimed to covers everything that is frequently used on the frontend.

Fire UI is still in development progress, currently version 0.2.0. However, it's already cover the basic of CSS framework to build a web page. Fire UI not only looking for contributors but also maintainers!

Fire UI is created and distributed under [MIT license](https://github.com/fire-ui/fire-ui/blob/master/LICENSE)

Documentation site: https://fire-ui.netlify.app/
GitHub repository: https://github.com/fire-ui/fire-ui

Examples using Fire UI:
- {% link https://dev.to/stanleyowen/build-landing-page-with-fire-ui-32cm %}
- {% link https://dev.to/stanleyowen/create-your-profile-page-from-scratch-with-fire-ui-35cn %}

Any comments, contributions(even for documentation), stars will be appreciated :)

Happy coding
What's after scratch?
Tags: kids, scratch, zim, zimjs
Published: 2021-01-04 03:40:37

ZIM at https://zimjs.com is perfectly poised to be what's next for those transitioning from Scratch to traditional text-based code.  ZIM makes the JavaScript Canvas simple which is good for everyone.  It is also a colorful way to be introduced to JavaScript.  Here is some sample code:

```javascript
new Circle(100, blue).center().drag();
```

We have ZIM Kids at https://zimjs.com/kids.  And we have ZIM Skool at https://zimjs.com/skool.  There is a video series called Learn JavaScript with Creative Coding at https://zimjs.com/learnjavascript.html and yet the same code can be used by developers for professional apps - see https://dev.zimjs.com.  Amazing!

---

ZIM KIDS
If you are a teacher looking to teach text-based code we have an intro to ZIM Kids here https://zimjs.org/curriculum.html.  An intro to code as magic is found here https://zimjs.org/magic.html.

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

Each tutorial has three levels with an online editor, the code to type, info about the code, a live sample and links to resources. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4wxaxl15fulj8e5ye0mm.jpg)

There is also a SLATE section for free-form coding and a series called ZIM Bits with 64 common examples.  We follow this with dozens of CodePen examples that will amuse and inspire.

---

SKOOL
If teaching older kids please see https://zimjs.org/skool/teachers.html and if a student the intro is here https://zimjs.org/skool/students.html.  The lessons can be found at https://zimjs.org/skool

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

Please join us at https://zimjs.com/slack or https://zimjs.com/discord to talk!  Hope to see you soon.

Dr Abstract

We dedicate this post to https://dev.to/coolscratcher - may you have a long life of coding creativity!

---

If you have not checked out the Canvas recently - you simply must!  Here is the [ZIM&nbsp;Dev&nbsp;Site](https://dev.zimjs.com) and some [In-depth&nbsp;Guides](https://drabstract.medium.com/) by Dr&nbsp;Abstract including [Your Guide to Coding Creativity on the Canvas](https://drabstract.medium.com/your-guide-to-coding-creativity-on-the-canvas-ada0996298f6).