├── .gitignore ├── .idea ├── .gitignore ├── PolyglotNotebookTalk.iml ├── inspectionProfiles │ └── profiles_settings.xml ├── misc.xml ├── modules.xml └── vcs.xml ├── .vscode ├── extensions.json └── settings.json ├── 00_Welcome.dib ├── 01_Jupyter ├── 00_Notebooks101.ipynb ├── 01_CallingFunctions.ipynb ├── 02_Classes.ipynb ├── 03_CallingScripts.ipynb ├── 04_UsingPackages.ipynb ├── 05_DataProcessing.ipynb ├── 06_DataVisualization.ipynb ├── 07_MachineLearning.ipynb ├── Fib.py ├── Titanic.csv └── Titanic_Processed.csv ├── 01_Terminology.dib ├── 02_Polyglot ├── 00_Polyglot.dib ├── 01_CSharp.dib ├── 02_Imports.dib ├── 02_Person.cs ├── 04_FSharp.dib ├── 04_GameInfo.cs ├── 05_InterOp_cs_fs.dib ├── 06_SQL_KQL.ipynb ├── 07_PowerShell.dib ├── 09_InterOp_JS_HTML.dib ├── 10_Mermaid.dib ├── 12_Formatting.dib ├── 13_Extensions.ipynb ├── 14_SandDance.ipynb ├── 92_InteractiveDocumentation.dib ├── 94_MachineLearningDotnet.ipynb ├── 95_ComputerVision.ipynb ├── 99_BigO.dib ├── 99_BigOMetrics.ipynb ├── 99_BigOMetricsPy.ipynb ├── DoctorWho.csv ├── DoctorWhoEpisodes.csv ├── ESRB.csv ├── ESRBTest.csv ├── Model.zip └── dbSetup.sql ├── 03_Mermaid ├── 00_Flowchart.dib ├── 01_Git.dib ├── 02_Sequence.dib ├── 03_Class.dib ├── 04_ERD.dib ├── 05_Gantt.dib ├── 06_UserJourney.dib ├── 07_State.dib ├── 08_Requirement.dib ├── 09_Pie.dib ├── 10_Mindmap.dib ├── 11_Timeline.dib ├── 12_C4Context.dib ├── 13_Markdown.md └── _index.dib ├── 04_GettingStarted ├── 00_IDEs.ipynb ├── 00_WorkLocally.dib ├── 01_Deploy.dib └── 02_Conclusion.dib ├── Checklist.md ├── DLLs ├── Bogus.dll ├── Microsoft.Azure.CognitiveServices.Vision.ComputerVision.dll ├── Microsoft.DotNet.Interactive.SqlServer.dll ├── Microsoft.ML.AutoML.dll ├── Microsoft.ML.Core.dll ├── Microsoft.ML.CpuMath.dll ├── Microsoft.ML.Data.dll ├── Microsoft.ML.DataView.dll ├── Microsoft.ML.FastTree.dll ├── Microsoft.ML.KMeansClustering.dll ├── Microsoft.ML.LightGbm.dll ├── Microsoft.ML.PCA.dll ├── Microsoft.ML.SearchSpace.dll ├── Microsoft.ML.StandardTrainers.dll ├── Microsoft.ML.Transforms.dll ├── Microsoft.ML.dll ├── Microsoft.Rest.ClientRuntime.dll ├── Newtonsoft.Json.dll ├── README.md └── Shouldly.dll ├── Images ├── AnacondaAddR.png ├── AnacondaHome.png ├── ArtCogs.png ├── ArtNotebookConcepts.png ├── AzureMLNotebook.png ├── Boss.png ├── ClockExtension.png ├── ClockExtensionInvoke.png ├── CogServicesResult1.png ├── CogServicesResult2.png ├── CogServicesResult3.png ├── DataSpell.png ├── Discord.png ├── JesterKeyboard.png ├── JupyterLab.png ├── JupyterVariables.png ├── JupyterWebPage.png ├── MM_Mermaid.png ├── MM_Overview.png ├── MM_Usages.png ├── MM_Why.png ├── MVP.png ├── Matt.png ├── Mindmap.png ├── PolyglotStructure.png ├── PyCharm.png ├── QR.png ├── SelectKernel.png ├── TL_NotebookFormats.png ├── Timeline.png ├── TryDotnet.png └── VSCode.png ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | 352 | *.pkl 353 | 354 | 04_UsageScenarios/Model.zip 355 | 356 | 04_UsageScenarios/AzureCreds.json 357 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /.idea/PolyglotNotebookTalk.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "ms-dotnettools.dotnet-interactive-vscode", 4 | "ms-toolsai.jupyter", 5 | "msrvida.vscode-sanddance" 6 | ] 7 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": [ 3 | "Agsunset", 4 | "Codespaces", 5 | "coloraxes", 6 | "CSFS", 7 | "CSJS", 8 | "dropna", 9 | "featurization", 10 | "fillna", 11 | "ipynb", 12 | "lsmagic", 13 | "minmax", 14 | "nbins", 15 | "ONNX", 16 | "pclass", 17 | "plotly", 18 | "showscale", 19 | "sibsp", 20 | "sklearn", 21 | "treemap", 22 | "xlabel", 23 | "ylabel" 24 | ] 25 | } -------------------------------------------------------------------------------- /00_Welcome.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | # Interactive Notebooks for the Polyglot 8 | _with Python, .NET, SQL, JS, and more!_ 9 | 10 | 11 | By [Matt Eland](https://MattEland.dev) ([@IntegerMan](https://Twitter.com/IntegerMan)) 12 | 13 | Instructor at [Tech Elevator](https://TechElevator.com) & [Microsoft MVP](https://mvp.microsoft.com/en-us/PublicProfile/5005207?fullName=Matt%20Eland) in AI 14 | 15 | ![Matt Eland | @IntegerMan | Microsoft MVP](Images/Matt.png) 16 | 17 | #!markdown 18 | 19 | ## Talk Resources 20 | 21 | **Code for this talk available at [https://GitHub.com/IntegerMan/PolyglotNotebookTalk](https://GitHub.com/IntegerMan/PolyglotNotebookTalk)** 22 | 23 | ![QR Code](images/QR.png) 24 | 25 | #!markdown 26 | 27 | ## Structure of this Talk 28 | 29 | #!markdown 30 | 31 | ![Overview Mind Map](Images/MM_Overview.png) 32 | -------------------------------------------------------------------------------- /01_Jupyter/00_Notebooks101.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "attachments": {}, 5 | "cell_type": "markdown", 6 | "metadata": {}, 7 | "source": [ 8 | "# Notebooks 101\n", 9 | "\n", 10 | "Before we get deeper into notebooks, let's see what they can do." 11 | ] 12 | }, 13 | { 14 | "attachments": {}, 15 | "cell_type": "markdown", 16 | "metadata": { 17 | "jupyter": { 18 | "source_hidden": true 19 | }, 20 | "tags": [] 21 | }, 22 | "source": [ 23 | "### Notebooks have Cells\n", 24 | "\n", 25 | "#### Markdown Cells\n", 26 | "This is a **markdown** cell.\n", 27 | "\n", 28 | "It supports standard [GitHub-flavored markdown](https://github.github.com/gfm/)." 29 | ] 30 | }, 31 | { 32 | "attachments": {}, 33 | "cell_type": "markdown", 34 | "metadata": {}, 35 | "source": [ 36 | "#### Code Cells" 37 | ] 38 | }, 39 | { 40 | "cell_type": "code", 41 | "execution_count": 12, 42 | "metadata": { 43 | "pycharm": { 44 | "is_executing": true 45 | } 46 | }, 47 | "outputs": [], 48 | "source": [ 49 | "# Which conference and what year is it again?\n" 50 | ] 51 | }, 52 | { 53 | "attachments": {}, 54 | "cell_type": "markdown", 55 | "metadata": {}, 56 | "source": [ 57 | "### Variables\n", 58 | "\n", 59 | "Variables defined in earlier cells can be referenced in later cells" 60 | ] 61 | }, 62 | { 63 | "attachments": {}, 64 | "cell_type": "markdown", 65 | "metadata": {}, 66 | "source": [ 67 | "Cells can be re-run, if desired" 68 | ] 69 | }, 70 | { 71 | "cell_type": "code", 72 | "execution_count": 14, 73 | "metadata": {}, 74 | "outputs": [], 75 | "source": [ 76 | "counter = 0" 77 | ] 78 | }, 79 | { 80 | "cell_type": "code", 81 | "execution_count": 15, 82 | "metadata": {}, 83 | "outputs": [ 84 | { 85 | "name": "stdout", 86 | "output_type": "stream", 87 | "text": [ 88 | "The current count is 1\n" 89 | ] 90 | } 91 | ], 92 | "source": [ 93 | "counter += 1\n", 94 | "\n", 95 | "print('The current count is ' + str(counter))" 96 | ] 97 | }, 98 | { 99 | "attachments": {}, 100 | "cell_type": "markdown", 101 | "metadata": {}, 102 | "source": [ 103 | "They can also be run out of order, if desired." 104 | ] 105 | }, 106 | { 107 | "attachments": {}, 108 | "cell_type": "markdown", 109 | "metadata": {}, 110 | "source": [ 111 | "---\n", 112 | "\n", 113 | "**Hey Matt**: Make sure you show the variables view!\n", 114 | "\n", 115 | "---" 116 | ] 117 | }, 118 | { 119 | "attachments": {}, 120 | "cell_type": "markdown", 121 | "metadata": {}, 122 | "source": [ 123 | "## Additional Options\n", 124 | "\n", 125 | "You can **restart the kernel** or **clear all outputs** if you need to." 126 | ] 127 | } 128 | ], 129 | "metadata": { 130 | "kernelspec": { 131 | "display_name": "Python 3 (ipykernel)", 132 | "language": "python", 133 | "name": "python3" 134 | }, 135 | "language_info": { 136 | "codemirror_mode": { 137 | "name": "ipython", 138 | "version": 3 139 | }, 140 | "file_extension": ".py", 141 | "mimetype": "text/x-python", 142 | "name": "python", 143 | "nbconvert_exporter": "python", 144 | "pygments_lexer": "ipython3", 145 | "version": "3.8.8" 146 | } 147 | }, 148 | "nbformat": 4, 149 | "nbformat_minor": 4 150 | } 151 | -------------------------------------------------------------------------------- /01_Jupyter/01_CallingFunctions.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "attachments": {}, 5 | "cell_type": "markdown", 6 | "metadata": {}, 7 | "source": [ 8 | "## Calling Functions" 9 | ] 10 | }, 11 | { 12 | "cell_type": "code", 13 | "execution_count": 2, 14 | "metadata": {}, 15 | "outputs": [], 16 | "source": [ 17 | "def even_or_odd(num):\n", 18 | " \"\"\"\n", 19 | " Returns a string value indicating whether the input number is even or odd\n", 20 | " \"\"\"\n", 21 | " if (num % 2 == 0):\n", 22 | " return str(num) + ' is even'\n", 23 | " else:\n", 24 | " return str(num) + ' is odd'" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "execution_count": 4, 30 | "metadata": {}, 31 | "outputs": [ 32 | { 33 | "data": { 34 | "text/plain": [ 35 | "'41 is odd'" 36 | ] 37 | }, 38 | "execution_count": 4, 39 | "metadata": {}, 40 | "output_type": "execute_result" 41 | } 42 | ], 43 | "source": [ 44 | "even_or_odd(41)" 45 | ] 46 | } 47 | ], 48 | "metadata": { 49 | "kernelspec": { 50 | "display_name": "base", 51 | "language": "python", 52 | "name": "python3" 53 | }, 54 | "language_info": { 55 | "codemirror_mode": { 56 | "name": "ipython", 57 | "version": 3 58 | }, 59 | "file_extension": ".py", 60 | "mimetype": "text/x-python", 61 | "name": "python", 62 | "nbconvert_exporter": "python", 63 | "pygments_lexer": "ipython3", 64 | "version": "3.8.8" 65 | }, 66 | "orig_nbformat": 4 67 | }, 68 | "nbformat": 4, 69 | "nbformat_minor": 2 70 | } 71 | -------------------------------------------------------------------------------- /01_Jupyter/02_Classes.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "attachments": {}, 5 | "cell_type": "markdown", 6 | "metadata": {}, 7 | "source": [ 8 | "## Declaring Classes" 9 | ] 10 | }, 11 | { 12 | "cell_type": "code", 13 | "execution_count": 1, 14 | "metadata": {}, 15 | "outputs": [], 16 | "source": [ 17 | "class FizzBuzz:\n", 18 | " \"\"\"\n", 19 | " Generates a Fizz Buzz string up to a given number where numbers divisible by 3 print Fizz, \n", 20 | " numbers divisible by 5 print Buzz, numbers divisible by 15 print FizzBuzz, \n", 21 | " and other numbers are printed as is.\n", 22 | " \"\"\"\n", 23 | "\n", 24 | " def generate(self, maxNumber):\n", 25 | " \"\"\"\n", 26 | " Generates a Fizz Buzz string up to the maximum number.\n", 27 | " Attributes:\n", 28 | " maxNumber (int): The maximum number to generate the Fizz Buzz string for.\n", 29 | " Returns:\n", 30 | " str: The generated Fizz Buzz string.\n", 31 | " \"\"\"\n", 32 | " result = []\n", 33 | "\n", 34 | " for i in range(1, maxNumber + 1):\n", 35 | " if i % 3 == 0 and i % 5 == 0:\n", 36 | " result.append('FizzBuzz')\n", 37 | " elif i % 3 == 0:\n", 38 | " result.append('Fizz')\n", 39 | " elif i % 5 == 0:\n", 40 | " result.append('Buzz')\n", 41 | " else:\n", 42 | " result.append(str(i))\n", 43 | "\n", 44 | " return ' '.join(result)" 45 | ] 46 | }, 47 | { 48 | "attachments": {}, 49 | "cell_type": "markdown", 50 | "metadata": {}, 51 | "source": [ 52 | "Classes may be instantiated and invoked in the same or subsequent cells" 53 | ] 54 | }, 55 | { 56 | "cell_type": "code", 57 | "execution_count": 2, 58 | "metadata": {}, 59 | "outputs": [ 60 | { 61 | "data": { 62 | "text/plain": [ 63 | "'1 2 Fizz 4 Buzz'" 64 | ] 65 | }, 66 | "execution_count": 2, 67 | "metadata": {}, 68 | "output_type": "execute_result" 69 | } 70 | ], 71 | "source": [ 72 | "fb = FizzBuzz()\n", 73 | "fb.generate(5)" 74 | ] 75 | } 76 | ], 77 | "metadata": { 78 | "kernelspec": { 79 | "display_name": "base", 80 | "language": "python", 81 | "name": "python3" 82 | }, 83 | "language_info": { 84 | "codemirror_mode": { 85 | "name": "ipython", 86 | "version": 3 87 | }, 88 | "file_extension": ".py", 89 | "mimetype": "text/x-python", 90 | "name": "python", 91 | "nbconvert_exporter": "python", 92 | "pygments_lexer": "ipython3", 93 | "version": "3.8.8" 94 | }, 95 | "orig_nbformat": 4 96 | }, 97 | "nbformat": 4, 98 | "nbformat_minor": 2 99 | } 100 | -------------------------------------------------------------------------------- /01_Jupyter/03_CallingScripts.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "attachments": {}, 5 | "cell_type": "markdown", 6 | "metadata": {}, 7 | "source": [ 8 | "### Calling Scripts\n", 9 | "\n", 10 | "You can reference a Python script in a `.py` file if you want to hide some code from the notebook." 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": 1, 16 | "metadata": {}, 17 | "outputs": [ 18 | { 19 | "data": { 20 | "text/plain": [ 21 | "5" 22 | ] 23 | }, 24 | "execution_count": 1, 25 | "metadata": {}, 26 | "output_type": "execute_result" 27 | } 28 | ], 29 | "source": [ 30 | "from Fib import largest_fibonacci\n", 31 | "\n", 32 | "# Find the largest fibonacci number before or including this number\n", 33 | "largest_fibonacci(5)" 34 | ] 35 | } 36 | ], 37 | "metadata": { 38 | "kernelspec": { 39 | "display_name": "base", 40 | "language": "python", 41 | "name": "python3" 42 | }, 43 | "language_info": { 44 | "codemirror_mode": { 45 | "name": "ipython", 46 | "version": 3 47 | }, 48 | "file_extension": ".py", 49 | "mimetype": "text/x-python", 50 | "name": "python", 51 | "nbconvert_exporter": "python", 52 | "pygments_lexer": "ipython3", 53 | "version": "3.8.8" 54 | }, 55 | "orig_nbformat": 4 56 | }, 57 | "nbformat": 4, 58 | "nbformat_minor": 2 59 | } 60 | -------------------------------------------------------------------------------- /01_Jupyter/04_UsingPackages.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "attachments": {}, 5 | "cell_type": "markdown", 6 | "metadata": {}, 7 | "source": [ 8 | "## Installing Packages in Jupyter Notebooks\n", 9 | "\n", 10 | "You'll sometimes need packages you don't have installed locally. Those packages must be installed via directives." 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "# Install the Pandas package in the virtual environment\n", 20 | "%pip install Pandas" 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": null, 26 | "metadata": {}, 27 | "outputs": [], 28 | "source": [ 29 | "# Install the Pandas package in the base environment. Usually you don't want to do this\n", 30 | "!pip install Pandas" 31 | ] 32 | }, 33 | { 34 | "attachments": {}, 35 | "cell_type": "markdown", 36 | "metadata": {}, 37 | "source": [ 38 | "**Note:** *[Anaconda](https://www.anaconda.com/) is a pre-configured Python environment with a standard set of data science packages already installed. It will spare you from a lot of the standard installs on your projects.*" 39 | ] 40 | }, 41 | { 42 | "cell_type": "code", 43 | "execution_count": null, 44 | "metadata": {}, 45 | "outputs": [], 46 | "source": [ 47 | "import pandas as pd\n", 48 | " \n", 49 | "# Create a DataFrame with a mysterious series of numbers\n", 50 | "data = [4,8,15,16,23,42]\n", 51 | "df = pd.DataFrame(data, columns=['Numbers'])\n", 52 | " \n", 53 | "# Display the DataFrame\n", 54 | "df" 55 | ] 56 | } 57 | ], 58 | "metadata": { 59 | "kernelspec": { 60 | "display_name": "base", 61 | "language": "python", 62 | "name": "python3" 63 | }, 64 | "language_info": { 65 | "codemirror_mode": { 66 | "name": "ipython", 67 | "version": 3 68 | }, 69 | "file_extension": ".py", 70 | "mimetype": "text/x-python", 71 | "name": "python", 72 | "nbconvert_exporter": "python", 73 | "pygments_lexer": "ipython3", 74 | "version": "3.8.8" 75 | }, 76 | "orig_nbformat": 4 77 | }, 78 | "nbformat": 4, 79 | "nbformat_minor": 2 80 | } 81 | -------------------------------------------------------------------------------- /01_Jupyter/07_MachineLearning.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "attachments": {}, 5 | "cell_type": "markdown", 6 | "metadata": {}, 7 | "source": [ 8 | "## Machine Learning in Python with SciKit-Learn" 9 | ] 10 | }, 11 | { 12 | "cell_type": "code", 13 | "execution_count": 1, 14 | "metadata": {}, 15 | "outputs": [], 16 | "source": [ 17 | "import pandas as pd\n", 18 | "import pickle\n", 19 | "\n", 20 | "from sklearn.model_selection import train_test_split\n", 21 | "from sklearn.linear_model import LogisticRegression\n", 22 | "from sklearn.preprocessing import minmax_scale" 23 | ] 24 | }, 25 | { 26 | "attachments": {}, 27 | "cell_type": "markdown", 28 | "metadata": {}, 29 | "source": [ 30 | "### Loading & Cleaning Data" 31 | ] 32 | }, 33 | { 34 | "cell_type": "code", 35 | "execution_count": 2, 36 | "metadata": {}, 37 | "outputs": [ 38 | { 39 | "data": { 40 | "text/html": [ 41 | "
\n", 42 | "\n", 55 | "\n", 56 | " \n", 57 | " \n", 58 | " \n", 59 | " \n", 60 | " \n", 61 | " \n", 62 | " \n", 63 | " \n", 64 | " \n", 65 | " \n", 66 | " \n", 67 | " \n", 68 | " \n", 69 | " \n", 70 | " \n", 71 | " \n", 72 | " \n", 73 | " \n", 74 | " \n", 75 | " \n", 76 | " \n", 77 | " \n", 78 | " \n", 79 | " \n", 80 | " \n", 81 | " \n", 82 | " \n", 83 | " \n", 84 | " \n", 85 | " \n", 86 | " \n", 87 | " \n", 88 | " \n", 89 | " \n", 90 | " \n", 91 | " \n", 92 | " \n", 93 | " \n", 94 | " \n", 95 | " \n", 96 | " \n", 97 | " \n", 98 | " \n", 99 | " \n", 100 | " \n", 101 | " \n", 102 | " \n", 103 | " \n", 104 | " \n", 105 | " \n", 106 | " \n", 107 | " \n", 108 | " \n", 109 | " \n", 110 | " \n", 111 | " \n", 112 | " \n", 113 | " \n", 114 | " \n", 115 | " \n", 116 | " \n", 117 | " \n", 118 | " \n", 119 | " \n", 120 | " \n", 121 | " \n", 122 | " \n", 123 | " \n", 124 | " \n", 125 | " \n", 126 | " \n", 127 | " \n", 128 | " \n", 129 | " \n", 130 | " \n", 131 | " \n", 132 | " \n", 133 | " \n", 134 | " \n", 135 | " \n", 136 | " \n", 137 | " \n", 138 | "
pclasssurvivedageSiblings and Spouses AboardParents and Children Aboardfareembarkedcabin_letteris_maleTotal Family Aboard
01.01.029.00000.00.0211.3375SouthamptonB00.0
11.01.00.91671.02.0151.5500SouthamptonC13.0
21.00.02.00001.02.0151.5500SouthamptonC03.0
31.00.030.00001.02.0151.5500SouthamptonC13.0
41.00.025.00001.02.0151.5500SouthamptonC03.0
\n", 139 | "
" 140 | ], 141 | "text/plain": [ 142 | " pclass survived age Siblings and Spouses Aboard \\\n", 143 | "0 1.0 1.0 29.0000 0.0 \n", 144 | "1 1.0 1.0 0.9167 1.0 \n", 145 | "2 1.0 0.0 2.0000 1.0 \n", 146 | "3 1.0 0.0 30.0000 1.0 \n", 147 | "4 1.0 0.0 25.0000 1.0 \n", 148 | "\n", 149 | " Parents and Children Aboard fare embarked cabin_letter is_male \\\n", 150 | "0 0.0 211.3375 Southampton B 0 \n", 151 | "1 2.0 151.5500 Southampton C 1 \n", 152 | "2 2.0 151.5500 Southampton C 0 \n", 153 | "3 2.0 151.5500 Southampton C 1 \n", 154 | "4 2.0 151.5500 Southampton C 0 \n", 155 | "\n", 156 | " Total Family Aboard \n", 157 | "0 0.0 \n", 158 | "1 3.0 \n", 159 | "2 3.0 \n", 160 | "3 3.0 \n", 161 | "4 3.0 " 162 | ] 163 | }, 164 | "execution_count": 2, 165 | "metadata": {}, 166 | "output_type": "execute_result" 167 | } 168 | ], 169 | "source": [ 170 | "df = pd.read_csv('Titanic_Processed.csv')\n", 171 | "\n", 172 | "df = df.drop(columns=['Unnamed: 0', 'sex'])\n", 173 | "df.head()" 174 | ] 175 | }, 176 | { 177 | "cell_type": "code", 178 | "execution_count": 3, 179 | "metadata": {}, 180 | "outputs": [ 181 | { 182 | "data": { 183 | "text/html": [ 184 | "
\n", 185 | "\n", 198 | "\n", 199 | " \n", 200 | " \n", 201 | " \n", 202 | " \n", 203 | " \n", 204 | " \n", 205 | " \n", 206 | " \n", 207 | " \n", 208 | " \n", 209 | " \n", 210 | " \n", 211 | " \n", 212 | " \n", 213 | " \n", 214 | " \n", 215 | " \n", 216 | " \n", 217 | " \n", 218 | " \n", 219 | " \n", 220 | " \n", 221 | " \n", 222 | " \n", 223 | " \n", 224 | " \n", 225 | " \n", 226 | " \n", 227 | " \n", 228 | " \n", 229 | " \n", 230 | " \n", 231 | " \n", 232 | " \n", 233 | " \n", 234 | " \n", 235 | " \n", 236 | " \n", 237 | " \n", 238 | " \n", 239 | " \n", 240 | " \n", 241 | " \n", 242 | " \n", 243 | " \n", 244 | " \n", 245 | " \n", 246 | " \n", 247 | " \n", 248 | " \n", 249 | " \n", 250 | " \n", 251 | " \n", 252 | " \n", 253 | " \n", 254 | " \n", 255 | " \n", 256 | " \n", 257 | " \n", 258 | " \n", 259 | " \n", 260 | " \n", 261 | " \n", 262 | " \n", 263 | "
pclasssurvivedageSiblings and Spouses AboardParents and Children Aboardfareis_maleTotal Family Aboardcabin_letter_Bcabin_letter_Ccabin_letter_Dcabin_letter_Ecabin_letter_Fcabin_letter_Gcabin_letter_Tembarked_Queenstownembarked_Southampton
01.01.029.00000.00.0211.337500.0100000001
11.01.00.91671.02.0151.550013.0010000001
\n", 264 | "
" 265 | ], 266 | "text/plain": [ 267 | " pclass survived age Siblings and Spouses Aboard \\\n", 268 | "0 1.0 1.0 29.0000 0.0 \n", 269 | "1 1.0 1.0 0.9167 1.0 \n", 270 | "\n", 271 | " Parents and Children Aboard fare is_male Total Family Aboard \\\n", 272 | "0 0.0 211.3375 0 0.0 \n", 273 | "1 2.0 151.5500 1 3.0 \n", 274 | "\n", 275 | " cabin_letter_B cabin_letter_C cabin_letter_D cabin_letter_E \\\n", 276 | "0 1 0 0 0 \n", 277 | "1 0 1 0 0 \n", 278 | "\n", 279 | " cabin_letter_F cabin_letter_G cabin_letter_T embarked_Queenstown \\\n", 280 | "0 0 0 0 0 \n", 281 | "1 0 0 0 0 \n", 282 | "\n", 283 | " embarked_Southampton \n", 284 | "0 1 \n", 285 | "1 1 " 286 | ] 287 | }, 288 | "execution_count": 3, 289 | "metadata": {}, 290 | "output_type": "execute_result" 291 | } 292 | ], 293 | "source": [ 294 | "df = pd.get_dummies(df, columns=['cabin_letter','embarked'],drop_first=True)\n", 295 | "df.head(2)" 296 | ] 297 | }, 298 | { 299 | "cell_type": "code", 300 | "execution_count": 4, 301 | "metadata": {}, 302 | "outputs": [ 303 | { 304 | "data": { 305 | "text/html": [ 306 | "
\n", 307 | "\n", 320 | "\n", 321 | " \n", 322 | " \n", 323 | " \n", 324 | " \n", 325 | " \n", 326 | " \n", 327 | " \n", 328 | " \n", 329 | " \n", 330 | " \n", 331 | " \n", 332 | " \n", 333 | " \n", 334 | " \n", 335 | " \n", 336 | " \n", 337 | " \n", 338 | " \n", 339 | " \n", 340 | " \n", 341 | " \n", 342 | " \n", 343 | " \n", 344 | " \n", 345 | " \n", 346 | " \n", 347 | " \n", 348 | " \n", 349 | " \n", 350 | " \n", 351 | " \n", 352 | " \n", 353 | " \n", 354 | " \n", 355 | " \n", 356 | " \n", 357 | " \n", 358 | " \n", 359 | " \n", 360 | " \n", 361 | " \n", 362 | " \n", 363 | " \n", 364 | " \n", 365 | " \n", 366 | " \n", 367 | " \n", 368 | " \n", 369 | " \n", 370 | " \n", 371 | " \n", 372 | " \n", 373 | " \n", 374 | " \n", 375 | " \n", 376 | " \n", 377 | " \n", 378 | " \n", 379 | " \n", 380 | " \n", 381 | " \n", 382 | " \n", 383 | " \n", 384 | " \n", 385 | " \n", 386 | " \n", 387 | " \n", 388 | " \n", 389 | " \n", 390 | " \n", 391 | " \n", 392 | " \n", 393 | " \n", 394 | " \n", 395 | " \n", 396 | " \n", 397 | " \n", 398 | " \n", 399 | " \n", 400 | " \n", 401 | " \n", 402 | " \n", 403 | " \n", 404 | " \n", 405 | " \n", 406 | " \n", 407 | " \n", 408 | " \n", 409 | " \n", 410 | " \n", 411 | " \n", 412 | " \n", 413 | " \n", 414 | " \n", 415 | " \n", 416 | " \n", 417 | " \n", 418 | " \n", 419 | " \n", 420 | " \n", 421 | " \n", 422 | " \n", 423 | " \n", 424 | " \n", 425 | " \n", 426 | " \n", 427 | " \n", 428 | " \n", 429 | " \n", 430 | " \n", 431 | " \n", 432 | " \n", 433 | " \n", 434 | " \n", 435 | " \n", 436 | " \n", 437 | " \n", 438 | " \n", 439 | " \n", 440 | " \n", 441 | " \n", 442 | " \n", 443 | " \n", 444 | " \n", 445 | "
pclasssurvivedageSiblings and Spouses AboardParents and Children Aboardfareis_maleTotal Family Aboardcabin_letter_Bcabin_letter_Ccabin_letter_Dcabin_letter_Ecabin_letter_Fcabin_letter_Gcabin_letter_Tembarked_Queenstownembarked_Southampton
01.01.029.00000.00.0211.337500.0100000001
11.01.00.91671.02.0151.550013.0010000001
21.00.02.00001.02.0151.550003.0010000001
31.00.030.00001.02.0151.550013.0010000001
41.00.025.00001.02.0151.550003.0010000001
\n", 446 | "
" 447 | ], 448 | "text/plain": [ 449 | " pclass survived age Siblings and Spouses Aboard \\\n", 450 | "0 1.0 1.0 29.0000 0.0 \n", 451 | "1 1.0 1.0 0.9167 1.0 \n", 452 | "2 1.0 0.0 2.0000 1.0 \n", 453 | "3 1.0 0.0 30.0000 1.0 \n", 454 | "4 1.0 0.0 25.0000 1.0 \n", 455 | "\n", 456 | " Parents and Children Aboard fare is_male Total Family Aboard \\\n", 457 | "0 0.0 211.3375 0 0.0 \n", 458 | "1 2.0 151.5500 1 3.0 \n", 459 | "2 2.0 151.5500 0 3.0 \n", 460 | "3 2.0 151.5500 1 3.0 \n", 461 | "4 2.0 151.5500 0 3.0 \n", 462 | "\n", 463 | " cabin_letter_B cabin_letter_C cabin_letter_D cabin_letter_E \\\n", 464 | "0 1 0 0 0 \n", 465 | "1 0 1 0 0 \n", 466 | "2 0 1 0 0 \n", 467 | "3 0 1 0 0 \n", 468 | "4 0 1 0 0 \n", 469 | "\n", 470 | " cabin_letter_F cabin_letter_G cabin_letter_T embarked_Queenstown \\\n", 471 | "0 0 0 0 0 \n", 472 | "1 0 0 0 0 \n", 473 | "2 0 0 0 0 \n", 474 | "3 0 0 0 0 \n", 475 | "4 0 0 0 0 \n", 476 | "\n", 477 | " embarked_Southampton \n", 478 | "0 1 \n", 479 | "1 1 \n", 480 | "2 1 \n", 481 | "3 1 \n", 482 | "4 1 " 483 | ] 484 | }, 485 | "execution_count": 4, 486 | "metadata": {}, 487 | "output_type": "execute_result" 488 | } 489 | ], 490 | "source": [ 491 | "# Drop rows with NaN values\n", 492 | "df = df.dropna()\n", 493 | "df.head()" 494 | ] 495 | }, 496 | { 497 | "cell_type": "code", 498 | "execution_count": 5, 499 | "metadata": {}, 500 | "outputs": [ 501 | { 502 | "data": { 503 | "text/html": [ 504 | "
\n", 505 | "\n", 518 | "\n", 519 | " \n", 520 | " \n", 521 | " \n", 522 | " \n", 523 | " \n", 524 | " \n", 525 | " \n", 526 | " \n", 527 | " \n", 528 | " \n", 529 | " \n", 530 | " \n", 531 | " \n", 532 | " \n", 533 | " \n", 534 | " \n", 535 | " \n", 536 | " \n", 537 | " \n", 538 | " \n", 539 | " \n", 540 | " \n", 541 | " \n", 542 | " \n", 543 | " \n", 544 | " \n", 545 | " \n", 546 | " \n", 547 | " \n", 548 | " \n", 549 | " \n", 550 | " \n", 551 | " \n", 552 | " \n", 553 | " \n", 554 | " \n", 555 | " \n", 556 | " \n", 557 | " \n", 558 | " \n", 559 | " \n", 560 | " \n", 561 | " \n", 562 | " \n", 563 | " \n", 564 | " \n", 565 | " \n", 566 | " \n", 567 | " \n", 568 | " \n", 569 | " \n", 570 | " \n", 571 | " \n", 572 | " \n", 573 | " \n", 574 | " \n", 575 | " \n", 576 | " \n", 577 | " \n", 578 | " \n", 579 | " \n", 580 | " \n", 581 | " \n", 582 | " \n", 583 | " \n", 584 | " \n", 585 | " \n", 586 | " \n", 587 | " \n", 588 | " \n", 589 | " \n", 590 | " \n", 591 | " \n", 592 | " \n", 593 | " \n", 594 | " \n", 595 | " \n", 596 | " \n", 597 | " \n", 598 | " \n", 599 | " \n", 600 | " \n", 601 | " \n", 602 | " \n", 603 | " \n", 604 | " \n", 605 | " \n", 606 | " \n", 607 | " \n", 608 | " \n", 609 | " \n", 610 | " \n", 611 | " \n", 612 | " \n", 613 | " \n", 614 | " \n", 615 | " \n", 616 | " \n", 617 | " \n", 618 | " \n", 619 | " \n", 620 | " \n", 621 | " \n", 622 | " \n", 623 | " \n", 624 | " \n", 625 | " \n", 626 | " \n", 627 | " \n", 628 | " \n", 629 | " \n", 630 | " \n", 631 | " \n", 632 | " \n", 633 | " \n", 634 | " \n", 635 | " \n", 636 | " \n", 637 | " \n", 638 | " \n", 639 | " \n", 640 | " \n", 641 | " \n", 642 | " \n", 643 | "
pclasssurvivedageSiblings and Spouses AboardParents and Children Aboardfareis_maleTotal Family Aboardcabin_letter_Bcabin_letter_Ccabin_letter_Dcabin_letter_Ecabin_letter_Fcabin_letter_Gcabin_letter_Tembarked_Queenstownembarked_Southampton
00.01.00.3611690.0000.0000000.4125030.00.01.00.00.00.00.00.00.00.01.0
10.01.00.0093950.1250.3333330.2958061.00.30.01.00.00.00.00.00.00.01.0
20.00.00.0229640.1250.3333330.2958060.00.30.01.00.00.00.00.00.00.01.0
30.00.00.3736950.1250.3333330.2958061.00.30.01.00.00.00.00.00.00.01.0
40.00.00.3110640.1250.3333330.2958060.00.30.01.00.00.00.00.00.00.01.0
\n", 644 | "
" 645 | ], 646 | "text/plain": [ 647 | " pclass survived age Siblings and Spouses Aboard \\\n", 648 | "0 0.0 1.0 0.361169 0.000 \n", 649 | "1 0.0 1.0 0.009395 0.125 \n", 650 | "2 0.0 0.0 0.022964 0.125 \n", 651 | "3 0.0 0.0 0.373695 0.125 \n", 652 | "4 0.0 0.0 0.311064 0.125 \n", 653 | "\n", 654 | " Parents and Children Aboard fare is_male Total Family Aboard \\\n", 655 | "0 0.000000 0.412503 0.0 0.0 \n", 656 | "1 0.333333 0.295806 1.0 0.3 \n", 657 | "2 0.333333 0.295806 0.0 0.3 \n", 658 | "3 0.333333 0.295806 1.0 0.3 \n", 659 | "4 0.333333 0.295806 0.0 0.3 \n", 660 | "\n", 661 | " cabin_letter_B cabin_letter_C cabin_letter_D cabin_letter_E \\\n", 662 | "0 1.0 0.0 0.0 0.0 \n", 663 | "1 0.0 1.0 0.0 0.0 \n", 664 | "2 0.0 1.0 0.0 0.0 \n", 665 | "3 0.0 1.0 0.0 0.0 \n", 666 | "4 0.0 1.0 0.0 0.0 \n", 667 | "\n", 668 | " cabin_letter_F cabin_letter_G cabin_letter_T embarked_Queenstown \\\n", 669 | "0 0.0 0.0 0.0 0.0 \n", 670 | "1 0.0 0.0 0.0 0.0 \n", 671 | "2 0.0 0.0 0.0 0.0 \n", 672 | "3 0.0 0.0 0.0 0.0 \n", 673 | "4 0.0 0.0 0.0 0.0 \n", 674 | "\n", 675 | " embarked_Southampton \n", 676 | "0 1.0 \n", 677 | "1 1.0 \n", 678 | "2 1.0 \n", 679 | "3 1.0 \n", 680 | "4 1.0 " 681 | ] 682 | }, 683 | "execution_count": 5, 684 | "metadata": {}, 685 | "output_type": "execute_result" 686 | } 687 | ], 688 | "source": [ 689 | "# Normalize data values between 0 and 1 so columns with larger ranges / values don't get bias by the training process\n", 690 | "df[:] = minmax_scale(df)\n", 691 | "df.head()" 692 | ] 693 | }, 694 | { 695 | "attachments": {}, 696 | "cell_type": "markdown", 697 | "metadata": {}, 698 | "source": [ 699 | "### Split Data into a testing dataset and a training dataset" 700 | ] 701 | }, 702 | { 703 | "cell_type": "code", 704 | "execution_count": 6, 705 | "metadata": {}, 706 | "outputs": [], 707 | "source": [ 708 | "# Use a distinct numerical seed so that results are repeatable\n", 709 | "seed = 42\n", 710 | "\n", 711 | "# Create two DataFrames out of the source DataFrame \n", 712 | "# with the first getting 90% of the rows and the second getting 10%\n", 713 | "train, test = train_test_split(df, test_size=0.1, random_state=seed)" 714 | ] 715 | }, 716 | { 717 | "cell_type": "code", 718 | "execution_count": 7, 719 | "metadata": {}, 720 | "outputs": [], 721 | "source": [ 722 | "# Drop the label column from the training dataset\n", 723 | "X_train = train.drop(\"survived\", axis=1)\n", 724 | "Y_train = train[\"survived\"]\n", 725 | "X_test = test" 726 | ] 727 | }, 728 | { 729 | "attachments": {}, 730 | "cell_type": "markdown", 731 | "metadata": {}, 732 | "source": [ 733 | "### Fit a model to our training dataset" 734 | ] 735 | }, 736 | { 737 | "cell_type": "code", 738 | "execution_count": 8, 739 | "metadata": {}, 740 | "outputs": [ 741 | { 742 | "data": { 743 | "text/plain": [ 744 | "LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True,\n", 745 | " intercept_scaling=1, l1_ratio=None, max_iter=50000,\n", 746 | " multi_class='auto', n_jobs=None, penalty='l2',\n", 747 | " random_state=42, solver='lbfgs', tol=0.0001, verbose=0,\n", 748 | " warm_start=False)" 749 | ] 750 | }, 751 | "execution_count": 8, 752 | "metadata": {}, 753 | "output_type": "execute_result" 754 | } 755 | ], 756 | "source": [ 757 | "model = LogisticRegression(random_state=seed, max_iter=50000)\n", 758 | "model.fit(X_train, Y_train)" 759 | ] 760 | }, 761 | { 762 | "attachments": {}, 763 | "cell_type": "markdown", 764 | "metadata": {}, 765 | "source": [ 766 | "### Evaluate our model's performance" 767 | ] 768 | }, 769 | { 770 | "cell_type": "code", 771 | "execution_count": 9, 772 | "metadata": {}, 773 | "outputs": [ 774 | { 775 | "data": { 776 | "text/plain": [ 777 | "array([0., 0., 1., 0., 0., 0., 0., 0., 0., 1., 0., 1., 0., 0., 0., 0., 0.,\n", 778 | " 0., 1., 0., 0., 1., 1., 0., 1., 0., 1., 0., 0., 0., 0., 1., 1., 1.,\n", 779 | " 0., 1., 1., 0., 0., 0., 0., 1., 1., 0., 1., 0., 1., 1., 0., 1., 1.,\n", 780 | " 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 1., 0., 0., 0.,\n", 781 | " 0., 0., 1., 0., 1., 0., 1., 0., 0., 1., 1., 0., 0., 0., 1., 0., 1.,\n", 782 | " 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 1., 0., 1., 0.,\n", 783 | " 0., 1., 0.])" 784 | ] 785 | }, 786 | "execution_count": 9, 787 | "metadata": {}, 788 | "output_type": "execute_result" 789 | } 790 | ], 791 | "source": [ 792 | "# Generate predictions\n", 793 | "Y_pred = model.predict(X_test.drop('survived', axis=1))\n", 794 | "Y_pred" 795 | ] 796 | }, 797 | { 798 | "cell_type": "code", 799 | "execution_count": 10, 800 | "metadata": {}, 801 | "outputs": [ 802 | { 803 | "data": { 804 | "text/plain": [ 805 | "79.64" 806 | ] 807 | }, 808 | "execution_count": 10, 809 | "metadata": {}, 810 | "output_type": "execute_result" 811 | } 812 | ], 813 | "source": [ 814 | "accuracy = round(model.score(X_train, Y_train) * 100, 2)\n", 815 | "accuracy" 816 | ] 817 | }, 818 | { 819 | "attachments": {}, 820 | "cell_type": "markdown", 821 | "metadata": {}, 822 | "source": [ 823 | "### Save the Trained Model\n", 824 | "Models can be \"pickled\" and saved in a binary file for later use, so you don't need to re-train the model every time." 825 | ] 826 | }, 827 | { 828 | "cell_type": "code", 829 | "execution_count": 11, 830 | "metadata": {}, 831 | "outputs": [], 832 | "source": [ 833 | "model_file = open('Titanic.pkl', 'wb')\n", 834 | "pickle.dump(model, model_file)\n", 835 | "\n", 836 | "model_file.close()" 837 | ] 838 | } 839 | ], 840 | "metadata": { 841 | "kernelspec": { 842 | "display_name": "base", 843 | "language": "python", 844 | "name": "python3" 845 | }, 846 | "language_info": { 847 | "codemirror_mode": { 848 | "name": "ipython", 849 | "version": 3 850 | }, 851 | "file_extension": ".py", 852 | "mimetype": "text/x-python", 853 | "name": "python", 854 | "nbconvert_exporter": "python", 855 | "pygments_lexer": "ipython3", 856 | "version": "3.8.8" 857 | }, 858 | "orig_nbformat": 4 859 | }, 860 | "nbformat": 4, 861 | "nbformat_minor": 2 862 | } 863 | -------------------------------------------------------------------------------- /01_Jupyter/Fib.py: -------------------------------------------------------------------------------- 1 | def largest_fibonacci(n): 2 | """ 3 | Calculates the largest Fibonacci number up to a given number. 4 | 5 | Args: 6 | n (int): The maximum number to calculate the largest Fibonacci number before. 7 | 8 | Returns: 9 | int: The largest Fibonacci number before the given number. 10 | """ 11 | 12 | a, b = 0, 1 13 | while b < n: 14 | a, b = b, a + b 15 | return a -------------------------------------------------------------------------------- /01_Terminology.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## High-Level Concepts 8 | 9 | This document contains high-level concepts useful for understanding Notebooks. 10 | 11 | #!markdown 12 | 13 | ### What is a Notebook? 14 | 15 | ![Notebook Concepts Art](Images/ArtNotebookConcepts.png) 16 | 17 | Notebooks are collections of **cells** that are either **code** or **markdown** cells. 18 | 19 | Notebooks allow you to combine documentation and code with **variable sharing** between different code blocks. Additionally, the output of code blocks can be visualized inside of the notebook. 20 | 21 | This means the notebook itself is a **new form of interactive application**. 22 | 23 | #!markdown 24 | 25 | ### What is a Kernel? 26 | 27 | ![Notebook Kernel Concept Art](Images/ArtCogs.png) 28 | 29 | A kernel is a programming language specific process that interacts with the Notebook to execute code and output results. 30 | 31 | Different kernels can support different programming languages. 32 | 33 | In **VS Code** you must select which kernel your Notebook runs. 34 | 35 | ![Selecting a Kernel in VS Code](Images/SelectKernel.png) 36 | 37 | Some kernels include: 38 | 39 | - Python 40 | - R 41 | - Julia 42 | - .NET Interactive (Polyglot Notebooks) 43 | 44 | #!markdown 45 | 46 | ### .ipynb Files vs .dib Files 47 | 48 | #!markdown 49 | 50 | ![Notebook Formats](Images/TL_NotebookFormats.png) 51 | 52 | **.ipynb** files are notebook files that *store the code and its prior results* so they don't need to be re-run. These tend to be larger files. 53 | 54 | **.dib** files are notebook files that use limited markdown to store just the cell contents *without results*. They are smaller and easier to manage in version control. 55 | 56 | #!markdown 57 | 58 | ### Why do we Care? 59 | 60 | #!markdown 61 | 62 | ![Mind Map: Why](Images/MM_Why.png) 63 | -------------------------------------------------------------------------------- /02_Polyglot/00_Polyglot.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Polyglot Notebooks 8 | 9 | ![Polyglot Structure](../Images/PolyglotStructure.png) 10 | 11 | #!markdown 12 | 13 | **Polyglot Notebooks** is an extension to **VS Code** that provides the **.NET Interactive Kernel** and integrates it into the **Jupyter Notebooks** extension. This makes the **.NET Interactive kernel** available to run notebook code in VS Code. Polyglot Notebooks requires the **.NET SDK** in order to function. 14 | 15 | #!markdown 16 | 17 | Polyglot Notebooks uses the **.NET Interactive** kernel in a Jupyter Notebook hosted inside of VS Code. 18 | This .NET Interactive Kernel allows writing code in multiple languages and sharing variables between many of these languages including: 19 | 20 | - C# 21 | - F# 22 | - JavaScript 23 | - HTML 24 | - SQL 25 | - Powershell 26 | - KQL 27 | - Mermaid 28 | -------------------------------------------------------------------------------- /02_Polyglot/01_CSharp.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## C# Code in Notebooks 8 | 9 | #!markdown 10 | 11 | ### Variables 12 | 13 | #!markdown 14 | 15 | Reminder: take a look at the Polyglot Notebooks Variables pane. 16 | 17 | #!markdown 18 | 19 | ### Classes 20 | 21 | Note: Custom namespaces and `partial` classes are not supported. Classes exist in the global namespace. 22 | 23 | #!csharp 24 | 25 | public class Point 26 | { 27 | public Point(int x, int y) { 28 | this.X = x; 29 | this.Y = y; 30 | } 31 | 32 | public int X {get; set;} 33 | public int Y {get; set;} 34 | public int Z {get; set;} 35 | 36 | public override string ToString() => $"Point({X}, {Y})"; 37 | } 38 | 39 | #!csharp 40 | 41 | // Instantiate the class 42 | Point p = new(4, 2); 43 | 44 | p 45 | 46 | #!markdown 47 | 48 | ### Defining Local Methods 49 | 50 | If you don't need a class but want to define a method / function, you can do that. 51 | 52 | #!csharp 53 | 54 | // Define a local method 55 | int CalculateFavoriteNumber() { 56 | return 42; 57 | } 58 | 59 | #!csharp 60 | 61 | // Call the local method 62 | CalculateFavoriteNumber() 63 | -------------------------------------------------------------------------------- /02_Polyglot/02_Imports.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Importing Code 8 | Because not all code you care about should live in one file. 9 | 10 | #!markdown 11 | 12 | ### Importing Code Files 13 | 14 | Let's import a `Person` class defined in `Person.cs`: 15 | 16 | #!csharp 17 | 18 | #!import 02_Person.cs 19 | 20 | #!csharp 21 | 22 | // Instantate the Person class here 23 | Person p = new Person(); 24 | 25 | p 26 | 27 | #!markdown 28 | 29 | ### Installing Libraries via NuGet 30 | 31 | With an internet connection you'd install NuGet Packages like this 32 | 33 | #!csharp 34 | 35 | #r "nuget:Bogus" 36 | 37 | #!markdown 38 | 39 | If you have custom NuGet feeds you want to use, you can register them with the `#i` directive: 40 | 41 | ``` 42 | #i "nuget:C:\myorg\mypackage\src\bin\Release" 43 | #r "nuget:MyOrg.MyPackage" 44 | ``` 45 | 46 | You can also skip NuGet entirely and work with `.dll` files directly via syntax like this: 47 | 48 | ``` 49 | #r 'folder/myAssembly.dll' 50 | ``` 51 | 52 | --- 53 | 54 | #!markdown 55 | 56 | Since, I'm demoing this knowing Internet is going to be offline or spotty so let's use pre-stored DLL files instead for this talk. 57 | 58 | #!csharp 59 | 60 | #r "..\DLLs\Bogus.dll" 61 | 62 | #!csharp 63 | 64 | using Bogus; 65 | 66 | var faker = new Faker() 67 | .RuleFor(p => p.First, (f, p) => f.Name.FirstName()) 68 | .RuleFor(p => p.Last, (f, p) => f.Name.LastName()) 69 | .RuleFor(p => p.Phone, (f, p) => f.Phone.PhoneNumber()) 70 | .RuleFor(p => p.Email, (f, p) => f.Internet.Email(p.First, p.Last)); 71 | 72 | faker.Generate() 73 | -------------------------------------------------------------------------------- /02_Polyglot/02_Person.cs: -------------------------------------------------------------------------------- 1 | public class Person { 2 | public string First {get; set;} = "Janelle"; 3 | public string Last {get; set;} = "Doe"; 4 | public string FullName => $"{First} {Last}"; 5 | public string Phone {get; set;} = "555-1234"; 6 | public string Email {get; set;} = "NotReal@SpamAlot.com"; 7 | } -------------------------------------------------------------------------------- /02_Polyglot/04_FSharp.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## F# - Functional Programming in a Notebook 8 | 9 | In general, this works just like F# Interactive, but in a notebook. You get all the same support you had in C# with NuGet, importing, and variables, but you're using F# syntax. 10 | 11 | #!fsharp 12 | 13 | open System 14 | 15 | // Random number generator 16 | let rand = new Random() 17 | 18 | #!markdown 19 | 20 | ### Random Capitalizer 21 | This function takes in a string and transforms it to random capitalization so that "Hello" might become "heLlO" 22 | 23 | #!fsharp 24 | 25 | let randomCase (input: string) = 26 | input.ToCharArray() 27 | |> Array.map (fun c -> if rand.Next(2) = 0 then Char.ToUpper(c) else Char.ToLower(c)) 28 | |> String.Concat 29 | 30 | #!fsharp 31 | 32 | randomCase "Hello Stir Trek!" 33 | 34 | #!markdown 35 | 36 | ### Leet Speak Generator 37 | Because why not bring that back? 38 | 39 | Transforms a string like "Cake" into the perfectly understandable "c4k3" 40 | 41 | #!fsharp 42 | 43 | let leetSpeak (input: string) = 44 | let replacements = Map.ofList [('a', '4'); ('e', '3'); ('l', '1'); ('o', '0'); ('s', '5'); ('t', '7')] 45 | input.ToCharArray() 46 | |> Array.map (fun c -> 47 | let lowerC = Char.ToLower(c) 48 | if replacements.ContainsKey(lowerC) then replacements.[lowerC] else c) 49 | |> String.Concat 50 | 51 | #!fsharp 52 | 53 | leetSpeak "Happy revenge of the 5th!" 54 | 55 | #!markdown 56 | 57 | ### Lorem Ipsum Generator 58 | 59 | This function generates "lorem ipsum" text up to length characters long 60 | 61 | #!fsharp 62 | 63 | let loremIpsum (length: int) = 64 | let words = ["lorem"; "ipsum"; "dolor"; "sit"; "amet"; "consectetur"; "adipiscing"; "elit"] 65 | let rec loop n acc = 66 | if n <= 0 then acc 67 | else 68 | let word = words.[rand.Next(words.Length)] 69 | loop (n - word.Length - 1) (acc + " " + word) 70 | loop length "" 71 | 72 | #!fsharp 73 | 74 | loremIpsum 140 75 | 76 | #!markdown 77 | 78 | ## Function Chaining 79 | 80 | Because when you're doing F#, you sort of have to chain together functions or it doesn't count. It's like a law. 81 | 82 | #!fsharp 83 | 84 | loremIpsum 140 |> leetSpeak |> randomCase 85 | -------------------------------------------------------------------------------- /02_Polyglot/04_GameInfo.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.ML; 2 | using Microsoft.ML.AutoML; 3 | using Microsoft.ML.Data; 4 | 5 | using System.Collections.Generic; 6 | 7 | /// 8 | /// This class represents a single unreleased video game 9 | /// 10 | public class GameInfo 11 | { 12 | [LoadColumn(0)] 13 | public string Title { get; set; } 14 | 15 | // These columns are our Features that impact the ESRB label 16 | [LoadColumn(1)] 17 | public bool Console { get; set; } 18 | [LoadColumn(2)] 19 | public bool AlcoholReference { get; set; } 20 | [LoadColumn(3)] 21 | public bool AnimatedBlood { get; set; } 22 | [LoadColumn(4)] 23 | public bool Blood { get; set; } 24 | [LoadColumn(5)] 25 | public bool BloodAndGore { get; set; } 26 | [LoadColumn(6)] 27 | public bool CartoonViolence { get; set; } 28 | [LoadColumn(7)] 29 | public bool CrudeHumor { get; set; } 30 | [LoadColumn(8)] 31 | public bool DrugReference { get; set; } 32 | [LoadColumn(9)] 33 | public bool FantasyViolence { get; set; } 34 | [LoadColumn(10)] 35 | public bool IntenseViolence { get; set; } 36 | [LoadColumn(11)] 37 | public bool Language { get; set; } 38 | [LoadColumn(12)] 39 | public bool Lyrics { get; set; } 40 | [LoadColumn(13)] 41 | public bool MatureHumor { get; set; } 42 | [LoadColumn(14)] 43 | public bool MildBlood { get; set; } 44 | [LoadColumn(15)] 45 | public bool MildCartoonViolence { get; set; } 46 | [LoadColumn(16)] 47 | public bool MildFantasyViolence { get; set; } 48 | [LoadColumn(17)] 49 | public bool MildLanguage { get; set; } 50 | [LoadColumn(18)] 51 | public bool MildLyrics { get; set; } 52 | [LoadColumn(19)] 53 | public bool MildSuggestiveThemes { get; set; } 54 | [LoadColumn(20)] 55 | public bool MildViolence { get; set; } 56 | [LoadColumn(21)] 57 | public bool NoDescriptors { get; set; } 58 | [LoadColumn(22)] 59 | public bool Nudity { get; set; } 60 | [LoadColumn(23)] 61 | public bool PartialNudity { get; set; } 62 | [LoadColumn(24)] 63 | public bool SexualContent { get; set; } 64 | [LoadColumn(25)] 65 | public bool SexualThemes { get; set; } 66 | [LoadColumn(26)] 67 | public bool SimulatedGambling { get; set; } 68 | [LoadColumn(27)] 69 | public bool StrongLanguage { get; set; } 70 | [LoadColumn(28)] 71 | public bool StrongSexualContent { get; set; } 72 | [LoadColumn(29)] 73 | public bool SuggestiveThemes { get; set; } 74 | [LoadColumn(30)] 75 | public bool UseOfAlcohol { get; set; } 76 | [LoadColumn(31)] 77 | public bool UseOfDrugsAndAlcohol { get; set; } 78 | [LoadColumn(32)] 79 | public bool Violence { get; set; } 80 | 81 | // This is our Label column - the one we're trying to predict 82 | [LoadColumn(33)] 83 | public string ESRBRating { get; set; } 84 | 85 | public override string ToString() => "{" + Title + "}"; 86 | } 87 | 88 | /// 89 | /// This class can report the progress of a machine learning job in progress 90 | /// 91 | public class MulticlassConsoleProgressReporter 92 | : IProgress> 93 | { 94 | public void Report(RunDetail value) 95 | { 96 | if (value.ValidationMetrics != null) 97 | { 98 | double accuracy = value.ValidationMetrics.MacroAccuracy; 99 | 100 | Console.WriteLine($"{value.TrainerName} ran in {value.RuntimeInSeconds:0.00} seconds with accuracy of {accuracy:p}"); 101 | } 102 | else 103 | { 104 | Console.WriteLine($"{value.TrainerName} ran in {value.RuntimeInSeconds:0.00} seconds but did not complete. Time likely expired."); 105 | } 106 | } 107 | } -------------------------------------------------------------------------------- /02_Polyglot/05_InterOp_cs_fs.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Combining C# and F# 8 | If you wanted to combine them, you now can! 9 | 10 | #!csharp 11 | 12 | public class Point 13 | { 14 | public decimal X {get; init;} 15 | public decimal Y {get; init;} 16 | 17 | public override string ToString() => $"Point({X}, {Y})"; 18 | 19 | public Point Scale(decimal factor) => new Point() { X = this.X * factor, Y = this.Y * factor}; 20 | } 21 | 22 | #!csharp 23 | 24 | // We can create a variable of that class as seen before: 25 | Point p = new() { X = 4, Y = 2}; 26 | p 27 | 28 | #!markdown 29 | 30 | Next we'll share the C# variable with F# via the `#!set` command. 31 | 32 | Tip: This can be done using the variables view for easier times remembering the syntax. 33 | 34 | #!fsharp 35 | 36 | #!set --value @csharp:p --name pFSharp 37 | 38 | // Display the current value of P after it's been translated 39 | pFSharp 40 | 41 | #!fsharp 42 | 43 | // Show the type of this variable 44 | pFSharp.GetType() 45 | 46 | #!fsharp 47 | 48 | // In order to get data out of it, you have to get its property out by name 49 | pFSharp.RootElement.GetProperty("X") 50 | 51 | #!markdown 52 | 53 | Additionally, methods are just not available, so `pFSharp.Scale` is nowhere to be found. 54 | 55 | #!markdown 56 | 57 | ### F# to C# 58 | 59 | #!fsharp 60 | 61 | type Person(name: string, age: int) = 62 | member this.Name = name 63 | member this.Age = age 64 | 65 | let bilbo = Person("Bilbo Baggins", 111) 66 | bilbo 67 | 68 | #!markdown 69 | 70 | Now let's take our F# object and translate it to C# 71 | 72 | #!csharp 73 | 74 | #!set --value @fsharp:bilbo --name bilboCS 75 | 76 | bilboCS 77 | 78 | #!csharp 79 | 80 | bilboCS.GetType() 81 | 82 | #!csharp 83 | 84 | int year = 2023; 85 | 86 | #!fsharp 87 | 88 | let month = "May" 89 | 90 | #!fsharp 91 | 92 | #!set --value @csharp:year --name year 93 | 94 | #!csharp 95 | 96 | public class Point 97 | { 98 | public decimal X {get; init;} 99 | public decimal Y {get; init;} 100 | 101 | public override string ToString() => $"Point({X}, {Y})"; 102 | } 103 | 104 | Point p = new() { X=4, Y=2}; 105 | p 106 | 107 | #!fsharp 108 | 109 | #!set --value @csharp:p --name p 110 | 111 | p 112 | 113 | #!fsharp 114 | 115 | p.GetType() 116 | 117 | #!fsharp 118 | 119 | let x = p.RootElement.GetProperty("X").GetInt32() 120 | let y = p.RootElement.GetProperty("Y").GetInt32() 121 | 122 | x, y 123 | -------------------------------------------------------------------------------- /02_Polyglot/06_SQL_KQL.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "## SQL and KQL\n", 8 | "\n", 9 | "Allowing you to use live data in a Polyglot Notebook" 10 | ] 11 | }, 12 | { 13 | "attachments": {}, 14 | "cell_type": "markdown", 15 | "metadata": {}, 16 | "source": [ 17 | "### Connecting to a Database\n", 18 | "\n", 19 | "First we need to import database libraries into Polyglot Notebooks\n", 20 | "\n", 21 | "**Warning:** this part does require an internet connection in order to install the required extensions into Polyglot automatically.\n", 22 | "\n", 23 | "May conference WiFi and tethering have mercy on our souls." 24 | ] 25 | }, 26 | { 27 | "cell_type": "code", 28 | "execution_count": 3, 29 | "metadata": { 30 | "dotnet_interactive": { 31 | "language": "csharp" 32 | }, 33 | "polyglot_notebook": { 34 | "kernelName": "csharp" 35 | } 36 | }, 37 | "outputs": [ 38 | { 39 | "data": { 40 | "text/html": [ 41 | "
Installed Packages
  • Microsoft.DotNet.Interactive.SqlServer, 1.0.0-beta.23205.1
