Discussion:
[FreeMarker-user] Boolean formatting
Smerek, Martin
2013-04-16 13:35:58 UTC
Permalink
<html><body>Hi all,

Even though FAQ http://freemarker.sourceforge.net/docs/app_faq.html#faq_number_boolean_formatting says "Unlike numbers, booleans has no commonly accepted format, not even a common format within the same page.", there is commonly accepted format for Boolean in our app universe. Would it be possible to add configuration flag (in Configurable class) which would override current behavior (ending with an error) and allowed printing out Boolean directly according to specified boolean format? Would anyone else find this helpful?

Thanks,
Martin


NOTICE: This email and any attachments may contain confidential and proprietary information of NetSuite Inc. and is for the sole use of the intended recipient for the stated purpose. Any improper use or distribution is prohibited. If you are not the intended recipient, please notify the sender; do not review, copy or distribute; and promptly delete or destroy all transmitted information. Please note that all communications and information transmitted through this email system may be monitored by NetSuite or its agents and that all incoming email is automatically scanned by a third party spam and filtering service

</body></html>
Daniel Dekany
2013-04-17 20:31:13 UTC
Permalink
Post by Smerek, Martin
Hi all,
Even though FAQ
http://freemarker.sourceforge.net/docs/app_faq.html#faq_number_boolean_formatting
says "Unlike numbers, booleans has no commonly accepted format, not
even a common format within the same page.", there is commonly
accepted format for Boolean in our app universe.
For the common format, there's the "boolean_format" setting, however,
AFAIR, it still demands a ?string after the boolean, only you don't
have to add the format as parameter if the "boolean_format" was set. I
suppose that's your problem here. And I guess FM is overly strict
here, so maybe I should just allow this conversion without ?string, if
the "boolean_format" was set. I wonder if it's backward-compatible
though... probably it had to be yet another setting whose default only
changes with 2.4 or so.

OTOH... what the commonly accepted format is in your app? Because,
just like with numbers, there's the problem that the proper format
depends on the app-domain meaning of the boolean. Like for something
maybe it's yes/no, for something else it's on/off. Then it's just
another case that can be solved with ApplicationDomainTypeFormatter.
Post by Smerek, Martin
Would it be
possible to add configuration flag (in Configurable class) which
would override current behavior (ending with an error) and allowed
printing out Boolean directly according to specified boolean format?
Would anyone else find this helpful?
Thanks,
Martin
NOTICE: This email and any attachments may contain confidential and
proprietary information of NetSuite Inc. and is for the sole use of
the intended recipient for the stated purpose. Any improper use or
distribution is prohibited. If you are not the intended recipient,
please notify the sender; do not review, copy or distribute; and
promptly delete or destroy all transmitted information. Please note
that all communications and information transmitted through this
email system may be monitored by NetSuite or its agents and that all
incoming email is automatically scanned by a third party spam and filtering service.
--
Thanks,
Daniel Dekany
Smerek, Martin
2013-04-25 12:12:43 UTC
Permalink
<html><body>Hi Daniel,

Sorry for late response.

Our standard format is Yes/No (for English). You are right that we could solve this using ApplicationDomainTypeFormatter, however, we think that introducing such a setting might be beneficial for other FreeMarker users too.

Thank you very much,
Martin

-----Original Message-----
From: Daniel Dekany [mailto:***@freemail.hu]
Sent: Wednesday, April 17, 2013 10:31 PM
To: FreeMarker-user
Subject: Re: [FreeMarker-user] Boolean formatting
Post by Smerek, Martin
Hi all,
Even though FAQ
http://freemarker.sourceforge.net/docs/app_faq.html#faq_number_boolean
_formatting says "Unlike numbers, booleans has no commonly accepted
format, not even a common format within the same page.", there is
commonly accepted format for Boolean in our app universe.
For the common format, there's the "boolean_format" setting, however, AFAIR, it still demands a ?string after the boolean, only you don't have to add the format as parameter if the "boolean_format" was set. I suppose that's your problem here. And I guess FM is overly strict here, so maybe I should just allow this conversion without ?string, if the "boolean_format" was set. I wonder if it's backward-compatible though... probably it had to be yet another setting whose default only changes with 2.4 or so.

