How to paste multiple environment variables in IntelliJ - intellij-idea

Is there a way to add multiple environment variables in IntelliJ? When one sends me a list of variables I can add them one by one by clicking + in this window
But it's quite annoying to do for 10 or 20 variables every time. I can copy all variables from Environment variables field but we cannot paste there. Is there any way to do it?

Yes, it's totally possible to paste all environment variables at once in this screen but they need to be in a specific format.
Click on the ... button to the right of environment variables to show the dialog you have in your first screenshot.
Now you can use the Paste button but the values in your clipboard have to be in a specific format for pasting to work. In your case that clipboard info would be something like this:
APP_PORT=8080
DB_URL=jdbc:mysql...
DB_USER=javausers
DB_PASSWORD=javausers
APP_LOGGING_LEVEL=DEBUG
Try copying the value above and use the paste button (not Ctrl+v). If you don't have your data in this format you can try formatting it using a text replace tool online.
Also if you select all of the values in that dialog and click the copy button you can get the values in the same format that will work with importing. Warning: clicking Ctrl+c will not copy the values in the same format as the copy button in the dialog.

You could use "Paste" button at the bottom of the variables list.

Yes, just:
Click on the three dots (...) button of the Environment variables option. On the Windows version, the button is a little folder icon.
Select all the variables on the showed popup (name and value) and click on the "Copy" button. Close the popup.
Choose the other configuration, open his Environment variables option and click on the "Paste" button.

I am not sure if the (...) option is available in the community edition also.
This is how i was able to add them to the configuration. Just select the environment variables you want to import into the desired configuration.
E.g: If you have variables like
min_instance_count: 1
max_instance_count: 2
min_memory: 2
max_memory: 2
Replace the colons/other delimiters with = :
min_instance_count= 1
max_instance_count= 2
min_memory= 2
max_memory= 2
Now import the variables by copy-pasting (the clipboard sign).

You can simply paste a ; concatenated list of environment variables (and their values) into the Environment Variables dialog box.
E.g. paste in:
AWS_DYNAMO_ENDPOINT=http://localhost:4569;AWS_REGION=us-east-1;sample_var=sample
and get:

Related

In TOAD, is there a way to comment out arbitrary blocks of code (i.e not whole lines)?

The shortcut to comment out code in TOAD (11.6.16) is CTRL+B
However, the problem is that it does not let you comment out an exact selection within a block of code. So, when I press CTRL+B it simply comments out all the lines of the code , so I can't comment out a specific column with /* .. */ via keystroke.
Is there a way to run the arbitrary /* .. */ commenting ?
Not exactly, but you can get there by a lesser known feature. The Search and Replace macro. In the Editor hit Ctrl+R to get to the replace dialog. On the toolbar click the right-most button to get to the macro editor. Copy the entire contents, below, and paste into that dialog within the left side tree. It'll create a macro for you that I made. Hit close, etc. to get out of that dialog. Now, in the editor whenever you make your selection you can invoke this by using the little dropdown next to the replace button on the Editor toolbar. It's not exactly as easy as using keyboard shortcut, but it works and Search/Replace macros are super powerful for more complex work. Here's the dropdown I'm referring to.
Here's the code to copy/paste. Grab everything from (and including) "object" through to (and including) the "end"
object TComponentCollection
Items = {
545046300F5474645265706C6163654D6163726F000B446973706C61794E616D
65060D436F6D6D656E7420426C6F636B0D49676E6F72654661696C757265080A
4D6163726F47726F7570080C5365617263684F726967696E070D736F456E7469
726553636F70650C577261705365617263686573080F50726F6D70744F6E5265
706C616365080A5465787446696E6465720A9C000000545046300F5474645465
78745265706C61636572000D4361736553656E7369746976650811526567756C
617245787072657373696F6E090A5365617263685465726D0606283F73292E2A
0F536561726368446972656374696F6E07097364466F72776172640A57686F6C
65576F726473080B5265706C6163655465787406062F2A24302A2F135265706C
6163655769746854656D706C617465080000054974656D730A32000000545046
301F547464437573746F6D5365617263685265706C6163654D6163726F4C6973
7400054974656D730A0000000000000000}
end

Copy tabs/sheets from one workbook to another with macro/vba code (1 button)

