Eigen3 and Clion: How to display matrix contents in Clion ide? - clion

I have followed the instructions for updating my GDB for use with Eigen3. However, the CLion IDE is unable to load the contents of eigen matrices in the debug panel.
What should be a quick validation and debug process of results is turning into a time consuming manual print process (or worse: running gdb in interactive mode in cygwin's terminal).
There must be a way to enable eigen to be used with clion's debugger?

There is quite a simple way #Chris and anyone else looking for a solution using GDB, CLion, I tested it on ubuntu but it should work on any system.
Part of the solution is already in the eigen repository, just needs a bit of tweaking.
Eigen printers
What I changed is the python module import logic:
Save printers.py to a newly created printers directory under any directory of your choosing, lets say /any_full_path/printers
make sure you create and empty __init__.py
Create a ~/.gdbinit in your home directory
Copy paste the slightly changed(from the original repo) script below
python
import sys
sys.path.insert(0, '/any_full_path/printers')
from printers import register_eigen_printers
register_eigen_printers(None)
end
Feel free to ask for more screenshots or other clarification, caus that should work simply like a charm.

I've managed to make lldb work in CLion using this project on windows: https://github.com/fantaosha/LLDB-Eigen-Pretty-Printer
You need to create .lldbinit in your home directory and add similar line:
command script import "C:\Users\user.lldb-eigen-data-formatter\LLDB_Eigen_Pretty_Printer.py" (ofc this folder and file needs to be cloned as per the readme on github)
Now Clion will import this script bit you will get some errors, you need to remove the question mark in the regular expressions as described here:
https://github.com/fantaosha/LLDB-Eigen-Pretty-Printer/issues/4#issuecomment-747329527
Now CLion will be able to show you the matrix, vector etc. values (but without newline - at least on windows).
For gdb specifically it should be what uta answered but I haven't tried it because I'm using lldb. Maybe you can try changing the debugger to lldb if you don't use anything specific related to that.
Hope this helps in some way!

Related

is there any way to change .exe file into .apk?

i made a python script with tkinter, python and i turned it into a program folder with .exe file that woks correctly using auto py to exe .
I m asking if there is a similar solution to turn this exe folder into an apk file and thanks
I think I understand the substance of your question.
I am not too much in the style of putting -1 on questions because I believe that no question is good or bad.
Be aware that there is no miracle method to transform your script into an android application. There are solutions to do things with python and android (notably Kivy) but not with Tkinter ...
Happy development!
See you soon
Actually there are ways of changing exe files to apk, but some controls (touch, scoll) doesn't always work as you might expect it to.
You can find how to do this here although I wouldn't exactly recommend it

Windows 8.1 Pro MinGW Gfortran Command Prompt 'not recognized command' error

C:\Users\redacted\Documents\redacted>gfortran hibrac.f -o hibrac.exe
'gfortran' is not recognized as an internal or external command,
operable program or batch file.
https://gcc.gnu.org/wiki/GFortranBinariesWindows seems similar to my problem: gfortran.exe is in C:\Windows\MinGW\bin -- except the solution appears not to apply to Windows 8.1 Pro:
Right click on My Computer, Properties, Advanced Tab, Environment Variables.
Instead I tried: Right click on 'This PC' within File Explorer, Properties, Advanced system settings, Advanced Tab -- and I cannot find an equivalent-looking section that allows me to proceed with the advised solution.
As background information:
I had installed MinGW Installation Manager which installed mingw32-gcc-fortran (together with mingw32-base, -gcc-g++, and -gcc-objc) in the recommended C:\Windows\MinGW folder, without any apparent error message.
Isn't it acceptable -- standard practice -- to have one's code in a folder separate from this MinGW folder? i.e. a subdirectory of my Users\account rather than a subdirectory of MinGW. This isn't the problem, is it? What do I need to do to get it to recognize the gfortran.exe, or call it correctly?
Please tell me what to do to get it working. If it's relevant, I have a Japanese computer with an English language pack installed (it seems to have some gaps, such as some text in the Settings charm or startup/shutdown text being in Japanese).
This looks very much like you have neglected to add C:\MinGW\bin to the effective PATH for the command window, in which you are attempting to run the gfortran command.
Your question isn't entirely specific on this point, (i.e. you could improve the question), but you hint that you were unable to add the appropriate PATH entry to the global environment variables, because you couldn't find the appropriate control panel applet? I know that this is often recommended as part of a MinGW setup, but the installer will not do it for you, because I, as the maintainer of mingw-get, don't consider that to be best practice; much better, IMO, to add it for each specific command window in which you need it to take effect, by running (once, at the start of each command prompt session) the command:
path %PATH%;C:\MinGW\bin
If you prefer, you may create a batch file to do this for you, along with any other initializations you wish to perform, (or better still, use MSYS as the working shell environment, in which case the PATH initialization is taken care of by the shell's own initialization scripts).

How to compile the examples from the documentation?

I am following the Rust docs hello world program section, and I have it made and saved. Now it asks me to compile it by using the command line. However, it doesn't say where to start the command line from, or how to enable rustc command. I am hoping someone actually can answer this question, as I did not find much on the topic.
I fixed the issue. For anyone who is wondering, if you are on Windows you just have to add the Rust bin file to the path. You can go to:
Control Panels > System and Security > System > Advanced System Settings > Environment Variables. Then, scroll down to Path, and click edit. Add the path to the Rust/bin folder. I actually did this one time before I asked this question, but it was removed for some reason. Adding it backed worked for me.

Programmatically locate gswin32.exe

My program needs to locate an existing GhostScript install, and run gswin32.exe (or the 64-bit version if installed) with some command-line options to do a silent conversion of PS to PDF. How should I go about this? I see they add some registry settings under HKEY_LOCAL_MACHINE\SOFTWARE\GPL Ghostscript\9.07, but I only see a LIB path (which has several paths) and a DLL path, nothing for the EXE. I could work backwards from the DLL path, I guess, but not sure if that will be "future proof".
For the type of app GhostScript is, I would assume they would make this part very easy and obvious, since a lot of programs will be doing exactly this. With all of the free "print to PDF" drivers out there, you would think this info would be easy to find, and maybe it is, but I sure can't find it. Hopefully I'm just missing something, because I don't know where to search, or the right keywords to find it on Google.
I'm tempted to use "GSLite", but so far the only places I've found to download this doesn't have any info on how to download the GS source code for the build of GS they are using, and I think that violates the GS license (not making source code available), so for now I'm just thinking I'll have users install GS themselves, and just look for it -- instead of making it a sub-folder under my app or anything like that.
try ftype (which of course may give acrobat or something, but worth a shot)
maybe some windows expert can tell how to acess the alternate apps list you get by right clicking a ps file...
HKEY_LOCAL_MACHINE\SOFTWARE\Artifex\GPL Ghostscript\9.07
After doing a registry search for a few different keywords, I found the above key which contains a (default) string that points to the install directory. I then did a Google search on that registry key and found some links to the GhostScript source code that sets that value, so I think it is safe to use. I would post those links here, but none of them are good sources (one I had to use Google's "from cache" feature, and the other was just a random person posting a snip-it of GS code). I'm sure it is in the official source code download from their website, if anyone else needs to confirm this, possibly a file named nsisinst.nsi, an install script.

How to Debug Following Fortran Program

I am trying to compile the following software so that I can step through and debug it. I am only a novice programmer and I am trying to understand how this whole makefile business works with Fortran. I know that there is a ton of literature on makefiles but I just need to insert a simple debug flag and I think if someone provided me with the answer to this question that would be the best way for me to learn.
So the program I am trying to compile, TINKER, is actually made up of several packages, located at http://dasher.wustl.edu/tinkerwiki/index.php/Main_Page. I would like to compile and debug JUST ONE specific executable, "analyze". I contacted the developer and received the following reply but I am still stuck...
Since TINKER has lots of small source code files, what we do is
compile each of the small files to an object file using the "-c" flag.
Then we put all of these object code files (ie, the ".o" files) into
an object library. Finally, we link each of the TINKER top level
programs, such as "analyze", against the object library. There is a
Makefile supplied with TINKER that does this. We also supply
individual scripts called "compile.make", "library.make" and
"link.make" for various CPU/compiler combinations that can be run in
order to perform the steps I describe above. To build a "debuggable"
executable, you just need to include the appropriate debug flags
(usually "-g") as part of the compile and link stages.
I am currently running OSX 10.6.8. If someone could show me which folders I cd into, what commands I enter that would be so great!
Thanks!
My follow up question (once I can figure out how to answer the above via command line will concern how to import the same procedure but using the Photran IDE - http://wiki.eclipse.org/PTP/photran/documentation/photran5#Starting_a_Project_with_a_Hand-Written_Makefile)
The directions are at http://dasher.wustl.edu/tinkerwiki/index.php/Main_Page#Installing_TINKER_on_your_Computer
Maybe out of date? g77 is obsolete -- it would be better to use gfortran.
The key steps: "The first step in building TINKER using the script files is to run the appropriate compile.make script for your operating system and compiler version. Next you must use a library.make script to create an archive of object code modules. Finally, run a link.make script to produce the complete set of TINKER executables. The executables can be renamed and moved to wherever you like by editing and running the ‘‘rename’’ script."
So cd to the directory for the Mac -- based on "we also provide machine-specific directories with three separate shell scripts to compile the source, build an object library, and link binary executables." Then run the command scripts. Probably ./compile.make. Look around for the directories ... you can probably figure it out from the names. Or search for the file "compile.make".
Or find someone local to you who knows more about programming.

Resources