" 42 | ] 43 | }, 44 | "metadata": {}, 45 | "output_type": "display_data" 46 | }, 47 | { 48 | "data": { 49 | "text/plain": [ 50 | "Loading extensions from `C:\\Users\\Admin\\.nuget\\packages\\microsoft.dotnet.interactive.sqlserver\\1.0.0-beta.23205.1\\interactive-extensions\\dotnet\\Microsoft.DotNet.Interactive.SqlServer.dll`" 51 | ] 52 | }, 53 | "metadata": {}, 54 | "output_type": "display_data" 55 | }, 56 | { 57 | "data": { 58 | "text/html": [ 59 | "
Query Microsoft SQL Server databases.\r\n", 60 | "

This extension adds support for connecting to Microsoft SQL Server databases using the #!connect mssql magic command. For more information, run a cell using the #!sql magic command.

\r\n", 61 | "
" 62 | ] 63 | }, 64 | "metadata": {}, 65 | "output_type": "display_data" 66 | } 67 | ], 68 | "source": [ 69 | "#r \"nuget: Microsoft.DotNet.Interactive.SqlServer, *-*\"" 70 | ] 71 | }, 72 | { 73 | "cell_type": "markdown", 74 | "metadata": {}, 75 | "source": [ 76 | "Next we connect to the database via a connection string.\n", 77 | "\n", 78 | "This assumes the database was already created on a local SQLExpress instance by following the `dbSetup.sql` file." 79 | ] 80 | }, 81 | { 82 | "cell_type": "code", 83 | "execution_count": 4, 84 | "metadata": { 85 | "dotnet_interactive": { 86 | "language": "sql" 87 | }, 88 | "polyglot_notebook": { 89 | "kernelName": "sql" 90 | } 91 | }, 92 | "outputs": [ 93 | { 94 | "data": { 95 | "text/plain": [ 96 | "Kernel added: #!sql-polyglot_examples" 97 | ] 98 | }, 99 | "metadata": {}, 100 | "output_type": "display_data" 101 | } 102 | ], 103 | "source": [ 104 | "#!connect mssql --kernel-name polyglot_examples \"Persist Security Info=False; Integrated Security=true; Encrypt=False; Initial Catalog=PolyglotNotebookExamples; Server=localhost\\SQLEXPRESS\"" 105 | ] 106 | }, 107 | { 108 | "attachments": {}, 109 | "cell_type": "markdown", 110 | "metadata": {}, 111 | "source": [ 112 | "Note: if you re-run the above cell you get an ugly error since the SQL kernel already exists" 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": 5, 118 | "metadata": { 119 | "dotnet_interactive": { 120 | "language": "sql" 121 | }, 122 | "polyglot_notebook": { 123 | "kernelName": "sql" 124 | } 125 | }, 126 | "outputs": [ 127 | { 128 | "data": { 129 | "text/plain": [ 130 | "(5 rows affected)" 131 | ] 132 | }, 133 | "metadata": {}, 134 | "output_type": "display_data" 135 | }, 136 | { 137 | "data": { 138 | "text/csv": [ 139 | "joke,punchline\r\n", 140 | "\"Why did the developer go broke?\",\"Because he used up all his cache.\"\r\n", 141 | "\"Why did the developer go broke?\",\"Because they used up all their cache.\"\r\n", 142 | "\"Why did the programmer get stuck in the shower?\",\"Because the instructions on the shampoo bottle said: Lather, Rinse, Repeat.\"\r\n", 143 | "\"Why did the programmer get stuck in the shower?\",\"Because the instructions on the shampoo bottle said: Lather, Rinse, Repeat.\"\r\n", 144 | "\"Why did the programmer quit his job?\",\"Because he didn't get arrays.\"\r\n" 145 | ], 146 | "text/html": [ 147 | "
jokepunchline
Why did the developer go broke?Because he used up all his cache.
Why did the developer go broke?Because they used up all their cache.
Why did the programmer get stuck in the shower?Because the instructions on the shampoo bottle said: Lather, Rinse, Repeat.
Why did the programmer get stuck in the shower?Because the instructions on the shampoo bottle said: Lather, Rinse, Repeat.
Why did the programmer quit his job?Because he didn't get arrays.
" 179 | ] 180 | }, 181 | "metadata": {}, 182 | "output_type": "display_data" 183 | } 184 | ], 185 | "source": [ 186 | "#!sql-polyglot_examples --name sqlJokes\n", 187 | "SELECT TOP 5\n", 188 | " j.joke, \n", 189 | " j.punchline \n", 190 | "FROM \n", 191 | " dad_jokes j\n", 192 | "ORDER BY \n", 193 | " j.joke,\n", 194 | " j.punchline" 195 | ] 196 | }, 197 | { 198 | "attachments": {}, 199 | "cell_type": "markdown", 200 | "metadata": {}, 201 | "source": [ 202 | "### Sharing Query Data between Languages\n", 203 | "Because Polyglot is all about sharing, you can share query results from SQL to C# and other languages" 204 | ] 205 | }, 206 | { 207 | "cell_type": "code", 208 | "execution_count": 11, 209 | "metadata": { 210 | "dotnet_interactive": { 211 | "language": "csharp" 212 | }, 213 | "polyglot_notebook": { 214 | "kernelName": "csharp" 215 | } 216 | }, 217 | "outputs": [ 218 | { 219 | "name": "stdout", 220 | "output_type": "stream", 221 | "text": [ 222 | "Why did the developer go broke?\n", 223 | "... Because he used up all his cache.\n", 224 | "\n", 225 | "Why did the developer go broke?\n", 226 | "... Because they used up all their cache.\n", 227 | "\n", 228 | "Why did the programmer get stuck in the shower?\n", 229 | "... Because the instructions on the shampoo bottle said: Lather, Rinse, Repeat.\n", 230 | "\n", 231 | "Why did the programmer get stuck in the shower?\n", 232 | "... Because the instructions on the shampoo bottle said: Lather, Rinse, Repeat.\n", 233 | "\n", 234 | "Why did the programmer quit his job?\n", 235 | "... Because he didn't get arrays.\n", 236 | "\n" 237 | ] 238 | } 239 | ], 240 | "source": [ 241 | "#!share --from sql-polyglot_examples sqlJokes\n", 242 | "\n", 243 | "using System.Collections.Generic;\n", 244 | "using Microsoft.DotNet.Interactive.Formatting.TabularData;\n", 245 | "\n", 246 | "TabularDataResource table = sqlJokes.First();\n", 247 | "\n", 248 | "// You can get at the indivual rows by looping over the data and then finding the key value pairs by key name.\n", 249 | "// There's probably a way to get this into a more natural dictionary, but I've not found it yet\n", 250 | "foreach (List> row in table.Data) {\n", 251 | " string joke = row.Find(r => r.Key == \"joke\").Value.ToString();\n", 252 | " string punchline = row.Find(r => r.Key == \"punchline\").Value.ToString();\n", 253 | "\n", 254 | " Console.WriteLine(joke);\n", 255 | " Console.WriteLine(\"... \" + punchline);\n", 256 | " Console.WriteLine();\n", 257 | "}" 258 | ] 259 | }, 260 | { 261 | "attachments": {}, 262 | "cell_type": "markdown", 263 | "metadata": {}, 264 | "source": [ 265 | "### A note on KQL\n", 266 | "\n", 267 | "Polyglot Notebooks supports Kusto Query Language (KQL), however your presenter's current knowledge does not.\n", 268 | "\n", 269 | "A sample KQL statement would look like this:\n", 270 | "\n", 271 | "``` kql\n", 272 | "#!kql-polyglot_examples --name kqlErrors\n", 273 | "\n", 274 | "logs\n", 275 | "| where severity == \"error\"\n", 276 | "| project timestamp, message\n", 277 | "```" 278 | ] 279 | }, 280 | { 281 | "attachments": {}, 282 | "cell_type": "markdown", 283 | "metadata": {}, 284 | "source": [ 285 | "This would run a Kusto Query Language statement against an established connection named `polyglot-examples` and display the results in a similar manner to a SQL statement.\n", 286 | "\n", 287 | "You can read more about KQL support in the [official documentation](https://github.com/dotnet/interactive/blob/main/docs/working-with-data.md)." 288 | ] 289 | } 290 | ], 291 | "metadata": { 292 | "kernelspec": { 293 | "display_name": ".NET (C#)", 294 | "language": "C#", 295 | "name": ".net-csharp" 296 | }, 297 | "language_info": { 298 | "name": "polyglot-notebook" 299 | }, 300 | "polyglot_notebook": { 301 | "kernelInfo": { 302 | "defaultKernelName": "sql", 303 | "items": [ 304 | { 305 | "aliases": [], 306 | "languageName": "sql", 307 | "name": "sql" 308 | }, 309 | { 310 | "aliases": [], 311 | "languageName": "T-SQL", 312 | "name": "sql-polyglot_examples" 313 | } 314 | ] 315 | } 316 | } 317 | }, 318 | "nbformat": 4, 319 | "nbformat_minor": 2 320 | } 321 | -------------------------------------------------------------------------------- /02_Polyglot/07_PowerShell.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Powershell Support 8 | Powershell has full support for variable sharing and all of the standard Polyglot goodness. Here's using Powershell to talk to a locally running identification server. 9 | 10 | #!pwsh 11 | 12 | $URL = "https://localhost:7041/iam" 13 | $METHOD = "GET" 14 | 15 | $RESPONSE = Invoke-RestMethod -Uri $URL -Method $METHOD 16 | 17 | $RESPONSE 18 | -------------------------------------------------------------------------------- /02_Polyglot/09_InterOp_JS_HTML.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## What's JS good at in Polyglot Notebooks? 8 | 9 | JavaScript is good at adding additional interactivity and flare to your page or using libraries like D3.js 10 | 11 | #!markdown 12 | 13 | ## HTML and JavaScript 14 | Here's some basic HTML in a notebook 15 | 16 | #!markdown 17 | 18 | Click into this cell to check it out. 19 | 20 |

