I just signed up to a Claude.ai Pro subscription to see if their paid model (Opus) is any better than the free model when it comes to acting as a coding / development partner. So far I have to say it’s been pretty good. I used it to brainstorm names for an app I’m thinking about and it even made a bunch of suggestions about how to layout the user interface. I’ve been messing about with database connectivity and wanted to see how well it performed with Xojo code (which GPT doesn’t do very well). I asked it
Give me the Xojo code required to connect to a remote MySQL database on a known IP and query it for all records in a table named “people”. Use API 2.0 (so RowSet instead of RecordSet).
Here’s the code it produced:
Var db As New MySQLCommunityServer
Var rs As RowSet
Try
// Set up the database connection
db.Host = "your_database_host_ip"
db.Port = 3306 // Default MySQL port
db.DatabaseName = "your_database_name"
db.UserName = "your_username"
db.Password = "your_password"
// Connect to the database
db.Connect
If db.Connect Then
// Create a SELECT query
Var sql As String = "SELECT * FROM people"
// Create a prepared statement
Var ps As PreparedSQLStatement = db.Prepare(sql)
// Execute the query and get the result set
rs = ps.SQLSelect
// Iterate through the rows and access the data
While Not rs.AfterLastRow
// Access individual columns using rs.Column("column_name")
// For example:
// Var id As Integer = rs.Column("id").IntegerValue
// Var name As String = rs.Column("name").StringValue
// Move to the next row
rs.MoveToNextRow
Wend
// Close the result set
rs.Close
Else
// Handle connection error
MessageBox("Database connection failed: " + db.ErrorMessage)
End If
Catch e As DatabaseException
// Handle any database-related errors
MessageBox("Database error: " + e.Message)
Finally
// Close the database connection
db.Close
End Try
Is anyone else messing about with LLMs to help them code?
Look at how it connects twice. Once in API 2.0, then again in API 1.0.

1 Like
For Xojo code ChatGPT usually is rather bad. I have had good success with regexes, AppleScripts, Excel formulas and php.
1 Like
The prepare is certainly not required.
I use the paid version of ChatGPT daily to handle mundane tasks in Xojo. For example, it can take a CSV list of field names and “retype” them out with code so that I can copy and paste into a method.
"Take this list of fields and type out the code with this pattern ‘Stream.WriteLine {fieldname]’ ". This is nice if you have 250 fields. Obviously, this can be done in a text editor, too. But I find ChatGPT to be very helpful.
I’ve also done more complicated things. As mentioned, it is not real good at sticking with API2. With a good prompt though, you can get a long way to your goal. Also, I have used it alot for writing PostgreSQL queries and it has absolutely amazed me.
2 Likes
The code it generates is certainly not perfect (honestly neither are the Xojo examples in the docs) but it has been getting me close enough to what I need to be worthwhile.
Brandon’s example is another really good use case. I had a giant list of Unicode code points that I wanted to put into a Dictionary and it was able to parse them into a format I needed.
Claude is by far my preferred AI assistant. Not sure if paying gets you more features, but it does get you priority access and I pay. I use it daily for a wide variety of things including coding, but for coding I usually ask it for high-level algorithmic guidance rather than writing code per se. I also use it frequently for regex search string generation.
You always have to check its work and it’s often wrong on the first or second try, but still very useful to me.
1 Like
even chatgpt 3.5 gives reasonable xojo code.
what I would like to find is a local LLM to use my local documents with…
so far testing privategpt with no luck compiling it…
AI need be fed with known content (lots of content) to get trained. The lack of Xojo content on Git Repos make it a dumb coder. When you get lots of code, and good online manuals, it could learn coding, infer styles, apply techniques learned from other languages, avoid deprecations, etc.
So the answer is no. LLMs can’t get good at Xojo due to lack of content, and specially new content and good content. Lots of content.
I am writing a program for kayak design which involves a lot of math - geometry. I have been using Chat-GPT 4. It does fine if the “problem” is really common and easily described. (area of a triangle given two sides and the included angle). But with more general problems it is distressingly bad. This confused me at first. It provides its results with the typical confidence that characterizes the interface with Chat-GPT. But it is very commonly wrong, sometimes subtly. I have spent hours wrangling with this issue.
But as I have read more, it is commonly acknowledged that LLM’s are bad with math because, of course, they have no fundamental understanding of what is going on.
you can try mathgpt, it’s better at maths (but still not perfect…)
Check this out for running models locally - its really easy to get started:
already tried. nice . the LLM is run locally, but it cannot deal with local documents…
sorry it seems it’s a paid subscription now… it was free when I tried…