coldfusion findNoCase not working - coldfusion

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)#

Related

TO_PURE_TEXT with cell referencing doesn't filter double quotes against documentation

I want to get a clean number from a string like "123.45". On using of =TO_PURE_TEXT(C10) it doesn't work for me,
against an example from the documentation. An absolute referencing doesn't help.
But, if i use no cell referencing, but direct input, like =TO_PURE_TEXT("123.45") the input is correct, as expected without quotes.
Is it a kind of bug, or do i really do something wrong? How can i get this work with the cell referencing?
all you need is:
=SUBSTITUTE(C10, """", )*1
or:
=REGEXREPLACE(C10, """", )*1
I can't speak to whether it's a bug. Does seem odd, but this should work for now:
=1*SUBSTITUTE(C10,CHAR(34),"")

How to put format code the right way in Python?

I try to learn Python via LPTHW (Learn Python The Hard Way), on the ex05 (its about format code), the code that he give isn't working, I need to use different code to get the same result.
I already tried deleting the parentheses, give space between f and the double quote.
At last I use the % (%s and %d) not the f (f"bla bla {bla}") one
What LPTHW expect is the first code to give the same result as the second one, yet it give me invalid syntax. There's no way the computer wrong right?
So what is the problem? Because when I try to find this problem, no one have the same problem as me.
I'm sure I type it right, because after that I tried to copy the exact code from the page and it still not working.

HTMLEditFormat Syntax Issues - XSS

I'm attempting to work on some possible XSS flaws in my code and have ran into some issues.
This code doesn’t work (line 297) - Syntax error:
#iif(HTMLEditFormat (not url.excludeFinalized),de(" disabled"),de("")) )#
This code does work (line 298):
#iif(HTMLEditFormat(url.excludeFinalized),de(" checked"),de("")) )#
This ‘not’ is what's messing me up - How would I properly place HTMLEditFormat into the code above or below?
#iif(not subgroupExercisesDone and nodeIsRollup,de("disabled"),de(""))#
Thanks for any help. I would greatly appreciate it!
I believe you need this change:
#iif((not url.excludeFinalized),de(HTMLEditFormat(" disabled")),de("")) )#
Your original code wraps HTMLEditFormat around a condition. And there's no need to HEF() and empty string, so you still have just one usage of HTMLEditFormat. I don't think you need HTMLEditFormat at all, to be honest.
I think. Didn't test this myself.
You can't put the NOT inside the function call like that.
This is more in line with what you were trying to do.
#iif(NOT HTMLEditFormat(url.excludeFinalized),de(" disabled"),de("")))#
But if HTMLEditFormat(url.excludeFinalized) can't be resolved as a Boolean value, you're going to get a runtime error.

Why regular expression doesn't work with Global identification in Perl?

It is very weird, and I don't have any idea what is the issue!
I have a very big string (length=648745), and I don't know if its length can make this issue, but I'm trying to find some parameters inside it, and push them to an array, like this:
push(#items_ids, [$2, $3]) while ($all_items_list =~ /itemID&(id|num)=([\d]*)\">\#([\d]*)/g);
It doesn't work, it returns an empty array at the end. I thought may be my RegEx is not right, but when I run this code:
while ($all_items_list =~ /itemID&(id|num)=([\d]*)\">\#([\d]*)/){
print "\nItemID=$2 Identity=$3\n";die;
}
it finds the first occurrence, when I put "g" at the end of ReEx it can't find it any more...
I know I'm missing something here, Please help me, this is not a hard part of my script and I'm stuck, :( ...
Thanks in advance for your help.
In scalar context, m/.../g starts looking after where a previous successful m/.../g left off. I would suggest resetting the search-position right before the loop:
pos($all_items_list) = undef;
push(#items_ids, [$2, $3]) while ($all_items_list =~ /itemID&(id|num)=([\d]*)\">\#([\d]*)/g);
and seeing if that helps. (See http://perldoc.perl.org/functions/pos.html.)

Django Haystack refuses to show no results, even for absurd queries

My question may be a bit strange, but it's been bothering me since the behavior is not what I expected. Here is my query:
query = request.GET.get('q','')
#in search_indexes:
#start_datetime = indexes.DateTimeField(model_attr='start_datetime',null=True)
#end_datetime = indexes.DateTimeField(model_attr='end_datetime')
search_events = SearchQuerySet().models(Event).filter(content=query).
filter(end_datetime__gte=datetime.now()).
order_by("start_datetime")
Now I type in a query like "asdfasdfjasldf lolol hwtf asdlfka" and I still get 3 results. (Note, I only have 5 events to start with. Not sure if that could affect anything.) I print out the scores, and they are [42,42,42]. Doesn't filter() match on exact phrases? Especially if I use quotes?
//edit
I also tried using auto_query, and the results are the same.
I'm really confused about what's happening, so hopefully somebody can help clear this up. Thanks in advance!
Turns out that someone else on my team had set HAYSTACK_DEFAULT_OPERATOR to 'OR' instead of 'AND'. Explains everything - the additional filter tag was actually expanding the number of results!
You might like to perform search using auto_query():
search_events = SearchQuerySet().models(Event)
.auto_query(query)
.filter(end_datetime__gte=datetime.now())
.order_by("start_datetime")
It has some extra features, like for example exact query searching when phrase is enclosed in quotes.