teleren/devto huggingface dataset:
How to receive json data response when call web API success?
Tags: programming, csharp, discuss, api
Published: 2023-05-27 14:56:32

I work on asp.net razor page Login user name and password . I call Web API validate user

name and password . my issue I face it I can't receive data returned after login success

JSON data returned from web API after success login username and password

`{
    "message": "success",
    "status": true,
    "data": {
        "userID": "9595",
        "userName": "ADC Test User",
        "userRole": "Administrator",
        "environment": "PY"
    },
    "statusCode": "0000"
}`
I call api from razor page login as below :

`public async Task OnPost()
{

           
            UserLoginViewModel loginview = new UserLoginViewModel();
            loginview.UserID = User.UserName;
            loginview.Password = User.vPassword;
            var json = JsonSerializer.Serialize(loginview);
            var content = new StringContent(json, Encoding.UTF8, "application/json");
            HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://localhost:44374/api/adcxx/ValidateUser");
            request.Content = content;
            var response = await _httpClient.SendAsync(request);
            if (response.IsSuccessStatusCode)
            {
          

             
            }
}`
I need to return data from login success where message=success as logic below :

```
 if (response.IsSuccessStatusCode)
            {
IF(message=="success" AND status="true")
{
receive `user id and username and user role and password`
}
}
```
image below explain what i need to do exactly

image show data I need to receive

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6e3kf6uvvdsngxquteya.png)
Vue component's props quirks while working with TypeScript
Tags: vue, typescript, webdev, javascript
Published: 2023-05-27 14:23:46

Vue and TypeScript, such a complicated relationship! 🤯

A common pitfall comes while defining component's props, which are defined through a structure that provide a sort of "lightweight" type checking for props validation.

This can generate some misunderstandings, it doesn't actually work as type checker, since those type checks and validators are runtime guards, this explains why the type property supports just the native objects ([Runtime Type Checks](https://vuejs.org/guide/components/props.html#runtime-type-checks)).

## Let's add TypeScript 

What I said above it doesn't change if you add TypeScript on the equation, those runtime validators still exists and required. So, maybe you might expect to write something like:

```
<script setup>
type MyCustomType = 'Hello' | 'World'
const props = defineProps({
  myProps: {
    type: MyCustomType
  }
})
// ...
</script>
```
The code above will results in:

![TypeScript error](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/26grtiowusa6ngenhiwy.png)

This happens because you're trying to mix runtime validations with static type checking.

## Solution 1

You can fully rely on TypeScript checking:
```
type MyCustomType = 'Hello' | 'World'
const props = defineProps<{
    test: MyCustomType
}>()
// ...
</script>
```
In this way you have solved the error, but you won't be able to provide custom validators.

## Solution 2

Rely on type assertions:
```
type MyCustomType = 'Hello' | 'World'
const props = defineProps({
  myProps: {
    type: String as PropType<MyCustomType>
    validator: (value: MyCustomType) => {
       // your custom validation
    },
  }
})
// ...
</script>
```

## Conclusion

As shown above, Vue might seem a little bit tricky while working alongside TypeScript, though it has taken steps onward, and still does.
Unveiling the Power of ChatGPT: Technology and Algorithms behind Intelligent Conversational AI in Streaming
Tags: chatgpt, ai, streaming, beginners
Published: 2023-05-27 13:54:48

