simple C graphic library for demo a matrix - c

I have been asked to display a pretty big matrix like 200*300. It's kind ugly when i output this to console..
The matrix is changing during an iteration, I have to show this as well.
I wonder if there is a simple tool I can use to display this matrix?
hopefully, I can call it in my C program.
I don't have any graphic programming experience.
Thanks!

Try GNUPlot:
OSX Installation:
http://www.miscdebris.net/blog/2009/09/16/install-gnuplot-on-mac-os-x/
Project Homepage:
http://www.gnuplot.info/download.html
I have used it in numerous projects. It is very easy to generate plots. In your case, you could just create a scatter plot, and export it to JPEG in a few simple steps.
If you don't want to have to build and integrate it into your application, you can just send commands via the "system" function to a prebuilt GNUPlot application.
http://www.cplusplus.com/reference/clibrary/cstdlib/system/

You could use SDL (libsdl.org) to make a display window and output each character as a pixel on the window.
Here is a test app so you can take a look at how it works:
http://friedspace.com/SDLTest.c

I really don't think you want to go into a graphics library for this. Instead, I would suggest dumping the data to an output file, and handling it from there.
For one, you could just format it to fixed-width fields, and view the text file with a text editor:
000 001 002
099 098 097
...
Or, you could consider dumping it as CSV, and importing it into something like Excel.

Related

How can I detect visual blocks in a PDF?

I'm trying to OCR resumes. My first problem is, before OCR, to get the main blocks of a document.
Since all the resumes have "visual blocks" (referring to professional experience, skills, languages, hobbies, whatever ...), I wonder if there's any open source solution to "split" into "blocks" a document, obviously no matter the layout design (that's where some kind of AI will work, I assume)
Thank you
First decompress your pdf using zlib.
you will then be able to see the pdf in a readable format - https://web.archive.org/web/20141010035745/http://gnupdf.org/Introduction_to_PDF#A_first_example
The pdf format is kind of similar to postscript.
also try converting your pdf to postscript to see how contents are arranged.
you can decompress the pdf using pdf-parser https://blog.didierstevens.com/2008/10/30/pdf-parserpy/
try this as well - https://gist.github.com/averagesecurityguy/ba8d9ed3c59c1deffbd1390dafa5a3c2
Once you can see how your data is presented => you can then start applying alogorithms to extract more meaning.

Is it possible to output formated text in a text file?

I`m working at a little text editor. My application is a winapi one in C. The idea is to write text in a large textbox(like in notepad) and then when I press a button it will take all text into a buffer, format it after some rules and then put it in a .txt file.
For example, if my input is:
Anne \red(got) \blue(\bold(apples)) and \italic(\bold(snails!))
After I parse it, it`s possible to put it into a .txt file and after I open it to see it like this?
I want to thank everyone for their time. I got exactly what answer I wanted. Everyone here rocks
I think that you are programming for fun, just for the pleasure of it, and with the perspective of learning more. If that is the objective, then it is okay to invent your own formats and essay your own solutions.
The problem presented can be twofold:
does the format results need to be shown in the editor itself?
or do you just need to do something that is going to be rendered in an external program?
If you are after the first possibility, then you need some Win32 (given your environment) component that will show the formatting. That component is RichEdit, and it implements RTF, a codification that can be saved to a text file, and which is more or less standard.
If you have the second possibility in mind, then you can choose from a variety of codifications. You would just be creating a text editor, probably with some helpers that write part of the commands for the user. For example, you could be creating a HTML editor, or a RTF editor.
There is a third possibility, though. You create your own codification, and when saving, you translate that codification to HTML, and then open the document in a web browser.
Say that you have:
\bold(hello), world.
You would translate that to:
<html><body><b>hello</b>, world.</body></html>
The possibilities, as you can see, are inifinite.
Hope this helps.

Export individual cell in IPython/Jupyter notebook

