checking how long are comments in a file - visual-studio-code

I just finished an assingment and according to the instructions I can't have a line of code or comment longer than 120 chars. is there a quick way to check that?
I'm using VSCODE on windows 10. I saw somewhere that I can make a verticle line in the editor to see if a row is too long but I can't find it now.
for example :
// return stack->size since stack->size holds the number of values that can be stored inside the array at a given time.
this comment is 119 chars so it is ok but anything bigger will cause me to lose points.
I know I can hold the last char in the sentence and see the 'col' number in VSCODE, I was hoping for something better.
thanks

"editor.rulers": [120]
Look at the Editor: Rulers setting:
Render vertical rulers after a certain number of monospace characters.
Use multiple values for multiple rulers. No rulers are drawn if array
is empty.
You can change its color or opacity like so (in your settings.json):
"workbench.colorCustomizations": {
"editorRuler.foreground": "#ff0000ff",
}
That changes the color to red, the last two hex digits are opacity. ff is 100% opaque. So you could try more transparent with #ff000080 for example. Color and transparency are the only two modifications you can make to rulers.

Related

Miscoloured lines in rule-based layer styling in QGIS

I'm styling a vector layer of roads and have noticed that a small subset of lines appear to be going 'rogue' and ignoring their line colour styling. They still obey the line stroke and width style however but insist on being yellow instead of the desired colour.
I've added a separate rule for one of them and it definitely 'catches' the correct line segment and restyles it in every way EXCEPT for the colour which stubbornly remains yellow.
Can anyone provide me with any clues as to what is going on here?
That line (or lines) are "selected" - You have one of the selection tools active and have clicked on the line. See the manual for more details, you need to click on the clear selection tool
to remove it.

Text component displaying lines in reverse order

Alright, I do not know how to fix this and only ran into this problem after trying to put in some longer text on a UI Text component. I have tried both pasting a value into its Text attribute through the Unity editor, and setting its value programmatically like this:
t.GetComponent<Text> ().text = "This is where meat, fish, and [...] (long text)"
Because Horizontal wrap is on, the text wraps when it reaches the edge of the available space.
However, the text displays backwards. Meaning, the start of the paragraph is at the bottom, and bottom at the top. Taking off wrap fixes this, but then the font size has to be really small (or it won't all be visible), and it can't form a normal paragraph because it has to... you know... wrap.
Is this a bug in Unity?
This is what happens - as you can see, it is displayed backwards:
The negative Line Spacing value is what is causing the issue here:
When the value of this field is less than 0, the lines will actually be arranged backwards, leading to the behaviour you're currently encountering. Just change the value to a positive number to have the text display correctly.

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.

iOS: Aligning two UILabels (left/right) and connecting with dots?

The above image was taken from an Android app. I am looking to do the same thing on iOS. I know how to do it using a background image for the dots, but it doesn't look like the Android developer used an image for the dots. Anyone know how this can be done?
I've found the way to do it with content hugging/compression resistance.
Here is the interface builder solution:
Left label has a phrase and lots of dots with line breaking = truncate tail. Content hugging/compression resistance do the rest of job.
I think you can do this without any code. Just use two labels with their baselines aligned, and with a horizontal spacing constraint of 0. The left label would have its text left aligned with say 10 dots added to the end of the string, and the line break mode set to "clips". The right label would also be left aligned, so its text would always be right up against the dots.
After Edit: I couldn't get this to work in IB. It may be possible in code using constraints, but I haven't tried that. It seems like you should be able to do it with 3 labels, with the two outside ones pinned to the edges of the view, and a flexible label in the middle whose text would be dots.
You can use NSAttributedString to format in that way.
Use two colors in two ranges, even bold font for 2nd part.
And calculate the total width (length of your text) and fill dots (.) in between those.
An idea to fill dots:
lets say you have 30 characters space.
str1 contains 10, str2 contains 6, then use 30-(10+6) then in a loop
for(30-(10+6) times) {
[mainString appendString:#"."]
}

font with graphic "blackspace" character

I'm looking for a font which contains a graphic character which is (essentially), the space character, inverted. I'm looking for a graphic character equivalent to the largest-possible solid-black box. The closest I have been able to find is Wingings 2 character 162, but that doesn't fill the entire available character space. When I insert two consecutive Wingdings 2 162 characters, there is still appreciable whitespace between them when displayed or printed. Does anyone know of a black-box font/character which would fill all available character space?
All characters are going to have whitespace between them, or they would be unreadable. This is called "kerning". You can adjust the kerning and line-height in whatever program you are using to send the malicious fax, if you want to be sure to use the maximum amount of toner per page.
Have you considered creating your own font using a software package like this or like this? You could edit the space character to be a solid black square. But as Chris McCall mentioned, you may still have space between characters of any size due to kerning applied by the layout engine that draws the fonts.
You other option is to owner draw your own text and programmatically replacing spaces with black boxes. You would have complete control over kerning and everything else.
I don't know if this is exactly what you were looking for, but...
I was looking for the same thing, since I wanted to create a "textbox" when I wanted to write text using the spritefont, but I never knew how long the total string was going to be, so I wanted something that I could "write" in the same location right before the string with a contrasting color which could be expected to be as long as the string it needed to encompass. That being the case, try:
Webdings - character 103.
I tried lining them up and there wasn't even any space in between. Perfect.