ColdFusion: How can I write '<' or '>' to a CF file? - coldfusion

The > and < are giving me problems when writing to a file. I know this should be a very simple thing but I'm clearly missing something.
I've tried assigning both chars to a variables and printing the variables as well as just printing in quotes but nothing has worked.
I'm trying to print something along the lines of... <some tag>blah, blah, blah</some tag>.
Any help would be greatly appreciated!

Here's a working example:
<cfset str = "Example < text >">
<cffile action="write" addnewline="yes" file="#ExpandPath('test.txt')#" output="#str#" fixnewline="yes">

There should be no problem writing < or > to a file just as-is: they are not special characters as far as CF is concerned. So I reckon you're going about things the wrong way. But it's difficult to tell what you're doing without seeing some code...

It sounds like you just need to use character entities:
> instead of >
< instead of <

Related

Modx *id isnot =`` and isnot=`` not working

Hi can someone help me with the correct code for this statement because it is not working for me.
[[*id:isnot=`250` and isnot=`252`:then=`[[$qc-wrap]]`]]
A more performant syntax would be:
[[[[*id:isnot=`250`:or:isnot=`252`:then=`$qc-wrap`:else=``]]]]
Note: updated to reflect comment below. Include a hyphen in the else value, as this:
[[[[ ... :else=`-`]]]]
Also note: an empty else condition can be left off entirely.
I think using or rather than and is appropriate here.
This article is great for understanding MODX conditionals:
https://sepiariver.com/modx/modx-output-filters-if-phx-conditional-statements-tutorial/
And this one for understanding the syntax above and why it's more performant:
https://modx.com/blog/2012/09/14/tags-as-the-result-or-how-conditionals-are-like-mosquitoes/
You use wrong syntax, please fix as follows:
[[*id:isnot='250':and:isnot='252':then='[[$qc-wrap]]']]
Don't forget to replace ' with ` within this example
A simpler solution for this question is to use the :inarray output modifier to return an empty string, and use the :default output modifier to customize output for everything that doesn't match 250 or 252:
[[*id:inarray=`250,252`:then=``:default=`[[$qc-wrap]]`]]

Proper use of OR in Coldfusion

I am having trouble using the "OR" operators in CF. I have tried writing many different or statements and none seem to work they are stopping at the first 'eq' to:
<cfif form.chosen eq 'Vickih' || 'AlyssaH'>
<cfif form.chosen eq 'Vickih' or 'AlyssaH'>
Am I just mistyping or misusing the "OR" statement? I need to make a list of like 8 names. I am trying to prevent the "else if" repeating the same code over and over.
Any help is greatly appreciated. The docs I am looking up say this should work. But the code is not running with the second name only the first name.
The correct syntax is
<cfif form.chosen eq 'Vickih' OR form.chosen eq 'AlyssaH'>
you could use the listFind or listFindNoCase function and do something like this:
<cfif listFindNoCase('Vickih,AlyssaH',form.chosen)>
Adobe documentation

Weka with Missing Values

I've a question about weka as this person:
Hi all:
I felt really strange about WEKA on this.
I have prepared a CSV file which has lots of missing values. One
missing value in this file is basic just no any value between pair of
commas i.e. ,random_value1,,random_value2. This is an example of the
format. You can see there is a pair of commas, between them is just
nothing not even a white_space, and it should indicates a missing
value of the data.
The weird thing is when I read this CSV into WEKA, WEKA assigns all
missing values to a question mark, i.e. '?'. This is exactly how WEKA
expresses it.
And then when I run testing analysis, WEKA started working on these
'?' as some sort useful information. It just missing values, could
WEKA please just jump over it?
These problem became really wasting. Analysis results read like if
missing then value missing, missing assocciates with missing, missing
correlates missing.
Can WEKA reads missing value as missing value, not some sort question
marks? Or can I tell WEKA that for all '?', treat them as missing
values?
Thanks guys
He solved his problem using this solution:
I found a way to tell WEKA about the missings. Just use the fine_and_replace function of a ASCII editor, replace all '?' to ?.
>
but I didn't know how can download ASCII Editor and use it ,, can anyone inform me ????
I suggest you to use notepad2 or notepad++ in windows.
You don't have to work on with missing values. Different algorithms work differently on missing values. So, don't worry, it will be handled just the way it should have been.

Turn off auto indent in sublime text 2, but

Right now in sublime text 2 when I start an if statement in Coldfusion and hit enter it will automatically indent the next line like this:
<cfif this eq that>
|
When I turn auto indent off it will leave the cursor back at the far left, which would be great, but a lot of times my code is already indented:
<cfif this eq that>
|
What I want is it to leave it where it is currently indented to, no more, no less. Like this:
<cfif this eq that>
|
Any suggestions? Thanks!
There may be other ways to make this work for you.
But, you can edit the regex string in ColdFusion.tmPreferences file under
<key>increaseIndentPattern</key>
Just add cfif and cfelse to the list
|link|meta|param|cfif|cfelse
When there is an update to the ColdFusion package though, you may have to edit again.
Edit: Make sure to update the package to the latest version. The single line tags like cfargument should not indent as expected in the updated version.
Although what you would like does not seem to be possible at the moment, see ST2 forum (maybe you posted that?)
A slightly absurd workaround that may work for you, (seems to work for me). Go to View>Syntax>Java now the auto indention should do as you please - you may lose bracket tag matching (+other things?), syntax checking may be a bit nuts (you can always flip back if necessary, try other syntax stuff), and the colour scheme will change a little, but it seems to work.
Take a look at the settings in Sublime, there is one called 'smart_indent'.
The description for this setting is:
Makes auto indent a little smarter, e.g., by indenting the next line
after an if statement in C. Requires auto_indent to be enabled.
Found some more info in the Sublime Documentation.

coldfusion findNoCase not working

Anyone have any idea why this won't give me back anything?
findNoCase("flashvars.ID = ''",result.FileContent)
I know that flashvars.ID = '' is in the result, as I dump it out and can see it. When I do just...
findNoCase("flashvars.ID",result.FileContent)
It finds it! I could probably do a bunch of crap with len() mid() etc. to find out if the value of flashvars.ID is empty, but I just want to know why the first findNoCase doesn't work!
Probably a whitespace issue. Give this a shot:
#refindNoCase("flashvars\.ID\s*.=\s*.''",content)#