Easily Creating Dynamic Form/Controls Within Qt - winforms

We've got a Qt application that configures external devices by querying their configure interface and then, using a QWebView, we present an HTML page with the appropriate controls. We'd prefer to hand the configuration information to some sort of Qt "Form Builder" class, and have it spit out a QWidget with a layout that contains native Qt controls. (We fully own the interface information, and so can turn it into whatever format this mythical "QFormBuilder" takes.)
Is this possible? No one really wants to budget the time to write our own parser (or use QScript for the same reason), as the HTML version looks "good enough". However, if there is an alternative, I'd love to know what other people have done.

Yes, that's possible. You can write the UI information in the same format Qt Designer uses, then construct the UI at runtime using the QUiLoader class.

Related

SCORM authoring tool

Im starting a new project. The aim of the project is to create a e-authoring tool for building courses in SCORM Complaint. Im new to this domain and I have little idea on this. I have taken a view on authoring tool in Articulate, which my customer requires to do the same. I understood the content creation, but I am trying to understand How can I export this as SCORM compliant course? In between I learned about xAPI as well And understood it is a kind of enhanced SCORM.
Could any one guide me to understand this,
1) How can create content from my custom authoring tool and export as SCORM complaint
2) Is it better to use xAPI or SCORM.
3) How is the SCORM pacakge communicate with my custom made LMS?
4) Heard about LRS,
My custom authoring tool will be made in React and store would MondDB
Any help would be greatly appreciated. Thankyou!
That is a lot to take on, particularly all at once.
1) The SCORM spec is made up of multiple parts. There is a packaging portion and a runtime portion. The basics are that your package needs to be a zip file, and that zip needs to include specific files that indicate to the LMS what type of standard it is along with other metadata about the package. For SCORM this will be called an imsmanifest.xml file. For xAPI you are most likely going to use a cmi5.xml (see cmi5) or a tincan.xml file (what Articulate Storyline exports when it says "xAPI"). The other parts of the package will depend on what standard and version of that standard (for SCORM 1.2, 2004 2nd, 3rd, or 4th edition) you are targeting, realizing that different LMSs support different standards and different degrees of those standards.
Once you have a package constructed that will import, the content itself (usually an HTML file) will need to locate the JavaScript API provided by the SCORM player (from the LMS) and make specific calls depending on what the content is needing to store or read, this is the runtime portion. The calls will again depend on the standard and version. For xAPI based packages (either tincan.xml packages or cmi5 packages) the content will communicate directly to the LRS based on the information provided on the URL at launch time (there is no built in JavaScript API).
2) This entirely depends on what your customer base looks like and the types of data that you intend to capture. SCORM is a more mature landscape and has wider adoption and is more heavily specified, if the information you need to capture fits into its limited information model then it is still an excellent choice. If you need significant data portability and/or the information you need to capture goes beyond compliance data (pass/fail, complete, and score) and/or interaction data (questions + answers) then you should consider xAPI, specifically via cmi5.
3) The LMS must provide a JavaScript API (specified by the SCORM runtime) which the content will use as its interface. The storage/retrieval of data is implementation specific for the LMS beyond what is included in the specification for the JavaScript API.
4) You didn't really include a question here.
I would suggest familiarizing yourself with the two sets of standards via http://scorm.com and http://xapi.com. And although it is a plug for my company's product, you may want to consider the Rustici Driver as it is a product (library) specifically designed to make it easy for an authoring tool to export content as SCORM 1.2, 2004, AICC, cmi5 or Tin Can (the latter two being xAPI). Once you have your tool up and running with minimal standards support you should consider testing it on Rustici's SCORM Cloud (it is free for this purpose), see http://cloud.scorm.com.
The format is huge, there is no quick reference guides. And different authoring tools have different scorm-support depths. You should probably start with this document
Sounds like you're talking about designing editable content; and the content "framework" itself.
This is a massive effort! This is massive support! That said, people do it.
Having built a CMS system for many supporting subject matters I had to divide and conquer this task.
Few ways I'd think to digest this beast- data, data, data
Requirements on Activities (Interaction types)
Design (static/dynamic) on these interactions
The view/facade displaying can change. Tech moves at the speed of light. Need to come up with a super solid data model.
I'd think about how these can be generic, and how they can be extended to meet the customers goals/needs. All depends how much customization (if any) can happen.
I start mapping all this to SCORM CMI Object level calls. Scoring, Progress, Interactions, Objectives etc...
Get your self a wicked SCORM Content API library or write one yourself. You'll be re-using a lot of these calls, no sense baking them into all your interactions
Get up on SCORM Packaging .. much of this has to be defined at author time. Lots of reading, and a lot of features you need to pick thru if your customers even use. Don't dev in places that have .1% market need. The low hanging fruit get you to market.
Surround yourself with passionate great people. You'll need them.
As far as the standards go, it's all about portability. SCORM works directly with a LMS if thats where your customer goes. Others use a LRS which is coded to work with one they set at author time. You can even do both.
Aside from React and MongoDB, you'll need something that can do the lift and shift of all this content.

