Here’s a quick word splitter routine for CBM BASIC. It takes phrase and “explodes” all words into an array, removing spaces. Feel free to adopt it for your own needs.
10rem word splitter
20rem splitsalongphrase into words ataspace
30input"tell me something";a$
40rem clear current array of words
50fori=0to10: wd$(i)="": next: wd=1
60rem detect spaces
90ifwd$(0)=" "then wd=wd+1: next
120rem print all words
Line 50 clears an array of 10 words called WD$(n). We also setup a word counter called WD. So in this example we can only detect a maximum of ten words. If you need more, you must DIM the array first.
Lines 70 loops through all characters in our phrase. We make use of the first element in our array WD$(0) to store each single character. If it’s a space, we’ll increase the word counter and move on to the next character. If it’s not (line 80), then we’ll add this character to the current word which is stored in WD$(WD).
The rest of the code simply prints each word on a new line to see our handy work.
Have you ever come across the above dialogue, asking if you’d like to “accept incoming network connections” on your Mac? It’s caused by the Firewall and it’s meant to be helpful. Because if you have an app that needs incoming network connections all the time, you can just add them to the Firewall rules (under System Preferences – Security – Firewall).
But of course, it doesn’t always work. Some apps get updated and this message starts appearing out of the blue, no matter if it hasn’t happened before or if you’ve manually added said app to the Firewall rules a thousand times already. God only knows whatever is upsetting our precious operating system, but it’s driving us all nuts.
Help is at hand: turns out these messages are caused by some certificate issue I genuinely do not care to know about – nor should I have to. Here’s a “relatively easy” way to fix it once and for all. There are other ways which involve more typing, or switching off the Firewall altogether, but the following is by far the quickest option in my opinion:
open a Finder window and navigate to the app in question (usually in Applications, potentially in a subfolder)
open a Terminal Session (under Applications – Utilities – Terminal)
type cd followed by a space
from the Finder window, drag the folder in which your app resides into the Terminal window
hit return (this will put you into the same directory as your app)
type the following scary line of code:
Replace “YourApp.app” with the actual name of the app, including the .app extension. You will be prompted for your password and in a few moments you should see a message such as “replacing existing signature”. With this code your Mac will have created a self-signed ad-hoc certificate, re-signing the app.
Don’t worry if this doesn’t sound English, all it means is that we’re telling the operating system (or rather, Keychain Access) that “the Administrator says it’s OK to trust this app”.
Now launch your app again. Don’t be dismayed when you see that annoying “accept incoming connections” dialogue again – it’ll be the last time. Select “allow” and you’re done with this – hopefully for good. Try it out by closing your app and restart it again. Celebrate about not seeing that message again.
Should this trick not work, leave out the –deep switch, and make sure your file does not have a trailing slash. Oh, and preface any spaces in the file name with a backslash.
Kudos to ahall over on Stack Exchange for this tip! It’s made me a much happier person again 🙂