How to find start and end of IF THEN ELSE block in asp classic - asp-classic

I have been tasked to edit some classic asp pages(though I develop in C#). These were created 10 years back but are still in use. One of the file is very big spanning 5159 lines. It has got many nested if then conditions which I am unable to figure out .. which is this if , where it is starting or where next if is like that.
I have tried vs2010 but it also dosen't highlight start/end of if/else, I tried notepad++ also with the same story.
My question to asp developers is that which IDE they use or how they figure out the start of many nested ifs thens?

I like to use UltraEdit Professional Text/HEX Editor which can fold unfold blocks: http://www.ultraedit.com/
Also this could help: http://www.aspindent.com/?indent
Never used it but heared good things about it: http://www.aspdebugger.com/

A code folding feature is very helpful on such problems, but only if code is quite good formatted. But code folding is of no help if the nesting takes place within a line.
All IDE and most text editors have a Match Brace command or something similar. That command is usually best to find the matching brace of a condition in a not well formatted block with nested conditions.
UltraEdit and maybe also other text editors support even customizable strings which are applied to the Match Brace feature. Perhaps this is a help for you on the not well structured ASP code.
UltraEdit has several brace matching features. But for your problem the most helpful would be the commands Go to Matching Brace and Select to Matching Brace which are both in menu Search (traditional menus) respectively Go to brace and Select to brace on Codding tab/menu (ribbon mode/contemporary menus). With caret blinking at beginning of an If the first command moves caret to the matching End If and the second command additionally selects everything from If to End If. The commands can be used also in reverse direction from End If to matching If.
But before the brace matching commands can be used on your ASP files on If and End If, it is necessary to define the string If as opening brace and the string End If as closing brace in the syntax highlighting wordfile for ASP.
To do this open in UltraEdit from ribbon/menu Advanced the Configuration by clicking on Configuration (traditional menus) or Settings (ribbon mode/contemporary menus). Open in configuration tree Editor Display and click on Syntax Highlighting. Select the language respectively wordfile VBScript ASP and click on button Open. Exit the configuration dialog with button Cancel.
In the opened wordfile vbscript.uew search at top for the lines
/Open Brace Strings = "{" "(" "[" "<"
/Close Brace Strings = "}" ")" "]" ">"
and append on first line "If" and on second line "End If".
/Open Brace Strings = "{" "(" "[" "<" "If"
/Close Brace Strings = "}" ")" "]" ">" "End If"
Save the modified wordfile and close it. The modification is immediately active and you can use now the commands Go to Matching Brace and Select to Matching Brace in your ASP files.

Related

If else for a new column [duplicate]

I am using the statement in R:
setwd("C:\\Users\\carl\\Documents\\research")
to set the working directory. It worked fine when I pasted the statement from someone else's R script but I received an error message:
Error: unexpected input in "setwd("".
when I entered the command directly or when I copied it from my script in a Word file.
It seems to be related to the fact that the double-quotes that I typed (that don't work) look a little slanted while the double-quotes in the pasted text (that work fine) look like they're straight up and down. Is there something I can do to type plain looking double-quotes instead of slanted double-quotes?
Word automatically replaces your double quotes with so-called smart quotes or curly quotes.
You need to use the regular/straight double quotes (") in r.
This support article explains how you can disable the automatic smart quote replacement in Word. In fairness though, Word is probably not the... um... ideal code editor.

How to highlight brackets in bluefish?

I'm using Bluefish on a Mac to write generic code (it's R but I just open Bluefish and start to type, I haven't told it what I am doing). The help says that Bluefish will:
"Highlighting matching block start and end markers (both brackets and tags)"
but it doesn't do this. So when I highlight a close bracket I'd like to see the open bracket highlighted above it. Under Document, Highlight Block Delimiters is ticked.
What am I doing wrong please?
It doesn't do it in plain text. You need to go Document, Language Mode and select a language (R is in the list).

Are there 2 types of double-quotes in R? My double quotes look slanted and are giving an error message

I am using the statement in R:
setwd("C:\\Users\\carl\\Documents\\research")
to set the working directory. It worked fine when I pasted the statement from someone else's R script but I received an error message:
Error: unexpected input in "setwd("".
when I entered the command directly or when I copied it from my script in a Word file.
It seems to be related to the fact that the double-quotes that I typed (that don't work) look a little slanted while the double-quotes in the pasted text (that work fine) look like they're straight up and down. Is there something I can do to type plain looking double-quotes instead of slanted double-quotes?
Word automatically replaces your double quotes with so-called smart quotes or curly quotes.
You need to use the regular/straight double quotes (") in r.
This support article explains how you can disable the automatic smart quote replacement in Word. In fairness though, Word is probably not the... um... ideal code editor.

"Element locator with prefix '| id' is not supported" error in Robot framework

I am using robot framework to test a GUI application ,
when I try to run the test case , got an error like
"Element locator with prefix '| id' is not supported " .
But I am using the latest version of selenium2library i.e.2.39.0 .
I will be thankful ,If somebody helps me out regarding the same .
and I have one more query ,i.e. how to click on the contents on GUI when working with robot framework
Thanks in advance
I think the only way you can get such an error message is if you mix two styles of cell separators in your test. For example, you may be mixing tabs and pipes, or multiple spaces and pipes.
Robot determines which format to use on a line-by line basis. First, it looks for a tab anywhere in the line being parsed, and if it finds it, it uses tabs to split the line. If it doesn't find a tab, it checks to see if the line begins with a pipe and space. If so, it uses the pipe for a separator. Failing that, it uses multiple spaces as the separator.
I can reproduce the exact error you are getting by mixing pipes with either a tab or multiple spaces. For example, the following will generate the exact same error you report:
# the next line begins with two spaces
click element | id=treeview_tv_active
Robot will detect the two leading spaces and decide to use spaces to split the line into cells. Thus, the first cell will be "click element" and the second cell will be "| id=treeview_tv_active". Selenium looks for everything before the "=" as the locator type, thus it's using "| id" as the locator, which is invalid and results in the error that you see.
Since you haven't shown us your code it's impossible to say for sure, but my guess is that the line causing the problem begins with a space or tab, or has a tab embedded somewhere else in the line, but later in the same line attempts to use pipes as cell separators.

inserting line breaks after every record in the textpad

I have a textpad file that has rows of text. For e.g.
Cat: Meaning - animal. The cat ran up the house
Rat: Meaning- rodent. The rat lives in the borough and feeds on leftovers
Word 3: Description
Word 4: Description
I have many such record in my file. I want to insert a line break at the end of every record for proper presentation. Doing it manually is tedious. Please help if you know an automated process to insert line break.
You can quickly do this by using a feature called "Regular Expressions" to find and add empty lines.
Open up the Find/Replace (Search menu > Replace)
In the "Find what" field, type the following: (^.+$)\n(^.+$)
In the "Replace with" field, type the following: \1\n\n\2
Tick the "Regular expression" checkbox
Click the Replace All button at least twice, but perhaps 3 times, until you get the message Cannot find the Regular Expression
Untick the "Regular expression" checkbox
Close the Replace dialog
Confirm the file is formatted as you are expecting
Save the file.
You can write a simple C# prgram that uses a loop that adds this code after every line :
But first add the namespace using System.Enviorment
Enviorment.NewLine;
If you have any more trouble i'll help with some code to get started
Open up the Find/Replace (Search menu > Replace)
In the "Find what" field, type the following so that the replace occurs at the end of each line: $
In the "Replace with" field, type the following. Note each 'n' represents a <return>. In this instance, I added a return at the end of a SQL statement, the word 'GO' on the next line and another <return>: \n\GO\n
Started with text file containing:
select * from <tablename>
select * from <tablename>
Ended with text file containing:
select * from <tablename
GO
select * from <tablename>
GO
Hope that helps.
from your text it is difficult to understand what you are intending to do. I'll give you some questions. The answers will help others to help you.
Do you really mean textpad as the product from company helios in UK or do you use this word as a general word for a class of tools (like notepad - but there is a general definition AND the tool as part of Windows).
Your file hase line breaks yet. You don't see them, but in the file itself they are present (in Unix systems line feed (hex code 0A) or in the windows world carriage return followed by line feed (hex code 0D 0A)).
Or would you like to publish your text in HTML? So you have to put the necessary tags around each line like paragraph, line break, list item etc.?

Resources