In Visual Studio Code, can I start a debugging session with custom arguments without editing settings.json? - visual-studio-code

I'm building a program that acts on files that it has to download from one of my company's servers. We have several million of these. For instance, my normal invocation could be:
python my_script.py file-id
And then my_script.py will go download file-id and do its work on it.
It's useful to be able to specify one fixed file to download and act on while I make changes to our code, but when it comes to testing at scale, I'll usually find out that maybe a dozen files couldn't be processed correctly, and I need to go and debug our program with it.
For this purpose, editing the settings.json file works, but it's kind of cumbersome that I have to change the parameter, save, run, and revert every time I just want to test a new input.
Is there a way that I pass an argument to a debug configuration as I start debugging, instead of having to change the settings.json file?

Related

Interactive Perl programming in Sublime 3 (Ubuntu)

Practically all of the exercises in my introductory Perl book have so far required taking input, which is causing me some challenges with Sublime Text 3. I set up the custom build file from this post to run scripts directly and I've also installed REPL on top of that, but I'm still unable to provide input through the bottom console.
Is there a way to enable input for scripts built via Ctrl+B, preferably with the console messages getting a little less in the way? I'm currently stuck with having to fire up the terminal every time, which doesn't make for a particularly smooth learning experience.
This doesn't really help you with your Sublime issue, but you mention firing up a terminal every time isn't helping you learn - here's the way I do it when I'm either learning or rapidly prototyping: Simply setup a folder on your local machine, called sync or something. Create a similar folder on your terminal server.
Now use an app (I use WinSCP and use Keep Remote Directory Up To Date setting) to sync. Every time you press save in your text editor, the new script is automatically uploaded to your terminal server, you can now just alt+tab to your terminal and run the script. Works very well for me and enabled really easy rapid prototyping.

Changing Code At Runtime While Debugging

I am using Eclipse Kepler Service Release 2 , EPIC 0.5.46 and Strawberry Perl 5 version 18 for perl programming. For debugging I am using Eclipse debugger and PadWalker .
I have an interactive perl program that writes to files based on answers provided by the users to multiple prompts. While debugging , every time i change a single line of code I have to rerun the whole program again and provide inputs to every prompt , which is really time consuming.
Is there a way to make changes to the code in a sub routine , in the middle of debugging session such that the instruction pointer resets itself to the first line of that sub routine. This way i do not have to restart the session to recompile the new code.
Appreciate your inputs and suggestions. Thank You!!!
What you want to do can be done, and I've done it many times in Perl myself. For example, see this.
However although what you describe may work (and is a bit dangerous), the way it is generally done a bit different and safer.
First one has to assume a regular kind of command structure like a command processor, or say a web server.
In a command processor or web server, you read a command (or get a web request), perform an action, then read another command, perform another action and so on. From your description, it sounds like you have such a structure.
In my case, I have each debugger command stored as in Perl file. This is helpful not only for facilitating this task, but also for understanding, testing and changing the code.
Given this kind of program structure, instead of trying to change the program counter, you complete the command and at the level where you are about to read a new command, you make the change and then reload the file which changes the code.
The specific Perl construct to do this is called do. Don't use require or use which will load in a Perl file only if that file or module hasn't been previously loaded. In your situation, you want to reload even if it has been loaded before.
So now how do you get to be able to issue a do command? As you suggest, you could do it through a debugger. Assuming you have this overall program stucture as described above, you put the breakpoint somewhere a common point in the caller which loops over things to process, rather than try to change things in indvidual commands.
And you don't even need a debugger to do this! Many web frameworks like Ruby on Rails, have a "development" mode where they save timestamps on files that implement functionality. If the file has changed they issue the "do" command before running the request.

How to open multiple files and edit them in eclipse

