teleren/devto huggingface dataset:
#4.Slash Commands in discord.py
Tags: discord, python, beginners
Published: 2023-07-10 15:22:50

Hey Fellows!
I am back with another post and this time we will learn about:
## 1.Slash Commands

> - What are slash commands?
> > when you type (/) in your discord chat (if you have use application commands perms in channel) then u might see some suggestions. These are slash commands. It helps to interact with bots. Slash command got features like autocomplete.

> - How to create a slash Command?
> > to create a slash command we will create an interaction.
Now what is interacton? Well we will discuss about it.....

![Slash Commands](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/inmhg0qqvpa16zpayvgv.png)

-----

## 2.Creating A Slash Command:
1. First of all we will use a decorator:
```python
@bot.tree.command(name="mannu",description="Mannu is a good boy")
```
2.Under this decorator we will create our async def as we always do:
```python
async def slash_command(interaction:discord.Interaction):
    # Your Logic Goes Here...
```
3.in this def we will write a syntax to send message:
```python
await interaction.response.send_message("Hello World!")
```

- Here's the complete code just in case:
```python
@bot.tree.command(name="mannu",description="Mannu is a good boy")
async def slash_command(interaction:discord.Interaction):
    await interaction.response.send_message("Hello World!")
```
Now let's try to understand what we did here:

In `step 1`, we used a decorator to create our command and in that decorator, I provided name and description of my command.

In `step 2`, I created a async def and in this async def there is param interaction which is discord.Interaction. its work iss same as `ctx` we used in our first `.hello` command. we will use it to control our bot.

now as our interaction is created let's create a logic

In `step 3`, I awaited a syntex to send a response of that interaction.

Before running our code we need to make sure our command gets synced with bot so we will add the following syntax in our on_ready event:
```python
await bot.tree.sync()
```
here's complete code
```python
@bot.event
async def on_ready():
    await bot.tree.sync()
```

Now Let's run our code and see does it work or not...

```bash
python main.py
```

Now on typing (/) we can see our slash command

![Slash Command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0fptdbcvw83elnu14vwx.png)


![Slash Command output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v85kcjo3tcjd1q8tzzlb.png)

`Well I had to change the bot coz my bot was giving me error coz I accidently used discord in my bot username which isn't allowed.
I'll fix it in next post`

So This is how We create our slash command. Hope it helps you.

-----


Github: https://github.com/MannuVilasara/discord.py-tutorial
Refrance : https://discordpy.readthedocs.io/
Discord: https://discord.gg/pvvJvZU6nS

-----

## Up Next: 
- error handling.
- accepting user input.
Architecture & Design of Linux Storage Stack
Tags: linux, kernel, storage, architecture
Published: 2023-07-10 15:17:06

I'm excited to announce my book: "Architecture and Design of Linux Storage Stack". The book will explore the multilayered design of the Linux kernel's storage stack and is divided into the following four parts:

- **Diving into the Virtual filesystem:** This part offers a detailed introduction to the virtual filesystem (VFS) layer, its major data structures, and the concepts associated with the different filesystems in Linux
- **Navigating through block layer:** This part will explain the role of block layer and focus on some of its major components, such as the device mapper framework, block devices, the multi-queue framework, and the different I/O schedulers
- **Descending into the physical layer:** This part will focus on the major components of the SCSI subsystem and the different types of physical storage media available today and the differences in their implementation.
- **Analzying & troubleshooting storage performance:** This part will present the different metrics for assessing and troubleshooting storage performance.

