You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@freemarker.apache.org by Siegfried Goeschl <si...@gmail.com> on 2019/11/17 18:02:39 UTC

Apache FreeMarker - Sharing Is Caring ...

Hi folks,

since I'm currently mostly busy with non-coding tasks I spent some time honing my coding skills - probably to no avail as my colleagues would say ;-)

1) I migrated my pet project "freemarker-cli" from Groovy to JDK 8 (see https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli>)

2) At https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc> you find a presentation I gave some while ago

3) I also wrote a Spring Boot FreeMarker sample project as part of the presentation (see https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>)

My plans / questions

I would be awesome if I could get some feedback about "freemarker-cli" in its current JDK incarnation :-) Later on I will release 2.0.0 and push it to Maven Central.

In the mean time I wrote three applications (micro services in new speak) using Apache FreeMarker and found it hard to find a starting point for a Spring Boot applications - therefore I wrote the sample project (see above). One way or the other a Spring Boot (and Micronaut) blue print should find its way into Apache FreeMarker officially. I think Apache FreeMarker is awesome for adding a developer UI to some micro service but developers don't care about the template engine but only about a quick and painless way to get the job done ...

Anyone volunteering to give a presentation about Apache Freemarker at ApacheCon? I could do but I'm not really qualified :-)

Thanks in advance, 

Siegfried Goeschl



Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Siegfried Goeschl <si...@gmail.com>.
Hi Daniel

Some thoughts along the line

* I found having "documents[]" and "Documents" a bit confusing
* I want to minimise the number of top-level objects in the data model
* Documents gives you array access and wildcard search
* The documents have exactly the same order as specified on the command line
* There are use cases where you have documents at all but only a template, e.g creating configuration files in the cloud which rely on environment variables
* I merged dozen of property files into a single CSV

Thanks in advance, 

Siegfried Goeschl


> On 23.12.2019, at 22:49, Daniel Dekany <da...@gmail.com> wrote:
> 
> Looks great from the change log!
> 
> But, one thing I find to be odd is "Do not use documents[0] as top-level
> variable - use Documents.get(0) instead ". I have already found loading
> data a bit too hard to read (not utilizing what FreeMarker can do), but I
> didn't come up with a concrete proposal for doing it otherwise, so I let it
> be in previous discussion. But why not even documents[0]? That's really a
> common idiom, even outside FreeMarker.
> 
> Another thing with documents. I guess in most use cases you expect exactly
> one document. So I think I would introduce a "document" variable, which
> fails on reading if there's not exactly one document. Therefore the
> template states clearly if expects one document, or multiple documents. The
> main problem with documents[0] (and now Documents.get(0)) is that it will
> not fail there are multiple documents. If the template is not prepared for
> multiple documents, that will certainly mean that it will silently pick a
> practically random document from the many, and you may don't realize that
> (as there's no error), and will use a wrong output therefore. (Actually,
> having 0 matches where you expect multiple documents is also suspicious,
> but is a less clear case.)
> 
> On Mon, Dec 23, 2019 at 4:46 PM Siegfried Goeschl <
> siegfried.goeschl@gmail.com> wrote:
> 
>> Hi folks,
>> 
>> Following the discussion (see below) I released
>> https://github.com/sgoeschl/freemarker-cli/releases/tag/v2.0.0-BETA-5
>> 
>> * The available tools are loaded from "freemarker-cli.properties" and
>> support user-supplied tools
>> * Apache POI / Excel integration supports getting to raw tables containing
>> the closest matching Java type (works but needs field testing)
>> * Falling back to "en_US" if no locale is provided on the command line
>> 
>> 
>> Thanks in advance,
>> 
>> Siegfried Goeschl
>> 
>> 
>> Release Notes
>> ============================================
>> 
>> Added
>> 
>> * Support interactive mode (-i or --interactive) to supply FreeMarker
>> templates on the command line
>> * UUIDTool to create random and named UUIDs
>> * ExcelTool returns raw table consisting of the underlying Java data type
>> * Document#getUnsafeInputStream to get a input stream which needs to be
>> closed by the caller
>> * CSVTool allows parsing plain string CSV
>> * Tools are loaded from freemarker-cli.properties and freely configurable
>> * Add RAT & PMD report to Maven site generation
>> * Add -times command line option to execute the transformation N times
>> 
>> Changed
>> 
>> * Renamed ExcelTool#parseSheet to ExcelTool#toTable
>> * Removed various Tool constructors taking Settings
>> * Do not use documents[0] as top-level variable - use Documents.get(0)
>> instead
>> * Available CSV formats are exposed using the CSVTool and not the global
>> data model
>> * Expose user-supplied system properties as top-level variables when using
>> -E
>> * Keep track of all Closables created & handed out to FreeMarker template
>> rendering
>> * Move ObjectConstructor, Statics and Enums into FreeMarkerTool
>> 
>> Deleted
>> 
>> * Environment & SystemProperties were deleted and the functionality moved
>> to SystemTool
>> * All DataModel classes were deleted
>> 
>> 
>>> On 19.12.2019, at 14:35, Woonsan Ko <wo...@apache.org> wrote:
>>> 
>>> Sounds good! :-)
>>> If we communicate well to each other explaining different use cases,
>>> then we can improve it together in this community. I believe everybody
>>> here is open to any new improvements for the community even if some
>>> features are not relevant to themselves. That's why we join the ASF.
>>> ;-)
>>> 
>>> Cheers,
>>> 
>>> Woonsan
>>> 
>>> On Thu, Dec 19, 2019 at 6:38 AM Siegfried Goeschl
>>> <si...@gmail.com> wrote:
>>>> 
>>>> Hi folks,
>>>> 
>>>> I’m okay with the things :-)
>>>> 
>>>> Thanks in advance,
>>>> 
>>>> Siegfried Goeschl
>>>> 
>>>> 
>>>>> On 18 Dec 2019, at 20:38, Daniel Dekany <da...@gmail.com>
>> wrote:
>>>>> 
>>>>> Yes, these can done after V1 or whatever. But it's still important if
>>>>> Siegfried will be OK with such things, or will lose motivation because
>> it's
>>>>> not how he likes his own kid. More code without more developers
>> probably
>>>>> won't work out well, given how little developer time even FM core gets.
>>>>> 
>>>>> As of nested output files, I agree (and BTW, FMPP also have a nested
>> output
>>>>> directive, not just starting a new). I also understand that it breaks
>> the
>>>>> clean mental model, but if (if...) this is what's reasonably often
>> needed
>>>>> in reality, then certainly the mental model should bend.
>>>>> 
>>>>> On Wed, Dec 18, 2019 at 8:01 PM Woonsan Ko <wo...@apache.org> wrote:
>>>>> 
>>>>>> On Wed, Dec 18, 2019 at 11:23 AM Siegfried Goeschl
>>>>>> <si...@gmail.com> wrote:
>>>>>>> 
>>>>>>> Hi Daniel,
>>>>>>> 
>>>>>>> please see my comments below …
>>>>>>> 
>>>>>>> Thanks in advance,
>>>>>>> 
>>>>>>> Siegfried Goeschl
>>>>>>> 
>>>>>>> 
>>>>>>>> On 18 Dec 2019, at 16:58, Daniel Dekany <da...@gmail.com>
>>>>>> wrote:
>>>>>>>> 
>>>>>>>> Multiple output files: How open are you to the idea if someone else
>>>>>> wants
>>>>>>>> to add that though? The use-case is when it's input data that drives
>>>>>> what
>>>>>>>> output files you will have (as in my example with the employees),
>> and
>>>>>>>> working that around with multiple invocations is not very nice.
>>>>>>>> 
>>>>>>> 
>>>>>>> Suggestive question - it is an Open Source project after all :-)
>>>>>>> 
>>>>>>> * As long as it is hosted on my GitHub repo I can ultimately reject
>> PRs
>>>>>> if I’m really unhappy about them but repos can be forked
>>>>>>> * If it becomes part of Apache FreeMarker project than there are more
>>>>>> qualified developers out there to make a decision
>>>>>>> 
>>>>>>> Regarding the implementation
>>>>>>> 
>>>>>>> * Multiple output files violates my my mental model since you can’t
>> use
>>>>>> stdout any longer
>>>>>>> * It could break the CommonsCSV integration since I’m using
>> CSVPrinter
>>>>>> sitting on FreeMarker’s output stream (which changes when using
>> multiple
>>>>>> output files)
>>>>>>> * Last but not least I have not enough experience / requirements to
>> come
>>>>>> up with a useful implementation from the scratch
>>>>>> 
>>>>>> In my head, we may introduce a new directive to specify a different
>>>>>> output for the nested things, instead of the _default_ STDOUT, in the
>>>>>> future. For example,
>>>>>> 
>>>>>> hello,
>>>>>> <#output file="another.csv">
>>>>>> something else...
>>>>>> </#output>
>>>>>> world!
>>>>>> 
>>>>>> So, by default "hello,\nworld!" to STDOUT, "something else..." to the
>>>>>> extra file.
>>>>>> This seems better to me than "changing output and closing the current
>>>>>> output" approach in FMPP.
>>>>>> 
>>>>>> But this improvement can be done together once Siegfried _donates_ his
>>>>>> project to Apache FreeMarker. ;-)
>>>>>> 
>>>>>>> 
>>>>>>>> Default locale:
>>>>>>>> And also default charset to UTF-8, if that wasn't done.
>>>>>>> 
>>>>>>> UTF-8 is the default
>>>>>>> 
>>>>>>>> 
>>>>>>>> JDBC drivers: There was some discussion of how to add user defined
>>>>>> classes
>>>>>>>> to the tool earlier. Well, I guess it's about the same as you add
>> your
>>>>>> own
>>>>>>>> jar-s to the classpath too, so, it shouldn't be a big deal. That
>> could
>>>>>>>> solve this side of the JDBC problem as well. As of storing
>> credentials,
>>>>>>>> that has to be solved when using external tools as well... but my
>>>>>> practical
>>>>>>>> experience is that people just put them in to a config file as plain
>>>>>> text
>>>>>>>> (maybe on a drive that has to be mounted with password first), or
>> bind
>>>>>> it
>>>>>>>> to the OS user.
>>>>>>> 
>>>>>>> The problem is more subtle - I want to provide a well-behaved command
>>>>>> line tool
>>>>>>> 
>>>>>>> * What happens if you update the freemarker-cli installation on your
>> box?
>>>>>>> * How do you easily distinguish between your custom JARs and the
>>>>>> initially installed ones?
>>>>>>> * How does it look like if you install freemarker-cli with package
>>>>>> managers, e.g. brew?
>>>>>> 
>>>>>> I guess it should be fine as an initial version even if there's no
>>>>>> separation between system libs and custom libs (such as JDBC drivers).
>>>>>> If there's a tool for easy JDBC access, it would be nice in practices.
>>>>>> I don't think it should be perfect from V1.
>>>>>> 
>>>>>> Regards,
>>>>>> 
>>>>>> Woonsan
>>>>>> 
>>>>>>> 
>>>>>>> Current state
>>>>>>> 
>>>>>>> * Custom tools can be instantiated using the
>> freemarker-cli-properties
>>>>>>> * For the templates I use ~/.freemarker-cli directory to have a clean
>>>>>> separation
>>>>>>> * There is no really nice solution for JARs - I might tweak the Maven
>>>>>> plugin creating the Unix & Windows wrappers - you can already create
>> an
>>>>>> “endorsed” directory there to place custom JARs
>>>>>>> 
>>>>>>>> 
>>>>>>>> Yes, Spring support is definitely important, given the omnipresence
>> of
>>>>>>>> Spring. It's not just web pages there, but e-mail templates
>>>>>> (especially as
>>>>>>>> there modern the UI technologies that has taken over at most places,
>>>>>> aren't
>>>>>>>> applicable). Would be good if someone can take ownership of that
>>>>>> aspect for
>>>>>>>> FreeMarker 2, probably using what was done in FM3. (Or maybe the
>> same
>>>>>>>> resources are better redirected to pushing FM3... who knows. There
>> are
>>>>>>>> really no resources to push two branches in parallel.)
>>>>>>>> 
>>>>>>>> On Wed, Dec 18, 2019 at 2:02 PM Siegfried Goeschl <
>>>>>>>> siegfried.goeschl@gmail.com <ma...@gmail.com>>
>>>>>> wrote:
>>>>>>>> 
>>>>>>>>> Hi Daniel,
>>>>>>>>> 
>>>>>>>>> try to write a top-level post to keep the discussion readable
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Ad Multi-file Output
>>>>>>>>> ===============================================================
>>>>>>>>> 
>>>>>>>>> Currently no plans to implement it - I personally don’t have a need
>>>>>> for it
>>>>>>>>> and it is a hypothetical requirement for now
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Ad POI Integration
>>>>>>>>> ===============================================================
>>>>>>>>> 
>>>>>>>>> No problem in exposing the non-String data - it is a good idea and
>>>>>> will be
>>>>>>>>> implemented
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Ad Default Locale
>>>>>>>>> ===============================================================
>>>>>>>>> 
>>>>>>>>> * I need to define a locale for the unit tests
>>>>>>>>> * I guess it is a good idea to pin it to “en_US” to avoid suprises
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Ad JDBC Access
>>>>>>>>> ===============================================================
>>>>>>>>> 
>>>>>>>>> It is part of a wider problem - when leaving the document-centric
>>>>>> approach
>>>>>>>>> into scripting there is a lot of useful functionality, e.g. JDBC
>> and
>>>>>> HTTP
>>>>>>>>> clients.
>>>>>>>>> 
>>>>>>>>> The problems
>>>>>>>>> 
>>>>>>>>> * JDBC: You need to add JDBC drivers, where to store the
>> credentials,
>>>>>>>>> database schema, ...
>>>>>>>>> * HTTP: More libraries, certificates, proxy support,...
>>>>>>>>> 
>>>>>>>>> It is possible to implement something but it will never work
>> properly
>>>>>> so I
>>>>>>>>> decided to tackle the problem differently b using commons-exec
>>>>>>>>> 
>>>>>>>>> * REST calls can be easily made by invoking cURL
>>>>>>>>> * Database command line clients can export the result of a SELECT
>>>>>> query to
>>>>>>>>> a CSV file
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Ad Templates aren't used much for Web UI-s anymore
>>>>>>>>> ===============================================================
>>>>>>>>> 
>>>>>>>>> Yes and no - IMHO it is quite useful to embed a UI into certain
>> "micro
>>>>>>>>> services”. Therefore I think that a ready-to-use Spring Boot (&
>>>>>> Micronaut,
>>>>>>>>> etc..) integration is important and should not be an afterthought.
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Thanks in advance,
>>>>>>>>> 
>>>>>>>>> Siegfried Goeschl
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>> On 18 Dec 2019, at 01:32, Daniel Dekany <da...@gmail.com>
>>>>>> wrote:
>>>>>>>>>> 
>>>>>>>>>> Hi,
>>>>>>>>>> 
>>>>>>>>>> Find my comments inline below.
>>>>>>>>>> 
>>>>>>>>>> On Tue, Dec 17, 2019 at 10:46 PM Siegfried Goeschl <
>>>>>>>>>> siegfried.goeschl@gmail.com <ma...@gmail.com>
>>>>>> <mailto:siegfried.goeschl@gmail.com <mailto:
>> siegfried.goeschl@gmail.com>>>
>>>>>> wrote:
>>>>>>>>>> 
>>>>>>>>>>> Hi Daniel,
>>>>>>>>>>> 
>>>>>>>>>>> Thanks for spending your time - feed back is always appreciated
>> when
>>>>>>>>> doing
>>>>>>>>>>> things in isolation ....
>>>>>>>>>>> 
>>>>>>>>>>> Please see my comments below
>>>>>>>>>>> 
>>>>>>>>>>> Thanks in advance,
>>>>>>>>>>> 
>>>>>>>>>>> Siegfried Goeschl
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>>> On 17.12.2019, at 19:19, Daniel Dekany <daniel.dekany@gmail.com
>>>>>> <ma...@gmail.com>>
>>>>>>>>> wrote:
>>>>>>>>>>>> 
>>>>>>>>>>>> Hi Siegfried,
>>>>>>>>>>>> 
>>>>>>>>>>>> Looks good!
>>>>>>>>>>>> 
>>>>>>>>>>>> Some random things I happened to notice:
>>>>>>>>>>>> 
>>>>>>>>>>>> - The ability generating multiple output files from the same
>>>>>> template
>>>>>>>>>>>> would be worthy addition. Like you load a CSV file that has
>>>>>> employees
>>>>>>>>>>> in
>>>>>>>>>>>> it, and based on that you generate one output file per
>> department.
>>>>>> Or
>>>>>>>>>>> even
>>>>>>>>>>>> one per employee. (There could directives for that, like
>>>>>>>>>>> changeOutputFile,
>>>>>>>>>>>> nestOutputFile, etc. on
>>>>>>>>> http://fmpp.sourceforge.net/pphash.html#sect17 <
>>>>>> http://fmpp.sourceforge.net/pphash.html#sect17>
>>>>>>>>>>> <http://fmpp.sourceforge.net/pphash.html#sect17 <
>>>>>> http://fmpp.sourceforge.net/pphash.html#sect17> <
>>>>>>>>> http://fmpp.sourceforge.net/pphash.html#sect17 <
>>>>>> http://fmpp.sourceforge.net/pphash.html#sect17>>>)
>>>>>>>>>>> 
>>>>>>>>>>> Well, I simply don't need it and it complicates things - in
>> simple
>>>>>> cases
>>>>>>>>>>> one could just re-run the freemarker-cli with a different
>> template
>>>>>>>>> and/or
>>>>>>>>>>> parameters
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> My feeling is that if there's a tool that's about transforming
>> some
>>>>>> files
>>>>>>>>>> to other files, but the idea that a single invocation can yield
>>>>>> multiple
>>>>>>>>>> output files is not part of it, one way or another (i.e., not
>>>>>> necessarily
>>>>>>>>>> in the way it was in FMPP), it might turns out to be a limiting
>>>>>> design
>>>>>>>>>> decision later as feature request start to pour in. And then it
>> can
>>>>>> be
>>>>>>>>> hard
>>>>>>>>>> to add as an afterthought. Well, maybe I'm wrong, as I have no
>>>>>> statics
>>>>>>>>>> about how often it's needed. FMPP users did use it (myself
>> included),
>>>>>>>>> some
>>>>>>>>>> of them at least.
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>>> - When I load an XLSX, I get back values as string, not as
>>>>>> numbers, or
>>>>>>>>>>>> dates. I'm not sure how hard it is to solve though (I don't
>>>>>> remember
>>>>>>>>>>> POI
>>>>>>>>>>>> much).
>>>>>>>>>>> 
>>>>>>>>>>> That should not be too hard - I actually use
>>>>>>>>>>> org.apache.poi.ss.usermodel.DataFormatter to create the strings
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> If templates get numbers etc., or have a such choice at least,
>> then
>>>>>> they
>>>>>>>>>> can compare numbers, filter based on their values, control the
>>>>>>>>> formatting,
>>>>>>>>>> etc. My idea here is that an Excel file, CSV file, whatever, is
>> just
>>>>>> a
>>>>>>>>> pure
>>>>>>>>>> data, and rendering/formatting is the duty of the templates.
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>>> BTW, the strings I get back are formatted with the locale of the
>>>>>> OS,
>>>>>>>>>>> 
>>>>>>>>>>> which is a problem. I guess there should be an config option to
>> set
>>>>>> the
>>>>>>>>>>> JVM
>>>>>>>>>>>> locale. (The ExcelToolTest fails on my computer with locale
>> hu_HU
>>>>>> for
>>>>>>>>>>>> somewhat similar reason, as it gets "100,00" instead of
>> "100.00".)
>>>>>>>>>>> 
>>>>>>>>>>> On the command line you can use
>>>>>>>>>>> 
>>>>>>>>>>> -l, --locale=<locale>     Locale being used for output file, e.g.
>>>>>>>>> 'en_US'
>>>>>>>>>>> 
>>>>>>>>>>> but I guess I should provide a fixed locale for the unit tests
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> The problem is not how FreeMarker renders the numbers. It already
>>>>>> gets
>>>>>>>>>> strings like that from POI, and --locale doesn't influence POI.
>>>>>>>>>> 
>>>>>>>>>> As of the default locale, for these kind of tools, I believe that
>>>>>> using
>>>>>>>>>> system defaults is usually evil. So having a fixed default is
>> maybe
>>>>>> not
>>>>>>>>>> just for unit tests. The locale of my computer, or wherever I run
>> a
>>>>>> job
>>>>>>>>> on
>>>>>>>>>> (often some backend linux box) should be usually irrelevant, and
>> not
>>>>>>>>>> influence the output. Not to mention when team mates share the
>>>>>> project,
>>>>>>>>> in
>>>>>>>>>> an international team.
>>>>>>>>>> 
>>>>>>>>>>> - Querying from relation databases (JDBC) would be probably an
>>>>>> useful
>>>>>>>>>>>> addition (it doesn't fit the Document paradigm though).
>>>>>>>>>>> 
>>>>>>>>>>> I integrated commons-exec and triggered AWS CLI - basically you
>>>>>> capture
>>>>>>>>>>> the output of any command-line invocation and process it. Just
>> need
>>>>>> to
>>>>>>>>> make
>>>>>>>>>>> sure that every tool supports processing raw strings ...
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> I'm note sure what do you mean. The result of a query is a
>> structured
>>>>>>>>> data,
>>>>>>>>>> with column names and non-string types, so I guess command-line
>>>>>>>>> invocation
>>>>>>>>>> can't solve that too well.
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>>> It would be good if there's some de-facto tool for these kind of
>>>>>> things
>>>>>>>>>>>> than what freemarker-cli does. I guess there's a few such tools
>> in
>>>>>>>>>>> company
>>>>>>>>>>>> repos, but of course those have no potential to become more
>>>>>> generic and
>>>>>>>>>>>> being published. (freemarker-generator was a such toll though,
>> but
>>>>>> it
>>>>>>>>>>>> didn't go anywhere after donation. Actually, FMPP was a such
>> tool
>>>>>> too,
>>>>>>>>>>> that
>>>>>>>>>>>> I used for some sysadmin/webadmin tasks some 15+ years ago.)
>> But of
>>>>>>>>>>> course,
>>>>>>>>>>>> long term care is the tricky issue with any project that has no
>>>>>> company
>>>>>>>>>>>> truly behind it (i.e., no payed developers). Do you have you
>> have
>>>>>> any
>>>>>>>>>>>> thoughts/plans regarding the longer term life of freemarker-cli?
>>>>>>>>>>> 
>>>>>>>>>>> I worked on a couple of not soo successful Open Source projects -
>>>>>> yes,
>>>>>>>>> it
>>>>>>>>>>> might become another Open Source GitHub project nobody knows /
>>>>>> cares :-)
>>>>>>>>>>> 
>>>>>>>>>>> Having said that
>>>>>>>>>>> 
>>>>>>>>>>> * I'm maintaining it already for a few of years and I will always
>>>>>> find
>>>>>>>>>>> some things I can do with it
>>>>>>>>>>> * It is useful for some common tasks when you have a Java
>> background
>>>>>>>>>>> * I think it is a great way to re-use or build up FreeMarker
>>>>>> knowledge
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> And, I would add, templates aren't used much for Web UI-s
>> anymore, so
>>>>>>>>> these
>>>>>>>>>> alternate use cases become the main ones.
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>> * And it should become part of the Apache Freemarker project -
>> much
>>>>>>>>> better
>>>>>>>>>>> visibility & broader user base
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> Yeah, the last point is what I'm going for really. But that's also
>>>>>> why I
>>>>>>>>>> hope that you feel like making it more general. Or at least has no
>>>>>>>>> negative
>>>>>>>>>> feelings about it.
>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>>> Also, some things that you miss for FreeMarker itself for it to
>> be
>>>>>> more
>>>>>>>>>>>> fitting for the task?
>>>>>>>>>>> 
>>>>>>>>>>> Support for Java 8 Date/Time API - last time I looked at it it
>> was
>>>>>> not
>>>>>>>>>>> supported by FreeMarker and it's a bummer since nobody is using
>>>>>> Date any
>>>>>>>>>>> longer ...
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> Yeah... it still isn't. It's probably among the new few things to
>>>>>> add at
>>>>>>>>>> this point, as it's long due.
>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> On Sun, Nov 17, 2019 at 7:02 PM Siegfried Goeschl <
>>>>>>>>>>>> siegfried.goeschl@gmail.com <mailto:siegfried.goeschl@gmail.com
>>> 
>>>>>> <mailto:siegfried.goeschl@gmail.com <mailto:
>> siegfried.goeschl@gmail.com>>
>>>>>>>>> <mailto:siegfried.goeschl@gmail.com <mailto:
>>>>>> siegfried.goeschl@gmail.com> <mailto:siegfried.goeschl@gmail.com
>> <mailto:
>>>>>> siegfried.goeschl@gmail.com>>>>
>>>>>>>>> wrote:
>>>>>>>>>>>> 
>>>>>>>>>>>>> Hi folks,
>>>>>>>>>>>>> 
>>>>>>>>>>>>> since I'm currently mostly busy with non-coding tasks I spent
>> some
>>>>>>>>> time
>>>>>>>>>>>>> honing my coding skills - probably to no avail as my colleagues
>>>>>> would
>>>>>>>>>>> say
>>>>>>>>>>>>> ;-)
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 1) I migrated my pet project "freemarker-cli" from Groovy to
>> JDK 8
>>>>>>>>> (see
>>>>>>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>>>>>> https://github.com/sgoeschl/freemarker-cli> <
>>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>>>>>> https://github.com/sgoeschl/freemarker-cli>> <
>>>>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>>>>>> https://github.com/sgoeschl/freemarker-cli> <
>>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>>>>>> https://github.com/sgoeschl/freemarker-cli>>> <
>>>>>>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>>>>>> https://github.com/sgoeschl/freemarker-cli> <
>>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>>>>>> https://github.com/sgoeschl/freemarker-cli>> <
>>>>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>>>>>> https://github.com/sgoeschl/freemarker-cli> <
>>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>>>>>> https://github.com/sgoeschl/freemarker-cli>>>>)
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 2) At
>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>> <
>>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>>> 
>>>>>>>>> <
>>>>>>>>> 
>>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>> <
>>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>> <
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>> <
>>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>>> 
>>>>>>>>> <
>>>>>>>>> 
>>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>> <
>>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>>> <
>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>>>>> <
>>>>>>>>> 
>>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>>>>>> 
>>>>>>>>>>> <
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>>>>> <
>>>>>>>>> 
>>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> you find a presentation I gave some while ago
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 3) I also wrote a Spring Boot FreeMarker sample project as part
>>>>>> of the
>>>>>>>>>>>>> presentation (see
>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>> <
>>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>>> 
>>>>>>>>> <
>>>>>>>>> 
>>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>> <
>>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>> <
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>> <
>>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>>> 
>>>>>>>>> <
>>>>>>>>> 
>>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>> <
>>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>>> <
>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>>>>> <
>>>>>>>>> 
>>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>>>>>> 
>>>>>>>>>>> <
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>>>>> <
>>>>>>>>> 
>>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>>>> )
>>>>>>>>>>>>> 
>>>>>>>>>>>>> My plans / questions
>>>>>>>>>>>>> 
>>>>>>>>>>>>> I would be awesome if I could get some feedback about
>>>>>> "freemarker-cli"
>>>>>>>>>>> in
>>>>>>>>>>>>> its current JDK incarnation :-) Later on I will release 2.0.0
>> and
>>>>>> push
>>>>>>>>>>> it
>>>>>>>>>>>>> to Maven Central.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> In the mean time I wrote three applications (micro services in
>> new
>>>>>>>>>>> speak)
>>>>>>>>>>>>> using Apache FreeMarker and found it hard to find a starting
>> point
>>>>>>>>> for a
>>>>>>>>>>>>> Spring Boot applications - therefore I wrote the sample project
>>>>>> (see
>>>>>>>>>>>>> above). One way or the other a Spring Boot (and Micronaut) blue
>>>>>> print
>>>>>>>>>>>>> should find its way into Apache FreeMarker officially. I think
>>>>>> Apache
>>>>>>>>>>>>> FreeMarker is awesome for adding a developer UI to some micro
>>>>>> service
>>>>>>>>>>> but
>>>>>>>>>>>>> developers don't care about the template engine but only about
>> a
>>>>>> quick
>>>>>>>>>>> and
>>>>>>>>>>>>> painless way to get the job done ...
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Anyone volunteering to give a presentation about Apache
>>>>>> Freemarker at
>>>>>>>>>>>>> ApacheCon? I could do but I'm not really qualified :-)
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Thanks in advance,
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Siegfried Goeschl
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> --
>>>>>>>>>>>> Best regards,
>>>>>>>>>>>> Daniel Dekany
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> --
>>>>>>>>>> Best regards,
>>>>>>>>>> Daniel Dekany
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> --
>>>>>>>> Best regards,
>>>>>>>> Daniel Dekany
>>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Best regards,
>>>>> Daniel Dekany
>>>> 
>> 
>> 
> 
> -- 
> Best regards,
> Daniel Dekany


Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Daniel Dekany <da...@gmail.com>.
Looks great from the change log!

But, one thing I find to be odd is "Do not use documents[0] as top-level
variable - use Documents.get(0) instead ". I have already found loading
data a bit too hard to read (not utilizing what FreeMarker can do), but I
didn't come up with a concrete proposal for doing it otherwise, so I let it
be in previous discussion. But why not even documents[0]? That's really a
common idiom, even outside FreeMarker.

Another thing with documents. I guess in most use cases you expect exactly
one document. So I think I would introduce a "document" variable, which
fails on reading if there's not exactly one document. Therefore the
template states clearly if expects one document, or multiple documents. The
main problem with documents[0] (and now Documents.get(0)) is that it will
not fail there are multiple documents. If the template is not prepared for
multiple documents, that will certainly mean that it will silently pick a
practically random document from the many, and you may don't realize that
(as there's no error), and will use a wrong output therefore. (Actually,
having 0 matches where you expect multiple documents is also suspicious,
but is a less clear case.)

On Mon, Dec 23, 2019 at 4:46 PM Siegfried Goeschl <
siegfried.goeschl@gmail.com> wrote:

> Hi folks,
>
> Following the discussion (see below) I released
> https://github.com/sgoeschl/freemarker-cli/releases/tag/v2.0.0-BETA-5
>
> * The available tools are loaded from "freemarker-cli.properties" and
> support user-supplied tools
> * Apache POI / Excel integration supports getting to raw tables containing
> the closest matching Java type (works but needs field testing)
> * Falling back to "en_US" if no locale is provided on the command line
>
>
> Thanks in advance,
>
> Siegfried Goeschl
>
>
> Release Notes
> ============================================
>
> Added
>
> * Support interactive mode (-i or --interactive) to supply FreeMarker
> templates on the command line
> * UUIDTool to create random and named UUIDs
> * ExcelTool returns raw table consisting of the underlying Java data type
> * Document#getUnsafeInputStream to get a input stream which needs to be
> closed by the caller
> * CSVTool allows parsing plain string CSV
> * Tools are loaded from freemarker-cli.properties and freely configurable
> * Add RAT & PMD report to Maven site generation
> * Add -times command line option to execute the transformation N times
>
> Changed
>
> * Renamed ExcelTool#parseSheet to ExcelTool#toTable
> * Removed various Tool constructors taking Settings
> * Do not use documents[0] as top-level variable - use Documents.get(0)
> instead
> * Available CSV formats are exposed using the CSVTool and not the global
> data model
> * Expose user-supplied system properties as top-level variables when using
> -E
> * Keep track of all Closables created & handed out to FreeMarker template
> rendering
> * Move ObjectConstructor, Statics and Enums into FreeMarkerTool
>
> Deleted
>
> * Environment & SystemProperties were deleted and the functionality moved
> to SystemTool
> * All DataModel classes were deleted
>
>
> > On 19.12.2019, at 14:35, Woonsan Ko <wo...@apache.org> wrote:
> >
> > Sounds good! :-)
> > If we communicate well to each other explaining different use cases,
> > then we can improve it together in this community. I believe everybody
> > here is open to any new improvements for the community even if some
> > features are not relevant to themselves. That's why we join the ASF.
> > ;-)
> >
> > Cheers,
> >
> > Woonsan
> >
> > On Thu, Dec 19, 2019 at 6:38 AM Siegfried Goeschl
> > <si...@gmail.com> wrote:
> >>
> >> Hi folks,
> >>
> >> I’m okay with the things :-)
> >>
> >> Thanks in advance,
> >>
> >> Siegfried Goeschl
> >>
> >>
> >>> On 18 Dec 2019, at 20:38, Daniel Dekany <da...@gmail.com>
> wrote:
> >>>
> >>> Yes, these can done after V1 or whatever. But it's still important if
> >>> Siegfried will be OK with such things, or will lose motivation because
> it's
> >>> not how he likes his own kid. More code without more developers
> probably
> >>> won't work out well, given how little developer time even FM core gets.
> >>>
> >>> As of nested output files, I agree (and BTW, FMPP also have a nested
> output
> >>> directive, not just starting a new). I also understand that it breaks
> the
> >>> clean mental model, but if (if...) this is what's reasonably often
> needed
> >>> in reality, then certainly the mental model should bend.
> >>>
> >>> On Wed, Dec 18, 2019 at 8:01 PM Woonsan Ko <wo...@apache.org> wrote:
> >>>
> >>>> On Wed, Dec 18, 2019 at 11:23 AM Siegfried Goeschl
> >>>> <si...@gmail.com> wrote:
> >>>>>
> >>>>> Hi Daniel,
> >>>>>
> >>>>> please see my comments below …
> >>>>>
> >>>>> Thanks in advance,
> >>>>>
> >>>>> Siegfried Goeschl
> >>>>>
> >>>>>
> >>>>>> On 18 Dec 2019, at 16:58, Daniel Dekany <da...@gmail.com>
> >>>> wrote:
> >>>>>>
> >>>>>> Multiple output files: How open are you to the idea if someone else
> >>>> wants
> >>>>>> to add that though? The use-case is when it's input data that drives
> >>>> what
> >>>>>> output files you will have (as in my example with the employees),
> and
> >>>>>> working that around with multiple invocations is not very nice.
> >>>>>>
> >>>>>
> >>>>> Suggestive question - it is an Open Source project after all :-)
> >>>>>
> >>>>> * As long as it is hosted on my GitHub repo I can ultimately reject
> PRs
> >>>> if I’m really unhappy about them but repos can be forked
> >>>>> * If it becomes part of Apache FreeMarker project than there are more
> >>>> qualified developers out there to make a decision
> >>>>>
> >>>>> Regarding the implementation
> >>>>>
> >>>>> * Multiple output files violates my my mental model since you can’t
> use
> >>>> stdout any longer
> >>>>> * It could break the CommonsCSV integration since I’m using
> CSVPrinter
> >>>> sitting on FreeMarker’s output stream (which changes when using
> multiple
> >>>> output files)
> >>>>> * Last but not least I have not enough experience / requirements to
> come
> >>>> up with a useful implementation from the scratch
> >>>>
> >>>> In my head, we may introduce a new directive to specify a different
> >>>> output for the nested things, instead of the _default_ STDOUT, in the
> >>>> future. For example,
> >>>>
> >>>> hello,
> >>>> <#output file="another.csv">
> >>>> something else...
> >>>> </#output>
> >>>> world!
> >>>>
> >>>> So, by default "hello,\nworld!" to STDOUT, "something else..." to the
> >>>> extra file.
> >>>> This seems better to me than "changing output and closing the current
> >>>> output" approach in FMPP.
> >>>>
> >>>> But this improvement can be done together once Siegfried _donates_ his
> >>>> project to Apache FreeMarker. ;-)
> >>>>
> >>>>>
> >>>>>> Default locale:
> >>>>>> And also default charset to UTF-8, if that wasn't done.
> >>>>>
> >>>>> UTF-8 is the default
> >>>>>
> >>>>>>
> >>>>>> JDBC drivers: There was some discussion of how to add user defined
> >>>> classes
> >>>>>> to the tool earlier. Well, I guess it's about the same as you add
> your
> >>>> own
> >>>>>> jar-s to the classpath too, so, it shouldn't be a big deal. That
> could
> >>>>>> solve this side of the JDBC problem as well. As of storing
> credentials,
> >>>>>> that has to be solved when using external tools as well... but my
> >>>> practical
> >>>>>> experience is that people just put them in to a config file as plain
> >>>> text
> >>>>>> (maybe on a drive that has to be mounted with password first), or
> bind
> >>>> it
> >>>>>> to the OS user.
> >>>>>
> >>>>> The problem is more subtle - I want to provide a well-behaved command
> >>>> line tool
> >>>>>
> >>>>> * What happens if you update the freemarker-cli installation on your
> box?
> >>>>> * How do you easily distinguish between your custom JARs and the
> >>>> initially installed ones?
> >>>>> * How does it look like if you install freemarker-cli with package
> >>>> managers, e.g. brew?
> >>>>
> >>>> I guess it should be fine as an initial version even if there's no
> >>>> separation between system libs and custom libs (such as JDBC drivers).
> >>>> If there's a tool for easy JDBC access, it would be nice in practices.
> >>>> I don't think it should be perfect from V1.
> >>>>
> >>>> Regards,
> >>>>
> >>>> Woonsan
> >>>>
> >>>>>
> >>>>> Current state
> >>>>>
> >>>>> * Custom tools can be instantiated using the
> freemarker-cli-properties
> >>>>> * For the templates I use ~/.freemarker-cli directory to have a clean
> >>>> separation
> >>>>> * There is no really nice solution for JARs - I might tweak the Maven
> >>>> plugin creating the Unix & Windows wrappers - you can already create
> an
> >>>> “endorsed” directory there to place custom JARs
> >>>>>
> >>>>>>
> >>>>>> Yes, Spring support is definitely important, given the omnipresence
> of
> >>>>>> Spring. It's not just web pages there, but e-mail templates
> >>>> (especially as
> >>>>>> there modern the UI technologies that has taken over at most places,
> >>>> aren't
> >>>>>> applicable). Would be good if someone can take ownership of that
> >>>> aspect for
> >>>>>> FreeMarker 2, probably using what was done in FM3. (Or maybe the
> same
> >>>>>> resources are better redirected to pushing FM3... who knows. There
> are
> >>>>>> really no resources to push two branches in parallel.)
> >>>>>>
> >>>>>> On Wed, Dec 18, 2019 at 2:02 PM Siegfried Goeschl <
> >>>>>> siegfried.goeschl@gmail.com <ma...@gmail.com>>
> >>>> wrote:
> >>>>>>
> >>>>>>> Hi Daniel,
> >>>>>>>
> >>>>>>> try to write a top-level post to keep the discussion readable
> >>>>>>>
> >>>>>>>
> >>>>>>> Ad Multi-file Output
> >>>>>>> ===============================================================
> >>>>>>>
> >>>>>>> Currently no plans to implement it - I personally don’t have a need
> >>>> for it
> >>>>>>> and it is a hypothetical requirement for now
> >>>>>>>
> >>>>>>>
> >>>>>>> Ad POI Integration
> >>>>>>> ===============================================================
> >>>>>>>
> >>>>>>> No problem in exposing the non-String data - it is a good idea and
> >>>> will be
> >>>>>>> implemented
> >>>>>>>
> >>>>>>>
> >>>>>>> Ad Default Locale
> >>>>>>> ===============================================================
> >>>>>>>
> >>>>>>> * I need to define a locale for the unit tests
> >>>>>>> * I guess it is a good idea to pin it to “en_US” to avoid suprises
> >>>>>>>
> >>>>>>>
> >>>>>>> Ad JDBC Access
> >>>>>>> ===============================================================
> >>>>>>>
> >>>>>>> It is part of a wider problem - when leaving the document-centric
> >>>> approach
> >>>>>>> into scripting there is a lot of useful functionality, e.g. JDBC
> and
> >>>> HTTP
> >>>>>>> clients.
> >>>>>>>
> >>>>>>> The problems
> >>>>>>>
> >>>>>>> * JDBC: You need to add JDBC drivers, where to store the
> credentials,
> >>>>>>> database schema, ...
> >>>>>>> * HTTP: More libraries, certificates, proxy support,...
> >>>>>>>
> >>>>>>> It is possible to implement something but it will never work
> properly
> >>>> so I
> >>>>>>> decided to tackle the problem differently b using commons-exec
> >>>>>>>
> >>>>>>> * REST calls can be easily made by invoking cURL
> >>>>>>> * Database command line clients can export the result of a SELECT
> >>>> query to
> >>>>>>> a CSV file
> >>>>>>>
> >>>>>>>
> >>>>>>> Ad Templates aren't used much for Web UI-s anymore
> >>>>>>> ===============================================================
> >>>>>>>
> >>>>>>> Yes and no - IMHO it is quite useful to embed a UI into certain
> "micro
> >>>>>>> services”. Therefore I think that a ready-to-use Spring Boot (&
> >>>> Micronaut,
> >>>>>>> etc..) integration is important and should not be an afterthought.
> >>>>>>>
> >>>>>>>
> >>>>>>> Thanks in advance,
> >>>>>>>
> >>>>>>> Siegfried Goeschl
> >>>>>>>
> >>>>>>>
> >>>>>>>> On 18 Dec 2019, at 01:32, Daniel Dekany <da...@gmail.com>
> >>>> wrote:
> >>>>>>>>
> >>>>>>>> Hi,
> >>>>>>>>
> >>>>>>>> Find my comments inline below.
> >>>>>>>>
> >>>>>>>> On Tue, Dec 17, 2019 at 10:46 PM Siegfried Goeschl <
> >>>>>>>> siegfried.goeschl@gmail.com <ma...@gmail.com>
> >>>> <mailto:siegfried.goeschl@gmail.com <mailto:
> siegfried.goeschl@gmail.com>>>
> >>>> wrote:
> >>>>>>>>
> >>>>>>>>> Hi Daniel,
> >>>>>>>>>
> >>>>>>>>> Thanks for spending your time - feed back is always appreciated
> when
> >>>>>>> doing
> >>>>>>>>> things in isolation ....
> >>>>>>>>>
> >>>>>>>>> Please see my comments below
> >>>>>>>>>
> >>>>>>>>> Thanks in advance,
> >>>>>>>>>
> >>>>>>>>> Siegfried Goeschl
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>> On 17.12.2019, at 19:19, Daniel Dekany <daniel.dekany@gmail.com
> >>>> <ma...@gmail.com>>
> >>>>>>> wrote:
> >>>>>>>>>>
> >>>>>>>>>> Hi Siegfried,
> >>>>>>>>>>
> >>>>>>>>>> Looks good!
> >>>>>>>>>>
> >>>>>>>>>> Some random things I happened to notice:
> >>>>>>>>>>
> >>>>>>>>>> - The ability generating multiple output files from the same
> >>>> template
> >>>>>>>>>> would be worthy addition. Like you load a CSV file that has
> >>>> employees
> >>>>>>>>> in
> >>>>>>>>>> it, and based on that you generate one output file per
> department.
> >>>> Or
> >>>>>>>>> even
> >>>>>>>>>> one per employee. (There could directives for that, like
> >>>>>>>>> changeOutputFile,
> >>>>>>>>>> nestOutputFile, etc. on
> >>>>>>> http://fmpp.sourceforge.net/pphash.html#sect17 <
> >>>> http://fmpp.sourceforge.net/pphash.html#sect17>
> >>>>>>>>> <http://fmpp.sourceforge.net/pphash.html#sect17 <
> >>>> http://fmpp.sourceforge.net/pphash.html#sect17> <
> >>>>>>> http://fmpp.sourceforge.net/pphash.html#sect17 <
> >>>> http://fmpp.sourceforge.net/pphash.html#sect17>>>)
> >>>>>>>>>
> >>>>>>>>> Well, I simply don't need it and it complicates things - in
> simple
> >>>> cases
> >>>>>>>>> one could just re-run the freemarker-cli with a different
> template
> >>>>>>> and/or
> >>>>>>>>> parameters
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>> My feeling is that if there's a tool that's about transforming
> some
> >>>> files
> >>>>>>>> to other files, but the idea that a single invocation can yield
> >>>> multiple
> >>>>>>>> output files is not part of it, one way or another (i.e., not
> >>>> necessarily
> >>>>>>>> in the way it was in FMPP), it might turns out to be a limiting
> >>>> design
> >>>>>>>> decision later as feature request start to pour in. And then it
> can
> >>>> be
> >>>>>>> hard
> >>>>>>>> to add as an afterthought. Well, maybe I'm wrong, as I have no
> >>>> statics
> >>>>>>>> about how often it's needed. FMPP users did use it (myself
> included),
> >>>>>>> some
> >>>>>>>> of them at least.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>> - When I load an XLSX, I get back values as string, not as
> >>>> numbers, or
> >>>>>>>>>> dates. I'm not sure how hard it is to solve though (I don't
> >>>> remember
> >>>>>>>>> POI
> >>>>>>>>>> much).
> >>>>>>>>>
> >>>>>>>>> That should not be too hard - I actually use
> >>>>>>>>> org.apache.poi.ss.usermodel.DataFormatter to create the strings
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> If templates get numbers etc., or have a such choice at least,
> then
> >>>> they
> >>>>>>>> can compare numbers, filter based on their values, control the
> >>>>>>> formatting,
> >>>>>>>> etc. My idea here is that an Excel file, CSV file, whatever, is
> just
> >>>> a
> >>>>>>> pure
> >>>>>>>> data, and rendering/formatting is the duty of the templates.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>> BTW, the strings I get back are formatted with the locale of the
> >>>> OS,
> >>>>>>>>>
> >>>>>>>>> which is a problem. I guess there should be an config option to
> set
> >>>> the
> >>>>>>>>> JVM
> >>>>>>>>>> locale. (The ExcelToolTest fails on my computer with locale
> hu_HU
> >>>> for
> >>>>>>>>>> somewhat similar reason, as it gets "100,00" instead of
> "100.00".)
> >>>>>>>>>
> >>>>>>>>> On the command line you can use
> >>>>>>>>>
> >>>>>>>>> -l, --locale=<locale>     Locale being used for output file, e.g.
> >>>>>>> 'en_US'
> >>>>>>>>>
> >>>>>>>>> but I guess I should provide a fixed locale for the unit tests
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>> The problem is not how FreeMarker renders the numbers. It already
> >>>> gets
> >>>>>>>> strings like that from POI, and --locale doesn't influence POI.
> >>>>>>>>
> >>>>>>>> As of the default locale, for these kind of tools, I believe that
> >>>> using
> >>>>>>>> system defaults is usually evil. So having a fixed default is
> maybe
> >>>> not
> >>>>>>>> just for unit tests. The locale of my computer, or wherever I run
> a
> >>>> job
> >>>>>>> on
> >>>>>>>> (often some backend linux box) should be usually irrelevant, and
> not
> >>>>>>>> influence the output. Not to mention when team mates share the
> >>>> project,
> >>>>>>> in
> >>>>>>>> an international team.
> >>>>>>>>
> >>>>>>>>> - Querying from relation databases (JDBC) would be probably an
> >>>> useful
> >>>>>>>>>> addition (it doesn't fit the Document paradigm though).
> >>>>>>>>>
> >>>>>>>>> I integrated commons-exec and triggered AWS CLI - basically you
> >>>> capture
> >>>>>>>>> the output of any command-line invocation and process it. Just
> need
> >>>> to
> >>>>>>> make
> >>>>>>>>> sure that every tool supports processing raw strings ...
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>> I'm note sure what do you mean. The result of a query is a
> structured
> >>>>>>> data,
> >>>>>>>> with column names and non-string types, so I guess command-line
> >>>>>>> invocation
> >>>>>>>> can't solve that too well.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>> It would be good if there's some de-facto tool for these kind of
> >>>> things
> >>>>>>>>>> than what freemarker-cli does. I guess there's a few such tools
> in
> >>>>>>>>> company
> >>>>>>>>>> repos, but of course those have no potential to become more
> >>>> generic and
> >>>>>>>>>> being published. (freemarker-generator was a such toll though,
> but
> >>>> it
> >>>>>>>>>> didn't go anywhere after donation. Actually, FMPP was a such
> tool
> >>>> too,
> >>>>>>>>> that
> >>>>>>>>>> I used for some sysadmin/webadmin tasks some 15+ years ago.)
> But of
> >>>>>>>>> course,
> >>>>>>>>>> long term care is the tricky issue with any project that has no
> >>>> company
> >>>>>>>>>> truly behind it (i.e., no payed developers). Do you have you
> have
> >>>> any
> >>>>>>>>>> thoughts/plans regarding the longer term life of freemarker-cli?
> >>>>>>>>>
> >>>>>>>>> I worked on a couple of not soo successful Open Source projects -
> >>>> yes,
> >>>>>>> it
> >>>>>>>>> might become another Open Source GitHub project nobody knows /
> >>>> cares :-)
> >>>>>>>>>
> >>>>>>>>> Having said that
> >>>>>>>>>
> >>>>>>>>> * I'm maintaining it already for a few of years and I will always
> >>>> find
> >>>>>>>>> some things I can do with it
> >>>>>>>>> * It is useful for some common tasks when you have a Java
> background
> >>>>>>>>> * I think it is a great way to re-use or build up FreeMarker
> >>>> knowledge
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>> And, I would add, templates aren't used much for Web UI-s
> anymore, so
> >>>>>>> these
> >>>>>>>> alternate use cases become the main ones.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>> * And it should become part of the Apache Freemarker project -
> much
> >>>>>>> better
> >>>>>>>>> visibility & broader user base
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>> Yeah, the last point is what I'm going for really. But that's also
> >>>> why I
> >>>>>>>> hope that you feel like making it more general. Or at least has no
> >>>>>>> negative
> >>>>>>>> feelings about it.
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>> Also, some things that you miss for FreeMarker itself for it to
> be
> >>>> more
> >>>>>>>>>> fitting for the task?
> >>>>>>>>>
> >>>>>>>>> Support for Java 8 Date/Time API - last time I looked at it it
> was
> >>>> not
> >>>>>>>>> supported by FreeMarker and it's a bummer since nobody is using
> >>>> Date any
> >>>>>>>>> longer ...
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>> Yeah... it still isn't. It's probably among the new few things to
> >>>> add at
> >>>>>>>> this point, as it's long due.
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> On Sun, Nov 17, 2019 at 7:02 PM Siegfried Goeschl <
> >>>>>>>>>> siegfried.goeschl@gmail.com <mailto:siegfried.goeschl@gmail.com
> >
> >>>> <mailto:siegfried.goeschl@gmail.com <mailto:
> siegfried.goeschl@gmail.com>>
> >>>>>>> <mailto:siegfried.goeschl@gmail.com <mailto:
> >>>> siegfried.goeschl@gmail.com> <mailto:siegfried.goeschl@gmail.com
> <mailto:
> >>>> siegfried.goeschl@gmail.com>>>>
> >>>>>>> wrote:
> >>>>>>>>>>
> >>>>>>>>>>> Hi folks,
> >>>>>>>>>>>
> >>>>>>>>>>> since I'm currently mostly busy with non-coding tasks I spent
> some
> >>>>>>> time
> >>>>>>>>>>> honing my coding skills - probably to no avail as my colleagues
> >>>> would
> >>>>>>>>> say
> >>>>>>>>>>> ;-)
> >>>>>>>>>>>
> >>>>>>>>>>> 1) I migrated my pet project "freemarker-cli" from Groovy to
> JDK 8
> >>>>>>> (see
> >>>>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
> >>>> https://github.com/sgoeschl/freemarker-cli> <
> >>>>>>> https://github.com/sgoeschl/freemarker-cli <
> >>>> https://github.com/sgoeschl/freemarker-cli>> <
> >>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
> >>>> https://github.com/sgoeschl/freemarker-cli> <
> >>>>>>> https://github.com/sgoeschl/freemarker-cli <
> >>>> https://github.com/sgoeschl/freemarker-cli>>> <
> >>>>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
> >>>> https://github.com/sgoeschl/freemarker-cli> <
> >>>>>>> https://github.com/sgoeschl/freemarker-cli <
> >>>> https://github.com/sgoeschl/freemarker-cli>> <
> >>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
> >>>> https://github.com/sgoeschl/freemarker-cli> <
> >>>>>>> https://github.com/sgoeschl/freemarker-cli <
> >>>> https://github.com/sgoeschl/freemarker-cli>>>>)
> >>>>>>>>>>>
> >>>>>>>>>>> 2) At
> >>>>>>>>>>>
> >>>>>>>>>
> >>>>>>>
> >>>>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>> <
> >>>>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>>>
> >>>>>>> <
> >>>>>>>
> >>>>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>> <
> >>>>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>>>
> >>>>>>>>
> >>>>>>>>> <
> >>>>>>>>>
> >>>>>>>
> >>>>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>> <
> >>>>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>>>
> >>>>>>> <
> >>>>>>>
> >>>>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>> <
> >>>>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>>>
> >>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>> <
> >>>>>>>>>>>
> >>>>>>>>>
> >>>>>>>
> >>>>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>>>>> <
> >>>>>>>
> >>>>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>>>>>>
> >>>>>>>>> <
> >>>>>>>>>
> >>>>>>>
> >>>>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>>>>> <
> >>>>>>>
> >>>>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> you find a presentation I gave some while ago
> >>>>>>>>>>>
> >>>>>>>>>>> 3) I also wrote a Spring Boot FreeMarker sample project as part
> >>>> of the
> >>>>>>>>>>> presentation (see
> >>>>>>>>>>>
> >>>>>>>>>
> >>>>>>>
> >>>>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>> <
> >>>>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>>>
> >>>>>>> <
> >>>>>>>
> >>>>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>> <
> >>>>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>>>
> >>>>>>>>
> >>>>>>>>> <
> >>>>>>>>>
> >>>>>>>
> >>>>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>> <
> >>>>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>>>
> >>>>>>> <
> >>>>>>>
> >>>>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>> <
> >>>>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>>>
> >>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>> <
> >>>>>>>>>>>
> >>>>>>>>>
> >>>>>>>
> >>>>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>>>>> <
> >>>>>>>
> >>>>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>>>>>>
> >>>>>>>>> <
> >>>>>>>>>
> >>>>>>>
> >>>>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>>>>> <
> >>>>>>>
> >>>>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>>> )
> >>>>>>>>>>>
> >>>>>>>>>>> My plans / questions
> >>>>>>>>>>>
> >>>>>>>>>>> I would be awesome if I could get some feedback about
> >>>> "freemarker-cli"
> >>>>>>>>> in
> >>>>>>>>>>> its current JDK incarnation :-) Later on I will release 2.0.0
> and
> >>>> push
> >>>>>>>>> it
> >>>>>>>>>>> to Maven Central.
> >>>>>>>>>>>
> >>>>>>>>>>> In the mean time I wrote three applications (micro services in
> new
> >>>>>>>>> speak)
> >>>>>>>>>>> using Apache FreeMarker and found it hard to find a starting
> point
> >>>>>>> for a
> >>>>>>>>>>> Spring Boot applications - therefore I wrote the sample project
> >>>> (see
> >>>>>>>>>>> above). One way or the other a Spring Boot (and Micronaut) blue
> >>>> print
> >>>>>>>>>>> should find its way into Apache FreeMarker officially. I think
> >>>> Apache
> >>>>>>>>>>> FreeMarker is awesome for adding a developer UI to some micro
> >>>> service
> >>>>>>>>> but
> >>>>>>>>>>> developers don't care about the template engine but only about
> a
> >>>> quick
> >>>>>>>>> and
> >>>>>>>>>>> painless way to get the job done ...
> >>>>>>>>>>>
> >>>>>>>>>>> Anyone volunteering to give a presentation about Apache
> >>>> Freemarker at
> >>>>>>>>>>> ApacheCon? I could do but I'm not really qualified :-)
> >>>>>>>>>>>
> >>>>>>>>>>> Thanks in advance,
> >>>>>>>>>>>
> >>>>>>>>>>> Siegfried Goeschl
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> --
> >>>>>>>>>> Best regards,
> >>>>>>>>>> Daniel Dekany
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>> --
> >>>>>>>> Best regards,
> >>>>>>>> Daniel Dekany
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>> --
> >>>>>> Best regards,
> >>>>>> Daniel Dekany
> >>>>>
> >>>>
> >>>
> >>>
> >>> --
> >>> Best regards,
> >>> Daniel Dekany
> >>
>
>

-- 
Best regards,
Daniel Dekany

Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Siegfried Goeschl <si...@gmail.com>.
Hi folks,

Following the discussion (see below) I released https://github.com/sgoeschl/freemarker-cli/releases/tag/v2.0.0-BETA-5

* The available tools are loaded from "freemarker-cli.properties" and support user-supplied tools
* Apache POI / Excel integration supports getting to raw tables containing the closest matching Java type (works but needs field testing)
* Falling back to "en_US" if no locale is provided on the command line


Thanks in advance, 

Siegfried Goeschl


Release Notes
============================================

Added

* Support interactive mode (-i or --interactive) to supply FreeMarker templates on the command line
* UUIDTool to create random and named UUIDs
* ExcelTool returns raw table consisting of the underlying Java data type
* Document#getUnsafeInputStream to get a input stream which needs to be closed by the caller
* CSVTool allows parsing plain string CSV
* Tools are loaded from freemarker-cli.properties and freely configurable
* Add RAT & PMD report to Maven site generation
* Add -times command line option to execute the transformation N times

Changed

* Renamed ExcelTool#parseSheet to ExcelTool#toTable
* Removed various Tool constructors taking Settings
* Do not use documents[0] as top-level variable - use Documents.get(0) instead
* Available CSV formats are exposed using the CSVTool and not the global data model
* Expose user-supplied system properties as top-level variables when using -E
* Keep track of all Closables created & handed out to FreeMarker template rendering
* Move ObjectConstructor, Statics and Enums into FreeMarkerTool

Deleted

* Environment & SystemProperties were deleted and the functionality moved to SystemTool
* All DataModel classes were deleted


> On 19.12.2019, at 14:35, Woonsan Ko <wo...@apache.org> wrote:
> 
> Sounds good! :-)
> If we communicate well to each other explaining different use cases,
> then we can improve it together in this community. I believe everybody
> here is open to any new improvements for the community even if some
> features are not relevant to themselves. That's why we join the ASF.
> ;-)
> 
> Cheers,
> 
> Woonsan
> 
> On Thu, Dec 19, 2019 at 6:38 AM Siegfried Goeschl
> <si...@gmail.com> wrote:
>> 
>> Hi folks,
>> 
>> I’m okay with the things :-)
>> 
>> Thanks in advance,
>> 
>> Siegfried Goeschl
>> 
>> 
>>> On 18 Dec 2019, at 20:38, Daniel Dekany <da...@gmail.com> wrote:
>>> 
>>> Yes, these can done after V1 or whatever. But it's still important if
>>> Siegfried will be OK with such things, or will lose motivation because it's
>>> not how he likes his own kid. More code without more developers probably
>>> won't work out well, given how little developer time even FM core gets.
>>> 
>>> As of nested output files, I agree (and BTW, FMPP also have a nested output
>>> directive, not just starting a new). I also understand that it breaks the
>>> clean mental model, but if (if...) this is what's reasonably often needed
>>> in reality, then certainly the mental model should bend.
>>> 
>>> On Wed, Dec 18, 2019 at 8:01 PM Woonsan Ko <wo...@apache.org> wrote:
>>> 
>>>> On Wed, Dec 18, 2019 at 11:23 AM Siegfried Goeschl
>>>> <si...@gmail.com> wrote:
>>>>> 
>>>>> Hi Daniel,
>>>>> 
>>>>> please see my comments below …
>>>>> 
>>>>> Thanks in advance,
>>>>> 
>>>>> Siegfried Goeschl
>>>>> 
>>>>> 
>>>>>> On 18 Dec 2019, at 16:58, Daniel Dekany <da...@gmail.com>
>>>> wrote:
>>>>>> 
>>>>>> Multiple output files: How open are you to the idea if someone else
>>>> wants
>>>>>> to add that though? The use-case is when it's input data that drives
>>>> what
>>>>>> output files you will have (as in my example with the employees), and
>>>>>> working that around with multiple invocations is not very nice.
>>>>>> 
>>>>> 
>>>>> Suggestive question - it is an Open Source project after all :-)
>>>>> 
>>>>> * As long as it is hosted on my GitHub repo I can ultimately reject PRs
>>>> if I’m really unhappy about them but repos can be forked
>>>>> * If it becomes part of Apache FreeMarker project than there are more
>>>> qualified developers out there to make a decision
>>>>> 
>>>>> Regarding the implementation
>>>>> 
>>>>> * Multiple output files violates my my mental model since you can’t use
>>>> stdout any longer
>>>>> * It could break the CommonsCSV integration since I’m using CSVPrinter
>>>> sitting on FreeMarker’s output stream (which changes when using multiple
>>>> output files)
>>>>> * Last but not least I have not enough experience / requirements to come
>>>> up with a useful implementation from the scratch
>>>> 
>>>> In my head, we may introduce a new directive to specify a different
>>>> output for the nested things, instead of the _default_ STDOUT, in the
>>>> future. For example,
>>>> 
>>>> hello,
>>>> <#output file="another.csv">
>>>> something else...
>>>> </#output>
>>>> world!
>>>> 
>>>> So, by default "hello,\nworld!" to STDOUT, "something else..." to the
>>>> extra file.
>>>> This seems better to me than "changing output and closing the current
>>>> output" approach in FMPP.
>>>> 
>>>> But this improvement can be done together once Siegfried _donates_ his
>>>> project to Apache FreeMarker. ;-)
>>>> 
>>>>> 
>>>>>> Default locale:
>>>>>> And also default charset to UTF-8, if that wasn't done.
>>>>> 
>>>>> UTF-8 is the default
>>>>> 
>>>>>> 
>>>>>> JDBC drivers: There was some discussion of how to add user defined
>>>> classes
>>>>>> to the tool earlier. Well, I guess it's about the same as you add your
>>>> own
>>>>>> jar-s to the classpath too, so, it shouldn't be a big deal. That could
>>>>>> solve this side of the JDBC problem as well. As of storing credentials,
>>>>>> that has to be solved when using external tools as well... but my
>>>> practical
>>>>>> experience is that people just put them in to a config file as plain
>>>> text
>>>>>> (maybe on a drive that has to be mounted with password first), or bind
>>>> it
>>>>>> to the OS user.
>>>>> 
>>>>> The problem is more subtle - I want to provide a well-behaved command
>>>> line tool
>>>>> 
>>>>> * What happens if you update the freemarker-cli installation on your box?
>>>>> * How do you easily distinguish between your custom JARs and the
>>>> initially installed ones?
>>>>> * How does it look like if you install freemarker-cli with package
>>>> managers, e.g. brew?
>>>> 
>>>> I guess it should be fine as an initial version even if there's no
>>>> separation between system libs and custom libs (such as JDBC drivers).
>>>> If there's a tool for easy JDBC access, it would be nice in practices.
>>>> I don't think it should be perfect from V1.
>>>> 
>>>> Regards,
>>>> 
>>>> Woonsan
>>>> 
>>>>> 
>>>>> Current state
>>>>> 
>>>>> * Custom tools can be instantiated using the freemarker-cli-properties
>>>>> * For the templates I use ~/.freemarker-cli directory to have a clean
>>>> separation
>>>>> * There is no really nice solution for JARs - I might tweak the Maven
>>>> plugin creating the Unix & Windows wrappers - you can already create an
>>>> “endorsed” directory there to place custom JARs
>>>>> 
>>>>>> 
>>>>>> Yes, Spring support is definitely important, given the omnipresence of
>>>>>> Spring. It's not just web pages there, but e-mail templates
>>>> (especially as
>>>>>> there modern the UI technologies that has taken over at most places,
>>>> aren't
>>>>>> applicable). Would be good if someone can take ownership of that
>>>> aspect for
>>>>>> FreeMarker 2, probably using what was done in FM3. (Or maybe the same
>>>>>> resources are better redirected to pushing FM3... who knows. There are
>>>>>> really no resources to push two branches in parallel.)
>>>>>> 
>>>>>> On Wed, Dec 18, 2019 at 2:02 PM Siegfried Goeschl <
>>>>>> siegfried.goeschl@gmail.com <ma...@gmail.com>>
>>>> wrote:
>>>>>> 
>>>>>>> Hi Daniel,
>>>>>>> 
>>>>>>> try to write a top-level post to keep the discussion readable
>>>>>>> 
>>>>>>> 
>>>>>>> Ad Multi-file Output
>>>>>>> ===============================================================
>>>>>>> 
>>>>>>> Currently no plans to implement it - I personally don’t have a need
>>>> for it
>>>>>>> and it is a hypothetical requirement for now
>>>>>>> 
>>>>>>> 
>>>>>>> Ad POI Integration
>>>>>>> ===============================================================
>>>>>>> 
>>>>>>> No problem in exposing the non-String data - it is a good idea and
>>>> will be
>>>>>>> implemented
>>>>>>> 
>>>>>>> 
>>>>>>> Ad Default Locale
>>>>>>> ===============================================================
>>>>>>> 
>>>>>>> * I need to define a locale for the unit tests
>>>>>>> * I guess it is a good idea to pin it to “en_US” to avoid suprises
>>>>>>> 
>>>>>>> 
>>>>>>> Ad JDBC Access
>>>>>>> ===============================================================
>>>>>>> 
>>>>>>> It is part of a wider problem - when leaving the document-centric
>>>> approach
>>>>>>> into scripting there is a lot of useful functionality, e.g. JDBC and
>>>> HTTP
>>>>>>> clients.
>>>>>>> 
>>>>>>> The problems
>>>>>>> 
>>>>>>> * JDBC: You need to add JDBC drivers, where to store the credentials,
>>>>>>> database schema, ...
>>>>>>> * HTTP: More libraries, certificates, proxy support,...
>>>>>>> 
>>>>>>> It is possible to implement something but it will never work properly
>>>> so I
>>>>>>> decided to tackle the problem differently b using commons-exec
>>>>>>> 
>>>>>>> * REST calls can be easily made by invoking cURL
>>>>>>> * Database command line clients can export the result of a SELECT
>>>> query to
>>>>>>> a CSV file
>>>>>>> 
>>>>>>> 
>>>>>>> Ad Templates aren't used much for Web UI-s anymore
>>>>>>> ===============================================================
>>>>>>> 
>>>>>>> Yes and no - IMHO it is quite useful to embed a UI into certain "micro
>>>>>>> services”. Therefore I think that a ready-to-use Spring Boot (&
>>>> Micronaut,
>>>>>>> etc..) integration is important and should not be an afterthought.
>>>>>>> 
>>>>>>> 
>>>>>>> Thanks in advance,
>>>>>>> 
>>>>>>> Siegfried Goeschl
>>>>>>> 
>>>>>>> 
>>>>>>>> On 18 Dec 2019, at 01:32, Daniel Dekany <da...@gmail.com>
>>>> wrote:
>>>>>>>> 
>>>>>>>> Hi,
>>>>>>>> 
>>>>>>>> Find my comments inline below.
>>>>>>>> 
>>>>>>>> On Tue, Dec 17, 2019 at 10:46 PM Siegfried Goeschl <
>>>>>>>> siegfried.goeschl@gmail.com <ma...@gmail.com>
>>>> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com>>>
>>>> wrote:
>>>>>>>> 
>>>>>>>>> Hi Daniel,
>>>>>>>>> 
>>>>>>>>> Thanks for spending your time - feed back is always appreciated when
>>>>>>> doing
>>>>>>>>> things in isolation ....
>>>>>>>>> 
>>>>>>>>> Please see my comments below
>>>>>>>>> 
>>>>>>>>> Thanks in advance,
>>>>>>>>> 
>>>>>>>>> Siegfried Goeschl
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>> On 17.12.2019, at 19:19, Daniel Dekany <daniel.dekany@gmail.com
>>>> <ma...@gmail.com>>
>>>>>>> wrote:
>>>>>>>>>> 
>>>>>>>>>> Hi Siegfried,
>>>>>>>>>> 
>>>>>>>>>> Looks good!
>>>>>>>>>> 
>>>>>>>>>> Some random things I happened to notice:
>>>>>>>>>> 
>>>>>>>>>> - The ability generating multiple output files from the same
>>>> template
>>>>>>>>>> would be worthy addition. Like you load a CSV file that has
>>>> employees
>>>>>>>>> in
>>>>>>>>>> it, and based on that you generate one output file per department.
>>>> Or
>>>>>>>>> even
>>>>>>>>>> one per employee. (There could directives for that, like
>>>>>>>>> changeOutputFile,
>>>>>>>>>> nestOutputFile, etc. on
>>>>>>> http://fmpp.sourceforge.net/pphash.html#sect17 <
>>>> http://fmpp.sourceforge.net/pphash.html#sect17>
>>>>>>>>> <http://fmpp.sourceforge.net/pphash.html#sect17 <
>>>> http://fmpp.sourceforge.net/pphash.html#sect17> <
>>>>>>> http://fmpp.sourceforge.net/pphash.html#sect17 <
>>>> http://fmpp.sourceforge.net/pphash.html#sect17>>>)
>>>>>>>>> 
>>>>>>>>> Well, I simply don't need it and it complicates things - in simple
>>>> cases
>>>>>>>>> one could just re-run the freemarker-cli with a different template
>>>>>>> and/or
>>>>>>>>> parameters
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> My feeling is that if there's a tool that's about transforming some
>>>> files
>>>>>>>> to other files, but the idea that a single invocation can yield
>>>> multiple
>>>>>>>> output files is not part of it, one way or another (i.e., not
>>>> necessarily
>>>>>>>> in the way it was in FMPP), it might turns out to be a limiting
>>>> design
>>>>>>>> decision later as feature request start to pour in. And then it can
>>>> be
>>>>>>> hard
>>>>>>>> to add as an afterthought. Well, maybe I'm wrong, as I have no
>>>> statics
>>>>>>>> about how often it's needed. FMPP users did use it (myself included),
>>>>>>> some
>>>>>>>> of them at least.
>>>>>>>> 
>>>>>>>> 
>>>>>>>>>> - When I load an XLSX, I get back values as string, not as
>>>> numbers, or
>>>>>>>>>> dates. I'm not sure how hard it is to solve though (I don't
>>>> remember
>>>>>>>>> POI
>>>>>>>>>> much).
>>>>>>>>> 
>>>>>>>>> That should not be too hard - I actually use
>>>>>>>>> org.apache.poi.ss.usermodel.DataFormatter to create the strings
>>>>>>>> 
>>>>>>>> 
>>>>>>>> If templates get numbers etc., or have a such choice at least, then
>>>> they
>>>>>>>> can compare numbers, filter based on their values, control the
>>>>>>> formatting,
>>>>>>>> etc. My idea here is that an Excel file, CSV file, whatever, is just
>>>> a
>>>>>>> pure
>>>>>>>> data, and rendering/formatting is the duty of the templates.
>>>>>>>> 
>>>>>>>> 
>>>>>>>>>> BTW, the strings I get back are formatted with the locale of the
>>>> OS,
>>>>>>>>> 
>>>>>>>>> which is a problem. I guess there should be an config option to set
>>>> the
>>>>>>>>> JVM
>>>>>>>>>> locale. (The ExcelToolTest fails on my computer with locale hu_HU
>>>> for
>>>>>>>>>> somewhat similar reason, as it gets "100,00" instead of "100.00".)
>>>>>>>>> 
>>>>>>>>> On the command line you can use
>>>>>>>>> 
>>>>>>>>> -l, --locale=<locale>     Locale being used for output file, e.g.
>>>>>>> 'en_US'
>>>>>>>>> 
>>>>>>>>> but I guess I should provide a fixed locale for the unit tests
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> The problem is not how FreeMarker renders the numbers. It already
>>>> gets
>>>>>>>> strings like that from POI, and --locale doesn't influence POI.
>>>>>>>> 
>>>>>>>> As of the default locale, for these kind of tools, I believe that
>>>> using
>>>>>>>> system defaults is usually evil. So having a fixed default is maybe
>>>> not
>>>>>>>> just for unit tests. The locale of my computer, or wherever I run a
>>>> job
>>>>>>> on
>>>>>>>> (often some backend linux box) should be usually irrelevant, and not
>>>>>>>> influence the output. Not to mention when team mates share the
>>>> project,
>>>>>>> in
>>>>>>>> an international team.
>>>>>>>> 
>>>>>>>>> - Querying from relation databases (JDBC) would be probably an
>>>> useful
>>>>>>>>>> addition (it doesn't fit the Document paradigm though).
>>>>>>>>> 
>>>>>>>>> I integrated commons-exec and triggered AWS CLI - basically you
>>>> capture
>>>>>>>>> the output of any command-line invocation and process it. Just need
>>>> to
>>>>>>> make
>>>>>>>>> sure that every tool supports processing raw strings ...
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> I'm note sure what do you mean. The result of a query is a structured
>>>>>>> data,
>>>>>>>> with column names and non-string types, so I guess command-line
>>>>>>> invocation
>>>>>>>> can't solve that too well.
>>>>>>>> 
>>>>>>>> 
>>>>>>>>>> It would be good if there's some de-facto tool for these kind of
>>>> things
>>>>>>>>>> than what freemarker-cli does. I guess there's a few such tools in
>>>>>>>>> company
>>>>>>>>>> repos, but of course those have no potential to become more
>>>> generic and
>>>>>>>>>> being published. (freemarker-generator was a such toll though, but
>>>> it
>>>>>>>>>> didn't go anywhere after donation. Actually, FMPP was a such tool
>>>> too,
>>>>>>>>> that
>>>>>>>>>> I used for some sysadmin/webadmin tasks some 15+ years ago.) But of
>>>>>>>>> course,
>>>>>>>>>> long term care is the tricky issue with any project that has no
>>>> company
>>>>>>>>>> truly behind it (i.e., no payed developers). Do you have you have
>>>> any
>>>>>>>>>> thoughts/plans regarding the longer term life of freemarker-cli?
>>>>>>>>> 
>>>>>>>>> I worked on a couple of not soo successful Open Source projects -
>>>> yes,
>>>>>>> it
>>>>>>>>> might become another Open Source GitHub project nobody knows /
>>>> cares :-)
>>>>>>>>> 
>>>>>>>>> Having said that
>>>>>>>>> 
>>>>>>>>> * I'm maintaining it already for a few of years and I will always
>>>> find
>>>>>>>>> some things I can do with it
>>>>>>>>> * It is useful for some common tasks when you have a Java background
>>>>>>>>> * I think it is a great way to re-use or build up FreeMarker
>>>> knowledge
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> And, I would add, templates aren't used much for Web UI-s anymore, so
>>>>>>> these
>>>>>>>> alternate use cases become the main ones.
>>>>>>>> 
>>>>>>>> 
>>>>>>>>> * And it should become part of the Apache Freemarker project - much
>>>>>>> better
>>>>>>>>> visibility & broader user base
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> Yeah, the last point is what I'm going for really. But that's also
>>>> why I
>>>>>>>> hope that you feel like making it more general. Or at least has no
>>>>>>> negative
>>>>>>>> feelings about it.
>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>> Also, some things that you miss for FreeMarker itself for it to be
>>>> more
>>>>>>>>>> fitting for the task?
>>>>>>>>> 
>>>>>>>>> Support for Java 8 Date/Time API - last time I looked at it it was
>>>> not
>>>>>>>>> supported by FreeMarker and it's a bummer since nobody is using
>>>> Date any
>>>>>>>>> longer ...
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> Yeah... it still isn't. It's probably among the new few things to
>>>> add at
>>>>>>>> this point, as it's long due.
>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> On Sun, Nov 17, 2019 at 7:02 PM Siegfried Goeschl <
>>>>>>>>>> siegfried.goeschl@gmail.com <ma...@gmail.com>
>>>> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com>>
>>>>>>> <mailto:siegfried.goeschl@gmail.com <mailto:
>>>> siegfried.goeschl@gmail.com> <mailto:siegfried.goeschl@gmail.com <mailto:
>>>> siegfried.goeschl@gmail.com>>>>
>>>>>>> wrote:
>>>>>>>>>> 
>>>>>>>>>>> Hi folks,
>>>>>>>>>>> 
>>>>>>>>>>> since I'm currently mostly busy with non-coding tasks I spent some
>>>>>>> time
>>>>>>>>>>> honing my coding skills - probably to no avail as my colleagues
>>>> would
>>>>>>>>> say
>>>>>>>>>>> ;-)
>>>>>>>>>>> 
>>>>>>>>>>> 1) I migrated my pet project "freemarker-cli" from Groovy to JDK 8
>>>>>>> (see
>>>>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>>>> https://github.com/sgoeschl/freemarker-cli> <
>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>>>> https://github.com/sgoeschl/freemarker-cli>> <
>>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>>>> https://github.com/sgoeschl/freemarker-cli> <
>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>>>> https://github.com/sgoeschl/freemarker-cli>>> <
>>>>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>>>> https://github.com/sgoeschl/freemarker-cli> <
>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>>>> https://github.com/sgoeschl/freemarker-cli>> <
>>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>>>> https://github.com/sgoeschl/freemarker-cli> <
>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>>>> https://github.com/sgoeschl/freemarker-cli>>>>)
>>>>>>>>>>> 
>>>>>>>>>>> 2) At
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>> <
>>>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>> 
>>>>>>> <
>>>>>>> 
>>>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>> <
>>>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>> 
>>>>>>>> 
>>>>>>>>> <
>>>>>>>>> 
>>>>>>> 
>>>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>> <
>>>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>> 
>>>>>>> <
>>>>>>> 
>>>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>> <
>>>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>> 
>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>> <
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>>> <
>>>>>>> 
>>>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>>>> 
>>>>>>>>> <
>>>>>>>>> 
>>>>>>> 
>>>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>>> <
>>>>>>> 
>>>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> you find a presentation I gave some while ago
>>>>>>>>>>> 
>>>>>>>>>>> 3) I also wrote a Spring Boot FreeMarker sample project as part
>>>> of the
>>>>>>>>>>> presentation (see
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>> <
>>>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>> 
>>>>>>> <
>>>>>>> 
>>>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>> <
>>>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>> 
>>>>>>>> 
>>>>>>>>> <
>>>>>>>>> 
>>>>>>> 
>>>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>> <
>>>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>> 
>>>>>>> <
>>>>>>> 
>>>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>> <
>>>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>> 
>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>> <
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>>> <
>>>>>>> 
>>>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>>>> 
>>>>>>>>> <
>>>>>>>>> 
>>>>>>> 
>>>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>>> <
>>>>>>> 
>>>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>>> )
>>>>>>>>>>> 
>>>>>>>>>>> My plans / questions
>>>>>>>>>>> 
>>>>>>>>>>> I would be awesome if I could get some feedback about
>>>> "freemarker-cli"
>>>>>>>>> in
>>>>>>>>>>> its current JDK incarnation :-) Later on I will release 2.0.0 and
>>>> push
>>>>>>>>> it
>>>>>>>>>>> to Maven Central.
>>>>>>>>>>> 
>>>>>>>>>>> In the mean time I wrote three applications (micro services in new
>>>>>>>>> speak)
>>>>>>>>>>> using Apache FreeMarker and found it hard to find a starting point
>>>>>>> for a
>>>>>>>>>>> Spring Boot applications - therefore I wrote the sample project
>>>> (see
>>>>>>>>>>> above). One way or the other a Spring Boot (and Micronaut) blue
>>>> print
>>>>>>>>>>> should find its way into Apache FreeMarker officially. I think
>>>> Apache
>>>>>>>>>>> FreeMarker is awesome for adding a developer UI to some micro
>>>> service
>>>>>>>>> but
>>>>>>>>>>> developers don't care about the template engine but only about a
>>>> quick
>>>>>>>>> and
>>>>>>>>>>> painless way to get the job done ...
>>>>>>>>>>> 
>>>>>>>>>>> Anyone volunteering to give a presentation about Apache
>>>> Freemarker at
>>>>>>>>>>> ApacheCon? I could do but I'm not really qualified :-)
>>>>>>>>>>> 
>>>>>>>>>>> Thanks in advance,
>>>>>>>>>>> 
>>>>>>>>>>> Siegfried Goeschl
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> --
>>>>>>>>>> Best regards,
>>>>>>>>>> Daniel Dekany
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> --
>>>>>>>> Best regards,
>>>>>>>> Daniel Dekany
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> Best regards,
>>>>>> Daniel Dekany
>>>>> 
>>>> 
>>> 
>>> 
>>> --
>>> Best regards,
>>> Daniel Dekany
>> 


Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Woonsan Ko <wo...@apache.org>.
Sounds good! :-)
If we communicate well to each other explaining different use cases,
then we can improve it together in this community. I believe everybody
here is open to any new improvements for the community even if some
features are not relevant to themselves. That's why we join the ASF.
;-)

Cheers,

Woonsan

On Thu, Dec 19, 2019 at 6:38 AM Siegfried Goeschl
<si...@gmail.com> wrote:
>
> Hi folks,
>
> I’m okay with the things :-)
>
> Thanks in advance,
>
> Siegfried Goeschl
>
>
> > On 18 Dec 2019, at 20:38, Daniel Dekany <da...@gmail.com> wrote:
> >
> > Yes, these can done after V1 or whatever. But it's still important if
> > Siegfried will be OK with such things, or will lose motivation because it's
> > not how he likes his own kid. More code without more developers probably
> > won't work out well, given how little developer time even FM core gets.
> >
> > As of nested output files, I agree (and BTW, FMPP also have a nested output
> > directive, not just starting a new). I also understand that it breaks the
> > clean mental model, but if (if...) this is what's reasonably often needed
> > in reality, then certainly the mental model should bend.
> >
> > On Wed, Dec 18, 2019 at 8:01 PM Woonsan Ko <wo...@apache.org> wrote:
> >
> >> On Wed, Dec 18, 2019 at 11:23 AM Siegfried Goeschl
> >> <si...@gmail.com> wrote:
> >>>
> >>> Hi Daniel,
> >>>
> >>> please see my comments below …
> >>>
> >>> Thanks in advance,
> >>>
> >>> Siegfried Goeschl
> >>>
> >>>
> >>>> On 18 Dec 2019, at 16:58, Daniel Dekany <da...@gmail.com>
> >> wrote:
> >>>>
> >>>> Multiple output files: How open are you to the idea if someone else
> >> wants
> >>>> to add that though? The use-case is when it's input data that drives
> >> what
> >>>> output files you will have (as in my example with the employees), and
> >>>> working that around with multiple invocations is not very nice.
> >>>>
> >>>
> >>> Suggestive question - it is an Open Source project after all :-)
> >>>
> >>> * As long as it is hosted on my GitHub repo I can ultimately reject PRs
> >> if I’m really unhappy about them but repos can be forked
> >>> * If it becomes part of Apache FreeMarker project than there are more
> >> qualified developers out there to make a decision
> >>>
> >>> Regarding the implementation
> >>>
> >>> * Multiple output files violates my my mental model since you can’t use
> >> stdout any longer
> >>> * It could break the CommonsCSV integration since I’m using CSVPrinter
> >> sitting on FreeMarker’s output stream (which changes when using multiple
> >> output files)
> >>> * Last but not least I have not enough experience / requirements to come
> >> up with a useful implementation from the scratch
> >>
> >> In my head, we may introduce a new directive to specify a different
> >> output for the nested things, instead of the _default_ STDOUT, in the
> >> future. For example,
> >>
> >> hello,
> >> <#output file="another.csv">
> >>  something else...
> >> </#output>
> >> world!
> >>
> >> So, by default "hello,\nworld!" to STDOUT, "something else..." to the
> >> extra file.
> >> This seems better to me than "changing output and closing the current
> >> output" approach in FMPP.
> >>
> >> But this improvement can be done together once Siegfried _donates_ his
> >> project to Apache FreeMarker. ;-)
> >>
> >>>
> >>>> Default locale:
> >>>> And also default charset to UTF-8, if that wasn't done.
> >>>
> >>> UTF-8 is the default
> >>>
> >>>>
> >>>> JDBC drivers: There was some discussion of how to add user defined
> >> classes
> >>>> to the tool earlier. Well, I guess it's about the same as you add your
> >> own
> >>>> jar-s to the classpath too, so, it shouldn't be a big deal. That could
> >>>> solve this side of the JDBC problem as well. As of storing credentials,
> >>>> that has to be solved when using external tools as well... but my
> >> practical
> >>>> experience is that people just put them in to a config file as plain
> >> text
> >>>> (maybe on a drive that has to be mounted with password first), or bind
> >> it
> >>>> to the OS user.
> >>>
> >>> The problem is more subtle - I want to provide a well-behaved command
> >> line tool
> >>>
> >>> * What happens if you update the freemarker-cli installation on your box?
> >>> * How do you easily distinguish between your custom JARs and the
> >> initially installed ones?
> >>> * How does it look like if you install freemarker-cli with package
> >> managers, e.g. brew?
> >>
> >> I guess it should be fine as an initial version even if there's no
> >> separation between system libs and custom libs (such as JDBC drivers).
> >> If there's a tool for easy JDBC access, it would be nice in practices.
> >> I don't think it should be perfect from V1.
> >>
> >> Regards,
> >>
> >> Woonsan
> >>
> >>>
> >>> Current state
> >>>
> >>> * Custom tools can be instantiated using the freemarker-cli-properties
> >>> * For the templates I use ~/.freemarker-cli directory to have a clean
> >> separation
> >>> * There is no really nice solution for JARs - I might tweak the Maven
> >> plugin creating the Unix & Windows wrappers - you can already create an
> >> “endorsed” directory there to place custom JARs
> >>>
> >>>>
> >>>> Yes, Spring support is definitely important, given the omnipresence of
> >>>> Spring. It's not just web pages there, but e-mail templates
> >> (especially as
> >>>> there modern the UI technologies that has taken over at most places,
> >> aren't
> >>>> applicable). Would be good if someone can take ownership of that
> >> aspect for
> >>>> FreeMarker 2, probably using what was done in FM3. (Or maybe the same
> >>>> resources are better redirected to pushing FM3... who knows. There are
> >>>> really no resources to push two branches in parallel.)
> >>>>
> >>>> On Wed, Dec 18, 2019 at 2:02 PM Siegfried Goeschl <
> >>>> siegfried.goeschl@gmail.com <ma...@gmail.com>>
> >> wrote:
> >>>>
> >>>>> Hi Daniel,
> >>>>>
> >>>>> try to write a top-level post to keep the discussion readable
> >>>>>
> >>>>>
> >>>>> Ad Multi-file Output
> >>>>> ===============================================================
> >>>>>
> >>>>> Currently no plans to implement it - I personally don’t have a need
> >> for it
> >>>>> and it is a hypothetical requirement for now
> >>>>>
> >>>>>
> >>>>> Ad POI Integration
> >>>>> ===============================================================
> >>>>>
> >>>>> No problem in exposing the non-String data - it is a good idea and
> >> will be
> >>>>> implemented
> >>>>>
> >>>>>
> >>>>> Ad Default Locale
> >>>>> ===============================================================
> >>>>>
> >>>>> * I need to define a locale for the unit tests
> >>>>> * I guess it is a good idea to pin it to “en_US” to avoid suprises
> >>>>>
> >>>>>
> >>>>> Ad JDBC Access
> >>>>> ===============================================================
> >>>>>
> >>>>> It is part of a wider problem - when leaving the document-centric
> >> approach
> >>>>> into scripting there is a lot of useful functionality, e.g. JDBC and
> >> HTTP
> >>>>> clients.
> >>>>>
> >>>>> The problems
> >>>>>
> >>>>> * JDBC: You need to add JDBC drivers, where to store the credentials,
> >>>>> database schema, ...
> >>>>> * HTTP: More libraries, certificates, proxy support,...
> >>>>>
> >>>>> It is possible to implement something but it will never work properly
> >> so I
> >>>>> decided to tackle the problem differently b using commons-exec
> >>>>>
> >>>>> * REST calls can be easily made by invoking cURL
> >>>>> * Database command line clients can export the result of a SELECT
> >> query to
> >>>>> a CSV file
> >>>>>
> >>>>>
> >>>>> Ad Templates aren't used much for Web UI-s anymore
> >>>>> ===============================================================
> >>>>>
> >>>>> Yes and no - IMHO it is quite useful to embed a UI into certain "micro
> >>>>> services”. Therefore I think that a ready-to-use Spring Boot (&
> >> Micronaut,
> >>>>> etc..) integration is important and should not be an afterthought.
> >>>>>
> >>>>>
> >>>>> Thanks in advance,
> >>>>>
> >>>>> Siegfried Goeschl
> >>>>>
> >>>>>
> >>>>>> On 18 Dec 2019, at 01:32, Daniel Dekany <da...@gmail.com>
> >> wrote:
> >>>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> Find my comments inline below.
> >>>>>>
> >>>>>> On Tue, Dec 17, 2019 at 10:46 PM Siegfried Goeschl <
> >>>>>> siegfried.goeschl@gmail.com <ma...@gmail.com>
> >> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com>>>
> >> wrote:
> >>>>>>
> >>>>>>> Hi Daniel,
> >>>>>>>
> >>>>>>> Thanks for spending your time - feed back is always appreciated when
> >>>>> doing
> >>>>>>> things in isolation ....
> >>>>>>>
> >>>>>>> Please see my comments below
> >>>>>>>
> >>>>>>> Thanks in advance,
> >>>>>>>
> >>>>>>> Siegfried Goeschl
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>> On 17.12.2019, at 19:19, Daniel Dekany <daniel.dekany@gmail.com
> >> <ma...@gmail.com>>
> >>>>> wrote:
> >>>>>>>>
> >>>>>>>> Hi Siegfried,
> >>>>>>>>
> >>>>>>>> Looks good!
> >>>>>>>>
> >>>>>>>> Some random things I happened to notice:
> >>>>>>>>
> >>>>>>>> - The ability generating multiple output files from the same
> >> template
> >>>>>>>> would be worthy addition. Like you load a CSV file that has
> >> employees
> >>>>>>> in
> >>>>>>>> it, and based on that you generate one output file per department.
> >> Or
> >>>>>>> even
> >>>>>>>> one per employee. (There could directives for that, like
> >>>>>>> changeOutputFile,
> >>>>>>>> nestOutputFile, etc. on
> >>>>> http://fmpp.sourceforge.net/pphash.html#sect17 <
> >> http://fmpp.sourceforge.net/pphash.html#sect17>
> >>>>>>> <http://fmpp.sourceforge.net/pphash.html#sect17 <
> >> http://fmpp.sourceforge.net/pphash.html#sect17> <
> >>>>> http://fmpp.sourceforge.net/pphash.html#sect17 <
> >> http://fmpp.sourceforge.net/pphash.html#sect17>>>)
> >>>>>>>
> >>>>>>> Well, I simply don't need it and it complicates things - in simple
> >> cases
> >>>>>>> one could just re-run the freemarker-cli with a different template
> >>>>> and/or
> >>>>>>> parameters
> >>>>>>>
> >>>>>>
> >>>>>> My feeling is that if there's a tool that's about transforming some
> >> files
> >>>>>> to other files, but the idea that a single invocation can yield
> >> multiple
> >>>>>> output files is not part of it, one way or another (i.e., not
> >> necessarily
> >>>>>> in the way it was in FMPP), it might turns out to be a limiting
> >> design
> >>>>>> decision later as feature request start to pour in. And then it can
> >> be
> >>>>> hard
> >>>>>> to add as an afterthought. Well, maybe I'm wrong, as I have no
> >> statics
> >>>>>> about how often it's needed. FMPP users did use it (myself included),
> >>>>> some
> >>>>>> of them at least.
> >>>>>>
> >>>>>>
> >>>>>>>> - When I load an XLSX, I get back values as string, not as
> >> numbers, or
> >>>>>>>> dates. I'm not sure how hard it is to solve though (I don't
> >> remember
> >>>>>>> POI
> >>>>>>>> much).
> >>>>>>>
> >>>>>>> That should not be too hard - I actually use
> >>>>>>> org.apache.poi.ss.usermodel.DataFormatter to create the strings
> >>>>>>
> >>>>>>
> >>>>>> If templates get numbers etc., or have a such choice at least, then
> >> they
> >>>>>> can compare numbers, filter based on their values, control the
> >>>>> formatting,
> >>>>>> etc. My idea here is that an Excel file, CSV file, whatever, is just
> >> a
> >>>>> pure
> >>>>>> data, and rendering/formatting is the duty of the templates.
> >>>>>>
> >>>>>>
> >>>>>>>> BTW, the strings I get back are formatted with the locale of the
> >> OS,
> >>>>>>>
> >>>>>>> which is a problem. I guess there should be an config option to set
> >> the
> >>>>>>> JVM
> >>>>>>>> locale. (The ExcelToolTest fails on my computer with locale hu_HU
> >> for
> >>>>>>>> somewhat similar reason, as it gets "100,00" instead of "100.00".)
> >>>>>>>
> >>>>>>> On the command line you can use
> >>>>>>>
> >>>>>>> -l, --locale=<locale>     Locale being used for output file, e.g.
> >>>>> 'en_US'
> >>>>>>>
> >>>>>>> but I guess I should provide a fixed locale for the unit tests
> >>>>>>>
> >>>>>>
> >>>>>> The problem is not how FreeMarker renders the numbers. It already
> >> gets
> >>>>>> strings like that from POI, and --locale doesn't influence POI.
> >>>>>>
> >>>>>> As of the default locale, for these kind of tools, I believe that
> >> using
> >>>>>> system defaults is usually evil. So having a fixed default is maybe
> >> not
> >>>>>> just for unit tests. The locale of my computer, or wherever I run a
> >> job
> >>>>> on
> >>>>>> (often some backend linux box) should be usually irrelevant, and not
> >>>>>> influence the output. Not to mention when team mates share the
> >> project,
> >>>>> in
> >>>>>> an international team.
> >>>>>>
> >>>>>>> - Querying from relation databases (JDBC) would be probably an
> >> useful
> >>>>>>>> addition (it doesn't fit the Document paradigm though).
> >>>>>>>
> >>>>>>> I integrated commons-exec and triggered AWS CLI - basically you
> >> capture
> >>>>>>> the output of any command-line invocation and process it. Just need
> >> to
> >>>>> make
> >>>>>>> sure that every tool supports processing raw strings ...
> >>>>>>>
> >>>>>>
> >>>>>> I'm note sure what do you mean. The result of a query is a structured
> >>>>> data,
> >>>>>> with column names and non-string types, so I guess command-line
> >>>>> invocation
> >>>>>> can't solve that too well.
> >>>>>>
> >>>>>>
> >>>>>>>> It would be good if there's some de-facto tool for these kind of
> >> things
> >>>>>>>> than what freemarker-cli does. I guess there's a few such tools in
> >>>>>>> company
> >>>>>>>> repos, but of course those have no potential to become more
> >> generic and
> >>>>>>>> being published. (freemarker-generator was a such toll though, but
> >> it
> >>>>>>>> didn't go anywhere after donation. Actually, FMPP was a such tool
> >> too,
> >>>>>>> that
> >>>>>>>> I used for some sysadmin/webadmin tasks some 15+ years ago.) But of
> >>>>>>> course,
> >>>>>>>> long term care is the tricky issue with any project that has no
> >> company
> >>>>>>>> truly behind it (i.e., no payed developers). Do you have you have
> >> any
> >>>>>>>> thoughts/plans regarding the longer term life of freemarker-cli?
> >>>>>>>
> >>>>>>> I worked on a couple of not soo successful Open Source projects -
> >> yes,
> >>>>> it
> >>>>>>> might become another Open Source GitHub project nobody knows /
> >> cares :-)
> >>>>>>>
> >>>>>>> Having said that
> >>>>>>>
> >>>>>>> * I'm maintaining it already for a few of years and I will always
> >> find
> >>>>>>> some things I can do with it
> >>>>>>> * It is useful for some common tasks when you have a Java background
> >>>>>>> * I think it is a great way to re-use or build up FreeMarker
> >> knowledge
> >>>>>>>
> >>>>>>
> >>>>>> And, I would add, templates aren't used much for Web UI-s anymore, so
> >>>>> these
> >>>>>> alternate use cases become the main ones.
> >>>>>>
> >>>>>>
> >>>>>>> * And it should become part of the Apache Freemarker project - much
> >>>>> better
> >>>>>>> visibility & broader user base
> >>>>>>>
> >>>>>>
> >>>>>> Yeah, the last point is what I'm going for really. But that's also
> >> why I
> >>>>>> hope that you feel like making it more general. Or at least has no
> >>>>> negative
> >>>>>> feelings about it.
> >>>>>>
> >>>>>>>
> >>>>>>>> Also, some things that you miss for FreeMarker itself for it to be
> >> more
> >>>>>>>> fitting for the task?
> >>>>>>>
> >>>>>>> Support for Java 8 Date/Time API - last time I looked at it it was
> >> not
> >>>>>>> supported by FreeMarker and it's a bummer since nobody is using
> >> Date any
> >>>>>>> longer ...
> >>>>>>>
> >>>>>>
> >>>>>> Yeah... it still isn't. It's probably among the new few things to
> >> add at
> >>>>>> this point, as it's long due.
> >>>>>>
> >>>>>>>
> >>>>>>>>
> >>>>>>>> On Sun, Nov 17, 2019 at 7:02 PM Siegfried Goeschl <
> >>>>>>>> siegfried.goeschl@gmail.com <ma...@gmail.com>
> >> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com>>
> >>>>> <mailto:siegfried.goeschl@gmail.com <mailto:
> >> siegfried.goeschl@gmail.com> <mailto:siegfried.goeschl@gmail.com <mailto:
> >> siegfried.goeschl@gmail.com>>>>
> >>>>> wrote:
> >>>>>>>>
> >>>>>>>>> Hi folks,
> >>>>>>>>>
> >>>>>>>>> since I'm currently mostly busy with non-coding tasks I spent some
> >>>>> time
> >>>>>>>>> honing my coding skills - probably to no avail as my colleagues
> >> would
> >>>>>>> say
> >>>>>>>>> ;-)
> >>>>>>>>>
> >>>>>>>>> 1) I migrated my pet project "freemarker-cli" from Groovy to JDK 8
> >>>>> (see
> >>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
> >> https://github.com/sgoeschl/freemarker-cli> <
> >>>>> https://github.com/sgoeschl/freemarker-cli <
> >> https://github.com/sgoeschl/freemarker-cli>> <
> >>>>>>> https://github.com/sgoeschl/freemarker-cli <
> >> https://github.com/sgoeschl/freemarker-cli> <
> >>>>> https://github.com/sgoeschl/freemarker-cli <
> >> https://github.com/sgoeschl/freemarker-cli>>> <
> >>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
> >> https://github.com/sgoeschl/freemarker-cli> <
> >>>>> https://github.com/sgoeschl/freemarker-cli <
> >> https://github.com/sgoeschl/freemarker-cli>> <
> >>>>>>> https://github.com/sgoeschl/freemarker-cli <
> >> https://github.com/sgoeschl/freemarker-cli> <
> >>>>> https://github.com/sgoeschl/freemarker-cli <
> >> https://github.com/sgoeschl/freemarker-cli>>>>)
> >>>>>>>>>
> >>>>>>>>> 2) At
> >>>>>>>>>
> >>>>>>>
> >>>>>
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >> <
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>
> >>>>> <
> >>>>>
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >> <
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>
> >>>>>>
> >>>>>>> <
> >>>>>>>
> >>>>>
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >> <
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>
> >>>>> <
> >>>>>
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >> <
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>
> >>>>>>
> >>>>>>>>
> >>>>>>>>> <
> >>>>>>>>>
> >>>>>>>
> >>>>>
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>>> <
> >>>>>
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>>>>
> >>>>>>> <
> >>>>>>>
> >>>>>
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>>> <
> >>>>>
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>>>>
> >>>>>>>>>
> >>>>>>>>> you find a presentation I gave some while ago
> >>>>>>>>>
> >>>>>>>>> 3) I also wrote a Spring Boot FreeMarker sample project as part
> >> of the
> >>>>>>>>> presentation (see
> >>>>>>>>>
> >>>>>>>
> >>>>>
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >> <
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>
> >>>>> <
> >>>>>
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >> <
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>
> >>>>>>
> >>>>>>> <
> >>>>>>>
> >>>>>
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >> <
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>
> >>>>> <
> >>>>>
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >> <
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>
> >>>>>>
> >>>>>>>>
> >>>>>>>>> <
> >>>>>>>>>
> >>>>>>>
> >>>>>
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>>> <
> >>>>>
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>>>>
> >>>>>>> <
> >>>>>>>
> >>>>>
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>>> <
> >>>>>
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>>>>
> >>>>>>>>
> >>>>>>>>>> )
> >>>>>>>>>
> >>>>>>>>> My plans / questions
> >>>>>>>>>
> >>>>>>>>> I would be awesome if I could get some feedback about
> >> "freemarker-cli"
> >>>>>>> in
> >>>>>>>>> its current JDK incarnation :-) Later on I will release 2.0.0 and
> >> push
> >>>>>>> it
> >>>>>>>>> to Maven Central.
> >>>>>>>>>
> >>>>>>>>> In the mean time I wrote three applications (micro services in new
> >>>>>>> speak)
> >>>>>>>>> using Apache FreeMarker and found it hard to find a starting point
> >>>>> for a
> >>>>>>>>> Spring Boot applications - therefore I wrote the sample project
> >> (see
> >>>>>>>>> above). One way or the other a Spring Boot (and Micronaut) blue
> >> print
> >>>>>>>>> should find its way into Apache FreeMarker officially. I think
> >> Apache
> >>>>>>>>> FreeMarker is awesome for adding a developer UI to some micro
> >> service
> >>>>>>> but
> >>>>>>>>> developers don't care about the template engine but only about a
> >> quick
> >>>>>>> and
> >>>>>>>>> painless way to get the job done ...
> >>>>>>>>>
> >>>>>>>>> Anyone volunteering to give a presentation about Apache
> >> Freemarker at
> >>>>>>>>> ApacheCon? I could do but I'm not really qualified :-)
> >>>>>>>>>
> >>>>>>>>> Thanks in advance,
> >>>>>>>>>
> >>>>>>>>> Siegfried Goeschl
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>> --
> >>>>>>>> Best regards,
> >>>>>>>> Daniel Dekany
> >>>>>>>
> >>>>>>
> >>>>>> --
> >>>>>> Best regards,
> >>>>>> Daniel Dekany
> >>>>>
> >>>>>
> >>>>
> >>>> --
> >>>> Best regards,
> >>>> Daniel Dekany
> >>>
> >>
> >
> >
> > --
> > Best regards,
> > Daniel Dekany
>

Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Siegfried Goeschl <si...@gmail.com>.
Hi folks,

I’m okay with the things :-)

Thanks in advance, 

Siegfried Goeschl


> On 18 Dec 2019, at 20:38, Daniel Dekany <da...@gmail.com> wrote:
> 
> Yes, these can done after V1 or whatever. But it's still important if
> Siegfried will be OK with such things, or will lose motivation because it's
> not how he likes his own kid. More code without more developers probably
> won't work out well, given how little developer time even FM core gets.
> 
> As of nested output files, I agree (and BTW, FMPP also have a nested output
> directive, not just starting a new). I also understand that it breaks the
> clean mental model, but if (if...) this is what's reasonably often needed
> in reality, then certainly the mental model should bend.
> 
> On Wed, Dec 18, 2019 at 8:01 PM Woonsan Ko <wo...@apache.org> wrote:
> 
>> On Wed, Dec 18, 2019 at 11:23 AM Siegfried Goeschl
>> <si...@gmail.com> wrote:
>>> 
>>> Hi Daniel,
>>> 
>>> please see my comments below …
>>> 
>>> Thanks in advance,
>>> 
>>> Siegfried Goeschl
>>> 
>>> 
>>>> On 18 Dec 2019, at 16:58, Daniel Dekany <da...@gmail.com>
>> wrote:
>>>> 
>>>> Multiple output files: How open are you to the idea if someone else
>> wants
>>>> to add that though? The use-case is when it's input data that drives
>> what
>>>> output files you will have (as in my example with the employees), and
>>>> working that around with multiple invocations is not very nice.
>>>> 
>>> 
>>> Suggestive question - it is an Open Source project after all :-)
>>> 
>>> * As long as it is hosted on my GitHub repo I can ultimately reject PRs
>> if I’m really unhappy about them but repos can be forked
>>> * If it becomes part of Apache FreeMarker project than there are more
>> qualified developers out there to make a decision
>>> 
>>> Regarding the implementation
>>> 
>>> * Multiple output files violates my my mental model since you can’t use
>> stdout any longer
>>> * It could break the CommonsCSV integration since I’m using CSVPrinter
>> sitting on FreeMarker’s output stream (which changes when using multiple
>> output files)
>>> * Last but not least I have not enough experience / requirements to come
>> up with a useful implementation from the scratch
>> 
>> In my head, we may introduce a new directive to specify a different
>> output for the nested things, instead of the _default_ STDOUT, in the
>> future. For example,
>> 
>> hello,
>> <#output file="another.csv">
>>  something else...
>> </#output>
>> world!
>> 
>> So, by default "hello,\nworld!" to STDOUT, "something else..." to the
>> extra file.
>> This seems better to me than "changing output and closing the current
>> output" approach in FMPP.
>> 
>> But this improvement can be done together once Siegfried _donates_ his
>> project to Apache FreeMarker. ;-)
>> 
>>> 
>>>> Default locale:
>>>> And also default charset to UTF-8, if that wasn't done.
>>> 
>>> UTF-8 is the default
>>> 
>>>> 
>>>> JDBC drivers: There was some discussion of how to add user defined
>> classes
>>>> to the tool earlier. Well, I guess it's about the same as you add your
>> own
>>>> jar-s to the classpath too, so, it shouldn't be a big deal. That could
>>>> solve this side of the JDBC problem as well. As of storing credentials,
>>>> that has to be solved when using external tools as well... but my
>> practical
>>>> experience is that people just put them in to a config file as plain
>> text
>>>> (maybe on a drive that has to be mounted with password first), or bind
>> it
>>>> to the OS user.
>>> 
>>> The problem is more subtle - I want to provide a well-behaved command
>> line tool
>>> 
>>> * What happens if you update the freemarker-cli installation on your box?
>>> * How do you easily distinguish between your custom JARs and the
>> initially installed ones?
>>> * How does it look like if you install freemarker-cli with package
>> managers, e.g. brew?
>> 
>> I guess it should be fine as an initial version even if there's no
>> separation between system libs and custom libs (such as JDBC drivers).
>> If there's a tool for easy JDBC access, it would be nice in practices.
>> I don't think it should be perfect from V1.
>> 
>> Regards,
>> 
>> Woonsan
>> 
>>> 
>>> Current state
>>> 
>>> * Custom tools can be instantiated using the freemarker-cli-properties
>>> * For the templates I use ~/.freemarker-cli directory to have a clean
>> separation
>>> * There is no really nice solution for JARs - I might tweak the Maven
>> plugin creating the Unix & Windows wrappers - you can already create an
>> “endorsed” directory there to place custom JARs
>>> 
>>>> 
>>>> Yes, Spring support is definitely important, given the omnipresence of
>>>> Spring. It's not just web pages there, but e-mail templates
>> (especially as
>>>> there modern the UI technologies that has taken over at most places,
>> aren't
>>>> applicable). Would be good if someone can take ownership of that
>> aspect for
>>>> FreeMarker 2, probably using what was done in FM3. (Or maybe the same
>>>> resources are better redirected to pushing FM3... who knows. There are
>>>> really no resources to push two branches in parallel.)
>>>> 
>>>> On Wed, Dec 18, 2019 at 2:02 PM Siegfried Goeschl <
>>>> siegfried.goeschl@gmail.com <ma...@gmail.com>>
>> wrote:
>>>> 
>>>>> Hi Daniel,
>>>>> 
>>>>> try to write a top-level post to keep the discussion readable
>>>>> 
>>>>> 
>>>>> Ad Multi-file Output
>>>>> ===============================================================
>>>>> 
>>>>> Currently no plans to implement it - I personally don’t have a need
>> for it
>>>>> and it is a hypothetical requirement for now
>>>>> 
>>>>> 
>>>>> Ad POI Integration
>>>>> ===============================================================
>>>>> 
>>>>> No problem in exposing the non-String data - it is a good idea and
>> will be
>>>>> implemented
>>>>> 
>>>>> 
>>>>> Ad Default Locale
>>>>> ===============================================================
>>>>> 
>>>>> * I need to define a locale for the unit tests
>>>>> * I guess it is a good idea to pin it to “en_US” to avoid suprises
>>>>> 
>>>>> 
>>>>> Ad JDBC Access
>>>>> ===============================================================
>>>>> 
>>>>> It is part of a wider problem - when leaving the document-centric
>> approach
>>>>> into scripting there is a lot of useful functionality, e.g. JDBC and
>> HTTP
>>>>> clients.
>>>>> 
>>>>> The problems
>>>>> 
>>>>> * JDBC: You need to add JDBC drivers, where to store the credentials,
>>>>> database schema, ...
>>>>> * HTTP: More libraries, certificates, proxy support,...
>>>>> 
>>>>> It is possible to implement something but it will never work properly
>> so I
>>>>> decided to tackle the problem differently b using commons-exec
>>>>> 
>>>>> * REST calls can be easily made by invoking cURL
>>>>> * Database command line clients can export the result of a SELECT
>> query to
>>>>> a CSV file
>>>>> 
>>>>> 
>>>>> Ad Templates aren't used much for Web UI-s anymore
>>>>> ===============================================================
>>>>> 
>>>>> Yes and no - IMHO it is quite useful to embed a UI into certain "micro
>>>>> services”. Therefore I think that a ready-to-use Spring Boot (&
>> Micronaut,
>>>>> etc..) integration is important and should not be an afterthought.
>>>>> 
>>>>> 
>>>>> Thanks in advance,
>>>>> 
>>>>> Siegfried Goeschl
>>>>> 
>>>>> 
>>>>>> On 18 Dec 2019, at 01:32, Daniel Dekany <da...@gmail.com>
>> wrote:
>>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> Find my comments inline below.
>>>>>> 
>>>>>> On Tue, Dec 17, 2019 at 10:46 PM Siegfried Goeschl <
>>>>>> siegfried.goeschl@gmail.com <ma...@gmail.com>
>> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com>>>
>> wrote:
>>>>>> 
>>>>>>> Hi Daniel,
>>>>>>> 
>>>>>>> Thanks for spending your time - feed back is always appreciated when
>>>>> doing
>>>>>>> things in isolation ....
>>>>>>> 
>>>>>>> Please see my comments below
>>>>>>> 
>>>>>>> Thanks in advance,
>>>>>>> 
>>>>>>> Siegfried Goeschl
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>>> On 17.12.2019, at 19:19, Daniel Dekany <daniel.dekany@gmail.com
>> <ma...@gmail.com>>
>>>>> wrote:
>>>>>>>> 
>>>>>>>> Hi Siegfried,
>>>>>>>> 
>>>>>>>> Looks good!
>>>>>>>> 
>>>>>>>> Some random things I happened to notice:
>>>>>>>> 
>>>>>>>> - The ability generating multiple output files from the same
>> template
>>>>>>>> would be worthy addition. Like you load a CSV file that has
>> employees
>>>>>>> in
>>>>>>>> it, and based on that you generate one output file per department.
>> Or
>>>>>>> even
>>>>>>>> one per employee. (There could directives for that, like
>>>>>>> changeOutputFile,
>>>>>>>> nestOutputFile, etc. on
>>>>> http://fmpp.sourceforge.net/pphash.html#sect17 <
>> http://fmpp.sourceforge.net/pphash.html#sect17>
>>>>>>> <http://fmpp.sourceforge.net/pphash.html#sect17 <
>> http://fmpp.sourceforge.net/pphash.html#sect17> <
>>>>> http://fmpp.sourceforge.net/pphash.html#sect17 <
>> http://fmpp.sourceforge.net/pphash.html#sect17>>>)
>>>>>>> 
>>>>>>> Well, I simply don't need it and it complicates things - in simple
>> cases
>>>>>>> one could just re-run the freemarker-cli with a different template
>>>>> and/or
>>>>>>> parameters
>>>>>>> 
>>>>>> 
>>>>>> My feeling is that if there's a tool that's about transforming some
>> files
>>>>>> to other files, but the idea that a single invocation can yield
>> multiple
>>>>>> output files is not part of it, one way or another (i.e., not
>> necessarily
>>>>>> in the way it was in FMPP), it might turns out to be a limiting
>> design
>>>>>> decision later as feature request start to pour in. And then it can
>> be
>>>>> hard
>>>>>> to add as an afterthought. Well, maybe I'm wrong, as I have no
>> statics
>>>>>> about how often it's needed. FMPP users did use it (myself included),
>>>>> some
>>>>>> of them at least.
>>>>>> 
>>>>>> 
>>>>>>>> - When I load an XLSX, I get back values as string, not as
>> numbers, or
>>>>>>>> dates. I'm not sure how hard it is to solve though (I don't
>> remember
>>>>>>> POI
>>>>>>>> much).
>>>>>>> 
>>>>>>> That should not be too hard - I actually use
>>>>>>> org.apache.poi.ss.usermodel.DataFormatter to create the strings
>>>>>> 
>>>>>> 
>>>>>> If templates get numbers etc., or have a such choice at least, then
>> they
>>>>>> can compare numbers, filter based on their values, control the
>>>>> formatting,
>>>>>> etc. My idea here is that an Excel file, CSV file, whatever, is just
>> a
>>>>> pure
>>>>>> data, and rendering/formatting is the duty of the templates.
>>>>>> 
>>>>>> 
>>>>>>>> BTW, the strings I get back are formatted with the locale of the
>> OS,
>>>>>>> 
>>>>>>> which is a problem. I guess there should be an config option to set
>> the
>>>>>>> JVM
>>>>>>>> locale. (The ExcelToolTest fails on my computer with locale hu_HU
>> for
>>>>>>>> somewhat similar reason, as it gets "100,00" instead of "100.00".)
>>>>>>> 
>>>>>>> On the command line you can use
>>>>>>> 
>>>>>>> -l, --locale=<locale>     Locale being used for output file, e.g.
>>>>> 'en_US'
>>>>>>> 
>>>>>>> but I guess I should provide a fixed locale for the unit tests
>>>>>>> 
>>>>>> 
>>>>>> The problem is not how FreeMarker renders the numbers. It already
>> gets
>>>>>> strings like that from POI, and --locale doesn't influence POI.
>>>>>> 
>>>>>> As of the default locale, for these kind of tools, I believe that
>> using
>>>>>> system defaults is usually evil. So having a fixed default is maybe
>> not
>>>>>> just for unit tests. The locale of my computer, or wherever I run a
>> job
>>>>> on
>>>>>> (often some backend linux box) should be usually irrelevant, and not
>>>>>> influence the output. Not to mention when team mates share the
>> project,
>>>>> in
>>>>>> an international team.
>>>>>> 
>>>>>>> - Querying from relation databases (JDBC) would be probably an
>> useful
>>>>>>>> addition (it doesn't fit the Document paradigm though).
>>>>>>> 
>>>>>>> I integrated commons-exec and triggered AWS CLI - basically you
>> capture
>>>>>>> the output of any command-line invocation and process it. Just need
>> to
>>>>> make
>>>>>>> sure that every tool supports processing raw strings ...
>>>>>>> 
>>>>>> 
>>>>>> I'm note sure what do you mean. The result of a query is a structured
>>>>> data,
>>>>>> with column names and non-string types, so I guess command-line
>>>>> invocation
>>>>>> can't solve that too well.
>>>>>> 
>>>>>> 
>>>>>>>> It would be good if there's some de-facto tool for these kind of
>> things
>>>>>>>> than what freemarker-cli does. I guess there's a few such tools in
>>>>>>> company
>>>>>>>> repos, but of course those have no potential to become more
>> generic and
>>>>>>>> being published. (freemarker-generator was a such toll though, but
>> it
>>>>>>>> didn't go anywhere after donation. Actually, FMPP was a such tool
>> too,
>>>>>>> that
>>>>>>>> I used for some sysadmin/webadmin tasks some 15+ years ago.) But of
>>>>>>> course,
>>>>>>>> long term care is the tricky issue with any project that has no
>> company
>>>>>>>> truly behind it (i.e., no payed developers). Do you have you have
>> any
>>>>>>>> thoughts/plans regarding the longer term life of freemarker-cli?
>>>>>>> 
>>>>>>> I worked on a couple of not soo successful Open Source projects -
>> yes,
>>>>> it
>>>>>>> might become another Open Source GitHub project nobody knows /
>> cares :-)
>>>>>>> 
>>>>>>> Having said that
>>>>>>> 
>>>>>>> * I'm maintaining it already for a few of years and I will always
>> find
>>>>>>> some things I can do with it
>>>>>>> * It is useful for some common tasks when you have a Java background
>>>>>>> * I think it is a great way to re-use or build up FreeMarker
>> knowledge
>>>>>>> 
>>>>>> 
>>>>>> And, I would add, templates aren't used much for Web UI-s anymore, so
>>>>> these
>>>>>> alternate use cases become the main ones.
>>>>>> 
>>>>>> 
>>>>>>> * And it should become part of the Apache Freemarker project - much
>>>>> better
>>>>>>> visibility & broader user base
>>>>>>> 
>>>>>> 
>>>>>> Yeah, the last point is what I'm going for really. But that's also
>> why I
>>>>>> hope that you feel like making it more general. Or at least has no
>>>>> negative
>>>>>> feelings about it.
>>>>>> 
>>>>>>> 
>>>>>>>> Also, some things that you miss for FreeMarker itself for it to be
>> more
>>>>>>>> fitting for the task?
>>>>>>> 
>>>>>>> Support for Java 8 Date/Time API - last time I looked at it it was
>> not
>>>>>>> supported by FreeMarker and it's a bummer since nobody is using
>> Date any
>>>>>>> longer ...
>>>>>>> 
>>>>>> 
>>>>>> Yeah... it still isn't. It's probably among the new few things to
>> add at
>>>>>> this point, as it's long due.
>>>>>> 
>>>>>>> 
>>>>>>>> 
>>>>>>>> On Sun, Nov 17, 2019 at 7:02 PM Siegfried Goeschl <
>>>>>>>> siegfried.goeschl@gmail.com <ma...@gmail.com>
>> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com>>
>>>>> <mailto:siegfried.goeschl@gmail.com <mailto:
>> siegfried.goeschl@gmail.com> <mailto:siegfried.goeschl@gmail.com <mailto:
>> siegfried.goeschl@gmail.com>>>>
>>>>> wrote:
>>>>>>>> 
>>>>>>>>> Hi folks,
>>>>>>>>> 
>>>>>>>>> since I'm currently mostly busy with non-coding tasks I spent some
>>>>> time
>>>>>>>>> honing my coding skills - probably to no avail as my colleagues
>> would
>>>>>>> say
>>>>>>>>> ;-)
>>>>>>>>> 
>>>>>>>>> 1) I migrated my pet project "freemarker-cli" from Groovy to JDK 8
>>>>> (see
>>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>> https://github.com/sgoeschl/freemarker-cli> <
>>>>> https://github.com/sgoeschl/freemarker-cli <
>> https://github.com/sgoeschl/freemarker-cli>> <
>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>> https://github.com/sgoeschl/freemarker-cli> <
>>>>> https://github.com/sgoeschl/freemarker-cli <
>> https://github.com/sgoeschl/freemarker-cli>>> <
>>>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>> https://github.com/sgoeschl/freemarker-cli> <
>>>>> https://github.com/sgoeschl/freemarker-cli <
>> https://github.com/sgoeschl/freemarker-cli>> <
>>>>>>> https://github.com/sgoeschl/freemarker-cli <
>> https://github.com/sgoeschl/freemarker-cli> <
>>>>> https://github.com/sgoeschl/freemarker-cli <
>> https://github.com/sgoeschl/freemarker-cli>>>>)
>>>>>>>>> 
>>>>>>>>> 2) At
>>>>>>>>> 
>>>>>>> 
>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>> <
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>> 
>>>>> <
>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>> <
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>> 
>>>>>> 
>>>>>>> <
>>>>>>> 
>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>> <
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>> 
>>>>> <
>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>> <
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>> 
>>>>>> 
>>>>>>>> 
>>>>>>>>> <
>>>>>>>>> 
>>>>>>> 
>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>> <
>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>> 
>>>>>>> <
>>>>>>> 
>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>> <
>>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>>>>> 
>>>>>>>>> 
>>>>>>>>> you find a presentation I gave some while ago
>>>>>>>>> 
>>>>>>>>> 3) I also wrote a Spring Boot FreeMarker sample project as part
>> of the
>>>>>>>>> presentation (see
>>>>>>>>> 
>>>>>>> 
>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>> <
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>> 
>>>>> <
>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>> <
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>> 
>>>>>> 
>>>>>>> <
>>>>>>> 
>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>> <
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>> 
>>>>> <
>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>> <
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>> 
>>>>>> 
>>>>>>>> 
>>>>>>>>> <
>>>>>>>>> 
>>>>>>> 
>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>> <
>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>> 
>>>>>>> <
>>>>>>> 
>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>> <
>>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>>>>> 
>>>>>>>> 
>>>>>>>>>> )
>>>>>>>>> 
>>>>>>>>> My plans / questions
>>>>>>>>> 
>>>>>>>>> I would be awesome if I could get some feedback about
>> "freemarker-cli"
>>>>>>> in
>>>>>>>>> its current JDK incarnation :-) Later on I will release 2.0.0 and
>> push
>>>>>>> it
>>>>>>>>> to Maven Central.
>>>>>>>>> 
>>>>>>>>> In the mean time I wrote three applications (micro services in new
>>>>>>> speak)
>>>>>>>>> using Apache FreeMarker and found it hard to find a starting point
>>>>> for a
>>>>>>>>> Spring Boot applications - therefore I wrote the sample project
>> (see
>>>>>>>>> above). One way or the other a Spring Boot (and Micronaut) blue
>> print
>>>>>>>>> should find its way into Apache FreeMarker officially. I think
>> Apache
>>>>>>>>> FreeMarker is awesome for adding a developer UI to some micro
>> service
>>>>>>> but
>>>>>>>>> developers don't care about the template engine but only about a
>> quick
>>>>>>> and
>>>>>>>>> painless way to get the job done ...
>>>>>>>>> 
>>>>>>>>> Anyone volunteering to give a presentation about Apache
>> Freemarker at
>>>>>>>>> ApacheCon? I could do but I'm not really qualified :-)
>>>>>>>>> 
>>>>>>>>> Thanks in advance,
>>>>>>>>> 
>>>>>>>>> Siegfried Goeschl
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> --
>>>>>>>> Best regards,
>>>>>>>> Daniel Dekany
>>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> Best regards,
>>>>>> Daniel Dekany
>>>>> 
>>>>> 
>>>> 
>>>> --
>>>> Best regards,
>>>> Daniel Dekany
>>> 
>> 
> 
> 
> -- 
> Best regards,
> Daniel Dekany


Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Daniel Dekany <da...@gmail.com>.
Yes, these can done after V1 or whatever. But it's still important if
Siegfried will be OK with such things, or will lose motivation because it's
not how he likes his own kid. More code without more developers probably
won't work out well, given how little developer time even FM core gets.

As of nested output files, I agree (and BTW, FMPP also have a nested output
directive, not just starting a new). I also understand that it breaks the
clean mental model, but if (if...) this is what's reasonably often needed
in reality, then certainly the mental model should bend.

On Wed, Dec 18, 2019 at 8:01 PM Woonsan Ko <wo...@apache.org> wrote:

> On Wed, Dec 18, 2019 at 11:23 AM Siegfried Goeschl
> <si...@gmail.com> wrote:
> >
> > Hi Daniel,
> >
> > please see my comments below …
> >
> > Thanks in advance,
> >
> > Siegfried Goeschl
> >
> >
> > > On 18 Dec 2019, at 16:58, Daniel Dekany <da...@gmail.com>
> wrote:
> > >
> > > Multiple output files: How open are you to the idea if someone else
> wants
> > > to add that though? The use-case is when it's input data that drives
> what
> > > output files you will have (as in my example with the employees), and
> > > working that around with multiple invocations is not very nice.
> > >
> >
> > Suggestive question - it is an Open Source project after all :-)
> >
> > * As long as it is hosted on my GitHub repo I can ultimately reject PRs
> if I’m really unhappy about them but repos can be forked
> > * If it becomes part of Apache FreeMarker project than there are more
> qualified developers out there to make a decision
> >
> > Regarding the implementation
> >
> > * Multiple output files violates my my mental model since you can’t use
> stdout any longer
> > * It could break the CommonsCSV integration since I’m using CSVPrinter
> sitting on FreeMarker’s output stream (which changes when using multiple
> output files)
> > * Last but not least I have not enough experience / requirements to come
> up with a useful implementation from the scratch
>
> In my head, we may introduce a new directive to specify a different
> output for the nested things, instead of the _default_ STDOUT, in the
> future. For example,
>
> hello,
> <#output file="another.csv">
>   something else...
> </#output>
> world!
>
> So, by default "hello,\nworld!" to STDOUT, "something else..." to the
> extra file.
> This seems better to me than "changing output and closing the current
> output" approach in FMPP.
>
> But this improvement can be done together once Siegfried _donates_ his
> project to Apache FreeMarker. ;-)
>
> >
> > > Default locale:
> > > And also default charset to UTF-8, if that wasn't done.
> >
> > UTF-8 is the default
> >
> > >
> > > JDBC drivers: There was some discussion of how to add user defined
> classes
> > > to the tool earlier. Well, I guess it's about the same as you add your
> own
> > > jar-s to the classpath too, so, it shouldn't be a big deal. That could
> > > solve this side of the JDBC problem as well. As of storing credentials,
> > > that has to be solved when using external tools as well... but my
> practical
> > > experience is that people just put them in to a config file as plain
> text
> > > (maybe on a drive that has to be mounted with password first), or bind
> it
> > > to the OS user.
> >
> > The problem is more subtle - I want to provide a well-behaved command
> line tool
> >
> > * What happens if you update the freemarker-cli installation on your box?
> > * How do you easily distinguish between your custom JARs and the
> initially installed ones?
> > * How does it look like if you install freemarker-cli with package
> managers, e.g. brew?
>
> I guess it should be fine as an initial version even if there's no
> separation between system libs and custom libs (such as JDBC drivers).
> If there's a tool for easy JDBC access, it would be nice in practices.
> I don't think it should be perfect from V1.
>
> Regards,
>
> Woonsan
>
> >
> > Current state
> >
> > * Custom tools can be instantiated using the freemarker-cli-properties
> > * For the templates I use ~/.freemarker-cli directory to have a clean
> separation
> > * There is no really nice solution for JARs - I might tweak the Maven
> plugin creating the Unix & Windows wrappers - you can already create an
> “endorsed” directory there to place custom JARs
> >
> > >
> > > Yes, Spring support is definitely important, given the omnipresence of
> > > Spring. It's not just web pages there, but e-mail templates
> (especially as
> > > there modern the UI technologies that has taken over at most places,
> aren't
> > > applicable). Would be good if someone can take ownership of that
> aspect for
> > > FreeMarker 2, probably using what was done in FM3. (Or maybe the same
> > > resources are better redirected to pushing FM3... who knows. There are
> > > really no resources to push two branches in parallel.)
> > >
> > > On Wed, Dec 18, 2019 at 2:02 PM Siegfried Goeschl <
> > > siegfried.goeschl@gmail.com <ma...@gmail.com>>
> wrote:
> > >
> > >> Hi Daniel,
> > >>
> > >> try to write a top-level post to keep the discussion readable
> > >>
> > >>
> > >> Ad Multi-file Output
> > >> ===============================================================
> > >>
> > >> Currently no plans to implement it - I personally don’t have a need
> for it
> > >> and it is a hypothetical requirement for now
> > >>
> > >>
> > >> Ad POI Integration
> > >> ===============================================================
> > >>
> > >> No problem in exposing the non-String data - it is a good idea and
> will be
> > >> implemented
> > >>
> > >>
> > >> Ad Default Locale
> > >> ===============================================================
> > >>
> > >> * I need to define a locale for the unit tests
> > >> * I guess it is a good idea to pin it to “en_US” to avoid suprises
> > >>
> > >>
> > >> Ad JDBC Access
> > >> ===============================================================
> > >>
> > >> It is part of a wider problem - when leaving the document-centric
> approach
> > >> into scripting there is a lot of useful functionality, e.g. JDBC and
> HTTP
> > >> clients.
> > >>
> > >> The problems
> > >>
> > >> * JDBC: You need to add JDBC drivers, where to store the credentials,
> > >> database schema, ...
> > >> * HTTP: More libraries, certificates, proxy support,...
> > >>
> > >> It is possible to implement something but it will never work properly
> so I
> > >> decided to tackle the problem differently b using commons-exec
> > >>
> > >> * REST calls can be easily made by invoking cURL
> > >> * Database command line clients can export the result of a SELECT
> query to
> > >> a CSV file
> > >>
> > >>
> > >> Ad Templates aren't used much for Web UI-s anymore
> > >> ===============================================================
> > >>
> > >> Yes and no - IMHO it is quite useful to embed a UI into certain "micro
> > >> services”. Therefore I think that a ready-to-use Spring Boot (&
> Micronaut,
> > >> etc..) integration is important and should not be an afterthought.
> > >>
> > >>
> > >> Thanks in advance,
> > >>
> > >> Siegfried Goeschl
> > >>
> > >>
> > >>> On 18 Dec 2019, at 01:32, Daniel Dekany <da...@gmail.com>
> wrote:
> > >>>
> > >>> Hi,
> > >>>
> > >>> Find my comments inline below.
> > >>>
> > >>> On Tue, Dec 17, 2019 at 10:46 PM Siegfried Goeschl <
> > >>> siegfried.goeschl@gmail.com <ma...@gmail.com>
> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com>>>
> wrote:
> > >>>
> > >>>> Hi Daniel,
> > >>>>
> > >>>> Thanks for spending your time - feed back is always appreciated when
> > >> doing
> > >>>> things in isolation ....
> > >>>>
> > >>>> Please see my comments below
> > >>>>
> > >>>> Thanks in advance,
> > >>>>
> > >>>> Siegfried Goeschl
> > >>>>
> > >>>>
> > >>>>
> > >>>>> On 17.12.2019, at 19:19, Daniel Dekany <daniel.dekany@gmail.com
> <ma...@gmail.com>>
> > >> wrote:
> > >>>>>
> > >>>>> Hi Siegfried,
> > >>>>>
> > >>>>> Looks good!
> > >>>>>
> > >>>>> Some random things I happened to notice:
> > >>>>>
> > >>>>> - The ability generating multiple output files from the same
> template
> > >>>>> would be worthy addition. Like you load a CSV file that has
> employees
> > >>>> in
> > >>>>> it, and based on that you generate one output file per department.
> Or
> > >>>> even
> > >>>>> one per employee. (There could directives for that, like
> > >>>> changeOutputFile,
> > >>>>> nestOutputFile, etc. on
> > >> http://fmpp.sourceforge.net/pphash.html#sect17 <
> http://fmpp.sourceforge.net/pphash.html#sect17>
> > >>>> <http://fmpp.sourceforge.net/pphash.html#sect17 <
> http://fmpp.sourceforge.net/pphash.html#sect17> <
> > >> http://fmpp.sourceforge.net/pphash.html#sect17 <
> http://fmpp.sourceforge.net/pphash.html#sect17>>>)
> > >>>>
> > >>>> Well, I simply don't need it and it complicates things - in simple
> cases
> > >>>> one could just re-run the freemarker-cli with a different template
> > >> and/or
> > >>>> parameters
> > >>>>
> > >>>
> > >>> My feeling is that if there's a tool that's about transforming some
> files
> > >>> to other files, but the idea that a single invocation can yield
> multiple
> > >>> output files is not part of it, one way or another (i.e., not
> necessarily
> > >>> in the way it was in FMPP), it might turns out to be a limiting
> design
> > >>> decision later as feature request start to pour in. And then it can
> be
> > >> hard
> > >>> to add as an afterthought. Well, maybe I'm wrong, as I have no
> statics
> > >>> about how often it's needed. FMPP users did use it (myself included),
> > >> some
> > >>> of them at least.
> > >>>
> > >>>
> > >>>>> - When I load an XLSX, I get back values as string, not as
> numbers, or
> > >>>>> dates. I'm not sure how hard it is to solve though (I don't
> remember
> > >>>> POI
> > >>>>> much).
> > >>>>
> > >>>> That should not be too hard - I actually use
> > >>>> org.apache.poi.ss.usermodel.DataFormatter to create the strings
> > >>>
> > >>>
> > >>> If templates get numbers etc., or have a such choice at least, then
> they
> > >>> can compare numbers, filter based on their values, control the
> > >> formatting,
> > >>> etc. My idea here is that an Excel file, CSV file, whatever, is just
> a
> > >> pure
> > >>> data, and rendering/formatting is the duty of the templates.
> > >>>
> > >>>
> > >>>>> BTW, the strings I get back are formatted with the locale of the
> OS,
> > >>>>
> > >>>> which is a problem. I guess there should be an config option to set
> the
> > >>>> JVM
> > >>>>> locale. (The ExcelToolTest fails on my computer with locale hu_HU
> for
> > >>>>> somewhat similar reason, as it gets "100,00" instead of "100.00".)
> > >>>>
> > >>>> On the command line you can use
> > >>>>
> > >>>> -l, --locale=<locale>     Locale being used for output file, e.g.
> > >> 'en_US'
> > >>>>
> > >>>> but I guess I should provide a fixed locale for the unit tests
> > >>>>
> > >>>
> > >>> The problem is not how FreeMarker renders the numbers. It already
> gets
> > >>> strings like that from POI, and --locale doesn't influence POI.
> > >>>
> > >>> As of the default locale, for these kind of tools, I believe that
> using
> > >>> system defaults is usually evil. So having a fixed default is maybe
> not
> > >>> just for unit tests. The locale of my computer, or wherever I run a
> job
> > >> on
> > >>> (often some backend linux box) should be usually irrelevant, and not
> > >>> influence the output. Not to mention when team mates share the
> project,
> > >> in
> > >>> an international team.
> > >>>
> > >>>> - Querying from relation databases (JDBC) would be probably an
> useful
> > >>>>> addition (it doesn't fit the Document paradigm though).
> > >>>>
> > >>>> I integrated commons-exec and triggered AWS CLI - basically you
> capture
> > >>>> the output of any command-line invocation and process it. Just need
> to
> > >> make
> > >>>> sure that every tool supports processing raw strings ...
> > >>>>
> > >>>
> > >>> I'm note sure what do you mean. The result of a query is a structured
> > >> data,
> > >>> with column names and non-string types, so I guess command-line
> > >> invocation
> > >>> can't solve that too well.
> > >>>
> > >>>
> > >>>>> It would be good if there's some de-facto tool for these kind of
> things
> > >>>>> than what freemarker-cli does. I guess there's a few such tools in
> > >>>> company
> > >>>>> repos, but of course those have no potential to become more
> generic and
> > >>>>> being published. (freemarker-generator was a such toll though, but
> it
> > >>>>> didn't go anywhere after donation. Actually, FMPP was a such tool
> too,
> > >>>> that
> > >>>>> I used for some sysadmin/webadmin tasks some 15+ years ago.) But of
> > >>>> course,
> > >>>>> long term care is the tricky issue with any project that has no
> company
> > >>>>> truly behind it (i.e., no payed developers). Do you have you have
> any
> > >>>>> thoughts/plans regarding the longer term life of freemarker-cli?
> > >>>>
> > >>>> I worked on a couple of not soo successful Open Source projects -
> yes,
> > >> it
> > >>>> might become another Open Source GitHub project nobody knows /
> cares :-)
> > >>>>
> > >>>> Having said that
> > >>>>
> > >>>> * I'm maintaining it already for a few of years and I will always
> find
> > >>>> some things I can do with it
> > >>>> * It is useful for some common tasks when you have a Java background
> > >>>> * I think it is a great way to re-use or build up FreeMarker
> knowledge
> > >>>>
> > >>>
> > >>> And, I would add, templates aren't used much for Web UI-s anymore, so
> > >> these
> > >>> alternate use cases become the main ones.
> > >>>
> > >>>
> > >>>> * And it should become part of the Apache Freemarker project - much
> > >> better
> > >>>> visibility & broader user base
> > >>>>
> > >>>
> > >>> Yeah, the last point is what I'm going for really. But that's also
> why I
> > >>> hope that you feel like making it more general. Or at least has no
> > >> negative
> > >>> feelings about it.
> > >>>
> > >>>>
> > >>>>> Also, some things that you miss for FreeMarker itself for it to be
> more
> > >>>>> fitting for the task?
> > >>>>
> > >>>> Support for Java 8 Date/Time API - last time I looked at it it was
> not
> > >>>> supported by FreeMarker and it's a bummer since nobody is using
> Date any
> > >>>> longer ...
> > >>>>
> > >>>
> > >>> Yeah... it still isn't. It's probably among the new few things to
> add at
> > >>> this point, as it's long due.
> > >>>
> > >>>>
> > >>>>>
> > >>>>> On Sun, Nov 17, 2019 at 7:02 PM Siegfried Goeschl <
> > >>>>> siegfried.goeschl@gmail.com <ma...@gmail.com>
> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com>>
> > >> <mailto:siegfried.goeschl@gmail.com <mailto:
> siegfried.goeschl@gmail.com> <mailto:siegfried.goeschl@gmail.com <mailto:
> siegfried.goeschl@gmail.com>>>>
> > >> wrote:
> > >>>>>
> > >>>>>> Hi folks,
> > >>>>>>
> > >>>>>> since I'm currently mostly busy with non-coding tasks I spent some
> > >> time
> > >>>>>> honing my coding skills - probably to no avail as my colleagues
> would
> > >>>> say
> > >>>>>> ;-)
> > >>>>>>
> > >>>>>> 1) I migrated my pet project "freemarker-cli" from Groovy to JDK 8
> > >> (see
> > >>>>>> https://github.com/sgoeschl/freemarker-cli <
> https://github.com/sgoeschl/freemarker-cli> <
> > >> https://github.com/sgoeschl/freemarker-cli <
> https://github.com/sgoeschl/freemarker-cli>> <
> > >>>> https://github.com/sgoeschl/freemarker-cli <
> https://github.com/sgoeschl/freemarker-cli> <
> > >> https://github.com/sgoeschl/freemarker-cli <
> https://github.com/sgoeschl/freemarker-cli>>> <
> > >>>>>> https://github.com/sgoeschl/freemarker-cli <
> https://github.com/sgoeschl/freemarker-cli> <
> > >> https://github.com/sgoeschl/freemarker-cli <
> https://github.com/sgoeschl/freemarker-cli>> <
> > >>>> https://github.com/sgoeschl/freemarker-cli <
> https://github.com/sgoeschl/freemarker-cli> <
> > >> https://github.com/sgoeschl/freemarker-cli <
> https://github.com/sgoeschl/freemarker-cli>>>>)
> > >>>>>>
> > >>>>>> 2) At
> > >>>>>>
> > >>>>
> > >>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> <
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >
> > >> <
> > >>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> <
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >
> > >>>
> > >>>> <
> > >>>>
> > >>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> <
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >
> > >> <
> > >>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> <
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >
> > >>>
> > >>>>>
> > >>>>>> <
> > >>>>>>
> > >>>>
> > >>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> > >> <
> > >>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> > >>>
> > >>>> <
> > >>>>
> > >>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> > >> <
> > >>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> > >>>
> > >>>>>>
> > >>>>>> you find a presentation I gave some while ago
> > >>>>>>
> > >>>>>> 3) I also wrote a Spring Boot FreeMarker sample project as part
> of the
> > >>>>>> presentation (see
> > >>>>>>
> > >>>>
> > >>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> <
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >
> > >> <
> > >>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> <
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >
> > >>>
> > >>>> <
> > >>>>
> > >>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> <
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >
> > >> <
> > >>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> <
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >
> > >>>
> > >>>>>
> > >>>>>> <
> > >>>>>>
> > >>>>
> > >>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> > >> <
> > >>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> > >>>
> > >>>> <
> > >>>>
> > >>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> > >> <
> > >>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> > >>>
> > >>>>>
> > >>>>>>> )
> > >>>>>>
> > >>>>>> My plans / questions
> > >>>>>>
> > >>>>>> I would be awesome if I could get some feedback about
> "freemarker-cli"
> > >>>> in
> > >>>>>> its current JDK incarnation :-) Later on I will release 2.0.0 and
> push
> > >>>> it
> > >>>>>> to Maven Central.
> > >>>>>>
> > >>>>>> In the mean time I wrote three applications (micro services in new
> > >>>> speak)
> > >>>>>> using Apache FreeMarker and found it hard to find a starting point
> > >> for a
> > >>>>>> Spring Boot applications - therefore I wrote the sample project
> (see
> > >>>>>> above). One way or the other a Spring Boot (and Micronaut) blue
> print
> > >>>>>> should find its way into Apache FreeMarker officially. I think
> Apache
> > >>>>>> FreeMarker is awesome for adding a developer UI to some micro
> service
> > >>>> but
> > >>>>>> developers don't care about the template engine but only about a
> quick
> > >>>> and
> > >>>>>> painless way to get the job done ...
> > >>>>>>
> > >>>>>> Anyone volunteering to give a presentation about Apache
> Freemarker at
> > >>>>>> ApacheCon? I could do but I'm not really qualified :-)
> > >>>>>>
> > >>>>>> Thanks in advance,
> > >>>>>>
> > >>>>>> Siegfried Goeschl
> > >>>>>>
> > >>>>>>
> > >>>>>>
> > >>>>>
> > >>>>> --
> > >>>>> Best regards,
> > >>>>> Daniel Dekany
> > >>>>
> > >>>
> > >>> --
> > >>> Best regards,
> > >>> Daniel Dekany
> > >>
> > >>
> > >
> > > --
> > > Best regards,
> > > Daniel Dekany
> >
>


-- 
Best regards,
Daniel Dekany

Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Woonsan Ko <wo...@apache.org>.
On Wed, Dec 18, 2019 at 11:23 AM Siegfried Goeschl
<si...@gmail.com> wrote:
>
> Hi Daniel,
>
> please see my comments below …
>
> Thanks in advance,
>
> Siegfried Goeschl
>
>
> > On 18 Dec 2019, at 16:58, Daniel Dekany <da...@gmail.com> wrote:
> >
> > Multiple output files: How open are you to the idea if someone else wants
> > to add that though? The use-case is when it's input data that drives what
> > output files you will have (as in my example with the employees), and
> > working that around with multiple invocations is not very nice.
> >
>
> Suggestive question - it is an Open Source project after all :-)
>
> * As long as it is hosted on my GitHub repo I can ultimately reject PRs if I’m really unhappy about them but repos can be forked
> * If it becomes part of Apache FreeMarker project than there are more qualified developers out there to make a decision
>
> Regarding the implementation
>
> * Multiple output files violates my my mental model since you can’t use stdout any longer
> * It could break the CommonsCSV integration since I’m using CSVPrinter sitting on FreeMarker’s output stream (which changes when using multiple output files)
> * Last but not least I have not enough experience / requirements to come up with a useful implementation from the scratch

In my head, we may introduce a new directive to specify a different
output for the nested things, instead of the _default_ STDOUT, in the
future. For example,

hello,
<#output file="another.csv">
  something else...
</#output>
world!

So, by default "hello,\nworld!" to STDOUT, "something else..." to the
extra file.
This seems better to me than "changing output and closing the current
output" approach in FMPP.

But this improvement can be done together once Siegfried _donates_ his
project to Apache FreeMarker. ;-)

>
> > Default locale:
> > And also default charset to UTF-8, if that wasn't done.
>
> UTF-8 is the default
>
> >
> > JDBC drivers: There was some discussion of how to add user defined classes
> > to the tool earlier. Well, I guess it's about the same as you add your own
> > jar-s to the classpath too, so, it shouldn't be a big deal. That could
> > solve this side of the JDBC problem as well. As of storing credentials,
> > that has to be solved when using external tools as well... but my practical
> > experience is that people just put them in to a config file as plain text
> > (maybe on a drive that has to be mounted with password first), or bind it
> > to the OS user.
>
> The problem is more subtle - I want to provide a well-behaved command line tool
>
> * What happens if you update the freemarker-cli installation on your box?
> * How do you easily distinguish between your custom JARs and the initially installed ones?
> * How does it look like if you install freemarker-cli with package managers, e.g. brew?

I guess it should be fine as an initial version even if there's no
separation between system libs and custom libs (such as JDBC drivers).
If there's a tool for easy JDBC access, it would be nice in practices.
I don't think it should be perfect from V1.

Regards,

Woonsan

>
> Current state
>
> * Custom tools can be instantiated using the freemarker-cli-properties
> * For the templates I use ~/.freemarker-cli directory to have a clean separation
> * There is no really nice solution for JARs - I might tweak the Maven plugin creating the Unix & Windows wrappers - you can already create an “endorsed” directory there to place custom JARs
>
> >
> > Yes, Spring support is definitely important, given the omnipresence of
> > Spring. It's not just web pages there, but e-mail templates (especially as
> > there modern the UI technologies that has taken over at most places, aren't
> > applicable). Would be good if someone can take ownership of that aspect for
> > FreeMarker 2, probably using what was done in FM3. (Or maybe the same
> > resources are better redirected to pushing FM3... who knows. There are
> > really no resources to push two branches in parallel.)
> >
> > On Wed, Dec 18, 2019 at 2:02 PM Siegfried Goeschl <
> > siegfried.goeschl@gmail.com <ma...@gmail.com>> wrote:
> >
> >> Hi Daniel,
> >>
> >> try to write a top-level post to keep the discussion readable
> >>
> >>
> >> Ad Multi-file Output
> >> ===============================================================
> >>
> >> Currently no plans to implement it - I personally don’t have a need for it
> >> and it is a hypothetical requirement for now
> >>
> >>
> >> Ad POI Integration
> >> ===============================================================
> >>
> >> No problem in exposing the non-String data - it is a good idea and will be
> >> implemented
> >>
> >>
> >> Ad Default Locale
> >> ===============================================================
> >>
> >> * I need to define a locale for the unit tests
> >> * I guess it is a good idea to pin it to “en_US” to avoid suprises
> >>
> >>
> >> Ad JDBC Access
> >> ===============================================================
> >>
> >> It is part of a wider problem - when leaving the document-centric approach
> >> into scripting there is a lot of useful functionality, e.g. JDBC and HTTP
> >> clients.
> >>
> >> The problems
> >>
> >> * JDBC: You need to add JDBC drivers, where to store the credentials,
> >> database schema, ...
> >> * HTTP: More libraries, certificates, proxy support,...
> >>
> >> It is possible to implement something but it will never work properly so I
> >> decided to tackle the problem differently b using commons-exec
> >>
> >> * REST calls can be easily made by invoking cURL
> >> * Database command line clients can export the result of a SELECT query to
> >> a CSV file
> >>
> >>
> >> Ad Templates aren't used much for Web UI-s anymore
> >> ===============================================================
> >>
> >> Yes and no - IMHO it is quite useful to embed a UI into certain "micro
> >> services”. Therefore I think that a ready-to-use Spring Boot (& Micronaut,
> >> etc..) integration is important and should not be an afterthought.
> >>
> >>
> >> Thanks in advance,
> >>
> >> Siegfried Goeschl
> >>
> >>
> >>> On 18 Dec 2019, at 01:32, Daniel Dekany <da...@gmail.com> wrote:
> >>>
> >>> Hi,
> >>>
> >>> Find my comments inline below.
> >>>
> >>> On Tue, Dec 17, 2019 at 10:46 PM Siegfried Goeschl <
> >>> siegfried.goeschl@gmail.com <ma...@gmail.com> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com>>> wrote:
> >>>
> >>>> Hi Daniel,
> >>>>
> >>>> Thanks for spending your time - feed back is always appreciated when
> >> doing
> >>>> things in isolation ....
> >>>>
> >>>> Please see my comments below
> >>>>
> >>>> Thanks in advance,
> >>>>
> >>>> Siegfried Goeschl
> >>>>
> >>>>
> >>>>
> >>>>> On 17.12.2019, at 19:19, Daniel Dekany <daniel.dekany@gmail.com <ma...@gmail.com>>
> >> wrote:
> >>>>>
> >>>>> Hi Siegfried,
> >>>>>
> >>>>> Looks good!
> >>>>>
> >>>>> Some random things I happened to notice:
> >>>>>
> >>>>> - The ability generating multiple output files from the same template
> >>>>> would be worthy addition. Like you load a CSV file that has employees
> >>>> in
> >>>>> it, and based on that you generate one output file per department. Or
> >>>> even
> >>>>> one per employee. (There could directives for that, like
> >>>> changeOutputFile,
> >>>>> nestOutputFile, etc. on
> >> http://fmpp.sourceforge.net/pphash.html#sect17 <http://fmpp.sourceforge.net/pphash.html#sect17>
> >>>> <http://fmpp.sourceforge.net/pphash.html#sect17 <http://fmpp.sourceforge.net/pphash.html#sect17> <
> >> http://fmpp.sourceforge.net/pphash.html#sect17 <http://fmpp.sourceforge.net/pphash.html#sect17>>>)
> >>>>
> >>>> Well, I simply don't need it and it complicates things - in simple cases
> >>>> one could just re-run the freemarker-cli with a different template
> >> and/or
> >>>> parameters
> >>>>
> >>>
> >>> My feeling is that if there's a tool that's about transforming some files
> >>> to other files, but the idea that a single invocation can yield multiple
> >>> output files is not part of it, one way or another (i.e., not necessarily
> >>> in the way it was in FMPP), it might turns out to be a limiting design
> >>> decision later as feature request start to pour in. And then it can be
> >> hard
> >>> to add as an afterthought. Well, maybe I'm wrong, as I have no statics
> >>> about how often it's needed. FMPP users did use it (myself included),
> >> some
> >>> of them at least.
> >>>
> >>>
> >>>>> - When I load an XLSX, I get back values as string, not as numbers, or
> >>>>> dates. I'm not sure how hard it is to solve though (I don't remember
> >>>> POI
> >>>>> much).
> >>>>
> >>>> That should not be too hard - I actually use
> >>>> org.apache.poi.ss.usermodel.DataFormatter to create the strings
> >>>
> >>>
> >>> If templates get numbers etc., or have a such choice at least, then they
> >>> can compare numbers, filter based on their values, control the
> >> formatting,
> >>> etc. My idea here is that an Excel file, CSV file, whatever, is just a
> >> pure
> >>> data, and rendering/formatting is the duty of the templates.
> >>>
> >>>
> >>>>> BTW, the strings I get back are formatted with the locale of the OS,
> >>>>
> >>>> which is a problem. I guess there should be an config option to set the
> >>>> JVM
> >>>>> locale. (The ExcelToolTest fails on my computer with locale hu_HU for
> >>>>> somewhat similar reason, as it gets "100,00" instead of "100.00".)
> >>>>
> >>>> On the command line you can use
> >>>>
> >>>> -l, --locale=<locale>     Locale being used for output file, e.g.
> >> 'en_US'
> >>>>
> >>>> but I guess I should provide a fixed locale for the unit tests
> >>>>
> >>>
> >>> The problem is not how FreeMarker renders the numbers. It already gets
> >>> strings like that from POI, and --locale doesn't influence POI.
> >>>
> >>> As of the default locale, for these kind of tools, I believe that using
> >>> system defaults is usually evil. So having a fixed default is maybe not
> >>> just for unit tests. The locale of my computer, or wherever I run a job
> >> on
> >>> (often some backend linux box) should be usually irrelevant, and not
> >>> influence the output. Not to mention when team mates share the project,
> >> in
> >>> an international team.
> >>>
> >>>> - Querying from relation databases (JDBC) would be probably an useful
> >>>>> addition (it doesn't fit the Document paradigm though).
> >>>>
> >>>> I integrated commons-exec and triggered AWS CLI - basically you capture
> >>>> the output of any command-line invocation and process it. Just need to
> >> make
> >>>> sure that every tool supports processing raw strings ...
> >>>>
> >>>
> >>> I'm note sure what do you mean. The result of a query is a structured
> >> data,
> >>> with column names and non-string types, so I guess command-line
> >> invocation
> >>> can't solve that too well.
> >>>
> >>>
> >>>>> It would be good if there's some de-facto tool for these kind of things
> >>>>> than what freemarker-cli does. I guess there's a few such tools in
> >>>> company
> >>>>> repos, but of course those have no potential to become more generic and
> >>>>> being published. (freemarker-generator was a such toll though, but it
> >>>>> didn't go anywhere after donation. Actually, FMPP was a such tool too,
> >>>> that
> >>>>> I used for some sysadmin/webadmin tasks some 15+ years ago.) But of
> >>>> course,
> >>>>> long term care is the tricky issue with any project that has no company
> >>>>> truly behind it (i.e., no payed developers). Do you have you have any
> >>>>> thoughts/plans regarding the longer term life of freemarker-cli?
> >>>>
> >>>> I worked on a couple of not soo successful Open Source projects - yes,
> >> it
> >>>> might become another Open Source GitHub project nobody knows / cares :-)
> >>>>
> >>>> Having said that
> >>>>
> >>>> * I'm maintaining it already for a few of years and I will always find
> >>>> some things I can do with it
> >>>> * It is useful for some common tasks when you have a Java background
> >>>> * I think it is a great way to re-use or build up FreeMarker knowledge
> >>>>
> >>>
> >>> And, I would add, templates aren't used much for Web UI-s anymore, so
> >> these
> >>> alternate use cases become the main ones.
> >>>
> >>>
> >>>> * And it should become part of the Apache Freemarker project - much
> >> better
> >>>> visibility & broader user base
> >>>>
> >>>
> >>> Yeah, the last point is what I'm going for really. But that's also why I
> >>> hope that you feel like making it more general. Or at least has no
> >> negative
> >>> feelings about it.
> >>>
> >>>>
> >>>>> Also, some things that you miss for FreeMarker itself for it to be more
> >>>>> fitting for the task?
> >>>>
> >>>> Support for Java 8 Date/Time API - last time I looked at it it was not
> >>>> supported by FreeMarker and it's a bummer since nobody is using Date any
> >>>> longer ...
> >>>>
> >>>
> >>> Yeah... it still isn't. It's probably among the new few things to add at
> >>> this point, as it's long due.
> >>>
> >>>>
> >>>>>
> >>>>> On Sun, Nov 17, 2019 at 7:02 PM Siegfried Goeschl <
> >>>>> siegfried.goeschl@gmail.com <ma...@gmail.com> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com>>
> >> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com>>>>
> >> wrote:
> >>>>>
> >>>>>> Hi folks,
> >>>>>>
> >>>>>> since I'm currently mostly busy with non-coding tasks I spent some
> >> time
> >>>>>> honing my coding skills - probably to no avail as my colleagues would
> >>>> say
> >>>>>> ;-)
> >>>>>>
> >>>>>> 1) I migrated my pet project "freemarker-cli" from Groovy to JDK 8
> >> (see
> >>>>>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli> <
> >> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli>> <
> >>>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli> <
> >> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli>>> <
> >>>>>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli> <
> >> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli>> <
> >>>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli> <
> >> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli>>>>)
> >>>>>>
> >>>>>> 2) At
> >>>>>>
> >>>>
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc>
> >> <
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc>
> >>>
> >>>> <
> >>>>
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc>
> >> <
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc>
> >>>
> >>>>>
> >>>>>> <
> >>>>>>
> >>>>
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >> <
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>
> >>>> <
> >>>>
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >> <
> >> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>>
> >>>>>>
> >>>>>> you find a presentation I gave some while ago
> >>>>>>
> >>>>>> 3) I also wrote a Spring Boot FreeMarker sample project as part of the
> >>>>>> presentation (see
> >>>>>>
> >>>>
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>
> >> <
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>
> >>>
> >>>> <
> >>>>
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>
> >> <
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>
> >>>
> >>>>>
> >>>>>> <
> >>>>>>
> >>>>
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >> <
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>
> >>>> <
> >>>>
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >> <
> >> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >>>
> >>>>>
> >>>>>>> )
> >>>>>>
> >>>>>> My plans / questions
> >>>>>>
> >>>>>> I would be awesome if I could get some feedback about "freemarker-cli"
> >>>> in
> >>>>>> its current JDK incarnation :-) Later on I will release 2.0.0 and push
> >>>> it
> >>>>>> to Maven Central.
> >>>>>>
> >>>>>> In the mean time I wrote three applications (micro services in new
> >>>> speak)
> >>>>>> using Apache FreeMarker and found it hard to find a starting point
> >> for a
> >>>>>> Spring Boot applications - therefore I wrote the sample project (see
> >>>>>> above). One way or the other a Spring Boot (and Micronaut) blue print
> >>>>>> should find its way into Apache FreeMarker officially. I think Apache
> >>>>>> FreeMarker is awesome for adding a developer UI to some micro service
> >>>> but
> >>>>>> developers don't care about the template engine but only about a quick
> >>>> and
> >>>>>> painless way to get the job done ...
> >>>>>>
> >>>>>> Anyone volunteering to give a presentation about Apache Freemarker at
> >>>>>> ApacheCon? I could do but I'm not really qualified :-)
> >>>>>>
> >>>>>> Thanks in advance,
> >>>>>>
> >>>>>> Siegfried Goeschl
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>> --
> >>>>> Best regards,
> >>>>> Daniel Dekany
> >>>>
> >>>
> >>> --
> >>> Best regards,
> >>> Daniel Dekany
> >>
> >>
> >
> > --
> > Best regards,
> > Daniel Dekany
>

Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Siegfried Goeschl <si...@gmail.com>.
Hi Daniel,

