Browsed by
Category: self appraisal

Personal skills, qualities and contexts: Communication, Numeracy, IT, Problem Solving, Working with Others, Technical Skills

Randomise column in CSV using awk

Randomise column in CSV using awk

In packaging our learning analytics automation system I have provided test data in CSV files on the Virtualbox machine. These CSV files contained actual student ID numbers from our College so I needed to replace them with random, non-repeating information. I have substituted these with Student(n) to represent the real students for this post. I found an excellent AWK entry on the evergreen Stack Overflow which fit my particular use case. This is very close to what I need to…

Read More Read More

Date offsets in PHP

Date offsets in PHP

I have been alerted to a problem with some of our CTS course search results which were displaying the wrong availability times. The times for the sessions are held in UNIX timestamp form which turned out to be the root of the problem. Each of the courses are due to start at 9am but two were presented as 8am on the website. Adding to the confusion was the fact that the HTML web service output showed the correct times where…

Read More Read More

Alternatives for directory listing in shell scripts

Alternatives for directory listing in shell scripts

I often have to repeat a process for every file of a certain type in a given directory. I have been use to using this ls dialogue: #!/bin/bash for file in `ls /data/video`;do   ffmbc – i $file -vcodec prores $file.mov done; This has some drawbacks as it tends to print the entire path to the file so you are restricted to where you put the output files. I have recently spotted a topic discussing this and their solution gives…

Read More Read More

I’m working solely on a Mac

I’m working solely on a Mac

I have shifted all of my work on to my Mac. The keyboard is nice but I need to use some new shortcut keys to achieve the things I used to do on my Linux workstation. In particular the nano editor has some peculiarities when navigating around. I can still use CTRL+shift+_ and type a line number but I couldn’t find Page Up, Page Down, Top, Bottom and skip a word forward and backward so here they are (After working…

Read More Read More

Delay UI Elements in iOS

Delay UI Elements in iOS

In my iOS app for the front reception desk I provide a staff sign in/out facility for staff visiting another campus site. The theory is that anyone who works at Dumfries campus visiting Stranraer will sign in via the iPad. The problem is that there are 200+ records to be loaded from web service on the screen with the sign in / sign out buttons. It is possible if you are very fast to attempt to load one of the…

Read More Read More

Check a samba mount is still available in Linux Bash

Check a samba mount is still available in Linux Bash

Sometimes in shell scripts I need to get files from Samba shares but these can become disconnected for various reasons so it’s always a good idea to check before retrieving data from them. An easy way to do this is to check whether the share you want to use is mentioned in /proc/mounts which is part of the proc virtual file system. /proc/mounts is not a real file like many end points in linux. So in my linux bash script…

Read More Read More

Using awk to get values from XML

Using awk to get values from XML

I have had occasion to write a shell script which carries out several tasks relating to learning analytics. One such task is to find out the current academic week. It’s not that easy to do MySql/PHP operations from inside a shell script. As luck would have it we have an in house web service which provides this information. The output however, is either JSON or XML. The XML version looks like this: <?xml version=’1.0′ encoding=’iso-8859-1′ ?> <weekno>32</weekno> The Linux shell…

Read More Read More

Adding secure parameters to web service calls Android AND XCode!

Adding secure parameters to web service calls Android AND XCode!

When you need to get information from a web service for your mobile application (which is almost all you ever do) you must have the ability to add $_POST information and send the request securely. Apple’s Swift language insists on this for every call to an external URL. Android is not so strict mainly because there are about a hundred ways to do this in Android and very few in Swift. As a for instance let’s go back to the…

Read More Read More

Moodle 3.0 to 3.2 Notes to self

Moodle 3.0 to 3.2 Notes to self

Moving from Moodle 3.0 to Moodle 3.2 is more involved for us than previous upgrades.  This is due to important dates in our Calendar and the end of life support for Ubuntu versions. Our current OS version is Ubuntu 14.04 on both Web and DB servers. 14.04 EOLs during block 2 in our 2017/8 session which is not an ideal situation, particularly if a critical update is needed after that date but before our next planned OS upgrade cycle. Ubuntu…

Read More Read More

Swift asynchronous web calls

Swift asynchronous web calls

I have written in the past about retrieving xml from asynchronous web service calls in Android Studio. In XCode / Swift there is no need to set up an entire class as an async task to retrieve data. You can interrupt viewDidLoad, retrieve your JSON data (including handling errors such as no connection) then resume your task like this: let url = URL(string: “https://yourwebservice”)! let task = session.dataTask(with: url, completionHandler: {             (data, response, error)…

Read More Read More