Thursday, November 12, 2015

HTML5 Builder for Delphi Lovers

HTML5 Builder is currently the best technology for those who have a Delphi background and need to create for a PHP/HTML environment with occasional JavaScript, plus it’s free inside your RAD Studio subscription.

Whether you’ve purchased my book or not, please feel free to Email me your migration experiences.  In a year or so I may do a second and expanded edition and will benefit from your stories.

I’m hearing from people that the hardest part starting up is learning or dealing with PHP.  First of all, the language is nowhere near as typed as Object Pascal, so you are more likely to make mistakes the compiler cannot detect.

Also, $value is different from $valuue is different from value with no $.  Small typos like those are easy to make but the compiler treats them as different uninitialized variables or a constant. Delphi would catch such mistakes in an instant and give more insight in the error message.

Those new to C like languages often make the if (a = b ) mistake, where the if statement can assign b to a.

Control-D reformats both Delphi and HTML5 Builder code, but Embarcadero simply will not reformat PHP if it has an error in the code, … whereas with Delphi that is how you FIND forgotten BEGINs and ENDs.  I hope a future version fixes that oversight.

There is one area I wish to comment on and direct you to a different product:  If you are writing a pure javascript application with little or no PHP, like an HTML5 mobile app, I would recommend against HTML5 Builder and redirect you to a little gem called Smart Mobile Studio.  It lets you write in Delphi-like Object Pascal, and it compiles to pure and fast JavaScript. 

HTML5 Builder javascript programs are a pain to debug, but SMS’s Object Pascal.  There are lots of examples, but little documentation.  There is a book available, but it is incomplete and hasn't been updated in over 3 years.  I don’t have any monetary interest in it, but I found it was very useful for a project that was taking too long in HTML Builder for JavaSciprt.

Keep in touch.

Thursday, September 24, 2015

AJAX and HTML5 Builder

HTML5 Builder does a lot of things very well, but the AJAX support is not actually asynchronous like AJAX implies – HTML5 Builder makes it happen in the foreground.

As a result of this design decision, a busy symbol is placed on your page while the content is loading.  It doesn’t look as professional as you want.  And it makes some things impossible to do well.

For example, you may want to have an automatically updating control that changes while you type: like Google’s search page Edit field. 

In my book I show how to do real AJAX while working with HTML5 Builder, and we re-create the Google-styled controls.

Fixing Errors on a Page

< br /> When debugging your program with HTML5 Builder, you have some options:
  • Breakpoints
  • Single step over
  • Single step into
  • Continue executing
Here are some handy hints:
If you have a page error displayed on your web browser, fix the error, then return to the browser and press F5 to reload the page. This won’t work if you’ve changed the layout of the page or added controls, but for pure source code changes it usually works.
If you are at a breakpoint or have just single-stepped, you may see an error you want to fix. Press the STOP button, make the change, and then you can usually F5 on the browser to reload the page. Failing to press Stop and then pressing F9 will confuse the browser and it might stop working correctly.

Evaluate/Modify
Evaluate/Modify works until you try to evaluate something that’s an error. Errors will be registered as though the program made the error, and the web page loading will fail. If you get an error, don’t be surprised that you cannot get any more data to display until you reload the page.

Wednesday, September 16, 2015

How to Find Programming Errors Using HTML5 Builder

Most common programming errors are simple things like
  • forgetting a trailing semicolon
  • starting with a single quote and ending with a double (or the reverse)
  • forgetting a trailing } marker
  • forgetting to use an initial { marker in an if clause
  • mismatching catch blocks
  • etc.
HTML5 Builder highlights your code so you might spot such  errors if you look close enough.  But if you aren't looking at the correct line, you might miss the highlighting.

Most of Embarcardero's programming products have an auto-reformat function when you press Ctrl-D.  HTML5 Builder is not an exception.  It will try to beautify your source.  However, unlike Delphi, it will fail if you have a syntax error but won't tell you where the problem is.  That's frustrating and I hope it gets fixed.

There are a few solutions I've used. 
  1. Get a better PHP beautifier
  2. get a PHP LINT program.
  3. just be lazy, press F9, and wait for the PHP interpreter to complain about a particular line
 Erick
Doing PhoneGap Seriously

If you are serious about making a PhoneGap application, especially if you are using plugins, I recommend joining the google mailing list: phonegap@googlegroups.com

I joined in Digest mode, so I get one Email per day, which is certainly not a big increase in your daily commitment, and you will learn a lot. In particular, you will learn about incompatibilities, updates, and replacement options of popular plugins and of PhoneGap and the vendors.

For example:
  • Apple dropped 32-bit only apps from being able to sell in their store a few months ago. All iOS apps must be 32/64 bit universal apps.
  • The PhoneGap plugin in the HTML5 Builder product is ancient and should be updated..
  • Fields we thought we could rely on, like UUID, … well Apple and Google have made them either return nothing or a pseudo-UUID which is not the real one. They don’t want you to snoop on their users.
My book (on Amazon.com) shows how to build a PhoneGap app that stays current with ever-changing PhoneGap and related technolgoies.  If there are additional problems, let me know and I'll comment in my blog.

Monday, September 14, 2015

Making Mobile Apps With HTML5 Builder

I have written several mobile apps with HTML5 Builder and describe how to do this in my book, but today I just wanted to share some general information for those contemplating a mobile project.

I recommend against installing all the mobile toolkits.  Sure you can do it, and it’s cheaper to do so yourself, but you will need a Mac for iOS apps, a Windows VM or PC to do the HTML5 Builder work, and a lot of time to keep everything co-ordinated.

I found every time I wanted to do another build, something was updated and incompatible.  You need to keep up with the latest PhoneGap modules, the latest iOS toolkits (you can’t distribute 32-bit only iOS apps anymore like HTML5 Builder builds natively), the latest Android toolkits, etc.  And then there is the latest PlugIns.  It’s a nightmare.

Luckily Adobe offers a service to do almost all the work for you: http://build.phonegap.org   I do not receive any money from them, but I have been a paying customer for ages.  They charge $9.99 US per month, and for that sum they keep everything updated.  They also add Hydration to automatically update your test clients, and debugging features.  I think $10 per month is fair money for my sanity.

If you want to add a plugin, you just add a line of XML.  Wonderful.  This service lets you get back to coding and testing, not configuring.

So to those who slave over staying current, my hat is off to you, but I’ll take the fast lane.

Erick
HTML5 Builder Guy
Erick Engelke

A few days ago (September 2015) I released my new HTML5 Builder book on Amazon.com.  It is available at the Amazon US, GB and European web sites.   

I have spent several years writing the book describing techniques I created while writing quite a few real world applications.  Due to my experiences, I have included material on XML/REST, Database, dynamic control creation, and much more.  If you develop with HTML5 Builder, you will need this knowledge.

The HTML5 Builder application is available from Embarcadero.com as part of their excellent Delphi package.  It includes a WYSIWYG web editor and the RPCL open source libraries.  From my understanding, you are free to distribute the libraries in any way you wish: commercial, internal, open source, etc. 

While I appreciate that this bundling introduced us Delphi users to HTML5 Builder, I think the requirement to buy the other parts is a shame, because I think it would do well as a standalone product… with adequate documentation of course.

The main forum for discussion about HTML5 Builder is forums.embarcadero.com.  I try to answer some questions there, and I used general questions there to think of topics for my book, and now hopefully, for the second edition sometime in the future.

If you have any comments about my book or blog, please feel free to live a message here, or drop me a private Email at erickengelke@gmail.com.