teleren/devto huggingface dataset:
Latest AZ-900 Questions And Answers
Tags: career
Published: 2023-04-26 12:37:20

## Question 1
**Question Type:** Multiple Choice

You need to purchase a third-party virtual security appliance that you will deploy to an Azure subscription. What should you use?

**Options:**
A- Azure Marketplace
B- Azure Security Center
C- Microsoft Store
D- Azure subscriptions

**Answer:** B

**Question 2**
**Question Type:** Multiple Choice

You need to manage containers. Which two services can you use? Each correct answer presents a complete solution,
NOTE: Each correct selection is worth one point.

**Options:**
A- Azure Virtual Desktop
B- Azure virtual machines
C- Azure Functions
D- Azure Kubernetes Service (AKS) E- Azure Container Instances

**Answer:** D, E

**Question 3**
**Question Type:** Multiple Choice

What is the longest term you can purchase for Azure Reserved VM Instances?

**Options:**
A- three years
B- four years
C- one year
D- five years

**Answer:** A

**Question 4**
**Question Type:** Multiple Choice

You have an accounting application named App1 that uses a legacy database. You plan to move App1 to the cloud. Which service model should you use?

**Options:**
A- software as a service (SaaS)
B- infrastructure as a service (laaS)
C- platform as a service (PaaS)

**Answer:** B

**Question 5**

**Question Type:** Multiple Choice

Who can use the Azure Total Cost of Ownership (TCO) calculator?

**Options:**

A- owners for an Azure subscription only

B- all users who have an account in Azure Active Directory (Azure AD) that is linked to an Azure subscription only

C- anyone

D- billing readers for an Azure subscription only

**Answer:** C

**Question 6**

**Question Type:** Multiple Choice

Your company plans 10 migrate all its data and resources to Azure. The company's migration plan states that only Platform as a Service (PaaS) solutions must be used in Azure You need to deploy an Azure environment that meets the company's migration plan What should you create?

**Options:**

A- an Azure App Service and Azure SQL databases

B- Azure storage accounts and web server in Azure virtual machines

C- Azure virtual machines. Azure SQL databases, and Azure Storage accounts

D- an Azure App Service and Azure virtual machines that have Microsoft SQL Server installed

**Answer:** A

