Migration from vtk8.2 to vtk9.1 for qt application - qt

I have a qt5.12 application with vtk8.2 which uses QVTKWidget. Now I want to use vtk9.1 instead of vtk8.2. But vtk9.1 does not support QVTKWidget anymore. So, I just changed it into QVTKOpenGLNativeWidget and did not do anything more. I even compiled it (VS2015 update 3), but this application fails on the module "vtkFixedPointVolumeRayCastMapper.cxx" on the lines
this->ImageDisplayHelper = vtkRayCastImageDisplayHelper::New(); // 1
this->ImageDisplayHelper->PreMultipliedColorsOn(); // 2
because this->ImageDisplayHelper is nullptr after //1.
As far as I understood this is because "vtkRayCastImageDisplayHelper" is not registered.
So, how can I register it? Maybe, I'm completely wrong and should migrate to vtk9.1 in some another way?

Related

How do I register a MediatR post processor

I would like to try the new pipeline feature in MediatR: https://github.com/jbogard/MediatR/wiki/Behaviors
I tried the following, but it does not get executed
services.AddMediatR();
services.AddTransient(typeof(IRequestPostProcessor<,>), typeof(PostHandler<,>));
What am I missing?
You need to register the behavior associated with post-processors, like this unit test shows.
Your registration code would look like:
services.AddMediatR();
services.AddTransient(typeof(IRequestPostProcessor<,>), typeof(PostHandler<,>));
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(RequestPostProcessorBehavior<,>));
That behavior will get all the post-processors you registered and execute them.
Edit
After a comment about the post-processor running twice, I had a look at the code that registers MediatR in the ASP.NET Core built-in DI container, and it turns out instances of IRequestPreProcessor<TRequest, TResponse> and IRequestPostProcessor<TRequest, TResponse> are automatically registered as you can see here. What's left to do to get them running in the pipeline is just register the associated behavior. So the necessary registration is then:
services.AddMediatR();
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(RequestPostProcessorBehavior<,>));
I encountered the same issue as Larsi in the comment above. My code looked like this
services.AddScoped<IPipelineBehavior<AddMessageRequest, MessageResponse>, RequestPostProcessorBehavior<AddMessageRequest, MessageResponse>>();
but the behaviour still executed twice. My solution was to simply not register it manually, seems like the registration is handled otherwise now.
In my case services.AddMediatR(Assembly.GetExecutingAssembly()); was enough.
Would be nice if someone could expand on why this is.

Where can I find Java prism render possible options and documentation?

I had problem with my application with Canvas generation ( I'm using JavaFx ). Setting this option helped:
-Dprism.order=j2d
The thing that is problem to is that I cann't find any documentation for prism ( Dprism ). Second problem is that I would like to set up this option via config file.
Properties props = System.getProperties();
props.setProperty("com.sun.prism.order", "j2d");
Code above dosen't work for me.
These were the properties used by JavaFX 20 months ago (from the adamish blog):
com.sun.scenario.animation.adaptivepulse
com.sun.scenario.animation.AnimationMBean.enabled
com.sun.scenario.animation.nogaps
decora.purgatory
glass.platform
javafx.animation.framerate
javafx.animation.fullspeed
javafx.animation.pulse
javafx.debug
javafx.embed.isEventThread
javafx.sg.warn
javafx.toolkit
javafx.verbose
javafx.version
nativewindow.ws.name
prism.debug
prism.device
prism.dirtyregioncount
prism.disableBadDriverWarning
prism.forcerepaint
prism.multisample
prism.noFallback
prism.order
prism.printallocs
prism.reftype
prism.showcull
prism.showdirty
prism.shutdownHook
prism.tess
prism.tessaa
prism.trace
prism.verbose
quantum.debug
quantum.pulsedebug
quantum.verbose
I do not know what most of the above properties are, when they are set, what values they may have, how they are used or what they do.
The JavaFX Project Lead (Richard Bair), notes:
Just a word of caution, if we haven't documented the command line
switches, they're fair game for removal / modification in subsequent
releases :-)
There is an issue tracker request to get some of the properties officially documented and supported:
JDK-8092282 "Document officially supported system properties and command line switches"
The request is currently scheduled for implementation in Java 9. Access to the issue tracker requires a login, but anybody can signup and comment on the issue or vote for it.
I was having the same problem. The issues is that if your main class extends Application, there is a launcher class that kicks in before your main method and reads the prism properties before you set them.
If you use a class that doesn't extend Application as the main class and from this one you set the system properties and then call the main method of class extending Application, the properties go through

Websphere & Tivoli: NPE while trying to create PDAuthorizationContext

