teleren/devto huggingface dataset:
Weekly Challenge 205
Tags: perl, python, theweeklychallenge
Published: 2023-02-20 12:30:08

[Challenge](https://theweeklychallenge.org/blog/perl-weekly-challenge-205/), [My solution](https://github.com/manwar/perlweeklychallenge-club/tree/master/challenge-205/sgreen)

## Task 1: Third Highest

### Task

You are given an array of integers.

Write a script to find out the Third Highest if found otherwise return the maximum.

### My solution

This is relatively straight forward. It is clear from the third example, that we only care about unique numbers. The first thing I do is sort the list removing non-unique numbers. For Python, I use `sorted(set(n))`. Sets are by-definition unique, and sorted will turn the set back to a list. In Perl, I used `sort  {$a <=> $b} (uniq(@n))`. uniq comes from List::Util, while `{$a <=> $b}` sorts values numerically.

If there are three or more unique values in the list, I get the value third from the end and display it. If there are less than 3 unique values, I display the last one.

### Examples

```bash
$ ./ch-1.py 5 3 4
3

$ ./ch-1.py 5 6
6

$ ./ch-1.py 5 4 4 3
3
```

## Task 2: Maximum XOR

### Task

You are given an array of integers.

Write a script to find the highest value obtained by XORing any two distinct members of the array.

### My solution

In both Python and Perl, the `^` operator returns the XOR-ed value of the two integers. Like with the first task, I remove non-unique values. A number XOR-ed with itself will always be zero.

I'm sure some cleverer Team PWC members have some formula to get the most efficient XOR-ed values, I just try every combination.

Given that we only need to compare two values, I use a simple iteration rather than methods like combinations from itertools to produce all possible combinations.

This is done with two loops. The outer loop (with the variable `first`) loops from 0 to 2 less than the length of the array. The inner loop (called `second`) loops from one more than `first` to one less than the length of the array. For each iterations, I calculate the XOR-ed number of the two numbers at the appropriate position. If it is greater than the current `max`, I set a new `max` value.

### Examples

```bash
$ ./ch-2.py 1 2 3 4 5 6 7
7

$ ./ch-2.py 2 4 1 3
7

$ ./ch-2.py 10 5 7 12 8
15
```
CAP theorem and what does it means
Tags: captheorem, cloudcomputing, distributedsystem
Published: 2023-02-20 16:13:31

---
title: CAP theorem and what does it means
published: true
description: CAP theorem is trade-off between consistency and availability. This video is about what is CAP theorem and what each properties means.
tags: captheorem, cloudcomputing, distributedsystem
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-02-20 16:10 +0000
---

The CAP theorem addresses the trade-off between consistency, availability, and partition tolerance in a distributed system. In this video, let's go through each of these properties and altogether what these properties mean in a distributed system.


{% youtube 3tI3g_nqWlo %}
Should I use Yoast Free or Yoast Premium Version?
Tags: seo, yoast, wordpress, optimization
Published: 2023-02-20 16:09:58

In a previous article, I talked about Yoast, defining what it was as well as listing some of its features. But if you would like to use Yoast to manage your content, have you already thought of which version to use? I mean will you use the Yoast free version or rather the premium version? Well, it may depend on many factors, the first being the different features each offer. In this article I will help you to answer the question– “Should I use Yoast free or Yoast Premium Version ?” for most of you who want to use Yoast SEO in order to optimize your content.

## Here are some criteria to take into consideration while choosing the Yoast premium version or free version.

I will be using PV and FV in some sections to represent the Premium version and Free version respectively.

1. In the PV you have full access to academic courses so you have the possibility to get full access to their training and become an expert in **SEO**. Meanwhile the FV you have access to the free courses only.
2. In the premium version you have the possibility to find and add high-performing keywords while in the free version, you add them manually in your text.
3. You can add related keywords in the PV. Unfortunately, you can only add one keyword or key phrase in the FV.

4. PV word form recognition is available in many languages whereas in FV you are responsible for manually researching and improving your content.

5. Both of them can tell Google what your page is all about.

## Automation, update and supports

6. PV automates your publishing flow, that is you can share your post to more than 2000 entities just by pushing on a button while in the free version sorry but you will have to manually share your posts.

7. In the PV, Yoast observes your important posts and pages and if necessary warns you if you haven’t updated for 6 months. You have to manually check your pages in FV in order to ensure that none is outdated.

8. You have the ability to preview what your pages look like on Google, Bing, Twitter and Facebook. Whereas in the FV you can only preview your pages on Bing and [Google](google.com).

9. For the PV you can get suggestions for internal links that Yoast suggests you internal links you can add to your post. While the FV you have to look for related posts yourself and add them.

10. You have full support 24h/7 (1 year) in PV. No support in the FV but the team provides hundreds of articles to help you.

11. PV is ad-free. So you won’t see ads on your dashboard. FV contains ads.

12. Last but not least both work in the WordPress classical and block editor.

Now that you have an idea of what each version offers, it's up to you to identify your main objects in order to chose the right solution.

Reference [yoast.com](yoast.com)

If you love this content also check my article on [how to bring more traffic to your website](https://dev.to/gunkev/4-ways-to-increase-traffic-to-your-website-2793)
O gerenciamento de sites do Google AdSense está mudando
Tags: notícias, tecnologia
Published: 2023-11-06 20:16:47

---
title: O gerenciamento de sites do Google AdSense está mudando
published: true
date: 2023-02-20 16:08:42 UTC
tags: Notícias,TECNOLOGIA
canonical_url: https://astronautsdevelopers.com/o-gerenciamento-de-sites-do-google-adsense-esta-mudando/
---

A guia “Sites” é o ponto de partida para quem quer gerar receita com um novo site no Google AdSense. Para facilitar o uso do Google AdSense, estamos reformulando a guia “Sites” e fazendo mudanças importantes no novo design.O que muda?A aparênciaA mudança mais perceptível é a nova aparência. A nova guia “Sites” vai mostrar …

[O gerenciamento de sites do Google AdSense está mudando Leia mais »](https://astronautsdevelopers.com/o-gerenciamento-de-sites-do-google-adsense-esta-mudando/)
Python break and continue tutorial
Published: 2023-02-20 16:08:25

In [**Python break and continue**](https://www.programdoc.com/python/break-continue) are two keywords used for flow control in loops. `break` is used to exit out of a loop, while `continue` is used to skip an iteration and move on to the next one. In this tutorial, we'll go over how to use `break` and `continue` in different types of loops in Python.

## Using `break` in loops

`break` is used to exit out of a loop. When `break` is encountered in a loop, the program exits out of the loop and continues executing the code after the loop. Here's an example of how to use `break` in a `for` loop:

```py
fruits = ["One", "Two", "Three", "Four", "Five"]
for fruit in fruits:
    if fruit == "Three":
        break
    print(fruit)
``` 

Output:

```py
One
Two
``` 

## Using `continue` in loops

`continue` is used to skip an iteration and move on to the next one. When `continue` is encountered in a loop, the program skips the remaining code in the current iteration and moves on to the next one. Here's an example of how to use `continue` in a `while` loop:

```py
i = 0
while i < 5:
    i += 1
    if i == 3:
        continue
    print(i)
``` 

Output:
```py
1
2
4
5
``` 

In this example, the number 3 is skipped because of the `continue` statement.




## Explore Other Related Articles
[Python While Loop tutorial](https://dev.to/max24816/python-while-loop-tutorial-463f)
[Python For Loops, Range, Enumerate Tutorial](https://dev.to/max24816/python-for-loops-range-enumerate-tutorial-20a2)
[Python if-else Statements Tutorial](https://dev.to/max24816/python-if-else-statements-tutorial-3p25)
[Python set tutorial](https://dev.to/max24816/python-set-tutorial-hcp)
[Python tuple tutorial](https://dev.to/max24816/python-tuple-tutorial-3m62)
Python While Loop tutorial
Published: 2023-02-20 16:00:49

The [**while loop in Python**](https://www.programdoc.com/python/while-loops) allows you to execute a block of code repeatedly as long as a certain condition is true. The syntax for a while loop is as follows:

```py
while condition:
    # block of code
``` 

The block of code will be executed as long as the `condition` is true. Once the `condition` becomes false, the program will move on to the next line of code after the while loop.

## Example - Counting with a While Loop

One common use case for a while loop is to count up to a certain number. Here's an example:

```py
count = 1

while count <= 5:
    print(count)
    count += 1
``` 

In this example, we initialize the `count` variable to `1`. Then, we enter a while loop with the condition `count <= 5`. As long as `count` is less than or equal to `5`, the block of code will execute.

Inside the block, we print the current value of `count` and then increment it by 1 using the `+=` operator. When `count` becomes 6, the condition becomes false and the program exits the while loop.

The output of this program will be:
```py
1
2
3
4
5
``` 

## Example - User Input with a While Loop

Another use case for a while loop is to repeatedly ask the user for input until they provide a valid response. Here's an example:

```py
name = ""

while not name:
    name = input("What is your name? ")

print("Hello, " + name + "!")
``` 

In this example, we initialize the `name` variable to an empty string. Then, we enter a while loop with the condition `not name`. As long as `name` is an empty string, the block of code will execute.

Inside the block, we use the `input()` function to ask the user for their name. If the user enters a non-empty string, the condition `not name` becomes false and the program exits the while loop.

Finally, we print a greeting message using the `name` variable.

The output of this program will depend on the user's input.


## Explore Other Related Articles
[Python For Loops, Range, Enumerate Tutorial](https://dev.to/max24816/python-for-loops-range-enumerate-tutorial-20a2)
[Python if-else Statements Tutorial](https://dev.to/max24816/python-if-else-statements-tutorial-3p25)
[Python set tutorial](https://dev.to/max24816/python-set-tutorial-hcp)
[Python tuple tutorial](https://dev.to/max24816/python-tuple-tutorial-3m62)
[Python Lists tutorial](https://dev.to/max24816/python-lists-tutorial-2g43)
Music Monday — What are you listening to? (Virtuoso Edition)
Tags: watercooler, discuss, music
Published: 2023-02-20 16:00:25

_cover image source: [jakeshimabukuro](https://giphy.com/jakeshimabukuro/)_

**What comes to mind when you think of musical virtuosity? Child prodigies like Michael Jackson blowing our minds at age 5? Groundbreaking guitarists like Jimi Hendrix playing solos with his teeth? Incredibly influential classical musicians, like pianist, Franz Liszt, who we don't actually have any recordings of, but history holds in high regard? YouTube-famous instrumentalists like ukulelist Jake Shumabukuro playing absurdly intricate pieces and making it look effortless? Whatever comes to your mind, please share it!**


![The Jackson 5 performing live and posing together for a dance move.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yczgje1ayjtbyrge5blr.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, alright... let's see those suggestions! I'm interested to know who y'all think are musical virtuosos. _Note: you can embed a link to your song using the following syntax `{% embed https://... %}`. This should work for most common platforms!_

Really looking forward to listening to y'all's suggestions! 🎶
Vue.js devtools in Chrome : issue with components debugging
Tags: vue
Published: 2023-02-20 15:58:20

I am not sure what should be reported exactly for a complete reproduction, since those projects are always so complex (hence always bumping in issues now and then slowing me down so much!).
For what I can provide: I'm using vue 2.6.14, vue.js 6.5.0 on Chrome 110.0.5481.104 (x64, Windows 10).
I use VSC for my project and serve it locally. Webpack 5.75. Then just check a component in the Chrome devtools "Sources" tab (for example having a debugger set in to component so it can be hit).

It used to work all fine but today after a month or two not working on the project, debugging in Chrome with the extension isn't working as expected. For several components, the JS code has not syntax highlighting and most importantly, hovering the variables in debugging mode doesn't show any content. It looks like I can't see all variables in the scope pane either.

I'm not unable to work properly with Chrome and don't know why this issue happened and how to sort it out.

Note that if I put debugger in the source code, I get the debugger stopping in Chrome at the right line, but can't really do efficient work as I don't get the variable content easily.

Thanks
Pierre
----
System infos:
 System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 Intel(R) Core(TM) i7-4700HQ CPU @ 2.40GHz
    Memory: 5.28 GB / 15.89 GB
  Binaries:
    Node: 12.16.3 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 110.0.5481.104
    Edge: Spartan (44.19041.1266.0), Chromium (110.0.1587.46)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    vue: 2.6.14 => 2.6.14
Best way to import csv file into Mysql
Published: 2023-02-20 15:57:15

Having tried mysqlimport command, navicat import wizard, mysql workbench, the best way to import my kinda large csv into mysql is using `LOAD DATA INFILE ` command (in mysql cli).

1. Saw from the thumbnail, using an import wizard to import wukong dataset's csv file just doesn't work. 
2. Mysqlimport(high upvotes from Stackoverflow) also doesn't work, it cuts the data in the csv file.
3. Using mysql workbench to import the csv file just leads to straight up crashing.

Finally, the way it worked, moreover, the way it worked properly and user-friendly, is to use the `LOAD DATA INFILE` supported in mysql cli as a part of SQL language.

Here's the code:

```
LOAD DATA INFILE '/Users/**/Desktop/Cabin/yagoo/resources/wukong_test.csv' 
INTO TABLE wukong_data
FIELDS TERMINATED BY ',' 
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS
(dir, text, token, url, alt_id);
```
You will have to create the table first. Using `head -n 1 wukong_test.csv ` to see the column names to work with.

```
output:
~/Desktop/Cabin/yagoo/resources$ head -n *.csv 
dir,text,token,url,alt_id
```

Most importantly, which is not a feature in any of the failing methods above, is that using `LOAD DATA INFILE` can tell you exactly why the import has failed. For me, it's mostly because in some of the column, the string is to long, I didn't set VARCHAR for enough capacity. If so, it'll output a message, telling which row the error took place, and why. 

```
mysql> LOAD DATA INFILE '/Users/**/Desktop/Cabin/yagoo/resources/wukong_test.csv' 
    -> INTO TABLE wukong_data_test
    -> FIELDS TERMINATED BY ',' 
    -> ENCLOSED BY '"'
    -> LINES TERMINATED BY '\n'
    -> IGNORE 1 ROWS
    -> (dir, text, token, url, alt_id);;

ERROR 1406 (22001): Data too long for column 'url' at row 32357
```
So please stick to sql more!

ps: You might need to tweak a little to make `LOAD DATA INFILE` work on your device.
State
Published: 2023-02-20 15:45:01

State - used for values that change over time. 

useState creates state variables

useState takes a single value, which is the base state, initial value. 

React.useState(0);

useState is a hook

useState returns an array with current value of state variable and a funciton you can use to update the astate variable

in the example of Jonny Appleseed's apple counter you would have the following syntax

function Appledieapp() {
  const [apple, setApple] = React.useState(0);
   return (
     <button onClick={() =>setApple(apple + 1)}>
         Apples: {apple}
     </button>
);
}
How to define a proxy in our kubeconfig file?
Tags: kubernetes, devops, sre
Published: 2023-02-20 15:43:00

In some situations, we should need to use a proxy to do some calls on a Kubernetes cluster. But how can we define it in our kubeconfig file ?

## Solution
In the parameter `clusters[].cluster`, you just have to add the parameter `proxy-url` with a value which uses the following template.

> http://user:password@proxy:port

*Exemple*
```yaml
apiVersion: v1
kind: Config
clusters:
- name: "dev"
  cluster:
    proxy-url: http://user:password@proxy:port
    server: "https://10.100.12.12:9006/k8s/clusters/c-jm5ws"
    ...
```

Once updated and saved, you should be able to use your proxy and do some successful calls on your cluster!

---

### Links
- Issue Github with the solution : https://github.com/kubernetes/client-go/issues/351#issuecomment-626752837

I hope it will help you! 🍺

---

<center><h3>You want to support me?</h3></center>
<a href="https://www.buymeacoffee.com/mxguilbert7" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
Comment définir un proxy dans son fichier kubeconfig?
Tags: kubernetes, devops, sre, french
Published: 2023-02-20 15:42:00

Dans certains contexts, il se peut que l'on ait besoin d'utiliser un proxy afin d'accéder à un cluster Kubernetes. Mais comment le définir dans son fichier kubeconfig?

## Solution
Dans le paramètre `clusters[].cluster`, il vous suffit d'ajouter le paramètre `proxy-url` avec le format suivant comme valeur.

> http://user:password@proxy:port

*Exemple*
```yaml
apiVersion: v1
kind: Config
clusters:
- name: "dev"
  cluster:
    proxy-url: http://user:password@proxy:port
    server: "https://10.100.12.12:9006/k8s/clusters/c-jm5ws"
    ...
```

Une fois modifié et enregistré, vous devriez pouvoir utiliser votre proxy et réussir à vous connecter!

---

### Liens
- Issue Github mentionnant la solution : https://github.com/kubernetes/client-go/issues/351#issuecomment-626752837

J'espère que ça vous aidera! 🍺

---

<center><h3>Vous voulez me supporter?</h3></center>
<a href="https://www.buymeacoffee.com/mxguilbert7" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
MylinkUp - Single place to store all your social media links (Linode + DEV Hackathon)
Tags: linodehackathon, linode, linux
Published: 2023-02-20 15:24:05

---
title: MylinkUp - Single place to store all your social media links (Linode + DEV Hackathon)
published: true
description: mylinkup ( Single place to store all your social media links )
tags: linodehackathon,linode,linux,
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nop6pjc2cyhs861dok8k.png
---


## What I built
I build a app where you can showcase your social media links in single place. If you want to showcase your social media links use
mylinkup(Single place to store all your social media links)


### Category Submission:
. SaaS Superstars

### App Link
Live link: https://mylinkup.vercel.app

### Screenshots
App landing page
![landingpage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sghdlq3bmvy56yijq2f5.png)


Dashboard

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

New Project creation page

![New Project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fvoy9r2uui9z2i7ntupc.png)


Preview Page

![Preview page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2xotmun0rkhwyin3b6vb.png)







App Instance (Linode)

![Linode instance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/413sztxqlw998mjgwvry.png)






### Description
 

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

1. User will interact with frontend to create/delete the page
2. Server manages all the request and response and server is running on Linode
3. All the data is storing in MongoDB database


### Link to Source Code
Frontend Source Code {% embed https://github.com/lmas3009/mylinkup %}
Backend Source Code  
{% embed https://github.com/lmas3009/mylinkup-server %}

### Permissive License
MIT Licence

## Background
There are many apps where you can create this. But i created this app to use at free of cost and help many developers to create there own mylinkups pages.

### How I built it

This is my first attempt on Linode platform. I learned new things and about server utilization.

**Languages, Frameworks, Cloud platforms, and Databases**

Languages:
1. Javascript

Frameworks:
1. NextJs
2. NodeJS
3. ExpressJs

Cloud platform:
1. Linode

Databases:
1. MongoDB


### Additional Resources/Info
[1] Linode [linode.com](https://www.linode.com/)
[2] Linode Documenation [Linode - Documentation](https://www.linode.com/docs/)
[3] 100$ Credit [Linode 100$ Credit](https://www.linode.com/lp/free-credit-100/?promo=sitelin100-02162023&promo_value=100&promo_length=60&utm_source=google&utm_medium=cpc&utm_campaign=11178784768_109179230123&utm_term=g_kwd-967903494871_e_linode%20100&utm_content=466940520125&locationid=9062138&device=c_c&gclid=EAIaIQobChMI9-_lt7Kk_QIVVQ4rCh1ejQ1HEAAYAiAAEgKN6_D_BwE)
[4] NextJs [nextjs.org](https://nextjs.org/)
[5] MongoDB [mongodb.com](https://www.mongodb.com/)
React native sanity v3 issues
Published: 2023-02-20 15:16:21

Hi there, I hope this message finds you well,  I'm having problems with react native apps, Now I have a warning that the sanityClient signature has been deprecated and that I should do createClient instead, but when I do this that's another error saying that error: URLSearchParams.set is not implemented, I've tried a bunch of possible solutions, but didn't get through. Would anybody be able to help me?