Boards.ie uses cookies. By continuing to browse this site you are agreeing to our use of cookies. Click here to find out more x
Post Reply  
 
 
Thread Tools Search this Thread
07-06-2019, 09:48   #856
cython
Registered User
 
cython's Avatar
 
Join Date: Sep 2005
Posts: 3,950
Several hundred log statements along the lines of the below added in the last few days:

Code:
logger.error("ClassName.methodName started");
//Do some stuff
logger.error("ClassName.methodName completed");
Yup, debug/trace log messages being logged with severity of error.
cython is offline  
Advertisement
07-06-2019, 11:18   #857
smacl
Moderator
 
smacl's Avatar
 
Join Date: Feb 2006
Posts: 11,964
Quote:
Originally Posted by cython View Post
Several hundred log statements along the lines of the below added in the last few days:

Code:
logger.error("ClassName.methodName started");
//Do some stuff
logger.error("ClassName.methodName completed");
Yup, debug/trace log messages being logged with severity of error.
And your coding horror shows up a bug in boards. You wrote



Chrome shows




Nested coding horrors
Attached Images
File Type: png 1.png (7.0 KB, 546 views)
File Type: png 2.png (8.9 KB, 544 views)
smacl is offline  
07-06-2019, 11:35   #858
Wilfinity
Registered User
 
Wilfinity's Avatar
 
Join Date: Jul 2004
Posts: 848
Quote:
Originally Posted by smacl View Post
Nested coding horrors
Bugception
Wilfinity is offline  
(3) thanks from:
07-06-2019, 20:53   #859
cython
Registered User
 
cython's Avatar
 
Join Date: Sep 2005
Posts: 3,950
Quote:
Originally Posted by smacl View Post
And your coding horror shows up a bug in boards. You wrote



Chrome shows




Nested coding horrors
And there I thought it was just my browser being an ass. Was also too f*cked off to dig further after finding that steaming pile of horse manure!
cython is offline  
07-06-2019, 21:00   #860
pillphil
Registered User
 
Join Date: Jan 2009
Posts: 730
Weird, it displays fine in my chrome browser on mint, but on mobile the original text looks wrong and the quote displays fine.

Edit: Removed massive image
Attached Images
File Type: png Screenshot_20190607-205720.png (218.5 KB, 124 views)

Last edited by pillphil; 07-06-2019 at 22:20.
pillphil is offline  
Advertisement
07-06-2019, 21:06   #861
pillphil
Registered User
 
Join Date: Jan 2009
Posts: 730
Ha, it's an advertising thing, skimlinks, it reads the something dot something and tries to create a link. which ****s up the display
pillphil is offline  
Thanks from:
18-07-2019, 10:22   #862
johnmcdnl
Registered User
 
johnmcdnl's Avatar
 
Join Date: Oct 2009
Posts: 3,528
Code:
public class RandomGenerator {
  public static String generateRandomString(int numberOfCharacters) {
    String newStr = "";
    for (int i = 1; i < numberOfCharacters; i++) {
      int numericValue = (int)Math.round((Math.random() * 61.0) + 1.0);
      if (numericValue > 52) {
        numericValue = (0x2F + numericValue) - 52;
      } else if (numericValue > 26) {
        numericValue = (0x60 + numericValue) - 26;
      } else {
        numericValue = 0x40 + numericValue;
      }
      newStr += (char)numericValue;
    }
    return newStr;
  }
It's really old legacy code, that is far away from the critical path, so fine maybe back in the 00s there wasn't any easier way to generate a random string than rolling your own?

1) But why would you use hexadecimal in the addition of the numbers -- because who can't read hexadecimal right?
2) And why does the returned string have length 1 less than 'numberOfCharacters' -- generateRandomString(4) returns a 3 letter string
3) And just why would you not double check that the string returned is actually random. If you spend 2 minutes doing a quick test you'd spot that the letters 'A' and '9' are only returned half as often as all the other chars.
johnmcdnl is offline  
(2) thanks from:
Post Reply

Quick Reply
Message:
Remove Text Formatting
Bold
Italic
Underline

Insert Image
Wrap [QUOTE] tags around selected text
 
Decrease Size
Increase Size
Please sign up or log in to join the discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Share Tweet