Any views expressed within media held on this service are those of the contributors, should not be taken as approved or endorsed by the University, and do not necessarily reflect the views of the University in respect of any particular issue.

...in which I don't go up mountains

Category: Programming Page 1 of 2

A row of white doors with one yellow door

Fixing two identical strings that don’t match in Power Automate

Reading Time: 3 minutes

Recently I’ve been working on a Power App for academic and teaching office staff to organise feedback on postgraduate dissertations. Microsoft recommend a maximum of 30 connectors per Power App, so I decided to pass the course codes to Power Automate, where a Switch action could be used to choose which course’s SharePoint lists to read data from.

This is how I had set that up in Power Automate:

Diagram of a Power Automate flow, showing course codes being used in a Switch statement to choose between subsequent actions

The Switch statement compares the course code passed in from Power Apps with text strings providing the code for each course. It should match one of them and then follow that course of action. But it didn’t. The two seemingly identical strings didn’t match, and the flow ran into the default (matching none) condition instead.

Two road signs pointing to the same location in opposite directions

Confusing road sign at Elan Village
cc-by-sa/2.0© Chris Henleygeograph.org.uk/p/265977

Painted artwork showing pictures in a spiral formation on a turquoise background

Using a Toggle to make a While Loop in Power Apps

Reading Time: 3 minutes

Picture: One Infinite Loop, Ignacio Sanz, CC BY-SA 2.0, via Wikimedia Commons and Flickr

The Problem: Power Apps only has ForAll Loops

When I was creating a demo Power App to fetch and display Dad Jokes, one of the challenges I faced was to fit the joke text inside a speech bubble graphic. The speech bubble was expandable, but only within limits, so I needed to keep fetching jokes and checking the length of their text until I found one short enough to fit inside the bubble design.

Power apps editor screenshot with the text 'Too long'

After clicking the button: the app enters the loop and the text changes to ‘Too long’

However, looping in Power Apps turned out to be tricky. Unbelievably, I discovered there is only one kind of loop in Power Apps: ForAll, which is used for looping over tables and collections. Power Apps really doesn’t have any other kind of loops, or even GoTos in the coding it makes available.

Making a While Loop in Power Apps

However, after much research, trial and error, I found a way to do this with just the loop (More Dad jokes) button and a hidden toggle:

Screenshot of a Power App that fetches random jokes from a REST API

Making a Dad Jokes App using REST APIs and Power Apps Custom Connectors

Reading Time: 30 minutes

This post describes a Power App that fetches and displays data from a simple REST API using a custom connector created by importing from Postman. The app also uses a Toggle control to create a While loop in Power Apps.

The app itself can be found here: https://apps.powerapps.com/play/f1478489-b888-4e8a-9fe5-8c244e126e70?tenantId=2e9f06b0-1669-4589-8789-10a06934dc61, but is sadly only available to those with a University of Edinburgh login, as this app is a personal educational project and is not for publication or profit.

Why did this happen?

I’ve recently been working on a project to access our Blackboard Learn Virtual Learning Environment more efficiently using REST APIs. It occurred to me that this might be possible using Microsoft Power Apps, which could allow the development of apps more quickly, if we could get the connection itself figured out. The Dad Jokes app was developed as a proof (or otherwise) of the concept.

Screenshot of an index box with HTML links

Index links and Info Box HTML template code

Reading Time: 2 minutes

Over the summer I helped out with setting up information blogs about Digital Education for the staff and students in GeoSciences.

One pattern that we needed to use several times was an index box linked to headings in sections with ‘back to top’ links, so I created a basic template that can be pasted into WordPress.

Anyone is welcome to adapt and use this: either copy and paste the top section into the Visual editor, or copy and paste the HTML section into the Text editor.

If your theme allows you to use Custom CSS (some but not all of ours do), you can use the id and class names for visually styling the elements.

Note: I have linked to line breaks above the headings rather than the headings themselves due to the variation in how the different themes we were using treat anchor links.

Here is the sample Info Box / Index links structure:

Main picture.
Introduction paragraph text.

I've got second place on the podium in the Kahoot quiz!

Day 2 of Microsoft 365 Global Developers’ Bootcamp: Building One Productivity Hub

