While my heart is with the Leafs, I think it’s going to be difficult for anyone to beat Tampa this year. I’d love to see the NHL go (back) to the NBA style playoff structure, where 1 plays 8 but until that time (at least 2 more years), some of the best playoff hockey will be in the first 2 rounds.
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!
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.
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:
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.
If you're on macOS and have Homebrew installed, run `brew cask install quicklook-json` and Quick Look will let you look into JSON files properly. pic.twitter.com/CZi85TXVUc
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.
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: