RE: [Freemarker-devel] Hexadecimal formatting
Generates text that depends on changing data (like dynamic HTML).
Brought to you by:
revusky
|
From: Mark v. de V. <mar...@se...> - 2004-04-29 14:41:30
|
Hi, > [snip] recently there was a guy who wanted a > "remove_tags" built-in (to remove HTML tags from text coming > from the DB), but then people here in the list voted against > it, because it's too special. So maybe this will be the case > with the "hex" built-in as well. But personally I would > accept it (as well as "remove_tags"). Now, of course I would > vote against a fibonacci number calculator built-in... Imho my "hex" build-in is really just a formatting thing and formatting (view generation in my case) is what Freemarker is all about. It does not calculate anything (like a fibonacci would), doesn't change data or affect anything else. If you acknowledge that Freemarker can be used in more technical applications then a "hex" build-in seems pretty generic. But that's just me. :) > There is no such documentation... but what info do you miss > regarding that? You're right, probably not much. I thought I saw other (big) open source projects have some pointers on what a wanne-be-developer should do. Things like: please look at this or that mailing list, learn about this or that before thinking of contributing or mail this person when you want to contribute. Maybe just a single line somewhere in the manual would do fine if it says something like "If you want to contribute please join the fre...@li... mailing list". > > below. It's not a complicated build-in. I'm sure you guys(?) > (Really... are there women?) Just covering my *ss. ;) In response to Attila: > Well - it's mostly okay, except for two things :-) > 1. If it's a BigInteger, then BigInteger.toString(int radix) > is the API to use > 2. Otherwise, num.longValue() is a better choice to support 64-bit > integers, too. You're right. I would go for the second option. I always use Integer.toHexString() and forgot that Long.toHexString() exists too... I'm not a very experienced Java developer but I read some place (http://mindprod.com/jgloss/gotchas.html) that BigInteger isn't a very nice class. Is it used much? It sounds to me that having 'limited' support for BigInteger isn't a big deal. > Also, I'm not sure if we want to include support for padding > zeroes... I understand. It's just that in more technical environments hexadecimal values very often printed as 2, 4 or 8 digit numbers. Why not incorporate it if the feature will be used most of the time? If only for performance (I have a embedded software back-ground). It really is kind of like ${12345?string("0.####E0")} and that is supported. Come and think if it, if it is possible to extend the ?string build-in to support hexadecimal formatting of integers then that could be a good solution too. Mark |