I am getting the following error when I try to start my Application...
[java.lang.IllegalStateException: java.lang.NullPointerException^M
at com.tivoli.pd.jutil.kb$1.run(kb$1.java:41)^M
at java.security.AccessController.doPrivileged(AccessController.java:229
)^M
at com.tivoli.pd.jutil.kb.c(kb.java:141)^M
at com.tivoli.pd.jutil.kb.(kb.java:56)^M
at com.tivoli.pd.jutil.PDContext.(PDContext.java:76)^M
at com.tivoli.pd.jazn.PDAuthorizationContext.(PDAuthorizationConte
xt.java:66)^M
I double checked the config file was accessible and I could read it. The code I am using looks as follows...
aC = new PDAuthorizationContext(cFile);
Is there a way to get more information on what is causing the NPE?
More information!!!
After debuging a bit, it appears the issue comes from this code (they use progaurd so it is a little hard to be 100% confident)...
Certificate[] arrayOfCertificate1 = ((KeyStore)???).getCertificateChain("DefaultID");
//Throws Null pointer (presumably because array is null)
Certificate localCertificate1 = arrayOfCertificate1[0];
EVEN MORE INFO
This appears to be some kind of dependency conflict (guess), because if I just create a sample App using PDAuthorizationContext it works fine.
Problem was related to the PD.jar version that I was using. Although I thought I was using one version I was using another. This was because on version was registered in my WebSphere library (under build path in eclipse). Once the proper library was introduced everything worked.

Sitecore context in HttpModule

I created simple HttpModule, all what I need is just get is valid Sitecore.Context inside but during processing I see that my Sitecore.Context is some kind of default.
I can get Sitecore user that log in to Sitecore, etc.
How to fix it ?
I assume you have a Sitecore Context, but it is null or set to the wrong site or language.
You can change the context like this:
// switch to the preferred site
Sitecore.Context.SetActiveSite("yourSiteName");
// set the preferred database
Sitecore.Context.Database = Sitecore.Configuration.Factory.GetDatabase("master");
// set the preferred language
Language language = Sitecore.Globalization.Language.Parse("en");
Sitecore.Context.SetLanguage = (language, false);
You probably also want to switch back to the original settings after your processing is done. So it is wise to "save" the original settings in a variable so you can change them back afterwards
Take a look at John West's posts on Sitecore pipelines for some background on how the context is being established.
http://www.sitecore.net/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2011/05/All-About-Pipelines-in-the-Sitecore-ASPNET-CMS.aspx
and
http://www.sitecore.net/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2011/05/Important-Pipelines-in-the-Sitecore-ASPNET-CMS.aspx
The following blog post on creating and running custom pipelines should give you an idea how to implement your own pipeline.
http://adeneys.wordpress.com/2008/08/27/creating-and-running-custom-pipelines-in-sitecore/

QAbstractItemModel testing using modeltest

I'm looking for a good tutorial on how to use modeltest to test models based on QAbstractItemModel. I don't know how to interpret debug messages that are displayed.
Also I'm having trouble configuring modeltest project to work with my app in QtCreator. Including the .pri/.pro doesn't work. I get an error saying "No rule to mage target ..". After fixing paths in modeltest/modeltest.pro file it starts to compile. But i get this wierd assertion
ASSERT: "QTest::testLogger" in file c:\ndk_buildrepos\qt-desktop\src\testlib\qtestlog.cpp, line 232
Any ideas why this happens ?
My modeltest folder is located inside my project. I added following line at the end of my *.pro file
include(modeltest/modeltest.pri)
The modeltest.pri file contains the following
load(qttest_p4)
SOURCES += modeltest/modeltest.cpp modeltest/dynamictreemodel.cpp
HEADERS += modeltest/modeltest.h modeltest/dynamictreemodel.h
I modified my code to use modeltest this way
model = new TasksModel(this);
new ModelTest(model, this);
ui->treeView->setModel(model);
TasksModel is my implementation of QAbstractItemModel model.
ui->treeView is the widget that displays data.
No other modifications where made while integrating modeltest with my app.
Qt version is 4.7.
This will sound a little overgeeky - but it is, in fact, what the ModelChecker dev intended for you to do ;) When you hit one of the asserts, go to the point in the code where it is hit and read the comments which are written along with it. The entire thing is extremely heavily commented, and describes what is breaking and likely reasons why. This is by far easiest to do if you run your app through a GUI debugger, such as that included in for example KDevelop, Qt Creator or Visual Studio.
The reason you are getting this error is because you aren't actually using the ModelTest inside a proper QTestLib test case. If you take a look at /tests/auto/modeltest (where you presumably got the modeltest class in the first place), you can see how to properly construct a test case using the ModelTest.

Resources