ChatGPT has revolutionized the realm of [streaming](https://streamingpie.com/) by enabling intelligent conversational AI experiences. Powered by advanced algorithms and the cutting-edge Transformer architecture, ChatGPT enhances user interactions, making streaming platforms more engaging and personalized.

## Transformer Architecture:

The Transformer architecture forms the foundation of ChatGPT's capabilities in understanding and generating text. This empowers ChatGPT to comprehend and respond contextually, leveraging the entire conversation history. In the streaming context, ChatGPT can provide tailored recommendations, answer user queries, and engage in meaningful conversations about preferred shows, movies, or music genres.

## Personalized Streaming Recommendations:

ChatGPT leverages its pre-training on vast amounts of internet text to deliver personalized streaming recommendations. By understanding user preferences, viewing history, and conversational cues, ChatGPT can suggest relevant content that aligns with individual tastes. It adds a human-like touch to the recommendation process, enhancing the streaming experience with tailored suggestions.

## Dynamic Content Exploration:

Through interactive conversations, ChatGPT enables dynamic content exploration on streaming platforms. Users can engage in natural language conversations to discover new shows, explore genres, or get recommendations based on specific moods or themes. ChatGPT's contextual understanding allows for intuitive and interactive content discovery, enriching the streaming journey.

## Real-time Interaction and Support:

ChatGPT serves as a virtual assistant for streaming platforms, offering real-time interaction and support. Users can ask questions, seek information about actors, plot details, or trivia, and ChatGPT provides prompt and accurate responses. This creates a seamless and immersive streaming experience, enhancing user engagement and satisfaction.

## Continuous Learning and Improvement:

OpenAI's reinforcement learning from human feedback plays a crucial role in refining ChatGPT's streaming capabilities. Feedback from users and human AI trainers helps improve the accuracy, relevance, and appropriateness of ChatGPT's responses. As a result, ChatGPT evolves over time, becoming increasingly knowledgeable and adept at addressing user queries and providing valuable insights about streaming content.

## Conclusion
ChatGPT, powered by advanced algorithms and the transformative Transformer architecture, elevates streaming experiences by delivering intelligent conversational AI. Through personalized recommendations, dynamic content exploration, real-time interaction, and continuous learning, ChatGPT enhances engagement and satisfaction on streaming platforms. As the streaming landscape evolves, ChatGPT represents an exciting advancement in conversational AI, providing users with interactive and personalized streaming experiences that redefine the way we engage with digital content.
What is Change Detection in Angular?
Tags: angular, javascript, typescript, webdev
Published: 2023-05-27 13:28:54

Change detection is **detecting changes in any component ** of your app and re-render view, so it displays updated value to end users.

Different events on which change occurs:

- Data received from network requests or component events.
- Mouse clicks,scrolling,mouseover,keyboard navigation

- AJAX Calls

- Use of timer function such as setTimeout() or setInterval().

## How does Change detection work??

- Whenever something triggers a change.

- To detect and update DOM with changed data,the framework provides its own change detection detector for each component.

- The change detector make sure data model and DOM are in sync.

- When Angular change detection detects the triggered change and run change detection to all component tree from top to bottom.

## Angular Change Detection strategies

There are two strategies basically in angular:-

- Default Change Detection Strategy

- OnPush Change Detection Strategy

## Default Change Detection Strategy

If **Angular Change Detector** is set to default then for any change in any model property, Angular will run change detection traversing component tree to update DOM.


**Change Detector Ref** class provides few built in methods , we can use to manipulate change detection tree.


- **markForCheck()** - marks that it changed.

- **detach()** - exclude view from change detection tree

- **detect Changes()** - check view and its child component

- **checkNoChanges()** -check view and it's child ,throw error if changes detected.

- **reattach()** - reattach a view that was previously detached


## Angular OnPush Change Detection Strategy

If angular change detector is set to **onPush** then Angular will run change detector only when new reference is being passed to component.

If observable is passed to onPush, then changeDetector must be called manually to update DOM

**Benefits**

Unnecessary check in child not performed if parent element updating values which are not passed @Input


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

Here we have changed strategy to OnPush

_Hope it help you guys :)_

_Please like share and subscribe if you like it_
Request and Response Interceptors in JS
Tags: javascript, webdev, beginners, programming
Published: 2023-05-27 13:27:12

Interceptors work as a wall between client and server.

Whenever a request is sent from client to server we can do all kind of processing like changing header,or any operation that can be done in interceptor.

After that interceptor will carry forward the request to the server

Similarly in response interceptor we can check whether the server is sending right response,will check status code if user is authorized or not and then we can do different type of actions as per our requirement and return back those response to client
strings in Python
Published: 2023-05-27 13:22:04

In Python, strings are a fundamental data type used to represent and manipulate text data. They are sequences of characters enclosed within single quotes (' '), double quotes (" "), or triple quotes (""" """).

