Visual Studio 2008 - Default Encoding style with .SQL files - sql

Tools used:
Visual Studio 2008
Team Foundation Server or Visual Source Safe
Backstory:
We add our SQL files to our source control. We do this by adding them to the solution with the .sql extension and checking them in.
By default these files are saved as unicode. What that means is that user A can save foo.sql and user B can get latest and grab foo.sql
Problem:
Unfortunately, since the encoding is unicode by default, if foo.sql happens to have a file size that is divisible by 8 bits the system will open up the file in the wrong format. This causes the file to look like it has chinese characters instead of normal sql statements.
This can be fixed if the user A manually changes the encoding type to western european, but that's a huge pain. It's also very difficult to notice if user A forgot to manually set the encoding unless a problem occurs.
Question:
Is there a way to have visual studio make the default encoding of sql files western european? Is there a way to batch update the encoding type of files in visual studio?

You can update the Visual Studio default files. See the answers in this post:
SQL file encoding in Visual Studio

Related

Pentaho don't Generete PDF in UTF-8 encoding

I have a problem related with PDF exportation in Pentaho BI plattform. I'm not able to produce a correct PDF file encoded in UTF-8 and which contains Spanish characters. That procedure neither works properly in local Report Designer nor in BI server. Special characters like 'ñ' or 'ç' are skipped in the PDF file. Generation in other formats works just fine (HTML, Excel, etc.).
I've been struggling with that issue for few days being unable to find any solution and would be grateful for any clue.
Thanks in advance
P.S. Report Designer and BI platform version 6.1.0.1
Seems like a font issue. Your font needs to know how to work with unicode and it needs to specify how to "draw" the characters you want.
Office programs (at least MS office) by default automatically select font, which can render any character (if font substitution is enabled), however PDF readers don't do it: they always use the exact font you've specified.
When selecting appropriate font, you have to pay attention to supported Unicode characters and to the font's license: some fonts don't allow embedding and Pentaho embeds font's subset, which was used, into generated PDF files if encoding is UTF-8 or Identity-H.
To install fonts for linux server you need to copy font files either to your java/lib/fonts/ folder or to /usr/share/fonts/, grant read rights to the server's user and restart the server application.

Migrating a string table (binary .res file) from VB6 to VB.NET

I have to port an old VB6 program to VB.NET and stumbled across an old ".res" (Resource) file, which is stored in binary format. Using VS 2013, I can embed that file into my .NET project, and VS shows me that it contains simply a string table.
The problem is, I cannnot figure out how to bring those res file into a more modern text format, or how to load the strings directly from the res file. I linked file to my application es an embedded resource, but all my atttempts to use VB6.LoadResString from the "Visual Basic Compatibility library" lead to an exception, showing the key was not found.
Furthermore, it seems VS does not allow me to copy/paste the string table into a text file, at least, not at a whole. Actually, it allows me to copy/paste one string after another, but as you can imagine, that is extremely cumbersome and error-prone. That is why I am looking for a better solution. Any ideas?
There is a functional VB6 Class for doing this at:
ResDecomp Class Decompiles RES Files
Sample programs are included, one of them a sort of "viewer" and the other just extracts RT_STRING resource strings to an XML document. You could easily change the latter to dump the string values to a text file, database, etc. instead.
Embed the .res file to a simple VB6 program which loops from min to the max ID and write out the strings to a text file using LoadResString (error trap for missing IDs).

VisualStudio 2013 weird compile issues

Issue
I'm having some really odd compile issues using Visual Studio 2013 and it's really disrupting my teams workflow.
The issue is hard to explain but I will provide screen shots and code snippets to help people understand the problems we are facing.
We have a project that we recently moved to VisualStudio 2013 from 2010 and upgraded it to .Net 4.5, the project is a ASP.net Web Forms project.
The code compiles and runs but oddly when I change any of the class files sometimes even just adding a comment 'Test Comment it fails to compile.
The errors shown in the error window are all wierd and the IntelliSense shows errors in the wrong place, some of the errors are even completly off. An example is _To is not defined in the line Dim _Town as String or in the same line 'ring' is not defined which is oviously part of the word String
ScreenShots
Here are some of the errors after I added the failing code at line 44 and then commented it out and re-compiled
What I've tried
I've tried to change the files line endings and make sure they are all Windows CR+LF, I've tried snooping in the build output nothing I can really see to help me.
I even brung the solution down from source control on another machine to test and it had the same issue. It didn't actually compile properly at all on the new machine but I don't know yet if these two issues are related.
I had the same issue as yours, and also the same scenario (I had upgraded a very old VB.NET project to a 2013 project).
The issue seem to be related to file encoding. I don't know the exact cause, but it might be having multiple files with different encoding (In my case, some files were ANSI, other files were UTF-8 w/ BOM).
If you aren't sure about having files with different encoding, open them in Notepad++. You should see the file encoding in the bottom-right corner.
At first, I have convert the offending file to ANSI to see if this will resolve the problem. I opened the offending file in Notepad++, selected Encoding-Convert to ANSI, Saved, Encoding->Encode In UTF-8 without BOM, Saved and Reloaded the file in VS. Now the project compile successfully.
However, I didn't want to do this every time I changed the file, (since VS convert it back to UTF8), therefore I copied all the old files (In my case they were 4 files only) to a temporary directory, deleted the files from VS and created new files with the same name, and I copy/pasted the content into each file. Now all my files are in UTF8, and I am no longer having this issue.
The solution is to either convert your files to ANSI as UTF8, or convert them to UTF8 (This seems to be the default encoding for newly created files in Visual Studio, so I suggest converting them to UTF8)
If you have a lot of files I think you can try to convert them to UTF8 using Notepad++.
Regards.

Delta copy using Visual Basic

I'm using Visual Basic to create a program and one part of the program is to copy huge files from a remote server that is connected slowly. So I want to transfer as littleas possible.
I thought to use something like a delta copy (you know it from Backup software and/or version control systems like SVN). Then I just have to copy these parts of a file that have been changed since the last copy.
Is there any possibility to execute something like this using the Visual Basic programming language?

VS2012 Crashes Loading Resource File with Byte Array

I used to use VS2010, which had no trouble loading System.Byte[] (byte array) from a resource file, however now when I open the same resource file with Visual Studio 2012 (VS2012) crashes.
Here is a format copied from the Resources.resx file:
<data name="BYTEARRAY_1" type="System.Byte[], mscorlib">
<value>
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZGVmZjBcZGVmb
c1xmcHJxMlxmY2hhcnNldDAgQXJpYWw7fXtcZjFcZnJvb
...
NCAqKioqKioqKioqKioqKioqKioqKioqKioqKipccGFy
My question is what is wrong and how do I fix it? What is the proper format now?
A second question is how do I add a new byte array to a resource file. I see the capability to insert images, strings, files, and icon, just not a byte array.
Thanks in advance
The solution that I took was to recode and simply insert a file as a resource. Files as a resource can load as a byte array. It was a bit of work, but at least files are easier to maintain.
Microsoft still has a bug, which they introduced in Visual Studio 2012 (VS2012), but their bug actually served me well.