please see my comments below …

Thanks in advance, 

Siegfried Goeschl


> On 18 Dec 2019, at 16:58, Daniel Dekany <da...@gmail.com> wrote:
> 
> Multiple output files: How open are you to the idea if someone else wants
> to add that though? The use-case is when it's input data that drives what
> output files you will have (as in my example with the employees), and
> working that around with multiple invocations is not very nice.
> 

Suggestive question - it is an Open Source project after all :-)

* As long as it is hosted on my GitHub repo I can ultimately reject PRs if I’m really unhappy about them but repos can be forked
* If it becomes part of Apache FreeMarker project than there are more qualified developers out there to make a decision

Regarding the implementation

* Multiple output files violates my my mental model since you can’t use stdout any longer
* It could break the CommonsCSV integration since I’m using CSVPrinter sitting on FreeMarker’s output stream (which changes when using multiple output files)
* Last but not least I have not enough experience / requirements to come up with a useful implementation from the scratch

> Default locale:
> And also default charset to UTF-8, if that wasn't done.

UTF-8 is the default

> 
> JDBC drivers: There was some discussion of how to add user defined classes
> to the tool earlier. Well, I guess it's about the same as you add your own
> jar-s to the classpath too, so, it shouldn't be a big deal. That could
> solve this side of the JDBC problem as well. As of storing credentials,
> that has to be solved when using external tools as well... but my practical
> experience is that people just put them in to a config file as plain text
> (maybe on a drive that has to be mounted with password first), or bind it
> to the OS user.

The problem is more subtle - I want to provide a well-behaved command line tool

* What happens if you update the freemarker-cli installation on your box?
* How do you easily distinguish between your custom JARs and the initially installed ones?
* How does it look like if you install freemarker-cli with package managers, e.g. brew?

Current state

* Custom tools can be instantiated using the freemarker-cli-properties
* For the templates I use ~/.freemarker-cli directory to have a clean separation 
* There is no really nice solution for JARs - I might tweak the Maven plugin creating the Unix & Windows wrappers - you can already create an “endorsed” directory there to place custom JARs

> 
> Yes, Spring support is definitely important, given the omnipresence of
> Spring. It's not just web pages there, but e-mail templates (especially as
> there modern the UI technologies that has taken over at most places, aren't
> applicable). Would be good if someone can take ownership of that aspect for
> FreeMarker 2, probably using what was done in FM3. (Or maybe the same
> resources are better redirected to pushing FM3... who knows. There are
> really no resources to push two branches in parallel.)
> 
> On Wed, Dec 18, 2019 at 2:02 PM Siegfried Goeschl <
> siegfried.goeschl@gmail.com <ma...@gmail.com>> wrote:
> 
>> Hi Daniel,
>> 
>> try to write a top-level post to keep the discussion readable
>> 
>> 
>> Ad Multi-file Output
>> ===============================================================
>> 
>> Currently no plans to implement it - I personally don’t have a need for it
>> and it is a hypothetical requirement for now
>> 
>> 
>> Ad POI Integration
>> ===============================================================
>> 
>> No problem in exposing the non-String data - it is a good idea and will be
>> implemented
>> 
>> 
>> Ad Default Locale
>> ===============================================================
>> 
>> * I need to define a locale for the unit tests
>> * I guess it is a good idea to pin it to “en_US” to avoid suprises
>> 
>> 
>> Ad JDBC Access
>> ===============================================================
>> 
>> It is part of a wider problem - when leaving the document-centric approach
>> into scripting there is a lot of useful functionality, e.g. JDBC and HTTP
>> clients.
>> 
>> The problems
>> 
>> * JDBC: You need to add JDBC drivers, where to store the credentials,
>> database schema, ...
>> * HTTP: More libraries, certificates, proxy support,...
>> 
>> It is possible to implement something but it will never work properly so I
>> decided to tackle the problem differently b using commons-exec
>> 
>> * REST calls can be easily made by invoking cURL
>> * Database command line clients can export the result of a SELECT query to
>> a CSV file
>> 
>> 
>> Ad Templates aren't used much for Web UI-s anymore
>> ===============================================================
>> 
>> Yes and no - IMHO it is quite useful to embed a UI into certain "micro
>> services”. Therefore I think that a ready-to-use Spring Boot (& Micronaut,
>> etc..) integration is important and should not be an afterthought.
>> 
>> 
>> Thanks in advance,
>> 
>> Siegfried Goeschl
>> 
>> 
>>> On 18 Dec 2019, at 01:32, Daniel Dekany <da...@gmail.com> wrote:
>>> 
>>> Hi,
>>> 
>>> Find my comments inline below.
>>> 
>>> On Tue, Dec 17, 2019 at 10:46 PM Siegfried Goeschl <
>>> siegfried.goeschl@gmail.com <ma...@gmail.com> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com>>> wrote:
>>> 
>>>> Hi Daniel,
>>>> 
>>>> Thanks for spending your time - feed back is always appreciated when
>> doing
>>>> things in isolation ....
>>>> 
>>>> Please see my comments below
>>>> 
>>>> Thanks in advance,
>>>> 
>>>> Siegfried Goeschl
>>>> 
>>>> 
>>>> 
>>>>> On 17.12.2019, at 19:19, Daniel Dekany <daniel.dekany@gmail.com <ma...@gmail.com>>
>> wrote:
>>>>> 
>>>>> Hi Siegfried,
>>>>> 
>>>>> Looks good!
>>>>> 
>>>>> Some random things I happened to notice:
>>>>> 
>>>>> - The ability generating multiple output files from the same template
>>>>> would be worthy addition. Like you load a CSV file that has employees
>>>> in
>>>>> it, and based on that you generate one output file per department. Or
>>>> even
>>>>> one per employee. (There could directives for that, like
>>>> changeOutputFile,
>>>>> nestOutputFile, etc. on
>> http://fmpp.sourceforge.net/pphash.html#sect17 <http://fmpp.sourceforge.net/pphash.html#sect17>
>>>> <http://fmpp.sourceforge.net/pphash.html#sect17 <http://fmpp.sourceforge.net/pphash.html#sect17> <
>> http://fmpp.sourceforge.net/pphash.html#sect17 <http://fmpp.sourceforge.net/pphash.html#sect17>>>)
>>>> 
>>>> Well, I simply don't need it and it complicates things - in simple cases
>>>> one could just re-run the freemarker-cli with a different template
>> and/or
>>>> parameters
>>>> 
>>> 
>>> My feeling is that if there's a tool that's about transforming some files
>>> to other files, but the idea that a single invocation can yield multiple
>>> output files is not part of it, one way or another (i.e., not necessarily
>>> in the way it was in FMPP), it might turns out to be a limiting design
>>> decision later as feature request start to pour in. And then it can be
>> hard
>>> to add as an afterthought. Well, maybe I'm wrong, as I have no statics
>>> about how often it's needed. FMPP users did use it (myself included),
>> some
>>> of them at least.
>>> 
>>> 
>>>>> - When I load an XLSX, I get back values as string, not as numbers, or
>>>>> dates. I'm not sure how hard it is to solve though (I don't remember
>>>> POI
>>>>> much).
>>>> 
>>>> That should not be too hard - I actually use
>>>> org.apache.poi.ss.usermodel.DataFormatter to create the strings
>>> 
>>> 
>>> If templates get numbers etc., or have a such choice at least, then they
>>> can compare numbers, filter based on their values, control the
>> formatting,
>>> etc. My idea here is that an Excel file, CSV file, whatever, is just a
>> pure
>>> data, and rendering/formatting is the duty of the templates.
>>> 
>>> 
>>>>> BTW, the strings I get back are formatted with the locale of the OS,
>>>> 
>>>> which is a problem. I guess there should be an config option to set the
>>>> JVM
>>>>> locale. (The ExcelToolTest fails on my computer with locale hu_HU for
>>>>> somewhat similar reason, as it gets "100,00" instead of "100.00".)
>>>> 
>>>> On the command line you can use
>>>> 
>>>> -l, --locale=<locale>     Locale being used for output file, e.g.
>> 'en_US'
>>>> 
>>>> but I guess I should provide a fixed locale for the unit tests
>>>> 
>>> 
>>> The problem is not how FreeMarker renders the numbers. It already gets
>>> strings like that from POI, and --locale doesn't influence POI.
>>> 
>>> As of the default locale, for these kind of tools, I believe that using
>>> system defaults is usually evil. So having a fixed default is maybe not
>>> just for unit tests. The locale of my computer, or wherever I run a job
>> on
>>> (often some backend linux box) should be usually irrelevant, and not
>>> influence the output. Not to mention when team mates share the project,
>> in
>>> an international team.
>>> 
>>>> - Querying from relation databases (JDBC) would be probably an useful
>>>>> addition (it doesn't fit the Document paradigm though).
>>>> 
>>>> I integrated commons-exec and triggered AWS CLI - basically you capture
>>>> the output of any command-line invocation and process it. Just need to
>> make
>>>> sure that every tool supports processing raw strings ...
>>>> 
>>> 
>>> I'm note sure what do you mean. The result of a query is a structured
>> data,
>>> with column names and non-string types, so I guess command-line
>> invocation
>>> can't solve that too well.
>>> 
>>> 
>>>>> It would be good if there's some de-facto tool for these kind of things
>>>>> than what freemarker-cli does. I guess there's a few such tools in
>>>> company
>>>>> repos, but of course those have no potential to become more generic and
>>>>> being published. (freemarker-generator was a such toll though, but it
>>>>> didn't go anywhere after donation. Actually, FMPP was a such tool too,
>>>> that
>>>>> I used for some sysadmin/webadmin tasks some 15+ years ago.) But of
>>>> course,
>>>>> long term care is the tricky issue with any project that has no company
>>>>> truly behind it (i.e., no payed developers). Do you have you have any
>>>>> thoughts/plans regarding the longer term life of freemarker-cli?
>>>> 
>>>> I worked on a couple of not soo successful Open Source projects - yes,
>> it
>>>> might become another Open Source GitHub project nobody knows / cares :-)
>>>> 
>>>> Having said that
>>>> 
>>>> * I'm maintaining it already for a few of years and I will always find
>>>> some things I can do with it
>>>> * It is useful for some common tasks when you have a Java background
>>>> * I think it is a great way to re-use or build up FreeMarker knowledge
>>>> 
>>> 
>>> And, I would add, templates aren't used much for Web UI-s anymore, so
>> these
>>> alternate use cases become the main ones.
>>> 
>>> 
>>>> * And it should become part of the Apache Freemarker project - much
>> better
>>>> visibility & broader user base
>>>> 
>>> 
>>> Yeah, the last point is what I'm going for really. But that's also why I
>>> hope that you feel like making it more general. Or at least has no
>> negative
>>> feelings about it.
>>> 
>>>> 
>>>>> Also, some things that you miss for FreeMarker itself for it to be more
>>>>> fitting for the task?
>>>> 
>>>> Support for Java 8 Date/Time API - last time I looked at it it was not
>>>> supported by FreeMarker and it's a bummer since nobody is using Date any
>>>> longer ...
>>>> 
>>> 
>>> Yeah... it still isn't. It's probably among the new few things to add at
>>> this point, as it's long due.
>>> 
>>>> 
>>>>> 
>>>>> On Sun, Nov 17, 2019 at 7:02 PM Siegfried Goeschl <
>>>>> siegfried.goeschl@gmail.com <ma...@gmail.com> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com>>
>> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com>>>>
>> wrote:
>>>>> 
>>>>>> Hi folks,
>>>>>> 
>>>>>> since I'm currently mostly busy with non-coding tasks I spent some
>> time
>>>>>> honing my coding skills - probably to no avail as my colleagues would
>>>> say
>>>>>> ;-)
>>>>>> 
>>>>>> 1) I migrated my pet project "freemarker-cli" from Groovy to JDK 8
>> (see
>>>>>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli> <
>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli>> <
>>>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli> <
>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli>>> <
>>>>>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli> <
>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli>> <
>>>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli> <
>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli>>>>)
>>>>>> 
>>>>>> 2) At
>>>>>> 
>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc>
>> <
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc>
>>> 
>>>> <
>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc>
>> <
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc>
>>> 
>>>>> 
>>>>>> <
>>>>>> 
>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>> <
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>> 
>>>> <
>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>> <
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
>>> 
>>>>>> 
>>>>>> you find a presentation I gave some while ago
>>>>>> 
>>>>>> 3) I also wrote a Spring Boot FreeMarker sample project as part of the
>>>>>> presentation (see
>>>>>> 
>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>
>> <
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>
>>> 
>>>> <
>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>
>> <
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>
>>> 
>>>>> 
>>>>>> <
>>>>>> 
>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>> <
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>> 
>>>> <
>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>> <
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
>>> 
>>>>> 
>>>>>>> )
>>>>>> 
>>>>>> My plans / questions
>>>>>> 
>>>>>> I would be awesome if I could get some feedback about "freemarker-cli"
>>>> in
>>>>>> its current JDK incarnation :-) Later on I will release 2.0.0 and push
>>>> it
>>>>>> to Maven Central.
>>>>>> 
>>>>>> In the mean time I wrote three applications (micro services in new
>>>> speak)
>>>>>> using Apache FreeMarker and found it hard to find a starting point
>> for a
>>>>>> Spring Boot applications - therefore I wrote the sample project (see
>>>>>> above). One way or the other a Spring Boot (and Micronaut) blue print
>>>>>> should find its way into Apache FreeMarker officially. I think Apache
>>>>>> FreeMarker is awesome for adding a developer UI to some micro service
>>>> but
>>>>>> developers don't care about the template engine but only about a quick
>>>> and
>>>>>> painless way to get the job done ...
>>>>>> 
>>>>>> Anyone volunteering to give a presentation about Apache Freemarker at
>>>>>> ApacheCon? I could do but I'm not really qualified :-)
>>>>>> 
>>>>>> Thanks in advance,
>>>>>> 
>>>>>> Siegfried Goeschl
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> --
>>>>> Best regards,
>>>>> Daniel Dekany
>>>> 
>>> 
>>> --
>>> Best regards,
>>> Daniel Dekany
>> 
>> 
> 
> -- 
> Best regards,
> Daniel Dekany


Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Daniel Dekany <da...@gmail.com>.
Multiple output files: How open are you to the idea if someone else wants
to add that though? The use-case is when it's input data that drives what
output files you will have (as in my example with the employees), and
working that around with multiple invocations is not very nice.

Default locale:
And also default charset to UTF-8, if that wasn't done.

JDBC drivers: There was some discussion of how to add user defined classes
to the tool earlier. Well, I guess it's about the same as you add your own
jar-s to the classpath too, so, it shouldn't be a big deal. That could
solve this side of the JDBC problem as well. As of storing credentials,
that has to be solved when using external tools as well... but my practical
experience is that people just put them in to a config file as plain text
(maybe on a drive that has to be mounted with password first), or bind it
to the OS user.

Yes, Spring support is definitely important, given the omnipresence of
Spring. It's not just web pages there, but e-mail templates (especially as
there modern the UI technologies that has taken over at most places, aren't
applicable). Would be good if someone can take ownership of that aspect for
FreeMarker 2, probably using what was done in FM3. (Or maybe the same
resources are better redirected to pushing FM3... who knows. There are
really no resources to push two branches in parallel.)

On Wed, Dec 18, 2019 at 2:02 PM Siegfried Goeschl <
siegfried.goeschl@gmail.com> wrote:

> Hi Daniel,
>
> try to write a top-level post to keep the discussion readable
>
>
> Ad Multi-file Output
> ===============================================================
>
> Currently no plans to implement it - I personally don’t have a need for it
> and it is a hypothetical requirement for now
>
>
> Ad POI Integration
> ===============================================================
>
> No problem in exposing the non-String data - it is a good idea and will be
> implemented
>
>
> Ad Default Locale
> ===============================================================
>
> * I need to define a locale for the unit tests
> * I guess it is a good idea to pin it to “en_US” to avoid suprises
>
>
> Ad JDBC Access
> ===============================================================
>
> It is part of a wider problem - when leaving the document-centric approach
> into scripting there is a lot of useful functionality, e.g. JDBC and HTTP
> clients.
>
> The problems
>
> * JDBC: You need to add JDBC drivers, where to store the credentials,
> database schema, ...
> * HTTP: More libraries, certificates, proxy support,...
>
> It is possible to implement something but it will never work properly so I
> decided to tackle the problem differently b using commons-exec
>
> * REST calls can be easily made by invoking cURL
> * Database command line clients can export the result of a SELECT query to
> a CSV file
>
>
> Ad Templates aren't used much for Web UI-s anymore
> ===============================================================
>
> Yes and no - IMHO it is quite useful to embed a UI into certain "micro
> services”. Therefore I think that a ready-to-use Spring Boot (& Micronaut,
> etc..) integration is important and should not be an afterthought.
>
>
> Thanks in advance,
>
> Siegfried Goeschl
>
>
> > On 18 Dec 2019, at 01:32, Daniel Dekany <da...@gmail.com> wrote:
> >
> > Hi,
> >
> > Find my comments inline below.
> >
> > On Tue, Dec 17, 2019 at 10:46 PM Siegfried Goeschl <
> > siegfried.goeschl@gmail.com <ma...@gmail.com>> wrote:
> >
> >> Hi Daniel,
> >>
> >> Thanks for spending your time - feed back is always appreciated when
> doing
> >> things in isolation ....
> >>
> >> Please see my comments below
> >>
> >> Thanks in advance,
> >>
> >> Siegfried Goeschl
> >>
> >>
> >>
> >>> On 17.12.2019, at 19:19, Daniel Dekany <da...@gmail.com>
> wrote:
> >>>
> >>> Hi Siegfried,
> >>>
> >>> Looks good!
> >>>
> >>> Some random things I happened to notice:
> >>>
> >>>  - The ability generating multiple output files from the same template
> >>>  would be worthy addition. Like you load a CSV file that has employees
> >> in
> >>>  it, and based on that you generate one output file per department. Or
> >> even
> >>>  one per employee. (There could directives for that, like
> >> changeOutputFile,
> >>>  nestOutputFile, etc. on
> http://fmpp.sourceforge.net/pphash.html#sect17
> >> <http://fmpp.sourceforge.net/pphash.html#sect17 <
> http://fmpp.sourceforge.net/pphash.html#sect17>>)
> >>
> >> Well, I simply don't need it and it complicates things - in simple cases
> >> one could just re-run the freemarker-cli with a different template
> and/or
> >> parameters
> >>
> >
> > My feeling is that if there's a tool that's about transforming some files
> > to other files, but the idea that a single invocation can yield multiple
> > output files is not part of it, one way or another (i.e., not necessarily
> > in the way it was in FMPP), it might turns out to be a limiting design
> > decision later as feature request start to pour in. And then it can be
> hard
> > to add as an afterthought. Well, maybe I'm wrong, as I have no statics
> > about how often it's needed. FMPP users did use it (myself included),
> some
> > of them at least.
> >
> >
> >>>  - When I load an XLSX, I get back values as string, not as numbers, or
> >>>  dates. I'm not sure how hard it is to solve though (I don't remember
> >> POI
> >>>  much).
> >>
> >> That should not be too hard - I actually use
> >> org.apache.poi.ss.usermodel.DataFormatter to create the strings
> >
> >
> > If templates get numbers etc., or have a such choice at least, then they
> > can compare numbers, filter based on their values, control the
> formatting,
> > etc. My idea here is that an Excel file, CSV file, whatever, is just a
> pure
> > data, and rendering/formatting is the duty of the templates.
> >
> >
> >>> BTW, the strings I get back are formatted with the locale of the OS,
> >>
> >>  which is a problem. I guess there should be an config option to set the
> >> JVM
> >>>  locale. (The ExcelToolTest fails on my computer with locale hu_HU for
> >>>  somewhat similar reason, as it gets "100,00" instead of "100.00".)
> >>
> >> On the command line you can use
> >>
> >> -l, --locale=<locale>     Locale being used for output file, e.g.
> 'en_US'
> >>
> >> but I guess I should provide a fixed locale for the unit tests
> >>
> >
> > The problem is not how FreeMarker renders the numbers. It already gets
> > strings like that from POI, and --locale doesn't influence POI.
> >
> > As of the default locale, for these kind of tools, I believe that using
> > system defaults is usually evil. So having a fixed default is maybe not
> > just for unit tests. The locale of my computer, or wherever I run a job
> on
> > (often some backend linux box) should be usually irrelevant, and not
> > influence the output. Not to mention when team mates share the project,
> in
> > an international team.
> >
> >>  - Querying from relation databases (JDBC) would be probably an useful
> >>>  addition (it doesn't fit the Document paradigm though).
> >>
> >> I integrated commons-exec and triggered AWS CLI - basically you capture
> >> the output of any command-line invocation and process it. Just need to
> make
> >> sure that every tool supports processing raw strings ...
> >>
> >
> > I'm note sure what do you mean. The result of a query is a structured
> data,
> > with column names and non-string types, so I guess command-line
> invocation
> > can't solve that too well.
> >
> >
> >>> It would be good if there's some de-facto tool for these kind of things
> >>> than what freemarker-cli does. I guess there's a few such tools in
> >> company
> >>> repos, but of course those have no potential to become more generic and
> >>> being published. (freemarker-generator was a such toll though, but it
> >>> didn't go anywhere after donation. Actually, FMPP was a such tool too,
> >> that
> >>> I used for some sysadmin/webadmin tasks some 15+ years ago.) But of
> >> course,
> >>> long term care is the tricky issue with any project that has no company
> >>> truly behind it (i.e., no payed developers). Do you have you have any
> >>> thoughts/plans regarding the longer term life of freemarker-cli?
> >>
> >> I worked on a couple of not soo successful Open Source projects - yes,
> it
> >> might become another Open Source GitHub project nobody knows / cares :-)
> >>
> >> Having said that
> >>
> >> * I'm maintaining it already for a few of years and I will always find
> >> some things I can do with it
> >> * It is useful for some common tasks when you have a Java background
> >> * I think it is a great way to re-use or build up FreeMarker knowledge
> >>
> >
> > And, I would add, templates aren't used much for Web UI-s anymore, so
> these
> > alternate use cases become the main ones.
> >
> >
> >> * And it should become part of the Apache Freemarker project - much
> better
> >> visibility & broader user base
> >>
> >
> > Yeah, the last point is what I'm going for really. But that's also why I
> > hope that you feel like making it more general. Or at least has no
> negative
> > feelings about it.
> >
> >>
> >>> Also, some things that you miss for FreeMarker itself for it to be more
> >>> fitting for the task?
> >>
> >> Support for Java 8 Date/Time API - last time I looked at it it was not
> >> supported by FreeMarker and it's a bummer since nobody is using Date any
> >> longer ...
> >>
> >
> > Yeah... it still isn't. It's probably among the new few things to add at
> > this point, as it's long due.
> >
> >>
> >>>
> >>> On Sun, Nov 17, 2019 at 7:02 PM Siegfried Goeschl <
> >>> siegfried.goeschl@gmail.com <ma...@gmail.com>
> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com>>>
> wrote:
> >>>
> >>>> Hi folks,
> >>>>
> >>>> since I'm currently mostly busy with non-coding tasks I spent some
> time
> >>>> honing my coding skills - probably to no avail as my colleagues would
> >> say
> >>>> ;-)
> >>>>
> >>>> 1) I migrated my pet project "freemarker-cli" from Groovy to JDK 8
> (see
> >>>> https://github.com/sgoeschl/freemarker-cli <
> https://github.com/sgoeschl/freemarker-cli> <
> >> https://github.com/sgoeschl/freemarker-cli <
> https://github.com/sgoeschl/freemarker-cli>> <
> >>>> https://github.com/sgoeschl/freemarker-cli <
> https://github.com/sgoeschl/freemarker-cli> <
> >> https://github.com/sgoeschl/freemarker-cli <
> https://github.com/sgoeschl/freemarker-cli>>>)
> >>>>
> >>>> 2) At
> >>>>
> >>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> <
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >
> >> <
> >>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> <
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >
> >>>
> >>>> <
> >>>>
> >>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> <
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >
> >> <
> >>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> <
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >
> >>>>
> >>>> you find a presentation I gave some while ago
> >>>>
> >>>> 3) I also wrote a Spring Boot FreeMarker sample project as part of the
> >>>> presentation (see
> >>>>
> >>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> <
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >
> >> <
> >>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> <
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >
> >>>
> >>>> <
> >>>>
> >>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> <
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >
> >> <
> >>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> <
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >
> >>>
> >>>>> )
> >>>>
> >>>> My plans / questions
> >>>>
> >>>> I would be awesome if I could get some feedback about "freemarker-cli"
> >> in
> >>>> its current JDK incarnation :-) Later on I will release 2.0.0 and push
> >> it
> >>>> to Maven Central.
> >>>>
> >>>> In the mean time I wrote three applications (micro services in new
> >> speak)
> >>>> using Apache FreeMarker and found it hard to find a starting point
> for a
> >>>> Spring Boot applications - therefore I wrote the sample project (see
> >>>> above). One way or the other a Spring Boot (and Micronaut) blue print
> >>>> should find its way into Apache FreeMarker officially. I think Apache
> >>>> FreeMarker is awesome for adding a developer UI to some micro service
> >> but
> >>>> developers don't care about the template engine but only about a quick
> >> and
> >>>> painless way to get the job done ...
> >>>>
> >>>> Anyone volunteering to give a presentation about Apache Freemarker at
> >>>> ApacheCon? I could do but I'm not really qualified :-)
> >>>>
> >>>> Thanks in advance,
> >>>>
> >>>> Siegfried Goeschl
> >>>>
> >>>>
> >>>>
> >>>
> >>> --
> >>> Best regards,
> >>> Daniel Dekany
> >>
> >
> > --
> > Best regards,
> > Daniel Dekany
>
>