I am able to export the entire notebook as HTML, but I would like to export just a single cell, together with its output.
Is there some way of doing this?
One way to do this is to use a custom preprocessor.
I explain how to do this briefly in response to Simple way to choose which cells to run in ipython notebook during run all.
To summarize: you can extend nbconvert.preprocessors.ExecutePreprocessor to create a preprocessor that checks cell metadata to determine whether that cell should be executed and/or output.
I use Jupyter Notebooks for report generation all the time, so I wrote a collection of custom processors to extend nbconvert behavior:
meta-language to determine what cells get executed and included in the final report (if/else logic on entire notebook sections)
executing code in markdown cells
removing code cells from output.
taking input arguments from the command line
I haven't had time to wrap these in an distributable extension, but you can see the code here: https://gist.github.com/brazilbean/3ebb31324f6dad212817b3663c7a0219.
Please feel free to use/modify/do-great-things with these examples. :)

A good binary file format that allows meshes, skeleton bones and animations

I have a question. Is there any good file format (binary better) that allows meshes, skeletons and animations? .3ds doesn't export animations, and .iqm doesn't work very well.
Thanks :D
Fbx supports animations, but it is close source.
Now I use pmx, a file format developed by anime amateurs. So it is so miniority. However you can find fully format description here PMX (Polygon Model eXtended) 2.0
And vmd for animations vmd file format
If you want to use some libraries or software,I recommend fbx. If you want to write your own, you can study about pmx, that is very simple and clear.

Easy to extend IDE for C

I want an simple IDE/editor for C in Linux to which I can add features easily. For example: I want to add a right click menu item and a related action for the editor. It should be easy to extent and add any desirable functionality. I tried eclipse CDT but its to much of learning(I mean knowing the eclipse plug-in architecture and the CDT extension points and stuff) to do for the small modification/s I want to do.
Thanks,
Sachin
I personally use Code::Blocks, which according to their website also has a Linux ditribution. http://www.codeblocks.org/
I don't know whether it's very extendable, but it has all the features you'd expect from an IDE.
QuantumPete
I would try emacs (but the programming you have to do is in LISP. it is easy, when you get the knack with parantheses). you can do the programming depending on context of the buffer (.c other than .h) an it has a very big c-mode which has many of the most need things implemented already.
Example: insert if
;; the indention-thing needs refining
(defun pm-if ()
"generates if stub"
(interactive)
(insert "if () {")
(indent-according-to-mode)
(newline)
(indent-according-to-mode)
(newline)
(indent-according-to-mode)
(insert "} /* endif */")
(indent-according-to-mode)
(newline)
(indent-according-to-mode)
(previous-line 3)
(end-of-line)
(goto-char (- (point) 3))
)
;; bind it to CTRL-c i
(define-key Ctl-C-keymap "i" 'pm-if)
Look at QDevelop - it`s quite simple but featured ide/editor for qt applications. 5 mins look at source files gives me a way to add a right click menu item :) Steps to reproduce:
Download source, try to build - i had no problems with that
Run, right click on some text in editor window - for instance there is a "Goto Implementation" item there
That text is in src/textEdit.cpp file as:
connect(menu->addAction(QIcon(":/treeview/images/cpp.png"), tr("Goto Implementation")), SIGNAL(triggered()), this, SLOT(slotGotoImplementation()) );
So, slotGotoImplementation() - is a func that will be called. Add your actions in a way like all other actions implemented there.
There are some information on a site about writing plugins to the editor - may be it`s a better way to extend features, but adding some pieces code to source seems easier.
Look at codeblocks and how to write plugins for it. It is the simplest way to add new functionality to the current application. This should be a good starting point for doing a plugin for codeblocks.
Acme
http://plan9.bell-labs.com/sys/doc/acme/acme.ps
this is the Linux port
http://swtch.com/plan9port/
Look into Anjuta. It's an IDE for GNOME/Glib type applications and to my knowledge is written in C, and has a plugin framework that should be useful.

Resources