I'm working on a number-crunching app with some fairly (from my POV) complex math. My first thought was,
Gee, it'd be really nice to be able to take a screen shot in
Mathematica and include it as a comment in my C# source.
I see a cdata value when entering /// alongside summary, remarks, and other options. Custom tags appear to also be supported (as there doesn't appear to be any validation happening).
In order of preference, I'd like to:
Link Mathematica code to my C# source, and have said code appear, in all its Greek-laden glory, as a comment above the method that calls it (or from which it was generated). Bonus points for actually embedding the Mathematica editor in VS!
Link to an image file containing a screenshot of the above, manually generated via Paint and the snip tool, and have VS display it.
Embed the image in a CDATA section, and have it automagically render inside of VS when viewing the code, inline with said code. Generating a base-85 (or whatever) encoded version of an image is trivial. The problem at this point is getting it to display.
Ways that this is possible:
Write an app that overlays an image on the screen and, via magic, keeps it aligned with the source view in VS. (This is ridiculous, but, hey, so is a language that requires you to denote variable names with a $, and yet has a full BNF grammar available to anyone who can Google. Oh, what a world...)
I got nothing.
Suggestions? Is it possible to extend VS so that an image, or control (where Mathematica could be hosted), can appear in the source view?
(note: one of my favorite statements is "It's software. Anything is possible. Give me a 9-volt battery, a paper clip, pocket knife and a monkey hopped up on speed, and we'll make it happen." In this case, I mean within the realm of practicality.)
It looks like this Visual Studio plug-in should solve most of your requirements:
http://visualstudiogallery.msdn.microsoft.com/793d16d0-235a-439a-91df-4ce7c721df12
Related
I have an custom developed application procured from a vendor. I am able to do a Ctrl+A, Ctrl+C in this application and Ctrl+V into Word or Pbrush. This gets pasted as an image. But I am trying to do the same onto ASPX Picture Box it does nothing. I have used the code from ASP Snippets for achieving this. It does not paste anything in to the picture box. I have also checked Stack Overflow but this talks about copying C# objects as per my understanding
I have opened clipboard using the WindowsKey+ V. This shows all the historical copied image and text from previous restart but not the copied object from the vendor procured application.
Kindly suggest / help / advice me on this
A image box, or picture box of some sort will not allow a cut + paste of an image.
However note how while I am answering this question, I am freely able to cut + paste in a image!
Thus, you need some kind of control on a page that allows/supports/enables pasting in of images.
Normally for reasons of security, this is not allowed.
You have to adopt some type of html text (HTML editor), that allows such opertaions (paste of content).
CKedit is a good possible choice.
I currently use the HTML editor from the ajax toolkit.
And thus I allow this:
So, in above, I allow the user(s) to paste in text, or as above shows, a image.
Now, when I display a Radiobutton list, I can drive the user choices from above.
So, above when user hits save becomes this:
And now I can use the above "list" of choices say like this:
So, allowing user to paste in "content" for parts of your website, or in above example say enter choices, but those choices allow users to paste in text (and/or graphics) means that your site can be driven by user supplied content.).
So, in both screen caps above, the first one is a editor that lets those doing the "issue tracking" create new "issues", and we allow graphics as part of that process.
And of course for the issue edit, note I was able to type in some text, but ALSO do a screen cpature and cut + paste in the screen shot (ctrl-v).
And note how THIS editor on SO also allows this.
So, in general a image control, or even a text box control does NOT allow pasting in as image + text.
However, the CURRENT editor on SO allows this, and you can in your applications also allow this feature. However, you have to adopt some kind of editor for this process.
As I noted, ckeditor is a popular choice.
https://ckeditor.com/
And the one I was using above is from the ajaxtoolkit for web forms.
https://www.devexpress.com/Products/AJAX-Control-Toolkit/
Both of the above choices are free to use.
I usually need to come back to old codes that I hardly remember after some weeks of work with other projects.
I try to write comments concisely, but still codes becomes messy.
Since I work mostly with computer geometry in Visual Studio C#, I was wondering if there is any "easy" way to add image comments rather than text?
I often place such 'documentation' in a project subfolder...
Then use the local FILE:// URI convention to link that image into my code comments or ever XML markup.. with the triple slash convention... which of course shows within intelligence
A comment can certainly link to an image (as a URL for example). But no, you can't embed an image as a comment. Code files are just text, not Word documents.
If the problem is that the code isn't clear and you're relying on comments to understand it, then the solution isn't to add more comments. The solution is to write code more clearly. Give variables semantically meaningful names, extract operations (every very small ones) into semantically meaningful methods. The code itself should tell you exactly what it's doing.
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.
I've been working on a WPF control for a few weeks now that contains a XAML-drawn map and has the ability to zoom in / out and pan the map. Also, it contains a converter that converts screen coordinates to lat / long coordinates which works pretty nice, however, the converter works based on few constant parameters that should be available when the application gets loaded.
Right now, those parameters are loaded with the non-XAML map file (.dwg file) which requires me to have a reference to an external library and the loading of the file takes up a few seconds when the application is loading for the first time, which is kinda annoying.
I wanted to store that information as constants in my C# code-behind for the XAML control, however is there a way to embed those constants in the XAML itself? Since the control should be as generic as possible and should support all maps that I will give it in the future (each having different parameters) I want the code to read the parameters from the XAML file and use it in the code.
If I wasn't clear in my question please let me know.
You may want to look at this article. It is about Silverlight but it should be applicable. This Code Project article may be of some use also.
MS Word has this capability in its Hebrew and Arabic versions. I would like to achieve this in a windows desktop application, using .Net (may be with win-api calls).
As explained in the link provided by Otaku here, current rich text edit controls can not handle this (unless you go for the hack OP in that Q did, which did not seem like a very good solution).
You could write code to do this manually yourself, ditching the text edit control completely, but that would probably mean a lot of work. It took Microsoft years to get support for combining diacritics working properly in MSWord. I would search for open source software that has this capability, and look at how other developers have done it. It might be hard to find, though, and you would likely have to step outside .NET-land. Maybe OpenOffice can do this?
This discussion might also be of help.
I am afraid that you will find, though, that you'll have to manually parse the Unicode and assign colors to the correct glyphs. If you want to be complete, that is one heck of a job.