teleren/devto huggingface dataset:
UUID
Tags: uuid, programming, go, codequality
Published: 2022-07-17 02:21:44

Universally Unique Identifier or GUID Globally Unique Identifier which in practice it's the same thing.

It's composed by 128 Bits represented by 32 digits Hexadecimal, divided by 5 groups separeted by "-" with struct: 8-4-4-4-12.

The goal identify unique information in the System, whithout a central chord.

Exist 5 versions, the first digit from third batch, is separated to identify the version of UUID.

---

Versions

> v1
Uses timestemp to generate the UUID, also can use NodeID which is an  identifier, usually for that MAC of the computer, or URL or prefixed data key.

> v2
Very similiar to v1, but the use of NodeID is mandatory to present a security group, this group may be related to entities or some context of the application. But veru little used.

> v3 and v5
It also use NodeIDas prefix. In v3 is used an MD5 hash key, while in v5 a has key of the SHA-1 algorithm is used, this second being more advised for development.

> v4
It is the most used version, in this case all characters are randomly generated.

---

> Benefits

- It's also a form of information security, the ID format increment informs how many users there may be on the plaform, important information for competitiros;

- Greater security if you don't have Authorization control in the application.


> Disadvantages

- Makes debugging records more complex;

- Increase in the cost of storage, storing in string format, char(32) can make the performance of queries quite heavy, a solution is to store in binaries;

- Must have a position rule, since the collision is possible.

---


> Go

