Meaning of the mysterious thin vertical red line in commit window - mercurial

The TortoiseHg Commit window has a thin vertical red line in the text area where you can write your commit message:
What is the purpose and/or meaning of this line? The relevant TortoiseHg documentation comes up empty. Searching Google and Stack Overflow currently give zero results.
Is it a suggested(?) or recommended(?) place to put hard line breaks in commit messages? If so: why have such a suggestion at all, and why at that particular location?

Okay, bro, it 's your personal hand-made settings (default value - unspecified)!!!
TortoiseHG - Settings - Commit
and at the bottom, when this listbox is active, you can read description and purpose of this parameter

Without knowing this platform I would say it's a text wrap marker - where text would wrap when printed as pure text to a printer. the old "standard" had a width of 80 chars (72 on some platforms) for ASCII-based documents.
The width was also relevant to pure-text document viewers who typically wrapped text at 72 or 80 chars. It was also used for terminals at the time when BBS'es was the norm (before internet became popular).
I suspect the reason is to provide backward-compatibility to the more old-school developers who might want to read this in a plain text reader and for printing (printing pure text is many times faster than formatted text which is printed as graphics, and therefor convenient when printing documentation and so forth). But this will be just a guess on my part.

Related

Is there a maximum content size for option element?

I have a web app with a form in it. The form in turn has a select element with options containing a bunch of users' info, their names being set as the label/content of the option elements.
Now apparently one of the users' parents think it's fun to give their child a name with 3000 characters of gibberish in it.
I wouldn't want to make his life any harder than it is, but unfortunately I'll have to remove his account because the long name seems to introduce some interesting limitations on browsers that I didn't know about.
I started highly scientific testing using this fiddle with a few browsers in two computers and found out that
Chrome v50 (64bit) displayed a black box instead of the dropdown when the label length hit 1510
FF v46 refused to open the dropdown at all when the content length was 2716
IE v11 doesn't even break a sweat with tens of thousands of characters
Chrome v49 was the least fun of all. It rendered the whole window and all the other open tabs fully black so I had to close them all and start again. Didn't bother to find the exact limit for that
It seems though that the actual limits are much more related to the content width and not the length, as changing the character from "a" to "i" using proportional font affected the results.
The question: is there a reason Chrome and FF flip out with content of this size? Is there a specific limit on how long/wide the option's label can be (other than the subjective opinions about aesthetic/usable form inputs)?

Text wrapping in the wp8 app bar

