teleren/devto huggingface dataset:
Encrypt string in Js and decrypt in Laravel PHP
Tags: javascript, laravel, encryptin, decrypting
Published: 2023-03-15 14:25:59

#I am going to show you encrypting data in javascript with JSEncrypt library with use RSA keys and decrypting string in Laravel.It is also supported for UTF8 encoding.

>Add the this script url your project in html side
```
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jsencrypt/3.0.0/jsencrypt.min.js"></script>
```

  >Basic initialization in JS
     
```
      let publicKey= '-----BEGIN PUBLIC KEY----- **** -----END PUBLIC KEY-----';
      const encryptor = new JSEncrypt();
      encryptor.setPublicKey(publicKey);
      const plainText= "This is a encrypting string";
      const encrypted = encryptor.encrypt(plainText);
      #the encrypted string is ready to send your server
```

   >Basic initialization in Laravel   
```
      $encryptedData = $request->input('data');
      #save your private key in this path file also you can create path yourself
      $privateKeyFile= file_get_contents(storage_path('app/keys/private.pem'));

      $privateKey = openssl_pkey_get_private($privateKeyFile);
      $encrypted = base64_decode($encryptedData);
      openssl_private_decrypt($encrypted, $decrypted, $privateKey);
      return response()->json(['decrypted' => $decrypted]);
```
Fearing less and Loving more
Tags: wecoded, fearlesslovemore
Published: 2023-03-11 00:31:48

## I pledge to embrace equality and equity in tech...

by **fearing less and loving more**. I pledge to continue to strive creating a better world now and in the future, by approaching this task with empathy and awareness. As part of the human race, we are all unique individuals with different cultural(a.k.a cults) backgrounds and beliefs. However, we should strive to embrace our similarities and differences in a positive and respectful manner, even if we do not always agree with each other. As I like to say, **"we all bleed red, when cut."**

To create a better world for the future, we must start by making positive changes in the present. This can involve simple acts of kindness, volunteering in our communities, and **making conscious choices that benefit not only ourselves but also the environment and those around us**. By taking responsibility for our actions, we can lay the foundation for a better world for generations to come.

**How can one help to create a better world, now; so are future may be even better ?**

![Olu T Akinyemi, sitting on a stool, with a red light illuminating](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x64t1vh07ddd22oqih9b.jpg)
Learn Python using Minecraft
Tags: python, beginners, programming, opensource
Published: 2023-03-15 14:18:28

I'm working on a FOSS project to teach Python by interacting with Minecraft.

Please take a look and provide feedback.
https://github.com/gilesknap/mciwb

The project provides a library that allows you to build in a Minecraft world using Python but also call Python functions when events occur inside the world.

It also provides a tutorial for step by step setup and beginner's introduction to Python programming. 

The castle with working portcullis pictured below was built using this project.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7entdgv27isde08r3llz.png)
understanding difference between git merge and git rebase
Tags: webdev, beginners, programming, tutorial
Published: 2023-03-15 14:09:39

Git merge and git rebase are two ways to integrate changes from one branch into another. Here are the differences between the two:

Git Merge:

Merges changes from one branch into another
Creates a new commit that combines the changes from the source branch and the target branch
Preserves the history of both branches
Can result in a "merge commit" that shows the point at which the two branches were merged
Does not modify the original branch
Git Rebase:

Integrates changes from one branch into another by applying them as new commits on top of the target branch
Rewrites the history of the target branch
Results in a linear history with a clear timeline of commits
Does not create a merge commit
Can cause conflicts if multiple people are working on the same branch
In general, if you want to preserve the history of both branches and create a merge commit, use git merge. If you want a linear history with a clear timeline of commits, use git rebase. However, it's important to consider the potential conflicts that may arise with rebasing, especially if you're working in a team with multiple contributors.
Here are some examples to help illustrate the differences between git merge and git rebase.

Let's say we have two branches, feature and master, and we want to integrate changes from feature into master.

