2012-09-24

24 min interval for Cron Job and cycling through file

 Simple approach, how to make cron job iterating over a list of a variables. Firstly, it is necessary store the list somewhere permanently. In simpliest case it can be text document and here the trick is to take only information from first line and then to put it on the end of file as a last element. array_push copies the first line of file $farray[0] as a last element of $farray, and then array_shift removes this first element.
$farray=file("file.txt");
$thisIsWhatINeed=$farray[0];
array_push($farray,$farray[0]);
array_shift($farray);
file_put_contents('file.txt', implode("",$farray));
I added a condition, because in my case there could be, that some part of cron job should not be executed at certain times. I have 54 runs per 24 hours; I calculated that cron job must run every 24 minutes. In 24 hours there are 1440 minutes; 54 runs could take maximum interval 26.666 minutes, but for convenience creating cron jobs (which is another aspect, written a little bit later) I set interval for 24 minutes between cron jobs and add 6 empty runs, which were taken in account using condition. Finally I had 60 runs for 24 hours, so i have 24 minutes as a equal interval between cron job runs.
And here comes another aspect - it is impossible to set intervals in cron, only set times. Thus i had to create 5 cron jobs with each defining (with 24 min step) when to start and run after 2 hours (because in 2 hours there can be 5x24 min intervals)

Two ways of defining upbeat bar length in Sibelius 7

Lately I had to give crash-course in music scores writing program Sibelus (version 7) and after that course I got telephone calls twice asking and precising some of very basic common tasks in the software. Despite I got the main problem - how to put an upbeat, I ended up struggling about how far and what exactly my student was doing working with Sibelius, because there are two ways how to do it.
Ok, so much for introduction, here go my solutions:

1) Easy way. Creating upbeat at quick start. When score writer has chosen what type of writer want to create, next thing is to choose different properties for scores, like time signature, tempo, key, etc. Under the Time signature setup there is option to create Pick-up bar with different length than it is defined by time signature. Easy as pie, but often forgettable.

2) Not so easy way. But, if score writer forgot to create upbeat at quick start, then it is still possible to make upbeat later. Here, writer have to select "Notations" tab to access "Time signature" dropdown selector. In dropdown selector there are common signatures, and under them there is button "More Options". And upbeat creation can be found there. Checkbox at "start with bar of length", choose length and press OK. After such manipulation mouse cursor becomes active and now it will create a bar with previously defined length in the place where score writer will click. So, because upbeat needs to be in the beginning of scores, score writer must click somewhere on the first bar or, better, on the key.