Comparing JavaScriptEngineMBS to XojoScript

Let's compare a bit XojoScript built-in to Xojo to JavaScriptEngineMBS class in MBS Xojo Tools Plugin. What are differences and benefits for both?

XojoScript is the scripting engine provided by Xojo and is heavily used in Xojo for IDE scripting. You can use it in your projects, compile code at runtime with a reduced Xojo language and the run it. With context object you can provide your own methods and properties and use them in the scripts. While you can precompile and then run several times, there is no way to store the compiled code anyhow. There is only one source piece containing all the code, so you can't just predefine some routines outside source.

On the other side we have JavaScriptEngineMBS, which uses Duktape library to provide a ECMAScript engine. So the language is JavaScript and there is built-in functionality for text, array and JSON functions. You can just pass some JavaScript from your user to the engine and let it execute. Our plugin allows you to set/get global properties in the JavaScript memory. With XojoScript you would have to predefine variables either in context object or in the source code. For JavaScript you can define your own functions to be used in the script by calling AddFunction method, so you don't need to know those at compile time and you can load them from a database at runtime. You could load a JavaScript from your user and let them write functions which you call with our CallFunction function. Finally like the XojoScript context object you can use Xojo methods to define JavaScript functions via delegates and have JavaScript call back to your Xojo application.

The JavaScript is evaluated at runtime, it may be parsed before running, but it is not compiled into machine code as with LLVM compiler in XojoScript. We don't expect anyone to notice the difference unless you do some heavy calculations. The JavaScript function definitions in Duktape can be exported as a BLOB and stored in binary notation in a database. See SaveFunction and LoadFunction methods in JavaScriptEngineMBS class.

As we don't know your use case, the decision which to use can be difficult. XojoScript has the big advantage that it's built-in and uses the same Xojo language you know about. But your users may be more familiar with JavaScript, so our plugin may be a good choice, too. As our JavaScript doesn't need to be defined as much at compile time, you can invoke it more dynamically. Like loading your context functions from a database and installing them at runtime and loading global properties from database and registering them via code. Finally you can add functions to call methods on different objects via delegates, so some methods you offer can go to the app object, some to the current window and others to your Xojo class for the data model you have.

If you have questions, please don't hesitate to contact us. See also New in the MBS Xojo Plugins 20.0

MBS Xojo Plugins, version 20.1pr1

New in this prerelease of the 20.1 plugins:
  • Added LTCMBS and related classes to encode/decode timecode.
  • Added Read and Write methods and ReadAvailable and WriteAvailable properties to PortAudioStreamBaseMBS class and removed them from PortAudioStreamMBS class.
  • Added isValidDateInCalendar and isValidDate for NSDateComponentsMBS class.
  • Added dateFromComponents, componentsInTimeZone, dateByAddingComponents to NSCalendarMBS class.
  • Updated NSDateComponentsMBS class to have debugger visible properties.
  • Updated DynaPDF to version 4.0.37.103.
  • Fixed buffer overrun in BytesToKey function in CipherMBS class.
  • Fixed BacktraceMBS to work again in console and web projects.
  • Fixed a bug in ShellMBS class when running applications on Windows with empty ApplicationName.
  • Added JavaScriptDateComponentsMBS class.
  • Added DateComponentsToTime, TimeToDateComponents and Now methods to JavaScriptEngineMBS class.
  • Updated SQLite to version 3.31.0.
  • Updated curl to version 7.68.0.
  • Documentation now includes references to Xojo Developer Magazine articles in html and PDF.
  • Added Navigate method for IEWebBrowserMBS class to pass headers and POST data with loading URL.
Download: monkeybreadsoftware.com/xojo/download/plugin/Prerelease/.
Or ask us to be added to our shared Dropbox folder.

Xojo Developer Magazine Links

Our documentation now links to issues of the Xojo Developer Magazine.
For each class/module/control, we link to relevant articles, so you can quickly find them.

e.g. if you scroll down on the page for DynaPDFMBS class, you find listed methods and properties using this class, example projects, blog entries and new the list of articles in Xojo Developer Magazine referencing this function.

We hope this makes live easier for those using MBS Xojo Plugins and subscribing to the Xojo Developer Magazine.
Even if your English is not perfect, you may want to read it as the Magazin is a big treasure with the back issues from 18 years.

