Ant database rebuild script, avoiding interactive prompting - sql

I'm writing an ant script to rebuild our database i.e. dropping everything and rebuilding from scratch. The problem our DBA adds a Y/N prompt before executing the rest of the script, and therefore we can't call this from an automated build process.
Does anyone have any suggestions to circumvent the Y/N prompt? Obviously we could create separate scripts, one for the DBA's and one for the automated build - but this requires maintaining both. We're running on Windows so it's not as easy as using sed to strip out the prompt...but I'm thinking something along those lines.
Not sure if that's clear enough but hope you can help.
Cheers.

Maybe Expect would help?
http://en.wikipedia.org/wiki/Expect

Seems like the DBA should be thinking more automation and make the script not pop up a gui yes no dialog. How about they make the yes no a command line option. I think you can jump through hoops to get past this, but push the work on the part of the process that needs to be reworked.
Take a look at AutoIT
This will let you possibly find the dialog and the yes button and automate the clicking. But I still say the DBA should move away from the GUI for this yes no input.

Related

Sizeable screenshot UI code

I am in need of someway to access the UI for the screenshot command in OSX (Cmd+Shft+4) and I would like to be able to activate the UI with a UI button that will screenshot the region selected and save it to a temp location.
Thanks in advance ;)
If there's a direct way to do this from Cocoa, maybe someone will chime in... but I doubt it exists. You can, however, get any behavior you want from the "screencapture" command line utility; it does exactly the same as Cmd-Shift-3 or 4 with a gazillion options. Just type "man screencapture" in Terminal to see all the flags.
But this would require you to run a bash script from your app. If you haven't done that before, well, google it, or check out the many threads here on SO... Opinions vary on how complicated it should be, from a one-liner call to system() to fully thread-safe error reporting NSTask and all kinds of answers in between.
I'd recommend using one of the NSTask answers which keep themselves to half a dozen lines, but YMMV.

Can you set Flash Builder to kill previous runs when starting a fresh run?

I'd like Flash Builder to kill previous run instances when I run/debug.
It's driving me nuts that I can easily accumulate multiple instances of my project running outdated code if I don't go through and kill them individually each time I run.
Thank you
This is the best answer I was able to find thanks to Lee Burrows:
There is an unbound keybinding called "Terminate and Relaunch" in the general preferences which will terminate the run/debug that is currently connected to the debugger and start a new instance. So if you only use this you can avoid accumulating outdated instances.
Putting this as an answer, but I hope someone can make something that doesn't require a change in flow (still be able to use the debug button), and this will also not kill multiple instances if that somehow still happens.

Can I run fsx files from within Visual Studio without setting up a project?

I want to use F# for some very basic tasks for which I previously used batch files. I can associate fsx files with fsi.exe and run it just by double clicking them. That's great so far.
However, sometimes I might want to dive into the code deeper and debug things. When I open the fsx file within Visual Studio I can't run it and I also can't select the lines and use "Send to interactive", though.
It seems to me as if those commands only work if you set up a full F# project. That seems to be cumbersome (as an batch file replacement). I wonder which is the right approach? I want to have my cake and eat it! I want a simple file that I can change quickly but I also want the ability to use the analyze things with Visual Studio on demand.
UPDATE
I just figured out you can open the interactive console at "View\Other Windows\F# Interactive" and after that you do have the "Send to Interactive" command.
I'm still lacking the ability to run the code and set breakpoints, though..
As you already discovered, you don't need to create project to use the F# Interactive console.
I believe that features like debugging are a lot less important when you use F# for interactive development (or scripting), because you can quite easily evaluate code step-by-step to analyze its behaviour just by sending individual commands to FSI. So I don't feel the need for debugging in F# Interactive very often.
Although this isn't really a supported feature, you can debug code in a script file when using just F# Interactive. The trick is to attach the debugger to the fsi.exe process that's running behind the F# Interactive.
Just go to "Debug" -> "Attach to Process" and then select "fsi.exe". Then you should be able to place brakepoints in the fsx script file and the code running in F# Interactive will break. As I said, this is not really supported, but it generally works well for code in functions. I don't find this as useful often, but it may be useful now and then.

Existing solutions to test a NSIS script

Does anyone know of an existing solution to help write tests for a NSIS script?
The motivation is the benefit of knowing whether modifying an existing installation script breaks it or has undesired side effects.
Unfortunately, I think the answer to your question depends at least partially on what you need to verify.
If all you are worried about is that the installation copies the right file(s) to the right places, sets the correct registry information etc., then almost any unit testing tool would probably meet your needs. I'd probably use something like RSpec2, or Cucumber, but that's because I am somewhat familiar with Ruby and like the fact that it would be an xcopy deployment if the scripts needed to be run on another machine. I also like the idea of using a BDD-based solution because the use of a domain-specific language that is very close to readable text would mean that others could more easily understand, and if necessary modify, the test specification when necessary.
If, however you are concerned about the user experience (what progress messages are shown, etc.) then I'm not sure that the tests you would need could be as easily expressed... or at least not without a certain level of pain.
Good Luck! Don't forget to let other people here know when/if you find a solution you like.
Check out Pavonis.
With Pavonis you can compile your NSIS script and get the output of any errors and warnings.
Another solution would be AutoIT.
You can compile your install using Jenkins and the NSIS command line compiler, set up an AutoIT test script and have Jenkins run the test.

How to write and execute programs in terminal/command prompt?

For example:
http://www.youtube.com/watch?v=tKTZoB2Vjuk (# 5 min)
I have no idea how one would go about writing code and making it work without an IDE but it seems like a useful thing to know how to do. Thanks!
Open an editor. Edit the code. Invoke the compiler. Run the executable.
Can't say much more without further details on your part.
What they're showing in the video though is the Python REPL.