Skip to main content
Ben Nadel at InVision In Real Life (IRL) 2019 (Phoenix, AZ) with: Jacob Holloway
Ben Nadel at InVision In Real Life (IRL) 2019 (Phoenix, AZ) with: Jacob Holloway@jakeishTweets )

Recent Activity

Recent Heroes of the BenNadel.com Community

Recent Comments

BKBK replied to a post RequestTimeout Setting Affects CFThread Execution In Lucee CFML 5.3.6.61

Great article on a crucial subject. The ability to time out a thread has huge implications. For one thing, it can mean the difference between a rogue thread being stopped in its tracks or being free to hang about and hog memory for as long as it wants. However, there are questions I should like to b... read more

Ben Nadel replied to a post Pretty-Printing JSON Using GSON In Lucee CFML 5.3.9.141

@Murray, That actually sounds a lot like how the JSON.stringify() method works in JavaScript. It's signature is like this: JSON.stringify( value [, replacer [, space ]] ) ... where the second param is your callback, and the third param is for the pretty-printing functionality that I'm doing in GSON.... read more

Murray Hopkins replied to a post Pretty-Printing JSON Using GSON In Lucee CFML 5.3.9.141

@Ben, Yes, the GSON builder with its customisable policies and strategies is a good pattern that makes the serialization very ... customisable. However, I also found it didn't play well with Lucee Structs without having to do even more work. I thought the idea was a good one and made a Lucee languag... read more

nana replied to a post Having Fun With The SpeechSynthesis API In Angular 11.0.5

@Ben, Thank you very much for your answer. Finally I ran this code (which you posted) and it worked without issue. I figured out it was just a TypeScript item. Before, I thought I had to install plugins to make it work. And I'm not running it on electron, just on browser. and i don't either use elec... read more

Ben Nadel replied to a post Pretty-Printing JSON Using GSON In Lucee CFML 5.3.9.141

@Murray, Yeah, I tried looking at the GSON "builder" to see if I could define some sort of setting for numbers. They have some number strategy options, but it looks like they were for the deserialization aspects, not the serialization aspects. You can define some sort of custom Java classes; but, th... read more

Murray Hopkins replied to a post Pretty-Printing JSON Using GSON In Lucee CFML 5.3.9.141

Thanks Ben. I recently looked at GSON in my exploration of Serialisation options for a Lucee project (mainly trying to get lowercase keys). Forum post One thing I noticed (probably not relevant for your use-case here) is that GSON is not accurate in its JSON representation. For example, your count a... read more

Ben Nadel replied to a post Understanding Struct Key-Casing Using SerializeJson() In Lucee 5.3.2.77

@Frederic, Oh heck yeah! I've been a big fan of ordered-structs since I realized that Lucee (and ACF) have this syntax. For the most part, in a production app it doesn't really matter what order keys are in. But, when doing demos with screen shots or outputting JSON, seeing the keys in a "human frie... read more

Ben Nadel replied to a post Having Fun With The SpeechSynthesis API In Angular 11.0.5

@Nana, Unfortunately, I don't have any experience with Ionic. But, my understanding is that the Ionic package is just a UI framework for the web; so, I don't think it would impose any additional constraints. As such, I think you can just use the Browser's native speech synthesis API (as I have done ... read more

Ben Nadel replied to a post Validating Complex, Nested, Dynamic Data Structures In ColdFusion

@Roberto, Do you have a sense of where in the application should be responsible for this kind of JSON validation? I've been struggling to wrap my head around a solution that feels right. I think for the JSON validation itself - ie, the data that is to be persisted - then that should be in the data p... read more

Ben Nadel replied to a post Validating Complex, Nested, Dynamic Data Structures In ColdFusion

@Adam, You are 100% correct. The tests within a rule are and'ed but the rules are or'ed. Basically, I am just looping over the rules and finding the first one that matches all the tests and then returning it's variant (based on the rollout, which is either a single value or a weighed distribution). ... read more

Adam Tuttle replied to a post Validating Complex, Nested, Dynamic Data Structures In ColdFusion

Looks pretty neat. I will admit that I didn't read through the entire source of the final embed, but this part caught my eye: And, of course, the tests array can have multiple entries that are all AND'ed together. My gut reaction was that you're skipping OR support for now (as I did with Semaphore h... read more

Ben Nadel replied to a post Building-Up A Complex Objects Using Form POST-Backs In ColdFusion

@All, As a fast-follow to this post, I wanted to rework the demo into a multi-step wizard. I realized that using JSON to post the pending form state back to the server with each submission actually unlocks some very interesting potential. Specifically, we can break our form up into parts without hav... read more

Gary Stanton replied to a post Splitting An Array Into Groups In ColdFusion 2021

Just thought I'd come back and update this with some new information... Having been using this approach for many years, I've finally run into an issue whereby SQL Server is unable to process such a complex query. In this instance we're passing a list of around 60k IDs, which to be fair, is a bit exc... read more

Will Belden replied to a post Working Code Podcast - Episode 82: GitHub Charging For Copilot

As far as I can tell, it's all from "your code". I think it runs locally, mostly, and dependent on your CPU, resources. There is a paid version that is "smarter" (I guess?) and talks to their servers. I found it to be pretty amazing, just the local, free version. You start noticing pretty quickly. O... read more

Ben Nadel replied to a post Building-Up A Complex Objects Using Form POST-Backs In ColdFusion

@John, I'm just going to have to say that "Great minds think alike" 🤪 but, seriously, I think my code is probably little more than the "more modern" version of what Brian was doing. By that, I just mean that the syntax / build-in methods are lighter-weight and easier to deal with. That said, I thin... read more

Chris G. replied to a post Using An Array To Power Weighted Distributions In Lucee CFML 5.3.8.201

@Ben That was my first thought too, but then you'd have to track each range, which is additive... A = 0 - 0.1 B = 0.11 - 0.3 C = 0.31 - 1 That does seem more complex. Even if your solution does more "work", in the end I love how easy it is to comprehend. It's just simple and straight forward. But wh... read more

Ben Nadel replied to a post Using An Array To Power Weighted Distributions In Lucee CFML 5.3.8.201

@Chris, 😛 Honestly, I don't even know what the mathy solution would have been. The approach I outlined is the only way I know how to do it. I guess you could have called something like rand() to get a decimal between 0-1; then, checked the decimal against the desired distributions ... but, that fee... read more

Chris G. replied to a post Using An Array To Power Weighted Distributions In Lucee CFML 5.3.8.201

Clever! I like it. And now I'm wondering how I would have handled it. Probably not as elegantly as you. I'd love to know what the Mathy solution would look like out of curiosity, but as the saying goes...when all you have is a hammer, everything looks like a nail. And you (my friend) nailed it! 🤣... read more