In total we reference the magazine from 290 items with 400 relevant pages. Enjoy!

Ideas wanted for surprise MBS feature for Xojo.Connect

Last year we presented our DynaPDF graphics class integration, a feature we worked on a few weeks before the conference in secret (see presentation video here). Beside the normal support requests and preparing the session slides that was a bit of extra work each day. The presentation file, I submitted before the conference, did miss the new special slides and I added them just before the presentation to make sure I didn't leak the news myself.

For Xojo.Connect 2020 in Nashville this year we look for a new idea on what to present as a surprise. Not sure if we find a compelling idea. It should be something which is useful to a large portion of the user base and not a feature for a you alone or a handful of people. And it should be plugin feature, so not a wish for iOS extension or some grid with containers as that is better written in Xojo directly.
Do you have ideas? Please email us.

I would also encourage the Xojo team to take a week before XDC, look through feedback cases and maybe let every Xojo engineer pick an annoying bug, a little feature request or something they'd like to see or have and spend some time onto this. Especially as a lot of feedback cases never come to the top 100 list and never get attention of the management. The in the keynote Geoff could present that list and maybe demonstrate those improvements. Those items would be first hand news shared with the crowd. Finally for the last session, if something got fixed at the conference, present it there. I did this before at a conference where I had a short lightning talk on the end and could show a new feature I programmed at the conference.

One of the feature I would do as a developer on the compiler is to make sure it annotates the nil object checks and out of bounds exceptions as far as possible with details like line numbers or name of variable. Not for all cases of course, but the functions to raise this exceptions could be overloaded and when the LLVM frontend for Xojo parses the lines and adds the checks, it could include the parameter with line number if it knows them.

Xojo Web 2 Progress

As a Xojo developer, do you use Feedback application to report bugs and feature requests?
Did you notice in the recent section that a lot of feature requests got marked as implemented for Web 2.x?



Seems like there is a quite a bit of WebAPI 2.x progress and I am looking forward to Xojo.Connect conference to learn the details!

We expect a beta version to be ready either at the conference or shortly after it. At the conference for attendees would be great because if we all download and play with it there, we may report bugs and show them directly to Xojo staff so they could be fixed at the conference.

Two months till Xojo.Connect 2020 in Nashville

Just two months till the XOJO.CONNECT 2020 in Nashville, Tennessee, USA. Tickets are still available for $999 USD.



It will be held March 25-27, 2020 in Nashville, TN at the Sheraton Music City Hotel. This conferences is the best place to meet Xojo developers from around the world in real live, make contacts, present yourself as expert and learn what is new in Xojo. Tickets are available in the Xojo store and if you bring your partner, you can order an extra guest ticket for the dinner events.

Check out the conference highlights video if you want to see what it's like - or ask one of the many attendees from the forum!

Wether you are full or part time Xojo developer, this is your chance to learn all about the Web 2.0 framework, the Android progress and what's new in the Xojo world.

New in the MBS Xojo Plugins 20.0

Last week we introduce the MBS Xojo Plugin in version 20.0. Today I want to give you an overview about what’s new.

JavaScript Engine

Furthermore we offer functions for the use of JavaScript in Xojo solutions. If you have a problem that you want to solve, you don't have to reinvent the wheel again and again. Perhaps someone has already found a solution to this problem and shared his solution on the internet. If the code of the solution is in javascript, you can evaluate the code with the help of the MBS Plugin in your project. You can add and call functions, Set and Get global properties and execute JavaScript code. For example we want to write a function that add a numeric value to a global JavaScript variable the code can look like this. An example:

Dim js As New JavaScriptEngineMBS
Dim r As Integer
js.GlobalProperty("A") = 2
js.AddFunction "AddNumberToVariableA", "function (x) { return A+x; }"
r = js.CallFunction("AddNumberToVariableA", 3)
MsgBox Str(r)

You can use our JavaScriptEngineMBS class just like you would use XojoScript control to define your own scripting language.

Also new is the WKWebviewMBS class for macOS to better use WebKIt 2.x. We can have objects that displays interactive web content, such as for an in-app browser. You can load content and can navigate through it. In the web view you can even execute JavaScript code with the EvaluateJavaScript method. (more)

