teleren/devto huggingface dataset:
C Static Libraries
Tags: c, computerscience, programming, linux
Published: 2022-03-01 08:14:57

## What is a static library?
A **static library** is an archive file containing object files that remain static until the program is recompiled. This static library can be used as a single entity in a linking phase of a program.

## Why do we use libraries?
Using a static library means only one object file needs to be pulled in during the linking phase. This speeds up the linking phase because there are fewer files to process. The benefit of using a static library is that the functions and other symbols loaded into it are indexed. For this reason, linking a program whose object files are ordered in libraries is faster than linking a program whose object files are separate on the disk.

## How to create them?
First of all, we include all function prototypes of .c files into the header file:

```
#ifndef MAIN_H
#define MAIN_H

/* all function prototypes */

#endif
```
Then we compile .c files with `gcc -c` command. After this process, we will have .c files compiled into object files '.o' which are necessary for the library.

The next step now is to create an archive file(static library) with object files '.o' and for this step, we use the command below:

```
ar -rc libexample.a *.o
```

- *ar* is a UNIX command for creating and maintaining library archives
- *-r* is used to replace or add files to archive
- *-c* is used to create a new archive file
- *libexample.a* is the name of the file with the extension '.a' which stands for archive
- And the final step of the command is the selection of all object files

## How to use them?
After creating the library (archive file) we use it in a program.
```
gcc filename.c -L . -lexample -o filename
```
- *gcc* (GNU Compiler Collection) - command to compile C files
- filename - name of the file
- *-L .* - tell the linker that the libraries might be found in the  current directory '.'
- *-l* - links the C file with the library file
- example - the name of the static library (check notes at the end of the article)
- *-o* is used to change the name of the executable file
- *filename* - the name of the executable file

## Conclusion
This was a basic explanation of what is a static library, how to create and use them. Hope you find it useful.

### Notes
We omitted the "lib" and ".a" when mentioning the library on the link command. The linker attaches these parts back to the name of the library to create a name of the file to look for.
A Quick 10-Second Programming Joke For Today
Tags: jokes, dailydeveloperjokes
Published: 2022-03-01 08:00:28

---
title: "A Quick 10-Second Programming Joke For Today"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
published: true
tags: #jokes, #dailydeveloperjokes
---

Hi there! Here's today's Daily Developer Joke. We hope you enjoy it; it's a good one.

![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12593b1b51e.png)

---

For more jokes, and to submit your own joke to get featured, check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/). We're also open sourced, so feel free to view [our GitHub Profile](https://github.com/dailydeveloperjokes).

### Leave this post a ❤️ if you liked today's joke, and stay tuned for tomorrow's joke too!

_This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit._

<!--
Joke text:
A programmer was arrested for writing unreadable code. They refused to comment.
 -->
Wordyl - Yet another Wordle clone!
Tags: javascript, react, tailwindcss, webdev
Published: 2022-03-01 07:58:15

