Search Results

Search found 2 results on 1 pages for 'evilreiko'.

Page 1/1 | 1 

  • jQuery: on focus, do customized focus on textarea

    - by evilReiko
    My Code: $('#myTextArea').one('focus', function() { $('#myTextArea')[0].selectionStart = 2; $('#myTextArea')[0].selectionEnd = 6; $('#myTextArea')[0].focus(); }); The code works fine, on focus (only once), it selects from index 2 to 6. The problem: since this function is called on focus, it does the custom focus, but then it calls focus AGAIN and I lose focus of the selected text. Any possible solution?

    Read the article

  • Java: Best approach to have a long list of variables needed all the time without consuming memory?

    - by evilReiko
    I wrote an abstract class to contain all rules of the application because I need them almost everywhere in my application. So most of what it contains is static final variables, something like this: public abstract class appRules { public static final boolean IS_DEV = true; public static final String CLOCK_SHORT_TIME_FORMAT = "something"; public static final String CLOCK_SHORT_DATE_FORMAT = "something else"; public static final String CLOCK_FULL_FORMAT = "other thing"; public static final int USERNAME_MIN = 5; public static final int USERNAME_MAX = 16; // etc. } The class is big and contains LOTS of such variables. My Question: Isn't setting static variables means these variables are floating in memory all the time? Do you suggest insteading of having an abstract class, I have a instantiable class with non-static variables (just public final), so I instantiate the class and use the variables only when I need them. Or is what am I doing is completely wrong approach and you suggest something else?

    Read the article

1