empty string in open statement in d3 pick - pick

I have the following statement in d3 pick:
OPEN '','AT-MASTER' TO AT.MASTER ELSE RETURN
The examples I have seen of the open statement either completely omit the comma and the thing before it, or they have something inside the thing before the comma, as follows, where dict is inside the single quotes before the comma.
open 'dict','invoice' to invoice.dict then
print 'ok'
end else
stop 201,'dict invoice cannot be opened'
end
What does the empty string made with single quotes that appears directly after the OPEN mean?

In old-style BASIC the syntax for OPEN 'DICT','FILENAME' was fixed. The empty first parameter means the Data file is being opened, not the Dictionary. Many developers still default to that syntax. Since the late 80's if only one parameter is present and it has only one word, it's assumed to mean the Data file. And all platforms these days support OPEN 'DICT FILENAME' in a single parameter. So the syntax with '','Datafile' is archaic but still works.

Related

How can I find a word with a new line in the VBA editor using find and replace?

I would like to go through and find all of the "End" statements in my code but skipping all of the "End x" statements like "End If", "End Sub", "End function", etc.--Just the pure "End". My thought was to use pattern matching, but I am unsure of how to do that.
I already tried using "End\n" and "End[\n]".
Does anyone know how to search for words that end in new lines?
The "find" function in the VBA editor does not support this kind of parameter/functionality.
You will have to manually step through the results and skip the ones you don't want to skip, or manually modify the "End" instances you don't want to catch, then search & replace, and finally restore all the End instances back to what you want.
Apologies for answering so long after the question was asked, but thought this information would help future readers as this question is still being actively found.
#TylerH is right that the specific search requested by the user cannot be performed in the VBE Find tool. For information, when "Use Pattern Matching" is selected the VBE Find tool supports use of:
? - single character
* - zero or more characters (on the same line)
# - single digit (0 to 9)
[charlist] - any single character in charlist
[!charlist] - any single character not in charlist
... where charlist can be a range of characters (eg [A-Z]) but must be in order (eg [Z-A] is not valid), it can also include multiple ranges of characters (eg [A-BD-E] matches A, B, D or E). Also to match any of ?, * or # then enclose them in square brackets (eg [*] matches an asterisk).
This means the VBE Find tool performs very similarly (perhaps identically ... but I can't provide assurances, VB and VBA not being the same language) to the VB Like operator, for which documentation is here
The alternative (which will perform the specific search in the question) is to use the 'Find Text' tool in the VBE Add-In MZ-Tools - though note MZ-Tools is a paid-for tool ... please note I am NOT in any way associated with MZ-Tools or it's author. The search text to use in MZ-Tools for the specific search requested in the question is: end\r?$

How can I disable automatic string detection in VS2015?

I'm using VB.NET, and my code contains a lot of strings that very often have double quotes inside of them. My problem is that as I'm fixing the string to escape double quotes (replacing every '"' with '""' inside of the string) it messes with the proceeding code, temporarily assuming everything is a string (since the double quotes don't match up) and completely messing up the formatting of other strings. It assumes that the start of a following string is the end of the current string which causes the actual string to be interpreted and formatted as code, which I have to go back and fix (since it adds spaces and other formatting characters that shouldn't actually be there).
Is there any way to disable this behavior? I didn't have the same problem in VS2013. I've been looking under Tools > Options > Text Editor > Basic, but I couldn't find anything relevant.
Additional Information: I can just modify the strings in a separate text document to escape all of the double-quotes (which is what I've resorted to for now), but in VS2013 I could easily just copy/paste the strings directly into my code without it messing up proceeding strings by temporarily interpreting them as code due to the uneven count of double-quotes.
This behavior is especially problematic when manually adding double-quotes within strings, because if you don't escape them quickly enough (or make a brief typo when doing so), you get the same issue.
You might notice that for other languages, such as C++, writing a string on one line (even with an uneven number of double-quotes) does not affect proceeding lines. Having this same behavior for VB would be great, assuming that there's some setting to enable it.
Yes its an inconvenience.
What I usually do is put some non-used character (e.g. some unused symbol on keyboard, or Alt+{some number}) instead of double quotes. When I'm done building my string whatever way I want, I just finalize it with either bringing up the Find and Replace box and replace that character with two double-quotes. Or just put a REPLACE statement immediately following it, replacing that character with Chr(34).
Instead use Chr(34), or if you end up repeating strings at all, store them as a resource.

Named ranges won't work

Whenever I try to make a named range in Excel I keep getting an error. I believe my formula is correct:
=OFFSET($B$2,0,0,COUNTA($B$2:$B$200),1)
However when I press OK I keep getting the dialog screen which states Excel found a problem with my formula.
Then it highlights the following part of the formula: $B$2,0,0,COUNTA.
I looked through various tutorials where this formula should be correct.
Can someone help me out on this?
One way to see this error message is if you are using the incorrect argument separators. For example, many locale's use the semicolon ;.
Try replacing the commas in your formula with semicolons
=OFFSET($B$2;0;0;COUNTA($B$2:$B$200);1)
or whatever your locale argument separator is.
Thanks, it were indeed the seperators which caused the problem: I have to use ; instead of a , - this tricked me as all of the tutorials I watched used the comma as well.

IntelliJ IDEA & AppCode live template nested variable issue

I have this snippet that are used in textmate:
var ${0:name} = ${1:"${2:value}"};
When this snippet get called, first the name will be selected and I have a chance to type something and change the variable name. Press TAB again it will select "value", in this case if my value is a number (the quotes is not required) I can start to type a number and overwrite "name". If my value is a string, I can press TAB again and it will select name (no quotes), I can actually type something and they will appear in the quotes. I want to know if this is doable in JetBrains software like Intellij IDEA and AppCode. I've tried but failed. Below is my code for JetBrains software.
var $name$ = "$value$";
I don't know how to give me a chance to select "value" instead of directly selecting value. Anyone can point me to the right direction? Thanks.
I don't think you can do exactly what you want. I got fairly close using this template:
var $name$ = $QUOTE$ $value$ $QUOTE$;
Then in "Edit variables" I set the expression for QUOTE to be "\"" and moved value above QUOTE.
This allows you to type the name, as you wanted, and tab next to value, where you can enter a string or a number. The next tab will highlight the first quote, which you can delete if you had a number - this will also delete the trailing quote.
However this is not exactly what you wanted, as the value inside the quotes, should you leave them there, has spaces either side. This is because what I really wanted was
var $name$ = $QUOTE$$value$$QUOTE$;
but if you put two variables next to each other like this, IntelliJ gets very confused.
I know this isn't the answer, but maybe it has you thinking about slightly different approaches to the problem.

Write a formula in an Excel Cell using VBA

I'm trying to use VBA to write a formula into a cell in Excel.
My problem is that when I use a semicolon (;) in my formula, I get an error:
Run-time error 1004
My macro is the following :
Sub Jours_ouvres()
Dim Feuille_Document As String
Feuille_Document = "DOCUMENT"
Application.Worksheets(Feuille_Document).Range("F2").Formula = "=SUM(D2;E2)"
End Sub
You can try using FormulaLocal property instead of Formula. Then the semicolon should work.
The correct character to use in this case is a full colon (:), not a semicolon (;).
The correct character (comma or colon) depends on the purpose.
Comma (,) will sum only the two cells in question.
Colon (:) will sum all the cells within the range with corners defined by those two cells.
Treb, Matthieu's problem was caused by using Excel in a non-English language. In many language versions ";" is the correct separator. Even functions are translated (SUM can be SOMMA, SUMME or whatever depending on what language you work in). Excel will generally understand these differences and if a French-created workbook is opened by a Brazilian they will normally not have any problem.
But VBA speaks only US English so for those of us working in one (or more) foreign langauges, this can be a headache.
You and CharlesB both gave answers that would have been OK for a US user but Mikko understod the REAL problem and gave the correct answer (which was also the correct one for me too - I'm a Brit working in Italy for a German-speaking company).
I don't know why, but if you use
(...)Formula = "=SUM(D2,E2)"
(',' instead of ';'), it works.
If you step through your sub in the VB script editor (F8), you can add Range("F2").Formula to the watch window and see what the formular looks like from a VB point of view. It seems that the formular shown in Excel itself is sometimes different from the formular that VB sees...