After my first React project - [Pokedex](https://github.com/s1varam/pokedex), it took a while before starting the next one. This time I made sure to learn and use **functional components**, since I used classes in the former one. Initially, I was so hesitant in switching to hooks, but once I got the hang of it, I found it to be easier than classes. 

Now - what to build? Since I wanted to get familiar with hooks, I didn't want to build something complex. Hence I chose to build **[WORDYL](https://wordyll.netlify.app/)** - a simple clone of the sensational game everyone's playing right now (Wordle). Since I used _Material UI_ in my previous app, I wanted to try something new and hence opted for _Tailwind CSS_.

<u>What I built:</u>
1. _Components_ : Gameboard (parent component that includes all the child components), Header, Keyboard, Letter-Tile, Modals.
2. Used _useState_, _useEffect_ and _useContext_ hooks.
3. Used word list from the og Wordle.
4. Application theme based on device theme using _useContext_ and _ThemeProvider_. Can also be changed manually.
5. Doesn't have all functionalities of the og game like sharing guesses/ one day timer.
6. Can be played unlimited number of times by hitting reset button.
7. Stats displayed in the form of a graph - used _ChartJS_.
8. Fancy confetti popup after guessing the correct word (_react-confetti_).
9. Used _compare-words_ npm package for comparing words.
10. Data is stored in _localStorage_ - so if site data is cleared, the progress would be lost.
11. Used very minimal CSS in the places I found Tailwind to be a bit difficult.
12. Used _cogo-toast_ npm package for displaying toast messages.
13. Responsive design.
14. Tried using _Framer Motion_ and _Animate.css_ packages for animations, but unfortunately was unable to get them working as expected :/

Some snapshots of the application:

![Game](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0glu60u4ehb6xolgaj78.png)

![Stats view](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x8cc2pnqbu66x5jsk58z.PNG)

<u>To-dos:</u>
1. Extend 5 letter words to more.
2. Use keyboard for typing words.
3. Add animations (like shake, pulse and reveal)
4. Share progress
5. Persistent user-data storage

You can find the source code [here](https://github.com/s1varam/wordyl) and you can play it [here](https://wordyll.netlify.app/). Do star the repo if you like it! Suggestions are most welcome!
[Azure Trial Hackathon Submission Post Placeholder Title]
Tags: azuretrialhack
Published: 2022-03-01 07:57:57

[Instructions]: # (To submit to the Microsoft Azure Trial Hackathon on DEV, please fill out all sections.)


### Overview of My Submission
[Note]: # (Please make sure the project links to the appropriate GitHub repository, and includes the [Apache-2 permissive license](https://www.apache.org/licenses/LICENSE-2.0)  and README.)


### Submission Category: 

[Note]: # (AI Aces, Computing Captains, Low-Code Legends, Java Jackpot, or Wacky Wildcards:)


### Link to Code on GitHub

[Note]: # (Our markdown editor supports pretty embeds. Try this syntax: `{% github link_to_your_repo %}` to share a GitHub repository)
[Note]: # (Your repository must include a README)
[Note]: # (You must use and list a permissive license for your code: MIT, Apache-2)


### Additional Resources / Info

[Note:] # Screenshots/demo videos are encouraged!

[Note]: # (Be sure to include the DEV usernames of your collaborators, if any. Prizes for winning projects with multiple collaborators will be sent to the person who posts this submission and they will distribute the prize evenly. DEV will not split prizes as per our rules)

[Reminder]: # (Submissions are due on March 8, 2022 @ 11:59 PM UTC)
Weekly 001
Tags: weeklyretro
Published: 2022-03-01 07:50:45

### Monday

Today, with my team, we went all together in Bern for our Monthly Breakfast Day.
We spent the morning in a restaurant for the breakfast and then we had a good meeting about the team and the status of our projects.

### Tuesday

I worked very hard on our product called “Red Origin”. We are close to the first release in production for our first customer.
I struggled a lot with Entity Framework because in these days I changed a lot of entities in our project and sometimes EF was not able to change the database directly and I have to recreate a new one from scratch.
It’s annoying.

### Wednesday

In the morning I worked on Red Origin, as always, and in the afternoon I arranged some slides for my first event for Azure DevOps Community in Zurich.

I talked about one of my favorite topic in the last few years: GitHub Codespaces.

At 18, I started with the live event.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fdqk20w5v4d78i2f1mzi.jpeg)
 
### Thursday

In the morning I did a presentation of Red Origin to a new potential customer. It went very well and I think they should be another customer in the future.
In the afternoon I delivered a live session with Diana Bernabei about the Accessibility of the web application.

https://www.ugidotnet.org/tv/episodio/2921/Ask-Me-Anything/Accessibilit%C3%A0-from-a-software-developer-s-perspective

In the afternoon I posted on my blog about deleting all tables from an Azure SQL Database, created by EF: https://dev.to/kasuken/drop-all-tables-and-reset-an-azure-sql-database-59oo

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/35bsbhvr3rp01w45cuw3.png)
 
### Friday

Friday was a very long day. I started to work very early in the morning because it was the release day!
Every time I am wondering why release a product is very hard. At the beginning everything works fine, but the very hard part is the last mile.
By the way we released the version 5.0 (and I have a plan to release an update at the beginning of the next week).
A colleague of mine helped me a lot to find bugs (especially in the UI).
As a developer I didn’t see a lot of them, even they were very clear.
At lunch I delivered another session about GitHub Codespaces. I enjoyed the session a lot and it was the first time for me to collaborate with the Austrian Developer Community.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q3czsqj6jqgatg4ix1so.png)
Static files not reading the .env file in a node js server
Tags: javascript, react, node, env
Published: 2022-03-01 07:48:49

I have a react app that i was able to build into static files which i then added to my node js app. after installing `dotenv` and adding `require('dotenv').config()` to `server.js` in the node server application. The following peice of code i had in the react application does not seem to be working now although the static files are being rendered in the browser just fine.


