Dymola conversion script, run script manually - updates

I have a library without annotation (uses(Modelica(version="X.Y.Z"))); in the top level package.mo file. Can I manually execute the conversion script to update my library? And where is it located? I am using Dymola.

Conversion scripts are usually located in the Resources folder of a library.
E.g. for the MSL 3.2.3 shipped wit Dymola 2020x, you can find them here:
C:\Program Files\Dymola 2020x\Modelica\Library\Modelica 3.2.3\Resources\Scripts\Dymola
To manually apply a conversion:
Open a fresh Dymola window
Run the conversion script
via the GUI with Run Script in the Simulation tab
or from the command line with RunScript("path/to/conversion.mos")
Open the library to convert
Dymola will directly apply the conversions and you will not see the usual conversion dialog. Check the log window to see what was converted.

Related

PyCharm Tests Add Shell Command to Additional Arguments

I'm still pretty new to running anything in PyCharm more advanced than just a simple script. I'm writing a test in pytest right now and I want to have the test results output to a junit xml file; I'm thinking the best naming convention will be based on the current date/time, so I am trying to pipe in the current date using the date shell command as an environment variable as seen below:
Current Configuration:
However, when I run the configuration as-is, it just names the .xml file based on the command without actually executing it. Any ideas what I'm missing, or if this is even possible?
Thanks!
Yes, it is possible with a workaround. I don't think what you are trying to achieve is possible using a single configuration. The the value you set in Environment variables are substituted as-is and wouldn't be executed in bash prior to that.
The workaround would be use multiple configurations.
Store the following line in a bash file.
export PYTEST_EXEC_TIME=$(date '+%Y-%m-%d%H:%M:%S')
Add a bash configuration to which executes this file.
Add that configuration to the pytest configuration as a "Before Launch" configuration and use the $PYTEST_EXEC_TIME in the additional parameters.
Note: Here is a detailed answer showing step by step process of setting up a "Before Launch" configuration.

How to run JM reference software using visual studio 2010

I have downloaded the H.264 source code and I can view it in Visual studio 2010. I don't know how to run the JM Reference software. How can I do that, and how to view the output?
First of all right click on the project in VS and rebuild solution.
After that from command prompt go to bin folder of JM reference software.
Which is in JM->bin.
Now write lencod.exe in command prompt.
This will run your encoder for default video file selected in encoder configurations. And same goes for decoder that is ldecod.exe.
For other encoding/decoding parameters read manual.
These slides will also help you to get started.
Firstly, I recommend you to download the latest JM reference software for H.264/AVC form this link. After downloading just click on jm_vc11.sln file (solution file) and it will open in Microsoft Visual Studio (MVS) as this:
Solution Explorer Image in MVS
Then from toolbar menu, click on Build>Batch Build and you will see something like this:
Batch Build in MVS
Then click on Rebuild button and it will compile and build all of the projects of this solution in your current folder. After seconds or so, you can go through a folder called "bin" in the current folder. In this folder you see lots of config files which are in .cfg format. Please open encoder.cfg file and you can see all the encoder configuration for you H.264 codec and at first lines of it there is InputFile name, FramesToBeEncoded, FrameRates and the deafult values is as this picture. Just please make sure the file "foreman_part_qcif.yuv" existed in the bin folder. Then just open command prompt (type cmd in windows search bar) and go to the current directory>bin folder where you can see lencod.exe file. Type this in your command line: "lencod.exe -d encoder.cfg" and it will encode your InputFile and generate test_ref.yuv as a reconstruction file that you can see the result of your encoding process. Also you can see your .yuv files using third-party apps like "yuvplayer". For decoding, Please open bin>decoder.cfg and check that the inpuFile is "test.264" and the output is "test_dec.yuv". Then in command prompt type: "ldecod.exe -d decoder.cfg" and the decoded output file will be generated as "test_dec.yuv" which you can play it in yuvplayer, for example.
For more details about the parameters of encoders and decoders please check the documentation file in your currnet directory>doc folder.

Loading icon from kit using twapi