Register Embedded DirectShow filter

I am working on an application at the moment that plays back video with a DirectShow filter. The application is written in WPF and is using MediaElements to play the video. As long as the DirectShow filter is registered the video will play. At the moment I just use regsvr32 to register the filter before playback.
What I was wondering is if it is possible to load the filter from an embedded resource when the application is run? I am trying to avoid needing administrator privileges to register the filter.
Edit:
Ok I'm trying to use this information and come up with a solution. You will have to excuse my lack of knowledge in the DirectShow area. I did not write the filter, I am just trying to come up with a solution using it. I am trying to do a little more research so I understand DirectShow and its components a little better.
I found a handy ComHelper class that I'm using to load the filter.
https://gist.github.com/jjeffery/1568627
I am using the code below to create an instance of the filter.
LibraryModule module = LibraryModule.LoadModule(#"filter.ax");
var comObject = ComHelper.CreateInstance(module, new Guid("c91aa7be-f627-46e3-b79f-2de55da46a8b"));
Is this correct? I'm trying to figure out where to go next. How would I use this to build the filter graph?
Building a filter graph using unregistered filters is possible, but you have to be aware of obstacles and then decide whether it is acceptable or not.
DirectShow filters are COM objects with relaxed requirements for threading. That is, adding filters to graphs does not require full COM registration. Graph's IGraphBuilder::AddFilter will accept an interface pointer of your filter without asking you how you obtained it. This means in particular that if you take care of filter instantiation and then you build the graph manually adding filter and connecting pins - this will definitely work out well.
Filters, that you don't want to be registered, can be otherwise instantiated by creating C++ object directly, or by loading DLL and using its DllGetClassObject exported function the way COM would do it with instantiation through registration.
Another note is that COM class can be registered "per-user" without need to have administrator privileges, and such registration enables standard CoCreateInstance instantiation (but not Intelligent Connect - see below).
The typical problem on the way is scenario when you expect a filter of your interest, such as video/audio decoder, to be added automatically via DirectShow Intelligent Connect. This only works with full COM registration, or the alternate option is API hooking which I omit here. To cut long story short: if you are not registering the filters, you have to instantiate and add them to the filter graph yourself, via code.
A final note on embedding. The filter will still be hosted by DLL, so you will have to load executable code into memory. This means that you cannot load it "from resource" directly. Although there are certain methods to build executable DLL image right in memory, the easiest would be to keep filter DLL with you and load it as regular DLL from external file using LoadLibrary. If you prefer to have single binary, you can embed the DLL as binary resource, then extract into temporary file on runtime and then continue with LoadLibrary from there.
See also:
How can I directly embed a DirectShow Push Source filter in an EXE?
C# Register Embedded Directshow Filter
Can I make my private DirectShow filter discoverable by Moniker by external programs?

Problems using protobuf-net RuntimeTypeModel and precompile with WPF client

Can anybody shed any light on how I can use the precompiled protobuf-net serializer assembly with WCF and a client (not to serialize/deserialize in code) to speed up first use of a DTO type?
I have managed to gain a lot of petrformance improvement in my large WCF/WPF application by using protobuf-net vs. datacontractserializer. However, even though I can precompile a serialization assembly from my DTO's, I cannot make WCF or it's WPF Client use it. The web service process always takes a long time for any first call from that process involving a new DTO, presumably to generate a serialization assembly on the fly.
How can I instruct the WCF server and/or the WPF client to use my generated assembly?
On a related issue, I have properties of type SolidColorBrush in some DTO's and this makes the precompiler fall over with "No serializer defined for type: System.Windows.Media.SolidColorBrush".
I have some code to add this support to the protobuf-net model, but I cannot understand how to apply it (to the precompiler or my code), when the rest of the DTO's are decorated with attibutes e.g. ProtoContractAttribute.
Any help much appreciated
At the moment, the only way to make WCF use a precompiled model would be configure WCF manually through code, in particular adding a ProtoOperationBehavior manually, and specifying the model:
var behavior = new ProtoOperationBehavior();
behavior.Model = new MyPrecompiledSerializer();
I confess I don't have a full end-to-end WCF example of doing that. I suspect it may be easier for me, in a new release, to tweak ProtoBehaviorExtension and/or ProtoBehaviorAttribute to allow you to specify the custom serializer-type via configuration - but that code does not exist today.
In the interim, if the issue is a slight delay on the first operation, then you can also add a few of the types you need exlicitly toe the default model, and compile it:
RuntimeTypeModel.Default.Add(typeof(Foo), true);
RuntimeTypeModel.Default.Add(typeof(Bar), true);
RuntimeTypeModel.Default.CompileInPlace();
that said: the compilation isn't horrendously slow - I'd be a little surprised if it is causing noticeable delay, unless your model is really complex (hundreds of types). Is it possible the delay is just WCF, network, TCP, etc overheads?
Regarding SolidBrush, and by implication: Color - it is possible to configure them at runtime:
RuntimeTypeModel.Default.Add(typeof(System.Windows.Media.Color), false)
.Add("R", "G", "B", "A");
RuntimeTypeModel.Default.Add(typeof(System.Windows.Media.SolidColorBrush), false)
.Add("Color");
However, I have not yet added a mechanism to do this when using "precompile" - it is much trickier at the technical level: I can't just use an executable method on (say) an attribute, because the assembly being inspected by "precompile" could be for any CLI (Silverlight, WinRT, .NET 1.1, CF, etc) - and as such, it is loaded by very different mechanisms.
My preferred approach would be: don't expose it as System.Windows.Media.Color - write your own DTO class that represents the data (rather than the final implementation), and map between them. Alternatively, it is also possible to write your own utility console exe that acts like "precompile", by configuring the model then calling RuntimeTypeModel.Default.Compile(string,string) or RuntimeTypeModel.Default.Compile(CompilerOptions).

Is there a free map control?

I want to develop something with a control like this :
Bing Maps Control
Is there something advisable and for free ?
Preliminarily I will use it for education but later on It's gonna be for production.
The Bing Maps Control is free as far as I know. But, if you want to use arbitrary tile sources, try Deep Earth
There are several consideration based on your needs.
1. Do you want to use a commercial control and platform?
If you want to use a commercial platform (like Bing Maps), you have to look at the various licence options that are associated to the platform. Take a look at the various licence type so you can get the appropriate one if you want to: http://msdn.microsoft.com/en-us/library/ff428642.aspx
Also, if it's used in an education use case at the first place, you can see in the Terms of Use if you can fall in this case: http://www.microsoft.com/maps/product/terms.html
When moving to production, you will be able to use the control for free for a limited period, limited transactions and depending on your use case (see the licence link and please report to the Terms of use to see if your case fits in the free commercial licence).
2. Do you want to use a specific technology?
If you really want to use the Silverlight control, you can take a look at the DeepEarth project on CodePlex, see here: http://deepearth.codeplex.com/ or you can consider to get inspiration from this project and develop your own extension based on the MultiScaleImage control of Silverlight.
If you don't want to use a particular technology (plugin), you might consider using the Leaflet library to display the map: http://leafletjs.com/
In every cases here, you might consider having some additionnal cost to get access to tiles (Bing's, OSM hosted tiles or whatever service) might require licence to get access to the tiles in your control. You could use your own server to host your own generated tile.
We used this and it worked well for us since we were looking for a zooming/panning solution, but not for maps.
There is an open project www.openstreetmap.org, and I think that it is in long term best choice.
You can install data for whole world or just countries you need on your server, there is accurate data update ... Or you can use maps from main server, get embeddable HTML etc.

Feature tracking WinForms

I would like to extend my WinForms app, which a feature that allows me to monitor which functions are used by the users.
The idea is to count how many times e.g. a button has been clicked, or a popup was opened.
I want to know which features are used more or less often by the users.
Any ideas how this can be done? (Or even if somebody solved this problem already)
tia,
Martin
The only mechanism I can think on to do what your looking for is to use a logger like log4net / Log4PostSharp to log details to a log file on the machine, this would give you details on usage for that particular client. You would have to create a custom attribute that you could decorate your methods with that would result in something being written out to the log file, otherwise your code would end up littered with code to implement the logging!
Have a look at this article too, it uses Log4PostSharp with AOP (Aspect Oriented Programming) which would make the implementation of the logging much more cleaner (uses attributes).
http://www.codeproject.com/KB/dotnet/log4postsharp-intro.aspx
You can find some if you google for the term "application analytics" instead of "feature tracking".
I have found the following products:
includeapp.com
Software Statistics Service
Dotfuscator for .NET, DashO for Java
FusionAnalytics
Flurry Analytics
OpenSpan Desktop Analytics
DeskMetrics
EQATEC Analytics
Rapidengines
I might say that I also plan to create such a product. When it will be Beta I will add it to the list.

Resources