I know it’s a few hours late but here we go… As with everyone else, Duke all the way!

# InSight Provides Real-time Weather on Mars

This is pretty cool!

# 100 Days of Swift

Paul Hudson (@twostraws) is hosting a 100 Days of Swift in which he provides short videos, quizzes and assignments to walk you through an introduction to Swift. He actually started some time ago, I think on Feb 1, 2019, but I’m just getting started now and have completed Day 4!

In Day 1, we covered the following topics:

- Variables – test
- Strings and integers – test
- Multi-line strings – test
- Doubles and booleans – test
- String interpolation – test
- Constants – test
- Type annotations – test
- Simple types: Summary – test

In Day 2, we covered the following topics:

- Arrays – test
- Sets – test
- Tuples – test
- Arrays vs sets vs tuples – test
- Dictionaries – test
- Dictionary default values – test
- Creating empty collections – test
- Enumerations – test
- Enum associated values – test
- Enum raw values – test
- Complex types: Summary – test

In Day 3, we covered:

- Arithmetic Operators – test
- Operator overloading – test
- Compound assignment operators – test
- Comparison operators – test
- Conditions – test
- Combining conditions – test
- The ternary operator – test
- Switch statements – test
- Range operators – test
- Operators and conditions summary – test

In Day 4, we covered:

# Exec-php WordPress Plugin and PHP 7 Fix

I recently upgraded the version of PHP used on our hosting service to 7.1, as the Elementor plugin requires at least version 7 to run now. This had the side effect of breaking the Exec-php plugin (version 4.9) I use to allow PHP code to run in posts and pages. It manifested itself with the following error message:

Parse error: syntax error, unexpected ‘new’ (T_NEW) in

It appears you can no longer assign a class in PHP version 7 using the ‘&’ symbol and Exec-php makes extensive use of this. Here’s an example:

$GLOBALS['g_execphp_manager'] =& new ExecPhp_Manager();

I went through all of the instances and removed the & symbol using BBEdit and it now runs correctly.

Thanks to the CodeCave blog for this insight!

# Using Python to Calculate Transmission Probabilities for Multilayer Structures

I’m currently taking the second Quantum Mechanics for Scientists and Engineers course online from Stanford. They are both great courses taught by David Miller. The second course is looking more at applications and the third week’s topic was optical absorption by semiconductors.

Once we worked through all the physics and algebra, it was presented that these types of calculations are very easy to code and Professor Miller provided a program to calculate the transfer matrix and transmission probabilities for multilayer structures. The code he provided was for Matlab (and also for Mathcad). I have Octave, basically an open source version of Matlab, running on my Mac, so I was able to run the code provided. Mathcad is only available on Windows and installing Octave on a Mac can be a bit cumbersome, so I wanted to create a solution that could easily be run on any platform and work on my Python coding skills, which are pretty dismal.

It took a couple of days to port the Matlab code to Python but I got it running, the challenge being complex numbers in Numpy. Then a little more time to figure out Jupyter Notebooks, as my original code ran straight Python on my desktop. Here’s a link to my notebook running on Google’s Colaboratory:

https://colab.research.google.com/drive/1aMV8ZYSfhraMMVnF_KiVhHFJXnMzWZnN

This link is view only, but you can easily download the code and run it in your own notebook, which will allow you to change the parameters, like the potentials, effective masses, etc. If you do run this one, you should get a graph that looks like this:

I did not attempt to make the code as efficient as possible, the goal was simply to get it to work. Comments and feedback are welcome.

# Quicklook JSON

# Setting the To value: cell in Excel’s Goal Seek to a Cell Reference

Sadly, it took awhile to “figure” this out. I was trying to solve a set of equations in Excel. I had one equation in one cell, say B1, that had a dependency on the value in A1. I had the second equation in cell C1 that also has a dependency on A1. I wanted to set cell B1 equal to CELL C1 by changing cell A1. You can’t do this with Excel’s Goal Seek feature, the To value: has to be a number.

The solution of course, was to create a third cell, D1, with the formula “= B1 – C1”. When those two cells are equal, as I wanted, D1 = 0. So now you can ask Goal Seek to solve the set of equations by setting cell D1 to value 0 by changing cell A1.

Yay!

# pydotplus on macOS

I’ve been playing around with SciKit-Learn’s decision tree regression function. In one of the examples I was working on, they provided a demo script to print out a jpg of the decision tree. Cool! Unfortunately, my system didn’t have pydotplus installed. I’m using Anaconda, so issuing the following command took care of that issue:

`conda install -c conda-forge pydotplus`

However, when attempting to run again, this produced and error stating that the GraphViz executable could not be found. Ugh. Luckily, a quick trip to Homebrew took care of that issue:

`brew install graphviz`

Voila!

# Move to Trash Deletes Immediately

I had this issue when I first updated to macOS Mojave. To solve it, I performed the following command in Terminal:

```
sudo rm -Ri ~/.Trash
[enter your password]
```

Then, Log out. Log back in. Move to Trash now works as expected.

*Note: You can implement Delete Immediately… by holding down Option-Command-Delete.*

# NBA 2018 Bracket

Okay, the NBA bracket challenge has a horrible interface! As a reminder for future years, don’t use this! Go with ESPN or someone else. Having said that, here’s my NBA bracket. I think it shows my picks except for the Blazers, who got their asses swept by the Pelicans, so zero points there! Amazing that was the series with a sweep.

Go Warriors!