Xojo Workshop in UK

The Coding in the Cotswolds group regularly organizes Xojo meetings in the south west of the United Kingdom near Swindon. I plan to attend the next meeting on 5th March 2020. Seating is limited, so if you are interested, please contact Paula or Bill and get or the guess or waiting list.

Beside this workshop we could of course organize a Xojo developer meeting for dinner in the same week. Someone interested?

Xojo developer meeting in New York City

The Xojo.Connect conference will take place March 25-27 in Nashville, TN. On our way to Nashville we stop in New York for a few days and we like to organize another Xojo developer meeting, this time in New York City.

Please vote on the day: Survey
Email us to make sure we have a matching email address for the attendee list, so we can keep you informed.

We meet in a nice restaurant somewhere central in New York City, so we can shop talk about Xojo and have dinner together. Time will probably be around 18 to 22 o'clock and you can of course come later or leave earlier. Suggestions for a restaurant with some separated space for our group is welcome.

If you are interested in private time for consulting, training or discussion MBS or Xojo topics, we can of course schedule a meeting. Please contact me directly interested.

Transactions in MBS Xojo SQL Plugin

Our MBS Xojo SQL Plugin supports the use of transactions. Two settings define the behavior, first the transaction mode and second the isolation level.

Please set transaction mode and isolation level after connecting to the database before running commands. (more)

Xojo Meeting in Berlin

We are coming back to Berlin in June, so we plan a Xojo developer meeting for 2nd June 2020.

Topics may be the last and upcoming Xojo conferences, what's new in recent Xojo and MBS Plugin releases and your experiences in development.

Interested? Please contact us soon to be added to the attendee list, so we reserve enough space.
We may have a few give aways, as usual.

PS: This event is cancelled.

MonkeyBread Software Releases the MBS Xojo Plugins in version 20.0

Nickenich, Germany - (January 14th, 2020) -- MonkeyBread Software today is pleased to announce MBS Xojo Plugins 20.0 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 2600 classes and 67,000 documented features, and the versatile plugins have gained more new functions:

In this release we include with JavaScriptEngineMBS class our own JavaScript engine based on the DukTape opensource project. Duktape is an embeddable Javascript engine, with a focus on portability and compact footprint. You can evaluate JavaScript snippets, get and set global properties and add custom functions written in Xojo or JavaScript.

For HTMLViewer on Windows using Internet Explorer as engine, we got new classes like IEDocumentMBS to offer many more features. We deprecated the older IE methods on HTMLViewer to declutter auto complete. And our new class brings you an Evaluate function to run JavaScript and get back the result as variant. You can call JavaScript functions and pass Xojo variants for parameters, so we pass numbers as numbers and not convert them to text. Use SetInternetExplorerVersion function to request a newer Internet Explorer version for HTMLViewer.

With MacOS Catalina Apple includes new machine learning capabilities, which you can use in your applications to update a model on device with new training data. Enjoy new events in WKWebViewControlMBS control to decide policy for navigation and load HTML files easier. Use the WKBackForwardListMBS class to navigate the history.

Enjoy ImageMagick in version 7 and use it with 8 to 64-bit color depth per pixel component and optionally HDRI support. For LCMS2TransformMBS class you can now use multi threading to run transformation in parallel.

For Windows use MFPMediaPlayerMBS to play video/audio independent of Xojo's MoviePlayer control. If you use WindowsPlayerMBS class to play mp3 files, you can now choose the audio device.

Use LMFitMBS and related classes for Levenberg-Marquardt least squares fitting algorithm. Solve boolean satisfiability problem with LGLMBS class. When using iTunesLibraryMBS class to read iTunes library content, you can now do initialization in a thread to not block user interface.

Finally we updated DynaPDF to version 4.0.37.101, CURL to 7.67.0, LibArchive to 3.4, SQLAPI to 5.0.3, zint to 2.7, LibXL to 3.8.8 and Xcode to version 11.3.

See release notes for a complete list of changes.

Xojo Developer Conference 2020

Just about two months till the XOJO.CONNECT 2020 in Nashville, Tennessee, USA starts. Today is the last day to get tickets for early bird prices with a $100 USD off.



