Jump to content
TNG Community

Search for Connections Mod


theKiwi

Recommended Posts

@mjaro I discovered this Mod this evening

https://tng.lythgoes.net/wiki/index.php?title=Search_for_connections

and have installed it on my testing site - but it doesn't work - I get this display, even when trying to find connections between my grandfather and my Dad

image.png

with the spinner just spinning without stopping. This is the URL - seems like not all parameters are filled - should they be?

[Website Example URL Removed as Website is Defunct]

Even with all other Mods uninstalled.

Any suggestions?

Roger

Edited by theKiwi
[Website Example URL Removed as Website is Defunct]
Link to comment
Share on other sites

  • Replies 598
  • Created
  • Last Reply

Top Posters In This Topic

  • mjaro

    210

  • tngrlkrz

    117

  • Ken Roy

    91

  • theKiwi

    54

Top Posters In This Topic

Posted Images

Not an answer to Roger's question but it the mod name is NextPaths then the TNG Wiki article name should be NextPaths or the mod should be changed to use

%name:Search for connections%

to match the TNG Wiki article name as recommended in the Mod Guidelines

It is difficult to find mods in the Mod Manager list if the guidelines are not followed when one has over 150 mods in the list :)

The mod should also have the

%wikipage:Search_for_connections%

directive (note the use of underscores here needed for the Mod Manager to generates the link to TNG Wiki mod article .   

Link to comment
Share on other sites

Roger,

Not sure why the mod did not work for you.  It appears to work fine on my WampServer localhost.

It is an interesting mod the shows several interrelationships in my French-Canadian and Acadian lines.  Probably not some thing I would deploy on my production site for the same reason I do not install the other relationship mods. 

If the mod, had an option to display only the shortest path, I might consider installing on my production site.  Searching for Dad and his father, I get

Path 1 found in 1. search step (path length = 1 incl. 0 marriages)

Claude M Roy --his father Maxime Roy

Path 2 found in 4. search step (path length = 5 incl. 2 marriages)

Claude M Roy --his wife Marie Therese Nadeau --her husband Wilbrod Morneault --his mother Catherine Roy --her father Jean Baptiste Roy --his son Maxime Roy

Path 3 found in 26. search step (path length = 9 incl. 1 marriages)

Claude M Roy --his wife Marie Therese Nadeau --her mother Mamie Mabel Soucy --her mother Celina Pelletier --her father Damase Pelletier --his mother Marie Violette --her father Augustin Violette --his daughter Scolastique Violette --her daughter Rose Malvina Martin --her son Maxime Roy

etc.

the mod does not appear to display the default images if one is using the old naming standard of treeID.personID.jpg

the mod also appears to display default gender icons even though the Admin > Setup > General Settings > Media section has Use default thumbnails:  set to NO

Link to comment
Share on other sites

I have suggested to Michal that perhaps an option to suppress the textual path statements and only display the graphical might be beneficial.  Much easier (for me) to see and follow the graphical presentation and I would rarely read the text which is redundant.  

Link to comment
Share on other sites

Roger,

So far I have not been able to reproduce this error... Please give me some more time for experiments.

Sorry,

Michal

Link to comment
Share on other sites

Ken, I corrected Wiki article and zip according to your directives. (I created an article and mod for the first time and that's probably why I missed the rules.) I hope is OK now.

Thank you for pointing out the errors. Michał

Link to comment
Share on other sites

Michal,

I have corrected the TNG Wiki article to use

[[Media:Search for connections.zip|Search for connections.zip]]

instead of [[File: so that the MediaWiki software will launch a Save As dialog for the users to download your mod.

Link to comment
Share on other sites

Roger and Ken,

I'll work now on the options you suggest.

For displaying persons' thumbnails I use the standard TNG functions. I have to see and understand if there are different TNG libraries that contain better functions for that. (if you use other functions which deal better with the old naming standard  -please suggest. If there is a way of knowing the naming standard in TNG settings, I could use it to have a proper code for thumbnails.)

Ken, referring to your sample paths, this is the very essence of my program to allow you to discover that "the father of Claude is a blood-relative of the other husband of his wife". But if you perfectly remember all such family relationships, the mod is just not for you. (BTW in the Wiki article I added a short tip how to see the shortest path only. There will be such an option in the next mod version).

Thank you for suggestions!

Michał

Link to comment
Share on other sites

2 hours ago, mjaro said:

Roger,

So far I have not been able to reproduce this error... Please give me some more time for experiments.

Sorry,

Michal

Do you think it's dependent on PHP version? My server is still running PHP 5.6.36 - I know it's hopelessly out of date, but as far as I know it all works for TNG 13.0.2 correctly.

I do plan someday to stop hosting my own sites here at home and move them to some accounts with SimplyHosting.net, but that won't happen any time soon I don't think.

Roger

Link to comment
Share on other sites

Ken, thanks for the Wiki correction - does it mean the the article is OK and the mod announcement will appear in the "Category:Mods for TNG v13" page? Should I do something?

Link to comment
Share on other sites

1 hour ago, mjaro said:

Ken, thanks for the Wiki correction - does it mean the the article is OK and the mod announcement will appear in the "Category:Mods for TNG v13" page? Should I do something?

Michal,

Updating the wiki categories at the bottom of the article automatically placed a link to the mod article on the Mods for TNG v13 page.

Link to comment
Share on other sites

I have spent some time with it this morning, and gone over the file db2graph.php. By uncommenting some of your debugging lines I can get this output from it, so it seems like it's making it all the way through db2graph.php, but is still failing to display anything..

image.png

So where should I look next?

Roger

Link to comment
Share on other sites

Roger, let me try switching my site to older PHP version. I've never checked this as since the beginning of my programming career (1 year) I've always been using v7.4. I hope it will be reversible ;) 

Link to comment
Share on other sites

Yes, switching PHP to 5.6 gives the effect you encounter.

Luckily, switching back to 7.4 was successful and the mod seems working again.

Now I'll try checking what differences could be the reason, and maybe a workaround is possible.

Link to comment
Share on other sites

Thanks, Ron!

Can I replace "Update" with "New"?  As it is the first version published. (BTW I did the same editing yesterday but it disappeared probably because the incosistencies Ken pointed out...)

Link to comment
Share on other sites

33 minutes ago, mjaro said:

Thanks, Ron!

Can I replace "Update" with "New"?  As it is the first version published. (BTW I did the same editing yesterday but it disappeared probably because the incosistencies Ken pointed out...)

OOPS,  my bad...did a copy/paste of another entry but missed that.

Link to comment
Share on other sites

1 hour ago, mjaro said:

Yes, switching PHP to 5.6 gives the effect you encounter.

 Luckily, switching back to 7.4 was successful and the mod seems working again.

 Now I'll try checking what differences could be the reason, and maybe a workaround is possible.

OK thanks - further testing here has revealed it fails somewhere early on after the Yen-BFS.php file is included.

I'll look at upgrading my server to PHP 7.x if you can't quickly see what is wrong and find a work-around.

Roger

Link to comment
Share on other sites

10 hours ago, theKiwi said:

OK thanks - further testing here has revealed it fails somewhere early on after the Yen-BFS.php file is included.

I'll look at upgrading my server to PHP 7.x if you can't quickly see what is wrong and find a work-around.

Upgrading the PHP on my server turns out to be NOT a quick fix - to get past PHP 5.6 I need to upgrade the Mac OS X operating system on it - it's about 7 or 8 years old, and PHP 5.6 is the highest that the installer packages for PHP will support on Mac OS X 10.8

So I've found the problem area of the code in the code in the Yen-BFS.php (by calling that file directly, not as an include) - it doesn't like this construct

function constructRelString(array $path, array $graph): string {
    $sentence=$gender = '';
    for ($person=1; $person<sizeof($path); $person++):
        $sentence .= $graph[$path[$person-1]][$path[$person]];
        $gender .= $graph[$path[$person-1]][$path[$person]];
    endfor;
    return $sentence;
}

specifically the error message is pointing to the 1st line

function constructRelString(array $path, array $graph): string {

 

image.png

So I don't know if there's a way to rewrite that to be PHP 5.6 compatible? What is the purpose and meaning of the "string" after the : in that function?

There are other instances too through that Yen-BFS.php file that would need to be corrected too.

Roger

 

Link to comment
Share on other sites

4 hours ago, theKiwi said:

Upgrading the PHP on my server turns out to be NOT a quick fix - to get past PHP 5.6 I need to upgrade the Mac OS X operating system on it - it's about 7 or 8 years old, and PHP 5.6 is the highest that the installer packages for PHP will support on Mac OS X 10.8

So I've found the problem area of the code in the code in the Yen-BFS.php (by calling that file directly, not as an include) - it doesn't like this construct

specifically the error message is pointing to the 1st line


function constructRelString(array $path, array $graph): string {

 

image.png

So I don't know if there's a way to rewrite that to be PHP 5.6 compatible? What is the purpose and meaning of the "string" after the : in that function?

There are other instances too through that Yen-BFS.php file that would need to be corrected too.

Roger

 

Roger, you have probably found the reason of the problem. The solution is simple: just delete  ": string" which is type declaration of returned value. This not necessary and maybe is forbidden in 5.6. The line should be then:

function constructRelString(array $path, array $graph) {

Then it works well in the PHP 7 as well.

Michał

Link to comment
Share on other sites

Roger, I've found anoother place that the code is also incompatible with PHP 5.6. 

(I "discovered" a possibility of checking compatibility)

Now Yen-BFS.php should work under PHP 5.6 (and 7.4 as well)

Yen-BFS.php

Link to comment
Share on other sites

On 2/12/2021 at 4:22 AM, mjaro said:

Roger, I've found anoother place that the code is also incompatible with PHP 5.6. 

 (I "discovered" a possibility of checking compatibility)

 Now Yen-BFS.php should work under PHP 5.6 (and 7.4 as well)

Thanks - that fixed it - the second instance was what I referred to as "other instances". Now it works.

But it does fail still when wrapped for WordPress by the TNG-WordPress plugin...

OK - an hour later I've found this problem in the file Yen-BFS.php - lines 11 and 44 are

 * @global $visited - list of visited nodes (distance, prev node, relationship of the prev)

as part of a string of commented code, but the TNG-WordPress plugin sees the "global" and decides that the rest of that line is the name of a variable (this is part of a function that scans ALL the files in the TNG directory looking for global variables).

$visited - list of visited nodes (distance, prev node, relationship of the prev)

which has a - in it and so causes the plugin to abort with an error about found - but expected ; or } etc

So I've removed lines 11 and 44 from Yen-BFS.php and now it works with the TNG-WordPress-plugin too.

[Website Example URL Removed as Website is Defunct]

Roger

Link to comment
Share on other sites

1 hour ago, theKiwi said:

and now it works with the TNG-WordPress-plugin too.

Roger,

it is wonderful that you have been so inquisitive and that you have not only detected but also found solutions to these problems! The solution for Wordpress plugin is very important as many TNG sites run with the Wordpress.

Ironically, both kinds of the problems are because - as a novice programmer learning PHP 7 - I coded very carefully according to the patterns I read... (the problematic ": string" was return type declaration, another was parameter scalar type declaration - both introduced in PHP 7; the part containing global is a recommended comment explaining function definitions). 

I'm going to include those corrections to the coming update of the mod.

Thank you very much!

Michał

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...