Comments for Chinh Do https://www.chinhdo.com/ Chinh's semi-random thoughts on software development, gadgets, and other things. Thu, 25 Sep 2025 16:14:52 +0000 hourly 1 https://wordpress.org/?v=6.8.3 Comment on How to switch to a different Kubernetes context or namespace? by cdo https://www.chinhdo.com/20231023/how-to-switch-to-a-different-kubernetes-namespace/comment-page-1/#comment-821621 Thu, 25 Sep 2025 16:14:52 +0000 https://www.chinhdo.com/?p=2913#comment-821621 In reply to Tad Od.

Hi Dat! Thank you for commenting on my blog!

]]>
Comment on How to switch to a different Kubernetes context or namespace? by cdo https://www.chinhdo.com/20231023/how-to-switch-to-a-different-kubernetes-namespace/comment-page-1/#comment-821620 Thu, 25 Sep 2025 16:14:27 +0000 https://www.chinhdo.com/?p=2913#comment-821620 In reply to Quan Do.

Thank you Quan! 🙂 Glad you liked the song.

]]>
Comment on How to switch to a different Kubernetes context or namespace? by Tad Od https://www.chinhdo.com/20231023/how-to-switch-to-a-different-kubernetes-namespace/comment-page-1/#comment-821619 Thu, 25 Sep 2025 06:35:26 +0000 https://www.chinhdo.com/?p=2913#comment-821619 Hello Didder hehe

]]>
Comment on How to switch to a different Kubernetes context or namespace? by Quan Do https://www.chinhdo.com/20231023/how-to-switch-to-a-different-kubernetes-namespace/comment-page-1/#comment-821618 Thu, 25 Sep 2025 06:35:12 +0000 https://www.chinhdo.com/?p=2913#comment-821618 Hello back chinh it is me quan do. Also datinator says “hello didder” We really like your song They Say. It actually pret good

]]>
Comment on Convert List<T>/IEnumerable to DataTable/DataView by DMITRIY SABITOV https://www.chinhdo.com/20090402/convert-list-to-datatable/comment-page-1/#comment-821237 Sat, 23 Nov 2024 12:32:35 +0000 https://www.chinhdo.com/20090402/convert-list-to-datatable/#comment-821237 Dear Chinh Do!

I suggest a slightly revised version of your code. As a result, you can get a datatable from an IEnumerable with values of value type and strings.

public static DataTable ToDataTable(IEnumerable input)
{
DataTable dt = new DataTable(typeof(T).Name);

PropertyInfo[] properties = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);

if (typeof(T).IsValueType || typeof(T) == typeof(System.String))
{
Type t = GetCoreType(typeof(T));
dt.Columns.Add(typeof(T).Name+”C”, t);
}
else
{
foreach (PropertyInfo property in properties)
{
Type t = GetCoreType(property.PropertyType);
dt.Columns.Add(property.Name, t);
}
}

foreach (T item in input)
{
if (typeof(T).IsValueType || typeof(T) == typeof(System.String))
{
dt.Rows.Add(item);
}
else
{
object[] values = new object[properties.Length];
for (int i = 0; i < properties.Length; i++)
{
values[i] = properties[i].GetValue(item, null);
}
dt.Rows.Add(values);
}
}
return dt;
}
public static Type GetCoreType(Type t)
{
if (t != null && IsNullable(t))
{
if (!t.IsValueType) { return t; }
else { return Nullable.GetUnderlyingType(t); }
}
else { return t; }
}
public static bool IsNullable(Type t)
{
return !t.IsValueType || (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable));
}

]]>
Comment on Tee-Object and Invoke-Expression in PowerShell by software akuntansi https://www.chinhdo.com/20100105/powershell-invoke-expression-tee-object/comment-page-1/#comment-819923 Tue, 31 Oct 2023 09:40:54 +0000 https://www.chinhdo.com/20100105/powershell-invoke-expression-tee-object/#comment-819923 software akuntansi

Tee-Object and Invoke-Expression in PowerShell – Chinh Do

]]>
Comment on Tee-Object and Invoke-Expression in PowerShell by school ict suites https://www.chinhdo.com/20100105/powershell-invoke-expression-tee-object/comment-page-1/#comment-819857 Thu, 19 Oct 2023 07:51:03 +0000 https://www.chinhdo.com/20100105/powershell-invoke-expression-tee-object/#comment-819857 school ict suites

Tee-Object and Invoke-Expression in PowerShell – Chinh Do

]]>
Comment on Tee-Object and Invoke-Expression in PowerShell by shooting eye protection https://www.chinhdo.com/20100105/powershell-invoke-expression-tee-object/comment-page-1/#comment-819821 Fri, 13 Oct 2023 17:46:02 +0000 https://www.chinhdo.com/20100105/powershell-invoke-expression-tee-object/#comment-819821 shooting eye protection

Tee-Object and Invoke-Expression in PowerShell – Chinh Do

]]>
Comment on Monitor & Visualize Your SmartThings Smart Home with Splunk by Chinh Do https://www.chinhdo.com/20200330/monitor-visualize-your-smart-home-with-splunk/comment-page-1/#comment-817720 Sun, 12 Feb 2023 01:23:33 +0000 https://www.chinhdo.com/?p=701#comment-817720 In reply to Jay Theriot.

Hi Jay, Yeah I just saw that it stopped working around Jan 11 of this year. I haven’t looked into it but when I have some time I will take a look. Thanks

]]>
Comment on Monitor & Visualize Your SmartThings Smart Home with Splunk by Jay Theriot https://www.chinhdo.com/20200330/monitor-visualize-your-smart-home-with-splunk/comment-page-1/#comment-817237 Mon, 02 Jan 2023 22:56:14 +0000 https://www.chinhdo.com/?p=701#comment-817237 Chinh, with smartthings switching over recently to processing things locally on the hubs and moving more to matter centric automation, my live logging is no longer visible on hub. Splunk is no longer logging the data. Have you found a workaround for this?

]]>