mnemonics

A mnemonic for the order of CSS margin and padding shorthand properties

荒凉一梦 提交于 2019-12-02 14:25:35
I can never remember the order of the shorthand property for setting the margin or padding in one declaration. That is: margin-top: 2px; margin-bottom: 4px; margin-left: 3px; margin-right: 8px; may be written as margin: 2px 8px 4px 3px; Yes I understand that one can visualise the order by thinking of a clock, starting at midday and moving clockwise. But I keep forgetting about that. I need to recall the order top, right, bottom, left textually. Hence, T B L R T R B L. Something like This [R-noun] [B-verb] [L-nouns] is perhaps the way to go but I feel myself lacking inspiration. If anyone has

Another way to set mnemonic for JMenuItem?

最后都变了- 提交于 2019-12-02 08:57:29
So, I have a "Open Project" menu item, and I want to set mnemonic to it. I prefer it to be 'e' character from Project word. But when I set it with openProjectMenuItem.setMnemonic('e'); it sets 'e' character from Open word as mnemonic. Is there a way to achieve what I want? The method setMnemonic(char mnemonic) is obsolete, you should use setMnemonic(int mnemonic) with the appropriate VK_E instead. In any case the default behaviour is to underline first occurrence of the letter, if present. If you want to customize this thing you should look at AbstractButton class, it has a method (doc here :

Remembering the Ternary Operator Syntax

試著忘記壹切 提交于 2019-11-30 20:55:21
Anyone have a good trick to remember the standard ternary syntax? Specifically whether the '?' or ':' comes first. I have consistently gotten this backwards over the years. The condition you are checking is kind of like a question, so the question mark comes first. x > 0 ? 1 : 0 Think of this statement as three English sentences: "Is x greater than 0? Then 1. Else, 0." You have one sentence for each clause in the statement. The predicate: x > 0 ? /* Is x greater than 0? */ The "true" branch: 1 /* Then 1. */ The "false" branch: : 0 /* Else, 0. */ As far as remembering which symbol comes first,

Assembly JLE jmp instruction example

落花浮王杯 提交于 2019-11-30 14:51:32
问题 How do you use the jump family of instructions? This is what they've got: JL label "It" jumps if it is less than or if it is not larger than or equal to. My question is what is it in this sentence? Say I have a variable in ebx and I want to jump to label there: if ebx is <= 10 . Specifically I'm interested in using the x86 jump family of instructions 回答1: The jump itself checks the flags in the EFL register. These are usually set with TEST or CMP(or as a side effect of many other instructions

Remembering the Ternary Operator Syntax

谁都会走 提交于 2019-11-30 04:47:48
问题 Anyone have a good trick to remember the standard ternary syntax? Specifically whether the '?' or ':' comes first. I have consistently gotten this backwards over the years. 回答1: The condition you are checking is kind of like a question, so the question mark comes first. x > 0 ? 1 : 0 Think of this statement as three English sentences: "Is x greater than 0? Then 1. Else, 0." You have one sentence for each clause in the statement. The predicate: x > 0 ? /* Is x greater than 0? */ The "true"

How to remember in CSS that margin is outside the border, and padding inside

ε祈祈猫儿з 提交于 2019-11-29 23:52:26
I don't edit CSS very often, and almost every time I need to go and google the CSS box model to check whether padding is inside the border and margin outside, or vice versa. (Just checked again and padding is inside). Does anyone have a good way of remembering this? A little mnemonic, a good explanation as to why the names are that way round ... When working with CSS finally drives you mad the padded cell that they will put you in has the padding on the inside of the walls. pin - P is in You are using a box. If you were putting something in a box you would put some padding inside to make sure