Ventura ? !!!!!!!!!!

Holy sh&^%!@&%^TTTTT !!!!!!!!!!!!!!!!!!
Mucking about still with Ventura on an external bootable drive
And set both external monitors to mirror the main, then set them back to extended and ……..

OMG !
it stopped flickering !!!!!!!!!!

So maybe I’ll update now ๐Ÿ˜›

MenuItem and add handler

Just to satisfy the curiosity of a few YES you can use addhandler with MenuItems

I made a post about it

Now would I recommend this style ? In general no.

But I have used it and in some cases its very handy since you may not be altering the menu item just changing the method that gets invoked.

For instance if you have a selection of numbers and want to invoke a “sort” method then you want something that will sort numerically. But if its a selection of non-numeric values then you want to sort in another fashion. Yet the menu item might just say “Sort”; or maybe sort ascending and one for sort descending.
So the handler might be swapped out ahead of time as the selection is made depending on what sort of selection you have. And you can do the proactively instead of after the fact in the menu handler. This might not be that significant in some cases; in others it can be.

Use with care and consideration of the implications of ANY use of addhandler

Ventura – no thanks

I’ve been asked why I still run Catalina on my 2019 16″ MBP

Well the updates in between then, and now ALL suffer from this particular problem. I’ve yet to find a solution.

Yeah – such fun

Appears I’m not alone and external monitors and flickering is a widely experienced issue

UPDATE : Apple released 13.4 and someone said “Hey it fixes the flicker!”

uh … nope

In praise of preferences

I like to have lots of preferences

Things that I CAN tweak to my liking IF I want to

Not that I do in every product I use for writing code. But its nice to have them. For instance in Xcode and VS Mac there are a TON of settings.

And I’ve customized very few. Why ? The defaults are decently chosen so I dont need to read them all understand them all and then set them.

BBEdit, perhaps my favourite text editor of all, is the same way

I _could_ customize the heck out of it but dont NEED to.

Now some might think “well if you never customize them why have them ?”. I said I never do. Thats not to say no one does. If they weren’t ever used or set they probably wouldn’t be there. But someone, somewhere, probably requested such a thing and these developers responded with a preference that lets people customize things to their liking rather than dictating “No you dont really need that do some thing else”

I’d love to have way more choices for things in Xojo as well.

I know users have long desired a settable “indentation spacing” preference. Maybe a way to disable certain annoying dialogs like the one you get now if you quit the IDE when you are running a debug version of your code (Yes I do know what I’m doing thanks now go away – again and again and again … arg !) Perhaps one to make it possible for users to set their own prefix when converting a regular property to a computed one. I like to use m_ but the IDE uses a plain m

And ones that provide additional customization like if I want a toggle button for line numbers which got removed and is now an IDE wide setting not a PER PROJECT one. Probably great if you only work on one project all the time but when you work on different client projects some like it on some like it off.

A quick search in Xojo’s Issues reveals a bunch of requests for such things

If you want to see some ion these come to pass up vote your favourites !

How external methods can make your code platform specific

In Xojo if you use external methods to simplify writing a declare over & the they can make your code platform specific.

How ?

In a method you can wrap the declare in a #if Target so it wont be used on targets its not intended for.

There is NO way to do this for external methods.

So as soon as you use them your code now has a hard dependency on what ever OS api you just exposed. And there is NO way to easily exclude it from being referred to when compiling for other targets. You simply rely in the code using them being excluded by the compiler since its not referenced (you hope)

IF the code using the external method isnt properly wrapped in a #if Target then you can get errors that are hard to track down since the declare wont be right where the error is saying it is. You just get a warning about a library not found.

I ran into this with code called WinAPILibrary

I‘ve forked this library and REMOVED these so anyone can compile the code regardless of the target but it will only function on Windows

The other issue I’ve run into is sometimes you need the same method defined several times because it can take different parameters. This is a bit easier to do, and IMHO, more obvious with several declares where you need thins than maybe several external methods with varying configurations.

My 2 cents FWIW

Antlr 4

Having once upon a time having had to use Lex & Yacc, and their eventual successors Flex & Bison, I’d been more than passingly familiar with writing and debugging grammars.

And all their weirdness like shift reduce conflicts ๐Ÿ˜›

At Xojo I’d looked through the grammar for the language to make sure various editors and parsers were conforming to the grammar especially in places like the method signature editor where you could paste in the whole thing into the method name and it would pull it apart. There were other places where the grammar had to be known to try & do the right thing.

And when a side project came up that required writing a grammar I knew I was capable of writing one using those tools; but really didnt want to use them as they have some weirdnesses and they only turned out C++ code, maybe Java too. But if you wanted some other language that wasnt an option.

Enter ANTLR !

One of the things I really like about it is not only can you read the grammar very easily, it has some handy test modes like showing you a visual parse tree, dumping all the tokens, a tree of all the tokens and piles of other nice debug info to help you write a better grammar and therefor a better parser.

For instance, originally I had a rule for reading a Xojo DIM statement. And it was much like

// Declare any number of variables/arrays of varying types.
dimStatement
    : (DIM | VAR) (arrayDecl | IDENTIFIER | ME) (',' (arrayDecl | IDENTIFIER | ME))* AS NEW? fqName('(' arguments ')')? (EQUALS expr)?
      (',' ((arrayDecl | IDENTIFIER | ME) (',' (arrayDecl | IDENTIFIER | ME))* AS NEW? fqName ('(' arguments ')')? ) (EQUALS expr)? )* comment? #DeclareVariables
    ;

quite a beast to read but it permitted any sort of single line dim statement to be parsed

