teleren/devto huggingface dataset:
A straightforward Flask replacement for ML model deployment
Tags: mlops, news, machinelearning
Published: 2023-08-10 19:27:02

Why would someone need to replace [Flask](https://flask.palletsprojects.com) or [FastAPI](https://fastapi.tiangolo.com) for the task of deploying a model? They get the job done. Well, yes — that was what I used to think.

Some time ago I gave the task of serving a model to a team of junior developers. It was a data science team, good at developing models, without prior web development knowledge.

I told the team: use something simple like Flask. They finally did it, but struggled with some web concepts such as requests, responses and headers during that day.

So, we are used to web frameworks for model serving, while we could be using a leaner and more specific tool for the task. That is what [Deserve](https://github.com/matiasbattocchia/deserve) is about.

I bid goodbye with an example:

```py
import deserve
from transformers import pipeline

# Load your model
classifier = pipeline('sentiment-analysis')

@deserve
async def predict(payload: object) -> object:
    return classifier(payload)
```
Two+ things I do every time I set up a new node project
Tags: node, javascript
Published: 2023-08-10 19:23:48

## 1. Early first commit
Committing regularly is a very good habit. And there is one point in time where it is especially helpful, right after you created a new project and BEFORE you type the first character in your project.

For example, right after creating a new Vite project (or bootstrapping with any other template):

```bash
git init
git add --all
git commit -m "blank vite react/typescript project"
```

This way you can easily spot what you have done and what has been created by `create vite@latest` for example.

## 2. Create a .nvmrc file

Working with different versions of Node on the same project might cause unnecessary trouble. So the second thing I do after setting up a node project is to create a `.nvmrc` file in the project root.

```bash
node --version > .nvmrc
git add .nvmrc
git commit -m "created .nvmrc file"
```

This will create a file named `.nvmrc` with this content:
```
v18.16.0
```

Having done that, any developer can just run `nvm use` in the project folder and [nvm](https://github.com/nvm-sh/nvm) will automatically switch to the correct version of node.

> 💡**Pro Tip** You can set up a script that will [automatically call nvm use](https://github.com/nvm-sh/nvm#zsh) whenever you enter a directory that contains an `.nvmrc`

## (3. Install node's types)
If working with TypeScript I also install the types package for node. Sooner or later you will need this.

```bash
npm install @types/node -D
```

## (4. Add a `jsconfig.json`)
If you are going to use an editor that uses <abbr title="Language Server Protocol">LSP</abbr> (VSCode, Sublime Text, etc.) make sure you have a `jsconfig.json` (or `tsconfig.json`) file for your project. Not having this file [might bring you into trouble](https://dev.to/receter/no-jsconfigjson-no-fun-31b8).
How do I get an intership at FAANG?
Tags: career
Published: 2023-08-10 19:17:04

So, basically I am still a student but want to get an internship in a FAANG company. I have done nothing Earth shattering and was hoping to get noticed by some of the talent hunters. What should I do to get accepted at some of these companies? Please add how you got an intership/full-time job at one of these companies.
Marshal Class in Service Oriented Architecture C++
Tags: networking, cpp
Published: 2023-08-10 19:12:44

🚀 Exciting Networking Protocol Insight: Leveraging the Power of the Marshal Class in Client-Server Architecture! 🌐🔗

👋🏼 Today, let's dive into a crucial aspect of networking protocols, specifically within the Client-Server architecture. 🖥️💼

🔍 Imagine a scenario where a client needs to request a specific method from a server and pass serialized parameters required by that service. This is where the Marshal class steps in to play a pivotal role. 📦🔗

✨ Marshal: The Serialization and Deserialization Maestro ✨
In this architecture, the Marshal class serves as a bridge between the client and server, responsible for efficiently packaging and unpacking data.

📦 Serialization: When the client intends to invoke a method on the server, the Marshal class serializes the method's parameters into a raw data format that can be easily transmitted over the network. This ensures data integrity and minimizes data transfer overhead.

🔍 Deserialization: Once the server receives the serialized data, the Marshal class performs the reverse process. It takes the raw data and skillfully deserializes it, converting it back into parameters that the server's requested method can understand and process.

in the provided snippet you will find My Implementation of the Marshal class in C++ and Example of how to use it.


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


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hi4zz8x8z87wbin0bb6d.png)
Construindo sua marca pessoal no mundo Open Source
Tags: braziliandevs, githubbrasil, opensource, career
Published: 2023-08-10 18:56:28

No mundo acelerado e interconectado da tecnologia, estabelecer uma identidade como pessoa desenvolvedora de open source pode ser uma ótima estratégia para destacar suas habilidades, colaborações e paixões. O GitHub, como uma plataforma central para projetos de open source, oferece um espaço para construir sua marca pessoal e criar seu espaço na comunidade global de desenvolvimento. 
Neste artigo, vamos falar sobre algumas etapas para construir uma marca pessoal sólida como pessoa desenvolvedora de open source no GitHub.

  

## Encontre seu espaço na Comunidade

  

Antes de mais nada, é importante descobrir o que você deseja comunicar na comunidade de open source. Se pergunte: quais são seus interesses? Quais problemas você precisa resolver? Depois que você tiver identificado as respostas para estas perguntas comece a procurar projetos no GitHub que tenham alguma relação com elas. Além de te ajudar a encontrar projetos de seu interesse , também te dá a oportunidade de conhecer outras pessoas e participar de comunidades.

  

## Tenha um Perfil Atrativo

  

Seu perfil no GitHub é sua vitrine para o mundo. Faça com que ele mostre quem você é como pessoa desenvolvedora e o que você está contribuindo para a comunidade. Inclua uma breve descrição sobre você, suas habilidades-chave e seus interesses de desenvolvimento.

  

## Contribua Ativamente para Projetos Relevantes

  

Contribuições são uma das coisas mais importantes para a construção da marca pessoal. Escolha projetos alinhados aos seus objetivos. Faça contribuições significativas, como resolver problemas, adicionar recursos ou melhorar a documentação. Seja consistente em suas contribuições, demonstrando comprometimento. Colaborando com outras pessoas da comunidade, você estará criando conexões valiosas e fortalecendo sua marca pessoal.

  
  
  
  

## Focando na Diversidade e Inclusão

  

Ao construir sua marca pessoal, é crucial priorizar a diversidade e a inclusão. Esteja atente a oportunidades de colaborar com pessoas de diferentes origens e experiências. Crie um ambiente acolhedor em seus próprios projetos e interações, promovendo uma comunidade de open source verdadeiramente inclusiva.

  

## Conclusão

Construir uma marca pessoal como pessoa desenvolvedora de open source no GitHub é um processo contínuo. Requer dedicação, paixão e esforço constante para construir relacionamentos, demonstrar habilidades e contribuir para a comunidade. Lembre-se de que sua marca pessoal é um reflexo autêntico de quem você é como pessoa desenvolvedora e do impacto positivo que você pode ter na comunidade global de open source.
DAY 68 - Single Number I
Tags: leetcode, coding, algorithms, tutorial
Published: 2023-08-10 18:43:52

Welcome to DAY 68. Today we will diverge once again into the Data Structures and look at some more questions. Today we are going to do a question  again on Bit Manipulation.


## Question: [Single Number](https://leetcode.com/problems/single-number/)

_Given a non-empty array of integers nums, every element appears twice except for one. Find that single one._

_You must implement a solution with a linear runtime complexity and use only constant extra space._

---

### _Example 1:_

> Input: nums = [2,2,1]
> Output: 1

### _Example 2:_

> Input: nums = [4,1,2,1,2]
> Output: 4


---


**_We are going to solve this problem using Bit Manipulation_**
Incase you don't know what's bit manipulation, It is the modification or manipulation of smallest form of data(a bit) and using their properties with bit operators to generate favorable results.
Read the article before this for a start.

---

### Intuition: Using XOR Operation

_**Associative Property of XOR:** The XOR operation has the associative property, which means that (a ^ b) ^ c is equivalent to a ^ (b ^ c). This property allows us to combine numbers in any order without changing the result._

_**Cancelling Out Duplicates:** When we XOR a number with itself, it results in 0. Additionally, XORing any number with 0 leaves the number unchanged. By XORing all numbers in the array together, the duplicate numbers will effectively cancel each other out, resulting in the unique number being left in the final XOR result._


**Using these XOR properties, we will find out the ans.**


### Algorithm Steps:

1. Initialize a variable `ans` to 0. This variable will eventually hold the unique number.

2. Iterate through each element `nums[i]` in the input array:
   - XOR the current value of `ans` with `nums[i]` and update `ans`.

3. After the loop, the variable `ans` holds the unique number that appears only once in the array.

### Example:

Input Array: [4, 2, 4, 3, 2]

- Initialize `ans` as 0.
- Iterate through the array:
  - `ans ^= 4` -> `ans` becomes 4.
  - `ans ^= 2` -> `ans` becomes 6.
  - `ans ^= 4` -> `ans` becomes 2.
  - `ans ^= 3` -> `ans` becomes 1.
  - `ans ^= 2` -> `ans` becomes 3.

Final `ans` value is 3, the unique number in the array.


### Code:

```cpp
class Solution {
public:
    int singleNumber(vector<int>& nums) {
        int ans = 0;
        for (int i = 0; i < nums.size(); i++)   
            ans = ans ^ nums[i];
        return ans;
    }
};

```


### Complexity Analysis:
**Time: O(N)**
**Space: O(1)**
wayland & clipboard
Tags: linux, wayland, clipboard, copy
Published: 2023-08-10 18:29:25

The clipboard in wayland works differently than in X11.
For some programs like vim to be able to access the system clipboard you must have installed wl-clipboard

``` bash
sudo apt install wl-clipboard
```

To be able to copy stdout you need wl-copy, xclip or xsel doesn't work anymore

``` bash
sudo apt install wl-copy
```
example
``` bash
echo "Hello world" | wl-copy
```
How are Domain and Hosting Different?
Published: 2023-08-10 18:06:05

As a beginner, are you struggling to discover how are domain and hosting from each other? These two come together, but they are clearly not the same. However, they both are essential to set up a site. 
Navicosoft is a competent web hosting domain registrar company. We make sure to host your site in such a way that helps you in achieving your business goals!
**What is a domain name?**
A domain name is a site’s address where users can reach you through the internet. Users type the address in the browser’s URL bar and get access to your website. A domain has mainly two parts. The first part is your brand's name, and the other is associated with the domain extension such as .com, .net, .org, etc.
**What is a Web hosting?**
[Web hosting](https://www.navicosoft.com/web-hosting/) is a storage place where the website’s content is located. The basic aspect that differentiates domain and hosting is that a domain name is a site’s address just like that of your house, whereas web hosting is the exact house.

When a user reaches the site’s address in the URL bar, a domain name directs them to the stored file. This way, they can get in touch with your website.
**What Is the Important Difference between Domain and Hosting?**
The main essential thing that matters is that you need both, web hosting account as well as a [domain name](https://www.navicosoft.com/domain-name/) to build a website. You can’t create a website if you don’t have each of the two.
Firstly select your domain name and register it with one of the domain registrar companies. Your registration will be valid for at least one year, and you can restore it before it expires.
The next step is to get a web hosting plan for your site and link it with the domain name. After this, you can simply install the website's software with tools and plugins and start adding content to your site.
**Can You Buy Web Hosting and Domain from the same Company?**
Yes, you can. It is up to you! However, you can purchase a domain name and host with the same company or even a different one. However, if you buy both from the same company, the setup method will be easy for you, and you will not have to modify the domain settings as well. Consequently, most companies provide both services together.
[Navicosoft](https://www.navicosoft.com/) is a well-known domain registration company, providing you reliability, full domain management with panel control, and maximum support to execute your dream business idea. Along with domain name registration, we also give customizable web hosting plans for your blog and site. We are one of the most reliable web hosting companies, providing extraordinary services.
This content is taken on given link:
[https://www.riteanswers.com/domain-and-hosting/details/how-are-domain-and-hosting-different](https://www.riteanswers.com/domain-and-hosting/details/how-are-domain-and-hosting-different)
Use Genymotion SaaS to run Maestro E2E on CI
Tags: android, e2e, cicd, maestro
Published: 2023-08-10 18:00:01

[Genymotion](https://cloud.geny.io) service privide a huge amount of Android emulators that can be used to run [Maestro E2E tests](https://maestro.mobile.dev/). 

I'll try to provide you a short list of instructions in this article to help you create a workflow.


---

Let's first install [`gmsaas`](https://docs.genymotion.com/gmsaas/) cli

```tsx
pip3 install gmsaas
gmsaas config set android-sdk-path "$ANDROID_HOME"
```

After that, you need to sign in (_Obviously, you must [signup](https://cloud.geny.io/signup) first_) 

```tsx
export GMSAAS_EMAIL="you-email@test.com"
export GMSAAS_PASSWORD="you-password"

gmsaas auth login $GMSAAS_EMAIL $GMSAAS_PASSWORD
```

Let's begin by starting your first Android emulator now.

To start Android you need to know its `recipes_id`. You can make your own or use already created recipes:

```bash
gmsaas recipes list # print list available recipes
# ...
# 4c015ada-e64e-4f5d-a320-06cbf6e95648  Google Pixel 3a          10.0       1080 x 2220 dpi 420  genymotion
# 70eaaf75-bd9a-406d-9f01-682a5d400c6e  Samsung Galaxy S10       10.0       1440 x 3040 dpi 560  genymotion
# e104f058-b291-4764-8e0d-d9ff78a41192  Custom Phone             11.0       768 x 1280 dpi 320   genymotion
# c65db329-511a-4c2a-9761-c7259649e8c7  Custom Tablet            11.0       1536 x 2048 dpi 320  genymotion
# 95016679-8f8d-4890-b026-e4ad889aadf1  Google Pixel 3a          11.0       1080 x 2220 dpi 420  genymotion


INSTANCE_UUID=$(gmsaas instances start 95016679-8f8d-4890-b026-e4ad889aadf1 my_instance_name)
```



Now, on the [Virtual Devices](https://cloud.geny.io/launchpad) page, you should be able to see a launched instance:


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


`INSTANCE_UUID` on the screenshot above have to store UUID value of that instance, using this UUIS you can connect a running instance to ADB:

```shell
gmsaas instances adbconnect $INSTANCE_UUID

$ANDROID_HOME/platform-tools/adb devices # check if it works
# List of devices attached
# localhost:34953	device
```


when an instance will be connected you run Maestor e2e:

```shell
$ANDROID_HOME/platform-tools/adb install myApp.apk
# ^^^ install app
$HOME/.maestro/bin/maestro test .maestro/myTest.yaml
# ^^^ run tests
```


video demonstration:

{% vimeo 853447374 %}





Finnaly when test pass don't forget to stop instance at the end:

```shell
gmsaas instances stop --no-wait $INSTANCE_UUID
```


---

> If you don't want to read the manual, **just copy [Maestro and Genymotion](https://github.com/retyui/Using-GitHub-Actions-to-run-your-Maestro-Flows#genymotion-saas) from my repository as working examples.**

That also includes **Github Actions** configuration: [`android-genymotion-cloud.yaml`](https://github.com/retyui/Using-GitHub-Actions-to-run-your-Maestro-Flows/blob/main/.github/workflows/android-genymotion-cloud.yaml)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zi3e9bl9uxeol2f0bfa8.png)
What would everyone think of a `window.post` variable in JavaScript?
Tags: idea, javascript, discuss, webdev
Published: 2023-08-10 18:00:00

Okay, hear me out because this case may or may not be niche.

## The Issue

So, PHP has `$_POST`, which can access posted form data, which is nice for things that work server-side.
But, what if I wanted my HTML to be a local file, which could run offline; now, let's say I had a form and I wanted to send the data to another file:
```html
<form action="./process_info.html" method="post">
  <!-- ... -->
</form>
```
I feel like we should have something to PHP `$_POST`.

## The Solution

My solution is `window.post`, which would either be a generic object, or a map of sorts — or, in classic JavaScript fashion, it could be its own class.
Something like:
```html
<script>
  if(window.post.get("age") < 18) { /* Generic under-18 code. */ }
  else { /* Other code. */ }
</script>
```

## What Exists Currently

Looking at [a StackOverflow post](https://stackoverflow.com/questions/1409013/how-to-read-the-post-request-parameters-using-javascript) I found, one solution seems to be to override the behavior of the `submit` code and use `sessionStorage` then redirect; however, there is no real means of (more) effectively accomplishing this.
As [GetFree](https://stackoverflow.com/users/25700/getfree) says in a reply to the accepted answer, this is something that would be perfectly viable; not only would this work because the browser already knows the data, **but also** each local HTML file is treated as its "own server" (kind of), so, in theory, data could be passed to a local file like it could a file on a server, or at least I believe so.

## What are your thoughts?

Do you (all) think this is something that could provide benefit?
Would it be worth adding this for local HTML apps?



<center><b>Thanks for reading!<br/>Cheers!</b></center>
My 1st Day of #100DaysCoding Challenge- Journey Begins!!
Tags: cpp, 100daysofcode, beginners, community
Published: 2023-08-10 17:37:48


Hey there, awesome Dev.to community!

Today marked the first day of my personal coding journey as part of the #100DaysCoding challenge, and let me tell you, it was exhilarating! I promised myself that I would make coding a part of my daily routine, and I'm excited to share my experiences with you all.

**_Highlights of My Day:_**
I kicked things off by diving into some practice problems on Geeks for Geeks, focusing on the basic level. As I worked through the challenges, I encountered a few stumbling blocks along the way. But hey, that's part of the learning process, right?

When I hit a roadblock, I turned to the trusty tool of every programmer: Google(well Chatgpt tbh). I looked up specific parts of the problems I was struggling with and found some great insights that helped me navigate through the challenges.

But that wasn't all! I also delved into a C++ tutorial for creating a digital clock. Although I haven't finished it yet, I'm already absorbing a wealth of knowledge. I got hands-on experience using headers like `windows.h`, `dos.h`, `conio.h`, and `time.h`, which expanded my understanding of these essential libraries.

**_What's Next?_**
I'm eagerly looking forward to tomorrow's coding session. There's something incredibly satisfying about this process—learning, implementing, and growing each day. I'm determined to make steady progress and eventually complete that digital clock project.

Oh, and here's an exciting tidbit: I decided to capture today's coding session in a time-lapse video! 🎥 If you're curious about my coding setup (which is just a desk and laptop ngl) and workflow, head over to my Instagram account **@coders_kernel**. I'll be sharing this video there, so you can get a glimpse into my coding adventure.

**_Join Me on this Journey:_**
If you're like me, striving to embrace coding daily and make it a significant part of your life, let's do this together! Whether you're just starting out or you're a seasoned coder, we can learn from each other's experiences, challenges, and triumphs.

Feel free to drop a comment below about your own coding journey or any tips you have for staying motivated. Let's connect, inspire one another, and make the most of this coding journey.

Until tomorrow's update, happy coding, everyone!

Sivaraghavi
Determine whether an integer is a palindrome
Tags: programming, beginners, javascript, interview
Published: 2023-08-10 17:35:13


Good morning! Here's your coding interview problem for today.

## This problem was asked by Bloomberg.

**Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.**

**Follow up**: Coud you solve it without converting the integer to a string?

**Example**

```
function isPalindrome(x) {

}

console.log(isPalindrome(121)) // true
console.log(isPalindrome(-121)) // false
console.log(isPalindrome(10)) // false
```

**Solution**

```
function isPalindrome(x) {
  if (x < 0) return false;
  let num = x;
  let reversed = 0;
  while (num > 0) {
    reversed = reversed * 10 + (num % 10);
    num = Math.floor(num / 10);
  }
  return reversed === x;
}

console.log(isPalindrome(121)); // true
console.log(isPalindrome(-121)); // false
console.log(isPalindrome(10)); // false

```

**Explanation**

- Handle negative numbers by returning false early.
- Initialize reversed to 0.
- While the original number num is greater than 0:
- Take the remainder of num divided by 10 to extract the last digit
- Add that digit to the reversed number multiplied by 10
- Remove the last digit from num by dividing by 10
- Once the original num reaches 0, reversed will contain the digits in reverse order. Compare it to the original x to determine if it is a palindrome.
- This iterates through the digits of x once while reconstructing the reverse order in reversed. It avoids converting the integer to a string.
Guess the output
Tags: javascript, beginners, programming, interview
Published: 2023-08-10 17:28:03

## This problem was asked by Amazon.

**What does the code snippet to the right output by console.log?**

```
console.log(1)
const promise = new Promise((resolve) => {
  console.log(2)
  resolve()
  console.log(3)
})

console.log(4)

promise.then(() => {
  console.log(5)
}).then(() => {
  console.log(6)
})

console.log(7)

setTimeout(() => {
  console.log(8)
}, 10)

setTimeout(() => {
  console.log(9)
}, 0)
```

## output

```
1
2
3
4
7
5
6
9
8
```

**Explanation**

- The synchronous code runs first. So 1, 2, 3, 4 , 7 are logged immediately.
- 5 and 6 are logged after 7 since they are in .then() handlers.
- 9 is logged before 8 since the timeout of 0 ms happens sooner than 10 ms.
- Promises and timeout callbacks are asynchronous which is why they run after the sync code.