teleren/devto huggingface dataset:
Day 16 - Require Statement
Tags: 100daysofcode, solidity, web3, blockchain
Published: 2022-06-13 14:03:00

{% embed https://github.com/Envoy-VC/30-Days-of-Solidity noreadme %}

This is Day `16` of `30` in Solidity Series
Today I Learned About Require Statement in Solidity.

The `require` statements declare prerequisites for running the function i.e. it declares the constraints which should be satisfied before executing the code. It accepts a single argument and returns a boolean value after evaluation, it also has a custom string message option. If false then exception is raised and execution is terminated. The unused gas is returned back to the caller and the state is reversed to its original state.

Following are some cases when require type of exception is triggered :

- When require() is called with the arguments which result as false.
- When a function called by a message does not end properly.
- When a contract is created using the new keyword and the process does not end properly.
- When a codeless contract is targeted to an external function.
- When ethers are sent to the contract using the public getter method.
- When .transfer() method fails.
    - When an assert is called with a condition that results in false.
    - When a zero-initialized variable of a function is called.
    - When a large or a negative value is converted to an enum.
    - When a value is divided or modulo by zero.
    - When accessing an array in an index which is too big or negative.

**Syntax:**
```solidity
require(condition,"Error Message");
```

Example:
```solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.7;

contract RequireStatement {
    function requireStatement(uint _input) public view returns(string memory){
        require(_input >= 0, "invalid uint8");
        require(_input <= 255, "invalid uint8");
        return "Input is Uint8";
}
```

Output:
when we pass input as 78 we get
```solidity
"0 : Input is Uint8"
```
when we pass input as 748 we get
```solidity
"0 : invalid uint8"
```

---
Move Zeroes
Tags: leetcode, dsa, theabbie
Published: 2022-06-13 14:00:47

Given an integer array `nums`, move all `0`'s to the end of it while maintaining the relative order of the non-zero elements.

**Note** that you must do this in-place without making a copy of the array.

**Example 1:**

**Input:** nums = \[0,1,0,3,12\]
**Output:** \[1,3,12,0,0\]

**Example 2:**

**Input:** nums = \[0\]
**Output:** \[0\]

**Constraints:**

*   `1 <= nums.length <= 104`
*   `-231 <= nums[i] <= 231 - 1`

**Follow up:** Could you minimize the total number of operations done?**SOLUTION:**

    class Solution:
        def moveZeroes(self, nums: List[int]) -> None:
            nums.sort(key = lambda a: 1 if a == 0 else 0)
Get this Browser Extension now!
Tags: extension, webdev, javascript, productivity
Published: 2022-06-13 13:54:39

I created this browser extension called "Naya Tab".

This new tab extension adds functionality similar to the brave browser's new tab page.

You can add shortcuts to websites and change wallpaper for the new tab page.


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

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

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

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

I was trying to publish it on Chrome Webstore but unfortunately I ran into some payment related issues so for now it's only available for firefox.

As for the edge store, it's under review so I'll post here when it gets published.

You can install it in Firefox by visiting: 

https://addons.mozilla.org/en-US/firefox/addon/naya-tab/
https://microsoftedge.microsoft.com/addons/detail/naya-tab-a-new-tab-exte/nclaeoangfbocckefkmmiabicmfcpolg
---

You can support me at: https://github.com/sponsors/sharadcodes
for India UPI: `iamsharadraj@okaxis`

---

I will make it open source once it get published on chrome and edge webstore.
Help needed: Getting a CORBS error when using remote images
Tags: react
Published: 2022-06-13 13:54:31

Hi guys, I'm getting this error in my console when a pass down an online image url as props. 
My app basically pulls data from an excel sheet and I'm passing that data down as props (if I get the image from local storage, I get the image correctly). I have added screenshots to describe all these.

I have tried looking through chrome documentation on this. I can see it's a security measure but I cannot seem to resolve this.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sezku9h6cuisvvrd8fqs.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c6zbazzwp1ftxx8281gr.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5j4o3sppfxxl7sasxlu4.png)
Personal multilang page written in Vue3, Sass, packaged with Vite, CI workflow
Tags: vue, sass, opensource, vite
Published: 2022-06-13 13:46:41

# bnarvaez-dev

- Personal webpage written in Vue 3, Sass and packaged with Vite.
- Unit tests in Vite 3
- CI Workflow

You can use for your own page!

[Github Repo](https://github.com/prinick96/bnarvaez.dev)
[Demo - My web](https://bnarvaez.dev)

[![Netlify Status](https://api.netlify.com/api/v1/badges/67937758-ab18-44f8-9d8a-968afed67f0b/deploy-status)](https://app.netlify.com/sites/prinick/deploys)

## ✅ Install and Run

First clone the repo
```bash
git clone https://github.com/prinick96/bnarvaez.dev.git
```

Install dependencies
```bash
npm install
```

Just run in local
```bash
npm run serve
```

Or with Docker 🐳
```bash
make docker-up
```

## ✅ Tests

All test are located in `/src/test`

Run
```bash
npm test
```

## ✅ Notes

I am using Netlify for deploy, i recommend optimize all images and minify the html if you don't use Netlify with plugins
Dev.to API
Tags: webdev, api, challenge, php
Published: 2022-06-13 13:42:38

**Hi Everyone , im suphi 
today i made dev.to unofficial api.
Anyone want to test it?
Github Link : [https://github.com/suphiyasin/Dev.to-API](https://github.com/suphiyasin/Dev.to-API)
I'm waiting for all positive / negative comments please don't forget to star in github and here**
what is tooltip in css ?
Published: 2022-06-13 13:41:11


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ypgv7z3iarh6x2gp41rw.png)
```
.tooltip .tooltiptext {
  visibility: hidden;
  width: 120px;
  background-color: black;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px 0;

  /* Position the tooltip */
  position: absolute;
  z-index: 1;
}
```
_A tooltip is often used to specify extra information about something when the user moves the mouse pointer over an element: Top. Right. Bottom. Left._
How to Get a Great Connecticut Mortgage Rate
Tags: mortgage, loans
Published: 2022-06-13 13:39:08

It goes without saying that having a strong credit score will help you acquire the best [mortgage rate](https://www.prysma.com/blog/how-to-get-connecticut-mortgage-rate/). You are more likely to receive loan offers with acceptable terms if your credit score is good. A lower credit score, on the other hand, will result in a higher interest rate.

In general, the higher your credit score, the lower the [mortgage rate you](https://www.prysma.com/) will be offered by lenders. So do everything you can to improve your credit score by paying off as many credit card bills and other personal debts as you can. Having a consistent income boosts your credit score.

Getting a secured credit card and paying your payments on time are two strategies to improve your credit score.

Assume you have no idea what your credit score is. In such situation, many companies, including the three major credit agencies Experian, Equifax, and TransUnion, may provide you with a free credit report. Once you've received the report, go over it attentively to look for any strange entries or errors.

When you receive your report, carefully review it for any unexpected entries or problems. If you find any problems or typos in the report, you can have them corrected by the bureau that created it.

Finally, double-check your credit report for any errors. Errors such as having debts in your name that you never really took out could sink your credit score.
Veterinary Clinic
Published: 2022-06-13 13:36:50

Pet Point [Veterinary Clinic](https://petpoint.ae) was born from our founders’ devotion to providing the best medical care for animals. With a heartfelt promise to nurture pets with comprehensive healthcare, our experienced and passionate doctors continue to meet first-class veterinary standards that leave both pets’ and their owners’ needs, fulfilled.

Our love for animals keeps us moving forward as we refine our practices and expand our reach to help pet-owners in the UAE.
5 Landscape Water Conservation Tips
Tags: leadership, tutorial, discuss, design
Published: 2022-06-13 13:33:04

When it comes to landscape design, there are various factors to consider. Aside from the economic and environmental benefits, a good design plan may also bring about social and health benefits. As a result, the focus of this article will be on the economic element. To be accurate, landscaping may be a creative method to boost the value of your home. A beautiful and appealing environment may provide a soothing and tranquil refuge while also improving the overall mood of your area.

However, as a [responsible homemaker](https://www.rootslandscapingct.com/), you must also implement ecologically friendly techniques that will not only make your landscape more sustainable but will also save you money in the long run. As a result, landscape construction in Sydney must be meticulous based on some of the most effective strategies available Now that water makes about half of the landscaping design, you must take extra steps to save it as efficiently as possible!

So, here are five key water-saving strategies to help you save water and make the most of it:

Purchase a Rain Barrel.

Sydney receives a lot of rain throughout the year, which might be a good incentive to build a rain barrel at your home. The major advantage of employing such a measure is that it allows you to conserve water for gardening, and the rainfall collected is mostly chemical-free because it comes from the groundwater (in the process). A rain barrel's additional benefit is that it reduces the flow of storm runoff, which can erode your garden soil and cause salt accumulation. As a result, you are fostering an ecologically beneficial method of root development enhancement. 

Plants that are drought resistant should be used.

The use of native and drought-resistant plants may help make landscape construction in Sydney as sustainable as you want it to be. These plants help reduce soil erosion and can even thrive in drought conditions. Palms, Watsonias, rockrose, sea holly, and other drought-tolerant plants can be purchased at a local horticultural store. However, you must ensure that the soil type is suitable for such plants before picking them!

This is all you need to know about water conservation in your landscape. If you follow this crucial advice, you will be able to live as sustainably as you like!
Create value; not complexity.
Tags: discuss, design, devops, devjournal
Published: 2022-06-13 13:32:24

## An essay on what really matters when coding

When designing systems, applications, and frontends, it's easy to get carried away. Premature abstraction and over-engineering just lead to burnout without real progress.

Sometimes you need to take a step back and go back to your original idea. What are you actually trying to accomplish? Are you solving your problem, or just creating new ones in the process?

### How I learned my lesson

As a quick example, over the past month or so I've been working on a CMS for my static site generator [HydePHP](https://hydephp.com/). My problem and goal were simple, I wanted something that would give me a good overview of the content on large sites.

In short, I went from an entire full-stack desktop program to a Laravel Lumen application, to a single-file PHP website, to eventually landing on a super simple project dashboard template in the form of a single Blade file that you can just drop into any existing project.

As you can tell, I've gone through many revisions, all of which I am thankful for as I learned an incredible amount about so many things, though that's another article.

#### All's well that ends well 

In the end, I solved my original problem and created something that will be easy to maintain and understand. It's also 300 lines of code, instead of a 900MB desktop application that only runs on Windows.

What do you think about this post, do you agree? Do you disagree? Leave a comment and let's discuss it!
Do have any the vulnerability of C/C++(other language) and Solidity the same?
Tags: solidity, c, cpp, security
Published: 2022-06-13 13:32:07

Hi guys, I am researching about Vulnerability of Solidity.
I really want to known do have any vulnerability of C/C++(other language) and Solidity the same?
If anyone don't mind, please send for me about this information.
Thank you for reading
Valid Parentheses
Tags: leetcode, dsa, theabbie
Published: 2022-06-13 13:30:41

Given a string `s` containing just the characters `'('`, `')'`, `'{'`, `'}'`, `'['` and `']'`, determine if the input string is valid.

An input string is valid if:

1.  Open brackets must be closed by the same type of brackets.
2.  Open brackets must be closed in the correct order.

**Example 1:**

**Input:** s = "()"
**Output:** true

**Example 2:**

**Input:** s = "()\[\]{}"
**Output:** true

**Example 3:**

**Input:** s = "(\]"
**Output:** false

**Constraints:**

*   `1 <= s.length <= 104`
*   `s` consists of parentheses only `'()[]{}'`.

**SOLUTION:**

    class Solution:
        def isValid(self, s: str) -> bool:
            stack = []
            validPairs = ['()', '[]', '{}']
            valid = True
            for bracket in s:
                if bracket in [b[0] for b in validPairs]:
                    stack.append(bracket)
                else:
                    if len(stack) > 0:
                        if (stack.pop() + bracket) not in validPairs:
                            valid = False
                            break
                    else:
                        valid = False
                        break
            if len(stack) > 0:
                valid = False
            return valid
It's all about the numbers
Tags: perl, python, theweeklychallenge
Published: 2022-06-13 13:22:01

## Weekly Challenge 169

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

After a long break, I'm back. Without further ado, let's go through the two challenges this week.

## Task 1: Brilliant Numbers

### Task

Write a script to generate first 20 Brilliant Numbers.

Brilliant numbers are numbers with two prime factors of the same length.

The number should have exactly two prime factors, i.e. it’s the product of two primes of the same length.

### My solution

This is one of those tasks where given we are dealing with such small numbers, it is easier to just brute force things. In the main function, I have the value `l` for the length of the primes. I then call call the `get_bril_nums` function to get all brilliant numbers.

It does this in three steps:

1. Get all primes of `l` length.
1. Multiple each of the primes
1. Sort the results numerically

I keep doing this until there are at least 20 numbers calculated (as we know this is when `l == 2`). I then print the first 20 numbers.

### Example

```bash
$ ./ch-1.py 
4, 6, 9, 10, 14, 15, 21, 25, 35, 49, 121, 143, 169, 187, 209, 221, 247, 253, 289, 299
```

## Task 2: Achilles Numbers

### Task

Write a script to generate first 20 [Achilles Numbers](https://en.wikipedia.org/wiki/Achilles_number).

### My solution

This task is more challenging than the first one, and highlighted that at the time of writing, Mohammad's description isn't quite correct. I've [tweeted](https://twitter.com/simongreennet/status/1536323816187924480) him, so hopefully it will be fixed.

For this task, I keep calling the `is_achilles_number` with an incrementing counter until we have found twenty numbers. This function does the following

1. Get the unique prime factors into the `factors` dict (hash in Perl), where the key is the prime number and the value is the power.
1. Set the `powers` set (array in Perl) to the power values. At this point we no longer care about the prime factor.
1. If there is only one value (it's a power of a single number) or any of the powers is 1, return `False` (undef in Perl).
1. If the [greatest common divisor](https://en.wikipedia.org/wiki/Greatest_common_divisor) of the powers is not 1, return `False` (undef).
1. Return `True`.

### Example

```bash
$ ./ch-2.py 
72, 108, 200, 288, 392, 432, 500, 648, 675, 800, 864, 968, 972, 1125, 1152, 1323, 1352, 1372, 1568, 1800
```
Helpful commands for networks
Tags: network, security, linux, cli
Published: 2022-06-13 13:17:52

Networks and ports are probably the first elements hackers enumerate. Let's see useful commands to analyze the situation.

## netstat

`netstat` shows open ports and connections (network statistics):

```
netstat -ano
```

With the above command, you can list active connections, state of the sockets, IP addresses, process IDs. It's available on Windows too.

## nmap 

The ultimate enumerator and probably the most popular: light, powerful, Swiss knife. The only inconvenience is the extensive range of options and modes that can be overwhelming for beginners, but there are lots of blog posts and documentations available:

```
nmap -O -sS TARGETED_MACHINE
```

* `-O` will determine the operating system, which is often needed during analysis
* `-sS` is for TCP SYN Scan 

## arp

The command dumps the ARP cache, a dynamic list of IP and MAC addresses of the routers your computer communicated with recently:

```
arp -a
```

This cache is used by your machine to store information and prevent useless queries every time you communicate with other devices in the same network or external devices.

## nslookup

`nslookup` can query a domain server and resolve associated IP addresses:

```
nslookup wikipedia.org
```

## ssh

OpenSSH `ssh` allows you to connect to a remote host. It's said to be way more secure than the old `telnet` that transmits all information in plain text. 

It checks if the target host is up and encrypts communications. It's quite straightforward:

```
ssh user@IP
``` 

If your SSH keys (`ls ~/.ssh`) are authorized on the remote host (`cat ~/.ssh/authorized_keys`), you can connect without your password:

```
ssh -i ~/.ssh/YOUR_PRIVATE_KEY user@IP
``` 

## ping

`ping` uses ICMP (Internet Control Message Protocol) to send packets to a host and see if it replies:

```
ping -6 github.com 
```

The above ping command will ping github.com and force IPv6 instead of IPv4.

## traceroute

`traceroute` is helpful to retrieve the whole path to a source server. It will also list all routers, also known as "hops," on the way.

Unlike `ping`, the purpose of `traceroute` is not to send a message to get an echo reply that confirms the host is up. Indeed, it's usually the command you use if `ping` fails and to determine where packets are lost.

In a security perspective, it can spot anomalies such as unauthorized routers installed by hackers:

```
traceroute mozilla.org
```

_N.B: `tracert` is the equivalent in Windows._
Let's cover the Docker Basics
Published: 2022-06-13 13:16:27

---
title: Let's cover the Docker Basics
published: true
description: In this video, we look through the docker basics. Working with docker is not that hard, but a couple of commands are considered basics. Then, we look at fetching base images, running commands, and setting environment variables.
tags:
cover_image: https://i.ytimg.com/vi/APZmBbSBwj4/maxresdefault.jpg
---

{% youtube APZmBbSBwj4 %}

In this video, we look through the docker basics. Working with docker is not that hard, but a couple of commands are considered basics. Then, we look at fetching base images, running commands, and setting environment variables.
Maximum Level Sum of a Binary Tree
Tags: leetcode, dsa, theabbie
Published: 2022-06-13 13:00:46

Given the `root` of a binary tree, the level of its root is `1`, the level of its children is `2`, and so on.

Return the **smallest** level `x` such that the sum of all the values of nodes at level `x` is **maximal**.

**Example 1:**

![](https://assets.leetcode.com/uploads/2019/05/03/capture.JPG)

**Input:** root = \[1,7,0,7,-8,null,null\]
**Output:** 2
**Explanation:** 
Level 1 sum = 1.
Level 2 sum = 7 + 0 = 7.
Level 3 sum = 7 + -8 = -1.
So we return the level with the maximum sum which is level 2.

**Example 2:**

**Input:** root = \[989,null,10250,98693,-89388,null,null,null,-32127\]
**Output:** 2

**Constraints:**

*   The number of nodes in the tree is in the range `[1, 104]`.
*   `-105 <= Node.val <= 105`

**SOLUTION:**

    # Definition for a binary tree node.
    # class TreeNode:
    #     def __init__(self, val=0, left=None, right=None):
    #         self.val = val
    #         self.left = left
    #         self.right = right
    class Solution:
        def inorder(self, root, l):
            if root:
                self.inorder(root.left, l + 1)
                self.levels[l] = self.levels.get(l, 0) + root.val
                self.inorder(root.right, l + 1)
        
        def maxLevelSum(self, root: Optional[TreeNode]) -> int:
            self.levels = {}
            self.inorder(root, 1)
            return -max([(v, -k) for k, v in self.levels.items()])[1]
This Week in Apache Pulsar 13-June-2022
Published: 2022-06-13 12:58:47

https://www.linkedin.com/pulse/june-2nd-week-2022-tim-spann/

#ApachePulsar

Big things are coming soon! I will be dropping into Berlin Buzzwords remote, so if you have questions ping me.



NEWS
Welcome new committer to Apache Pulsar!

ARTICLES


VIDEOS


EVENTS
June 15, 2022. Virtual.



June 21, 2022 - Systems Masterclass - Half Day on Distributed Data Systems with Scylla, Pulsar, and AWS talks and group discussion. This is an interactive session with some interesting things in it.

Distributed Data Systems Masterclass
June 21 | 8AM - 12PM Paciﬁc Time

Register Now!


Learn how to build and manage enterprise-scale distributed data systems with the latest event streaming and distributed database technologies.

In this free, interactive half-day masterclass, our experts walk you
through how to build a resilient distributed system framework. We’ll
cover how to configure an Apache Pulsar cluster with a ScyllaDB NoSQL
database for a real-time event streaming application. At the end, you will have the opportunity to demonstrate what you learned and earn a certificate that shows your achievement.

You will learn best practices on how to:
- Configure event streaming for enterprise-scale applications
- Connect a low-latency data store to the event streaming architecture
- Use observability tools to monitor and optimize performance
Plus earn a certificate and an exclusive swag pack!*

*Must attend to be eligible. Shipping restrictions apply.

Register Now.

Organized by:  
ScyllaDB, Inc. and StreamNative
http://www.scylladb.com/
https://streamnative.io/
June 21, 2022 - Virtual Poland - Data Science Summit: Machine Learning Edition.

July 25-27, 2022. Virtual Florida. Deep Dive into Building Streaming Applications with Apache Pulsar

August 2022

Oct 3-6, 2022: Apache Con, New Orleans, LA.

Oct 4-5, 2022: Current: Apache Kafka Summit. Austin, TX.

Oct 25, 2022: KubeCon: Detroit
TOOLS





https://developer.tbd.website/projects/web5/