teleren/devto huggingface dataset:
Without Reverting, Open old version of Code with Git | Git Tag
Tags: git
Published: 2022-10-07 22:44:28

Was your current merge to production buggy?
Do you want to go back to the previous version of code without reverting the changes?

## Switching to old version without Reverting

```sh
git checkout <commit id of the previous/old merge>
git checkout 893faa2a
```

What this does is that it shifts the HEAD to the old version of the code stored in git without making any changes to the commit history.


![Commit Checkout without Reverting](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rx33crjsry117zt0qp9k.png)

> The HEAD is in detached mode so you can make changes and commit them but they will not affect the branch
To keep the changes and commits, you can create a new branch by :
`git switch -c <new-branch-name>`

This look cool but, the problem arises when you have to remember the commit ids for the merge commits and it is a tedious task.

## Using Tags in Git

Git has a special feature of tagging the commits.
We can use this feature to tag our commits/merge commits as a version of the code.

### To add a tag to the current commit
```sh
git tag <name-of-the-tag>
git tag v1.4.0
```
### To add a tag to an old commit
```sh
git tag <name-of-the-tag> <commit-id>
git tag v1.3.0 893faa2a
```

### To list all tags

We can also list all the available tags in ascending order.

```sh
git tag
```

![Listing Available tags with Git](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ldwe61v0vc241yl4voxq.png)

Now that we have tagged our commits we can easily remember their names and checkout to them whenever we want without reverting the code.

## Switching to old version without Reverting using Tags

```sh
git checkout <tag-name>
git checkout v1.3.0
```

![Switching to old version of code without Reverting using Tags in Git](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wkg2870o00mcgb5zzjwz.png)


For More Info Visit

