SELECT CURRENT_TIMESTAMPor
SELECT {fn NOW()}orSELECT GETDATE()
My .Net programming notes.
static string ByteArrayToString1(byte[] source) { StringBuilder sb = new StringBuilder(); foreach (byte item in source) { sb.AppendFormat("{0:x2}", item); } return sb.ToString(); } static string ByteArrayToString2(byte[] source) { return BitConverter.ToString(source).Replace("-", ""); } static string ByteArrayToString3(byte[] source) { // namespace: System.Runtime.Remoting.Metadata.W3cXsd2001 return new SoapHexBinary(source).ToString(); } static string ByteArrayToString4(byte[] source) { // works for .Net 4 only return String.Concat(Array.ConvertAll(source, x => x.ToString("X2"))); }
enum Week { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday }
foreach (Week item in Enum.GetValues(typeof(Week))) { //... }
static Int64 IPv4StringToInt64(string ipv4String) { Int64 ipInteger = 0; try { ipInteger = (long)(uint)IPAddress.NetworkToHostOrder(BitConverter.ToInt32(IPAddress.Parse(ipv4String).GetAddressBytes(), 0)); } catch (Exception) { } return ipInteger; }
static string IPv4Int64ToString(Int64 ipv4Int64) { if (ipv4Int64 < 0) return "0.0.0.0"; else if (ipv4Int64 < 4294967295) return IPAddress.Parse(ipv4Int64.ToString()).ToString(); else return "255.255.255.255"; }Usage:
Console.WriteLine("255.255.255.0 => " + IPv4StringToInt64("255.255.255.0")); Console.WriteLine("4294967040 => " + IPv4Int64ToString(4294967040));
OpenFileDialog FileDialog = new OpenFileDialog();
FileDialog.Title = "Open XML Document";
FileDialog.Filter = "XML file (*.xml)|*.xml";
if (FileDialog.ShowDialog() == DialogResult.OK)
{
WebBrowser1.Navigate(FileDialog.FileName);
WebBrowser1.Refresh();
}I found that if I load the second XML, sometimes it will not refresh itself to show the new XML content. Instead, it still shows the previous one. I google the web to see if there is any other way to prevent the cache. Unfortunately, I found nothing. But this post inspires me and so I create a workaround.