teleren/devto huggingface dataset:
How Uniswap deployed contract to the same address?
Tags: solidity, ethereum, uniswap
Published: 2021-07-20 17:20:26

## The contract address is not random?

I thought all the Ethereum-based contract address was random, just like how we access the wallet from the randomized private key.

Until I found interesting notes from Uniswap v2 Docs.
1. The [Uniswap V2 router address](https://uniswap.org/docs/v2/smart-contracts/router02/#address) is `0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D` for all networks. 

2. Moreover, [Uniswap LP token address](https://uniswap.org/docs/v2/smart-contract-integration/getting-pair-addresses/#create2) can be deterministicly computed offline. 


Wow, These are such a nice dev experience ✨. So I want to explore how they do it. 

---

### 1. Deploying same contract address to all networks

> The address for an Ethereum contract is deterministically computed from the address of its creator (**sender**) and how many transactions the creator has sent (**nonce**)

So one simple way is to use the same wallet (address) to deploy all networks, and deploy with the first transaction of the wallet, so nonce will be the same. 🎉

**But why?**: I think this is quite convenient for the testnet development. The developers have no more need to google for the different testnet address, or make the config handle different addresses.

### 2. Deploying a pair of tokens LP to the same address.

> A new opcode, `CREATE2` was added in [EIP-1014](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1014.md) that is another way that a contract can be created. For contract created by `CREATE2` its address will be:
`keccak256( 0xff ++ senderAddress ++ salt ++ keccak256(init_code))[12:]`

Considering variable params needed...
- `init_code` is a byte code from the deployed contract 
- `salt` is something which can be changed.

So Uniswap utilized `salt` to be a hash of `token0` and `token1` addresses. That's why it is always deterministic. 🎉

Which I think this is also helpful to Uniswap to avoid having a duplicate LP for the same pair of tokens.

**But why?**: This is quite useful to get the information of each LP without looking up LP address. We just need the addresses of 2 tokens, then compute the LP address to retrieve the information right away.

---

Thanks to a nice summary from: https://ethereum.stackexchange.com/a/761/76945
Android 11 with TailwindCSS
Tags: tailwindcss, webdev, design
Published: 2021-07-20 16:48:03

In this blog, we gonna recreate the Android 11 model UI with [TailwindCSS](https://tailwindcss.com/?ref=lagandlog.com).

If you are interested in using TailwindCSS in React Native, check out [TailwindCSS and React native](https://lagandlog.com/logs/how-to-use-tailwind-css-in-react-native) log.

Let's get right into it,

We are gonna take an image from the official page and try to replicate the same, follow along for more.

#### Image to replicate:

![ANDROID11.png](https://lagandlog-uploads.s3.amazonaws.com/ANDROID_11_079b0813aa.png)
Image source - https://www.android.com/intl/en_in/android-11/
#### Final output 😍:
![android11output.png](https://lagandlog-uploads.s3.amazonaws.com/android11output_4e54645242.png)

Find source code here -  [Complete source](https://lagandlog.com/logs/rebuild-android-11-with-tailwindcss)

{% codepen https://codepen.io/sasiKdharan/pen/LYyjOZM %}

Feel free to add your comments below & follow me on Twitter for more - [sasiKdharan](https://twitter.com/sasiKdharan)

Thanks.
### Happy Designing 💅
How to Create Background-Changer Using HTML, CSS and JavaScript.
Tags: html, css, javascript, webdev
Published: 2021-07-20 16:36:32

Hello Everyone, In this Post We Will be Seeing How to Create Background Changer Using HTML, CSS and JavaScript.

Here is The Live Link of Page https://bg-changer-js.netlify.app/

Follow Me on LinkedIn https://www.linkedin.com/in/ajaysharma12799/

Follow Me on Github https://www.github.com/ajaysharma12799/

Steps to Create :-

1. Choose Any Text Editor (VSCode Recommended).
2. Create 3 Files in Current Project Directory, index.html, style.css and app.js.
3. Use Below HTML, CSS and JS Code To Build Your Page.
```
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Background Changer</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div id="container">
        <div class="title">
            Click To Change Background
        </div>
    </div>
    <script src="./app.js"></script>
</body>
</html>
```
```
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
#container {
    cursor: pointer;
    border: none;
    width: 50%;
    margin: 0 auto;
    margin-top: 50vh;
    background-color: #1B98F5;
    box-shadow: 0 0 20px #fff;
}
.title {
    color: #fff;
    font-size: 30px;
    font-weight: lighter;
    text-align: center;
    padding: 20px;
}
```
```
let containerElement = document.getElementById("container");

containerElement.addEventListener("click", changeColor);

function changeColor() {
    let random1 = Math.floor(Math.random() * 255 + 1);
    let random2 = Math.floor(Math.random() * 255 + 1);
    let random3 = Math.floor(Math.random() * 255 + 1);
    document.body.style.backgroundColor = `rgb(${random1}, ${random2}, ${random3})`;
}
```
System.Mvvm updates
Tags: csharp, mvvm, dotnet, opensource
Published: 2021-07-20 16:31:37

System.Mvvm is a powerful cross-platform MVVM class library for .Net (Framework, Core and .Net 5+), UWP, Xamarin.iOS, Xamarin.Mac, Xamarin.Android.

We have just published an update to all of the DSoft.System.Mvvm packages.

##Changes
  - Updated DSoft.System.Mvvm.Hosting with the correct assembly name.
  - Added .NET 5.x targets for the core and hosting libraries, on top of Net Standard 2.0.

{% github newky2k/System.Mvvm %}
Hurricano
Tags: showdev, javascript
Published: 2021-07-20 16:25:01


An open source Discord bot!

<h2>Features⭐ :</h2>

⭐ Mongoose-Based Command Cooldowns
⭐ Command Permissions
⭐ Slash Command Handler
⭐ Subcommands system
⭐ OwnerOnly Commands
⭐ Args required or not Option
⭐ Permissions handler
⭐ Role-Requirement Giveaways
⭐ Customizable server settings using MongoDB
⭐ Button help-menu
⭐ Starboard
⭐ Logging
⭐ a lot of `/` commands
⭐ ...And many interesting commands!


<h2>Invite Hurricano 🌀</h2>
<div align=center>

<a href="https://top.gg/bot/803169312827113483"></center>
<img src="https://top.gg/api/widget/803169312827113483.svg" alt="HurricanoBot"/>
</a>
Github : https://github.com/Hurricanobot/Hurricano
Invite Hurricano: https://dsc.gg/novusbot
</div>
MySQL pagination
Tags: mysql
Published: 2021-07-20 15:33:46

MySQL is one of the most popular database software and most loved as well by software engineers. I have used MySQL in tons of projects and have complete confidence in this software. I am sure if you have a software engineering background, you must have come across MySQL.

MySQL stores data in the database and table format and when the size of data grows it becomes a performance bottleneck to read all of the data. For few thousand records, it’s alright to run a SELECT * query and fetch all the records. It’s not recommended to do it for hundred thousand or million records.

Let’s consider a very simple data record, a user table that contains all the information about users. To fetch the record, you run this query.

```
SELECT * FROM users;
```
This returns all the records, you can filter them by providing a WHERE clause but the MySQL engine needs to scan all of the records to find the match.

To avoid this scenario, we use the pagination approach. In the pagination approach, we send back the information in pages or batches instead of the whole at once.

For instance, we send 100 records per page and the application can request more data if requires by asking for the next page data.

To achieve this in MySQL, we use the OFFSET and LIMIT clauses.

The OFFSET clause lets you skip the records and the LIMIT clause lets you limit the record to a certain number.

For example, if we want to read the 50 records per page. We run our query like this.

For page 1
```
SELECT * FROM users OFFSET 0 LIMIT 50;
```
For the next page i.e page 2, we tweak the query like this.
```
SELECT * FROM users OFFSET 50 LIMIT 50;
```
For the next page i.e page 3, we tweak the query like this.
```
SELECT * FROM users OFFSET 150 LIMIT 50;
```
And so on.

This article was first published on [Shahid's blog.](https://shaikhshahid.com/)
Doing Something Different.
Published: 2021-07-20 16:12:22

I've been learning that maybe I haven't been doing things in the right way as a developer. I feel like I'm trying and failing and trying and failing again and maybe that's because I haven't been documenting the way I should be.
I feel like years of what I've done has fallen into the void just because I wasn't posing it online and sharing it with other people..

I was coding almost everyday at 15/16. I quit playing video games just because I wanted to make websites. I was doing some really cool things but I never thought to share them or save what I was doing, I was just having Fun. I can still remember the first time I installed an Operating System, it was Kali Linux! I did that back in 2014. 

I'm almost 20 now. And I feel like I have to go to college, and maybe that'll make me a better developer, or maybe I'll just get a piece of paper and that'd be cool too.
 
Starting Today, I'm making my reappearance on social media platforms and This time I want to make it apart of what I do; to share what I care about and spend so much of my time doing.
O que é HTTP?
Tags: beginners, ptbr
Published: 2021-07-20 16:00:39

Depois de entender [como a internet funciona](https://dev.to/deborafelix/como-a-internet-funciona-5f8a) , sabemos o quão importante é a conexão TCP/IP e a estrela de hoje se beneficia muito dela, porque para que o protocolo HTTP possa transferir seus dados é necessário a conexão entre cliente e servidores. Mesmo assim ela é conhecida como protocolo de texto sem conexão. 

Primeiro, vamos dar nome aos bois. HTTP é a sigla para HyperText Transfer Protocol que é um protocolo (de transferência de hipertexto) usado para transferir dados pela WWW (World Wide Web) que seria o grupo de conteúdos transferido via internet. Essas siglas são bem familiares porque elas antecedem o nome da maior parte dos sites que visitamos e se você clicou para ver aqui no dev.to reparou que é HTTPS, uma extensão mais segura do HTTP, sendo o S de Secure, provavelmente a maioria dos sites que mais visitados hoje são HTTPS pois o Google mostra avisos de não seguro para sites HTTP. 

Então, quando eu chamo o link de um site, eu crio uma requisição HTTP  para o servidor que tem o conteúdo e espero a resposta, se o servidor tiver o conteúdo, ele manda e a conexão é desconectada, se não tiver o que pedi, ele vai responder que não tem e a conexão é desconectada. Pois isso um protocolo de texto "sem conexão". 

Além do **request** e **response** tem outros nomes que se você vai trabalhar com HTTP, você precisa conhecer. 

### Estrutura do HTTP

Quando você pede um livro em uma biblioteca, existe um conjunto de informações necessárias para a bibliotecária conseguir te entregar exatamente o que você procura. Se pretende pegar um livro, o máximo de informações que você tem sobre aquele livro vão ajudar, mas são informações diferentes se você pretende na verdade mudar o livro que já tem, ou só devolver. No HTTP existem algumas maneiras de transmitir essas informações que podem ser transmitidas através do body, header e na url.

 Na url temos duas maneiras, params e query string. Na url dev.to/deborafelix sendo **/deborafelix** um exemplo de params. Pensando de novo na biblioteca, um params poderia ser o nome de um gênero de livros, ou do autor. Agora o query string são os parâmetros após " ? " como quando pesquisamos algo no dev.to/search **?q=something**. 

O body e header não são tão visíveis. Sendo mais fácil visualizar essas informações durante o desenvolvimento, no postman, insomnia ou similares. Isso é muito bom quando é preciso enviar informações confidencias, como o token de autorização e o content-type, sendo o último o identificador para o tipo de dado enviado. 

Se você está iniciando na área da programação, pode ter certeza que esses conceitos não serão esquecidos e falarei mais sobre eles em outros posts no futuro. 

### Links

Esses são os links que me ajudaram na construção desse post:

[Alura](https://www.alura.com.br/artigos/desmistificando-o-protocolo-http-parte-1)
[Rock Content](https://rockcontent.com/br/blog/http/)
[Oficina da net](https://www.oficinadanet.com.br/artigo/459/o_protocolo_http)
Seventh-week check in for PSF, GSoC 2021
Tags: gsoc
Published: 2021-07-20 15:58:48

Hi! This weeks check in may be short but interesting. Firstly, I was given great news: I passed the first evaluation :smiley:. Now, the second period begins, and I plan to keep my good workflow ongoing.

## What did I do this week?

I focused on my **third milestone**. I made two challenges for the course. The first one is a called *Hangman challenge*, and it is about creating a hangman game. The hard thing was coding its web test. I'll explain this later. The second challenge is called *Pergamino challenge*, and it is about deciphering a parchment with Python code. This was very straightforward, even its web test.

## Did I get stuck anywhere?

Yes. The playwright test for the hangman challenge was tricky. Interacting with the exercises of this challenge meant dealing with several dialog prompts. I already knew how to accept one dialog prompt:
```python
page.on("dialog", lambda dialog: dialog.accept("sth"))
```
But I had trouble when more than one needed to be handled in the same test. By looking at playwrights documentation I found a solution. First, expect for the dialog event to appear on screen. Then, accept that single dialog once. This, translated to code, is:
```python
with page.expect_event("dialog") as prompt1:
    page.once("dialog", lambda dialog: dialog.accept("sth"))
with page.expect_event("dialog") as prompt2:
    page.once("dialog", lambda dialog: dialog.accept("sth"))
```

## What is coming up next?

I made two PRs this week. Both are regarding the new challenges. They are still awaiting review. So this week I will tackle the review suggestions, and will review my peers PRs.
ReactJS in one hour - Live
Tags: react
Published: 2021-07-20 15:56:48

Join me for **ReactJS in one hour** https://www.linkedin.com/events/reactjsinonehour6823243129743900672/
Wednesday, 21 July · 6:00 – 7:00pm IST
Video call link: https://meet.google.com/nbj-vmwm-eap

*Agenda*
- First React App
- Functional Component & Props
- Class Component & State Management
- Class Component with Input types
- React Hook

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j6ieslfkj6vw40e2ggnr.png)
Making Project Management Not Suck w/ Zach Ozer of Clubhouse
Tags: management, leadership, productivity, agile
Published: 2021-07-20 15:50:39

It’s time for project management not to suck anymore.

That’s why on this week’s episode of [Dev Interrupted](https://devinterrupted.com/podcast/making-project-management-not-suck/) we've brought in Zach Ozer, the VP of Engineering at Clubhouse.io, to talk about how the new partnership between [LinearB](https://linearb.io/) and [Clubhouse](https://clubhouse.io/signup/) is helping dev teams eliminate the need for status update meetings, and automate the manual tasks so many project management tools require from developers.

#**Listen to the full episode**
{% spotify spotify:episode:50FuvvMf5bQPNyigTaVI85 %}


#**Episode Highlights include:**
* What’s broken with software development and project management today
* How engineering organizations can eliminate status update meetings
* What a dev-first project management tool does different
* Why [LinearB and Clubhouse.io are partnering](https://linearb.io/clubhouse-and-linearb/) and what it means for you


#**Join the Dev Interrupted Discord Server**
With over 1200 members, the Dev Interrupted Discord Community is the best place for Engineering Leaders to engage in daily conversation. No sales people allowed. [Join the community >>](https://discord.gg/devinterrupted)
![Join the Dev Interrupted Discord Community!](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19j3dzgz4r4kzav3w6z8.png)
What is MLOps?
Tags: machinelearning, devops, datascience, cloudnative
Published: 2021-07-20 15:50:02

I recently started a new job at a Machine Learning startup. I've given up trying to explain what I do to non-technical friends and family (my mum still just tells people I work with computers). For those of you who at least understand that "AI" is just an overused marketing term for Machine Learning, I can break it down for you using the latest buzzword in the field:

> MLOps

The term "MLOps" (a compound of Machine Learning and Operations) refers to the practice of deploying, managing and monitoring machine learning models in production. It takes best practices from the field of DevOps and utilises them for the unique challenges that arise running machine learning systems in production.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tiqsjood75zj9b0qy45c.png)
*Search interest for “MLOps” over the past 5 years. Source: Google Trends*

The term is relatively new and has grown rapidly in usage over the last year and is a direct result of a maturing Machine Learning landscape. As businesses get good at collecting data, designing and training ML models, their focus shifts towards integrating those models into their software estates. This brings all sorts of new challenges around infrastructure, scalability, performance and monitoring that most data science teams are not traditionally equipped to deal with.

One approach is to segregate duties between Data Science and DevOps like so:
* Data Science - design, build and evaluate the models
* DevOps - deploy, monitor and manage the models

This seems like a good idea at first but we only need to start asking some questions to see where we might struggle:
* When do we retrain a model and deploy a new version?
* What are the expected input/output formats of the model? Do we need to validate them?
* Can the model performance be optimsed by utilizing a GPU?
* How do we allow models to be continually tested?
Answering any of these questions requires knowledge of both the model itself and the complex environment it’s deployed in.

The reality is that the whole lifecycle of an ML system is tightly coupled and highly iterative in nature. Production ML is hard and requires expertise in Data Engineering, Data Science and DevOps. The umbrella term “MLOps” provides an easy way to refer to the techniques, tools and skilled engineers who inhabit the growing space between these disciplines.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jkawq1jtfqjmpvc9nu4m.png)
*Mandatory Venn diagram - Source: Wikipedia*

Is MLOps just another buzzword? Absolutely! But for now it’s the best we’ve got and it serves an important purpose.
MongoDB vs MySQL Pt.2
Published: 2021-07-20 15:49:21

In my [first post](https://mail.google.com/mail/u/0/#search/community) comparing the two database systems, I didn't actually compare them at all. I wrote a bit about Mongo and getting over a stumbling block that I had while using it for the first time. It was the kind of stumbling block that helps you to learn something better than if everything was just smooth sailing. Going from *why isn't this working?* to *this is how it works* can be very frustrating but also very productive.

##But still, what about the comparison?##

I started out with the question of **why Mongo at all** but decided that was going to be a path too far. I had a sprint to work on after all, so I limited my query to answering the question **How do you structure Mongo schemas?**. Like, how do I even think about the data in the first place, and do we have to think about 1-to-N and N-to-N type relationships etc?

I read two short documents on MongoDB to answer that question

[6 Rules of Thumb for MongoDB Schema Design](https://www.mongodb.com/blog/post/6-rules-of-thumb-for-mongodb-schema-design-part-1)
[MongoDB - Data Modelling](https://www.tutorialspoint.com/mongodb/mongodb_data_modeling.htm)

, leaving a bunch of bigger questions to be answered at a a later time. Questions like:
- What's the deal with non-relational databases?
- What's the deal with having a field that's an array. And for that matter an array of non-prescriptive length.
- What are the performance considerations or just any of the considerations when deciding what type of database to use?

So what do I know so far?

###Here's what I've learned.

- Mongo gives you flexibility to design your schema according to the needs of your project. I think about that in comparison to a SQL schema where I always think about normalization and foreign keys.

- You can containerize data according to logical relationships. If a person has pets, you can store the Pet info (name, species, etc) inside of a Person model.

- Designs like Pet-Person above can have a drawback where you need only the Pet info. With this kind of design, you would need to access the Person first.

- Foreign and Primary keys exist in Mongo but they're called 'references'. I don't know anything about the mechanics of references.

- Certain Mongo schemas seem more convenient but less efficient.

All in all, I have very little understanding of what's going on. But I had enough working knowledge to create a very simple non-referencing model for our Mongo/Full-stack sprint and also in yesterday's TA (this was supposed to be yesterday's post).