It will be held March 25-27, 2020 in Nashville, TN at the Sheraton Music City Hotel. This conferences is the best place to meet Xojo developers from around the world in real live, make contacts, present yourself as expert and learn what is new in Xojo. Registration is currently $100 off full price till Tuesday night (14th January). Please sign up early to get the best deal.

Don't forget to reserve a hotel room. Can be cancelled later free of charge, so you don't loose anything by reserving one now. If you find a better deal, you can cancel it.

Check out the conference highlights video if you want to see what it's like - or ask one of the many attendees from the forum!

Individual licenses for MBS Xojo Plugins

As you may know we have currently 40 plugins for Xojo. We offer licenses for 37 plugins as a package, named the Complete Set. But still DynaPDF, SQL and ChartDirector plugins cost us royalties, so those are not included in the set. The other 37 plugins can be purchased separately. Our web site shows in the order page about 20 parts with direct links.

For next release 20.0 we upgraded our license key system to be able to generate keys for all parts individually. For the store we just added an "other" item as place holder. A few people asked over the last year for licenses to individual licenses, so we got this now.

Please notice the dependencies list. For example when you would purchase AVFoundation plugin, you also need Main, MacBase, MacCG, MacCocoa, MacControls and MacCF installed. Those plugins must be installed to build an application using a single AVFoundation class. If you use one of the classes from he other plugins, you may need the other plugin license, too. That is the reason we offer users interested in those plugins the whole package to avoid them later run into an issue with a missing license.

Nevertheless, if you can't afford Complete Set and you need one of the plugins, you are welcome to order a license. If you take the other item in the store, we'll ask you which one you want. And if you later prefer Complete Set within a few weeks, we may just refund the old part.

MBS Xojo Plugins, version 20.0pr8

New in this prerelease of the 20.0 plugins:
  • Updated DynaPDF to version 4.0.37.101.
  • Added EqualContent method to JSONMBS class.
  • Changed OpenStream for PortAudioStreamBufferedMBS class to always change format to Float32.
  • Fixed ReadError and ReadOutput for WindowsProcessMBS class to return empty string when called with value zero.
  • Added parameter for FindValueInArray and FindValueInObjectArray in JSONMBS class to compare by content.
  • Updated JavaVMMBS constructor to better find Java libraries.
Download: monkeybreadsoftware.com/xojo/download/plugin/Prerelease/.
Or ask us to be added to our shared Dropbox folder.

MBS Xojo Plugins, version 20.0pr7

New in this prerelease of the 20.0 plugins:
  • Added threaded parameter for Constructor in iTunesLibraryMBS class.
  • Changed the text file embedded in xojo plugin files to include a random build UUID which is different each time a plugin is built as well as a Plugin UUID which doesn't change for the same plugin.
  • Implemented synchronous EvaluateJavaScript for 32-bit in WKWebViewControlMBS control and fixed bug in 64-bit.
  • Added ChannelMask and DeviceID properties to WindowsPlayerMBS class.
  • Added OpenDialogItemMBS class.
  • Added Items and Files methods to OpenDialogMBS class.
  • Added WindowsPlayerDeviceMBS class.
  • Fixed problem with Progressive property in JPEGExporterMBS not always being used.
Download: monkeybreadsoftware.com/xojo/download/plugin/Prerelease/.
Or ask us to be added to our shared Dropbox folder.

MBS Xojo Plugins, version 20.0pr6

New in this prerelease of the 20.0 plugins: Download: monkeybreadsoftware.com/xojo/download/plugin/Prerelease/.
Or ask us to be added to our shared Dropbox folder.

Evaluate JavaScript for web viewer in Windows

Imaging what you could do in a web viewer in FileMaker or HTMLViewer in Xojo if you could evaluate JavaScript and get back the result?



Coming soon for MBS FileMaker Plugin for MacOS, Windows & iOS and MBS Xojo Plugins for MacOS, Linux & Windows.

Array size allocation in Xojo

When you allocate an array in Xojo, you may wonder how many bytes are allocated and when.

We measured a bit and it looks like allocating an empty array will just allocate the array structure, but not allocate data for the array values. Then when you append the first value, the memory is allocated for 16 values, byte size depending on byte size of elements. Then whenever the appended values fills the allocated space, the allocation is resized to make room for more values. The number of values added is doubled each time as you see in our table:

