Visual Studio 2012 Error List is wrong - visual-studio-2012

So I have a solution that compiles and runs fine.
But the Error List window is always maxed out
(Last line in window: "Maximum number of errors has been exceeded.")
And they're totally crazy error messages like:
'End Function' must be preceded by a matching 'Function'
'Try' must end with a matching 'End Try'
'If' must end with a matching 'End If'
'Catch' cannot appear outside a 'Try' statement.
Statement cannot appear within a method body. End of method assumed
When I double click any of the errors, it just takes me to the first line of my class file.
I might not be the best developer in the world, but I'm not making mistakes like the Error List window says I am!

I copy/pasted the entire class file to notepad, save the text file, closed the text file, opened the text file and copy/pasted back into the class file...no more crazy Error List.
After I went through this process, I found out that you can choose "Save As" from VS, and there is a little arrow next to the Save button that lets you set the encoding.
So I'm guessing it was an encoding thing...the original class file has been in the project since Visual Studio 2003...no issues until VS2012...go figure!
Thanks everyone!

This started happening to me after reinstalling my system.
I think GoDogGo's solution of changing the file encoding is probably valid (I found I had a mixture of different encodings at work). Intellisense was showing errors that didn't match up to the right character positions in my source files.
I also had issues with types not being recognised, such as 'Data.DataTable'. I found I had included an un-encoded ampersand in the value of a web.config appSetting entry (it was part of a folder path). I think the compiler probably knew about it but didn't include it in the visible list of errors in the IDE's error list.
Once I had corrected the ampersand encoding and rebuilt, all the other errors disappeared.

Related

Python script in Colab keeps throwing error message: IndentationError: unindent does not match any outer indentation level

I'm currently using Google Colab in order to take advantage of its free GPU. I was trying to modify a code that I copy and pasted from machinelearningmaster.com. However, whenever I try to add a new code line, for example "print("some words"), I get an indention error.
I have tried adding tabs or spaces before the print call but I still get the error. for example:
space,space,print("some words")
tab, tab ,print("some words")
I have also checked the colab editor settings, currently the indention width setting are set to two spaces.
The first three lines are part of the original code, the print statement is
my addition. I copy and pasted this directly from the colab editor. In Colab all four lines are aligned. As you can see here only the first three lines are aligned. I don't know what's going on.
img_path = images_dir + filename
ann_path = annotations_dir + image_id + '.xml'
count=count+1
print("this is count: ", count)
I expected this to print the value of count, instead I get an error message telling me:
IndentationError: unindent does not match any outer indentation level
Okay, after much searching and frustration, I have an idea of what went wrong, but even better, a solution to fix it.
It appears that the Google Collaborator (Colab) editor does not have a way to set it for tabs "\t" versus space (space-bar entries). From the settings tab on the cell you can set the width of the tab from 2 to 4, but these will be interpreted as 2 to 4 space-bar entries. Usually, this isn't a problem. However, if you're like me and you want to test out code from the web, or be lazy and just copy paste from your editor, problems can arise.
Here's how I fixed it. Before pasting the copied code into Colab, first put it into notepad++. Go to View> Show Symbols >Show All Characters, click on this, you should now be able so see all the characters in the code. Find a tab, it will look like an arrow pointing to the right -->, right click and copy it. Open Search> Find, open the Replace tab. Depending on your version of notepad++ the tab you copied will automatically be entered and the replace will already be set to four spaces. Hit "Replace all". This will automatically replace all tabs with equivalent spaces. Copy the code from notepad++ back to Colab. Now there will be no more conflicts.
I think using a simple find and replace tool will just work fine. I also came across this error recently in Colab and I went through #Rice Man solution. The only difference was I used Libre office writer instead of Notepad++. I also found this tool to be helpful. I am not proficient in using Colab but this solution worked for me.
Another quick fix that worked for me related to this question.
I was trying to run a python script in colab and faced this error though the line seems at an appropriate indentation in that script.
I checked with the !cat filename.py cmd, and found out that the actual indentation appears different than it is in the script (hence the error).
Taking that unindented line (according to the colab) at the start of the line and using space afterward fixed the error.
I used this website to fix the error.
Copy your code to the site, then click beautify button on top left. This will remove indention errors.
If you want to know where the indention error is coming from, use #Prachi answer.

