Sad day for me

7 years ago when Xojo let me go I decided I need to do something tough to prove to myself that I could still take on challenging things and succeed

So I combined that desire with my love of skiing & joined the Canadian Ski Patrol

Over the years I’ve met a lot of amazing people. I’ve won a bunch of awards – some I am extremely proud of and always will be. And worked on the executive at the local & Zone level

But, one thing that I never managed to do was become an instructor.

Not for lack of desire or trying

I asked several years in a row but the person in charge always refused. Their reasons never made sense to me, and were stated so bluntly that I filed a complaint with the Division.

It made no sense to me to remain a member of an organization where being part of it would continually remind me of my disappointment. And I have told my grand daughter often enough “If something makes you feel bad you do not HAVE to do it”

And so, with much sadness I have resigned from the Ski Patrol

Weird little tidbit

Got asked an interesting question
Can you know, in code, if profiling is or was enabled when the app was built ?

At first I couldn’t think of a way so I said “off the top of my head no”

But a bit more poking about and I came up with

Public Function isprofiling() As boolean
  For i As Integer = 0 To runtime.ObjectCount - 1
    
    Dim s As String = runtime.ObjectClass(i)
    
    If s = "_Profiler.Profile" Then 
      Return True
    End If
    
  Next
  
  return false
  
End Function

And now you can actually tell if profiling was on or not when the app was built and so is available to be enabled or not with the start profiling / stop profiling commands

Wow its been way too long

Working on some neat projects and actually learning C# along with MAUI/Uno/Avalonia UI frameworks.

One of the things I’ve come to really like is the simplicity of serializing and deserializing class instances to /from JSON.

In C# this is a one liner. In Xojo its a pile of work to read the JSON, create an instance & then copy the Json data into the new instance

In C# literally

var item = JsonSerializer.Deserialize<Type>( data ) ;

will take the Json and move the corresponding json keys into the matching properties in a new instance of the type given.
Yeah the notation is a little odd to Xojo users (but Xojo has NO notation for doing this sort of thing)

At the closest it might be

Vendor_Item item = JsonSerializer.Deserialize(content, new Vendor_Item);

That is assuming Xojo had a JsonSerializer that worked like this. While YOU have to make sure you call it right (new whatever) its at least close

But, it doesnt have one like that

However, I have created one (you HAD to know that was coming right ?)

Give it a spin & leave me feedback about it if you would

Xojo and nil arrays

Xojo can return arrays from method calls like

Function foo() as String()

Now what happens if you leave such a function without a return statement ?
Xojo will happily return a NIL array – not one that has no members but one that IS NIL

For instance, if you create the function as

Function foo() as string()
End Function

and then call it later like

dim arr() as string = foo
break

The debugger will show you that arr is NIL; not a valid array with no elements (some Xojo documentation conflates these two things but they are NOT the same)

If your code was

dim arr() as string = foo
arr.append "123"

You will get a NilObjectException (yes internally arrays are objects)

So how DO you check which it is ?

  1. use Is Nil to test if you got a NIL array
  2. use the count property if the array IS NOT NIL
dim arr() as string = foo
if arr is nil then
  // ok now how do I deal with this ?
  // how can I make it so I can add items ?
else if arr.count = 0 then
  // ok we got back an array with no items in it
  // appending items will work !
else 
  // ok we got back an array with items in it !
  // appending items will work !
end if

Notice that if we get back a NIL we cant do much since there is NO array. Trying to append will raise an exception. So what can I do to make it NOT be a nil array ?

At first you might try the Redim function to create an array like

Redim arr(-1)

in API 2 this is arr.ResizeTo like arr.ResizeTo(-1) which will also fail

The right thing to do is use the Array FUNCTION to create one with some elements then resize it to 0 like

arr = Array("")
redim arr(-1)

The resulting code then looks like

dim arr() as string = foo
if arr is nil then
  // ok got a NIL array
  // but thanks to norm we know how to fix this
  arr = Array("")
  redim arr(-1)
else if arr.count = 0 then
  // ok we got back an array with no items in it
  // appending items will work !
else 
  // ok we got back an array with items in it !
  // appending items will work !
end if

// and now here you can append items
// regardless of what the function gave you back 

Have a great day

Whee !!!!!!!

In the last 2 years I’ve taken up golf more seriously than ever before. Like so many others I’ve played an occasional game here and there for many years but there have been very long stretches between where I played none at all.

Two years ago my wife got me a membership at a local course & I decided that in order to make it worth while I had to play at least 20 times. Thats probably more games of golf in one year than I have ever played in total.

But it was a great distraction from work and life in general and a nice activity for the spring, summer, and fall activity in addition to skiing in the winter.