OTOH... what the commonly accepted format is in your app? Because, just like with numbers, there's the problem that the proper format depends on the app-domain meaning of the boolean. Like for something maybe it's yes/no, for something else it's on/off. Then it's just another case that can be solved with ApplicationDomainTypeFormatter.
Post by Smerek, Martin
Would it be
possible to add configuration flag (in Configurable class) which would
override current behavior (ending with an error) and allowed printing
out Boolean directly according to specified boolean format?
Would anyone else find this helpful?
Thanks,
Martin
NOTICE: This email and any attachments may contain confidential and
proprietary information of NetSuite Inc. and is for the sole use of
the intended recipient for the stated purpose. Any improper use or
distribution is prohibited. If you are not the intended recipient,
please notify the sender; do not review, copy or distribute; and
promptly delete or destroy all transmitted information. Please note
that all communications and information transmitted through this email
system may be monitored by NetSuite or its agents and that all
incoming email is automatically scanned by a third party spam and filtering service.
--
Thanks,
Daniel Dekany


------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
FreeMarker-user mailing list
FreeMarker-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freemarker-user


NOTICE: This email and any attachments may contain confidential and proprietary information of NetSuite Inc. and is for the sole use of the intended recipient for the stated purpose. Any improper use or distribution is prohibited. If you are not the intended recipient, please notify the sender; do not review, copy or distribute; and promptly delete or destroy all transmitted information. Please note that all communications and information transmitted through this email system may be monitored by NetSuite or its agents and that all incoming email is automatically scanned by a third party spam and filtering service

</body></html>
Smerek, Martin
2013-04-25 12:25:25 UTC
Permalink
<html><body>Hi Daniel,

One thing slipped my mind. If you use ApplicationDomainTypeFormatter, you will lose boolean format when you use the model in expressions, e.g. ${!transaction.isBillable} or ${transaction. isBillable && customer.isActive}. In these cases, having global Boolean format seems to be really beneficial.

Thanks,
Martin

-----Original Message-----
From: Smerek, Martin
Sent: Thursday, April 25, 2013 2:13 PM
To: FreeMarker-user
Subject: RE: [FreeMarker-user] Boolean formatting

Hi Daniel,

Sorry for late response.

Our standard format is Yes/No (for English). You are right that we could solve this using ApplicationDomainTypeFormatter, however, we think that introducing such a setting might be beneficial for other FreeMarker users too.

Thank you very much,
Martin

-----Original Message-----
From: Daniel Dekany [mailto:***@freemail.hu]
Sent: Wednesday, April 17, 2013 10:31 PM
To: FreeMarker-user
Subject: Re: [FreeMarker-user] Boolean formatting
Post by Smerek, Martin
Hi all,
Even though FAQ
http://freemarker.sourceforge.net/docs/app_faq.html#faq_number_boolean
_formatting says "Unlike numbers, booleans has no commonly accepted
format, not even a common format within the same page.", there is
commonly accepted format for Boolean in our app universe.
For the common format, there's the "boolean_format" setting, however, AFAIR, it still demands a ?string after the boolean, only you don't have to add the format as parameter if the "boolean_format" was set. I suppose that's your problem here. And I guess FM is overly strict here, so maybe I should just allow this conversion without ?string, if the "boolean_format" was set. I wonder if it's backward-compatible though... probably it had to be yet another setting whose default only changes with 2.4 or so.

