teleren/devto huggingface dataset:
Smart Contract Inheritance.
Tags: beginners, blockchain, programming, web3
Published: 2023-01-09 14:28:35

**Inheritance Overview**
As with many object-oriented languages, Solidity includes inheritance as a feature.

Inheritance means that you can create an object with some values/methods and use it as a base for other objects.
In Solidity, the objects we're referring to are contracts and interfaces. We can write a contract with state variables and functions. Then we can create contracts that inherit those variables and functions. These derived contracts can then choose to add behavior as necessary.

Smart contracts can inherit other contract by using the is keyword. More specifically, a contract that inherits is the child and the inheritor is the parent. Using the is keyword in Solidity establishes a smart contract parent-to-child chain. So whenever you think of inheritance, just think of the father-son relations.


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

Inheritance allows programmers to create classes that are built upon existing classes, to specify a new implementation while maintaining the same behaviors.

Contracts can inherit other contracts by using the **is** keyword.

Just as illustrated in the diagram above, the syntax to establish inheritance between smart contracts in Solidity is to simply us the is keyword in the child contract - which creates an explicit pointer to the parent contract:

contract A {
    
}

contract B is A {
    
}

In this case Contract A is the parent contract, often times referred to as the base contract whereas Contract B is the child contract, often referred to as the derived contract. Let's break down the different types of smart contract inheritance in Solidity.
useId() Hook - web dev simplified
Tags: react, beginners, webdev, javascript
Published: 2023-01-09 14:06:19

**Folder Structure**

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

**App.js Code**

``` react
import React from 'react'
import EmailForm from './EmaliForm'

const App = () => {
    return (
        <>
            <EmailForm />
            <article style={{marginBlock: "1rem"}}>
                Lorem ipsum dolor sit, amet consectetur adipisicing elit. Recusandae illum, porro temporibus unde dolores voluptatem repudiandae numquam cupiditate libero repellat dolorum inventore fugit qui autem minima, natus iure atque itaque nisi eaque quod accusamus facere odio. Quam corporis officia eius odio nesciunt maxime praesentium modi, deleniti, tempore error officiis libero.
            </article>
            <EmailForm />

        </>
    )
}

export default App

```
**EmaliForm.js Code**

``` react
import { useId } from "react"

export default function EmailForm() {
    const id = useId();
    return (
        <>
            <label htmlFor={`${id}.email`}>Email</label>
            <input type="email" id={`${id}.email`} /> 

            <br />

            <label htmlFor={`${id}.name`}>Name</label>
            <input type="email" id={`${id}.name`} /> 

        </>
    )
}
```
**Output**

![Output Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/khxnz0ighyugmz644pq3.png)
The Rocketship Template for AWS 🚀
Tags: aws, dotnet, api, template
Published: 2023-01-09 14:00:00

---
title: The Rocketship Template for AWS 🚀
published: true
description: Presenting a simple template to develop, publish, and test a C# service API on AWS, with serverless Lambda functions, supported by DynamoDb, behind an API Gateway, and protected by Cognito auth.
tags: #AWS #DotNet #API #Template
cover_image: https://raw.githubusercontent.com/instantiator/mvp-rocketship-template/main/documentation/images/rocket-mvp.png
published_at: 2023-01-09 14:00 +0000
---

Presenting a simple template to develop, publish, and test a C# service API on AWS, with serverless Lambda functions, supported by DynamoDb, behind an API Gateway, and protected by Cognito auth.

Read more about it, here: https://instantiator.dev/post/rocketship-template/

Feel free to plunder the template on GitHub, here: https://github.com/instantiator/mvp-rocketship-template
User commands of linux
Published: 2023-01-09 13:57:34

sudo adduser username	
To add a new user

sudo passwd -l 'username'	
To change the password of a user

sudo userdel -r 'username'	
To remove a newly created user

sudo usermod -a -G GROUPNAME USERNAME	
To add a user to a group

sudo deluser USER GROUPNAME	
To remove a user from a group
Linux Commands and description for practice
Published: 2023-01-09 13:52:28

ls
Lists all files and directories in the present working directory


ls -R	
Lists files in sub-directories as well

