Skip to content

Instantly share code, notes, and snippets.

<cfscript>
x = "a" & chr(160) & "b" & chr(160);
writedump(x)
writedump( "[" & trim(x) & "]")
</cfscript>
<cfscript>
local.nuovoGiorno = 7 // domenica
local.data = "22/07/2024"; // lun 22 07
local.giornoDaEsaminare = dayofweek(local.data, "iso");
// 1 = Lunedi / 7 = domenica
// Calcola quanti giorni mancano al prossimo giorno di consegna disponibile
local.giorniMancanti = (local.nuovoGiorno - local.giornoDaEsaminare + 7) % 7;
<!--- 2018-12-03 Convert XML string to JSON string in 1 line of code
Uses CF2016 /cfusion/lib/closure-compiler.jar (but library used is from 2009 and has been updated 12+ times)
If using CF10 (or want to use newer library), download newer JARs directly from the JSON-Java project & use JavaLoader:
https://github.com/stleary/JSON-java
https://search.maven.org/search?q=g:org.json%20AND%20a:json&core=gav
2023-07-25: This approach to consuming XML is not susceptible to the XML External Entity (XXE) vulnerability.
https://foundeo.com/security/guide/xml-external-entities/
--->
<!--- 2018-12-03 Convert XML string to JSON string in 1 line of code
Uses CF2016 /cfusion/lib/closure-compiler.jar (but library used is from 2009 and has been updated 12+ times)
If using CF10 (or want to use newer library), download newer JARs directly from the JSON-Java project & use JavaLoader:
https://github.com/stleary/JSON-java
https://search.maven.org/search?q=g:org.json%20AND%20a:json&core=gav
2023-07-25: This approach to consuming XML is not susceptible to the XML External Entity (XXE) vulnerability.
https://foundeo.com/security/guide/xml-external-entities/
--->
<!--- 2018-12-03 Convert XML string to JSON string in 1 line of code
Uses CF2016 /cfusion/lib/closure-compiler.jar (but library used is from 2009 and has been updated 12+ times)
If using CF10 (or want to use newer library), download newer JARs directly from the JSON-Java project & use JavaLoader:
https://github.com/stleary/JSON-java
https://search.maven.org/search?q=g:org.json%20AND%20a:json&core=gav
2023-07-25: This approach to consuming XML is not susceptible to the XML External Entity (XXE) vulnerability.
https://foundeo.com/security/guide/xml-external-entities/
--->
<!--- 2018-12-03 Convert XML string to JSON string in 1 line of code
Uses CF2016 /cfusion/lib/closure-compiler.jar (but library used is from 2009 and has been updated 12+ times)
If using CF10 (or want to use newer library), download newer JARs directly from the JSON-Java project & use JavaLoader:
https://github.com/stleary/JSON-java
https://search.maven.org/search?q=g:org.json%20AND%20a:json&core=gav
2023-07-25: This approach to consuming XML is not susceptible to the XML External Entity (XXE) vulnerability.
https://foundeo.com/security/guide/xml-external-entities/
--->
<!--- 2018-12-03 Convert XML string to JSON string in 1 line of code
Uses CF2016 /cfusion/lib/closure-compiler.jar (but library used is from 2009 and has been updated 12+ times)
If using CF10 (or want to use newer library), download newer JARs directly from the JSON-Java project & use JavaLoader:
https://github.com/stleary/JSON-java
https://search.maven.org/search?q=g:org.json%20AND%20a:json&core=gav
2023-07-25: This approach to consuming XML is not susceptible to the XML External Entity (XXE) vulnerability.
https://foundeo.com/security/guide/xml-external-entities/
--->
<!--- 2018-12-03 Convert XML string to JSON string in 1 line of code
Uses CF2016 /cfusion/lib/closure-compiler.jar (but library used is from 2009 and has been updated 12+ times)
If using CF10 (or want to use newer library), download newer JARs directly from the JSON-Java project & use JavaLoader:
https://github.com/stleary/JSON-java
https://search.maven.org/search?q=g:org.json%20AND%20a:json&core=gav
2023-07-25: This approach to consuming XML is not susceptible to the XML External Entity (XXE) vulnerability.
https://foundeo.com/security/guide/xml-external-entities/
--->
<!--- 2018-12-03 Convert XML string to JSON string in 1 line of code
Uses CF2016 /cfusion/lib/closure-compiler.jar (but library used is from 2009 and has been updated 12+ times)
If using CF10 (or want to use newer library), download newer JARs directly from the JSON-Java project & use JavaLoader:
https://github.com/stleary/JSON-java
https://search.maven.org/search?q=g:org.json%20AND%20a:json&core=gav
2023-07-25: This approach to consuming XML is not susceptible to the XML External Entity (XXE) vulnerability.
https://foundeo.com/security/guide/xml-external-entities/
--->
<!--- 2018-12-03 Convert XML string to JSON string in 1 line of code
Uses CF2016 /cfusion/lib/closure-compiler.jar (but library used is from 2009 and has been updated 12+ times)
If using CF10 (or want to use newer library), download newer JARs directly from the JSON-Java project & use JavaLoader:
https://github.com/stleary/JSON-java
https://search.maven.org/search?q=g:org.json%20AND%20a:json&core=gav
2023-07-25: This approach to consuming XML is not susceptible to the XML External Entity (XXE) vulnerability.
https://foundeo.com/security/guide/xml-external-entities/
--->