R statistics console in QT - r

I am planning to link a Qt project against R to provide some statistical funcionality. I thought it might be quite cute to add some generality to the project by having an R console as a Qt widget within the tab to allow me to do analyses that I haven't thought of in the design stage later on. I was wondering whether it is something that might be accomplished fairly easily?
In particular I'm stuck on how I would access the RTerm from QT? Has anyone else attempted something similar or can give some hints on where to start?

One of the examples for RInside does something pretty close---in around 200 lines most of which deal with the other GUI aspects, it wraps R functionality inside a Qt application.
The example implements a GUI density slider, and the edit box allows you to write an almost arbitrary R expression, or rather the parts that are then passed into an evaluation to generate random number: rnorm(50), or for a mixture c(rnorm(50), rt(50)) etc. You could possibly build on top of that.
See this blog post for more.

Check out Carson Farmer's work on manageR:
http://www.ftools.ca/manageR/
this is a plugin for Quantum GIS (mapping package) that interfaces it to R, giving you exactly what you want - an R console wrapped in a Qt4 body - as well as data transfer between Qgis and R. It handles plots as well.
I've tried to encourage Carson to produce a standalone R Gui project from this code, but he's a busy guy. Aren't we all?

RStudio is largely written using QT, you should be able to have a look at their code and build something similar into your Qt based application:
https://github.com/rstudio/rstudio

Related

Julia's equivalents to R's help pages and vignettes?

Coming from an R background, and just started learning Julia, I wonder how's documentation in Julia, and if there are analogues to R's help pages and vignettes.
Furthermore, in R, one can document functions using roxygen comment blocks, is there also something similar in Julia?
I think it is best to understand how things work by example. I will comment on how DataFrames.jl is documented as this is a pretty standard approach:
Functions are documented using docstrings, here is an example of a docstring of function names; These docstrings are then discoverable interactively via help system (by pressing ?)
A standard way to generate a documentation for a package is to use Documenter.jl; by the way: the package has a great team of maintainers who are very helpful and responsive; here you have a link to the make.jl file that is executed to generate the documentation; note in particular the option doctest=true which makes sure that all code examples that are properly anoteted following Documenter.jl rules are producing an expected output
In order to set-up auto-generation of package documentation you need to set up CI integration on GitHub; again - there are many ways to do it; a standard one is to use GitHub Actions; here you have a link to the part of the ci.yml specification file that ensures that documentation is built as a part of CI; then in any PR, e.g. this one (I am giving a link to a currently open PR that is documentation related) you can see in the section reporting CI results that after running tests also documentation was generated. Here you can see how a documentation generated using this toolchain looks like (e.g. note that at the bottom you can switch the version of the package you want to read manual of dynamically which shows you that all here is really well integrated - not just a bunch of PDF or HTML files).
I hope this will help you to get started. I have pointed you to all essential pieces that are normally used by packages hosted on GitHub (i.e. this is not the only way to do it, but it is a standard way most commonly used).
To master all the details of the above you need to read the documentation in the Julia Manual and Documenter.jl carefully. Unfortunately writing a proper documentation is not easy (in any programming language). The good thing is that Julia has a really excellent toolchain that supports this process very well.

How to make own text editor for math equation?

I'm using C# on Windows (but I can also use C++)
What I want to make is just an own text editor that I can write/edit mathematical equations/formulas.
Reason why I'm looking for this function is that the calculations of my structural analyzing programs are only editable with in my C# code. I want my programs provide a function that a user can add their own formulas for design checking or whatever so that my programs can be more widely used.
I know how to parsing equation of string form to multiple variables in code so I can compute what I want. However, I really have no idea that how to display own text editor. I think it can't be done by textbox and only thing I can think of is using opengl api. But I believe there should be easier and efficient way to this job done.
My programs are currently run on windows only but I'm planning to make OSX version and web version as well. I don't mind if solution only available for windows only or not. If anyone knows easy way to display own text-box, please help me. I will really appreciate for it. Thanks for reading my question.

Is there any method for fix manually an Alloy Analyzer graph?

