This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @sql NVARCHAR(2000) | |
WHILE(EXISTS(SELECT 1 from INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_TYPE='FOREIGN KEY')) | |
BEGIN | |
SELECT TOP 1 @sql=('ALTER TABLE ' + CONSTRAINT_SCHEMA + '.[' + TABLE_NAME + '] DROP CONSTRAINT [' + CONSTRAINT_NAME + ']') | |
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS | |
WHERE CONSTRAINT_TYPE = 'FOREIGN KEY' | |
EXEC(@sql) | |
PRINT @sql | |
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
//Class from: http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/all-operations-on-active-directory-ad-using-C-Sharp/ | |
namespace TestAD.ActiveDirectory | |
{ | |
class ADUserProperty | |
{ | |
public const String DESCRIPTION = "description"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using Microsoft.EnterpriseManagement; | |
using Microsoft.EnterpriseManagement.Common; | |
using Microsoft.EnterpriseManagement.Configuration; | |
using Microsoft.EnterpriseManagement.ConnectorFramework; | |
namespace SCSMTool.Framework |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.originalValues = ko.observableArray([]); | |
self.modifiedValues = ko.observableArray(self.originalValues.slice()); | |
//... | |
// user modified the self.modifiedValues() object interacting with the UI so now, we want to know the missing items | |
var marked = []; | |
ko.utils.arrayForEach(self.originalValues(), function (original) { | |
var exists = ko.utils.arrayFirst(self.modifiedValues(), function (item) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This final block, in your controller. | |
public const string SessionLangKey = "UsrLang"; | |
public ActionResult Language(string lang, string returnUrl) | |
{ | |
if (String.IsNullOrWhiteSpace(lang)) View("Index"); | |
switch (lang.ToLower()) | |
{ | |
case "en-EN": | |
case "es-ES": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DllImport("user32.dll")] | |
public static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vlc); | |
[DllImport("user32.dll")] | |
public static extern bool UnregisterHotKey(IntPtr hWnd, int id); | |
protected override void WndProc(ref Message m) | |
{ | |
if (m.Msg == 0x0312) | |
{ | |
//TODO: action here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void SetVisibleProperty(bool visible = false, params ToolStripItem[] controls) | |
{ | |
foreach (var ctrl in controls) | |
{ | |
ctrl.Enabled = visible; | |
if (ctrl is System.Windows.Forms.ToolStripMenuItem) | |
{ | |
var menu = ctrl as System.Windows.Forms.ToolStripMenuItem; | |
if (menu.DropDownItems.Count > 0) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- To know wich tables are Tracking enable | |
SELECT sys.schemas.name as Schema_name, sys.tables.name as Table_name FROM sys.change_tracking_tables | |
JOIN sys.tables on sys.tables.object_id = sys.change_tracking_tables.object_id | |
JOIN sys.schemas on sys.schemas.schema_id = sys.tables.schema_id | |
--Enable Tracking on 'abc' table | |
ALTER TABLE dbo.abc ENABLE CHANGE_TRACKING WITH (TRACK_COLUMNS_UPDATED = OFF) | |
-- More info: https://msdn.microsoft.com/en-us/library/bb933875%28v=sql.105%29.aspx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
using System.Windows.Forms; | |
using MainApplication.Service; | |
namespace MainApplication | |
{ | |
static class Program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM dbo.[TablaName] WHERE (ABS(CAST((BINARY_CHECKSUM(*) * RAND()) as int)) % 100) < 10 | |
-- Will select the half of rows | |
SELECT TOP 50 PERCENT * FROM dbo.[TablaName] Order By NewId() | |
-- MSDN Article: https://msdn.microsoft.com/en-us/library/cc441928.aspx |
NewerOlder