Git Merge example:
`git checkout master
git merge feature
`
This creates a new commit that combines the changes from feature and master. The resulting commit history would look something like this:

```
*   Merge branch 'feature' into 'master'
|\  
| * Commit D (feature)
| * Commit C (feature)
| * Commit B (feature)
|/  
* Commit A (master)

```
Note the new "merge commit" that shows the point at which the two branches were merged.

Git Rebase example:

```
git checkout feature
git rebase master
git checkout master
git merge feature

```
This applies the changes from feature as new commits on top of master. The resulting commit history would look something like this:

```
* Commit D' (feature)
* Commit C' (feature)
* Commit B' (feature)
* Commit A (master)

```
Note that there is no merge commit and the commit history is linear, with a clear timeline of commits. However, it's important to note that if there were conflicts during the rebase process, they would need to be resolved before merging feature into master.

I hope this helps clarify the differences between git merge and git rebase!
Demystifying Event-Driven Architecture: A Series on Design Patterns and Best Practices
Tags: eventdriven, tutorial, discuss, architecture
Published: 2023-03-15 14:00:00

Event-Driven Architecture (EDA) has gained significant popularity in recent years as organizations increasingly adopt microservices and distributed systems to build scalable, responsive, and resilient applications. At its core, EDA is a style of architecture that emphasizes the use of events to trigger and communicate changes between services, rather than relying on synchronous communication between components.

While EDA offers many benefits, such as improved scalability, flexibility, and decoupling of services, designing and implementing an event-driven system can be challenging. In this series of blog posts, we will explore some of the key concepts, design patterns, and best practices for building successful event-driven systems.

Over the next few weeks, we will cover several topics related to EDA, including the Broker Pattern, the Observer Pattern, the Saga Pattern, and the Command-Query Responsibility Segregation (CQRS) Pattern. We will also discuss best practices for designing and implementing event-driven systems, such as monitoring and logging, handling failures, and designing for resiliency.

Each blog post will provide a brief overview of the topic, explain how it fits into the broader context of EDA, without going into the implementation details as there are many resources available online written way better than I could possibly do. My goal is to demystify EDA and provide you with the tools and knowledge you need to understand scalable and event-driven systems.

Stay tuned for my first post on the Broker Pattern, where we will explore how it can help you decouple event publishers and subscribers and provide a flexible and reliable event distribution system.
Cracking Git Rebase
Tags: git, github, beginners
Published: 2023-03-15 13:59:17

git rebase is a Git command that allows you to modify the history of a branch by moving the branch to a new base commit. This can be useful in situations where you want to incorporate changes from one branch into another branch, or to clean up the history of a branch by removing unnecessary commits.

When you run git rebase, Git identifies the common ancestor commit between the current branch and the branch you want to rebase onto. It then replays all the changes made in the current branch after that common ancestor commit onto the new base commit. This results in a linear history, with all the changes from both branches combined in chronological order.

The basic syntax for git rebase is:
`
git checkout <branch-to-rebase>
git rebase <new-base-branch>
`
This will rebase the current branch onto the new-base-branch. During the rebase process, Git will pause and allow you to resolve any conflicts that arise between the changes in the two branches.

It's important to note that git rebase rewrites the history of a branch, so it should only be used on branches that have not yet been shared with others or pushed to a remote repository. If you rebase a branch that others have already based their work on, you will create conflicts and confusion for everyone involved.
A Quality Checklist for API Documentation
Tags: api, apidocumentationchecklist
Published: 2023-03-15 13:46:31

