SELECT *
FROM sys.objects
WHERE schema_id = SCHEMA_ID('schemaName') and type='U'
'U' stands for User table.
Just some random development ramblings mostly related to the Microsoft .NET platform.
Thursday, November 1, 2018
Wednesday, August 29, 2018
Windows Explorer: Search for files/folders with exact name only
Once and a while I want to search a directory structure and find all the files or folders that only match a specific name only. Here is the quick way to do this in the Windows Explorer search box (Ctrl-E):
File
name:=seachName
Folder
kind:=folder name:=searchName
Thursday, February 22, 2018
Spectacularly simple and flexible jQuery drop-down plugin (Bootstrap 4)
Here is a very simple, yet flexible, custom drop-down selection control. Very lightweight JavaScript and all the needed options. You can also register to be notified of a selection and have it pass you a HTML "data-" tag value. You'll need jQuery and Bootstrap.
Note: You write your use normal Bootstrap 4 drop-down menu code, then just create an instance of the plugin, and wah-lah! Very nice.
Give it a whirl on on JsFiddle.
Note: You write your use normal Bootstrap 4 drop-down menu code, then just create an instance of the plugin, and wah-lah! Very nice.
Give it a whirl on on JsFiddle.
Tuesday, January 23, 2018
[Solved] Convert complex C#/JSON object to query string, ASPNET Core 2.0
I had to call an internal web page using HttpClient to get the HTML. The Razor Page's OnGetAsync expected a C# complex object (nested types) as a parameter. Here is a string extension, JsonAsQueryString, to convert a complex object into a query string for ASPNET Core 2.0. I just converted the C# complex object to JSON using JsonConvert.Serialize, then use this extension method.
public static class StringExtensions
{
public static string JsonAsQueryString(this string json)
{
return ParseJObject(json, string.Empty);
}
private static string ParseJObject(string json, string parentField = "")
{
var jo = (JObject)JsonConvert.DeserializeObject(json);
var query = String.Join("&",
jo.Children().Cast<JProperty>()
.Select(jp => StringExtensions.ParseJProperty(jp, parentField)));
return query;
}
private static string ParseJProperty(JProperty jp, string parentField)
{
var parentFormat = string.IsNullOrWhiteSpace(parentField) ? string.Empty : $"{parentField}.";
if (jp.Value as JArray != null)
{
// this object is an array; repeat names
var tokens = string.Join("&", jp.Value
.Select(t => $"{parentFormat}{jp.Name}={HttpUtility.UrlEncode(t.ToString())}"));
return tokens;
}
else if (jp.Value.Type == JTokenType.Object)
{
// nested object; make a recursive call
return StringExtensions.ParseJObject(jp.Value.ToString(), $"{parentFormat}{jp.Name}");
}
else
{
// normal member
return $"{parentFormat}{jp.Name}={HttpUtility.UrlEncode(jp.Value.ToString())}";
}
}
}
Subscribe to:
Posts (Atom)
Can't RDP? How to enable / disable virtual machine firewall for Azure VM
Oh no! I accidentally blocked the RDP port on an Azure virtual machine which resulted in not being able to log into the VM anymore. I did ...
-
Oh no! I accidentally blocked the RDP port on an Azure virtual machine which resulted in not being able to log into the VM anymore. I did ...
-
Here is a full test program that demonstrates how to use SharpZipLib to zip an XElement into a byte array. This allows you to transfer larg...