teleren/devto huggingface dataset:
data encoding for machine learning
Published: 2023-02-15 10:21:07

### introduction
some of the data available in real word is not mumerical for example if you are to record  people sex we have male and female. On the other hand most machine learning  algorithims only proses numerical data data. this is challegge hence the nessecity of coverting this categorical data to numerical data, the way we do this is  through data encoding. (data encoding is basically converting categorical data to numerical data.) They are several way to do this  and we will discus some of them.
The common data encoding techinuques include One hot encoding, target encoding, Label encoding, Ordinal encoding and direct encoding. 
For example using the titanic data set we can see that they are several collumn whose data type is not numerical

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

## Direct encoding
this is notmuch of an encoding techinuque as it is basicaly replacing  categorical data with numerical data.
eg for sex value you would replace male with 0 and  female with 1 as seen in the image below.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7f2q40wddmr24cavdr5u.png)
the colum gender which is encode from the sex of the passenger as the sex as 0 & 0 hich can now be processed by a machine learning model.

##One hot encoder
This technique create dummies for every unique category in the data colum but it drop the last colum. This is a limition to the techinuque as it has to create as many new colums as the unique data categories. it effective for data with few unique categories.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/66g6p911nrh7ot0vr3ue.png)dumies of sex colum

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kbn0nh9owrbq0279cmf8.png)an array of one hot encoder results

## label encoding
this techinique simplely give all the categories a data value without any preference.

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

## conclusion
they are more data encoding technique not covered above. but they are all important the key is choosing the one that fit your data well
Nitro Bot Launch
Published: 2023-02-15 10:11:55

The Nitro Bot Launch is an initiative to merge the potential of IoT and NFTs to create awareness and understanding about the power of IoT through the use of NFTs in a comic style. The Nitro Bot NFTs are a series of 10,000 unique NFTs that offer exciting benefits to the holders such as staking rewards, passive income through royalties, exclusive access to comic content, and discounts at the IoT and NFT marketplace. In the story behind the creation of Nitro Bot NFTs, Dr Nitro and the Nitro Bot NFTs must establish harmony in the ecosystem to defeat a dark entity on Earth. The Nitro Bot NFTs will be available to the public on Opensea from February 28th, and the Mint Roadmap consists of three mints, with the starting mint price at 0.08 ETH. The NFT Roadmap for Nitro Bot NFT consists of five phases, including the launch of the website, Nitro NFT comic and interactive content, and community building. Nitro Bot NFTs are an attractive investment option for collectors and investors, offering exclusive airdrops, community campaigns, and access to partner ecosystems.


Join our social media platforms: 
Nitro Network: https://twitter.com/Nitro_HQ 
Nitro Network NFT: https://twitter.com/NitroNetworkNFT
Discord: https://discord.gg/zsMjDYbP
Hiring Remote Developers Vs. Developer Relocation — What To Choose in 2023?
Tags: webdev, programming, writing, hiring
Published: 2023-02-15 10:04:55

The rise in remote work over the past few years has brought about a significant shift in the way companies hire and manage their employees. As a result, many organizations are faced with a choice between hiring remote developers or relocating in-person developers.

