DBeaver SQL Editor: how to search/replace in only the current window? - editor

In the DBeaver SQL Editor, is there a way to search and replace only in the current script window? It seems like this should be simple and obvious, but to me it's not.
My search dialog looks like the below. I don't see how I can restrict the scope to just the current window (assuming I have multiple scripts open in different tabs). I also don't understand why the "Resource in active editor" option is disabled. I've explored underneath the "Working set", but there too it's not clear how to specify only the current window.
I'm running DBeaver v.21.0.1 on Windows 10.
DBeaver's File Search documentation page does not explain these search scope options.
DBeaver is such a great tool, but sometimes quite obtuse!

Have you tried Ctrl-F or "Edit > Find Replace"?
BTW, it took me a little while to figure this out too!

Related

Find features of a non Microsoft program

I'm not sure how to even ask this question, but let's say I have a program such as Google Chrome. How would I find out the "features" of it so I can use PowerShell to modify it.
For example, how would I have Chrome open a web page and click a button.
I know for IE, you can use $ie.document.getElementById("loginform").submit() to click a button.
Thank you,
Tony
You can't ever really get the same amount of control over non-Windows programs using Powershell.
In terms of Chrome, you could simply open the browser and go to a webpage with:
$Start-Process "chrome.exe" "www.google.com"
There is generally not that much more for further functionality, but with Chrome you may be able to do things like change settings and configuration. Check out the (large) JSON file Preferences and other config files, which you can find in Chrome's local appdata folder (Win+R, %localappdata%, Google/Chrome/User Data/Default). I'm not too sure but it may also be a bad idea to mess around with these files.
I also did a Google search and found this third party powershell tool for browsers, called Selenium. Here's the list of extensions.

Change help link in the Visual Editor of MediaWiki

