subversion version number question - subversive

I am using SVN, Visual Studio, and VisualSVN plugin for VS.
Is it possible to set things up where each item under control, say a file, will have its own sequential version number, which is independent from other items under control.
For example, I want foo.txt to get version numbers 1, 2, 3, 4, etc.; and I want bar.txt to get version numbers 1,2,3,4, etc.
How things are workig for me currently, is that foo get "1", then if I make a change to bar and check it in next, it gets "2", see what I mean?

They aren't version numbers. They are revision numbers. It tells you at which point on the last commit did the content of the revision change. What you are asking is totally pointless. If you want to do versions, then you should create tags instead.

svn has a single global revision level, and individual items have a sparse space of versions.
You would need to do something very complex with triggers to achieve this result, which you could store on a property.

Related

Disable all Emacs c-mode reformatting, insertion/refusal, cursor jumps

I want to keep all syntax highlighting, autocomplete, commands etc. of Emacs c-mode (and I'll add in company-mode or similar shortly) but I want to disable everything in c-mode which:
Reformats other than if I C-<command> or M-<command> ask it to.
Moves my cursor around the source, even momentarily, unless I asked for it. For example, closing parens/braces highlighting the matching one.
Ever i) inserts anything I didn't type (other than 1 Tab = 4 spaces) or ii) refuses to insert something I did type because formatting.
Reformats, repaginates, realigns or otherwise edits the source for any reason, including on paste, on save, or because the moon is gibbous.
I've already set (setq-default c-basic-offset 4) and (setq-default indent-tabs-mode nil).
I have tried:
C-x C-l a.k.a. c-toggle-electric-state a.k.a. (setq-default c-electric-flag nil) which fixes some of 4, but Tab still reformats code when it feels inclined, and I'm guessing isn't alone; and doesn't fix 2 or 3.
c-auto-align-backslashes which fixes one above case only.
(setq c-syntactic-indentation nil) which partially fixes 4, but breaks 1 and 3 (for instance, Tab doesn't insert at the cursor), and doesn't fix 2.
text-mode which obviously removes all the c-mode features I want to keep.
Various searches and dives into https://www.gnu.org/software/emacs/manual/html_mono/ccmode.html, which carefully documents 2^1024 settings but doesn't exhibit an "all formatting off" switch that I can find.
Scanning https://sourceforge.net/p/cc-mode/cc-mode/ci/default/tree/ for obvious flags to disable (*blork*?)
I've been at this for hours, so any help gratefully received.
Update: More thrashing around: installing emacs source code (apt-get install emacs24-el) and using C-h k <key combo> to find the function called when a key is pressed. M-x find-function to browse that source to work out what it's actually doing and look for hooks. (setq-default indent-tabs-mode nil) to stick with spaces, not tabs. (setq-default blink-matching-paren nil) to prevent cursor jump on closing parens/braces. I still can't disable formatting, or achieve 1, 2, 3 and 4, but I'm getting better at whack-a-mole.
First observation: this is a difficult sort of question to answer, because "disable everything that does ...." is a bit unspecific. However...
Item 2. (Moving point momentarily to the matching open paren when you type a close paren) is easy: (setq blink-matching-paren nil). This is in the Emacs manual on page "Matching Parentheses". (Whoops! You've already found that one).
You don't like the action of the tab key; what do you want it to do? It's bound to c-indent-command, which indents the current line inwards or outwards to the "correct" position. I'm guessing you want simply to insert spaces to bring point to the next 4*nth position. How about tab-to-tab-stop? Try (define-key c-mode-base-map "\t" 'tab-to-tab-stop). Note that defining it in the default key map would not work, since the major mode key map takes priority over it.
Having done C-c C-l to disable the automatic indentation on typing, e.g., a ;, does typing a ; still do anything to offend? If so, you could disable its "special" features entirely with (define-key c-mode-base-map ";" 'self-insert-command)
Again, a list of specific things you don't like, even a long list, is a lot easier to deal with than "everything which inserts anything I didn't type". The maintainer of the mode just doesn't mentally classify things that way.
Anyhow, I hope you manage to get things sorted out.

Generate MEL to rebuild a model in Maya

I made a 3D tree in Maya and need MEL code to run in a for loop and generate as many trees as I want. Is there any way to convert a model made in Maya into MEL code that would rebuild the tree?
I can't just duplicate it because the script needs to generate the tree from scratch. Unfortunately, I cleared my history because it was messy, so I am looking for a way to generate the MEL code given just the geometry.
It is slightly unfortunate that you deleted the history. If you had not then you could have just built a script out if the history tree. But all is not lost, still i will explain how you can do this in case you do remake the history at some point.
The complexity of your history is never really a issue, at least when modeling. I would advice to not delete any history until your sure its of no use. Having a 1000 node history is not in any way slowing you down since most of it is inactive. Its only a problem once you enter animation even then its not necessarily a problem at all. Since the history deletion is a bit destructive its a good idea to save the scene when you are deleting big areas of history. So rule of thumb do not delete history and use the freeze transformation operation unless its really necessary (and it may be you never actually do this).
Another side remark: Copying stuff is still valid, unless like in this case there is a artificial limitation. The only time when this limitation is valid is if this is homework (in which case you may want to demonstrate that your willing to follow instruction). Doing a copy does not detract in any way the end result. Copying is mel (and all maya ascii files are mel of sorts).
Method 1: (when history is cleared)
You can reduce the problem to a normal rigging operation. What you do is you rig the tree that you built with bones, clusters and possibly blend shapes. Then just randomize the channels of your rig on each copy operation. The neat thing here is that the script can be easily extended with different base trees, or just about anything, just by making new separate rigs.
The bonus here is that you could now also easily animate the tree being blown by the wind etc.
This might feel like something outside the scope of the assignment. However a good MEL programmer does not really separate tasks. Using a node to do something is just as valid, if not more valid, as writing everything in code. Something like this demonstrates really thorough understanding of maya use and maya programming. On the other hand not all users are as enlightened (most are not).
Everything in Maya is or at least should be a rig. (the auxiliary to this is that your mel should strive to build a rig or you should use API to make nodes)
Method 2: (when history is cleared)
Chunk your result into pieces. Then randomize the chunk positions with L-system like rule based generator. It may seem counter intuitive to use a L-system with hand modeled pieces when the entire thing could be generated with a L-system.
But clunking allows for a very simple l-system to be built. The end result also retains the artistic integrity of the original in some ways that might be much more pleasing.
A slightly different version of this and method 3 is to make 2-3 overlapping set of branches in the model and then randomly delete branches for variation.
Method 3: (when history is cleared)
Cheat, well i would actually argue that in CG there's no such thing as cheating. Just copy the same tree about, alter its rotation ans scale. And randomize new shaders to your model (swap different leaf textures different color etc). When combined with even slight amount of rigginng approach can totally hide the fact that there is just one tree. Copies dont have to be all that exact they might be shaped with a lattice or something. This is actually pretty efficient, most people wouldn't notice.
Method 4: (when history is not cleared)
When you model something manually maya records this quite efficiently. The history can be turned into a script with little or no effort. The best kept secret. If you save this kind of scene as maya ascii then the maya ascii file is (almost) just mel and you can repeat this by adding variables to the stream to instrument it to mel. Beware tough that not all tools build meaningful history so point tweaks should be done on clusters instead on manual point tweaking that ends up in the shapes tweak array.
It is also possible to build the mel automatically with a mel script that checks for connections and values in nodes to reproduce the thing in code. The good thing is that you can readily introduce the instrumentation. Here's a really old version of code as giveaway (you need to handle the shaders and inputComponents for example):
/* jooConvertNodeNetworkToMelLadder.mel 0.0
Authors: Janne 'Joojaa' Ojala
Testing: Has known bugs, code deprecated, no bug reporting
Licence: Creative Commons Attribution-ShareAlike 3.0 Unported
About:
A deprecated early version of code generation it has some bugs and
is nowhere near perfect but you can have this code for the heck of
it. Main thing missing is that it does not check for selection
sets for nodes so you need to make those manually.
Install Instructions:
copy jooConvertNodeNetworkToMelLadder.mel to your maya script
directory
Usage:
Select node and run jooConvertNodeNetworkToMelLadder from mel
commandline.
Deprecated at 31.12.2006
*/
proc string generateAttrib(string $node, string $createNode,
string $attrib,string $varName){
string $return="";
if (getAttr($node + "." + $attrib) !=
getAttr($createNode + "." + $attrib))
$return = (" setAttr (" +
$varName + "+\"." + $attrib+"\") "+
getAttr($node + "." + $attrib) + ";\n");
return $return;
}
proc string doOneNode(string $nodeOrig,string $connections[]){
string $hist[]=`listConnections -c 1 -p 1 $nodeOrig`;
string $return="";
$type=`nodeType $nodeOrig`;
$varName=("$"+$nodeOrig);
$createNode=`createNode $type`;
$return=(" "+$varName+"=`createNode -n "+$nodeOrig+" "+$type+"`;\n");
if ($type != "mesh") {
for ($attrib in `listAttr -settable -multi -w -scalar $createNode`){
$return += generateAttrib($nodeOrig, $createNode,
$attrib, $varName);
}
}
delete $createNode;
for ($i=0;$i< size($hist);$i=$i+2){
if (size(`connectionInfo -dfs $hist[$i]`)){
string $node,$port,$type,$nodeOrig,$portOrig;
$node=`match "[^.]*" $hist[$i+1]`;
$port=`match "[.].*$" $hist[$i+1]`;
$nodeOrig=`match "[^.]*" $hist[$i]`;
$portOrig=`match "[.].*$" $hist[$i]`;
$connections[size($connections)]=
(" connectAttr -f ($" +
$nodeOrig + "+\"" + $portOrig + "\") ($" +
$node+"+\""+$port+"\");");
}
}
return $return;
}
global proc jooConvertNodeNetworkToMelLadder()
{
print "\n// jooConvertNodeNetworkToMelLadder result:\n{\n";
string $a[]={};
for ($node in `listHistory`)
print(`doOneNode $node $a`);
print $a;
print "}\n";
}
But this is all I have time for, hope this helps.

Eclipse - How do I view java arrays / collections better in debugger

Viewing/Searching java arrays and collections in the Eclipse Java debugger is tedious and time-consuming.
I tried this promising plugin (in alpha as of Aug 2012)
http://www.cvast.tuwien.ac.at/projects/visualdebugging/ArrayExplorer
But it freezes Eclipse for simple arrays beyond a few hundred elements.
I do use Detail formatters, but that still needs clicking on each element to see the values.
Are there any better ways to view this array/collection data?
Use the 'Expressions' tab.
There you can type in any number of expressions and have them evaluated in the current scope.
ie: collection.size(), collection.getValueAt(i), ect...
Eclipse > Preferences > Java > Debug >Detail Formatter
This may be close to what you are looking for. It is another tedious work to setup but once done you can see the value of objects in Expressions window.
Here is link to start
override toString method of your class and you will be able to see what you want to see. i'm attaching example to show you exactly that.
Even though i could not find a way to see them in nice table/array, i found a halfway workaround.
The solution is to define a static method in a throwaway class that takes the array as input and returns a string of concatenated values that one wants to quickly glance at. it could include the array index and newlines to view results formatted nicely. It can be fine tuned to print out only certain array indices to reduce clutter.
This static method can then be used in the watch area.

Vim - Show data type

I typically code most of my C projects in Vim. I am comfortable with navigation, search and replace, and indexing via Ctags/Cscope.
One feature I would like to have, if possible, is a keymapping that will show the datatype for a variable under the cursor on screen.
For example, if my cursor is on a variable, "test123" (ie: int test123 = 0) is there a way to have the type (int) and some other details about the variable shown in another tab within Vim?
Also, is there something similar that would do the same for a struct variable, and show a list of all its members in the descriptive tab as well as the type (ie: struct)?
I've also noticed that sometimes while coding, I have a tab titled "[Scratch][Preview]" at the top of Vim that appears to fulfill this requirement, but I have no idea what triggers it (searches and Ctag searches don't seem to trigger it). It looks like so:
name: myStruct::instanceOfStrct| 2 cmd: /^ int instanceOfStrct;$/
.. (up a dir) | 3 kind: m
</code/test/test.c | 4 struct: myStruct
|+config/ | 5 access: public
|+lib/ | 6 filename: /code/test/test.c
I think this is something that already exists in Vim to some extent, but I have not idea how to work with it.
Thank you.
I do not know of any plugin that does what you want, however it should be quite possible using libclang. There is a fork of clang_complete that adds 'go to definition' functionality which is close to what you want. However development on that plugin seems to have stagnated.
Also the scratch buffer appears when doing autocompletion to give more information about a specific completion. It can be enabled and disabled using the completeopt setting.

Easy way to plot and display arrays?

First post here. Using C in Visual Studio 2008. Can work with VS 2005 if necessary.
How do I display numerical data in arrays as in a spreadsheet?
How do I plot numerical data in arrays?
These seem to be simple questions. But I cannot find solutions. So far, I would print the data to a file, import into Excel and view/plot. However, with this code there are too many arrays--so the print/import/plot is tiring.
Some constraints.
I do not want to write 20+ lines of code to do the above. MATFOR or Array Visualizer let you do the plotting with a one line function call.
They cannot display the data in a convenient format. I would like to display the data and the plot in one or two windows so that they are visible simultaneously.
This is a win32 console application---all the code is portable.
Will be using these during debugging.
Free or paid.
While I am looking for something specific, the requirements are substantially the same for any one doing numerical work with arrays and matrices--displaying data and plot simultaneously.
I am hoping that a such a tool has been written and is available.
I am also open to a solution that outputs the array data to an Excel sheet (can keep Excel open) and if it can also plot that can be great but I can live without plotting.
PS: I need this only when debugging the code.
I use ArrayDebugView which is a plug-in you install in Visual studio and draws graphs out of arrays while you are debugging your application. It works as a visual way of variable watch in debug mode. You don't need to write a line of code.
I can't think of any library that would enable what you want in a console app in less than 20 lines of code. My suggestion would be instead to script the plotting-step using MATLAB og GNU Octave to do the actual plotting.
In order to display numerical data in array, you should add the pointer to the first data element you want to observe, into the watch --- if you want to observe the array from the beginning, it would just be the array name, which is the pointer to the first element. In order to view more then one element, you add a "," after the pointer, followed by the number of element you want to observe.
For example, in order to observe the elements of float farray[100];, you should add to the watch farray,100.
In order to plot, you can copy-paste from the watch to your plotting software (i.e. excel), but it is not very convenient as you cannot copy the data column alone, but the columns to the left and right as well, so it involves extra manual editing.
I use GNUPlot (http://www.gnuplot.info/) to display my performance/speedup measurements.
I print my numbers to stdout and wrote a bash script that combines these numbers and calls gnuplot for rendering.
I made a simple plotting program for that purpose. There is only a textbox where I paste the data and a chart where it's drawn.
The data needs to be in either form:
with an automatic X (increment by 1 for each value): seriesName value
for both X and Y specified: seriesName xvalue yvalue
Most of the time I used to plot data from tracepoints.
I copy/paste the whole output window of VS, the plotting program ignores anything that doesn't follow these 2 forms (so I don't have to cleanup the string and put it in excel and all).
It does line, point, colum, area charts and save image, copy to clipboard.
MiniPlot
There are several ways to do this but this will require writing some code. Visualizing data is generally easy and straight forward but visualizing data exactly the way you want them to look will require some additional code and work.
There are several options to visualize data:
A combination of BASH and GNUPLOT
Use MATLAB or OCTAVE for all your calculations and visualization
Use PYTHON and SciPy and matlibplot libraries.
Gnuplot is a great tool to plot data but it is cumbersome to use. It looks fabulous if you invest time to get the plots right and combines excellent with LaTeX and has a good fit implementation for arbitrary functions. Visit http://gnuplot-tricks.blogspot.ch/ great site to learn all about gnuplot.
Numerical programs such as MATLAB and it's open source equivalent OCTAVE are great because they are fast implementation languages for numerical programs and have extensive additional libraries especially MATLAB. For high load numerical computing it is really slow and the plot library is only good for basic plotting needs.
Using PYTHON and its scientific programing libraries (SciPy and matlibplot) are a great combination. This allows excellent plot which are not as cryptic as gnuplot to plrogram and it is more flexible than MATLAB in plotting. Additionally it gives you a environment for numerical programing like MATLAB.

Resources