Neo4jClient: Wild char Search do not work when parametarized [closed] - neo4j

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I am having a strange issue with the Neo4JClient.
The following query works
.AndWhere("((shipper.Name =~ '(?i).*" + filterTxt + ".*') OR (frm.Name =~ '(?i).*" + filterTxt + ".*') OR (to.Name =~ '(?i).*" + filterTxt + ".*'))");
but the same when I convert to the parameterized query like below:
.AndWhere("((shipper.Name =~ {searchParam}) OR (frm.Name =~ {searchParam}) OR (to.Name =~ {searchParam}))")
.WithParam("searchParam", "(?i).*" + filterTxt + ".*");
it fails to execute from within the Neo4JClient I get an exception saying connection is closed, however when I pickup the DebugQueryText generated by the Neo4JClient, and execute it on the neo4j console, it returns result.
is there something I am doing wrong with the way I am using this wildcard search?
Regrads
Kiran

Related

SanitizeHelper removes permitted tags [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
Here is a sample comment I'm trying to sanitize:
"<p><strong>hello</strong><em></em> <em>there</em> whats up?</p><p><ul><li>this </li><li>is a</li><li>list</li></ul><p>and then there was more</p><p><ol><li>do this</li><li>do that</li></ol><p><img src=\"https://google.com\" alt=\"\"><br></p></p></p>"
I tried sanitizing with this command:
sanitize comment.text, tags: %w(p, strong, em, a, blockquote, img, ol, ul, li), attributes: %w(href, target, title)
Output is:
"hello there whats up?<li>this </li><li>is a</li><li>list</li>and then there was more<li>do this</li><li>do that</li>"
As you can see the li elements aren't nested in their respective ordered and unordered lists, and all the other tags I tried to permit are removed too.
When using the special array creators (such as %w() you don't want to use commas:
%w(p, strong, em, a, blockquote, img, ol, ul, li)
# => ["p,", "strong,", "em,", "a,", "blockquote,", "img,", "ol,", "ul,", "li"]
Remove those and things should start working for you. (You'll note that li worked, because as the last element, it didn't contain a trailing comma)

How to find total amount from a string using regex [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
Hi i am working on a ruby on rails project wih ruby-2.5.0 and rails 5. I have a string which contains the total amount. So i need to find the total amount using regex.
String:-
"TOTAL
EFT
CHANGE
Taxable Ite.s
TOTAL includes GST
OTHER SAVINGS
0000000000
$73.26
HAIERF(RDS stm IGA
KARAWARA *AOI
TERMINAL"
Here $73.26 is the total amount. I tried /$(\d{1,2}(\.)\d{1,2})/ and /^\d{1,4}(\.\d{0,2})?$/ But its not working. Please help me with exact regex. Thanks in advance.
Updated As per the op's comment:
/TOTAL(?=((?!TOTAL).)*).*?(\$\d{1,4}(?:\.\d{1,2})?)/im
This is a compilation of both of your regex.
Regex Demo
Sample Source ( Run Here )
re = /TOTAL(?=((?!TOTAL).)*).*?(\$\d{1,4}(?:\.\d{1,2})?)/im
str = 'TOTAL $234
EFT
CHANGE
Taxable Ite.s
TOTAL includes GST
OTHER SAVINGS
0000000000
$73.26
HAIERF(RDS stm IGA
KARAWARA *AOI
TERMINAL
$83.26
Total
asdasfd
sadfasdf
$1235
'
str.scan(re) do |match|
puts match[1]
end

String capitalization not working [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
What can be the reason of string capitalization not working?
A database column:
t.string "name", limit: 255
Some example:
flower_name = Flower.find_by(id: 1).name #=> "chamomile©"
Trying to capitalize (got the same output):
flower_name.capitalize #=> "chamomile©"
Checking if it is string:
flower_name.is_a?(String) #=> true
capitalize works with ASCII characters only. Is there any chance your string contains non-ascii letters?
Try
flower_name.mb_chars.capitalize.to_s
mb_chars method may help you if you are using Rails >= 3.
'æ-ý'.mb_chars.upcase
=> "Æ-Ý"
If you're not using Rails, you can:
use directly active_support gem:
require 'active_support/core_ext/string/multibyte'
try unicode gem.
I hope you will find an answer in this similar question: Special character uppercase

syntax error, unexpected tINTEGER, expecting '(' [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
My code is
for i in 0..array_dif.count-1
a = array_dif[i] - array_dif[0]
b = array_dif[array_dif.count-1] - array_dif[0]
norm = a.0/b
array_norm[i] = norm
end
And i'm getting the following error:
rb:135: no .<digit> floating literal anymore; put 0 before dot (SyntaxError)
norm = a.0/b
^
C:/piegas/config/initializers/backtrace_silencers.rb:135: syntax error, unexpected tINTEGER, expecting '('
norm = a.0/b
^
I don't know whats wrong with it
norm = a.0/b is an invalid statement (aka SyntaxError).
What do you want that statement to do?
norm = a/b might make sense.
norm = array_dif[0]/b might also make sense.
But without knowing the purpose of the code, it's difficult to know what the correct solution is.
What do you mean by a.0/b? It is invalid. If you were trying to convert a to float then it would be a.to_f/b.

Get the sub string between two bracket in ruby on rails [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have following strings:
1) Beach Cottage (CP)
2) Beach Cottage (AP)
3) Cotta (GAP)
And I want to get substing between ( ) that is from first CP
Try this for example:
str = "Beach Cottage (CP)"
str.match(/(\((.*)\))/)[2]
you can use scan also with regx:
str = "Beach Cottage (CP)"
needed_sub_str = str.scan(/\((.*)\)/)
puts "expected sub string :: #{needed_sub_str}"
Output ::
expected sub string :: CP

Resources