Is there a way to change the help link in the toolbar dropdown in the new visual editor of MediaWiki?
I tried setting
"visualeditor-help-link":"mw:Help:VisualEditor/User guide/de"
in
"extentsions/VisualEditor/modules/ve-wmf/i18n/de.json"
as proposed here, but then my MediaWiki could not parse the JSON file. My goal is to link to the MediaWiki help page, that can be found here. The normal version:
"visualeditor-help-link":"[https://www.mediawiki.org/wiki/Help:VisualEditor/User_guide/de]"
did not work, neither did this:
"[[{{MediaWiki:visualeditor-helppagelink}}|Hilfe]]"
You should never ever change the source code of MediaWiki core or any extension. It makes an upgrade process much more hard and complicated. There are other ways to achieve a high customization of the user interface language :)
For your problem, it should be enough to create the following page in your wiki (like any other page, but you need the editinterface user right, which is assigned to sysops by default):
MediaWiki:visualeditor-help-link
Put the link you want to use into the textarea (without any wikitext, e.g. "Help:VisualEditor" (without any ")) and save the page.
After reloading the VisualEditor (maybe you need to clear your browser's cache using Ctrl + F5) the link should point to the new target you specified in the message above. If you use a message cache, it is maybe needed to rebuilt it.

Can I find out current typing co-ordinates in a notepad relative to desktop window

Is it possible for me to find out the typing co-ordinates (relative to desktop co-ordinates) in a notepad window from a Delphi application? For example, if we look at the below picture, I am typing on a notepad window. Can I find out the screen co-ordinates, where I am typing on notepad.
Edit
It would be helpful if someone can suggest a generic solution. Answer no1 speaks about notepad. How about a console window? Is it possible to figure out the co-ordinates, if i am typing on a console window?
I guess, if UAC would not disable it, you can implement the following sequence:
you have to learn the windows structure of the notepad. Using tools like WinSpy++, WinSight or ProcFS for Total Commander or whatever. And then you have to get the handle (HWND) of the actual editbox window. The topic of enumerating or finding other applications windows was discussed many times already on StackOverflow and on Google.
Then you have to ask the main edit window for it coordinates. See Get{Client/Window}Rect functions, see http://msdn.microsoft.com/en-us/library/windows/desktop/ms633503.aspx and http://msdn.microsoft.com/en-us/library/windows/desktop/ms633519.aspx Perhaps even better would be to SendMessage the EM_GETRECT custom message: http://msdn.microsoft.com/en-us/library/ms997530.aspx
Then you have to know the position of caret: like TMemo.SelEnd and TEdit.SelStart - again best way would be to just read how they are implemented in VCL. Probably that would be rooted in SendMessage(EM_GETSEL,...) - http://msdn.microsoft.com/en-us/library/ms997530.aspx - there is a ready example to do this
Then you would have to ask Widows for relative coordinates of that position - relative to the Client Rect you get in above steps. See EM_POSFROMCHAR message http://msdn.microsoft.com/en-us/library/windows/desktop/bb761631.aspx and Delphi sample at http://www.delphipages.com/forum/showthread.php?t=33707
However some claims that this does not always work reliably: http://vbcity.com/forums/t/14951.aspx so as last resort you can use hard-core string parsing, as described in version 1 of this answer.

jVi Visual Block Select

I'm trying to do a block selection using jVi in Netbeans. I cannot seem to get it working - there seems to be a lot of good info on this topic, however I'm not seeing the answer to my problem.
This is what I understand: to do a block select, you first enter visual mode and select some text. Then you hit Ctrl-V to enter block select mode? For me, Ctrl-V pastes the clipboard, so I found someone mentioned Ctrl-Q. I try that, but I cannot get text to select in a column using the arrow keys or the h,j,k,l keys. For me, it just does a regular selection grabbing the rest of the line, and the line below (if I move the cursor down) up to the cursor.
What am I missing?
jVi has options to specify which control keys are handled by jVi and which passed on to NetBeans for processing. Your description indicates that Ctrl-V is being handled by NB (not by jVi). In NetBeans look at
Tools > Options > jViConfig > Ctrl-Key Bindings
and enable/check the keys that jVi should process.
Make sure you're not in a special more before you start (just press ESC a few times). It's also possible that some of your jVi startup scripts are remapping those keys.
Ctrl-V is the default, but Ctrl-Q was introduces on gvim on Windows, to avoid confusing users who knew Ctrl-v is for pasting text. You can look at your key mappings by typing
:map
in command-mode. You can even do
:verbose map
to find out where each mapping was defined. I think that only lists user-set mappings, so it'll show you when Ctrl-V and Ctrl-Q were re-defined by a script.
This worked for me - combining both suggestions from above. In jVi settings page, enable Ctrl-Q and use it for classic Ctrl-V functionality. Do not enable Ctrl-V as it has too many side effects wrt handling of mouse selection buffer. Works nicely in this way for me with netbean 8.2.

Google Chrome Extension: Print the page silently

I'm developing an internal Google Chrome Extension that needs a way to initiate print the current page to the printer. I do not want the default Print dialog to come up (so, javascript:window.print() is out of question).
As far as I understand, this is not possible just with the JS + HTML plug-in, so I'm also open to using the NPAPI plugin also (with a dummy mime-type). And I'm concerned for Windows platform only.
I'm also open for various hacks / workarounds if possible, though a standard solution would be nice.
If you think this is not possible, let me know if you know any feature request logged for it?
Any suggestions/clarifications are welcome..
In chrome (v18+) we have the --kiosk --kiosk-printing switches. One can print automatically to default printer without print confirmation.
You can see it from this video http://www.youtube.com/watch?v=D6UHjuvI7IE
Since NPAPI allows you to create native C++ plugins that you can interact with through an object tag (which you can use from an extension), that would probably be the way to do it.
The tricky bit is that I don't know of a good way to get the bits for printing the page. The only person I know of who has done something similar to this actually got the window handle for the browser (available through NPAPI) and scraped the bits off of it to print that way, but that won't take into account print stylesheets or anything. You could also try using automation events to try to control the print dialog, but I have no idea if that would work or not.
By design, the browsers try not to let you do something like this, as it could open some serious vulnerabilities if any website could just start printing things to your printer without confirmation...
Anyway, if you find a way to do it with C++ you can use FireBreath to ease the creation of the NPAPI plugin.
There are various extensions that take snapshots of the current web page (for example, this one); you could adapt one to send the image to a printer via an NPAPI plugin.
I've recently been looking for a similar ability, and it seems like it would be quite possible using Chrome's new native messaging api.
https://developer.chrome.com/extensions/nativeMessaging
There are plenty of examples of this with C#, but here is one quick example of troubleshooting Chrome native messaging with a basic C# application
Native messaging from chrome extension to native host written in C#
I realize this may be a day late and a dollar short, but in case anyone else comes across this question, this is the solution that worked for me. From inside a C# app, you can directly print to installed printers using the PrintDocument class. If you figured out a way to get the page image, this would be far easier than using firebreath or NPAPI.
Disable print preview in Google Chrome on Mac
Quit Google Chrome
Launch Terminal on your Mac. (Search “Terminal” using the Search box)
Type defaults write com.google.Chrome DisablePrintPreview -bool true
Close Terminal and open Google Chrome
Disable print preview in Google Chrome on Windows
Close Google Chrome
From your desktop, right click Google Chrome
Click Properties
In the dialog box, add ‘ –disable-print-preview‘ at the end of the Target field sans the apostrophe (make sure to include the space before –)
Click Apply
Disable print preview in Firefox on Mac
In the address bar type “about:config” and press Enter.
Right click on the page, hover over ‘New’ and click on ‘Boolean’
Type ‘print.always_print_silent’ as the preference name and click ‘OK’
Click on ‘true’ and click ‘OK’.
Close the about:config window.
Disable print preview in Firefox on Windows
In the address bar type “about:config” and press Enter.
Right click on the page, hover over ‘New’ and click on ‘Boolean’ Type
‘print.always_print_silent‘ as the preference name and click ‘OK’
Click on ‘true’ and click ‘OK’.
Close the about:config window.
https://support.dryfta.com/how-to-disable-print-preview-in-chrome-firefox-on-windows-mac/

Resources