<?xml version="1.0" encoding="utf-8"?>
This is the XML declaration.
version="1.0"
: Tells the XML parser to use version 1.0 rules.
encoding="utf-8"
: Says the text is encoded in UTF-8 (supports all languages and symbols).
Every Question..What does it mean? Why is this? How it works?
Microsoft .Net (pronounced dot (.) net) may be a package element that runs on the Windows software package.
.Net provides tools and libraries that change developers to form Windows package a lot of quicker and easier.
Microsoft describes it as:".Net is that the Microsoft internet Service strategy to attach data, people,
system and devices through software".I'm Choulla Naresh..!
<?xml version="1.0" encoding="utf-8"?>
This is the XML declaration.
version="1.0"
: Tells the XML parser to use version 1.0 rules.
encoding="utf-8"
: Says the text is encoded in UTF-8 (supports all languages and symbols).
# | Concept | Comparison | Example |
---|---|---|---|
1 | Abstract Class vs Interface | Abstract class can have implementations; interface cannot. | abstract class A {} vs interface I {} |
2 | Ref vs Out | ref requires initialization, out does not. |
void Method(ref int x) vs void Method(out int x) |
3 | Value Type vs Reference Type | Value types store data directly; reference types store memory addresses. | int x = 5; vs string s = "Hello"; |
4 | == vs Equals() | == checks reference for objects, Equals() checks values. |
"abc" == "abc" vs "abc".Equals("abc") |
5 | Sealed vs Static vs Abstract Class | sealed prevents inheritance, static prevents instantiation, abstract enforces method overriding. |
sealed class A {} , static class B {} , abstract class C {} |
6 | Method Overloading vs Overriding | Overloading is same method with different parameters; Overriding modifies base method. | void Show(int x) vs override void Show() |
7 | Stack vs Queue | Stack: LIFO, Queue: FIFO. | Stack<int> stack = new Stack<int>(); |
8 | Stack vs Heap | Stack stores value types; Heap stores reference types. | int x = 10; (Stack) vs new Person(); (Heap) |
9 | IEnumerable vs IQueryable | IEnumerable executes in-memory, IQueryable executes on the database server. |
IEnumerable<T> (Linq in-memory) vs IQueryable<T> (Linq-to-SQL) |
10 | String vs StringBuilder | string is immutable, StringBuilder is mutable. |
string s = "Hello"; vs StringBuilder sb = new(); |
11 | Task vs Thread | Task is for async programming, Thread is for parallel execution. |
Task.Run(() => {...}) vs new Thread(()=> {...}).Start(); |
12 | ReadOnly vs Const vs Static | const is compile-time, readonly is runtime, static belongs to class. |
readonly int a; , const int b = 10; , static int c; |
13 | Dispose vs Finalize | Dispose() is called explicitly; Finalize() is called by GC. |
using(obj) {...} vs ~ClassName() |
14 | Early Binding vs Late Binding | Early binding is compile-time; Late binding is runtime. | var obj = new Class(); (early) vs dynamic obj = new Class(); (late) |
15 | XML vs JSON | XML uses tags, JSON uses key-value pairs. | <Person><Name>John</Name></Person> vs {"Name": "John"} |
16 | Static Constructor vs Instance Constructor | Static runs once per class; instance runs per object. | static Example() {} vs public Example() {} |
17 | DataSet vs DataReader | DataSet stores data in memory; DataReader reads forward-only. |
DataSet ds = new DataSet(); vs SqlDataReader dr = cmd.ExecuteReader(); |
18 | Hashtable vs Dictionary | Dictionary<T, T> is type-safe; Hashtable is not. |
Dictionary<int, string> d = new(); |
19 | Struct vs Class | struct is value type; class is reference type. |
struct Point {} vs class Point {} |
20 | Interface vs Delegate | Interface defines behavior; Delegate is a method reference. | interface IRun {} vs delegate void MyDelegate(); |
21 | IS vs AS Operator | is checks type compatibility; as performs safe casting. |
if (obj is string) vs string s = obj as string; |
22 | Singleton vs Static Class | Singleton allows only one instance; Static class cannot be instantiated. | private static Singleton instance; vs static class MyClass {} |
23 | Lazy Loading vs Eager Loading | Lazy loads data when needed; Eager loads immediately. | Lazy<T> obj = new Lazy<T>(); |
24 | Throw vs Throw ex | throw preserves stack trace, throw ex resets it. |
throw; vs throw ex; |
25 | Partial Class vs Abstract Class | Partial splits a class, Abstract enforces overriding. | partial class MyClass {} vs abstract class MyClass {} |
26 | Deep Copy vs Shallow Copy | Deep Copy creates a new object, Shallow Copy copies reference. | Clone() for Deep, MemberwiseClone() for Shallow |
27 | Boxing vs Unboxing | Boxing converts value type to object, Unboxing retrieves value type from object. | object obj = 10; (Boxing) vs int x = (int)obj; (Unboxing) |
28 | Implicit vs Explicit Conversion | Implicit is automatic; Explicit requires casting. | int x = 10; double d = x; vs double d = 10.5; int x = (int)d; |
29 | Delegate vs Event | Delegate is a function pointer, Event is a restricted delegate. | delegate void MyDelegate(); vs event MyDelegate MyEvent; |
30 | Thread vs Process | Thread is lightweight; Process is heavyweight. | Thread t = new Thread(); vs Process p = new Process(); |
If an error occurs, right-click on the project and unload it. Then, right-click again and choose 'Edit'. After
that, search for 'DevelopmentServerPort'. You will find the following lines
<DevelopmentServerPort>62343</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:62878/</IISUrl>
VISA Thumb and Interview Process:
Thumb Day:
On the DS-160 form, there is a "Completed On" date. This date must be within one year before the interview date.
For example, if you are attending the interview on January 2, 2024, the "Completed On" date should not be earlier than January 2, 2023. If it's incorrect, log in to the portal, update the date, and print the corrected form. Carry this updated printout with you. Otherwise, they might send you back, asking you to correct the date and return.
Today's required documents: Passport, DS-160 form, and appointment confirmation letter. These two printouts along with the original passport. You must attend with your thumb ready.
Interview Day:
Whatever information you entered in the DS-160 form will be asked during the interview. You must answer accurately and exactly as you filled in the form.
For example, if it’s about your date of birth, ensure you provide the exact details as mentioned in the form. Don’t provide more or less information than what’s in the form.
Today's required documents: Passport, DS-160 form, and appointment confirmation letter. These two printouts along with the original passport. If attending for B1, invitation letters are also needed. Additionally, original certificates, Xerox copies, salary-related payslips, and any other necessary documents would be better to carry.
I attended for B1. If someone else is inviting, they ask for a copy of their visa or passport. I heard them mentioning this there.
If you are going for this process, follow these steps. All the best!
The SQL query you've provided retrieves various properties related to the SQL Server instance using the SERVERPROPERTY
function. Here's a breakdown of each property:
SERVERPROPERTY('ProductVersion') AS Version
:
15.0.2000.5
for SQL Server 2019). It indicates the specific release version.SERVERPROPERTY('ProductLevel') AS ProductLevel
:
SERVERPROPERTY('Edition') AS Edition
:
SERVERPROPERTY('EngineEdition') AS EngineEdition
:
SERVERPROPERTY('MachineName') AS MachineName
:
SERVERPROPERTY('IsClustered') AS IsClustered
:
The result of this query would look something like this:
Version | ProductLevel | Edition | EngineEdition | MachineName | IsClustered |
---|---|---|---|---|---|
15.0.2000.5 | SP1 | Enterprise | 6 | MyServer | 0 |
This information can be useful for administrators to assess the configuration, version, and environment of the SQL Server instance.
To send an email in a SQL Server trigger using SMTP2GO, you’ll need to create a stored procedure that sends emails through SMTP and call this procedure from within your trigger. Here’s a step-by-step guide to setting this up.
First, ensure Database Mail is enabled on your SQL Server instance. Database Mail is required to send emails from SQL Server.
Set up SMTP2GO as the SMTP server in SQL Server Database Mail:
mail.smtp2go.com
2525
(or 587
/465
for secure connections)In the Database Mail configuration, add these SMTP server details.
Now, create a stored procedure to send emails through Database Mail. This stored procedure will be called from your trigger.
CREATE PROCEDURE SendEmailUsingSMTP2GO
@recipient NVARCHAR(255),
@subject NVARCHAR(255),
@body NVARCHAR(MAX)
AS
BEGIN
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'SMTP2GOProfile', -- Use the profile name you configured
@recipients = @recipient,
@subject = @subject,
@body = @body,
@body_format = 'HTML';
END
Replace 'SMTP2GOProfile'
with the actual profile name created for Database Mail.
Now, create a trigger that calls the SendEmailUsingSMTP2GO
stored procedure to send an email when a specific action occurs on the table.
CREATE TRIGGER trgSendEmailOnInsert
ON YourTableName
AFTER INSERT
AS
BEGIN
DECLARE @recipient NVARCHAR(255);
DECLARE @subject NVARCHAR(255);
DECLARE @body NVARCHAR(MAX);
-- Set the recipient, subject, and body of the email
SET @recipient = 'recipient@example.com';
SET @subject = 'New Record Inserted';
SET @body = 'A new record has been inserted into the table.';
-- Call the stored procedure to send the email
EXEC SendEmailUsingSMTP2GO
@recipient = @recipient,
@subject = @subject,
@body = @body;
END
Replace YourTableName
with the name of your table, and customize the @recipient
, @subject
, and @body
variables as needed.
Insert a row into YourTableName
to test if the trigger works and if the email is sent via SMTP2GO.
sql
INSERT INTO YourTableName (Column1, Column2) VALUES ('Value1', 'Value2');
If everything is set up correctly, you should receive an email at the specified recipient address.
If you're building a URL string dynamically in C#, you can use Uri.EscapeDataString
to ensure proper encoding:
string searchTerm = "rock&roll";
string query = $"https://example.com/search?query={Uri.EscapeDataString(searchTerm)}";
This approach will automatically encode any special characters, including &
, resulting in a safe and valid query string.
-- Declare a cursor to iterate through the sessions
DECLARE @sessionId INT;
DECLARE kill_cursor CURSOR FOR
SELECT session_id
FROM sys.dm_exec_sessions
WHERE database_id = DB_ID('DBName');
-- Open the cursor and loop through the sessions
OPEN kill_cursor;
FETCH NEXT FROM kill_cursor INTO @sessionId;
WHILE @@FETCH_STATUS = 0
BEGIN
-- Print the session ID to be killed (for verification purposes)
PRINT 'Killing session: ' + CAST(@sessionId AS VARCHAR(10));
-- Kill the session
EXEC('KILL ' + @sessionId);
FETCH NEXT FROM kill_cursor INTO @sessionId;
END
-- Close and deallocate the cursor
CLOSE kill_cursor;
DEALLOCATE kill_cursor;
You can create a unique constraint using the ALTER TABLE
command:
ALTER TABLE YourTableName ADD CONSTRAINT Unique_Constraint_Name UNIQUE (ColumnName);
This enforces a unique constraint on ColumnName
.