I want to have a program which generates diagrams for trees, ones looking pretty much like this
It is to be a part of a project I am working on using C#, but if there is a way to make a Python or Javascript do it, that be okay as well. Maybe some C# library, or JavaScript/Python library with parameters I can provide to it ?
The most important thing, regardless of the programming language, is that it be easy to use.
You may want to use pydot, which is an interface to the Graphviz .DOT format visualization software. As outlined in the Graphviz guide, the .DOT format lets you design graphs similar to the one you posted as well as more much more sophisticated ones.
Here's an example from the pydot doc:
import pydot
graph = pydot.Dot('graphname', graph_type='digraph')
subg = pydot.Subgraph('', rank='same')
subg.add_node(pydot.Node('a'))
graph.add_subgraph(subg)
subg.add_node(pydot.Node('b'))
subg.add_node(pydot.Node('c'))
If you're looking at Javascript instead, canviz is a well-respected library that allows you to draw .DOT graphs to browser canvases.
There is a C# wrapper around the Graphviz bindings.
I'm working on a project that generates trees with Graphviz (not in C# though) and it works great.
Related
I have a batch of HTML files which need some editions easy to perform with jQuery (mainly selecting some nodes and changing their attributes).
My approach to achive this, has been opening them one by one in Google Chrome, excecuting the jQuery code in the console, and then copying the resulting DOM back to my HTML editor.
Since what I'm currently doing takes a lot of time, and also due to the fact that every file needs the same edition (i.e., the same jQuery/JS code will work for every HTML file), I am considering to write a script/program to do this.
Anyway, I am not completely clear of which of the following (if any of them) approaches I should take to accomplish this task.
Write a JavaScript script with jQuery using some FileSystem/File manipulation library (which one?)
Write a Java or C# program using some jQuery-based library (like CsQuery)
Finding a plugin for some of my editors (Aptana, Notepad++, Eclipse, etc) or a completely different editor that supports jQuery-like commands for edition (just as notepad++ regex replacement support). This would be slow with big batches, but at least it would allow me to avoid the annoying copy/paste to/from Chrome.
Is one of this approaches the right way to accomplish what I need? (Is there a right way to do this?) Which should be more straight-forward?
I think that #2 would be easier for me since I have a lot more experience in Java and C# than in JavaScript, but I think that maybe that idea would be sort of using a sledgehammer to crack a nut.
You should consider using PhantomJs. It is a headless WebKit which can be executed from te commandline. It accepts a javascript or coffeescript file as a an argument, which can be used to e.g. do something with a web page. Here is an example:
var page = require('webpage').create();
page.open('http://m.bing.com', function(status) {
var title = page.evaluate(function(s) {
return document.querySelector(s).innerText;
}, 'title');
console.log(title);
phantom.exit();
});
I am not sure of the right way but it sounds like you are familiar with C# and would think writing a class library would be the least overhead for automation. Here are some potential solutions:
Scripting Library (e.g., C#.NET) - You can use a library like the one you mentioned or something like ScriptSharp if you want to use DOM manipulation. If the HTML has appropriate closing tags you can also use LINQ to easily navigate the HTML (or something like the HTML Agility Pack found on CodePlex). I would even recommend using Mustache with an HTML file template in C#.
JavaScript Library - If you wanted to stay in pure JavaScript you can use Node.js. There are file manipulation libraries you can use.
Headless Browsers - Haven't thought through being able to save the resulting HTML automatically but you can use something like jsTestDriver or Phantom.js
You can go with the plugins in editors as well, but I would stick with a Java, C#, python, etc. library that you can potentially call from existing application or schedule as a job/service.
I have an ANTLR grammar that defines a DSL (domain specific language). This grammar is relatively simple. It is parsing the language and outputting C code to create a very basic translator.
This language is meant to be used in C# application (typed into some sort of control, whether it be RichTextBox or a custom control) and one requirement is to have syntax highlighting for this language. I have scoured the Internet in hopes of finding some sort of information on how to accomplish this, or find a tool to make this a little easier on myself.
After not finding too much information, my best assumption would be that I need to use the ANTLR generated lexer to look at the tokens and color them accordingly. Is this the correct path of action, or is there some other method/tool to provide syntax highlighting for custom domain specific languages? If this is the correct method, how do I go about recognizing specific tokens?
If I left out any important information, please ask! Thanks!
I successfully used AvalonEdit for a similar project of mine. I just created a small editor with the correct syntax highlighting.
It is very easy and quick to get it up and running in your project. You just have to provide it with a simple XML file to document the syntax of your DSL and you will have a colored output out-of-the-box as a WPF control.
It looks like they added completion facilities since I used it, I don't have experience on that part though, but I suspect it is also very well done if the quality is the same as the colouring.
This language is meant to be used in C# application (typed into some sort of control, whether it be RichTextBox or a custom control) and one requirement is to have syntax highlighting for this language.
Consider using Scintilla for your control. It's a text control for IDE-style text editing. Notepad++ uses it for its text control, as does the SciTE IDE from which it originates. I've used it in a small, custom IDE project written in C# using an unofficial .NET-specific version -- I think it was ScintillaNET.
Scintilla supports custom keyword highlighting and also a variety of programmable features like squiggly-line underlining and things like that.
If you have a control that you'd rather use, I think it's reasonable to use a small ANTLR lexer to produce tokens for you. Each token contains the line number, starting character position, source text, and token type -- everything you'd need to know what to highlight and how. The only hassle would be running the text through the lexer each time the text is changed. There are efficient ways to do that without re-lexing the entire document, but it's still something to keep in mind.
Here is the situation:
We ran a brainstorming session to find all the tasks we will have to achieve for our project
Now, I want to create a Gantt Planning (for instance) with all these tasks
We already built a MindMap with Xmind (I sometimes use Freemind too, or I could also export the Xmind to a Freemind format).
I would like to create a Gantt Planning in Microsoft Project (this is what we mainly use here).
My questions are:
Has anyone of you ever tried to automate the creation of a Gantt from the MindMap (using each level of the MindMap as Title and each leaf as Tasks)?
Would it be possible with VBA? Or C#? I didn't find much API to Xmind of Freemind, did I miss something?
If you can convert your mind map to Freemind, there is some documentation on the Freemind site which provides a couple of approaches to reformatting the Freemind file as an XML file which MS Project can read.
I maintain MPXJ, a library which can be used to read and write file formats which MS Project works with. I felt sure that someone had already written an add-on for Freemind which allowed you to export mind maps as a project plan using MPXJ... however I can't find a reference to it any more! If you don't mind a bit of coding (in Java, or any of the .Net languages) it wouldn't be too hard to achieve what you want using MPXJ.
Jon
We're doing exactly that with STOIC.
Is there any component of MathML Renderer which can be used by Dot Net App? I hope you could help me find one no matter how much it costs.
Detailed Requirements:
it can provides a control for equation edit
it must not be a COM component
it must support Content MathML markup (it will be better if it could support both Content and Presentation markup)
it could generate the markup according to the formula
it could generate the formula according to the markup
I have found some tools such as MathML .Net Control and NuGenEQML .Net, but unluckily, both two components don't support Content Markup.
I have the same need. There's only three options that I am aware of:
= MathFlow by Decision Science - I will soon be evaluating this one and am hopeful it will be my new solution; they've provided presentation MathML for MS Word for a long time; they finally came out with a Content MathML offering
= Integre - I've used their COM control in .NET... painful; they have a Java one, but was never able to get them to do a .NET wrapper; they are working on a Flash one that I thought I'd be able to wrap and embed, but I've grown tired of waiting
= Forumulator by Hermitech - seems to be a step down from the two above
If you uncover any others, please post here.
I have a c# winforms project with many forms, now I want to localize these forms to another language, is there any way or code that generates resource files for forms and translate them online?
Thanks
There are open source tools which allow to translate resx files. I haven't found a version which uses a online translation service such as google translate or the microsoft translator api or even the bablefish. But I think the Resx Translation Helper (open source project) should be very easy to modify. Note however, that the author explicitly discourage the usage of autogenerated translation:
It does NOT automatically translate because user-translation is currently still much better than automated translation.
if you will be able to generate resx file from your sources. maybe Crowdin.net will be suitable solution for online translations.
The Visual Localizer tool utilizes Google Translate, Microsoft Translator and MyMemory for this very purpose. It has also many other features regarding automatic localization in .NET.
You can use ReSharper plugin and/or RGreatEx - The ReSharper Great Extension
and U can easily Move strings to resource to translate them for specific language.