Connect to SQL Server with Windows Authentication in a different domain - Database Administrators Stack Exchange:
runas /netonly /user:domain\username "C:\path_to\ssms.exe""
Saturday, 28 January 2017
Friday, 26 August 2016
Enable/Disable Network interface via command line - Microsoft Community
Enable/Disable Network interface via command line - Microsoft Community:
"netsh interface set interface name="Local Area Connection" admin=disabled"
'via Blog this'
Get NIC list and index number:
"netsh interface set interface name="Local Area Connection" admin=disabled"
'via Blog this'
Get NIC list and index number:
wmic nic get name, index
Enable NIC with index number: (eg: 7)
wmic path win32_networkadapter where index=7 call enable
Disable NIC with index number: (eg: 7)
wmic path win32_networkadapter where index=7 call disable
Enable NIC with index number: (eg: 7)
wmic path win32_networkadapter where index=7 call enable
Disable NIC with index number: (eg: 7)
wmic path win32_networkadapter where index=7 call disable
netsh interface set interface name="Local Area Connection" admin=disabled
Tuesday, 14 June 2016
Thursday, 2 June 2016
Tuesday, 12 April 2016
Generate Bitmap containing Centered Text
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication14
{
class Program
{
static void Main(string[] args)
{
string txt = "HELLO";
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(131, 50);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp);
g.Clear(System.Drawing.Color.DarkGreen);
System.Drawing.Font f = new System.Drawing.Font("Courier", 25, System.Drawing.FontStyle.Bold);
System.Drawing.SizeF szf = new System.Drawing.SizeF();
szf = g.MeasureString(txt, f);
int xoff = (int)((bmp.Width - szf.Width) /
2);
g.DrawString(txt, f, System.Drawing.Brushes.Red, new System.Drawing.Rectangle(/*x*/xoff, /*y*/0, bmp.Width, bmp.Height));
bmp.Save("c:/temp/xxx.bmp");
}
}
}
C# Formax XML
// Load the XmlDocument with the XML.
document.LoadXml(fp.FetchXml);
writer.Formatting = System.Xml.Formatting.Indented;
// Write the XML into a formatting XmlTextWriter
document.WriteContentTo(writer);
writer.Flush();
mStream.Flush();
// Have to rewind the MemoryStream in order to read
// its contents.
mStream.Position = 0;
// Read MemoryStream contents into a StreamReader.
System.IO.StreamReader sReader = new System.IO.StreamReader(mStream);
// Extract the text from the StreamReader.
String FormattedXML = sReader.ReadToEnd();
string[] Result = FormattedXML.Replace("\r", "").Split(new char[] { '\n'});
foreach (string s in Result)
Consolw.WriteLine("{0}", s);
document.LoadXml(fp.FetchXml);
writer.Formatting = System.Xml.Formatting.Indented;
// Write the XML into a formatting XmlTextWriter
document.WriteContentTo(writer);
writer.Flush();
mStream.Flush();
// Have to rewind the MemoryStream in order to read
// its contents.
mStream.Position = 0;
// Read MemoryStream contents into a StreamReader.
System.IO.StreamReader sReader = new System.IO.StreamReader(mStream);
// Extract the text from the StreamReader.
String FormattedXML = sReader.ReadToEnd();
string[] Result = FormattedXML.Replace("\r", "").Split(new char[] { '\n'});
foreach (string s in Result)
Consolw.WriteLine("{0}", s);
Serialize CRM Object
namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
Microsoft.Xrm.Sdk.Entity E = new Microsoft.Xrm.Sdk.Entity("entity");
System.Runtime.Serialization.DataContractSerializer Sz =
new System.Runtime.Serialization.DataContractSerializer(typeof(Microsoft.Xrm.Sdk.Entity));
StringBuilder sb = new StringBuilder();
System.IO.MemoryStream ms = new System.IO.MemoryStream();
Sz.WriteObject(ms, E);
string str = Encoding.ASCII.GetString(ms.ToArray());
}
}
}
{
class Program
{
static void Main(string[] args)
{
Microsoft.Xrm.Sdk.Entity E = new Microsoft.Xrm.Sdk.Entity("entity");
System.Runtime.Serialization.DataContractSerializer Sz =
new System.Runtime.Serialization.DataContractSerializer(typeof(Microsoft.Xrm.Sdk.Entity));
StringBuilder sb = new StringBuilder();
System.IO.MemoryStream ms = new System.IO.MemoryStream();
Sz.WriteObject(ms, E);
string str = Encoding.ASCII.GetString(ms.ToArray());
}
}
}
Subscribe to:
Posts (Atom)