Reading Time: < 1 minute

Obviously this was one of the high points for me: there I am in second place on the podium in the Kahoot quiz!

I've got second place on the podium in the Kahoot quiz!

To be fair, I did do this quiz twice…

Personally I would love to have my own working copy of the One Productivity Hub app, as it is a step better than the ‘Team of Me’ that I had put together earlier in lockdown as an attempt to bring all my notifications together. I am still a step or two short of being able to install something like that in our Office365 setup: our security does not allow for setting up the ‘ngrok’ tunnelling and I don’t know yet how to deploy the app in a more permanent way.

So at the moment I am stuck on this error when I try to install it to my personal Team:
Valid domains cannot contain a tunneling site. Please remove these in your manifest. To help to ensure the security of your app and users, domains outside of your organization's control (including wildcards) and tunneling services cannot be included in the valid domains in your manifest.

But it’s been a great learning experience, so I thought I’d share my joy and thank the instructors on Twitter😎:

Links

One Productivity Hub Teams App

Coronavirus apps

Reading Time: < 1 minute

I collected some links about apps people have been developing in connection with the coronavirus pandemic:

Coronavirus App Links

Raspberry Pi Day, with added Internet of Things!

Reading Time: 3 minutes

Raspberry Pi is a small, cheap computer on a circuit board the size of a credit card. I spent a very interesting day in training today, learning how to use a Raspberry Pi with Python programming, creating small embedded systems and connecting to servers, with applications (in theory!) for the Internet of Things. Today a little red light, tomorrow the world!

World domination aside, it was the first time in years that I had built an electronic circuit, or done any microcontroller programming, so it was a very hands on day and a really fun change from my usual work.

Radiohead: No surprises

Unix file counting challenge, Part 3: Counting with Shell Scripts

Reading Time: 7 minutes

This post follows on from Unix file counting challenge, Part 2, which in itself follows on from Part 1. No surprises there.

Post Summary

These are the steps I’ve been taking in developing a short Unix shell script to count a lot of files and directories by type.

Scarlett O'Hara: "After all, Tomorrow is another day!", Gone With the Wind, via MagicalQuote.com

Unix file counting challenge, Part 2: Tracking down the errors

Reading Time: 9 minutes

Summary:

I’ve got a project coming up that will involve some major tidying up of a big shared network drive that has been used in different ways by many different people over many years.

One of the first steps is to find out what kind of files are on the network drive, how many of them there are, whether they’re still being used, and where they are stored in the directory structure.

I use a Windows laptop at work, which has a VPN connection to the University’s network and a MacBook at home, which doesn’t (yet). I’ve also been attending a training course in Unix skills, which seem like they could usefully be applied to this problem, and I’ve been really enjoying finding out more about this.

So that’s the combination of things going on.

This post is continued from Part 1, which is:

Can I turn a massive bureaucratic, er, challenge into a fun Unix challenge?

Counts with text fragments

Can I turn a massive bureaucratic, er, challenge into a fun Unix challenge?

Reading Time: 12 minutes

Well.

I have been given an enormous number of files of different types, in many jumbled up directories and subdirectories on a network drive, to count. That ought to be a job for the Unix commands and shell scripting I’ve been learning at Software Carpentry over the last couple of weeks, right?

My initial thoughts were that this could be done with either the command line, probably involving ls, sort, regular expressions with uniq and counting options or a shell script looping through a file listing with some combination of those.

Time to fire up Git Bash, my trusty Unix terminal for Windows…

Page 1 of 2

Powered by WordPress & Theme by Anders Norén

css.php

Report this page

To report inappropriate content on this page, please use the form below. Upon receiving your report, we will be in touch as per the Take Down Policy of the service.

Please note that personal data collected through this form is used and stored for the purposes of processing this report and communication with you.

If you are unable to report a concern about content via this form please contact the Service Owner.

Please enter an email address you wish to be contacted on. Please describe the unacceptable content in sufficient detail to allow us to locate it, and why you consider it to be unacceptable.
By submitting this report, you accept that it is accurate and that fraudulent or nuisance complaints may result in action by the University.

  Cancel