Check for update (compare remote XML file with a local variable) - c++

I have an InnoSetup for my C# application. And I'd like the setup to check for updates before installing (to make sure the user always gets the latest version). To do this, I need a bit of C++ code to parse an xml file from a remote location (which contains a version string) and have a method return it.
From InnoSetup I can call the DLL and compare it to a local variable in the InnoSetup code.
Any clues on how to do this?

If you have access to the server side, it might be better to not use XML, just return version string. If you can't avoid XML, you should write your C++ code (if that's you question, I suggest using TinyXML), then create a dll export for a function returning the version string.

Related

Get iPhone directory path in C++

I am using a C++ library from an Objective-C layer. I want to be able to access this path, or at least it's container identifying string, directly in the C++ library.
(NB: In production we are able to pass the identifier from the Objective-C layer, but this is to try and get the path directly in CI)
For example, if I get the NSDocumentDirectory path in Objective-C, the path is easy:
/var/mobile/Containers/Data/Application/93C788E8-3F76-4DD2-BC5F-7980BE9970C7/Documents
I could strip out the GUID (93C788E8-3F76-4DD2-BC5F-7980BE9970C7) from this path and pass it, but I need to be able to generate it purely in C++. Our CI is running our unit test suite directly on a device instead of a simulator. I know that this is basically a unix command, but I've spent my morning snooping around, and coming up empty. Any ideas where to look?
You can use getenv("HOME"); to get the path to your application's directory.
Taking your example into account this should return /var/mobile/Containers/Data/Application/93C788E8-3F76-4DD2-BC5F-7980BE9970C7/.
Then you can extract the GUID from this path.
The idea to this was taken from https://stackoverflow.com/a/17284816/4181011

python-sip: How to access a DLL from both Python and C++

I have a C++ GUI, it load a DLL when running. I use SIP to import the DLL in python. I need to embed the python part in the GUI, and some data are needed to exchange between python and C++.
For example, in the C++ GUI, I can enter command from a panel, such as "drawSomething()", it will call corresponding function in python, and the result will be shown in the GUI.
Can I use SIP to
extract a C++ object from python object (just like the way boost.python does), or is there a better way to share data between python and c++ seamlessly?
thanks.
It turns out that I do not need to do anything complicated...
In my case, there is no difference to call functions in DLL from C++ or from python code embedded in C++.
I am totally over-thinked.
Please take a look at this Library
http://www.swig.org/Doc1.3/Python.html

C++ writing HTML onto each of two already opened Firefox tabs from within extension

I'm seeking C++ help in writing HTML code to a new tab in Firefox within an extension.
Our C++ code has been partially wrapped by an XPCOM wrapper and embedded within a Firefox extension thanks to the work of a consultant we have lost contact with, and still partially implemented by calling out to a standalone executable.
To get our output displayed from the standalone executable, the C++ code writes the output to a file and simply calls system(firefox file.html) which then comes up with a file:-based URI.
This no longer works in all situations, based on a report from a user running Vista. So it seems to be time to do it right, and navigate the DOM, likely integrating the rest of the C++ code into the XPCOM-wrapped part. Perhaps there's a right way to do it from the standalone executable using the DOM model?
The "current working directory" seems to no longer match the directory in which the extension installed the standalone executable, with a "VirtualStore" path element.
We also generate parallel output in a different MIME type, VRML to be specific.
Any suggestions or examples for how to properly generate output into a Firefox browser pane under C++ programmatic control would be very much appreciated.
You could call Firefox with a fully specified file:/// URL, not a relative URL (file.html).
Or you if you want to dump a separate executable, you could implement a protocol handler or a simpler about module (where ios.newChannel would be replaced by your own channel implementation that generates the data).
I'd say keeping the file-generation solution is OK and doesn't seem very bad, so I'd go with (1), perhaps changing the generated file location to a temporary folder and specifying it fully both for the executable that generates it and for Firefox.

Xerces/Xalan: UNC path as argument for document function?

I'm transforming an XML document by using Xerces-C 2.5 and Xalan-C 1.8. The XSL contains a "document" function, that references a file on the network. Unfortunately I cannot access this file by HTTP. I've only got the UNC path.
Xerces refuses to parse the referenced document, because WinSockNetAccessor::makeNew is called in Xerces as the "file" protocol is only accepted for local files. WinSockNetAccessor::makeNew is implemented for HTTP only, an exception is thrown and the file is ignored.
Is there a way to fool Xerces in order to accept the unc path as local file or any other known workaround without writing my own parser or manipulating Xerces?
A simple workaround would be, I guess, to just create a mapping, so you can call the network drive O: or whatever. That often fools programs that can't work directly with a UNC path (such as cmd.exe itself).
Does the UNC as it appears in the XSL have a "file:" prefix?
BTW, Xerces C V2.5 is several years old. Have you tried the latest version - V3.0.1 at the moment?

Symbian C++ - Persistent storage of a single variable

I wish to store a single variable in my application that will be saved between runs. This will be a version number that will be used to trigger an update option and so will change only rarely.
Does anyone have suggestions on the best way of implementing this? Considering it's such a simple requirement I am interested in the simplest solution.
Thanks!
Normally, that sort of information will be held in a constant (not a variable) in the binary, and the binary will contact an external site to find out whether there is a more recent version of the software. When it downloads the new, the newly downloaded file will have a new constant embedded in it.
Alternatively, you could keep the information in some sort of file in the file system. I'm not familiar with the Symbian environment, but something similar most likely exists.
It has already been mentioned, so I am going to elaborate on it. Create a file in your project directory that will contain the version number. Make that file a part of final SIS file by adding a line about it in the PKG file---for example, put a line in the PKG file to tell the installer to copy the file to a place like c:\System\Apps\${AppName}\${filename} on the device. Within code, read the version number from that file. The advantage you will have from doing it this way is that when you update your code and edit the file in your project directory and recreate an updated SIS file, on updating the SIS on the device, the version file will automatically get replaced with the current one.