Eclispe RCP: Invoke Save all from within my code - save

I want to invoke the save all command of my eclispe rcp from within my code. I spent like an hour without any ideas.. this cant be that hard?

You can use the saveAllEditors command
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
page.saveAllEditors(true);

Related

date variable in TFS

I am trying to create a variable in TFS for my task for timestamp in format yyyymmdd. I know that I create a task specifically for this using bash or powershell. However, I am looking to find some existing variable or some way to create this variable without having to setup a task dedicated for itself.
So far I have tried to use $(Date:yyyymmdd) in my variables but it does not put values in it, it uses variable name as is.
For example, C:\Alpha\beta\$(Date:yyyymmdd) instead of C:\Alpha\beta\20191107
Can anyone help me with this ? Thanks a lot
Actually, it is hence not expanded. We do not have this kind of system or environment variable which get current date time and work every. You may have noticed you could use $(Date), however which is only available in the Build number format section. Others such as $(Rev:r) and $(DateOfYear) are the same, do not work outside the BuildNumberFormat-Settings..
Take a look at the list of all system and environment variables here: Predefined variables
As you have pointed out, you need to use a script in a PowerShell Task to set a variable in your build definition, a sample:
$date=$(Get-Date -Format 'yyyymmdd');
Write-Host "##vso[task.setvariable variable=time]$date"
Then you can use $(time) in your subsequent build tasks.
More details also take a look at this similar question: VSO(TFS) - get current date time as variable

Can I force applescript to run synchronously?

I'm writing a simple applescript script for iTerm2 that generates a bunch of tabs and starts running services within them (I have a lot of microservices, and all need to be running to test things locally).
Things are mostly working, however I'm experiencing some slightly odd behavior which I think is related to applescript sending commands early. Let's look at a concrete example:
create tab with default profile
tell the current session
write text "cd services/myservice"
write text "make build-docker"
write text "make run-docker"
end tell
In theory, this chunk should
1) Create a new tab
2) Change into a new directory
3) Build a docker image and
4) Run that docker image.
This will occasionally work, but more frequently I run into problems on step 4. Specifically, I'll check the tab only to find out that 'make build-docker' was the last command run. This command takes some time, so I'm assuming "make run-docker" is sent while build is running and is ignored. Is there a way to force applescript/iTerm2 to wait for this command to finish so that run is executed correctly?
Hopefully this is clear. Thanks for reading!
If you have iTerm's shell integration enabled, you can poll is at shell prompt to determine if the command has finished:
tell application "iTerm2"
tell current window
create tab with profile "BentoBox"
tell current session
write text "sleep 5"
repeat while not (is at shell prompt)
delay 0.5
end repeat
write text "sleep 5"
end tell
end tell
end tell
Otherwise, you will want to string all the commands together in one tell:
write text "cd services/myservice; make build-docker; etc; etc; etc.."
Or place them in a shell script and execute that:
write text "my_super_duper_shell_script.sh"
Or use AppleScript to write the cmds to a tmp file and execute that:
re : How can I create or replace a file using Applescript?

How to set explain option?

If you issue this command to informix server, the server will just generate explain and won't run the query. Great feature if your query doesn't end at all.
SET EXPLAIN ON AVOID_EXECUTION;
If you issue this command to informix then the Explain file will be generated at that location .
SET EXPLAIN FILE TO 'c:\temp\sql.out';
But, I need both options on and I can't figure out the syntax for doing that. If I execute both statements then the latter overrides the former.
Execute first the SET EXPLAIN FILE TO 'c:\temp\sql.out';, this way you set the target.
Then you change to avoid execution : SET EXPLAIN ON AVOID_EXECUTE;;

Display output from a Symfony task on a template

I am executing a task from an action in Symfony. I wish to capture the output from the task & display it to the (admin) user. Do I extract it from the dispatcher / log or somewhere else?
This might not be the answer you're looking for, however, in a task you can log to a seperate file like so (within the execute function in the task class):
$fileLogger = new sfFileLogger($this->dispatcher,
array('file' =>$this->configuration->getRootDir().'/log/foobar.log'));
$this->dispatcher->connect('command.log', array($fileLogger, 'listenToLogEvent'));
And then in your task when you use:
$this->logSection('something', 'Log whatever message you want....', 1000);
It will automatically log to the custom log file.
Hope this helps. :-)
Why not just perform the task within the action - and format the output in the template ? why are you running a separate task from an Action ? (i know this thread is old)

Passing constants as arguments in INNO's Exec()

I have created an installer using Inno Setup in which I am executing an exe that I created to create a small service inside Windows XP. I need to pass two arguments to the exe - "-install" and the path of the installation directory. I have no way of expanding the constant {app} to pass the actual value inside of {app}. Is there some way of doing this?
Thanks
I do not really understand what you want, but maybe you are seeking the ExpandConstant function?
This should work:
[Run]
Filename: {app}\MyApp.exe; Parameters: "-install {app}";
I've done it before using InnoSetup and it puts the correct value for {app}.
If you are still having problems, please post your code.

Resources