I'm using Practically Macros, but maybe there is some better Eclipse macro player for this task?
I run some commands on huge amount of files.
How do you open all files from a folder - one at a time - recursive, then do some commands on them?
Also is there some better fix for using the save command if there were no changes made? Like only save if changes where made. Now it generates an error so I write an character and then remove it to always be able to save.
I know how to do the file editing, but I first must open the files manually and it takes alot of time because if I select multiple I can't use the open with (Progress OpenEdge AppBuilder (OpenEdge UI Designer) is default and I don't want that but thats not the point here).
Practically Macro example:
*file editing, many commands*
Insert string: -
Delete previous character
Save
Close
Play last macro
This edit all the currently opened files like I want them (beautify).
This generates an error when there is no more files to close. How to fix?
So my macro/progress questions where:
Is there a better macro player for eclipse than Practically Macro?
Is there a way to use the save command only when needed?
Is there a way to not get errors when all files are closed? Or a way to detect when the recursive loop should end.
Is there a way to open multiple files with in Progress Developer Studio in text mode?
Is there a way to recursive open all the files in a folder (one at a time and open with OpenEdge ABL Editor) with macro?
This version of Practically Macro had semi-usable Eclipse macro support for my current version of Eclipse (Mars). Another option that seems to take a more official approach, but hasn't seemed to get much traction yet, is EASE.
If you do these kinds of tasks regularly, you could script things externally, in perl or Node.js or any other of the dozens of high-quality scripting languages out there.
WARNING: there appear to be two older versions of Practically Macro you might stumble upon. One is also on the Eclipse Marketplace but not marked with the trailing "-0". There is also another older one on SourceForge.

Talend studio tWaitForFile issue

I am using a tWaitForFile component from a Talend Studio Project and I want to know if there is a way to be sure a file to trig the event when this file is fully written on disk.
I tried to set the advanced property : "Wait the file to be released"
but it seems this is useless, the file trigs the component even it is not finished to be transmitted.
Does anybody have the same behaviour and a solution to fix that?
The version of Tos is: 4.2.3
The advanced setting "Wait for file to be released" only works on Windows. It has no effect on Unix, which probably explains why it did not work for you.
It is generally difficult, or even impossible, for a Unix process to figure out if a file has been written completely or not. Consequently, there is no easy way to do this in Talend, either.
(For example, if you wanted to wait until the file size does not change anymore -- how long do you wait?)
A common solution involves the process writing to the file: Create the file under a different name first, and when it is written completely, rename it to the name that the other process expects. That way, it will show up in its full size immediately.

Making and Interfacing with Custom Services

I've been searching for this for awhile now, and I am not sure if I am just not using the correct search terms or if the answer is really that hard to find.
What I am trying to do is to create a new Windows service for a game server from a batch file, and then have a task run another batch file every 30 minutes or more that would run two commands on the game server's command line and do some file work.
Specifically, I am running a Minecraft server using Bukkit for a gaming community I help run, and I want to make sure that the thing is always up unless I specifically tell it to stop (like a service). Bukkit is run directly from a batch file and has it's own command line thing running on it.
I am told that you CAN run this type of thing as a service, but the command line will be hidden from view and/or interaction. This is the second part of my query. I have a handy little backup.bat file that copies all the world files and userdata files into a backup directory, 7zips it, and deletes the directory. The only thing is, is that Minecraft likes to always have the worlds' region files open and writing at all times, meaning that it could cause map corruption if I just run it straight off. To compensate, I need to run the command "save-off" on the server to disable the file hooks temporarily, run the backup, and as soon as it finishes, run "save-on" so that the game can continue without lost data.
What I would like to know about this second one is, is it possible to interface with the game service through a batch file, or do I need to create an application to do that? If the latter, how exactly does one go about doing that? I have moderate C++ knowledge (up through my second OO-C++ course in college), and can possibly learn another language if absolutely necessary.
So, in short, two questions:
1. Is it possible to, and how to run a BAT file as a Windows Service?
2. How to interface with said service via BAT files, and if not possible, what kind of application do I need to write (redirection to or writing a tutorial works for me).
Thank you in advance for any and all help!
Old question, user account doesn't seem active on SO anymore, but hey, if you stumble upon this because you have a similar problem:
Since we are speaking about a Bukkit Minecraft server, turn to the "Essentials" plugin for Bukkit.
It now includes a Backup function that does exactly what the OP asks for, namely stop the save so the files can be manipulated without corruption, launch a script, then starts again.
The script can be a backup one (examples provided in the linked page) but can be used to run any operation on the world's files.