How Implement EmguCV (or any other framework) in CleanArchitecture Solution - dependency-injection

I need to use EmguCV NuGet package in my solution.
As i read in the Uncle Bob's books, to pursue the goal of leaving in the external part of the solution any dependency related to the library, I created a new Interface named IImageProcessor in the core project, then I created a new project as a place where to install the NuGet Package and I implemented there a new concrete class called EmguImageProcessor extending the IImageProcessor Interface. In this class I wrote functions to wrap some emgu library functions.
I registered by dependency injection the IImageProcessor with EmguImageProcessor and it has been very cool..But now.. if i wish to use any Emgu Library method I have to wrap them in the interface and implement them in the class..that is a lot of work.. maybe am I missing something?
I need to know what is the best method to use Third-party libraries in my solution.

Related

Is it possible to use some of the features in maui-community-toolkit together with Blazor MAUI?

Thinking of MVVM and using ObservableObject, ObservableProperty and more. It seems like Blazor MAUI and the toolkit use incompatible partial classes. Gets error CS0263: Partial declarations of 'NameOfPage' must not specify different base classes.
I'm trying to use the CommunityToolkit.Mvvm.ComponentModel, I also tried to inherit the same base class in the Page as in the NameOfPage.razor.cs (and also NameOfPage.cs) file but with no result. If it is not possible or currently out of the scope for this project, would this be an improvement, or are there any workarounds or guidance for using the toolkit with Blazor MAUI or other similar ways to do this?

What is the difference between a unity plugin and a dll file?

i am new to Unity and i am try to understand plugins. I have got the difference between a managed plugin and a native plugin, but what is not very clear to me is:
what is the difference between a plugin and a dll? what should i expect to find in an sdk to make it usable in my unity project?
Thanks a lot
To expand on #Everts comment instead of just copying it into an answer, I'll go a little into details here
What is a plugin?
It's a somewhat vague word for a third-party library that is somehow integrated with the rest of your game. It means that it neither is officialy supported by Unity, nor is it a part of your core code. It can be "plugged" in or out without altering its internals, so it must provide some kind of API that can be used by the game code.
For example, you'll find many plugins that handle external services like ads, notifications, analytics etc. You'll also find a couple of developer-tools that can also be called plugins, like tile-based map editors and such.
Plugins come in many forms - DLL files are one example but some plugins actually provide full source code for easier use. And of course, other plugins will provide native code for different platforms, like Objective-C for iOS or .jars for Android.
So to answer your first question:
DLL is simply a pre-compiled source file that can be a part of a plugin
A plugin is a whole library that can consist of multiple files with different formats (.cs, .dll, .jar, .m etc)
What do you need to use an sdk?
First of all - documentation. Like I said before, and like you noticed yourself, not all plugins give you access to the source code. And unfortunately, not many sdks have extensive and developer-friendly documentations so it can be a tough task to actually understand how to use a given sdk.
Secondly - the code. Many sdks give you some kind of "drag & drop" library, a single folder with all the neccessary files inside that you simply add to your Unity projects. I've also seen sdks that use Unity packages that you have to import via Assets > Import Package > Custom Package.
Once you have the code and documentation it's time to integrate it with your game. I strongly recommend using an abstract lyer in your game as, in my experience, you often have to change sdks for various reasons and you don't want to rewrite your game logic every time. So I suggest encapsulating sdk-related code in a single class so that you have to change only one class in your code when switching from, say, one ad provider to another (and keep the old class in case you need to switch back).
So you basically need three things:
Documentation (either a readme file or an online documentation)
The code (precompiled or source)
A versatile integration

Dependency injection in Umbraco or unit testing

I have made a project in Umbraco using backoffice completely.But Now I am trying to apply concept of dependency injection(which I may have used in past..but not by that specific name) in that project.
and after loads of searching.I now know the concept of dependency injection(I think),in which we are supposed to use classes and constructor to restrict the input supplied to a function in terms of type,value.
But how am I suppose to make that umbraco project from that.I once tried making a strongly typed.It looks much like that which I am supposed to do now.
I also took reference from these articles.
Is it possible to use dependency injection with Umbraco 7 ContentService event handlers?
Why does one use dependency injection?
But still I am kind of stuck..Is there any other way to do unit testing in umbraco.
Yes, you can! :)
Basically, the starting URL for using IoC and DI with Umbraco was already shared. It's here: https://our.umbraco.org/documentation/reference/using-ioc. You can of course use any of the avaialable containers, the example is just for autofac. You just need to remember to initialize container when Umbraco starts (using event handlers).
For Unit Testing resources I would point you first to tests made by Umbraco itself: https://github.com/umbraco/Umbraco-CMS/tree/dev-v7/src/Umbraco.Tests. You can explore how the core team is testing their code and even reference this library and make use of it in your solution.
There are some other useful materials to start unit testing with Umbraco. To list a few:
http://blog.aabech.no/archive/the-basics-of-unit-testing-umbraco/
http://skrift.io/articles/archive/unit-testing-umbraco-plausible/
http://skrift.io/articles/archive/unit-testing-umbraco-with-umbraco-context-mock/
https://www.youtube.com/watch?v=1xS002NyGnc
I think it will be enough to start doing it.

ZF2 Composer autoloading or via Zend\Loader whats the difference?

at the moment i going to learn ZF2.
I want to test ZF2 without MVC to understand the components.
Now my first Question.
There are different Types of Zend\Loaders and Composer.
Should i use composer to autoload my classes, third party librarys, e.g or the Zend\Loader* ?
Why there are Zend\Loaders like the StandardAutoloader if we have composer?
They do the same thing, which is obviously autoload classes, although it might be an unfair comparison. The Zend implementation is simply a collection of classes that wrap the SPL auto loader.
Composer however, is a package manager and manages the entire application library. This includes sourcing and updating third party resources according to custom specifications (composer.json), perhaps pulling from GitHub or informing you of other missing dependencies.
The icing on the cake is that composer once compleate with all that hard work, automatically generates a custom autoloader class including all the managed namespaces just for you. This class can be rebuilt over with one command composer update as your projects requirements change.

MediaInfoList Example for Delphi

According to the MediaInfo documentation which is located at http://mediainfo.sourceforge.net/en/Support/SDK/Doxygen/class_media_info_lib_1_1_media_info_list.html, the MediaInfoList class is used to gather information about multiple files in one shot.
The problem I have is the MediaInfoDLL.pas file that comes with the download package does not contain any information I need to access this class and I cannot find any examples online that show how to use this class from within Delphi.
If anyone has any references or examples on how I am supposed to access this class then please do share.
That is Visual C++ class, it is absolutely different from Delphi classes.
You may try to compile the whole MediaInfo using C++ Builder instead.
Or make COM class over that class using Visual C++.
Or better not use classes at all. Most simple. And most practical.
Make your own class wrapping non-class API

Resources