teleren/devto huggingface dataset:
Why is C so fast
Tags: beginners, c, java, python
Published: 2021-02-27 21:34:55

We have heard programmers around us talk about C being fast, so in this article, I’ll be attempting to explain the **"why"**.

C is fast because... it has no special features. It was designed to be as close to Machine level as possible. The only benefit being that it was readable (I know, I know, just try to imagine assembly devs using C for the first time back then).

Due to how close it is to machine language, the speed of a C program is loosely determined by the number of statements being executed.

From this, we can begin to see that C is not fast per se... other languages are just slow!

And that is because they have a higher level of abstraction to machine language than C does. That is not necessarily a bad thing since higher-level languages (like Python) provide:

1. Safety checks
2. Added complexity
3. Error handling
4. Memory management
5. Automatic garbage collection

The only tradeoff being speed... or is it?



### is C really the fastest?

Short answer, Not really. Long answer, it is only fast when the programmer writes optimal code. And even then, there are instances where virtual machine-based languages (like Java) run faster than C. Plus, Assembly is a language too and it's faster than C.

Thanks for reading!


##
##
###Sources
https://stackoverflow.com/questions/418914/why-is-c-so-fast-and-why-arent-other-languages-as-fast-or-faster
https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zappldev/zappldev_85.htm
Python Zero to Hero - Ep.36 - The most useless library ever
Tags: python, tutorial, packaging, beginners
Published: 2021-02-27 21:04:09