OTOH... what the commonly accepted format is in your app? Because, just like with numbers, there's the problem that the proper format depends on the app-domain meaning of the boolean. Like for something maybe it's yes/no, for something else it's on/off. Then it's just another case that can be solved with ApplicationDomainTypeFormatter.
Post by Smerek, Martin
Would it be
possible to add configuration flag (in Configurable class) which would
override current behavior (ending with an error) and allowed printing
out Boolean directly according to specified boolean format?
Would anyone else find this helpful?
Thanks,
Martin
NOTICE: This email and any attachments may contain confidential and
proprietary information of NetSuite Inc. and is for the sole use of
the intended recipient for the stated purpose. Any improper use or
distribution is prohibited. If you are not the intended recipient,
please notify the sender; do not review, copy or distribute; and
promptly delete or destroy all transmitted information. Please note
that all communications and information transmitted through this email
system may be monitored by NetSuite or its agents and that all
incoming email is automatically scanned by a third party spam and filtering service.
--
Thanks,
Daniel Dekany


------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
FreeMarker-user mailing list
FreeMarker-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freemarker-user


NOTICE: This email and any attachments may contain confidential and proprietary information of NetSuite Inc. and is for the sole use of the intended recipient for the stated purpose. Any improper use or distribution is prohibited. If you are not the intended recipient, please notify the sender; do not review, copy or distribute; and promptly delete or destroy all transmitted information. Please note that all communications and information transmitted through this email system may be monitored by NetSuite or its agents and that all incoming email is automatically scanned by a third party spam and filtering service

</body></html>
Daniel Dekany
2013-04-27 15:17:37 UTC
Permalink
Just like in the case of numbers, the whole ApplicationDomainType
business works only if your data-model supports it. At least if those
values aren't all top-level values (in which case you can "cheat"),
you had to extend BeansWrapper (or DefaultObjectWrapper) so that it
will know which methods return what application-domain-type value.
That's why it will be seldom used if the template authors are, or
working with the application developers; you rather tell the template
authors to call this and that formatter methods for this and that kind
of values. But there are applications where the template authors are
end-users. So the application developers make an extra effort to add
this meta-information to the data-model one, and all the end-user will
automatically get the proper formatting. At least that's my idea
behind ApplicationDomainType.

As of the matter with booleans... ApplicationDomainType will
inevitably work for them, but ApplicationDomainType is not for
everyone (see above), while this boolean thing bugs everybody. So,
yes, I think I will add a setting to 2.3.20 which makes using ?string
optional after a boolean, as far as there was a default boolean format
specified. Until that, you have to write ${myBoolean?string}.

