In this article I want to introduce you the new functionalities from the MBS Xojo Plugins in version 21.3.
OCR
I want to start with the new classes for OCR. With the TessEngineMBS class we can now use the newer Tesseract 4.x and 5.x versions. With the method Initialize we initialize tesseract. In the parameters we set the path to the tesseract library and the language we want to detect. With the shared method LibraryLoaded we then can test whether the library was initialized.
In the class we find some methods that allow us to recognize text.
The other new classes from this section will also help you with this. With the new version you can recognize multiple languages in the same text and pass a picture directly to the engine.
Dim OCR As new TessEngineMBS // your instance of tesseract
If Not ocr.Initialize("C:\Program Files\Tesseract-OCR\tessdata", "eng") Then
MsgBox "failed to initialize"
Quit
End If
Dim f As FolderItem = SpecialFolder.Desktop.Child("test.jpg")
Dim p As Picture = f.OpenAsPicture
OCR.SetImage(p)
// get the text
Dim OCRText As String = OCR.GetText
(more)
You downloaded Xojo 2021r2 and looked into what is new and you may have found the binary enum. If you wonder what this is, let me give you a short explanation. Normal enums give names to integer values, so you can pass a name instead of knowing the value. Binary enums now are defined to give every bit in an integer a name, so you can toggle bits easily and store flags in the enum. For more details, check the Xojo blog.
Let's define a binary enum like this:
Module Module1
Enum Fruits
Apple
Orange
Grape
End Enum
End Module
Mark the checkbox for binary. Implicitly the first one gets a value of 1 for Apple, Orange is 2 and Grape 4. You can use custom values like AppleWithOrange = 3. We can use the enum now and benefit from OR operator and the built-in Contains functions:
Private Sub test()
Dim t As Fruits
t = Fruits.Apple Or Fruits.Grape
Dim n As Integer = t
If t.Contains(Fruits.Orange) Then
Break
End If
If t.Contains(Fruits.Grape) Then
Break
End If
Break
End Sub
If you run this, you will see it stops at second break inside the test for Fruits.Grape. The variable n has the value 5.
(more)
We include the new ChartDirector 7 library for some time as the C++ version was available earlier. But now we got notice that ChartDirector 7 is released for all languages including C++, .NET, Java, ASP/COM/VB, PHP, Perl and Python.
Advanced Software Engineering is pleased to announce the immediate availability of ChartDirector 7.0.
ChartDirector 7.0 introduces 3 new chart types:
- Treemap Chart: It visualizes a hierarchical structure by partitioning a rectangle into smaller rectangles recursively.
- Discrete Heat Map: It consists of cells which are colored based on their data values. Its continuous counterpart is the contour chart.
- Circular Bar Meter: It is similar to a bar meter, but with the bar bended into a circle. The bar can be segmented to enhance visualization.
For the user interface, ChartDirector Chart Viewers now have built-in high DPI support, and tooltips can be formatted with CDML (ChartDirector Mark Up Language).
The C++ and .NET editions of ChartDirector includes a Data Accelerator object, which allows real-time charts with up to a billion data points with full user interaction support.
In addition to charts, ChartDirector can now generate complete PDF reports, with charts, text, tables, images and other graphics.
Other notable features include cross section for contour charts, contour labels, 4D surface charts, surface projections and surface texture mapping.
More details can be found in the ChartDirector 7.0 release notes.
For Xojo we do the port and offer our
MBS Xojo ChartDirector Plugin, which is offered in the
OmegaBundle currently.
See also
ChartDirector 7 preview,
RealTimeViewPort in ChartDirectory and
Heatmaps with the Monkeybread ChartDirector Plugin
The latest Xojo release arrived this morning and you may be impressed by the number of bug fixes. The Xojo community complained the last year about quality problems in Xojo frameworks and the rush to market for Web 2. Some API 2 related changes and the confusion was perfect.
And yes, Xojo Inc. listened. They scheduled more time to fix bugs and refine the framework classes. Several of the bigger projects in work (see
roadmap) got pushed back. And a lot of work went into fixing issues related to version tracking. The IDE should now better track what changed and write it to disk. This should avoid repeated changes showing up in version tracking.
For each project, you may do a one time cleanup. Make a new IDE script, put in the command DirtyAllProjectItems and run it. Then save the project and commit the changes to version tracking. From that point on you should no longer see properties switching between e.g. "true" and true, like sometimes having quotes and sometimes not.
On the bugs fixed, well it includes feedback case
64456 - JSONItem ToString leaks memory, which I reported there after looking for leaks in the web project. Also I am happy for the String.Compare leak got fixed.
The list of changes includes a couple of new things, but most of them may also be handled as bug fixes. At least for the macOS universal builds steps I would count it as bug that the post scripts run twice, which is now changed to run once.
On new things added, we got some new PDF methods in Xojo including iOS support. But we sill recommend everyone to try
MBS Xojo DynaPDF Plugin instead, which is currently available with
OmegaBundle. The binary option for enumeration lets you do flags, where each value has a different bit in the integer value. The Xojo Cloud servers can now send iOS push notifications to Apple's servers and then deliver them to your iOS application.
In introduction of a bug fix release like Apple did with Snow Leopard for macOS is a great idea. With over 200 fixes (including fixes labeled as changes), this is a huge improvement for the Xojo community. Maybe Xojo Inc. could do that every year like a summer release for bug fixes and do bigger new features into spring and fall releases. Like Linux for example switches between bug fix and new feature release.
MBS Xojo Plugins in current versions should work just fine.
If you use a Worker in Xojo to run code on multiple cores, you basically get a helper console application to do the work. Workers are launched in Xojo as needed to process whatever jobs you provide. Since workers have no open or started event, you can't easily put the registration code there (see feedback case 62409). But you can use static keyword to get a globally stored, but locally defined boolean to check status:
EventHandler Function JobRun(jobData As String) As String
Static registered As Boolean = False
If Not registered Then
If Not RegisterMBSPlugin("License Name", "MBS Complete", 202108, "xxx") Then
System.DebugLog "MBS Plugin serial not valid?"
Else
registered = true
End If
End If
As you see we can check registered flag to only register the first time. All first time work like initialization of plugin, opening a database connection or similar can be done there.
To have code cleanup when the helper quits you can put in a property referencing a class and put cleanup in destructor there. e.g. you can have a tempFile class, with a property for the FolderItem and delete the file in the destructor.
Stefanie wrote an excellent blog post about ChartDirector and the new heat map charts for the official
Xojo blog:
Heatmaps with the Monkeybread ChartDirector Plugin
Also the extras section in the
Xojo Store got updated and you can now easier than ever order your Xojo license update with a
license of MBS Plugins.
From time to time we get bug reports about some variation of library not loading. There are various reasons and I collected a few problems loading MySQL (or MariaDB) client libraries here.
First the error when no library is set:
libmysqlclient.dylib.21: dlopen(libmysqlclient.dylib.21, 1): image not found
libmysqlclient_r.dylib: dlopen(libmysqlclient_r.dylib, 1): image not found
libmysqlclient_r.15.dylib: dlopen(libmysqlclient_r.15.dylib, 1): image not found
libmysqlclient_r.16.dylib: dlopen(libmysqlclient_r.16.dylib, 1): image not found
libmysqlclient_r.18.dylib: dlopen(libmysqlclient_r.18.dylib, 1): image not found
libmysqlclient.dylib: dlopen(libmysqlclient.dylib, 1): image not found
libmariadb.dylib.3: dlopen(libmariadb.dylib.3, 1): image not found
libmariadb.dylib.2: dlopen(libmariadb.dylib.2, 1): image not found
libmariadb.dylib: dlopen(libmariadb.dylib, 1): image not found
(more)
Nickenich, Germany - (July 12th, 2021) -- MonkeyBread Software today is pleased to announce MBS Xojo Plugins 21.3 for macOS, Linux and Windows, the latest update to their product that is easily the most powerful plugin collection currently available for Xojo. MBS Xojo Plugins have been updated and now includes over 2800 classes and 73,000 documented features, and the versatile plugins have gained more new functions:
With this release we integrate zbar as an option for barcode detection. If you have a picture of a barcode to detect, you can try zxing classes. Or you load the zbar library with ZBarMBS.LoadLibrary function and then try the new Scan function in ZBarMBS class. Supported barcodes in zbar includes EAN-13/UPC-A, UPC-E, EAN-8, Code 128, Code 39, Interleaved 2 of 5 and QR Code.
For years we have OCR functions using tesseract 3.02 and that library got dated. We now allow you to opt-in to use LoadLibrary method in TessEngineMBS class and load the current version 4.1 of tesseract and benefit from the enhancements in the library. With the new version you can recognize with multiple languages in the same text and pass a picture directly to the engine.
For our CURLSMBS class we added a support for pre-signed URLs. You can use our examples for Amazon S3 to upload files and then generate time limited URLs to access those files with AWSPresignURL method and load them in a HTMLViewer. The CAInfo file can now be passed from a container.
For macOS we added support for more barcodes in VNDetectBarcodesRequestMBS class, a new isMonterey function for SystemInformationMBS to detect the upcoming macOS version. And isLowPowerModeEnabled property in NSProcessInfoMBS lets you detect low power mode. Our MapKit integration got new classes for multi polygons and polylines. The NSCollectionViewControlMBS control got new features for sections and drag & drop.
On Windows when you use Chromium for HTMLViewer, we can now use cross origin white list to allow JavaScript to perform across origins.
Check the new StringCodePointsMBS function and the StringHandleMBS improvements for faster string handling. Our LGLMBS class got multithreaded functions and a separate exception class.
Finally we updated curl library to version 7.77.0, DynaPDF to 4.0.54.148, openssl library to 1.1.1k, SQLite to 3.36.0 and Xcode to version 12.5.1.
See release notes for a complete list of changes.
New in this prerelease of the 21.3 plugins:
- Added UInt32Value, UInt8Value and UInt16Value to StringHandleMBS class.
- Added Clear method to StringHandleMBS class.
- Added StringCodePointsMBS function.
- Added option to pass array and start position to FindByte function in StringHandleMBS class.
- Changed JavaVMMBS constructor to not to try to load JavaVM.framework, which results in a crash on Big Sur.
- Changed CURL to fail if your URL does not contain a protocol specification.
Download:
monkeybreadsoftware.com/xojo/download/plugin/Prerelease/ or
from Dropbox.
Or ask us to be added to our shared Dropbox folder.
Sometimes you have to loop over characters in a string in Xojo. Whether you count something, search for patterns or you want to replace some characters, the reasons are divers, but performance may matter.
Let's try four different ways and report how much time is needed for each function.
My test file is about 300,000 characters big, stored as UTF-8 and contains various German umlauts, so we have a couple of two byte characters. All tests are made with DisableBackgroundTasks pragma set to reduce background activity. For the timing we run each block 10 times to get an average duration.
(more)
New in this prerelease of the 21.3 plugins:
- Updated Xcode to version 12.5.1.
- Added LGLAbortedExceptionMBS class.
- Added ParseFileMT, ParsePathMT and ParseStringMT for LGLMBS class for better threading.
Download:
monkeybreadsoftware.com/xojo/download/plugin/Prerelease/
Have you considered trying our MBS Xojo DynaPDF Plugin?
With OmegaBundle you get the Starter license included and it includes all this features:
- Available for macOS, iOS, Linux and Windows.
- Use color spaces like DeviceGray, DeviceRGB, DeviceCMYK
- Create and edit JavaScript Functions / JavaScript Actions
- Creation of tagged PDF files
- Create, modify, delete annotations (30+ types)
- Add actions to annotations like JavaScript, GoToR and GoTo.
- Custom page templates
- File attachments and file attachment annotations
- Font subsetting
- Full access to content streams
- JPEG 2000 compression for images and JBIG2 compression for 1 bit images
- More than 60 code pages, incl. 17 CJK character sets and Unicode
- Named Destinations
- Native PDF Transparency for Images (Alpha channels)
- No differentiation between client and server application
- Royalty free distribution
- Support for multi-page TIFF's
- Tables for your layout and with page breaks
- Text formatting, multi-column text
- Vector graphics, line dash patterns, shadings, patterns
- Web links, file links, page links and bookmarks
(more)
The July/August (19.4) issue of
xDev Magazine is now available. Here's a quick preview of what's inside:
The Need for Speed by Markus Winter
Have you ever wondered which of two algorithms was faster? Sometimes there's a need to measure speed that's simpler than Xojo's built-in profiler—Markus demonstrates his method.
xDev Tools by Marc Zeedar
Here at xDev Magazine we use a lot of Xojo-created tools to get our work done. Marc thought it would be interesting to show you some of the programs he's written to automate his publishing production.
Maps, Part 10 by Markus Winter
Last issue Markus set up his plans for mapping GPS data. This time he shows how that works so you can now take data from a device like a Garmin and plot the route on a map within Xojo using MapKit and the MBS Plugins.
Exploring Cryptography, Part 2 by Eugene Dakin
In his series on cryptography, Eugene explores something called the MonoAlphabetic Substitution Cipher. Yeah, say that three times fast. Perhaps it would be easier to just read his article!
Plus: GoalMonitor, event definitions, Zip archives, databases, programming careers, accessibility, and much more!