VS2013: "Match Case" always defaults to checked in Find and Replace Dialog - visual-studio-2013

I'm not sure when it started happening or how (though it may have coincided with VS2013 Update 4), but for some reason, every time I start VS2013 and go to the "Find and Replace" dialog (Ctrl-Shift-F), "Match Case" under the "Find Options" is checked. Previously, the option was either unchecked or at worst was "sticky" - meaning it retained the previous selection across runs of VS2013.
I can un-check it and run a search, and it stays un-checked as long as that instance of Visual Studio is running, but the next time I start VS2013, it's checked again. Can't find any obvious setting under Tools | Options.

On a hunch (and thanks to the gentle prodding from #Cliff Mayson, I decided to search through the registry to see if there was any obvious setting that was forcing case-sensitive searching in VS2013. Didn't take long to find the answer:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\Find\DialogOptions
had a value of
MatchCase=1 WholeWord=0 Hidden=1 Up=0 Selection=0 Block=0 KeepCase=0 SubFolders=1 KeepOpen=1 NameOnly=0 Plain Solution FindAll
I changed MatchCase=1 to MatchCase=0 and restarted VS2013. Voila! No more case-sensitive search!
There are some other similar-looking registry keys in that section but I didn't mess with any of them.

To complete a bit more. The registry key that Mr. T's refers to applies to the classic Find dialog but not to the new smaller and embedded one that VS2013 has. But you will get the same effect with that one too by changing the MatchCase value of the registry key
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\Find\AdornmentOptions
which is two rows above DialogOptions from
MatchCase=1
to
MatchCase=0
I.e., just as it is done for the DialogOptions key.

Related

How to Set the Last Used On Value Manually in Programs and Features

I'm trying to figure out how (and if it is possible) I can set the Last Used On value for a program in Programs and Features manually.
Specifically, it's the red field in the image below. I've tried copying the format of the Installed On column as it is presented in the registry but that didn't set any value at all. I'm testing with Google Chrome if that makes any difference.
Nothing concrete has turned up in my search, the most I've found is that the Start Menu assisted in inferring the last use but not how this value was set or if it still can be set.

How to recover or prevent from accidental UNDO/REDO operations on Visual Studio 2010

Case 1 (Overwritten undo/redo history)
You are editing source codes on "Program.cs". After a dedicated hour, You've done with 100 lines and typed "Ctrl+S"(Save).
To take a break, you left your desk without closing the "Program.cs" and Visual Studio. While you're leaving, your dog came to your desk and typed sequently
"Ctrl+Z"(Undo) > "Ctrl+Z"(Undo) > ... (Until the original codes appered) > "a"(Type text).
You came back from a break but it's too late. You're pressing "Ctrl+Z"(Undo) or "Ctrl+Shift+Z"(Redo) to recover your 100 lines, but all you can get is the original codes or "a".
Case 2 (Discard undo/redo history)
You are editing source codes on "Program.cs". After a dedicated hour, You've done with 100 lines and typed "Ctrl+S"(Save).
To take a break, you left your desk without closing the "Program.cs" and Visual Studio. While you're leaving, your dog came to your desk and typed sequently
"Ctrl+A"(All) > "a"(Type text) > "Ctrl+S"(Save) > "Ctrl+F4"(Close the src).
You came back from a break but it's too late. You're pressing "Ctrl+Z"(Undo) or "Ctrl+Shift+Z"(Redo) to recover your 100 lines, but all you can get is "a".
What i want to say through the above cases is "It's quite easy to lose the 100 lines."
I knew those possibilities and believed that i'll never catch of them, but the Second Case just happened 30 minutes ago by own mistake.
I want to know whether any solutions exist except SVN/GIT commit and rollback features.
Unfortunately, "Undo/Redo Last Global Action" didn't work for me.
Thank you for your help.
You asked for VS2010, but tagged this also for VS2012, and for VS2012 and onwards you have the Microsoft Devlabs AutoHistory extension which tracks local history. The extension is here: https://visualstudiogallery.msdn.microsoft.com/dfcb2438-180c-4f8a-983b-62d89e141fe3 , a blog on it is here: https://blogs.msdn.microsoft.com/visualstudio/2014/01/23/auto-history-extension-in-visual-studio-2013/
Example screenshot, the diff produced for a file where I added a Subtract method, saved it, then my dog came around and wiped it off and wrote "bbbbb" instead.
CTRL Y - Is the easiest way to fix the problem in visual studio code.

Error list messing with the selected entry

Maybe it's just a stupid case of PEBKAC, but recently, when fixing C# compiler errors, I frequently run into this problem:
I press enter on the first error (to jump to the code and fix it)
The error gets removed from the list (still normal for JIT code)
Previously, I would now just shortcut to the Error list, press down once, then Enter and fix the next bug. But now the list just seems to put my selection at a random error, not at the next one in the file.
I have the list sorted by error number (2nd column) which seems to coincide with File and Line sorting. I'm using VS2013.
Maybe I changed some setting by accident? Or is that a VS2013 bug? (Haven't been using it for that long, and 2008 never had that problem AFAIK)
PS: It could be the case that that problem has always existed, but I didn't notice because it doesn't happen in C++ obviously, and I didn't have such a mass of errors at once (big refactoring atm)

How to switch sql worksheet display in oracle sql developer 3.2

In the sql worksheet of oracle sql developer when you press the keys ctrl + [up/down]arrow the worksheet switch into a single sql statmenet navigation. It breaks your script into individual statements and let's you navigate between them.
How can i switch back to the original one long script ?
I can't seem to find it.
EDIT:
and how can i completely cancel this option.
Using "Ctrl-Z" to go backwards also gets you there, but it does it one step at a time (e.g. Ctrl-Down 5 times requires 5 corresponding "undo" actions to take you back).
ctrl-up and ctrl-down navigate your query history in SQL Worksheet, at least by default. That doesn't sound quite like what you're seeing, but possibly you're going back through old versions of partial statements that you've now combined in a single script, in which case you can just ctrl-up until you get back to the current state (though it only seems to keep things you've executed, so if you change something and then hit ctrl-down before running, I think your changes are gone...).
I don't think you can disable that behaviour, but you can make it harder to trigger by accident, if that is what's happening. From the Tools->Preferences->Shortcut Keys option, search for ctrl-down, and highlight the entry for category 'Other'. Click in the 'new shortcut' area at the bottom and type a more obscure key combination (that isn't already used) and click 'Assign'. Repeat for ctrl-up.

Automatically saving notebook (or other type files in mathematica) files

I have been facing this problem for sometimes now, a laziness caused in part by the fact that Microsoft Office automatically save files you are working on with versions and automatic recovery.
Many times when I am starting a new notebook in mathematica to do some tests or whatever, I often forget to save what I am doing.
Every now and then, depending on the computer I am using, the computer crashes and all the beautiful work I was doing is lost forever...
Is there a way to get around this other that manically saving my files every five minutes? How about file versioning?
BTW: Using MMA V8
Regarding autosaving, you may want to check out the NotebookAutoSave option, which can be set to True through Fromat->Option Inspector. You have to choose "Selected notebook", then go to Notebook Options -> File Options, and set NotebookAutoSave to True. Then, your notebook will be saved after every evaluation. Whether or not this is a satisfactory solution, of course depends on the situation.
But my experience is that the most reliable way is to develop a CTRL+S reflex - this one never lets me down and is working quite well.
As for the versioning, it is much easier with packages, for which you can use WorkBench which has integrated support for CVS and support for SVN via Eclipse plugin. For notebooks, I refer you to this SO thread. You may also find this Mathgroup discussion of some interest.
EDIT
For M8, for auto-saving purposes you can probably also run
RunScheduledTask[NotebookSave[EvaluationNotebook[]],{300}]
But I can not test this code at the moment
EDIT2
I just came across this post in the Toolbag repository - which may also be an alternative for the autosave part of the question (but please see also the discussion in comments on the relative advantages of scheduled tasks vs. Dynamic)
Since you have MMA version 8 you could use:
saveTask = CreateScheduledTask[FrontEndExecute[FrontEndToken["Save"]], 5*60];
StartScheduledTask[saveTask];
to save every 5 minutes (change the term 5*60 for other timings).
To remove the auto-save task use:
RemoveScheduledTask[saveTask];
To save only a fixed, specific notebook, store its handle in nb (finding it using Notebooks, SelectedNotebook, InputNotebook or EvaluationNotebook) and use FrontEndToken[nb,"Save"] instead of just FrontEndToken["Save"]
I have a Mathematica package that provides auto-backup functionality. When enabled, the current notebook--call it "blah.nb"--will be backed up to "blah.nb~" after a configurable amount of time has elapsed. I use it constantly and it has saved me from losing work many, many times. It's better than autosaving since it doesn't touch the actual notebook file: if you screw something up or something gets corrupted you don't want to overwrite your main file. :)
It's on GitHub here.
I've got an autosave routine that saves a copy of every open, modified notebook every 5 minutes (or whatever interval you prefer. It leaves your manually-saved copy alone, and saves a "swap file" in a separate directory that can be easily recovered if need be. The code (to be copied to init.m) is given in this answer: https://mathematica.stackexchange.com/questions/18380/automatic-recovery-after-crash/65852#65852, and copied below:
Motivated by the same concerns, I wrote the following code and added it to my init.m file. There are two main entries you'll want to change to use this. The global variable $SwapDirectory is where the swap files are saved (by swap file, I mean it in the VIm sense; an "extra" copy of your notebook, separate from your manually saved copy that periodically saves any new work). The swap files are organized within the swap directory in a directory structure which "mirrors" their original file locations, and have ".swp" appended to their file names. The other variable you might want to change is the number of seconds between autosaves, indicated by the "300" (corresponding to 5 minutes) near the bottom of the code below. At the appropriate times, this code will (automatically in the background) save swap files for ALL open notebooks, unless they are unmodified from their manually-saved versions (this exception makes the code more efficient, and more importantly, prevents the storage of swap files for documentation notebooks, for example).
In its current form, the code does not filter for only the input cells, but hopefully you can use the other answers to make that modification yourself.
Some things to note:
1) the Mathematica Put command seems to have trouble writing to network drives, even when offline access is enabled. Therefore, it is probably best to choose a SwapDirectory that is on your local machine.
2) Within SwapDirectory, you should create a sub-directory called "Recovery". This is where the AutoSaveSwap routine will make an initial save of any notebooks for which there is NO existing manual save location.
3) Simply evaluate
RecoverSwap["filePath"]
where "filePath" is a string representing the filePath of the MANUALLY-SAVED copy of the file (i.e., not the file that was created by AutoSave). This will then pop up a window containing the most recent auto-saved version of the file. The manually saved version is NEVER overwritten, unless you explicitly choose to do so. Once the recovered version pops up, you can save it whereever you like, or discard it at your discretion.
4) You should probably add this code to the KERNEL version of init.m ($UserBaseDirectory/Kernel/init.m) rather than the frontend version... this way, if you quit and restart the kernel, the autosave feature will also restart. On the other hand, this means that you must evaluate at least one expression after each start or restart to begin auto-saving. Once this initial evaluation is done, you do NOT need to have evaluated a cell for it to be backed up (unlike the built-in autosave utility).
Hope this helps someone! Feel free to respond with any questions, suggestions, or requests for improvement you may have. And, if you find this post useful, upvotes would be most appeciated! Take care.
$SwapDirectory= "C:\\Users\\pacoj\\Swap Files\\";
SaveSwap[nb_NotebookObject]:=Module[
{fileName, swapFileName, nbout, nbdir, nbdirout, recoveryDir},
If[ ! SameQ[Quiet[NotebookFileName[nb]], $Failed],
(* if the notebook is already saved to the file system *)
fileName = Last[ FileNameSplit[ NotebookFileName[nb]] ];
swapFileName = fileName <> ".swp";
nbdir = Rest[FileNameSplit # NotebookDirectory[nb]];
nbdirout= FileNameJoin[ FileNameSplit[$SwapDirectory]~Join~nbdir]<>"\\";
If[!DirectoryQ[nbdirout], CreateDirectory[nbdirout]];
nbout = NotebookGet[nb];
Put[nbout, nbdirout <> swapFileName],
(* else, if the file has never been saved, save as untitled *)
recoveryDir= $SwapDirectory <> "Recovery\\\";
fileName= ("WindowTitle" /. NotebookInformation[nb])<>".nb";
NotebookSave[nb, recoveryDir <> fileName]
]
];
RecoverSwap::noswp= "swap file `1` not found in expected location";
RecoverSwap[nbfilename_String]:=Module[
{fileName, swapFileName, nbin, nbdir, nbdirout},
fileName= Last[ FileNameSplit[ nbfilename] ];
swapFileName= fileName <> ".swp";
nbdir= Most[ Rest[FileNameSplit # nbfilename] ];
nbdirout= FileNameJoin[ FileNameSplit[$SwapDirectory]~Join~nbdir]<>"\\\";
If[ FileNames[swapFileName, {nbdirout}] == {},
Message[RecoverSwap::noswp,nbdirout <> swapFileName]; Return[],
nbin= Get[nbdirout <> swapFileName]; NotebookPut[nbin]
]
];
AutoSaveSwaps= CreateScheduledTask[
SaveSwap /# Select[Notebooks[], "ModifiedInMemory" /. NotebookInformation[#]&],
300
]
StartScheduledTask[AutoSaveSwaps]

Resources