This is HTML!

21 | 22 | #!markdown 23 | 24 | ### Rendering Content with D3 JS 25 | Example taken from [Polyglot Notebooks documentation](https://github.com/dotnet/interactive/blob/main/samples/notebooks/javascript/D3.js%20with%20import.ipynb) 26 | 27 | #!html 28 | 29 | 30 | 31 | #!javascript 32 | 33 | d3 = await import("https://cdn.jsdelivr.net/npm/d3@7/+esm"); 34 | 35 | const width = 200; 36 | const height = 200; 37 | const svg = d3.select("#d3_target"); 38 | 39 | svg 40 | .attr("width", width) 41 | .attr("height", height) 42 | .attr("viewBox", [0, 0, width, height]) 43 | .attr("style", "max-width: 100%; height: auto; height: intrinsic;"); 44 | 45 | svg 46 | .append("circle") 47 | .attr("fill", "steelblue") 48 | .attr("cx", width/2) 49 | .attr("cy", height/2) 50 | .attr("r", "75"); 51 | -------------------------------------------------------------------------------- /02_Polyglot/10_Mermaid.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Mermaid Diagrams 8 | 9 | #!markdown 10 | 11 | ![Mermaid Mind Map](../Images/MM_Mermaid.png) 12 | 13 | #!mermaid 14 | 15 | flowchart LR 16 | c[Client] 17 | s[Server] 18 | db[Database] 19 | 20 | c -- HTTP GET --> s 21 | s -- SQL Query --> db 22 | db -. Result Set .-> s 23 | s -. JSON .-> c 24 | 25 | #!mermaid 26 | 27 | erDiagram 28 | COUNTRY ||--|{ STATE : "Has" 29 | STATE ||--|{ CITY : "Has" 30 | CITY ||--o| STATE : "Is capital of" 31 | CITY ||--o| COUNTRY : "Is capital of" 32 | 33 | #!mermaid 34 | 35 | sequenceDiagram 36 | actor C as Client 37 | participant S as Server 38 | participant DB as Database 39 | C->>S: Login (Username, Password) 40 | S->>DB: Select User Info 41 | note over DB: Password is not stored in database 42 | DB-->>S: Salt & Hash 43 | S-->>C: 200 OK & JWT 44 | note over C, S: Subsequent requests include JWT 45 | 46 | #!mermaid 47 | 48 | %%{init: { 'theme': 'base' } }%% 49 | gitGraph 50 | commit tag: "v0.4.0" 51 | branch feature 52 | checkout main 53 | commit 54 | branch bugfix 55 | commit 56 | checkout feature 57 | commit id: "Dark Theme" 58 | checkout main 59 | merge feature 60 | commit tag: "v0.4.1" 61 | commit 62 | checkout bugfix 63 | commit id: "Fixed Null Ref" 64 | checkout main 65 | merge bugfix tag: "v0.4.2" 66 | commit 67 | 68 | #!mermaid 69 | 70 | gantt 71 | title Write about Mermaid.js Gantt Charts 72 | Create code for Gantt chart : 2023-04-11, 2d 73 | Outline article on Gantt charts : 2023-04-12, 2d 74 | Write article on Gantt charts : 2023-04-13, 1d 75 | Publish article on Gantt charts : 2023-04-14, 1d 76 | 77 | #!mermaid 78 | 79 | stateDiagram-v2 80 | direction LR 81 | 82 | state intro { 83 | [*] --> Descending 84 | Descending --> Roar 85 | Roar --> [*] 86 | } 87 | state combat { 88 | [*] --> Attacking 89 | Attacking --> Pain 90 | Pain --> Attacking 91 | } 92 | state defeated { 93 | [*] --> Dying 94 | Dying --> Dead 95 | Dead --> [*] 96 | } 97 | 98 | [*] --> intro 99 | intro --> combat 100 | combat --> defeated 101 | defeated --> [*] 102 | 103 | #!mermaid 104 | 105 | journey 106 | title Attend a Tech Conference 107 | section Pre-Conference 108 | Buy a Ticket: 4: Attendees, Web Site 109 | Check Schedule before Conference: 3: Attendees, Web Site 110 | section Morning 111 | Check in at Conference: 5: Attendees, Volunteers 112 | Attend Talk: 5: Attendees, Speakers, Volunteers 113 | section Afternoon 114 | Lunch: 4: Attendees, Volunteers 115 | "Hallway Track": 5: Attendees, Volunteers 116 | Post-Conference Movie: 7: Attendees, Volunteers, Speakers 117 | -------------------------------------------------------------------------------- /02_Polyglot/12_Formatting.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Extending Polyglot Notebooks 8 | 9 | #!markdown 10 | 11 | ### Formatting 12 | 13 | The formatter allows you to display custom HTML for any Type you want to display as the result of a cell. 14 | 15 | This example, taken from [Polyglot Notebooks documentation](https://github.com/dotnet/interactive/blob/main/docs/formatting.md), shows configuring the `Formatter` to render `System.Drawing.Rectangle` objects as rectangles using SVG instead of just listing their properties. 16 | 17 | #!csharp 18 | 19 | using System.Drawing; 20 | using Microsoft.DotNet.Interactive.Formatting; 21 | 22 | #!csharp 23 | 24 | Rectangle rect = new() { X=0, Y=0, Width=200, Height=50}; 25 | 26 | // This is the default appearance of a rectangle 27 | rect 28 | 29 | #!csharp 30 | 31 | // Any subsequent renderings of the Redctangle class now use this styling 32 | Formatter.Register( 33 | rect => $""" 34 | 35 | 38 | 39 | """, 40 | mimeType: "text/html"); 41 | 42 | // This will follow the new styling 43 | rect 44 | -------------------------------------------------------------------------------- /02_Polyglot/13_Extensions.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "attachments": {}, 5 | "cell_type": "markdown", 6 | "metadata": {}, 7 | "source": [ 8 | "## Extensions" 9 | ] 10 | }, 11 | { 12 | "attachments": {}, 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "#### Clock Example\n", 17 | "You can author custom formatters in DLL form as seen with the [Polyglot Notebooks Clock Sample](https://github.com/dotnet/interactive/blob/main/docs/extending-dotnet-interactive.md)\n", 18 | "\n", 19 | "![Clock Formatter](../Images/ClockExtensionInvoke.png)" 20 | ] 21 | }, 22 | { 23 | "attachments": {}, 24 | "cell_type": "markdown", 25 | "metadata": {}, 26 | "source": [ 27 | "### Explain Sample (ExtensionLab)\n", 28 | "The ExtensionLab repository contains a few pre-built extensions including the `!explain` magic command that observes code behavior and pipes the results to the Mermaid kernel." 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": 1, 34 | "metadata": { 35 | "dotnet_interactive": { 36 | "language": "csharp" 37 | }, 38 | "polyglot_notebook": { 39 | "kernelName": "csharp" 40 | } 41 | }, 42 | "outputs": [ 43 | { 44 | "data": { 45 | "text/html": [ 46 | "
Installed Packages
  • Microsoft.DotNet.Interactive.ExtensionLab, 1.0.0-beta.23205.1