---
title: Python Zero to Hero - Ep.36 - The most useless library ever
published: true
description: Today you will be making the most useless Python library with me ever. We will start this week and keep on building this library (so hopefully in the end it will be not so useless).
tags: python, tutorial, packaging, beginner
---
Today you will be making the most useless Python library with me ever. We will start this week and keep on building this library (so hopefully in the end it will be not so useless). If you have any questions or any suggestions about which Python topics to cover, please leave your comment at my [Twitch channel](https://www.twitch.tv/cheukting_ho)

You can get the slide deck [here](https://slides.com/cheukting_ho) and the example code and homework form [GitHub here](https://github.com/Cheukting/python02hero). Ask questions at my [Twitch channel](https://www.twitch.tv/cheukting_ho)
Simulate single page app using CSS selector (:target)
Tags: html, css, javascript
Published: 2021-02-27 21:00:50


hack the idea of SPA using :target css selector (it is a funny idea more than for actual use   ) [preview](https://codepen.io/mohamedfarid/full/ZEBxGJo)


why target selector, because it is the only selector that can understand the URL.

the target selector refers to the element with the id matches 
the URL hash  


the idea is to give every page id and hide all pages except  the current target page

and you can still navigate between pages without javascript 
or refresh the page as normal

to hide all pages except the target page
 
``` css
 .page:not(:target) {
   display: none;
 }

```
put nav to be fixed in all pages

```html
<nav>
  <a href="#home">Home</a>
  <a href="#about">About</a>
  <a href="#contact">Contact</a>
  <a href="#posts">Posts</a>
</nav>
```
create pages that will be affected

```html 
<div class="page home" id="home">Home</div>
<div class="page about" id="about">about</div>
<div class="page posts" id="home">posts</div>
```

if the URL does not have hash push to the home page

```javascript
if (window.location.hash === "") {
  window.location.hash = "#home";
}
```
to listen to the page change

```javascript
window.addEventListener("hashchange", (e) => {
});
```
as example, if you went to get posts 

```javascript
window.addEventListener("hashchange", (e) => {
  if (location.hash === "#posts") {
    fetch("https://sitetogetposts/posts")
      .then((res) => res.json())
      .then(setPosts)
      .catch(handleError);
  }
});
```


you can check the full example [here](https://codepen.io/mohamedfarid/pen/ZEBxGJo?editors=0010)


Any feedback is appreciated 🤝
Writing Thunks Workflow
Published: 2021-02-27 19:44:28


**Pre-req:**
[Install thunks](https://www.npmjs.com/package/redux-thunk)

1. Get organized - Create a `thunks.js` or a folder `./thunks/` and the appropriate file names to group the related thunks.

2. Import `action-creators` from the appropriate file(s) into your thunk file.

3. Write your thunk(s). 

4. Create a new `reducer` or update other `reducers` as appropriate and import any needed `actions`.
4.1. If creating a new `reducer`, `import` it to store.js and add the `reducer` to your reducers object.

5. In the component needing the `thunk`, import the `thunk`, add it to the appropriate `props`, `mapState`, and `mapProps`, and place the `thunk` function were needed in the component.  

### Resources & References
[Redux-Thunk Official](https://www.npmjs.com/package/redux-thunk)
[What Are Thunks?](https://medium.com/fullstack-academy/thunks-in-redux-the-basics-85e538a3fe60) <-the best article on Thunks and how they work
Moving to Cloud : Prove you expertise
Tags: cloud, aws, certificate
Published: 2021-02-27 18:57:57

**Trick 4 - Show your work** 

So far you have put in a few hours and done some work to hone your skills in cloud. However it is not enough. You need to let people know, that you know cloud. There are a few ways to do it without showing it to everyone's face. Lets take a look at them -

*1. Get Certified* 

Many, if not all employers love certified folks. But keep in mind, the certificate alone won't be enough to get the job for you, but it can open some doors. Let the certification open the door, but let your work do the talking in an interview. For someone who needs a structured way to study, this is a nice way of getting it done.

*2. Use social media*

Tweet helpful snippets of your notes, share some of your learning on you blog, share how you solved a particular problem at work that involved cloud on LinkedIn, answer a few questions on stack-overflow if you can. The trick is to project your profile as someone who knows cloud and can get things done.

*3. Projects* 

When you study for certifications, make sure you are doing a lot of hands on labs. Mimicking the workflows from your work is the best exercise you could do. If that is not possible, deploy a web app using as many services as you can.

E.g. You could deploy a static website using S3, S3+Cloudfront, Amplify Console, EC2, EC2 + SSL using ALB, Lightsail, Elastic beanstalk etc.

You can use tools like Hugo to generate these sites. 

Similar things can be done to other services too. Use your existing expertise.

These 4 tricks have helped me immensely to reach where I am today. My official title now reads 'Cloud Architect' and I owe a lot of my relative success to the above tricks / process.

Got any questions? Comment here or reach out to me via twitter.
Understanding Kubernetes in a visual way (in 🎥 video): part 4 – Namespaces
Tags: kubernetes, devops, docker, beginners
Published: 2021-02-27 19:40:01

---
title: Understanding Kubernetes in a visual way (in 🎥 video): part 4 – Namespaces
published: true
description: Serie of videos about Kubernetes. Explaining in a visual way Kubernetes principles.
tags: Kubernetes, DevOps, Docker, beginners
series: Understanding Kubernetes in a visual way - (in video) in video
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kfe5xqq63az55j3zluaf.jpg
---

Understanding Kubernetes can be difficult or time-consuming. In order to spread knowledges about Cloud technologies I started to create sketchnotes about Kubernetes, then I've auto-published a book and since now I've started a new serie of video! :-)

I imagined a serie of short videos with a mix of sketchnotes and speech.

I think it could be a good way, more visual, with audio & video to explain Kubernetes (and others technologies).

The third episode is focused on a very important Kubernetes object: Namespaces.

{% youtube hJqv-dcZUZM %}

The video is in French BUT I done the subtitles in english (and french too).

If you liked the video and are interested to watch another ones, please give me some feedbacks (and you can also subscribe to [my Youtube channel](https://www.youtube.com/channel/UCrRk0kOP58lBMl9B8ZS8Vlg), if you want to ❤️).

Here the illustrations that you can see in the video:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d63cabtm9d7j04kcrc3f.jpeg)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/clyscs82rlctabtwd7bi.jpeg)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pdb7ador8txovl9mcmiz.jpeg)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zuf7ulpld9n8vckfdf1j.jpeg)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7s5qtr90ryerff76wkao.jpeg)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oskv00da1zribct8lxeh.jpeg)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yc1frnokw1id3yo2vr48.jpeg)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/510agifebgws4j0iotbw.jpeg)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wvpvqubwv94p1iwgp2mg.jpeg)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wkuvipbllooldtb1wv12.jpeg)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qzaf7dzmffbsui4wzts4.jpeg)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ixhjuu5ewtoaaxudpbas.jpeg)

If you are interested, I published all the sketchnotes on Kubernetes (and new ones!) to make a "book" of 120 pages: ["Understanding Kubernetes in a visual way"](https://gumroad.com/aurelievache#uCxcr).

If you like theses sketchnotes, you can follow me, I will publish others sketchs shortly :-).
Arithmetic Operator
Tags: javascript
Published: 2021-02-27 19:21:22

Addition operator ( + ) Example : 10+10 = 20
Subtraction operator ( - ) Example : 22-10 = 12
Multiplication Operator ( * ) Example : 4*5 = 20 
Division Operator ( / )   Example : 12/2 = 6 
Remainder/Modulo operator ( % ) Example : 5%2 = 1 
Exponent Operator ( ** )  Example : 5**2 = 25 (same as 5*5)

