teleren/devto huggingface dataset:
Daily Dose of x86-64 - I
Tags: beginners, assembly, register
Published: 2023-01-09 16:24:44


![x86-64 registers](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yz3hxrn43hx4kdgy735p.png)

These are registers in x86-64 assembly language. We will use some of those registers and do some experiments with them.

![assembly code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5caguuliphej94gfagmq.png)

In the picture above, we assign **AX** register a value of 259. **AX** is a 16 bit register. When we convert decimal value of 259 to binary we will get 0001 0000 0011.

```
259d = 0001 0000 0011b
```
Because of **AX** is 16 bit register it can store decimal 259. But what about **AL** register inside **AX** register which is 8 bit register, Can **AL** store 259d?

![RAX register](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lwqphudkc4b7xl6dimvh.png)

**AL** register (8 bit) is lower half of the **AX** register. When we are storing values inside **AX** register we also use **AH** and **AL** registers. In our situation **AH** and **AL** stores, 

```
AH  0000 0001 AL 0000 0011
AH = (2^8 * 1) = 256 
AL = (2^1 * 1) + (2^0 * 1) = 3 
TOTAL 256 + 3 = 259d
```

So what actually happens to **AH** and **AL** registers when we try to store 259 in **AX** register?

8 bit is for
**unsigned** types 0 to 255 
**signed**  types -128 to 127

```
unsigned type 0 to (2^8 - 1)
signed type (-2^8 / 2) to (2^8 / 2 - 1)
```

Answer to **AL** is, because of it is an 8 bit register and the value that will stored in **AX** is more than max value that **AL** (first part of **AX**) can store, it will deny the value bigger than 8 bit memory. What that mean is, it will take the modulus of the value by cutting out all the pieces of full 8 bit memories (1111 1111b) from it and use the value that lefts.

```
259d % 256 = 3 
//because of the max value is 255 we need to
//take modulus of 256 for able to get 255 also in modulus result.
AL 0000 0011
```
Answer to **AH** is, It will store the value that **AL** can not stored and because of `AX = AH + AL`. 1st bit of **AH** is actually 9th bit of **AX**.
For **AX**, **AH** will store 256 but for **AH** it is storing 1.

```
AX 0000 0001 0000 0011
AH 0000 0001
AL 0000 0011
```
 
![values stored in registers](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fedptrj9byhb4qc7kb8m.png)

<u>These are the registers and variables and values that they store as we saw in the second picture.</u> 

**mov ax, 259**
We can see **WORD** size (16 bit) AX register stores 259d. 
Upper half of AX which is BYTE size AH (8 bit) stores 1d, 0000 0001b. 
Lower half of AX which is also BYTE size AL (8 Bit) stores 3d 0000 0011b. 

**mov bl, 257**
BL (8 bit) register stores 1d = 0000 0001b  (257 % 256 = 1).

**mov BYTE[number], 256** 
BYTE size number variable stores 0d = 0000 0000b (256 % 256 = 0).
Configure Proxmox to use an external Ceph cluster
Published: 2023-01-09 16:11:30

---
title: Configure Proxmox to use an external Ceph cluster
published: true
description: We look into how to configure your Proxmox installation to use an external Ceph cluster for your data needs.
tags:
cover_image: https://i.ytimg.com/vi/uBpug5f5XTs/maxresdefault.jpg
---

{% youtube uBpug5f5XTs %}

We look into how to configure your Proxmox installation to use an external Ceph cluster for your data needs.
What are your Goals for the week of Jan 9?
Tags: discuss, watercooler, motivation
Published: 2023-01-09 16:05:31

What are your goals for this week? 
What are your goals for the new year?
 
- What are you building? 
- What will be a good result by week's end?
- Did you meet your goals last week?
- Anything planned for the new year?

**Last Week's Goals**

- [:white_check_mark:] Clean up from the Holidays.
- [:white_check_mark:] Make new contact header for socials.
- [:white_check_mark:] Hit milestone in blog views.

