XojoTalk 027 – Database Goddess

We at BKeeney Software are blessed in so many ways.  All of our employees bring a unique and interesting mix of talents and experiences.  It’s not just about one person and we often bounce ideas off each other to get the best possible result.

In the latest XojoTalk, Paul interviews our CEO, Carol Keeney, and how she uses Xojo and gets her thoughts on databases.    Carol has a ton of project management experience that makes running BKeeney Software easy since we often have a half dozen projects going at a time.

She has a lot of database experience too.  That has given her the “Database Goddess” nickname.  Again, that experience is so helpful for the programmers because, really, you don’t want your programmers designing the database.  We tend to do things the easy way which might not be the right way.

I thought it was an excellent interview.  You can find the XojoTalk at http://blog.xojo.com/2016/07/26/xojotalk-027-database-goddess/

Xojo 2016 Release 2

Last week Xojo 2016 Release 2 was unleashed to the masses.  There are a lot of changes and tweaks in this version and if you are creating web or iOS applications there is a lot of like about this release.  There are also a myriad of changes and enhancements that should satisfy most developers.

iOS Stuff

The biggest changes in R2 is for iOS and these are things that developers have been requesting since its initial release.  Support for iOS 7 has been dropped because its market share is less than 20% and the minimum required version is now iOS 8.  This also means that Xcode 7 or Xcode 8 needs to be installed.

The Xojo engineers added iOSScrollableArea which allows you to view and display content that is larger than the view.  This is a very welcome addition and is worth the upgrade for this feature alone.

R2 also adds the iOSLocation class that allows your application to request location coordinates as well as get updates from the device.  Once your application gets permission to access the device location you receive changes via the LocationChanged event that gives you latitude, longitude, altitude, course and speed parameters.  An Accuracy property lets you change the desired accuracy.  In addition to iOSLocation Xojo has added the iOSMotion class that allows developers to access the accelerometer and gyroscope.

iOSTable was arguably the most useful and least powerful control in iOS for Xojo and this release definitely gives it some love.  You can now embed controls in the cells of iOSTable by using the iOSCustomTableCell class.  This allows you to create some very rich and powerful UI that lives in the cell of an iOSTable.  I guess the best equivalent in desktop and web terms is that the iOSCustomTableCell is a specialized ContainerControl you can put into an iOSTable cell.  I’m looking forward to using this.

They’ve also added support for Row Actions in the iOSTable.  The new ActionsForRow event passes in the section and row and you have to supply the iOSTableRowAction array.  The iOSTableRowAction has a title, an Auto tag and a Style.  The style can be either Normal or Destructive with Destructive changing the background of the Action to red (does this ever vary? – not sure).

The new iOSSharingPanel allows you to share pictures, text and URL’s with any registered system service or app.  That’s a fancy way of saying you can share this data between applications.  It’s the iOS version of the clipboard available to desktop applications.

The iOSPicturePicker class allows you to select images on the device or take pictures with the camera.

To avoid confusion for users, the old SQLiteDatabase class for iOS has been renamed iOSSQLiteDatabase.  The corresponding recordset class is now named iOSSQLiteRecordSet.

Non-IOS stuff

The Web framework is now HiDPI capable.  It works similarly as desktop apps in that it queries the browser for the scaling factor.  Then, the application serves up the proper image if it can.  You can change how this works by changing the Supports HiDPI in the Shared Build Settings.

In Windows there are a number of significant HiDPI changes that make it work better in Windows 8.1 and 10.  Perhaps the biggest Windows change is that Xojo.Net.HTTPSocket is no longer much slower than HTTPSecureSocket.  I have not had a chance to look at this one in detail yet so if you’ve had success or failure with it, please leave a comment below.

Always check the release notes that are in every release.  I’m just hitting the highlights out of hundreds of line items and you never know what might be there that affects your application.

As with any new release it’s better to test your project against it before releasing it into the wild.  In my own testing I had some instability with converting an old web project (started around the very first public beta of Web Edition) to use HiDPI graphics.  This involved adding an ImageSet and adding the 1x and 2x graphics, deleting the old graphic, and then fixing it in all locations in the project.  I was able to crash the IDE but all of the crashes were different and, of course, none of it was reproducible.

The Future

