Another common use case for event handlers is passing a parameter to a function in React so it can be used later. For example:
import React from "react";
const App = () => {
const sayHello = (name) => {alert(`Hello, ${name}!`);
};
return (
<button onClick={() => {sayHello("John");}}>Say Hello</button>
);
};
export default App;
Inline functions allow you to write code for event handling directly in JSX. See the example below:
import React from "react";
const App = () => {
return (
<button onClick={() => alert("Hello!")}>Say Hello</button>
);
};
export default App;
Event handlers determine what action is to be taken whenever an event is fired. This could be a button click or a change in a text input.
You would write this as follows in React:
function ActionLink() {
const handleClick = (e) => {
e.preventDefault();
console.log('The link was clicked.');
}
return (
<button onClick={handleClick}>Click me</button>
);
}
The spread (...) syntax allows an iterable, such as an array or string, to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected.
Spread operator doing concat
let arrayOne = [1, 2, 3];
let arraryTwo = [4, 5];
arrayCombined = [...arrayOne,...arrayTwo];
Add item using spread operator
let arrayOne = [1, 2, 3];
arrayNew = [...arrayOne, 3];
In the example below, we have a list of numbers. The ForEach method is called on the list and a lambda expression num => Console.WriteLine(num) is passed as the argument. This lambda expression takes each element num from the list and prints it using Console.WriteLine. The lambda acts as the action to be performed on each element in the list.
var numbers = new List<int> { 1, 2, 3, 4, 5 };
numbers.ForEach(num => Console.WriteLine(num));
Entity Framework Core 5 is the first EF version to support filtering in Include
.
Supported operations are Where
, OrderBy
(Descending)/ThenBy
(Descending), Skip
, Take
Some usage example
context.Customers
.Include(c => c.Orders.Where(o => o.Name != "Foo")).ThenInclude(o => o.OrderDetails)
.Include(c => c.Orders).ThenInclude(o => o.Customer)
Only one filter is allowed per navigation, so for cases where the same navigation needs to be included multiple times (e.g. multiple ThenInclude on the same navigation) apply the filter only once, or apply exactly the same filter for that navigation.
You can get private property like so:
Class class = new Class();
var privateProperty = class.GetType().GetProperty("privateProperty", BindingFlags.Instance | BindingFlags.NonPublic);
int propertyValue = (int) privateProperty.GetValue(class);
var privateField = class.GetType().GetField("privateField", BindingFlags.Instance | BindingFlags.NonPublic);
int fieldValue = (int) privateField.GetValue(class);
It is possible to use PUT without a body like
PUT /example HTTP/1.0
Content-Type: text/plain
Content-Length: 0
A sample would be the github starring API, which uses PUT with an empty body to turn on a star and DELETE to turn off a star.
To use useState, you must first import it from the React library. Then you can call the useState function with an initial value for your state variable. This will return an array with two elements: the current value of the state variable and a function that you can use to update that value.
For example, let's say you want to create a counter that increments each time a button is clicked. You could use useState to create a state variable for the count like this:
import React, { useState } from 'react';
function Counter() {
const [count, setCount] = useState(0);
const handleClick = () => {
setCount(count + 1);
};
return (
<div>
<p>You clicked {count} times</p>
<button onClick={handleClick}>Click me</button>
</div>
);
}
In this example, we're using the useState hook to create a state variable called count
, which is initially set to 0. We're also defining a function called handleClick
that updates the count variable by calling the setCount
function with the new value of count + 1
. Finally, we're rendering the current value of count
in a paragraph tag, along with a button that calls the handleClick
function when clicked.
Here’s an example of how to invoke a private method using reflection in .NET:
MyClass myClass = new MyClass();
Type classType = myClass.GetType();
MethodInfo methodInfo = classType.GetMethod("MethodName",
BindingFlags.Instance | BindingFlags.NonPublic);
// Make an invocation:
var result = await (dynamic)methodInfo.Invoke(myClass, null);
You can use this code to get only the methods decorated with a custom attribute.
MethodInfo[] methodInfos = assembly.GetTypes()
.SelectMany(t => t.GetMethods())
.Where(m => m.GetCustomAttributes(typeof(CustomAttribute), false).Length > 0)
.ToArray();
You can use the following code snippets to get a class's public methods using reflection. The class name is provided as typeName
.
MethodInfo[] methodInfos = typeof(Class).GetMethods();
Variant with filter using BindingFlags
MethodInfo[] methodInfos = Type.GetType(typeName)
.GetMethods(BindingFlags.Public | BindingFlags.Instance);
The time service in Windows can be reset to a default state by running the following inside an elevated Command Prompt (CMD):
net stop w32time
w32tm /unregister
w32tm /register
net start w32time
To verify the time server, follow these steps:
timedate.cpl
time.windows.com
)(&(objectClass=user)(cn=Mark*))
This means: search for all entries that have objectClass=user AND cn that start with the word 'Mark'.
Microsoft has announced that window sharing of the Microsoft Teams application is now generally available on the Azure Virtual Desktop for Windows users.
Application window sharing now allows users to select a specific window from their desktop screen to share. Previously, users could only share their entire desktop window or a Microsoft PowerPoint Live presentation. Application window sharing helps reduce the risk of showing sensitive content during meetings/calls and keeps meetings focused by directing participants to specific content.
Read more at Azure Daily 2022
The Change Tracking and Inventory service tracks changes to Files, Registry, Software, Services and Daemons and uses the MMA (Microsoft Monitoring Agent)/OMS (Operations Management Suite) agent. This preview supports the new AMA agent and enhances the following:
Large language models are quickly becoming an essential platform for people to innovate, apply AI to solve big problems, and imagine what’s possible. Today, we are excited to announce the general availability of Azure OpenAI Service as part of Microsoft’s continued commitment to democratizing AI, and ongoing partnership with OpenAI.
With Azure OpenAI Service now generally available, more businesses can apply for access to the most advanced AI models in the world—including GPT-3.5, Codex, and DALL•E 2—backed by the trusted enterprise-grade capabilities and AI-optimized infrastructure of Microsoft Azure, to create cutting-edge applications. Customers will also be able to access ChatGPT—a fine-tuned version of GPT-3.5 that has been trained and runs inference on Azure AI infrastructure—through Azure OpenAI Service soon.
We debuted Azure OpenAI Service in November 2021 to enable customers to tap into the power of large-scale generative AI models with the enterprise promises customers have come to expect from our Azure cloud and computing infrastructure—security, reliability, compliance, data privacy, and built-in Responsible AI capabilities.
Since then, one of the most exciting things we’ve seen is the breadth of use cases Azure OpenAI Service has enabled our customers—from generating content that helps better match shoppers with the right purchases to summarizing customer service tickets, freeing up time for employees to focus on more critical tasks.
Customers of all sizes across industries are using Azure OpenAI Service to do more with less, improve experiences for end-users, and streamline operational efficiencies internally. From startups like Moveworks to multinational corporations like KPMG, organizations small and large are applying the capabilities of Azure OpenAI Service to advanced use cases such as customer support, customization, and gaining insights from data using search, data extraction, and classification.
“At Moveworks, we see Azure OpenAI Service as an important component of our machine learning architecture. It enables us to solve several novel use cases, such as identifying gaps in our customer’s internal knowledge bases and automatically drafting new knowledge articles based on those gaps. This saves IT and HR teams a significant amount of time and improves employee self-service. Azure OpenAI Service will also radically enhance our existing enterprise search capabilities and supercharge our analytics and data visualization offerings. Given that so much of the modern enterprise relies on language to get work done, the possibilities are endless—and we look forward to continued collaboration and partnership with Azure OpenAI Service."—Vaibhav Nivargi, Chief Technology Officer and Founder at Moveworks.
“Al Jazeera Digital is constantly exploring new ways to use technology to support our journalism and better serve our audience. Azure OpenAI Service has the potential to enhance our content production in several ways, including summarization and translation, selection of topics, AI tagging, content extraction, and style guide rule application. We are excited to see this service go to general availability so it can help us further contextualize our reporting by conveying the opinion and the other opinion.”—Jason McCartney, Vice President of Engineering at Al Jazeera.
“KPMG is using Azure OpenAI Service to help companies realize significant efficiencies in their Tax ESG (Environmental, Social, and Governance) initiatives. Companies are moving to make their total tax contributions publicly available. With much of these tax payments buried in IT systems outside of finance, massive data volumes, and incomplete data attributes, Azure OpenAI Service finds the data relationships to predict tax payments and tax type—making it much easier to validate accuracy and categorize payments by country and tax type.”—Brett Weaver, Partner, Tax ESG Leader at KPMG.
The general availability of Azure OpenAI Service is not only an important milestone for our customers but also for Azure.
Azure OpenAI Service provides businesses and developers with high-performance AI models at production scale with industry-leading uptime. This is the same production service that Microsoft uses to power its own products, including GitHub Copilot, an AI pair programmer that helps developers write better code, Power BI, which leverages GPT-3-powered natural language to automatically generate formulae and expressions, and the recently-announced Microsoft Designer, which helps creators build stunning content with natural language prompts.
All of this innovation shares a common thread: Azure’s purpose-built, AI-optimized infrastructure.
Azure is also the core computing power behind OpenAI API’s family of models for research advancement and developer production.
Azure is currently the only global public cloud that offers AI supercomputers with massive scale-up and scale-out capabilities. With a unique architecture design that combines leading GPU and networking solutions, Azure delivers best-in-class performance and scale for the most compute-intensive AI training and inference workloads. It’s the reason the world’s leading AI companies—including OpenAI, Meta, Hugging Face, and others—continue to choose Azure to advance their AI innovation. Azure currently ranks in the top 15 of the TOP500 supercomputers worldwide and is the highest-ranked global cloud services provider today. Azure continues to be the cloud and compute power that propels large-scale AI advancements across the globe.
Source: TOP500 The List: TOP500 November 2022, Green500 November 2022.
As an industry leader, we recognize that any innovation in AI must be done responsibly. This becomes even more important with powerful, new technologies like generative models. We have taken an iterative approach to large models, working closely with our partner OpenAI and our customers to carefully assess use cases, learn, and address potential risks. Additionally, we’ve implemented our own guardrails for Azure OpenAI Service that align with our Responsible AI principles. As part of our Limited Access Framework, developers are required to apply for access, describing their intended use case or application before they are given access to the service. Content filters uniquely designed to catch abusive, hateful, and offensive content constantly monitor the input provided to the service as well as the generated content. In the event of a confirmed policy violation, we may ask the developer to take immediate action to prevent further abuse.
We are confident in the quality of the AI models we are using and offering customers today, and we strongly believe they will empower businesses and people to innovate in entirely new and exciting ways.
The pace of innovation in the AI community is moving at lightning speed. We’re tremendously excited to be at the forefront of these advancements with our customers, and look forward to helping more people benefit from them in 2023 and beyond.
Azure Data Explorer (ADX) now supports managed ingestion from Azure Cosmos DB.
This feature enables near real-time analytics on Cosmos DB data in a managed setting (ADX data connection). Since ADX supports Power BI direct query, it enables near real-time Power BI reporting. The latency between Cosmos DB and ADX can be as low as sub-seconds (using streaming ingestion).
This brings the best of both worlds: fast/low latency transactional workload with Azure Cosmos DB and fast / ad hoc analytical with Azure Data Explorer.
Only Azure Cosmos DB NoSQL is supported.
Source: Public Preview: Azure Cosmos DB to Azure Data Explorer Synapse Link
Delta Lake is open source software that extends Parquet data files with a file-based transaction log for ACID transactions and scalable metadata handling. Now, Stream Analytics no-code editor provides you an easiest way (drag and drop experience) to capture your Event Hubs data into ADLS Gen2 with this Delta Lake format without a piece of code. A pre-defined canvas template has been prepared for you to further speed up your data capturing with such format.
To access this capability, simply go to your Event Hubs in Azure portal -> Features -> Process data or Capture.
Source: Public preview: Capture Event Hubs data with Stream Analytics no-code editor in Delta Lake format
With the "Featured Clothing" insight, you are able to identify key items worn by individuals within videos. This allows high-quality in-video contextual advertising by matching relevant clothing ads with the specific time within the video in which they are viewed. "Featured Clothing" is now available to you using Azure Video Indexer advanced preset. With the new featured clothing insight information, you can enable more targeted ads placement.
Iqra Technology is an IT Solutions and Services Company. We are a salesforce and Microsoft partner company. We aim to provide cost-effective IT services within the customer’s budget range. We scrutinize, design, and develop solutions custom-made for the business necessities. We deliver services in various domains including CRM, ERP, e-commerce, CMS, business intelligence, web development, customized applications, portals, mobile apps, & RPA technologies. We provide IT services starting from $2100 per month and 2 weeks free trial. https://iqratechnology.com/
If you just switched to the new Windows version, here are some of the most interesting Windows 11 features that you should know about:
Who doesn't know this? You have something on your mind and want to tell the other person how you feel and what's on your mind. However, the other person, unfortunately, does not listen properly and you do not feel understood.
Unfortunately, most people are poor listeners. Good listeners have often undergone special training or have made listening to their profession. But what does good listening actually mean? How can you listen better and give your counterpart an appreciative feeling? In the following, I would like to show you three tips that will help you become a better listener.
A large proportion of German employees suffer from recurring chronic back pain, which, according to medical experts, is mainly caused by immobile sitting in everyday working life.
In the following, you will find out what a vital workday can do for your health. First, however, you should start at the basis of your every day (work) life.
Do you not know where to go with you because of the heat? Rescue is at hand! According to traditional Chinese medicine, these foods provide a large portion of cooling.
The fan has given up the ghost, your feet are boiling, and you don't know if that thing on your neck is a head or a hotplate? We feel you! We can't offer you a nice igloo in the Arctic at the moment, but at least the heat buildup in your body can be solved with smart decisions when eating.
Doesn’t it make sense then to try to save as much of your hard-earned money as possible? The less you spend, the more you have.
Here are some money tips you can use to save big on many of your expenses.
Vasily Alekseyev was tricked into lifting 500 pounds over his head.
Until 1970, many weightlifters had only come close to cracking that psychological barrier.
So when his trainers told him that the bar was loaded with slightly less than 500 pounds, a weight he’d lifted before, he threw it up like a matchstick.
Only they had lied—he’d actually lifted 500.5 pounds. Over the next seven years, he continued to smash records, topping out at 564 before retiring.
Because seeing is believing, many others started lifting 500+ soon after.
Remember Roger Bannister? Until 1954, everyone believed a human couldn't run a mile in under four minutes. Then Roger did it, and his record stood for only 46 days. In the next 50 years, more than a thousand runners beat the four-minute mile.
What changed? Only a belief in what’s possible.
A few everyday things make us look immediately unattractive to our counterpart - at least, that's what science says.
Do you get too little sleep and are often in a bad mood? Then watch out! These and other everyday things that seem supposedly "normal" to us have a negative impact on your attractiveness. Scientists have found out which behaviors don't go down well and cast a bad light on us:
Walking barefoot is the natural way for humans to walk why it's worthwhile to go barefoot more often.
For thousands of years, our ancestors stomped around barefoot. Only recently have people started to squeeze into socks and shoes with rubber soles, completely isolating themselves from the earth's surface - yet walking with bare feet brings so many health benefits. Because walking barefoot...
Too many tasks and too little time is a permanent condition for you? Do you feel stressed and are unproductive? Poor time management is often to blame. With these 5 tips, you'll finally get the hang of it.
Everyone has 24 hours in a day, yet some people seem to use them better than others. Those who cultivate poor time management struggle to complete their tasks. The consequences: Constant stress and declining productivity. These tips (from Focus Online) show you how good time management works and bring peace back into your workday.
Our society places great value on multitasking. So, too, are our work environments designed for multitasking: Now more than ever, we use computers and networks that offer instant messaging, email, and other "productive" tools. We are constantly jumping back and forth between them.
Multitasking includes three different types:
Performing two or more tasks simultaneously.
Switching back and forth between tasks.
Performing a series of tasks in rapid succession.
While this way of working seems normal to many people, multitasking is a disadvantage. If we use single-tasking instead and consciously approach each project "task-by-task," we can be very productive.
The fastest way to get many things done is to do one thing at a time.
At least two liters a day should be. You should definitely drink before sports ... There are plenty of myths about drinking. But which ones are really true?
Many of us find it difficult to follow through on all work tasks and figure out how to continue to be as productive as possible after an extended period of physical and social isolation. With a little mindfulness, planning ahead, and acknowledging what's actually going well, it's possible to jumpstart productivity with new strategies. These six simple methods will help you be more productive in your workday:
This is what happens when you drink water in the morning on an empty stomach.
These 7 things happen when you drink water after waking up on an empty stomach, from weight loss to visibly healthier hair.
We hear again and again that sufficient liquid is important for our body. But what happens when water is drunk directly after getting up? We'll tell you:
How would the world look like 5, 10, or 15 years from now? Well, indeed, no one can predict.
Monitoring the changing pattern of technological usage & growth can help understand how the professional world may change in the future.
A career you may want to pursue, or a career you already have may shape up to be quite a boom in years to come.
In this blog, we shall shed some light on in-demand careers which we believe shall grow in years to come.
In the job interview, it is important to score points with professional competence and personality. In recent years, soft skills have become increasingly important compared to pure hard skills. Companies are looking for a "team fit" rather than a pure "skill fit. The problem with personality traits is that, in comparison to hard skills, they cannot be proven with a certificate. Companies are therefore not only looking for personalities. They are looking for personalities that are as authentic as possible. Here I explain how you can present yourself as authentically as possible.