I’ve been working with JSON in the new Xojo framework quite a bit lately and wanted the ability to format the JSON text so it is more readable.
A little Internet research turned up a set of classes for .NET (in C#) that can do this. I took a few minutes to port these three classes over to a single Xojo class that can format JSON for you.
Eric Gibbon has been using Xojo to develop bespoke cross-platform applications for Mac and PC and for the web for 15 years. He lives in Stamford, England, and is an active member of the Xojo UK User Group.
There’s an old programmer’s saying: If it works, leave it alone. But sometimes we have to go back to code that works to make it go faster, because it’s too slow.
Over time I have picked up some tips on how to get better performance from Xojo code. I have used these tips to improve old code running on all platforms and have seen big improvements. They are quick and easy to do.
If you work with computers, having backups of your data is essential. This particularly came to light recently with people testing out Apple Music and discovering that it could make a mess of your iTunes library. In fact, this happened to me!
But “luck favors the prepared” and I had backups, so this Apple Music glitch only proved to be an annoyance and not a catastrophe.
In my case, I just restored my iTunes library from my Time Machine backup. But I know far too many people that don’t even have any type of backup system in place. I’m here to help.
Anyone who is developing software, even if they are the only person working on the project, should be using source control (aka as version control). As you can see, this comes up a lot:
The code editor tries to help you see what code groups together. For instance, it draws small lines between matching block beginning statements like IF, SELECT CASE and their closers (END, END IF or END SELCT):
Though increasingly rare, we do still hear from Xojo users who get false positives from their anti-virus software when downloading Xojo or running Xojo applications. We’ve even heard of this occurring when users are debugging apps from the IDE. To get around this, you can refer to the documentation for your anti-virus software on how to exclude Xojo from scans. To fix these issues for yourself and future Xojo users, we ask that you report these occurrences to your anti-virus software makers.
We’ve occasionally heard from Xojo users that their anti-virus software gives them a warning about Xojo. All of these have been false positives and we ask that you report these to your virus software makers if it happens to you.
dim i64 as Int64 = 1234567
dim i32 as int32 = 7654321
i32 = Int32(i64) // cast
i64 = Int64(i32) // cast
i32 = Ctype(i64, Int32) // convert
i64 = Ctype(i32, Int64) // convert
It all seems reasonable enough. Not useful, but seems reasonable. Only one problem. It won’t compile. Why not? The two casts to int32 and int64 will fail. Now why is that?
Operator_Lookup and ParamArray are two language features that have been in Xojo for a while now, but most probably don’t know why they were originally added. The need grew out from having to support COM on Windows.
With Xojo 2015 Release 2, most of the new Xojo framework is available for all project types. This includes Xojo.Net.HTTPSocket, which adds support for HTTP 1.1.
Much of the new Xojo framework is available for all project types staring with Xojo 2015r2. The Data namespace includes two methods for dealing with JSON data: GenerateJSON and ParseJSON. This is how they are used in comparison to JSONItem in the old “Classic” framework.