To Get Premium Files for AZ-900 Visit: [https://www.p2pexams.com/products/az-900](https://www.p2pexams.com/products/az-900)
🚀 Using infer in TypeScript
Tags: typescript
Published: 2023-04-26 12:30:00

## Extracting a Type with infer 🔍

The infer keyword is used in conjunction with the extends keyword to extract a type from a generic parameter. By using infer, you can perform type inference on a nested type that depends on the type of the input parameter.

### Example:

Extracting the Type of the First Element of an Array 🌟

```typescript
type FirstElement<T> = T extends [infer First, ...any[]] ? First : never;

const arr = ["foo", 42, true];
type FirstType = FirstElement<typeof arr>; // inferred type: string
```

### Example: 

Extracting the Return Type of a Callback Function 🎯

```typescript
function map<T, U>(arr: T[], callback: (value: T) => U): U[] {
  const result: U[] = [];
  for (const element of arr) {
    result.push(callback(element));
  }
  return result;
}

type ReturnType<T extends (...args: any[]) => any> = T extends (...args: any[]) => infer R ? R : any;

const arr = ["foo", "bar", "baz"];
const result = map(arr, (str) => str.length);
type ResultType = ReturnType<typeof result[number]>; // inferred type: number
```

## Conclusion:

infer is a powerful feature of TypeScript generics that allows you to extract types from generic parameters and perform type inference on nested types. By using infer, you can write more expressive and reusable code that is less error-prone.
AI Impact on the Job Market (Short guide)
Tags: ai, chatgpt, jobsecurity
Published: 2023-04-26 12:27:13

‍Artificial Intelligence is a double-edged sword. It has the potential to revolutionize industries and create new opportunities, and it has the potential to disrupt the job market and replace workers in many industries.

I am a professional programmer, and I am also a Computer Science student almost done with my Master's degree in CS with Data Analytics.

In this blog post, I will try to explore what kind of impact AI could have on jobs, including my very own programming job. What’s more important, I will share what I think is going to help you to stay ahead in the job market.

Please check this link to read the full post: https://testclub.hashnode.dev/ai-impact-on-the-jov-market-short-guide
Learn async v/s defer attributes of Script in JavaScript
Tags: javascript, webdev, programming
Published: 2023-04-26 12:26:37

Hello Dev community!👋 I hope you're having a great day and staying safe during these challenging times🫡. Let's dive in our topic and I am sure I will definitely make you comfortable with async and defer. Let's dive in and explore how these powerful attributes can help boost your website's performance!"

## What is **async** and **defer**?
Both **"async"** and **"defer"** are JavaScript characteristics that can be added to the script tag in an HTML document. They enable asynchronous script loading, which can improve website performance by lowering page load times. 

## Now you might have a question, how it reduces page loading?🧐
When a script is loaded synchronously (that is, without the "async" or "defer" attribute), the browser must load and run the script before proceeding to render the rest of the page. This can cause the page to "freeze" while the script is loading, resulting in slower page load times and a negative user experience.
                                                      When a script is loaded asynchronously using the "async" or "defer" attributes, the browser can continue to load and render the remainder of the page while the script is loading in the background. Because the page can be displayed to the user more rapidly, even while the script is still loading, this can result in speedier page load times. 


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

When script tag does not have **defer** or **async** then it is executed synchronously, this means that the parsing of the HTML document will be paused and script file is fetched and after fetching it is executed then after again the HTML document starts parsing again.


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

When script tag has **async** attribute, both HTML document parsing and script file downloading happens parallelly and once Script file is downloaded then the HTML parsing is paused and script file is executed and after execution of script file again the HTML document started parsing.


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

When script tag has **defer**, the HTML is completely parsed along with the Script file is downloaded, After completely parsing of HTML document the Script file is executed.

## CONCLUSION
In general, **defer** is preferred when there is no need of the script to be executed immediately after fetching but rely on other resources or scripts to be loaded first, and use async for scripts that can be executed independently and do not rely on other resources. However the optimal approach may upon their use case.
Impact of Artificial Intelligence in Retail Market ?
Tags: aws, ai, automation, appwritehack
Published: 2023-04-26 12:05:39

[AI development company](https://sofster.com/ai-application-development-company/) (AI) is revolutionizing the retail industry, transforming the way retailers operate and serve their customers. AI has become an essential tool for retailers to stay competitive and achieve growth in today's digital age. In this guide, we will discuss the impact of AI in retail and provide some examples of how AI is being used in the industry. 


**Personalized Marketing:**
AI-powered marketing algorithms enable retailers to analyze customer data and create personalized marketing campaigns. These campaigns are tailored to specific customer needs and preferences, increasing the chances of customer engagement and conversion. For instance, Amazon uses AI-powered recommendations to suggest products to customers based on their previous searches and purchase history.

**Inventory Management:**
[AI-powered](https://sofster.com/ai-application-development-company/) inventory management systems enable retailers to optimize their inventory levels and ensure that they always have the right products in stock. This leads to increased efficiency and cost savings, as well as improved customer satisfaction. Walmart uses AI-powered inventory management to ensure that their stores are always stocked with the products that customers want.

**Chatbots and Customer Service:**
AI-powered chatbots are being increasingly used by retailers to improve customer service. Chatbots are able to quickly and efficiently respond to customer inquiries, providing them with the information they need in real-time. This improves customer satisfaction and reduces the workload of customer service teams. Sephora uses chatbots to help customers find the right products and answer common beauty questions.

**Predictive Analytics:**
AI-powered predictive analytics enable retailers to forecast customer behavior and make informed decisions. Retailers can use predictive analytics to identify trends, anticipate customer needs, and make pricing and promotional decisions. For example, H&M uses predictive analytics to determine which products will be popular in each store location and adjust their inventory accordingly.


**Supply Chain Optimization:**
AI-powered supply chain optimization systems help retailers improve their supply chain efficiency and reduce costs. These systems use machine learning algorithms to analyze data and make predictions about inventory levels, shipping times, and other factors that affect the supply chain. For example, Alibaba uses AI-powered supply chain optimization to reduce delivery times and improve overall efficiency.

**Wrapping up:**
AI is transforming the retail industry by improving customer experiences, optimizing operations, and increasing efficiency. Retailers that adopt AI technologies are more likely to stay competitive and achieve growth in today's digital age.

Are you ready to be a part of this revolutionary future? Contact [AI Development Company](https://sofster.com/ai-application-development-company/) today.
5 Unknown Free Resources to Learn Prompt Engineering | Here is Why it is Most Valuable Skill 2023
Published: 2023-04-26 12:03:48

Prompt engineering is a skill set that is in high demand in today’s technological world. With the ever-growing popularity of digital assistants and chatbots, the ability to create effective prompts is becoming increasingly important. In this article, we will explore the importance of prompt engineering, why it is crucial for businesses, and how to learn it + 5 best free resources to learn professional prompt engineering.


## What is Prompt Engineering?


Prompt engineering is the process of creating prompts for conversational agents, such as chatbots, virtual assistants, or voice assistants. A prompt is a message that initiates a conversation with the user and prompts them to take an action or provide information. The quality of a prompt can make or break the user experience, as it sets the tone for the entire conversation.

## Why is Prompt Engineering Important?

Prompt engineering is crucial for businesses that want to provide a seamless and efficient user experience. A poorly crafted prompt can lead to confusion, frustration, and even abandonment of the conversation. On the other hand, a well-designed prompt can guide the user towards their desired outcome and increase their satisfaction.

With the increasing popularity of conversational interfaces, the importance of prompt engineering is only going to grow. By 2023, it is estimated that over 50% of all searches will be voice searches. This means that businesses that do not prioritize prompt engineering risk falling behind their competitors and losing out on potential customers.

Here are 5 Best Free resources to Learn professional Prompt engineering

[5 Unknown Resources to Learn Prompt Engineering](https://devcom.tech/how-to-learn-prompt-engineering/)
Iterating on gpt-4 code suggestions
Tags: ai, webdev, chatgpt
Published: 2023-04-26 11:59:03

**AI can give you what you want, but you should know what you want to achieve anyway.**


> js
> given array A and array B
> B is array with objects like {id:string}
> write a function which gets - A, changed-B, and previous-B , detects items reorder in B and applies that on a


```js
function applyReorder(a, prevB, changedB) {
	// Create a map of id to index for the previous b array
	const prevBIndexMap = new Map()
	prevB.forEach((item, index) => {
		prevBIndexMap.set(item.id, index)
	})
	// Create a reordered array based on the changedB array
	const reorderedA = new Array(a.length)
	changedB.forEach((item, index) => {
		const prevIndex = prevBIndexMap.get(item.id)
		reorderedA[index] = a[prevIndex]
	})
	return reorderedA
}
```

> now write that in a more functional style
```js
function applyReorder(a, prevB, changedB) {
	const prevBIndexMap = prevB.reduce((map, item, index) => {
		map.set(item.id, index)
		return map
	}, new Map())
	return changedB.map((item) => a[prevBIndexMap.get(item.id)])
}
```

> use Map constractor
```js
function applyReorder(a, prevB, changedB) {
	const prevBIndexMap = new Map(
		prevB.map((item, index) => [item.id, index])
	)
	return changedB.map((item) => a[prevBIndexMap.get(item.id)])
}
```

> implement this in one line
```js
const applyReorder = (a, prevB, changedB) =>
	changedB.map(
		(item) =>
			a[
				new Map(prevB.map((el, idx) => [el.id, idx])).get(
					item.id
				)
			]
	)
```

> use one line implementation using findIndex
```js
const applyReorder = (a, prevB, changedB) =>
	changedB.map(
		(item) => a[prevB.findIndex((el) => el.id === item.id)]
	)
```

### So progressively we got one line instead of 10 and only one implementation was non working

------------------------------------

### And the final implementation:

```ts
function applyReorder(
	applyTo: any[],
	prevAccordingTo: { id: string }[],
	changedAccordingTo: { id: string }[]
) {
	return changedAccordingTo.map(
		(item) =>
			applyTo[
				prevAccordingTo.findIndex((el) => el.id === item.id)
			]
	)
}
```
Life of Innovators
Published: 2023-04-26 11:57:11

Innovators tread where others dare not,
Pushing boundaries, exploring every new thought.
Their minds alive with endless creation,
Seeking to build a better, brighter civilization.

And in the midst of their grand design,
They spend countless hours refining every line.
The user interface, a crucial part,
Must be intuitive, easy to start.

With every button, every click and swipe,
Their vision comes to life, with such delight.
The colors and shapes all fall into place,
Each element a reflection of their creative grace.

But even when their work is done,
And the users come, one by one,
The innovator knows the journey's not complete,
For there's always more to improve and tweak.

And so they keep refining, with passion and care,
Knowing that the user experience is what they share.
For the life of the innovator is to create,
And to make the world a better place, without debate.
Some ideas just stick
Published: 2023-04-26 11:52:38

For the daring innovator, the risk is high,
To try what's never been done, to reach for the sky.
For every success, there's a dozen failures,
Each one a lesson, a chance to uncover new treasures.

But amidst the smoke and the gusts of flame,
There are some ideas that refuse to be tamed.
They take hold of the public imagination,
And spread like wildfire, igniting a sensation.

And even if the source code is lost,
The idea persists, at no great cost.
For it lives on in the minds of those who believe,
And their passion and commitment, it will never leave.

So the innovator watches as the fire burns,
And from the ashes, a new idea learns.
For they know that even if it doesn't catch on,
The thrill of the chase is never really gone.
Join the webinar: Building a unified test automation reporting with Zebrunner on May 3, 2023
Tags: testing, test, automation
Published: 2023-04-26 11:51:21

📣 We invite you to the webinar on May 3, 2023, where Anna Sukhodolova will present an informative session on how to build a unified test automation  #reporting with Zebrunner when using multiple testing frameworks.

During the session, you will:

🔵 Understand the significance of using unifiedreporting;
🔵 Learn how to link your test projects to facilitate #test data reporting;
🔵 Speed up your failureanalysis process through AI/ML classification, logs, screenshots, and video;
🔵 Ensure the traceability of your test results by monitoring cases, automated executions, and defects;
🔵 Discover how to gain an instant overview of your product's health through intuitive dashboards and widgets .

➡️ [Save your spot now!](https://zebrunner.com/webinar-building-unified-automation-reporting?utm_source=devto&utm_medium=webinar2&utm_campaign=post_announcement_w1 )
I made a VSCode extension: "Purple Dark Theme"
Tags: java, html, javascript, webdev
Published: 2023-04-26 11:25:16

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

How to install Download it from the marketplace or search for Purple Dark Theme in VSCode Extensions and install it.

Link Here (https://marketplace.visualstudio.com/items?itemName=waleedishfaq.ColorCodeTheme)
Notification System for android (unity)
Published: 2023-04-26 10:55:29

To create a notification system in Unity for Android, you need the Android notification library, then write a public void function whit DateTime type argument and create a notification channel inside it, then create the notification itself in that function and finally send it to the Android notification center.
Finally, call this function where you want
for example:

```
public void notificationSchedule(DateTime time)
{

    const string ChannelID = "notification";
   AndroidNotificationChannel notificationChannel = new 
   AndroidNotificationChannel
   {
      Id = ChannelID,
      name = "notification:,
      description = "random description",
      Importance = Importance.Default 
   };
  AndroidNotificationCenter.RegisterNotificationChannel(notificationChannel);
  AndroidNotifition notification = new AndroidNotifition
  {
      Titel = "AnyThing",
      text = "anyThing" ,
      smallIcon = "default",
      largIcon  = "default",
      FireTime = time 
  };
 AndroidNotificationCenter.SendNotification(notification ,ChannelID);
}
```
#unity
#notification
#android
Building Asynchronous Flutter Applications with FutureBuilder
Published: 2023-04-26 10:19:38

FutureBuilder is a powerful widget in Flutter that allows you to build your UI based on the state of a Future. A Future represents a value that is not available yet, but will be available at some point in the future.

When you use FutureBuilder, you pass a Future to it and a builder function. The builder function gets called whenever the state of the Future changes. The state of the Future can be one of three possibilities:

- ConnectionState.active: The Future is currently running and has not yet completed.

- ConnectionState.done: The Future has completed and either has a value or an error.

- ConnectionState.none: The Future has not yet started.


Based on the state of the Future, you can build different widgets to show the user different UI elements. For example, if the Future is still running, you can show a loading spinner. If the Future has completed with a value, you can show the value. If the Future has completed with an error, you can show an error message.

Here is an example of how you can use FutureBuilder in your Flutter application:

```
class MyApp extends StatelessWidget {
  Future<String> _loadData() async {
    await Future.delayed(Duration(seconds: 3)); // simulate network delay
    return "Hello, World!";
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("FutureBuilder Example"),
      ),
      body: Center(
        child: FutureBuilder<String>(
          future: _loadData(),
          builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
            if (snapshot.connectionState == ConnectionState.waiting) {
              return CircularProgressIndicator();
            } else if (snapshot.hasError) {
              return Text("Error: ${snapshot.error}");
            } else {
              return Text("Data: ${snapshot.data}");
            }
          },
        ),
      ),
    );
  }
}

```

In this example, `_loadData()` simulates a network request and returns a string after a delay of 3 seconds. `FutureBuilder` is used to build the UI based on the state of the Future returned by `_loadData()`. If the Future is still running, a `CircularProgressIndicator` is displayed. If the Future has completed with an error, an error message is displayed. Finally, if the Future has completed successfully, the data is displayed on the screen.

FutureBuilder is an essential widget in Flutter that can help you make your applications more responsive by allowing you to build your UI based on asynchronous operations. By using it correctly, you can provide a better user experience for your users.
Different Ways of Writing JavaScript Functions
Tags: webdev, javascript, codenewbie, programming
Published: 2023-04-26 09:59:42

Functions are fundamental to your versatility as a JavaScript developer. They offer you flexibility, absolute control over your code, and other benefits that make it imperative for you to master the art of function declaration.

Many newbie JavaScript developers struggle to create functions because they have zero clue about the available options. 

You can write JavaScript functions in three different ways which are:

**1. - Function Declaration**
**2. - Function Expression**
**3. - Arrow Function**

Let’s review these function types one after the other.


1. **Function Declaration**

In a function declaration, you declare the function directly without assigning it to a variable.

function functionName(parameters) {

//the code to be executed goes here

}

For example:

function sum() {
….. // content

}

Consider the example below:

function sum(a,b) {

return a + b;

}

console.log (sum(5,6)); // result = 11.


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


**2. - Function Expression**

In a function expression, you assign the function to a variable name. the following example demonstrates how you declare a function expression.

const x = functionName(parameters) {

//code goes here

}

Example:

let x = function sum(a,b) {

return a + b;

}

console.log(sum(2,20));

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


**3. - Arrow Function**

The arrow function was introduced in the JavaScript ES6 version. It is an alternative way to the methods discussed above.

Arrow functions are shorter and easier to use.

Here, you replace the “function” keyword with =>.

Consider this:

sum = (a, b) => a + b;

console.log(sum(34,20)); // result = 54

Note that you can use brackets if the function will cover multiple lines. A typical example is shown below:

const bigger = (a, b) => {

if (a > b) {

return `${a} is bigger`;

} else {

return `${b} is bigger`;

}

}

console.log (bigger(45,90)); // result: 90 is bigger

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


You can choose any of the methods discussed above to create a function, although the arrow method is currently the standard method.