You know what an API is, particularly [what a REST API](https://document360.com/blog/what-is-rest-api/) looks like.

Here, we will be relating to REST APIs.

There are a variety of tools that help automate [API documentation](https://document360.com/blog/api-documentation/) such as Postman or Swagger. You still need to “flesh it out” the generated documentation to make it both useful and readable.

REST API documentation is typically split into two major sections:

**1. An introductory section that includes for example,**

- The purpose of the API
- Any prerequisites such as setup considerations (including API key requirements)
- The base URL to use
- Paging considerations for APIs with a large amount of output
- Result codes (the most common being 200 – success and 40x – errors of various types)

**2. The API itself.**

The API may be split into several major functionality groups each having their own endpoint and calls (GET, POST, PUT, PATCH, DELETE etc).

Each call typically requires two tables, one explaining the query parameters and a second for the results. The request parameters may be entered directly, or through an input JSON file. They are described in the first table. Very often the results come in a JSON file the fields of which are described in the second table.

Following the request/results section, add a return codes section. Always show the 200 and 400 return codes. If other possible return codes are standard, then a cross reference to the Common return codes will do. If you are using call specific return codes, add them here.

And finally, provide an example. Many modern API documentation pages have a vertical bar to the right that shows a sample of the API call in a choice of multiple formats (cURL, PHP, JavaScript etc). Other possibilities are a horizontal code bar below the API description or a link to an API sandbox. If for some reason, these features are not available, then at least, add a textbox with a hard coded example.

And there is room for flexibility: A call with a single simple parameter obviously does not need the first table. Similarly, the second table will not generally be required for POST and PUT calls.

## Take a look at some of these API documentation examples:

**Twitter API**

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

**Dropbox API**


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

**YouTube API**

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


## A deeper look into - [API documentation checklist](https://document360.com/blog/api-documentation-checklist/)
What is the venn-diagrammatic relation b/w container, venv and git_branches?
Published: 2023-03-15 13:33:04

The order of setting up these tools can vary depending on your specific project needs and workflow.

Typically, you would start by setting up Git branches to manage different versions of your codebase. Once you have set up your Git repository, you can create a Dockerfile to define the environment for your Python application, including any necessary dependencies, tools, and configurations. The Docker container can be used to provide a consistent and reproducible environment for running your Python application.

Next, you can create a Python virtual environment inside the Docker container to manage your Python dependencies. This can help ensure that your project dependencies are consistent and reproducible across different environments.

Once you have set up your Docker container and Python venv, you can start developing your code in a Git branch. You can activate the Python virtual environment and start installing any necessary project dependencies using pip. When you are ready to commit your changes, you can use Git to manage and version control your code.

Overall, the order of setting up Git branches, Docker containers, and Python venv can vary depending on your specific project needs and workflow. However, it's important to ensure that all three tools are integrated and working together to provide a consistent and reproducible development and deployment environment.
Maximising ReactJS Performance: Best Practices and Tips.
Tags: react, webdev, performance, frontend
Published: 2023-03-15 13:15:20

As a ReactJS developer, you know that performance is key to a great user experience. But even if your React app is fast, there are always ways to optimise it further. Here are five tips for optimising ReactJS performance:

1. **Use the shouldComponentUpdate lifecycle method**: The shouldComponentUpdate method allows you to determine if a component should update or not. By default, React will re-render a component every time its props or state change, but you can use shouldComponentUpdate to prevent unnecessary re-renders. This can greatly improve performance, especially for large or complex components.

2. **Implement code splitting**: Code splitting allows you to split your code into smaller chunks, which can then be loaded on demand. This can greatly improve load times, especially for larger apps. `React.lazy()` is a built-in method that allows you to implement code splitting easily.

3. **Use React.memo() for memoization**: Memoization is a technique that allows you to cache the results of a function call based on its inputs. `React.memo()` is a built-in method that uses memoization to optimise the rendering of functional components. Use it to prevent unnecessary re-renders of functional components.

4. **Optimise images and other assets**: Large images or other assets can slow down your React app. Use tools like [ImageOptim](https://www.npmjs.com/package/imageoptim) or [TinyPNG](https://www.npmjs.com/package/tinypng) to optimise your images before including them in your app. You can also use lazy loading to load images on demand.

5. **Use the React Developer Tools extension**: The React Developer Tools extension for Chrome and Firefox is a powerful tool that allows you to inspect and debug your React app. Use it to identify performance bottlenecks and other issues, and to optimise your app for maximum performance.

By following these tips, you can greatly improve the performance of your ReactJS app. Remember to always keep performance in mind as you build your app, and to test your app frequently to identify and fix any issues. 

Happy optimising!
Resolvendo problemas no HackerRank: Anúncios virais.
Tags: javascript, beginners, programming
Published: 2023-03-15 13:07:47

Olá, seja bem vindo a mais um Resolvendo problemas no HackerRank: no problema de hoje,ver uma sequência de publicidade que crescerá cada vez mais,atingindo novos públicos, mas é claro eles tem uma regra. Vejamos agora.


**Viral Advertising -**

A HackerLand Enterprise está adotando uma nova estratégia de publicidade viral. Quando eles lançam um novo produto, eles o anunciam exatamente para as pessoas nas redes sociais.

No primeiro dia, temos um alcance de 5 pessoas do qual a metade inteira gostou da publicidade(5/2= 2), essas pessoas que gostaram compartilharam para mais 3. A sequência se segue da seguinte maneira:

- n =5

Day Shared Liked Cumulative
1      5     2       2
2      6     3       5
3      9     4       9
4     12     6      15
5     18     9      24



Seguindo a  tabela acima, vejamos o código:

```
function viralAdvertising(n) {
    // Write your code here
    let resultAdd = 0;
    let shared = 5;
    
      for (let i = 0; i < n; i++){
    let liked = Math.floor(shared / 2);
          resultAdd += liked;
          shared = liked * 3;
      }
    return resultAdd;
}
```

Criamos duas variáveis, uma do resultado dos anúncios e outra de compartilhamentos. Depois criamos um laço for que irá iterar com um index `i`o parâmetro n que guarda o número de dias. Depois declaramos uma variável `liked`que irá ser a divisão de compartilhados por 2(pegando seu valor principal) . ResultAdd que representa o resultado dos anúncios se adicionará ao resultado de `liked`anterior. Por último pegamos o `shared`e o valor de `liked`e multiplicamos por 3, conseguindo o resultado final.


O resultado será:

```
3

9 // resultado
```
 
Com isso, concluímos mais um desafio do _Resolvendo problemas no HackerRank:_ . Até a próxima!!!
Stay Ahead of the Competition with Effective Price Monitoring
Tags: forum, competitorpricemonitoring, pricetracking
Published: 2023-03-15 13:07:12

**Are you struggling to keep up with your competitors' pricing strategies?** 

Do you find it challenging to determine the right price for your products or services? 

If so, you're not alone. Competitor price monitoring is crucial for any business that wants to stay competitive and profitable.

Effective price monitoring can provide you with valuable insights into your competitors' pricing strategies. By monitoring their prices, you can identify trends, understand the market, and adjust your own pricing strategies accordingly. You can also stay ahead of the competition by being the first to offer discounts or promotions.

There are several ways to monitor your competitors' prices, including manual monitoring, web scraping, and automated price monitoring tools. Each method has its advantages and disadvantages, so it's essential to choose the one that works best for your business.

Manual monitoring involves manually checking your competitors' prices on a regular basis. While this method is time-consuming and can be prone to errors, it can be effective for businesses with a small number of competitors.

Web scraping involves using software to extract data from your competitors' websites. This method is more efficient than manual monitoring, but it can be costly and technically challenging.

Automated price monitoring tools are the most effective and efficient way to monitor your competitors' prices. These tools can provide you with real-time data and insights, allowing you to make informed pricing decisions quickly.

In conclusion, competitor price monitoring is a critical component of any successful pricing strategy. By staying ahead of the competition, you can increase your profitability and ensure the long-term success of your business. Choose the right method for your business and start [monitoring your competitors' prices](https://www.webdataguru.com/competitor-price-monitoring-software/) today!
Make a macOS app icon from an image
Tags: macos, design
Published: 2023-03-15 13:06:31

macOS has everything you need to make an icon file for your application from the terminal.

macOS application icons are really a bundle ("iconset") of images at various sizes (16×16, 32×32, 64×64, ..., 1024×1024).

First create a `myicon.iconset` directory containing your icon image at all the sizes needed using the `sips` command line tool:

    sips -Z 16 myicon.png --out myicon/icon_16x16.png
    sips -Z 32 myicon.png --out myicon/icon_16x16@2x.png
    sips -Z 32 myicon.png --out myicon/icon_32x32.png
    sips -Z 64 myicon.png --out myicon/icon_32x32@2x.png
    ...

Then bundle them together with the `iconutil` command:

    iconutil -c icns myicon.iconset

Here is a Makefile to do this automatically. Just save the Makefile to a directory containing your icon image file; change the variables `NAME` and `ICON` at the top; type `make` in the Terminal, and you're done: https://gist.github.com/eliteraspberries/a536f28b0498ec844fb210bb597738e2
Template driven forms in Angular
Published: 2023-03-15 12:52:48


To use template driven approach to handle forms. We assign a name to the form using the NgForm directive. We then use a submit event handler, to listen to a submit event. Since our form button is of type submit, a submit event is triggered every time a user submits the form.

```
<form (submit)="onAddPost(postForm)" #postForm="ngForm">
    <input type="text" ngModel name="title" #title="ngModel">
    <textarea rows="4" ngModel name="content"  #content="ngModel"></textarea>
    <button type="submit"> Save Post </button> 
</form>
```

The NgForm creates an instance of the form and binds to the form in the template. To access the forms inputs we call the form instance and its value property. 

```
onAddPost(form: NgForm) {
    console.log(form, form.value, form.value.title, form.value.content);
}
```
AFFiNE is the next-generation collaborative knowledge base for professionals, open source, privacy first,
Tags: webdev, notion, affine, python
Published: 2023-03-15 12:50:07

AFFiNE is the next-generation collaborative knowledge base for professionals, open source, privacy first, 


https://www.youtube.com/watch?v=kq1ibp0DmR4


AFFiNE is the next-generation collaborative knowledge base for professionals, open source, privacy first, and the potential alternative to Notion/Miro/Monday.
This video introduces Downhills, the next version of AFFiNE with multi-collaboration support that still prioritises the local-first experience.

Table of  contents
Introduction - Chris
Introduction of AFFiNE - Enther (Founder of AFFiNE)
Product Architecture - Joe (Product Architect)

More useful links:
AFFiNE Website: https://affine.pro
https://twitter.com/AffineOfficial
Effective Communication
Tags: storybytes, effectivecommunication, compassion, communication
Published: 2023-03-15 12:43:22


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/paasf6zgonc762vi1ani.png)Building a solid bridge takes work. Effective communication is like a bridge, connecting confusion and clarity. We communicate with people every day, whether in person, written or on all digital platforms. But how much of our communication reaches the intended audience or person the way we hoped? Effective communication requires attention to detail. At Web and App Studio, we try to use the four W’s with vitamin C. Why, When, Who, What ending with Connect. The more clarity, the less misinterpretation. The less misunderstanding, the more the alignment. The more the alignment, the better the outcome. These are vital factors that drive effective Communication. The benefits of communication effectiveness can be witnessed in the workplace, in an educational setting, and in your personal life. Learning to communicate well can be a boon in these areas. Atop, while all AI and bots can help us improve our communication patterns and grammar, add your own vitamin C by “C”-onnecting. We, humans, connect for a reason. By expressing compassion, we ensure we communicate effectively and care for each other. And one of the best ways to get ready to share is to understand first the needs of all parties involved. This can also be called active listening. More about active listing in the coming weeks.