teleren/devto huggingface dataset:
🤖 Building RAG chatbot with NeMo Guardrails !💡
Tags: ai, python, security, opensource
Published: 2024-03-25 13:32:19

> Discover how the power of NeMo Guardrails ensures safer and more controlled conversations chatbot !

## 🛠️ Tools Overview:

1. **[NeMo Guardrails](https://github.com/NVIDIA/NeMo-Guardrails)** 🛡️
2. **[LangChain](https://python.langchain.com/docs/get_started/introduction)** 🔗
3. **[Gradio](https://www.gradio.app/)** 🎛️
4. **[Chroma DB](https://docs.trychroma.com/)** 🗃️

## ⚔️ NeMo Guardrails

Checkout more on why [NeMo Guardrails](https://dev.to/ssk14/navigating-conversations-safely-the-role-of-guardrails-in-llm-applications-with-nemo-framework-3n4p-temp-slug-895857?preview=b26114e4fbb45e77f50becb49d056a1eeb242f65712ff7359c024851bb36e087839214369cc96efbd385e381f23724a2fbdb0626b9c60bd4433225ab) ?

Here are some key components a config folder should be containing:

- **Config**: Houses essential details such as models and high-level flow instructions.
- **Rails**: Define dialogue flows using colang, including welcoming messages.
- **Actions**: Specify actions for different dialogue scenarios, such as blocking certain words.

Explore more on configuring Nemo Guardrails [here](https://github.com/NVIDIA/NeMo-Guardrails/tree/develop/examples/configs).

---

## 🔗 LangChain with NeMo Guardrails

> LangChain gives developers a framework to construct LLM‑powered apps easily.

Integrate LangChain with Nemo Guardrails effortlessly:

```python
# Initialization
llm = ChatOpenAI(openai_api_key=openai_api_key, model_name="gpt-3.5-turbo-16k")

# Loading configs
config = RailsConfig.from_path("config")
app = LLMRails(config=config, llm=llm)

# Generate response
response = await app.generate_async(messages="Here's our message")
```

## 🛢 Vector Database with NeMo Guardrails

> NeMo Guardrails support knowledge base only in markdown format.

Is there any other way ? Yes, using vector database. 

Lets use Chroma DB to: 
1. **Create a Vector Database**: Ingest documents of any format to build a robust knowledge base.
2. **Perform Similarity Search**: Connect to Croma DB and retrieve relevant chunks for user messages.

Now you can generate response with message and relevant_chunks

```python
relevant_chunks = vector_search(message)
response = await app.generate_async(messages=[{"role": "context", "content": {"relevant_chunks": relevant_chunks}}, {"role": "user", "content": message}])
```
---

## 🚀 Demo

[AWS Guard Chatbot](ssk-14-aws-guard-bot.hf.space)

```
Note: It has only minimal guards added from NeMo for demo,
So its possible to prompt injection 
```

| Without Guardrails |
|------------|
| ![Without Guardrails](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ddowmgtxcips29bjrudv.png) |

| With Guardrails |
|------------|
| ![With Guardrails](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jt9gzo40uqrp507vu9av.png) |

---

## 💻 Explore the Source Code 
Curious to explore further? Head over to the [GitHub repository](https://github.com/SSK-14/chatbot-guardrails) for the complete source code!
The Ultimate SPOTO Certification Study Guide
Published: 2024-03-25 13:11:00

Consider your [spoto certification](https://spotocertification.com/) personal schedule and commitments to create a realistic study plan that you can stick to. Setting milestones and deadlines will help you stay focused and track your progress effectively. Utilize Reliable Study Materials: Invest in high-quality study materials that align with the exam objectives. SPOTO offers official study guides, practice tests, and online resources to aid your preparation. 

Additionally, leverage reputable online platforms, forums, and communities where you can interact with other candidates and gain valuable insights. Active Learning Techniques:[spotocertification](https://spotocertification.com/) Passive reading is not an effective study strategy. Instead, engage in active learning techniques such as summarizing key concepts, creating flashcards, and teaching the material to someone else. 

CLICK HERE FOR MORE INFO>>>>>>>>>>>>>>>  https://spotocertification.com/
Anupama written update
Tags: blockchain, webdev, beginners, programming
Published: 2024-03-25 13:15:13

Written updates for Indian Star Plus dramas provide a detailed summary and account of the latest
 episodes of popular television serials aired on Star Plus
one of India's leading entertainment channels. These updates are essential for viewers who may have missed
 an episode or wish to quickly catch up on the latest plot developments, twists, and turns in their favorite dramas.

[Anupama written update](https://www.dramawriitenupdates.online/)


![Uploading image](...)
Play together in Etch-a-Sketch
Published: 2024-03-25 13:12:57

This web development project, 
inspired by [**The Odin Project's Etch-A-Sketch**](https://www.theodinproject.com/paths/foundations/courses/foundations/lessons/etch-a-sketch-project) assignment, 

focuses on creating a dynamic grid of square divs 
using **JavaScript** for **DOM manipulation**. 

The project requirements include implementing a hover effect to change the appearance of squares as the mouse moves over them, and adding a clear button to reset the grid and prompt the user for a new grid size. 

The layout utilizes **Flexbox** and **CSS Grid** for element arrangement, with attention to centering elements and ensuring proper sizing of the grid container. 

**JavaScript functions** handle <u>grid creation</u>, <u>hover effects</u>, and <u>grid reset</u> functionality. 

Additional styling enhancements were made to improve the project's visual appeal.

**Key Features:**

1. Dynamic grid generation based on user input
2. Hover effect to change square appearance
3. The clear button to reset the grid
3. Responsive layout using Flexbox and CSS Grid
4. JavaScript functions for grid manipulation

**<u>Overall</u>**, the project provides a hands-on opportunity to practice DOM manipulation, event handling, and responsive web design techniques, making it an engaging learning experience for web development beginners.

I want to share with you my work:
[my Live Demo Code](https://tezv-etch-a-sketch.netlify.app)
[my GitHub Code](https://github.com/TEZv/TheOdinProjects/tree/main/Etch-a-Sketch)

Thanks for reading😊
"Day 49 of My Learning Journey: Setting Sail into Data Excellence! ⛵️ Today's Focus: Maths for Data Analysis ( Per & Comb - 4)
Tags: data, datascience, dataenginnering, analyst
Published: 2024-03-25 12:54:01

PERMUTATION AND COMBINATION - 4


Factorial notation :- 



0! = 1
N! = N(N-1)(N-2).....3.2.1 
1! = 1
2! = 2
3! = 6
4! = 24
5! = 120
6! = 720
7! = 5040
8! = 40320
9! = 362880
10! = 3628800




Exception   1 / (-2)! = 0


Q. In how many ways 4 boys can be arranged on 4 chairs ?
Sol. 
Total no of ways to arrange = 4! = 24

Explanation :- 
Boy 1 has 4 option
Boy 2 has 3 option
Boy 3 has 2 option
Boy 4 has 1 option


Conclusion 

There are n - different  objects and we have to arrange / permutation  them linearly than 
total no. of ways = n !





🙏 Thank you all for your time and support! 🙏
Don't forget to catch me daily at 6:30 Pm (Monday to Friday)for the latest updates on my programming journey! Let's continue to learn, grow, and inspire together! 💻✨
Реализация префиксного дерева(Trie) на Java
Published: 2024-03-25 12:53:37

```java
class Trie {
    TrieNode root;

    public Trie() {
        root = new TrieNode();
    }
    
    public void insert(String word) {
        TrieNode current = root;
        for (char c : word.toCharArray()) {
            if (!current.children.containsKey(c)) {
                current.children.put(c, new TrieNode());
            }
            current = current.children.get(c);
        }
        current.terminates = true;
    }
    
    public boolean search(String word) {
        TrieNode current = root;
        for (char c : word.toCharArray()) {
            if (!current.children.containsKey(c)) {
                return false;
            }
            current = current.children.get(c);
        }
        return current.terminates;
    }
    
    public boolean startsWith(String prefix) {
        TrieNode current = root;
        for (char c : prefix.toCharArray()) {
            if (!current.children.containsKey(c)) {
                return false;
            }
            current = current.children.get(c);
        }
        return true;
    }

    class TrieNode {
        Map<Character, TrieNode> children;
        boolean terminates;

        public TrieNode() {
            this.children = new HashMap<>();
        }
    }
}
```
Spring Boot 3 application on AWS Lambda - Part 1 Introduction to the series
Tags: aws, serverless, java, springboot
Published: 2024-03-25 12:52:35

## What we will explore and learn throughout the series?

Let me introduce to you my new series. "Spring Boot 3 application on AWS Lambda". 

In the course of the series, we'll use Java 21 runtime to demonstrate multiple ways how to run and optimize Spring Boot 3 (and at the time of writing the latest major Spring Boot version is 3.2) application on AWS Lambda. You can easily adopt the examples to the newer Spring Boot version when it will be released.

In the upcoming articles we'll explore the following ways to run Spring Boot 3 application on AWS Lambda using the following frameworks, technologies or concepts:

- AWS Serverless Java Container 
- AWS Lambda Web Adapter 
- Spring Cloud Function
- Custom Docker Image

For each of this we'll introduce the concept first, then how to develop, deploy and run our application using each approach and also how to optimize the application with Lambda SnapStart (including various priming techniques) if available (currently not available on the Docker Container images). We'll also explore [GraalVM Native Image ](https://www.graalvm.org/22.0/reference-manual/native-image/) using Spring Cloud Function deployed as the AWS Lambda Custom Runtime as the optimization technique. 

Of course, we'll measure and the cold and warm start times of the Lambda function using all mentioned approaches and compare all introduced solutions. 

Last but not least we'll explore whether Spring Boot 3 [native support](https://docs.spring.io/spring-framework/reference/integration/checkpoint-restore.html) of [CRaC](https://openjdk.org/projects/crac/) is also a valid approach. We'll also make a comparison of the all introduced frameworks and concepts.

You can already find code samples for the entire series in [AWSLambdaJavaWithSpringBoot repository](https://github.com/Vadym79/AWSLambdaJavaWithSpringBoot) of my GitHub account.

In the next part of the series we'll introduce AWS Serverless Java Container.
React Interview Questions
Tags: webdev, javascript, beginners, react
Published: 2024-03-25 12:45:12

**Question 1:** Why should you **not** copy the values of props into a component's state?

Answer: It will create two instances of the same state that can become out of sync.


**Question 2:** What is **not** a rule for React Hooks?

**Answer:** Hooks can be called in Class or Function components


**Question 3:** What is a common use case for ref?

**Answer**: To access the DOM node.


**Question 4:** How can you optimize performance for a function component that always renders the same way?

Answer: Wrap it in a React.memo higher order component


**Question 5:** A copy of the 'real' DOM that is kept in memory is called what?

**Answer:** Virtual DOM  


BONUS
**Question:** What is the children prop?

**Answer:** A property that lets you nest components in other components

Let me know if this helped ;)
OpenWeather API - 256 Characters
Tags: frontendchallenge, devchallenge, javascript, webdev
Published: 2024-03-25 12:42:53

_This is a submission for DEV Challenge v24.03.20, One Byte Explainer: Browser API or Feature._

## Explainer
open weather API is a weather forecast based API that is best and easy to implement, it gives the info about weather all over the world easily and quickly, with this we can create our own weather update application

## Additional Context
<!-- Please share any additional context you think the judges should take into consideration as it relates to your One Byte Explainer. -->
{% codepen https://codepen.io/safikumar00/pen/GReJQZz %}
https://codepen.io/safikumar00/pen/GReJQZz

This is my first project with API and I have choosen the weather application and integrated it with Open Weather Api as my choice, please check that out. 

<!-- Team Submissions: Please pick one member to publish the submission and credit teammates by listing their DEV usernames directly in the body of the post. -->

<!-- Don't forget to add a cover image to your post (if you want). -->


<!-- Thanks for participating! -->
Remix JS: Sending state on redirect without using parameters
Published: 2024-03-25 12:39:16

Working with Remix means working with web standards. Just as we use search params to send data to another URL, we can also use a **native browser feature**, `without exposing the information in the URL`.

We will use the following hooks:

- [useNavigate](https://reactrouter.com/en/main/hooks/use-navigate) - to redirect by sending the state
- [useLocation](https://reactrouter.com/en/main/hooks/use-location) - to receive the state

\* You can use the [Link](https://remix.run/docs/en/main/components/link) component too, instead of useNavigate.

---

## Problem to solve

I am implementing a `Save As` button, when it is clicked, I need to redirect to a new route with the new ID.

When opening the new cloned content, I want to show a message to the user.

---

## Redirecting with state

After processing the data on the server side with the [action function](https://remix.run/docs/en/main/route/action), we can validate the `actiondData` and create a redirect using the useNavigate hook.

Use [option.state](https://reactrouter.com/en/main/hooks/use-navigate#optionsstate) to send the state to the landing link.

```
const navigate = useNavigate();

...

navigate('your/path/here', {
  state: {
    message: 'successfully-copied',
  },
});
```

---

## Get the state in the landing page

Now, after being redirected to a new page, get the state using the [useLocation](https://reactrouter.com/en/main/hooks/use-location#locationstate) hook.

```
const location = useLocation();
const stateMessage = location?.state?.message;
```

See a real example using toast:

```
useEffect(() => {
  if (stateMessage) {
    toast.success(t(stateMessage), {
      id: stateMessage,
    });
  }
}, [stateMessage, creative]);
```

---

## Using the Link component instead of the useNavigate hook

You can also use the `Link` component to pass the state, instead of the useNavigate hook: 

https://remix.run/docs/en/main/components/link#state

---

## Under the hood

Under the hood we have the History interface of the History API, allowing manipulation of the browser session history. Simple, right?

History: state property: 
[https://developer.mozilla.org/en-US/docs/Web/API/History/state](https://developer.mozilla.org/en-US/docs/Web/API/History/state)


![Using Dev Tools console to update history api](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1zm6ieokdx5jy9dwrafu.png)



That's it, [Remix](https://remix.run/) is simple and it uses web standards to the fullest.

**And you?** Do you like working with states differently? Tell us in the comments!
How to Solve Amazon Captcha When Scraping
Tags: solver, amazoncaptchasolver
Published: 2024-03-25 12:34:20

Captchas serve as a security measure to differentiate between humans and automated bots, presenting challenges easy for humans but difficult for bots. Amazon implements Captcha to deter automated scraping, deploying two primary forms: FunCaptcha and Image-to-text. FunCaptcha, developed by Arkose Labs, employs interactive puzzles, while Image-to-text utilizes optical character recognition (OCR) to convert text within images into machine-readable text.

Capsolver, an enterprise-level solution specializing in Amazon CAPTCHA, stands out for its accuracy and speed. Here's a structured approach to solving Amazon's Captchas using Capsolver:

### Solving Amazon FunCaptcha

**Step 1: Create Task**

Initiate by creating a task through the `createTask` endpoint. This requires specifying the task type as `FunCaptchaTaskProxyLess`, along with the website URL and the public key of the domain utilizing FunCaptcha. Optionally, a special subdomain from which the JS captcha widget loads and additional parameters required by FunCaptcha implementation may be included.

**Task Object Example:**

```json
{
  "clientKey": "YOUR_API_KEY_HERE",
  "task": {
    "type": "FunCaptchaTaskProxyLess",
    "websiteURL": "https://google.com",
    "websitePublicKey": "E8A75615-1CBA-5DFF-8031-D16BCF234E10",
    "data": "{\"blob\": \"YOUR_BLOB_DATA_HERE\"}"
  }
}
```

Upon task submission, a task ID is received if successful.

**Step 2: Retrieve Result**

Utilize the `getTaskResult` method to fetch the result, with response times varying based on system load.

**Result Retrieval Example:**

```json
{
  "clientKey": "YOUR_API_KEY",
  "taskId": "TASK_ID_RECEIVED_UPON_SUBMISSION"
}
```

### Solving Amazon Image-to-Text Captcha

**Step 1: Create Task**

For image-to-text captcha, create a task through the `createTask` endpoint, specifying `ImageToTextTask` as the task type. This includes the base64 encoded content of the captcha image and optional parameters such as the webpage URL, module preference, desired accuracy score, and case sensitivity.

**Task Object Example:**

```json
{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "ImageToTextTask",
    "websiteURL": "https://example.com",
    "module": "queueit",
    "body": "BASE64_ENCODED_IMAGE_CONTENT"
  }
}
```

The solution, including the deciphered text, is directly returned upon task creation.

By effectively employing Capsolver for addressing Amazon's captcha challenges, businesses can enhance their data scraping efforts, ensuring seamless access to vital e-commerce data critical for market entry and sales growth.
JavaScript Interview Questions For Entry Level Developers
Tags: webdev, javascript, beginners, programming
Published: 2024-03-25 12:24:12

**Question 1:** How does a while loop start?
**Answer:** while (i <= 10; i++)  

**Question 2:** How do you insert a comment that has more than one line?
**Answer:** /* This comment has
more than one line */  

**Question 3:** How do you find the number with the highest value of a and c?
**Answer:** Math.max(a,c)

**Question 4:** What is the correct JavaScript syntax for opening a new window called "Tutors" 
**Answer:** Tutors = window.open("http://tutor.com")

**Question 5:** How can you detect the client's browser name
**Answer:** navigator.appName

Let me know if this helped ;)
GUI in GitHub Codespaces
Tags: githubcodespace, github, productivity
Published: 2024-03-25 12:21:13

# GitHub Codespaces with VNC Support

GitHub Codespaces offers developers an instant, cloud-based development environment with a plethora of tools and utilities, all accessible directly from your browser. While it's perfect for many development tasks such as command line tools, Docker, or NodeJS, certain tasks, like those involving OpenGL rendering or Java Swing necessitate a graphical interface, which Codespaces lacks. However, with the help of a tool called **Light-weight Desktop (desktop-lite)**, we can overcome this limitation.

## Setting Up VNC Support with Desktop-lite

To enable VNC support in Codespaces, follow these steps:

1. Navigate to the option “Configure dev container” from the Codespaces dropdown menu.


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

2. Replace the existing JSON configuration with the following:

```json
{
  "image": "mcr.microsoft.com/devcontainers/universal:2",
  "features": {
    "ghcr.io/devcontainers/features/desktop-lite:1": {}
  },
  "forwardPorts": [6080],
  "portsAttributes": {
    "6080": {
      "label": "desktop"
    }
  }
}

```

3. Commit the changes and open the Codespaces environment. If prompted to rebuild the container to apply the changes, proceed with the rebuild.

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

4. Click on the bottom icon labeled "Ports" and select the "Open in Browser" option.


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

5. Use the default password `vscode` to connect.


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

6. In the Settings, select the `Scaling Mode` to `Remote Resizing` for a better user experience.


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

7. You can now navigate to your project path as seen in VS Code by using the command
```bash
cd /workspaces/<repo_name>

```

Any changes made here will reflect in the VS Code environment seamlessly.
about us
Tags: law, portugal
Published: 2024-03-25 11:50:22

<p>Mouteira Guerreiro, Rosa Amaral &amp
Associados, SP R.L. (MGRA Advogados) is an independent law firm established in 2004, focused on the areas of law that are critical to business: <a href="https://mgra.pt/en/services/practices/corporate-mergers-aquisitions/">corporate and commercial</a>, <a href="https://mgra.pt/en/services/practices/tax/">tax</a>, <a href="https://mgra.pt/en/services/practices/finance-law-e-capital-markets/">finance</a>, <a href="https://mgra.pt/en/services/practices/administrative-e-european/">regulatory</a>, <a href="https://mgra.pt/en/services/industries/real-estate-and-construction-law-firm-portugal-mgra/">real estate</a>, <a href="https://mgra.pt/en/services/practices/employment-and-labour-portugal/">labour</a>, <a href="https://mgra.pt/en/services/practices/intellectual-property-and-it-law/">IP</a> and <a href="https://mgra.pt/en/services/practices/litigation-e-arbitration/">litigation</a>.</p>
<p>MGRA Advogados practice follows <a href="https://mgra.pt/en/mgra/recommendations/awards/">international standards of quality</a>. For that purpose, our qualified lawyers are organized in specialized <a href="https://mgra.pt/en/services/practices/">divisions</a> of the various areas of law, thus allowing experienced multi-expertise teams in major <a href="https://mgra.pt/en/services/industries">industries or projects</a>.</p>
<p>MGRA has its <a href="https://mgra.pt/en/contacts/">headquarters</a> conveniently located in the centre of in Lisbon.</p>
<p>We have also local representation in many Portuguese speaking countries via MGRA <a href="https://mgra.pt/en/services/global-legal-partnerships/">Global Legal Partnerships</a> and long-established cooperation agreements with sound law firms worldwide, namely through exclusive membership in <a href="https://iln.com/firms/mgra-associados/">International Lawyers Network</a>, in order to provide our Clients reliable legal representation in the world’s principal business centres.</p>