teleren/devto huggingface dataset:
How I learn things after 10 years
Tags: webdev
Published: 2021-12-12 21:13:32

When I see that people that have been in the web industry for decades still learn and want to learn new things, that amazes me. I am also learning constantly, but in a different fashion than before.

I don't have a lot of developer friends, so I occasionally end up listening to people complaining or just talking about their jobs. There are two common problems as I see it: the other person, like a boss or a colleague, or the job itself, like bad organization or just lousy job.

I rarely hear from my friends that they have to learn some new things or spend a weekend working on my side project to improve their skills.

That makes me wonder, who is the luckier one: me, who needs to learn new stuff constantly, or they, who rarely need to learn something new for their job?

I love to learn, but I want to spend less time in front of the computer as I am getting older. So if I am not able to learn new things during office hours (which I, as a remote worker, manage myself), then I usually just read some articles before I go to sleep.

I noticed that I am not trying new things as much I used to. I don't immediately jump to something new like a new framework or feature. Instead, I try to remember an article or at least the gist of it, or do a little bit of investigation and general learning, and apply the knowledge when I actually need it. If such an occasion doesn't occur, at least I didn't invest my time in something useless to me.

One thing that helps me memorize all the new things [is my newsletter](https://mentor.silvestar.codes/reads/). I have a few hundred subscribers, but I write it primarily for me. When I read the article, I try to summarize it in one sentence before sharing it. I also try to learn more about the author, especially if the author is not in my Twitter circle. The summarized sentence and author information stuck with me longer than the plain article.

On more than one occasion, I tried to find an article, and then I remembered I shared it in my newsletter.

Before starting the newsletter, I [bookmarked almost every article I read in the Pocket app](https://www.silvestar.codes/bookmarks/pocket/). It was insane. The list was too immense, and I rarely used or searched it. As a result, many solid articles vanished from my memory, unfortunately.

* * * * *

I recently read [Rachel Andrew's interview with Bramus](https://web.dev/community-highlight-bramus/#new-features-in-css), and I was impressed how Bramus still loves to learn and explore every new shiny feature in CSS. I think that is a blessing. It might be that web technologies are still just shaping, and we are doing our best to use them in their current shape. Having people like Bramus trying out the new features and writing about them, we developers could learn a lot and prepare for the exciting future.

Conclusion
----------

My friend salesman, my other friend electrician, or my other friend teacher, their jobs are already well defined and finalized. I think we still have a long way before we could call technologies like CSS finalized. That excites me so much, but mainly during office hours.
The final result
Tags: opensource, telescope
Published: 2021-12-12 20:49:01

In the last week of OSD600, all my PRs for Telescope were merged.
The summary of them is as follows:
* 1st: Adding feeds/delayed route to Posts service: [PR](https://github.com/Seneca-CDOT/telescope/pull/2575)
* 2nd: Upgrade Elasticsearch version in docker-compose.yml file: [PR](https://github.com/Seneca-CDOT/telescope/pull/2598)

In my last two blog posts, I discussed the issues related to the first PR and how I resolved them. For this blog, I would love to write about my experience working on the Telescope project in general and what I learned from my second PR.   

## Elasticsearch version
Regarding this [issue](https://github.com/Seneca-CDOT/telescope/issues/1897), I just need to change the version number of Elasticsearch in the docker-compose.yml file and it is just a 5-min fix:
```yml
// old code
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.3
// my fix
image: docker.elastic.co/elasticsearch/elasticsearch:7.14.2
```
However, after I sent my PR, Prof. David filed an [issue](https://github.com/Seneca-CDOT/telescope/issues/2597) about a high severity vulnerability (CVE-2021-44228) which has impacted the Elasticsearch versions 5.0.0+. So the solution is to upgrade to Elasticsearch 7.16.1 once it is released. This experience made me think that we should be aware and keep updated on the third-party engines/tools used in our project. 

## Experience
To put it simply, this is the best open source project I have contributed to. Telescope's Slack channel is always active, and when there is a question, the maintainers and contributors reply instantly. What I love most about it is code review, as I learnt a ton of good practices from Prof. David's comments. 
For example:

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

![comment](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3pvtzp4ww66qcnz4d982.png)

I think Telescope's maintainers did a fantastic job in fostering engagement. They are always there to help contributors. They provide excellent and constructive feedbacks, and they value every contribution, even small ones. 

## Conclusion
This semester, I did not have a chance to work on Front-end issues. However, I am looking forward to taking some React issues in the OSD700 course.
Living in the Shell #13; rm (Delete Files/Directories)
Tags: productivity, linux, bash, devops
Published: 2021-12-12 20:39:07

## `rm` 💣

Removes files or directories.

💀 Removal is irreversible.

## Remove a single file

```sh
rm some-file
```

## Remove multiple files

```sh
rm first-file second-file third-file
```

## Remove a directory `-r`

```sh
rm -r my-dir
```

## Set to prompt before every removal `-i`

```sh
rm -ri my-dir
```

## Set to suppress any interaction/error `-f`

```sh
rm -rf my-dir my-non-existing-dir
```
Event Badge Project
Published: 2021-12-12 20:33:53

## Summary
For this project we needed to make a web component of an event badge, that could be reusable for all events that would use a photo on their badge. We also needed to wire it up to HAX.

## Getting Started
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eoz33eu2n67dqb3n6nhw.png)
For this project we were given the comp shown above. For this component my group and I decided to brake in down into the following elements:
- Event-Badge
- Event-Header
- Event-Photo
- Event-Name
- Event-Logo

We also decided that we would want to make it hockey themed instead of the media theme that was in the original comp.

## Progress

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4rn7r8zew14m0gakdhsb.png)
As shown above this is how our comp currently looks. We still have some things to work on before it is due, but so far we have made our own banner for the header area. How I did this was by taking 4 different svg's and mixing them up in different patterns. Liz is the main developer for our project so she has do the majority of the coding. Our professor commented on how the code shown below was a cool way for solving the hole punch that we needed at the top of our badge.
```
.holePunch {
  margin: auto;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: white;
}
```
We still need to ``<slot>`` in the content, add support for an image, as well as add support for the name, title, company properties. When we are finished I will add in screenshot of the badge below.

## HAX
As I mentioned earlier we needed to wire our component to HAX. What is HAX you may ask, well HAXTheWeb is an open source collection of web components that are reusable on all platforms. This is achieved by using a tag structure that is very semantic. The web components can be used with or without HAX after it has been created as well. As our professor is a main part of HAX, we were asked to do this project based off of issue that had been added to the HAX GitHub account.

## Links
**NPM:**[https://www.npmjs.com/package/@runtimeerrorsmadeeasy/project-three](https://www.npmjs.com/package/@runtimeerrorsmadeeasy/project-three)
**GitHub:** [https://github.com/runtimeErrorsMadeEasy/Project3](https://github.com/runtimeErrorsMadeEasy/Project3)
What a newbie thinks about blockchain development when enters the field. 
Tags: blockchain, smartcontracts, ethereum, solana
Published: 2021-12-12 20:19:11

Hi I am a newbie blockchain developer and I was writing what was going on in my head for some clarity about what I think about blockchain and other stuff so here is what I have written. 

Will blockchain actually change the future? Do I think so?

I think I am not in spot to say that because I haven't been in a spot where I know all the practical uses of blockchain all I have done till now is make smart contracts and deploy them on some test networks. Most of which I don't even know what they do. Like the defi staking app, I know that it used to put money in bank and then we could withdraw them with interest that bank gave us. This project that I am currently working on can like fetch the custom token and transfer them. So like till now I have just made some smart contracts. I wonder how much of these smart contracts are actually gonna make me blockchain developer.

What should be the job of blockchain developer? 

Maybe make blockchain and make use of this blockchain.And I know that smart contracts make use of pre-existing blockchains. Yes so like these smart contracts should be the one's that are the main thing. Blockchain developers should be smart contract writers. So the main thing is what are the uses of these smart contracts and what are these solana,NFT,etc are leveraging from these smart contracts. How are solana, ehtereum using to make them better blockchains. 

Ethereum is shifting to proof of stake which is like great. But it kills the whole idea of 'for the public by the public' like if you want to be miner you have to have like butt load of money and then only you can be the miner. But well for environment if we have to sacrifice a bit, we can do it. The current system might die because of the effects of it on environment. But proof of stake might not.

Thank you for reading have a great day!
The Dilemma of New Devs
Tags: devjournal
Published: 2021-12-12 20:00:41

Good day devs, has anyone noticed that there's a lot of tutorials on learning a language or library or framework but there's little to no tutorial on Project configuration? You check out an open source project and you can't seem to find the beginning or the end, because you don't know or understand how a project is supposed to be structured, then the config files that looks like gibberish. 

I recently downloaded an IDE for kotlin, launched it and clicked on "New Project". I got lost almost immediately because of the settings I was expected to configure, as a dev new to kotlin that's normal especially as there's really no explanation for this things......
Go Channel Patterns - Wait For Result
Tags: go, programming, tutorial, beginners
Published: 2021-12-12 19:31:11

---
series: [Go Channel Patterns]
---

To improve my Go Programming skills and become a better Go engineer, I have recently purchased an excellent on-demand education from [Ardan Labs](https://www.ardanlabs.com/education/). Materials are created by an expert Go engineer, [Bill Kennedy](https://twitter.com/goinggodotnet).

{% twitter 1467962096138825730 %}


I have decide to record my process of learning how to write more idiomatic code, following Go best practices and design philosophies. 

This series of posts will describe channel patterns used for orchestration/signaling in Go via goroutines.


## Wait For Result Pattern

The main idea behind **Wait For Result** pattern is to have:
- a channel that provides a signaling semantics
- a goroutine that does some work 
- a goroutine that waits for that work to be done

### Example

In this example we have an `employee` (`a` goroutine) that has some work to do. We also have a `manager` (`main` goroutine) that waits on that work to be done. Once work is done, `employee` notifies `manager` by sending a signal (`paper`) via communication channel `ch`. 

Feel free to try the example on [Go Playground](https://go.dev/play/p/lYAJ9Rneyws)

```go
package main


func main() {
	// make channel of type string which provides signaling semantics
	ch := make(chan string)

	// goroutine 'a' that does some work => employee
	go func() {
		// simulate the idea of unknown latency (do not use in production)
		time.Sleep(time.Duration(rand.Intn(500)) * time.Millisecond)
                // when work is done send signal
		ch <- "paper"

		// we don't know the order of print statement
		fmt.Println("employee: sent signal")
	}()

	// goroutine 'main' => manager 
	// goroutines 'main' and 'a' are executed in parallel

	// wait for and receive signal from 'goroutine a'
        // blocking operation
	p := <-ch
	
	
	// we don't know which print statement is going to be executed first
	fmt.Println("manager: received signal :", p)

	// ensure enough time to get the result (do not use in production)
	time.Sleep(time.Second)
}
```

### Result (1st execution)
```sh
go run main.go
employee: sent signal
manager: received signal : paper
```

### Result (2st execution)
```sh
go run main.go
manager: received signal : paper
employee: sent signal
```


## Most common misconceptions:
1. Note that in the first and the second execution of the previous code, the order of `fmt.Println()` statement is not guaranteed. Goroutines are executed in parallel.

## Conclusion
In this article, wait for result channel pattern was described. In addition, simple implementation was provided.

Readers are encouraged to check out excellent [Ardan Labs](https://www.ardanlabs.com/education/) education materials to learn more.

Resources:
1. [Ardan Labs](https://www.ardanlabs.com/)
2. [Cover image by Igor Mashkov from Pexels](https://www.pexels.com/photo/radio-telescope-against-sky-with-stars-6325001/)
react app, assets path change
Tags: react, beginners, css
Published: 2021-12-12 19:23:40

Hello, Im helping a friend to solve an issue a previous developer left, but Im new on React, so I don't know how to solve this issue:

He was integrating a html template he bought with React for his store site (he sells courses). The problem is when we click and open a detail of tutor or a detail of a course, the inner Source structure change, making the app lost the path to the '/assets' folder, making that all the pages to lost the styling.

for most of the pages this is the structure, and works fine, for example the checkout page:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mzy1qzuh7fd3h86skwrg.png)
 

but when I enter on a detail, the structure changes:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h7w64gpggvgth31mfsde.png)
 

As you can see, on the detail, a 'tutorDetail' folder is created and inside is the 'localhost:3000/tutorDetail/assets' folder with the css and js, while the original 'localhost:3000/asset' folder is now empty, after that when I go to any other page, all are a white mess of words and images.


The site was builded on a component called 'Home' and is build like this:

`return (
        <Fragment>
            <Header />
                <div className="sg-page-content">
                    <div className="sg-section">
                        <div className="section-content sg-filter-content list-view-tab section-padding">
                            <div className="container">
                                <Content />
                            </div>
                        </div>
                    </div>
                </div>
            <Footer />
        </Fragment>
    )`

and in the 'Content' component is where all the pages are render:

`  return (
        <Router>
            <Switch>
                <Route path="/courses" component={Courses}/>
                <Route path="/school" component={Schools}/>
                <Route path="/tutordetail/:tutor" component={TutorDetail}/>
                <Route path="/blog" component={Blog}/>
                <Route path="/coursedetails/:course" component={CourseDetail} />
                <Route path="/schooldetails/:school" component={SchoolDetail} />
                <Route path="/blogdetail/:idPost" component={BlogDetail}/>
                <Route path="/login" component={Login}/>
                <Route path="/register" component={Registro}/>
                <Route path="/cart" component={Cart}/>
                <Route path="/checkout" component={Checkout}/>
                <Route path="/" component={Index}/>
            </Switch>
        </Router>
    )`

I also noticed the next:

I tried to 'fix' this editing the HTML manually with the developers tool changing the inner path to the css and js for example:

from

  `<link rel="stylesheet" href="./assets/css/main.css"> `

to 

 ` <link rel="stylesheet" href="../assets/css/main.css"> `

and this fix the looks, but I don't know how to solve this from React to tell all the pages to use the same path to '/assets'

can you guide me on how to solve this?
Spell check - Text analysis
Tags: spacy, textanalysis, nlp, python
Published: 2021-12-12 19:22:21

Tried spell check for a specific domain data in health care and consumer.  Basic python spell check was not sufficient. The test which was given as an example did not work. Then i started looking at Spacy contextual check. (with large english dataset). 

This had problem with domain specific proper nouns.  Drug names, disease names, electronic brands were not getting corrected.

please check out:
https://spacy.io/universe/project/contextualSpellCheck
How To Swap 2 Unique Primary Keys In The Same Table With MySQL
Tags: mysql, sql, swap, howto
Published: 2021-12-12 18:18:13

Sometimes, we need to swap two unique primary keys in MySQL database tables. We can use two separate `update` queries like below.

```
UPDATE table_name SET id = 1 WHERE id = 2;
UPDATE table_name SET id = 2 WHERE id = 1;
```

But it does not work as we expected. The reason is, it tries to create duplicate primary keys. The 1st query tries to change the id value of the 2nd record to 1. But that id = 1 record already exists. So MySQL rejects the execution of the query as there cannot be any duplicate primary key.

But we can slightly modify the above queries to avoid trying to create duplicate primary keys in 3 steps. First, we can change the id of the first row to a non-existing, temporary value something like 0. Then we can change the 2nd row id to 1. At this moment, it will not make any conflicts like before as the original first row id value is 0. Then, we can change the id of the original first row id to 2.

Before running this, make sure to replace the `table_name`, primary key ids `1` and `2` with your related primary key ids.

```
UPDATE table_name SET id = 0 WHERE id = 1;
UPDATE table_name SET id = 1 WHERE id = 2;
UPDATE table_name SET id = 2 WHERE id = 0;
```

Finally, we can see both 1st and 2nd row ids have successfully swapped.

Feel free to visit [devtonight.com](https://devtonight.com?utm_source=dev&utm_medium=questions&utm_campaign=how-to-swap-2-unique-primary-keys-in-the-same-table-with-mysql) for more related content.
🔊 Say Github - monitoring Github Workflow
Tags: github, productivity, tooling, android
Published: 2021-12-12 18:17:36

### Introduction
*Disclaimer: Presented solution applies to OS X but the general idea can be easily adjusted to other systems.*

Recently I have found a great tool called [saydle](https://github.com/handstandsam/saydle). It's a simple Gradle wrapper that notifies you using `say` command when your build is completed.

I think it's a great example of improving everyday workflow with simple system command. I run many Android builds on daily basis using Github CI, so I've started thinking about similar solution for notifying me when my Github Workflow is completed.

### Solution - 1st approach
After doing quick research, it turned out that I've already had all the necessary components to monitor Github Workflow. 

I used Github command line [tool](https://cli.github.com/) to be notified when a workflow is completed.
```bash
gh run watch <run-id> && say "Workflow completed"
```
Run id can be obtained directly from the workflow URL or the workflow list command
```bash
gh run list
```

### System notification - 2nd approach
Going a step further I've thought that relying on sound maybe it's not the best option. I've decided to display system notification instead of using `say` command. For displaying notification I used [terminal-notifier](https://github.com/julienXX/terminal-notifier) tool which is pretty straightforward to use.
```bash
gh run watch <run-id> && terminal-notifier -message 'Workflow completed'
```

### Clickable notification - my final approach
At this moment I was pretty happy with my current solution but then I thought that clickable notification taking me directly to the Github Workflow result page would be even cooler. 

After checking that terminal-notifier supports URL parameter I created a simple script.
```bash
#!/usr/bin/env bash

WORKFLOW_ID=$1
URL=https://github.com/<USERNAME>/<PROJECT>/actions/runs/$WORKFLOW_ID
gh run watch $WORKFLOW_ID && terminal-notifier -message 'Workflow completed' -open $URL
```
Usage is simple:
```bash
./monitor-workflow <run-id>
```
After my workflow was completed I've got the notification:

![System notification](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p2kntrktrhk5zr0pi19y.png)

And as expected, clicking it took me to the result page.

### Summary
It took me around 20 minutes to build the final version. It helps me save time every day while I'm waiting for my Android builds.

Maybe this solution won't fit your needs, but I want to encourage you to create tools that work for you. Creating custom solutions with all the great tools out there is now simpler than ever before.

Happy hacking :)