![text christopherleejarvis.com and dev.to @jarvisscript](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/20m07vdw87mvfsonfa1c.jpg)

Alternate version. Need avatar or something on left side or just recenter this.
![text in white and bluechristopherleejarvis.com and dev.to @jarvisscript](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hoxuah5h49vfsd5uso4h.jpg)

### Still working on: 
- Update resume/linkedIN/portfolio.
- I'm taking a course starting later this month, course hasn't dropped yet.
- This ties in with the Virtual Coffee January Challenge a month of Learning. I need to plan this out and set some more defined goals this week.


**This Week's Goals**

- Update resume/linkedIN/portfolio.
- Make new contact header for socials.
- I'm taking a course starting later this month, looking for prep work for it.
- This ties in with the Virtual Coffee January Challenge a month of Learning. I need to plan this out and set some more defined goals this week.
- Encourage Virtual Coffee members in our Month of Learning Challenge.

**This Month's Goals**
- Gain more followers here. I would like to have more followers on DEV than I had on the bird site. Need about 100 more here. 
- Gain more followers on Mastodon. @jarvisscript@hachyderm.io I'm nowhere near my DEV or bird numbers but that's ok.

This post will be my 100th published post. Thank you to everyone that comments and encourages me on these weekly posts. Seeing you hit your goals motivates me to hit mine. I will throw it back to the point of the post.

What are your goals for the week?

```
-$JarvisScript git push
```
Make Your Code Self-Documenting with Descriptive Event Handler Names
Tags: react, javascript, programming, webdev
Published: 2023-01-09 15:52:49

In software development, one of the key principles is to make code that is **easy to read and understand**. This is especially important in **declarative systems** like **React**, Vue or Svelte where the code describes what the system is supposed to do rather than the specific steps to do it. When you give your event handlers meaningful names, it becomes much easier for other developers (and yourself, when you come back to the code later) to understand the purpose of the handler just by reading the name.

For example, consider the following two event handlers:

```jsx
// meaningful event handlers
<Touch
  onTouchStart={saveOffsetForMoveAndFocus}
  onTouchMove={moveWindow}>
...
</Touch>

// generic event handlers
<Touch
  onTouchStart={handleTouchStart}
  onTouchMove={handleTouchMove}>
...
</Touch>
```

Which of these handlers is more meaningful? The first example clearly communicates what is supposed to happen, whereas the second one does not so, you need to browse the rest of the code to understand its purpose.

Using descriptive names for your event handlers makes your code more **self-documenting**, which can save time and reduce the need for detailed documentation. It can also make it easier to **find and fix bugs** in your code, as the names can provide clues about the purpose of the event handler and where it is being used.

## Wait, this way my function names are gonna be too long!!!

When it comes to the length of method names, **Uncle Bob** suggests that it is generally _better to err on the side of longer and more descriptive names, rather than shorter and more vague names_. In "Clean Code" he writes:

"Don’t be afraid to make a name long. A long descriptive name is better than a short enigmatic name. A long descriptive name is better than a long descriptive comment. Use a naming convention that allows multiple words to be easily read in the function names, and then make use of those multiple words to give the function a name that says what it does."

To add to that, I recently came across a concept: the **"Principle of Least Astonishment" or POLA**, which states that code should be written in a way that minimises the surprise of the reader. I think that by giving your event handlers descriptive names, you can make it clear what they do and reduce the potential for a surprise when reading the code.
The Zen of Proverbs
Tags: cleancode, webdev, codenewbie, codequality
Published: 2023-01-09 15:36:00

20 rules of thumb for writing better software.

* Optimize for simplicity first
* Write code for humans, not computers
* Reading is more important than writing
* Any style is fine, as long as it's black
* There should be one way to do it, but seriously this time
* Hide the sharp knives
* Changing the rules is better than adding exceptions
* Libraries are better than frameworks
* Transitive dependencies are a problem
* Dynamic runtime dependencies are a bigger problem
* The surface area of an API is a liability
* Returning early is a good thing
* Plain text is usually best
* Compiler errors are better than runtime errors
* Runtime errors are better than bugs
* Tooling is better than documentation
* Documentation is better than nothing
* Configuration sucks, but so does convention
* The cost of building a feature is its smallest cost
* Types are one honking great idea -- let's do more of those!

