IDE or plugin to add helpful graphics or illustrate code as-is? - plugins

I was staring at my code thinking how boring the text looks.
All I see is text, with no visualizable structure.
Visualizable structures would be awesome:
Background graphics such as 3D half-pipes on edge connecting the opening and closing brackets of loop scopes, nested in 3D to show how deep the loops are nested.
Wires with arrows along them showing where a goto statement points, with a code section highlight (or preview if out of viewport) of the target label.
Conditional blocks could be rendered to show the "true" code in a positive color and the "false" code in a negative color, and mousing over the background at the left edge could reveal a preview of the condition statement for that block (appended with "== true" or "== false" depending on the code context).
Icons for Types, that show up in front of variable names so you know what type they are.
Change the background of the method, displaying tiled locks or keys, depending on whether you type public or private in front of the method (a nice indicator of the default if you fail to specify either).
Is there anything out there that illustrates code like this?
I don't mean analytically generated graphics representing the code or algorthmic structure in some way. Rather, I mean something that actually illustrates the editable code in place.

Related

Turquoise Blue Font in Matlab

I would like to know what the light blue/turquoise blue font in Matlab means. I am currently working on Bayesian Optimisation in Matlab and whilst going to some previous students' code, I came across a weird blue font colour I have never seen before in their function definition. I have checked my colour scheme settings in Matlab and this turquoise blue does not appear in the list of set colours. See the attached picture for reference.
By default this color means that the corresponding variable has shared scope. This can be because it is
a global variable (its scope is shared with the command window);
a persistent variable (its scope is shared across subsequent calls to this function); or
a variable that is used in a nested function (its scope is shared between the nested and parent functions).
Thus, this color indicates in general that the value of that variable can be affected from outside the function.
The color can be changed in the Matlab preferences window. The window also shows some example code that illustrates this:

Unity UI Canvas & SetPass calls & TextMeshProUGUI order

I am trying to minimize SetPass calls in Unity canvas.
Consider the following example:
The rendering in canvas happens layer by layer. The rendering sequence can be like the following:
Red squares (+1 set pass call)
Text "1" and yellow squares (+2 set pass call)
Text "2" and pink square (+2 set pass call)
Text "3" (+1 set pass call)
Or, it might be a little better:
Red squares (+1 set pass call)
Yellow squares and then text "1" (+1 set pass call)
Pink square and then texts "2" and "3" (+2 set pass calls)
Because of this, drawing is switching from default image material to text material and back. The result of this drawing will produce at least 4 draw calls, instead of 2. Even though only 2 materials are in use. This example also assumes that Red, Yellow, and Pink squares weren't batched.
Question: is there a way to ensure that text will be always drawn on top?
Notes:
TextMeshPro UI material (mobile-overlay) doesn't help here.
Unity 2019.3.12.f1
All texts are actually placed as last layers (e.g. there is nothing drawing on top of them).
Batching helps sometimes. However, complex UI might use several materials. Since my intention is to always draw text over everything, isn't there a general solution for this?
Z-order makes drawing order even worse and switching between materials happens more frequently.

Enterprise Architect Shape Script DrawNativeShape() Function does not work

I have created a new profile for Enterprise Architect. It defines a stereotype for "Requirement".
Modifying the default shape of "Requirement", I'm dealing with Shape Script. Calling the function "DrawNativeShape()" does not raise an error, neither has any effect!
In fact I expect the code below to display the default shape of the element, but it does not so that the diagram looks empty.
shape main{
DrawNativeShape();
}
The DrawNativeShape command is effectively saying "draw the shape exactly as you would if it didn't have a shape script". You say that that is what is happening. I don't see a problem.
There are two main uses for DrawNativeShape:
It can be used to apply conditional shapes to an element. What you do is test some condition and depending on the answer either draw a shape or call DrawNativeShape.
It can be used to apply conditional colour to an element. Call SetFillColor followed by DrawNativeShape and the element will be drawn with default appearance but using the colour specified by the shape script.

Way to get a color while transitioning