I’ve made a few friends on the golf course and one this year helped me out a lot in improving my game. (Thanks Mike !)

And he felt good enough about my improvements to invite me to be his partner at a tournament at another local course.

We played and I thought we had played well. But both of us had said all weekend that we believed we were just in it for fun and didnt expect to win anything.

AND HOLY CRAP ! We came in first in our group !

Nice surprise to end a fun weekend !

Screen madness

Well I’ve narrowed my issue down to DISPLAY SLEEP

If I set my monitors to NEVER sleep and only run the screen saver than my monitor madness doesnt happen

So something about letting them sleep screws thing sup to the point when I log back in it can take up to 10 minutes for me to get them, back under control

Xattrs

Lord I hate these things

So here’s a little droplet, in AppleScript, to remove them

Yes I thought about writing it in something else
But the AppleScript is 213 K and just about everything else would be quite a bit larger

Some, many megabytes

The ENTIRE text is as follows


-- This droplet processes files dropped onto the applet 
on open these_items
  repeat with i from 1 to the count of these_items
    set this_item to item i of these_items
    set the item_info to info for this_item
    if folder of the item_info is true then
      process_folder(this_item)
    else
      try
        set this_extension to the name extension of item_info
      on error
        set this_extension to ""
      end try
      try
        set this_filetype to the file type of item_info
      on error
        set this_filetype to ""
      end try
      try
        set this_typeID to the type identifier of item_info
      on error
        set this_typeID to ""
      end try
      if (folder of the item_info is false) and (package folder of the item_info is false) and (alias of the item_info is false) then
        process_file(this_item)
      end if
    end if
  end repeat
end open

-- this sub-routine processes folders 
on process_folder(this_folder)
  set these_items to list folder this_folder without invisibles
  repeat with i from 1 to the count of these_items
    set this_item to alias ((this_folder as Unicode text) & (item i of these_items))
    set the item_info to info for this_item
    if folder of the item_info is true then
      process_folder(this_item)
    else
      try
        set this_extension to the name extension of item_info
      on error
        set this_extension to ""
      end try
      try
        set this_filetype to the file type of item_info
      on error
        set this_filetype to ""
      end try
      try
        set this_typeID to the type identifier of item_info
      on error
        set this_typeID to ""
      end try
      if (folder of the item_info is false) and (package folder of the item_info is false) and (alias of the item_info is false) then
        process_file(this_item)
      end if
    end if
  end repeat
end process_folder

-- this sub-routine processes files 
on process_file(this_item)
  -- NOTE that during execution, the variable this_item contains a file reference in alias format to the item passed into this sub-routine
  -- FILE PROCESSING STATEMENTS GO HERE
  set thePathToFile to POSIX path of this_item
  log thePathToFile
  
  set theresult to do shell script "/usr/bin/xattr \"" & thePathToFile & "\"" as text
  --  log theresult
  
  set theParagraphs to paragraphs of theresult
  repeat with i from 1 to length of theParagraphs
    set theCurrentListItem to item i of theParagraphs
    -- Process the current list item
    -- log " line" & (i as text) & " = [" & theCurrentListItem & "]"
    
    do shell script "/usr/bin/xattr -d " & theCurrentListItem & " \"" & thePathToFile & "\""
    
  end repeat
  
end process_file


One year on

When we started 2023 Xojo had
– 2013 open bug reports
– 25516 closed bug reports
– 4203 archived bug reports
– 11.62 average daily # of new reports
and the fist public case # I could find was 71329

As of Jan 1, 2024 there are
– 2280 open bug reports (an increase of 267 – up 13%)
– 26686 closed bug reports (an increase of 1170 – up 4%)
– 4284 archived bug reports (an increase of 81 – up 2%)
– 11.05 average daily # of new reports
and the fist public case # I could find was 75266 (up 3937 – up 5%)

With each release through the year more reports and bugs were filed than fixed meaning Xojo slowly fell further & further behind fixing issues.

C# on the mac

Well there’s a bummer

MS is ceasing development of VS on macOS

Too bad

And some would have you believe that this is the end of C# on macOS.

Not true
Unlike other proprietary tools that have a single IDE & compiler from one company C# has alternatives that can read & write VS projects and compile them on the Mac. It’s open sourced. Heck MS even made Roslyn, their compiler infrastructure open source.

Rider, from the JetBrains folks, works just fine.

Yes its not free like VS was – unfortunate.

But its not exactly expensive either

And if you REALLY want their super duper “do anything in any language we support” package

Still VERY affordable

Will I miss VS ? yeah a bit – but I’m sure I’ll manage to carry on on my mac