[](https://www.amazon.com/Architecture-Design-Linux-Storage-Stack-ebook/dp/B0BTT9VCF2)


[](https://www.packtpub.com/product/architecture-and-design-of-linux-storage-stack/9781837639960)
SQL 📊 challenge_1⚔️
Tags: challenge, sql, database, beginners
Published: 2023-07-10 14:51:30

## Data Science Skills LinkedIn SQL Interview Question

- Given a table of candidates and their skills, you're tasked with finding the candidates best suited for an open Data Science job.
- You want to find candidates who are proficient in Python, Tableau, and PostgreSQL.
- Write a query to list the candidates who possess all of the required skills for the job. 
- Sort the output by candidate ID in ascending order.

####⚠️Note:

- You have to visit the task URL to fully understand what the task needs if you want to add a solution or test your solution.

###### Task URL: [Link](https://datalemur.com/questions/matching-skills)


## My Solution:

```
SELECT 
    candidate_id
FROM 
    candidates 
WHERE
    skill IN ('Python', 'Tableau', 'PostgreSQL')
GROUP BY 
    candidate_id
HAVING
    COUNT(skill) = 3;
```


### Code Snapshot:


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

### Learn SQL 📊

###### SQL 🔥 Get Expertise in SQL with These Top Free Courses💯🏆

🎥 {% youtube 00loCpVmozI%}


### Connect with Me 😊

#### 🔗 Links

[![linkedin](https://img.shields.io/badge/linkedin-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/mahmoud-el-kariouny-822719149/)

[![twitter](https://img.shields.io/badge/twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/Mahmoud42275)
[Summary] Chapter#09 "The Internals of PostgreSQL" Write Ahead Logging (WAL) (Part-02)
Tags: postgres, apacheage, devcommunity, bitnine
Published: 2023-07-10 14:46:44

## Writing of XLOG Records
Ready to understand writing XLOG records.
Following each line of pseudo code will explained for understanding of XLOG records
- The function ExtendCLOG() writes statement of this transaction.
- The function heap_insert() insert a heap tuple into target page on shared buffer pool.
- The function XLoginsert() writes the XLog.
- Function finish_xact_command() commits the transaction.
- Function XLogWrite() writes and flushes all XLOG records on the WAL buffer to WAL segment file.
- Function TransactionIdCommitTree() changes the state of this transaction.

**WAL Writer Process**
WAL writer is a background process to check the WAL buffer periodically and write all unwritten XLOG records into the WAL segment. If this process has not been enable the writing of XLOG records might have been bottlenecked when a large amount of data at one time.

**Checkpoint Processing in PostgreSQL**
One of the following occurs when process starts
- The interval time set for checkpoint_timeout from the previous checkpoint has been gone over.
- In version 9.4 or earlier Number of WAL segment file set for checkpoint_segment has been consumed since previous checkpoint
- In version 9.5 or later total size of WAL segment files in the pg_xlog has exceeded the value of the parameter max_wal_size.
- PostgreSQL server stops in smart or fast mode.

**Database Recovery in PostgreSQL**
PostgreSQL implements redo log based recovery feature. PostgreSQL restore database cluster by sequentially replaying the XLOG records in the WAL segment file from REDO point.
The first step towards recovery is stat up of pg_control file.


**WAL segment Files Management**
 PostgreSQL writes XLOG records to one of the WAL segment files stored. in the pg_xlog subdirectory and switches for a new one if the old one has been filled up.

**WAL segment Switches**
- WAL segment has been filled up 
- The function pg_switch_xlog has been issued.
-archive_mode is enable and the time set to archive_timeout has been exceeded.

**Continuous Archiving and Archive Logs**
Feature that copy WAL segment files to archival area at the time when WAL segment switches and perform archiver process. The copied file called archive log.

[Reference](https://www.interdb.jp/pg/pgsql09.html)
FLaNK Stack Weekly for 10 July 2023
Tags: apachenifi, apachekafka, apacheflink, opensource
Published: 2023-07-10 14:38:51

## 10-July-2023



### FLiPN-FLaNK Stack Weekly

Tim Spann @PaaSDev

https://www.threads.net/@tspannhw


### CODE + COMMUNITY

Please join my meetup group NJ/NYC/Philly/Virtual. 

[http://www.meetup.com/futureofdata-princeton/](http://www.meetup.com/futureofdata-princeton/)

[https://www.meetup.com/futureofdata-newyork/](https://www.meetup.com/futureofdata-newyork/)

[https://www.meetup.com/futureofdata-philadelphia/](https://www.meetup.com/futureofdata-philadelphia/)


**This is Issue #93 **

[https://github.com/tspannhw/FLiPStackWeekly](https://github.com/tspannhw/FLiPStackWeekly)

[https://www.linkedin.com/pulse/schedule-2023-tim-spann-/](https://www.linkedin.com/pulse/schedule-2023-tim-spann-/)



### Videos

https://www.youtube.com/watch?v=7mbxJxjGj3w&ab_channel=PierreVillard
https://www.youtube.com/watch?v=kvJx8vQnCNE
https://www.youtube.com/watch?v=CPK6gWPgrzg

### Talks

https://www.slideshare.net/bunkertor/meetup-streaming-data-pipeline-development-258709707

https://www.slideshare.net/bunkertor/big-data-fest-building-modern-data-streaming-apps

https://www.youtube.com/live/1xFha8va7pg?feature=share


### Articles



https://dzone.com/articles/streaming-change-data-capture-data-two-ways


### Documentation




### Events

[https://attend.cloudera.com/ameropendatalakehousewithcdpon?lid=7vxyhds3tlv7](https://attend.cloudera.com/ameropendatalakehousewithcdpon?lid=7vxyhds3tlv7)

July 19, 2023:   2-Hours to Data Innovation:   Data Flow
[https://www.cloudera.com/about/events/hands-on-lab-series-2-hours-to-data-innovation.html](https://www.cloudera.com/about/events/hands-on-lab-series-2-hours-to-data-innovation.html)

October 18, 2023:  2-Hours to Data Innovation:   Data Flow
[https://www.cloudera.com/about/events/hands-on-lab-series-2-hours-to-data-innovation.html](https://www.cloudera.com/about/events/hands-on-lab-series-2-hours-to-data-innovation.html)

Cloudera Events
[https://www.cloudera.com/about/events.html](https://www.cloudera.com/about/events.html)

More Events:
[https://www.linkedin.com/pulse/schedule-2023-tim-spann-/](https://www.linkedin.com/pulse/schedule-2023-tim-spann-/)



### Code

https://github.com/cloudera/CML_AMP_LLM_Chatbot_Augmented_with_Enterprise_Data/tree/main

### NiFi Code

https://github.com/georgevetticaden/evernote-ai-chatbot

### Tools

* https://github.com/dttung2905/kafka-in-production
* https://github.com/chfritz/lineselect
* https://aqicn.org/map/europe/
* https://promptswithfriends.com/app
* https://github.com/Eugeny/tabby
* https://www.wired.com/story/5-surprising-uses-chatgpt/
* https://github.com/pingcap/ossinsight-lite
* https://thanos.io/
* https://www.reddit.com/r/ChatGPT/comments/14ublwc/code_interpreter_is_the_most_powerful_version_of/
* https://castle-engine.io/gallery_games.php
* https://container.training/
* https://github.com/midzer/sitemap2feed
* https://github.com/linkedin/coral
* https://medium.com/capital-one-tech/democratizing-machine-learning-5041f5605b67


&copy; 2020-2023 Tim Spann
What is domain-driven design?
Tags: domaindrivendesign, softwareengineering, beginners, programming
Published: 2023-07-10 14:26:06

Developing software is challenging. It's not just writing code. It's everything from discovering a problem, doing process and product analysis, developing requirements, writing code and iterating on the process.

As software engineers, most of us have experienced a “spaghetti” or "big ball of mud" codebase. A codebase with no clarity, where there are dependencies in all directions. This is a symptom of code that is often highly coupled, fragile and difficult to test and maintain. A change to one part of the code may have a big knock-on effect.

There is often a common cause for this - developers are trying to build software solutions with a lack of business knowledge and understanding. When this happens we end up with software that does not truly represent business functionality. A traditional waterfall approach to developing software can be a root cause of this because it focuses on one person or team gathering information and requirements, then passing to engineers to build and deliver. There's a huge gap of knowledge transfer and collaboration.

Domain-driven design approaches software development with a focus on engineering teams gaining a rich understanding of business rules and processes from domain experts. It involves engineers being involved early on in the discovery phase and working closely with the product teams and domain experts directly. The aim is to understand as much about the domain and the business as possible. This has many positive impacts.

- It provides context
- It aligns the engineering team with the business
- It reduces ambiguity and information lost in transit
- It helps to improve communication because a common language can be established
- It facilitates changes because everyone's on the same page
- It decreases complexity of inherently complex problems

Although there are technical patterns engineers can use when writing code, it’s important to remember that domain-driven design is not just about code. It is not purely a technical concern. It is a wider concept that can be utilised by other team members including product teams and key project stakeholders. It requires engineering teams to seek understanding of the problem space before trying to solve the problem, and modelling the domain using that understanding. It involves establishing a common ubiquitous language that improves communication and helps to create software solutions that are clearly aligned to business processes.

If we align the software we build to the business we can write better, more easily maintainable and testable software. We can also communicate more effectively, thus enabling us to tackle software complexities when solving complex problems.

For more information, check out my ebook ["Discovering Domain-Driven Design"](https://www.mbrookson.uk/products/discovering-ddd?utm_source=dev.to) for a distilled overview of domain-driven design and how you can use it to build better software.
AWS Marketplace Disbursement Explained | AWS Marketplace Reporting
Tags: aws, awsmarketplace, disbursement, awsdatawarehouse
Published: 2023-07-10 14:23:03

**Disbursement is?**

In the context of AWS Marketplace, disbursement refers to the process of transferring funds from a customer's account to a seller's account for the purchases made through the marketplace.

When a customer makes a purchase on AWS Marketplace, the payment is collected by AWS on behalf of the seller. AWS then deducts its fees and taxes (if applicable) from the total amount and initiates the disbursement process. The remaining amount, known as the net disbursement, is transferred to the seller's account.

The specific date when disbursement is initiated depends on the disbursement schedule chosen by the seller. 

**AWS Marketplace offers two disbursement schedules:** 
Monthly and
Daily.

**1. Monthly Disbursement Schedule:**

If the seller has selected the monthly disbursement schedule, disbursements are initiated around the 15th day of the month following the month in which the purchase was made. For example, if a customer made a purchase in May, the disbursement for that purchase would be initiated around the 15th of June.

**2. Daily Disbursement Schedule:**

If the seller has chosen the daily disbursement schedule, disbursements are initiated on a daily basis for transactions that occurred at least 14 days prior. This means that there is a 14-day delay between the purchase date and the initiation of disbursement.

Regarding the seller report for the previous month, it is typically made available shortly after the disbursement has been initiated. 
AWS provides a detailed seller report that includes information about the transactions, fees, taxes, and other relevant data for the previous month's sales. 

**Real Life Example:**

Disbursements are initiated around the 15th of the following month. For example, if a customer named ABC made a purchase in May, the disbursement for that purchase would be initiated around June 15th.

**_Regarding seller reports_**, they are available a few days after disbursement. For instance, if disbursement for May purchases is initiated on June 15th, the seller report for May would be available shortly after that (3-5 days after a disbursement has been initiated to transfer funds to your bank).

If you have any problem with disbursement, you can always request a disbursement over the email disbursement-appeals@amazon.com

It's good remember that the disbursement process and timing may be subject to changes or updates by AWS. It's always a good idea to refer to the AWS Marketplace documentation:

https://docs.aws.amazon.com/marketplace/latest/userguide/monthly-disbursement-report.html
https://docs.aws.amazon.com/marketplace/latest/userguide/monthly-billed-revenue-report.html
https://docs.aws.amazon.com/marketplace/latest/userguide/monthly-disbursement-report.html

Thanks for reading :)
Approve AWS CodePipeline Deployments from MS Teams
Tags: aws, devops, cicd, terraform
Published: 2023-07-10 14:15:34

With increasing number of pipelines running in multiple accounts for different applications it becomes difficult to manage all deployment approvals. The solution provided here enables you to approve CodePipeline stages in a centralized way using Microsoft Teams.

**Architecture**

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

The solution involves several components working together. Firstly, Notification Lambda function is used to send an approval request to an MS Teams channel via message card. This function is triggered by SNS topic configured in a AWS CodePipeline stage that requires manual approval. The Notification Lambda function uses the Microsoft Teams webhook connector to send a message card to the MS Teams channel, which includes a button that the approver can click to approve or reject the pipeline stage. When the approver clicks the approval button, the MS Teams channel sends a POST request to an API Gateway endpoint, which triggers another Lambda function. This second function Approval Lambda uses the AWS CodePipeline API to update the status of the pipeline stage based on the approver's response.

**Implementation**
The whole solution can be found in [my git repository](https://github.com/nbekenov/pipeline-approval-from-ms-teams)

For [IaC](https://github.com/nbekenov/pipeline-approval-from-ms-teams/tree/main/infra/terraform) I used Terraform but you can choose any other method you prefer. The most important part I believe is the code of Lambda functions. I wrote them using Python. 

More about MS Teams message cards [here](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using?tabs=cURL)

**Notes**
- It's possible to enhance security by adding Lambda Authorizer for Api Gateway to ensure that requests are coming only from MS Teams.
- Use a dedicated MS Teams channel for approval request to ensure that they are easily visible and distinguishable from other messages.
- Make sure that people who allowed to trigger pipeline approval are added into channel and granted admin access
Use descriptive and informative message card format that includes relevant information such as the pipeline name, stage name and etc.
- Use appropriate error handling and logging in your Lambda functions to detect and handle errors and exceptions
- Use monitoring and alerting to track usage and performance of your Lambda functions and other resources, and to alert you about potential issues or anomalies.
- The same approach/solution can be done with Slack channels. The only difference will be in the part of sending requests to and from Slack.
Panasonic Aquarea Smart Cloud without WPS
Tags: panasonic, heatpump, iot, configuration
Published: 2023-07-10 14:12:38

# Panasonic Aquarea Heat-Pumps

Panasonic produces one of the best heat pumps on the market. On top of built-in configuration panel, it is possible to upgrade it to smart device and control via Internet with additional Panasonic's adapter: [Panasonic CZ-TAW1](https://www.google.com/search?q=panasonic+cz-taw1&tbm=shop)

## Smart Cloud Adapter CZ-TAW1

Panasonic heat-pump can be controlled remotely via their own Comfort Cloud. That gives you the same possibilities as from built-in control panel.

Addition is easy to configure and can be connected via Ethernet wire or via Wi-Fi.

One downside is wireless connection can be established via WPS, which [isn't safe to have it available in your network](https://blog.pulsarsecurity.com/what-is-wps-why-is-it-dangerous).

You can have somewhere stashed a cheap WPS-enabled router to set it up your heat-pump, but there is another way to do that.

CZ-TAW1 is equipped with USB port, which initially I thought is for service only. It can be used for setting up your wireless connection. It is possible to create configuration for USB stick, when you're registering an adapter, but then that option on Panasonic cloud is not available any more.

I did some searching and found on [Ubiquity forum a post](https://community.ui.com/questions/WPS-alternatives-just-for-the-sake-of-documentation/8c000b47-6813-4ce0-bc82-e1e4daea061e) how to create that configuration manually.

* you need a USB stick formatted with **FAT** partition (I have checked 64 GB stick and was read by adapter)
* create **settings.txt** file with Windows (CRLF) new line codes
* enter there 2 properties: `SSID` and `KEY` with plain text values
* place `settings.txt` file in root folder on USB

```settings.txt
SSID=homewifi
KEY=12345678
```

The author of that post mentioned that adapter may have issues with complex passwords, with characters other than ones from ranges: a-z, A-Z, 0-9.
Go's list of keywords is surprisingly short
Tags: go, coding
Published: 2023-07-10 14:10:48

Every language has a list of reserved keywords you aren't allowed to use, but Go's list is surprisingly short leaving it open to do all kinds of funky things. 

Below is a list of all the reserved keywords in Go (as of writing this post):

- break
- case
- chan 
- const
- continue
- default
- defer
- else
- fallthrough
- for 
- func
- go 
- goto 
- if
- import
- interface
- map
- package
- range
- return 
- select
- struct
- switch
- type
- var

( [Source](https://go.dev/ref/spec#Keywords) )

## An Experiment
The keen eyed among you might have noticed that there are two missing values on that list that one might expect to be there.

Notice the words `true` and `false` aren't listed as reserved keywords in Go. Does this mean we can reassign the meaning of `true` and `false`?

Lets perform a small experiment to find out:
```
package main

import "fmt"

func main() {
  false := true
  fmt.Printf("In Boolean Logic, is a false statement actually true? %v", false == true)
}

```

Running this short experiment produces the output:
```
In Boolean Logic, is a false statement actually true? true
```

## There You Have It
As you can see by our short experiment above, `true` and `false` not being reserved by the Go language lets you turn boolean logic upside down. Stop means go. No means Yes. Up means down. Its a quiet a powerful trick to have and I would definitely **NOT** recommend using this in any _real_ code. 

What other words did you notice weren't reserved? Can you think of any other universe altering techniques you could get away with? 

Let me know in the comments (: