mailto: blog -at- heyrick -dot- eu

Scrambled egg and chips

I mowed some grass yesterday. As I went shopping and got home for just after six, which became half six when everything was sorted out, it wasn't able to be finished as I had to stop by 8pm. I finished today, and also turned the part of the potato patch that didn't have anything growing on it.

Anyway, as I was tired last night, I wanted a simple meal that was also "nice".

Here it is.

Scrambled egg and chips
Scrambled egg and chips.

The scrambled egg was cooked in the microwave, then covered with cheddar and a little pepper.
The chips are homemade - a few store bought potatoes, peeled, chipped, and cooked in the air fryer. Before cooking they were tossed in sunflower oil, and during cooking shaken regularly.

Today? Probably pasta and chicken nuggets.

 

Daily backdrop - part one

Rather than having a single fixed backdrop all the time, I felt that it would be nice to have a selection of backdrops, which are changed randomly. But remain the same through the course of the day.

Here is an example of some of my backdrops, all the result of numerous Google searches and wandering around crappy advert-laden sites (yay for UBlock Origin!).

Various backdrops
A collage of various random backdrops,
all © unknown people way more talented than me.

You might notice a shift in emphasis towards something more in keeping with the sort of music I listen to (today's preferred track: Deadlocked by Tristania).
In my defence, I started out looking for backdrops for Halloween and.... got a bit sidetracked.

Andrew, of R-Comp fame, suggested Pinboard2. I tried it and... it does a lot. I'll keep it installed as it's a pretty useful upgrade on the existing pinboard ... best bit, it will scale images to the size of the screen and not the size of the work area (screen minus iconbar) which always results in oddly squished images.
There's also an option to make the iconbar slightly transparent. Not sure how it actually does that, but it's a pretty nifty effect, as can be seen from this screenshot.

My current desktop
My current desktop, featuring Cthulhu.

Now, Pinboard2 almost does what I want. In a manner of speaking. It can be set to have an automatic carousel of images randomly selected from a directory, and if you set it to change after 86400 seconds, then it'll be a new daily backdrop.

However, upon rebooting, it will pick a new random backdrop.

Now I tried to get Pinboard2 to compile, but it will not on my system. It is set up to work with the OS build environment, which is rather different to the DDE build environment. For example, the DDE doesn't have "amu_machine". It's easy to alias that to "amu -E %%*0", but everything falls apart when trying to reference the exported headers.

So rather than banging my head on the wall looking to get that built, and try to work out where exactly to place my modifications in the scheme of things, I decided instead to write some proof-of-concept code to pick a new backdrop every day when the machine is booted.

This does not change the backdrop if the machine remains on. I'll do something for that in a few days. It'll probably be "mostly this code" in a polling loop that checks the date once every minute, and makes the change if it's changed to a new day.

This program is called ChooseBD and should be placed into !Boot.Choices.Boot.PreDesk.

What it does is it checks the current day number, and if it's different than the one we have remembered, it will check a directory (currently $.Documents.backdrops) for any sprite and JPEG images. These will be enumerated, one will be picked at random, and then the PinSetup file modified to load the chosen image.

It contains sufficient comments that it shouldn't be too hard to follow. The only thing that might need explanation is the maths around the date calculation. We're basically extracting the current date as ordinals (that is to say, individual values for the day, month, and year) and then translating it into a Julian Date, which is a unique number for each day.

REM >ChooseBD
REM
REM Choose Backdrop - version 0.01
REM by Rick Murray, 17th September 2022
REM

ON ERROR PRINT REPORT$+" at "+STR$(ERL) : END

maxentries% = 64
ourentries% = 0
imgdir$ = "Boot:^.Documents.backdrops"
currf$ = "<Choices$Write>.Boot.Tasks.PinSetup"
copyf$ = "<Choices$Write>.Boot.Tasks.__PinSetup"
settings$ = "<Choices$Write>.HeyRick.ChooseBD"
DIM entry$(maxentries%)
DIM buffer% 255

REM Sanitise
REM Images directory must exist and be a directory
SYS "XOS_File", 17, imgdir$ TO type%
IF (type% <> 2) THEN END
REM PinSetup file must exist and be an Obey file
SYS "XOS_File", 23, currf$ TO type%,,,,,,ftype%
IF (type% <> 1) THEN END
IF (ftype% <> &FEB) THEN END

REM Now check the current date
buffer%?64 = 3
SYS "OS_Word", 14, buffer%+64
SYS "Territory_ConvertTimeToOrdinals", -1, buffer%+64, buffer%
yy% = buffer%!&18
mm% = buffer%!&14
dd% = buffer%!&10
jj% = (1461*(yy%+4800+(mm%-14)/12))/4+(367*(mm%-2-12*((mm%-14)/12)))/12-(3*((yy%+4900+(mm%-14)/12)/100))/4+dd%-32075

REM Does our settings file exist?
SYS "XOS_File", 17, settings$ TO type%
IF (type% = 1) THEN
  fp% = OPENIN(settings$)
  line$ = GET$#fp%
  CLOSE#fp%
  IF (VAL(line$) = jj%) THEN END : REM Same day
ENDIF
SYS "XOS_CLI", "CDir <Choices$Write>.HeyRick"
fp% = OPENOUT(settings$)
BPUT#fp%, STR$(jj%)
CLOSE#fp%

REM Enumerate the available files
start% = 0
REPEAT
  SYS "OS_GBPB", 12, imgdir$, buffer%, 1, start%, 255, 0 TO ,,,num%,start%
  IF (num% <> 0) THEN
    REM We have something, but we only want Sprites of JPEGs.
    IF ( ( buffer%!20 = &FF9) OR ( buffer%!20 = &C85) ) THEN
      SYS "XOS_GenerateError", buffer%+24 TO buffer$ : REM So very lame
      entry$(ourentries%) = buffer$
      ourentries% += 1
    ENDIF
  ENDIF
UNTIL (start% = -1)

REM Sanitise - we do have images, right?
IF (ourentries% = 0) THEN END

REM Pick one at random
which% = RND(ourentries%)
which% -= 1 : REM Counting from zero

REM Obtain it's canonical name
SYS "OS_FSControl", 37, "Boot:^.Documents.backdrops."+entry$(which%), buffer%, 0, 0, 255
SYS "XOS_GenerateError", buffer% TO canoname$

REM Now update the PinSetup file accordingly
currf$ = "<Choices$Write>.Boot.Tasks.PinSetup"
copyf$ = "<Choices$Write>.Boot.Tasks.__PinSetup"
SYS "XOS_FSControl", 25, currf$, copyf$
in% = OPENIN(copyf$)   : REM Read from the copy
out% = OPENOUT(currf$) : REM Write to the in-use

REM Copy across the file verbatim except the part we're changing
WHILE NOT EOF#in%
  line$ = GET$#in%
  REM Lowercase a copy for matching
  linecopy$ = line$
  FOR scan% = 1 TO LEN(line$)
    MID$(linecopy$, scan%, 1) = CHR$(ASC(MID$(linecopy$, scan%, 1)) OR 32)
  NEXT

  IF (INSTR(linecopy$, "backdrop ")) THEN
    REM This is the part we want to alter.
    REM Look for "::"
    posn% = INSTR(line$, "::")
    IF (posn% = 0) THEN
      REM The user has entered a relative path here.
      posn% = INSTR(line$, "<")
    ELSE
      WHILE ( MID$(linecopy$, posn%, 1) <> " ")
        posn% -= 1
      ENDWHILE
      posn% += 1 : REM Step over the space
    ENDIF

    REM We know where the filename begins, so find the end
    end% = posn%
    len% = LEN(linecopy$)
    WHILE ( ( MID$(linecopy$, posn%, 1) <> " " ) AND ( end% <= len% ) )
      end% += 1
    ENDWHILE

    REM Was it not actually found?
    IF (posn% = 0) THEN
      REM Neither an absolute path nor a relative one.
      REM Might be something like Boot:^... but we'll
      REM just overwrite the line and too bad. PinSetup
      REM does NOT create these sorts of things.
      BPUT#out%, "X Backdrop -Colour &00000000 -TextColour &ffffff00 "+canoname$
    ELSE
      IF (end% >= len%) THEN
        REM We only need to extract out the beginning
        linecopy$ = MID$(line$, 1, (posn% - 1)) + " "+canoname$
      ELSE
        REM We have information on both sides to deal with
        linecopy$ = MID$(line$, 1, (posn% - 1)) + " "+canoname$ + MID$(line$, (end% + 1))
      ENDIF
      BPUT#out%, linecopy$
    ENDIF
  ELSE
    BPUT#out%, line$
  ENDIF
ENDWHILE

CLOSE#in%
CLOSE#out%

REM Tidy up
SYS "XOS_CLI", "SetType "+currf$+" Obey"
SYS "XOS_FSControl", 27, copyf$, , 0, 0, 0, 0, 0

 

 

Your comments:

Please note that while I check this page every so often, I am not able to control what users write; therefore I disclaim all liability for unpleasant and/or infringing and/or defamatory material. Undesired content will be removed as soon as it is noticed. By leaving a comment, you agree not to post material that is illegal or in bad taste, and you should be aware that the time and your IP address are both recorded, should it be necessary to find out who you are. Oh, and don't bother trying to inline HTML. I'm not that stupid! ☺ ADDING COMMENTS DOES NOT WORK IF READING TRANSLATED VERSIONS.
 
You can now follow comment additions with the comment RSS feed. This is distinct from the b.log RSS feed, so you can subscribe to one or both as you wish.

VinceH, 18th September 2022, 15:43
Your scrambled egg looks to me more like a really deep omelette, without anything added. 
 
Although TBH, I haven't had an omelette in a very long time, so that's based on a very very old memory of what one looks like. I've never made one myself, whereas I do on rare occasions make scrambled egg* but I think the basic method has a lot in common with making scrambled egg - so a similarity may be understandable. 
 
* I rarely buy eggs unless I fancy a fry up for breakfast, and when I do, *if* I happen to have bought milk at any point (which I also rarely buy), I sometimes also do scrambled eggs at some point. 
 
Another random backdrop changer that you didn't mention (may not be aware of?) is Stuart Halliday's BgrdImage (hosted on RISCOSitory). This was what I used for many years, and had it set to download and use the Astronomy Picture of the Day. A flaw was that those images would have different sizes and aspect ratios from one day to the next - but the ability to fetch an image from a specific site and use that was quite cool. 
 
IIRC, though, you needed to know enough to be able to configure it to recognise the right image link in the source html page - and to be able to update that configuration if the page design changed - so probably not the most user friendly. I suspect (but can't remember for sure) the reason I stopped using it is that some component or other wasn't 32-bit. 
 
When I was still using RISC OS more frequently, I thought about a random backdrop changer, but never ever sat down to commit my thoughts even to notes, let alone code. One of the ideas I had was a 'rules' file so that you could say (for example) normally pick one from 'this' folder, but on specific dates (or date ranges) use 'this other' folder instead - so in the run up to Halloween for example (as you mentioned it) you could have random horror films, in the run up to Christmas (if you're that way inclined) you could have festive images, and so on. 
Steve Drain, 18th September 2022, 17:02
I was intrigued by the random background program, although I just use a simple tiling. My effort is at: 
http://www.kappa.me.uk/Micellaneous.swBackdrop001.zip 
if you are interested. 
It has a simple approach, but it has an attempt at 24 changes - untested.
Steve Drain, 18th September 2022, 19:20
Or even 
http://www.kappa.me.uk/Miscellaneous/swBackdrop001.zip  
No editing, Rick.
Rick, 18th September 2022, 19:29
Not my fault you didn't copy paste from a link. 😋 
 
No, I don't do editing. While it can be useful, some people can use this to go back and alter what they have written. 
I'd like to support an ElReg style "10 minute editing window" but this comments system is very simple and doesn't require login, cookies, etc. 
 
As your consolation prize, I've made your URL a clickable link.
J.G.Harston, 19th September 2022, 14:01
In my Choices directory, I have a directory Backdrops with: 
10 REM > Backdrops.!Run 
20 REM Set a random backdrop 
30 ON ERROR PROCCloseAll:END 
40 SYS "OS_GetEnv" TO A$ 
50 A$=MID$(A$,1+INSTR(A$," ",1+INSTR(A$," ",1+INSTR(A$," ")))) 
60 Path$=A$:IFA$="":Path$="Choices:Backdrops." 
70 in%=OPENIN(Path$+"!List"):IF in%=0:END 
80 A%=RND(-(TIME EOR RND(65535))) 
90 REPEAT 
100 REPEAT 
110 PTR#in%=RND(EXT#in%) 
120 REPEAT:UNTIL BGET#in%<32 
130 UNTIL NOTEOF#in% 
140 A$=GET$#in% 
150 UNTIL LEFT$(A$,1)<>"|" 
160 CLOSE#in%:in%=0 
170 OSCLI "Backdrop "+Path$+A$:END 
180 : 
190 DEF PROCCloseAll 
200 in%=in%:IF in%:A%=in%:in%=0:CLOSE#A% 
210 ENDPROC 
220  
230 Backdrop -S ADFS::IDEDisc4.$.!Boot.Choices.Backdrops.Arcadia 
 
and 
| > Backdrop.!Run 
| List of *Backdrop commands for bootup 
| One is randomly selected on bootup to set a backdrop image 
| Likelyhood is proportional to number of duplicate entries 

| Mode 40 backdrop - 896 or 448 pixels x 640 or 320 or 160 pixels 

Thinking -S 
tcf640x8b -S 
Arcadia -S 
Bunny/spr -T 
Whitby -S 

 
works fine for me. 
J.G.Harston, 19th September 2022, 14:03
I have a similar version on my Windows PC. 

Add a comment (v0.10b) [help?] . . . try the comment feed!
Your name
Your email (optional)
Validation Are you real? Please type 65134 backwards.
Your comment
French flagSpanish flagJapanese flag
Calendar
«   September 2022   »
MonTueWedThuFriSatSun
   2
611
12131416
1921222324
272830  

(Felicity? Marte? Find out!)

Last 5 entries

List all b.log entries

Return to the site index

Geekery

Search

Search Rick's b.log!

PS: Don't try to be clever.
It's a simple substring match.

Etc...

Thank you:
  • Fred
  • Bernard
  • Michael
  • David

Last read at 08:48 on 2022/10/05.

QR code


Valid HTML 4.01 Transitional
Valid CSS
Valid RSS 2.0

 

© 2022 Rick Murray
This web page is licenced for your personal, private, non-commercial use only. No automated processing by advertising systems is permitted.
RIPA notice: No consent is given for interception of page transmission.

 

Have you noticed the watermarks on pictures?
Next entry - 2022/09/18
Return to top of page