Changes between Xojo/Same project

In a project, I analyze a master folder contents and build an html description that holds afolder contents description in <table …/… .
As the first line, I place a line.

Now, I wrote an analyzer that build a Table of Contents by searching these and store them (temporarilly) in an array.

When the analuze is done, I insert a brand new <table at a document start (pre-defined location with an <a name=" … too).

With Xojo 2021r2.1 all is clean / clear / works like a charm.

But, Xojo 2024r4.1 and Xojo 2024r4.2, the results is not what the average person imagie a Table of contents can be.

I am a bit lost.

NB: I was very happy when I wrote the analyzer because it tooks me no time. I was a bit less happy to correct all small mistakes there was in my code (yes, you can call that bugs).
But even that late in the night, after some times the code was doing what I was expecting.

In the code I use:

// Where is "master_table" ?
Pos_Actual = TA.Value.InStr("master_table")

// Build table href=#
Do Until TA.Value.InStr(Pos_Actual, Tag_Start) = 0
  // Get the Position of the Issue Name and Number Start Tags
  Pos_Start = TA.Value.InStr(Pos_Actual, Tag_Start)
  
  // Stop here if no more Tag_Start String in the text
  If Pos_Start = 0 Then Exit
  
  // Set the actual Character Position
  Pos_Actual = Pos_Start
  
  // Get the Position of the end tag
  Pos_End = TA.Text.InStr(Pos_Actual, Tag_End)

The question is:
In your experience, what have changed between these two versions to produce (so many) errors

Here’s a screenshot of the html result (same project / different IDE version) done with Firefox.


On the left, result of the 2021r2.1 created file, while on the right, for the same contents, results of the 2024r4.2 IDE.
The “structure” is correct (more or less), while the contents is garbage. I do not even tried to click in a link (before looking at the html code). :frowning:

Is this an API2 issue where string indices changed by 1?

This appears to be completely different data. Please run both versions on the same dataset and report back.

I do ot understand. What different data set ?

For the record:

  1. I use a simple set of data (always the same)
  2. Same project developed with 2021r2.1, checked with the current version from time to time (in this case: 2024r4.2)

With 2021r2.1, my Table of Contents is build correctly and works.
With the current version, it is garbage that I get instead of a Table of Contents.

I will be busy in the next days (as I leave the hospital by tomorrow), so when I will resume operations on this project, maybe some great idea would come.

A single window, single button / and single TextArea is all I have in that project …

I will try to create a brand new project using only the code from the actual one just to see the result. :wink:

Your first result contains “Somaire (11 numeros)”. The second one has “12 numeros”.

and you think this can lead the difference ?

OK. The html that is analyzed is created by my project.
I tested the project on a more than 450 issues (numéros) without troubles. The Table of Contents was generated using Xojo 2021r2.1 and worked fine on that too.

I use a small testing data because I do not want to wait nearly 10 s to get a result (for a 450) when with far less (11 or 12) I get the result in a second or so. And I can test if the links are valid / load the html file in FireFox and check the results / the code if there’s error(s).

But, man, the same project !

I’m just suggesting to reduce the variablity between runs. If the same data produces different output, then that gives us somenthing to work with.

2 Likes

Sadly, the description in the first post is very hard to understand.
Away from whether there is a difference between the two Xojo versions, (which we cannot help with unless we see the actual code, since there is almost none here to work with.)

I do wonder what you are actually doing.
Is this folder a folder full of files?
If so, are you making a table of contents about the files?

If so, I do not understand why you are doing all this searching for start and end tags.
Dont you just create this HTML yourself?

The image on the left and the image on the right do not use the same test data
L’intégrale Tarzan 01 to 11

First thing you need to do is test the same code with the same input.

Then, if there is a difference, check what part of your code could be adding extra <a, </a> or <a>.

1 Like

Master Folder → In my Example “L’intégrale Tarzan”
List of folders in my Example there is 11 folders

Each folder correspond to a Volume. Each vlolume have many stories.

The program search data into these 11 folders, create a description with what it found.
the description starts with <a name="L’intégrale Tarzan followed by a number (1 thru 11) and the </a> closing tag.

The analyzer search each <a name=, takes thename contents and build a <a href="# link. These links are then inserted in a <table …/… <table>, then inserted at the beginning of the description html.

So in a browser, when that file is loaded, the user can navigate thru the issues (Volumes in the example).

Why 11 and 12 ? By error, I created a folder in the Master Folder. That is all. I noticed later and removed it.

The test process is rigourous.

The code was shared two days ago without any answer, but 36 views here.

The variables reset at the end of the loop (before Next) were a test, but change nothing.
I even loaded the html to work with in the TextArea and call only the method “in case” I will learn something: no, same problem.

I can share an html file (the one I have handly have 76 entries and is 139KB without the images, 18,7Mb with the ilages) or we can wait tomorrow for the 11 Volumes test file.

Is it clear now ?

As there is no information on where to paste or how to use that code, it will be hard for someone to spend the time trying to create a sample project to help you.

Can you create a sample project, zip it, and upload it to the forum? That way someone can just run the project in both Xojo versions and try to find the difference. We may need the folder structure to test too. Maybe you can zip something to test too.

Here’s a diagram:


The large folder is the master folder,
Below are 11 folders from where the file (see below) L’intégrale Tarzan.html is created.

I extracted the coe to build the Table of Contents from the original project.

html file to load in the TextArea (named “L’intégrale”):
Nude_data.zip (2.8 MB)

Project to use:
Test_20240129.xojo_binary_project.zip (6.9 KB)

How to do the tests:
Load the file L’intégrale Tarzan.html in a text editor
Copy the whole text,
Paste in the TextArea,
Click in the OK button
In the debugger, click in Entries and look at what is displayed…

I just checked and same bad behavior.

It appears to be struggling with the word “L’intégrale”

If you add the Locale to your IndexOf calls then I think it’s working as you are intending.

Var FrenchLocale As New Locale("fr-FR")

// Where is "master_table" ?
Pos_Actual = TA.Text.IndexOf("master_table", ComparisonOptions.CaseInsensitive, FrenchLocale) // There is one.

Just be sure to add ComparisonOptions.CaseInsensitive, FrenchLocale to the other 3 IndexOf calls as well.

Thank you Jared.

Time to sleep, I will check that tomorrow.

But I have another test folder with around 80 entries, without diacritics / no character value > 126 (ascii). And, this may explain two or three, but there is no mathematical progression in the error… (not the same, the progression is erratic, not cumulative).

Tests will explain.

You are right ! It works.

Now I have to compare the time spend to achieve the task.

For the record, the working line is:


Pos_Start = TA.Text.IndexOf(Pos_Actual, Tag_Start, ComparisonOptions.CaseInsensitive, locale_French)

When I had at the beginning:


Pos_Start = TA.Text.InStr(Pos_Actual, Tag_Start)

I’m happy that it worked!

If you are curious about the debugging thought process, I first put a return in after the text is selected

// Select the Text
TA.SelectionStart = Pos_Start
TA.SelectionLength = Issue_Length - 1 // To not get the ending quote…

return

That shows that Pos_Start is incorrect for some reason

I wasn’t sure why, so I went to the first IndexOf call to see if that was off as well and added a return there to check

// Where is "master_table" ?
Pos_Actual = TA.Text.IndexOf("master_table") // There is one.

TA.SelectionStart = Pos_Actual
TA.SelectionLength = 0

return

Pos_Actual was off there there as well, but by 3 characters

So I deleted everything above that line just as a sanity check and then it was correct

Hmmmm, something is offsetting the index by 3. I don’t deal with diacritics in the US, so I tried deleting one of the words with special characters that appeared before “master_table”, and that moved the cursor one position to the left. Turns out that there are 3 of those words before the target string.

Took a look at the docs and saw that Locale was an optional parameter and must be there for a reason. This looked like French and I’ve seen a lot of your posts Emile, so I figured I’d give that a shot and it worked.

Edit to add: I was curious why “numéros” in that comment didn’t affect anything, but it turns out that it’s actually a differently composed character. There is something with precomposed vs decomposed characters that are represented by different byte sequences, but that’s a whole thing that has been gone into in depth in other threads and resulted in the addition of the Characters and CharacterCount methods being added for strings.

1 Like

In other words: “how to make complex what was simple”…

But, clear explanation. Thank you.

BTW: the -1 is a result of the way Xojo do things: start at 0 or start at 1. Also, I may be a bit fast (faster) using a value (8) instead of compute the length (I think, its early, the night was nearly white).
8+1 line: I compute now the length.

I confirm the master_table misalignment.

But, now, it takes endless time to process a larger number of folders (483). I had enough and Cmd-. I will compare time (2021.r2.1 vs 2024r4.2) later.