If all goes as planned (no natural disasters etc), 2.3.20 will be
released at the end of May.
--
Thanks,
Daniel Dekany
Post by Smerek, Martin
Hi Daniel,
One thing slipped my mind. If you use
ApplicationDomainTypeFormatter, you will lose boolean format when
you use the model in expressions, e.g. ${!transaction.isBillable} or
${transaction. isBillable && customer.isActive}. In these cases,
having global Boolean format seems to be really beneficial.
Thanks,
Martin
-----Original Message-----
From: Smerek, Martin
Sent: Thursday, April 25, 2013 2:13 PM
To: FreeMarker-user
Subject: RE: [FreeMarker-user] Boolean formatting
Hi Daniel,
Sorry for late response.
Our standard format is Yes/No (for English). You are right that we
could solve this using ApplicationDomainTypeFormatter, however, we
think that introducing such a setting might be beneficial for other FreeMarker users too.
Thank you very much,
Martin
-----Original Message-----
Sent: Wednesday, April 17, 2013 10:31 PM
To: FreeMarker-user
Subject: Re: [FreeMarker-user] Boolean formatting
Post by Smerek, Martin
Hi all,
Even though FAQ
http://freemarker.sourceforge.net/docs/app_faq.html#faq_number_boolean
_formatting says "Unlike numbers, booleans has no commonly accepted
format, not even a common format within the same page.", there is
commonly accepted format for Boolean in our app universe.
For the common format, there's the "boolean_format" setting,
however, AFAIR, it still demands a ?string after the boolean, only
you don't have to add the format as parameter if the
"boolean_format" was set. I suppose that's your problem here. And I
guess FM is overly strict here, so maybe I should just allow this
conversion without ?string, if the "boolean_format" was set. I
wonder if it's backward-compatible though... probably it had to be
yet another setting whose default only changes with 2.4 or so.
OTOH... what the commonly accepted format is in your app? Because,
just like with numbers, there's the problem that the proper format
depends on the app-domain meaning of the boolean. Like for something
maybe it's yes/no, for something else it's on/off. Then it's just
another case that can be solved with ApplicationDomainTypeFormatter.
Post by Smerek, Martin
Would it be
possible to add configuration flag (in Configurable class) which would
override current behavior (ending with an error) and allowed printing
out Boolean directly according to specified boolean format?
Would anyone else find this helpful?
Thanks,
Martin
NOTICE: This email and any attachments may contain confidential and
proprietary information of NetSuite Inc. and is for the sole use of
the intended recipient for the stated purpose. Any improper use or
distribution is prohibited. If you are not the intended recipient,
please notify the sender; do not review, copy or distribute; and
promptly delete or destroy all transmitted information. Please note
that all communications and information transmitted through this email
system may be monitored by NetSuite or its agents and that all
incoming email is automatically scanned by a third party spam and filtering service.
--
Thanks,
Daniel Dekany
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for
building apps and a phenomenal toolset for data science. Developers
can use our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
FreeMarker-user mailing list
https://lists.sourceforge.net/lists/listinfo/freemarker-user
NOTICE: This email and any attachments may contain confidential and
proprietary information of NetSuite Inc. and is for the sole use of
the intended recipient for the stated purpose. Any improper use or
distribution is prohibited. If you are not the intended recipient,
please notify the sender; do not review, copy or distribute; and
promptly delete or destroy all transmitted information. Please note
that all communications and information transmitted through this
email system may be monitored by NetSuite or its agents and that all
incoming email is automatically scanned by a third party spam and filtering service.
Smerek, Martin
2013-04-29 15:40:25 UTC
Permalink
<html><body>Hi Daniel,

Thanks for the explanation. Looking forward to 2.3.20.

Regards,
Martin Smerek

-----Original Message-----
From: Daniel Dekany [mailto:***@freemail.hu]
Sent: Saturday, April 27, 2013 5:18 PM
To: Smerek, Martin
Cc: 'FreeMarker-user'
Subject: Re: [FreeMarker-user] Boolean formatting

Just like in the case of numbers, the whole ApplicationDomainType business works only if your data-model supports it. At least if those values aren't all top-level values (in which case you can "cheat"), you had to extend BeansWrapper (or DefaultObjectWrapper) so that it will know which methods return what application-domain-type value.
That's why it will be seldom used if the template authors are, or working with the application developers; you rather tell the template authors to call this and that formatter methods for this and that kind of values. But there are applications where the template authors are end-users. So the application developers make an extra effort to add this meta-information to the data-model one, and all the end-user will automatically get the proper formatting. At least that's my idea behind ApplicationDomainType.

As of the matter with booleans... ApplicationDomainType will inevitably work for them, but ApplicationDomainType is not for everyone (see above), while this boolean thing bugs everybody. So, yes, I think I will add a setting to 2.3.20 which makes using ?string optional after a boolean, as far as there was a default boolean format specified. Until that, you have to write ${myBoolean?string}.

If all goes as planned (no natural disasters etc), 2.3.20 will be released at the end of May.

