qt-linguist- Merging .ts files - qt

I am translating the GUI of QGIS desktop software.
The current developing version is on transifex platform from which it can be extracted the corresponding .ts file.
the older versions of QGIS are archived on github.
I'd like to insert the missing strings translated in the newer version in the older version. Also some strings have been corrected in the new version and I'd like to replace them in the older.
I used lconvert in this form:
lconvert -i 2.18.ts 2.99.ts -o total.ts
But QT Linguist warns that in total.ts there are duplicated strings.
Is it possible to insert in the older version (2.18) only the strings that are the same from the newer (2.99)?

I ran three years ago with the ts-tools from Qt4 into the same problem.
The manual says that the call of lconvert (just like you laid it out) will merge the content (means: the translations from two sources) into a new file. And I expected "merge" to work like "make a superset out of both". But it did not.
I wrote myself a bash-script to merge it in a way I want to. Will try to find the file this evening.
(I know, right now the answer is - beside confirming the error - not helpful.)

Related

Where is convert in ImageMagick?

I just spent an infuriating day trying to make a gif out of a series of jpg files in R. I installed ImageMagick to run the following code:
system("convert -delay 40 *.png example_4.gif")
but I get the following error message:
Warning message:
running command 'convert -delay 40 *.png example_4.gif' had status 4
which looks like a path error. Now I've looked for convert in the Imagemagick download and can't see it anywhere. Does anyone know where it is?
Alternately, is there another easier method of making a gif from a series of jpegs in R that isn't ridiculously long?
Thanks
Three options:
Consider using the magick R package instead of using system().
Change your script from convert ... to magick convert ....
Re-install imagemagick, and enable the "Install legacy utilities (e.g. convert)" option.
This change has been around since 7.0.1 (now up to 7.0.7), and is discussed in their porting guide, specifically in the section entitled "Command Changes".
Philosophically, I prefer to not install the legacy utilities, mostly because it can cause some confusion with command names. For instance, the non-ImageMagick convert.exe in windows tries to convert a filesystem ... probably not what you want to accidentally trigger (there is a very low chance that you could get the arguments right to actually make a change, but it's still not 0). The order of directories in your PATH will dictate which you are calling.
EDITs:
From comments, it seems like the difference between "static" and "dll" installers might disable the option to install legacy utilities such as convert.exe. So you can either switch to the "dll" to get the legacy option, or you are restricted to options 1 (magick R package) and 2 ("magick convert ...").
From further comments (thanks to fmw42 and MarkSetchell), it is clear that the old convert.exe and the current legacy mode of magick.exe convert are not the same as the currently recommended magick.exe (without "convert"); the first two are legacy and compatibility modes, but they do not accept all arguments currently supported by magick-alone. So the use of "convert" anywhere in the command should indicate use of v6, not the current v7. This answer is then merely a patch for continued use of the v6 mechanisms; one could argue a better solution would be to use magick.exe's v7 interface, completely removing the "convert" legacy mode.

does R binary format changes from version to version

My question is if an object in R saved to binary format using the save function can be different if saved from different (but recent) versions of R.
That is because I have a script that makes some calculations and save its results to a file. When reproducing the same calculations later, I decided to compare the two files using
diff --binary -s mv3p.Rdata mv3p.Rdata.backup
To my surprise the two files are different. However when analysing the contents in R, they are identical.
The new version is 3.3.1. I believe the older version have been created by R 3.3.0 but it could also be by 3.2.x, I am not 100% sure. I used the save command with only the object I wanted to save and the filename arguments.
So my question is : is it normal that the same object is written differently in different versions of R? is it documented somewhere? How can I be sure to be able to reproduce exactly the same file? On what can it depend (R version, OS, processor architecture, etc...)
Please , I am NOT asking if versions can be read by another version of R and I am NOT asking about very old R versions.
R data files also include the R version used to write it. That's one reason the files may be different. See here on documentation: http://biostat.mc.vanderbilt.edu/wiki/Main/RBinaryFormat
Also, you can use save(..., ascii=T) to see the difference in plain text.

GNAT Programming Suite: Cross-Reference Info Not Up To Date (this is a guess)

I'm trying to get package references resolved during a build, using GNAT Programming Suite (hosted on Win XP). In the Builder Results, I get errors like this one:
file "ac_configuration_s.ada" not found
Clicking on the error takes me to a line like this:
with
Ac_Configuration,
Dispense_Timer,
...
The first item (Ac_Configuration) isn't resolved, but the second item (Dispense_Time) is resolved. I have several others that do or don't resolve. All of the files in question (spec and body) are identified as source files.
When I hover my mouse over the line with the error, a popup shows up that offers this:
(Cross-references info not up to date. This is a guess.)
Ac_Configuration
local package declared at D_Ac_Config_S.Ada:85
The guess is correct, but I don't know how to use this. How do I get this to correctly build?
Update
Here is teh call to gcc
gcc -c "-gnatec=C:\Source\build\GNAT-TEMP-000001.TMP" -I- -gnatA
-x ada "-gnatem=C:\Source\build\GNAT-TEMP-000002.TMP" "C:\Source\C_Cbt_Main_B.Ada"
I don't see a reference to teh "miimal" switch.
In this case, there is no corresponding body file file D_Ac_Config_S.Ada. So the is no body file to compile separately.
When I right click on the package reference inside the with, I can goto the declaration of Ac_Configuration and every other package name that is the source of an error. So these lreferences are being resolved somehow.
By the way, I have not used ADA before, so I'm still trying to understand everything.
It looks as though you're using _s.ada as the suffix for specs, and I'm guessing _b.ada for bodies?
GNAT may have difficulty with this naming convention. It's possible, using a GNAT Project file (.gpr), to alter GNAT's default convention ({unit-name}.ads for specs, {unit-name}.adb for bodies) but the rules (see "Spec_Suffix") say "It cannot start with an underscore followed by an alphanumeric character" (I haven't tried this, but you can see that it would confuse the issue if you had a package Foo_S, for example).
LATER: It turns out that GNAT (GPL, 4.7, 4.8) is quite happy with your suffixes!
If the package Ac_Configuration is really a local package declared at line 85 of D_Ac_Config_S.Ada, then there's your problem; you can only with a library unit, which in this case would be D_Ac_Config.
with D_Ac_Config;
...
package Foo is
...
Bar : D_Ac_Config.Ac_Configuration.Baz;
I wonder whether D_Ac_Config_S.Ada (for example) actually contains multiple Ada units? (if so, compiling that file should result in a compilation error such as end of file expected, file can have only one compilation unit). GNAT doesn't support this at compile time, providing instead a utility gnatchop.
Would it be possible to just gnatchop all the source and be done with it?
Hm, I think it sounds like the compiler's got a bad set of objects/ALIs it's working with, hence the cross-reference not up to date error. (Usually the compiler's good about keeping things up to date; but you may want to check to see if the "minimal recompilation" switch is set for the project.)
Have you tried compiling just the ["owning"] file D_Ac_Config_S.Ada? (i.e. if it were a spec, go to the corresponding body and compile that.) That should force its ALI/object files to be updated.
Then try building as normal.
-- PS: you might have to clean first.

R2PPT crashes R; are there alternatives to R2PPT?

I am attempting to automate the insertion of JPEG images into Powerpoint. I have a macro done for that already, except using R would be infinitely better for my purposes.
The package R2PPT should do this, I understand. However, I cannot use it. For example, when I try to use PPT.Open, I understand I can do it two different ways by calling method = "rcom" or method = "RDCOMClient". Using the latter, R will always crash, sending an error report to windows. Using the former, it tells me I need to install statconnDCOM , before giving the error:
Error in PPT.Open(x) : attempt to apply non-function.
I cannot install statconnDCOM freely, as I wouldn't call this work non-commercial. So if there isn't a way to get around this issue, are there at least some free alternatives to R2PPT so that I can save several hours of manual work with a simple R code? If there is a way for me to use R2PPT, that would be ideal.
Thanks!
Edit:
I'm using R version 2.15 and downloaded the most recent version of R2PPT. Powerpoint is 2007.
Do you have administrative privileges on this machine?
There is an issue with package RDCOMClient. It needs permissions to write file rdcom.err in the root of drive C:. If you don't have privileges to write to c:, there is a rather cumbersome workaround:
Close R
Create "c:\temp" folder if it doesn't exist.
Locate on your hard drive file rdcomclient.dll. It usually placed in \R\library\RDCOMClient\libs\i386\ and in \R\library\RDCOMClient\libs\x64\ (you need to patch file which corresponds your Windows version - 32 bit or 64 bit). It's recommended to make backup copy of this files before patching.
Open rdcomclient.dll in text editor (Notepad++, for example -http://notepad-plus-plus.org/)
Find in file string c:\rdcom.err - it occurs only once.
Go into overwrite mode (usually by pressing "Ins" key). It is very important that new path will have the same number of characters as original one. Type C:\temp\e.rr instead of c:\rdcom.err
Save the file.
Now all should work fine.
Arguably not an answer, but have you looked at using Sweave/knitr to render your presentations in LaTeX using something like Beamer? (As discussed on slide 17 here.)
Wouldn't help any with getting JPGs into a PowerPoint, but would certainly make putting R-output (numerical or graphical) into a presentation much easier!
Edit: if you want to use knitr (which I recommend), here's another reference.

How to create a patch file on windows?

On windows, I have two source files and want to create a patch with difference, like this one.
But I'm unsure, what format this patch is and what app to use in order to create it? GNU diff output is very different from the patch I can see in the link above.
Try WinMerge. You'll find a patch generator in the "Tools" menu.
Thanks, PhiLho & Lukáš! The diff program from UnxUtils works great under Windows 7 to generate the patch file:
diff -u oldfile newfile >patchfile
Likewise, the patch program from UnxUtils works great to apply the patch:
patch -u oldfile patchfile
The output format is called "unified diff", it can be generated using diff -u.
WinMerge is the best tool for windows.
To create a patch file, you need to do the following:
File>Open
-- Here you open the files for which you are generating patch file.
Tools>Generate Patch
-- Here you specify the path where to save the patch file. And WinMerge will save patch file for you.
WinMerge (http://winmerge.org/) is what you need. You also can compare whole file trees with this tool, which is an absolute must-have for some people.
The UnxUtils package offers lot of useful Unix tools for Windows, with a minimal impact on Windows installation (unzip, add location to path, use it).
It has a diff.exe
In Beyond Compare 4 you can generate a unified diff by selecting the 'Session' > 'Text Compare Report...' menu item and then selecting 'Patch' for the layout and 'Unified diff' for the patch style. Then save the output to file, or to the clipboard.
I've also made a tool to generate patch files (like WinMerge html format) between two sets of changesets/folders/commits (as a zip downloaded from github or azure or just folders sitting in your drive) since currently WinMerge does NOT support path file generation from command-line to support automation.
use it like:
python diff_generator.py --c1 "path_to_file1.zip" --c2 "path_to_file2.zip" [--git]
or
python diff_generator.py --c1 "path_to_folder1" --ddc1 --c2 "path_to_folder2" --ddc2

Resources