Things to avoid in Xojo

Very good question and point Nathan. DisableBackgroundTasks is something you definitely want to avoid in a web app.

Out of interest, I wonder how long DisableBackgroundTasks has to be used for before other web sessions timeout because I assume that if the Xojo client side is not getting a response from the server for a while it must give up trying or give out a timeout error.

[quote=97716:@Eduardo Gutierrez de Oliveira]This is such a simple workaround to such an expensive routine I’m surprised it’s not officially recommended in the NthField and CountFields guide entries.

NthField and CountFields have the doubtful honor of being ridiculously intuitive (in name and use). They become like crutches you forget how to walk without. When you hit one of the scenarios where they really show their ugly face you’re surprised it took so long to realize.[/quote]

Maybe there should be a feedback request that CountFields and NthField use the same caching behavior that array.ubound uses… ie just return the previous value (if one has been calculated). Any change to the string would clear the calculations. Or would that cause a performance hit on other string functions?

I’d rather just update the documentation. There is no reason to modify the behavior of those functions with such an easy workaround available. I wouldn’t want the engineers to spend their time on it.

Class Window1

Inherits Window

// Window1.upperLimit - computed property:

Protected Property upperLimit As Integer
  Get As Integer
    Static topValue As Integer = 10
    topValue = topValue - 1               <-- The engineer wants some weird alien math here to be iterated
    if topValue<1 then topValue=10
    return topValue
  End Get
End Property

// Window1 Control PushButton1:

Sub Action()
  // “i” will increase while upperLimit will dynamically change! 
  For i As Integer = 1 to upperLimit // <— The engineer expect dynamic reevaluations here, not a cached one
    System.DebugLog Str(i) // i = 1 to 5, for a cached one it would be i = 1 to 9
End Sub

End Class