HOWEVER, it had real issues when it came to trying to deal with it in code. Why ? well in antler the code would have lists of possible arraydecl objects, identifier objects, fqnames for the type and none of them were easily associated with each other. So it makes it hard to know what arrays were defined as what type, what identifiers were defined as what types & so on.

What do I mean by that ? Given code like

dim k() , I as integer, s() as string, b, bb() as boolean

I’d get

array decls : k, s, b
identifiers : I, b
fqnames : integer, string, boolean

Very hard to tell which array and indents are integers, which are strings and which are booleans

Now this looks like

// Declare any number of variables/arrays of varying types.
dimStatement
    : (DIM | VAR) declClause ( ',' declClause)* comment? 
    ;

declClause :
	(arrayDecl | simplevarDecl ) (',' (arrayDecl | simplevarDecl))* AS NEW? fqName('(' arguments ')')? (EQUALS expr)?
	;

arrayDecl
    : simplevarDecl '(' ( MINUS? number (',' MINUS? number)* )? ')'
    ;

simplevarDecl 
	: (IDENTIFIER | ME) ;

And parsing that same code I now get and array of decl clauses like

decl clause
     array decls : k
     identifiers : I
     fqname : integer
decl clause
     array decls :
     identifiers : s
     fqname : string
decl clause
     array decls : bb
     identifiers : b
     fqname : boolean

and this is much easier to sort out and way easier to handle in code

As I work more on this project I’ll have to keep an eye out for these sorts of things

Antlr makes some of this super easy to deal with

Now I need to find other books on designing grammars for ANTLR 4 to see what else I might be missing out on

How I spent last weekend

Recently I visited a client in Germany
And we worked hard for the 2 weeks I was there

But while I was there I took advantage of the fact I’d be there over a weekend and went to Austria to ski at an enormous resort that had not yet closed – Ischgl.

Driving there I had feelings of dread as all the lower parts of hills like Garmisch-Partenkirchen were closed and obviously very green – but there was snow high up.

So I kept on driving – it was about 2.5 hours from where I was in Germany to Ischgl

As I finally got to the town I saw a LOT of green and my hopes sort of sunk

But again there was snow high up and there were lots of people putting on ski boots & heading across to the gondola. So I got on my gear and headed the same way the crowd was heading.

And am I glad I did. I quickly rented gear and got a ticket and headed up the gondola

Take note – that board isnt listing all the runs that are open. The upper left is all the lifts that are open. There are 42 lifts up there and most were open. The gondola I took up is marked A on that map and there are 2 others that start right in the town itself.


And if you look closely you can see there are several mountains ridges & areas that are possible to ski. Most are labelled – B, M, N, C, L and E

B is the area that the gondola I took initially places you at. And this area is about the same size as the village area of Sunshine village. So I quickly hopped on a chair and rode it up to take a quick spin down.

For the entire day I tried quite hard to not ride the same lift more than once. Although sometimes I had no choice. And I skied and skied and skied. I finally grabbed some lunch from an amazing cafeteria – VERY nice chefs on staff and excellent food ! It was such a nice day I decided to sit on the deck & scope out where I would head for the afternoon (yes thats a lift way off in the distance on that ridge)

I skied and skied and I dont think I got to even half of the lifts before I finally called it a day.

And, after skiing all day, I drove the 2.5 hours back to Germany

Truly had an amazing memorable day

Nice week

Last week Trish & I went to Cancun
We’d planned this sometime ago and we had a really nice week

Visited Isla Mujeres, Chichen Itzรก, and went snorkelling a couple times

On the ride over to Isla Mujeres we sat near this gent from Goa India who was on board without his girlfriend (she was sick that day)
We struck up a conversation and it turns out he’s in the same line of work I am
And we had a great visit for about 2 hours
I’m sure Trish was bored as heck as we talked nothing but tech & geek topics the entire time

And when we finally departed the boat we both made a deliberate & concerted effort to find the other & thanked each other for what turned out to be a great conversation which made the trip even nicer

It made nice day even nicer to meet someone as passionate about the things we talked about

And then the last evening we were there we sat with another resident of the condominium and her daughter.

At first the daughter wasnt very engaged in any of the conversations. Then her mom asked about what the heck was going on in Tennessee and the Tennessee three & I explained what that was and what had occurred.

Her daughter then joined in and became quite animated and engaged and we sat & talked politics for a couple hours. She was extremely well spoken and knowledgeable.

And her mom just sat and you could see her smiling as we talked.

And we covered a lot of topics from politics to health care to Canada’s governmental systems and a lot in between.

Eventually it grew late and the young lady departed

At that point her mom leaned over to me and said “Thank you VERY much for finding my daughter in there”

She said that her daughter had, through covid, become quite withdrawn and disengaged and that this was perhaps the most conversation she had engaged in in the last 3 years. Mom was almost in tears as she said her daughter had come out of the shell she built up through covid & all the lockdowns and isolation.

I have to admit that I felt really glad to have “helped” but it was so easy. I just talked to her daughter and we had a great chat. It was thoroughly enjoyable especially to see an under 20 person so knowledgeable and engaged in politics and so much else going on in the USA.

Oh yeah. Cancun was fun too !

Water + Horse โ‰  Horse drinking water

The saying is of course “You can lead a horse to water but you cannot are it drink”

And that applies in many contexts
You can show a person a solution to a problem but they’ll still refuse it – for whatever reason they have.

Sometimes the real saying that should be applied is “You can only help someone if they want help”

Again, despite seeming to ask for it, when they get an offer of help that isnt EXACTLY what they wanted they’ll refuse the help.

Then what do you do bug shrug and say “I tried”