An HTML index of Gambas Classes

Post

Posted
Rating:
#1 (In Topic #270)
Avatar
Regular
Cedron is in the usergroup ‘Regular’
Attachment

So, sometimes as a relative newbie, I have a tough time remembering which component which class is in.  This makes it harder to find in the Wiki.

As part of my FarmDB project, I gathered a lot of the information that is in the Wiki.  Well, long story made short, attached you will find a zip file of an html file that is an index of all the class names in Gambas starting with an ordinary letter.  The link should take you to the correct page in the wiki.

I hope you all find it useful.

Ced

.... and carry a big stick!
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Regular
Cedron is in the usergroup ‘Regular’
Attachment

Here is a version with the virtual classes included as well.

Ced

.... and carry a big stick!
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Regular
stevedee is in the usergroup ‘Regular’

Cedron said

Here is a version with the virtual classes included as well…

My goodness you must have some patience. Many thanks.

Maybe Charlie could add this to the GambasOne home page?
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Regular
Cedron is in the usergroup ‘Regular’
Attachment

Patience?  No, it only takes seconds to run.

First fruits of a long process?  Yes.

Here is the process information flow diagram (programs in parentheses):

Code

/usr/share/Gambas3/info/gb.*
  |
  V
(Scanner)
  |
  V
LoadFiles.tsv                                               (Text Editing)
  |                                                               |
  V                                                               V
(Loader) <-- LoadDB_Vault.SQL      (Text Edit Field Info)   Database Diagram
  |                                         |                     |
  V                                         V                     V
SQLiteDatabase <-- (DB Creator) <-- CreateDB_Vault.SQL <-- (Diagram Parser)
  |
  V
(Reporter) <-- Query_Vault.SQL  <-- (SQLite + Text Editing)
  |         +- Report_Vault.HTM <-- (Text Editing)
  V
HTML Files

Here is the current Database Diagram:

Code

                   pd_vendors     pd_roots                  wk_class_flags
                           0       1                                    0
                           |       |                                    |
                           M       M                                    |
 pd_tags                  pd_projects                    wk_components  |
  1   1                   1  1 0  1 1                     1         1   |
  |   +-------+           |  | |  | +--------+            |         |   |  +---+
  M           M           M  | |  M          M            M         M   M  M   |
 pd_subtags  pd_project_tags | | pd_files   pd_project_components  wk_classes  |
  1                          | |  1   1 1                           1   1  0   |
  |              +-----------+ |  |   | +-----------+          +----+   |  +---+
  M              M             |  |   M             M          M        |
 pd_project_subtags    +-------+  |  cs_routines   cs_class_usage       |
                       |          |   1       1                         |
                       |     +----+   |       |                         |
                       M     |        M       |                         |
           cs_shared_libs    |   cs_lines     |      wk_member_types    |
            1       1        |   1  1 1 1     |                  1      |
            |       |        |   |  | | |     |                  |      |     
            |       M        M   |  | | M     M                  M      M
            |      cs_lib_usage  |  | | cs_calls                wk_members
            |                    |  | |                          1
            |                    |  | +-----+           +--------+
            M                    |  |       M           M
           cs_lib_function       |  |      cs_member_usage      wk_keywords
                   1             |  |                            1
                   |             |  +-------+          +---------+
                   M             M          M          M
                  cs_function_usage        cs_keyword_usage


It's evolved a bit since the last time I posted it.  There are three regions to the database:

wk - Wiki Information

pd - Project Definition

cs - Code Scanner

Currently I have the wk region loaeded, working on the pd, not started on the cs.

When I am done, and the projects/code being scanned are all the projects in the Software Farm, the database will be able to report all sorts of useful information.  This class listing is just the first.  It is a simple query on the wk_classes and wk_components tables.

Code


SELECT wk_classes.name          AS ClassName,
       wk_components.name       AS ComponentName,
       wk_classes.inherits_name AS InheritsName

FROM       wk_classes
INNER JOIN                               wk_components
ON         wk_classes.wk_components_fk = wk_components.id

ORDER BY   ClassName, ComponentName   


Then the program simply brute force scans the resulting list for each letter:

Code (gambas)

  1. '---- Gather the Values
  2.        
  3.         For r = 0 To theClassNames.Max
  4.           If Left(theClassNames[r]) = theLetter Then
  5.              theEntry_Row.Add(r)
  6.           Endif
  7.         Next
  8.  
  9.         For r = 0 To theClassNames.Max
  10.           If Left(theClassNames[r]) = "." Then
  11.              If Mid(theClassNames[r], 2, 1) = theLetter Then
  12.                 theEntry_Row.Add(r)
  13.              Endif
  14.           Endif
  15.         Next
  16.  
  17.         For r = 0 To theClassNames.Max
  18.           If Left(theClassNames[r]) = "_" Then
  19.              If Mid(theClassNames[r], 2, 1) = theLetter Then
  20.                 theEntry_Row.Add(r)
  21.              Endif
  22.           Endif
  23.         Next
  24.  
  25. '---- Find the One third Mark
  26.  
  27.         Dim theThird As Integer
  28.        
  29.         theThird = Int((theEntry_Row.Count + 2) / 3)
  30.  
  31.  

