Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm looking for a file compare tool with a "combined file" view. To me, this makes the best use of screenspace because unchanged lines are only shown once and also I don't have to move my eyes much to move from "before" to "after". The screenshot below shows what I mean - the blue and red text show the differences, the black text on white background is the unchanged portion of the file.
I checked Beyond Compare and WinMerge and CompareIt from the master list, but they don't have this feature (unless I'm missing it?). MKS Visual Difference has "combined file" view, but you can only get that as part of an expensive toolkit of 400 programs. I'm looking for a cheaper option. I'd like a GUI not a command-line tool, and I like to be able to view all the unchanged lines not just some of them.
alt text http://img186.imageshack.us/img186/9503/visualdifference2.png
I've never tried it, but Guiffy is a cross platform diff/merge tool. It has a 3-way merge view and is reasonably priced. Here's a screenshot of 3-way merge.
EDIT (MarkJ) 3-way merge wasn't what I was looking for, but the Guiffy "together view" looks great! I found a screenshot of that:
alt text http://img41.imageshack.us/img41/4558/guiffytogether.png
Of course there is diff -u which will produce output very close to what you describe.
$ diff -10 -u 1 2
--- 1 2009-08-19 12:48:12.847750000 +0200
+++ 2 2009-08-19 12:48:50.925875000 +0200
## -1,13 +1,13 ##
Dim bOk As Integer
Select Case Col
Case giCOL_OPTPOLNAME
- Value = gParamRecOpt.PolName(Row)
+ Value = Trim$(gParamRecOpt.PolName(Row))
Case giCOL_OPTINCLUDE
Value = Format$(gParamRecOpt.Include(Row))
Case giCOL_OPTSHORTLONG
Value = Format$(gParamRecOpt.Include(Row))
$
You can get the diff program for free (GPL) as part of cygwin.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
The community reviewed whether to reopen this question 1 year ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I think I run something incorrectly trying to add a directory to PATH in fish. Perhaps it was this:
set -g PATH my_foobar_directory "$PATH"
From fish tutorial I now understand that I shouldn't have added the double-quotes.
Better yet, should've used fish_add_path my_foobar_directory.
Lesson learned; however, the change has persisted somewhere, and nothing I try seems to recover the previous state. I also cannot find the previous PATH value — the console logs with it were washed away by copious fish: Unknown command: python etc, from fish_prompt bells & whistles.
Falling back to bash gives me bogus PATH as well — even after set -e PATH.
What do? How do I start over?
So for myself, I solved it like this.
In the process tree, I found a sufficiently long-running process. In my case, cinnamon-session worked — though any not-so-distant fish parent would do.
The idea being that in that process's environment, the previous PATH value could still be intact. It was.
Then basically — let's say the pid was 661 — print environment of pid 661 in fish format:
/bin/tr \0 ' ' < /proc/661/environ
# copy output
Then just pick that output, and feed it into the "universal" variant (fish-specific) of the PATH variable, taking care to erase all other variants:
set -e PATH
set -eg PATH
set -Ux PATH <paste>
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
i'm looking to find a way to beautify my code in MATLAB. I'm talking about tabs, deleting unnecessary spaces etc., the way Eclipse does it with Ctrl+Shift+F
The smart indentation (ctrl + I) is probably all you need (as #Matteo V and #Cris Luengo already mentioned).
However, there are a few other neat tricks that you might want to have a look at if you are really into code development:
Well, first have a look at the Improve Code Readability site of MATLAB. You could use the Apply smart indenting while typing option in the Preferences > MATLAB > Editor/Debugger > Language > Indenting section (it should be turned on per default but I like the Indent all functions setting). There are a bunch of other settings that you may want to explore
If you dig yourself deeper in the MATLAB IDE, you will notice that you can adjust almost everything to your preferences, but the way is not always documented in the web.... however, the local documentation (call doc) contains the info you may be looking for, see this blog-post
I am not aware of an automatic detection of double spaces or similar but you might end up writing your own little callback-function. Most languages ignore this anyway (perhaps except for Python). Code readability is usually a topic that the programmer(s) should care about... and not the machines ;)
Further tips:
respect the Right-hand text limit, which is the vertical gray line in your editor and shall indicate how many characters a single line of code should have as maximum. If it is a comment, wrap it. If it is an expression, try to outsource some commands to a dedicated variable
use equally long variable names. (There is no style guide as in Python, which says that you should use normal words and underscores etc) E.g. if you have two variables describing a commanded and a measured velocity, you could call them v_cmd and v_act and your code perfectly aligns if you apply the same manipulations to both variables ;)
use section. With %% (the space is important) at the beginning of a line in the editor, you create a section (you'll note the slight yellow background color and the bold writing that follows this command). It is convenient to structure your code. You can even run entire sections Editor-Tab > Run > Run section
Although there are programmers claiming that a good code speaks for itself (and therefore doesn't need any comments), to my experience writing comments has never been a bad idea. It improves the readability of your code
The answer might have been a bit elaborate for such an innocent question ... oO
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
In matlab script editor, we can use double percent symbol to define a region. for example in the following matlab script, two region are defined:
%% region 1
a=1;
b=2;
%% region 2
c=7;
d=5;
The advantage of defining region is that you can just execute one region where the cursor locates rather than the whole script by press ctrl+enter.
if the cursor is at c=7; line, after pressing ctrl+enter, c=7 and d=5 will be executed while a=1 and b=2 will not be executed.
however, I have searched a lot from web to find something equivalent in ESS, there is no results.
There is a command 'eval region' in ESS, but I don't know how to define such a region.
Thanks in advance!
The region is emacs speak for the part of the text that you would (essentially) consider to be "highlighted" in a "normal"/GUI text editor.
You can read more about it in The Mark and the Region in the emacs manual.
As far as I know, there is no equivalent to the matlab behavior you are describing. The few times I have used matlab, though, I do recall finding it handy when poking at a problem using ad hoc scripts.
As Steve said select a region, then all the standard ESS evaluation commands will act on a region (C-c C-c,C-RET,C-M-x).
But, what you describe sounds very interesting. Would you mind giving the full description of the workflow and markup, and post it to ess-help mailing list for a more thorough discussion? I would be interested in implementing such a feature. Thanks.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
Right now, I use most as my pager. While it has helpful syntax highlighting for man pages, it lacks colored syntax highlighting for anything else (I'm specifically looking for diff/C++).
Meanwhile, pygments is a wonderful program. I can easily make colorized output with it:
# ./pygmentize -f console256 ${file}
hg diff | ./pygmentize -f console256 -l diff
Now, I would like to be able to page the output, so I just use:
# ./pygmentize -f console256 ${file} | most
hg diff | ./pygmentize -f console256 -l diff | most
At this point, most dumps all the colorizing control characters to my screen like so:
^[[38;5;28;01mclass^[[39;00m ^[[38;5;21;01mheap_allocator^[[39;00m
{
^[[38;5;28;01mpublic^[[39;00m^[[38;5;241m:^[[39m
This is, of course, unreadable. I looked though the man page for most, but I couldn't find any "Hey, show those control characters as colors instead of printing them" options. less has the same garbage behavior as most, but more shows the colors perfectly fine, with the obvious limitations of being more.
Is there a pager that supports syntax highlighting or some crazy combination of parameters and programs I can string together to make this work? Ultimately, I would like to get diffs and logs from Mercurial to be highlighted, so maybe there is a shortcut in there...
Might I suggest vimpager?
First off, recent vim distributions (I believe 6.0 and above) come with a pager-esque-mode script. It's quite simple and functional, and operates similarly to less. Try: vim '+help less' +only.
Even better, however, Rafael Kitover has written a much more robust and powerful script called vimpager. It's available on GitHub (or vimscripts). If you are on OS X and using Homebrew, it's as easy as brew install vimpager.
At that point, you can simply set $PAGER=vimpager, or even alias less=vimpager. It works excellently.
less -R shows ANSI color sequences as-is (instead of expanding to caret notation). That'll make syntax highlighting work!
You can also create an environment variable LESS=-R to make this the default behavior. Similarly for other options; see man less.
Look for bat: A cat(1) clone with wings.
bat supports syntax highlighting for a large number of programming and markup languages.
It is not a pager, but it automatically redirects output to less if needed.
You might try using jed. Yes, it's a text editor, not a pager, but it's quite lightweight and the default install contains excellent colorschemes for a wide variety of file types and languages.
Jed has syntax highlighting modes for different languages, simillar to the emacs ones. For example if you piped a C program to it, you can turn on the highlighting by pressing 'ESC', then 'x', then typing 'c-mode' . If it is a php program - change the last part to 'php-mode' and so on ...
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Are there any (ideally GUI) diff tools that are aware of syntax?
As an example of the kind of thing I'm looking for, I keep finding that my current tool miss aligns repetitive code:
Foo = { 'hello': 'world', | Foo = { 'hello': 'world',
'goodnight': 'moon' | 'goodnight': 'moon'
} <
<
Bar = { 'picture': 1000, <
} | }
I'd like a tool that would try and make matching braces on one side align with matching braces on the other.
Edit: I'm looking for a tool that can automatically spot that condition and correct it's alignment.
Not GUI based, but completely syntax driven: my company's Smart Differencer tools for many langauges (incluiding Java, C#, C++, PHP, Python, JavaScript, HTML, XML, COBOL,...)
The Smart Differencer parses the source text like the compiler, so it understands that language syntax and structures the way the compiler does. It compares these structures (using ASTs) to determine the "least edit distance" in terms of edit actions (move, copy, delete, replace, rename-identifier-in-block) on these structures and report them.
In your example, it would know the curly brace on the right belongs to foo, not bar, and would tell you that the entire statement involving bar was simply deleted.
The output style is diff-like if you want to feed the result to another tool, or more human readable if you want to examine it directly.
Beyond Compare will let you realign lines that it mismatches. I generally have good luck with it matching lines properly.
I think Beyond Compare has what you are looking for
http://www.scootersoftware.com/index.php
I like Source Gear's DiffMerge.
The Pretty Diff tool is syntax aware automatically. The process it uses is to minify code in order to remove comments and then beautify the code so as to normalize formatting and white space. It only supports a few web client-side languages though. This tool works on the client side so you can test it out in your browser and there is a sample page containing some demos.