How do I get left-aligned output from text-mode Maple? - unix

The file a.ms contains:
A:=6:
A*7;
When I run
maple -q a.ms
I get:
42
(empty line)
I want to get:
42
That is, 42 should be left-aligned, and no empty line after it.
How do I get that?
I'm looking for an answer which proposes a Maple-only solution without the need additional filtering.

Following acer's comments, this did the trick:
A:=6:
printf("%d\n", A*7):
This also did the trick:
interface(prettyprint=0):
A:=6:
A*7;

Related

What is the right parameter syntax for PyRAF biassec?

If I use epar ccdproc in imred >> ccdred >> ccdproc, I can put [261:280,1:1032] in biassec, which is in a old iraf code by my teacher:
ccdproc #list.all o//#list.all ccdtype='' overscan+ biassec=[261:280,1:1032]
But if I use the terminal, it will say:
SyntaxError: Too many positional parameters for task ccdproc
And if I put (261:280,1:1032), (261:280;1:1032) or (261:280 1:1032), it will also pop out SyntaxError. It seems that pyraf syntax is slightly different from iraf. What is the right parameter syntax?
Solved, "[261:280,1:1032]".
Add quotation marks
ccdproc #list.all o//#list.all ccdtype='' overscan+ biassec="[261:280,1:1032]"

Unexpected Coding Error on Arduino Uno R3

When I run this code it gives me an error, I am still a beginner so I don't know how to fix it.
This is what I have written so far
Giving a look in your code, you missed to place some semicolons (;) at the end of some instructions, to be more specific you miss them in lines:
5
32
34
37
40
In line 9, you have to type "Serial.begin(9600);" instead "serial.begin(9600);"
On the last else, you forgot to enclose the instructions between "{}" and placing the '}' to close the void loop.
You are making reference to a routine named getVoltage, but I don't see it
Another issue that I can see is that you have to write with uppercase words like: OUTPUT, INPUT, HIGH and LOW
Please share more details once you be able to fix this observations

How to combine two Vim commands into one (command not keybinding)

I've found few Stack Overflow questions talking about this, but they are all regarding only the :nmap or :noremap commands.
I want a command, not just a keybinding. Is there any way to accomplish this?
Use-case:
When I run :make, I doesn't saves automatically. So I'd like to combine :make and :w. I'd like to create a command :Compile/:C or :Wmake to achieve this.
The general information about concatenating Ex command via | can be found at :help cmdline-lines.
You can apply this for interactive commands, in mappings, and in custom commands as well.
Note that you only need to use the special <bar> in mappings (to avoid to prematurely conclude the mapping definition and execute the remainder immediately, a frequent beginner's mistake: :nnoremap <F1> :write | echo "This causes an error during Vim startup!"<CR>). For custom commands, you can just write |, but keep in mind which commands see this as their argument themselves.
:help line-continuation will help with overly long command definitions. Moving multiple commands into a separate :help :function can help, too (but note that this subtly changes the error handling).
arguments
If you want to pass custom command-line arguments, you can add -nargs=* to your :command definition and then specify the insertion point on the right-hand side via <args>. For example, to allow commands to your :write command, you could use
:command -nargs=* C w <args> | silent make | redraw!
You can combine commands with |, see help for :bar:
command! C update | silent make | redraw!
However, there is a cleaner way to achieve what you want.
Just enable the 'autowrite' option to automatically write
modified files before a :make:
'autowrite' 'aw' 'noautowrite' 'noaw'
'autowrite' 'aw' boolean (default off)
global
Write the contents of the file, if it has been modified, on each
:next, :rewind, :last, :first, :previous, :stop, :suspend, :tag, :!,
:make, CTRL-] and CTRL-^ command; and when a :buffer, CTRL-O, CTRL-I,
'{A-Z0-9}, or `{A-Z0-9} command takes one to another file.
Note that for some commands the 'autowrite' option is not used, see
'autowriteall' for that.
This option is mentioned in the help for :make.
I have found a solution after a bit of trial and error.
Solution for my usecase
command C w <bar> silent make <bar> redraw!
This is for compiling using make and it prints output only if there is nonzero output.
General solution
command COMMAND_NAME COMMAND_TO_RUN
Where COMMAND_TO_RUN can be constructed using more than one command using the following construct.
COMMAND_1_THAN_2 = COMMAND_1 <bar> COMMAND_2
You can use this multiple times and It is very similar to pipes in shell.

Move cursor up/down one line in Atom

I'm using Atom with soft wrap turned on. In most simple editors such as gedit, Ctrl-Down would be used to skip ahead to the true next line, ignoring any wrapped lines below (same as j and k in Vim).
However in Atom this shortcut produces the result of moving the line itself around, which is less useful to me. I'd like to remap Ctrl-Up and Ctrl-Down to move the cursor up or down to the next true line, as described above.
I'm familiar with editing my keymap file, but I simply can't find any command that would be the equivalent of moving ahead one full line.
You could write a custom command in your init.coffee like this:
atom.workspaceView.command 'custom:move-next-buffer-line', ->
editor = atom.workspace.getActiveEditor()
editor.moveCursorToEndOfLine()
editor.moveCursorRight()
And then just reverse it for moving to the previous buffer line. You can then map the custom command in your keymap, which you said you're familiar with.
If you're using the vim-mode-plus package, then just modify your keymap.cson file by adding
# except insert
# -------------------------
'atom-text-editor.vim-mode-plus:not(.insert-mode)':
# Motions
# -------------------------
'k': 'vim-mode-plus:move-up-screen'
'j': 'vim-mode-plus:move-down-screen'
See for details https://github.com/t9md/atom-vim-mode-plus/blob/master/keymaps/vim-mode-plus.cson

Unix diff to only print relevant diff

I have these two files
File: 11
11
456123
File: 22
11
789
Output of diff 11 22
2c2
< 456123
---
> 789
Output to be
< 456123
> 789
I want it to not print the 2c2 and --- lines. I looked at the man page but could not locate any help. Any ideas? The file has more than 1000 lines.
What about diff 11 22 | grep "^[<|>]"?
Update: As knitti pointed out the correct pattern is ^[<>]
Diff has a whole host of useful options like --old-group-format that are described very briefly in help. They are expanded in http://www.network-theory.co.uk/docs/diff/Line_Group_Formats.html
The following is producing something similar to what you want.
diff 11.txt 22.txt --unchanged-group-format="" --changed-group-format="<%<>%>"
<456123
>789
You might also need to play with --old-group-format=format (groups hunks containing only lines from the first file) --new-group-format=format --old-line-format=format (formats lines just from the first file) and --new-line-format=format etc
Disclaimer - I have not used this for real before, in fact I have only just understood them. If you have further questions I am happy to look at it later.
Edited to change order of lines

Resources