Creating a String:
To create a string, simply assign a sequence of characters to a variable. For example:

```
message = "Hello, World!"
```
In this case, the variable message holds the string "Hello, World!".

## String Manipulation:
Python provides a wide range of built-in functions and methods to manipulate strings. Here are some commonly used operations:

## 
Accessing Characters:
You can access individual characters within a string using indexing. Python uses 0-based indexing, where the first character is at index 0. For example:

```
message = "Hello, World!"
print(message[0])  # Output: 'H'
```

## String Length:
To determine the length of a string, you can use the len() function:

```
message = "Hello, World!"
print(len(message))  # Output: 13
```

## String Concatenation:
To combine or concatenate strings, you can use the + operator:

```
greeting = "Hello"
name = "Alice"
message = greeting + ", " + name
print(message)  # Output: "Hello, Alice"
```

##  String Slicing:
You can extract a portion of a string using slicing. Slicing allows you to specify a range of indices to extract a substring. For example:
   

```
message = "Hello, World!"
print(message[7:12])  # Output: "World"
```

## String Methods:
Python provides several useful string methods for various operations. Some common methods include:
lower(): Converts a string to lowercase.
upper(): Converts a string to uppercase.
strip(): Removes leading and trailing whitespace from a string.
replace(): Replaces occurrences of a substring with another substring.
split(): Splits a string into a list of substrings based on a delimiter.



**Conclusion:**
Strings are a versatile and powerful data type in Python that allow you to manipulate and process textual data. By leveraging the various built-in functions and methods available, you can perform a wide range of operations on strings, such as accessing characters, concatenating, slicing, and applying transformations
SIX Tips to Help You Produce Excellent Coursework
Published: 2023-05-27 12:34:23

Overcome the challenges of daunting [coursework assignments](https://www.treatassignmenthelp.com/tips-to-help-you-produce-excellent-coursework
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bgfjqs8bteb2encjkwxe.jpg)) with thorough planning, researching, clear writing, and diligent revising. Further, you can also increase your chances of achieving good results by ordering our coursework writing help. Treat Assignment Help is a trusted name for original, plagiarism free and timely delivered coursework help and dissertation help on all subjects and topics.
Django ORM
Tags: django, webdev, programming, tutorial
Published: 2023-05-27 12:05:28

Django provides an Object-Relational Mapping (ORM) layer that allows you to interact with your database using Python code instead of writing raw SQL queries. The ORM provides a high-level, Pythonic API for performing database operations. Here are some common Django ORM commands and their equivalent SQL statements:

1. **Creating Objects:**
   - Django ORM: `Model.objects.create(**kwargs)`
   - SQL: `INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...)`

2. **Saving Objects:**
   - Django ORM: `object.save()`
   - SQL: `UPDATE table_name SET column1=value1, column2=value2, ... WHERE condition`

3. **Querying Objects:**
   - Django ORM: `Model.objects.all()`
   - SQL: `SELECT * FROM table_name`

4. **Filtering Objects:**
   - Django ORM: `Model.objects.filter(**kwargs)`
   - SQL: `SELECT * FROM table_name WHERE condition`

5. **Ordering Objects:**
   - Django ORM: `Model.objects.order_by(*fields)`
   - SQL: `SELECT * FROM table_name ORDER BY column1, column2, ...`

6. **Updating Objects:**
   - Django ORM: `Model.objects.filter(**kwargs).update(**update_kwargs)`
   - SQL: `UPDATE table_name SET column1=value1, column2=value2, ... WHERE condition`

7. **Deleting Objects:**
   - Django ORM: `object.delete()`
   - SQL: `DELETE FROM table_name WHERE condition`

<!--8. **Aggregating Objects:**
   - Django ORM: `Model.objects.aggregate(agg_func)`
   - SQL: `SELECT agg_func(column) FROM table_name`

9. **Joining Objects (Related Models):**
   - Django ORM: `Model.objects.select_related('related_model')`
   - SQL: `SELECT * FROM table_name INNER JOIN related_table ON table_name.related_column = related_table.id`
