http://coldfusion.com logo
Join Slack
Powered by
# cfml-beginners
  • d

    Daniel Mejia

    11/29/2022, 11:30 AM
    #advent-of-code join here. AOC start’s December 1st at Midnight EST. 2 puzzles per day until Christmas Eve. Help save Christmas!!! Share leaderboards here. Share your code repos here. Get stuck on a puzzle - ask for help here.
  • a

    Amado

    12/06/2022, 5:36 PM
    Hello - I'm very new to coldfusion and programming for that matter. I'm trying to create a quadratic equation calculator program in Coldfusion. However - I don't know how to take the inputs from a user. I have a simple calculator function for the quadratic equation and have looked up various tutorials on how to take inputs. It appears that maybe I have to do a separate form but how do I pass information from that form into my program? Here's what I've done so far
    Copy code
    <cfscript>
    
    
        function computeQuadratic(a,b,c) {
            var discriminant1 = (-1 * b) + sqr((b*b) -(4*a*c));
    
            var discriminant2 = (-1 * b) - sqr((b*b)-(4*a*c));
    
            var root1 = discriminant1/(2*a)
            var root2 = discriminant2/(2*a)
    
            writeOutput ("<p> the answer for root1 is #root1#</p>");
            writeOutput ("<p> the answer for root2 is #root2#</p>");
    
        }  computeQuadratic(3,8,4);
    a
    s
    +2
    • 5
    • 26
  • g

    gsr

    12/12/2022, 3:04 PM
    TLS1.1
  • m

    mk

    12/13/2022, 4:15 PM
    I am using a jquery UI based jquery idletimeout plus and added all the necessary columns so when the Sessiontimeout is about to expire, it should extend it i have this code in my page
    Copy code
    <cffunction name="backupSession" returntype="struct">        
    <cfset local.backup = StructNew()>
        <cflock scope="session" timeout="10">
            <cfset str = {}>
            <cfloop collection="#session#" item="i">
                <cfset str[i] = duplicate(session[i])>
            </cfloop>
            <cfset local.backup.Original = str>            
        </cflock>
        <cfreturn local.backup>
    </cffunction>
    
    <cffunction name="restoreSession" returntype="void" >
        <cfargument required="true" name="backup" type="struct">        
        <cflock scope="session" timeout="10">
            <cfset local.Liste=StructKeyList(arguments.backup)>    
            <cfloop index="i" from="1" to="#ListLen(local.Liste)#">    
                <cfset LeItem=ListGetAt(local.Liste,i)>
                <cfset session[LeItem]=arguments.backup[LeItem]>
            </cfloop>
        </cflock>
    </cffunction>
    
    <cfoutput>
        <cfset retData = backupSession()>
        #restoreSession(retData)#
    </cfoutput>
    
    my Application.cfm file has timeout set as 4 minutes to session, do i need to call my application also to extend the session, because even if i say stay connected, i gets logged out
    m
    • 2
    • 9
  • i

    Iyob Zenebe

    12/14/2022, 1:12 PM
    Unable to display image on cfdocument on the below code.
    Copy code
    <div><img src="../barcodeImages/#barCode.image#"></div>
    Any help is highly appreciated.
    Copy code
    <cfdocument name="PaymentVoucher" format="pdf" >
    			<h2 align="center">Payment Voucher</h2>
    			<div style="margin-left:20px;">
    			 
    			To report contributions, submit this voucher ..............to:<br><br>
    				<address>ABC Co<br>
    						PO Box 123<br>
    						Any City, VA 12349-0972<br>
    				</address>
    			</div>
    			<cfoutput>
    				<div style="margin-left:50px;">
    					<br>
    					<b>Voucher ID:</b><br>
    					#Left(session.userlogin.acc_num,7)#.#dateformat(barcode.generatedTime, "mmddyyyy")#.#lastId#.#local_num#
    					<br><br>
    					<div style="margin-top:20x;width:25%;float:left;">
    						<b>Work Period:</b>
    					</div>
    					<div style="margin-top:20x;width:75%;float:left;">
    						<b>Reports:</b>
    					</div>
    					<cfset totalRunTot = 0>
    					<cfloop query="getReportInfo">
    						<div style="padding-bottom:5px;width:25%;float:left;">
    							#getReportInfo.work_period#	
    						</div>
    						<div style="padding-bottom:5px;width:75%;float:left;">
    							#getReportInfo.report_group# - $#getReportInfo.runtot#
    						</div>
    						<cfset totalRunTot += getReportInfo.runtot>
    					</cfloop>
    					 
    					<div style="margin-top:20px;width:100%;">
    						<b>Total Check Amount:</b>
    						<br>#DollarFormat(totalRunTot)#
    					</div>
    					
    					<div style="clear:both;float:left;margin:40px 0 0 0;">
    						 						 
    						 <div><img src="../barcodeImages/#barCode.image#"></div>
    						<div style="letter-spacing:#letterspace#;font-weight:bold;">#Left(session.userlogin.acc_num,7)#.#dateformat(barcode.generatedTime, "mmddyyyy")#.#lastId#.#local_num#</div>
    					</div> 
    				<div>
    			</cfoutput>
    </cfdocument>
    c
    r
    +2
    • 5
    • 8
  • o

    Ookma-Kyi

    12/17/2022, 11:00 PM
    How do I document a component, it's properties and it's related functions in a matter similar to JavaDocs?
    a
    b
    • 3
    • 5
  • o

    Ookma-Kyi

    12/23/2022, 1:22 AM
    Sorry totally forgot what the cfml equivalent of echo is. Can someone please remind me?
    b
    g
    • 3
    • 3
  • r

    rodyon

    12/23/2022, 1:22 AM
    writeoutput
  • o

    Ookma-Kyi

    12/23/2022, 1:29 AM
    thank you, writeOutput is what I was looking for! πŸ™‚
    πŸ‘πŸΌ 1
  • a

    Alex M.

    01/04/2023, 3:20 AM
    https://coldfusion.adobe.com/2021/05/adobe-cf-certification-now-us149-including-many-hours-training/ I'm trying to find a CF video course for a newbie developer in training. We both work at the same company. I've got 20+ years experience in IT, most of it writing code. I have significant experience with CF. I saw the above course and have a couple questions. Can you use Lucee and VS Code instead of Adobe CF and CF Builder. I ask because I'm not sure how literal the videos are going to be about click this button to see this as opposed to covering syntax and general language concepts. I'm trying to give the newbie developer a bootcamp experience. I would do some pair programming with the developer working on simpler projects and progressing to more advanced projects later. He's got experience with HTML, CSS, some light JavaScript and some knowledge of SQL. I was hoping I could find a course that would cover syntax and theory so I could focus more on the projects with him. The Pluralsight course is too basic and stops short. I'm looking for the first half of Volume 1 of CFWACK book series level of knowledge. May some portions from the second half of Volume 1 as well. Things like variable scopes, forms, reading and writing to a db, etc. The reason I'm teaching him CF is because that's the language he would use most at work. He'd rather watch than read which is why I thought this course might help. Is this course a good fit? Any thoughts or recommendations are welcome.
    d
    e
    m
    • 4
    • 6
  • g

    gsr

    01/08/2023, 5:53 PM
    i am usin cfquery to call a spx to insert and that insert has in the end as: select scope_identity(); which returns me the last inserted id, i am wondering how do i fetch it, its weird i can not get it
    a
    r
    • 3
    • 3
  • r

    Risen Joe

    01/12/2023, 12:58 PM
    Hi all, While using Coldfusion version 21, in my app I have an issue like illegal character in path in paypal_console.jar file whereas in Coldfusion 16 I don't have that issue so can someone say what is the issue?
    a
    e
    • 3
    • 3
  • g

    gsr

    01/15/2023, 5:34 PM
    cflib icalUS seems only taking care of the US daytime savings, is there a global thing i can change so it reflects all countries timezoine or atleast make the time GMT enabled so it always displays in GMT instead of every country timezone, but if timezone can be done, it will be much better
    a
    • 2
    • 1
  • s

    Simone

    01/18/2023, 5:24 PM
    how to get a 3rd row and 2nd column of 3rd row value from query
    a
    g
    • 3
    • 6
  • g

    gavinbaumanis

    01/25/2023, 11:36 PM
    In a conversation elsewhere, I mention @markmandel and ColdSpring which got me to thinking about a podcast I guest appeared on in the early 00's... where I spoke about Test Driven Design and unit tests in general... So... I just wanted to throw out there.... Yell from a cliff-top and if something comes back - great - and if it doesn't - oh well I guess it was a duck's quack... Test driven-design is NOT about "anally" writing tests. It's most definitely NOT about getting a % of coverage, either. For me: It is only about code-confidence. Did the Bug fix... / Did the new feature... / Did the rewrite.... β€’ Actually do what I am expecting it to do? β€’ Break something I never thought would have a touch-point with my change.
    πŸ‘ 1
    a
    • 2
    • 3
  • s

    Simone

    01/30/2023, 1:14 PM
    Hi, I am trying to create an upsert for my table, if records exists, update else insert, for a table, anyone knows how to do all in one i am going in google but its too much information instead of just one small page which shows how it is done in sql server
    m
    r
    +3
    • 6
    • 7
  • u

    Umair Khan

    01/31/2023, 4:21 PM
    Can we add HTML content to one of many sheets using cfspreadsheetobj?
    Copy code
    <cfset objSpreadsheet = SpreadsheetNew("REGISTRO DE VENTAS") />					
    				  <cfset SpreadSheetSetActiveSheet(objSpreadsheet, "REGISTRO DE VENTAS")/>	
    				  <cfset SpreadsheetAddRow(objSpreadsheet,encabezadosMatrizVentas)>										  
    				  <cfset SpreadsheetAddRows( objSpreadsheet, MatrizVentas) />
    Instead of query I want to use html save content to export to excel in one of sheets
    e
    • 2
    • 1
  • s

    Simone

    02/01/2023, 1:07 PM
    i need some help in rereplace, where i am trying to replace required='yes" or required='no' with default='''
    d
    a
    • 3
    • 16
  • a

    Anna

    02/02/2023, 10:08 PM
    Hi I have a password which contains #. ( abcd#456) I need to pass it in the argStruct when calling the createObject function. But I get syntax error. What to do ?
    Copy code
    <cfset myObj = createObject('webservice', 'urltowsdl ', {authType = 'basic', username='abc@abc', password='abcd#456'})>
    m
    a
    • 3
    • 4
  • a

    Anders Lars

    02/03/2023, 5:53 PM
    Trying to compare a time string ('hhmmss') that I receive - to the current time (any date parts are irrelevant). Looking at the CF date and time functions - didn't see anything that will compare times only. I guess I need to call CreateDateTime() - passing in the date parts from now(), plus my time parts - and then compare that constructed date with now(). Is this is scenario where I'd be better off dropping down to Java? say
    Copy code
    <cfscript>
        jTime = createObject( "java", "java.time.LocalTime" )
        jEnum = createObject("java", "java.time.temporal.ChronoUnit");
        variables.time1 = jTime.now();
        variables.time2 = jTime.parse('17:28:51');
        echo(variables.time1.until(variables.time2, jEnum.seconds));
    </cfscript>
    Method gets called pretty often, otw I would not be sweating it. thanks!
    m
    c
    +2
    • 5
    • 13
  • s

    Simone

    02/09/2023, 3:35 PM
    i am looping over session collection, but i want to keep the session kes but make all the values as empty, right now i can loop over session and do a sessionclear which also deletes the sesisonkeys
    m
    s
    a
    • 4
    • 5
  • j

    johnbarrett

    02/09/2023, 7:37 PM
    I just finished a job interview, and 2 questions were asked that I didn't know about: (1) What is a closure?, and (2) when would you use === in ColdFusion? Is === in ColdFusion similar to when you would use === in javaScript. Can anybody help me understand these two items. Thanks so much!
    p
    b
    +3
    • 6
    • 44
  • g

    gsr

    02/10/2023, 6:26 PM
    what is wrong i am doing in JSOUp loop
    Copy code
    TheTable = HTMLDocument.select("##tableID");
    TheTable.addClass("styled-table");
    			dateFields = TheTable.select('tr td:nth-child(4)');
    			dateFields.forEach( field => {
    			  field.innerText.split(/\s/)[0]);
    			});
    i am trying to remove the second value from the td of each row by looping over it which is seperated by &nbsp; or space
    e
    • 2
    • 3
  • g

    gsr

    02/11/2023, 3:37 PM
    anyone knows how can i write an email to me if onmisfire executes in cfschedule
    e
    a
    • 3
    • 7
  • g

    gsr

    02/11/2023, 3:37 PM
    looks for docs but not getting any =thingf
  • j

    johnbarrett

    02/13/2023, 9:36 PM
    I am feeling stupid, I have the following <cfquery> in my page, but it is showing up blank. I don't think that there is anything wrong here, or at least I am not seeing it. Why would the page be blank, instead of showing the table of users in the database?
    Copy code
    <cfquery name = "members" datasource = "cfhawaiiDBmain">         SELECT user_id,first_name,last_name, joining_date
        FROM users
        ORDER BY user_id
    </cfquery>
    
    <table>
        <cfoutput query="members">
            <tr>
                <td>#members.first_name#</td>
                <td>#members.last_name#</td>
                <td>#members.date#</td>
            </tr>
        </cfoutput>
    </table>
    b
    a
    e
    • 4
    • 9
  • m

    Michael Gillespie

    02/15/2023, 10:54 PM
    This seems appropriate here, how do I implement an if statement in a sql query using queryExecute? Is it possible? Or do I bite the bullet and craft the sql in a var and use that var in the queryExecute call. I ask because I am modernizing and there are a LOT of queries like this - figured I'd "do it right" from the beginning.
    Copy code
    <cfquery name="sortedQry" dbtype="query">
    		select *
    		from tmpQry
    		order by 
    		<cfif arguments.sortBy eq 0>
    			volume
    		<cfelse>
    			length, width, height
    		</cfif>
    </cfquery>
    m
    e
    +2
    • 5
    • 9
  • j

    johnbarrett

    02/15/2023, 11:01 PM
    CF Mail question, in the output in the mail How do I skip a line, I tried <br />, but it just shows up in the mail:
    Copy code
    <cfmail   to="johnbarr@hawaii.edu" 
              from="john@cfhawaii.net"
              subject="Hawaii ColdFusion User Group Message"
              wraptext="75">
              From: #form.demo_name# (#form.demo_email#)<br />
              Comments: #form.demo_message#                                      </cfmail>
    m
    m
    a
    • 4
    • 7
  • s

    Simone

    02/17/2023, 3:04 PM
    i am using Application.cfm and please do not ask to update, because not in my hands πŸ™‚ so how can i have a maintenance page which checks if there is an outrage depending on sql connection,
    a
    • 2
    • 4
  • g

    gsr

    02/18/2023, 5:14 PM
    another approach i am trying is to use
    Copy code
    writedump(TheTable.select("tbody").before("#getHeaders#").toString()); abort;
    to add thead before tbody but its not adding it
    a
    e
    m
    • 4
    • 11
1...45678Latest