" 47 | ] 48 | }, 49 | "metadata": {}, 50 | "output_type": "display_data" 51 | }, 52 | { 53 | "data": { 54 | "text/plain": [ 55 | "Loading extensions from `C:\\Users\\MattE\\.nuget\\packages\\microsoft.dotnet.interactive.extensionlab\\1.0.0-beta.23205.1\\interactive-extensions\\dotnet\\Microsoft.DotNet.Interactive.ExtensionLab.dll`" 56 | ] 57 | }, 58 | "metadata": {}, 59 | "output_type": "display_data" 60 | }, 61 | { 62 | "data": { 63 | "text/html": [ 64 | "
Create strongly-typed dataframes using#!linqify.\r\n", 65 | "

The #!linqify magic command replaces a Microsoft.Data.Analysis.DataFrame variable with a generated, strongly-typed data frame, allowing the use of LINQ operations over the contained data.

\r\n", 66 | "
" 67 | ] 68 | }, 69 | "metadata": {}, 70 | "output_type": "display_data" 71 | }, 72 | { 73 | "data": { 74 | "text/html": [ 75 | "
ExplainCode\r\n", 76 | "

This extension generates Sequence diagrams from csharp code using Mermaid kernel.

\r\n", 77 | "
" 78 | ] 79 | }, 80 | "metadata": {}, 81 | "output_type": "display_data" 82 | }, 83 | { 84 | "data": { 85 | "text/html": [ 86 | "
Inspect code compilation details using the #!inspect magic command.\r\n", 87 | "

The #!inspect magic command allows you to see the C# decompilation, IL, and JIT Asm for the code in a C# cell.

\r\n", 88 | " \r\n", 89 | "
" 90 | ] 91 | }, 92 | "metadata": {}, 93 | "output_type": "display_data" 94 | }, 95 | { 96 | "data": { 97 | "text/html": [ 98 | "
Use the #!record magic command to keep a transcript of the code you run.\r\n", 99 | "

Once you enable transcripts using #!record, each code submission (including re-running cells) is recorded in the specified file. The JSON format used is the same format recognized by the .NET Interactive stdio and http APIs and can be used to replay an interactive session via automation.

\r\n", 100 | " \r\n", 101 | "
" 102 | ] 103 | }, 104 | "metadata": {}, 105 | "output_type": "display_data" 106 | }, 107 | { 108 | "data": { 109 | "text/html": [ 110 | "
Query SQLite databases.\r\n", 111 | "

This extension adds support for connecting to SQLite databases using the #!connect sqlite magic command. For more information, run a cell using the #!sql magic command.