* [Git Tag Explained](https://www.freecodecamp.org/news/git-tag-explained-how-to-add-remove/)
* [Git-Tag](https://git-scm.com/docs/git-tag)
* [Git-Checkout](https://git-scm.com/docs/git-checkout)
Exercism #3: Amusement Park Exercise
Published: 2022-10-07 22:30:53

My code: 

```
class Attendee
  def initialize(height)
      @height = height
     # raise 'The provided height is outside acceptable limits'
  end
  def height
    @height
    # raise 'Implement the Attendee#height method'
  end
  def pass_id
  
    @pass_id
    # if pass_id = nil
    #   @pass_id = nil
    # else
    # @pass_id = pass_id
    # end
    
    # raise 'Implement the Attendee#pass_id method'
  end
  def issue_pass!(pass_id)
    
    @pass_id = pass_id
  end
  def revoke_pass!
    
    @pass_id = nil
    
    # raise 'Implement the Attendee#revoke_pass! method'
  end
end
```
Initializing is a method used to give a class a value off the bat. In the case of the Amusement Park exercise, you are providing a value to the _height_ variable


```
if pass_id = nil
   @pass_id = nil
else
   @pass_id = pass_id
end
```
This code initially worked because I was creating a new instance for pass_id, but was breaking the 4th test because it was preventing a value to be given to pass_id, it kept returning nil.

Things to remember:

1. MAKE SURE TO COMMENT OUT "raise" SO THAT IT WILL TEST PROPERLY

2. READ ALL OF THE INSTRUCTIONS MORE THAN ONCE AND TAKE NOTES
My first PR for Hacktoberfest
Published: 2022-10-07 22:07:30

Hi everyone,

This week I created my first ever [pull request](https://github.com/seths10/Quotes-Generator/pull/21) for Hacktoberfest. This was a new process for me, so I was pretty nervous. 

Finding an issue to work on was a long and tough process that took days. Originally, I had found two other issues that I wanted to work on, but they were completed before I got to submit my pull requests. I decided to look for a more simple issue to work on just so I could get my toes wet and chose this [repo](https://github.com/seths10/Quotes-Generator).

The [issue](https://github.com/seths10/Quotes-Generator/issues/18) was to add a copy to clipboard button on the website so that the user could copy a quote to their clipboard for use. To add this feature, I first created the button in HTML and added an icon to the button to make it look nice. Then I coded the button's functionality so that whenever the user clicks the button, the quote on the page would get copied. I made sure to follow the owner's coding style and to document my code. The owner of the repo approved my code with no changes. The issue was pretty easy to implement, but I'm glad I was able to really start my open source journey.
Can GitOps be worthy of implementation?
Tags: gitops, devops, productivity
Published: 2022-10-07 21:52:18

Depending on the DevOps model that an organization holds for delivering code into the production environment, considering velocity, complexity, money on the license that multiple tools may require, and block on development teams, it might be interesting to change the strategy to achieve the delivery goals most efficiently. GitOps came to automate and agile the DevOps processes.

By manual infrastructure management, it's meant that when it comes to setting up a new environment for an application, it is necessary to understand all the tools used, which can be, for example, WebSphere, ServiceNow, or UrbanCode.

Most of the time, rollback incidents on software using these tools are complex due to the need for rollback into many different places. The process can be exhausting as it can take a lot of time and also because it's not that simple to version the infrastructure, to set the environment as in previous states.

GitOps is a good solution for versioning infrastructure. It also comes with a new way of implementing infrastructure, which is: using code for it, CI/CD, implementing DevOps best practices, keeping collaboration, etc. For startups and small companies who just want to focus on developers or don't want to hire any more DevOps engineers, that's a way to take advantage of coding skills to embrace the operational side and level up the infrastructure.

Infrastructure as Code tools such as GitOps + Terraform is the perfect combination to use well-known programming languages to build infrastructure and maintain it easily with versioning on Git. Rollbacks are easy to perform and can be made, for example, from a merge.

Some other concepts are still involved with Infrastructure as Code, like the **difference between GitOps and ChatOps**. I'll leave the link for [CTO.ai's blog](https://cto.ai/blog/gitops-vs-chatops/) here in case you want to learn about the difference.

### Some examples of what you can do with GitOps:

- Use events such as pull requests and merges to trigger pipelines and initiate build or deployment processes.

- Versioning infrastructure as code so that you can switch 
between different configurations in multiple environments.

- Enable multiple applications to work with since the configuration will be all in one place.

Overall, there are several benefits in adopting GitOps for teams which the majority is composed of developers who are more familiar with Git and/or YAML. Teams will be able to deliver faster and more efficiently compared to manual processes or multi-tooling processes.
Some new features for Izyum
Tags: opensource, typescript, ssg
Published: 2022-10-07 21:46:32

Hi! Thanks for checking in. This week I worked on adding a new feature to another Static Site Generator [Izyum](https://github.com/Myrfion/izyum). It is written in TypeScript and CLI apps in TypeScript is something new for me, so let me tell you how it went.

## The feature

The feature I've been working on is support for config files.  

What this means is instead of having to write `izyum --input ../../textFiles/tests --output ./html/generatedHTML --language uk-UA`, you can gather all of these command options and store them in a `JSON` format. After that, you can call `izyum --config config.json`.

JSON parsing works as follows: for each key / value it will perform a command / argument, so `"input": "tests"` will be parsed as `--input tests` in command line.

## How it went

Interestingly enough, all went as smooth as it could be! 

Installation was easy enough, all thanks to [Myrfion](https://github.com/Myrfion)'s documentation.

The code was easy to read and understandable, so I filed an issue, forked the repo, created a new git branch, and started working. 

Implementing the feature wasn't hard, and soon enough I opened a pull request, which is now merged and my feature is officially a part of Izyum!
Stuff I've read, watched, and heard - #0
Tags: opensource, career, git, writing
Published: 2022-10-07 20:49:18

For a very long time, I've been fascinated by the idea of starting a technical blog but I didn't have the courage to do it, I grew up as a bookworm, reading was and still is my favorite hobby, and becoming a writer was my first childhood dream (pretty nerdy I know). I've been thinking about it lately and I've decided that I don't need to start big, I just need to start regardless, So here I am.

This is my first Article in a weekly series in which I'll share stuff I've read, watched, and heard throughout the week and found interesting and worth sharing.

## Stuff I've Read.
[How to Write a Good Commit Message](https://dev.to/chrissiemhrk/git-commit-message-5e21)
- I was getting ready to start contributing to Open Source and participating in [Hacktoberfest](https://hacktoberfest.com/) this month so I found this very useful, this article talks about how to write a meaningful commit message to make life easier for you and your teammates.
- Also check the comments to find more useful tips on how to write a good commit message.

[Authentication vs Authorization – What's the Difference?](https://www.freecodecamp.org/news/whats-the-difference-between-authentication-and-authorisation/)
- Authentication and Authorization can be easily confused. In this article, you will learn the difference between both of them and how each one works.

## Stuff I've Watched

[Show your Backend Engineering Skills To Recruiters - Building a Full Backend Portfolio
](https://youtu.be/nIracKeqsFk)
- This video provides 9 methods that you can use to show your backend engineering skills to recruiters.
- Note: If you're interested in backend engineering make sure to check [Hussein Nasser 
 Youtube Channel](https://www.youtube.com/c/HusseinNasser-software-engineering).

[HOW TO USE LINKEDIN AS A DEVELOPER to get a job in tech! How to network!
](https://youtu.be/SG5Sb5WTV_g)
- I've seen so many tweets on how this video helped a lot of people to get a job in tech so I've decided to give it a try, to be honest, it helped me to improve my LinkedIn profile although I think It's a little bit long.

## Stuff I've Heard
 
[Discipline Now .. Freedom Later](Link)
- I've been into Stoicism lately and The Daily Stoic is one of my favorite podcasts out there, this episode talks about discipline and the importance of being disciplined in today's world.

- Quote from the episode:
> At a critical moment in The Odyssey, Odysseus tied himself to the mast of his ship because he knew he wouldn’t be able to resist steering the ship toward the beautiful sound of the Sirens. In temporarily giving up his freedom, Odysseus became the first person ever to hear the Sirens without fatally crashing into the rocks surrounding the island where they lived.
---
Embracing Change.
Published: 2022-10-07 20:17:49

After about three days of learning javascript I began to wonder why WPF still exists. I'm almost embarrassed to say that I developed a WPF app from zero just a year and a half ago, but in my defense, that was the tech everyone was comfortable with where I was working. Also in my defense, my manager had some irrational fear of python, any python, all python, so I don't know how I would have written a back end even if I had made the right decision. Anyway, now that we're two weeks into this program, I realize that I'll likely never create a UI that's outside a browser again, and that's cool.  I'm okay with that. JS turns out to be a reasonably powerful tool, and using TypeScript has gotten me over my annoyance with un-typed languages. It's humbling on some level. I have a good amount of experience as a developer and starting from basically zero isn't great, but this is part of the job. Relational databases become no-sql databases, fat client apps become thinner and thinner until they're invisible, and everyone's development language of choice changes. I'm working on embracing the change - it's probably harder work than learning the technical details of the language.
Why Your Programming Skills will not gonna Obsolete as Fast as You ThinK! 😀😀
Tags: programming, study, computerscience, beginners
Published: 2022-10-07 19:42:07

As mentioned in my post that
That how I completed my postgrad recently.
I encounter a few things about learning comp sci and programming languages. 

As a part of my program, I have to learn several different programming languages like C, C++, PHP, Python, Java, etc. OR Databases such as Mysql. And Operating system. 

As I thought. I need to purchase new books to study to keep pace with my course. 

But after carefully going through all topics. I noticed I don't need to buy any resources to study Whichever few subjects such as python. I have all materials.

Even though my books were published 20 years before. **My Java complete reference **published in 2003.
 
It is still relevant for my academic study. As it covers 90℅ of portion. As I am not going to in detail as I have more than 14 subjects in my curriculum. Java is one of them. 

---


Here few points drawn as a conclusion. 

- Don't blindly run behind every programming language hot in the current market. 
FOCUS ON FUNDAMENTALS

- Most technologies evolve with time. It is not easy to replace with a new funky easy-to-use or learn technology stack or programming languages time-tested stack. 
For example, GO is a general-purpose language developed by google. But it can not suddenly, be replaced by C language overnight. It's a slow and tedious process. so go developers had to be patient as the market adopts it.

- After so many decades still, digital computers understand 0 & 1. Still, we can't use our natural language as a computer programming language. 
There are so many things that are the same. 
But It's nice to see what lies in the future. 

---



Some worthy classical mentions

1. Modern operating systems by Andrew S. Tanenbaum

2. Java: The Complete Reference by Herbert Schildt 

4. Head First C# by Andrew Stellman.


3. Let Us C by Yashwant Kanetkar

4. OBJECT ORIENTED Programming WITH C++ by E. Balagurusamy


Recently I read this amazing article which supports this argument.
https://www.toptal.com/c/after-all-these-years-the-world-is-still-powered-by-c-programming
What was your win this week?
Tags: discuss, weeklyretro
Published: 2022-10-07 20:06:20

---
title: What was your win this week?
published: true
description: Got to all your meetings on time? Started a new project? Fixed a tricky bug?
tags: discuss, weeklyretro
cover_image: https://cl.ly/188e843c2985/download/Image%202019-02-15%20at%202.36.37%20PM.png
---

Hey folks!

Hope everybody is having a fantastic Friday and that you all have wonderful weekends!

Looking back on this past week, what was something you were proud of accomplishing?

All wins count — big or small 🎉

Examples of 'wins' include:

- Starting a new project
- Fixing a tricky bug
- Goofing around with a friend 😆🤣

---

[It's Friday then, it's Saturday, Sunday, what?!](https://www.youtube.com/watch?v=1TewCPi92ro) 

![Dude from the popular It's Friday meme dancing up a storm outside of the car](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/crqvlo61n6g1lcfxlsj0.gif)
How to monitor long running ALTERS in AWS RDS MySQL 5.7+ using the Performance Schema
Tags: mysql, queries, rds, aws
Published: 2022-10-07 20:02:19

You've probably landed on this page because you have a MySQL RDS database that has one/many massive tables and anytime you run an `ALTER` it takes hours, maybe even days. Unfortunately, MySQL does not provide an easy way to monitor this and neither does RDS monitoring or RDS Performance Insights on AWS.


Luckily, since MySQL 5.7 there has been support for Progress information and that is implemented with the Performance Schema using the stage events. I recommend you read this excellent [article](https://mysql.wisborg.dk/2018/08/10/innodb-progress-information/) for a detailed explanation (and also a better way to do the below in MySQL 8). In this article I will focus on MySQL 5.7

So how do you do it on RDS?

1. Set `performance_schema` parameter to 1 in your database's parameter group (⚠Requires instance reboot so that parameter is applied)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gt8qqvvvzh39h1kpl202.png)
2. Once the parameter has been applied. Run the following queries
	```sql
	-- Enable events_stages_current to monitor threads
	UPDATE performance_schema.setup_consumers 
	SET ENABLED = 'YES' 
	WHERE NAME = 'events_stages_current';

	-- Check results of below to see that ENABLED 
	-- and EnabledWithHierarchy are both "YES"
	SELECT 
		NAME, 
		ENABLED, 
		sys.ps_is_consumer_enabled(NAME) AS EnabledWithHierarchy 
	FROM performance_schema.setup_consumers 
	WHERE NAME = 'events_stages_current';
	```
3. If the above works then you are good to go. You can now start an alter and execute this query to see its progress
	```sql
	SELECT 
		stmt.THREAD_ID, 
		stmt.SQL_TEXT, 
		stage.EVENT_NAME AS State,
	        stage.WORK_COMPLETED, 
		stage.WORK_ESTIMATED,
	  ROUND(100*stage.WORK_COMPLETED/stage.WORK_ESTIMATED, 2) AS CompletedPct
	FROM performance_schema.events_statements_current stmt
	INNER JOIN performance_schema.events_stages_current stage
	ON stage.THREAD_ID = stmt.THREAD_ID
	AND stage.NESTING_EVENT_ID = stmt.EVENT_ID

	-- ALTERNATIVELY
	----------------
	-- SELECT 
	-- 	thd_id, 
	--     conn_id, 
	--     db, 
	--     command, 
	--     state, 
	--     current_statement,
	-- 	   statement_latency, 
	--     progress, 
	--     current_memory, 
	--     program_name
	-- FROM sys.session
	-- WHERE progress IS NOT NULL;
	```
4. You should see something like this (where `WORK_COMPLETED` is how many rows have been altered and `WORK_ESTIMATED` is how many rows are left to alter and `CompletedPct` is the completion percent). Run this query everytine you need to see the updated values.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j92j2at7cmzq6f1jyfre.png)

And that's it -- hopefully now you can monitor long running queries on an RDS database!


-------
Hi I'm [Emmanuel](https://emmanuelnk.com)! I write about software, AWS and DevOps.

If you liked this article and want to see more, add me on [LinkedIn](https://www.linkedin.com/in/emmanuel-nsubuga-kyeyune/) or follow me on [Twitter](https://twitter.com/emmanuel_n_k)
HASH S: .KEYS AND .KEY
Published: 2022-10-07 19:29:37

THIS WEEK WEEK HAS BEEN CHALLENGING WITH UNDERSTANDING THE HASHE S. HOWEVER, THE DIFFERENCE BETWEEN .KEYS AND .KEYS BECAME EVIDENT AND USEFUL: .KEYS SHOWS ALL THE KEYS IN A HASH SO WE KNOW WHAT TO .FETCH.
.KEY IS THE INVERSE OF .FETCH, WHEREIN .KEY RUNS THROUGH ALL THE VALUES AND RETURNS THE KEY WHERE IT RESIDES IN THE HASH.
In One Minute : Redis
Tags: redis, beginners, programming, oneminute
Published: 2022-10-07 19:14:06

Redis (Remote Dictionary Server)

Redis is an in-memory data structure store, used as a distributed, in-memory key–value database, cache and message broker, with optional durability. 

{% embed https://youtu.be/uRGD7itqIJY %}

Redis supports different kinds of abstract data structures, such as strings, lists, maps, sets, sorted sets, HyperLogLogs, bitmaps, streams, and spatial indices. The project was developed and maintained by Salvatore Sanfilippo, starting in 2009.

Redis popularized the idea of a system that can be considered a store and a cache at the same time. It was designed so that data is always modified and read from the main computer memory, but also stored on disk in a format that is unsuitable for random data access.

According to monthly DB-Engines rankings, Redis is often the most popular key–value database. Redis has also been ranked the #4 NoSQL database in user satisfaction and market presence based on user reviews, the most popular NoSQL database in containers.

Official website : https://redis.io/
assignment
Published: 2022-10-07 19:12:14

##Write a Python program that will ask the user to enter a word as an input. 
● If the length of the input string is less than 4, then your program should print the same 
string as an output. 
● If the input string’s length is greater than 3, then your program should add "er" at the end 
of the input string. 
● If the input string already ends with "er", then add "est" instead, regardless of the length 
of the input string
● If the input string already ends with "est", then your program should print the same input 
string as an output.


########################
#include <iostream>
using namespace std;


int main() {
    string a;
    cin>>a;
    string e;
    int i =a.length()-1;
    int j =a.length()-2;
    int k =a.length()-3;
    if (a.length()<4){
        if (a[i]=='r' and a[j]=='e'){
            e=a.substr(0,j);
            cout<<e+"est";
        }
        else{
            cout<<a;
        }
    }
    else if (a.length()>3){
        if (a[i]=='r' and a[j]=='e'){
            e=a.substr(0,j);
            cout<<e+"est";
        }
        else if(a[i]=='t' and a[j]=='s'){
            if(a[k]=='e'){
                cout<<a;
            }
            else{
                ;
            }
        }
        else{
            cout<<a+"er";
        }
    }
    

    return 0;

###################
Write a program that takes a string as input and prints “Binary Number” if the string contains 
only 0s or 1s. Otherwise, print “Not a Binary Number”.
####################
#include<iostream>
using namespace std;
int main(){
    string a;
    cin>>a;
    int flag=0;
    
    
    for(int i=0;i<=a.length();i++){
        if (a[i]=='1' or a[i]=='0'){
            flag=flag+1;
        }
    }
    if (flag==a.length()){
        cout<<"binary";
    }
    else{
        cout<<"not binary";
    }
    
    
    return 0;
}
}
##############################Write a Python program that will ask the user to input a string (containing exactly one word). 
Then your program should print subsequent substrings of the given string as shown in the 
examples below

##################################
#include <iostream>
using namespace std;

int main() {
    string a;
    cin>>a;
    string e;
    for(int i =0;i<=a.length();i++){
        e=a.substr(0,i);
        cout<<e<<endl;
    }

    return 0;
#######################
Write a Python program that will ask the user to input a string (containing exactly one word). 
Then print the ASCII code for each character in the String using the ord() function. 
To check if your program is working correctly or not, you can find a list of all correct values 
from the following website. You may look at “Dec” and “Char” columns only and ignore the 
other columns for this problem.


##########################################
#include <iostream>
using namespace std;

int main() {
    string a;
    cin>>a;
    char b=' ';
    for (int i =0;i<=a.length();i++){
        b=a[i];
        cout<<(int)b<<endl;
        b=' ';
    }

    return 0;
}