From UboundSize in BytesNumber of values
-100
01281616
163844832
4889611264
1121920240128
2403968496256
49680641008512
10081625620321024
20323264040802048
40806540881764096
8176130944163688192
163682620163275216384
327525241606552032768

When you do a redim on the array, you set the allocated size to the array to an explicit value. So unless redim has already the value of ubound, a new memory block will be allocated and data is copied. There is no optimization to just change internal ubound and keep array allocation if e.g. size is just shrinking by one or two. We made a feedback request to ask for optimization: Feedback 58755.

What to do? Whenever you fill an array and you know the final ubound in advance, you can use redim beforehand and then set values. Otherwise you use append or insert methods which dynamically allocate new memory when you hit the current allocation limit.


Whether to order updates or not

As you may know you can purchase MBS Plugin license and later decide whether you purchase a license update to extend the maintenance for your license. For this we have four different customer groups:
  • First group of clients receive an email notification about the end of their maintenance and they immediately order an update. Those customers pay in advantage for future updates and in general expect they will use those newer versions. When this happens, they can add a full year (or several years) to their maintenance time.
  • Second group of clients waits till a new version comes out that has interesting new features or critical bug fixes. Those customers buy the update when needed and that is fine of course. This may mean that the customer orders an update from last year version to this year and does not get a full new year of updates as the maintenance is of course expanded from where it ended before. Or if they didn't purchase within the year after expiration, they have to pay the full price for a new license.
    When we had Black Friday offer running last November, we did email those clients to inform them that buying a new license with discount was cheaper then the update order for two years!
  • Third group of clients doesn't care for updates or maintenance. When they need a newer version after many years, they just buy a new license. We are long enough in business to see that some of them easily have a 5 year gap between orders.
  • Forth group are developers just use the plugin in demo or trial mode. Maybe they work at home and have a license only at work. Or they are consultants and the client buys the license later. Some get trial licenses several times, so we ask them kindly to purchase a license for themselves.
With everyone using the plugin, we say thank you for your business. As long as sales go well, we can continue the work.

MBS Meeting in Netherlands

As I am traveling again to the Netherlands, I like to arrange a MBS meeting for both FileMaker and Xojo developers.

Let's talk about Xojo, FileMaker, conferences, plugins and other programming topics.

Meeting will be Wednesday 8th January 2020 in Rotterdam in a restaurant near the main station around 18:00 to 21:00 o'clock. Some of you may come later, some earlier, but I try to be there around 18 o'clock to welcome you. We should have a separated space for the meeting. If you are early, wait at the bar.

Already over 20 people have announced they will come, so see you there!

If you like to join and you are not yet on the guest list, please contact us soon.

xDev 18.1 Issue

The January/February (18.1) issue of xDev Magazine is now available. Here's a quick preview of what's inside:

Numbers Please! Part 6 by Markus Winter
Wrapping up and building a demostration app.

On the Scene by Stefanie Juchmes
Getting started with Apple's 3D graphics toolkit, SceneKit.

Check Your Spelling by Eugene Dakin
Harness the power of Microsoft Word on Windows to add spelling checking to your apps.

Your First Web App -- Part 4 by Paul Budd
It's finally time to learn how to deploy the Web app!

Embedding Link by Stefanie Juchmes
How to use MBS to add links -- external or internal -- within your PDFs.

PLUS: Xojo 2019r3, Setting Goals, Color Groups, Iterators, Best of the Web, and more!

MBS Xojo Plugins, version 20.0pr5

New in this prerelease of the 20.0 plugins: Download: monkeybreadsoftware.com/xojo/download/plugin/Prerelease/.
Or ask us to be added to our shared Dropbox folder.

Welcome 2020