\r\n", 112 | "
" 113 | ] 114 | }, 115 | "metadata": {}, 116 | "output_type": "display_data" 117 | }, 118 | { 119 | "data": { 120 | "text/plain": [ 121 | "Loading extensions from `C:\\Users\\MattE\\.nuget\\packages\\microsoft.data.analysis\\0.20.0\\interactive-extensions\\dotnet\\Microsoft.Data.Analysis.Interactive.dll`" 122 | ] 123 | }, 124 | "metadata": {}, 125 | "output_type": "display_data" 126 | } 127 | ], 128 | "source": [ 129 | "#r \"nuget:Microsoft.DotNet.Interactive.ExtensionLab, *-*\"" 130 | ] 131 | }, 132 | { 133 | "cell_type": "code", 134 | "execution_count": 6, 135 | "metadata": { 136 | "dotnet_interactive": { 137 | "language": "csharp" 138 | }, 139 | "polyglot_notebook": { 140 | "kernelName": "csharp" 141 | } 142 | }, 143 | "outputs": [ 144 | { 145 | "data": { 146 | "text/html": [ 147 | "
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ... (21 more) ]
" 179 | ] 180 | }, 181 | "metadata": {}, 182 | "output_type": "display_data" 183 | } 184 | ], 185 | "source": [ 186 | "using System.Collections.Generic;\n", 187 | "\n", 188 | "List items = new();\n", 189 | "for (int i = 0; i < 42; i++) {\n", 190 | " items.Add(i);\n", 191 | "}\n", 192 | "items.RemoveAt(0);\n", 193 | "\n", 194 | "items" 195 | ] 196 | }, 197 | { 198 | "cell_type": "code", 199 | "execution_count": 7, 200 | "metadata": { 201 | "dotnet_interactive": { 202 | "language": "csharp" 203 | }, 204 | "polyglot_notebook": { 205 | "kernelName": "csharp" 206 | } 207 | }, 208 | "outputs": [ 209 | { 210 | "data": { 211 | "text/html": [ 212 | "
\r\n", 213 | "\r\n", 214 | "\r\n", 257 | "
\r\n", 258 | "
\r\n" 259 | ] 260 | }, 261 | "metadata": {}, 262 | "output_type": "display_data" 263 | } 264 | ], 265 | "source": [ 266 | "#!explain\n", 267 | "\n", 268 | "using System.Collections.Generic;\n", 269 | "\n", 270 | "List items = new();\n", 271 | "for (int i = 0; i < 42; i++) {\n", 272 | " items.Add(i);\n", 273 | "}\n", 274 | "items.RemoveAt(0);\n", 275 | "\n", 276 | "items" 277 | ] 278 | } 279 | ], 280 | "metadata": { 281 | "kernelspec": { 282 | "display_name": ".NET (C#)", 283 | "language": "C#", 284 | "name": ".net-csharp" 285 | }, 286 | "language_info": { 287 | "name": "polyglot-notebook" 288 | }, 289 | "polyglot_notebook": { 290 | "kernelInfo": { 291 | "defaultKernelName": "csharp", 292 | "items": [ 293 | { 294 | "aliases": [], 295 | "languageName": "csharp", 296 | "name": "csharp" 297 | } 298 | ] 299 | } 300 | } 301 | }, 302 | "nbformat": 4, 303 | "nbformat_minor": 2 304 | } 305 | -------------------------------------------------------------------------------- /02_Polyglot/92_InteractiveDocumentation.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Interactive Documentation 8 | 9 | I make no claims to authorship of this documentation. I asked Bing chat to generate this markdown and then I converted it to a `.dib` file. 10 | 11 | My point here is that documentation doesn't have to be static examples. We can have live code embedded in our documentation that others can play with. 12 | 13 | #!markdown 14 | 15 | ### Lists in C# 16 | 17 | A `List` is a collection of objects that can be accessed by index. It is similar to an array, but it has some additional functionality that makes it more flexible. 18 | 19 | #!markdown 20 | 21 | #### Creating a List 22 | 23 | To create a `List`, you need to specify the type of objects that the `List` will contain. Here's an example of creating a `List` of `int` values: 24 | 25 | #!csharp 26 | 27 | List numbers = new List(); 28 | numbers.Add(614); 29 | numbers 30 | 31 | #!markdown 32 | 33 | You can also initialize a `List` with some values like this: 34 | 35 | #!csharp 36 | 37 | List numbers = new List { 1, 2, 3 }; 38 | 39 | numbers 40 | 41 | #!markdown 42 | 43 | #### Adding and Removing Items 44 | 45 | You can add items to a `List` using the `Add()` method: 46 | 47 | #!csharp 48 | 49 | numbers.Add(4); 50 | 51 | numbers 52 | 53 | #!markdown 54 | 55 | You can also insert an item at a specific index using the `Insert()` method: 56 | 57 | #!csharp 58 | 59 | numbers.Insert(0, 0); 60 | 61 | numbers 62 | 63 | #!markdown 64 | 65 | To remove an item from a `List`, you can use the `Remove()` method: 66 | 67 | #!csharp 68 | 69 | numbers.Remove(1); 70 | 71 | numbers 72 | 73 | #!markdown 74 | 75 | Or you can remove an item at a specific index using the `RemoveAt()` method: 76 | 77 | #!csharp 78 | 79 | numbers.RemoveAt(0); 80 | 81 | numbers 82 | 83 | #!markdown 84 | 85 | #### Accessing Items 86 | 87 | You can access items in a `List` by index just like you would with an array: 88 | 89 | #!csharp 90 | 91 | int firstNumber = numbers[0]; 92 | 93 | firstNumber 94 | 95 | #!markdown 96 | 97 | You can also use the `IndexOf()` method to find the index of an item in the `List`: 98 | 99 | #!csharp 100 | 101 | int index = numbers.IndexOf(2); 102 | 103 | index 104 | 105 | #!markdown 106 | 107 | #### Modifying Items 108 | 109 | You can modify items in a `List` by assigning a new value to an index: 110 | 111 | #!csharp 112 | 113 | numbers[0] = 5; 114 | 115 | numbers 116 | 117 | #!markdown 118 | 119 | #### Looping Through a List 120 | 121 | You can loop through a `List` using a `for` loop or a `foreach` loop: 122 | 123 | #!csharp 124 | 125 | // Looping with a loop 126 | for (int i = 0; i < numbers.Count; i++) 127 | { 128 | Console.WriteLine(numbers[i]); 129 | } 130 | 131 | #!csharp 132 | 133 | // Looping using foreach 134 | foreach (int number in numbers) 135 | { 136 | Console.WriteLine(number); 137 | } 138 | -------------------------------------------------------------------------------- /02_Polyglot/95_ComputerVision.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "attachments": {}, 5 | "cell_type": "markdown", 6 | "metadata": {}, 7 | "source": [ 8 | "## Computer Vision\n", 9 | "Notebooks can be used to configure and launch occasional manual tasks instead of building a full application.\n", 10 | "\n", 11 | "This notebook analyzes an image on disk using Azure Cognitive Services and displays the results to the user" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 8, 17 | "metadata": { 18 | "dotnet_interactive": { 19 | "language": "csharp" 20 | }, 21 | "polyglot_notebook": { 22 | "kernelName": "csharp" 23 | } 24 | }, 25 | "outputs": [], 26 | "source": [ 27 | "using System.IO;\n", 28 | "\n", 29 | "string filePath = Path.Combine(Environment.CurrentDirectory, \"../Images/JesterKeyboard.png\");" 30 | ] 31 | }, 32 | { 33 | "attachments": {}, 34 | "cell_type": "markdown", 35 | "metadata": {}, 36 | "source": [ 37 | "### Setup" 38 | ] 39 | }, 40 | { 41 | "cell_type": "code", 42 | "execution_count": 9, 43 | "metadata": { 44 | "dotnet_interactive": { 45 | "language": "csharp" 46 | }, 47 | "polyglot_notebook": { 48 | "kernelName": "csharp" 49 | } 50 | }, 51 | "outputs": [ 52 | { 53 | "data": { 54 | "text/html": [ 55 | "
Installed Packages
  • Microsoft.Azure.CognitiveServices.Vision.ComputerVision, 7.0.1
  • Newtonsoft.Json, 13.0.3
