{"id":2472,"date":"2022-09-11T09:23:31","date_gmt":"2022-09-11T14:23:31","guid":{"rendered":"http:\/\/ninmonkeys.com\/blog\/?p=2472"},"modified":"2023-05-11T18:23:25","modified_gmt":"2023-05-11T23:23:25","slug":"experiments-of-2022-09","status":"publish","type":"post","link":"https:\/\/ninmonkeys.com\/blog\/2022\/09\/11\/experiments-of-2022-09\/","title":{"rendered":"Experiments of 2022-09"},"content":{"rendered":"\n\n\n<p><\/p>\n\n\n\n<h2>Power BI \/ Power Query<\/h2>\n\n\n\n<p>Things to note<\/p>\n\n\n\n<ul><li><code class=\"\" data-line=\"\">options<\/code> is an record, when used this way it&#8217;s similar to Python&#8217;s <code class=\"\" data-line=\"\">kwargs<\/code><\/li><li>Merging two records with update the existing fields, adding new fields, if they do not yet exist<\/li><li>(in PowerQuery) the order of steps don&#8217;t change the final result (order of execution is the same)  That&#8217;s why <code class=\"\" data-line=\"\">defaults<\/code> after <code class=\"\" data-line=\"\">config<\/code> works<\/li><li>Sometimes readability improves when placing large &#8220;blocks&#8221; like <code class=\"\" data-line=\"\">values_list<\/code> out of order so the logic is on top<\/li><li>I replaced values *before* converting them to text so you have more control (before coercion )<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-powerquery\" data-line=\"\">Text.JoinSpecialValues_impl = (source as list, optional options as nullable record) as text =&gt;\n    let\n            config = Record.Combine({defaults, options ?? []}),\n            defaults = [\n                Separator = &quot;|&quot;,\n                UseSpecialSymbols = true\n            ],\n            text_list = List.Transform( values_list, Text.From),\n            joined_string =  Text.Combine( text_list, config[Separator] ),\n            values_list  = if not config[UseSpecialSymbols] then source else\n                List.ReplaceMatchingItems( source,\n                    {\n                        \/\/ replace true null, and true empty strings (vs whitespace)\n                        { null, &quot;\u2400&quot;},\n                        { &quot;#(cr,lf)&quot;, &quot;#(240d)\u2424&quot; }, \/\/ is #(2424)&quot; }\n                        { &quot;#(lf)&quot;, &quot;\u2424&quot; }, \/\/ is #(2424)&quot; }\n                        {&quot;&quot;, &quot;\u2420&quot;}\n                    } ) \n\n        in\n            joined_string,<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"890\" height=\"867\" src=\"https:\/\/ninmonkeys.com\/blog\/wp-content\/uploads\/2022\/09\/image-1.png\" alt=\"\" class=\"wp-image-2495\" srcset=\"https:\/\/ninmonkeys.com\/blog\/wp-content\/uploads\/2022\/09\/image-1.png 890w, https:\/\/ninmonkeys.com\/blog\/wp-content\/uploads\/2022\/09\/image-1-300x292.png 300w, https:\/\/ninmonkeys.com\/blog\/wp-content\/uploads\/2022\/09\/image-1-768x748.png 768w\" sizes=\"(max-width: 890px) 100vw, 890px\" \/><figcaption><a href=\"https:\/\/github.com\/ninmonkey\/ninMonkQuery-examples\/tree\/ea3162276945204ec12de10742b34ef6de38ff1e\/Types\">Power Query and Report.pbix<\/a> (permalink) at <a href=\"https:\/\/github.com\/ninmonkey\/ninMonkQuery-examples\/tree\/main\/Types\">github:\/\/ninmonkey<\/a><\/figcaption><\/figure>\n\n\n\n<p> <\/p>\n\n\n\n<h2>Powershell <\/h2>\n\n\n\n<h3>Goto Everything <\/h3>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-powershell\" data-line=\"\">Goto \/c\/foo\/bar\n\n# go back\n&gt; Goto -Back\n&gt; Goto &#039;-&#039;    # normal cd history works too\n&gt; Goto &#039;+&#039;\n\n# Goto the world\n$Profile            | goto  # go to string&#039;s path\nGet-Item $PROFILE   | goto  # cd to the FileItem&#039;s path\ngcm EditFunc        | goto  # jump to function declaration\ngmo NameIt          | Goto  # go to module&#039;s folder\n[CompletionResult]  | goto  # to docs for\n# &lt;https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/System.Management.Automation.CompletionResult&gt;\n\n# Open git repos in browser\ngoto git microsoft\/powerquery-parser | goto\ngoto git@github.com:microsoft\/powerquery-parser.git | goto \n\n# goto the newest log\nGet-ChildItem &#039;c:\\root\\manyLogs&#039; -Recurse\n| Sort LastWriteTime -desc -top 1 | goto<\/code><\/pre>\n\n\n\n<h3>Pwsh Cli<\/h3>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/ninmonkeys.com\/blog\/wp-content\/uploads\/2022\/09\/Pwsh-\u2510-VS-Code-Snippet-2022-07-part1-export-1.mp4\"><\/video><figcaption>Display all parameters<br>My favorite hotkey, <code class=\"\" data-line=\"\">ctrl+spacebar<\/code> <\/figcaption><\/figure>\n\n\n\n<p>s<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/ninmonkeys.com\/blog\/wp-content\/uploads\/2022\/09\/VsCode-\u2510-pwsh-generates-all-possible-params-vs-mandatory-2022-07-export-1.mp4\"><\/video><\/figure>\n\n\n\n<figure class=\"wp-block-video\"><\/figure>\n\n\n\n<h3>Breaking Formatting<\/h3>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-powershell\" data-line=\"\">2, 40, 100, 200, 400, &lt;#700, 2000,#&gt; 20000 | %{ $i=$_;\n  0..10 | %{ $j = $_;\n    0..3000 | Get-Random -Count 300 | %{ $k = $_\n      [pscustomobject]@{ DisplayString = [string]$_ }} | fw -Column $i }\n        &quot;Was: $i&quot;\n        sleep -sec 0.7 }\n<\/code><\/pre>\n\n\n\n<p>Is it a bug, or,  is the extra y-axis padding working as intended in a situation where intended is not intended ( ie: column count orders of magnitude larger than the terminal&#8217;s column count )<\/p>\n\n\n\n<h2>Excel functions: What&#8217;s New<\/h2>\n\n\n\n<p><a href=\"https:\/\/insider.office.com\/en-us\/blog\/text-and-array-manipulation-functions-in-excel\">https:\/\/insider.office.com\/en-us\/blog\/text-and-array-manipulation-functions-in-excel<\/a><\/p>\n\n\n\n<ul><li>[ ] new array ops, make a query like<\/li><li>= <code class=\"\" data-line=\"\">a1: e1<\/code> , except new functions could dynamically change the selection based on variable<\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Power BI \/ Power Query Things to note options is an record, when used this way it&#8217;s similar to Python&#8217;s kwargs Merging two records with update the existing fields, adding new fields, if they do not yet exist (in PowerQuery) the order of steps don&#8217;t change the final result (order of execution is the same) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[66,72,50],"tags":[73,6,7,4,93],"_links":{"self":[{"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/posts\/2472"}],"collection":[{"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/comments?post=2472"}],"version-history":[{"count":11,"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/posts\/2472\/revisions"}],"predecessor-version":[{"id":2496,"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/posts\/2472\/revisions\/2496"}],"wp:attachment":[{"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/media?parent=2472"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/categories?post=2472"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/tags?post=2472"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}