http://coldfusion.com logo
Join Slack
Powered by
# cfml-general
  • m

    mithlond

    05/27/2022, 3:38 PM
    Ran into an interesting thing. This code works fine:
    Copy code
    <cfset local.result = getModel("personS").PMRoleUpdateProductPosition(
    	listToArray(arguments.rc.productIDs).map((product_id) => {
    		return {
    			product_id = arguments.product_id,
    			context_type = rc.context_type
    		};
    	}),
    	arguments.rc.contextStatus,
    	arguments.rc.person_id
    ) />
    until I make some other seemingly unrelated changes somewhere else in the file, far away, like changing this
    Copy code
    <cfif
      (...
    to this
    Copy code
    <cfif (...
    and this
    Copy code
    <cfif blah>
      <!--- some comment --->
    to this
    Copy code
    <cfif blah> <!--- some comment --->
    Then, CF is like unhandled exception "Invalid CFML construct found on line n" complaining about the
    }
    character on the 7th line of the first bit of code. If I refactor it a bit to this, no complaints and it runs fine:
    Copy code
    <cfset local.productsArray = listToArray(arguments.rc.productIDs) />
    <cfset local.productsWithTypes = local.productsArray.map((product_id) => {
    	return { product_id = arguments.product_id, context_type = rc.context_type };
    }) />
    <cfset local.result = getModel("personS").PMRoleUpdateProductPosition(local.productsWithTypes, arguments.rc.contextStatus, arguments.rc.person_id ) />
    Why would the exact same code not have a syntax error before those unrelated, distant changes, but die once they're made?
    a
    • 2
    • 11
  • m

    mithlond

    05/27/2022, 3:39 PM
    granted, I'm doing a cfscript closure in CFML, but I've done that many many times w/o problems. And it works. Perfectly. In this case. Before the unrelated changes.
    a
    • 2
    • 3
  • m

    mithlond

    05/27/2022, 3:39 PM
    I'm wondering if it's some tokenization bug in CF itself.
  • m

    mithlond

    05/27/2022, 3:40 PM
    I'm also tempted to follow the old chestnut about the guy who goes to his doctor and says "doc, when I go like this, it hurts!", and the doctor says "don't do that". I'm ok with being pragmatic and just leaving it as the 2nd version of the code where I take it a step at a time.
  • m

    mithlond

    05/27/2022, 3:41 PM
    Just that some poor sap is going to come behind me and see that these lines could be simplified a bit, put it back to the original, and break it w/o realizing
  • m

    mithlond

    05/27/2022, 3:41 PM
    😭
  • s

    sknowlton

    05/27/2022, 3:42 PM
    that's not a doctor, that's a cf tag shaman, and who knows what's in his cauldron
    😎 1
  • s

    sknowlton

    05/27/2022, 3:42 PM
    any difference with Lucee vs. acf?
    m
    • 2
    • 1
  • j

    Jason Ryan

    05/27/2022, 5:32 PM
    Hey guys, trying to wrap my head around the anti-CSRF tokens, generation/verification. For each of my forms I have it generating a token. I'm assuming we would want the verification done in Application.cfc / onRequestStart ? Is my thinking in the right direction here? Thanks.
  • r

    ryanguill

    05/27/2022, 5:47 PM
    I dont guess theres still a cfdocs channel, but the fact that the
    log
    function is linked from the
    cflog
    page is humorous to me https://cfdocs.org/cflog 😄
    😁 1
    b
    a
    • 3
    • 3
  • j

    James Vince

    05/31/2022, 3:16 PM
    Does anyone know of a way I could set a timeout on a DirectoryExists() or FileExists() call in Lucee? We have files stored in Amazon EFS, and once in a while the file system is unreachable. A few pages in our web app check if certain files exist when the page loads, and if EFS is unreachable, the page won't load. The real fix will be figuring out why we sometimes can't connect to EFS, but being able to set a timeout on the FileExists() call would be helpful in the meantime
    d
    s
    • 3
    • 4
  • c

    chris_hopkins

    05/31/2022, 3:26 PM
    Just upgraded from 2016 -> 2021 on production and everything worked! about 4 tickets of things we knew already would kerplode but other than having to install the QoQ hotfix its going rather smoothly. Fingers crossed it continues that way
    👍 2
    n
    • 2
    • 3
  • f

    Formiko

    05/31/2022, 4:20 PM
    Hey fellas, Is it possible to create fractals in coldfusion? I don't see why not. I made Mandelbrot fractals in visual basic and Perl back in the day. They're implemented in python and php using the GD library. Has anyone attempted this in cf? Maybe @ben?
    m
    s
    • 3
    • 3
  • s

    Steve

    05/31/2022, 5:44 PM
    I'm working on a POC with cf-2021 and mongodb (atlas). Is there a best practice for handling find() and findOne() results? I was working with findOne(), and if it finds a hit, then all is good, findOne() returns the document. But then I intentionally wanted to see what happens when a match is not found, and the behaviour seems strange:
    Copy code
    var findResponse = this.findOne( query={ "_id": "mid:#mid#[invalidkey]" } );
    		application.utilities.debug( module="daoI4goV5.getMerchant", text="Find #mid#", data=findResponse );
    The debug line threw an exception because findResponse did not exist. Is this intentional and is there a best practice for handling this, meaning "try/catch", "isdefined()", "isnull()" (I'm not sure if the last even works, just throwing it out there)?
    m
    d
    • 3
    • 12
  • j

    Jason Ryan

    06/01/2022, 3:22 PM
    Hey guys, trying to implement anti-CSRF tokens, and having trouble accessing form info in the
    onRequestStart()
    hook in
    Application.cfc
    . Is it possible? When I output
    form
    it is just an empty struct ☹️
    r
    m
    • 3
    • 10
  • d

    David Rogers

    06/01/2022, 4:14 PM
    is
    self
    a keyword or scope or otherwise magic identifier?
    t
    b
    • 3
    • 7
  • j

    jakobward

    06/01/2022, 11:32 PM
    Any alternatives to “JavaMail” for decoding email MIME in ColdFusion? Preferably a native method.
    w
    b
    +2
    • 5
    • 52
  • g

    gavinbaumanis

    06/02/2022, 4:32 PM
    Ok Hi everyone - it is late after 2am and my brain has stopped. I have a struct that I have created with
    Copy code
    answerStr = {
        "Value" = "Value-1",
        "Description" = "Description-1"
    };
    questionsStruct["Q1"] = answerStr;
    answerStr = {
        "Value" = "Value-2",
        "Description" = "Description-2"
    };
    questionsStruct["Q2"] = answerStr;
    Now I want the following outcome in my table
    Copy code
    <tr>
    <td>Q1</td>
    <td>Value-1</td>
    <td>Description-1</td>
    </tr>
    <tr>
    <td>Q2</td>
    <td>Value-2</td>
    <td>Description-2</td>
    </tr>
    I have tried with the following (and so many other flavours.... DOT notaion Square Brackets without DOTS / with DOTS / with Quotes / without Quotes... I just can't seem to get it to output the actual contents of the structs I can get the contents of the TD cell to look like the string literal;
    aQuestion.Q1.Value
    - but not what it should evaluate to.... I tried wrapping the contents in
    DE()
    , I tried
    saveContent()
    ....
    Copy code
    i=0;
    cfloop(collection=questionsStruct item="aQuestion"){
        i++;
        writeOutput('
            <tr>
                <td>Q#i#</td>
                <td>aQuestion.Q#i#.#Value#</td>
                <td>Q#i#.Description</td>
             </tr>
        ');
    }
    Anyway - if someone wouldn't mind helping me out - I'd really appreciate it!
    z
    s
    +2
    • 5
    • 7
  • b

    Brian

    06/02/2022, 6:25 PM
    I'm trying to implement an updated SSO solution using SAML in ACF 2021. Would you protect a given application by putting the InitSAMLAuthRequest() in the onRequestStart in the Application.cfc? That would seem to call it with every request, which doesn't seem right though. And how does the value of relaystate effect this?
  • d

    Daniel Mejia

    06/03/2022, 3:44 AM
    Need help understanding how session works in either cfengine.
    p
    a
    • 3
    • 28
  • g

    gavinbaumanis

    06/05/2022, 8:18 AM
    if I define a variable in within a function - with "var"; Is it in the LOCAL or VARIABLES scope? Thanks!
    p
    a
    +2
    • 5
    • 7
  • p

    Peter Hoopes

    06/06/2022, 2:38 PM
    Looking for a little pointer. I’m working integrating the OAuth2 CFC found in Forgebox, but I’m having some trouble seeing how to tie it into my session management. Looking at the doc pointer, there appears to have been a good starter doc here: http://www.progratory.com/index.cfm/2014/10/31/Getting-started-with-oauth2-for-Google, but that’s now gone 404. I’ve downloaded and set up the OAuth2-Examples from Forgebox, but I’m still a bit confused as to how to just use our Google Domain as the OAuth2 source for our SIS app (which I wrote in CF). I’ve looked for any YT videos or CFCasts, but nothing available. Any good documentation or examples pointers would be greatly appreciated.
    r
    a
    • 3
    • 5
  • g

    gsr

    06/06/2022, 6:16 PM
    can i run node with cfexecute
    m
    p
    • 3
    • 12
  • m

    mithlond

    06/06/2022, 6:46 PM
    recommendations for image processing in CF? we have user photo uploads right now that we accept jpg/png and limit them to 4MB size, but we'd like to allow any size (up to like 100MB or something) and resize it on the server to fit our desired size, and also convert things like HEIC to jpg. Anyone got anything they're using currently that works for them?
    m
    b
    +2
    • 5
    • 8
  • g

    gsr

    06/07/2022, 11:44 AM
    i have an error handler module, it works withe every single project, i want to make it one project for all sites a common place
    m
    • 2
    • 1
  • g

    gsr

    06/07/2022, 11:45 AM
    because different sites use different datasources
  • g

    gsr

    06/07/2022, 11:45 AM
    any idea, suggestions
    a
    • 2
    • 5
  • a

    aaronstoddard

    06/07/2022, 1:04 PM
    We have ACF 2021 in a Docker container with Kubernetes and we need to programmatically restart the CF server. Can this be done via <cfexecute>?
  • m

    Marco

    06/07/2022, 1:28 PM
    Q: does cbSwagger works with the old Routes.cfm ?
    s
    • 2
    • 1
  • m

    Marco

    06/07/2022, 1:44 PM
    I am getting errors when trying to generate a YML file with cbSwagger, I think it only works with the new Router.cfc but need a confirmation, because if it works with the old Routes.cfm then there is something wrong in my routes configuration, thanks
1...91011...38Latest