" 56 | ] 57 | }, 58 | "metadata": {}, 59 | "output_type": "display_data" 60 | } 61 | ], 62 | "source": [ 63 | "#r \"nuget:Microsoft.Azure.CognitiveServices.Vision.ComputerVision\"\n", 64 | "#r \"nuget:Newtonsoft.Json\"" 65 | ] 66 | }, 67 | { 68 | "cell_type": "code", 69 | "execution_count": 10, 70 | "metadata": { 71 | "dotnet_interactive": { 72 | "language": "csharp" 73 | }, 74 | "polyglot_notebook": { 75 | "kernelName": "csharp" 76 | } 77 | }, 78 | "outputs": [], 79 | "source": [ 80 | "using Microsoft.Azure.CognitiveServices.Vision.ComputerVision;\n", 81 | "using Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models;\n", 82 | "\n", 83 | "using System.Collections.Generic;\n", 84 | "using System.IO;" 85 | ] 86 | }, 87 | { 88 | "cell_type": "code", 89 | "execution_count": 11, 90 | "metadata": { 91 | "dotnet_interactive": { 92 | "language": "csharp" 93 | }, 94 | "polyglot_notebook": { 95 | "kernelName": "csharp" 96 | } 97 | }, 98 | "outputs": [], 99 | "source": [ 100 | "// Determine what features we care about in our image\n", 101 | "List features = new() { \n", 102 | " VisualFeatureTypes.Categories,\n", 103 | " VisualFeatureTypes.Description,\n", 104 | " VisualFeatureTypes.ImageType,\n", 105 | " VisualFeatureTypes.Tags,\n", 106 | " VisualFeatureTypes.Adult,\n", 107 | " VisualFeatureTypes.Objects,\n", 108 | " VisualFeatureTypes.Color,\n", 109 | " VisualFeatureTypes.Faces,\n", 110 | " VisualFeatureTypes.Brands,\n", 111 | "};" 112 | ] 113 | }, 114 | { 115 | "cell_type": "code", 116 | "execution_count": 12, 117 | "metadata": { 118 | "dotnet_interactive": { 119 | "language": "csharp" 120 | }, 121 | "polyglot_notebook": { 122 | "kernelName": "csharp" 123 | } 124 | }, 125 | "outputs": [], 126 | "source": [ 127 | "// This has been retired and won't work for you\n", 128 | "string endpoint = \"https://eland-cog-services-demo.cognitiveservices.azure.com/\";\n", 129 | "string apiKey = \"2533c1b2cf3b4b479ba1609e698f96c4\";" 130 | ] 131 | }, 132 | { 133 | "cell_type": "code", 134 | "execution_count": 13, 135 | "metadata": { 136 | "dotnet_interactive": { 137 | "language": "csharp" 138 | }, 139 | "polyglot_notebook": { 140 | "kernelName": "csharp" 141 | } 142 | }, 143 | "outputs": [], 144 | "source": [ 145 | "// The credentials object lets us authenticate against Azure.\n", 146 | "ApiKeyServiceClientCredentials credentials = new(apiKey);\n", 147 | "\n", 148 | "// The Computer Vision Client lets us call out to Cognitive Services\n", 149 | "ComputerVisionClient client = new(credentials);\n", 150 | "client.Endpoint = endpoint;" 151 | ] 152 | }, 153 | { 154 | "attachments": {}, 155 | "cell_type": "markdown", 156 | "metadata": {}, 157 | "source": [ 158 | "Here is the image we'll send to Azure Cognitive Services:\n", 159 | "\n", 160 | "![A puppy on a hand on a keyboard](../Images/JesterKeyboard.png)" 161 | ] 162 | }, 163 | { 164 | "cell_type": "code", 165 | "execution_count": 14, 166 | "metadata": { 167 | "dotnet_interactive": { 168 | "language": "csharp" 169 | }, 170 | "polyglot_notebook": { 171 | "kernelName": "csharp" 172 | } 173 | }, 174 | "outputs": [], 175 | "source": [ 176 | "ImageAnalysis analysis;\n", 177 | "\n", 178 | "// Load the image's data into memory\n", 179 | "using (Stream imageStream = File.OpenRead(filePath)) {\n", 180 | " \n", 181 | " // Send the image data to Azure Cognitive Services\n", 182 | " analysis = await client.AnalyzeImageInStreamAsync(imageStream, features);\n", 183 | "}" 184 | ] 185 | }, 186 | { 187 | "attachments": {}, 188 | "cell_type": "markdown", 189 | "metadata": {}, 190 | "source": [ 191 | "### Exploring the Analysis Results" 192 | ] 193 | }, 194 | { 195 | "cell_type": "code", 196 | "execution_count": 15, 197 | "metadata": { 198 | "dotnet_interactive": { 199 | "language": "csharp" 200 | }, 201 | "polyglot_notebook": { 202 | "kernelName": "csharp" 203 | } 204 | }, 205 | "outputs": [ 206 | { 207 | "data": { 208 | "text/html": [ 209 | "
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.ImageAnalysis
Categories
indexvalue
0
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.Category
Nameothers_
Score
0.00390625
Detail
<null>
Adult
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.AdultInfo
IsAdultContent
False
IsRacyContent
False
IsGoryContent
False
AdultScore
0.002754890825599432
RacyScore
0.005863004829734564
GoreScore
0.2202041894197464
Color
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.ColorInfo
DominantColorForegroundBrown
DominantColorBackgroundBrown
DominantColors
[ Brown, Black ]
AccentColor7D2A05
IsBWImg
False
ImageType
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.ImageType
ClipArtType
0
LineDrawingType
0
Tags
indexvalue
0
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.ImageTag
Nameindoor
Confidence
0.9848715662956238
Hint
<null>
1
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.ImageTag
Namecomputer
Confidence
0.9793701171875
Hint
<null>
2
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.ImageTag
Nameanimal
Confidence
0.9454659819602966
Hint
<null>
3
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.ImageTag
Namecomputer keyboard
Confidence
0.9284276962280273
Hint
<null>
4
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.ImageTag
Namepersonal computer
Confidence
0.9160323143005371
Hint
<null>
(15 more)
Description
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.ImageDescriptionDetails
Tags
[ text, indoor, dog, computer, person ... (1 more) ]
Captions
indexvalue
0
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.ImageCaption
Texta dog sleeping on a desk
Confidence
0.3856593370437622
Faces
Objects
indexvalue
0
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.DetectedObject
Rectangle
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.BoundingRect
X
404
Y
185
W
193
H
137
ObjectPropertycomputer keyboard
Confidence
0.551
Parent
<null>
1
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.DetectedObject
Rectangle
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.BoundingRect
X
0
Y
0
W
271
H
281
ObjectPropertydisplay
Confidence
0.655
Parent
<null>
2
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.DetectedObject
Rectangle
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.BoundingRect
X
279
Y
0
W
321
H
131
ObjectPropertydisplay
Confidence
0.773
Parent
<null>
3
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.DetectedObject
Rectangle
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.BoundingRect
X
62
Y
131
W
373
H
203
ObjectPropertydog
Confidence
0.507
Parent
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.ObjectHierarchy
ObjectPropertymammal
Confidence
0.871
Parent
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.ObjectHierarchy
ObjectPropertyanimal
Confidence
0.871
Parent
<null>
Brands
RequestId2edb36cc-8b22-4aa3-af08-7cbd40c28879
Metadata
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.ImageMetadata
Width
600
Height
449
FormatPng
ModelVersion2021-05-01
" 241 | ] 242 | }, 243 | "metadata": {}, 244 | "output_type": "display_data" 245 | } 246 | ], 247 | "source": [ 248 | "using Microsoft.DotNet.Interactive.Formatting;\n", 249 | "Formatter.ListExpansionLimit = 5;\n", 250 | "\n", 251 | "analysis" 252 | ] 253 | }, 254 | { 255 | "cell_type": "code", 256 | "execution_count": 16, 257 | "metadata": { 258 | "dotnet_interactive": { 259 | "language": "csharp" 260 | }, 261 | "polyglot_notebook": { 262 | "kernelName": "csharp" 263 | } 264 | }, 265 | "outputs": [ 266 | { 267 | "data": { 268 | "text/html": [ 269 | "
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.ImageCaption
Texta dog sleeping on a desk
Confidence
0.3856593370437622
" 301 | ] 302 | }, 303 | "metadata": {}, 304 | "output_type": "display_data" 305 | } 306 | ], 307 | "source": [ 308 | "// Display the primary caption and its confidence\n", 309 | "analysis.Description.Captions[0]" 310 | ] 311 | }, 312 | { 313 | "cell_type": "code", 314 | "execution_count": 17, 315 | "metadata": { 316 | "dotnet_interactive": { 317 | "language": "csharp" 318 | }, 319 | "polyglot_notebook": { 320 | "kernelName": "csharp" 321 | } 322 | }, 323 | "outputs": [ 324 | { 325 | "name": "stdout", 326 | "output_type": "stream", 327 | "text": [ 328 | "indoor (98.49% Confidence)\n", 329 | "computer (97.94% Confidence)\n", 330 | "animal (94.55% Confidence)\n", 331 | "computer keyboard (92.84% Confidence)\n", 332 | "personal computer (91.60% Confidence)\n", 333 | "input device (90.87% Confidence)\n", 334 | "desk (88.89% Confidence)\n", 335 | "dog (88.82% Confidence)\n", 336 | "computer hardware (88.35% Confidence)\n", 337 | "output device (87.93% Confidence)\n", 338 | "electronic device (87.56% Confidence)\n", 339 | "peripheral (86.15% Confidence)\n", 340 | "keyboard (85.36% Confidence)\n", 341 | "space bar (85.06% Confidence)\n", 342 | "computer monitor (84.90% Confidence)\n", 343 | "display device (84.40% Confidence)\n", 344 | "office equipment (84.20% Confidence)\n", 345 | "person (84.03% Confidence)\n", 346 | "floor (72.31% Confidence)\n", 347 | "lap (53.11% Confidence)\n" 348 | ] 349 | } 350 | ], 351 | "source": [ 352 | "// Display Tags\n", 353 | "foreach (ImageTag tag in analysis.Tags) {\n", 354 | " Console.WriteLine($\"{tag.Name} ({tag.Confidence:P} Confidence)\");\n", 355 | "}" 356 | ] 357 | }, 358 | { 359 | "cell_type": "code", 360 | "execution_count": 18, 361 | "metadata": { 362 | "dotnet_interactive": { 363 | "language": "csharp" 364 | }, 365 | "polyglot_notebook": { 366 | "kernelName": "csharp" 367 | } 368 | }, 369 | "outputs": [ 370 | { 371 | "data": { 372 | "text/html": [ 373 | "
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.ColorInfo
DominantColorForegroundBrown
DominantColorBackgroundBrown
DominantColors
[ Brown, Black ]
AccentColor7D2A05
IsBWImg
False
" 405 | ] 406 | }, 407 | "metadata": {}, 408 | "output_type": "display_data" 409 | } 410 | ], 411 | "source": [ 412 | "// Display color information\n", 413 | "analysis.Color" 414 | ] 415 | }, 416 | { 417 | "cell_type": "code", 418 | "execution_count": 19, 419 | "metadata": { 420 | "dotnet_interactive": { 421 | "language": "csharp" 422 | }, 423 | "polyglot_notebook": { 424 | "kernelName": "csharp" 425 | } 426 | }, 427 | "outputs": [ 428 | { 429 | "data": { 430 | "text/html": [ 431 | "
Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.AdultInfo
IsAdultContent
False
IsRacyContent
False
IsGoryContent
False
AdultScore
0.002754890825599432
RacyScore
0.005863004829734564
GoreScore
0.2202041894197464
" 463 | ] 464 | }, 465 | "metadata": {}, 466 | "output_type": "display_data" 467 | } 468 | ], 469 | "source": [ 470 | "// Is this adult, racy, or gory?\n", 471 | "analysis.Adult" 472 | ] 473 | }, 474 | { 475 | "cell_type": "code", 476 | "execution_count": 20, 477 | "metadata": { 478 | "dotnet_interactive": { 479 | "language": "csharp" 480 | }, 481 | "polyglot_notebook": { 482 | "kernelName": "csharp" 483 | } 484 | }, 485 | "outputs": [ 486 | { 487 | "name": "stdout", 488 | "output_type": "stream", 489 | "text": [ 490 | "computer keyboard detected at 404, 185 by 193, 137 (55.10% Confidence)\n", 491 | "display detected at 0, 0 by 271, 281 (65.50% Confidence)\n", 492 | "display detected at 279, 0 by 321, 131 (77.30% Confidence)\n", 493 | "dog detected at 62, 131 by 373, 203 (50.70% Confidence)\n" 494 | ] 495 | } 496 | ], 497 | "source": [ 498 | "foreach (DetectedObject obj in analysis.Objects) {\n", 499 | " string bounds = $\"{obj.Rectangle.X}, {obj.Rectangle.Y} by {obj.Rectangle.W}, {obj.Rectangle.H}\";\n", 500 | " Console.WriteLine($\"{obj.ObjectProperty} detected at {bounds} ({obj.Confidence:P} Confidence)\");\n", 501 | "}" 502 | ] 503 | } 504 | ], 505 | "metadata": { 506 | "kernelspec": { 507 | "display_name": ".NET (C#)", 508 | "language": "C#", 509 | "name": ".net-csharp" 510 | }, 511 | "language_info": { 512 | "name": "polyglot-notebook" 513 | }, 514 | "polyglot_notebook": { 515 | "kernelInfo": { 516 | "defaultKernelName": "csharp", 517 | "items": [ 518 | { 519 | "aliases": [], 520 | "languageName": "csharp", 521 | "name": "csharp" 522 | } 523 | ] 524 | } 525 | } 526 | }, 527 | "nbformat": 4, 528 | "nbformat_minor": 2 529 | } 530 | -------------------------------------------------------------------------------- /02_Polyglot/99_BigO.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!csharp 6 | 7 | int numItems = 2000; 8 | 9 | #!csharp 10 | 11 | #!time 12 | 13 | Console.WriteLine(numItems); 14 | 15 | #!csharp 16 | 17 | void delay(int amount) { 18 | for (int i = 0; i < amount; i++) { 19 | // do Nothing 20 | } 21 | } 22 | 23 | #!csharp 24 | 25 | #!time 26 | 27 | for (int i = 0; i < numItems; i++) 28 | { 29 | delay(250); 30 | } 31 | 32 | #!csharp 33 | 34 | #!time 35 | 36 | for (int i = 0; i < numItems; i++) 37 | { 38 | for (int j = 0; j < numItems; j++) 39 | { 40 | delay(1); 41 | } 42 | } 43 | 44 | #!csharp 45 | 46 | #!time 47 | 48 | for (int i = 1; i <= numItems; i *= 2) 49 | { 50 | delay(250000); 51 | } 52 | 53 | #!csharp 54 | 55 | using System; 56 | using System.Collections.Generic; 57 | 58 | Random rand = new(); 59 | 60 | // Add a series of random doubles to a list of numbers 61 | List numbers = new(); 62 | for (int i = 0; i < numItems; i++) 63 | { 64 | numbers.Add(rand.Next()); 65 | } 66 | 67 | #!csharp 68 | 69 | #!time 70 | 71 | numbers.Sort(); 72 | -------------------------------------------------------------------------------- /02_Polyglot/99_BigOMetrics.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": { 7 | "dotnet_interactive": { 8 | "language": "javascript" 9 | }, 10 | "polyglot_notebook": { 11 | "kernelName": "javascript" 12 | }, 13 | "vscode": { 14 | "languageId": "polyglot-notebook" 15 | } 16 | }, 17 | "outputs": [], 18 | "source": [ 19 | "plotlyloader = (require.config({\n", 20 | " paths: {\n", 21 | " d3: 'https://cdn.jsdelivr.net/npm/d3@7.4.4/dist/d3.min',\n", 22 | " jquery: 'https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min',\n", 23 | " plotly: 'https://cdn.plot.ly/plotly-2.14.0.min'\n", 24 | " },\n", 25 | "\n", 26 | " shim: {\n", 27 | " plotly: {\n", 28 | " deps: ['d3', 'jquery'],\n", 29 | " exports: 'plotly'\n", 30 | " }\n", 31 | " }\n", 32 | "}) || require);" 33 | ] 34 | }, 35 | { 36 | "cell_type": "code", 37 | "execution_count": 2, 38 | "metadata": { 39 | "dotnet_interactive": { 40 | "language": "html" 41 | }, 42 | "polyglot_notebook": { 43 | "kernelName": "html" 44 | }, 45 | "vscode": { 46 | "languageId": "polyglot-notebook" 47 | } 48 | }, 49 | "outputs": [ 50 | { 51 | "data": { 52 | "text/html": [ 53 | "
placeholder
" 54 | ] 55 | }, 56 | "metadata": {}, 57 | "output_type": "display_data" 58 | } 59 | ], 60 | "source": [ 61 | "
placeholder
" 62 | ] 63 | }, 64 | { 65 | "cell_type": "code", 66 | "execution_count": null, 67 | "metadata": { 68 | "dotnet_interactive": { 69 | "language": "html" 70 | }, 71 | "polyglot_notebook": { 72 | "kernelName": "html" 73 | }, 74 | "vscode": { 75 | "languageId": "polyglot-notebook" 76 | } 77 | }, 78 | "outputs": [], 79 | "source": [] 80 | } 81 | ], 82 | "metadata": { 83 | "language_info": { 84 | "name": "python" 85 | }, 86 | "orig_nbformat": 4 87 | }, 88 | "nbformat": 4, 89 | "nbformat_minor": 2 90 | } 91 | -------------------------------------------------------------------------------- /02_Polyglot/Model.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/02_Polyglot/Model.zip -------------------------------------------------------------------------------- /02_Polyglot/dbSetup.sql: -------------------------------------------------------------------------------- 1 | 2 | USE master; 3 | GO 4 | 5 | -- Drop the database if it exists 6 | IF EXISTS (SELECT name FROM sys.databases WHERE name = 'PolyglotNotebookExamples') 7 | DROP DATABASE PolyglotNotebookExamples; 8 | GO 9 | 10 | -- Recreate the database 11 | CREATE DATABASE PolyglotNotebookExamples; 12 | GO 13 | 14 | USE PolyglotNotebookExamples 15 | GO 16 | 17 | CREATE TABLE dad_jokes ( 18 | id INTEGER IDENTITY(1,1) PRIMARY KEY, 19 | joke NVARCHAR(140) NOT NULL, 20 | punchline NVARCHAR(140) NOT NULL 21 | ); 22 | GO 23 | 24 | INSERT INTO dad_jokes (joke, punchline) 25 | VALUES 26 | ('Why do programmers prefer dark mode?', 'Because light attracts bugs.'), 27 | ('Why do programmers always mix up Halloween and Christmas?', 'Because Oct 31 equals Dec 25.'), 28 | ('Why did the programmer quit his job?', 'Because they didn''t get arrays.'), 29 | ('Why do Java developers wear glasses?', 'Because they can''t C#.'), 30 | ('Why was the JavaScript developer sad?', 'Because everything felt so undefined.'), 31 | ('Why don''t programmers like nature?', 'It has too many bugs.'), 32 | ('Why did the developer go broke?', 'Because they used up all their cache.'), 33 | ('Why was the computer cold?', 'Because it left its Windows open.'), 34 | ('Why did the programmer get stuck in the shower?', 'Because the instructions on the shampoo bottle said: Lather, Rinse, Repeat.'), 35 | ('Why don''t programmers like to swim?', 'Because they might encounter a fatal error.'); 36 | GO 37 | 38 | SELECT * FROM dad_jokes -------------------------------------------------------------------------------- /03_Mermaid/00_Flowchart.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Flowcharts 8 | 9 | #!mermaid 10 | 11 | flowchart 12 | Client 13 | Server 14 | Database 15 | 16 | #!mermaid 17 | 18 | flowchart 19 | Client --> Server 20 | Server --> Database 21 | 22 | #!mermaid 23 | 24 | flowchart LR 25 | Client --> Server 26 | Server --> Database 27 | 28 | #!markdown 29 | 30 | ### Relationships 31 | 32 | #!mermaid 33 | 34 | flowchart LR 35 | Client --> Server 36 | Server --> Database 37 | Database -.-> Server 38 | Server -.-> Client 39 | 40 | #!mermaid 41 | 42 | flowchart LR 43 | Base --> Arrow 44 | Base ==> Heavy 45 | Base -.-> Dotted 46 | Base --- Line 47 | Base --> You --> Can --> Chain --> Relations --> On --> One --- Line 48 | 49 | #!mermaid 50 | 51 | flowchart LR 52 | c[Client] 53 | s[Server] 54 | db[Database] 55 | 56 | c -- HTTP GET --> s 57 | s -- SQL Query --> db 58 | db -. Result Set .-> s 59 | s -. JSON .-> c 60 | 61 | #!markdown 62 | 63 | ### Shapes 64 | 65 | #!mermaid 66 | 67 | flowchart 68 | a[Default] 69 | b([Rounded]) 70 | c[(Database)] 71 | d[[Subroutine]] 72 | e((Circle)) 73 | f>Note] 74 | g{Decision} 75 | h{{Hexagon}} 76 | i[/Parallelogram/] 77 | j(((Double Circle))) 78 | 79 | #!markdown 80 | 81 | ### Subgraphs 82 | 83 | #!mermaid 84 | 85 | flowchart LR 86 | subgraph Azure 87 | s[Server] 88 | db[(Database)] 89 | end 90 | subgraph Netlify 91 | c[Client] 92 | end 93 | 94 | c -- HTTP GET --> s 95 | s -. JSON .-> c 96 | db -. Result Set .-> s 97 | s -- SQL Query --> db 98 | 99 | #!markdown 100 | 101 | ### Icons 102 | 103 | #!mermaid 104 | 105 | flowchart LR 106 | subgraph Azure 107 | s[fa:fa-code Server] 108 | db[(fa:fa-table Database)] 109 | end 110 | subgraph Netlify 111 | c[fa:fa-user Client] 112 | end 113 | 114 | subgraph Netlify 115 | end 116 | subgraph Azure 117 | direction LR 118 | end 119 | 120 | c -- HTTP GET --> s 121 | s -- SQL Query --> db 122 | db -. Result Set .-> s 123 | s -. JSON .-> c 124 | -------------------------------------------------------------------------------- /03_Mermaid/01_Git.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Git Graphs 8 | 9 | #!mermaid 10 | 11 | %%{init: { 'theme': 'base' } }%% 12 | gitGraph 13 | commit 14 | commit 15 | commit 16 | 17 | #!mermaid 18 | 19 | %%{init: { 'theme': 'base' } }%% 20 | gitGraph 21 | commit 22 | commit id: "Fixed Issue #42" 23 | commit 24 | 25 | #!markdown 26 | 27 | ### Branching 28 | 29 | #!mermaid 30 | 31 | %%{init: { 'theme': 'base' } }%% 32 | gitGraph 33 | commit 34 | commit 35 | branch feature 36 | commit 37 | 38 | #!mermaid 39 | 40 | %%{init: { 'theme': 'base' } }%% 41 | gitGraph 42 | commit 43 | commit 44 | branch feature 45 | commit id: "Dark Theme" 46 | checkout main 47 | merge feature 48 | commit 49 | 50 | #!mermaid 51 | 52 | %%{init: { 'theme': 'base' } }%% 53 | gitGraph 54 | commit 55 | branch feature 56 | checkout main 57 | commit 58 | branch bugfix 59 | commit 60 | checkout feature 61 | commit id: "Dark Theme" 62 | checkout main 63 | merge feature 64 | commit 65 | checkout bugfix 66 | commit id: "Fixed Null Ref" 67 | checkout main 68 | merge bugfix 69 | commit 70 | 71 | #!markdown 72 | 73 | ### Tags 74 | 75 | #!mermaid 76 | 77 | %%{init: { 'theme': 'base' } }%% 78 | gitGraph 79 | commit tag: "v0.4.0" 80 | branch feature 81 | checkout main 82 | commit 83 | branch bugfix 84 | commit 85 | checkout feature 86 | commit id: "Dark Theme" 87 | checkout main 88 | merge feature 89 | commit tag: "v0.4.1" 90 | commit 91 | checkout bugfix 92 | commit id: "Fixed Null Ref" 93 | checkout main 94 | merge bugfix tag: "v0.4.2" 95 | commit 96 | 97 | #!markdown 98 | 99 | ### Highlighting Commits 100 | 101 | #!mermaid 102 | 103 | %%{init: { 'theme': 'base' } }%% 104 | gitGraph 105 | commit tag: "v0.4.0" 106 | branch feature 107 | checkout main 108 | commit 109 | branch bugfix 110 | commit id: "Whoopsies" type: REVERSE 111 | checkout feature 112 | commit id: "Dark Theme" 113 | checkout main 114 | merge feature 115 | commit tag: "v0.4.1" 116 | commit type: HIGHLIGHT 117 | checkout bugfix 118 | commit id: "Fixed Null Ref" 119 | checkout main 120 | merge bugfix tag: "v0.4.2" 121 | -------------------------------------------------------------------------------- /03_Mermaid/02_Sequence.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Sequence Diagrams 8 | 9 | #!mermaid 10 | 11 | sequenceDiagram 12 | Client->>Server: Login (Username, Password) 13 | Server-->>Client: 200 OK & JWT 14 | 15 | #!mermaid 16 | 17 | sequenceDiagram 18 | Client->>Server: Login (Username, Password) 19 | Server->>Database: Select User Info 20 | Database-->>Server: Salt & Hash 21 | Server-->>Client: 200 OK & JWT 22 | 23 | #!markdown 24 | 25 | ### Object Ordering and Aliases 26 | 27 | #!mermaid 28 | 29 | sequenceDiagram 30 | participant C as Client 31 | participant DB as Database 32 | participant S as Server 33 | C->>S: Login (Username, Password) 34 | S->>DB: Select User Info 35 | DB-->>S: Salt & Hash 36 | S-->>C: 200 OK & JWT 37 | 38 | #!markdown 39 | 40 | ### Actors 41 | 42 | #!mermaid 43 | 44 | sequenceDiagram 45 | actor C as Client 46 | participant S as Server 47 | participant DB as Database 48 | C->>S: Login (Username, Password) 49 | S->>DB: Select User Info 50 | DB-->>S: Salt & Hash 51 | S-->>C: 200 OK & JWT 52 | 53 | #!markdown 54 | 55 | ### Notes 56 | 57 | #!mermaid 58 | 59 | sequenceDiagram 60 | actor C as Client 61 | participant S as Server 62 | participant DB as Database 63 | C->>S: Login (Username, Password) 64 | S->>DB: Select User Info 65 | note over DB: Password is not stored in database 66 | DB-->>S: Salt & Hash 67 | S-->>C: 200 OK & JWT 68 | note over C, S: Subsequent requests include JWT 69 | 70 | #!markdown 71 | 72 | ### Sequence Numbers 73 | 74 | #!mermaid 75 | 76 | sequenceDiagram 77 | autonumber 78 | actor C as Client 79 | participant S as Server 80 | participant DB as Database 81 | C->>S: Login (Username, Password) 82 | S->>DB: Select User Info 83 | note over DB: Password is not stored in database 84 | DB-->>S: Salt & Hash 85 | S-->>C: 200 OK & JWT 86 | note over C, S: Subsequent requests include JWT 87 | 88 | #!markdown 89 | 90 | ### Self-Referencing Messages 91 | 92 | #!mermaid 93 | 94 | sequenceDiagram 95 | autonumber 96 | actor C as Client 97 | participant S as Server 98 | participant DB as Database 99 | C->>S: Login (Username, Password) 100 | S->>DB: Select User Info 101 | note over DB: Password is not stored in database 102 | DB-->>S: Salt & Hash 103 | S->>S: Check Computed Hash using Salt 104 | S->>S: Generate JWT 105 | S-->>C: 200 OK & JWT 106 | note over C, S: Subsequent requests include JWT 107 | 108 | #!markdown 109 | 110 | ### Conditional Logic 111 | 112 | #!mermaid 113 | 114 | sequenceDiagram 115 | autonumber 116 | actor C as Client 117 | participant S as Server 118 | participant DB as Database 119 | C->>S: Login (Username, Password) 120 | S->>DB: Select User Info 121 | note over DB: Password is not stored in database 122 | DB-->>S: Salt & Hash 123 | S->>S: Check Computed Hash using Salt 124 | alt Computed Hash Matches 125 | S->>S: Generate JWT 126 | S-->>C: 200 OK & JWT 127 | else No user or wrong password 128 | S-->>C: 401 Unauthorized 129 | end 130 | note over C, S: Subsequent requests include JWT 131 | 132 | #!markdown 133 | 134 | ### Activation / Deactivation 135 | 136 | #!mermaid 137 | 138 | sequenceDiagram 139 | autonumber 140 | actor C as Client 141 | participant S as Server 142 | participant DB as Database 143 | C->>S: Login (Username, Password) 144 | activate S 145 | S->>DB: Select User Info 146 | 147 | activate DB 148 | note over DB: Password is not stored in database 149 | DB-->>S: Salt & Hash 150 | deactivate DB 151 | 152 | S->>S: Check Computed Hash using Salt 153 | alt Computed Hash Matches 154 | S->>S: Generate JWT 155 | S-->>C: 200 OK & JWT 156 | else No user or wrong password 157 | S-->>C: 401 Unauthorized 158 | end 159 | deactivate S 160 | note over C, S: Subsequent requests include JWT 161 | 162 | #!mermaid 163 | 164 | sequenceDiagram 165 | autonumber 166 | actor C as Client 167 | participant S as Server 168 | participant DB as Database 169 | C->>+S: Login (Username, Password) 170 | S->>+DB: Select User Info 171 | note over DB: Password is not stored in database 172 | DB-->>-S: Salt & Hash 173 | 174 | S->>S: Check Computed Hash using Salt 175 | alt Computed Hash Matches 176 | S->>S: Generate JWT 177 | S-->>C: 200 OK & JWT 178 | else No user or wrong password 179 | S-->>C: 401 Unauthorized 180 | end 181 | note over C, S: Subsequent requests include JWT 182 | deactivate S 183 | -------------------------------------------------------------------------------- /03_Mermaid/03_Class.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Class Diagrams 8 | 9 | See [my article on class diagrams](https://newdevsguide.com/2023/04/08/mermaid-class-diagrams/) for additional context & information 10 | 11 | #!markdown 12 | 13 | ### Old Notation 14 | 15 | #!mermaid 16 | 17 | classDiagram 18 | class GameObject 19 | GameObject : -String Name 20 | GameObject : -int PosX 21 | GameObject : -int PosY 22 | GameObject : +Despawn() void 23 | 24 | #!mermaid 25 | 26 | classDiagram 27 | GameObject <-- DamageableObject 28 | GameObject : +String Name 29 | GameObject : +Point Position 30 | GameObject <-- SpecialEffect 31 | SpecialEffect: -double Intensity 32 | SpecialEffect: +PlayEffect() 33 | DamageableObject : -int HitPoints 34 | DamageableObject : +bool IsDead 35 | DamageableObject: +TakeDamage(int damage) 36 | DamageableObject <-- Player 37 | DamageableObject <-- Monster 38 | Player: -int Score 39 | Player: -int LivesLeft 40 | Player: +RewardForKill(Monster) 41 | Monster: -int PointValue 42 | Monster: -int ThreatLevel 43 | Monster: +Kill() 44 | 45 | #!markdown 46 | 47 | ### New Notation 48 | 49 | #!mermaid 50 | 51 | classDiagram 52 | class GameObject { 53 | -String Name 54 | -int PosX 55 | -int PosY 56 | +Despawn() void 57 | } 58 | 59 | #!mermaid 60 | 61 | classDiagram 62 | class GameObject { 63 | -String Name 64 | -int PosX 65 | -int PosY 66 | +Despawn() void 67 | } 68 | class DamageableObject { 69 | +int MaxHealth 70 | -int Health 71 | +IsDead() bool 72 | +TakeDamage(int damage) void 73 | +OnKilled() void 74 | } 75 | GameObject <|-- DamageableObject 76 | 77 | #!markdown 78 | 79 | ### Aggregation & Composition 80 | 81 | #!mermaid 82 | 83 | classDiagram 84 | Human *-- Cells : Is Composed of 85 | Salesperson o-- Sales : Makes 86 | 87 | #!mermaid 88 | 89 | classDiagram 90 | Human *-- Cells : composed of 91 | Salesperson o-- Sales : makes 92 | Human <|-- Salesperson : is 93 | 94 | #!mermaid 95 | 96 | classDiagram 97 | Human "1" *-- "*" Cells : composed of 98 | Salesperson "1" o-- "0..*" Sales : makes 99 | Human <|-- Salesperson : is 100 | 101 | #!markdown 102 | 103 | ### Abstract Classes 104 | 105 | #!mermaid 106 | 107 | classDiagram 108 | class GameObject { 109 | -String Name 110 | -int PosX 111 | -int PosY 112 | +Despawn() void 113 | } 114 | class DamageableObject { 115 | <> 116 | +int MaxHealth 117 | -int Health 118 | +IsDead() bool 119 | +TakeDamage(int damage) void 120 | +OnKilled()* void 121 | } 122 | GameObject <|-- DamageableObject 123 | 124 | #!mermaid 125 | 126 | classDiagram 127 | class GameObject { 128 | +String Name 129 | +int PosX 130 | +int PosY 131 | +Despawn() void 132 | } 133 | class DamageableObject { 134 | <> 135 | +int MaxHealth 136 | -int Health 137 | +IsDead() bool 138 | +TakeDamage(int damage) void 139 | +OnKilled()* void 140 | } 141 | class Player { 142 | -int Score 143 | -int LivesRemaining 144 | +OnKilled() void 145 | } 146 | class Monster { 147 | -int ThreatLevel 148 | -Color Color 149 | +MakeNoise(double decibelLevel) string 150 | +OnKilled() void 151 | } 152 | GameObject <|-- DamageableObject 153 | DamageableObject <|-- Player 154 | DamageableObject <|-- Monster 155 | 156 | #!markdown 157 | 158 | ### Generics (~) 159 | 160 | #!mermaid 161 | 162 | classDiagram 163 | class Queue~T~ { 164 | -IEnumerable~T~ items 165 | +Enqueue(T item) void 166 | +Dequeue() T 167 | +HasItems() bool 168 | } 169 | 170 | #!markdown 171 | 172 | ### Static ($) 173 | 174 | #!mermaid 175 | 176 | classDiagram 177 | class ColorManager { 178 | -Dictionary~string_Color~ hexColors$ 179 | +BuildColorFromHex(string hexCode)$ Color 180 | } 181 | -------------------------------------------------------------------------------- /03_Mermaid/04_ERD.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Entity Relationship Diagrams (ERDs) 8 | 9 | See [My Article on Entity Relationship Diagrams in Mermaid.js](https://newdevsguide.com/2023/04/08/creating-erds-with-mermaid/) for more information on ERDs. 10 | 11 | #!markdown 12 | 13 | ### Defining Entities 14 | 15 | #!mermaid 16 | 17 | erDiagram 18 | CITY 19 | STATE 20 | COUNTRY 21 | 22 | #!markdown 23 | 24 | ### Defining Relationships 25 | 26 | #!mermaid 27 | 28 | erDiagram 29 | COUNTRY ||--|{ STATE : "Has" 30 | STATE ||--|{ CITY : "Has" 31 | CITY ||--o| STATE : "Is capital of" 32 | CITY ||--o| COUNTRY : "Is capital of" 33 | 34 | #!markdown 35 | 36 | ### Defining Attributes 37 | 38 | #!mermaid 39 | 40 | erDiagram 41 | CITY { 42 | int city_id 43 | string name 44 | string state_abbreviation 45 | } 46 | STATE { 47 | string state_abbreviation 48 | string name 49 | int country_id 50 | } 51 | COUNTRY { 52 | int country_id 53 | string name 54 | } 55 | COUNTRY ||--|{ STATE : "Has" 56 | STATE ||--|{ CITY : "Has" 57 | CITY ||--o| STATE : "Is capital of" 58 | CITY ||--o| COUNTRY : "Is capital of" 59 | 60 | #!markdown 61 | 62 | ### Primary and Foreign Keys 63 | 64 | #!mermaid 65 | 66 | erDiagram 67 | CITY { 68 | int city_id PK 69 | string name 70 | string state_abbreviation FK 71 | } 72 | STATE { 73 | string state_abbreviation PK 74 | string name 75 | int country_id FK 76 | } 77 | COUNTRY { 78 | int country_id PK 79 | string name 80 | } 81 | COUNTRY ||--|{ STATE : "Has" 82 | STATE ||--|{ CITY : "Has" 83 | CITY ||--o| STATE : "Is capital of" 84 | CITY ||--o| COUNTRY : "Is capital of" 85 | -------------------------------------------------------------------------------- /03_Mermaid/05_Gantt.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Gantt Chart 8 | 9 | See [my article on Gantt charts in Mermaid](https://newdevsguide.com/2023/04/14/mermaid-gantt-chart/) for more details. 10 | 11 | #!mermaid 12 | 13 | gantt 14 | title Write about Mermaid.js Gantt Charts 15 | Create code for Gantt chart : 2023-04-11, 2d 16 | Outline article on Gantt charts : 2023-04-12, 2d 17 | Write article on Gantt charts : 2023-04-13, 1d 18 | Publish article on Gantt charts : 2023-04-14, 1d 19 | 20 | #!mermaid 21 | 22 | gantt 23 | title Write about Mermaid.js Gantt Charts 24 | Create code for Gantt chart :done, crit, 2023-04-11, 2d 25 | Outline article on Gantt charts :done, 2023-04-12, 2d 26 | A Standard Task : 2023-04-12, 2d 27 | Write article on Gantt charts :active, crit, 2023-04-13, 1d 28 | Publish article on Gantt charts :crit, 2023-04-14, 1d 29 | 30 | #!mermaid 31 | 32 | gantt 33 | title Preparing Polyglot Notebooks Talk for Stir Trek 2023 34 | section Proposal and Evaluation 35 | Submit Abstract :done, 2023-01-15, 2023-02-18 36 | Session Evaluation :done, 2023-02-18, 2023-03-05 37 | Talk Accepted :milestone, done, 2023-03-05, 2023-03-05 38 | section Talk Preparation 39 | Research & Outlining :done, 2023-03-12, 9d 40 | Create Mermaid Examples :done, 2023-03-12, 2023-04-08 41 | Write Mermaid Articles :active, 2023-04-08, 7d 42 | Write Jupyter Articles : 2023-04-15, 2d 43 | Deep Dive into Polyglot :crit, 2023-04-08, 2w 44 | Write Polyglot Articles : 2023-04-18, 7d 45 | section Delivery 46 | Final Notebook :crit, 2023-04-22, 7d 47 | Rehearsal :crit, 2023-04-29, 2023-05-04 48 | Stir Trek 2023 :milestone, crit, 2023-05-05, 1d 49 | 50 | #!mermaid 51 | 52 | gantt 53 | title Preparing Polyglot Notebooks Talk for Stir Trek 2023 54 | section Proposal and Evaluation 55 | Submit Abstract :done, 2023-01-15, 2023-02-18 56 | Session Evaluation :done, EVAL 2023-02-18, 2023-03-05 57 | Talk Accepted :milestone, done, after EVAL 58 | section Talk Preparation 59 | Research & Outlining :done, OUTLINE, 2023-03-12, 9d 60 | Create Mermaid Examples :done, MER_EXAMPLE, after OUTLINE, 5d 61 | Write Mermaid Articles :active, MER_ART, after MER_EXAMPLE, 7d 62 | Write Jupyter Articles : after MER_ART, 3d 63 | Deep Dive into Polyglot :crit, 2023-04-05, 2w 64 | Write Polyglot Articles : 2023-04-12, 10d 65 | section Delivery 66 | Final Notebook :crit, NOTEBOOK, 2023-04-19, 7d 67 | Rehearsal :crit, after NOTEBOOK, 2023-05-04 68 | Stir Trek 2023 :milestone, crit, 2023-05-05, 1d 69 | 70 | #!mermaid 71 | 72 | gantt 73 | axisFormat %Y-%m-%d 74 | title Write about Mermaid.js Gantt Charts 75 | Create code for Gantt chart :done, crit, 2023-04-11, 2d 76 | Outline article on Gantt charts :done, 2023-04-12, 2d 77 | A Standard Task : 2023-04-12, 2d 78 | Write article on Gantt charts :active, crit, 2023-04-13, 1d 79 | Publish article on Gantt charts :crit, 2023-04-14, 1d 80 | 81 | #!mermaid 82 | 83 | gantt 84 | title Preparing Polyglot Notebooks Talk for Stir Trek 2023 85 | dateFormat YYYY-MM-DD 86 | section Proposal and Evaluation 87 | Submit Abstract :done, submit, 2023-01-15, 2023-02-18 88 | Session Evaluation :done, eval, after submit, 2023-03-05 89 | Talk Accepted :milestone,done, accepted, after eval, 1d 90 | section Talk Preparation 91 | Research & Outlining :done,crit research, after accepted, 9d 92 | Create Mermaid Examples :active, mermaid, 2023-03-12, 2023-04-08 93 | Write Mermaid Articles :after mermaid, 7d 94 | Write Jupyter Articles : 2023-04-15, 2d 95 | Deep Dive into Polyglot :crit, 2023-04-08, 2w 96 | Write Polyglot Articles : 2023-04-22, 7d 97 | section Delivery 98 | Final Notebook Arrangement :crit, 2023-04-22, 7d 99 | Rehearsal :crit, 2023-04-29, 2023-05-04 100 | Stir Trek 2023 :milestone,crit, 2023-05-05, 1d 101 | -------------------------------------------------------------------------------- /03_Mermaid/06_UserJourney.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## User Journey Mapping 8 | 9 | See [my article on User Journey charts in Mermaid](https://newdevsguide.com/2023/04/12/user-journey-maps-mermaid/) for more details. 10 | 11 | #!mermaid 12 | 13 | journey 14 | title Attend a Tech Conference 15 | Buy a Ticket: 4 16 | Check Schedule before Conference: 6 17 | Check in at Conference: 5 18 | Check Schedule at Conference: 4 19 | Attend Talk: 5 20 | Lunch: 3 21 | "Hallway Track": 5 22 | Post-Conference Movie: 7 23 | 24 | #!mermaid 25 | 26 | journey 27 | title Attend a Tech Conference 28 | Buy a Ticket: 4: Attendees, Point of Sales 29 | Check Schedule before Conference: 6: Attendees, Web Site 30 | Check in at Conference: 5: Attendees, Volunteers 31 | Check Schedule at Conference: 4: Attendees, Mobile App 32 | Attend Talk: 5: Attendees, Speakers, Volunteers 33 | Lunch: 3: Attendees, Volunteers 34 | "Hallway Track": 5: Attendees, Volunteers 35 | Post-Conference Movie: 7: Attendees, Volunteers, Speakers 36 | 37 | #!mermaid 38 | 39 | journey 40 | title Attend a Tech Conference 41 | section Pre-Conference 42 | Buy a Ticket: 4 43 | Check Schedule before Conference: 6 44 | section Morning 45 | Check in at Conference: 5 46 | Check Schedule at Conference: 4 47 | Attend Talk: 5 48 | section Afternoon 49 | Lunch: 3 50 | "Hallway Track": 5 51 | Post-Conference Movie: 7 52 | 53 | #!mermaid 54 | 55 | journey 56 | title Attend a Tech Conference 57 | section Pre-Conference 58 | Buy a Ticket: 4: Attendees, Point of Sales 59 | Check Schedule before Conference: 6: Attendees, Web Site 60 | section Morning 61 | Check in at Conference: 5: Attendees, Volunteers 62 | Check Schedule at Conference: 4: Attendees, Mobile App 63 | Attend Talk: 5: Attendees, Speakers, Volunteers 64 | section Afternoon 65 | Lunch: 3: Attendees, Volunteers 66 | "Hallway Track": 5: Attendees, Volunteers 67 | Post-Conference Movie: 7: Attendees, Volunteers, Speakers 68 | -------------------------------------------------------------------------------- /03_Mermaid/07_State.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## State Diagram / Finite State Machines (FSM) 8 | 9 | See [my article on State charts in Mermaid](https://newdevsguide.com/2023/04/18/mermaid-state-machine/) for more details. 10 | 11 | ![Boss Fight](../Images/Boss.png) 12 | 13 | #!mermaid 14 | 15 | stateDiagram-v2 16 | [*] --> Descending 17 | Descending --> Attack 18 | Attack --> Pain 19 | Pain --> Attack 20 | Attack --> Dead 21 | Pain --> Dead 22 | Dead --> [*] 23 | 24 | #!mermaid 25 | 26 | stateDiagram-v2 27 | direction LR 28 | [*] --> Descending 29 | Descending --> Attack 30 | Attack --> Pain 31 | Pain --> Attack 32 | Attack --> Dead 33 | Pain --> Dead 34 | Dead --> [*] 35 | 36 | #!mermaid 37 | 38 | stateDiagram-v2 39 | [*] --> Descending : Player entered arena 40 | Descending --> Attack : After roar animation 41 | Attack --> Pain : Hurt a lot 42 | Pain --> Attack : Finished animation 43 | Attack --> Dying : Ran out of health 44 | Pain --> Dying : Ran out of health 45 | Dying --> [*] : After death animation 46 | 47 | #!mermaid 48 | 49 | stateDiagram-v2 50 | direction LR 51 | 52 | state intro { 53 | [*] --> Descending 54 | Descending --> Roar 55 | Roar --> [*] 56 | } 57 | state combat { 58 | [*] --> Attacking 59 | Attacking --> Pain 60 | Pain --> Attacking 61 | } 62 | state defeated { 63 | [*] --> Dying 64 | Dying --> Dead 65 | Dead --> [*] 66 | } 67 | 68 | [*] --> intro 69 | intro --> combat 70 | combat --> defeated 71 | defeated --> [*] 72 | 73 | #!mermaid 74 | 75 | stateDiagram-v2 76 | direction LR 77 | 78 | state intro { 79 | Descending --> Roar 80 | Roar --> Attacking 81 | } 82 | state combat { 83 | Attacking --> Pain 84 | Pain --> Attacking 85 | } 86 | state defeated { 87 | Dying --> Dead 88 | } 89 | 90 | [*] --> Descending 91 | combat --> Dying 92 | Dead --> [*] 93 | 94 | note left of combat: The boss is damageable in this state 95 | 96 | #!mermaid 97 | 98 | stateDiagram-v2 99 | direction LR 100 | 101 | state intro { 102 | Descending --> Roar : Movement Finished 103 | Roar --> Attacking : Animation Finished 104 | } 105 | state combat { 106 | Attacking --> Pain : Took Enough Damage 107 | Pain --> Attacking : Animation Finished 108 | } 109 | state defeated { 110 | Dying --> Dead : Animation Finished 111 | } 112 | 113 | [*] --> Descending : Spotted player 114 | combat --> Dying : Took enough damage 115 | Dead --> [*] : AI Stopped 116 | 117 | note left of combat: The boss is damageable in this state 118 | -------------------------------------------------------------------------------- /03_Mermaid/08_Requirement.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Requirement Diagrams 8 | 9 | See [my article on Requirement Diagrams in Mermaid](https://newdevsguide.com/2023/04/17/mermaid-requirement-diagrams/) for more details. 10 | 11 | #!mermaid 12 | 13 | requirementDiagram 14 | 15 | requirement dark_theme { 16 | id: 1 17 | text: Dark Themes Rule! 18 | risk: low 19 | verifymethod: inspection 20 | } 21 | 22 | #!mermaid 23 | 24 | requirementDiagram 25 | 26 | interfaceRequirement dark_theme { 27 | id: 1 28 | text: Dark Themes Rule! 29 | risk: low 30 | verifymethod: inspection 31 | } 32 | 33 | element revised_skin { 34 | type: css, 35 | docRef: theme.css 36 | } 37 | 38 | #!mermaid 39 | 40 | requirementDiagram 41 | 42 | interfaceRequirement dark_theme { 43 | id: 1 44 | text: Dark Themes Rule! 45 | risk: low 46 | verifymethod: inspection 47 | } 48 | 49 | performanceRequirement load_time { 50 | id: 2 51 | text: 200ms or less 52 | risk: medium 53 | verifymethod: analysis 54 | } 55 | 56 | element revised_skin { 57 | type: css, 58 | docRef: theme.css 59 | } 60 | 61 | #!mermaid 62 | 63 | requirementDiagram 64 | 65 | interfaceRequirement dark_theme { 66 | id: 1 67 | text: Dark Themes Rule! 68 | risk: low 69 | verifymethod: demonstration 70 | } 71 | 72 | performanceRequirement load_time { 73 | id: 2 74 | text: 200ms or less 75 | risk: medium 76 | verifymethod: test 77 | } 78 | 79 | functionalRequirement accessibility { 80 | id: 3 81 | text: Contrast 82 | risk: low 83 | verifymethod: inspection 84 | } 85 | 86 | element revised_skin { 87 | type: css, 88 | docRef: theme.css 89 | } 90 | 91 | 92 | element perf_test { 93 | type: unit test, 94 | docRef: LoadTest.cs 95 | } 96 | 97 | revised_skin - satisfies -> dark_theme 98 | revised_skin - satisfies -> accessibility 99 | revised_skin - satisfies -> load_time 100 | perf_test - satisfies -> load_time 101 | -------------------------------------------------------------------------------- /03_Mermaid/09_Pie.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Pie Charts 8 | 9 | See [my article on pie charts in Mermaid](https://newdevsguide.com/2023/04/13/mermaid-pie/) for more details. 10 | 11 | #!mermaid 12 | 13 | pie 14 | title Leading Causes of Developer Tears 15 | "JavaScript": 42 16 | "DNS": 8 17 | "Leaving a VM on": 15 18 | -------------------------------------------------------------------------------- /03_Mermaid/10_Mindmap.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## MindMap 8 | 9 | See [my article on Mind Maps in Mermaid](https://newdevsguide.com/2023/04/14/mermaid-mind-maps/) for more details. 10 | 11 | #!mermaid 12 | 13 | mindmap 14 | Talk 15 | Notebooks 16 | What 17 | Why 18 | How 19 | Jupyter Notebooks 20 | IDEs 21 | VS Code 22 | DataSpell 23 | Web Browser 24 | Anaconda 25 | Polyglot Notebooks 26 | Installation 27 | Languages 28 | CSharp 29 | FSharp 30 | JS 31 | CSS 32 | SQL 33 | KQL 34 | Mermaid 35 | Class Diagram 36 | Gantt 37 | Timeline 38 | User Experience Journey 39 | Pie Chart 40 | ERD 41 | Mindmaps 42 | Requirements 43 | Variable Sharing 44 | Next Steps 45 | 46 | #!markdown 47 | 48 | Mindmap diagrams are not supported on Mermaid.js version 9.1.7, which is the current version used by Polyglot Notebooks, so here's a screenshot: 49 | 50 | ![Mindmap Diagram](../Images/Mindmap.png) 51 | -------------------------------------------------------------------------------- /03_Mermaid/11_Timeline.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Timeline Charts 8 | **NOTE: Not supported in Mermaid 9.1.7** 9 | 10 | Will be available in future Polyglot releases 11 | 12 | See [my article on Timeline Diagrams in Mermaid](https://newdevsguide.com/2023/04/16/mermaid-timeline-charts/) for more details. 13 | 14 | #!mermaid 15 | 16 | timeline 17 | title Major .NET Releases 18 | section .NET Framework 19 | 2000 - 2005 20 | : .NET Framework 1.0 21 | : .NET Framework 1.0 SP1 22 | : .NET Framework 1.0 SP2 23 | : .NET Framework 1.1 24 | : .NET Framework 1.0 SP3 25 | : .NET Framework 2.0 26 | 2006 - 2009 27 | : .NET Framework 3.0 28 | : .NET Framework 3.5 29 | : .NET Framework 2.0 SP 1 30 | : .NET Framework 3.0 SP 1 31 | : .NET Framework 2.0 SP 2 32 | : .NET Framework 3.0 SP 2 33 | : .NET Framework 3.5 SP 1 34 | 2010 - 2015 35 | : .NET Framework 4.0 36 | : .NET Framework 4.5 37 | : .NET Framework 4.5.1 38 | : .NET Framework 4.5.2 39 | : .NET Framework 4.6 40 | : .NET Framework 4.6.1 41 | section .NET Core 42 | 2016 - 2017 43 | : .NET Core 1.0 44 | : .NET Core 1.1 45 | : .NET Framework 4.6.2 46 | : .NET Core 2.0 47 | : .NET Framework 4.7 48 | : .NET Framework 4.7.1 49 | 2018 - 2019 50 | : .NET Core 2.1 51 | : .NET Core 2.2 52 | : .NET Framework 4.7.2 53 | : .NET Core 3.0 54 | : .NET Core 3.1 55 | : .NET Framework 4.8 56 | section Modern .NET 57 | 2020 : .NET 5 58 | 2021 : .NET 6 59 | 2022 : .NET 7 60 | : .NET Framework 4.8.1 61 | 62 | #!markdown 63 | 64 | Timeline View isn't supported in Mermaid 9.1.7 which is what Polyglot currently uses, so here's a screenshot of the results: 65 | 66 | ![Timeline View](../Images/Timeline.png) 67 | -------------------------------------------------------------------------------- /03_Mermaid/12_C4Context.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## C4 Context Diagram 8 | 9 | Still in active development 10 | 11 | #!mermaid 12 | 13 | C4Context 14 | title GitStractor Context Diagram 15 | 16 | UpdateLayoutConfig($c4ShapeInRow="2", $c4BoundaryInRow="1") 17 | 18 | Enterprise_Boundary(bMain, "GitStractor") { 19 | ContainerDb(cGit, "Git Repository", "git", "A locally-cloned git repository") 20 | 21 | Component(cGitStractor, "GitStractor Class Library", "C# Class Library", "Core library used for pulling data out of git repositories") 22 | 23 | Container_Boundary(bUI, "User Interface") { 24 | UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="1") 25 | Container(cWPF, "GitStractor Desktop Edition", "Dotnet and C#", "Stand-Alone Utility for pulling and visualizing data") 26 | Container(cJupyter, "GitStractor Juypter Edition", "Jupyter Notebook", "Uses Python, Plotly, and Pandas to visualize data") 27 | Container(cBI, "Power BI Template", "Power BI", "Visualize Data with Dedicated Tooling") 28 | } 29 | 30 | Container(cExe, "GitStract.exe", "Dotnet and C#", "Pulls Git Information into data files") 31 | 32 | ContainerDb(cData, "Data Files", "CSV Files", "Stores information on commits and files") 33 | } 34 | 35 | Rel(cGitStractor, cGit, "Analyzes") 36 | Rel(cGitStractor, cData, "Creates") 37 | Rel(cExe, cGitStractor, "Uses") 38 | Rel(cWPF, cGitStractor, "Uses") 39 | Rel(cData, cWPF, "Used by") 40 | Rel(cData, cJupyter, "Used by") 41 | Rel(cData, cBI, "Used by") 42 | -------------------------------------------------------------------------------- /03_Mermaid/13_Markdown.md: -------------------------------------------------------------------------------- 1 | # Mermaid.js Samples 2 | 3 | ## Entity Relationship Diagram 4 | 5 | See [My article on Mermaid.js ERDs](https://newdevsguide.com/2023/04/08/creating-erds-with-mermaid/) for more details 6 | 7 | ``` mermaid 8 | erDiagram 9 | CITY { 10 | int city_id PK 11 | string name 12 | string state_abbreviation FK 13 | } 14 | STATE { 15 | string state_abbreviation PK 16 | string name 17 | int country_id FK 18 | } 19 | COUNTRY { 20 | int country_id PK 21 | string name 22 | } 23 | COUNTRY ||--|{ STATE : "Has" 24 | STATE ||--|{ CITY : "Has" 25 | CITY ||--o| STATE : "Is capital of" 26 | CITY ||--o| COUNTRY : "Is capital of" 27 | ``` 28 | 29 | 30 | ```mermaid 31 | mindmap 32 | Talk 33 | Notebooks 34 | What 35 | Why 36 | How 37 | Jupyter Notebooks 38 | IDEs 39 | VS Code 40 | DataSpell 41 | Web Browser 42 | Anaconda 43 | Polyglot Notebooks 44 | Installation 45 | Languages 46 | CSharp 47 | FSharp 48 | JS 49 | CSS 50 | SQL 51 | KQL 52 | Mermaid 53 | Class Diagram 54 | Gantt 55 | Timeline 56 | User Experience Journey 57 | Pie Chart 58 | ERD 59 | Mindmaps 60 | Requirements 61 | Variable Sharing 62 | Next Steps 63 | ``` -------------------------------------------------------------------------------- /03_Mermaid/_index.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | # Mermaid Diagrams 8 | 9 | #!mermaid 10 | 11 | mindmap 12 | Mermaid Diagrams 13 | Flowchart 14 | Git graph 15 | Sequence Diagram 16 | Class Diagram 17 | ERD 18 | Gantt Chart 19 | User Journey 20 | State Chart 21 | Requirement Diagram 22 | Pie Chart 23 | C4 Context 24 | Mind Map 25 | Timeline 26 | 27 | #!markdown 28 | 29 | ![Mermaid Diagrams](../Images/MM_Mermaid.png) 30 | -------------------------------------------------------------------------------- /04_GettingStarted/00_IDEs.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "attachments": {}, 5 | "cell_type": "markdown", 6 | "metadata": { 7 | "pycharm": { 8 | "name": "#%% md\n" 9 | } 10 | }, 11 | "source": [ 12 | "# Jupyter Environments" 13 | ] 14 | }, 15 | { 16 | "cell_type": "markdown", 17 | "metadata": { 18 | "collapsed": false, 19 | "pycharm": { 20 | "name": "#%% md\n" 21 | } 22 | }, 23 | "source": [ 24 | "## IDEs\n", 25 | "\n", 26 | "There are many IDEs that natively support Jupyter Notebooks and no IDE is needed if you want to use your browser." 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": { 32 | "collapsed": false, 33 | "pycharm": { 34 | "name": "#%% md\n" 35 | } 36 | }, 37 | "source": [ 38 | "### VS Code\n", 39 | "![VS Code](../Images/VSCode.png)\n", 40 | "\n", 41 | "Notes:\n", 42 | "- Can also run **Polyglot Notebooks**\n", 43 | "- GitHub Codespaces allow you to run notebooks in the browser without Python" 44 | ] 45 | }, 46 | { 47 | "cell_type": "markdown", 48 | "metadata": { 49 | "collapsed": false, 50 | "pycharm": { 51 | "name": "#%% md\n" 52 | } 53 | }, 54 | "source": [ 55 | "### PyCharm\n", 56 | "\n", 57 | "Automatically starts Jupyter Server for you\n", 58 | "\n", 59 | "![PyCharm](../Images/PyCharm.png)" 60 | ] 61 | }, 62 | { 63 | "cell_type": "markdown", 64 | "metadata": { 65 | "collapsed": false, 66 | "pycharm": { 67 | "name": "#%% md\n" 68 | } 69 | }, 70 | "source": [ 71 | "### DataSpell\n", 72 | "\n", 73 | "Connects to any Jupyter Server\n", 74 | "\n", 75 | "![DataSpell](../Images/DataSpell.png)" 76 | ] 77 | }, 78 | { 79 | "cell_type": "markdown", 80 | "metadata": { 81 | "collapsed": false, 82 | "pycharm": { 83 | "name": "#%% md\n" 84 | } 85 | }, 86 | "source": [ 87 | "## Browser" 88 | ] 89 | }, 90 | { 91 | "cell_type": "markdown", 92 | "metadata": { 93 | "collapsed": false, 94 | "pycharm": { 95 | "name": "#%% md\n" 96 | } 97 | }, 98 | "source": [ 99 | "### Jupyter Notebooks\n", 100 | "\n", 101 | "[Runs on Localhost](http://localhost:8888/notebooks/01_Basics/00_Notebooks101.ipynb)\n", 102 | "\n", 103 | "![Jupyter Notebook in the Browser](../Images/JupyterWebPage.png)" 104 | ] 105 | }, 106 | { 107 | "cell_type": "markdown", 108 | "metadata": { 109 | "collapsed": false, 110 | "pycharm": { 111 | "name": "#%% md\n" 112 | } 113 | }, 114 | "source": [ 115 | "### Jupyter Labs\n", 116 | "Just add `/lab` to the end of your Jupyter URL in many cases.\n", 117 | "\n", 118 | "![Jupyter Labs](../Images/JupyterLab.png)" 119 | ] 120 | } 121 | ], 122 | "metadata": { 123 | "kernelspec": { 124 | "display_name": "base", 125 | "language": "python", 126 | "name": "python3" 127 | }, 128 | "language_info": { 129 | "name": "python", 130 | "version": "3.8.8" 131 | }, 132 | "orig_nbformat": 4 133 | }, 134 | "nbformat": 4, 135 | "nbformat_minor": 2 136 | } 137 | -------------------------------------------------------------------------------- /04_GettingStarted/00_WorkLocally.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Getting Started Locally 8 | 9 | #!markdown 10 | 11 | ### Step 1: Install VS Code 12 | 13 | If you don't have it already you'll need Visual Studio Code from [https://code.visualstudio.com/](https://code.visualstudio.com/). 14 | 15 | This is cross-platform, free, and amazing. 16 | 17 | #!markdown 18 | 19 | ### Step 2: Install Anaconda 20 | 21 | Installing [Anaconda](https://www.anaconda.com/) will give you a local **Python** environment pre-configured with common libraries already installed along with **Jupyter Notebooks** and **Jupyter Labs**. 22 | 23 | Go to [Anaconda.com](https://www.anaconda.com/) and click **Download** then install it on your operating system. 24 | 25 | You may need to reboot after this step. 26 | 27 | #!markdown 28 | 29 | ### Step 3: Install .NET 7 Locally 30 | 31 | If you want to use **Polyglot Notebooks** and the **.NET Interactive** kernel, you need to install the .NET SDK from [https://dotnet.microsoft.com/en-us/download/dotnet/7.0](https://dotnet.microsoft.com/en-us/download/dotnet/7.0). 32 | 33 | #!markdown 34 | 35 | ### Step 4: Install VS Code Extensions: Jupyter and Polyglot Notebooks 36 | 37 | You'll need to install the [Jupyter Extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter) in order to run standard Jupyter Notebooks in VS Code. 38 | 39 | In order to use Polyglot Notebooks, you'll need to install the [Polyglot Notebooks extension](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.dotnet-interactive-vscode) 40 | 41 | You may need to reboot your machine or restart VS Code after these steps. 42 | 43 | #!markdown 44 | 45 | --- 46 | 47 | After these steps you should be able to create and execute both `.dib` and `.ipynb` files and work with both **Jupyter Notebooks** and **Polyglot Notebooks**. 48 | 49 | Tip: if your team uses a standard image for new developers, you should probably include this in that image. If not, you should document the installation process you're using along with the exact version numbers you recommend your team install. Test this as regularly as you can. 50 | -------------------------------------------------------------------------------- /04_GettingStarted/01_Deploy.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Deploying Notebooks 8 | 9 | #!markdown 10 | 11 | ### Option 1: Don't 12 | 13 | Have your notebooks run locally on everyone's machines. Make this part of your training process. 14 | 15 | #!markdown 16 | 17 | ### Option 2: Use GitHub.dev 18 | 19 | This allows you to run VS Code in your browser for a project. Just got to `github.dev` instead of `github.com` or type `.` on GitHub.com while logged in. 20 | 21 | Example: [this repository](https://github.dev/IntegerMan/PolyglotNotebookTalk) 22 | 23 | Downsides: Doesn't support Polyglot Notebooks yet. 24 | 25 | #!markdown 26 | 27 | ### Option 3: Use GitHub CodeSpaces 28 | 29 | [GitHub CodeSpaces](https://code.visualstudio.com/docs/remote/codespaces) allows you to run notebooks in the cloud using pre-configured compute resources. 30 | 31 | Downside would be setup. 32 | 33 | #!markdown 34 | 35 | ### Option 4: Deploy a Jupyter Notebooks Server 36 | 37 | This can be done by following the [Jupyter documentation](https://jupyter-notebook.readthedocs.io/en/stable/public_server.html). Other commercial hosting solutions such as Anaconda may also work. 38 | 39 | --- 40 | 41 | The **.NET Interactive** kernel can be installed into a Jupyter Notebook directly which would allow some of the features present in VS Code. 42 | 43 | See the [Official Documentation](https://github.com/dotnet/interactive/blob/main/docs/NotebookswithJupyter.md) for full steps, but the key step is to run: 44 | 45 | `dotnet tool install -g Microsoft.dotnet-interactive` 46 | 47 | followed by: 48 | 49 | `dotnet interactive jupyter install` 50 | 51 | #!markdown 52 | 53 | ### Option 5: Deploying Jupyter Notebooks to Azure 54 | These are easy to share with standard Jupyter Notebooks, however I have not yet verified that they can run Jupyter. 55 | 56 | ![Azure Notebook](../Images/AzureMLNotebook.png) 57 | 58 | #!markdown 59 | 60 | #### 1. Create an Azure Machine Learning Studio Instance 61 | 62 | **Tips:** 63 | 64 | - I recommend using a new dedicated resource group for this resource 65 | - Don't create an Azure Container Registry until you need one (you won't for notebooks) 66 | 67 | #!markdown 68 | 69 | #### 2. Create a Compute Instance 70 | 71 | This is the compute resource that will run your notebook 72 | 73 | **Tips:** 74 | - Make sure you set it to auto-shutoff if left inactive! 75 | - You don't need something with a ton of capabilities for most tasks 76 | - You can have multiple of these if you need to swap tiers 77 | 78 | #!markdown 79 | 80 | #### 3. Create a Notebook 81 | 82 | You can add a new notebook or upload an existing one 83 | 84 | You cannot work with `.dib` files or Polyglot Notebooks at present 85 | 86 | #!markdown 87 | 88 | #### 4. Share with your Colleagues! 89 | 90 | Standard Azure RBAC controls may be applied 91 | -------------------------------------------------------------------------------- /04_GettingStarted/02_Conclusion.dib: -------------------------------------------------------------------------------- 1 | #!meta 2 | 3 | {"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}} 4 | 5 | #!markdown 6 | 7 | ## Matt Eland | [@IntegerMan](https://twitter.com/IntegerMan) 8 | Code for this talk available at [https://GitHub.com/IntegerMan/PolyglotNotebookTalk](https://GitHub.com/IntegerMan/PolyglotNotebookTalk) 9 | 10 | ![QR Code](../images/QR.png) 11 | 12 | #!markdown 13 | 14 | #### [Polyglot Notebooks documentation](https://github.com/dotnet/interactive/blob/main/docs) 15 | 16 | The team is still building out the [documentation](https://github.com/dotnet/interactive/blob/main/docs), but it does help on some of the architecture. 17 | 18 | #!markdown 19 | 20 | #### [AccessibleAI.dev](https://AccessibleAI.dev) - My Data Science Blog 21 | 22 | Anything new on the data science aspects of Polyglot Notebooks generally goes here. 23 | 24 | #!markdown 25 | 26 | #### [NewDevsGuide.com](https://NewDevsGuide.com) - My Software Engineering Blog 27 | 28 | A lot of content around **Mermaid diagrams** in particular but general content on Polyglot too. 29 | 30 | #!markdown 31 | 32 | #### [MattOnDataScience.com](https://MattOnDataScience.com) - My YouTube Channel 33 | 34 | If you're looking for recorded video content on topics like this. 35 | 36 | This talk will eventually exist as a series of videos on that channel. 37 | -------------------------------------------------------------------------------- /Checklist.md: -------------------------------------------------------------------------------- 1 | ## Notes for Presentation 2 | 3 | ### Prep Work 4 | 5 | - [ ] Groot Server running 6 | - [ ] Anaconda open and ready to demo 7 | - [ ] Phone off 8 | - [ ] Steam off 9 | - [ ] Discord off 10 | - [ ] Slack off 11 | 12 | ### Timeline 13 | 14 | - **Intro** 0 - 5 15 | - **Jupyter** 6 - 28 16 | - **Polyglot** 29 - 50 17 | - **Next Steps & QA** - 51 - 60 -------------------------------------------------------------------------------- /DLLs/Bogus.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Bogus.dll -------------------------------------------------------------------------------- /DLLs/Microsoft.Azure.CognitiveServices.Vision.ComputerVision.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Microsoft.Azure.CognitiveServices.Vision.ComputerVision.dll -------------------------------------------------------------------------------- /DLLs/Microsoft.DotNet.Interactive.SqlServer.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Microsoft.DotNet.Interactive.SqlServer.dll -------------------------------------------------------------------------------- /DLLs/Microsoft.ML.AutoML.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Microsoft.ML.AutoML.dll -------------------------------------------------------------------------------- /DLLs/Microsoft.ML.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Microsoft.ML.Core.dll -------------------------------------------------------------------------------- /DLLs/Microsoft.ML.CpuMath.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Microsoft.ML.CpuMath.dll -------------------------------------------------------------------------------- /DLLs/Microsoft.ML.Data.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Microsoft.ML.Data.dll -------------------------------------------------------------------------------- /DLLs/Microsoft.ML.DataView.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Microsoft.ML.DataView.dll -------------------------------------------------------------------------------- /DLLs/Microsoft.ML.FastTree.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Microsoft.ML.FastTree.dll -------------------------------------------------------------------------------- /DLLs/Microsoft.ML.KMeansClustering.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Microsoft.ML.KMeansClustering.dll -------------------------------------------------------------------------------- /DLLs/Microsoft.ML.LightGbm.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Microsoft.ML.LightGbm.dll -------------------------------------------------------------------------------- /DLLs/Microsoft.ML.PCA.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Microsoft.ML.PCA.dll -------------------------------------------------------------------------------- /DLLs/Microsoft.ML.SearchSpace.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Microsoft.ML.SearchSpace.dll -------------------------------------------------------------------------------- /DLLs/Microsoft.ML.StandardTrainers.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Microsoft.ML.StandardTrainers.dll -------------------------------------------------------------------------------- /DLLs/Microsoft.ML.Transforms.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Microsoft.ML.Transforms.dll -------------------------------------------------------------------------------- /DLLs/Microsoft.ML.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Microsoft.ML.dll -------------------------------------------------------------------------------- /DLLs/Microsoft.Rest.ClientRuntime.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Microsoft.Rest.ClientRuntime.dll -------------------------------------------------------------------------------- /DLLs/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /DLLs/README.md: -------------------------------------------------------------------------------- 1 | These files only exist to demonstrate Polyglot Notebook capabilities without an external connection to the internet. Normally you would not need them. -------------------------------------------------------------------------------- /DLLs/Shouldly.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/DLLs/Shouldly.dll -------------------------------------------------------------------------------- /Images/AnacondaAddR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/AnacondaAddR.png -------------------------------------------------------------------------------- /Images/AnacondaHome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/AnacondaHome.png -------------------------------------------------------------------------------- /Images/ArtCogs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/ArtCogs.png -------------------------------------------------------------------------------- /Images/ArtNotebookConcepts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/ArtNotebookConcepts.png -------------------------------------------------------------------------------- /Images/AzureMLNotebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/AzureMLNotebook.png -------------------------------------------------------------------------------- /Images/Boss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/Boss.png -------------------------------------------------------------------------------- /Images/ClockExtension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/ClockExtension.png -------------------------------------------------------------------------------- /Images/ClockExtensionInvoke.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/ClockExtensionInvoke.png -------------------------------------------------------------------------------- /Images/CogServicesResult1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/CogServicesResult1.png -------------------------------------------------------------------------------- /Images/CogServicesResult2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/CogServicesResult2.png -------------------------------------------------------------------------------- /Images/CogServicesResult3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/CogServicesResult3.png -------------------------------------------------------------------------------- /Images/DataSpell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/DataSpell.png -------------------------------------------------------------------------------- /Images/Discord.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/Discord.png -------------------------------------------------------------------------------- /Images/JesterKeyboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/JesterKeyboard.png -------------------------------------------------------------------------------- /Images/JupyterLab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/JupyterLab.png -------------------------------------------------------------------------------- /Images/JupyterVariables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/JupyterVariables.png -------------------------------------------------------------------------------- /Images/JupyterWebPage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/JupyterWebPage.png -------------------------------------------------------------------------------- /Images/MM_Mermaid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/MM_Mermaid.png -------------------------------------------------------------------------------- /Images/MM_Overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/MM_Overview.png -------------------------------------------------------------------------------- /Images/MM_Usages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/MM_Usages.png -------------------------------------------------------------------------------- /Images/MM_Why.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/MM_Why.png -------------------------------------------------------------------------------- /Images/MVP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/MVP.png -------------------------------------------------------------------------------- /Images/Matt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/Matt.png -------------------------------------------------------------------------------- /Images/Mindmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/Mindmap.png -------------------------------------------------------------------------------- /Images/PolyglotStructure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/PolyglotStructure.png -------------------------------------------------------------------------------- /Images/PyCharm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/PyCharm.png -------------------------------------------------------------------------------- /Images/QR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/QR.png -------------------------------------------------------------------------------- /Images/SelectKernel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/SelectKernel.png -------------------------------------------------------------------------------- /Images/TL_NotebookFormats.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/TL_NotebookFormats.png -------------------------------------------------------------------------------- /Images/Timeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/Timeline.png -------------------------------------------------------------------------------- /Images/TryDotnet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/TryDotnet.png -------------------------------------------------------------------------------- /Images/VSCode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntegerMan/PolyglotNotebookTalk/a1ef2bba6e45337cecaa979ebc473831a62befb1/Images/VSCode.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Matt Eland 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Polyglot Notebook Talk 2 | This code contains code examples for [Matt Eland's](https://MattEland.dev) [Interactive Notebooks](https://stirtrek.com/speakers/2023/Matt-Eland.html#abstract) talk 3 | 4 | The contents of this notebook should explain themselves to a limited degree if you start at `00_Welcome.dib` and then move through each of the folders in sequential order. 5 | 6 | This code is intended to be viewed inside of `VS Code` using the `Polyglot Notebook` extension and the `Jupyter Notebook` extension. Additionally, you will need to have the `.NET SDK version 7` installed for Polyglot to work correctly and a Python environment installed for the Jupyter content to work correctly. I recommend `Anaconda` as an easy way to get a Python environment suitable for data science installed. 7 | 8 | ## Running the Code 9 | 10 | ### Step 1: Install VS Code 11 | 12 | If you don't have it already you'll need Visual Studio Code from [https://code.visualstudio.com/](https://code.visualstudio.com/). 13 | 14 | This is cross-platform, free, and amazing. 15 | 16 | ### Step 2: Install Anaconda 17 | 18 | Installing [Anaconda](https://www.anaconda.com/) will give you a local **Python** environment pre-configured with common libraries already installed along with **Jupyter Notebooks** and **Jupyter Labs**. 19 | 20 | Go to [Anaconda.com](https://www.anaconda.com/) and click **Download** then install it on your operating system. 21 | 22 | You may need to reboot after this step. 23 | 24 | ### Step 3: Install .NET 7 Locally 25 | 26 | If you want to use **Polyglot Notebooks** and the **.NET Interactive** kernel, you need to install the .NET SDK from [https://dotnet.microsoft.com/en-us/download/dotnet/7.0](https://dotnet.microsoft.com/en-us/download/dotnet/7.0). 27 | 28 | ### Step 4: Install VS Code Extensions: Jupyter and Polyglot Notebooks 29 | 30 | You'll need to install the [Jupyter Extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter) in order to run standard Jupyter Notebooks in VS Code. 31 | 32 | In order to use Polyglot Notebooks, you'll need to install the [Polyglot Notebooks extension](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.dotnet-interactive-vscode) 33 | 34 | You may need to reboot your machine or restart VS Code after these steps. 35 | 36 | ## Additional Resources 37 | 38 | ### Official Documentation 39 | 40 | The team is still building out the [Polyglot Notebooks documentation](https://github.com/dotnet/interactive/blob/main/docs), but that documentation is growing. 41 | 42 | ### My Content 43 | 44 | I write and speak about Jupyter Notebooks, Polyglot Notebooks, and various topics related to this talk including: 45 | 46 | - Python 47 | - Pandas 48 | - Plotly 49 | - ML .NET 50 | - Azure Cognitive Services 51 | - Azure Machine Learning 52 | 53 | #### [AccessibleAI.dev](https://AccessibleAI.dev) - My Data Science Blog 54 | 55 | Anything new on the data science aspects of Polyglot Notebooks generally goes here. 56 | 57 | #### [NewDevsGuide.com](https://NewDevsGuide.com) - My Software Engineering Blog 58 | 59 | This site has a lot of content around **Mermaid diagrams** in particular that should help you understand how to get started with Mermaid in Polyglot Notebooks. 60 | 61 | I also will sometimes use Polyglot Notebooks to teach programming concepts or introduce Polyglot Notebooks as a means of experimenting and proving a proof of concept. 62 | 63 | #### [MattOnDataScience.com](https://MattOnDataScience.com) - My YouTube Channel 64 | 65 | If you're looking for recorded video content on topics like this. 66 | 67 | This talk will eventually exist as a series of videos on that channel. 68 | --------------------------------------------------------------------------------