The 800 pound gorilla in the room is a 64 bit IDE and 64 bit debugging.  Things like XojoScript are holding back the IDE from being 64 bit.  I would also imagine that not having an integrated debugger available in 64 bit is holding back that as well.  I know we are avoiding releasing some 64 bit projects because of these limitations. We’ve also been playing around with the Raspberry Pi and it’s definitely not very useful without the debugger.

We need the 64 bit debugger.  Let’s hope that R3 provides us with some relief in that area!

How has your experience been with R2 so far?

Celebrate National Bikini Day

July 5th is National BKeeney…er…Bikini Day.  In celebration we’re offering all of our products at 30% off for the next 48 hours.  Apply the coupon BIKINI in our online store to receive the discount on the following products:

ARGen:  Our utility for creating ActiveRecord classes for use with Xojo.  Make the IDE work for you when developing your Xojo database applications.

BKS Spell Check Plugin:  Easily add spell checking to your Xojo applications with our Mac and Windows plugin that can either use the System dictionary or use a Hunspell dictionary.

Calendar Classes:  Add Day, Week, and Month views to your Xojo applications.

BKeeney Shorts Professional:  Create and render reports in your Xojo desktop and web applications.  Renders to screen, printer, HTML, CSV, and PDF formats.

Formatted Text Control:  A TextArea replacement that allows inline pictures, hyperlinks, and much more.

FTC and Spell Checker Plugin:  Get the FTC control with the spell checker.

Simple Help Editor:  Making help systems stinks.  This utility helps make it easy.

Styled HTML Field:  Export from a StyledText field to HTML.  Handy if you’re going to add HTML to emails sent from Xojo applications.

Task Timer 5 (Mac and Windows):  If you aren’t tracking your time you’re missing out on a key metric on how well you estimate and where you spend more of your time.

Xojo Trainer (Download and Flash versions):  Learn Xojo (offline) from Xojo professionals with over 15 years of Xojo development experience.

Visit our online store to see all our products or visit any of the product pages to get more information on them.

BKS Shorts Version 1.7.0 Released

pens128BKeeney Software is pleased to announce a new release of BKeeney Shorts, their Reporting tool for Xojo.  BKS Shorts allows users to embed a report designer into their desktop applications and render reports onscreen, to a printer, as well as to HTML, CSV, and PDF formats (PDF requires a DynaPDF license). Web applications can render reports to HTML, CSV and PDF Formats.

Version 1.7 is an extensive update with a new, faster, file format.  Users with dynamic queries can now put a summary of selections in the header.  Dynamic queries that use popup list selections can now make them optional.  And much, much more.  Complete change list below.

BKeeney Shorts Product Page:  http://www.bkeeney.com/allproducts/bkeeney-shorts/

BKeeney Shorts costs $300 and is shipped with 100% unencrypted Xojo source code.

New Features:

  • Added SupressField property to Fields. This will keep rows with identical text to the row above it from displaying. Resets on each page.
  • Added ?? shortcut to Header/Footer bands to be able to put report parameters into the report. Feedback appreciated.
  • Added check upon opening reports in the designer to see if all fields in the report are still valid.
  • Now provide an error message to user if there were any errors while generating report.
  • Added a Version field to the report to make it easier for future file format changes. New file format is 1. Added a conversion routine to convert to version 1.
  • The Property List now has a dedicated popup menu for Date fields.
  • The Query List Dynamic queries can now be made optional to ‘select all’ for that field.

Changes:

  • Now provide feedback to the user during report generation. This will give rough estimates of numbers of rows created.
  • When switching back to Design view we now make sure the thread generating the report is killed if still running.
  • Major rewrite to the DBWrapper class to make it much more effecient.
  • PAF_QueryCondition made part of the PAF_DatabaseKit and renamed to PAF_DatabaseKit.QueryCondition
  • Reports will save the DefaultStyle from the StylesList.
  • Added some Localization strings into the object list.
  • Removed the Contextual Menu from the Property List format item. Only used for Dates and it now has dedicated Date Popup.
  • Added a WaterMark to two of the Coded reports.