-->

These are just a few examples of how Django ORM commands correspond to SQL statements. The Django ORM handles many more complex operations, such as complex filtering, grouping, and aggregations, while abstracting away the underlying SQL syntax.
Building a basic "chat with a PDF" app with Laravel and OpenAI
Tags: webdev, ai, laravel
Published: 2023-05-27 12:03:00

Earlier this month I decided to start learning how to build AI products in my free time.

It's been quite a satisfying journey. Based on what I've learned, I even wrote up a sort of [cheat sheet for building chatbots](https://farez.substack.com/p/how-to-create-a-chatbot-with-openais). And once you've learned the new ideas and components of an AI app, it's not that hard.

The app uses OpenAI's API and I'm using their GPT-3.5-turbo model. I'm using their embeddings endpoint to create embeddings for the uploaded PDF content, and using the chat endpoint to ask the AI questions about the document.

In the requests to the API, I asked it to assume the role of "an explanation bot that explains complex information in simple everyday English".

The learning project actually turned into a half-decent app for interrogating PDFs. Even I myself was impressed with how useful a simple AI integration can be.

To test it out, I uploaded a [long PDF from the UK Home Office](https://www.gov.uk/government/publications/form-an-guidance). It's a document explaining how to apply for UK citizenship. Basically, a long and tedious document to read. Then I asked it a few questions.

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

I liked how it summarised the answers and explained them back to me in simple English. Actually, I'm more of a bullet-point kinda guy so I would actually have preferred shorter answers in bullets. But this still saved me a tonne of time trying to read through the document.

Once I had the basic functionality working, then I tidied the frontend up a bit with some simple Tailwind classes. Instead of the usual chat box at the bottom, I decided to put it at the top and have the AI's responses appear below it.

Here's the tech stack for this simple app:

- Backend: Laravel + Nginx
- Database: PostgresQL + pgvector extension
- Frontend: Livewire + Tailwind
- AI API: OpenAI / GPT-3.5

I go into more detail about the above in a [Twitter thread](https://twitter.com/farez/status/1654942532223086592).

For us indie businesses, building is just half the story. To turn this into a money-making project, I'll need to launch this and have people pay to use it.

This is my task this weekend - polish and launch this learning project as an actual product. And yes, I have bought the domain name: clarifypdf.com :)

As always I'll be sharing all the details as I go on Twitter [@farez](https://twitter.com/farez). Or you can just sign up to [my newsletter](https://farez.substack.com/) and get posts like this one on my AI SaaS journey.
Data Engineer Associate Dumps: You’re Secret Weapon for Acing Tests
Published: 2023-05-27 11:22:43

Are you looking to ace your Databricks Certified Data Engineer Associate certification exam? Look no further than reliable Databricks-Certified-Data-Engineer-Associate dumps. These resources offer the perfect study companion for those looking to boost their test scores and achieve exam success.

Dumps provide a comprehensive review of all the topics covered in the certification exam,<a href="https://dumpsboss.com/databricks-exam/databricks-certified-data-engineer-associate/">Databricks-Certified-Data-Engineer-Associate Exam Dumps</a>  as well as expert tips and strategies for answering questions effectively. With these resources at your disposal, you can tackle even the most challenging questions with confidence.

One major advantage of using Databricks-Certified-Data-Engineer-Associate dumps is that they are frequently updated to reflect any changes or updates made to the certification exam. This ensures that you have access to accurate and up-to-date information when preparing for your test.

# Databricks-Certified-Data-Engineer-Associate Dumps: Ace Your Certification with These Reliable Resources

Another benefit of using reliable dumps is that they are often created by experienced professionals who have already passed the certification exam themselves. They know exactly what it takes to succeed on this challenging test and can provide valuable insights into how best to prepare for it.

So if you're serious about acing your Databricks Certified Data Engineer Associate certification, don't hesitate to invest in quality dumps. With these reliable resources at your fingertips, you'll be well-equipped to master any challenge thrown your way on test day.

Get Discount 96% off for Limited Time >>>> https://dumpsboss.com/databricks-exam/databricks-certified-data-engineer-associate/
Laravel Pro Tips - Laravel Queue ✨
Tags: laravel, queue, laravelprotips, webdev
Published: 2023-05-27 11:21:14

✨ **Unlocking Efficiency and Scalability: Harnessing the Power of Laravel Queue**

📂 _From "[Laravel Pro Tips](https://www.linkedin.com/feed/hashtag/?keywords=laravel_pro_tips)" series,_



• Laravel queue is a powerful tool that allows developers to perform time-consuming tasks in the background, freeing up server resources and improving application performance. Here are some examples of how Laravel queue can be used in real-life scenarios:



1. Sending emails: When sending emails to a large number of recipients, it can take a lot of time and resources to process each email individually. By using the Laravel queue, developers can send emails in the background, allowing users to continue using the application without any delays.



2. Processing payments: When processing payments, it's important to ensure that transactions are completed quickly and securely. By using the Laravel queue, developers can process payments in the background, reducing the risk of errors or delays.



3. Generating reports: Generating reports can be a time-consuming task that requires a lot of server resources. By using the Laravel queue, developers can generate reports in the background, allowing users to continue using the application without any delays.



4. Image processing: When uploading and processing images on a website or application, it can take a lot of time and resources to resize or edit each image individually. By using the Laravel queue, developers can process images in the background, allowing users to continue using the application without any delays.



5. Data analysis: When performing data analysis on large datasets, it can take a lot of time and resources to process each data point individually. By using the Laravel queue, developers can perform data analysis in the background, allowing users to continue using the application without any delays.



• Overall, #Laravel_Queue is an essential tool for improving application performance and user experience by offloading time-consuming tasks to the background.


👉 Don't miss out on exclusive Laravel tips and tricks. Follow my LinkedIn account today! 😊

👉 [Peter B. Youssef](https://www.linkedin.com/in/peterkostandy/ )
React developer - Interview Experience
Tags: interview, webdev, career, react
Published: 2023-05-27 11:04:16


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

**Interview questions are:-**

1)To create form in html and javascript
2)What is DOM?
3)HTML tags 
4)Flex properties
5)What is component and write it. How to call components from one component to another
6)What is ES6 and properties
7)What is redux?
8)What is callback and promises
9)How many ways to give style in html document 
10)How to use style in javascript
11)Write is different between class and function components
12)Write one class component and function components...
13)What is different between let const and var
14)Brief explanation about project you done

