teleren/devto huggingface dataset:
The Spring Bean Lifecycle
Tags: java, spring, bean, lifecycle
Published: 2020-10-08 02:20:56

#Initialization
```java
ApplicationContext context = SpringApplication.run(AppConfig.class);
```
1. Load and process bean definitions: @Configuration classes are processed, @Components are scanned, XML files are parsed, bean definitions are added to a BeanFactory, BeanFactoryPostProcessor beans are invoked.
    1. Load bean definitions
    2. Post process bean definitions
2. Perform bean creation (for each bean): each bean is eagerly instantiated by default (unless marked as [lazy](https://dev.to/eidher/lazy-beans-in-spring-1j0)), each bean goes through a post-processing phase.
    1. Find and create its dependencies
    2. Instantiate beans (dependency injection)
    3. Call setters (dependency injection)
    4. Bean Post Processors
        1. BeforeInit: modify a bean before initialization
        2. Initializer: initialization methods are called ([@PostConstruct](https://dev.to/eidher/postconstruct-and-predestroy-in-spring-2lkh), @Resource, etc)
        3. AfterInit: modify a bean after initialization
    5. Bean ready for use

#Usage
```java
AppService service = context.getBean("appService", AppService.class);
service.doSomething();
```

When you invoke a bean obtained from the context. If the bean is wrapped by a proxy the proxy is created during the initialization phase by a BeanPostProcessor adding behavior to the bean. It may be a JDK Proxy (interface based) or a CGLib Proxy (subclass based)

#Destruction
```java
context.close();
```
The context is closed if the application shuts down (not killed or failed), all beans are cleaned up, [@PreDestroy](https://dev.to/eidher/postconstruct-and-predestroy-in-spring-2lkh) methods are invoked, beans are released for the Garbage Collector to destroy.
Calculating Read time in JavaScript
Tags: javascript
Published: 2020-10-09 04:26:57

---
title: Calculating Read time in JavaScript
published: true
date: 2020-10-08 01:51:48 UTC
tags: javascript
canonical_url: https://aboutdavid.me/posts/2020-10-08-calculating-read-time-in-javascript/
---

This is a very simple task. First, we need a sentence to try this out. Let's use "The quick brown fox jumps over the lazy dog". A few thing we need to know is:

- The average word is 5 in the English dictionary.
- The average Words Per Minute for reading (WPM) is 200-250, which averages to 225 WPM. ([https://archive.is/FRfWJ](https://archive.is/FRfWJ)).

So, we have to split the text every 5 letters and divide it by 225 WPM. This can easily be done with JavaScript:

```
"The quick brown fox jumps over the lazy dog.".match(/.{1,5}/g).length/225;
```

Which should return a value of `0.04`. So are we done? No. We also need make it human readable. First we need to round to the nearest whole number by using `Math.round()` :

```
Math.round("The quick brown fox jumps over the lazy dog.".match(/.{1,5}/g).length/225);
```

Which should return `0`. Now we are almost done. Let's make it human readable. We can give it summaries using if/else statements.

Lets use:

- Less than a minute read - for read times under a minute.
- `n` min read - for read times that are over a minute.

as statements.

```
var rt = Math.round("The quick brown fox jumps over the lazy dog.".match(/.{1,5}/g).length/225); if (rt <= 0) { rt = "Less than a minute read." } else if (rt === 1){ rt = `${rt} min read.` } else if (isNaN(rt)){ rt = "Failed to calculate readtime!" } else { rt = "Failed to calculate readtime!" }
```

which returns `Less than a minute read.`

Let's make it ready for "production" by wrapping it around a function and compressing it using [JScompress](https://jscompress.com/). I put the source code on [P2Pbin](https://dev.to/aboutdavid/p2pbin-a-peer-to-peer-paste-sharing-site-with-no-servers-2f8c), which you can find [here.](https://p2pbin.glitch.me/?id=QmSUskuMStqUSb4huDVDWc94UPE3v5AyX2aNp4nUoWw9tp)
When to apply for senior Developer position? 
Tags: help, career, react, discuss
Published: 2020-10-08 01:43:47

Hello friends,
It's been 1 year I'm working as FrontEnd Developer in a startup, have a good working experience on working tools/framework like React, Redux, saga, styled components, ramda etc. 

Now when I see job posting regarding a Senior frontend developer role, most of requirements they want I have experience with.

So can I apply for Senior Developer position? 

Is there a rule of thumb that I can know I'm ready to apply for senior Developer position?
It's not only about code!
Tags: hacktoberfest, beginners, opensource, github
Published: 2020-10-08 01:41:16

## What I Learned From Hacktoberfest

I recently completed my Hacktoberfest PRs and 
This post is for all the people who are struggling to get those Pull Requests in and have to resort to special repositories which are targeted toway Hacktoberfest only (nothing wrong with using these).

But there's another way with which you can make valuable contributions easily to the biggest of projects and later on, look at them and feel proud. 😄

## Documentation Matters

The secret I'm talking about is of documentation, most if not all repositories on GitHub use simple markdown files for their documentation, which are very easy to edit and append to. Most of the repositories out there could also use better documentation and the maintainers will be more than happy to accept your PRs.

## Translation Goes a Long Way

Another great thing you can do is provide translations for the documentation, which is easy enough for you to do if you are multilingual. By doing this not only you will get the PRs in but this will make the repository much more inclusive and this will make life a bit easier for many people who speak that language and use the project.

So, what are you waiting for, head on to GitHub and find all your favourite projects and start making those contributions.

Happy Open Sourcing. 🎉❤️🙏🏼
Day 2 of 100!
Tags: 100daysofcode, javascript, webdev, codenewbie
Published: 2020-10-08 01:37:03

Just created my account but on Day 2 of 100.
Continuing to code my project (Coding from scratch a Wix website I did for a local organization). Finished all the HTML and going to style it up. Starting to get that feeling when you start developing progress!
Caching Tutorial 2020- System Design Basics
Tags: webdev, career, javascript, tutorial
Published: 2020-10-08 01:08:05

Caching is one of the most important concepts for understanding how to scale systems. Large applications like Twitter and Facebook wouldn't be possible without extensive caching to boost performance. In this video I'll cover:

* What caching is
* How it works and why you need it
* Distributed Caching
* Cache eviction
* Cache consistency
{% youtube ylFgcpe4TK4 %}


If you're interested in other system design topics be sure to check out my other articles and videos
{%link https://dev.to/renaissancetroll/load-balancer-tutorial-2020-system-design-basics-4g3i %}
How to solve low disk space issue in windows.
Tags: windows, tutorial, webdev, disk
Published: 2020-10-08 00:37:02

My laptop has 128 GB of SSD and I ran out of space, The options I had to upgrade my SSD storage. But I'm not able to do that so I compressed my C drive.

As you can see in the thumbnail I had only 4 GB of space left, and after compression, it has 32 GB of free space available.


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

To achieve this right click on your disk > properties > check "compress this disk to save space".

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

On the next popup select "apply to this folder and subfolder" option.

##### Note:
> You should not be using windows during compression
> It will take 7 - 8 hours depends on the size of the disk.
> Close all programmers so no files will be in use or you can "ignore all" option.

That's how you save your space from the Pacman 🌏.

Share your idea's in the comment.
Good Boy/Girl Forever!
Tags: python, deeplearning, imageclassification, app
Published: 2020-10-08 00:10:56

Love Dogs? Check it!

I was able to take my deep learning to the next level, with this handsome guy here. His name is Ranger, but sometimes I wonder what Rangers mix is as he is a good ole craigslist dog. As many dogs are not a pure breed but mixes and no one has time to do vet blood work to tell what they are, so I thought my next project would be fun for all ages to see what furr ball you could have. I used the resnet34 image classification architecture to train the model to get an error rate of 7%! An industry-standard in today's image classification architecture. The images were trained on bing search images of some of the top breeds listed on the American Kennel Club. Bing has an easy to gain access to API that allows you to easily gather up to 150 images per parameter in this case dog breed. I was able to gather 5000 images to train my model on in the process. You can find the app here in my first link and see if your good boy/girl can be classified. 

Tips: 
Full body shot
Good lighting 
limited/no obstructions

Because the images are trained are perfectly taken pictures found on search engines such as bing these tips are very important otherwise you will get your dog classified as a cat! Not really, but still reasons being that color, light, and visibility of the puppy, in general, are the main source to recognize the image. 

Also, the ability to launch the app will take a min as the file is made into a docker file by binder and has to be recreated each time. 

App/ Github Repo
https://github.com/andrewdarmond/PuppyPalooza

Fastai:
https://www.fast.ai/

Binder:
https://mybinder.org/

Docker:
https://www.docker.com/play-with-docker

Who's a good pup!
Contributed to Dome Game Engine for This Hacktoberfest
Tags: c, game, wren, hacktoberfest
Published: 2020-10-08 00:07:56

---
title: Contributed to Dome Game Engine for This Hacktoberfest
published: true
description: 
tags: c, game, wren, hacktoberfest
//cover_image: https://direct_url_to_image.jpg
---

For this Hacktoberfest I decided to contribute to the [Dome Engine](https://github.com/avivbeeri/dome/pulls/clsource). A minimalist game engine that is written in _C_ that uses the [Wren Programming Language](https://wren.io/) for scripting.

These were the accepted contributions:

- Added _Wren Version_ to the command: `dome -v`.
- Removed unused code for _ffi_ module.
- Added a new variable to _Window_ for getting the _FPS_.

Also there were two additional _PRs_ that were not accepted because they required additional though not related to code.

- Added JSON support: This _PR_ could not be accepted since its preferred to use raw C to generate the _Map_ data structure, instead of _Wren_. But since _Wren_ does not have support for _Map_ construction until version _0.4.0_ this module was delayed until then.

- Added command line arguments to be accesible to _Wren_ code: This was delayed because the _optparse.c_ file has some arbitrary way of dealing with _argv_. And it was not clear the best way to interpret which items belongs to the _engine_ arguments and which belongs to user custom arguments.
How to remove attributes from a DOM element using JavaScript?
Tags: javascript
Published: 2020-10-08 00:00:00

---
  title: How to remove attributes from a DOM element using JavaScript?
  published: true
  tags: JavaScript
  date: Thu Oct 08 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/remove-attribute-element-dom-javascript
  cover_image: https://melvingeorge.me/_next/static/images/main-dfbf2e898c7d02c478bdb7b86d2049ac.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/remove-attribute-element-dom-javascript)
  
To remove an attribute from a DOM element, we can use the `removeAttribute()` method in the element in JavaScript.

Let's say we have a paragraph tag with `id` attribute like this,

```html
<!-- Paragraph -->
<p id="myParagraph">Hello World!</p>
```

Now let's remove the `id` attribute using the `removeAttribute()` method in the paragraph element.

```javascript
// get refernce to the paragragh element
const paragraph = document.querySelector("p");

// remove the id attribute using
// the removeAttribute() method
paragraph.removeAttribute("id");

// try to get the id attribute now
console.log(paragraph.getAttribute("id")); // null
```

- The method accepts a valid tag name of string type as the parameter.

See this example live in [JSBin](https://jsbin.com/yavolejazo/1/edit?html,js,console).

### Feel free to share if you found this useful 😃.

---
I have a dream about conventional commits
Tags: git, versioning
Published: 2024-03-08 12:55:52

---
title: I have a dream about conventional commits
published: true
date: 2020-10-08 00:00:00 UTC
tags: git,versioning
canonical_url: 
---

# I have a dream about conventional commits

Everyone these days has heard of semver, as most package managers try to enforce it upon their packages.

While the idea behind it is nobel, the execution often lacks.

We’ve all been screwed by some form of [sentimental versioning](http://sentimentalversioning.org/)before I’m sure, so here’s an idea you might not have heard of:

## Conventional Commits

Use ✨[conventional commits](https://www.conventionalcommits.org/)✨, introduce some tooling, and you’ll be semantically versioning in no time.

Commit messages are subject to rules according to a specification which ensures, that the git history can be tracked for patch, minor and major changes.

As a bonus, you can from now on generate your CHANGELOG.md as well.

Thanks for adhering to my advice.

# Discussion

Are you already comitting conventionally? How is it working out for you? Was it hard to adapt with an entire team?

Let me know by submitting an issue on [GitHub](https://github.com/InDieTasten/indietasten.github.io/issues).
Full System Architecture of my React-Flask App
Tags: react, architecture, microservices, python
Published: 2020-10-07 23:03:31

During last few months, while being locked at home due to COVID, I thought of using my free time to build something useful. So I built an App to help my wife manage her Recipes (which she has been complaining that she is having hard time managing). While I built the app it was a great learning curve for me where I learnt a few new things and got a chance to apply them to my app. Particularly I learnt a lot building the whole architecture for the app including the front end and the backend.  

I explain about the app architecture in my blog post here:  
https://amlanscloud.com/apparchitecture/

 If you want to view a preview of the app, watch these videos:

- Web UI: <a href="https://www.youtube.com/watch?v=tf263VNweps" target="_blank">Here</a>   
- Mobile UI: <a href="https://www.youtube.com/watch?v=Kc7SirxMwSQ" target="_blank">Here</a>
Create a Rust-Client during Hacktoberfest
Tags: contributorswanted, hacktoberfest, rust, rest
Published: 2020-10-07 22:50:35

Hi all,

you can create a Rust-Client for [SirixDB](https://sirix.io) and make a huge contribution during Hacktoberfest. We can split the task into many smaller tasks, of course.

{% github https://github.com/sirixdb/sirix/issues/345 %}

We need your help, bringing the project forward :-)

It's an evolutionary, accumulate-only database system, which means that the full history of each of your resources in the database is retained and can be queried to gain further insights, to undo human or machine errors or for audits.

Kind regards
Johannes
Decreasing Your Website Bundle Size
Tags: javascript, webdev, performance
Published: 2020-10-07 22:20:06

# How To
Just put this in your webpage:
```html
<script src="https://cdn.jsdelivr.net/gh/shadowtime2000/easy-dom/src/index.js"></script>
```
and then instead of using `document` use `DOM` and it saves you 5 bytes.

## Improvements to original size of website
The more references you have to `document` the more bytes it can save. If you have more than 22 `document` references it starts decreasing your bundle instead of increasing.

### Largely Used Libraries If They Use this
 - `jquery` would decrease their size by over 1kb
 - `react` would decrease their size by over 1kb
 - `angular` would decrease their size by over 2kb

#### Finishing Thoughts
So that is how you can decrease your website bundle size. If you liked this post and [the library](https://github.com/shadowtime2000/easy-dom), star the library to support it.
Day 233: One Step Ahead
Tags: hiphop, code, coding, lifelongdev
Published: 2020-10-07 21:22:47

_liner notes_:
- Professional : Couldn't sleep so I got up super early and did some work. I figured out the issue I was having with the Web Component I was working on before. It was something pretty silly. At least I got it working. I worked on a couple of slides I'll be presenting on a livestream I'll be doing next week. Also made a demo for the application I'll be making on that livestream. Had a couple of meetings. Got to talk with my manager and show what I had for the upcoming livestream. Also found out that my latest blog post on using Web Components in a React application went live today. They said I didn't really have any major edits that needed to be done. Cool. I'll probably post about it tomorrow on social media. Just been a long day.

- Personal : After helping with the virtual event last night, I was pretty wiped and went to bed early..

![Floating tents on a lake in Zug, Switzerland at sunset](https://dev-to-uploads.s3.amazonaws.com/i/a1wkddmfoaq00mr1zi8l.png)

Going to go through some tracks for this week's show. Been a little ahead this week. Hope I can keep it up and stay one step ahead. haha Got some vacation coming up next week. After the track, I'll probably work a little on my side project.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube J2XiS6EFwPE %}
Learn Python by Building 3 Small Apps - Part 2
Tags: vscode, python, beginners, dev
Published: 2020-10-07 21:20:16

---
title: Learn Python by Building 3 Small Apps - Part 2
published: true
description: Learn Python 3 by building apps step by step
tags: vscode,python,beginner,dev 
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/r7ct4zhsqtw0f5ymsbwy.png
---

Hello everyone, 

I'm back again with a fresh set Python apps built from scratch on my [Twitch Stream](https://twitch.tv/mbcrump). If you missed the first three apps, then they can be found below (video+source code):

{% link https://dev.to/mbcrump/learn-python-by-building-3-small-apps-14in %}

I've continued the approach of building 3 small Python apps that incorporate the skills to be a successful app developer.

**App 4 - Journal Application** - create a journal application that allows you to read/write entries to your local file system.

[Source code](https://github.com/mbcrump/journal)
Video (9 mins)

{% youtube SyN_NSws0ss %}

**App 5 - A web scraper** - import a third party module and scrape a weather site for the current temperature for your local city/state. 

[Source code](https://github.com/mbcrump/CallAWebsite)
Video (9 mins)

{% youtube evS2WeMgN_Y %}

**App 6 - Parse arguments from the CLI** - Work with arguments, help documentation and more.

[Source code](https://github.com/mbcrump/CommandLineAwesomeness)
Video (4 mins)

{% youtube RoMn8YRBhdc %}

The next set is coming shortly. 

Conclusion

Stay tuned for [future streams](https://twitch.tv/mbcrump) as we build out an additional 4 Python apps from scratch or you can watch the condensed version by subscribing to my [YouTube](https://youtube.com/mbcrump). 

Stay connected with me on social platforms for security and software development news.

-[Twitter](https://twitter.com/intent/follow?screen_name=mbcrump) | [Twitch](https://twitch.tv/mbcrump) | [Instagram](https://instagram.com/mbcrump) | [YouTube](https://youtube.com/mbcrump) | [GitHub](https://github.com/mbcrump) | [Website](https://www.michaelcrump.net)
Test HTML in GitHub Actions
Tags: github, html, webdev, showdev
Published: 2020-10-07 22:42:28

---
title: Test HTML in GitHub Actions
published: true
date: 2020-10-07 21:08:40 UTC
tags: ["github", "html", "webdev", "showdev"]
canonical_url: https://www.joshkasuboski.com/posts/htmltest-githubactions/
---

I want to start adding tests for my site so that I don't break it 😢. `htmltest` is first.

## Setup htmltest

I went with [htmltest](https://github.com/wjdp/htmltest) mainly because it's just a go binary. I've seen other options in the past that required a Ruby environment and generally don't like dealing with that.

Installing `htmltest` into the current directory can be as simple as `curl https://htmltest.wjdp.uk | bash`. I installed it system-wide but 🤷‍♂️.

`htmltest` operates on HTML files…whereas my site is set up with [Hugo](https://gohugo.io/) so is largely Markdown. I have to generate my site first using `hugo` and then run `htmltest` on the `public` folder. Fortunately, htmltest has a config file that lets you set the directory. This way testing my site (once it's rendered) is just a matter of running `htmltest`.

The first time running htmltest my site had a number of issues. It found a broken link to an svg I had removed, my LinkedIn link was incorrect, and a number of missing `alt` tags. There were also a couple other issues that I ended up having ignored. I have some [indieweb](https://indieweb.org/) tags that didn't respond kindly to a `GET` request and one site I linked out to kept timing out in the test.

## Add to GitHub Actions

I installed htmltest in my pipeline using the magic `curl` script. This way it always gets the latest version and I didn't have to write anything. htmltest will cache the results of the remote links check so the workflow will cache the `tmp/.htmltest` folder to help keep it quick. Overall this adds six seconds to my pipeline.

This is all that was needed to add to the workflow yaml. It assumes htmltest is configured with `.htmltest.yml`. You can find my [config](https://github.com/kasuboski/personal-site/blob/master/.htmltest.yml) in the repo.

```
- uses: actions/cache@v2
  with:
    path: tmp/.htmltest
    key: ${{ runner.os }}-htmltest

- name: HTML Test
  run: |
    curl https://htmltest.wjdp.uk | bash
    bin/htmltest

```

![GitHub actions run](https://www.joshkasuboski.com/posts/htmltest-githubactions/actions-run.png)

I did have to configure it not to fail on external links as it was failing every so often. Every change to my site now gets tested to ensure the links are valid.

## Next Steps 🦶

I want to add more tests. I think the first might be a spellchecker. I write these posts in VS Code which will highlight misspellings, but I don't always notice. I've used [vale](https://github.com/errata-ai/vale) before and it will even recommend some grammar changes.

I also want to test the Lighthouse score and make sure it doesn't get worse. This GitHub action seems nice [lighthouse-check](https://github.com/marketplace/actions/lighthouse-check). It could generate an HTML report like below.

![lighthouse report](https://www.joshkasuboski.com/posts/htmltest-githubactions/lighthouse-report.png)
My development environment
Tags: ubuntu, devops
Published: 2020-10-07 20:44:01

I preferred to code online instead of doing it locally. As I am very much uncomfortable to organize the project folders locally & that why I do coding work completely online.

#### My development Env.
I have 2 vps which I only use for my Development purpose.  One is from Vultr(2gig, 1cpu) & another one from DO (1gig, 1cpu).
All of my projects are configured there & I use an online IDE Called CodeTasty which is just the tool I need & the ide is connected to both of my servers via ssh. I can easily switch between the servers when needed. With the IDE I can easily organize my project files, commit & push the codes to git repo.

#### The summery of my development environment:

* I configured my project files on cloud servers to manage & organize the codes
* I have connected an Online IDE to my dev servers & do code directly to them
* I use GitLab & GitHub for final code store or version controlling
* I test all the projects from my dev server with a subdomain
* Once testing is done I push the codes to production via GitLabs CI/CD or GitHub Actions

Hope my workflow will help you guys.