teleren/devto huggingface dataset:
What is AWS Detective?
Tags: aws, security, threat, investigation
Published: 2022-05-10 18:50:08

 Migrating your workloads to the Cloud can be daunting,it is important  that as you move them you make sure your data is secure .
Aws Detective is a resource you can use  to conveniently do that;It informs you about any threat dredging down to the root cause .
Detective quickly analyses,investigates, and identifies the security issues or threats.

There is a connection and partnership between AWS Detective and Guard Duty they also  work hand in hand.Detective has to be enabled before it is deployed and AWS Guard Duty too has to be enabled for at least 48 hours for the synergy to  kicks in.When it is enabled it can analyze different events from different data sources.



_**How AWS Detective Works**_ 


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

**Enable Amazon Detective**
You enable Amazon Detective in the AWS Management Console this quickly analyzes and investigates potential security issues.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2xmgn0maz1wajihld1ov.PNG)
After Detective is enabled it organizes the data.

**Automatically Organises data**

- Detective organises the data using [Cloud Trail Logs](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-log-file-examples.html)

- Using [VPC Flow Logs](https://aws.amazon.com/blogs/aws/vpc-flow-logs-log-and-view-network-traffic-flows/)

- Activating [Amazon Guard Duty discovery](https://aws.amazon.com/guardduty/) as well

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nwppnqa726pjw7frxgvu.PNG)
Detective uses a graph analysis that create a relationship between users and resources along with an interaction with a timeline.
It isolates,aggregates and organizes data with the graph.
The graph continuously updates as new data is made available.

- **Investigates a security finding**
Since AWS Detective work hand in hand with other AWS security services like Guard Duty and Security Hub,

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

clicking "investigate" on the AWS Management console bring up discoveries.

**Benefits and Features of AWS Detective**

1. Multiple data sources such as AWS VPC Flow Logs,Cloudtrail and Guard Duty investigations can be analysed at the snap of a finger by AWS Detective.

2. It can create a unified interactive view of resources

3. It can be visualized in an interactive manner as it shows the resource behaviour and interaction between them over time.

4.Without much effort while working in the  AWS Management Console you can add multiple AWS account in a group and review the findings.
Introducing ts-jackson, a typescript library to deserialize/serialize deeply nested json structures.
Tags: typescript, javascript, json, opensource
Published: 2022-05-10 18:40:10

[ts-jackson](https://www.npmjs.com/package/ts-jackson) is a json seralization library aimed to effortlessly handle serialization/deserialization of deeply nested json structures.

For example:

```
const jsonData = {
  images: {
    items: [
      {
        height: 300,
        url:
          'https://i.scdn.co/image/ab67616d0000b27380368f0aa8f90c51674f9dd2',
        width: 300,
      },
      {
        height: 640,
        url:
          'https://i.scdn.co/image/ab67616d00001e0280368f0aa8f90c51674f9dd2',
        width: 640,
      },
    ],
  },
}

@Serializable()
class Playlist {
  @JsonProperty('images.items[1]')
  readonly backgroundImage: Image
}

const deserialized = deserialize(jsonData, Playlist)
// Playlist {
//   backgroundImage: Image {
//     height: 640,
//     width: 640,
//     url: 'https://i.scdn.co/image/ab67616d00001e0280368f0aa8f90c51674f9dd2'
//   }
// }
const serialized = serialize(deserialized)
// {
//   images: {
//     items: [undefined, {
//       height: 640,
//       width: 640,
//       url: 'https://i.scdn.co/image/ab67616d00001e0280368f0aa8f90c51674f9dd2',
//     }],
//   },
// }
```
It uses [Lodash](https://lodash.com/) `_.get/_.set` to resolve property paths and supports every pattern provided by Lodash.

You can check out the full api here:
https://github.com/Eljoy/ts-jackson

Every feedback is truly welcomed. :)
Interacting with a smart contract - .send or .call?
Tags: web3, solidity, dapp, blockchain
Published: 2022-05-10 18:39:35

I like learning things when building. So, tutorials, blog posts and then books are my go-to tools when picking up a new paradigm or tool. With the same mindset, after some tinkering with DApps, I realized an important detail that might be helpful to any beginner. 

When building your first web3 application by following up on tutorials, you may not notice the difference between `send` and `call` methods immediately.

Let me try to explain the difference below.

**Call**

Contract methods that do not modify the state of the contract and have no logic other than returning a value can be invoked with `call` methods. 

- they don't cost any gas or transaction fees - it is free to call them
- used for view and pure functions (read-only), so it's faster to execute
- no need to sign them with MetaMask or with another provider
- safer to use them because they don't forward gas and publish anything

_an example [call to contract](https://web3js.readthedocs.io/en/v1.2.11/web3-eth.html#getbalance)_

```
web3.eth.getBalance("0x407d73d8a49eeb85d32cf465507dd71d507100c1")
.then(console.log);
> "1000000000000"
```
 
**Send**

Contract methods that modify the state of the contract uses `send` method to add this modification to the blockchain.

- they cost gas and transaction fees - it is not free to invoke those functions
- it needs a `from` as the sender address
- it needs to be signed through MetaMask or with another provider
- it is published in the form of transaction and can publicly be seen on the blockchain

_an example [send to contract](https://web3js.readthedocs.io/en/v1.2.11/web3-eth.html#sendtransaction)_

```
web3.eth.sendTransaction({
    from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe',
    to: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe',
    value: '1000000000000000'
})
.on('transactionHash', function(hash){
    ...
})
.on('receipt', function(receipt){
    ...
})
.on('confirmation', function(confirmationNumber, receipt){ ... })
.on('error', console.error);
```

Notice, `getBalance` will return a **value** while `sendTransaction` method returns a **callback** which is expected to include a 32 bytes transaction hash. 

This is an important detail to keep in mind when designing our interactions with the contract and user.

Happy coding!
Tik Tik ToDo🌺 🍃
Tags: appwritehack
Published: 2022-05-10 18:38:13

### Overview of My Submission:

Hello.👋

Actually I am new to appwrite. So had to educate my self on how appwrite works and make sure that I have understood all the concepts.😎🚩

Was busy with my studies, so couldn't create a big application using appwrite. But I created a simple ToDo application with AppWrite and React Native.🙂

# To Run the Project

You guys also can run this web app on your machine too.❤️

Now run the following commands and you should be good to go 💪🏼

```
$ npm install
```

For iOS devices you'll need to link the relevant CocoaPods. 
From the /ios directory run:

```
pod install
```

To run on Android:
```
$ npx react-native run-android

```

To run on iOS:

```
$ npx react-native run-ios
```


### Submission Category: 

Wacky Wildcards


### Link to Code

{% embed https://github.com/kithminiii/TikTik-ToDo %}

```
Happy Coding! ☕​🌱​
```
Laravel action, filter hooks system like WordPress
Tags: laravel, wordpress, hooks, actionfilter
Published: 2022-05-10 18:24:44

## About

- An action interrupts the code flow to do something, and then returns back to the normal flow without modifying anything.

- A filter is used to modify something in a specific way so that the modification is then used by code later on.
Read more about filters and actions

Hooks are a way for one piece of code to interact/modify another piece of code at specific, pre-defined spots.

## Installation
`composer require millat/laravel-hooks`
DONE! Now you can use laravel-hooks

## Usage
Visit for details: [https://github.com/SneherAdor/laravel-hooks](https://github.com/SneherAdor/laravel-hooks)

## Actions
Wherever you want, you can create a new action in you Laravel application:

```
do_action('user_created', $user);
```
Here, user_created is the name of the action, which will use later when the action will be listening. And $user is the parameters, which will be found whenever you listen the action. These can be anything.

To listen to your actions, you attach listeners. These are best added to your AppServiceProvider boot() method.

For example if you wanted to hook in to the above hook, you could do:

```
add_action('user_created', function($user) {
    $user->sendWelcomeMail();
}, 20, 1);
```
The first argument must be the name of the action. The second would be a closures, callbacks and anonymous functions. The third specify the order in which the functions associated with a particular action are executed. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action. Default value: 10. And fourth, the number of arguments the function accepts. Default value: 1

## Filters
Filters always have to have data coming in and data going out to ensure the data is output in the browser

Basically, filters are functions that can be used in Laravel application to pass data through. They allows developers to modify the default behavior of a specific function.

Here’s an example:

Post.php is a model or class , where it builds a query to fetch all published posts

```
class Post extend Model
{
    public function getPublished()
    {
        return Post::where('published_at', '>', now());
    }
}
```
Using filter we can make a offer to modify this query:

```
class Post extend Model
{
    public function getPublished()
    {
        return apply_filters('posts_published', Post::where('published_at', '>', now());
    }
}
```
Now, in the entry point of application like any module or plugin’s you can modify this post published query.

In Module’s or Plugin’s service provider (preferably in the boot method) we’ll add a listener for the filter.

```
class ModuleServiceProvider extends ServiceProvider
{
    public function boot()
    {
        add_filter('posts_published', function($query) {
            return $query->where('status', 'active');
        });
    }
}
```

[https://github.com/SneherAdor/laravel-hooks](https://github.com/SneherAdor/laravel-hooks)
JavaScript Array and String common methods.
Tags: javascript, array, string, methods
Published: 2022-05-10 18:23:45

JavaScript is an awesome language with a lot of built-in objects (Array, Date, Math, and String) and their build-in methods (split, sort, parseInt) which make a developer's life easier.

`Array -> Index-Value pair`
`String -> Also can work as Index-Value(character) pair`

Let's see in details -
```
const jsString = 'abc'
```
can be considered equivalent (for one dimension array only) to -
```
const jsArray = ['a', 'b', 'c']
```
Example:
```
jsString.indexOf('a') // 0
jsArray.indexOf('a')  // 0 or,

jsString[0] // a
jsArray[0]  // a

jsString == jsArray // false - because array pass reference
'a,b,c' == ['a', 'b', 'c'] // true (loose check)
```


**Common Methods:**
There are some useful methods those work on arrays as well as in strings in javascript. So, if you learn them, can easily apply for both. Those are -

> .slice()
> .indexOf()
> .lastIndexOf()
> .concat()
> .includes()
> .length
> .toString()
> .valueOf()
> [...strOrArray]


Like -
![JavaScript array slice and string slice](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o7zssw80qpn9vo2sphml.png)

**Remember**: A String always carries its value whereas an array always carries reference. That's why there are some methods(not all) of the array that changes the actual value of the variable. But for string, there are no methods that can change its actual value.

---

**Array Methods:**
Here listed some methods for array that modifies the original array value directly. These methods never can be applied for string -
> .splice()
> .push()
> .pop()
> .shift()
> .unshift()
> .reverse()
> .fill()

These array methods don't modify the array but used only for array -
> .map()
> .filter
> .reduce()

---

**String Methods:**
Only for string-
> .substr() // similar to splice
> .substring() // similar to slice
> .charAt()
> .match()
> .trim()

---

If you want to use string methods for an array, you can convert that array to a string and vice versa you can use array methods for string by converting that string to an array. You can easily convert each other -

![Split and Join](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4zpj9svqucb1gbghsg9j.png)

THANKS!
C-style for loop in Common Lisp's Loop macro
Tags: commonlisp, loop, c
Published: 2022-05-10 18:20:22

---
title: C-style for loop in Common Lisp's Loop macro
published: true
description: 
tags: commonlisp,loop,c
//cover_image: https://direct_url_to_image.jpg
---

I try to convert C-style for-loop in JS to Common Lisp's loop macro for a learning purpose.

```JavaScript
for (i=0; i<10; i++) {
  console.log(i)
}
```

Above JS code can be converted to:

```Lisp
(loop with i = 0
      unless (< i 10) return nil
      do (print i)
      do (incf i))
```

And, of course, the version below is more appropriate. 

```Lisp
(loop for i from 0 below 10 do
    (print i))
```

The first version looks more flexible in applying to another problem than the last one.
I created the first interplanetary exchange platform.
Tags: space, vue, javascript, blockchain
Published: 2022-05-10 18:00:54

Good morning !
Yes very ambitious as a title, but that's all.

**Let's start with the beginning :**

Some time ago, I thought about an optimized commentary for a few points of a **rocket launch specification.**

After a few weeks of research, I found a working topic regarding payloads in the rocket fairing head.

The difficulty today for space agencies and private launchers is **optimizing this space and managing to fit useful volumes into a cylinder several meters high.**

_Short._

I worked on an optimization topic, pitched my concept to someone in the business, and presented a useful space optimization algorithm. **I was then invited to my first astronaut conference.**

Then an idea came to me.

## The first interplanetary e-commerce platform based on the Stellar Lumens (XLM) blockchain

My ambitions were to **facilitate exchanges between the various space service providers**. 

To do this, I imagined a platform, operating on the principle of the blockchain. 

Who can any operator on Earth or from a space station or another planet to be able to order products from a partner. 

It could take advantage of the spaces made available by private space companies that sell the payload space in their rocket fairing head.

_A problem quickly arises, what do I do when the connection does not exist?_

I imagined an application installed on the client (computer, micro computer, smartphone etc...), which is practically autonomous, and which signs the transactions directly via the client. 

Once the synchronization has been carried out again, the signature is authenticated by the rest of the nodes of this chain and therefore is validated or not (in the event of cheating) by the blockchain.

This system allows all operators to be sure that the order has been made by the right customer. Fraud is only possible if your secret key is stolen.

I decided to make this work Open Source under **MIT license.**

You can find details of my work here:
https://github.com/Simerca/itpmarket

And the demo:
https://itp-platform.netlify.app/

Glad to read you about this crazy idea <3
Day 10 - How is abstraction achieved in java?
Tags: java, beginners, programming
Published: 2022-05-10 18:06:04

---
title: Day 10 - How is abstraction achieved in java?
published: true
date: 2022-05-10 17:59:40 UTC
tags: java, beginners, programming
canonical_url: https://blog.sanjaybabu.dev/day-10-abstraction-java
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vseltebuucw5l0opnyae.jpg
series: 100 days of interview questions
---

Abstraction allows us to hide our implementation. It is one of the key properties of Object-Oriented Programming (OOP). In java, it is implemented using _abstract class_ & _Interface_.

## Abstract class

We can simply create an abstract class by including the `abstract` keyword in front of it. An abstract class cannot be instantiated. So no objects of an abstract class or constructors are allowed.

```java

abstract class Animal {
    int type;
    abstract void move();
}

```

## Interface

The interface is a blueprint of a class that is used to specify its behavior. Again an interface cannot be instantiated. It can have only abstract functions. It cannot have any function body. So we don't need to specify the `abstract` keyword.

```java

interface Shape{
    String color;
    void draw();
}

```

## When to use Abstract Class?

If we have a use case where "A is a B" consider using an abstract class. 

Eg- _Lion_ is an _Animal_ , _Neem_ is a _Tree_

## When to use interface?

If we have a use case where "A can do some activity of B" consider using an abstract class. 

Eg- _Scream_ can give the sound of an _Animal_ , _Blossom_ can give a flower of a _Tree_
love calculator
Tags: appwritehack, webdev
Published: 2022-05-10 17:33:45




### Overview of My Submission
love calculator is type of calculator which shows about the actual love score of couples.It allows the user to have a scorecard of their love.

### Submission Category:
Wacky Wildcards



### Additional Resources / Info
github link: [lavesh123.github.io/love-calc/]()
Why new programmers should be using Vim
Published: 2022-05-10 17:30:40

At the beginning of my coding journey like most others one of my first steps was to download VSCode onto my computer. 

It wasn't until a few months into learning how to code that I learned of a program that was already on my computer that completely changes the way you interact with a text editor. 

That text editor is Vim and after seeing some of the benefits it could give to power users. I decided to give it a shot. 

After the initial cobwebs wore off I found that after just a few days there were some tasks I was already faster at doing compared to in VSCode which although new was a UI I had been interacting with almost my whole life. The ability to jump to any point on the page with just a few key strokes felt like I was was Neo in The Matrix. 

There are seven basic modes in vim but when first starting out I'd advice for you to just focus on these three

* *command mode* (moving with the keyboard)
* *insert mode* (typing in the text editor)
* *visual mode* (used to selected characters ex. copy, paste, etc.

... and here are some key-binds to get you going  

* switch between command mode and insert mode with **i**
* switch between insert mode and command mode with **Esc**
* **navigate up** in command mode with **k**
* **navigate down** in command mode with **j**
* **navigate left** in command mode with **h**
* **navigate right** in command mode with **l**
* **save** with **:w** followed by **enter**
* to **quit** without saving **:q!** or **ZQ**
* **undo** with **u** 
* **redo** with **Ctrl+r**
* to **save AND quit** **:wq**

In conclusion if you've been thinking of giving vim a try or this is your first time hearing about it just learning the basics can be beneficial and who knows you might just find that you prefer it!
Todo manager App with Appwrite backend
Tags: appwritehack, react, materialui, webdev
Published: 2022-05-10 17:23:34

[Instructions]: # (To submit to the Appwrite Hackathon on DEV, please fill out all sections.)


### Overview of My Submission
Todomanager is a simple todo application backend by Appwrite. It uses following technologies:

- ReactJS for Frontend
- MaterialUI for Styles
- Appwrite for Backend

[Note]: # (Share what you built, how you built it, and the inspiration behind the idea! Please make sure the project links to the appropriate GitHub repository, and includes the [Apache-2 permissive license](https://www.apache.org/licenses/LICENSE-2.0)  and README.)


### Submission Category: 
Wacky Wildcards

[Note]: # (Web2 Wizards, Web3 Wunderkinds, Mobile Moguls, Wacky Wildcards)


### Link to Code
{% embed https://github.com/thepkpawankumar/todo-manager %}

[Note]: # (Our markdown editor supports pretty embeds. Try this syntax: `{% embed link_to_your_repo %}` to share a GitHub repository)


### Additional Resources / Info

In this app development environment is used, I have not created any production environment. I created this app using docker on my local machine. I am attaching screenshots of used database collection and other screens of the application.
It uses

- Appwrite Authentication
- Appwrite Database

services of Appwrite.

This application has following endpoints:

- /: Home page
- /signin: Signin/Login page
- /signup: Signup/Register page
- /todos: Todolist page

Screenshots:

![Docker instance of Appwrite Application](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4prxdd1g55qsxryhejcg.png)
![Backend users in appwrite](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/16vwepgkt3u84uuw5sg2.png)

![Todo collection](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kb91a5du7hyzukeo9b1f.png)

![Login screen](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gp8wi9gtju7ccvarjkzv.png)

![Landing/Home page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q44zo63lf90p9xn5issa.png)

![Todo's frontend screen](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uptt0fngdm4zb7mndey1.png)

![Todo app action buttons ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nf5ktiqlynvy98cnqjad.png)
It is my first Hackathon, and I had a lots of fun with it.

Appreciate your time to reading this article.

Thank You! Happy Coding :)
What's Your Victory Face?
Tags: beginners, productivity, motivation, devjournal
Published: 2022-05-10 17:16:46

Look at that face! There's no ambiguity about what he's experiencing in the moment: triumph. When you're able to resolve a programming issue after several hours, or finally get a feature working, **how do you celebrate**? Do you uppercut the air and look something like that? 😆

background:
I am no sports buff by any measure, but I have a secret crush for tennis. Hearing of this rising tennis star Carlos Alcaraz who defeated two world-class players had a contagious positive vibe to start my day.