-- 
Best regards,
Daniel Dekany

Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Siegfried Goeschl <si...@gmail.com>.
Hi Daniel,

try to write a top-level post to keep the discussion readable


Ad Multi-file Output
===============================================================

Currently no plans to implement it - I personally don’t have a need for it and it is a hypothetical requirement for now


Ad POI Integration
===============================================================

No problem in exposing the non-String data - it is a good idea and will be implemented


Ad Default Locale
===============================================================

* I need to define a locale for the unit tests 
* I guess it is a good idea to pin it to “en_US” to avoid suprises


Ad JDBC Access
===============================================================

It is part of a wider problem - when leaving the document-centric approach into scripting there is a lot of useful functionality, e.g. JDBC and HTTP clients. 

The problems

* JDBC: You need to add JDBC drivers, where to store the credentials, database schema, ...
* HTTP: More libraries, certificates, proxy support,...

It is possible to implement something but it will never work properly so I decided to tackle the problem differently b using commons-exec

* REST calls can be easily made by invoking cURL
* Database command line clients can export the result of a SELECT query to a CSV file


Ad Templates aren't used much for Web UI-s anymore
===============================================================

Yes and no - IMHO it is quite useful to embed a UI into certain "micro services”. Therefore I think that a ready-to-use Spring Boot (& Micronaut, etc..) integration is important and should not be an afterthought.


Thanks in advance, 

Siegfried Goeschl


> On 18 Dec 2019, at 01:32, Daniel Dekany <da...@gmail.com> wrote:
> 
> Hi,
> 
> Find my comments inline below.
> 
> On Tue, Dec 17, 2019 at 10:46 PM Siegfried Goeschl <
> siegfried.goeschl@gmail.com <ma...@gmail.com>> wrote:
> 
>> Hi Daniel,
>> 
>> Thanks for spending your time - feed back is always appreciated when doing
>> things in isolation ....
>> 
>> Please see my comments below
>> 
>> Thanks in advance,
>> 
>> Siegfried Goeschl
>> 
>> 
>> 
>>> On 17.12.2019, at 19:19, Daniel Dekany <da...@gmail.com> wrote:
>>> 
>>> Hi Siegfried,
>>> 
>>> Looks good!
>>> 
>>> Some random things I happened to notice:
>>> 
>>>  - The ability generating multiple output files from the same template
>>>  would be worthy addition. Like you load a CSV file that has employees
>> in
>>>  it, and based on that you generate one output file per department. Or
>> even
>>>  one per employee. (There could directives for that, like
>> changeOutputFile,
>>>  nestOutputFile, etc. on http://fmpp.sourceforge.net/pphash.html#sect17
>> <http://fmpp.sourceforge.net/pphash.html#sect17 <http://fmpp.sourceforge.net/pphash.html#sect17>>)
>> 
>> Well, I simply don't need it and it complicates things - in simple cases
>> one could just re-run the freemarker-cli with a different template and/or
>> parameters
>> 
> 
> My feeling is that if there's a tool that's about transforming some files
> to other files, but the idea that a single invocation can yield multiple
> output files is not part of it, one way or another (i.e., not necessarily
> in the way it was in FMPP), it might turns out to be a limiting design
> decision later as feature request start to pour in. And then it can be hard
> to add as an afterthought. Well, maybe I'm wrong, as I have no statics
> about how often it's needed. FMPP users did use it (myself included), some
> of them at least.
> 
> 
>>>  - When I load an XLSX, I get back values as string, not as numbers, or
>>>  dates. I'm not sure how hard it is to solve though (I don't remember
>> POI
>>>  much).
>> 
>> That should not be too hard - I actually use
>> org.apache.poi.ss.usermodel.DataFormatter to create the strings
> 
> 
> If templates get numbers etc., or have a such choice at least, then they
> can compare numbers, filter based on their values, control the formatting,
> etc. My idea here is that an Excel file, CSV file, whatever, is just a pure
> data, and rendering/formatting is the duty of the templates.
> 
> 
>>> BTW, the strings I get back are formatted with the locale of the OS,
>> 
>>  which is a problem. I guess there should be an config option to set the
>> JVM
>>>  locale. (The ExcelToolTest fails on my computer with locale hu_HU for
>>>  somewhat similar reason, as it gets "100,00" instead of "100.00".)
>> 
>> On the command line you can use
>> 
>> -l, --locale=<locale>     Locale being used for output file, e.g. 'en_US'
>> 
>> but I guess I should provide a fixed locale for the unit tests
>> 
> 
> The problem is not how FreeMarker renders the numbers. It already gets
> strings like that from POI, and --locale doesn't influence POI.
> 
> As of the default locale, for these kind of tools, I believe that using
> system defaults is usually evil. So having a fixed default is maybe not
> just for unit tests. The locale of my computer, or wherever I run a job on
> (often some backend linux box) should be usually irrelevant, and not
> influence the output. Not to mention when team mates share the project, in
> an international team.
> 
>>  - Querying from relation databases (JDBC) would be probably an useful
>>>  addition (it doesn't fit the Document paradigm though).
>> 
>> I integrated commons-exec and triggered AWS CLI - basically you capture
>> the output of any command-line invocation and process it. Just need to make
>> sure that every tool supports processing raw strings ...
>> 
> 
> I'm note sure what do you mean. The result of a query is a structured data,
> with column names and non-string types, so I guess command-line invocation
> can't solve that too well.
> 
> 
>>> It would be good if there's some de-facto tool for these kind of things
>>> than what freemarker-cli does. I guess there's a few such tools in
>> company
>>> repos, but of course those have no potential to become more generic and
>>> being published. (freemarker-generator was a such toll though, but it
>>> didn't go anywhere after donation. Actually, FMPP was a such tool too,
>> that
>>> I used for some sysadmin/webadmin tasks some 15+ years ago.) But of
>> course,
>>> long term care is the tricky issue with any project that has no company
>>> truly behind it (i.e., no payed developers). Do you have you have any
>>> thoughts/plans regarding the longer term life of freemarker-cli?
>> 
>> I worked on a couple of not soo successful Open Source projects - yes, it
>> might become another Open Source GitHub project nobody knows / cares :-)
>> 
>> Having said that
>> 
>> * I'm maintaining it already for a few of years and I will always find
>> some things I can do with it
>> * It is useful for some common tasks when you have a Java background
>> * I think it is a great way to re-use or build up FreeMarker knowledge
>> 
> 
> And, I would add, templates aren't used much for Web UI-s anymore, so these
> alternate use cases become the main ones.
> 
> 
>> * And it should become part of the Apache Freemarker project - much better
>> visibility & broader user base
>> 
> 
> Yeah, the last point is what I'm going for really. But that's also why I
> hope that you feel like making it more general. Or at least has no negative
> feelings about it.
> 
>> 
>>> Also, some things that you miss for FreeMarker itself for it to be more
>>> fitting for the task?
>> 
>> Support for Java 8 Date/Time API - last time I looked at it it was not
>> supported by FreeMarker and it's a bummer since nobody is using Date any
>> longer ...
>> 
> 
> Yeah... it still isn't. It's probably among the new few things to add at
> this point, as it's long due.
> 
>> 
>>> 
>>> On Sun, Nov 17, 2019 at 7:02 PM Siegfried Goeschl <
>>> siegfried.goeschl@gmail.com <ma...@gmail.com> <mailto:siegfried.goeschl@gmail.com <ma...@gmail.com>>> wrote:
>>> 
>>>> Hi folks,
>>>> 
>>>> since I'm currently mostly busy with non-coding tasks I spent some time
>>>> honing my coding skills - probably to no avail as my colleagues would
>> say
>>>> ;-)
>>>> 
>>>> 1) I migrated my pet project "freemarker-cli" from Groovy to JDK 8 (see
>>>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli> <
>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli>> <
>>>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli> <
>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli>>>)
>>>> 
>>>> 2) At
>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc>
>> <
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc>
>>> 
>>>> <
>>>> 
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc>
>> <
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc>
>>>> 
>>>> you find a presentation I gave some while ago
>>>> 
>>>> 3) I also wrote a Spring Boot FreeMarker sample project as part of the
>>>> presentation (see
>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>
>> <
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>
>>> 
>>>> <
>>>> 
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>
>> <
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>
>>> 
>>>>> )
>>>> 
>>>> My plans / questions
>>>> 
>>>> I would be awesome if I could get some feedback about "freemarker-cli"
>> in
>>>> its current JDK incarnation :-) Later on I will release 2.0.0 and push
>> it
>>>> to Maven Central.
>>>> 
>>>> In the mean time I wrote three applications (micro services in new
>> speak)
>>>> using Apache FreeMarker and found it hard to find a starting point for a
>>>> Spring Boot applications - therefore I wrote the sample project (see
>>>> above). One way or the other a Spring Boot (and Micronaut) blue print
>>>> should find its way into Apache FreeMarker officially. I think Apache
>>>> FreeMarker is awesome for adding a developer UI to some micro service
>> but
>>>> developers don't care about the template engine but only about a quick
>> and
>>>> painless way to get the job done ...
>>>> 
>>>> Anyone volunteering to give a presentation about Apache Freemarker at
>>>> ApacheCon? I could do but I'm not really qualified :-)
>>>> 
>>>> Thanks in advance,
>>>> 
>>>> Siegfried Goeschl
>>>> 
>>>> 
>>>> 
>>> 
>>> --
>>> Best regards,
>>> Daniel Dekany
>> 
> 
> -- 
> Best regards,
> Daniel Dekany


Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Daniel Dekany <da...@gmail.com>.
Hi,

Find my comments inline below.

On Tue, Dec 17, 2019 at 10:46 PM Siegfried Goeschl <
siegfried.goeschl@gmail.com> wrote:

> Hi Daniel,
>
> Thanks for spending your time - feed back is always appreciated when doing
> things in isolation ....
>
> Please see my comments below
>
> Thanks in advance,
>
> Siegfried Goeschl
>
>
>
> > On 17.12.2019, at 19:19, Daniel Dekany <da...@gmail.com> wrote:
> >
> > Hi Siegfried,
> >
> > Looks good!
> >
> > Some random things I happened to notice:
> >
> >   - The ability generating multiple output files from the same template
> >   would be worthy addition. Like you load a CSV file that has employees
> in
> >   it, and based on that you generate one output file per department. Or
> even
> >   one per employee. (There could directives for that, like
> changeOutputFile,
> >   nestOutputFile, etc. on http://fmpp.sourceforge.net/pphash.html#sect17
> <http://fmpp.sourceforge.net/pphash.html#sect17>)
>
> Well, I simply don't need it and it complicates things - in simple cases
> one could just re-run the freemarker-cli with a different template and/or
> parameters
>

My feeling is that if there's a tool that's about transforming some files
to other files, but the idea that a single invocation can yield multiple
output files is not part of it, one way or another (i.e., not necessarily
in the way it was in FMPP), it might turns out to be a limiting design
decision later as feature request start to pour in. And then it can be hard
to add as an afterthought. Well, maybe I'm wrong, as I have no statics
about how often it's needed. FMPP users did use it (myself included), some
of them at least.


> >   - When I load an XLSX, I get back values as string, not as numbers, or
> >   dates. I'm not sure how hard it is to solve though (I don't remember
> POI
> >   much).
>
> That should not be too hard - I actually use
> org.apache.poi.ss.usermodel.DataFormatter to create the strings


If templates get numbers etc., or have a such choice at least, then they
can compare numbers, filter based on their values, control the formatting,
etc. My idea here is that an Excel file, CSV file, whatever, is just a pure
data, and rendering/formatting is the duty of the templates.


> > BTW, the strings I get back are formatted with the locale of the OS,
>
>   which is a problem. I guess there should be an config option to set the
> JVM
> >   locale. (The ExcelToolTest fails on my computer with locale hu_HU for
> >   somewhat similar reason, as it gets "100,00" instead of "100.00".)
>
> On the command line you can use
>
> -l, --locale=<locale>     Locale being used for output file, e.g. 'en_US'
>
> but I guess I should provide a fixed locale for the unit tests
>

The problem is not how FreeMarker renders the numbers. It already gets
strings like that from POI, and --locale doesn't influence POI.

As of the default locale, for these kind of tools, I believe that using
system defaults is usually evil. So having a fixed default is maybe not
just for unit tests. The locale of my computer, or wherever I run a job on
(often some backend linux box) should be usually irrelevant, and not
influence the output. Not to mention when team mates share the project, in
an international team.

>   - Querying from relation databases (JDBC) would be probably an useful
> >   addition (it doesn't fit the Document paradigm though).
>
> I integrated commons-exec and triggered AWS CLI - basically you capture
> the output of any command-line invocation and process it. Just need to make
> sure that every tool supports processing raw strings ...
>

I'm note sure what do you mean. The result of a query is a structured data,
with column names and non-string types, so I guess command-line invocation
can't solve that too well.


> > It would be good if there's some de-facto tool for these kind of things
> > than what freemarker-cli does. I guess there's a few such tools in
> company
> > repos, but of course those have no potential to become more generic and
> > being published. (freemarker-generator was a such toll though, but it
> > didn't go anywhere after donation. Actually, FMPP was a such tool too,
> that
> > I used for some sysadmin/webadmin tasks some 15+ years ago.) But of
> course,
> > long term care is the tricky issue with any project that has no company
> > truly behind it (i.e., no payed developers). Do you have you have any
> > thoughts/plans regarding the longer term life of freemarker-cli?
>
> I worked on a couple of not soo successful Open Source projects - yes, it
> might become another Open Source GitHub project nobody knows / cares :-)
>
> Having said that
>
> * I'm maintaining it already for a few of years and I will always find
> some things I can do with it
> * It is useful for some common tasks when you have a Java background
> * I think it is a great way to re-use or build up FreeMarker knowledge
>

And, I would add, templates aren't used much for Web UI-s anymore, so these
alternate use cases become the main ones.


> * And it should become part of the Apache Freemarker project - much better
> visibility & broader user base
>

Yeah, the last point is what I'm going for really. But that's also why I
hope that you feel like making it more general. Or at least has no negative
feelings about it.

>
> > Also, some things that you miss for FreeMarker itself for it to be more
> > fitting for the task?
>
> Support for Java 8 Date/Time API - last time I looked at it it was not
> supported by FreeMarker and it's a bummer since nobody is using Date any
> longer ...
>

Yeah... it still isn't. It's probably among the new few things to add at
this point, as it's long due.

>
> >
> > On Sun, Nov 17, 2019 at 7:02 PM Siegfried Goeschl <
> > siegfried.goeschl@gmail.com <ma...@gmail.com>> wrote:
> >
> >> Hi folks,
> >>
> >> since I'm currently mostly busy with non-coding tasks I spent some time
> >> honing my coding skills - probably to no avail as my colleagues would
> say
> >> ;-)
> >>
> >> 1) I migrated my pet project "freemarker-cli" from Groovy to JDK 8 (see
> >> https://github.com/sgoeschl/freemarker-cli <
> https://github.com/sgoeschl/freemarker-cli> <
> >> https://github.com/sgoeschl/freemarker-cli <
> https://github.com/sgoeschl/freemarker-cli>>)
> >>
> >> 2) At
> >>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> <
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >
> >> <
> >>
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> <
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> >>
> >> you find a presentation I gave some while ago
> >>
> >> 3) I also wrote a Spring Boot FreeMarker sample project as part of the
> >> presentation (see
> >>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> <
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >
> >> <
> >>
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> <
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >
> >>> )
> >>
> >> My plans / questions
> >>
> >> I would be awesome if I could get some feedback about "freemarker-cli"
> in
> >> its current JDK incarnation :-) Later on I will release 2.0.0 and push
> it
> >> to Maven Central.
> >>
> >> In the mean time I wrote three applications (micro services in new
> speak)
> >> using Apache FreeMarker and found it hard to find a starting point for a
> >> Spring Boot applications - therefore I wrote the sample project (see
> >> above). One way or the other a Spring Boot (and Micronaut) blue print
> >> should find its way into Apache FreeMarker officially. I think Apache
> >> FreeMarker is awesome for adding a developer UI to some micro service
> but
> >> developers don't care about the template engine but only about a quick
> and
> >> painless way to get the job done ...
> >>
> >> Anyone volunteering to give a presentation about Apache Freemarker at
> >> ApacheCon? I could do but I'm not really qualified :-)
> >>
> >> Thanks in advance,
> >>
> >> Siegfried Goeschl
> >>
> >>
> >>
> >
> > --
> > Best regards,
> > Daniel Dekany
>

-- 
Best regards,
Daniel Dekany

Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Siegfried Goeschl <si...@gmail.com>.
Hi Daniel,

Thanks for spending your time - feed back is always appreciated when doing things in isolation ....

Please see my comments below

Thanks in advance, 

Siegfried Goeschl



> On 17.12.2019, at 19:19, Daniel Dekany <da...@gmail.com> wrote:
> 
> Hi Siegfried,
> 
> Looks good!
> 
> Some random things I happened to notice:
> 
>   - The ability generating multiple output files from the same template
>   would be worthy addition. Like you load a CSV file that has employees in
>   it, and based on that you generate one output file per department. Or even
>   one per employee. (There could directives for that, like changeOutputFile,
>   nestOutputFile, etc. on http://fmpp.sourceforge.net/pphash.html#sect17 <http://fmpp.sourceforge.net/pphash.html#sect17>)

Well, I simply don't need it and it complicates things - in simple cases one could just re-run the freemarker-cli with a different template and/or parameters

>   - When I load an XLSX, I get back values as string, not as numbers, or
>   dates. I'm not sure how hard it is to solve though (I don't remember POI
>   much).

That should not be too hard - I actually use org.apache.poi.ss.usermodel.DataFormatter to create the strings


> BTW, the strings I get back are formatted with the locale of the OS,
>   which is a problem. I guess there should be an config option to set the JVM
>   locale. (The ExcelToolTest fails on my computer with locale hu_HU for
>   somewhat similar reason, as it gets "100,00" instead of "100.00".)

On the command line you can use 

-l, --locale=<locale>     Locale being used for output file, e.g. 'en_US'

but I guess I should provide a fixed locale for the unit tests 

>   - Querying from relation databases (JDBC) would be probably an useful
>   addition (it doesn't fit the Document paradigm though).

I integrated commons-exec and triggered AWS CLI - basically you capture the output of any command-line invocation and process it. Just need to make sure that every tool supports processing raw strings ...

> 
> It would be good if there's some de-facto tool for these kind of things
> than what freemarker-cli does. I guess there's a few such tools in company
> repos, but of course those have no potential to become more generic and
> being published. (freemarker-generator was a such toll though, but it
> didn't go anywhere after donation. Actually, FMPP was a such tool too, that
> I used for some sysadmin/webadmin tasks some 15+ years ago.) But of course,
> long term care is the tricky issue with any project that has no company
> truly behind it (i.e., no payed developers). Do you have you have any
> thoughts/plans regarding the longer term life of freemarker-cli?

I worked on a couple of not soo successful Open Source projects - yes, it might become another Open Source GitHub project nobody knows / cares :-)

Having said that

* I'm maintaining it already for a few of years and I will always find some things I can do with it
* It is useful for some common tasks when you have a Java background
* I think it is a great way to re-use or build up FreeMarker knowledge
* And it should become part of the Apache Freemarker project - much better visibility & broader user base

> 
> Also, some things that you miss for FreeMarker itself for it to be more
> fitting for the task?

Support for Java 8 Date/Time API - last time I looked at it it was not supported by FreeMarker and it's a bummer since nobody is using Date any longer ...

> 
> 
> On Sun, Nov 17, 2019 at 7:02 PM Siegfried Goeschl <
> siegfried.goeschl@gmail.com <ma...@gmail.com>> wrote:
> 
>> Hi folks,
>> 
>> since I'm currently mostly busy with non-coding tasks I spent some time
>> honing my coding skills - probably to no avail as my colleagues would say
>> ;-)
>> 
>> 1) I migrated my pet project "freemarker-cli" from Groovy to JDK 8 (see
>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli> <
>> https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli>>)
>> 
>> 2) At
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc>
>> <
>> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc>>
>> you find a presentation I gave some while ago
>> 
>> 3) I also wrote a Spring Boot FreeMarker sample project as part of the
>> presentation (see
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>
>> <
>> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>
>>> )
>> 
>> My plans / questions
>> 
>> I would be awesome if I could get some feedback about "freemarker-cli" in
>> its current JDK incarnation :-) Later on I will release 2.0.0 and push it
>> to Maven Central.
>> 
>> In the mean time I wrote three applications (micro services in new speak)
>> using Apache FreeMarker and found it hard to find a starting point for a
>> Spring Boot applications - therefore I wrote the sample project (see
>> above). One way or the other a Spring Boot (and Micronaut) blue print
>> should find its way into Apache FreeMarker officially. I think Apache
>> FreeMarker is awesome for adding a developer UI to some micro service but
>> developers don't care about the template engine but only about a quick and
>> painless way to get the job done ...
>> 
>> Anyone volunteering to give a presentation about Apache Freemarker at
>> ApacheCon? I could do but I'm not really qualified :-)
>> 
>> Thanks in advance,
>> 
>> Siegfried Goeschl
>> 
>> 
>> 
> 
> -- 
> Best regards,
> Daniel Dekany


Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Daniel Dekany <da...@gmail.com>.
Hi Siegfried,

Looks good!

Some random things I happened to notice:

   - The ability generating multiple output files from the same template
   would be worthy addition. Like you load a CSV file that has employees in
   it, and based on that you generate one output file per department. Or even
   one per employee. (There could directives for that, like changeOutputFile,
   nestOutputFile, etc. on http://fmpp.sourceforge.net/pphash.html#sect17)
   - When I load an XLSX, I get back values as string, not as numbers, or
   dates. I'm not sure how hard it is to solve though (I don't remember POI
   much). BTW, the strings I get back are formatted with the locale of the OS,
   which is a problem. I guess there should be an config option to set the JVM
   locale. (The ExcelToolTest fails on my computer with locale hu_HU for
   somewhat similar reason, as it gets "100,00" instead of "100.00".)
   - Querying from relation databases (JDBC) would be probably an useful
   addition (it doesn't fit the Document paradigm though).

It would be good if there's some de-facto tool for these kind of things
than what freemarker-cli does. I guess there's a few such tools in company
repos, but of course those have no potential to become more generic and
being published. (freemarker-generator was a such toll though, but it
didn't go anywhere after donation. Actually, FMPP was a such tool too, that
I used for some sysadmin/webadmin tasks some 15+ years ago.) But of course,
long term care is the tricky issue with any project that has no company
truly behind it (i.e., no payed developers). Do you have you have any
thoughts/plans regarding the longer term life of freemarker-cli?

Also, some things that you miss for FreeMarker itself for it to be more
fitting for the task?


On Sun, Nov 17, 2019 at 7:02 PM Siegfried Goeschl <
siegfried.goeschl@gmail.com> wrote:

> Hi folks,
>
> since I'm currently mostly busy with non-coding tasks I spent some time
> honing my coding skills - probably to no avail as my colleagues would say
> ;-)
>
> 1) I migrated my pet project "freemarker-cli" from Groovy to JDK 8 (see
> https://github.com/sgoeschl/freemarker-cli <
> https://github.com/sgoeschl/freemarker-cli>)
>
> 2) At
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc
> <
> https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc>
> you find a presentation I gave some while ago
>
> 3) I also wrote a Spring Boot FreeMarker sample project as part of the
> presentation (see
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> <
> https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo
> >)
>
> My plans / questions
>
> I would be awesome if I could get some feedback about "freemarker-cli" in
> its current JDK incarnation :-) Later on I will release 2.0.0 and push it
> to Maven Central.
>
> In the mean time I wrote three applications (micro services in new speak)
> using Apache FreeMarker and found it hard to find a starting point for a
> Spring Boot applications - therefore I wrote the sample project (see
> above). One way or the other a Spring Boot (and Micronaut) blue print
> should find its way into Apache FreeMarker officially. I think Apache
> FreeMarker is awesome for adding a developer UI to some micro service but
> developers don't care about the template engine but only about a quick and
> painless way to get the job done ...
>
> Anyone volunteering to give a presentation about Apache Freemarker at
> ApacheCon? I could do but I'm not really qualified :-)
>
> Thanks in advance,
>
> Siegfried Goeschl
>
>
>

-- 
Best regards,
Daniel Dekany

Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Woonsan Ko <wo...@apache.org>.
Hi Siegfried,

On Wed, Dec 4, 2019 at 10:17 AM Siegfried Goeschl
<si...@gmail.com> wrote:
>
> Hi Woonsan,
>
> integrating Spring Boot is currently not an option for me
>
> * It adds additional libraries causing bloat - think of using “freemarker-cli” in Docker Images.
> * It increase the startup time significantly and JVM startup is already slow

I see.

>
> Having said that
>
> * Making the "Tools" being loaded configurable is a good idea and rather simple

+1

> * In a perfect world the “Tools" don’t have any dependency on “freemarker-cli” which is also an easy task (need to get rid of Settings.java used in two tools)

+1

Thanks! And I have no problem without spring-boot as long as it can be
used easily in that kind of frameworks. ;-)

Cheers,

Woonsan

>
> Thanks in advance,
>
> Siegfried Goeschl
>
>
> > On 4 Dec 2019, at 01:27, Woonsan Ko <wo...@apache.org> wrote:
> >
> > Hi Siegfried,
> >
> > On Tue, Dec 3, 2019 at 5:06 AM Siegfried Goeschl
> > <si...@gmail.com> wrote:
> > ---8<--- snip --->8---
> >> Regarding remarks (improvement ideas)
> >>
> >> Having an easy way to add custom tools would be nice but a bit tricky
> >
> > Right. I was imagining a Spring Boot based app which can take
> > advantage of extra libraries loading, application configuration,
> > executable jar distribution, etc. But I admit that I didn't consider
> > all different environment issues.
> > So, I'm not suggesting we should adopt something like spring-boot
> > right now, but just want to share what I was thinking below.
> >
> >>
> >> * How to pick up custom tools - config file versus class path scanning? What dependencies to pull in?
> >
> > As the current tool objects such as XmlTool are just POJO beans, it
> > seems nice if we can configure extra beans _easily_.
> > In spring-boot apps, we can provide (a) the default application
> > configuration file (e.g, application.yaml), (b) people can override
> > some properties through command line (e.g,
> > "-Dtools=com.example.tools.MyTool,com.example.tools.MyTool2"), or (c)
> > they can replace the whole configuration file through command line
> > (e.g, --spring.config.location=my.yaml).
> > And spring-boot allows to specify extra classpah too. i.e, java
> > -Dloader.path="mylib/" ...
> >
> > I'm not sure yet whether this kind of approach - simple executable jar
> > with depending on the framework's feature - may bring other drawbacks
> > that do not exist with your current solution.
> >
> > Please share what you think - pros and cons.
> >
> > Cheers,
> >
> > Woonsan
> >
> >> * How to integrate custom libs with the generated wrapper scripts - I would like to cleanly separate out-of-the-box freemarker-cli from user-specific changes, e.g. I support loading FreeMarker templates from “~/.freemarker-cli/templates”
> >>
> >> Using FreemarkerTask in a different environment
> >>
> >> * No problem to keep a shared “Configuration”
> >>
> >> Thanks in advance,
> >>
> >> Siegfried Goeschl
>

Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Siegfried Goeschl <si...@gmail.com>.
Hi Woonsan,

integrating Spring Boot is currently not an option for me 

* It adds additional libraries causing bloat - think of using “freemarker-cli” in Docker Images.
* It increase the startup time significantly and JVM startup is already slow 

Having said that

* Making the "Tools" being loaded configurable is a good idea and rather simple
* In a perfect world the “Tools" don’t have any dependency on “freemarker-cli” which is also an easy task (need to get rid of Settings.java used in two tools)

Thanks in advance, 

Siegfried Goeschl


> On 4 Dec 2019, at 01:27, Woonsan Ko <wo...@apache.org> wrote:
> 
> Hi Siegfried,
> 
> On Tue, Dec 3, 2019 at 5:06 AM Siegfried Goeschl
> <si...@gmail.com> wrote:
> ---8<--- snip --->8---
>> Regarding remarks (improvement ideas)
>> 
>> Having an easy way to add custom tools would be nice but a bit tricky
> 
> Right. I was imagining a Spring Boot based app which can take
> advantage of extra libraries loading, application configuration,
> executable jar distribution, etc. But I admit that I didn't consider
> all different environment issues.
> So, I'm not suggesting we should adopt something like spring-boot
> right now, but just want to share what I was thinking below.
> 
>> 
>> * How to pick up custom tools - config file versus class path scanning? What dependencies to pull in?
> 
> As the current tool objects such as XmlTool are just POJO beans, it
> seems nice if we can configure extra beans _easily_.
> In spring-boot apps, we can provide (a) the default application
> configuration file (e.g, application.yaml), (b) people can override
> some properties through command line (e.g,
> "-Dtools=com.example.tools.MyTool,com.example.tools.MyTool2"), or (c)
> they can replace the whole configuration file through command line
> (e.g, --spring.config.location=my.yaml).
> And spring-boot allows to specify extra classpah too. i.e, java
> -Dloader.path="mylib/" ...
> 
> I'm not sure yet whether this kind of approach - simple executable jar
> with depending on the framework's feature - may bring other drawbacks
> that do not exist with your current solution.
> 
> Please share what you think - pros and cons.
> 
> Cheers,
> 
> Woonsan
> 
>> * How to integrate custom libs with the generated wrapper scripts - I would like to cleanly separate out-of-the-box freemarker-cli from user-specific changes, e.g. I support loading FreeMarker templates from “~/.freemarker-cli/templates”
>> 
>> Using FreemarkerTask in a different environment
>> 
>> * No problem to keep a shared “Configuration”
>> 
>> Thanks in advance,
>> 
>> Siegfried Goeschl


Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Siegfried Goeschl <si...@gmail.com>.
Hi folks,

