http://coldfusion.com logo
Docs
Join the conversationJoin Slack
Channels
adobe
advent-of-code
auwcl
aws
books
bot-dev
box-products
cfeclipse
cfkrauts
cflint
cfml-beginners
cfml-general
cfml-tuning
cfsummit2022
cfwheels
ci
community_courses
css
devops-general
docker
docker-commandbox
documentation
events
friday-puzzle
fusion-reactor
fw1
ide
java-and-jvm
javascript
jobs
jobs-non-us
linen-dev
lucee
masacms
meta
migrations
mura
music
nosql
object-oriented
orm
perf-monitor
prog-general
slack-help
sql
taffy
testing
version-control
vuejs
water-cooler
Powered by Linen
fw1
  • f

    Formiko

    08/21/2022, 1:59 AM
    I just got this on fw1..https://www.wcl.american.edu/sjd/spp/index.cfm It seems like index,cfm is blank and Application,cfc has all the logic. I have to change only one line in the frontfacing side, but I can't seem to find where it is? Do any of you FW/1 gurus wanna throw me a bon which section I should look in? view or model or do you want to see Appliation.cfc?
    s
    8 replies · 2 participants
  • r

    rodyon

    09/10/2022, 4:29 PM
    hello, I was thinking of good way to implement 'skins' for fw/1 application. At one point, I think - what if /views and /layouts to be stored in 'theme' folder and location of 'theme' to be controlled by settings? I know this may sound like rare use case, but as exercise may bring some fun 🙂 Changes in Framework One itself will be required but it's the best path.
    a
    2 replies · 2 participants
  • s

    Scott Conklin

    09/16/2022, 2:46 PM
    Hi
  • s

    Scott Conklin

    09/16/2022, 2:49 PM
    Is there anyway to abort processing in a before() method and prevent it from executing item(). I am checking for an error and then I want to just want to go straight to renderdata and do nothing else: setting a return in before() does not seem to prevent it from continuing on to the item() method.
    rc["response"]["errors"] = 'Sorry, something went wrong';
    variables.fw.renderData().type( 'json' ).data( rc.response ).statusCode( 200 ).statusText( "Successful" );
    return;
    m
    w
    4 replies · 3 participants
  • f

    Formiko

    09/20/2022, 7:40 PM
    this is the rl how do I add stuff to thre main index.cfm page? https://www.blahbah.com/career/mentor/index.cfm/main/new/hash/6482DDCFABB7C0F1 trhe index.cfm is blank but it seems Application.cfc has stuff. I'm rtrying to add a capctchah to the form. Thnaks
    c
    9 replies · 2 participants
  • f

    Formiko

    09/21/2022, 12:46 AM
    I'm having a lot of trouble figuring this out, so the clients recommended disabling the form. Where do I look to make a page invisible in the framework?
  • f

    Formiko

    09/21/2022, 12:47 AM
    I think the MVC concept confuses me
  • f

    Formiko

    09/21/2022, 1:10 AM
    I'll try to simplify my problem. I work for a university and each department has it's own setup. A couple of years ago a developer came in and made only one of the department's websites in framework1. Every department has a form of some sort and I put captcha on all of them because of all the spam bots, EXCEPT one department which has FW-1. So while I'm trying to figure out framwework1, how do I disable the form completely. or make that particular page invisible until I get it to work?
  • r

    rodyon

    09/21/2022, 12:27 PM
    I bet Framework One does not stand in your way in this case. Search for < form > HTML tag and add captcha to it. Captcha is just another field in the form in most cases. Your form is somewhere in /views folder, probably under /main/new, I think.
  • f

    Formiko

    09/21/2022, 1:43 PM
    thank you
  • f

    Formiko

    09/21/2022, 1:51 PM
    That was it! I just needed to get out of my own way
    ❤️ 1
  • g

    GVJustDOIT

    09/27/2022, 7:03 PM
    Hi, I have upgraded from FW1 3.1 to 4.3 (the latest version) and the beans are not initializing properly. Can anyone have any suggestions?
    s
    2 replies · 2 participants
  • s

    Scott Conklin

    09/28/2022, 11:42 PM
    Is it not possible to set some application variables from a property injected dependency inside of setupApplication()? This does not throw an error, but I am experiencing strange behavior; namely the application variables are not defined.
    property config;
    
    ...
    
    	public void function setupApplication() {
    		settings = config.getSettings();
    	    	
    		application.AESKey = settings.keys.AES ;
    		application.captchaKey = settings.keys.captcha;
    		application.VTID = settings.application.vtid;
    		application.COTID = settings.application.cotid;
    		application.securelist = settings.securelist;
    		application.env = getEnvironment();
    		
    	 }
    w
    s
    +1
    53 replies · 4 participants
  • c

    Charles Robertson

    11/02/2022, 9:17 AM
    Hi everyone Isn’t it dangerous to use the variables scope in components that have been cached in the Application scope? It seems that by default, all FW1 services are singletons? Here is a bit more detail about what I mean. I am using FW1 and I have just found out that controllers and services are singletons [application scope]: https://framework-one.github.io/documentation/4.3/developing-applications/#services-domain-objects-and-persistence Inside one of my controllers, I have made two method calls: blogController
    function list(rc){
        rc.page = 1;
        variables.blogService.page(rc.page);
        rc.data = variables.blogService.list();
    }
    blogService
    component accessors = true{
        variables.blogs = {};
    
        // constructor etc…
     
        function page(page){
            // build variables.blogs struct from DB query
        }
     
        function list(){
            return variables.blogs;
        }
    }
    So, essentially, the
    blogService
    page method uses a DB query to populate:
    variables.blogs
    And then I immediately return this variable, in the
    list()
    method. What worries me, is that if there are two different requests like: REQUEST 1:
    rc.page = 1;
    variables.blogService.page(rc.page);
    rc.data = variables.blogService.list();
    REQUEST 2:
    rc.page = 2;
    variables.blogService.page(rc.page);
    rc.data = variables.blogService.list();
    The list data might get mixed up? My question: Are the two method calls, atomic, in the
    blogController
    , per request? I know that Coldfusion is multi-threaded, so requests are dealth with, in parallel. I am worried that the following might happen:
    REQUEST 1 rc.page = 1;
    REQUEST 1 variables.blogService.page(rc.page);
    REQUEST 2 rc.page = 2;
    REQUEST 2 variables.blogService.page(rc.page);
    REQUEST 1 rc.data = variables.blogService.list();
    REQUEST 2 rc.data = variables.blogService.list();
    Essentially, the user responsible for REQUEST 1 will receive the REQUEST 2 data. I feel that data is safe, within a singleton, as long as methods are UDFs [functional/stateless methods], but when there is stateful data, in a singleton, then the alarm bells start ringing. I am not sure why I decided to create a component variables variable, but I think I found it in an FW1 example. The three potential solutions I have, are: 1) Make services instances, not singletons [remove from the application scope] CANNOT DO THIS AS FW1 THROWS AN ERROR 2) Lock the two method calls, like:
    cflock (name="listBlogService", type="exclusive", timeout="30") {
        variables.blogService.page(rc.page);
        rc.data = variables.blogService.list();
    }
    3) Remove the
    blogService
    list()
    method and return the list from the
    page()
    method. This would turn the
    page()
    method into a UDF, removing references to state. I am veering towards option 3?
    w
    m
    5 replies · 3 participants
  • r

    rodyon

    11/02/2022, 10:32 AM
    REQUEST 1 rc.data = variables.blogService.list();
    REQUEST 2 rc.data = variables.blogService.list();
    I think if something like this happen in Lucee/Coldfusion, it would be abandoned somewhere around year 2000 as unusable platform. I'm not big on multithreading, but never got an issue you mentioned with cfml or fw/1 in years.
  • c

    Charles Robertson

    11/02/2022, 11:30 AM
    Well. Normally I would agree with you, but because the entire application is sharing what is read/written to
    <http://variables.blog|variables.blog>
    , I am not so sure. I mean, we are sometimes meant to lock down application variables and other bits of code that might spawn a race condition. I just wondered whether this is one such example?
  • r

    rodyon

    11/02/2022, 1:11 PM
    I don't thing it's possible to have race condition in REQUEST scope. Setting APPLICATION or SESSION vars should be Exclusively-locked I think.
  • w

    websolete

    11/02/2022, 1:18 PM
    no race conditions BETWEEN requests. application and session writes are thread safe but only within their respective application.cfc methods (onApplicationStart() and onSessionStart()). you'd most likely need to lock writes elsewhere if there's the possibility of race conditions
  • w

    websolete

    11/02/2022, 1:19 PM
    at least that's my understanding
  • j

    Jim Priest

    11/02/2022, 1:22 PM
    It's early so maybe I'm misunderstanding this - but why not use the 'local' scope (or var)? "Variables that you declare with the Var keyword inside a cffunction tag or CFScript function definition are available only in the method in which they are defined, and only last from the time the method is invoked until it returns the result. The Variables scope is not the same as the function local scope, which makes variables private within a function. Always define function-local variables using the var keyword of the Local scope name."
    👍 1
    c
    w
    +1
    4 replies · 4 participants
  • r

    rodyon

    11/02/2022, 1:36 PM
    FW/1 injects Service into Controller's variable scope
  • c

    Charles Robertson

    11/02/2022, 1:57 PM
    Yes. But all controllers/services are placed in the application scope, by default. When we inject into a controller like:
    property fooService;
    My understanding is that because the actual controller component is in the application scope, everything inside the component, including properties, which are in the
    variables
    scope, also persist. You can see this when you dump out the application scope. The point I am trying to make, is that any variable inside a service, in the
    variables
    scope, is a singleton, as well. This makes it vulnerable to being changed by more than one request. If services were transients, each request would get given a new instance. In this case, there would be no problem, because each request would be given its own copy of all the variables inside each service.
  • c

    Charles Robertson

    11/02/2022, 2:03 PM
    If you dump out the application scope, you will see the controllers/services. The beans are transients [instances]
  • w

    websolete

    11/02/2022, 2:30 PM
    i still think the flaw is mutating variables-scoped variables in singletons. it just feels you're trying to plug a hole created by not having any DAOs (which would be injected into the services as required)
    👍 1
  • c

    Charles Robertson

    11/02/2022, 3:17 PM
    I should be using DAOs, but to be honest that would only provide an extra level of organisation. However, I absolutely agree with your opinion about
    variables
    scope mutation inside a singleton. I only used this approach, because I found it in an FW1 example application. And to be fair, the objective, within the example app, was very possibly correct and I corrupted it. So, I’m going to remove the
    variables
    scope variable and just return the list data from the
    page()
    method. Before:
    function page(page){
        // build variables.blogs struct from DB query
        …
       cfloop(query=local.qGetFile, startrow=local.startrow, endrow=local.endrow){
            // add blog bean to variables.blogs
            …
            variables.blogs[local.qGetFile.File_ID] = blog;
        }
    }
    After:
    function page(page){
        // build variables.blogs struct from DB query
        …
        local.pagedata = {
            recordcount: local.recordcount,
            list: {}
        };
       cfloop(query=local.qGetFile, startrow=local.startrow, endrow=local.endrow){
            // add blog bean to variables.blogs
            …
            local.pagedata.list[local.qGetFile.File_ID] = blog;
        }
        return local.pagedata;
    }
  • s

    seancorfield

    11/02/2022, 5:35 PM
    To answer the question: do not use variables scope in controllers for request-specific data ever. Use
    rc
    or `local`/`var` scope variables only. The
    variables
    scope of a controller should only be used to cache global state (like an in-memory copy of a fixed lookup table or some such) and should either be initialized in the constructor method
    init()
    via dependency injection, or with careful locking as if dealing with
    application
    scope.
    👍 2
    👍🏻 1
    c
    s
    7 replies · 3 participants
  • d

    dfgrumpy

    12/28/2022, 4:47 PM
    I have a question for the class. To caveat this.. I can't share code or anything specific so please don't ask. I have a strange situation w/ a FW/1 app. The app, even in production, needs to have reload on every request enabled. If not, strange errors happen all over the place. I have some ideas as to what I am looking for to fix this. But was wondering if anyone else has ran into something like this and what they may have discovered was their fix.
    w
    b
    9 replies · 3 participants
  • t

    tmcneer

    01/31/2023, 4:52 PM
    Over the years, I have developed several fw1 applications that involve pretty granular permissions. Since a given permission might be required for a number of different section/action combinations, I’ve used various schemes for relating the fw1 context to permissions. But I’m curious as to how others might have dealt with the situation, if anyone is willing to share how they have attacked this.
    w
    18 replies · 2 participants
  • r

    rodyon

    02/03/2023, 5:29 PM
    Never used AOP with fw/1, reading docs: https://framework-one.github.io/documentation/3.1/using-aop-one/ - code examples are good, but no mention of FILES where these examples should be used... stuck! :)
    s
    4 replies · 2 participants
  • j

    jakobward

    02/23/2023, 1:04 AM
    @jakobward has left the channel
Powered by Linen
Title
j

jakobward

02/23/2023, 1:04 AM
@jakobward has left the channel
View count: 1