What is the Qt6/PySide6 equivalent of QXmlDefaultHandler? - xml-serialization

I am currently trying to port from PyQt4 to PySide6 an application that uses the QXmlDefaultHandler, however this class (as many others) is no longer supported in Qt6 (as can be seen here).
So I am looking for a solution on how I can adapt the code and replace the QXmlDefaultHandler in my inheritance setup.
The application I am porting is an example from the book "Rapid GUI Programming with Python and Qt", and here's the specific file in question.
I am new to dealing with that part of Qt, and I am not particularly determined to keep it as is, but I'd like to find as close a replacement as possible to the original code, in order to keep the book relevant with the updated examples.

Related

Is it possible to generate complete C/C++/Java code from a State machine in Magic Draw?

I want to generate code from my state machine in Magic Draw. Magic Draw supports code generation for classes but does not include an option for state machine. I tried using SinelaboreRT software. However, it generates limited code. We need to manually add 'Main' function and other functions defined inside states. I wanted to know if it is possible to generate an executable or a C/C++/Java code file with all the code mentioned inside states as well a 'Main' function?
Yes, there are three main options that I am aware of 1) make your own code generator, 2) buy a commercial code generator e.g. LieberLieber provides what appears to be a fairly sophisticated one, or 3) use one of the open source code generators such as Papyrus-RT.
The first option isn't actually that difficult depending on your target language and framework. For my work at MITRE, I have written a generator to take properly formed Magicdraw models and create deploy-able Spring microservices. I used the Spring state machine library to simplify the STM code generation.
I personally found most convenient way to create state machine from models is UML or any other DSL is the combination of
Eclipse Papyrus / Eclipse XText / Eclipse XTend
there is also new kind in the block, if you don't want to work Eclipse based
Langium
but they are suffering at the moment little bit from being new but I will advice you check them every 6 months, they seem promising.
If you want to see how is it done, I have several blogs about it.
UML Based:
Akka Finite State Machine Generation Blog2
Papyrus and Spring State Machine
DSL Based:
XText and Spring State Machine

Converting SBML model into a simulatable Matlab Function

I'm looking for a tool to convert a SBML model into a Matlab function. I've tried SBMLTranslate() function from libSBML but this returns a Matlab struct, not a function. Does anybody know if such tool exists? Thanks
There are at least three efforts in this direction:
Frank Bergmann offers an online service for SBML translation where you can upload an SBML file and it will generate a MATLAB file. The comments at the top of the generated MATLAB file explain how to use the results. The C++ source code is available on SourceForge.
Bergmann's code referenced above was used by Stanley Gu to create sbml2matlab, a Windows standalone program. Off-hand, I don't know whether Gu's version changed or enhanced the algorithm used by the Bergmann version, but it seems likely. (Note: Gu now works at Google and does not maintain this code anymore, as far as I know.)
The Systems Biology Format Converter (SBFC) is a framework written principally by Nicolas Rodriguez; it includes a collection of converters, one of which is an SBML-to-MATLAB converter. This converter is written in Java.
I have not compared the results of the translators myself yet, so cannot speak to the differences or quality of output. If you try them and have any feedback to relate, please let the authors know. Knowing what has or hasn't worked for real users will help improve things in the future.
A final caveat is that all of these have been research projects, so make sure to set your expectations accordingly. (This is not a criticism of the authors; the authors are very good – I know most of them personally – but the reality of academic development work is that we all lack the time and resources to make these systems comprehensive, hardened, polished, and documented to the degree that we wish we could.)

Convert MIndiGolog fluents to the IndiGolog causes_val format