Following up the discussion

* The various tools are now instantiated using "freemarker-cli.properties" and support a single argument constructor taking a map (passing configuration data) or a default constructor.

* The  "freemarker-cli.properties" is picked up from the file system or class path and can be overridden on the command line

* Removed some redundancy across the available tools and aligned the namings

Regarding Spring Boot integration - not sure how feasible that is since "freemarker-cli" is still leaking command line tool abstractions. The various factory methods can be overridden in "FreeMarker Task" ...

Thanks in advance, 

Siegfried Goeschl




> On 06.12.2019, at 02:21, Woonsan Ko <wo...@apache.org> wrote:
> 
> On Thu, Dec 5, 2019 at 5:50 PM Denis Bredelet <bredelet@me.com.invalid <ma...@me.com.invalid>> wrote:
>> 
>> Hello Woonsan,
>> 
>>>> On Tue, Dec 3, 2019 at 5:06 AM Siegfried Goeschl
>>>> <si...@gmail.com> wrote:
>>>> ---8<--- snip --->8---
>>>>> Regarding remarks (improvement ideas)
>>>>> 
>>>>> Having an easy way to add custom tools would be nice but a bit tricky
>>>> 
>>>> Right. I was imagining a Spring Boot based app which can take
>>>> advantage of extra libraries loading, application configuration,
>>>> executable jar distribution, etc. But I admit that I didn't consider
>>>> all different environment issues.
>>>> So, I'm not suggesting we should adopt something like spring-boot
>>>> right now, but just want to share what I was thinking below.
>> 
>> The settings described below are quite nice, it should be simple enough to adopt the functionality without depending on Spring.
>> 
>> Just use a different configuration file name by default. Make the tool compatible with current version of Spring config file.
>> 
>> If used with Spring, then pass the settings down to it.
> 
> I don't think it is necessary to make it compatible with spring
> configuration file.
> freemarker-cli already has a nice abstraction,
> `com.github.sgoeschl.freemarker.cli.model.Settings`, for
> `FreeMarkerTask`.
> Anyone who wants to integrate with other framework can create the
> `Settings` from whatever-style configurations.
> 
> Woonsan
> 
>> 
>> Does that sound good?
>> — Denis.
>> 
>>>> 
>>>>> 
>>>>> * How to pick up custom tools - config file versus class path scanning? What dependencies to pull in?
>>>> 
>>>> As the current tool objects such as XmlTool are just POJO beans, it
>>>> seems nice if we can configure extra beans _easily_.
>>>> In spring-boot apps, we can provide (a) the default application
>>>> configuration file (e.g, application.yaml), (b) people can override
>>>> some properties through command line (e.g,
>>>> "-Dtools=com.example.tools.MyTool,com.example.tools.MyTool2"), or (c)
>>>> they can replace the whole configuration file through command line
>>>> (e.g, --spring.config.location=my.yaml).
>>>> And spring-boot allows to specify extra classpah too. i.e, java
>>>> -Dloader.path="mylib/" ...
>>> 
>>> Just in case, I have a spring-boot app project, which helps migrate
>>> Apache Jackrabbit binary data store from one to another:
>>> - https://github.com/woonsan/jackrabbit-datastore-migration
>>> You can find some examples about the framework features in the README.md.
>>> 
>>>> 
>>>> I'm not sure yet whether this kind of approach - simple executable jar
>>>> with depending on the framework's feature - may bring other drawbacks
>>>> that do not exist with your current solution.
>>>> 
>>>> Please share what you think - pros and cons.
>>>> 
>>>> Cheers,
>>>> 
>>>> Woonsan
>>>> 
>>>>> * How to integrate custom libs with the generated wrapper scripts - I would like to cleanly separate out-of-the-box freemarker-cli from user-specific changes, e.g. I support loading FreeMarker templates from “~/.freemarker-cli/templates”
>>>>> 
>>>>> Using FreemarkerTask in a different environment
>>>>> 
>>>>> * No problem to keep a shared “Configuration”
>>>>> 
>>>>> Thanks in advance,
>>>>> 
>>>>> Siegfried Goeschl


Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Woonsan Ko <wo...@apache.org>.
On Thu, Dec 5, 2019 at 5:50 PM Denis Bredelet <br...@me.com.invalid> wrote:
>
> Hello Woonsan,
>
> >> On Tue, Dec 3, 2019 at 5:06 AM Siegfried Goeschl
> >> <si...@gmail.com> wrote:
> >> ---8<--- snip --->8---
> >>> Regarding remarks (improvement ideas)
> >>>
> >>> Having an easy way to add custom tools would be nice but a bit tricky
> >>
> >> Right. I was imagining a Spring Boot based app which can take
> >> advantage of extra libraries loading, application configuration,
> >> executable jar distribution, etc. But I admit that I didn't consider
> >> all different environment issues.
> >> So, I'm not suggesting we should adopt something like spring-boot
> >> right now, but just want to share what I was thinking below.
>
> The settings described below are quite nice, it should be simple enough to adopt the functionality without depending on Spring.
>
> Just use a different configuration file name by default. Make the tool compatible with current version of Spring config file.
>
> If used with Spring, then pass the settings down to it.

I don't think it is necessary to make it compatible with spring
configuration file.
freemarker-cli already has a nice abstraction,
`com.github.sgoeschl.freemarker.cli.model.Settings`, for
`FreeMarkerTask`.
Anyone who wants to integrate with other framework can create the
`Settings` from whatever-style configurations.

Woonsan

>
> Does that sound good?
> — Denis.
>
> >>
> >>>
> >>> * How to pick up custom tools - config file versus class path scanning? What dependencies to pull in?
> >>
> >> As the current tool objects such as XmlTool are just POJO beans, it
> >> seems nice if we can configure extra beans _easily_.
> >> In spring-boot apps, we can provide (a) the default application
> >> configuration file (e.g, application.yaml), (b) people can override
> >> some properties through command line (e.g,
> >> "-Dtools=com.example.tools.MyTool,com.example.tools.MyTool2"), or (c)
> >> they can replace the whole configuration file through command line
> >> (e.g, --spring.config.location=my.yaml).
> >> And spring-boot allows to specify extra classpah too. i.e, java
> >> -Dloader.path="mylib/" ...
> >
> > Just in case, I have a spring-boot app project, which helps migrate
> > Apache Jackrabbit binary data store from one to another:
> > - https://github.com/woonsan/jackrabbit-datastore-migration
> > You can find some examples about the framework features in the README.md.
> >
> >>
> >> I'm not sure yet whether this kind of approach - simple executable jar
> >> with depending on the framework's feature - may bring other drawbacks
> >> that do not exist with your current solution.
> >>
> >> Please share what you think - pros and cons.
> >>
> >> Cheers,
> >>
> >> Woonsan
> >>
> >>> * How to integrate custom libs with the generated wrapper scripts - I would like to cleanly separate out-of-the-box freemarker-cli from user-specific changes, e.g. I support loading FreeMarker templates from “~/.freemarker-cli/templates”
> >>>
> >>> Using FreemarkerTask in a different environment
> >>>
> >>> * No problem to keep a shared “Configuration”
> >>>
> >>> Thanks in advance,
> >>>
> >>> Siegfried Goeschl
>

Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Denis Bredelet <br...@me.com.INVALID>.
Hello Woonsan,

>> On Tue, Dec 3, 2019 at 5:06 AM Siegfried Goeschl
>> <si...@gmail.com> wrote:
>> ---8<--- snip --->8---
>>> Regarding remarks (improvement ideas)
>>> 
>>> Having an easy way to add custom tools would be nice but a bit tricky
>> 
>> Right. I was imagining a Spring Boot based app which can take
>> advantage of extra libraries loading, application configuration,
>> executable jar distribution, etc. But I admit that I didn't consider
>> all different environment issues.
>> So, I'm not suggesting we should adopt something like spring-boot
>> right now, but just want to share what I was thinking below.

The settings described below are quite nice, it should be simple enough to adopt the functionality without depending on Spring. 

Just use a different configuration file name by default. Make the tool compatible with current version of Spring config file. 

If used with Spring, then pass the settings down to it. 

Does that sound good?
— Denis. 

>> 
>>> 
>>> * How to pick up custom tools - config file versus class path scanning? What dependencies to pull in?
>> 
>> As the current tool objects such as XmlTool are just POJO beans, it
>> seems nice if we can configure extra beans _easily_.
>> In spring-boot apps, we can provide (a) the default application
>> configuration file (e.g, application.yaml), (b) people can override
>> some properties through command line (e.g,
>> "-Dtools=com.example.tools.MyTool,com.example.tools.MyTool2"), or (c)
>> they can replace the whole configuration file through command line
>> (e.g, --spring.config.location=my.yaml).
>> And spring-boot allows to specify extra classpah too. i.e, java
>> -Dloader.path="mylib/" ...
> 
> Just in case, I have a spring-boot app project, which helps migrate
> Apache Jackrabbit binary data store from one to another:
> - https://github.com/woonsan/jackrabbit-datastore-migration
> You can find some examples about the framework features in the README.md.
> 
>> 
>> I'm not sure yet whether this kind of approach - simple executable jar
>> with depending on the framework's feature - may bring other drawbacks
>> that do not exist with your current solution.
>> 
>> Please share what you think - pros and cons.
>> 
>> Cheers,
>> 
>> Woonsan
>> 
>>> * How to integrate custom libs with the generated wrapper scripts - I would like to cleanly separate out-of-the-box freemarker-cli from user-specific changes, e.g. I support loading FreeMarker templates from “~/.freemarker-cli/templates”
>>> 
>>> Using FreemarkerTask in a different environment
>>> 
>>> * No problem to keep a shared “Configuration”
>>> 
>>> Thanks in advance,
>>> 
>>> Siegfried Goeschl


Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Woonsan Ko <wo...@apache.org>.
On Tue, Dec 3, 2019 at 7:27 PM Woonsan Ko <wo...@apache.org> wrote:
>
> Hi Siegfried,
>
> On Tue, Dec 3, 2019 at 5:06 AM Siegfried Goeschl
> <si...@gmail.com> wrote:
> ---8<--- snip --->8---
> > Regarding remarks (improvement ideas)
> >
> > Having an easy way to add custom tools would be nice but a bit tricky
>
> Right. I was imagining a Spring Boot based app which can take
> advantage of extra libraries loading, application configuration,
> executable jar distribution, etc. But I admit that I didn't consider
> all different environment issues.
> So, I'm not suggesting we should adopt something like spring-boot
> right now, but just want to share what I was thinking below.
>
> >
> > * How to pick up custom tools - config file versus class path scanning? What dependencies to pull in?
>
> As the current tool objects such as XmlTool are just POJO beans, it
> seems nice if we can configure extra beans _easily_.
> In spring-boot apps, we can provide (a) the default application
> configuration file (e.g, application.yaml), (b) people can override
> some properties through command line (e.g,
> "-Dtools=com.example.tools.MyTool,com.example.tools.MyTool2"), or (c)
> they can replace the whole configuration file through command line
> (e.g, --spring.config.location=my.yaml).
> And spring-boot allows to specify extra classpah too. i.e, java
> -Dloader.path="mylib/" ...

Just in case, I have a spring-boot app project, which helps migrate
Apache Jackrabbit binary data store from one to another:
- https://github.com/woonsan/jackrabbit-datastore-migration
You can find some examples about the framework features in the README.md.

>
> I'm not sure yet whether this kind of approach - simple executable jar
> with depending on the framework's feature - may bring other drawbacks
> that do not exist with your current solution.
>
> Please share what you think - pros and cons.
>
> Cheers,
>
> Woonsan
>
> > * How to integrate custom libs with the generated wrapper scripts - I would like to cleanly separate out-of-the-box freemarker-cli from user-specific changes, e.g. I support loading FreeMarker templates from “~/.freemarker-cli/templates”
> >
> > Using FreemarkerTask in a different environment
> >
> > * No problem to keep a shared “Configuration”
> >
> > Thanks in advance,
> >
> > Siegfried Goeschl

Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Woonsan Ko <wo...@apache.org>.
Hi Siegfried,

On Tue, Dec 3, 2019 at 5:06 AM Siegfried Goeschl
<si...@gmail.com> wrote:
---8<--- snip --->8---
> Regarding remarks (improvement ideas)
>
> Having an easy way to add custom tools would be nice but a bit tricky

Right. I was imagining a Spring Boot based app which can take
advantage of extra libraries loading, application configuration,
executable jar distribution, etc. But I admit that I didn't consider
all different environment issues.
So, I'm not suggesting we should adopt something like spring-boot
right now, but just want to share what I was thinking below.

>
> * How to pick up custom tools - config file versus class path scanning? What dependencies to pull in?

As the current tool objects such as XmlTool are just POJO beans, it
seems nice if we can configure extra beans _easily_.
In spring-boot apps, we can provide (a) the default application
configuration file (e.g, application.yaml), (b) people can override
some properties through command line (e.g,
"-Dtools=com.example.tools.MyTool,com.example.tools.MyTool2"), or (c)
they can replace the whole configuration file through command line
(e.g, --spring.config.location=my.yaml).
And spring-boot allows to specify extra classpah too. i.e, java
-Dloader.path="mylib/" ...

I'm not sure yet whether this kind of approach - simple executable jar
with depending on the framework's feature - may bring other drawbacks
that do not exist with your current solution.

Please share what you think - pros and cons.

Cheers,

Woonsan

> * How to integrate custom libs with the generated wrapper scripts - I would like to cleanly separate out-of-the-box freemarker-cli from user-specific changes, e.g. I support loading FreeMarker templates from “~/.freemarker-cli/templates”
>
> Using FreemarkerTask in a different environment
>
> * No problem to keep a shared “Configuration”
>
> Thanks in advance,
>
> Siegfried Goeschl

Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Siegfried Goeschl <si...@gmail.com>.
Hi Woonsan,

thanks for having a look - and nothing stops us making a nice common CLI tool :-)

Regarding remarks (improvement ideas)

Having an easy way to add custom tools would be nice but a bit tricky 

* How to pick up custom tools - config file versus class path scanning? What dependencies to pull in?
* How to integrate custom libs with the generated wrapper scripts - I would like to cleanly separate out-of-the-box freemarker-cli from user-specific changes, e.g. I support loading FreeMarker templates from “~/.freemarker-cli/templates”

Using FreemarkerTask in a different environment

* No problem to keep a shared “Configuration”

Thanks in advance, 

Siegfried Goeschl



> On 2 Dec 2019, at 21:02, Woonsan Ko <wo...@apache.org> wrote:
> 
> Please see my comments inline. Thanks!
> 
> On Tue, Nov 19, 2019 at 4:35 AM Siegfried Goeschl
> <siegfried.goeschl@gmail.com <ma...@gmail.com>> wrote:
>> 
>> Hi Woonsan,
>> 
>> please see my comments below …
>> 
>> Thanks in advance,
>> 
>> Siegfried Goeschl
>> 
>> 
>>> On 19 Nov 2019, at 00:03, Woonsan Ko <wo...@apache.org> wrote:
>>> 
>>> Hi Siegfried,
>>> 
>>> On Sun, Nov 17, 2019 at 1:02 PM Siegfried Goeschl
>>> <si...@gmail.com> wrote:
>>>> 
>>>> Hi folks,
>>>> 
>>>> since I'm currently mostly busy with non-coding tasks I spent some time honing my coding skills - probably to no avail as my colleagues would say ;-)
>>>> 
>>>> 1) I migrated my pet project "freemarker-cli" from Groovy to JDK 8 (see https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli>)
>>>> 
>>>> 2) At https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc> you find a presentation I gave some while ago
>>>> 
>>>> 3) I also wrote a Spring Boot FreeMarker sample project as part of the presentation (see https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>)
>>>> 
>>>> My plans / questions
>>>> 
>>>> I would be awesome if I could get some feedback about "freemarker-cli" in its current JDK incarnation :-) Later on I will release 2.0.0 and push it to Maven Central.
>>> 
>>> I like the idea in principle. We have some other "generators" - code
>>> generators for example, but this simple transformation/generation in
>>> CLI seems very useful too. Just as an example, I have seen my
>>> colleagues writing python scripts to convert one format to another.
>>> Your tool seems easier and more maintainable to me.
>>> I'd like to try it out later this week.
>> 
>> 
>> +1
> 
> I've take a look at the code. It is really nice! Thanks again for
> sharing this great tool. I wish we could make a nice common CLI tool
> out of this together.
> 
> I have some other remarks (which could be improvement ideas):
> - It would be nice if people can drop their jar or classes to register
> a custom tool, not just built-in tools. e.g, custom xml stream based
> reading tool, commons-vfs based tool, s3 tool, etc.
> - Sometimes people might want to use the `FreeMarkerTask` in
> multi-threaded env or framework-integrated env (e.g, spring-batch /
> spring-boot). At the moment, `FreeMarkerTask` creates the FreeMarker
> `Configuration` every time. It might be better to have an option to
> pass a shareable `Configuration` object to the caller task for those
> cases.
> 
> Kind regards,
> 
> Woonsan
> 
>> 
>>> 
>>>> 
>>>> In the mean time I wrote three applications (micro services in new speak) using Apache FreeMarker and found it hard to find a starting point for a Spring Boot applications - therefore I wrote the sample project (see above). One way or the other a Spring Boot (and Micronaut) blue print should find its way into Apache FreeMarker officially. I think Apache FreeMarker is awesome for adding a developer UI to some micro service but developers don't care about the template engine but only about a quick and painless way to get the job done ...
>>> 
>>> FWIW, in v3 branch, we also have a new submodule, freemarker-spring,
>>> substituting the spring mvc jsp tag libraries:
>>> -  https://github.com/apache/freemarker/tree/3/freemarker-spring
>>> Some examples in templates:
>>> - https://github.com/apache/freemarker/tree/3/freemarker-spring/src/test/resources/META-INF/web-resources/views/test/model
>>> 
>>> The template models, which replaces the spring jsp taglibs, are more
>>> lightweight and performant.
>>> I had my own GitHub repo for demo purpose, but intended to merge it to
>>> v3 branch someday:
>>> - https://github.com/woonsan/spring-mvc-freemarker3-demo
>>> It might be a bit outdated, but you will get the idea.
>>> And, I assume that mvc examples would be helpful to make a nice boot
>>> example with templates.
>> 
>> Will check out the v3 branch ...
>> 
>>> 
>>>> 
>>>> Anyone volunteering to give a presentation about Apache Freemarker at ApacheCon? I could do but I'm not really qualified :-)
>>> 
>>> I can give a hand, and I know you're really a qualified presenter
>>> (I've attended your session about JSPWiki before).
>>> So, if there's anyone, like Daniel or someone else, I'd just help out
>>> with anything. If no one can join in ApacheCon NA next year, I also
>>> want to volunteer preparations or even presenting together. ;-)
>>> 
>> 
>> I’m honoured - I think there were altogether less than 10 attendees for my two JSPWiki presentations @ ApacheCon :)
>> 
>>> Kind regards,
>>> 
>>> Woonsan
>>> 
>>>> 
>>>> Thanks in advance,
>>>> 
>>>> Siegfried Goeschl


Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Woonsan Ko <wo...@apache.org>.
Please see my comments inline. Thanks!

On Tue, Nov 19, 2019 at 4:35 AM Siegfried Goeschl
<si...@gmail.com> wrote:
>
> Hi Woonsan,
>
> please see my comments below …
>
> Thanks in advance,
>
> Siegfried Goeschl
>
>
> > On 19 Nov 2019, at 00:03, Woonsan Ko <wo...@apache.org> wrote:
> >
> > Hi Siegfried,
> >
> > On Sun, Nov 17, 2019 at 1:02 PM Siegfried Goeschl
> > <si...@gmail.com> wrote:
> >>
> >> Hi folks,
> >>
> >> since I'm currently mostly busy with non-coding tasks I spent some time honing my coding skills - probably to no avail as my colleagues would say ;-)
> >>
> >> 1) I migrated my pet project "freemarker-cli" from Groovy to JDK 8 (see https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli>)
> >>
> >> 2) At https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc> you find a presentation I gave some while ago
> >>
> >> 3) I also wrote a Spring Boot FreeMarker sample project as part of the presentation (see https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>)
> >>
> >> My plans / questions
> >>
> >> I would be awesome if I could get some feedback about "freemarker-cli" in its current JDK incarnation :-) Later on I will release 2.0.0 and push it to Maven Central.
> >
> > I like the idea in principle. We have some other "generators" - code
> > generators for example, but this simple transformation/generation in
> > CLI seems very useful too. Just as an example, I have seen my
> > colleagues writing python scripts to convert one format to another.
> > Your tool seems easier and more maintainable to me.
> > I'd like to try it out later this week.
>
>
> +1

I've take a look at the code. It is really nice! Thanks again for
sharing this great tool. I wish we could make a nice common CLI tool
out of this together.

I have some other remarks (which could be improvement ideas):
- It would be nice if people can drop their jar or classes to register
a custom tool, not just built-in tools. e.g, custom xml stream based
reading tool, commons-vfs based tool, s3 tool, etc.
- Sometimes people might want to use the `FreeMarkerTask` in
multi-threaded env or framework-integrated env (e.g, spring-batch /
spring-boot). At the moment, `FreeMarkerTask` creates the FreeMarker
`Configuration` every time. It might be better to have an option to
pass a shareable `Configuration` object to the caller task for those
cases.

Kind regards,

Woonsan

>
> >
> >>
> >> In the mean time I wrote three applications (micro services in new speak) using Apache FreeMarker and found it hard to find a starting point for a Spring Boot applications - therefore I wrote the sample project (see above). One way or the other a Spring Boot (and Micronaut) blue print should find its way into Apache FreeMarker officially. I think Apache FreeMarker is awesome for adding a developer UI to some micro service but developers don't care about the template engine but only about a quick and painless way to get the job done ...
> >
> > FWIW, in v3 branch, we also have a new submodule, freemarker-spring,
> > substituting the spring mvc jsp tag libraries:
> > -  https://github.com/apache/freemarker/tree/3/freemarker-spring
> > Some examples in templates:
> > - https://github.com/apache/freemarker/tree/3/freemarker-spring/src/test/resources/META-INF/web-resources/views/test/model
> >
> > The template models, which replaces the spring jsp taglibs, are more
> > lightweight and performant.
> > I had my own GitHub repo for demo purpose, but intended to merge it to
> > v3 branch someday:
> > - https://github.com/woonsan/spring-mvc-freemarker3-demo
> > It might be a bit outdated, but you will get the idea.
> > And, I assume that mvc examples would be helpful to make a nice boot
> > example with templates.
>
> Will check out the v3 branch ...
>
> >
> >>
> >> Anyone volunteering to give a presentation about Apache Freemarker at ApacheCon? I could do but I'm not really qualified :-)
> >
> > I can give a hand, and I know you're really a qualified presenter
> > (I've attended your session about JSPWiki before).
> > So, if there's anyone, like Daniel or someone else, I'd just help out
> > with anything. If no one can join in ApacheCon NA next year, I also
> > want to volunteer preparations or even presenting together. ;-)
> >
>
> I’m honoured - I think there were altogether less than 10 attendees for my two JSPWiki presentations @ ApacheCon :)
>
> > Kind regards,
> >
> > Woonsan
> >
> >>
> >> Thanks in advance,
> >>
> >> Siegfried Goeschl
> >>
> >>
>

Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Siegfried Goeschl <si...@gmail.com>.
Hi Woonsan,

please see my comments below …

Thanks in advance, 

Siegfried Goeschl


> On 19 Nov 2019, at 00:03, Woonsan Ko <wo...@apache.org> wrote:
> 
> Hi Siegfried,
> 
> On Sun, Nov 17, 2019 at 1:02 PM Siegfried Goeschl
> <si...@gmail.com> wrote:
>> 
>> Hi folks,
>> 
>> since I'm currently mostly busy with non-coding tasks I spent some time honing my coding skills - probably to no avail as my colleagues would say ;-)
>> 
>> 1) I migrated my pet project "freemarker-cli" from Groovy to JDK 8 (see https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli>)
>> 
>> 2) At https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc> you find a presentation I gave some while ago
>> 
>> 3) I also wrote a Spring Boot FreeMarker sample project as part of the presentation (see https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>)
>> 
>> My plans / questions
>> 
>> I would be awesome if I could get some feedback about "freemarker-cli" in its current JDK incarnation :-) Later on I will release 2.0.0 and push it to Maven Central.
> 
> I like the idea in principle. We have some other "generators" - code
> generators for example, but this simple transformation/generation in
> CLI seems very useful too. Just as an example, I have seen my
> colleagues writing python scripts to convert one format to another.
> Your tool seems easier and more maintainable to me.
> I'd like to try it out later this week.


+1

> 
>> 
>> In the mean time I wrote three applications (micro services in new speak) using Apache FreeMarker and found it hard to find a starting point for a Spring Boot applications - therefore I wrote the sample project (see above). One way or the other a Spring Boot (and Micronaut) blue print should find its way into Apache FreeMarker officially. I think Apache FreeMarker is awesome for adding a developer UI to some micro service but developers don't care about the template engine but only about a quick and painless way to get the job done ...
> 
> FWIW, in v3 branch, we also have a new submodule, freemarker-spring,
> substituting the spring mvc jsp tag libraries:
> -  https://github.com/apache/freemarker/tree/3/freemarker-spring
> Some examples in templates:
> - https://github.com/apache/freemarker/tree/3/freemarker-spring/src/test/resources/META-INF/web-resources/views/test/model
> 
> The template models, which replaces the spring jsp taglibs, are more
> lightweight and performant.
> I had my own GitHub repo for demo purpose, but intended to merge it to
> v3 branch someday:
> - https://github.com/woonsan/spring-mvc-freemarker3-demo
> It might be a bit outdated, but you will get the idea.
> And, I assume that mvc examples would be helpful to make a nice boot
> example with templates.

Will check out the v3 branch ...

> 
>> 
>> Anyone volunteering to give a presentation about Apache Freemarker at ApacheCon? I could do but I'm not really qualified :-)
> 
> I can give a hand, and I know you're really a qualified presenter
> (I've attended your session about JSPWiki before).
> So, if there's anyone, like Daniel or someone else, I'd just help out
> with anything. If no one can join in ApacheCon NA next year, I also
> want to volunteer preparations or even presenting together. ;-)
> 

I’m honoured - I think there were altogether less than 10 attendees for my two JSPWiki presentations @ ApacheCon :)

> Kind regards,
> 
> Woonsan
> 
>> 
>> Thanks in advance,
>> 
>> Siegfried Goeschl
>> 
>> 


Re: Apache FreeMarker - Sharing Is Caring ...

Posted by Woonsan Ko <wo...@apache.org>.
Hi Siegfried,

On Sun, Nov 17, 2019 at 1:02 PM Siegfried Goeschl
<si...@gmail.com> wrote:
>
> Hi folks,
>
> since I'm currently mostly busy with non-coding tasks I spent some time honing my coding skills - probably to no avail as my colleagues would say ;-)
>
> 1) I migrated my pet project "freemarker-cli" from Groovy to JDK 8 (see https://github.com/sgoeschl/freemarker-cli <https://github.com/sgoeschl/freemarker-cli>)
>
> 2) At https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc <https://github.com/sgoeschl/presentations/blob/master/javameetup/freemarker/slides/src/docs/asciidoc/index.adoc> you find a presentation I gave some while ago
>
> 3) I also wrote a Spring Boot FreeMarker sample project as part of the presentation (see https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo <https://github.com/sgoeschl/presentations/tree/master/javameetup/freemarker/demo>)
>
> My plans / questions
>
> I would be awesome if I could get some feedback about "freemarker-cli" in its current JDK incarnation :-) Later on I will release 2.0.0 and push it to Maven Central.

I like the idea in principle. We have some other "generators" - code
generators for example, but this simple transformation/generation in
CLI seems very useful too. Just as an example, I have seen my
colleagues writing python scripts to convert one format to another.
Your tool seems easier and more maintainable to me.
I'd like to try it out later this week.

>
> In the mean time I wrote three applications (micro services in new speak) using Apache FreeMarker and found it hard to find a starting point for a Spring Boot applications - therefore I wrote the sample project (see above). One way or the other a Spring Boot (and Micronaut) blue print should find its way into Apache FreeMarker officially. I think Apache FreeMarker is awesome for adding a developer UI to some micro service but developers don't care about the template engine but only about a quick and painless way to get the job done ...

FWIW, in v3 branch, we also have a new submodule, freemarker-spring,
substituting the spring mvc jsp tag libraries:
-  https://github.com/apache/freemarker/tree/3/freemarker-spring
Some examples in templates:
- https://github.com/apache/freemarker/tree/3/freemarker-spring/src/test/resources/META-INF/web-resources/views/test/model

The template models, which replaces the spring jsp taglibs, are more
lightweight and performant.
I had my own GitHub repo for demo purpose, but intended to merge it to
v3 branch someday:
- https://github.com/woonsan/spring-mvc-freemarker3-demo
It might be a bit outdated, but you will get the idea.
And, I assume that mvc examples would be helpful to make a nice boot
example with templates.

>
> Anyone volunteering to give a presentation about Apache Freemarker at ApacheCon? I could do but I'm not really qualified :-)

I can give a hand, and I know you're really a qualified presenter
(I've attended your session about JSPWiki before).
So, if there's anyone, like Daniel or someone else, I'd just help out
with anything. If no one can join in ApacheCon NA next year, I also
want to volunteer preparations or even presenting together. ;-)

Kind regards,

Woonsan

>
> Thanks in advance,
>
> Siegfried Goeschl
>
>