I need to fix my Alloy graph, for example I have this output:
I can't move "node2" rectangle over the row of "node0" and "node1", and I can't move "node1" under "node2" whitout also move "node0". Is there any solution? Thank you.
PS: I am using Alloy Analyzer 4.2 under Windows.
PPS: This is only an example, i get a big graph with 5 or 6 rows of 20-25 rectangles, and if I can't fix it manually, it's only a mess.
To answer the direct question: I for one have never found a way to make the visualizer change its mind about which nodes should be on the same horizontal level. (That doesn't quite mean it's not possible, but it does mean that if it's possible it's not immediately obvious how to do it. But I guess you knew that already.)
If your goal is to make the auto-generated diagrams easier to read, the simplest approach is to experiment with adjustments to the visualizer theme. The "Magic Layout" button can be helpful; manual adjustments to hide some nodes or display some relations as labels rather than arcs can help with diagrams which are otherwise too cluttered.
If your goal is to make a 'good' version of a diagram for inclusion on a slide for a talk or a figure for a paper, you may want to export to Dot and import into a graph-drawing tool that gives you the kind of manual control you want (or edit the .dot file yourself, if you are familiar with graphviz and can make it do what you want), or export to XML and generate the graph description language of your choice from the XML.
I hope this helps.
The Lightning tool is an Ecplise plugin relying on Alloy4.2 to formally define Domain Specific Languages and might be a solution to your problem.
It's still under development, but if you are only interested in being able to freely reorganize each atom and label of generated instances, there shouldn't be any problems, as it uses Ecplise draw2D to render those latter.
If now you're really interested in providing an intuitive visualization to your generated instance (by intuitive I mean a visualization that is closer to its domain rather than the structure of your model), then you can define your own language (with your model as abstract syntax ) and define a concrete syntax for it.
The update site to be used for the installation of the tool is : http://lightning.gforge.uni.lu/update-site
Don't hesitate to contact me if you plan to give it a shot and get any issues.
(I'm eager of constructive feedbacks ;-) )
The steps to follow to generate a graphical instance in which any components can be moved are :
Install Lightning
Create a new Lightning Project
Create a new Language in this project
Put your model in the ASM folder
generate instances of the language by "running the project"

How to integrate matlab with QT

I want to call matlab from QT 4 (used for UI only in my project) where i can pass values and read values back from matlab. and also run the .m scripts and then get the results back from matlab.
QT is irrelevant here.
You basically want to use the Matlab Engine. You can call Matlab from compiled C++ (for example). You'll probably want to use engOpen to start the connection and then engEvalString to run scripts. You may also want to use engGetVariable, mxGetClassID and mxGetDimensions to access the results.
But definitely read the documentation and try it, then come back with more detailed questions.

Ada: plotting 2d graphs

it would be interesting to be able to plot a 2D graph within an Ada code rather than having to save values say to file and use an external drawing software afterwards. A search on the web has taken me to two packages: Win_IO and JEWL. I have been able to use WIN_IO though but the documentation is quite poor and having just started using it, it seems that it is not possible to resize the size of the canvas. I use the GPS editor and I get complaint when running Win_IO that some fonts are not available on my system and that the output will be ugly. Finally the plot doesn't itself pop up on the screen; One has to click on the exe file of the file being compiled and linked so as to get the graph.
I have taken a look also at JEWL but it doesn't seem to be able to plot graphs.
Are there more Ada packages available out there for plotting 2D graphs.
Thanks a lot...
My experience with GNAVI:
The installation instructions are at
http://www.gnavi.org/index.php?Command=Class&ClassID=Start&CID=381
Basically the installation consists of:
To use:
Place this directory on your path
cd to gnatcom and run: make install
cd to gwindows and run: make UNICODE=1 all
run: gnavi_ide and enjoy :-)
But the installation is plagued with errors:
C:\gnavi\gnatcom>install
Installing GNATCOM.....
MAKE Version 5.2 Copyright (c) 1987, 2000 Borland
Error makefile 2: Command syntax error
* 1 errors during make *
Install Completed
C:\gnavi\gwindows>make UNICODE=1 all
MAKE Version 5.2 Copyright (c) 1987, 2000 Borland
Error makefile 2: Command syntax error
* 1 errors during make *
And though C:GNAVI is on my path, the IDE still complains that icg.exe which is found in C:GNAVI is not on the path.`This is trouble with software which has not been fully tested!!! I was very disappointed that people can write irresponsible and incomplete installation instructions. Have the developers even found out that whether a normal user can install their software?
I have also try to look at AdaDesigner at https://gna.org/projects/adadesigner
Here, FireFox complains: This Connection is Untrusted
gna.org uses an invalid security certificate.
The certificate is not trusted because the issuer certificate is unknown.
I decided not to visit such a website.
PLplot is a cross-platform package for creating scientific plots. It has a well-documented Ada binding. For reference, this gallery illustrates a variety of plots. Click a thumbnail to view a full-size image. Click either Ada tab (standard or traditional) to see the corresponding source code.
I'd give a try to GTKAda. I'm not completely sure this subsystem would allow you to do 2D graphs as I've never used it for that purpose, but it can be done with GTK+ (C/C++).
There is also a guide on GTKAda and a reference manual, some documentation on the GTK toolkit itself may also come handy.
It depends on exactly what you want to do. For graphing node-based diagrams, the first thing I'd look into using is Graphviz. It has its own special graphing language it uses, but I'm all about using Domain Specific Languages when appropriate. Ada has great interoperability, so using DSLs with it can really make it powerful.
An example I found is AdaDesigner, which generates Graphviz DOT files to help visualze the structure of Ada code.
The one time in the past I had to do simple plotting, it was for a web app. I ended up dynamically generating SVG pages on the server side (even though it was poorly supported then). Support is better now, so I'd definitely use it again today.
If working directly on a Windows PC display appeals more to you, there are several options for GUI bindings, all of which should support drawing lines and points on a canvas. In addtion to GTK (which is both powerful and portable), there are a few Win32 API's floating around. I think one comes with Gnat. Another you might not be aware of is GWindows. It is part of GNAVI, which aims to be sort of an OpenSource alternative to Delphi. It isn't the most active of projects, but is (reportedly) quite useable, and is still being worked on and used. Here are some screenshots of it being used for plotting.
(source: gnavi.org)
MathGL is cross-platform GPL plotting library. It have C interface, so you can use it from yours code too. Also it can create a window with graphics -- i.e. you don't need to study/use other widget libraries in simplest case.

Resources