This should be a no-brainer, but I haven't really written any classic ASP code in like 10 years and just cannot remember how to do this, and can't find it on google.
All I'm looking to do is to set a Classic ASP page to use Option Compare Text, but I cannot remember the syntax for this. I've tried all of the following, as the first lines in my file...
<%Option Compare Text%>
<%Option Compare="Text"%>
<%Option=CompareText%>
<%Compare="Text"%>
<%Option="Compare Text"%>
<%#Option Compare Text%>
<%#Option Compare="Text"%>
I'm pretty sure it is something with the # symbol like the last two, but just can't remember.
There is no Option Compare in VBScript, sorry.
Source
Could you not use StrComp function that has parameter for the method of comparison?
Related
One of the useful features of ess-mode (Emacs speaks statistics) is to automatically replace the underscore _ with the assignment operator <-. Lately, I have been using a lot of pipes (written as %>%) and it would be great to not have to type three characters for each pipe.
Is it possible to define a custom key binding for the pipe, similar to the one converting _ into ->?
The simplest solution is to just bind a key to insert a string:
(define-key ess-mode-map (kbd "|") "%>%")
You can still insert | with C-q |. I'm not sure about the map's name; you'll almost certainly want to limit the key binding to ess-mode.
Check out yasnippet. You can use it to define something like "if this sequence of characters is followed by this key (which you can define to whatever you like), then replace them with this other sequence of characters and leave the cursor in this place". There's more to yasnippet than this, but there's plenty of documentation online and even already made recipes similar to the example I gave above that you can try, like yasnippet-ess-mode, for example.
Alternatively, you can also try abbrev-mode and see if that works for you.
I, for one, like yasnippet better, since you can also specify where to leave the cursor after the expansion, but abbrev-mode seems to be easier to set up. As always in Emacs world, try multiple solutions, don't settle for the first one you put your hands on. What works best for others might not work for you, and vice-versa.
How do I create expression for integer literal (say 2) using Roslyn syntax factory?
When I viewed it under debugger, it looks like it has type NumericLiteralExpression, but I cannot find how to create it?
Closest, I found was SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Token(..)), but I don't know how to create a token representing value 2.
I actually found out after some trial and error. Following seems to work.
SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(2))
I am trying to set a label in a gridview not to show a particular date if it is returned (it is because it is a default date and is not needed).
The code I have used is
<%# 'Convert.ToString(Eval("DateTaken")).Equals("01/01/1899") ? "" : Eval("DateTaken")'%>
Unfortunately, when I try and compile it the code won't run. I have tried to find an answer by research, but have not been able to do so.
It uses part of Chris's answer, but Equals does not work. Changing this to Contains does when parsing the value as year
<%# 'Convert.ToString(Eval("DateTaken")).Equals("01/01/1899") ? "" : Eval("DateTaken")'%>
This is not valid syntax as far as I am aware. You have single quotes ' wrapping your statement which is likely confusing the parser a lot. I'm not sure what you intend them to be doing but I'd suggest trying without:
<%# Convert.ToString(Eval("DateTaken")).Equals("01/01/1899") ? "" : Eval("DateTaken")%>
I can't test this but it looks like it should work.
Also for the comparison (I assumed you'd tested that elsewhere first) I suspect you may have problems with the fact that Convert.ToString likely includes a time element. Instead I would suggest specifying what string format you want to be outputted. Or even better assuming that it is a DateTime you are getting back compare it as a DateTime. Either of the following should work as a reliable comparison
(((DateTime)Eval("DateTaken")).ToString("yyyy-MM-dd")=="2014-03-05")
(((DateTime)Eval("DateTaken")).Date==new DateTime(2014,03,05))
I am trying to use regex generators to create an expression, but I can't seem to get it right.
What I need to do is find the following type of string in a string:
community_n
For example, within the string which may be
community community_1 community_new_1 community_1_new
from that, I just want to extract community_1
I have tried /(community_\\d+)/, but that is clearly not right.
Try adding word boundries, so
/(\\bcommunity_\\d+\\b)/
Try using the regex (community_\d+).
Though I could be incorrect since I don't know which language you are using.
(For some reason I cannot add comments, I can only answer questions).
I have two CSS files where most of the whitespace have been removed. I wonder whether there's a way to get a meaningful diff out of them.
Run each file through a CSS prettifier, and then diff them the normal way.
A quick google search turned up this online prettifier: http://procssor.com/
Do a search and replace through the css file and insert a new line after every '{', '}' and ';' character. Then, you can use ordinary diff to compare them.
Use Pretty Diff. That tool is a language aware diff tool, so trivial things like white space and comments are filtered out as false positives.