Verbosity and the Exploding Brain (1 Viewer)

Thales750

Formerly Jsanders
Local time
Today, 14:44
Joined
Dec 20, 2007
Messages
3,732
I thought it might be fun to compare some of the things we find problematic, or at least annoying, in our interactions with the AIs.

As the title states, sometimes all I want is a simple yes or no, and I am delivered a dissertation. Other times, I question a bit of code and it writes a new procedure, or maybe even an entire module, plus an encyclopedia of explanations.

And I can't tell you how many of these conversation were initiated because the GPT, for no reason other than it embellished some code into a full chaotic symphony resembling a spiraling vortex.

Until all that is left is an undecipherable cacophony.

You look at this code, and your brain says why, why, why, for the love of God does this machine include so much fluff?
And then your brain explodes.
 
Last edited:
As the title states, sometimes all I want is a simple yes or no, and I am delivered a dissertation.

It's a strategy to frustrate you and thereby dissuade you from asking any more annoying questions. We sesquipedalianists know this method well. Whom do you think taught it to the AI during their training sessions?

:ROFLMAO:
 
This is what it wanted us to use:
Code:
Option Compare Database
Option Explicit

Private Function TVW_IsVisibleOnScreen(ByVal n As MSComctlLib.Node) As Boolean
    Dim p As MSComctlLib.Node
    Set p = n.Parent
    Do While Not p Is Nothing
        If p.Expanded = False Then
            TVW_IsVisibleOnScreen = False
            Exit Function
        End If
        Set p = p.Parent
    Loop
    TVW_IsVisibleOnScreen = True
End Function

Private Function TVW_HasVisibleChildren(ByVal tvw As MSComctlLib.TreeView, ByVal n As MSComctlLib.Node) As Boolean
    Dim c As MSComctlLib.Node
    If n.Children = 0 Then Exit Function
    If n.Expanded = False Then Exit Function

    Set c = n.Child
    Do While Not c Is Nothing
        If TVW_IsVisibleOnScreen(c) Then
            TVW_HasVisibleChildren = True
            Exit Function
        End If
        Set c = c.Next
    Loop
End Function

Private Function TVW_IsLeaf(ByVal n As MSComctlLib.Node) As Boolean
    TVW_IsLeaf = (n.Children = 0)
End Function

Private Function TVW_TaskIDFromKey(ByVal sKey As String) As Long
    'Assumes Key like "tTaskID:123"  (adjust if needed)
    TVW_TaskIDFromKey = CLng(Split(sKey, ":")(1))
End Function

Public Sub BuildVisibleTaskPKTable()
    Dim db  As DAO.Database
    Dim n   As MSComctlLib.Node
    Dim tID As Long
    Dim isVis As Boolean

    Set db = CurrentDb
    db.Execute "DELETE FROM tblTmpVisibleTasks", dbFailOnError

    For Each n In Me.tvwTasks.Nodes
        isVis = TVW_IsVisibleOnScreen(n)
        If isVis Then
            tID = TVW_TaskIDFromKey(n.Key)

            '1) All visible nodes (optional but handy)
            db.Execute "INSERT INTO tblTmpVisibleTasks (tTaskID, vCategory) VALUES (" & tID & ",'All')", dbFailOnError

            '2) Branches = nodes with visible subnodes
            If TVW_HasVisibleChildren(Me.tvwTasks, n) Then
                db.Execute "INSERT INTO tblTmpVisibleTasks (tTaskID, vCategory) VALUES (" & tID & ",'Branch')", dbFailOnError
            End If

            '3) Leaves = last nodes (no children)
            If TVW_IsLeaf(n) Then
                db.Execute "INSERT INTO tblTmpVisibleTasks (tTaskID, vCategory) VALUES (" & tID & ",'Leaf')", dbFailOnError
            End If
        End If
    Next n
End Sub

plus some code to call it which was missing the needed loops to run through the TreeView Nodes looking for the right conditions to add to the list.
We regrouped. We went atomic.
Me.
Where is that calling the sub that have the nodes it does not seem to be adding any nodes I think we are going about this the wrong way first what are the states we are trying to list? Single phrase each
GPT
  • All Visible Nodes
  • Visible Branch Nodes
  • Visible Leaf Nodes
  • what are ethe single line of code that returns a single value of each of these
Assuming nd As Node and tv As TreeView:


  • All Visible Nodes
    TVW_IsVisibleOnScreen(nd)
  • Visible Branch Nodes
    TVW_IsVisibleOnScreen(nd) And nd.Expanded And nd.Children > 0
  • Visible Leaf Nodes
    TVW_IsVisibleOnScreen(nd) And nd.Children = 0

That’s it.
So then we went through them and tested one after another and found that we were getting duplication (that was obviously going to happen. and after a couple of tries at solving it with error code (which I hate) I just did a basic group query and appended that to another table.

For a final output that actually worked and was done in 20 mins compared to the previous 2 hours chasing rabbits down their hole only to discover dragons.

This is actually very important, it's easy to slip into lazy mode and end up with a giant centipede attacking you. Smaller bites means way less debugging.
So for anyone interested in creating an indented list that matches your tree here it is .

Code:
Private Sub cmdBuildVisiblePKs_Click()
    Dim db As DAO.Database
    Dim nd As MSComctlLib.Node

    Set db = CurrentDb
    db.Execute "DELETE FROM tblTmpVisibleTasks", dbFailOnError
    db.Execute "DELETE FROM tblTmpVisibleTasksOutput", dbFailOnError

    For Each nd In tvw.TreeView.Nodes
        If TVW_IsVisibleOnScreen(nd) Then
            db.Execute "INSERT INTO tblTmpVisibleTasks (tTaskID) VALUES (" & tvw.getNodePK(nd) & ")", dbFailOnError
        End If
    Next nd
  
    For Each nd In tvw.TreeView.Nodes
        If TVW_IsVisibleOnScreen(nd) And nd.Expanded And nd.Children > 0 Then
            db.Execute "INSERT INTO tblTmpVisibleTasks (tTaskID) VALUES (" & tvw.getNodePK(nd) & ")", dbFailOnError
        End If
    Next nd
  
     For Each nd In tvw.TreeView.Nodes
        If TVW_IsVisibleOnScreen(nd) And nd.Children = 0 Then
            db.Execute "INSERT INTO tblTmpVisibleTasks (tTaskID) VALUES (" & tvw.getNodePK(nd) & ")", dbFailOnError
        End If
    Next nd
  
    strSQL = "INSERT INTO tblTmpVisibleTasksOutput (tTaskID)" & vbCrLf & _
        "SELECT tblTmpVisibleTasks.tTaskID" & vbCrLf & _
        "FROM tblTmpVisibleTasks" & vbCrLf & _
        "GROUP BY tblTmpVisibleTasks.tTaskID;"
    CurrentDb.Execute strSQL, dbFailOnError + dbSeeChanges

End Sub
 

Users who are viewing this thread

Back
Top Bottom