1: $Right = [System.Security.AccessControl.FileSystemRights]"Modify"2: $InheritanceFlag = ([System.Security.AccessControl.InheritanceFlags]::ContainerInherit, [System.Security.AccessControl.InheritanceFlags]::ObjectInherit)
3: $PropagationFlag = [System.Security.AccessControl.PropagationFlags]::InheritOnly
4: $objType =[System.Security.AccessControl.AccessControlType]::Allow
5: $objUser = New-Object System.Security.Principal.NTAccount("domain\username")6:
7: $objACE = New-Object System.Security.AccessControl.FileSystemAccessRule($objUser, $Right, $InheritanceFlag, $PropagationFlag, $objType)
8:
9: $objACL = Get-Acl “C:\test”
10: $objACL.AddAccessRule($objACE)
11: Set-ACL “C:\test” -aclobject $objACL
Thursday, November 20, 2014
Give modify permissions to the folder and subfolder using Power shell Script
Tuesday, November 11, 2014
Wednesday, October 15, 2014
Get 30 GB free in One Drive hurry…
Hey guys we can get 30 GB free in One Drive by turn on the auto upload in your smart phone. i have done in my phone
Now i have 30GB .. Thanks Microsoft :)
You can also get it now by simple configuring your Smartphone . Click here to get more information on this
PowerShell Script To build Visual Studio Project in Debug, Release modes
Recently i have got a requirement to build the visual studio project in release mode using PowerShell script . I have tried different ways by using Visual Studio command line and msbuild but nothing is worked . Finally i am able build the project with release mode and debug mode.
Here is the code …
Monday, September 1, 2014
Invalid field value for field "itr1.itr….incometax india efiling
Recently i have faced this issue during efilling . Here is the exception i got during the save
Here is the solution for this.
Don't enter .00 for money . ex (100.00) enter only actual value (Ex 100) and submit it .
Thursday, August 14, 2014
Get datatable from Gridview
protected void btnGetDatafromGrid_Click(object sender, EventArgs e){DataTable dtEmployees = new DataTable();dtEmployees.Columns.Add(new DataColumn { ColumnName = "Eno", DataType = typeof(Int32) });dtEmployees.Columns.Add(new DataColumn { ColumnName = "Ename", DataType = typeof(string) });foreach (GridViewRow grdRow in GridView1.Rows){DataRow drEmployeeRow = dtEmployees.NewRow();drEmployeeRow[0] = grdRow.Cells[1].Text;drEmployeeRow[1] = grdRow.Cells[2].Text;dtEmployees.Rows.Add(drEmployeeRow);}//Now you have fully loaded datatable from Gridif (dtEmployees.Rows.Count > 0){GridView1.DataSource = dtEmployees;GridView1.DataBind();}}
Wednesday, July 16, 2014
Get DataTable using asynchronous Programming
public static async Task<DataTable> GetDataAsync(string connectionString,string query){DataTable resultTable = new DataTable();try{ConnectionStringSettings connectionStringSettings = System.Configuration.ConfigurationManager.ConnectionStrings[connectionString];DbProviderFactory factory = DbProviderFactories.GetFactory(connectionStringSettings.ProviderName);using (DbConnection connection = factory.CreateConnection()){connection.ConnectionString = connectionStringSettings.ConnectionString;connection.Open();DbCommand command = connection.CreateCommand();command.CommandText = query;DbDataReader readers = command.ExecuteReader();DataTable schemaTable = readers.GetSchemaTable();foreach (DataRow dataRow in schemaTable.Rows){DataColumn dataColumn = new DataColumn();dataColumn.ColumnName = dataRow[0].ToString();dataColumn.DataType = Type.GetType(dataRow["DataType"].ToString());resultTable.Columns.Add(dataColumn);}readers.Close();command.CommandTimeout = 30000;using (DbDataReader reader = await command.ExecuteReaderAsync()){while (await reader.ReadAsync()){DataRow dataRow = resultTable.NewRow();for (int i = 0; i < resultTable.Columns.Count ; i++){dataRow[i] = reader[i];}Console.WriteLine(string.Format("From thread {0}-and data-{1}",System.Threading.Thread.CurrentThread.ManagedThreadId,dataRow[0]));resultTable.Rows.Add(dataRow);}}}}catch (System.Exception ex){Console.WriteLine(ex.Message);throw;}return resultTable;}
Friday, June 6, 2014
Start may not be called on a promise-style task.
Recently i have faced this issue . The problem here is The await keyword inside your asynchronous method is trying to come back to the UI thread.Since the User Interface thread is busy and waiting for the entire task to complete, you have a deadlock.Moving the async call to Task.Run() solves the issue.Because the async call is now running on a thread pool thread, it doesn't try to come back to the UI thread, and everything therefore works.
Alternatively, you can call StartAsTask().ConfigureAwait(false) before awaiting the inner operation to make it come back to the thread pool rather than the UI thread, avoiding the deadlock entirely.
Here is the working code to avoid the above exception
1: private void GetData(string text)2: {3: var task = Task.Run(async () => { await GetDataAsync(sqlQuery); });4: task.Wait();5: }6:
Monday, June 2, 2014
Detecting the Browser using jQuery including IE 11
Recently one of the team member got the issue with IE 11 while writing the code to detect the browser.The browser detection code what he has written is not working with IE 11 . The issue here is Microsoft keep updating the User Agent String every time when new IE version released ..
To fix the issue i made few changes and now it is working .
Here is the code to detect the browser including IE 11
<script type="text/javascript" >function GetBrowserDetails() {var ua = window.navigator.userAgentvar msie = ua.indexOf("MSIE ")// If Internet Explorer, return version numberif (msie > 0)return parseInt(ua.substring(msie + 5, ua.indexOf(".", msie)))// If Internet Explorer 11 handling differently becaue UserAgent string updated by Microsoftelse if (!!navigator.userAgent.match(/Trident\/7\./))return 11;else//If another browser just returning 0return 0}if (GetBrowserDetails() > 0)alert("Hey This is Internet Explorer and the version no is " + GetBrowserDetails());elsealert("Hey This is not IE browser");</script>
Tuesday, May 20, 2014
Tuesday, May 6, 2014
The type 'xxxxx' and the type 'yyyyyy' both have the same simple name of and so cannot be used in the same model. All types in a given model must have unique simple names. Use 'NotMappedAttribute' or call Ignore in the Code First fluent API to explicitly exclude a property or type from the model.
Recently i have faced this issue with Entity Framework . The issue occurs when dbset property refers the Mapping class instead of Entity . I fixed the issue by changes the dbset property entity type (Instead of mapping class referred Entity class).
Here are the rules
- The dbset property should have the Entity
- In model creating we should specify the mapping class
Working Example
As you see below screen shot the first one(dbset property for Contractor Visits) referred the POCO entity
and in the configuration referred the Mapping class of ContractorVisist.
Now it worked fine . Let me know if you still facing any issues ..
Tuesday, April 1, 2014
Hide console window when using processor class in c#
psi = new ProcessStartInfo("exe path"));psi.CreateNoWindow = true;psi.UseShellExecute = false;process = System.Diagnostics.Process.Start(psi);process.StartInfo.UseShellExecute = false;process.StartInfo.CreateNoWindow = true;process.WaitForExit();
Thursday, March 13, 2014
Disable .pdb file generation in Release Mode
Here are the steps to disable the .pdb file generation
Visual Studio – Compile Options
In Visual Studio 2005, .pdb file gets generated in Debug mode and Release mode.
In debug mode it loads the entire symbol table, in Release mode it loads the key symbols.
In Release mode, the generated .pdb can be deleted very well deleted. (Because framework does not uses it)
To disable .pdb generation in Release mode, goto
Project Properties > Compile Tab > Advanced Compile Options
Thursday, February 6, 2014
LoadLibraryEx failed on aspnet_filter.dll
Recently I have got this error
The issue here is IIS is trying to load a 32 bit ISAPI filter in 64 bit operating system
To fix the issue we needs to configure the issue occurred WebSite -Application pool ->Advance settings
-->Enable 32-bit applications to "True" and try …. It will work
Tuesday, January 21, 2014
Solution for Queue build with shelveset not working with VS 2013 issue
There is a Bug with VS 2013 . You cannot run the builds with shelve set . You can see by default “What do you want to build” field is disabled
To fix this issue we needs to install one of the hotfix which is provided by Microsoft. Here is the link for that
http://download.microsoft.com/download/6/C/D/6CD8507E-E11A-46DC-AE13-663ECAB66E18/VS12-KB2898341.exe
Note: You needs to stop the all Visual Studio instances while installing and after installation completed you should restarts the VM to affect these changes
Now you will get the “What do you want to build” field is enabled
Happy Coding :)