So Bootstrap has great drop down UI control. How about improve it. So I just created a code pen to enhance some UI features of bootstrap drop down.
So I have added some animations using Animate.css and some custom CSS.
So Bootstrap has great drop down UI control. How about improve it. So I just created a code pen to enhance some UI features of bootstrap drop down.
So I have added some animations using Animate.css and some custom CSS.
Dependency Injection
It is a software design pattern that implements the Inversion of control. Dependency injection is vital for loosely coupled software development.
So I just created a video to Show you guys How to implement Unity Dependency Injection in ASP.NET MVC
So I got this error while working

It says no permission on object sp_delete_database_backuphistory. I get it fixed from granting execution permission to above object
USE msdb; GRANT EXEC ON dbo.sp_delete_database_backuphistory TO PUBLIC
Things can go wrong in sql operation. So how we handle Errors in sql server.
We can detect errors in two ways
@@ERROR
If there is no errors based on the last operation @@ERROR will be set to 0 . If something went wrong it will be set to value other than 0. How ever this not best way to handle errors in sql server.
TRY/CATCH
BEGIN TRY -- this is where we put our codes that can be generate errors END TRY BEGIN CATCH -- this where we put code to handle errors END CATCH
Big thing in TRY block is always we’re going to assume success because only way that we’re going to get to the next line of code is if the line before is succeeded
Transactions in sql server must be Isolated. It means that if a transaction is running and somebody else comes along and there’re trying to work with data that previous transaction working with, they’re not allowed to touch that.
Sql server handle this problem using concurrency and locks.
Concurrency is the process of managing who has access to data.
The way that access to data is managed by locks.
Locks:
One of the issue with locks is it is bit of overhead.
Locks can be maintained at a few levels
1.Row level
2.Page level
3.Table level
Make sure that do locks as little data as possible and for as short a period of time as possible
Why transactions.
We generally works with multiple tables in one operation. May be we want to insert data to order header and order detail table in one operation. Then what happens if only part of the operation succeeds. Some statements can be failed.
So we are with lot of possible problems inside our database when it comes to data integrity . This is where we need transactions.
Transactions will allow us to control the entirety of an operation and ensure that everything’s going to succeed or everything is going to get rolled back should something fail.
Transaction must meet ACID.
ACID is comprised with four different components.
A -> Atomic
Entire operation must succeed or the entire operation must fail, and it must do so as a single unit
C -> Consistent
Once the operation is complete, database must be left in a consistent or in a valid state
I -> Isolated
Every transaction must also be isolated, simply meaning that somebody else’s operation at the same time that I’m working on my data, is not allowed to impact my operation.
D -> Durable
The database should be durable enough to hold all its latest updates even if the system fails or restarts
There are three main commands in managing transaction manually.
This will mark the start of the transaction
2.COMMIT TRANSACTION
We are going to execute this once we know everything is works fine.
3.ROLLBACK TRANSACTION
If some thing went wrong we are going to execute this one. We got some errors and we want to Rollback the transaction.
Sliding menu is great controller in mobile. We can create amazing sliding menu in Ionic without more troubles. actually it is very easy.
I Just created a video on How to creating amazing sliding menu in Ionic.
My One of Clients came with a new requirement. It is creating Mobile app for his business. Actually It was mobile CRM application. So in that moment I didn’t have any mobile application development experience.
But Actually I wanted to experience Mobile application development. So I experienced some technologies. After doing some researches I came up with Ionic framework.
It was very easy to learn and I did quick learn and I could deliver perfect app for my client.
So I thought it is good to do some post about Ionic. So I created a Video on How to create sample Ionic Tabview app.
I thought it may help some one.
Some times we have to use our own Modal binding mechanism in MVC. In MVC default Modal binding machansim is perfect. It binds our modal to posted variables . We can create our custom Modal binder. We can use DefaultModalBinder Or IModalBinder to do that. In following video you can find Custom ModalBinder Using IModalBinder.
Some times Reading Excel files can be bit cumbersome. I needed to allow user to upload excel document and read data from excel file. So I followed following way to get it done.
private void button1_Click(object sender, EventArgs e)
{
DataSet ds = new DataSet();
Excel.Application xlApp = new Excel.Application();
Excel.Workbook xlWorkBook;
Excel.Worksheet xlWorkSheet;
Excel.Range range;
xlWorkBook = xlApp.Workbooks.Open(Application.StartupPath + "\\sample.xlsx", 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
range = xlWorkSheet.UsedRange;
// read data and bind to grid view
System.Data.DataTable dt = new System.Data.DataTable("dtExcel");
ds.Tables.Add(dt);
DataRow dr;
StringBuilder sb = new StringBuilder();
int jValue = xlWorkSheet.UsedRange.Cells.Columns.Count;
int iValue = xlWorkSheet.UsedRange.Cells.Rows.Count;
for (int j = 1; j <= jValue; j++)
{
dt.Columns.Add("column" + j, System.Type.GetType("System.String"));
}
for (int i = 1; i <= iValue; i++)
{
dr = ds.Tables["dtExcel"].NewRow();
for (int j = 1; j <= jValue; j++)
{
range = (Microsoft.Office.Interop.Excel.Range)xlWorkSheet.Cells[i, j];
string strValue = range.Text.ToString();
dr["column" + j] = strValue;
}
ds.Tables["dtExcel"].Rows.Add(dr);
}
dataGridView1.DataSource = ds.Tables[0];
xlWorkBook.Close(true, null, null);
xlApp.Quit();
// release object
releaseObject(xlWorkSheet);
releaseObject(xlWorkBook);
releaseObject(xlApp);
}
private void releaseObject(object obj)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
obj = null;
}
catch (Exception ex)
{
obj = null;
MessageBox.Show("Unable to release the Object " + ex.ToString());
}
finally
{
GC.Collect();
}
}