Inside Go we have a lot of packages that press UUID, but in this demo we will use the official google package [Package](https://pkg.go.dev/github.com/google/uuid),  in addition to supporting all of the above versions. The project link is here: [Project](https://github.com/piovani/go-and-uuid)
I don't use Makefile anymore! instead I use bake-cli
Tags: awesome, cli, bash, makefile
Published: 2022-07-17 02:16:17

before know about bake-cli I'm do a lot of makefiles.. Because it's oldschool and because you could define task to execute easily!

And its great, then I find out fabric and invoke, OH my good! I felt in :love: I start a writing task in python for my local development. But I miss the a lot the simpliest of the makefiles.

But the makefiles isn't create to execute tasks, it was created and designed to compile code.

Then I ever miss in makefiles the possibility of run bash scripting inside.

The same feeling kennethreitz had.

> The problem with doing this is that you can't use familiar bash–isms when doing so, as GNU Make doesn't use the familiar Bash syntax, nor does it allow for simple ad–hoc use of arbitrary scripting languages (e.g. Python).

Therefore bake-cli born.

You create a Bakefile and put the task inside with bash power!

```
$ cat Bakefile                                                $ bake install
install: install/node install/python                            + Executing install/node:
    echo 'All ready!'                                           |  yarn install v1.17.3
install/full: install/system install                            |  info No lockfile found.
install/python: @skip:key=Pipfile.lock                          |  [1/4] Resolving packages...
    pipenv install                                              |  [2/4] Fetching packages...
install/node: @skip:key=yarn.lock                               |  [3/4] Linking dependencies...
    yarn install                                                |  [4/4] Building fresh packages...
install/system: @confirm                                        |  success Saved lockfile.
    brew install pipenv yarn                                    |  Done in 0.05s.
                                                                + Executing install/python:
python/format:                                                  |  Installing dependencies from …
    black .                                                     + Executing install:
                                                                |  All ready!
utils/argv:                                                     + Done.
    set -u && echo "$HELLO: $@"                                 
                                                                Rinse and repeat…
utils/deploy: @confirm:secure                 
    exit 0                                              
    
```
**Scrollme right**


You will speedout your development with this! replace the makefiles

{% github https://github.com/kennethreitz/bake %}

Its a nodejs version too of it.
Squash multiple commits into one
Published: 2022-06-11 08:00:04

> "Damn, your PR has 5 commits? This is not what we agreed on right? Now, i may encounter multiple merge conflicts during rebase", code review dilemma.

When working on a project with multiple developers, git and Github is one of the mostly used tools for code collaboration. 

Imagine a situation where you are working on a feature and before you are done, you 5 different commits. But then, your organizational rules says each pull request must have 1 commit. This means you have to find a way to merge all the 5 commits into 1 (squash them) and then push to your branch before making a PR. Making a PR with 1 commit could also help avoid multiple issues when pulling with rebase. 

The question now is, how do you bring all 5 commits into 1. 

1. On the branch which you want to make the PR from, do `git log`. This will show you all the commits you have made. It starts from the most recent commits right down to the last set of commits in your branch. 
2. Identify the last (from the main branch) before your first commit (needed in the pr). Example

```
commit 5 #hash5 (pr-branch - you are here)
commit 4 #hash4 (pr-branch)
commit 3 #hash3 (pr-branch)
commit 2 #hash2 (pr-branch)
commit 1 #hash1 (pr-branch)
commit 0 #hash0 (main-branch - you want to come here)
```
Copy #hash0 and keep. 

3. You now have to soft reset (reset the commits but keep the file changes) from the current commit (#hash5) to the main commit, (#hash0) by doing `git reset --soft #hash0`. Replace #hash0 with the hash of commit 0. 

4. Now, if you do `git status`, you will see all the file changes still intact but have not yet been committed. File changes that have not been committed are in red, while file changes chat have been committed are in green (it may vary with your command line tool)

5. Finally, you can follow the process of `git add .` to add the file changes, `git commit -m "One commit message summarizing everything in the 5 commits"` and finally, `git push origin pr-branch`. If you had already pushed the commits, you may need to add a `-f` flag in your push command. 

Tahdann, there you go, you have successfully joint (squashed) all 5 commits into 1, your PR is cleaner and the dev reviewing it will be happier and likely least number of rebase merge conflicts. 

If you got any other ways, please drop them in the comments section. I'll love to read and learn more about your approach.
[Solved] rvm_error "There has been an error while updating your system using \`apt-get\`
Published: 2022-07-17 01:29:10


### Problem:

Running into the following error when trying to install `ruby-2.7.2` on Ubuntu 20.04 via `rvm`:

```
...
    rvm_error "There has been an error while updating your system using \`apt-get\`.
It seems that there are some 404 Not Found errors for repositories listed in:

    /etc/apt/sources.list
    /etc/apt/sources.list.d/*.list

Make sure that all repositories are available from your system and verify your setup by running manually:

    sudo apt-get update

Make sure that it works correctly before proceeding with RVM.

If you are working from the GUI instead of the terminal, you might want to verify and fix broken
repositories using \"Software & Updates\" application.
...
```

Note: this error is displayed in a log file after the following generic error message is displayed in the terminal after running the command `rvm install 2.7.2`:

```
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/20.04/x86_64/ruby-2.7.2.tar.bz2
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system...
Error running 'requirements_debian_update_system ruby-2.7.2',
please read /home/sean/.rvm/log/1657594112_ruby-2.7.2/update_system.log
Requirements installation failed with status: 1.

```

### Solution:

This issue was resolved for me by running the following command:

```
rvm autolibs disable
```

followed by my initial command:

```
rvm install 2.7.2
```

Apparently the `autolibs` feture that is built into RVM is playing a part in causing this error. More on `autolibs` [in the official RVM docs](https://rvm.io/rvm/autolibs)

### Conclusion

Thanks for reading this blog post!

If you have any questions or concerns please feel free to post a comment in this post and I will get back to you when I find the time.

If you found this article helpful please share it and make sure to follow me on [Twitter ](https://twitter.com/SeanAtukorala)and [GitHub](https://github.com/ShehanAT), connect with me on [LinkedIn](https://www.linkedin.com/in/shehan-atukorala-8631491a5/) and subscribe to my [YouTube channel](https://www.youtube.com/channel/UCtxed_NljgtAXrQMMdLvhrQ).
Ganymede Kernel 2.0.0.20220717 Released
Tags: java, jupyter
Published: 2022-07-17 20:07:22

---
title: Ganymede Kernel 2.0.0.20220717 Released
date: 2022-07-17 00:00:00 UTC
published: true
tags: Java,Jupyter
canonical_url: https://blog.hcf.dev//2022/07/17/ganymede-kernel-release-announcement.html
---

[Ganymede Kernel](https://github.com/allen-ball/ganymede) 2.0.0.20220717 is released.

The [Ganymede Kernel](https://github.com/allen-ball/ganymede) is a [Jupyter Notebook](https://jupyter-notebook.readthedocs.io/en/stable/index.html) Java [kernel](https://jupyter-client.readthedocs.io/en/stable/kernels.html) based on [JShell](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.jshell/jdk/jshell/JShell.html?is-external=true) combined with an integrated [Apache Maven](https://maven.apache.org/)-like POM, support for JVM languages such as [Groovy](https://groovy-lang.org/), [Javascript](https://www.oracle.com/technical-resources/articles/java/jf14-nashorn.html), and [Kotlin](https://kotlinlang.org/), and support for [Apache Spark](http://spark.apache.org/) and [Scala](https://www.scala-lang.org/) binary distributions.

<!--more-->

This release improves the [Ganymede Kernel](https://github.com/allen-ball/ganymede)’s robustness by introducing the Ganymede Kernel REST protocol to communicate between the kernel and the [JShell](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.jshell/jdk/jshell/JShell.html?is-external=true) instance.

This release adds support for:

- The `%%java` magic with no code will display the context with pointers to the respective type’s javadoc

- New magics: `mustache` (`handlebars`), `spark-session`, and `sql`

- New renderers for [jOOQ](https://www.jooq.org/doc/latest/manual) Formattable and [Tablesaw](https://github.com/jfree/jfreechart) Table

- Mustache scripting with [JMustache](https://github.com/samskivert/jmustache)

- Updated the Apache Maven Resolver to 1.8.1 and support the use of “LATEST” in the POM artifact version specification

- Added Ganymede and JDK javadoc to help links

- Support Apache Spark and Hive 3.1.3 with runtime support for Hive

- Use PicoCLI for magic command line parsing and improved usage messages

Binary and source downloads are available from [https://github.com/allen-ball/ganymede/releases/tag/v2.0.0.20220717](https://github.com/allen-ball/ganymede/releases/tag/v2.0.0.20220717).

Quickstart if Java 11 (or later) and [Jupyter](https://jupyter-notebook.readthedocs.io/en/stable/index.html) are already installed:

```
$ curl -sL https://github.com/allen-ball/ganymede/releases/download/v2.0.0.20220717/ganymede-2.0.0.20220717.jar -o ganymede-kernel.jar
$ java -jar ganymede-kernel.jar --install

```

Please see the project [page](https://github.com/allen-ball/ganymede) for detailed [installation](https://github.com/allen-ball/ganymede#installation) instructions and its [features and usage](https://github.com/allen-ball/ganymede#features-and-usage).
Coding Shorts: ASP.NET Core Middleware Explained
Tags: csharp, aspnetcore, middleware
Published: 2022-07-18 03:38:33

---
title: Coding Shorts: ASP.NET Core Middleware Explained
published: true
date: 2022-07-17 00:00:00 UTC
tags: 
  - csharp
  - aspnetcore
  - middleware
canonical_url: https://wildermuth.com/2022/07/17/coding-shorts-asp-net-core-middleware-explained/
cover_image: https://wilderminds.blob.core.windows.net/img/2022/07/17/cover.jpg
---

As I continue to make my Coding Shorts videos, I decided to dedicate the next few episodes to [ASP.NET](http://asp.net/) Core middleware. I’m going to show off some common middleware that more projects should be using. But before I dive into that, I wanted to make sure everyone understood how middleware actually works. Take a look:

> [Watch](https://www.youtube.com/watch?v=TqCshF0o0nE)

> [View All Coding Shorts](https://shawnl.ink/codingshorts)  
> [Subscribe to my YouTube Channel](https://shawnl.ink/yt)

[![Creative Commons License](http://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png)](http://creativecommons.org/licenses/by-nc-nd/3.0/)

 This work by [Shawn Wildermuth](http://wildermuth.com) is licensed under a [Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License](http://creativecommons.org/licenses/by-nc-nd/3.0/).  
 Based on a work at [wildermuth.com](http://wildermuth.com).

* * *

If you liked this article, see Shawn's courses on [Pluralsight](http://shawnw.me/pscourses).
Low F1-Score due to Imbalanced Dataset even after resampling
Tags: machinelearning, python, ai
Published: 2022-07-16 23:50:18

I am performing a Binary Classification over an **imbalanced dataset**:  
0: 16,263  
1: 214

I have used multiple oversampling, undersampling, and combination techniques, below are the results that I have obtained:
I obtained this plots thanks to this piece of code:

    def plot_resampling(X, y, sampler, ax, title=None):
        X_res, y_res = sampler.fit_resample(X, y)
        ax.scatter(X_res[:, 0], X_res[:, 1], c=y_res, alpha=0.8, edgecolor="k")
        if title is None:
            title = f"Resampling with {sampler.__class__.__name__}"
        ax.set_title(title)
        sns.despine(ax=ax, offset=10)
  ***Clarification: The X and y are the X_train and y_train and I used it to show the distribution of my data points before and after the resampling.***
 

[![Comparison Initial Dataset and multiple oversampling techniques][1]][1]  

**For the RandomUnderSampler, the first one is without replacement and the second one is with replacement=True**  
[![Comparison Initial Dataset and multiple oversampling techniques][2]][2]


[![Use of Combination techniques][3]][3]


You need to know also that I have **multiple outliers in my dataset**, and hence, multiple columns are skewed, so I chose to use models that are not sensitive to skewness like:

 - SVC
 - Naive Bayes Classifier
 - Ensemble XGboost
 - KNN
  
For now, the best result that I have obtained is with **SVC(kernel = "rbf")** and using the **SMOTE technique**(Of course the sampling is only performed on the training dataset since the test one should represent the real population):  
 - **Test Accuracy: 0.75**  
 - **Training Accuracy: 0.88**

  But the classification report is not good, the **f1-score is 0.51**, there is a **real issue with the 1 class** even after the resampling!! as you can see below:  
[![enter image description here][4]][4]  
Here is also the Confusion Matrix:  
[![enter image description here][5]][5]  
Can you please help me improve the f1 score, what is your analysis of the situation, and what are your suggestions?


  [1]: https://i.stack.imgur.com/NiRuq.png
  [2]: https://i.stack.imgur.com/IJri5.png
  [3]: https://i.stack.imgur.com/KpNx0.png
  [4]: https://i.stack.imgur.com/EMjuC.png
  [5]: https://i.stack.imgur.com/8GRjf.png
Tips and Tricks to make Coding Easier
Tags: beginners, productivity, codenewbie, webdev
Published: 2022-07-16 23:36:00

In this article I’ll be discussing how to use Emmet, and various VS Code extensions to make your coding life easier and more organized.

Professional Dev's utilize shortcuts to make coding faster and more efficient. You can do that too! Get started today learning how to set up some of these same tools to make your coding life easier.


##What Is Emmet and How Do I Use It?

Emmet is a set of keyboard abbreviations that will automatically convert to the language you're using them with. Although that may sound confusing, it's a lot simpler than it sounds. Emmet allows you to type less and create code more quickly. It is simply a list of shorthand keystrokes that will fill out as HTML, CSS, and other languages. [Checkout the Emmet Cheat Sheet here](https://docs.emmet.io/cheat-sheet/) to see all of the available languages and to get started. Let's dive right in to see Emmet in action.

[If you want, you can check out how to get started with Emmet in my help article here.](https://allmaddesigns.com/how-to-use-emmet-abbreviations/)

##What is ESLint and How Do I Use It?

ESLint is a tool that will analyze your JavaScript code and let you know if problems exist within it while you're coding. If you want to avoid running into common syntax errors or other simple errors before you run your code in a JavaScript Runtime Environment like a browser, then you should start using ESLint today. You can use ESLint to make your coding life easier and I'll show you how. To find out more about ESLint, check out [their documentation here](https://eslint.org/). In short, after setting up ESLint in VSCode, you'll be able to find problems in your code and fix them before ever running it in the browser.
[Check out my blog post about how to set up ESLint in VSCode.](https://allmaddesigns.com/what-is-eslint-and-how-do-i-use-it/)

##What is Prettier & How Do I Use It?

To put it simply, Prettier is a code formatter. The reason we format code is to make it readable, not only for others, but for yourself as well. [Check out the Prettier docs](https://prettier.io/) for more info here.

Readable code is workable code and you can make your code easy to work with if you format it appropriately. The problem with formatting your code manually is that not only is it error prone, but it's tedious and time consuming. Using a tool like Prettier can save you time, and prevent errors in your formatting. Your code will be more legible and you'll have an easier time navigating your code if you haven't looked at it in a while. You can even set up Prettier in VSCode to format your code whenever you save it. Configuring Prettier is not always a straight forward process. In this article I'm going to show you how to set Prettier up in VSCode to make your coding life easier.

[Check out my blog post about how to set up Prettier in VSCode.](https://allmaddesigns.com/set-up-prettier-format-code/)
DjangoStart New Release 1.0.4 🎊
Tags: django, pythoh, webdev
Published: 2022-07-16 22:43:07

This script saves time for you to start a new Django project. It creates the project and creates the first app and then updates the project settings file and also updates the project URLs file and then creates a views and configures the application URLs file and also creates the index.html

## TL;DR
### New Feature
- `-v, --virtualenv` For create virtual environment by default name `env`
- `-n, --name` To set custom name for virtualenv `-v -n my_new_name`

### Chang Log
- added help options
- fixes bugs
- refactor code
- remove version check function
- required add path to project
`django-start <project_name> <app_name> . `
- now for install django-start just type `pip install django-start-automate`

### Installation

```shell
pip install django-start-automate
```

```shell
django-start --help

usage: django-start [-h] [-v] [-n ] project_name app_name path

django-start 1.0.4 (Beta) automate start project and create app

positional arguments:
  project_name      Write a project name
  app_name          Write an app name
  path              select path

options:
  -h, --help        show this help message and exit
  -v, --virtualenv  Create virtualenv
  -n [], --name []  Set virtualenv name

```
**Success Install 🎊**

### Start First Project with virtualenv
```shell
django-start frist_project first_app -v -n my_virtualenv .
```
---
> You can run command without create virrualenv
```shell
django-start frist_project first_app .
```

![django start screen shoot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k93sbntq6gzdtac2wdi0.png)
[pypi project](https://pypi.org/project/django-start-automate/)
[django-start repo](https://github.com/islam-kamel/django-start)
Tips for New Developers
Tags: watercooler, beginners, discuss, motivation
Published: 2022-07-16 21:49:39

I've been a professional software developer, engineer or whatever you want to call since 2013. During this time, I've lead workshops, mentored in bootcamps and at work. With this experience, I've compiled some tips that have helped developers.

## Be Flexible

There's always chatter between developers about being front-end, back-end or fullstack. Some say pick this or that because it makes you more money; but enjoying what you do is also important.

I always recommend to try out everything. Do front-end work,  back-end work, or devops. Eventually, you'll gravitate towards one or more. I experienced this firsthand as I started as fullstack with roughly 50% front-end and 50% back-end. Now, I do roughly 95% front-end with 5% back-end as I enjoyed front-end more.

## Read Code

Being able to read and follow code written by someone else is an integral part of being a good developer. Getting used to reading code not only helps you learn why developers do certain things but see alternative ways to solve the same problem.

It will also make you an effective reviewer when the time comes.

## Focus on Yourself

A common thing I hear especially from new developers is I'm not fast enough or not good enough compared to someone else. Comparing yourself to other developers who are at a different stage of their career will affect your mental health. It might also worsen your impostor syndrome.

Focusing on yourself also keeps you honest with what you're missing skill-wise and knowledge-wise.

## Find a Mentor

It's never too late to find a mentor. Having a mentor does wonders when it comes to receiving insight, and an alternative point of view about certain things as they would have different experiences. The topics you talk about with your mentor doesn't have to be exclusively about technology. It could be about life or career trajectory.

As someone who didn't have a mentor, it was difficult especially as a young developer. With little to no support early on in my career, it definitely affected my mental health at that time.

## Rest

I've seen young developers who are extremely eager to learn as quickly as possible that they would be studying after work and over the weekend. The motivation is there but make sure that you're not burning out because of it.

## Conclusion

Most of these tips might be common sense for most people, but sometimes it's important to mention it again. I hope some of these tips resonated with you.

What tips do you have for new developers?
plymouth.splash kernel cmdline tweaks discovered
Published: 2022-07-16 21:49:00

Was just browsing through plymouth code and found the plymouth.splash= magic switch to select a plymouth theme.... 

https://gitlab.freedesktop.org/plymouth/plymouth/-/blob/main/src/main.c#L376

So in theory i can pass in `"plymouth.splash=solar"` and see a change of behaviour .... I will keep you posted how things work out...