Bug Fixes:

  • Fixed issue where Grand Summary bands weren’t working.
  • Views are now properly vetted through the TableViewAddCheck.
  • Rescanning the schema will refresh the object list properly now.
  • Can no longer drag a report objects (from the Report section of the Object List) into the designer. Now you can only drag fields and report primitives.
  • Repeat Each Page and Page Break are now only valid and displayed for group headers.
  • Adding/Removing items from the Designer now updates the Report Objects section of the object list.
  • Fixed wording in the Band Editor.
  • Background Text Color now saved properly in Style editor.
  • Pressing Enter/Return while in the Properties List will update the object in the Editor.
  • Fixed issue with report time in Report Footer if user had never set format in preferences.
  • Fixed issue with line objects not calculating their top/right property properly.
  • Fixed a date conversion issue when formatting the dates to other than default.
  • Fixed mouse handling and drawing issues when the canvas width was smaller than the page width.
  • Fixed Report window Title not showing on initial save of report in designer.
  • Fixed odd random Nil Object Exceptions when updating from the property list.
  • Fixed the WindowMenu class to work with multiple menu bars used in the project.
  • Fixed issues with the IsFunction property when generating reports.

Xojo Windows Application Runtime Requirements

One of the strengths of Xojo is that it creates a no requirements executable package.  For Mac OS X it puts all required libraries and resources in the application bundle and for Windows and Linux it puts all the necessary files into the Libs and Resources folders.  This makes installing your apps on Windows and Linux pretty easy because you did not need an installer (however it’s highly recommended you use installers!).

Screen Shot 2016-04-20 at 2.58.37 PMXojo 2016 Release 1, however, has a new requirement that is biting some users fairly hard.  Some Windows 7 and 8 users get an error staying that it can’t start because it’s missing the api-ms-win-crt-runtime-l1-1-0.dll.  This error is because Xojo Windows framework was updated to use the latest Microsoft tools which means the “Universal C Runtime”.

This new runtime is shipped with Windows 10 and should be part of a fully updated Windows 7 and Windows 8 installation and because of this Xojo is not distributing the DLL when they build an application.  The past few months have shown us that many people do not automatically update their systems.  It’s pretty easy to replicate this behavior in a VM environment.  Simply do the base install of Windows 7 or 8 (doesn’t matter if it’s 32 bit or 64 bit) and without doing the hundreds of updates required to bring that version of Windows up to date, run a Xojo application.

There are three solutions to this problem.  First, have the user do all of the available Windows Updates which should install the runtime.  The second, is to have the user download the runtime installer from Microsoft.  The third option, is to add it to your installer.

Screen Shot 2016-04-20 at 2.59.02 PM

We use InnoSetup for creating our Windows installers.  Xojo has conveniently added the redistributable to the Xojo download package so we can use it.  Look in the Extras/Windows Runtime/Installers/ directory to find these installers.  Adding this into your installer is relatively painless.

In the [Files] section of your Innosetup script, add the following line:

Source: “VC_redist.x86.exe”; DestDir: {tmp}

Then, in the [Run] section, add this line to have it installed automatically:

Filename: {tmp}\VC_redist.x86.exe; Parameters: “/install /quiet /norestart”; StatusMsg: “Installing 32-bit runtime…”; Flags: waituntilterminated

This is a no fuss way to add it to your installer.  It only adds about 14 MB to your installer.  Most users will never see it because they’re up to date.

I highly recommend that you peruse the PDF provided by Xojo on this topic at Documentation/WindowsUniversalRuntime.pdf.

In our testing installing the new runtime has not caused any issues.  The clients that have had this added for them have reported no issues either so I think it’s pretty safe.  Some Xojo forum users, however, have reported that their Windows installation will hang when trying to install the Runtime.  Have you experienced any issues with the runtime?

Changes at BKeeney Software

BKeeney Software, Inc. is proud to welcome Tim Parnell as the newest addition to our full-time staff.  Tim will be working on several high profile client projects for BKeeney in addition to lending his skills to all of the BKeeney products.

Tim has been writing software for nine years and is known for his work on MacDust and with TinyGrab and MacHeist.  He has also been active in the Xojo community with his HTML Edit and Answers products and is an active contributor in the Xojo forums.

Bob Keeney, Vice President of BKeeney Software said, “We’re excited about bringing Tim on board.  His experience with web technologies in addition to his Xojo skills enhances the mix of services we can offer to our clients.”

BKeeney Software, Inc is a consulting and software development company that has been around since 2002, specializing in Xojo application development.  BKeeney offers Xojo training, tutorials, source code and developer products.  www.bkeeney.com