Application of arithmetic operator. 

Find any digit from a number.
Suppose we have a number 53425. Print 3rd digit from this number.
Here we use the arithmetic operator.
          53425 % 1000 = 425 
          425 / 100 = 4  ( 4 is the third digit of this number)
```javascript
var res = Math.floor((n % 1000) / 100);
```
another example : 
Print 3rd and 4th number digit from 53425.
         53425 % 1000 = 425 
         425 / 10 = 42 ( Here 4 and 2 are the third and 4th digit of this number )
   ```javascript
   var res = Math.floor((n % 1000) / 10);
   ```
Deploy a Next.js site to Netlify
Tags: nextjs, netlify
Published: 2021-02-27 19:12:25

Next.js is from Vercel.com, but I already have a Netlify account and some familiarity with Netlify. My first 2 deployment attempts failed. I was pointing to the wrong directory.

The publish directory should be `./out`

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

You should already have signed up for Netlify and your Next.js site in a Github, Gitlab, or Bitbucket repo.  

Here are the steps:

1. install Netlify-cli `npm install -g netlify-cli` (I already had it installed)
2. log in to Netlify `ntl login`
3. Navigate to your sites route directory `cd ~/path/to/your/nextjs-site/`
4. initialize Netlify `ntl init`
   new site:
  * choose "Create & configure a new site"
  * select your team (if you have more than one)
  * optional - give the site a unique name (or let Netlify randomly assign one)
   existing site: 
  * if anyone needs the steps please request in the comments and I will update the post
5.Authorize with GitHub (or the remote you chose)
6. use `npm run build && npm run export` as the build command
7. use `.out` as the "Directory to Deploy"
8. specify your "netlify functions" folder (I do not have any for this project yet)
* You could configure build settings, deploy settings, and environment variables in a [`netlify.toml`](https://docs.netlify.com/configure-builds/file-based-configuration/)

```toml
// netlify.toml
[build]
  command = "npm run build && npm run export"
  publish = "out"
```

When you push new code to your remote git repo Netlify will automatically update!

sources:
https://www.netlify.com/blog/2020/11/30/how-to-deploy-next.js-sites-to-netlify/

https://explorers.netlify.com/learn/nextjs/nextjs-deployment
How to create an NPM Package in 5 minutes
Tags: javascript, npm
Published: 2021-02-27 19:04:46

---
title: How to create an NPM Package in 5 minutes
published: true
description: Npm Packages are a vital thing when using javascript code from other developers. We will learn how to create and use it quickly
tags:  javascript, npm
---
What is NPM 
It is a package manager for the JavaScript programming language. This is the world's largest Software Registry.

Step 1 - Create an npm project 
 1.1 Create a folder named "my_demo_calculator" 
```mkdir my_demo_calculator```

1.2 Create an npm project 
``` npm init -y ``` 
It will turn your project folder into an npm package 

1.3 Create a file named "index.js" and add the following code to it. 
```
function add(x,y){
    return x+y;
}
function sub(x,y){
    return x-y;
}
function mul(x,y){
    return x*y;
}
function divide(x,y){
    return x/y;
}

module.exports = {add,sub,mul,divide}
```
1.3 (Optional) Create a README.md file and add it to the folder 

1.4 Login into the NPM Registry. You need to create an account on npmjs.com and use the same here

```npm login```

1.5 Publish the Package with the following command 
```npm publish```

That's It :) 

You can see my sample package on the links below 

https://www.npmjs.com/package/demo_npm_package_devtalks
PHPNews for PHP Developers
Tags: php
Published: 2021-02-27 18:52:38

This is nice app for all PHP developers they can use to keep updated with latest PHP stuff from difference sources in one application.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0p29jfxicinkhlkbgx0g.png)