AutoPEP8, Anaconda, Sublime Text 3 Inconsistent Error Reporting

Please reference the attached screenshot.
I am working on a scrapy pipeline. I am using Sublime Text 3 with Anaconda/AutoPep8. I just moved over from ST2 where I did not have AutoPep8 or Anaconda.
The huge white dot is telling me that this line has invalid syntax. I could not figure out what the problem was, so I copied the line and pasted it here on line 1 of what was then an empty file. The syntax error still showed, suggesting it was not a problem with a prior line missing a closing parenthesis.
Then I made up some similar code, lines 3, 6, & 9. As you can see, they all pass muster. (I don't care about the other little errors, they are not the issue).
Then I pasted in the entire method over onto this new document, and now, as you can see, even the suspect line (22) passes.
Then I copied and pasted the whole class, and again, as you can see, line 49, the code it was complaining about before now doesn't cause any issues at all.
I tried using the command palette - PEP8: Preview Changes, (see https://github.com/wistful/SublimeAutoPEP8) but nothing happened.
I also tried the right click menu Anaconda > Autoformat PEP8 Errors but the E501 errors (line too long) were ignored and nothing happened with the supposed syntax error in the if statement.
Note: When I first started using AutoPep8 to fix E501 errors last week, I noticed that about halfway through a script, it suddenly stopped reporting errors at all. Don't know if this is related.
I also get this error when ST3 starts: https://github.com/DamnWidget/anaconda/issues/514. However, the consensus seems to be that if Sublime works even after you click through this error, it is nothing to worry about. I just mention this to give you as much as I know so you can help.
I also tried turning len('advocate') into a string, but the syntax error remains.
What is going on here? Is there a bug in Anaconda, AutoPep8, ST3, or my code?
Ubuntu 16.04, Python 3.4, (but 'automatic' build in ST3) ST3 Build 3126 (I don't know how the Build number lines up with a version number) Anaconda, AutoPep8 version numbers unknown, but I got them less than two weeks ago.
Well, it took a lot of very patient Googling and a comparison test in VSCode, but I have the astoundingly simple answer: I should have put '==', not '=' ! Yes, dear friends, it is basic Python. = means assignment, == mean equality or comparison. My if is of the latter type, because you can't make an assignment in an if statement. Now VSCode didn't make this any clearer, I think they both use Pylint, but it at least let me know that this was probably a valid error, whether I understood it or not. (Unless of course I know more that the devs at Pylint...Yea, not likely).
Kudos to Jean Mark Gawron, (who must be related to the Klingon Emperor) for giving me the answer: http://gawron.sdsu.edu/python_for_ss/course_core/book_draft/programming_intro/boolean_results.html

LaTeX document errors where no errors exist

I am writing my thesis with LaTeX and since today very curious errors turn up. I wrote something and made a citication in the file references.bib, and then the errors turned up. Befor writing that few lines everything worked great. Thus, I deleted everything I've added. But the errors still turn up. One Error is: Extra }, or forgotten $. ...ckoverflow Permission SYSTEM_ALERT_WINDOW}. I think my citication (which I've deleted after the errors turned up) is still stored somewhere , because "ckoverflow Permission SYSTEM_ALERT_WINDOW" was a part of the title of the cite.
I hadn't found any error in any file.
The next weird thing is that a mate of mine can compile that files without any problems. He is using WinEdt. I am using TeXStudio, but I've tried it with WinEdt, too.
There is a screenshot of my errors:
Please help me, any suggestions are appreciated.
Best regards
Looks like you might need to escape your _ characters there, as they are normally used for subscript, but only in math mode; hence the "missing $ inserted".
(La)TeX error messages make me sad... :(

Error on using Vim-latex ("can't find file ~")

I'm not sure if this question is appropriate here but I have nowhere else to ask. I recently started to typeset some 'mathsy' stuff using Latex and it became a hobby for me. I've been using TeXnicCenter for this, but feeling that I've got familiar with Latex language, I decieded to improve 'efficiency' of typesetting by changing the editor.
So I decided to use Vim (latest version, 7.4) with Suite-Latex. I've just installed Vim and Suite-Latex, following exactly what was instructed here. I made every necessary changes mentioned here, and it seemed to me that installation was successful (I got what was expected on Step 4)
Then I started to work through this tutorial and everything went fine until this section.
When I press F9 for autoreference, I see that Vim is working on something for split seconds and red error message refering to "can't find [some file name]" in my user/appdata/local/temp directory. The "file name" changes every time I do this (so its kind of temporary file as its directory suggests?). And then it produces a new window with title __ OUTLINE __ where 2 empty lines are showing up.
If I press n (in the new window described above) error message saying "E486: Pattern not found: rf" pops up and pressing j results in going down one row. If I press enter key, message ":call Tex_FinishOutlineCompletion()" pops up.
More frustratingly, if I try to compile a file by entering command \ll, a new window pops up where there are two lines saying:
1.ll I can't find file `newfile.tex'. newfile.tex
2.ll Emergency stop
and below these is a message saying
[Quickfix list]: latex -interaction=nonstopmode -file-line-error-style newfile.tex
So I thought it maybe is something to do with VIM not being able to find files in my computer (so something wrong with grep?), and I tried to resolve it by downloading a software called "cygwin" on which developers said their tests were successful, but it changed nothing.
But I think the two problems are related.
As it is, I am completely newbie in this type of editing environment (or any kind of programming) but I really would like to learn some Vim seeing how efficient it is in typesetting etc. Sorry for not being a pro at typing codes here. Thanks for reading!
I believe you need a latex compiler---I've had this issue and well, one thing that's left out of the conversation a lot is the compiler (pdflatex, latexmk, etc). As of now, you should download a compiler since vim-latex (latex-suite) doesn't actually come with a compiler (that I know of) and it's just a plug in with some cool stuff in it, but not what you need to make a file.pdf out of your file.tex.
It happened to me before. I found out that this problem may happen when you have special characters (such as white space and other symbols) in your file name or folder path. Try again with file name and path only in English letters.

Excel VBE inconsistent exports

I am exporting .bas files from an .xls file as outlined here: Exporting A VBComponent Code Module To A Text File to check them in into an SVN repo.
I am encountering the following issue which causes a change in casing of variable names in the files that is actually not real (or at least not relevant).
Statements like these get reformatted/recased:
rngTenors.Cells(i, 1)
changes into
rngTenors.cells(i, 1)
(subtle but still different and it gets picked up by the diff tool that I use and hides the real changes on the file in the noise that this generates)
Any idea of ways to prevent this from happening would be appreciated.
I'm doing something similar but haven't seen what you are experiencing. I'm not using the same export routines but they look similar at first glance.
A couple of questions.
1) Are you using option explicit, and
do you have a variable named cell
anywhere?
2) If you Commit, then make a few changes, export the .bas file and Commit again, what does the diff look like?
3) Are you opening and diffing the .bas files in a code aware editor (eg: Ultraedit) that may be changing your capitalisation?
I'm just guessing... but VB editor capitalisation can be weird if you name variables the same as methods or properties. Also i don't see why your export would inconsistently export .Cell i'm guessing if it exports to .cell then it should always export to .cell and not be a problem.
These are just some ideas, good luck :)
The VBE keeps an internal cache of variable names, including the casing, so even though you found a variable called cell, and renamed it to be something else, VBA still thinks it is a valid name, and so it is preserving the casing across all usages of that text.
You can trick the VBE into resetting the variable casing (and this also works for casing problems on methods too) by temporarily declaring a variable with the correct casing:
Public Cell as String
And then deleting that variable. You should then find that all of the casings are fixed throughout your project (and any project that refers to it).
Indeed I found something in the code as was suggested above.
dim cell
I have now renamed this variable and no reformats have occurred since. I expect and hope that this has resolved the issue. Many thanks for help!

Resources