[In this article,](https://evrone.com/remote-developers) we will look at both options, explore their pros and cons, and provide insights into what companies should consider when making their decision in 2023. Whether you’re a startup or an established enterprise, this article will help you weigh the benefits and drawbacks of each hiring strategy and determine which one aligns best with your goals and values.
Unlocking the Power of Probabilities: An Introduction to Bayesian Networks
Tags: programming, machinelearning
Published: 2023-02-15 10:00:00

Bayesian Networks are a powerful tool in the field of Artificial Intelligence and Machine Learning, providing a graphical representation of probabilistic relationships between variables. They are used in a wide range of applications such as medical diagnosis, image recognition, and natural language processing. In this article, we'll explore the basics of Bayesian Networks, how they work, and their potential applications in the future.

---

## **What are Bayesian Networks?**

A Bayesian Network, also known as a Belief Network or a Bayes Net, is a probabilistic graphical model that represents a set of random variables and their conditional dependencies via a directed acyclic graph (DAG). Each node in the graph represents a random variable, and each edge represents a conditional dependency. The network allows for efficient computation of conditional probabilities, making it a useful tool for reasoning under uncertainty.

## **How do Bayesian Networks work?**

Bayesian Networks work by representing the probabilistic relationships between variables as a directed acyclic graph. Each node in the graph represents a random variable and is associated with a probability table that describes the probability of each state of the variable given the states of its parents. The network can be used to answer queries about the probability of certain events given certain evidence using the algorithm of belief propagation.

## **Applications of Bayesian Networks**

Bayesian Networks have a wide range of applications in various industries, including:

- **Medical diagnosis**: Bayesian Networks are used to model the relationships between symptoms, diseases and test results to assist in diagnostic decision making.
- **Image recognition**: Bayesian Networks are used to model the relationships between image features and object classes to improve the accuracy of object recognition.
- **Natural language processing**: Bayesian Networks are used to model the relationships between words and phrases to assist in tasks such as language translation and text summarization.
- **Finance**: Bayesian Networks are used to model the relationships between financial variables such as stock prices and exchange rates to assist in tasks such as portfolio management and risk assessment.
- **Robotics**: Bayesian Networks are used to model the relationships between sensor measurements, robot actions, and the environment to assist in tasks such as localization and mapping.

---

Bayesian Networks are a powerful tool in the field of Artificial Intelligence and Machine Learning, providing a graphical representation of probabilistic relationships between variables. They are widely used in various industries and have the potential to improve the performance of decision-making systems. With continued research and development, we can expect to see even more exciting applications of Bayesian Networks in the future.
Use video as background with CSS
Tags: tutorial, css, html, design
Published: 2023-02-15 09:25:55

Using images as a background is something we always do with simple css property i.e 
`background:url(path to image)`

However, sometimes there is a need to use video as a background. In this post I will share a neat and simple trick to use video as a background.

## Step 1: Create Container

First we will make a container in which video and other content will be there. Please note that height of the container will be relative to the height ratio of video. If you like you can limit it's height using (max-height) and hide overflow content with 'overflow:hidden'.

 

```
.vid-bg {width:100%; display:block; max-height: 500px; overflow:hidden;position:relative;margin:0; padding:0}
```

## Step 2: Set overlay content

This is the main part where we will be set our overlay content with the 'position:absolute' property. It will allow our content to remain on top of the video. Following is the code for overlay:

```
.vid-bg .content { width:100%; height:100%;top:0;position:absolute;background:rgba(0,0,0,0.6); padding:0px; color:#fff; text-align:center; font-size:30px; z-index:1; display:flex; align-items: center;
    justify-content: center;}
```

## Step 3: Use video element

Now we will use our video. There are 3 main properties that we will be using which are : 'autoplay', 'loop' & 'muted'.

1. autoplay: It will allow us to play our video as soon as its is loaded.

2. loop : It will allow our video to play on loop.

3. muted : This is crucial property because without this our video will not autoplay since chromium browsers only allow muted videos to autoplay.

Keep in mind the aspect ratio of video, if you want whole video to be shown then you will have to remove the 'max-height' property else your video will be clipped.

Following is the full html & css code :
HTML:
```
<div class="vid-bg">
<video muted  autoplay loop width="100%" src="https://joy1.videvo.net/videvo_files/video/free/2013-08/large_watermarked/hd0992_preview.mp4">
</video>
<div class="content"><h1> Use Video as background </h1></div>
</div>
```
CSS:

```
.vid-bg {width:100%; display:block; max-height: 500px;  overflow:hidden;position:relative;margin:0; padding:0}

.vid-bg .content { width:100%; height:100%;top:0;position:absolute;background:rgba(0,0,0,0.6); padding:0px; color:#fff; text-align:center; font-size:30px; z-index:1; display:flex; align-items: center;
    justify-content: center;}

.vid-bg .content h1 {background: rgba(255, 255, 255, 0.5); padding:20px; color:#111; border-radius: 60px; font-size:30px; margin:0 10px;}
```

TADA! You have done it. You can play around with following Codepen.

P.S. : BONUS Content in Codepen! Please check it out.

Thanks! Happy DEVing.

{% codepen https://codepen.io/shammishady/pen/ababrro %}
ChatPic: AI natural language photo editor
Published: 2023-02-15 09:05:38

Hey crew, I'm just launching this and wanted to hear your feedback!!

Say goodbye to complicated photo editing tools!
I'm excited to announce the upcoming launch of ChatPic, the conversational photo editor for images!
Edit your photos with just a few words, no need for complex toolsSign up for early access to the beta release and be one of the first to experience ChatPic! 🎉

Want to know more:
[https://chatpic.online](https://chatpic.online)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kjzcnr5bm2qzmmz1t3aa.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t9lev9uiph4kzs01j9e3.png)
Exploring the Agile Testing Quadrants for Successful Software Testing
Tags: testing, agile, tutorial
Published: 2023-02-15 09:02:52

I'm happy to provide some information about the Agile Testing Quadrants, a great testing resource. This tool, created by Brian Marick in 2003, aids in the classification of tests, early resource identification, and team guidance for planning, development, and releases.

When using this tool, it's important to bear in mind that there are no hard rules, no sequence is implied by the quadrants, and not all tests are necessary. Understanding test types and using the quadrants to direct the team is the goal here.

We have technology-focused tests in Quadrant 1 that assist the team and guarantee functionality. These tests are written concurrently with development and are automated. In this quadrant, tools like NUnit and Moq can be beneficial.

Business-facing tests that aid in resolving issues and validating application features are the emphasis of quadrant 2. Both human and automated versions of these tests ought to be covered by the Definition of Done (DoD). The tools in this quadrant include Flow Diagrams, GUI Tests, and Behavior-Driven Development.

Although it also concentrates on business-related testing, Quadrant 3 tries to evaluate the product and comprehend user experience. These mostly manual tests give information about how the application is currently behaving. In this quadrant, intuition, critical thinking, and domain knowledge are crucial skills, while GUI tests, workflow tests, logs and traces can be practical tools.

Last but not least, Quadrant 4 concentrates on technological tests that assess the product and reveal information about the project. These automated tests provide information on performance, stability, scalability, and other characteristics. Tools in this quadrant that can be useful include profilers, memory and resource monitors, and load and performance test tools.

The Agile Testing Quadrants can be a helpful resource for any team involved in testing. Have you used this tool before? Let me know in the comments!
How to parse XML in Total.js Flow
Tags: totaljs, totaljsflow, iot, nodered
Published: 2023-02-15 08:51:02

**[Total.js Flow](https://totaljs.com/flow)** is the famous **[Node-red](https://nodered.org)** alternative. It’s a friendly, modern, straightforward Visual Programming Interface for Low-code Development accessible through a web browser.

**XML** stands for Extensible Markup Language. It is similar to HTML in its appearance but, XML is used for data presentation, while HTML is used to define what data is being used. XML is exclusively designed to send and receive data back and forth between clients and servers. Take a look at the following example:

Example:

```<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<food>
    <item name="breakfast">Idly</item>
    <price>$2.5</price>
    <description>
   Two idly's with chutney
   </description>
    <calories>553</calories>
</food>
<food>
    <item name="breakfast">Paper Dosa</item>
    <price>$2.7</price>
    <description>
    Plain paper dosa with chutney
    </description>
    <calories>700</calories>
</food>
<food>
    <item name="breakfast">Upma</item>
    <price>$3.65</price>
    <description>
    Rava upma with bajji
    </description>
    <calories>600</calories>
</food>
<food>
    <item name="breakfast">Bisi Bele Bath</item>
    <price>$4.50</price>
    <description>
   Bisi Bele Bath with sev
    </description>
    <calories>400</calories>
</food>
<food>
    <item name="breakfast">Kesari Bath</item>
    <price>$1.95</price>
    <description>
    Sweet rava with saffron
    </description>
    <calories>950</calories>
</food>
</metadata>```


In the following video you will learn how easy you can parse XML to json within Total.js Flow (Don't forget to subscribe):
{% embed https://www.youtube.com/watch?v=ZerRYfpLuvk %}

---

- [__Make the Total.js Platform better, support it!__](https://www.totaljs.com/support/)
- [Have any questions? Contact us](https://www.totaljs.com/contact/)
- [Join Total.js Telegram](https://t.me/totaljs)
Rolling update in Kubernetes
Tags: kubernetes, deployment
Published: 2023-02-15 08:42:07

Rolling Update is a way of updating your application running in Kubernetes without causing downtime. It gradually replaces the old version with the new version one by one, so that users can still access the application while the update is happening. This makes updates more reliable and easier to manage, and helps ensure that your application remains available and responsive to users.

### Step 1 -- Create deployment and Service
create file named rolling-app.yaml

```yaml
cat > rolling-app.yaml << EOF
apiVersion: apps/v1
kind: Deployment
metadata:
 name: my-app
 namespace: rolling
spec:
 replicas: 5
 selector:
   matchLabels:
     app: my-app
 template:
   metadata:
     labels:
       app: my-app
   spec:
     containers:
       - name: nginx
         image: bayhaqisptr/nginx-canary:v1
         ports:
           - name: http
             containerPort: 80
         resources:
           requests:
             cpu: 100m
             memory: 50Mi
           limits:
             cpu: 200m
             memory: 100Mi
---
apiVersion: v1
kind: Service
metadata:
 name: my-app
 namespace: rolling
 labels:
   app: my-app
spec:
 type: NodePort
 ports:
 - name: http
   port: 80
   targetPort: http
 selector:
   app: my-app
EOF
```

Create namespace `rolling`

```bash
kubectl create ns rolling
```

and apply `rolling-app.yaml`

```bash
kubectl apply -f rolling-app.yaml
```


### Step 2 -- Set image with another version tag

use command `kubectl set image` to set image in existing deployment

```bash
kubectl set image deployment.v1.apps/my-app my-app=bayhaqisptr/nginx-canary:v2
```

see rollout status with following command 

```bash
kubectl rollout status deployments/my-app
```

show available changes that made

```bash
➜  rolling kubectl rollout history deployment.apps/my-app -n rolling                               
deployment.apps/my-app 
REVISION  CHANGE-CAUSE
2         <none>
3         <none>
```

check service will be responses with version 2

access app with node ip and node port has been created

```bash
➜ curl 172.23.0.5:31374 
<html>
<h1>Hello World!</h1>
<p>This is version 2</p>
</html>
```


### Step 3 -- Rollback deployment

rolling back to one previous version

```bash
kubectl rolling undo deployment/my-app
```

rolling back to specific revisions

```bash
kubectl rolling undo deployment/my-app --revision=2
```
addeventlistener with class method and bind
Published: 2023-02-15 08:22:19

I wanted to write addeventlistener inside a class constructor. But then, javascript requires classMethod.bind(this) and that sometimes is annoying to be used with addeventListener because that also send 'event' to callback classMethod. 

The biggest winner is 
```
making classMethod as () => { } arrow function.
Then it wouldn't mess up your this. inside class method.
```

https://stackoverflow.com/questions/21298918/is-it-possible-to-call-a-class-method-with-addeventlistener
Https scrapping AWS App Runner URL with Prometheus
Tags: prometheus, apprunner, aws, nginx
Published: 2023-02-15 08:00:44

You might have come across the following error (404 Not Found) while trying to scrape Prometheus metrics with App runner. This error occurs when the Prometheus server is configured to serve HTTPS traffic.


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

A simple solution is to configure App runner as a reverse proxy for Prometheus. 

Thus, for this we will be using ngnix from our host. We will be configuring ngnix as a reverse proxy for Prometheus. This will allow us to scrape the metrics from Prometheus server via HTTPS.

**Step 1**: Install ngnix on our host machine. 
**Step 2**: Create an Nginx configuration file (e.g. nginx.conf) on the host.
**Step3**: Add the following configuration to the Nginx configuration file:


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

Change the Host and proxy_pass as per your domain.

**Step 4**: Restart the Nginx service to apply the changes.

**Step 5**: Configure the prometheus.yml file as below


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

Change the 'target' field as per your proxy domain.


With this setup, when Prometheus scrapes 
"https://example.us-east-1.awsapprunner.com/actuator/prometheus", 
 it will actually be redirected to 
"https://example.us-east-1.awsapprunner.com:443/actuator/prometheus" via the Nginx reverse proxy.

This will eliminate the 404 Not found error as Prometheus can now access the domain and return the metrics path data.

Authors:
@vivekpawar
@vedantyerpude14
Today's Daily Humor For Devs - Daily Developer Jokes
Tags: jokes, dailydeveloperjokes
Published: 2023-02-15 08:00:29

---
title: "Today's Daily Humor For Devs - Daily Developer Jokes"
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/5e125964dfaa7.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:
___Q:___ What is React's favorite movie genre?

___A:___ Suspense
 -->
How to Request Admin Permissions in Windows Through UAC with Golang
Tags: technology
Published: 2023-03-01 18:37:02

---
title: How to Request Admin Permissions in Windows Through UAC with Golang
published: true
date: 2023-02-15 07:59:42 UTC
tags: Technology
canonical_url: https://blog.hadenes.io/post/how-to-request-admin-permissions-in-windows-through-uac-with-golang/
---

Originally posted at https://blog.hadenes.io/post/how-to-request-admin-permissions-in-windows-through-uac-with-golang/

In Windows, User Account Control (UAC) is a security feature that helps prevent unauthorized changes to the operating system. When an application requires elevated privileges to perform certain actions, UAC prompts the user for permission to proceed.

In this guide, we’ll show you how to request admin permissions in Windows through UAC using Golang.

So yeah, it’s basically `sudo`.

### Requesting Admin Permissions

To request admin permissions in Windows through UAC with Golang, you’ll need to use the **syscall** and **`windows`** packages. Here’s how you can do it:

```

package main

import (
   	"syscall"
   	"time"
   	"os"
   	"strings"
   	"fmt"
   	"golang.org/x/sys/windows"
)
    
func becomeAdmin() {
   	verb := "runas"
   	exe, _ := os.Executable()
   	cwd, _ := os.Getwd()
   	args := strings.Join(os.Args[1:], " ")
    
   	verbPtr, _ := syscall.UTF16PtrFromString(verb)
   	exePtr, _ := syscall.UTF16PtrFromString(exe)
   	cwdPtr, _ := syscall.UTF16PtrFromString(cwd)
   	argPtr, _ := syscall.UTF16PtrFromString(args)
    
   	var showCmd int32 = 1 //SW_NORMAL
   
   	err := windows.ShellExecute(0, verbPtr, exePtr, argPtr, cwdPtr, showCmd)
   	if err != nil {
  		fmt.Println(err)
   	}
}
    
func checkAdmin() bool {
   	_, err := os.Open("\\\\.\\PHYSICALDRIVE0")
    
    return err == nil
}

```

The **`becomeAdmin()`** function elevates the current executable to admin privileges. It retrieves the path and arguments of the current executable using **`os.Executable()`** and **`os.Args`** , respectively, and uses **`windows.ShellExecute()`** to run the executable with elevated privileges.

The **`checkAdmin()`** function checks if the current process is running with admin privileges. It does this by attempting to open the physical drive using **`os.Open()`**. If an error occurs, the function returns **`false`**.

To use these functions, you can call **`checkAdmin()`** to check if the current process is running with admin privileges. If not, call **`becomeAdmin()`** to elevate the current process:

```

if !checkAdmin() {
  	becomeAdmin()
   
   	time.Sleep(2 * time.Second)
   
 	os.Exit(0)
}

```

This will kill the original process and spawn a new one with admin privileges, so you likely want this to be the first thing to run.

### Source

This guide is based on the Gist created by user **`jerblack`** , which can be found at [https://gist.github.com/jerblack/d0eb182cc5a1c1d92d92a4c4fcc416c6](https://gist.github.com/jerblack/d0eb182cc5a1c1d92d92a4c4fcc416c6).