[View PHPNews on Android PlayStore](https://play.google.com/store/apps/details?id=io.codeinphp.phpnews)
TIL: Set-Up & Launch an AWS Instance
Tags: todayilearned, linux, devjournal
Published: 2021-02-27 18:48:25

Today was my first time using AWS.

I setup a free account and created, launched, and connected to an  Ubuntu 20.04 instance.

Certainly not as user friendly as setting something up on Digital Ocean. It's a popular platform though, so I figure it will be helpful to get some exposure to it as I continue to work towards Linux Foundation certifications.

![aws instance dashboard](https://i.ibb.co/X4JdY1H/aws.jpg)
NOTION , I recommend it! 
Tags: devops, help, webdev, programming
Published: 2021-02-27 18:48:19

As a suggestion,
I found a notes APP called 
“NOTION”, it’s kinda inbetween Slack and Microsoft office, work places..... 

I’ve been creating config layouts of creating different projects, and it lets you just click “copy” to copy code you’ve written. It seem really really good. 

The “catch” is that the “personal” is free, where it’s just one user account, but if you wanted to share info/notes, there’s the paid version.

BUT... it allows others to comment, edit notes and also create events.

It’s really good
Moving to Cloud : Using social tools
Published: 2021-02-27 18:40:09

Please read the first post of the series to get the context. 

** Trick 2 - Get involved in the community. Attend meetups / seminars **

A very underrated and excellent way of learning is to observe people who excel at their craft and learn in the process. It's equivalent to active listening from music. Personally, this is the part where I learned the most from. I observed how people were using the services in their setup. I tried to relate what I observed with things at work. Took notes in meetups and tried researching on them while trying to solve a problem at work. Luckily AWS User Group was in nascent stages when this happened and I got to be a part of the journey to build that user group. I learned a ton in that process. 

To validate your skills speak at your local meetups. There are many people who don't know what you know. Share it. This helps you boost your confidence, expand your network and enhance your people skills.

** Trick 3 - Teach Someone **

Write summary of what you learnt at any webinar / meetup and share it with your friends / colleagues / boss. Try teaching them what you learnt. Help a colleague or friend with the cloud basics.  Teaching someone will uncover quite a lot of details that you would generally miss while learning yourself.
Downloadable Codecademy JavaScript Lessons
Tags: javascript, webdev, node, codenewbie
Published: 2021-02-27 18:36:25

If interested in learning **JavaScript** from **Codecademy** for free, download the resources below:

### JavaScript
1.  [Introduction to JavaScript](https://drive.google.com/drive/folders/18ynjjWfdaqXFLP_-1XwtXsfDGzxa8NGD?usp=sharing) 
2. [Variables](https://drive.google.com/drive/folders/1bBT95ZTPACRT9YqtJIWHuPjjKv-kq7hw?usp=sharing)
3. [Conditional Statements](https://drive.google.com/drive/folders/13Z_Kkh7QVwXeNMJn8pafHLsIYwTCq6Ia?usp=sharing)
4. [Functions](https://drive.google.com/drive/folders/1A95ZdEcISH0hNn-hI5uedyme7RkRERDO?usp=sharing)
5. [Code Challenges JavaScript Fundamentals](https://drive.google.com/drive/folders/1VHh1Vfht9SQJaClF-JxPrDeBPWPX9Jt-?usp=sharing)
6. [Scope](https://drive.google.com/drive/folders/1MFL-nWnv2qQjuWZwtlR8uWk1wPN4El7S?usp=sharing)
7. [Arrays](https://drive.google.com/drive/folders/1_g884k25Wnygbr1NAP7yPFET0TXiKrh0?usp=sharing)
8. [Loops](https://drive.google.com/drive/folders/1X5ye0z8DfUmoLcAqGxfKAWPk3NzeBkt2?usp=sharing)
9. [Higher Order Functions](https://drive.google.com/drive/folders/18QPzuKf0pzv8w_tof3hzyTn3xGzwIqjO?usp=sharing)
10. [Iterators](https://drive.google.com/drive/folders/1rF4pZaCgXuPMNCzVpzElcf56LjdMk7-b?usp=sharing)
11.  [Objects](https://drive.google.com/drive/folders/11GoCFGTFXkXAIMg-n89qpvj8EOTVypaT?usp=sharing)
12.  [Advanced Objects](https://drive.google.com/drive/folders/1ErUg7JbpB22TfBF54ogFPhDd64kWp4V9?usp=sharing)
13. [JavaScript Interactive Websites](https://drive.google.com/drive/folders/1MphE9b3WuuVBIsvnrQKwmhoHx76QcWkg?usp=sharing)  
14. [Creating your First JavaScript Website](https://drive.google.com/drive/folders/1jXVO8t-RfkYtL8lSrZxDTMogLToGqASr?usp=sharing)
15.  [The DOM](https://drive.google.com/drive/folders/1UlG-2z-4P0egF_D8ZVHBBt4Fbl6jXpQD?usp=sharing) 
16.  [JavaScript and the DOM](https://drive.google.com/drive/folders/1mlXlIm6YamJrLWkTjLnfLbuFyygcYxW-?usp=sharing) 

If also interested in having a one-month Codecademy free subscription,  [click this link](https://t.co/QEJa7L36zk?amp=1).

---

[![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1614450714446/lvvlwS6yT.png)](https://skillshare.eqcm.net/c/2680282/300216/4650)
The best framework in 2021
Tags: discuss, webdev, javascript
Published: 2021-02-27 18:33:23

Hi there! In my humble opinion, frameworks get their popularity rapidly. So, what is the most critical and useful framework nowadays? Why do you think so?

As for me, **Vue.js** is the best framework for modern development. **Firstly**, it has a clear structure. **Secondly**, it has a lot of available additional libraries.
Moving to Cloud : Taking the first step
Tags: cloud, aws, codenewbie
Published: 2021-02-27 18:29:29

I wrote a twitter thread in December 2020 in an attempt to collate advice I had given to a bunch of people who made career transition to cloud. It was received relatively well. Its time to convert it into a blog post. Our default choice of cloud for this post would be AWS.

Below is the tweet thread this post is inspired from 
{% twitter 1338152016388845568 %} 

This post is indented for developers, system admins, DBA's etc. already working in a professional setting. There is a different thread (which I will convert to a blog post soon) for recent graduates or for people looking to make a career switch. 

{% twitter 1339282200865304577 %}

Having made that clear, let jump into the actual stuff. 

**Trick 1 - Gain entry into the cloud from a familiar landscape**

You can do this by using a few services from cloud that you could potentially use at work. Use the cloud which is accessible to your at your workplace. If you don't use cloud at work, start with AWS.

Lets look at few examples - 

*Example 1 - * I was working as SQL Dev with Oracle/ MS SQL / PostgreSQL. The moment I had a chance to deploy a PostgreSQL DB in cloud ( which was quite new in the org at that time), I volunteered. Played around it for a bit and complemented it with online classes.

*Example 2 -* If you are a sysadmin, you can start exploring EC2, LightSail and Elastic beanstalk. If your work permits, try running a development workload of an existing application you are handling on any of these services. If it doesn't, create a free tier account and setup a WordPress or ghost blog. It will cost you less than 10$ to have a nice blog with your custom URL.

*Example 3 - * If you are a front end developer, start with Amplify Framework. Take a look at how it can help you accelerate your development. Try a few features in your dev environment or in your side projects.

Once you start working with these services in the area of your expertise, slowly start looking at other services from AWS that are supporting the application. Look at the solution diagram and reason with yourself why they were chosen the way they are. Slowly and steadily as you gain interest gain, take active participation in cloud related tasks. Fill in the gaps by either taking a cloud certification or by implementing a few side projects.
SPOTIFY SYSTEM TRAY [KDE]
Tags: systems, kde
Published: 2021-02-27 18:12:55

O Spotify é um app de música que todo mundo usa hoje em dia, mas ele tem um pequeno defeito que infelizmente ainda não foi resolvido no client do linux. Que é o fato de minimizar o aplicativo pra system tray da distribuição linux, que é o **Kde-Neon 5.21**.

Com isso comecei a procurar algumas soluções e a que mais se adaptou a minha distro, foi usar o *kdocker*. 

Instale o **kdocker** com o comando:

```sudo apt install kdocker```

Após isso, vamos alterar o arquivo **spotify.desktop**

```sudo nano /usr/local/share/applications/spotify.desktop```

Iremos até a linha `Exec = spotify %U` e iremos editar para `Exec=kdocker -d 30 -i /usr/share/spotify/icons/spotify-linux-32.png -q spotify %U`

Salve o arquivo, que deverá estar assim: 

```[Desktop Entry]
Type=Application
Name=Spotify
GenericName=Music Player
Icon=spotify-client
TryExec=spotify
Exec=kdocker -d 30 -i /usr/share/spotify/icons/spotify-linux-32.png -q spotify %U
Terminal=false
MimeType=x-scheme-handler/spotify;
Categories=Audio;Music;Player;AudioVideo;
StartupWMClass=spotify```

E pronto, após isso é só abrir o Spotify que ele irá minimizar diretamente na system tray do kde.
Show Dev: A VSCode Snippet to Write JS Arrow Function Really Fast
Tags: showdev, vscode, typescript, javascript
Published: 2021-02-27 18:02:30

https://github.com/vinliao/fast-arrow

![gif](https://raw.githubusercontent.com/vinliao/fast-arrow/master/images/faster.gif)

I was quite annoyed for having to type arrow functions in js. So much keypresses! Now I use this all the time when writing arrow functions.