Views are Your Friend

One of the challenges I see regularly in my work as a database administrator is finding a way to bridge the gap between the well-normalized physical implementation of a database behind an application and providing a way to make the data available in an easy-to-use (and understand) fashion for the end user.  For many clients this means letting them design their own reports.  Database views are my go-to method for making a complex database structure easy to use for end-users and even developers.

Views have a number of advantages.  For one, they are available in all SQL databases, including SQLite.  Views allow you to reduce the complexity of the end user experience by managing and limiting the data presented.  This might mean taking a very complex query joining multiple tables and presenting it in a single table with the end user (or developer) not needing to know the gory details of the SQL behind it.

This last point is important for the developers too.  Having the programmers figure out the complex joins for a query pulling from multiple tables is sometimes challenging and not always a good use of their time.  Having the Xojo application do all that work for a complex query is sometimes painfully slow.  Views not only speed up the development process but make the Xojo application more efficient since the database has already created the view and optimized it internally.

Views are more secure since you can limit the data shown and control who has the rights to view it.  By giving users and developers access to the underlying tables you may be exposing sensitive data.  Views are an easy way of sanitizing data.  We use views as read-only constructs so the user cannot update the data (note:  not all databases treat views as read-only).

Views can be created, modified and deleted via simple SQL statements.  The syntax of the statements (in particular for modifying views) varies a bit from database to database but the details can be easily found.  To create a view, the syntax is:

    CREATE VIEW viewname AS

SELECT (fill in your query here)

We recently used views implementing a large customer records management (CRM) system for an insurance broker.  Their database has around 100 tables containing information on customers, policies, related products, agent and commission data.  The data is normalized and it isn’t always straightforward to get related data.  The client does not have a dedicated IT staff and reporting is the primary responsibility of a part-time administrative employee, “Jane”.

Our goal was to provide Jane with the easiest means possible to write any report that was requested by management.  While Jane has some knowledge of databases and foreign keys, she isn’t technical and doesn’t have any training on the SQL language.

Our answer was to use our desktop reporting tool, BKeeney Shorts, customized to only show her views created solely for reporting.  (We did this via a simple naming standard in the database.)  She is presented with options such as:  Agent Commission, Prospect Contact and Client Policy Details.  If she needs an additional view, it’s easy to add it to the database and not impact the Xojo code behind the application. (It doesn’t require a recompile and redeployment of the software).

The view incorporates the calculations behind the data, so the reports are always consistent in terms of things such as how commission checks are calculated or who is the primary agent for an account.  By using views we ensure that consistent results are shown to the end user even if someone else is assigned to write reports

Views provide a level of abstraction between the database and the end user and we find  them very useful.  For the developers, it means they don’t have to figure out the complex queries and have the Xojo application create inefficient and complex queries.  Views are your friend!

Shorts Report Designer 1.6.2

pens128BKeeney Software is proud to announce Version 1.6.2 of BKS Shorts with Report Designer, our reporting classes and tool for Xojo.  Shorts allows you to integrate a report designer into your own Xojo desktop application.  Desktop and Web applications can generate reports.  Both versions can export to PDF if they have the MonkeyBread DynaPDF plugin.

This is a free update to all existing users.  This version fixes a couple of important bugs and is recommended for all users.  In this version we also added a CSV Renderer that allows you to export your reports to CSV in addition to HTML and PDF.

Product Home Page:  http://www.bkeeney.com/allproducts/bkeeney-shorts/

New:

  • Added a CSV Renderer that can export reports to CSV format ignoring page headers and footers.  (Note: CSV Export isn’t perfect. We’re just taking the text and putting it in a file.)
  • Added CSV Export into the File->Export Menu to give example.
  • Added Chinook Invoice Database Example.
  • Added ability to get exception messages back from the Report Thread.

Changes:

  • Tightened up the spacing in the dynamic DateTime container.
  • Did some prep work in the Designer and in ReportPF to allow fields in the header in a future release.

Bug Fixes:

  • Fixed Formatting of page numbers so it can go up to 4 digits.
  • Fixed loading of Schema and Views in the report viewer.
  • When opening a report the view switches automatically to the Design View.
  • Fixed an issue where adding ? to the Filter Data (thus making it a dynamic runtime variable) would not get saved without unchecking and checking the dynamic checkbox in the list.
  • Fixed issue with Lines line staying put in proper location in the Designer.
  • Fixed issue where adding a Field in the Header of the report would cause what appeared to be an infinite loop (really was an exception in the thread). Now it will finish the report.

