Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
N

Nathan D Cook

@Nathan D Cook
About
Posts
17
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • ToString() and ToUpper() are like, so cool!
    N Nathan D Cook

    (some meaningless code left out)

    if (combo.SelectedItem.ToString() != null && combo.SelectedItem.ToString().ToUpper() == "APPROVED")
    {
    /*do some stuff*/
    }

    else if (combo.SelectedItem.ToString() != null && combo.SelectedItem.ToString().ToUpper() == "UNAPPROVED")
    {
    /*do some stuff*/
    }

    else if (combo.SelectedItem.ToString() != null && combo.SelectedItem.ToString().ToUpper() == "PAID")
    {
    VoidPayment(combo.SelectedItem.ToString().ToUpper());
    }

    else if (combo.SelectedItem.ToString() != null && combo.SelectedItem.ToString().ToUpper() == "ADJUSTED")
    {
    VoidPayment(combo.SelectedItem.ToString().ToUpper());
    }

    VoidPayment(string paytype)
    {
    if (paytype.ToUpper() == "PAID")
    else if (paytype.ToUpper() == "ADJUSTED")
    }

    I am just a novice programmer, but I saw 3 things that seemed strange to me. First, why check for null every time and a ToString().ToUpper() every time? Why not just check it once and set a string that we can check? :confused: Second, in the paid and adjusted if-else sections, why not just pass PAID or ADJUSTED into VoidPayment? In this particular function, the combo box doesn't change. You already know what section you are in due to the if-else logic. (Or we could pass that same string I mentioned a second ago). Third, in the VoidPayment function why are we doing yet another ToUpper when we know we are passing in either a capitalized PAID or ADJUSTED string? VoidPayment is only called from those two spots, and it's not really a function that should be called elsewhere or added anywhere else later. And they wonder why our code is slow....... Cheers, Nathan

    The Weird and The Wonderful question

  • Just got an email rejection to my job application........
    N Nathan D Cook

    Maybe they had THAT many people to interview? :laugh: Anyways, I met my wife because of a place taking waaaaaaaaay too long to drug-test me. After about 5 weeks, I got another job elsewhere and met my future wife there. (Of course, ironically, the drug test came back OK the day after I got hired elsewhere, but too late for them.) Also, One time many years ago, a place listed "Bachelor's degree in Computer Science or equivelant" as their *only* requirement. I sent them my resume. A month later I got a letter saying "We're sorry, but you are not qualified." :confused: I have no problem if they looked over my resume and didn't like it, that's fine. But, either change your requirements or change your rejection message, because I *WAS* qualified enough according to their "requirements." :laugh:

    The Lounge career

  • The Most Hated Buzzword - 2011
    N Nathan D Cook

    I think "It is what it is" is required training of every pro athlete and sports journalist in the US. I swear I hear that phrase on ESPN at least once a day.

    Buzzword Bingo com question learning

  • How to waste time calling the database multiple times
    N Nathan D Cook

    Names changed to protect the innocent....

    private void FillGrid()
    {
    /*Lots of code ommitted...A lengthy function that completely wipes out datatables, re-calls the database, and re-fills the datatables. */
    }

    /*handler called for certain changes to the Case*/
    private void Case_SelectionChanged(object sender, EventArgs e)
    {
    FillGrid();
    }

    private void FillCase(string PatientID)
    {
    /*(some meaningless code ommitted)*/

    case.ItemIndex = 0; /*fires the CaseSelectionChanged handler*/
    }

    /*called EVERY time we search...*/
    protected void Search()
    {
    FillCase(PatientID);
    case.EditValue = caseNo.Trim(); /*fires the same handler*/
    Case_SelectionChanged(new object(), new EventArgs()); /*call the handler directly*/
    FillGrid();
    }

    So, in 4 lines of code in Search(), we call a lengthy FillGrid function 4 times....Really? :doh:

    The Weird and The Wonderful database tutorial question

  • Odd one out
    N Nathan D Cook

    +5 Because that was EXACTLY what I was going to say!

    The Lounge xml question

  • Body mass indexes (indices???): What a load of.... well, you know!
    N Nathan D Cook

    What about NFL Lineman? I realize some guys are plain just fat, but there are many more who are big and strong dudes but would be considered "unhealthy" by BMI standards. I don't really remember the categories/numbers of BMI, but my first "UGH" at BMI was when I was in high school. I was having basketball practice for 2.5 hours every day. I was 6'1" and probably about 150-160 lbs...and I was considered overweight. I was fairly skinny too. I was seriously like "Ok, this BMI thing is stupid." LOL.

    The Lounge question career

  • What will it be, xbox or playstation 3.
    N Nathan D Cook

    I hope Wii 2. I'm more of a Nintendo fan.

    The Lounge graphics question

  • Poll: How many of you hunt and peck on the keyboard
    N Nathan D Cook

    Luckily, I am an elite typist and very very fast typing the normall keyboard and the 10pad. I don't ever look at the keyboard. That's good, because as much as I've tried, I'm still a very very poor programmer. X| I need those extra seconds to think. My dad is a hunt and pecker, but he just plays games. So, basically, the only letters he really knows on the keyboard is his name. He's really good at those letters and pretty bad with any letters that aren't in his name. LOL.

    The Lounge performance tutorial question

  • VBA data storage the text box way
    N Nathan D Cook

    Is the colleague actually a programmer? If so, I echo said "stunned silence".

    The Weird and The Wonderful data-structures question

  • Logic
    N Nathan D Cook

    I'm just a novice programmer and didn't even realize (or I forgot?) that & was a legal command. I've always just used &&. I'm so confused by the last 30 some posts, I'm going to keep it simple and make sure I never use &.

    The Weird and The Wonderful com help question

  • Making sure something is really true.....
    N Nathan D Cook

    saw this at work today.... if (Status == "something") { randomValue = true; } else { randomValue = true; } That was it. No other code in that if/else statement. :-D

    The Weird and The Wonderful

  • Can't publish a project even though no build errors
    N Nathan D Cook

    I have been using C# and Visual Studio for about 6 months now and it has worked fine. Recently, I don't know what I did, but when I try to publish a program now it doesn't work properly. I have no build errors, but when I click on publish under the menu (or in the project window), it says "Could not publish because a project failed to build." I searched for this online and found it can sometimes be caused by DevExpress. So, I uninstalled DevExpress, and I still get the problem. I thought I might have done something clumsy in code, so I started a completely new solution, a windows form, and clicked publish. I still get the problem. One thing I noticed is when I click publish, a "(name of project)TemporaryKey.pfx" appears in the project window, at about the same time the error happens. Could that maybe have something to do with my problem? (I know very little about keys.) Any ideas? Thanks for any help.

    C# help csharp visual-studio question

  • Fire drills
    N Nathan D Cook

    I used to work at wal-mart, and the alarms are amazingly loud there........ugh....

    The Lounge question

  • With This Ring I Was Wed
    N Nathan D Cook

    A. Yes, very happily. B. Very, very rarely. I can't *stand* my ring, :mad: I constantly re-adjust it when I wear it, and it drives me nuts. C. Left index

    The Lounge com question announcement learning

  • Logics is really hard to learn
    N Nathan D Cook

    "Logics is really hard to learn?" Don't you mean "Logics are really hard to learn?" LOL, I'm just kidding. Anyways, personally, I actually prefer the first one just because it's easier. My job involves 40 hrs a week of trying to decipher other people's written code and fix bugs. I love it, but I'll gladly take the simple-written code over the stuff I have to think over for a minute or so.

    The Weird and The Wonderful tutorial question

  • Magic Bullets: Wizardzz's Firearm Report
    N Nathan D Cook

    Well, the price of food IS going up....(but, I didn't think you'd get attacked over it...)

    The Lounge hosting cloud announcement

  • Enquirer Points [modified]
    N Nathan D Cook

    Just start doing all your responses in "Jeopardy style..." and phrase all your answers in a question... "What is C#?" "Who is Microsoft?" That counts, right? (sarcasm)

    The Lounge hosting cloud question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups