Poll: What web programming language are you good at?

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

Elledan

Banned
Jul 24, 2000
8,880
0
0


<< Zuni, could you give me an example of a cf code? >>

<CFIF Login IS &quot;True&quot;>
Welcome.
<CFELSEIF Login IS &quot;False&quot;>
Sorry, we could not log you in.
<CFELSE>
The was a problem processing your request,
please try again or contact the server admin.
</CFIF>



*shivers while looking at it*
 

Czar

Lifer
Oct 9, 1999
28,510
0
0
<CFIF Login IS &quot;True&quot;>
Welcome.
<CFELSEIF Login IS &quot;False&quot;>
Sorry, we could not log you in.
<CFELSE>
The was a problem processing your request,
please try again or contact the server admin.
</CFIF>

horrible :p

if($login == &quot;true&quot;) {
print(&quot;Welcome&quot;);
} else if($login == &quot;false&quot;) {
print(&quot;The was a problem processing your request,please try again or contact the server admin.&quot;);
}

This is what I know ;)
 

Jason Clark

Diamond Member
Oct 9, 1999
5,497
1
0
Or:

<CFSCRIPT>
// Capitalize first char of each word
function CapsFirst(string)
{
// Define local variables
VAR outstring=&quot;&quot;;
VAR c1=0;
VAR c2=0;

// Loop through string
for (i=1; i LTE Len(string); i=i+1)
{
// Is this the first char in string?
if (i IS 1)
{
// First is always upper case
c1=UCase(Mid(string, i, 1));
}
else
{
// Get char and previous char
c1=Mid(string, i, 1);
c2=Mid(string, i-1, 1);


// If Previous char is . or space
if ((c2 IS &quot;.&quot;) OR (c2 IS ' '))
// then upper case
c1=UCase(c1);
else
// else lower case
c1=LCase(c1);
}


// And put the string back together
outstring=outstring &amp; c1;
}


return outstring;
}
</CFSCRIPT>

 

Czar

Lifer
Oct 9, 1999
28,510
0
0
zuni

Thats alot better, so
<CFSCRIPT>
and
</CFSCRIPT>

is just the same as
<?php
and
?>

I use in php, pretty neat
 

Jason Clark

Diamond Member
Oct 9, 1999
5,497
1
0
Yeah it allows you to write in a more programatic way, very popular these days. You can define global functions and call them anywhere etc. Once it goes java you'll have even more toys to play with :).
 

Jason Clark

Diamond Member
Oct 9, 1999
5,497
1
0
<cfquery name=&quot;qGetRecords&quot; datasource=&quot;MyDatasource&quot; cachedwithin=&quot;#CreateTimeSpan(0,0,1,0)#&quot;>
select * from employees
</cfquery>

then you can get real funky and do this

<cfquery dbtype=&quot;Query&quot; name=&quot;queryempquery&quot;>
select firstname,lastname from employees where vchfirstname LIKE '%Mary%'
</cfquery>

So you can query a recordset, cache it for x amount of time. Then run multiple queries against the cached recordset that was returned from the main query.
 

Czar

Lifer
Oct 9, 1999
28,510
0
0
Like the cache / sub query feture. Think you can do the same with php, just that mysql doesnt support it right now, so you can make a query within a query.

There is only one thing that anoys me about cf, its how it spews out the html code, so many spaces and nl codes. Why is that?

Also, does cf have any sortof a developement tool?
The closest I´v come with php is PHPEd. http://www.soysal.com/PHPEd/
 

Jason Clark

Diamond Member
Oct 9, 1999
5,497
1
0
Essentially you are querying the results of another query. So you can run a large query cache it then run multiple queries against it. The whitespace issue is a pain but it can be worked around, there are server attributes you can set that don't output cf as whitespace, or server level settings etc.
 

kuk

Platinum Member
Jul 20, 2000
2,925
0
0
<cf_shameless allaire/macromedia plug>

This weekend I have converted myself to ColdFusion, after playing one year with asp. What took me a month to learn and understand in asp, I was able to do in coldfusion in an hour or so. Database connections are MUCH easier, and the whole tag based system is easy to get used to (hey, just get an editor that colors the code out and you're all set).

Some things I like:
[*] As I said, database connections are much easier
[*] Don't have to mess with loops while showing database fields (damn, everyday I would lock my machine up because I ran a mal-formed asp code, filling up memory to the gigabytes)
[*] #cfvariables# are neat ... better than <% response.write aspvariable %> :)
[*] A page written in CF is much smaller. I have &quot;translated&quot; the same ASP page into CF and the difference is incredible. Code is also much cleaner.

Some things I dislike:
[*] ColdFusion Express Server is too stripped down :(
[*] ColdFusion Server Professional+ is too expensive ... U$1.000 is too much for an independent coder (like me) to deal with.
[*] Small number of free Coldfusion webhosting.

It would be great if Allaire/Macromedia would allow pro-version-only-tags to be available in the express version.Unfortunatelly, due to these disavantadges, I'll have to continue coding my new site with asp.

</cf_shameless allaire/macromedia plug>