I am using Eclipse (version: Kepler Service Release 1) with Prolog Development Tool (PDT) plug-in for Prolog development in Eclipse. Used these installation instructions: http://sewiki.iai.uni-bonn.de/research/pdt/docs/v0.x/download.
I am working with Multi-Agent IndiGolog (MIndiGolog) 0 (the preliminary prolog version of MIndiGolog). Downloaded from here: http://www.rfk.id.au/ramblings/research/thesis/. I want to use MIndiGolog because it represents time and duration of actions very nicely (I want to do temporal planning), and it supports planning for multiple agents (including concurrency).
MIndiGolog is a high-level programming language based on situation calculus. Everything in the language is exactly according to situation calculus. This however does not fit with the project I'm working on.
This other high-level programming language, Incremental Deterministic (Con)Golog (IndiGolog) (Download from here: http://sourceforge.net/p/indigolog/code/ci/master/tree/) (also made with Prolog), is also (loosly) based on situation calculus, but uses fluents in a very different way. It makes use of causes_val-predicates to denote which action changes which fluent in what way, and it does not include the situation in the fluent!
However, this is what the rest of the team actually wants. I need to rewrite MIndiGolog so that it is still an offline planner, with the nice representation of time and duration of actions, but with the causes_val predicate of IndiGolog to change the values of the fluents.
I find this extremely hard to do, as my knowledge in Prolog and of situation calculus only covers the basics, but they see me as the expert. I feel like I'm in over my head and could use all the help and/or advice I can get.
I already removed the situations from my fluents, made a planning domain with causes_val predicates, and tried to add IndiGolog code into MIndiGolog. But with no luck. Running the planner just returns "false." And I can make little sense of the trace, even when I use the GUI-tracer version of the SWI-Prolog debugger or when I try to place spy points as strategically as possible.
Thanks in advance,
Best, PJ
If you are still interested (sounds like you might not be): this isn't actually very hard.
If you look at Reiter's book, you will find that causes_vals are just effect axioms, while the fluents that mention the situation are usually successor-state-axioms. There is a deterministic way to convert from the former to the latter, and the correct interpretation of the causes_vals is done in the implementation of regression. This is always the same, and you can just copy that part of Prolog code from indiGolog to your flavor.

Environment properties files in scala project

Just starting to learn scala for a new project. Have got to the point where I would like to define different properties files for the different environments the app is going to run on, ideally in a similar way to Rails - very lightweight, just one different properties file per environment that is loaded based on its name. I don't really care if it's a java properties file, YML or scala code.
In the spirit of not reinventing the wheel I've been looking to see if there is some accepted standard Scala way of doing this but I can't find one, I've found a few similar but not identical questions here where people suggest using system properties in the startup script but this feels like it would end up being a nightmare.
I could obviously implement it if needs be but feels like the sort of thing that should already exist. So - does it?
I'm using sbt if that makes a difference.
I know of Configgy. Also, Akka/Play 2.0 will be using Config, which looks nice too. See blog about the latter.
Basically, Configgy has been used for a while now, but has been deprecated, while Config will be all-new. However, having Config as the default Typesafe Stack configuration tool will probably make it the preferred tool for that pretty fast.
I have written a Configgy replacement called Configrity. It can use different input formats (like YAML), it's immutable, supports functional patterns and uses type class to convert automatically the values to the desired type.
I have written BeeConfig, a replacement for java.util.Properties except that it is a Scala API and uses UTF-encoded configuration files. It supports string interpolation, chaining and a bunch of other features. But its main objective is simplicity.
Bitbucket | Blog post
Rick

C++ Libraries on iPhone/Android: Generation of Wrapper classes

I have the following question:
Let's assume I have many different C++ libraries(algorithms), which are written in the same style . (They need some inputs and give back some outputs).
I've done some research and wanted to ask if its possible to auto-generate Wrapper classes (by using an algorithm which are given the input and the outputs of the c++ algorithm), which can be easily used in Objective-C/Java (iOS/Android) then .
The app-programming part isn't really time-consuming.
You'll want to look at SWIG. This generates bindings for other languages from a C based API. Objective-C support is in there as is Java.
I'm not sure what happened to objective-C support in the later versions, but its in v1.1 and you can see the branch where it was added.