Disclaimer, I don’t consider myself a programmer. At best I am a citizen developer, a term programmers hate. My degree is in accounting and my programming skill level can best be described as “knows enough to be dangerous’.
I’ve been playing with shortcuts in IOS. Mostly I’m building a morning an evening routine to start and wrap up my day. These include things like upcoming calendar events, tasks, today’s weather, etc. That’s how I found out that the weather tools in Shortcuts, and most of the weather shortcut examples suck.
In Shortcuts, users can select Get Current Weather for a location. Then use text or scripting to pull out individual elements like today’s high. This is where things go wrong. The “high” temperature is the high over the LAST 24 hours. If the current temp is higher it doesn’t matter, you get yesterday’s high. I’m not sure how this makes any sense, but it’s what Current Weather does. And many, many weather shortcut examples do exactly this and give wrong information.
There’s a different option in Shortcuts called Get Weather Forecast. That seems promising, until you realize that it gives you the forecast for each of the next 7 days. Most of the time, I’m trying to figure out today. Seven days is forever.
Ultimately, I solved this using scripting in Shortcuts to pull out just one day. For my day start, I look at today. For my day end, I look at tomorrow.
The nuts and bolts of this are:
[Get Weather Forecast] Get Daily forecast at CurrentLocation
[Get Item from List] Get FirstItem from High (High is one choice from the Weather Conditions magic variable. This is a list of high temps over the next 7 days and we are picking the first one, today.) or [Get Item from List] Get Item at Index 2 from High (Item at Index 2 is the second choice in the list. Today is 1, tomorrow is 2, etc.)
[Round] Round Item from List to Ones Place (This is optional and rounds the temp to the nearest whole value. It’s a prediction not a precise measurement.)
[Set Variable] Set Variable nHigh to Rounded Number (I chose to put the result into a variable because I want the high and low and other pieces to all be displayed together.
[Text] Today’s high will be nHigh (nHigh here is the variable from above. You should be able to just select it. This sets the text to speak or display.
[Show Result] Show Text (Show will show or speak depending on if the shortcut is run from Siri) or [Speak Text] Speak Text (Speak will always speak the text
I hope this helps somebody out who’s struggling with this. I found it frustrating and I tend to blog about things I don’t want to forget.
At NASA, one issue with O-Rings was that they had seen damage before. NASA had a precedent of O-Ring damage starting with the first shuttle flight. As the incidents and level of non-fatal O-Ring damage increased, NASA was concerned but kept launching because they had a precedent of O-Ring damage.
My simple consulting example comes from experience. We had a rule. When you travel to visit a client the first time, never stay in a crappy hotel. If you do, you’ll be stuck in a down market hotel for the rest of the project. That first trip is the precedent and overcoming it later takes a lot of effort.
My point is simply don’t forget how powerful precedent can be when making decisions. In the case of NASA, it took a tragedy to overcome it.
My pet peeve word right now is constantly. It’s followed closely by continuously. Short of breathing, there are few things people do constantly. I know it’s hyperbole. It’s also common enough to be annoying.
I find this most annoying when organizations do it because it seems disingenuous. Companies aren’t constantly making changes to their software. Professional firms aren’t continually scanning the landscape for the newest big idea. They may be regularly updating or frequently scanning, but constantly? continuously?
This continuous march of constantly is now having the opposite effect. If someone says they constantly do something, I assume they did it once. Maybe they thought really hard about doing it one time, but now they want to do is talk about it.
This one is a reminder for me. I’m the dummy from the title. It’s a variance of reboot your computer occasionally.
When everything is working fine and then stuff just stops working try restarting the core. More and more, that for is the phone, not the PC.
One example, occasionally my wife’s Car Play acts up in her car. The answer is always restart the phone. Everything in Apple’s Car play flows through the phone.
Today it was the Apple Watch. I’ve got an older one that I use to login to my Mac. Today, no login. I tried all the recommended tricks and was close to re-pairing my watch. Re-pairing a watch is not a simple task so I put it off. Then it hit me…at least try restarting the phone. That worked. Of course, getting to that point wasted the better part of an hour, but fixed is still better than broken.
I’m working on a little project for some of our partners. Basically pulling some data out of Fastpath and having Excel pull it into a pivot table via a macro. In the past, I’ve tried to stay away from macros and VBA when I could. Frankly, the security issues macros can cause sometimes force people to shy away from using them. This time I had no choice.
I started with code to import a report and pull out the header to make pivot table creation easier. Then came code to create a pivot table. I got everything working for one ERP system, but I need this work on multiple ERP’s. My first thought, the sloppy thought, was to just replicate the code and make multiple Excel files. That thought didn’t last long. Too hard to maintain.
After that I decided to copy parts of the code and give users the chance to select their ERP and drive the code selection that way. That’s when things got interesting. In testing I realized that my Excel code simply skips pivot table columns if they aren’t present. For example, if D365 uses “Role” and Oracle EBS uses “Responsibility”, I could put both of those items in the code, but if I’m running this for D365, Responsibility won’t come in because it’s not in the file. Excel just ignores that Responsibility is missing and moves on. This made coding for multiple ERP’s much easier. I no longer needed to make users pick an ERP system. With the right code, it just works for each ERP I’ve setup.
It wasn’t this easy of course. I found a bug in my v1 that blew out an entire worksheet as I moved to v2. Oops. Pulling out the header proved to be more challenging than expected since the header can be different lengths. I still have some testing to do, but all the preliminary stuff looks good.
So what’s the point? Well 1) It’s cool that Excel VBA doesn’t error out when building a pivot table if a field is missing, it just moves on. 2) Projects like this take some deep work. They need large blocks of time and they can’t be rushed. Distractions kill work like this. Twitter, email, slack, all of it. It’s a lot of “no’s” to tackle a project of even limited complexity.
Oh, and for those of you asking, yes, I built the whole thing in Excel for Mac and it runs just fine in Excel for Windows.