There is No Easy Button

Most of us want an easy button when it comes to software development.  Out of the dark ages when you literally had to code everything yourself came the frameworks that did a lot of the dirty work for you and all you needed was to figure out what those framework calls were.  Tools like Xojo make this even easier because the framework has been around a long time, well known and documented, and mostly complete.  Add in the rise of internet searching and it’s quite possible to find huge chunks of code that do what you want.  Be wary, though, because that convenient piece of code you just found might have bugs in it.

The reality of programming is that any code that you didn’t write should be considered suspect.  That’s not the same thing as saying Other Peoples Code (OPC) is wrong, it might be perfectly safe to use, but you really should vet the code and thoroughly test it before putting it into your application.

I’ve seen it on the Xojo forums where someone whips out some code from memory and it contains a bug or simply doesn’t work.  The person asking the question then gets mad that it doesn’t work.  Normally the bug is simple to fix but it’s obvious that in many cases the developer getting mad didn’t even attempt to read any documentation.  Come on, people!  If it was that easy, we’d have created AI’s to do the programming by now.

Really, in the long run, you need to understand what you’ve copied.  Maybe it looks right on screen but it is horribly optimized, or worse.  Maybe it calls into the netherworld and summons Cthulhu.  Anything is possible, right?  Do you want to be responsible for the software Armageddon in your company?

Much of the example code given on the internet is lacking defensive coding for the sake brevity.  This can lead to runtime exceptions that can cause needless headaches.  If I had a $1 for every Xojo programming that’s wondered why their Recordset is coming back nil and not checking for database errors I’d could probably buy an enterprise license of Xojo every year.

It’s been my experience that any code you find you will have to tweak it (either a little or a lot) to fit the business requirements of your application.  If you don’t understand the code you’ll never be able to figure that part of it out.  Learn the individual bits of code and learn how to use the debugger for heavens sake.  The Xojo documentation has some great information.  The debugger is your friend!

When it’s your own code that you’re copying and pasting (especially in the same project) it’s a very strong indicator that you should refactor your code.  Perhaps making a global method or making a helper class makes sense.  That’s actually a good time to ask the forum on the best strategy because you’ll probably get two or three different responses.  Learning new techniques is good and in the in long run those will become new tools in your arsenal of programming tricks.  And remember that in a year or two you’ll look back at your coding today and be embarrassed (this is natural) because you’ve learned SO much since then.

There is no easy button when it comes to software development.  Even with RAD tools like Xojo you need to learn the language and the framework to bend it to your will.  Sure, use OPC as a way to learn how parts of it work but copying and pasting verbatim without learning why it works is a recipe for disaster.

Happy Coding!

Xojo 2016 Release 1.1

Xojo 2016 Release 1.1 hit the web today and this version should be the one you’re using from now on.  This dot release fixes a number of critical and important things.

First off, web app compile times just got much better.  Building a 64 bit Linux web application went from five minutes in 2016 R1 to just three minutes in 2016 R1.1 (both versions had to recompile the plugins so take two minutes off that for an average time). This is a marvelous and unexpected surprise in R1.1.

The Web Page Layout editor that was a dog in R1 is much improved.  A complex web page with multiple containers and controls is now nearly flawless when dragging controls around on the page.  This one feature alone is the worth upgrading to R1.1.

The MySQL plugin no longer crashes when a closing the database connection.

BMP’s with a mask dragged into a Linux project long longer throws an out of bounds exception when the app is launched.  Xojo.Net.HTTPSocket was also updated.

In Windows, the SaveAsDialog no longer returns the wrong name if anything in the file path has a period in it.  Xojo.Crypto.RSAGeneratePair no longer crashes.  The new Language Reference no longer has high CPU usage and the Windows IDE no longer crashes when a remote debug app quits.

Besides the web page editor, the IDE also received a few fixes.  Perhaps most important is that searching the project no longer results in a crash for some developers.

Read about all of the R1.1 changes in the release notes.

All-in-all R1.1 is a welcome version and I recommend that you update to it immediately.  What do you think?