```
let node_server_url;
//TODO
// set the NODE_ENV on the .env file.
// create the .env file on the root of the project and add a NODE_ENV on the file
// e.g NODE_ENV=development or NODE_ENV=production

let urlConfig = (process.env.NODE_ENV === "production") ? {
    urlBackend: `https://mybluebookloanuat.bayportbotswana.com`,
} : {
    // urlBackend: `http://10.16.32.22:5000`,
    urlBackend: `http://localhost:5003`,
}

// eslint-disable-next-line
export default node_server_url = urlConfig.urlBackend;
```
i want to be able to just set up in the `.env` file the address for deverlopment and for production in the node server app. Can someone help me
Revue de Presse Cloud #3
Tags: sfeir, cloud, microsoft, gcp
Published: 2022-03-01 07:36:28

Le comité Cloud de SFEIR s’est réuni pour vous préparer leur revue de presse mensuelle ! 

Nous vous avons sélectionné les articles et news à ne pas louper ces dernières semaines dans l’univers Cloud 

Bonne lecture ! 

***

### [Faire de votre cluster Kubeadm, un vrai simulateur accessible à distance](https://blog.filador.fr/faire-de-votre-cluster-kubeadm-un-vrai-simulateur-accessible-a-distance/)

Cet article vous montre comment rendre votre cluster Kubeadm accessible à distance à travers son API kubeapi-server et aussi comment alimenter votre cluster de scripts qui permettent d'en faire un vrai simulateur

### Trois articles pour gérer ses coûts Azure
[Article 1](https://azure.microsoft.com/en-gb/blog/save-big-by-using-your-onpremises-licenses-on-azure/) [Article 2](https://www.codeguru.com/azure/budget-configure-alerts-azure/) [Article 3](https://azure.microsoft.com/en-gb/blog/rightsize-to-maximize-your-cloud-investment-with-microsoft-azure/)

Ces articles vont vous aider à gérer vos coûts Azure en configurant votre budget et vos alertes dans Azure ainsi qu'en réduisant les frais de licenses en réutilisant vos licences on-premises, et en choisissant la bonne taille de ressources.

### [Azure Spring Cloud Enterprise est disponible en preview](https://azure.microsoft.com/en-gb/blog/azure-spring-cloud-enterprise-is-now-available-in-preview/)
Découvrez l'offre Azure pour hoster vos applications Spring Boot dans Azure Spring Boot

### [J'ai pas de carte graphique et je veux jouer sur mon PC.](https://www.youtube.com/watch?v=_UrzJBp7Vsw)
How2 : déployer une VM sur Azure (sans trop se poser de questions...), la configurer et en déporter l'affichage pour jouer. 

### [The Cloud Waste Problem: How to Stop Overprovisioning Resources in 2022](https://dev.to/castai/the-cloud-waste-problem-how-to-stop-overprovisioning-resources-in-2022-5daf)
Un article simple qui donne des chiffres sur le sur provisionning de ressources notamment avec Kubernetes, et quelques solutions simples pour réduire les coûts.


***

### SFEIR Institue - Cloud 

SFEIR Institute fournit aux entreprises des solutions de formation sur les technologies de pointe. Tous les mois, le comité Cloud met en avant l’une de ses SFEIR Institute.
Ce mois-ci, nous vous proposons cette formation gratuite 
Elle portera sur Google Cloud Fundamentals – Core Infrastructure avec Jérôme Nahelou.
RDV le 31 mars de 9h à 18h 👇
Inscriptions et informations ici : https://www.sfeir.com/fr/sfeir-institute-google-cloud-fundamentals-core-infrastructure-free/

### CFP et évènements en France

Plusieurs évènements tech ont annoncé leur retour en 2022 et leurs Call for Paper sont ouverts ! C’est le moment de proposer vos talk

- [DevFest Lille](https://conference-hall.io/public/event/vzbfowsExm54SrWLtxA5) le 10 juin 2022 ! 
- [Voxxed Days](https://cfp-voxxed-lux.yajug.org/) 21-22 juin 2022

***

Romain Boulanger
Sébastien Roux
Grégory Kieffer
Antoine Méausoone

***

Merci à la communauté Cloud de SFEIR pour cette revue de presse !
How to count duplicate value in an array in javascaript
Tags: javascript, tutorial, programming, webdev
Published: 2022-03-01 07:03:55

const votes = ['Yes', 'Yes', 'Yes', 'No', 'No', 'Absent'];

const result = votes.reduce((prevValue, vote) => {
    if (prevValue[vote]) {
        prevValue[vote]++;
    } else {
        prevValue[vote] = 1;
    }
    return prevValue;
}, {});

console.log(result);

Output: { Yes: 3, No: 2, Absent: 1 }
Enable Remote Access to Kibana and Elasticsearch in Same Network
Tags: elk, kibana, elasticsearch, log
Published: 2022-03-01 07:00:28

Hello there,
Welcome to guide to enabling remote access to Kibana and Elasticsearch from a machine to another machine in the same network. Let's get started.

First of all you have to edit "**elasticsearch.yml**" file. 
```
nano /etc/elasticsearch/elasticsearch.yml
```
It should look like this:
```
transport.host: localhost 
transport.tcp.port: 9300 
http.port: 9200
network.host: 0.0.0.0
```
"network.host" line must be "0.0.0.0" to allow remote access.
You must restart the service to make configuration work.
```
sudo systemctl restart elasticsearch
```


And then you have to edit Kibana's config file which names as "kibana.yml"
```
nano /etc/kibana/kibana.yml
```
It should look like this:
```
server.port: 5601
server.host: "X.X.X.X" (Kibana server's IP address)
```
You must restart the service to make configuration work.
```
sudo systemctl restart kibana
```

After that editing part, then you will be able to access Kibana's Dashboard on a web browser with this:
```
http://X.X.X.X:5601
```
X.X.X.X is your Kibana server's IP address

Hope it would be helpful :)
Create a CICD Pipeline using GitHub, CodeBuild, CodeDeploy Part-2
Tags: aws, devops, cicd, github
Published: 2022-03-01 06:55:57

**Pre-requisites:**
-	Clone the source code required for this demo from the github.

**Link**: https://github.com/nidhi2802/code_deploy_demo
-	Create your own github repository and push the downloaded code in your repository.

**Architecture**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lpzhautvn28rj3hoij1h.png)

## Step 1: Create required IAM Roles
-	Create role for EC2 instance with permissions for CodeDeploy and S3 access to download the code.
-	Create a role for CodeDeploy service with permissions to access S3 and basic CodeBuild functionalities.

## Step 2: Create S3 bucket to store source code and build artifacts

## Step 3: Create Code Build project
-	Here we will create a Build Project that will take source code from GitHub repository, and authenticate AWS CodeBuild to use code from our GitHub account.

## Step 4: Create Deployment Application

-	We will create a CodeDeploy application that will deploy the applications to EC2 instance.

## Step 5: Launch an EC2 Instance to host the application
-	Launch an EC2 instance that will have the custom role attached to it created in Step 1 and with proper tag so it can be used later.
-	Attach the security group with port 22 open for ssh and port 80 open to access the web application.
-	SSH to EC2 instance and install the CodeDeploy agent so CodeDeploy can deploy the application.

**Commands to install CodeDeploy agent**

```
# Installing CodeDeploy Agent
sudo yum update
sudo yum install ruby
# Download the agent (replace the region)
wget https://aws-codedeploy-eu-west-3.s3.eu-west-3.amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto
sudo service codedeploy-agent status

```

## Step 6: Create Deployment Group

-	In the CodeDeploy application created earlier in Step 4, create Deployment Group and mention the tag of EC2 instance created earlier to deploy application on instances having that specific tag.

## Step 7: Create a CodePipeline

-	In Stage 1 we will select GitHub as cource code repository and choose the artifacts to be stored at the S3 bucket created earlier.
-	In Build stage we will choose the Build Project created by us.
-	In the Deploy stage select the deployment application and group created in the previous steps.

## Step 8: Update the IAM Role for CodePipeline

-	Here we will update the IAM role created by CodePipeline and attach the access policy granting full access of S3 to CodePipeline.

That’s all the pipeline is created and we can make changes to github repository and check the working of pipeline.

{% youtube zTT0keHlr9w %}
Well splice seems interesting
Tags: javascript, webdev, beginners, discuss
Published: 2022-03-01 06:22:10

So me and my peer discovered in our boot camp lab today that If you use the **.splice()** method on an array and want to use it to make a copy with an additional element at the end of the array ( exp. Arr.**splice**(start, deletecount, new element added).)
You kind of have to know the length of the array because it adds the new element to the left indexs of the specified starting point so .**splice**(-1,0,”newstring”)will add the new string an index before the final element in the array and not at the end of the array. Wild, just wild. Any comments to expand my understanding of this method is more than welcome.
What is connect()() function in redux or reactjs ?
Tags: react, javascript, programming, redux
Published: 2022-03-01 06:19:48

In redux, we usually comes across `connect()()` syntax.

Everyone knows that, `connect()()` function in redux is used for connecting the component with store.

But under the hood, what it exactly means? What can we call such functions ? Is this are normal function like `foo()` thing ?

Lets see whats its exactly:

**What it is knowns as ?**
**Currying**: This methodology or syntax signature of function which takes `multiple arguments one at a time` is known as **'Curried function'** or in short **'Currying'**

**<u>Is it same as normal / partial function `foo()`?</u>**
Curry: lets you call a function, **splitting it in multiple calls**, providing **one argument per-call**.

Partial: lets you call a function, **splitting it in multiple calls**, providing **multiple arguments per-call**.

Basically both are same, Currying function helps you to manage code better than partial function and that's the reason on architecture level, usually you will come across curry functions.

Example: Lets do a sum using both partial and curry function:

**<u>Partial function:</u>**
```
function sum_partial(a,b,c){
	return a+b+c;
}
```
**<u>Curried Function:</u>**
```
function sum_curried(a) {
    return function (b) {
        return function (c)  {
            return a + b + c
        }
    }
}
```
**Calling partial function:**

```
let res = sum_partial(1, 2, 3);
console.log(res); //6
```

**Calling Curried function:**

```
//Method ONE
let sc1 = sum_curried(1);
let sc2 = sc1(2);
let res2 = sc2(3);
console.log(res2); //6
```

**<u>Short METHOD OR Similar to connect()() in redux</u>**

```
let res3 = sum_curried(1)(2)(3);
console.log(res3); //6
```

Working JS Fiddle [here](https://jsfiddle.net/imsabir/6q7x5fd4/6/)

For in deep working of connect go [here](https://react-redux.js.org/api/connect#:~:text=Overview%E2%80%8B,dispatch%20actions%20to%20the%20store.)
For more such contents follow @msabir 



Cheers!!
#1 Python Series
Tags: python
Published: 2022-03-01 06:13:40


Day1:
This is a super easy way of writing program compared to java.

The first line of code is to print classic "Hello World"....

**Code:**
print("Hello World!") --> Output : Hello World!
-*-
Super Easy right!

**Code2:**
print("something") --> Output : something

_Explaination-_ ".." the double quote is used to explain computer that i wanted to print the value inside the quotes.
print is a command to the computer to print in console.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/69sc67qxce8s5a3dadmp.png)

This is a error which created voluntarily to check.
The error is missing " at the end .


**// Next module printing code in seperate lines.**

print("Day 1 - Python Print Function")
print("The function is declared like this:")
print("print('what to print')")


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/00vjczfwgejg8at1o7ch.png)

_Why single quote is used instead of double quotes?_
It will throw a error when we use double quotes inside double quotes.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0oybdb9b2serx0gxswh3.png)
//**Logic to write a single line code to print output in seperate lines**.
print("Hello World!\nHelloWorld!")
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vy22n3a9dbjsrs74vnhy.png)


// String Concat -  Combine different string and the value added to other string.
print("Hello" + "Dev")

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j3buerrx34oztb3k4l1h.png)
print("Hello"+" "+"Dev")


**Input Function-**
gets data from user and use it in code...
print("Hello" + input("What is your name?"))

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q6tohsi318jiessybjz9.png)
 
# hashtag is used to comment lines in python. 
 
Counting String by getting string as a input.

len() is a predefined function which counts the value of string.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mc4j0twx8yub8keo2fjl.png)
https://stackoverflow.com/questions/4967580/how-to-get-the-size-of-a-string-in-python 
Here S is a variable without declaring a variable the value we get form user is stored no where if we want retrieve impossible so we are first storing it to a variable and the calling it where ever we wanted.


Day 1 practice Excersice:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fqp0scpafbvooiae8vux.png)
 
Concat your city and pet name and name it your music band. 


city = input("what's name of the city you grew up in?")
petName = input("what's your pet's name?")

concat = print("Your Band name could be "+city+" "+petName)

GitLink : https://github.com/Saravananb15/Python/tree/day1
----****-----