I am used to working within pgAdmin, open a SQL script and just type there. I figured out how to run some scripts after each other with a batch file but ran into the problem that I needed UTF-8 without BOM. I fixed that by opening the scripts in notepad++ and saving them in UTF-8 without BOM.
But now whenever I work on a script within pgAdmin and then want to run it from the batch file, I have to do the same routine with notepad++. Isn't there a way to save UTF-8 without BOM in pgAdmin? Or to set the type of the scripts in UTF-8 without BOM that it is the default value and will never change?
In pgAdmin III (pgadmin3) version 1.14 and later, you can control this with a global setting:
Open the options dialog, e.g. with menu File → Options
Go to section Query tool → Query file
Uncheck checkbox Write BOM for UTF files
If you already had "Query tool" windows open in pgAdmin, you might have to close them and reopen the scripts in new "Query tool" windows for the change to take effect on subsequent saves.
Related
I'm running Geany 1.34.1 under Windows 10. Whenever I click a text file on Windows Explorer Geany opens the file in a new instance.
How can I configure Geany so that it opens all files in a single instance only?
According to a section of the Geany documentation, the behavior you want should occur unless Geany is started with the appropriate command line option. From the table of command line options, that would be either -i or --new-instance.
Check your file type association for text files and delete either of those command line options if they're there.
If no options are found, you might check your Geany configuration file to see if there's something related to starting a new instance. If so, you can try deleting the related stuff and see what happens. Be sure to make a backup copy of the configuration file before editing it so you can recover in case something goes terribly wrong.
If no options are found anywhere, then it may be a bug in the Windows version of Geany.
I was wondering if it was possible to run a selfwritten ruby program just like any other program by double-clicking an icon of some sort.
And if it's possible, how do I do it?
I wrote a little program for a friend but I don't want him to have to use the command line to run it, because that's rather inconvenient (unless there is a way to just double-click and the command line opens the program itself..).
Thanks for your help!
The simple answer that should work for all versions of Windows is to just create a simple batch launcher.
Create a .bat file. I usually just create a new .txt file via "right click > new > text document". Then rename it, highlight everything, including the extension, and rename it to something like run.bat. The .bat part is important. Once you rename it, the icon should change to gears. If you can't overwrite the extension, or Windows is still treating it as a text document, you'll need to either manually save it as a bat, or disable "hide file extensions" in the explorer settings so the extension can be changed.
Edit the bat file, and put into it something like:
#echo off
YOUR RUN COMMAND HERE THAT YOU WOULD NORMALLY TYPE MANUALLY
pause
Paste the command that you would normally run manually where the capital text is. The first line is so it doesn't repeat the commands back, and the pause is so if an error happens, the command prompt doesn't immediately close. This gives you a chance to read the error.
Save it and close it. Now, if you double click on the bat file, your program should run.
Multiple ways
if it's for occasional use and for one script only I would pack it
to a Windows executable with Ocra, then you can double click
the .exe itself or a link to it
same as above but use jRuby and create a .jar file, not for beginners though
the easiest: if you configure Windows to start/run .rb files with your ruby.exe you can double click the .rb files itself and they
will execute, they will have the red Ruby stone icon
if you run a .reg file to enable drap and drop on .rb files you can combine the previous technique to drop files on the script and
they will be the parameters to the script, see my answer here for the reg file
my favorite: copy the .rb to your windows "C:\Users\your_user\AppData\Roaming\Microsoft\Windows\SendTo\"
folder, then you can right click file(s) or folder(s) and select
sendto and select your script, the files or folder will again be the
parameters for your script
you can create a .bat or .cmd file that starts with the path to your ruby.exe and the script as parameter, use rubyw.exe if you
don't want output
I try to run script (.read FILE) that has UTF-8 strings. I used pragma command:
PRAGMA encoding="UTF-8";
But I get wrong characters.
If I create table and insert values by myself, everything works right. What should I do to run script properly?
By the way, I checked a lot of questions/articles on stackoverflow and other resources + read documentation. I tried some methods, for example, to use chcp 65001 in Windows cmd and then opened sqlite3 in current window. But it didn't help.
The PRAGMA encoding setting does not change how you use the SQLite API. And the encoding of an existing DB cannot be changed.
Don't use it.
The sqlite3.exe command-line shell does not work with UTF-8 characters. (Except maybe in the latest version.)
Don't use it.
If your own scripts and applications use strings encoded in UTF-8, and if you use any tool except sqlite3.exe to check the resulting DB, then it will work.
All you need to do is:
Open cmd and change encoding (chcp 65001)
Run sqlite3.exe from current windows
Change encoding (PRAGMA encoding="UTF-8";)
Create correct UTF-8 script.
There can be "This file came from another computer and might be blocked" message in file properties.
Is there a way to block back file in windows 7?
I need this for program testing.
You have to recreate the alternate data stream for the file. The easiest way to do this is by using Notepad. Run cmd.exe and navigate to the directory that contains the file. I'll use test.txt as an example, type this command:
Notepad "test.txt:Zone.Identifier"
Double quotes required. Notepad prompts you to create a new file, click Yes. Paste or write this:
[ZoneTransfer]
ZoneId=3
Press Ctrl+S to save.
When I open a file with vim or gvim from console on windows that is located in a sub directory (e.g. gvim subdir/file), it creates a new file at subdir\subdir\file saying "subdir\file" [New DIRECTORY] instead of simply opening the existing file at subdir\file.
This happens since I added the following line to my vimrc:
set enc=utf-8
Is there a possibility to open and create files in UTF-8 mode on Windows without this issue?
You may also look at my vimrc file.
Thank you for any help.
Change the order of the autochdir and encoding options in your vimrc. First set the encoding then autochdir
set enc=utf-8
set autochdir
An explanation can be found here