Wednesday, October 11, 2017

line height CSS

What is Line Height in CSS?


- Line Height property defines amount of height in which text content is written in HTML.

Properties of Line Height:

Normal: 

This is default Height line, generally around 100% to 120%. 

e.g.: Default Height line in word document.

Number:

A number that will be multiplied with the current font size to set the line height.

Length:

 Fixed Length in px, pt etc.

Percentage: 

% of current font size.

Initial:

Set to default value.

Inherit:

Inherit from Parent.

Please find the example below for more detail,

HTML





Output


normal line height.
normal line height.
percentage line height.
percentage line height.
length line height.
length line height.

Sunday, October 8, 2017

Application's path in a .NET console application

How can I get the application's path in a .NET console application? OR Get path for my assembly.

System.Reflection.Assembly.GetEntryAssembly().Location;

Thursday, October 5, 2017

Using Replace in Update statement SQL

Using Replace in Update statement SQL

Suppose you have following table 'MasterData' table in SQL,


You want to replace '!!' by '{{' and '||' by '}}' in data column of table. How would you do it.

=> You can do it by using Replace function in Update statement of SQL Server as below,


UPDATE dbo.MasterData
SET Value = REPLACE(REPLACE(Data, '!!', '{{'),'||','}}')

WHERE ID = 1

Inner Replace function is used for replacing '!!' characters and outer replace function is used to replace  '||'.


Monday, September 25, 2017

How to assign default or null or empty parameter to Guid

One of my friend working on one project, and he wants to assign the null / Empty / default parameter to guid,

public void SampleFunction(Guid guidParameter = Guid.Empty)
{
}
But the compiler complains that Guid.Empty is not a compile time constant.
Solution 
We can use,
public void SampleFunction(Guid guidParameter = new Guid()){
  // when called without parameters this will be true
  var guidIsEmpty = guidParameter == Guid.Empty;}
When we call above method, without any paramter, then it will assign "Empty" Value to the guidParameter, so in that case "guidIsEmpty"  will be true.
We can also use default(Guid) instead of "new Guid()",  it will work same.

Why didn't Guid.Empty work?

The reason you are getting the error is because Empty is defined as:
public static readonly Guid Empty;
So, it is a variable, not a constant (defined as static readonly not as const). Compiler can only have compiler-known values as method parameters default values (not runtime-only-known).
Note:
Guid.Empty is equivalent to new Guid(), which is equivalent to default(Guid). So you can use:
Assign Guid.Empty value to Guid
public void SampleFunction(Guid guidParameter = default(Guid))
or
public void SampleFunction(Guid guidParameter = new Guid())
Assign Null value to Guid 
public void SampleFunction(Guid? guidParameter = null)



Saturday, September 16, 2017

Fiddler Wildcard AutoResponse For URL parameters

Suppose you want to enable autoresponder for perticular URL like,

https://dotnetpeoples.blogspot.in/Employee/Login?id=12345

but every time id changes when we re-fresh this page, so autoresponder not considering it,

so just do below 2 steps it will work for you guys,


Step 1:  Enable Automatic responses & unmatched request passthrough



Step 2: In Rule Editor Changed below URL as,

Exact:https://dotnetpeoples.blogspot.in/Employee/Login?id=12345  Changed to

REGEX: https://dotnetpeoples.blogspot.in/Employee/Login.*


Just replace querystring to .*

Thursday, January 5, 2017

How to set identity specification set to false globally in entity framework


We can globally turn off this feature by removing StoreGeneratedIdentityKeyConvention Convention as below,

public class OurContext : DbContext 
{    
protected override void OnModelCreating(DbModelBuilder modBuilder) {        modBuilder.Conventions.Remove<StoreGeneratedIdentityKeyConvention>();    
}
}

Thursday, December 22, 2016

microsoft visual studio can not set breakpoint in c# file

Microsoft visual studio can not set breakpoint in c# file

I was getting same error in one of my project, and after 15 to 20 mins of search & practical i found very simple solution as below,

BUILD > Clean Solution

BUILD > Build Solution

Hope it will help you guys.