How do I include a single-quote in MSBuild item transformation seperator? - msbuild

I need to include a single quote in an item transformation, like so:
<DatabaseFileNames>#(DatabaseFiles->'%(PhysicalName)', '','')</DatabaseFileNames>
This, however, spits out a rather cryptic error:
error MSB4095: The item metadata
%(PhysicalName) is being referenced
without an item name. Specify the
item name by using
%(itemname. PhysicalName).
I'm basically trying to create a comma-seperated list of single-quoted values.
How do I get single-quotes into the transformation seperator?
I tried using HTML-entities (the entity for single quote is '), like so:
<DatabaseFileNames>#(DatabaseFiles->'%(PhysicalName)', '','')</DatabaseFileNames>
But I get the same error.

It looks like you have to use URL-encoding style escapes, that is, %CharacterHexNumber. In this case, the single quote is ASCII character 39, which is 27 in hex, so the correct escape sequence is:
<DatabaseFileNames>#(DatabaseFiles->'%(PhysicalName)', '%27,%27')</DatabaseFileNames>

Related

I am trying to name a column in my code as 'MA+_Apps'

I am trying to name a column as 'MA+_Apps'. Getting an error everytime.
Select date,SUM(ma_at_apps+mrsnp_at_apps) AS (ma +_at_apps)
from .....
You need to use delimited identifiers (double quotes)
"MA+_Apps" would work instead of 'MA+_Apps'
But I believe it would be better to remove +, and if you really need to use it for some reason, you can substitute it like this 'MA_Plus_Apps'

How to include apostrophe in character set for REGEXP_SUBSTR()

The IBM i implementation of regex uses apostrophes (instead of e.g. slashes) to delimit a regex string, i.e.:
... where REGEXP_SUBSTR(MYFIELD,'myregex_expression')
If I try to use an apostrophe inside a [group] within the expression, it always errors - presumably thinking I am giving a closing quote. I have tried:
- escaping it: \'
- doubling it: '' (and tripling)
No joy. I cannot find anything relevant in the IBM SQL manual or by google search.
I really need this to, for instance, allow names like O'Leary.
Thanks to Wiktor Stribizew for the answer in his comment.
There are a couple of "gotchas" for anyone who might land on this question with the same problem. The first is that you have to give the (presumably Unicode) hex value rather than the EBCDIC value that you would use, e.g. in ordinary interactive SQL on the IBM i. So in this case it really is \x27 and not \x7D for an apostrophe. Presumably this is because the REGEXP_ ... functions are working through Unicode even for EBCDIC data.
The second thing is that it would seem that the hex value cannot be the last one in the set. So this works:
^[A-Z0-9_\+\x27-]+ ... etc.
But this doesn't
^[A-Z0-9_\+-\x27]+ ... etc.
I don't know how to highlight text within a code sample, so I draw your attention to the fact that the hyphen is last in the first sample and second-to-last in the second sample.
If anyone knows why it has to not be last, I'd be interested to know. [edit: see Wiktor's answer for the reason]
btw, using double quotes as the string delimiter with an apostrophe in the set didn't work in this context.
A single quote can be defined with the \x27 notation:
^[A-Z0-9_+\x27-]+
^^^^
Note that when you use a hyphen in the character class/bracket expression, when used in between some chars it forms a range between those symbols. When you used ^[A-Z0-9_\+-\x27]+ you defined a range between + and ', which is an invalid range as the + comes after ' in the Unicode table.

Hyphenated terms in KDB WHERE clause list

I'm trying to list hyphenated criteria in a KDB WHERE IN list. The single (non-hyphenated) terms work just fine but when I need to have a hyphen in the literal, KDB doesn't like it. I've tried quoting the strings in a comma delimited list but that doesn't seem to work either.
This works just fine:
where product in (`CD`MUNICIPAL)
This gives me an error:
where product in (`TREASURY-NOTE`TREASURY-BOND`TREASURY-TIPS)
Error:
'TIPS
This is what I'm trying but with no luck:
where product in ("TREASURY-NOTE","TREASURY-BOND","TREASURY-TIPS")
Because "-" is a special character you need to declare these as strings before casting to symbols.
where product in `$("TREASURY-NOTE";"TREASURY-BOND";"TREASURY-TIPS")
You could also use "like" which allows you to use some basic regex:
where product like "TREASURY*"

In bigquery sql are curly braces allowed as part of a column alias

I'm trying to do something like this
SELECT epi_week {week}, state
FROM
lookerdata:cdc.project_tycho_reports
LIMIT 10
Error: Encountered " "{" "{ "" at line 1, column 17. Was expecting: EOF>
It seems that curly braces are not legal syntax. I've tried escaping or using quotes without success.
Is there a way around this? We use the braces as an indication for post-processing string replacement to support multiple languages.
Is there a way around this?
No way unfortunatelly.
Field name must contain only letters, numbers, and underscores, start with a letter or underscore, and be at most 128 characters long.
As an option - you might want to come up with another name convention for post-processing

Retrieving the value which have '#' character in ColdFusion

I'm trying to assign the value of a column from the query to a variable using cfset tag. For example, if the value is 'abcd#1244', then if I use <cfset a = #trim(queryname.column)#> it will return only abcd. But I need the whole value of that column.
You will need to escape the # symbol. You can get clever and do it all in one swoop (# acts as an escape character when placed next to another #).
Example being
The item## is #variable#.
In order to print "The item# is 254."
There are plenty of text and string functions at your disposal.
I'd recommend first trying to escape the value as soon as it is drawn from your database.
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec1a60c-7ffc.html