two (hopefully) easy questions -
Can I copy 2 tabs from File1.xlsm to a master.XLSX file and still run the macro code? I assume not?
Assuming I cannot do #1, can I copy the 2 tabs into another master.xlsm file? If so, please help I've tried the following.
File1.xlsm just has a grid with a 1 button that calls 'File1.xlsm'!getData which populates the grid.
I was able to right click the tabs in File1.xlsm and move/copy them successfully into master.xlsm but without the vba getData Sub(). When I click the button it said it couldn't find the !getData code. Is there a clean way to copy the 2 tabs, and !getData macro code into the Master.xlsm?
Thanks a bunch in advance!
To accomplish this task, you should consider adding the relevant code into a module within your File1 workbook. You will need to enable the Visual Basic extensibility within your File1 workbook library.
You would then need to copy the module along with the two sheets into the new workbook. You would do this with commands similar to the following.
ActiveWorkbook.VBProject.VBComponents("module1").Export Path
SomeWorkbook.VBE.VBProject.VBComponents.Import Path
Where path is a string variable to a place where you would like to place the module, and someworkbook would be your Master.xlsm workbook object.
with ActiveWorkbook.VBProject
.VBComponents("sheet1").codemodule.addfromstring .VBComponents("Sheet1").codemodule.lines(1,.VBComponents("Module1").codemodule.CountofLines)
end with
sheets(array("sheet1","sheet2")).copy

How to select all instances of a variable and edit variable name in Sublime

If I select a variable (not just any string) in my code, all other instances of that variable get a stroke (white outline) around them:
Is there a keyboard shortcut that will let me select all of those instances of the variable and edit them all at once?
Things I've Tried:
⌘D, ⌘K, and ⌘U lets me select them one-by-one, but I have to manually exclude the non-variable string matches:
And using Ctrl⌘G simply selects all the string matches:
Clearly, Sublime is able to differentiate between variable and string matches. Is there no way to select just the variable matches?
Put the cursor in the variable.
Note: the key is to start with an empty selection. Don't highlight; just put your cursor there.
Press ⌘D as needed. Not on a Mac? Use CtrlD.
Didn't work? Try again, making sure to start with nothing selected.
More commands:
Find All: Ctrl⌘G selects all occurences at once. Not on a Mac? AltF3
Undo Selection: ⌘U steps backwards. Not on a Mac? CtrlU
Quick Skip Next: ⌘K⌘D skips the next occurence. Not on a Mac? CtrlKCtrlD
Sublime Docs
I know the question is about Macs, but I got here searching the answer for Ubuntu, so I guess my answer could be useful to someone.
Easy way to do it: AltF3.
Despite much effort, I have not found a built-in or plugin-assisted way to do what you're trying to do. I completely agree that it should be possible, as the program can distinguish foo from buffoon when you first highlight it, but no one seems to know a way of doing it.
However, here are some useful key combos for selecting words in Sublime Text 2:
Ctrl⌘G - selects all occurrences of the current word (AltF3 on Windows/Linux)
⌘D - selects the next instance of the current word (CtrlD)
⌘K,⌘D - skips the current instance and goes on to select the next one (CtrlK,CtrlD)
⌘U - "soft undo", moves back to the previous selection (CtrlU)
⌘E, ⌘H - uses the current selection as the "Find" field in Find and Replace (CtrlE,CtrlH)
This worked for me. Put your cursor at the beginning of the word you want to replace, then
CtrlK, CtrlD, CtrlD ...
That should select as many instances of the word as you like, then you can just type the replacement.
The Magic is, you have to start with an empty selection, so put your cursor in front of the word/character you want to multi-select and press Ctrl+D .
To me, this is the biggest mistake in Sublime. Alt+F3 is hard to reach/remember, and Ctrl+Shift+G makes no sense considering Ctrl+D is "add next instance to selection".
Add this to your User Key Bindings (Preferences > Key Bindings):
{ "keys": ["ctrl+shift+d"], "command": "find_all_under" },
Now you can highlight something, press Ctrl+Shift+D, and it will add every other instance in the file to the selection.
As user1767754 said, the key here is to not make any selection initially.
Just place the cursor inside the variable name, don't double click to select it. For single character variables, place the cursor at the front or end of the variable to not make any selection initially.
Now keep hitting Cmd+D for next variable selection or Ctrl+Cmd+G for selecting all variables at once. It will magically select only the variables.
It's mentioned by #watsonic that in Sublime Text 3 on macOS, starting with an empty selection, simply ⌃⌘G (AltF3 on Windows) does the trick, instead of ⌘D + ⌃⌘G in Sublime Text 2.
At this moment, 2020-10-17, if you select a text element and hit CTRL+SHIFT+ALT+M it will highlight every instance within the code chunk.
Just in case anyone else stumbled on this question while looking for a way to replace a string across multiple files, it is Command+Shift+F