I have a tcl script named main.tcl in a folder called App. One of the lines in the script uses a command from the twapi module (that line is actually in a proc and I'm trying to minimize the app to system tray when a user closes the app through the 'X' window button):
package require twapi
# ... code here
set hand [twapi::load_icon_from_file tclkit.ico]
# ... code here
The file tclkit.ico is in the same directory as the script (i.e. in the folder App).
When main.tcl is run through wish, the script works without any issues, but after wrapping it into an executable through command line,
> tclkit sdx.kit wrap App -runtime tclsh863.exe
the executable raises an error, notably that the icon file could not be found:
The system cannot find the file specified.
The system cannot find the file specified.
while executing
"LoadImage $hmod $path $type $opts(width) $opts(height) $flags"
(procedure "twapi::_load_image" line 18)
invoked from within
"twapi::load_icon_from_file tclkit.ico"
(procedure "min_to_tray" line 2)
invoked from within
"min_to_tray"
(command for "WM_DELETE_WINDOW" window manager protocol)
The current workaround right now is to have a copy of the tclkit.ico file in the same directory as the .exe but I want to avoid that as much as possible and only have the standalone .exe file. I tried using the full path with:
set hand [twapi::load_icon_from_file [file join [pwd] App.exe tclkit.ico]]
which normally works when I want to read a file (.txt, .png files, etc.) within the .exe, without success.
So basically, is there a way to enable the .exe to load the .ico file from within itself or another workaround that will not require some dependence on a file outside the .exe app?
The core issue is that the relevant Windows API actually takes a filename, and not something that it's more easy to wrap loading-from-archive around (such as a buffer). This means that you have to copy the file out of the archive somewhere and then pass that name to the system call. This is in fact what Tcl does internally for load when it's pulling the DLL from a source that isn't directly visible to the OS; it doesn't do it automatically for TWAPI though, as that library takes the philosophical position of being just a thin wrapper and letting the caller handle the consequences (which does mean you can easily do more tricks, provided you're inventive).
I suggest copying the file to a temporary file somewhere (i.e., the standard location for these things; Tcl 8.6 has file tempfile to help with this sort of trick) and then passing the full filename into the TWAPI call. I think everywhere in the Windows API that you could pass a simple filename in, you can also pass a full filename. (That's actually very convenient…)

Zip the contents of a folder in SSIS

I am trying to zip the contents of a Folder in SSIS, there are files and folders in the source folder and I need to zip them all individually. I can get the files to zip fine my problem is the folders.
I have to use 7.zip to create the zipped packages.
Can anyone point me to a good tutorial. I haven't been able to implement any of the samples that I have found.
Thanks
This is how I have configured it.
Its easy to configure but the trick is in constructing the Arguments. Though you see the Arguments as static in the screenshot, its actually coming from a variable and that variable is set in the Arguments expression of Execute Process Task.
I presume you will have this Execute Process task in a For Each File Ennumerator with Traverse SubFolders checked.
Once you have this basic setup in place, all you need to do is work on building the arguments to do the zipping, how you want them. A good place to find all the command line arguments is here.
Finally, the only issue I ran into was not providing a working directory in the command line arguments for 7zip. The package used to run fine on my dev environment but used to fail when running on the server via a SQL job. This was because 7zip didn't have access to the 'Temp' folder on the SQL Server, which it uses by default as the 'working directory'. I got round this problem by specifying the 'working directory as follows at the end of the command line arguments, using the -ws switch:
For e.g:
a -t7z DestinationFile.7z SourceFile -wS:YourTempDirectoryToWhichTheSQLAgentHasRights

How to set an environment variable programmatically in Jenkins/Hudson?

I have two scripts in the pre-build step in a Jenkins job, the first one a perl script, the second a system groovy script using the groovy plugin. I need information from the first perl script in my second groovy script. I think the best way would be to set some environment variable, and was wondering how that can be realized.
Or any other better way.
Thanks for your time.
The way to propagate environment variables among build steps is via EnvInject Plugin.
Here are some previous answers that show how to do it:
How to set environment variables in Jenkins?
Jenkins : Report results of intermediate [windows batch] build steps in email body
In your case, however, it may be simpler just to write to a file in one build step and read that file in another. To make sure you do not accidentally read from a previous version of the file you can incorporate BUILD_ID in the file name.
Using EnvInject Plugin from job configuration you should use Inject environment variables to the build process / Evaluated Groovy script.
Depending on the setup you may execute Groovy or shell command and save it in map containing environment variables:
Example
By either getting command result with execute method:
return [DATE: 'date'.execute().text]
or with Groovy equivalent if one exists:
return [DATE: new Date()]