<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Danstan-O</title>
    <description>The latest articles on DEV Community by Danstan-O (@danstano).</description>
    <link>https://dev.to/danstano</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1007805%2F3efab097-6d27-40cb-84ac-87a2ae4e0b9f.png</url>
      <title>DEV Community: Danstan-O</title>
      <link>https://dev.to/danstano</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/danstano"/>
    <language>en</language>
    <item>
      <title>How to Create and update your Github Personal Token Issue</title>
      <dc:creator>Danstan-O</dc:creator>
      <pubDate>Fri, 05 May 2023 16:22:04 +0000</pubDate>
      <link>https://dev.to/danstano/how-to-create-and-update-your-github-personal-token-issue-26m6</link>
      <guid>https://dev.to/danstano/how-to-create-and-update-your-github-personal-token-issue-26m6</guid>
      <description>&lt;h2&gt;
  
  
  1. Creating a personal acccess Token token
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Disclaimer: a personal access token should be treated as a password to GitHub.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;GitHub supports two types of personal access tokens;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Fine-frained personal access tokens.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Personal access tokens (classic).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Github recommends that you use fine-grained personal access tokens instead of personal access tokens(classic) whenever possible.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can follow the instructions in the link provided in references on how to generate an access token.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Updating an expired token
&lt;/h2&gt;

&lt;p&gt;If you have a token that you have been using and it expires you can run the command &lt;code&gt;git remote -v&lt;/code&gt;. This command shows you your current origin which will look like;&lt;br&gt;
&lt;code&gt;https://[PERSONALACCESSTOKEN]@github.com/[USERNAME]/[REPO].git&lt;/code&gt;.&lt;br&gt;
There are two steps to update a expired token;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;First, you have to remove the expired token by running the command &lt;code&gt;git remote remove origin&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After removing the expired token you can run the command &lt;code&gt;git remote -v&lt;/code&gt; to confirm that your token has been removed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You now need to generate a new token following the steps highlighted in the creating a new token. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After creating a new token you need a to add a remote with your updated Github personal access token.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can add it using the command git remote add origin + your new generated token as follows; &lt;code&gt;git remote add origin https://[PERSONALACCESSTOKEN]@github.com/[USERNAME]/[REPO].git&lt;/code&gt; and you are done.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token"&gt;Creating a personal access token&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>github</category>
      <category>git</category>
    </item>
    <item>
      <title>Introduction to static libraries in C programming language.</title>
      <dc:creator>Danstan-O</dc:creator>
      <pubDate>Sun, 09 Apr 2023 21:36:00 +0000</pubDate>
      <link>https://dev.to/danstano/introduction-to-static-libraries-in-c-programming-language-25n0</link>
      <guid>https://dev.to/danstano/introduction-to-static-libraries-in-c-programming-language-25n0</guid>
      <description>&lt;h2&gt;
  
  
  WHAT IS A STATIC LIBRARY
&lt;/h2&gt;

&lt;p&gt;A library is a collection of already build functions, variables, classes and anything that should make your code run. You can use the code in your program without knowing how it's declared.&lt;br&gt;
Static libraries are a collection of object files that are linked into the program during the linking phase.&lt;/p&gt;
&lt;h2&gt;
  
  
  HOW TO CREATE A STATIC LIBRARY
&lt;/h2&gt;

&lt;p&gt;We first need to create a normal c file. After creating the c file define all the functions needed in that file.&lt;br&gt;
After our functions have been defined we create a header file that will be used to store all the prototypes that will be needed in our program.&lt;br&gt;
The header file should have a .h file extension. &lt;br&gt;
The following code should be included in our main.h file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#ifndef MAIN_H
#define MAIN_H


#endif
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  A WALK THROUGH EXAMPLE
&lt;/h2&gt;

&lt;p&gt;I will create 2  c files and use them to demonstate the concepts described above. The file names will be monalisa.c and sum.c. We also have to create the main.c file which will act as our main entry point to the program.&lt;br&gt;
The monalisa.c file will have the following code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
#include "main.h"

/**
 * monalisa - file returns a print statement
 * Return: returns 0
 */