Is there a shortcut for selecting word under cursor in Sublime Text, Atom

Is there a shortcut or a command to select word under cursor in Sublime Text or Atom? I want a replacement for double-click. So I could press shortcut instead and get selection on a current word and start typing to replace it or get in quotes etc...
command+d on OSX
control+d on Windows/Linux
You can find all the default keybindings by going to Preferences > Keybindings - Default and perusing the list.
You can add a key binding to select the word:
{ "keys": ["ctrl+shift+w"], "command": "expand_selection", "args": {"to": "word"} }
Unlike the find_under_expand command (control+d by default) repeated presses won't add cursors at matching words.
install ExpandRegion if you want to expand the selection:
Expand selection to word
Expand selection to quotes (content only)
Expand selection to quotes (with quotes)
Expand selection to complete self closing tag
Expand selection to parent node content
Expand selection to complete node
Expand selection to parent node content
I looked around for this and eventually came up with this, which I assigned to ctrl-F
you need to paste it into a new user plugin python file
import sublime, sublime_plugin
class find_under_cursor(sublime_plugin.WindowCommand):
def run(self):
view = self.window.active_view()
view.run_command("expand_selection", {"to": "word"})
view.run_command("slurp_find_string")
self.window.run_command("show_panel", {"panel": "find", "reverse": False} )
With Vim bindings (Vintage or vintageous)
* - to find next
# - to find last
For both, all matches are highlighted
Without Vim bindings
For current file: CMD+E, CMD+F, Enter
Explanation:
CMD+E - copies the word under cursor
CMD+F - bring up find in local file dialogue
Enter - er you know what this means
Substitute CMD+F for CMD+SHIFT+F to find in all files in project (or whatever search range you specify)

Import Data Wizard Does Not Like Data Type I Choose For A Column

Does anybody else have this same problem, when you import data from Excel file to MSSQL Server 2005, if some column contains mostly numeric data, but even if you set the column type to varchar, the wizard fails to import those fields that fail to parse as numbers?
Try this (Note: These instructions are based on Excel 2007)...
The following steps should force Excel to treat the column as text:
Open your spreadsheet with Excel.
Select the whole column that contains your "mostly numeric data" by clicking on the column header.
Click on the Data tab on the ribbon menu.
Select Text to Columns. This will bring up the Convert Text to Columns Wizard.
-On Step 1: Click Next
-On Step 2: Click Next
-On Step 3: Select Text and click Finish
Save your Excel sheet.
Retry the import using the SQL Server 2005 Import Data Wizard.
You need to edit the connection string that SSIS uses. Add this to the end of the string "IMEX=1;" (No quotes) That tells SSIS/jet to not try and figure out what the data types are. Just import them.
You might try tweaking Jet settings for importing Excel data. You can force the Jet engine to sample the entire sheet when trying to determine the column type during a given import. Change the following registry key (after making a backup first) and see if that doesn't do it:
HKLM\Software\Microsoft\Jet\4.0\Engines\Excel
Or on x64
HKLM\Software\Wow6432Node\Microsoft\Jet\4.0\Engines\Excel
Set the value TypeGuessRows equal to zero. This will force Jet to sample all rows to determine the column type.
Create a new column that is an apostophe + the contents of the column you want to import. This will force it to be a string
="'"&E2
Adding IMEX=1 BEFORE the HDR setting worked for me.
This is the best solution:
Click File on the ribbon menu, and then click on Options.
Click Advanced, and then under When calculating this workbook, select the Set precision as displayed check box, and then click OK.
Click OK.
In the worksheet, select the cells that you want to format.
On the Home tab, click the Dialog Box Launcher Button image next to
Number.
In the Category box, click Number.
In the Decimal places box, enter the number of decimal places that
you want to display.