## Homage and references

* [The Zen of Python](https://peps.python.org/pep-0020/)
* [The Go Proverbs](https://go-proverbs.github.io/)
* [The Zen of Zig](https://ziglang.org/documentation/master/#Zen)
* [Unix Philosophy](https://en.wikipedia.org/wiki/Unix_philosophy#Origin)
* [Sharp Knives](https://rubyonrails.org/doctrine#provide-sharp-knives)

> Any color the customer wants, as long as it’s black.
> 
> -- Henry Ford (maybe)
APIs lifecycle Management 101
Tags: api, softwareengineer, backend
Published: 2023-01-09 15:33:30

---
title: APIs lifecycle Management 101
published: true
description: Learn everything about APIs lifecycle management in our new Developer Nation workshop with @getapiwiz.
tags: #API #SoftwareEngineer #Backend
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-01-09 15:24 +0000
---

Learn everything about APIs lifecycle management in our new Developer Nation workshop with @getapiwiz.

In this workshop you’ll learn how to manage your APIs Lifecycle from deploying to production to monitoring their performance using state of the art tools by APIWiz. Things to learn from this workshop:

- About API lifecycle
- Best practises
- Using APIWiz tools
- Where to go from here

Watch below 👇 and leave us feedback.

![APIs Lifecycle Management](https://i.ibb.co/FDLmVpB/thumbnail.jpg)

[**Watch Here**] (youtu.be/yuThotxcVjc)
Music Monday — What are you listening to? (Hip Hop Edition)
Tags: watercooler, discuss, music
Published: 2023-01-09 15:23:58

_cover image source: [Philip De Canaga](https://giphy.com/philipdecanaga/)_

** Hip hop heads rejoice! The time has come for us to share our favorite rappers, beatmakers, and labels. Whether you're a sucker for good lyrics or just a fan of hard knocking beats, I wanna know where you folks stand on rhymes and rhythms. If old school is where it's at for you — let us know. If you're into the underground scene, turn us onto something outside the mainstream. All angles of hip hop are welcome here!**


![This image flips through a bunch of cartoon faces of various hip hop artists over time](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e6botgzalens7gjpsb74.gif)

***

## How we do 

In this weekly series, folks can chime in and drop links to whatever it is they've been listening to recently + browse others suggestions.

If you like talking about music, consider following the org [#music discussions](https://dev.to/music-discussions) for more conversations about music!

{% embed https://dev.to/music-discussions %}

***

Alright y'all, let's drop some hip hop songs! _Note: you can embed a link to your song using the following syntax `{% embed https://... %}`. This should work for most common platforms!_

Always looking forward to listening to y'all's suggestions! 🎶
Core Java - Wrapper class.
Tags: java
Published: 2023-01-09 15:09:39

Helps us to convert primitive types to object types.

It helps in collection class....

Primitive to object - boxing
object to primitive - Unboxing.
primitive to string 
string to primitive 
Object to string
string to object.


Primitive to object and Object to primitive.


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

Primitive to String and String to primitive.

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


String to object and Object to String.


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

Wrapper class also provide us with 2 convenient constructors.
That allow us to create an object with primitive and string. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k7d01ay818hv0pc752ym.png)
My GitHub Repo App.
Published: 2023-01-09 15:02:56

**Table of content**

1.Brief intro to React
2.About the App
3.Project Overview
4.Setting up React
5.Setting up React Router
6.Homepage
7.Pagination
8.Error boundary
9.Conclusion

**Brief intro to React**
React is one of the most important frameworks of Javascript. It is arguably the most popular framework. It was developed by Jordan Walke, a software developer at Meta and was initially released in 2013.
React is a framework that simplifies complex Javascript concepts.

**About the App**
I built this Github App as a student at Altschool Africa. This App is a project for second semester exams. In this project, I implemented some interesting features which includes but not limited to Fetch API, Nested routes, pagination, error boundary, error 404 page, Search Engine Optimization.

**Project Overview** 
This is a Github App which displays all my repositories in a paginated format with 6 Repos per page which spans over 5 pages. Clicking each repository gives more information about the clicked repository. I also implemented Nested routes which allows navigation between Home and Repo without rendering the whole page. Error boundary, error 404 page and Search Engine Optimization were also implemented.

**Setting up React**
I created a new React App using
npx create-react-app my-app

After a successful creation, I created the necessary folders and files.

**Setting up React Router**
Navigation is one of the primary features of any App or website. Without a good navigation, an App becomes difficult to use. React comes with a library called React Router which allows for navigation within the App. React Router is set up using the command.
npm install react-router-dom

After installing this library, I implemented Nested routes which allows for navigation without rendering the whole page.

**Home page**
This consists mainly of the Home and Repo navbar buttons, error boundary button and relevant texts.
The Repo navbar button takes user to the paginated repositories while the home navbar button returns user to the homepage. Both buttons work without rendering the whole page due to implemented nested routes.

**Pagination**
I implemented this feature after effecting Fetch API of all my Github repositories using the URL

https://api.github.com/users/Bentike/repos

With quite a lot of repositories, I needed to equally distribute(paginate) them to make the App user-friendly. I made each repo into a small card and placed 6 of them on a single page which spans over 5 pages.

**Error Boundary**
Errors within a an App may crash the whole App if it isn't caught and effectively managed by an error boundary. I executed this using the lifecycle methods namely
 static getDerivedStateFromError() or componentDidCatch()
Image description

This can be tested by simply clicking on the error boundary button in the home page.

**Conclusion**
This is the end of my little Github App walkthrough. I hope you have benefitted from this. Below is the Github Repository link to the code and deploy link.

Thanks for reading.

https://github.com/bentike
The Curious Case of 257
Tags: python, programming, beginners, productivity
Published: 2023-01-09 15:02:29

Python has an interesting caching feature, which I discovered recently -  


![code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gid14j11kjdiwr5qyt10.png)



This is called small integer caching. 

What Python does is pre-allocate a global list of integers as singletons in the range [-5, 256] during initialisation. So every time that an integer is created in this range, instead of creating a new object, a reference to the existing object is returned. Therefore it saves a lot of space and computation for commonly used integers.

This can also be seen during computations.


![code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t1msnjhpn6cnyyz9n09p.png)



Another interesting byte. When initialised in the same line, the interpreter creates a new object for the first variable, and then reference the second variable with the same object. This is because the  compiler can see both the variables and can optimise the referencing.


![code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vaztf2flsij9b6yzmhut.png)



Hey wait! I am not done yet.


![code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1z2ysoau7lv29lug1b7p.png)



Another new confusing thing?

The compiler also optimises identical literals, when the code is compiled in the same code object. So, 1. If the Python compiler can see the whole code, more optimisations may apply to the code. When typing into the Python shell each line is a completely different statement, parsed, and compiled separately. 

This works for floats as well, which is not cached.


![code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/egp4pjl0y6r7st5qlt46.png)



Literals inside tuples and other data structures are shared as well.


![code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l1rwqbw3j0vwaos0gesl.png)



Java uses a similar approach and caches the integers between -128 to 127. However this works only on autoboxing. They’re not cached if built with the constructor.

References -

[Why Python is Slow: Looking Under the Hood](http://jakevdp.github.io/blog/2014/05/09/why-python-is-slow/)

[Python internals: Arbitrary-precision integer implementation](https://rushter.com/blog/python-integer-implementation/)

[What's with the integer cache maintained by the interpreter?](https://stackoverflow.com/a/15172182)


PS: This is my first technical blog post, so any corrections and constructive criticisms are welcome!
Returning object literals using Javascript arrow function
Tags: object, javascript, functional, beginners
Published: 2023-01-09 15:00:37

Now this is one such problem where I found myself stuck for 30 odd minutes only because I didn't knew the usage of arrow functions properly. It's common for developers to feel "Ya i know that thing...", but when we encounter a problem where the logic you implemented seems all correct but there's some error with the syntax. So here I am going to discuss about a problem where I had to map one array of objects to another. The problem goes like - 

> You have an array of user objects, each one has name, surname and id. Write the code to create another array from it, of objects with id and fullName, where fullName is generated from name and surname.

Normally it's an easy problem (for any developer who has done some programming). This was my first attempt - 

`
let john = { name: "John", surname: "Smith", id: 1 };
let pete = { name: "Pete", surname: "Hunt", id: 2 };
let mary = { name: "Mary", surname: "Key", id: 3 };
let users = [ john, pete, mary ];
let usersMapped = users.map(item=>{
    fullName: ``${item.name} ${item.surname}``,
    id: item.id,
});
console.log(usersMapped);
`

This was okay for me as far as the logic of the problem was concerned. But on running, it gave me a bunch of errors. After proper research on the subject I found out that I was not using the arrow function properly. **_I found out that while using arrow functions with object literals we have to wrap the object literals with parenthesis_.**  Although I had learned the arrow function and done quite a few problems using the same, I was not aware of this fact that led me to this error and this wonderful insight. 

The fix : (see there's an extra pair of parentheses added)


`let usersMapped = users.map(item=>({
    fullName: ``${item.name} ${item.surname}``,
    id: item.id,
}));`

**In short : If you have to return objects using arrow function, wrap the object literals in parentheses.**

References : 
https://javascript.info/task/map-objects
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
 
**NOTE :** 
_This article does not claim to provide the best method of using arrow functions. There might be plenty more elegant methods of implementing the same. Through this article I am just sharing one of my experiences while solving a problem and how I started to learn from the errors. Also I would love to improve if you let me know my mistakes on this article._
Gitlab-CI - Comment partager des variables d'environnement dans after_script?
Tags: sre, devops, french
Published: 2023-01-09 15:00:00

Dans **Gitlab-CI**, on peut utiliser `after_script` pour effectuer certains traitement après une job, et ce, peut importe ce qui a pu se passer durant la job.

## Soucis
Mais si vous avez essayé de partager des variables d'environnement via `export` depuis les étapes `before_script` ou `script`, vous ne serez pas capable d'obtenir leurs valeurs.

## Qu'est-ce qui cause le soucis?
Pour chaque exécution de `after_script`, Gitlab va **créer une nouvelle instance shell**.

Par conséquent, tous les éléments temporaire **qui ne sont pas partagé entre toutes les instances shell ne seront pas accessibles depuis `after_script`.**

## Résolution
Pour résoudre ce soucis, vous pouvez simplement écrire la valeur de votre variable d'environnements dans un fichier, puis lire ce fichier dans la section `after_script`.

```yaml
job:
  before_script:
    - export TEST="test"
    - echo $TEST > test
  after_script:
    - export TEST = $(cat test)
    - echo $TEST
```

---

## Liens
- Gitlab : https://gitlab.com/
- Gitlab-CI - after_script : https://docs.gitlab.com/ee/ci/yaml/#after_script

---

J'espère que ça vous aidera! 🍺
7 Awesome Libraries for Java Unit & Integration Testing
Tags: java, testing, programming
Published: 2023-01-09 14:43:23

[In this video](https://youtu.be/JVPHSdHViMg) you'll find 7 awesome Java libraries that will improve your unit & integration tests.

* [AssertJ](https://assertj.github.io/doc/) - fluent assertions
* [Awaitility](http://www.awaitility.org/) - asynchronous testing
* [Mockito](https://site.mockito.org/) - Java mocking
* [Wiser](https://jitpack.io/p/davidmoten/subethasmtp) - in-memory SMTP server
* [MemoryFileSystem](https://github.com/marschall/memoryfilesystem) - in-memory file system
* [Wiremock](https://wiremock.org/) - HTTP mocking
* [TestContainers](https://www.testcontainers.org/) - throw-away sidecar containers

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