Is it possible insert image to a code comment? - c#

My question is probably an insane idea, however, it's very valuable when I write code for educational purpose.
Especially when the code is relevant to math and physics, images inserted in comment are more convenient and articulated.
Until now, I can't find a way succeed to insert a true image into comment, not C# nor python or any other common programming language or IDE.
Using tools that convert images to ASCII image is a workaround but less precise.
Any idea is appreciated

There is an example here that extend the Visual Studio 2010 editor: Image Insertion (but it's tied to Visual Studio, not a generic solution)

For Python you can use Google Colab.
Inside a text-block you can write something like:
![Alt text](https://someurl.com/image.png).
Example:
For C# you can try this plug-in:
https://marketplace.visualstudio.com/items?itemName=MsBishop.ImageComments

Literate Programming tools work this way; you basically use TeX or something to write the code, then run a preprocessor which extracts the code snippets into an intermediate source file. http://en.wikipedia.org/wiki/Literate_programming

Using Sandcastle
Each SHFB project is it's own container for everything seen in the documentation project. When it's compiled, the (program project's") XML doc is pulled into SHFB to be put into the document.
If you want to show images in the top section of the class documentation, you must add the image to the SHFB project and refer to that image from the code comment. See Problem 2...
Problem 1:
"I can't get an image to show from a conceptual topic using the 'image' tag"
Make sure to use the proper XML markup similar to this:
<section>
<content>
<mediaLink>
<image xlink:href="MyMainImage"/>
</mediaLink>
</content>
</section>
Notice that the Href (above) doesn't have the file type associated,
this is because Sandcastle wants the ID instead.
Add the image to the project using the default media folder. Or, if you want you can create your own folder e.g Images.
Go to properties page of the image and set Build action to Image.
When you use an "image" tag, SHFB only uses the Image ID found in the properties page, seen in the HREF above.
Recompile the project and open up the CHM file and you will see the
image.
Problem 2:
"I cannot get an Image to show using Code commenting XML markup in the programming project".
In the summary section of the code comment, the markup can look like
this:
/// <summary>
/// <remarks><img src="\Images\MyImage.PNG"/></remarks>
/// </summary>
Note that the src attribute does contain the file type. It also must correctly identify the folder that your SHFB project has for that image.
After adding that image to the SHFB right click on it and change the "Build Action" property to Content
Happy coding and documenting!
Thanks goes to Eric W.
Keywords:
SHFB Cannot Add Image
Sandcastle Help File Builder Conceptual Topic Images
Code Commenting Images
CHM File Images
How to add an image in XML Code Commenting C#

I politely disagree with #thekip reply. IDE is not just the editor, but a full set of tools, and thank God code editors has been evolving from the old times. That’s why:
Eons ago I was amazed with the AMOS developer tool for old AMIGA computers, that had the fold/unfold capability you can see now in many code editors, and during many years I was asking myself why Borland and Microsoft tools didn’t had it. It’s clear that information should not be always at the same level.
Code editors already had automatic text styling, to see different kind of reserved words or comments in different colors, allow auto indentation, and so.
Comments in code is an a topic in discussion out there, with some people defending that maintaining them under minims is the way to follow, arguing that they are usually not maintained by developers as they change code. People like me disagree with that, having in mind that comments are part of the code.
Not always all comments have the same importance, and 2020 tools should provide something better than UPERCASE and a bunch of dash separators ----------
Allow different font size, bold and italic in comments is the “must have” we will have again some eons later, and sometimes an image diagram in the same code could save you many time of search in the appropriate project documentation. Google Collab and other Jupyter tools seems to finally understood that.
All this should not replace project documentation through other tools, of course but, hey, do other people’s lives easier.
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
John Woods
#Simon Mourier reply for Visual Studio, rocks!

I found Jupyter Notebooks very valuable for teaching and used them with Python. They let you combine text, images and code.
Microsoft announced Jupyter Notebooks for .NET core and it is now in Preview in the .NET Interactive repo.

I had the same Idea and wanted to check if someone already shared it.
I just did it one way: Wordpad -> wrote code with an image between /* */ and saved as text document: images removed. just an empty comment zone remaining.
Of course, many interesting possibilities are missing from such an editor.
But all that is needed would be to allow a better suited one to include images.
It could greatly speed up the understanding of code if visual elements are involved.

Why don't use a free image hosting like http://imgur.com and insert image link to code comment?
Then the only problem for a student would be to copypaste link to browser from any IDE. Quite easy though.
Maybe some IDEs have the ability to "underline" links so that you can click it instead of copypasting.

Actually,you can always include the link of the image but cannot add an image to the comment of the code.

I think you're using the wrong tool for your problem. An IDE is a 'development' environment so it's not very important to have complete control over styling.
I would use something else (like LaTeX, see the comment) for you presentation.

Related

How do you get custom intellisense comments to appear when using a custom DLL in Visual Studio C#?

I have been wondering how to setup intellisense comments for Visual Studio (minimum version 2013) and have been having trouble. Using XML comments are only useful for generating the separate file for documentation.
What I want is to be able to put descriptions on functions/methods that show up when I hover over them in a project I am working that includes the DLL that should have these descriptions already set. This is something trivial to be honest but it would be really nice to have this functionality. But every thing I try seems to end with no comments being shown in the project when I hover over these functions/methods.
To restate my question, what needs to be done to allow for my descriptions of functions/methods to appear when I hover over them when they are used in a separate project/solution?
Okay. I got it to work. I just checked the XML documentation file box in Project Properties -> Build Tab. I also needed to include it as Alexei Levenkov helped me out with in the comments. Doing both of those things allow them to show up.

How should I go about creating a multilingual text translation editor in VS 2010?

Feature explained below is available in Microsoft Dynamics AX (formerly known as Axapta), an ERP application. However, my question is related to Visual Studio 2010 and MVC 3 application. Please find my questions after this feature explanation.
Screenshot #1 shows a method written in X++ (language used in Microsoft Dynamics AX) using the MorphX editor. If I select a text within double quotes and right-click on them, I will get the options as shown in the screenshot. This is true if the text begins with an # character and is a valid id found in the label file.
If I click on the option Lookup Properties/Methods, a tool tip will appear showing the actual text associated with the selected label id. Here in this case the label id is #SYS67 and its associated label text is Transaction date. Refer screenshot #2.
If I click on the option Lookup Label/Text, the label editor will appear with the label id pre-filtered along with other languages of choice at the bottom section of the editor. I can change the translation text in different languages using the editor. Refer screenshot #3.
In Dynamics AX, the label texts are stored in text files with label id and separated by a tab. Label ids always begin with # symbol. Here in the example shown #SYS is the group prefix and the given number is a sequential index. Refer screenshot #4 that displays text found in an en-us label file.
I understand that this is similar to Resource editor in Visual Studio where the translation text are stored in .resx files for each language. I would like to do something similar for an ASP.NET MVC 3 application using SQL Server database as the data store for the translation text.
Here are my questions:
What would I need to create in Visual Studio 2010 to achieve this functionality so I can invoke the translation editor in the IDE? Would that be a plugin or extension?
Would a similar resource provider be possible to do in an ASP.NET MVC application, where I can just specify the label id within double quotes and have provider model fetch the data from database during runtime? Is the syntax Resources.MyResource.GetLabel("#SYS67"); the only available option in ASP.NET? Sorry, if the resources syntax is wrong.
Are there any similar tool set (plugin/extension) already available for Visual Studio?
I believe that one of the terms to do translation in ASP.NET application is making use of Resource Provider Model. Are there any other terms? I am interested to know the term of what I am trying to achieve so I can search on the web to read more about it.
Any inputs will be really appreciated.
Thanks in advance.
Screenshot #1:
Screenshot #2:
Screenshot #3:
Screenshot #4:
I'm going to jump in here and give you what I know. I apologize if it doesn't completely answer your question but I don't want to stray too far from what I am familiar with and thus give you bad advice.
From the way you describe your issue, it seems that you could use the resource files (RESX) for translations, the issue is more that you want to know how to edit them in a manner that is user friendly. Further, some users may want to edit the translations on the web.
To answer this part of your question, I would recommend that you look at this article:
http://blog.lavablast.com/post/2008/02/07/RESX-file-Web-Editor.aspx
The author seems to have a similar issue as you and the conclusion the author arrived at was similar to what you are thinking about. The source code is provided so you could get a head-start if you wanted to pursue this method.
If you are going to pursue rolling your own editor, I would suggest that you choose one interface and stick with it. Otherwise you will be increasing your development time on something that isn't your actual product. Since you want the web for some users, I would suggest you would stick with the web for everyone. However, if you really want to pursue an plugin for Visual Studio, I would recommend that you put as much code into a central business logic layer as possible so that your presentation layers don't take up much of your time.
As for currently-available options, I don't think any of the following are Visual Studio plugins, but they all do a good job at working with localization:
http://www.redpin.eu/index.html
http://www.lingobit.com/products/index.html
http://www.sdl.com/en/language-technology/products/software-localization/sdl-passolo.asp
If you want to learn more about the terminology and practices of localization, I would recommend the following site:
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/localization/localization.aspx
If you want to store information in a database instead of a .resx file, here is a resource that will show you how to do it:
http://msdn.microsoft.com/en-us/library/aa905797.aspx

Using MS Word Templates to allow a user to fill out a report

I'm trying to create create a simple word template on the fly which would just contain text and a few text input fields and then open a new word document based on that template for the user to fill out. I don't think this would be too difficult using Word automation and C#, but I've never worked with Word's COM interface before.
Any links to examples or fresh examples on how to create a simple template with some text and a text input field and then how to open a document based on that template in C# would be greatly appreciated.
Thanks in advance!
I think "Office Interop" is the keyword you are looking for.
You'll find a starting point here: http://support.microsoft.com/kb/316384
Several drawbacks involved (for instance, installed Office on client machine required; not advisable to be run as a server process), but might do the job for your requirement.
I have done a fair amount of work with Word automation - though not really so much with tempates... My advice would be first of all to have a look at the documentation that ships with the product - which is a simple matter of editing a word macro, and pushing F1 in the code editor. I have found that to be a rich source of information...
The other piece of advice I would give you is to try recording a macro in Word that covers any task you want to do, and then inspecting the code that is generated. This has proven invaluable to me in getting stuff up and running quickly...
Hope this helps...
Martin.

Free watermark for my wizards.Where can I find them?

I have written some wizards in c# and I would like to make look like more professional by adding some watermarks on the welcome and complete page.
I am struggling to find any source where I can download some free to use EG Database related watermarks that I can use in a Database script generator that I have written.
Any suggestions?
I am pretty useless at making them.
thanks
PS
Not sure where I should post it .I put under c# but again not sure
You can try to download watermark tools, these links might be helpful:
http://www.softpedia.com/get/Multimedia/Graphic/Graphic-Others/Fast-Watermark-Free.shtml
http://www.mydigitallife.info/2009/11/20/download-free-watermark-image-to-watermark-or-add-logo-to-photos-in-batch/
http://www.freedownloadscenter.com/Best/free-watermark.html
And you can search for more on Google. Don't forget to scan these tools for spyware, etc.
Or you can create your own watermark here: http://www.webwatermarks.com/
Please consider checking Google. When I looked up "Free Watermarks" there were several viable hits.
Also try looking into "Stock Photography" and some combination thereof with "Free Watermarks"

Rich Text Editor on a web page

I am trying to add a rich text editor in my web page where users can write reviews and format what they have written...something similar to the editor in which we write our posts on this site...
can anyone point me to the right direction regarding this...any tutorial that would help me build such a component...
Also i want a free product....(Forgot to mention earlier...)
Something in the likes of TinyMCE or FCKeditor, perhaps.
They're quite complete, and customisable.
The editor used on Stack Overflow is the WMD Editor.
The current version used on the site has been updated by Jeff Attwood and other site users and you can read about it here and get a copy of the code for your own site.
I think you'd be better off using (and perhaps modifying) an existing component rather than writing your own from scratch.
I've been using the Telerik r.a.d Editor, and been very happy with it.
after much research here is what i did...
i needed a control that was free and easy to use..all the editors that i went through came with a licence so i decided to make my own control!!!!
well..i couldnt do that on my own so i used the help of a few sites....
javascript Rich Text Editors
http://aspalliance.com/1092_Rich_Text_Editor_Part_I
http://ws.aspalliance.com/1092_Rich_Text_Editor_Part_II and a few others too...
so the best option for me was to build my own control so that i could customize it according to my needs....
http://freetextbox.com/
here is yet another one: NicEdit

Categories

Resources