teleren/devto huggingface dataset:
Annotating Deployments in Grafana Using the Process Start Time Metric
Tags: grafana, prometheus, metrics, kubernetes
Published: 2020-05-25 14:26:45

---
title: Annotating Deployments in Grafana Using the Process Start Time Metric
published: true
date: 2020-05-22 00:00:00 UTC
tags: grafana, prometheus, metrics, kubernetes
canonical_url: https://unconj.ca/blog/annotating-deployments-using-process-start-time.html
---

Grafana sports a feature called [Annotations](https://grafana.com/docs/grafana/latest/reference/annotations/) that allow you to label a timestamp on a dashboard with meaningful events – most commonly deployments, campaigns, or outages:

![Process start time annotations on a Grafana panel](https://unconj.ca/blog/images/annotated-grafana-panel-with-start-time.png)

(In this case annotating the simulated deployment of a [FluentBit](https://docs.fluentbit.io/manual/) container, which I’ve used to forward container logs out of the cluster.)

Annotations can be input manually, but the only recommendations I’ve seen to generate them automatically is to use something like [Loki](https://grafana.com/blog/2019/12/09/how-to-do-automatic-annotations-with-grafana-and-loki/), or [teaching your CI/CD system](https://frederic-hemberger.de/notes/grafana/annotate-dashboards-with-deployments/) to interact with Grafana’s web API. However, if you’re running a simple Prometheus + Grafana stack (say, using the [Prometheus Operator](https://coreos.com/blog/the-prometheus-operator.html) on Kubernetes), you might be reticent to add more complexity to your setup just to get deployment annotations.

Fortunately, there’s a simpler alternative for this narrow case: you can use the `process_start_time_seconds` metric from Prometheus to get an approximate idea of when apps or pods were started. I haven’t seen this approach recommended elsewhere, which is the purpose of this post.

It turns out that `process_start_time_seconds` is exposed by almost all applications because it’s one of the standard metrics [recommended by Prometheus itself](https://prometheus.io/docs/instrumenting/writing_clientlibs/#process-metrics) and is exported by most client libraries automatically (including [my own](https://unconj.ca/blog/introducing-openmetrics-for-r.html)).

You can add annotations like the one in the image above as follows, assuming you have a `namespace` and `pod` [template variable](https://grafana.com/docs/grafana/latest/variables/templates-and-variables/) defined:

![Adding process start time annotations in the Grafana web UI](https://unconj.ca/blog/images/create-start-time-annotation-in-grafana.png)

It’s important to understand that these annotations will show only when new processes are started, most likely because of a deployment but also during rescheduling, scaling, or a pod failure – but since it is likely that you’d want to know about those as well, perhaps that’s a good thing.
Senior Developer Advocate digs into Interviews, Promotions and Compensation
Tags: career, devrel
Published: 2020-05-21 23:59:56

[Alyss Noland](https://dev.to/preciselyalyss) is a senior developer advocate with years of juicy interview and career advice to share with candidates getting into developer relations and looking to level up. We get real about hiring processes, promotions and compensation.

Follow Alyss on
- Twitter https://twitter.com/PreciselyAlyss
- Dev.rel https://dev.to/preciselyalyss

DevRel career path resources: https://slack.engineering/defining-a-career-path-for-developer-relations-cf70257352dd

CANDIDATE PLANET:
Empowering candidates to ace interviews and negotiate offers. Leave a comment or email Lusen@CandidatePlanet.com with questions you want me to answer.

DANGOORMENDEL:
One-on-one success-based coaching for technical and tech-adjacent candidates applying to tech companies. We specialize in interview preparation and offer negotiation.

SALARY NEGOTIATION PLAYLIST ☆ https://www.youtube.com/playlist?list=PLY0uEDNh-Haqes9eEvyGtzrUWOHv-c1op

SUBSCRIBE:
☆ Youtube ☆ https://youtube.com/c/CandidatePlanet
☆ Newsletter ☆ https://dangoormendel.com/newsletter
☆ LinkedIn ☆ https://linkedin.com/in/lus

MORE INFO:
☆ Website ☆ https://dangoormendel.com
☆ Speaking Inquiries ☆ lusen@candidateplanet.com
☆ Client Inquiries ☆ hello@dangoormendel.com

{% youtube YG7YsOfNVHc %}
tsParticles family is now complete
Tags: news, showdev, javascript, typescript
Published: 2020-05-21 23:53:00

# tsParticles suite has become larger

tsParticles after plain Javascript and ReactJS with a 3rd party component now has its own jQuery, VueJS, ReactJS and Preact official packages, maintained with the main project.

## tsParticles ❤️ ReactJS ❤️ VueJS ❤️ Preact ❤️ jQuery

You can find all repositories here:

### Plain Javascript

The core library, every specific library wraps a component around this project.

[**tsParticles**](https://github.com/matteobruni/tsparticles)

#### What is tsParticles?

If you don't know this project, well... It's what particles.js should be if that project wasn't abandoned years ago. Lots of new features, many bugs fixed (particles.js has bugs, yes) and actively maintained.

Want to see some cool new features?

Check out this collection: https://codepen.io/collection/DPOage

### jQuery

The jQuery plugin for tsParticles

[**jquery-particles**](https://github.com/matteobruni/jquery-particles)

### VueJS

The VueJS component created with tsParticles

[**particles.vue**](https://github.com/matteobruni/particles.vue)

### ReactJS

The official ReactJS component wrapped around tsParticles

[**react-tsparticles**](https://github.com/matteobruni/react-tsparticles)

### Preact

The official Preact component wrapped around tsParticles

[**preact-particles**](https://github.com/matteobruni/preact-particles)

### Angular CLI

The official Angular CLI (Angular v9 for now) component wrapped around tsParticles

[**ng-particles**](https://github.com/matteobruni/ng-particles)
Creating a user registration System Using PHP and Mysql.
Tags: php, sql, regisrationsystem
Published: 2020-05-21 23:04:09


## Prerequisite
* PHP
* MySql
* PHP-MySql Connector
* Ubuntu (Or any Linux Distro)(Pre assuming apache2 is already installed.)

## Setting Up Environment

* **Step First:**
  Install **PHP** using this Command.
  
  ```
  sudo apt-get install php
  ```
  
* **Step Second:**
  Install **MySql** using this command.
  
  ```
  sudo apt-get install mysql
  
  ```
* **Step Third:**
  Install **MySql-Client** using this command.
  
  ```
  sudo apt-get install mysql-client
  
  ```
* **Step Fourth:**
  Install **PHP** and **MySql** Connector.
  
  ```
  sudo apt-get install php-mysql
  ```
 
 * **Step Fifth:**
     Open terminal and paste this command to open mysql databse;
     ```
     mysql -u root -p1234
 
     ```
 * **Step Sixth:**
     
     ```
     Create a **database**
     ```
     <br/>
     ```
     create database logindetails;
     
     ```
     <br/>
     ```
     use logindetails;
  
     ```
  * **Step Seventh:** 
      Create a table to store user data
  
      ```
  
       CREATE TABLE `users` (
      `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
      `username` varchar(100) NOT NULL,
      `email` varchar(100) NOT NULL,
      `password` varchar(100) NOT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1;


    ```
 * **Step Eighth:**
 
     Clone this [repository](https://github.com/priyaranjankumar/Login-SignUp-PHP-Mysql) and copy the registration folder to **/var/www/html/**
     ```
     sudo cp -r registration /var/www/html/
  
     ```
 
* **Step Nineth:**

    Restart the apache server
  
    ```
    sudo systemctl restart apache2
    ```
* **Step Tenth:**
    Open this URL in browser
    
    ```
    http://localhost/registration
    
    ```
  
   
   ## Click on sign up page to sign up for an account.
   
   
   </br>
   </br>
   
   ## Then sign back again with the username and password.
Don't comment what your code is doing, comment the Why
Tags: refactoring, improvement, cleancode, simplicity
Published: 2020-05-22 06:28:17

---
title: Don't comment what your code is doing, comment the Why
published: true
date: 2020-05-22 06:00:00 UTC
tags: refactoring, improvement, cleancode, simplicity
canonical_url: http://gsferreira.com/archive/2020/05/dont-comment-what-your-code-is-doing-comment-the-why/
---

Code comments are a common topic of love/hate discussions. It's particularly interesting to see developers shifting opinion while experience grows.

Code Comments are a good idea because we are writing them down to help others. Even to help the future self. But we use a lot of comments that don't help. This explains the Comments bad reputation nowadays.

So, what can we do to improve our comments?

I use a simple rule: **Explain the Why, not the What.**

I see a lot of Comments that are explaining what the code is doing. That doesn't help. 
The effort that we put to write a Comment must be invested refactoring the code ([this is a good starting point](https://gsferreira.com/archive/2019/10/a-simple-tip-to-improve-your-code-maintainability-decompose-if-statements-into-methods)). 
**When we need to describe the What is because the code isn't readable at all.**

It's also pretty common to have obvious Comments. All we have seen that _"// Get a Customer"_ comment in a _"GetCustomer"_ method.

Those comments don't bring value. They raise the cognitive load required to read and maintain the code.

So, the idea is to **let the code speak for himself**. We only write comments, when we need to explain Why we have done something.

It's useful to understand why a piece of code was written in a certain way. 
Those Why comments can help us out to understand that there's a particular corner case, or the reason for the followed approach, or that, because of a bug (Link the bug from the comment), we need to do that. 
Those are a few examples, but you get the point.

Our code must be self-describing, but sometimes, we need to explain the Why.

And remember: **don't Comment the code that you don't need anymore. Throw it away.** In case you need it, it will be at the source control.
Flutter Neumorphism
Tags: flutter, neumorphism, android, code
Published: 2020-05-21 22:58:37

A flutter web application for Neumorphic UI Dart code generation.



## My Final Project
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/coxtbh3rp3nvoso5m8zi.png)


## Link: https://flutterneumorphism.com
 

## Link to Code: 

`https://github.com/Neelansh-ns/Flutter-Neumorphism`

## How I built it 
Neumorphism is a new word for the new user interface trend. Since this is a hard word to pronounce, some people also say Soft UI.

Let us start with the root of the word “Neumorphic”. It is a combination of 2 words. Neu and Morphic: Neu: New + Morphic: a variant of Morphous, meaning having a specific shape or form. This word was also used in an old interface design trend called Skeumorphic.


## Additional Thoughts / Feelings / Stories
Neumorphic Flutter widgets code generator that will help with colors, gradients and shadows to adapt this new design trend or discover its posibilities.

If you like my project, don't forget to star the repo :)
linux : running on mac machine
Tags: linux, vagrant, mac, virtualmachine
Published: 2020-05-21 22:56:29

This is how I run linux in my machine.
I'm using brew for the installation.

## **1. Make sure brew is installed**
hit `brew --version` in the terminal to see if brew is installed already. If there is no brew installed, let’s just add it into our machine.
```
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```

## **2. Install VirtualBox**
Run this command to add VirtualBox in our machine
```
brew install cask virtual box
```
Then check the installation using this command `vboxmanage --version`

## **3. Install Vagrant**
Next, we will need Vagrant to help us running and getting in to the linux machine.
```
brew install vagrant
```
Then check the installation using `vagrant --version`

## **4. Let’s start the linux machine**
These are the main things to run linux. 

### - Creating a Virtual Machine
```
vagrant init <boxpath>
```
You can choose linux version that you want. go to this source [here](https://app.vagrantup.com/boxes/search).
In case we want to use ubuntu1804, we can type `vagrant init ubuntu/bionic64` .
This command will generate a Vagrantfile for us.

### - Starting a Virtual Machine
```
vagrant up
```
This command will start our linux machine in virtualbox. We can see if our machine is up already by typing this command.
```
vagrant status
```

### - Getting into a Virtual Machine
```
vagrant ssh <boxname>
```
In this case, we only use default Vagrantfile which is generated from `vagrant init <boxpath>` instead of set the box name. We can simply run `vagrant ssh` to get into out VM.
Welcome to linux machine !!

### - Stoping a Virtual Machine
```
vagrant halt
```
This will stop the VM. We can simply run `vagrant resume` to start the VM again.

### - Cleaning up a Virtual Machine
```
vagrant destroy
```
This command will delete the VM, and we need to run `vagrant up` if we want to run the Linux machine again.
Better recursions with Tail Call Optimization
Tags: tco, javascript, ts, optimisation
Published: 2020-05-21 22:54:50

On a beautiful day in the Shire, Bilbo Baggins is learning programming and was practicing recursions.

He wrote this code 
```
const fact = (num) =>{
  if(num === 1) return 1; // non-recursive base case
  return n * fact(n-1); // recursive part
}

```
So he ran it, it worked fine with 3 and 4.
But this curious headed little hobbit wants to check how long can it go.
He gave input of 100000 and

`RangeException:
               Maximum stack size exceeded`


He ran to seek help from Gandalf, then the wise wizard explained to him how stacks work.

``Whenever you call a function then it pushes a new frame on to the stack and once the operation of that frame is done then it is removed from the stack``

So the above code for input "4" would translate into this
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7h6orv3b4one0jd7jmoh.png)


Since the ram has a limited size and it allocates a little part of it whenever a program runs. Keeping this restriction in mind, when you run the same code with input "100000" the stack length increases and eventually reaches a point where it cannot add any new frames into it.

And now Bilbo asks `Master can we not optimize it?`

The Gray one smokes the pipe and says `Of course my old friend!`

**Tail Call Optimization**
``If the last thing a routine does before it returns is call another routine, rather than doing a jump-and-add-stack-frame immediately followed by a pop-stack-frame-and-return-to-caller. 
Tail call optimization reduces the space complexity of recursion from O(n) to O(1). Our function would require constant memory for execution. It does so by eliminating the need for having a separate stack frame for every call.``

So Gandalf rewrote the code 
```
 const fact = (num,acc = 1) => {
     if(num === 1) return acc;
     return fact(n-1,acc * n);
 }

```
Now the stack view looks something like

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

Here whenever you call the fact function instead of adding a new frame on to stack the frame is removed from the stack since it is the last thing to be done by it.
Day 2: Taking the time to really learn the basics. 
Tags: firstyearincode, beginners, css, codenewbie
Published: 2020-05-21 22:37:39

I think that a lot of developers mean well when they say that new coders shouldn't waste too much time doing things like trying to memorize css classes and html tags. I've read many articles where developers say that they regret all the time that they spent doing CSS challenges and trying to memorize good html markup. They say that they should have focused more on learning by applying and knowing that they could just look the entries up when they need. 

I think that this outlook should be taken with a grain of salt. Using the fact that most things can be searched on Stack Overflow when there's an issue, can be a powerful tool, but also become the crutch that newbie developers like me tend to rely on. This dangerously begins to feel like progress when in actuality, the sites that i'm creating aren't even semantically written, and that is a huge problem. See, the time that these developer's are saying they "wasted" wasn't actually wasted time. Even if they believe that they could've focused on other projects sooner, the extra time they took to go over the basic, menial, and "easy" code skills is what allowed them to work on their larger projects without having to worry about how to make a page responsive or whether to use flex or grid, because they know the skills and which work best like the back of their hand.

I want a job as bad as the next 20 year old broke guy does, but letting that wish and desire control my timing is what can really leave me with the huge gaps that I have in my knowledge. The funny thing is, here I am, beginning to code again from the start to truly learn the skills without rushing. Had I "wasted" my time by studying HTML and CSS earlier, maybe everything would've came a bit easier. 

I know that I said I would focus on my progress, but today I really wanted to just let anyone reading this know, don't <em> rush <em>. Take your time, learn the skills, and be patient. Your time will come, and when it does, no matter when it does, it will be right on time. That's what I am believing moving forward.
Journey Begins...
Tags: machinelearning, beginners
Published: 2020-05-21 22:26:41

Hi fellow programmers !! This is Mustafa. I am an 18 years old computer engineering student from India. Guys machine learning gets me excited, and when I saw videos of Code Bullet on Youtube, I knew I had to dig in and learn all about machine learning and AI. So recently I took a step towards my goal of becoming next Geoff Hinton and enrolled in Andrew Ng's class on Coursera.com. 

I've been introduced to terms like supervised, unsupervised, reinforcement learning and also recommender systems. So far, it seems exciting!!! By the end of the week, I'll make sure to be done with the second section which is linear algebra and linear regression with one variable. I don't how the journey ahead is going to be, but I think with this lovely community by my side, I won't ever be stopping when I get hit by a bump on this long road. 

So make sure to stick with this "Another" guy who wants to jump in machine learning's journey. And who knows one day you might be able to say that I followed Mustafa's blogs when no one else did and I soo am proud of him for what he's doing! Ahh, just kidding.

Wait for the blog that's going come next Friday. Signing off, this was Mustafa( Just "Another" guy who wants to learn machine learning.)
Fresh from #MSBuild - Deploy a static Hugo site with Azure Static Web App Service (Video Tutorial)
Tags: azure, beginners, github, cicd
Published: 2020-05-21 22:16:51

Fresh from Microsoft Build 2020, check out this quick tutorial on deploying a static hugo site.  You'll get some demo code featuring my best friend, Rico the pug, and steps to deploy the site.


{% youtube Ik9AfYKn-p0 %}


Here are some links to help you with this new service:

[Static Web Apps PREVIEW](https://cda.ms/1jH)
[$200 Free Azure!](https://cda.ms/1jL)
[Azure Static Web Apps documentation](https://cda.ms/1jJ)
[Tutorial: Publish a Hugo site to Azure Static Web Apps Preview](https://cda.ms/1jK)
[Rico Info Code](https://github.com/jaydestro/ricoinfo)
Stories with Astronomy Picture of the Day
Tags: githubsdp, vkontakte, nasa, stories
Published: 2020-05-21 22:10:48

Here's my story about the first project I made with GitHub. It was several months ago. I was learning Python and really want to do a practical things with it. 

And then an idea came to my mind. I'm Russian so the main social network here is VKontakte. Few years ago its developers boarded the hype train and added stories like Instagram and Snapchat ones.

Also I really love Astronomy Picture of the Day (APoD). It's a website made by NASA that publishes an image and a short caption of it every day. The idea I mentioned before was to post that picture automatically to VKontakte stories. 

Happily I found out that APoD has its own API. So with about fifty lines in Python the script was ready.

A free access to Digital Ocean for 10 months by GitHub Student Pack helped me here a lot. I've just used a promo code and uploaded the script to the server. And that's all!

That script is still working and publish APoD every day! And I've actually lost count how many people have written to me that these stories are the only interesting ones in their feed :)

P.S. An example published in stories is below.

![An example](https://dev-to-uploads.s3.amazonaws.com/i/7ua5mhzn82z3duftwqen.jpg)
SaveTheGarden: An Attempt to Rescue Small Businesses from the Effects of COVID-19
Tags: devgrad2020
Published: 2020-05-21 22:04:45

## Project Overview
As I watched COVID-19 slowly shape our everyday lives and constantly saw how it damaging its effects were I decided I needed to help somehow. After scouring the internet for ways I can use my technical skills to help fight the pandemic I stumbled upon a website called helpmainstreet.com; There mission was simple, by buying gift cards from small businesses we can essentially provide a "mini-loan" to these businesses so they can get much needed cash flow to keep the doors open. Seeing that these versions were only adopted for New York and San Francisco I decided to make one for my home state of New Jersey. The idea was simple, curate a list of all the small businesses I could find and very neatly put it on a NJ-themed website so loyal patrons can support their favorites businesses. 

Check it out here! https://savethegarden.net/
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9nsvudgavdejcqvieqzt.png)


#Link to Repo 
https://github.com/EddyYeung1/saveourfavesnj

## How I built it
The tech stack was pretty simple for this website. All I did was use React and GitHub Pages to host the site. I also implemented Google Analytics to track site traffic as well as engagement with the site. My favorite part about building this was working with my designers Eileen Zhang and Rebecca Fu. Both of them not being from New Jersey decided to help me anyways and design my entire site quickly and beautifully. It is amazing how much people are willing to help if you just ask because before this I did not know either of them. I also learned how to network with companies to help me out. Initially, I really struggled in figuring out how I was going to get a bunch of businesses from NJ and also getting their gift cards links, so thats when I reached out to the helpmainstreet team. In collaboration with a startup, Lunchbox, they gave me a list for NJ they already had and gave me the ability to populate my site with over 900 businesses. I was really grateful and happy that I was able to connect with so many great people and work together to collectively fight the pandemic from all corners of the United States. 


## Additional Thoughts
Now that I am graduated I hope to add more features to the website and find more ways to help the businesses in NJ. Hopefully, some of my ideas will inspire others to help out their own communities and get through this together.
N-gram Models for Code Completion in Pharo
Tags: octograd2020, computerscience, opensource
Published: 2020-05-21 22:02:43

## My Final Project
For my thesis, this semester I have been working on improving code completion in the Pharo IDE. It is an open source IDE meant for developing in Pharo, an object-oriented dynamically typed programming language inspired by Smalltalk. For the project I have been using n-gram models (in particular, unigram and bigram) to sort completion candidates and give more relevant suggestions.

## Link to Code
[https://github.com/myroslavarm/CompletionSorting](https://github.com/myroslavarm/CompletionSorting)

## How I built it
It has been quite a challenging task as I had to make a lot of design decisions, and apart from training the models, also implemented the sorting functionality to use the end results, and an evaluation tool to measure the accuracy and effectiveness of the implemented sorters.