I created a macro. However, when I run it,a exclamation mark (without errors or warnings) is shown in front of the line in my log.
I tested it out without the macroname, it would work. Is it because of the underscore? How come? Thank you! -Michelle
%macro _macroname_transpose(data_new,visit_num,
! neurophys_score);
proc transpose data=epic.exercise1 out=&data_new
prefix=&visit_num;
by cid;
id vnum;
var &neurophys_score;
run;
%mend _macroname_transpose;
The exclamation point in a simple indicator that the log line is a continuation of the one above it. This will happen a lot if your session linesize setting is small. If the linesize is made larger, more information will fit in a single log line, but you may have to scroll right to see it all.
options linesize = MAX; * 250 if I recall ;
options linesize = 120;
… your code here …
A source code line length can be any length you want, and is not affected by the linesize (LS) option. LS affects output to the log and the ODS listing destination. When the source line is longer than LS the log will contain the continuation character.
Related
Everything is indented normally in my .cpp file until the moment I press the semicolon ; on the following lines --- at which point emacs indents all the way to the full length of the last line typed...
This oddly doesn't happen if I remove the access modifier and declare vars int x and int y for any class or struct..
class Blah {
private int x;
private int y;
private int z;
};
If I highlight the whole field and press < TAB >, Emacs views this as the proper indent for the region. Can't seem to find anything else related on this besides other qs on indent customization
Additional details:
C-h k ; yields this description, so it might have to do with this feature ---- though I don't understand because the indentation described appears to refer to the immediate next newline not the current the cursor is on.
; runs the command c-electric-semi&comma (found in c++-mode-map),
which is an interactive compiled Lisp function in ‘cc-cmds.el’.
It is bound to ,, ;.
(c-electric-semi&comma ARG)
Insert a comma or semicolon.
If ‘c-electric-flag’ is non-nil, point isn’t inside a literal and a
numeric ARG hasn’t been supplied, the command performs several electric
actions:
(a) When the auto-newline feature is turned on (indicated by "/la" on
the mode line) a newline might be inserted. See the variable
‘c-hanging-semi&comma-criteria’ for how newline insertion is determined.
(b) Any auto-newlines are indented. The original line is also
reindented unless ‘c-syntactic-indentation’ is nil.
(c) If auto-newline is turned on, a comma following a brace list or a
semicolon following a defun might be cleaned up, depending on the
settings of ‘c-cleanup-list’.
; is one of many keys that triggers the "correct this line's indentation" command. There's nothing special about ; here, it's just that Emacs normally keeps your indentation right according to the style defined for the file.
As 0x5453 says in a comment, your C++ file is syntactically invalid, and the indenter is trying its best to come up with a reasonable indentation for this incorrect file. If you fix your code to be legal, the indentation will also be resolved.
While executing a script, I have used
msg='Please wait...';
a=fprintf('%6s\n',msg);
fprintf('\n');
before the results get displayed. However after the results disclosure on the screen "Please wait..." is still appearing although I used
clear a
Thus, is there a way of turning off in the code
fprintf()
Clear a: the clear function delete the selected variable from the memory. To clear the console you have to use clc.
But you can also comment or delete the line where fprintf is called.
As already stated you have to use clc to clear the command window.
You can also erase just the last characters by inserting multiple backspaces. For instance:
fprintf(repmat(char(8), [1 numel(msg)]));
I am typing some code using emacs ,for example:
pi = 3.14
radius = 5
area = pi*radius**2
print area
and I want to comment out all 4 lines like so;
#pi = 3.14
#radius = 5
#area = pi*radius**2
#print area
Someone suggested to select the block, then ctrl+x r t # enter , but this is what I got;
#i = 3.14
#adius = 5
#rea = pi*radius**2
#rint area
It has replaced the first entry with a # . This would be fine if it could be reversed but the reversal method crtl+x r k just deletes everything.
I found something that works though which is a bit long drawn out. First select the position of the first # and type ctrl+x ( crtl+a # ctrl+n ctrl+x ). This will have put a # at the start of the first line. If you want to repeat this for Z number of lines now type crtl+u Z crt+x e. This will place a # at the start of the following Z lines.
Is there an easier way?
The C-x C-r t trick replaces the text in the rectangle bounded by point and mark, so this would actually work if you select from the first column of the first row, and then put point on the first column of the last row, i.e.:
<mark>pi = 3.14
radius = 5
area = pi*radius**2
<point>print area
Then it will "replace" the empty string at the beginning of each line with #.
Another way to do this is to mark the block you want to comment out and hit M-; (or M-x comment-region). It's supposed to do the right thing for the programming language you're currently using.
As noted by lawlist in the comments, multiple-cursors is a rather addictive tool that can be useful in situations like this.
Do not use C-x C-r t here. Use one of these instead:
comment-region (I bind it to C-x C-;)
comment-dwim (M-;)
string-insert-rectangle -- if you have Emacs 24.4 or later (or a recent dev snapshot)
I have been playing around with vim macros lately (in MacVim at the moment), and sometimes I like to explicitly assign a macro into a register using e.g. :let #a='(macro keystrokes)'. This is generally working fine, but I found a weird behavior in which anytime I assign a string value that ends in Carriage Return / ^M, vim automatically adds a Linefeed / ^J to the end before putting it in the register, which affects the execution of the macro!
Example: Let's say I record a simple macro that gets into insert mode, types "hey", escapes out of insert mode, and then hits Enter twice to go down 2 lines. I record this into register #a by typing qaihey<Escape><Enter><Enter>q, which stores the following in #a:
ihey^[^M^M
So far so good, and executing the macro by typing #a does just what it's supposed to. Another perfectly ok way I can get this same macro into register #a would be by typing the whole thing (ihey<Ctrl-V><Escape><Ctrl-V><Enter><Ctrl-V><Enter>) into a buffer and then yanking it with "ay -- the end result is just the same. But here's the weird thing -- suppose I just wanted to assign that string directly into #a using a let statement:
:let #a='ihey^[^M^M'
Now if I type :reg to look at the value it says there's an extra ^J on the end for some reason:
"8 ...
"9 ...
"a ihey^[^M^M^J
"b ...
Having the extra ^J causes it to go down an extra line when I execute the macro, so it's actually changing the behavior.
Anybody know why this extra character is being added? Anyone know how I can get a string value ending with ^M into a register (or any variable), without having an extra ^J get added?
Some quick checking the vim help files says this:
:let #{reg-name} = {expr1} *:let-register* *:let-#*
...
If the result of {expr1} ends in a <CR> or <NL>, the
register will be linewise, otherwise it will be set to
characterwise.
In other words, ending the string with a carriage return will make Vim interpret it as a line ending
Quick googling give this from the VimTips wiki:
Note however, that the above method using :let will not work as expected for any macros which you make ending in a < CR > or < NL > character (carriage return or newline). This is because, as documented in :help :let-#, Vim will treat the register as "linewise" under these conditions. The reason for this is to make registers set with :let act "the right way" when dealing with yanked/deleted text, but it can cause headaches when dealing with recorded macros. Possible workarounds include using the setreg() function or adding "no-op" commands to the end of the macro, such as a < ESC >. See the discussion on vim_dev about unexpected behavior of the :let command for details.
So you have a few options: use setreg() or add some kind of no-op sequence (< ESC >) to the string when you use let.
In order to insert special keys easily using let, just use double quotes:
:let #a="ihey\<Esc>\<Return>\<Return>"
If you use single quotes vim will insert:
\<Esc>\<Return>\<Return> instead of their functions
I recently discovered that you can set breakpoints in Xcode that will print to the console and auto-continue -- meaning you can insert log statements without having to write NSLog() calls and recompile (on-the-fly logging, woot).
Only problem is that it seems to be a little limited in what you can display when doing a log.
It shows some tokens you can insert, like %B to print out some info about the current breakpoint or %H for the hit count.
I'd like to know if there's any way I can insert a time stamp in a particular format into the log line?
I tried playing with the "shell script" breakpoint action, but it told me that the date command didn't exist.... strange...
Any help would be awesome,
Thanks guys!
Read the GDB manual about Breakpoint Command Lists
You can give any breakpoint (or watchpoint or catchpoint) a series of commands to execute when your program stops due to that breakpoint. For example, you might want to print the values of certain expressions, or enable other breakpoints.
And in particular:
for example, here is how you could use breakpoint commands to print the value of x at entry to foo whenever x is positive.
break foo if x>0
commands
silent
printf "x is %d\n",x
cont
end
Does this answer your question?