• Mr Zero (unregistered)

    If you can't put in easter eggs or other fun stuff, test data is one of the places where you can have lots of fun. It also eliminates issue like the OP.

    I regularly test with Mr. Zeuax, first name Beaux.

  • Bert Glanstron (unregistered) in reply to frits
    frits:
    Bert Glanstron:
    frits:
    Rick:
    I am curious. Is there a reason why so many people know all these memes, going back years, but don't bother to register? Am I doing it wrong?

    It's how you can tell the n00bs. Most of these memes are repeated almost daily, so it takes no time at all to pick up on them. Captcha posting is another telltale sign of newness.

    You are an idiot and should be banned from your mommy and daddy’s modem.

    You know, the difference between funny and you is the obviousness of your reference. If you were to refer to something obscure but related, it may be construed as interesting. That way, you could still just copy-and-paste someone else's work, but at least it would be entertaining.

    In C++ templates, the compiler generates the code at compile time, so you still get compiler type checking and code optimization. C# generics do none of this. Note my example:

    long i = Cast<long>("I Like Canaries!");

    This not only compiles, but signal my intent to cast "I Like Canaries!" to a long. I'm not sure where this could ever be useful.

  • (cs)

    Ahhh, Agile Development in action.

  • by (unregistered) in reply to hoodaticus
    hoodaticus:
    Ahhh, Agile Development in action.

    On Linux, no less.

  • (cs) in reply to Ken B.
    Ken B.:
    by:
    Yes, it will be difficult (without some creativity) to assign multiple roles to induhviduals.
    What makes you think it's so difficult? Simply replace
    return UserName.StartsWith(roleName.Substring(0, 3));
    with
    return UserName.Contains(roleName.Substring(0, 3));

    And the cycle of WTF is complete.

  • Darth Stringbasedrole (unregistered) in reply to hoodaticus
    hoodaticus:
    Ken B.:
    by:
    Yes, it will be difficult (without some creativity) to assign multiple roles to induhviduals.
    What makes you think it's so difficult? Simply replace
    return UserName.StartsWith(roleName.Substring(0, 3));
    with
    return UserName.Contains(roleName.Substring(0, 3));

    And the cycle of WTF is complete.

    When we last met, I was but the learner. Now, I am the master.

  • Bob (unregistered)

    TRWTF is that they didn't use BobX.

  • Borken (unregistered) in reply to by
    by:
    hoodaticus:
    Ahhh, Agile Development in action.

    On Linux, no less.

    What does Linux have to do with this? From what I can tell, this looks like C-Pound, which certainly and thankfully does not run on Linux (except using Wine).

  • swedish tard (unregistered) in reply to Borken
    Borken:
    by:
    hoodaticus:
    Ahhh, Agile Development in action.

    On Linux, no less.

    What does Linux have to do with this? From what I can tell, this looks like C-Pound, which certainly and thankfully does not run on Linux (except using Wine).

    Or mono if Im not mistaken.

  • Fedaykin (unregistered) in reply to by
    by:
    I don't think this is an appropriate use of the term "canary." A canary (as used in the coal-mine analogy) is something that will die of lethal fumes before it reaches dangerous levels for humans. The "canary" in a programming environment is someone so incompetent that you don't have to worry about your job being in jeopardy until that person is fired (if you don't know who the canary is, the canary is you). How does this code fit that example?

    It's a canary because you know, based on this idiocy, that the code base is indeed deadly.

  • by (unregistered) in reply to Fedaykin
    Fedaykin:
    by:
    I don't think this is an appropriate use of the term "canary." A canary (as used in the coal-mine analogy) is something that will die of lethal fumes before it reaches dangerous levels for humans. The "canary" in a programming environment is someone so incompetent that you don't have to worry about your job being in jeopardy until that person is fired (if you don't know who the canary is, the canary is you). How does this code fit that example?

    It's a canary because you know, based on this idiocy, that the code base is indeed deadly.

    Ah. Now I see.

  • CAPTCHA: nimis (unregistered)

    TRWTF is that they didn't implement this function in VB

    Public Function IsInRole(ByVal Role As String) As Boolean Try Return StrComp(Left(Username, 3), Role, vbBinaryCompare) == 0; Catch ex As ArgumentNullException Throw Catch ex As ArgumentException Throw Catch ex As NotSupportedException Throw Catch ex As Reflection.TargetInvocationException Throw Catch ex As MethodAccessException Throw Catch ex As MemberAccessException Throw Catch ex As Runtime.InteropServices.InvalidComObjectException Throw Catch ex As Runtime.InteropServices.COMException Throw Catch ex As TypeLoadException Throw End Try End Function

  • CAPTCHA: bene (unregistered)
    public bool IsInRole(string roleName)
    {
       if (UserName.StartsWith(roleName.Substring(0, 3)) {
         return true;
       } else {
         MessageBox.Show("Not in role: " + roleName);
         return false;
       }    
    }
    
  • Anonymous (unregistered) in reply to CAPTCHA: nimis
    CAPTCHA: nimis:
    TRWTF is that they didn't implement this function in VB

    Public Function IsInRole(ByVal Role As String) As Boolean Try Return StrComp(Left(Username, 3), Role, vbBinaryCompare) == 0; Catch ex As ArgumentNullException Throw Catch ex As ArgumentException Throw Catch ex As NotSupportedException Throw Catch ex As Reflection.TargetInvocationException Throw Catch ex As MethodAccessException Throw Catch ex As MemberAccessException Throw Catch ex As Runtime.InteropServices.InvalidComObjectException Throw Catch ex As Runtime.InteropServices.COMException Throw Catch ex As TypeLoadException Throw End Try End Function

    Don't forget the error if the string has less than 3 characters!

  • Anon (unregistered) in reply to Knux2
    Knux2:
    notromda:
    Anon:
    jonsjava:
    After entering her password (Snookums1902 -- her cat's name, and her year of birth).

    Wow! That's one old cat.

    No one said the cat was still alive....

    Is it still in a box with a small amount of radioactive substance and some hydrocyanic acid?

    If the cat's been in there for 108 years, I don't think even quantum mechanics can save it. There, I've just disproved Heisenberg.

  • (cs) in reply to Anonymous
    Anonymous:
    Pentium100:
    Simple - assign each module a number (power of 2, so 10 modules would have numbers of 1, 2, 4, ..., 1024). When you want to give a user privileges to certain odules, just add their numbers and place the sum as a prefix to user name, so 16_n00b will have access to module number 5, while 2047_admin will have access to all modules.

    Job security in it's finest! SQL Server actually used (maybe still uses) this method to store some details about it's databases. I forget the exact details of which table/field in the master db.

    I just love them cryptic bit masks!

  • Constant Coder (unregistered) in reply to Cliff
    Cliff:
    I could see 3 tables, roles and users could well need a junction table to resolve a many-to-many...

    One user has many roles, each role has many users...

    Are you sure you are in the right place? This thread is where recent Comp-Sci graduates insult VB-users and management. No DBA skills are required....

  • super_adm_sys_Dave (unregistered)

    TRWTF is that people are still arguing about fixed roles, when it's been known since at least 1623 that they change with time; as the Bard said, "one man in his time plays many parts."

    CAPTCHA: conventio, as in Conventio exits stage left.

  • Aussie Contractor (unregistered)

    When I started my job, I had to legally change my name to "Employee167" (Obviously, I am the 169th person to work here after my boss, his name is "The Boss" and "Admin Guy" who is our admin guy)

    It means that we don't have to worry about learning new names when people come and go. You can also reuse logins when replacing an employee.

    "Hi everyone, this 'Employee128' she will be working in data entry to replace 'Employee128' who is away on maternity leave."

    It solves so many issues !!!

    Captcha "dolor" - seriously, now you are just making these up!

  • (cs) in reply to Bert Glanstron
    Bert Glanstron:
    In C++ templates, the compiler generates the code at compile time, so you still get compiler type checking and code optimization. C# generics do none of this. Note my example:

    long i = Cast<long>("I Like Canaries!");

    This not only compiles, but signal my intent to cast "I Like Canaries!" to a long. I'm not sure where this could ever be useful.

    I know "long pig" is a euphemism for human flesh, used in reference to those cultures that practice (or used to practice) cannibalism. No idea what a "long canary" actually is.

    Flamingo, maybe.

  • wtf (unregistered) in reply to super_adm_sys_Dave
    super_adm_sys_Dave:
    TRWTF is that people are still arguing about fixed roles, when it's been known since at least 1623 that they change with time; as the Bard said, "one man in his time plays many parts."

    CAPTCHA: conventio, as in Conventio exits stage left.

    Wasn't Conventio the manager of the nunnery in As You Like It?

  • Loathing computer? (unregistered)

    Usually when the code is bad also the tests are bad. Who on earth tests systems with unified data?

  • (cs)

    Hmm, look at the code:

    public bool IsInRole(string roleName)
    {
       return UserName.StartsWith(roleName.Substring(0, 3));
    }

    You see that? Java capitalisation in a C# application! What you can see is that 'Username' comes from a C# developer, and the 'IsInRole' method was later added by a Java developer.

    This clearly proves that, as soon as you step over to the Dark Side, your code immediately suffers.

    Or it could be, of course, that the developer is an utter twit.

  • NFL Shop (unregistered)

    There are a lot of new idea,it gives me inspiration.I think I will also inspired by you and think about more new ideas

  • NFL Jerseys (unregistered)

    这是一个很好的,常识article.Very帮助一谁是发现此part.It的resouces一定会帮助教育我。

  • polo shirts (unregistered)

    好文章,每一个点是与我们分享您的智慧好enough.Thanks 。

  • oakley sunglasses (unregistered)

    我完全同意你的博客帖子oppinion.this是非常令人鼓舞的人谁想要了解这些议题。

  • OTee (unregistered)

    That was until Emperor Palpatine aka "Emp-Pal" came and demanded full access on that battle station !

    CAPTCHA: ratis, lat. a bone deformation illnes forcing you to scurry around like a rat.

  • vydf (unregistered) in reply to Severity One
    Severity One:
    Hmm, look at the code:
    public bool IsInRole(string roleName)
    {
       return UserName.StartsWith(roleName.Substring(0, 3));
    }
    You see that? Java capitalisation in a C# application! What you can see is that 'Username' comes from a C# developer, and the 'IsInRole' method was later added by a Java developer.

    This clearly proves that, as soon as you step over to the Dark Side, your code immediately suffers.

    Or it could be, of course, that the commenter is an utter twit.

    FTFY. See http://www.oracle.com/technetwork/java/codeconventions-135099.html#367 for why.

  • Guen Enduser (unregistered) in reply to Admiral Nelson

    You might, but I can't seem to do anything.

  • Dylan (unregistered) in reply to Admiral Nelson

    What? convenient? What if the users user-name didn't start with "Emp"? They wouldn't get the right privileges... how convenient.

  • (cs) in reply to The Nerve
    The Nerve:
    Or maybe they have uncooperative DBAs.

    Really, is there any other kind?

  • CAPTCHA: secundum (unregistered) in reply to Harder than Hard-Core

    If you extend this with versioning it really sounds a lot like ENVY.

  • OMGWTFJON (unregistered)

    Seems someone took the agile philosophy of 'Do the simplest thing that can possibly work' past breaking point.

  • Sten (unregistered) in reply to Admiral Nelson

    What about creating a role named “Emperor” that can do anything. Do you see the flaw now?

  • CAPTCHA: ingenium (unregistered) in reply to Sten
    Sten:
    What about creating a role named “Emperor” that can do anything. Do you see the flaw now?

    Duh, the frist comment covered that.

  • Buzz Killington (unregistered) in reply to metzomagic
    metzomagic:
    The Nerve:
    Or maybe they have uncooperative DBAs.

    Really, is there any other kind?

    I just found out after 20 years that DBA stands for Database Administrator. I always assumed it stood for "Don't Bother Asking" because that is the response I most frequently hear from them.

  • Bill's kid (unregistered) in reply to Sten
    Sten:
    What about creating a role named “Emperor” that can do anything. Do you see the flaw now?

    What if you had a user name that started with Adm, a common abbreviation for Administrator? Do you see the joke now?

  • (cs) in reply to vydf
    vydf:
    Severity One:
    Or it could be, of course, that the commenter is an utter twit.

    FTFY. See http://www.oracle.com/technetwork/java/codeconventions-135099.html#367 for why.

    Irony isn't your strongest side, is it?

    But pray tell, shouldn't 'Username' and 'roleName' have the same capitalisation? Hmm?

    And the code example is in C#, so WTF are you coming up with a Java page?

  • nulla (unregistered) in reply to hoodaticus
    hoodaticus:
    Ahhh, Agile Development inaction.
    FTFY
  • (cs) in reply to Severity One
    Severity One:
    vydf:
    Severity One:
    Or it could be, of course, that the commenter is an utter twit.

    FTFY. See http://www.oracle.com/technetwork/java/codeconventions-135099.html#367 for why.

    Irony isn't your strongest side, is it?

    But pray tell, shouldn't 'Username' and 'roleName' have the same capitalisation? Hmm?

    And the code example is in C#, so WTF are you coming up with a Java page?

    C#, Java. Tom-ate-o tom-art-o.

  • (cs) in reply to Constant Coder
    Constant Coder:
    Cliff:
    I could see 3 tables, roles and users could well need a junction table to resolve a many-to-many...

    One user has many roles, each role has many users...

    Are you sure you are in the right place? This thread is where recent Comp-Sci graduates insult VB-users and management. No DBA skills are required....

    There are excellent SQL discussions on here all the time.

    DELETE FROM dbo.Comments WHERE UserName='Constant Coder';

  • CurtCharlesPDX (unregistered)

    I haven't written code in over 15 years, but...

    Seems like the function returns true only if the USER has the same start as the ROLE. So it would work fine for the test cases where the role is EMPLOYEE and the test user name is also EMPLOYEE, but for real users it would likely always fail.

    What was needed here is to look up the user in the roles table and see if that role which is assigned matches the role that's being requested.

  • Jonathan (unregistered) in reply to Luca from Pisa University
    Luca:
    I am an Italian student who studies Computer Science at Pisa University, and I am developing some projects in Java using Java 2 Standard Edition (J2SE) and Java 2 Micro Edition (J2ME for MIDP 1.0 compliant devices). I need to know if there are some Java API (for J2SE and J2ME) to implement roles for a mobile phone.

    If you're Luca Cardelli (developer of ML), I'd say you have a Very Odd sense of humor!

  • Woops (unregistered)

    Reminds me of some ill formed grep statement on our multi million dollar machines that checked if the username was 'root', of course, mr 'grootmans' also got root access...

  • (cs) in reply to Woops

    And as these things go, Dhr. Grootmans was probably a janitor or, worse even, a manager.

  • C (unregistered) in reply to Yuval
    Yuval:
    You mean "its".

    (this was a commentary on the superfluous apostrophe in the last paragraph of the article. Seriously. "It's development"??)

    What? No comment on the superfluous verb in "that's is passed"? :p

  • C (unregistered) in reply to Severity One
    Severity One:
    vydf:
    Severity One:
    Or it could be, of course, that the commenter is an utter twit.

    FTFY. See http://www.oracle.com/technetwork/java/codeconventions-135099.html#367 for why.

    But pray tell, shouldn't 'Username' and 'roleName' have the same capitalisation? Hmm?

    And the code example is in C#, so WTF are you coming up with a Java page?

    Because "UserName" might be a property, not a member, while roleName is an object...

    Also because your original post made no sense: "the 'IsInRole' method" would never have been "added by a Java developer." -- and the link could help you understand why.

  • (cs) in reply to Knux2
    Knux2:
    My Roomba has root privileges, for some reason...
    +1
  • (cs) in reply to Anon
    Anon:
    Knux2:
    notromda:
    Anon:
    jonsjava:
    After entering her password (Snookums1902 -- her cat's name, and her year of birth).

    Wow! That's one old cat.

    No one said the cat was still alive....

    Is it still in a box with a small amount of radioactive substance and some hydrocyanic acid?

    If the cat's been in there for 108 years, I don't think even quantum mechanics can save it. There, I've just disproved Heisenberg.

    That's odd. Your post changed when I observed it.

Leave a comment on “Role-based Canary”

Log In or post as a guest

Replying to comment #:

« Return to Article