In my Windows Phone 8 app the app bar usually looks like this:
But for some reason on one of my users with a 1020 it looks like this: (it's a NOKIA RM-877_nam_att_205 3.3.0.2 3051.40000.1346.0001 with OS version 8.0.10517.0)
(the WP8 emulator also looks like the second one)
Anyone knows why this happens, and how can I fix it?
The default behaviour of English text accompanying an ApplicationBarIconButton is for it to be on a single line.
Multi-line support was added for some languages where word length is typically longer than in English. The wrapping was therefore needed for text to not be clipped.
The enabling of multi-line support is dependent upon a combination of device, OEM and regional settings. Developers/apps cannot influence this behaviour.
The expectation of all English text accompanying an icon button is that it should be on a single line. If it ran across multiple lines and then was translated to a language which used longer words for the translation then the translated text would not fit in the available space.
You should only use text that can fit on a single line.
For your examples above, I'd recommend "catalog" and "downloads" as labels for the two buttons on the right.
It looks like there some regional dependency and there is no fix yet, since it not accessible from the application. Same problem at the msdn.
Users reported: English-UK, French, German or Dutch - wrap. English-US - truncate.
Icon button text is displayed beneath the icon when the user expands the application bar.
If the length of the string exceeds 7 to 13 characters, depending on the width of the characters
that make up the string, it is clipped.
Menu item text does not wrap and should be limited to 14 to 20 characters in length,
depending on the width of the characters.
Many languages use different amounts of space to convey the same meaning. Therefore,
when choosing menu item or button text, consider the different lengths of the text strings
for the language your app will be in. Assume that an average of 30% more space will be
required for any text. Depending on the language and the phrase, the localized string
might even require twice as much space.

Extract or crop image from within TIFF

I need to extract/crop the logotype (BEAVER) in the middle from a TIFF file that looks like this: http://i41.tinypic.com/2i7rbie.jpg
And then I need to automate the process so it can be repeated about 9 million times...
My guess is that I would have to use some OCR software. But is it possible for such a software to "crop anything that starts below this point and ends above this point"?
Thoughts?
Typically OCR software does only extraction of text from images and conversion of it into some text-specific format. It does not do crop. However, you can use OCR technologies to achieve your task. I would recommend following:
OCR whole page
Get coordinates of recognized text
Apply your magic rules to recognized text to locate area to crop: such as averything in between "application filled" and "STATEMENT" sentences.
Cut from image that area and export it where you want it.
Real challenge is in the amount of text you would like to process. You have to be very carefull when defining your "smart rules" to make sure they don't provide false positives and always send suspicious images to separate queue that you will later manually review and update your rules.
In general it may look like this:
Take first 10 of images, define logo detection rules, test and see if everything works well
Then run on next 10, see what was prcessed wrong, what was not processed, update rules, re-process those 10 to make sure everything works well now
Re-run it on new batches of same size until it will start working well.
Then increase batch size from 10 to 100, and go with those batches until again everything start working smoothly
Then continue this way perfecting your rules and increasing batch size. At some point of time you will go to production speed.
Most likely you will encounter some strange images that either contradict existing rules, or just wrong. Not always you have to update your rules to accomodate it. It may happen that there it only dozen of images like that in whole your 9 million collection. It might be better to leave them in exceptions queue for manual processing, and don't risk stability of your magic rules.

How to implement text selecting?

My question is not language based or OS based. I guess every system is offering some sort of TextOut(text, x, y) method. I am looking for some guidlines or articles how should I implement selection of outputed text. Could not find any info about this.
The only thing which comes to my mind is like this:
When user clicks some point on the text canvas I know the coordinates of this point. I need to calculate where exactly it will be in my text buffer. So I am traversing from the begining of the buffer and I am applying to each character (or block of text) a style (if it has any). After this, I know that after given style the letter has given size. I am adding its width and height to previously calculated X,Y coordinates. In this way, I am traversing the buffer until the calculated position has not reached the point that has been clicked by the user. After I reach the point within range of some offset I have starting point for the selection.
This is the basic idea. I don't know if this is good, I would like to know how this is done for real like for example in Firefox. I know I could browse the sources and if I won't have a choice I'll do it. But first I am trying to find some article about it...
Selecting text is inherently specific to the control which is containing it and the means it stores that text.
A very simple (though questionably inefficient means) is to run the text flow algorithm you are using when clicking on a point and stopping the algorithm when you have reached what is closest to that point. More advanced controls might cache the text layout to make selections or drawing their content more efficient. Depending on how much you value CPU time or memory there are ways to use caches and special cases to make this “hit test” cheaper.
If you can make any assertions (only one font in the control, so every line has the same height) then it is possible to make these tests cheaper by indexing the font layout by lines and then doing simple arithmetic to find out which line was clicked on. If your text control is also using monospace fonts (every character occupies the same width as well as height) then you are in even more luck, as you can jump straight to the character information via a lookup table and two simple divisions.
Keep in mind that writing a text control from scratch is obscenely difficult. For best practice, you should keep the content of the document separate from the display information. The reason for this is because the text itself will need to be edited quite often, so algorithms such as Ropes or Gap Buffers may be employed on the data side to provide faster insertion around the caret. Every time text is edited it must also be rendered, which involves taking that data and running it through some kind of formatting / flow algorithms to determine how it needs to be displayed to the user. Both of these sides require a lot of algorithms that may be annoying to get right.
Unfortunately using the native TextOut functions will not help you. You will need to use methods which give you the text extents for individual characters, and more advanced (multiline for example) controls often must do their own rendering of characters using this information. Functions like TextOut are not built to deal with blinking insertion carets for example, or performing incremental updates on text layouts. While some TextOut style functions may support word wrap and alignment for you, they also require re-rendering the entire string which becomes more undesirable in proportion to the amount of text you need to work with in your control.
You are thinking at a much lower level than necessary (not an insult. you are thinking that you need to do much more work then you need to). Most (if not all) languages with GUI support will also have some form of selectionRange that gives you either the string that was selected or the start and stop indices in the string.
With a modern language, you should never have to calculate pixels and character widths.
For text selection in Javascript, see this question: Understanding what goes on with textarea selection with JavaScript

What text editors support vertical rulers?

I'm looking for a feature somewhat like the vertical red 80 columns marker in NetBeans but one that's easier to use. I'd like it to function more like the tabs in MS Word except that the horizontal line is displayed on the entire file. I looked on the Comparison of Text Editors over at Wikipedia and I didn't find that "vertical ruler" was one of their features.
It would be used to line up html tags in a massive file that I did not create, but have to maintain.
The Zeus editor has the option to set two vertical column markers. The first is the line wrap column and the second is the left margin column and the settings for both of these markers are found in the document type.
These markers are drawn as a solid vertical line one pixel in width.
Notepad++ has this feature.
At http://tech.groups.yahoo.com/group/vim/message/87027?l=1 is a way to get a similar behavior in vim.
You can do column guides in Visual Studio: blog post here (registry entry required though).