_**Love to see the answers of this in comments**_ 🥸
AGESQL | CLI Tool For AGE (Setup)
Tags: apacheage, postgres
Published: 2023-05-27 10:58:27

Hi Guyz!

This blog will cover a new topic of Apache AGE. In this one, we will learn about a command-line tool under development for Apache AGE, namely AGESQL. 

Just psql is a command-line tool for postgresql to write queries for manipulating databases, agesql is a command-line tool that can be used to query the server with cypher queries without calling an additional function to parse the query to SQL syntax.

So, let's see how you can setup agesql on your system.

Note: To run agesql on your system, you must have postgresql 15 setup on your system and ready to go.

Now, first clone the AGE_CLI branch from age repository on your system. Open the respective folder from terminal and run the following commands:

**-> cd age
-> export PATH="path to postgresql15/bin:$PATH"
-> export PGDATA="path to postgresql15/bin"
-> export USE_PGXS=TRUE
-> flex -b -Cfe -p -p -o ‘cypher.c’ cypher.l
-> bison -d cypher.y
->make**

If make command is successful that means agesql is installed and ready to run on your system.

That's all for now. In the next blog, we will see how to run agesql and write cypher queries in it.

https://age.apache.org/
https://github.com/apache/age
https://github.com/apache/age/tree/AGE_CLI

GoodBye!
React Redux - Lets Do It
Tags: javascript, react, redux, frontend
Published: 2023-05-27 10:47:06

When you finally understand and confident in React-Redux . 
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i6nxzyu6ku6v84of6y88.gif)

Stay tuned, I will come back with Project implementation using React-redux.

**Comment out your ideas for Redux project.**