ls -a	
Lists hidden files as well

ls -al	
Lists files and directories with detailed information like permissions,size, owner, etc.

cd  or cd ~	
Navigate to HOME directory

cd ..	
Move one level up

cd /	
Move to the root directory

cat > filename	
Creates a new file

cat filename	
Displays the file content

cat file1 file2 > file3	
Joins two files (file1, file2) and stores the output in a new file (file3)

sudo	
Allows regular users to run programs with the security privileges of the superuser or root

rm filename	
Deletes a file

man	
Gives help information on a command

history	
Gives a list of all past commands typed in the current terminal session

clear	
Clears the terminal

mkdir directoryname	
Creates a new directory in the present working directory or a at the specified path

rmdir	Deletes a directory
Powerful AI Tools and YOU.com
Published: 2023-01-09 13:26:30

Welcome to You.com the first app that combines ChatGPT connected to Google.

It seems ChatGPT is disrupting the Internet. Now, it is Google the one that can be disrupted. Welcome to **[You.com](https://you.com/)** the first app that combines ChatGPT connected to Google. You.com is a search engine that puts its users first.


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

You.com is a privacy-focused search engine built in Palo Alto, California, United States that summarizes web results using website categories, contrary to a traditional search engine that shows a list of links.

## What is the difference between Google and you com?
You.com is a search engine that wants to take on Google and has no ads policy. Whereas, Google is a platform with search in the center and other products like Gmail, Android, YouTube, and more bolstering its presence. Also, Google receives over a billion search queries daily.

This is only the beginning and we are just in early January!

## 10 powerful tools you must have in 2023:

**1- CleanUp.pictures:**
Remove unwanted objects from
photos, people, text, and defects from any picture.

[LINK](https://cleanup.pictures/)

2- Resumeworded:
Online resume and LinkedIn grader instantly scores your resume and LinkedIn profile and gives you detailed feedback on how to get more opportunities and interviews. [LINK](https://www.resumeworded.com/)

3- SoundRaw:
[Soundraw](https://soundraw.io/) is a music generator for creators.
Select the type of music you want genre, instruments, mood, length, etc, and let Al generate beautiful songs for you.

4- LOOKA:
Design a Logo, make a website, and create a brand identity you’ll love with the power of Al. [LINK](https://looka.com/)

5- CopyAI:
Get a great copy that sells. [Copy.ai](https://www.copy.ai/) is an Al-powered copywriter that generates high-quality copy for your business.


6- Dall-E:
[DALL·E 2](https://openai.com/dall-e-2/) is a new AI system that can create realistic images and art from natural language descriptions.


7- Wonder:
At [Wonders.ai](https://www.wonders.ai/) we are cultivating a world where Artificial General Intelligence can live amongst us as equals and relate to us on an interpersonal level.

[PlayStore](https://play.google.com/store/apps/details?id=com.codeway.wonder&hl=en&gl=US&pli=1) and [AppStore](https://apps.apple.com/us/app/wonder-ai-art-generator/id1621278575)

8- WriteSonic:
[Writesonic](https://writesonic.com/)is an AI writing and image generation platform with a mission to empower everyone in the world to create any form of content 10X faster.

9- MidJourney:
The [mid-journey](https://midjourney.com/home/?callbackUrl=%2Fapp%2F) is an independent research lab exploring new mediums of thought and expanding the imaginative powers of the human species.

10- ChatGPT:
[ChatGPT](https://openai.com/blog/chatgpt/)is a large language model chatbot developed by OpenAI based on GPT-3.5. It has a remarkable ability to interact in conversational dialogue form and provide responses that can appear surprisingly human.
Create a emoji-picker in dmenu
Tags: linux, dmenu, xfce, emoji
Published: 2023-01-09 13:25:45

One of the nice things I have in Windows is that when I pressed `windows` + `.`, the emoji picker shows up. When I moved to linux distros as a daily driver, I kinda missed that features.

You can use others packages or use IBus, but I would like some cleaner approach. This approach is presented by Luke Smith, check out his cool youtube: https://www.youtube.com/watch?v=UCEXY46t3OA.

I'm assuming you're already installed dmenu on your system.

## Get all the emoji

```bash
mkdir ~/dmenu
cd dmenu

curl https://gist.githubusercontent.com/Caellian/947e9b7b0f9d42278b9308765dc4ec08/raw/66a8b264732b4da40970cb3c57df02118e47cb2b/update.sh | sh
```
We make a directory and then use this nice script by [Caellian](https://gist.github.com/Caellian/947e9b7b0f9d42278b9308765dc4ec08) to collect all available emojis and format it.

You'll see a file named "emoji_list". That's the file we're going to insert into dmenu.

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

## Make the script
```
touch dmenuemoji.sh
chmod +x dmenuemoji.sh
```
We created a file `dmenuemoji.sh`, open it with your favorite editor.

Paste the script by Luke Smith below.

```bash
#!/bin/sh

grep -v "#" emoji_list | dmenu -i -l 20 | awk '{print $1}' | tr -d '\n' | xclip -selection clipboard

pgrep -x dunst >/dev/null && notify-send "$(xclip -o -selection clipboard) Copied!"
```

Don't forget to bind it with a keyboard shortcut.

You can edit the script, for example your preferred dmenu layout or your clipboard app. Here's my final result:

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

My final script:
```bash
#!/bin/sh
grep -v "#" emoji_list | dmenu -c -i -l 15 | awk '{print $1}' | tr -d '\n' | xclip -selection clipboard;

if [ -n "$(xclip -o -selection clipboard)" ]; then
notify-send "Emoji copied" "$(xclip -o -selection clipboard) successfully copied!" --icon=dialog-information;
fi
```
Most Useful Websites Right Now
Tags: webdev, beginners, tutorial, productivity
Published: 2023-01-09 13:24:57

Do you feel like you're constantly online but never really aware of the latest and most excellent websites out there?

**1.TinyWow**

This website contains many free tools that save you lot of time and money. Usually most files will be processed in under a minute and both source and converted file will be deleted within 1hour from the server.
[
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rgwoks2tk6xc2kiu5g5w.png)](https://tinywow.com/)

**2.Alternative**

This website contains lot of alternative free websites for paid websites. It contains alternatives for famous sites like Netflix, Spotify, Microsoft Office Suite, Adobe Acrobat Ready and so on. Literally anything.

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

**3.Free-for-dev**

This is one of the best website that every Software Developer should know. It contains massive list of service offerings that have free tiers for developers. It contains list of software from SaaS, PaaS, IaaS and so on.


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


**4.Slant**

This website gives you the product rankings and helps you to find the best product, app or game for you across thousands of queries.
Each month, over million people use Slant to find the best products and share their knowledge.

[![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/43wk636eysq5rnqnl8z0.png)](https://www.slant.co/)

**5.PDFDrive**

PDF Drive is a website that allows users to search for and download PDF files from a large database. It may be useful for anyone who needs to access a wide range of PDF documents for research, study, or other purposes. 


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


**6.Pocket**

This app allows you to save articles, videos, and other content to view later, so you don't have to bookmark or remember links.

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


Keep Learning📚
Now, I guess this is where I say GoodBye👋.
Thanks for reading till the end❤️

Please do like and follow for more such contents!!
Optimistic Locking on Spring Boot
Tags: java, springboot, programming
Published: 2023-01-09 13:13:21

If your application has massive traffic. Sometimes there will be conflicting updates between data.

For example, User A and User B accidentally trying to update same data on same time. Both of their updates will be saved and both users will receive a successful response. Both of them will assume their data correctly saved. But, that's not the case - the first saved data will replaced by the last one. We don't know which user saved it first.

In order to prevent this, we can use Optimistic Locking. In Optimistic Locking we need to save record version in database.

![optimistic locking example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u6bhjd1ffp51xtjcembj.jpg)

If there's modification on a record, we need to check its version first. If the new data version is lower than the version in the database, it will be rejected. If it has the correct version, the new data will be saved and the version will be incremented.

It has quite a lot logic right? But, don't worry all of that process will be taken care by JPA.

We need to add the @Version annotation to the entity.
```
@Entity
public class Student {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    Long id;

    String name;

    @Version
    Long version;
}
```
**All done!**

Here's a test script to check if Optimistic Locking is working correctly.

```
@DataJpaTest
public class RepoTest {

    @Autowired
    StudentRepository repo;

    @Test
    void testOptimisticLock(){
        Student initStudent = new Student(1L, "Andy", 0L);
        Student insertedStudent = repo.saveAndFlush(initStudent);

        assertEquals(0, insertedStudent.getVersion());

        insertedStudent.setName("Jack");
        Student updatedStudent = repo.saveAndFlush(insertedStudent);

        assertEquals(1, updatedStudent.getVersion());

        assertThrows(OptimisticLockingFailureException.class, () ->
            repo.saveAndFlush(initStudent)
        );
    }
}
```

[You can check the full code here](https://github.com/rfnajid/optimisticlock)

**Note **

If you don't want to add dedicated version field to your existing table, you can use the update date as the version instead.
Vim: ignore casing in search
Tags: vim
Published: 2023-01-09 13:07:15

escape sequence anywhere in the pattern `\c`

```vim
/\ccmake
```
will match `cmake` and `CMake` or `cMake` 
```vim
/c\cmake
```
will match `cMake` and `cmake` but not `CMake`

the inverse of `\c` is `\C`

```vim
/\cc\CMake
```
will match `CMake` and `cMake` but not `cmake`


###further options:
This will ignore casing in all searching:
```
:set ignorecase
```
unset with `no` prefix as usual:
```
:set noignorecase
```

In addition to the above this will ignore casing if search string is all lowercase, but will be case sensitive if the search string contains any upper case letter. The `ignorecase` must me set.
```
:set smartcase
```
My Journey in Open Source - ab-test-fn
Tags: javascript, github, opensource, typescript
Published: 2023-01-09 13:03:33

[Link to the repo](https://github.com/Cadienvan/ab-test-fn)

## What is this?

A higher-order function to provide an A/B testing mechanism with multiple weights.

## How do I install it?

```bash
npm install ab-test-fn
```

## How can I use it?

### Use-case #1 - Simple A/B testing

In this scenario, we want to test two versions of a function, `fnA` and `fnB`, and we want to run `fnA` 80% of the time and `fnB` 20% of the time.

```javascript
import { AB } from 'ab-test-fn';

const fnA = () => console.log('fnA');
const fnB = () => console.log('fnB');

const fnAB = AB(fnA, fnB, [0.8, 0.2]);

fnAB(); // Will log 'fnA' 80% of the time and 'fnB' 20% of the time
```

### Use-case #2 - A/B testing with multiple weights

In this scenario, we want to test three versions of a function, `fnA`, `fnB` and `fnC`, and we want to run `fnA` 50% of the time, `fnB` 30% of the time and `fnC` 20% of the time.

```javascript
import { AB } from 'ab-test-fn';

const fnA = () => console.log('fnA');
const fnB = () => console.log('fnB');
const fnC = () => console.log('fnC');

const fnABC = AB(fnA, fnB, fnC, [0.5, 0.3, 0.2]);

fnABC(); // Will log 'fnA' 50% of the time, 'fnB' 30% of the time and 'fnC' 20% of the time
```

## API

The `AB` function accepts an indefinite number of functions and an array of weights. The weights can be either integers or floats, they don't have to add up to 1. The function will return a new function that will run one of the provided functions based on the sum of the weights.

## Tests

You can run the tests by using the following command:

```bash
npm test
```
From Coding to Writing: Why Every Developer Needs a Blog
Published: 2023-01-09 11:57:11

<u>As a software developer, you may be used to expressing yourself through code, but have you ever considered writing a blog?</u> Whether you're a seasoned developer or just starting out, there are many benefits to blogging that make it worth considering.

**1. Improve Your Communication Skills:** Writing a blog can help you to improve your communication skills, both written and verbal. It's one thing to be able to write code, but being able to clearly and concisely explain technical concepts to a non-technical audience is a valuable skill to have. Blogging can help you to develop this skill, and can also help you to improve your overall writing ability.

**2. Build Your Personal Brand:** By sharing your thoughts and expertise on a particular topic, you can establish yourself as a thought leader in your field and attract potential clients or employers. A well-written and informative blog can be a great way to showcase your skills and knowledge, and can help you to stand out in a competitive job market.

**3. Document Your Learning Journey:** Blogging can be a great way to document your learning journey and reflect on your own growth as a developer. By writing about the challenges you've faced and the solutions you've found, you can not only share your knowledge with others, but also gain a deeper understanding of the concepts you're learning.

**7. Have Fun and Get Rewarded:** Finally, blogging can be a fun and rewarding hobby. It can be a great way to express your creativity and share your passion for technology with others. And who knows, you may even be able to monetize your blog and turn it into a side income!

So, if you're a software developer, consider giving blogging a try. It can be a valuable addition to your professional development, and can help you to build your skills, network, and reputation in the industry.
ERP Software For Garment Industry | Garment manufacturing ERP - Caret IT
Published: 2023-01-09 13:03:17

Book a Garment ERP to learn how End to End requirements of business manage easily? Garment ERP  Unique Features Customization & Salable as Per Yours.
Why choose odoo for the garment industry management system Cloud Garment ERP Loaded with Unique Features Customizable & Scalable as Per Your.

Get the best ERP software for the apparel industry that supports a speedier, more reliable order procedure and product planning. Take a demo today!
How Web Works?
Published: 2023-01-09 13:01:41

**Web technology** is a system of interrelated technologies that power the **World Wide Web**. It is a combination of hardware, software, protocols and standards that enable the exchange of information, multimedia, and applications across the Internet.

At its core, web technology is made up of _three_ components:

1. Client-side technology: This refers to the technology used by a user to access the web. This includes browsers, plug-ins, and other tools that allow users to interact with the web.

2. Server-side technology: This refers to the technology used by web servers to provide the content, applications, and services that users access through the web. This includes web servers, databases, and other tools that allow web servers to host and deliver web content.

3. Network technology: This refers to the technology used to connect users and web servers. This includes routers, switches, and other networking equipment that allow users and web servers to communicate with each other.

When a user visits a website, their browser sends a request to the web server hosting the website. The web server then responds by sending the requested web page to the user’s browser. The web page is then displayed in the user’s browser.

Thanks for Reading! Follow for more...
macOS Tip: How-To Quickly Get More Details About A Mac's Wi-Fi Connection
Tags: macos, tutorial, programming, productivity
Published: 2023-01-09 13:00:00

- [Introduction](#introduction)
- [Getting More Details About A Wi-Fi Connection](#getting-more-details-about-a-wi-fi-connection)
- [Conclusion](#conclusion)

## Introduction

When clicking on the Wi-Fi icon in macOS, it will show the Wi-Fi network that the Mac is connected to, any additional networks it has found and personal hotspots. An example is shown below:

![01-wifi-default](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rk1p5au6m8udbetl2jsl.png)

Whilst this is useful, mainly for setting up a Wi-Fi connection, there could be a time when an issue arises that requires more information, such as the IP address or the channel that the Wi-Fi network uses.

This level of information is not shown by default but it is available in macOS. This guide will show how to get that information quickly, along with some additional information that could be of use.

## Getting More Details About A Wi-Fi Connection

1. Hover over the Wi-Fi icon (shown in the image below in the purple box) in the macOS' menu bar. It is usually shown on the right-hand side near the date and time.
![02-wifi-icon](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y28qm9vc9z9ap5e6q6y4.png)
2. Press and hold down the Option key on your keyboard.
3. Click on the Wi-Fi icon. As shown below, there will be a lot more detail shown versus how it normally appears.

![03-wifi-expanded](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dpu8fnts9gyvvdk8lsqq.png)

In addition to using the above for getting more Wi-Fi details, it can also be used for other icons on the menu bar. For example:

- More details about connected / paired bluetooth devices.
- Change input devices in the sound icon.
- Browse other Time Machine drives if the Time Machine icon is shown.
- Enable focus mode if the date / time is clicked on.

## Conclusion

I hope you found this useful. Thank you for reading and have a nice day.