void monalisa(void)
{
printf("Welcome home, Kid\n");
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The sum.c file can have the following snippet&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
#include "main.h"

/**
 * sum - adds up two integers
 * @z: our first input value
 * @y: our second input value
 * Return: returns the sum of two integers
 */

int sum(int y, int z)
{
int sum;
sum = y + z;
printf("The sum of the two integers is: %d\n", sum);
return (sum);
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;our main.c file can have the following piece of code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include "main.h"

/**
 * main - the major entry point
 * Return: it returns a 0
 */

int main(void)
{
monalisa();
sum(1, 2);
return (0);
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and finally our main.h file will have the following piece of code that will contain our prototypes and will be used to call the monalisa and sum functions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#ifndef MAIN_H
#define MAIN_H

void monalisa(void);
int sum(int y, int z);


#endif

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Running the command 'gcc -c *.c' generates all the .o files from the .c files that will be in the current directory.&lt;/p&gt;

&lt;p&gt;We can then create a library named lib.a with the command&lt;br&gt;
'ar rcs lib.a'&lt;/p&gt;

&lt;p&gt;After creating the library we run the command 'ar rcs lib.a *.o' which helps move copies of every .o files into our  library.&lt;br&gt;
Note: The s flag tells the ar command to add an index to the archive or update it if the index already exists.&lt;br&gt;
This can also be achieved by running the command 'ranlib lib.a' after generating the .o files.&lt;/p&gt;

&lt;p&gt;After indexing our library we can run the commandn 'ar  -t lib.a' to see if our file is indexed properly.&lt;br&gt;
Finally we run the ' nm lib.a' command to list all the symbols of the files that we have and from this we can see the files that we were unable to link into our object file. &lt;/p&gt;
&lt;h2&gt;
  
  
  TOP TIP
&lt;/h2&gt;

&lt;p&gt;We can create an executable file script that can be used to automate the process of generating .o library files.&lt;br&gt;
Create a file named static_lib.sh and put the following code in it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
gcc -c *.c
ar rc bilan.a *.o
ranlib bilan.a
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After writing the code you can make the file executable by running the following command.&lt;/p&gt;

&lt;p&gt;chmod u+x static_lib.sh&lt;/p&gt;

&lt;p&gt;The above script creates a static library called bilan.a from all the .c files that are in our current directory.&lt;/p&gt;

&lt;p&gt;After creating an executable file we run the following commmand on the terminal to test our executable and add all the .o files that will have been generated from the .c files into our library named bilan.a&lt;br&gt;
./create_static_lib.sh&lt;/p&gt;

&lt;p&gt;All the libaries have a .a exentionj to them.&lt;/p&gt;

&lt;p&gt;By Oduor.&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>programming</category>
    </item>
    <item>
      <title>Contributing to an open source tech project on github.</title>
      <dc:creator>Danstan-O</dc:creator>
      <pubDate>Sun, 05 Feb 2023 16:30:24 +0000</pubDate>
      <link>https://dev.to/danstano/contributing-to-an-open-source-tech-project-on-github-381b</link>
      <guid>https://dev.to/danstano/contributing-to-an-open-source-tech-project-on-github-381b</guid>
      <description>&lt;p&gt;In this article I am  going to talk about some of the advantages of contributing to open source projects and how you can start doing it. &lt;/p&gt;

&lt;h2&gt;
  
  
  Advantages of contributing to an open source project
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It helps you build the muscle power needed in programming by giving you different projects to work on.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It helps you learn new skills, tools and different programming technologies.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It builds your reputation and you can showcase the contributions to prospecting employers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It helps you meet new people.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the process of meeting new people you get to improve on your communication skills as an individual.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Since you are now convinced of why you should start contributing to open source projects, how can you start doing that?&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Identify a project that you are interested in.
&lt;/h3&gt;

&lt;p&gt;The first thing that you need to do is identify a project that excites you among the many projects that the community maybe working on. You can do this by going to your community's homepage on github or gitlab.&lt;br&gt;
i.e In this article I will be using the github as my primary reference. &lt;/p&gt;

&lt;h3&gt;
  
  
  2. Fork the repository
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzgqajrq0707eabm94zyb.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzgqajrq0707eabm94zyb.jpeg" alt="forking the parent repo tab" width="800" height="525"&gt;&lt;/a&gt;&lt;br&gt;
This will give you your own cpy of the repo that you can manipulate when working on the project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Clone the repository
&lt;/h3&gt;

&lt;p&gt;Since git collaboration is an advanced feature when working with git I will assume that you are familiar with this step and I will jump right into you going to get an issue you will be working on.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting an issue.
&lt;/h3&gt;

&lt;p&gt;An issue is a feature that you will try to implement and see that it's functionalities work as it was intended in the initial design. An issue will come with an explanation of where you need to place the components needed in achieving the desired feature, how the feature should look like and sometimes a link to the project design.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbbswielkfyw5n20x5v3o.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbbswielkfyw5n20x5v3o.jpeg" alt="issue tab" width="800" height="597"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Issues are taken from the parent repository where you forked the project and they are continuously updated by the project lead.&lt;br&gt;
When you have picked an issue that you want to work on you can leave a comment to tell everyone that you will be working on that issue and they can choose something else to work on.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating a pull request
&lt;/h3&gt;

&lt;p&gt;After working on an issue and being confident that your code works as intended you have to commit the changes and push the code to github.&lt;br&gt;
After pushing the code you go to github and create a new pull request so that your work can be reviewed and get merged to the main project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvgnrwavqfnkpblwduty3.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvgnrwavqfnkpblwduty3.jpeg" alt="new pull button" width="800" height="453"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After creating a pull request you can notify someone to review your changes on github.&lt;/p&gt;

&lt;h3&gt;
  
  
  What happens when changes have been merged.
&lt;/h3&gt;

&lt;p&gt;After a contributors changes have been reviewed and merged to the main project you have to sync your forked repository with the main repository.&lt;br&gt;
You can do this by going to the github repository that you forked and syncing the fork.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F026ii5tkbj77zjsqrrhb.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F026ii5tkbj77zjsqrrhb.jpeg" alt="sync fork icon" width="800" height="567"&gt;&lt;/a&gt;&lt;br&gt;
After this you have to do a &lt;code&gt;git pull&lt;/code&gt; on the terminal to get the changes locally on your machine then you can continue working on the project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Extra tip
&lt;/h3&gt;

&lt;p&gt;When making commits to github you can add some descriptive emoji just to spice things up and also make the person reviewing the code have an idea of what you were doing even before looking at the code or the comment sent.&lt;br&gt;
Here is a link to gitmoji that can help you achieve sending emojis when doing your commits.&lt;br&gt;
&lt;a href="https://gitmoji.dev/" rel="noopener noreferrer"&gt;gitmoji link&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;For example, after updating your readme file you can commit something like: " 📝 updated my readme file"&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;br&gt;
Have a lovely time!&lt;/p&gt;

</description>
      <category>announcement</category>
      <category>devto</category>
      <category>contributorswanted</category>
      <category>royalties</category>
    </item>
  </channel>
</rss>