The broader purpose of this whole exercise is to build a web application and a desktop application which will find code examples from the Software Farm indexed by the components/classes.

Imagine that if you clicked on one of those links, not only would you get a list of members (properties,methods,events) of the class, but also a list of all the Software Farm projects which use that class.  Click on a project name and it takes you to a page showing you code excerpts around the class usage.

I have attached the last program in the process for those who are interested in seeing how it works.  The included database is just the wk tables to keep it as small as possible.

So, this is really a matter of perserverence over patience.  The Vault files are like a Settings file that can be mulitple line with replaceable parameters.  The code is a work in progress and I will be formally announcing it soon, but you can see how the first draft works in the attached files.  Since they are text files, you can bring them into the IDE and use them as if they are alternative format source files.

Ced

P.S.  Cogier, et al, I would be delighted if you downloaded this demo, modified the HTML to fit your site style, and posted a copy.

P.P.S.  When you unzip the demo, there is a file called CreateUniqueWiki_Vault.SQL included.  You should open up the FarmDB.sqlite database, paste the contents of the SQL file in the query execute panet and run it.  This will create a set of new derived tables of unique identifiers for the wk tables.

.... and carry a big stick!
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Guru
cogier is in the usergroup ‘Guru’
I have added the page to Gambas.one. You can access it from the front page (Gambas Classes) or here https://www.gambas.one/classes/

<IMG src="http://www.cogier.com/gambas/classes.png"> </IMG>

Can you please advise me how to get the latest copy of the database, better still alter your program to go get it and do the necessary so I can just update the page when a new version of Gambas is out.

Nice work Cedron!
Online now: No Back to the top

Post

Posted
Rating:
#6
Avatar
Regular
Cedron is in the usergroup ‘Regular’
 Thanks Cogier.

I'll be posting all the projects in the system diagram once they are in a presentable state.  I'm also thinking of an umbrella project that will do a full refresh with a single button press.  Currently the process (Delete the database, create it, load it, and do the report) takes about a minute or so.

I do think that you should dress the page up a bit with your site headers, links and such, so it looks like it belongs.  I can modify the report program to match that.

If you want any of the pieces you see ahead of time, send me an email and I will send them to you.

In the meanwhile, if anybody wants to develop a Gambas Application to display the Wiki region of the database and post it here, that would be most welcome.

Ced

P.S.  There is a slight error in the database data in that the inherits_id field in the classes table points at the first class that the name matches to, not the class with the same name in the same component.  I'll be fixing that shortly, but it has no impact on the report.

.... and carry a big stick!
Online now: No Back to the top

Post

Posted
Rating:
#7
Avatar
Guru
cogier is in the usergroup ‘Guru’
 I'll make some changes as we go along, I have already altered the Report_Vault.HTM file. I would still like to know where you get the database from.
Online now: No Back to the top

Post

Posted
Rating:
#8
Avatar
Regular
Cedron is in the usergroup ‘Regular’
Attachment

It's down the left column of the information flow diagram:

Code

/usr/share/Gambas3/info/gb.*
  |
  V
(Scanner)
  |
  V
LoadFiles.tsv
  |
  V
(Loader)
  |
  V
SQLiteDatabase
  |
  V
(Reporter)
  |
  V
HTML Files

I've attached the Scanner program.  It's small and simple.  I had a great deal of help from Tobi on this one.

Ced

.... and carry a big stick!
Online now: No Back to the top

Post

Posted
Rating:
#9
Avatar
Guru
cogier is in the usergroup ‘Guru’

Cedron said

In the meanwhile, if anybody wants to develop a Gambas Application to display the Wiki region of the database and post it here, that would be most welcome.

I have used your code Cedron but altered it to suit me (sorry). I like .csv files rather than .tsv. :o

Have a look at the attached program and let me know what you think. I'll put it on the Farm once I have some feed back.

<IMG src="http://www.cogier.com/gambas/Gambas%20Classes.png"> </IMG>

Attachment
Online now: No Back to the top

Post

Posted
Rating:
#10
Avatar
Regular
Cedron is in the usergroup ‘Regular’
{Replacement: lower case fix, new vault version]

Attachment

That's pretty neat.  I have no objections to you changing things to suit your tastes.

What I was actually looking for is good template code for typical database usage and you bypassed the database entirely.  I'm chuckling.

I will look at your code closer.

In the meanwhile, here is the whole Wiki Scan/Load/Report in one console program.

This one renames the previous version of the database and creates a new one.  Ultimately, it will be a refresh process.

To use:

1) Unzip the attached file

2) Open and run the BatchWiki project

The load files will be in the (TsvFiles) directory.  (TSV are better suited for this task.)

A reader writes.... - Gambas ONE

The Classes list will be in the (HtmlFiles) directory.

The FarmDB,sqlist will hold the Wiki region.

The HTML updates have been applied to the enclosed Report_Vault.HTM file.

Ced

.... and carry a big stick!
Online now: No Back to the top
1 guest and 0 members have just viewed this.