Happy new year to everyone! The year 2020 will have some great news coming soon:
  • In mid January we will ship MBS FileMaker Plugin in version 10.0 with over 6000 functions! Over hundred new functions added since last release. Yes, in early December we reached the 6000 functions mark!
  • For Xojo the version 20.0 of MBS Xojo Plugins will come with over 1500 new items in our documentation. We now have 1000 global functions alone and documented 67000 items.
  • This year we'll celebrate 20 years of Monkeybread Software with a big party in April.
  • Nashville will 2020 be the target for us twice, first the Xojo.Connect conference in spring and later in summer the Claris Engage conference. See you there!
  • Later this year we look forward to the first Claris Engage Europe conference coming to Lisbon. Instead of going to the France, Spanish, Italian, English, Scandinavian, Dutch and German conferences, everyone can come to one place and meet Claris staff from Europe and USA together. And Lisbon is reachable via car, ship or train for those who prefer not to fly. It may be a nice road trip through France and Spain for us.
  • Already we signed up for the German FileMaker conference in Malbun.
  • You wait for the next Xojo conference in Europe?
    Please join Xojo.Connect in Nashville for 2020. There is no MBS Xojo Conference 2020 planned and announcement for 2021 may come later in the year.
  • Stefanie has done a great job in her first year here at Monkeybread Software. You may have notices her blog entries, magazine articles and met here at the conferences. You'll see more from her in the second year.
  • In general the year 2019 was a record year for us in sales, new customers and active licenses. We look forward to a great year 2020!
  • See you at one of the conferences!
The biggest plugin in space...

Archives

Mar 2024
Feb 2024
Jan 2024
Dec 2023
Nov 2023
Oct 2023
Sep 2023
Aug 2023
Jul 2023
Jun 2023
May 2023
Apr 2023
Mar 2023
Feb 2023
Jan 2023
Dec 2022
Nov 2022
Oct 2022
Sep 2022
Aug 2022
Jul 2022
Jun 2022
May 2022
Apr 2022
Mar 2022
Feb 2022
Jan 2022
Dec 2021
Nov 2021
Oct 2021
Sep 2021
Aug 2021
Jul 2021
Jun 2021
May 2021
Apr 2021
Mar 2021
Feb 2021
Jan 2021
Dec 2020
Nov 2020
Oct 2020
Sep 2020
Aug 2020
Jul 2020
Jun 2020
May 2020
Apr 2020
Mar 2020
Feb 2020
Jan 2020
Dec 2019
Nov 2019
Oct 2019
Sep 2019
Aug 2019
Jul 2019
Jun 2019
May 2019
Apr 2019
Mar 2019
Feb 2019
Jan 2019
Dec 2018
Nov 2018
Oct 2018
Sep 2018
Aug 2018
Jul 2018
Jun 2018
May 2018
Apr 2018
Mar 2018
Feb 2018
Jan 2018
Dec 2017
Nov 2017
Oct 2017
Sep 2017
Aug 2017
Jul 2017
Jun 2017
May 2017
Apr 2017
Mar 2017
Feb 2017
Jan 2017
Dec 2016
Nov 2016
Oct 2016
Sep 2016
Aug 2016
Jul 2016
Jun 2016
May 2016
Apr 2016
Mar 2016
Feb 2016
Jan 2016
Dec 2015
Nov 2015
Oct 2015
Sep 2015
Aug 2015
Jul 2015
Jun 2015
May 2015
Apr 2015
Mar 2015
Feb 2015
Jan 2015
Dec 2014
Nov 2014
Oct 2014
Sep 2014
Aug 2014
Jul 2014
Jun 2014
May 2014
Apr 2014
Mar 2014
Feb 2014
Jan 2014
Dec 2013
Nov 2013
Oct 2013
Sep 2013
Aug 2013
Jul 2013
Jun 2013
May 2013
Apr 2013
Mar 2013
Feb 2013
Jan 2013
Dec 2012
Nov 2012
Oct 2012
Sep 2012
Aug 2012
Jul 2012
Jun 2012
May 2012
Apr 2012
Mar 2012
Feb 2012
Jan 2012
Dec 2011
Nov 2011
Oct 2011
Sep 2011
Aug 2011
Jul 2011
Jun 2011
May 2011
Apr 2011
Mar 2011
Feb 2011
Jan 2011
Dec 2010
Nov 2010
Oct 2010
Sep 2010
Aug 2010
Jul 2010
Jun 2010
May 2010
Apr 2010
Mar 2010
Feb 2010
Jan 2010
Dec 2009
Nov 2009
Oct 2009
Sep 2009
Aug 2009
Jul 2009
Apr 2009
Mar 2009
Feb 2009
Dec 2008
Nov 2008
Oct 2008
Aug 2008
May 2008
Apr 2008
Mar 2008
Feb 2008