teleren/devto huggingface dataset:
I need help forking ERC20 smart contracts
Tags: solidity, erc20, smartcontracts
Published: 2022-07-15 15:52:48

Hello,

My name is Wabi, I have practically 0 coding experience but I have slowly fiddled my way through forking solidity ERC20 smart contracts. 

I scour the new listings on Ethereum constantly to find new standard meme coin contracts that are relatively inexpensive to deploy. In this scenario I found $USI which was unfortunately a rug(https://etherscan.io/address/0xccf3549bb3aeaa6f8b240da03be2446827a54079#code).

$USI has the lowest deployment fee's out of all contracts that I have found but upon forking it I have stumbled upon many problems.

Problems:

1. Max wallet - line 150 and 293 -  there seems to be no maximum amount that a wallet can hold? I deployed it onto Ropsten and I was able to buy more than 20% of the supply on 1 wallet. 
How would I be able to change it so the maximum amount a wallet could hold is 3%?

2. Enable trading - line 291/294 - the creator of this contract needed to enable trading before listing bots were able to buy it, see here as "Open trading" was called - https://etherscan.io/address/0x9a53152672d73a59049319b1bef99e6e393b92f2
However, upon forking it on Ropsten I am able to purchase the contract right after adding liquidity. 
How would I Open trading manually after adding liquidity? the function is there. 



Any guidance on these problems is massively appreciated.

Wabi
Surviving in Lagos
Tags: livinginlagos, lagosnigeria, fun, lifestyle
Published: 2022-07-15 15:51:48

To Survive in Lagos, you need to be in Survival mode. The challenges differ based on what leverage you have.

Nothing will exempt you from the challenges in Lagos Nigeria, Fuel, traffic, housing, increased cost of living, insecurity, etc are challenges you will face at one point or the other.

In this video, we shared our experiences and how we were able to navigate around them and we believe you will enjoy watching this video.

Do share in the comment session what your experience in Lagos looks like

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

Follow me for more content on Tech, Data, and Lifestyle
Quickly find a recent command in Terminal in VS Code
Tags: vscode, todayilearned, beginners
Published: 2022-07-15 15:47:18

VS Code [v1.69](https://code.visualstudio.com/updates/v1_69) was released last week. As with any of the previous releases, it came packed with new features. I found some of them to be quite useful and have already used them to tweak [my VS Code setup](https://dzhavat.github.io/2021/09/08/my-vs-code-setup.html).

In this short post I’m going to show you one new feature that I like in particular - the “**Terminal: Run Recent Command**” command.

Before we look into what this command does, how often do you use the up arrow key in the Terminal to find a previously executed command? Quite often, right? You remember that you ran one particular command yesterday but you can’t really remember which was it. So you use the up arrow key to go trough the recent commands, one at a time, to find the one you need. I do that all the time too.

What if there was a way to see a list of recent commands and quickly find the one you need. That would be so much better, wouldn’t it?

Here’s where the “**Terminal: Run Recent Command**” command comes in. When you run it, you get a list of recent commands in a Quick Pick-like panel similar to the Command Palette or Quick Open panel. It looks like this 👇

![Run Recent Command panel in VS Code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uqvvr4symg1zi1f25igw.jpg)

Go ahead and try it. Open a Terminal, then open the Command Palette (`Ctrl/Cmd+Shift+P`) and run the “**Terminal: Run Recent Command**” command. Selecting a command from the list will automatically run it.

### But wait, there’s more

If you hold the `Alt` key while selecting a command, the text will be written in the Terminal without running it. This way you can modify it if you need to. You can also search for a command in the input field.

#### Assigning a key keybinding

The “**Terminal: Run Recent Command**” command doesn’t have a keybinding assigned by default. In the release post, an example is given where `Ctrl+Space` is used for hooking up the command to a keybinding. I used that suggestion in my setup. Works quite well.

If you too want to use it, run the `Preferences: Open Keyboard Shortcuts` command, then click on the “Open Keyboard Shortcuts (JSON)” icon (looks like a “file-with-an-arrow-pointing-right”) all the way to the right to open a file with your personal keybinding combinations. Then paste the following snippet 👇

```json
{
  "key": "ctrl+space",
  "command": "workbench.action.terminal.runRecentCommand",
  "when": "terminalFocus"
}
```

You can now use `Ctrl+Space` to open the list of recent commands when the Terminal is in focus.

I also recorded a short video explaining the post above.

{% embed https://www.youtube.com/embed/l216XssGpqQ %}

I hope you learned a little tip today. Happy coding 😎
2337. Leetcode Solution in Java
Tags: java
Published: 2022-07-15 15:45:14

```
class Solution { 
    public boolean canChange(String s, String t) { 
        int count = 0; 
        
        //Checking if equal number of spaces
        for (char c : s.toCharArray()) { 
            if (c == '_')
                count++; 
        } 
        
        for (char c : t.toCharArray()) { 
            if (c == '_')
                count--;
        } 
        
        if (count != 0)
            return false;
        
        return checkIfEqualStringFormed(s, t); 
    } 
     
    public boolean checkIfEqualStringFormed(String s1, String s2) {
        // Checking if frequency of 'L and 'R' are equal in both string or not.
        int[] freq1 = new int[2];
        int[] freq2 = new int[2];
        
        for (int i = 0; i < s1.length(); i++) { 
            char s1c = s1.charAt(i); 
            char s2c = s2.charAt(i);
            
            if (s1c == 'L'){
                freq1[0]++;
            }
            else if(s1c == 'R'){
                freq1[1]++;
            } 
            if (s2c == 'L'){
                freq2[0]++;
            } 
            else if(s2c == 'R'){
                freq2[1]++;
            } 
        } 
         
        if(freq1[0] != freq2[0] || freq1[1] != freq2[1])
            return false;
        
        // List to store the indices of 'L' and 'R'.
        List<Integer> start = new ArrayList<>(); 
        List<Integer> target = new ArrayList<>(); 
         
        for (int i = 0; i < s1.length(); i++) { 
            if (s1.charAt(i) != '_') { 
                start.add(i); 
            } 
            if (s2.charAt(i) != '_') { 
                target.add(i); 
            } 
        }
        
        
        for (int i = 0; i < start.size(); i++) {
            // Checking if both string will be equal if we remove '_'
            if (s1.charAt(start.get(i)) != s2.charAt(target.get(i))) { 
                return false; 
            }
            
            // If character are same, check (negative case) 
            // if character at second string is behind first string character index.
            if (s1.charAt(start.get(i)) == 'L') { 
                if (start.get(i) < target.get(i)) { 
                    return false; 
                }
            } else {
                if (start.get(i) > target.get(i)) { 
                    return false; 
                } 
            } 
        } 
        return true; 
    } 
}

```
#leetcode
#weekly contest
Here is the link for the problem.....
https://leetcode.com/contest/weekly-contest-301/problems/move-pieces-to-obtain-a-string/
Getting started with Rust
Tags: rust, linux, macos, cargo
Published: 2022-07-15 15:44:47


## Setup



On MacOS or Linux, run this command in the terminal (then follow the instructions):
*More: https://www.rust-lang.org/learn/get-started*

```sh
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```




Get the current Rust & Cargo versions:

```sh
rustc --version
cargo --version
```




Update Rust:

```sh
rustup update
```




Cargo utils:

```sh
# create new project
cargo init

# compile & execute
cargo run

# build project
cargo build

# test project
cargo test

# build documentation
cargo doc

# add crate
cargo add <name>
```


Source: https://www.rust-lang.org/learn/get-started 

You can also install the Rust VSCode extension from [here](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)

## First Project

### With Cargo



Create a new folder then setup a rust project with `cargo init`. This command will create *Cargo.toml* & *src/main.rs* with a Hello World example. Run the project with `cargo run`.

```sh
mkdir new-project

cd new-project

cargo init

cargo run
```



### Without Cargo



Create a file named `main.rs` with:

```rust
fn main() {
  let hello = "Hello World";
  println!("{}", hello)
}
```



Compile it with `rustc main.rs` then run it with `./target/debug/main` (`.\target\debug\hello.exe` on Windows)
How to use Browser location in React application
Tags: javascript, react, webdev, beginners
Published: 2022-07-15 15:43:37

Hi

How to get user location from Browser navigator location api in a react component

```
const Map = (props) => {
  // get the location from geolocation
  const [latLng, setLatLng] = useState({
    lat: 0.0,
    lng: 0.0,
    isLoaded: false,
  });

  useEffect(() => {
    if (navigator.geolocation) {
      navigator.geolocation.getCurrentPosition(
        (position) => {
          setLatLng({
            lat: position.coords.latitude,
            lng: position.coords.longitude,
            isLoaded: true,
          });
        },
        (error) => {
          alert(error);
        }
      );
    }
  }, [setLatLng]);
  
  const lat = "latitude is : " + latLng.lat;
  const long = "longitude is : " + latLng.lng; 
  return (
    <div>
      <p>{lat}</p>
      <p>{lng}</p>
    </div>
  );
}
```
2338. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-15 15:43:02

```
const int mod = 1e9+7;
const int N = 1e4+5;

int dp[21][N];
int lengths[N][21];

class Solution {
    // lengths[j][k] --> How many unique paths are there that ends at 'j' & have length of 'k'
    void CalculateUniquePathLengths () {
        memset(lengths, 0, sizeof(lengths));

        for (int j = 1; j < N; j ++) {
            // contribute 'j' to its every multiples
            lengths[j][1] = 1;
            for (int k = j+j; k < N; k += j) {
                for (int i = 0; i < 20; i ++) lengths[k][i+1] += lengths[j][i];
            }
        }
    }
    
    // How many unique arrangement of length 'length' & having all the values from [1 ..X]
    int UniqueArrangements (int length, int mx) {
        if (length == 0) return (mx == 0);
        if (mx == 0) return 0;
        
        int &ans = dp[mx][length];
        if (ans != -1) return ans;
        
        ans = (UniqueArrangements(length-1, mx) + UniqueArrangements(length-1, mx-1)) % mod;
        return ans;
    }
    
public:
    int idealArrays(int n, int maxValue) {
        memset(dp, -1, sizeof(dp));
        CalculateUniquePathLengths();
        
        int ans = 0;
        for (int last = maxValue; last >= 1; last --) {            
            for (int j = 1; j < 21; j ++) {
                long long arrangementsWithEverything = UniqueArrangements(n, j);
                
                ans = (ans + (arrangementsWithEverything * lengths[last][j]) % mod) % mod;
            }
        }
        return ans;
    }
};
```
#leetcode
#weekly contest
Here is the link for the problem.....
https://leetcode.com/contest/weekly-contest-301/problems/count-the-number-of-ideal-arrays/
Microsoft Azure Administrator AZ-104 Bootcamp - Day 03
Tags: azure, whizlabs
Published: 2022-07-15 15:42:55

I attended the Microsoft Azure Administrator AZ-104 Bootcamp by Azure Developer Community sponsored by Whizlabs and Microsoft.

In Day 03 of the Microsoft Azure Administrator AZ-104 Bootcamp, I learnt about the Azure Storage Services and its usage.

From these learnings, I developed a python content management application that uses blob-storage to store photos and Azure SQL server to store the structured data.

Below are the steps followed.


Link to register for the Bootcamp - 
https://azdev.reskilll.com/event/Az104~doon

Links to all the sessions in this Bootcamp series.
Day1: https://www.youtube.com/watch?v=En_0-P7dkEA
Day2: https://www.youtube.com/watch?v=z8zCX0U-yGE
Day3:https://www.youtube.com/watch?v=3_yRuplWfhk
2336. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-15 15:33:52

```
class SmallestInfiniteSet {
private:
    set<int> s;

public:
    SmallestInfiniteSet() {
        for (int i = 1; i <= 1000; i++)
            s.insert(i);
    }

    int popSmallest() {
        int r = *s.begin();

        s.erase(s.begin());

        return r;
    }

    void addBack(int num) {
        s.insert(num);
    }
};


/**
 * Your SmallestInfiniteSet object will be instantiated and called as such:
 * SmallestInfiniteSet* obj = new SmallestInfiniteSet();
 * int param_1 = obj->popSmallest();
 * obj->addBack(num);
 */
```

#leetcode
#weekly contest
Here is the link for the problem.....
https://leetcode.com/contest/weekly-contest-301/problems/smallest-number-in-infinite-set/
2335. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-15 15:32:09

```
class Solution {
public:
    int fillCups(vector<int>& amount) {
        sort(amount.begin(), amount.end());

        if (amount[0] + amount[1] <= amount[2])
            return amount[2];

        int s = amount[0] + amount[1] + amount[2];

        return s % 2 == 0 ? s / 2 : s / 2 + 1;
    }
};
```
#leetcode
#weekly contest
Here is the link for the problem.....
https://leetcode.com/contest/weekly-contest-301/problems/minimum-amount-of-time-to-fill-cups/
Blazor Sticker Giveaway – Try the new Blazor Guide in Visual Studio
Tags: tutorial, productivity, dotnet, webdev
Published: 2022-07-15 15:32:09

We want you to try our new Blazor Guide inside Visual Studio and we are giving away Blazor stickers for those who give it a try. Read on to learn about how to give it a try and for a chance to receive a sticker. 

![Blazor sticker](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l7g5o14tbib3h62rqqry.png)_Above: The Blazor sticker that you can win, by trying the new Visual Studio Guide!_

Blazor helps developers build rich interactive web UI using C#. To help developers learn Blazor, we’ve created an integrated Guide within Visual Studio so that everything you need to create your first app is available in the same space.

The learning experience walks you through editing and building a sample Counter app in Visual Studio. Since this is the first launch of a new learning experience, we’re looking for feedback to help us iterate on the functionality and content of the Guide!


![Visual Studio guide for Blazor](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ese5a7hv8ph5totxhntj.png)_Above: Screenshot of a step in the Guide_

## Try the Guide
We are giving away stickers to 100 randomly selected people who complete the Guide! Here is how to give it a try:

1. [Install the Visual Studio Preview experience here](https://aka.ms/blazorguidegiveaway). (You must install the Visual Studio 2022 Preview from this link to get the new Guide.)
2. Create a new Blazor server app using the instructions provided in the Guide (select “Build your first Blazor app”).
![Start the Guide in Visual Studio using this button](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3bio24wjep7qmrzxhks5.png)_Above: Screenshot of where to start the Guide_
3. Finish the new Guide to learn how to build your first app. 
4. At the end change insert a new `<h1>` under the `<h1>Counter</h1>` tag with your name, such as `<h1>Grace Taylor</h1>`.
5. [Fill out this form to complete your entry](https://www.surveymonkey.com/r/CNNDM7C).
6. If you have Twitter, share a photo of you completing the guide and mention [@dotnet](https://twitter.com/dotnet), [@aspnet](https://twitter.com/aspnet), and include the #VSguide tag.

To be eligible to be selected:
- You must complete the steps above and fill out the entry form.
- Giveaway is open to residents of the USA.
- Giveaway is open to those who are 18 years of age or older.
- Please submit by July 25th, 2022 at 11:59 PM Pacific Time.

Sticker recipients will be notified by e-mail provided in the survey form no later than August 5th. [View the full Terms and Conditions here](https://github.com/dotnet/letslearndotnet/blob/main/07-2022-Blazor/terms-and-conditions.md).
Getting data back from Async function in NextJS
Tags: javascript, nextjs, react, webdev
Published: 2022-07-15 15:24:55

I have the following code in `/lib/s3libdata.js`:

```
import { Upload } from "@aws-sdk/lib-storage";
import {S3, S3Client} from "@aws-sdk/client-s3";

export const putObject = async (uploadFilePath, fileStream) => {
    const upload = new Upload({
        params: {
            Bucket: process.env.AWS_BUCKET,
            Key: uploadFilePath,
            Body: fileStream,
        },
        client: new S3Client({
            region: process.env.AWS_REGION,
            credentials: {
                accessKeyId: process.env.AWS_ACCESS_KEY,
                secretAccessKey: process.env.AWS_SECRET_KEY,
            },
        }),
        queueSize: 3,
    });

    upload.on("httpUploadProgress", (progress) => {
        console.log(progress);
    });

    await upload.done();
};
```

Using the `@aws-sdk/lib-storage`.  The upload works, and in my terminal I get the console log output of the progress.  My question now is how do I send that progress information back to the page?

The way I call this is from `/pages/api/upload.js` which is called from `/pages/upload.js`.  

Ideally I want the upload.js page to display the progress data.  How can I achieve this?
I Create my portfolio
Tags: html, css, javascript, portfolio
Published: 2022-07-15 15:23:33

[AinTech - My Portfolio](https://albinn-j.github.io/AinTech/)

Plz Send your Opinion

[GitHub](https://github.com/AlbinN-J/AinTech)

Connect Me

[Linkedin](https://www.linkedin.com/in/albinnj/)
[Gmail](albinnj0214@gmail.com)
[Desafio] - Estimar Custos em Nuvem
Published: 2022-07-15 14:25:04

> Conteúdo original [nessa thread do Twitter](https://twitter.com/zanfranceschi/status/1547949550899384320)

---

Ei dev,

Tenho um desafio diferente pra você: fazer um orçamento duma aplicação.

Por mais que talvez você nunca queira se envolver em custos, vale a pena ter essa noção. Nenhum dinheiro é infinito, por mais que pareça em alguma grandes empresas.

cc @sseraphini

↓

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

A aplicação e requisitos são simples:

- Hospedagem em nuvem;
- 20.000 usuários mês (picos de 4 acessos/segundo);
- Disponível na internet com domínio próprio;
- Crescimento de 2GB/mês de banco;
- Disponibilidade decente :)

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

---

O desenho não mostra uma solução completa (load balancer, logs, DNS, etc.), ok? Estime o que VOCÊ entender como uma aplicação. Não precisa estar "certo" – não existe o certo aqui. O importante é começar a ter consciência de custos e exercitar.

---

No orçamento, pra simplificar, leve em consideração apenas o valor mensal – ignore a construção.

Dica: usem as calculadoras dos provedores cloud:

- https://azure.microsoft.com/en-us/pricing/calculator/

- https://calculator.aws/#/addService

---

Depois posta aí seu orçamento com o dimensionamento dos recursos pra gente ver! Quem sabe alguém não te contrata :)
Paste Hosting Code Snippets online
Tags: hosting, paste, webdev, staticsave
Published: 2022-07-15 15:15:15


If you're a web developer, then you know that one of the most tedious tasks is hosting code snippets. You have to find a place to host them, copy and paste the code, and then hope that people can find it. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4wneagt6kls4jb7igxex.png)
 
In [StaticSave.com](https://staticsave.com/) you can host all your code snippets by simply pasting it in the field provided. And save the code and host it online.

Plus, with StaticSave you can keep track of all the code snippets you've hosted in one place. So you can go back and find the code you need quickly and easily. And if you need to share your code snippets with others, you can do so with ease. 

StaticSave is the perfect solution for web developers who need to host code snippets. So why not give it a try? 

You can find more information and sign up for StaticSave at: [https://staticsave.com/](https://staticsave.com)
What Is Scikit-learn?
Tags: python, programming, javascript, tutorial
Published: 2022-07-15 07:07:30

It is a NumPy and SciPy-related Python library. One of the best libraries for handling complex data is thought to be this one.

[Replace values inside a for loop (Python)](https://professional-writer0.blogspot.com/2022/07/how-can-we-remove-every-number-from.html)

This library is undergoing a lot of changes. The cross-validation feature, which enables the use of multiple metrics, is one modification. Numerous training techniques, including logistic regression and nearest neighbours, have seen some minor advancements.

## Features Of Scikit-Learn

1. Cross-validation: A number of techniques exist to evaluate the efficacy of supervised models on unobserved data.

2.Unsupervised learning algorithms are available in a wide variety, ranging from clustering to unsupervised neural networks using principal component analysis and factor analysis.

3. Feature extraction: Effective for removing features from text and images (e.g. Bag of words)
Box Modeling
Published: 2022-07-15 15:07:51

## Modelo de caja

[[Modelo de caja](https://web.dev/i18n/es/learn/css/box-model/)](url)


- ---------------------------

[Introducción al Modelo de Caja de CSS - CSS | MDN](https://developer.mozilla.org/es/docs/Web/CSS/CSS_Box_Model/Introduction_to_the_CSS_box_model)

- ---------------------------

[CSS Box Model](https://www.w3schools.com/css/css_boxmodel.asp)

- ---------------------------

[¿Que es el Box Model?🤔](https://dev.to/lupitacode/que-es-el-box-model-4mnj)

PROPIEDAD DISPLAY:VALORES

[https://www.geeksforgeeks.org/css-display-property/](https://www.geeksforgeeks.org/css-display-property/)

- ---------------------------

ELEMENTOS EN LINEA

[https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements)

- ---------------------------------

ELEMENTOS DE BLOQUE

[https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements)