Simplifying Visual Studio Find result format - visual-studio

I want to simplify Visual Studio Find in Files result, and I found a posting.
And I found it is not quite satisfactory.
Is there a way to display partial portion of directory in find result window?
ie)
x:\users\myname\project\solution_home\project1_home\src\project1.cpp
x:\users\myname\project\solution_home\project1_home\src\helper.cpp
x:\users\myname\project\solution_home\project2_home\src\helper.cpp
into
\project1_home\project1.cpp
\project1_home\helper.cpp
\project2_home\helper.cpp
IMHO, filename alone is not enough to distinguish important result, particulary in large soultion.
but, I want to eliminate certain part of directory path being repeated in every single result.
I wish there would be directory depth designation in $d format string.
ie)
$0d : file's directory
$1d : parent directory
$2d : parent of parent
... etc
Is there any extension and/or technique to do this?
PS: sorry for my poor english

I have something of a hack for this problem: map the local path to a drive. For example:
> subst Y: x:\users\myname\project\solution_home
Your Find Results will then be:
Y:\project1_home\project1.cpp
Y:\project1_home\helper.cpp
Y:\project2_home\helper.cpp
N.B. It has the side effect of breaking the CodeLens Team indicators (which must be a bug).

Related

perforce shorter client directory structure

This is a very basic query, but I am using perforce to create a workspace for a particular project that is deep in the depot directory.
Hence, on windows I am facing a warning as to "File name ... exceeds the limit of 260 characters"
I am trying to search a way to limit the folder structure to something just like : "C:\p4\dept.. " without the long list of folders.
Is there an easy way to do this?
I have come across following similar solution on :
[http://answers.perforce.com/articles/KB/3051?startURL=%2Farticles%2FKB_Article%2FSubmitting-or-Syncing-Files-with-Long-Path-Names][1]
But, cannot find out the command execution.
Is there a better, easier way to do this ?
The local paths (which exceed 260 chars in your case) are composed by concatenating
the workspace root
the paths (relative to the workspace root) as defined by your mapping.
To shorten the two, open Connection > Edit Current Workspace in P4V. Then
Shorten your Workspace root (e.g. to C:\p4)
Shorten your mappings:
In the same dialog as above, expand Workspace Mappings. This may be displayed as a graphical tree view. If that's the case, click one of the icons near its top-right corner to switch to a text-area view.
In the text-area view, each line has two parts: the depot path and the local path. The local path is something like //foo/some/relative/path/to/bar, where foo is your Workspace name. Shorten it to something like //foo/bar.
This should produce much shorter local paths.

How to browse for file (Win7/64bits)

I need to quickly write a simple GUI over a command line application. Two steps are required:
Specify an input file path,
Specify an output file path (non existing)
I found out a previous post, however trying to get the above (1) to work seems like an insane task.
Indeed BrowseForFolder seems to only work in some weird cases, you can use BIF_BROWSEINCLUDEFILES for only *.pdf and/or *.txt (trial and errors). I can get an error if I select a *.dll and/or a *.jpg (don't ask).
So instead, I gave up this approach and followed another one, in this case (objIE.Document.all.FileSelect), only the name of the selected file is returned the path seems to be always set to "c:/fakepath" for some reason. So again I am missing the full path to be able to pass that to the command line app.
Is there any sane way (<10 lines of codes) to get (1) and (2) working on Win7/64bits (VBS, HTA...)?
Don't know if people are still interested in the BrowseForFolder file selection issue, but here's what I've found.
I had the same issue selecting files with BrowseForFolder using &H4000 / BIF_BROWSEINCLUDEFILES. I could get a return with .docx but not .doc files and as you say .pdf files.
For me .txt wouldn't return anything, as didn't WMI Backup .rec files that I needed for a script I'm writing, resulting in this error information:-
Error: Unspecified error
Code: 80004005
Source: (null)
After looking at other solutions I came back to this one as my preferred choice, plus it was doing my head in that it didn't want to work. So at the bitter end it seems to be this easy.
To get my .rec files recognized I add this to the registry:-
[HKEY_CLASSES_ROOT\.rec]
#="WMI.Backup"
[HKEY_CLASSES_ROOT\WMI.Backup]
#="WMI Backup"
"BrowseInPlace"="1"
To get .txt files recognized I add this to the registry:-
[HKEY_CLASSES_ROOT\txtfile]
"BrowseInPlace"="1"
So "BrowseInPlace"="1" seems to be the nugget.
Seems so unbelievably easy that I'm sure this solution is out there somewhere but I never came across it so thought I'd put it online.
I would be interested to find that it works for others as I fear that this issue may of sent me mad, still can't believe it seems to work.
Hope this helps.
Here are 3 different ways to do what you want:
http://www.robvanderwoude.com/vbstech_ui_fileopen.php

Directory printing tool?

I have a very complex web app project I want to re-structure. Naturally, it consists of a considerable number of folders and sub-folders. I have a huge piece of paper ready to sketch a new structure on.
Now, I need paper printouts of the projects. Some directories I need in full detail including their files - the /library directory for example that contains core parts of the engine. Other directories, I need in much less detail, with just the sub-directories, or not even that.
I am on Windows and can use the tree command but that only gives me a full listing of the whole structure I then have to clean up by hand. I would much rather have a tool which I tell which directories I need in which depth, and in which I can save those settings.
Does anybody happen to know such a tool?
Edit: I have kind of sorted it out using the tree command, deleting the entries manually. To get what I wanted I would probably have to write a script of my own, which I can't do right now. Any hints are still welcome.
I would use a bit of Powershell code for this
Take a look at this example and look at the help page for getChilItems (gci).
You can specify files to include and files not to include.
$DllFiles = gci "C:\Windows\System32" -recurse | ? {$_.extension -eq ".exe"}
Foreach ($Dll in $DllFiles) {
$Dll.name + "t " + $DLL.CreationTime + "t " + $Dll.Length
$i++
}
Write-Host The total number of files is: $i
Here is an example of the exclude parameter
Get-ChildItem c:\scripts*.* -exclude .txt,.log
there is also an include parameter is that fits your needs better.
Are you wanting a batch file/folder renamer? Or something that lets you export the tree to a CSV or XML, or do you want to just see the files you want in the tree?
I used to use a program called FileMonkey, but it hasn't been updated since 2005. A quick search for the latest and greatest batch file handler turned up a few, the one I liked is Flex Renamer.
Apoligies if you've already tried this - I have no idea of your level of Linux knowledge.
Sounds like you may want to use find. It can find everything under a certain path with
find /path/to/directory/
or it can find just directories with
find /path/to/directory/ -type d
Using either approach, you can redirect the output to a file
find /path/to/directory/ -type d >> output.txt
find /path/to/somewhere/else/ >> output.txt
and then edit the file as you see fit.
Hope that is helpful.
-Jim

Include only certain file types when searching in Visual Studio

Often when I want to search through my code in Visual Studio, I know the thing I'm looking for is in some C# code. However, as I've used the same variable name in a JavaScript file, I have to wade through all those search results too. This gets even worse when the text I'm looking for is also used in a third-party JavaScript library that we've brought into the project: this can result in hundreds of search results.
To compound things, our designers include HTML mock-ups of the pages in the same project, so I often find I'm hitting loads of search results in there too.
I guess what I really want is to see results in my .cs, .aspx, and .ascx files, but not .js or .htm.
Is there any way to do any of the following:
Search only in files of a particular type (search only .cs files).
Search only in files of any of a given set of types (search only .cs, .aspx and .ascx files).
Search in all file types except a particular type or types (search everything except .js).
I suspect not, in which case is there any crafty way of working around this?
In the Find in Files dialog (Ctrl+Shift+F), there should be a field called Find Options. You should be able to enter the extensions of fields you want to search in a field in this dialog:
*.cs; *.aspx; *.ascx;
Instead of Ctrl + F, I think it is Ctrl + Shift + F which gives you the choice to specify file types, you wish to look into.
You can choose file types from default or type your own. Regular expressions available for complex search.
Another way to limit file searches is by only choosing certain folder sets.
I like to exclude js files by using the following search:
*.a*;*.cs*;
Most of the times, I end up searching for stuff in aspx, cs, cshtml files so this is quite helpful.
Notice how I use *.cs* instead of *.c* since the latter would select jquery custom files such as jquery.custom1234.js (which I usually use in most of my projects), of course if you don't you could just use *.c*.
In the Find dialog box, go to "find options->Look at these file types".
Type in you own string, eg, *.cs, *.aspx, *.ascx. The click the "find all" button.

If I have a solution folder, is it ok to name projects ProjectName instead of MyCompany.MySolution.ProjectName?

So the directory layout would look like:
Visual Studio 2008\
Projects\
MyCompany.MySolution\
Models\
Models.Tests\
Services\
Services.Tests\
UI\
etc..
rather than
Visual Studio 2008\
Projects\
MyCompany.MySolution\
MyCompany.MySolution.Models\
MyCompany.MySolution.Models.Tests\
MyCompany.MySolution.Services\
MyCompany.MySolution.Services.Tests\
MyCompany.MySolution.UI\
etc..
The namespace for each project would of course be MyCompany.MySolution.MyProject.
The question was generated by concern over maximum character path limit of 260. It seems better to me to do whatever I can to be able to freely name my projects and solutions; however, I don't want to run into an unforeseen mess.
If you run up the character path limit, you have to do something and you have to get creative. In this case, it is reasonable to alter the filename to a less-than ideal convention. Demoting the project names from including the complete namespace to merely the project name seems reasonable. Otherwise, consider using acronyms whenever you can. This approach will help a bunch.

Resources