I thought about the whole transition thing, and also saw while a text's color is being transitioned - it crosses through other tints of colors.
I had a lot of situations when I saw a beautiful color which I wanted, but it was a part of the transition process, and I eventually couldn't accomplish it.
For example, this code:
HTML:
<div id="transition">
ultra super califragilisticexpialidocious
</div>
CSS:
#transition {
color:black;
transition: 1s color;
}
#transition:hover {
color:#f00;
}
A demo: JsBin
You could see the transition shows a maroon color while text is transitioned, and my meaning is, how can I get this special tint of maroon?
Generally, my question is, how can I get a color while it is transitioned? There's a way to pick it?
Thanks in advance
Well, the things we think we like most are often those that are hard to get ;-)
But it's not so hard in this case. The question is whether picking the transitioning color is the best way to get what you want. Wouldn't it be simpler to change the color by hand until it looks best?
This is how to easily change a displayed font color with the Firebug plugin of Firefox:
Open the page with the transition and open the Firebug window.
Select the HTML tab, and then the Style tab of the side panel (if the side panel is closed, open it by clicking on the small arrow in the top right corner).
Click on the button with the mouse pointer in the top left corner of the Firebug window, then click on the div with the transition, thus selecting it.
You may want to disable the transition in the style, by clicking to the left of it.
You may want to display colors in RGB instead of hex (you can toggle back and forth when you want), by clicking on the dropdown button in the Style tab and selecting the mode you want.
You can click on the color value to edit it. Instead of rewriting it, you can click again on a single component (works in hex mode too), and then use the up and down arrow keys. It's almost like having a slider for each component. If you have the whole value selected, the arrow keys change all three components simultaneously.
Chrome is almost identical in operation. You open the Developer Tools with Ctrl-Shift-I, select an element with the magnifier button, and edit its style. You can toggle between hex colors and RGB colors by clicking on the gear-wheel within the Styles window. The difference with Firebug is that you can only modify the single RGB values with the up and down arrow keys when in RGB mode, in hex mode the arrow keys can only change the hex value as whole (i.e., starting from the B channel).
Knowing the numerical values of the endpoint colors of the transition, you can guess the numerical values of the "transition color" you want. The numerical value of each RGB (red, green, blue) component will be an intermediate value between its endpoints, more or less close to one of the two endpoint values.
The browser is free to interpolate by using the algorithm it prefers. The easiest algorithm moves colors along a straight line in the three-dimensional RGB space. Interpolated colors in this case (called linear interpolation in RGB space) are integer approximations of
R = R[0] * (1 - t) + R[1] * t
G = G[0] * (1 - t) + G[1] * t
B = B[0] * (1 - t) + B[1] * t
for t varying from 0 to 1. For t = 0.5 you get the color which is linearly (in RGB) halfway between the two endpoints. The parameter t may be any function of time (in the simplest case it is a linear function, which means that the color moves at constant speed in RGB space between the two endpoints).
As I said, the browser is free to interpolate in a more complicated way, in order to achieve a better visual result. If you really need to see what the browser does, you can slow it down to snail speed (e.g., by editing the transition-duration with Firebug), then grab the screen (e.g., by pressing the "Print Scrn" key), open your favorite image editor, paste the printed screen (often by pressing Ctrl-V), and finally select a fully colored pixel to get the RGB values of your long craved color.
BTW, your test case is particularly easy, because the endpoints are (0,0,0) and (255,0,0), so that the maroon color you are after is almost certainly nothing but a dark red of the kind (x,0,0). You only have one parameter to vary, you can even do it by trial and error with an editor!

Word Styles to get two elements to share same background/border

Within MS Word 2013 I am trying to create a text element plus a list underneath it, all wrapped inside a coloured border with background shading (see image). The attached image shows the text in plain form.
I would like to place a blue border around both the title and the list. I can achieve this by placing both objects within a 1x1 table and applying colouring rules to the cell, but semantically this seems bad (I'm from an HTML development background where it is very wrong!)
When I edit a Style rule to create the border/background, it works well until I create the list, then it goes badly wrong. Is it possible to achieve the output of the table cell approach by only using a style rule and no table?
After a day of experimentation, the closest I can get is by doing the following:
Create a style rule called Tips Heading based on Normal, then set it to be Bold with a blue background.
Create another style rule called Tips List based on List Paragraph, and set it to have a blue background.
Unfortunately the List cannot be indented because the background colour also indents. The border is also affected in this manner, so I ignored the border and indentation. It works really well and is semantically well structured.