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: 4,055
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: 13,310
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, 1385 views)
File Type: png 2.png (8.9 KB, 1371 views)
smacl is offline  
07-06-2019, 11:35   #858
Wilfinity
Registered User
 
Wilfinity's Avatar
 
Join Date: Jul 2004
Posts: 924
Quote:
Originally Posted by smacl View Post
Nested coding horrors
Bugception
Wilfinity is online now  
(3) thanks from:
07-06-2019, 20:53   #859
cython
Registered User
 
cython's Avatar
 
Join Date: Sep 2005
Posts: 4,055
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: 747
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, 141 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: 747
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,630
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:
20-12-2019, 10:01   #864
GhostyMcGhost
Registered User
 
GhostyMcGhost's Avatar
 
Join Date: Jan 2017
Posts: 1,006
Could have been worse. Could have been 256 hours
GhostyMcGhost is offline  
Advertisement
20-12-2019, 10:10   #865
lawred2
Registered User
 
Join Date: Dec 2009
Posts: 17,379
Quote:
Originally Posted by Sephiroth_dude View Post
Would the following be considered a "Coding Horror"

Code:
public void setFirstName(String firstName){
	  
	  if(firstName.length() < 5){
		 
		  throw new IllegalArgumentException("NAME LENGTH IS TOO SHORT! ");
	  }
	  this.firstName = firstName;
  }
it would be the work of an idiot for sure

where did he pull that business rule from?
lawred2 is online now  
20-12-2019, 13:03   #866
iLikeWaffles
Registered User
 
iLikeWaffles's Avatar
 
Join Date: Nov 2011
Posts: 3,176
Quote:
Originally Posted by lawred2 View Post
it would be the work of an idiot for sure

where did he pull that business rule from?
Must not like people named Paul
iLikeWaffles is offline  
20-12-2019, 16:57   #867
Capt'n Midnight
00:00
 
Capt'n Midnight's Avatar
Quote:
Originally Posted by iLikeWaffles View Post
Must not like people named Paul
Worse still it's not cryptographically secure if Alice can't talk to Bob.
Capt'n Midnight is offline  
20-12-2019, 20:50   #868
 
Join Date: Jul 2014
Posts: 9,002
Quote:
Originally Posted by lawred2 View Post
it would be the work of an idiot for sure

where did he pull that business rule from?
Likely that he works in an organisation that has poor business analysis and people make up rules on the fly from time to time. The most senior dev in the place I work is a terror for it. Even makes up business rules based on her experience and logs them as bugs. Some of the rules are daft.
Berserker is offline  
20-12-2019, 21:10   #869
swampgas
Registered User
 
swampgas's Avatar
 
Join Date: Apr 2008
Posts: 3,279
Quote:
Originally Posted by Capt'n Midnight View Post
Worse still it's not cryptographically secure if Alice can't talk to Bob.
On the upside, looks like Eve won't get a look in either.
swampgas is offline  
(2) thanks from:
08-01-2020, 22:11   #870
Capt'n Midnight
00:00
 
Capt'n Midnight's Avatar
https://www.theregister.co.uk/2020/0...een_blank_bug/
Quote:
Boeing's 737 Next Generation airliners have been struck by a peculiar software flaw that blanks the airliners' cockpit screens if pilots dare attempt a westwards landing at specific airports.
this comment


270 degrees ?

hmmmm

tan(270) error infinite result?
Capt'n Midnight is offline  
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