--
Thanks,
Daniel Dekany
Post by Smerek, Martin
Hi Daniel,
One thing slipped my mind. If you use
ApplicationDomainTypeFormatter, you will lose boolean format when
you use the model in expressions, e.g. ${!transaction.isBillable} or
${transaction. isBillable && customer.isActive}. In these cases,
having global Boolean format seems to be really beneficial.
Thanks,
Martin
-----Original Message-----
From: Smerek, Martin
Sent: Thursday, April 25, 2013 2:13 PM
To: FreeMarker-user
Subject: RE: [FreeMarker-user] Boolean formatting
Hi Daniel,
Sorry for late response.
Our standard format is Yes/No (for English). You are right that we
could solve this using ApplicationDomainTypeFormatter, however, we
think that introducing such a setting might be beneficial for other FreeMarker users too.
Thank you very much,
Martin
-----Original Message-----
Sent: Wednesday, April 17, 2013 10:31 PM
To: FreeMarker-user
Subject: Re: [FreeMarker-user] Boolean formatting
Post by Smerek, Martin
Hi all,
Even though FAQ
http://freemarker.sourceforge.net/docs/app_faq.html#faq_number_boolean
_formatting says "Unlike numbers, booleans has no commonly accepted
format, not even a common format within the same page.", there is
commonly accepted format for Boolean in our app universe.
For the common format, there's the "boolean_format" setting,
however, AFAIR, it still demands a ?string after the boolean, only
you don't have to add the format as parameter if the
"boolean_format" was set. I suppose that's your problem here. And I
guess FM is overly strict here, so maybe I should just allow this
conversion without ?string, if the "boolean_format" was set. I
wonder if it's backward-compatible though... probably it had to be
yet another setting whose default only changes with 2.4 or so.
OTOH... what the commonly accepted format is in your app? Because,
just like with numbers, there's the problem that the proper format
depends on the app-domain meaning of the boolean. Like for something
maybe it's yes/no, for something else it's on/off. Then it's just
another case that can be solved with ApplicationDomainTypeFormatter.
Post by Smerek, Martin
Would it be
possible to add configuration flag (in Configurable class) which would
override current behavior (ending with an error) and allowed printing
out Boolean directly according to specified boolean format?
Would anyone else find this helpful?
Thanks,
Martin
NOTICE: This email and any attachments may contain confidential and
proprietary information of NetSuite Inc. and is for the sole use of
the intended recipient for the stated purpose. Any improper use or
distribution is prohibited. If you are not the intended recipient,
please notify the sender; do not review, copy or distribute; and
promptly delete or destroy all transmitted information. Please note
that all communications and information transmitted through this email
system may be monitored by NetSuite or its agents and that all
incoming email is automatically scanned by a third party spam and filtering service.
--
Thanks,
Daniel Dekany
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for
building apps and a phenomenal toolset for data science. Developers
can use our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
FreeMarker-user mailing list
https://lists.sourceforge.net/lists/listinfo/freemarker-user
NOTICE: This email and any attachments may contain confidential and
proprietary information of NetSuite Inc. and is for the sole use of
the intended recipient for the stated purpose. Any improper use or
distribution is prohibited. If you are not the intended recipient,
please notify the sender; do not review, copy or distribute; and
promptly delete or destroy all transmitted information. Please note
that all communications and information transmitted through this
email system may be monitored by NetSuite or its agents and that all
incoming email is automatically scanned by a third party spam and filtering service.
NOTICE: This email and any attachments may contain confidential and proprietary information of NetSuite Inc. and is for the sole use of the intended recipient for the stated purpose. Any improper use or distribution is prohibited. If you are not the intended recipient, please notify the sender; do not review, copy or distribute; and promptly delete or destroy all transmitted information. Please note that all communications and information transmitted through this email system may be monitored by NetSuite or its agents and that all incoming email is automatically scanned by a third party spam and filtering service

</body></html>
Daniel Dekany
2013-05-27 10:49:33 UTC
Permalink
Post by Daniel Dekany
If all goes as planned (no natural disasters etc), 2.3.20 will be
released at the end of May.
2.3.20 it will be possibly released when planned, but boolean
formatting and the ApplicationDomainType (and #p) will have to wait
until a later release. These things all interact with how formatting
in general should be re-designed (regardless of these features), and
that's a bigger work. But it's not like I will sit on the issue for
months. 2.3.21 is to be expected in a few weeks.
--
Thanks,
Daniel Dekany
Continue reading on narkive:
Loading...