Recent Activity
Recent Heroes of the BenNadel.com Community
-
Posted 58 comments since December 11, 2008
-
Posted 223 comments since October 23, 2012
-
Posted 8 comments since April 15, 2020
-
Posted 3 comments since June 26, 2024
-
Posted 13 comments since March 4, 2022
-
Posted 4 comments since April 26, 2018
-
Posted 1 comment since July 8, 2024
-
Posted 1 comment since July 22, 2024
Recent Comments
Ben Nadel replied to a post An "x-input" Property Binding Directive In Alpine.js
Comment posted July 23, 2024
I've updated the code to use framework.effect(), not Alpine.effect(). This should now be automatically cleaning-up any reactive logic when then scope of the component is destroyed (or so I've been told).... read entire comment from Ben Nadel.
Ben Nadel replied to a post An "x-input" Property Binding Directive In Alpine.js
Comment posted July 22, 2024
So, according to Eric Kwoka in my previously-linked Discussion, as long as you use the effect method that is passed into the directive definition, you don't have to release() it - it is doing some magic in the background to make this happen. In my code, I'm actually using Alpine.effect(). I assumed ... read entire comment from Ben Nadel.
Ben Nadel replied to a post Code Kata: Building A Tri-State Switch In Alpine.js
Comment posted July 22, 2024
@Samuel, I'll admit there's a lot of code here; but, it's not as obvious to me (as you make it out to be). I had to make some decisions that I'm not completely confident in. For example, with a simple Boolean switch, the fact that there are only 2 states makes things much simpler. Cycling direction ... read entire comment from Ben Nadel.
samuel replied to a post Code Kata: Building A Tri-State Switch In Alpine.js
Comment posted July 22, 2024
How unbelievably difficult it is to do what is essentially a variable that fits in two bits with still 25% memory wasted should tell us something about how awful the framework is we work in. You have a setter, a getter, a cycle function, a conditional, an array overflow error handler, a class, an in... read entire comment from samuel.
Ben Nadel replied to a post An "x-input" Property Binding Directive In Alpine.js
Comment posted July 22, 2024
I opened a Help question in the Alpine Github discussions forum: Clarity on when / if I need to call .release() on an effect reference? I'll report back when I have more clarity.... read entire comment from Ben Nadel.
Ben Nadel replied to a post An "x-input" Property Binding Directive In Alpine.js
Comment posted July 22, 2024
I'm realizing now that I am using Alpine.release() for the scope-level reactivity but not for the property-level reactivity. This stems from the fact that I'm not sure if I need to use it at all. I'm going to see if I can get some more information about this.... read entire comment from Ben Nadel.
Ben Nadel replied to a post Working Code Podcast - Episode 187: Viability Of The Minimum Viable Product
Comment posted July 20, 2024
@Rick, Getting help is one of those things that is so obvious from the outside; but, isn't always obvious when you're in the midst of things. It's also one of those things where when you don't have the muscle memory for it, it's hard to know where to start (ie, I need help with "XYZ", where do I fin... read entire comment from Ben Nadel.
Rick Mason replied to a post Working Code Podcast - Episode 187: Viability Of The Minimum Viable Product
Comment posted July 19, 2024
Adam and Ben, As a long time solo entrepreneur the advice I'd give is don't be afraid to get help on what you're not good at. In my case its getting AWS servers set up. Ben, one good hang out for one or two man teams on Slack is the MicroConf folks. Around double the daily traffic of the CFML Slack.... read entire comment from Rick Mason.
Chris G replied to a post Getting A Struct Key In Its Native Key-Casing In ColdFusion
Comment posted July 15, 2024
@Ben Nadel, that's so true. CF is a ton more fun to write than JAVA for example because of it's looseness (in my opinion). I like strict rules, but only to a certain (reasonable) extent :)... read entire comment from Chris G.
Ben Nadel replied to a post Getting A Struct Key In Its Native Key-Casing In ColdFusion
Comment posted July 15, 2024
@Chris, it's funny how stuff evolves over time. In the early days of ColdFusion, especially when it was more of a walled garden, the looseness of everything was so great. Strings, numbers, dates, upper case, lower case, it all just worked. But, the moment ColdFusion had to start regularly touching t... read entire comment from Ben Nadel.
Chris G replied to a post Getting A Struct Key In Its Native Key-Casing In ColdFusion
Comment posted July 15, 2024
This is 100% something I would do too! LOL I'm OCD about setting my struct keys like this myStruct[' keyName'] because I can't stand ALL CAP key names in my dumps.... read entire comment from Chris G.
Ben Nadel replied to a post OWASP Java Encoder Project Recommends Using Both URL and Attribute Encoding For HREF Attributes
Comment posted July 15, 2024
I thought I had this in my post somewhere, but I guess not. Here are the Java Docs for the Encoder class - this explicitly lists out all of the characters that get encoded in each method. https://javadoc.io/doc/org.owasp.encoder/encoder/latest/index.html... read entire comment from Ben Nadel.
Ben Nadel replied to a post OWASP Java Encoder Project Recommends Using Both URL and Attribute Encoding For HREF Attributes
Comment posted July 15, 2024
One of the things that makes this topic all the more confusing is that while the OWASP Java Encoder project says you should double-encode href attributes in the "common mistakes" section, they don't actually do this in any of their examples. If you look at their GitHub Wiki (see section 2), you'll s... read entire comment from Ben Nadel.
Ben Nadel replied to a post Normalizing Collection Entries In ColdFusion
Comment posted July 12, 2024
@Scott, ha ha, yeah, probably the right move for CSS (especially with all the nth child stuff we have these days).... read entire comment from Ben Nadel.
Scott Stroz replied to a post Normalizing Collection Entries In ColdFusion
Comment posted July 12, 2024
I would use a pre CSS solution for zebra-striping 😁... read entire comment from Scott Stroz.
Ben Nadel replied to a post Normalizing Collection Entries In ColdFusion
Comment posted July 12, 2024
15-years ago, I tried to do the same thing using a custom tag: https://www.bennadel.com/blog/1634-each-unified-struct-and-array-iteration-in-coldfusion.htm... read entire comment from Ben Nadel.
Simon replied to a post Trapping Focus Within An Element Using Tab-Key Navigation In JavaScript
Comment posted July 8, 2024
Thank you for sharing, I found this useful to enhance keyboard accessibility for my websites jumbo nav.... read entire comment from Simon.
Ben Nadel replied to a post Creating A ColdFusion-Oriented HashCode With Loose Types
Comment posted July 7, 2024
@All, Ok, I took another stab at creating a more configurable version of the FusionCode.cfc: https://www.bennadel.com/blog/4681-creating-a-coldfusion-oriented-hashcode-with-loose-types-part-2.htm In Part 2, you can enable struct-key / column-name case sensitivity; and, you can disable type-coercion.... read entire comment from Ben Nadel.
Ben Nadel replied to a post Creating A ColdFusion-Oriented HashCode With Loose Types
Comment posted July 6, 2024
Oh man, this is such a rabbit hole! Fraught with edge-cases. What I'm realizing now is that by converting the BigDecimal to a string, I can get false-positive equivalence. Maybe not so much in this particular post (where type-coercion is acceptable); but, in a follow-up post that I'm working on, I r... read entire comment from Ben Nadel.
Ben Nadel replied to a post Creating A ColdFusion-Oriented HashCode With Loose Types
Comment posted July 6, 2024
Ahh, ok, I can't do that. I didn't realize this at first, but the update(int) in the CRC-32 is only taking the lowest 8-bits: update(int b): Updates the CRC-32 checksum with the specified byte (the low eight bits of the argument b). Uggg, this gets more complicated. Ok, I think maybe I have to updat... read entire comment from Ben Nadel.
Ben Nadel replied to a post Creating A ColdFusion-Oriented HashCode With Loose Types
Comment posted July 6, 2024
Hmmm, and now I'm wondering if I can't just normalize numbers with the javaCast() alone, and not worry at all about the BigDecimal: javaCast( "double", value ).hashCode() Gonna play with that and see if that works better.... read entire comment from Ben Nadel.
Ben Nadel replied to a post Creating A ColdFusion-Oriented HashCode With Loose Types
Comment posted July 5, 2024
I've updated the code to use BigDecimal + javaCast("double") instead of BigInteger + javaCast("long") for normalizing numbers. Hopefully this is more accurate.... read entire comment from Ben Nadel.
Ben Nadel replied to a post Creating A ColdFusion-Oriented HashCode With Loose Types
Comment posted July 5, 2024
I just realized that javaCast( "long" ) is truncated decimal values. I didn't realize that—I had thought that long could hold decimal values. I get a little fuzzy on the low-level data types. It looks like double can hold decimals, though. I'll find a way to tweak that.... read entire comment from Ben Nadel.
Ben Nadel replied to a post Creating A ColdFusion-Oriented HashCode With Loose Types
Comment posted July 4, 2024
@Andrew, So, I just added this to my test code (I didn't update the blog post, just did this on my dev server): writeDump({ "objectEquals": objectEquals( data, dataPrime ) }); And it reports back as NO on Adobe ColdFusion and true on Lucee CFML. I don't know which parts of this are necessary not ... read entire comment from Ben Nadel.
Ben Nadel replied to a post Creating A ColdFusion-Oriented HashCode With Loose Types
Comment posted July 4, 2024
Ha ha, you're too far ahead of the curve 😛... read entire comment from Ben Nadel.
Andrew Kretzer replied to a post Creating A ColdFusion-Oriented HashCode With Loose Types
Comment posted July 4, 2024
Well, it appears I may be the only person to ever use it 🙃 https://community.ortussolutions.com/t/boxlang-town-meeting-edition-is-going-live-now/10223/2?u=andrew_kretzer... read entire comment from Andrew Kretzer.
Ben Nadel replied to a post Creating A ColdFusion-Oriented HashCode With Loose Types
Comment posted July 3, 2024
@Andrew, Literally never seen that function before 🤪 I'll have to play around with it; but, it might be exactly on the money. That said, Adobe ColdFusion also has one, but the description seems to be about "client side CFCs". Very confusing. Awesome tip, though! I'll circle back on what I find. For... read entire comment from Ben Nadel.
Andrew Kretzer replied to a post Creating A ColdFusion-Oriented HashCode With Loose Types
Comment posted July 3, 2024
Have you tried objectEquals() for this? Ignore the goofy explanation in cfdocs, but I think it does the same for your code (at least in Lucee... I have not used ACF for eons)... read entire comment from Andrew Kretzer.
Ben Nadel replied to a post Creating A ColdFusion-Oriented HashCode With Loose Types
Comment posted July 3, 2024
@Will, I really only designed it to work with native data structures (string, struct, array, etc). But, if all else fails, it will fall back to using the .hashCode() on whatever you give it. That said, I have no idea how that would work with CFCs. As for speed, I'm assuming it's not great due to rec... read entire comment from Ben Nadel.
Will B. replied to a post Creating A ColdFusion-Oriented HashCode With Loose Types
Comment posted July 3, 2024
Does it only work with simple values? Or can you stuff it with objects (like Java objects, CFC's, etc.) and it still do the work? How's the speed?... read entire comment from Will B..
Ben Nadel replied to a post Using An Ordered Struct As A Fixed-Size Cache In ColdFusion
Comment posted July 2, 2024
@Chris, Ha ha, I'm 100% with you there - if I'm outputting to JSON or using a dump, I'll often use an ordered struct just so my output feels more human-friendly :D Ain't nothing wrong with that!... read entire comment from Ben Nadel.
Chris G replied to a post Using An Ordered Struct As A Fixed-Size Cache In ColdFusion
Comment posted July 2, 2024
The only use case I have for ordered structs is purely aesthetic..I like when my structs are ordered (for me) when I dump and inspect them. Haha! But it's great to see another, more code-worthy use case. However, I do like the idea of a cache that retains items based on usage while (potentially) fac... read entire comment from Chris G.
Ben Nadel replied to a post Using An Ordered Struct As A Fixed-Size Cache In ColdFusion
Comment posted July 2, 2024
It's definitely a niche-case. I think most cache eviction rules revolve around access rates (keeping popular items in the cache and expunging rarely-used items).... read entire comment from Ben Nadel.
Will B. replied to a post Using An Ordered Struct As A Fixed-Size Cache In ColdFusion
Comment posted July 2, 2024
Makes sense. I mean, I've done my share of in-object caching with structs, to be sure. I've never limited by quantity that way, but I see the idea. With code at work, we use Cachebox within Coldbox. I don't think it has a limited-quantity ruleset. Maybe they should add it!... read entire comment from Will B..
Ben Nadel replied to a post Using An Ordered Struct As A Fixed-Size Cache In ColdFusion
Comment posted July 2, 2024
@Will, The biggest difference is when having to check to see if a value is already cached. In the .get() method, you'd have to change the relatively simple call, store.keyExists(key), with something that iterates over the array to see if the key exists.... read entire comment from Ben Nadel.
Will B. replied to a post Using An Ordered Struct As A Fixed-Size Cache In ColdFusion
Comment posted July 2, 2024
What would you say is the advantage of the struct style vs. an array of 10 items like: [ { "Key-100": "Value-100"} , { "Key-99": "Value-99"} ... ]... read entire comment from Will B..
Zachary Spitzer replied to a post Adobe ColdFusion Parses JSON Into Non-Ordered Structs
Comment posted July 2, 2024
Micha and I are glad you like it!... read entire comment from Zachary Spitzer.
Ben Nadel replied to a post Using An Ordered Struct As A Fixed-Size Cache In ColdFusion
Comment posted July 2, 2024
Ha ha, I'll keep it just between us 😉... read entire comment from Ben Nadel.
Zachary Spitzer replied to a post Using An Ordered Struct As A Fixed-Size Cache In ColdFusion
Comment posted July 2, 2024
there's a hidden new feature in Lucee 6.1 structNew( "max:50" ), but don't let anyone know I told you ok, just between us ok? https://github.com/lucee/Lucee/commit/aab00654330bb18d015056b08b92a125bda5ed86... read entire comment from Zachary Spitzer.
Ben Nadel replied to a post Adobe ColdFusion Parses JSON Into Non-Ordered Structs
Comment posted July 2, 2024
@Zac, To be clear, I prefer Lucee's implementation. And, I think it more closely matches the expectation in the JavaScript community (despite what the JavaScript specifications say). And, presumably, JavaScript will never change since the web bends-over-backwards to never break backwards compatibili... read entire comment from Ben Nadel.
Ben Nadel replied to a post Adobe ColdFusion Parses JSON Into Non-Ordered Structs
Comment posted July 2, 2024
This conversation inspired me to share another use of ordered structs: creating a very simple fixed-size cache: https://www.bennadel.com/blog/4677-using-an-ordered-struct-as-a-fixed-size-cache-in-coldfusion.htm Since the order of the key-insertion matches the order of key-iteration, you always know ... read entire comment from Ben Nadel.
Zachary Spitzer replied to a post Adobe ColdFusion Parses JSON Into Non-Ordered Structs
Comment posted July 2, 2024
From memory, this change was partly inspired whilst we started to implement .CFConfig.json support. As for compat concerns, there is no guarantee about the order of an unordered struct, even if it seems to be consistent... read entire comment from Zachary Spitzer.
Will B. replied to a post Adobe ColdFusion Parses JSON Into Non-Ordered Structs
Comment posted July 1, 2024
I recently (6 months ago?) discovered ordered structs. I love 'em! But not for "important" order, but so that when I dump the objects they look like the order I built them in. I would say that ACF should, however, convert to using ordered structs with deserializeJSON(), since it could be done that w... read entire comment from Will B..
Scott Stroz replied to a post Adobe ColdFusion Parses JSON Into Non-Ordered Structs
Comment posted July 1, 2024
@Ben Nadel, Meh...ordered or not, I am NEVER going to get values from a struct based on the position of the key in the struct (nor can I think of a use case for doing so). Which brings me to two interesting thoughts: How would you even get the value of a key based on the position of that key in a st... read entire comment from Scott Stroz.
Ben Nadel replied to a post Adobe ColdFusion Parses JSON Into Non-Ordered Structs
Comment posted July 1, 2024
@Scott, I think it's just a matter of understanding the tools at hand. If an unordered struct is created, then I agree, you should not depend on the order of the keys. But, if a system intentionally generates an ordered struct in a given workflow, I think it's completely reasonable to leverage the f... read entire comment from Ben Nadel.
Scott Stroz replied to a post Adobe ColdFusion Parses JSON Into Non-Ordered Structs
Comment posted July 1, 2024
I would argue that if you need a struct to be ordered...you should not be using a struct, you should be using an array. I would also argue that getting values by the position of the key in the struct rather than the key name is doing it wrong.... read entire comment from Scott Stroz.
Ben Nadel replied to a post Two Spread Operator Bugs In Adobe ColdFusion 2023
Comment posted June 28, 2024
I've filed two tickets with the Adobe Bug Tracker: CF-4222642 - Spread operator used with brackets causes template compilation error. CF-4222643 - Spread operator creates a nonsense result.... read entire comment from Ben Nadel.
Ben Nadel replied to a post Goodbye GROUP_CONCAT(), Hello JSON_ARRAYAGG() And JSON_OBJECTAGG() In MySQL 5.7.32
Comment posted June 26, 2024
@Tom, Learning is what's we're here for -- glad that at least there was some inspiration shared here :)... read entire comment from Ben Nadel.
Tom replied to a post Goodbye GROUP_CONCAT(), Hello JSON_ARRAYAGG() And JSON_OBJECTAGG() In MySQL 5.7.32
Comment posted June 26, 2024
@Ben Nadel, Thanks! I'm not a database expert, too. But today your post gave me the occasion to learn something new: JSON_OBJECTAGG's key cannot be null, otherwise you get the error "PDOException: SQLSTATE[22032]: <>: 3158 JSON documents may not contain NULL member names". This can be a problem in c... read entire comment from Tom.
Ben Nadel replied to a post Goodbye GROUP_CONCAT(), Hello JSON_ARRAYAGG() And JSON_OBJECTAGG() In MySQL 5.7.32
Comment posted June 26, 2024
@Tom, Ah, ok, I think I see what you're asking now. The column value coming out of the MySQL database is a string, even when the column type is defined as json; or, when you use something like JSON_ARRAYAGG() or JSON_OBJECTAGG() to collect data. At the end of the workflow, what the database gives yo... read entire comment from Ben Nadel.