How To Get The Current SharePoint User That Is Logged In Using C#



TODO:

Have you ever wanted to get the current user that is logged into SharePoint?

 

SOLUTION:

//set textfield to the user
txtModificationBy.Text = this.Web.CurrentUser.LoginName;

 

NOTES:

There are no notes on this topic.

How To Print Messages In a SQL Server Stored Procedure



TODO:

Have you ever wanted to print output messages in a stored procedure?

 

SOLUTION:

PRINT 'some string'

PRINT 'some string' + @SomeVariable

 

NOTES:

Note, if you are concatenating a numeric variable you will need to cast it to Varchar

How To Enable Disk Cleanup In Windows Server 2012



TODO:

Have you ever wanted to enable the Disk Cleanup tool in Windows Server 2012?

 

SOLUTIONS:

To enable this tool, you have to install the Desktop Experience Feature, which is located in Control Panel -> Programs and Features -> Turn Windows Features On and Off ->Add Roles and Features -> Features.

 

NOTES:

There are no notes on this topic.

The Many Boot Modes Of Mac OSX Lion



TODO:

Have you ever wanted to boot to recovery or safe mode?

 

SOLUTION:

Target Disk Mode

Option + T

Command Line Mode

Command + S

type fsck -cy

 

Recovery Mode or Selectable Boot Mode

Command + R or Option

 

Safe Mode

Hold Shift after startup tone on boot

Release when you see the Apple in the center of the screen


NOTES:

There are no notes on this topic

Internal Speaker Stops Working After Unplugging Headphones On A MacBook Pro



TODO:

Have  you ever unplugged your headphones, and the internal speaker does not work, and it is simply greyed out?  You will also see a red light coming out of the headphone jack.

 

SOLUTION:

Use a toothpick and wiggle it in the headphone jack hole.  You can also insert and remove the headphones a few times and the internal speaker should kick on.

 

NOTES:

Sees to be a sensor gets stuck that turns on the Optical Input inside the headphone jack.

How To Drop A Column From A Table In SQL Server Using T-SQL



TODO:

Have you ever wanted to drop a column to an existing SQL Server Table using T-SQL?

 

SOLUTION:

ALTER TABLE Customer DROP COLUMN FavoriteColor

 

NOTES:

There are no notes on this topic

How To Add A Column To An Existing Table In SQL Server Using T-SQL



TODO:

Have you ever wanted to add a column to an existing SQL Server Table using T-SQL?

 

SOLUTION:

ALTER TABLE Customer ADD FavoriteColor VARCHAR(20)

 

NOTES:

There are no notes on this topic

How To Use BulkCopy To Insert A DataTable In C#



TODO:

Have you ever wanted to insert the contents of a DataTable efficiently using SqlClient.BulkCopy?

 

SOLUTION:

public static void FillMonteCarloSimulationResults(DataTable InDataTable)
{
     using (SqlBulkCopy bulkCopy = new SqlBulkCopy("myconnectionstring")
     {
          //***NOW Do column mappings.  This maps columns from DataTable (left) to DB Table (right)
          bulkCopy.DestinationTableName = "Results";
          bulkCopy.ColumnMappings.Add("EmployeeId", "EmployeeId");
          bulkCopy.ColumnMappings.Add("Name", "Name");
          bulkCopy.WriteToServer(InDataTable);            
     }
}

 

NOTES:

This example will take the DataTable, map the columns, then preform BulkCopy

How To Fix "Could not load file or assembly '$SharePoint.Project.AssemblyFullName$" Error When Adding HttpHandler To SharePoint Application Project



 

TODO:

You add a HTTPHandler to your SharePoint project, and  you get the following error : "Parser Error Message: Could not load file or assembly '$SharePoint.Project.AssemblyFullName$' or one of its dependencies. The system cannot find the file specified."

  

SOLUTION:

The fix is simple, do the following:

1.  Open your project file in NotePad

2.  Find the PropertyGroup nodes.

3.  Add a new PropertyGroup node.

<PropertyGroup>

     <TokenReplacementFileExtensions>ashx;</TokenReplacementFileExtensions>

 </PropertyGroup>

4.  Re-Open your project file


NOTES:

There are no notes on this topic.

How to Change Application Page Title Dynamically In C# Code Behind



TODO:

Have you ever wanted to change the title of your Application Page dynamically?

 

SOLUTIONS:

protected void SetPageTitles(string Title)
{
     ContentPlaceHolder contentPlaceHolder = (ContentPlaceHolder)Page.Master.FindControl("PlaceHolderPageTitle");
     contentPlaceHolder.Controls.Clear();
     LiteralControl title = new LiteralControl();
     title.Text = Title;
     contentPlaceHolder.Controls.Add(title);

     contentPlaceHolder = (ContentPlaceHolder)Page.Master.FindControl("PlaceHolderPageTitleInTitleArea");
     contentPlaceHolder.Controls.Clear();
     title = new LiteralControl();
     title.Text = Title;
     contentPlaceHolder.Controls.Add(title);
}

 

NOTES:

There are no notes on this topic.