Skip to content

The Weird and The Wonderful

It was the best of code, it was the worst of code. Coding Horrors, Worst Practices, and flashes of brilliance

This category can be followed from the open social web via the handle the-weird-and-the-wonderful@forum.codeproject.com

1.8k Topics 20.7k Posts
  • ERROR_SUCCESS => the successful error

    visual-studio com help question
    8
    0 Votes
    8 Posts
    0 Views
    E
    ERROR_NOT_READY (Get a move on!) ERROR_CALL_NOT_IMPLEMENTED (Don't try to contact your friend with your laptop) ERROR_DISCARDED (you threw away your computer!) ERROR_PIPE_CONNECTED (That's an error?) ERROR_CANTREAD (Illiterate computer) ERROR_CANTWRITE (Ditto)
  • Productivity Wars

    help css com business collaboration
    22
    0 Votes
    22 Posts
    1 Views
    J
    jim lahey wrote: We want to be able to interpret expressions defined in Xml files Presumably because this reflects a real business need versus a 'really cool' development idea. jim lahey wrote: and we've got a component that can do a hell of a lot more to boot Which isn't a recommendation. After all Oracle can do a lot more than store a configuration value but one certainly shouldn't choose to use Oracle only to store a configuration value. jim lahey wrote: What objections do you have to using third party stuff? Some Reasons - Often the complexity greatly exceeds the needed use. - The intended use is much more suited to a far simpler solution. This is similar to but not the same as the prior reason. It comes about because the developer finds a library they want to use and then invents a problem to solve with it or rationalizes much more needed functionality for an existing problem. - The license is not compatible with the needs of the business. This often is because some licenses can require that the Application code must be available as source. Another common problem is that that there is no license which means one must have explicit use license from the author to use it. - It isn't available as source and the author(s) support is erratic. One must of course have a policy in place to keep and track license(s). And one should keep an actual copy of the license not just a link. One must also be prepared for the possibility that at some time the license might change.
  • Big risk

    json help asp-net business
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Oh no, not again....

    question
    7
    0 Votes
    7 Posts
    0 Views
    K
    The only thing wrong with the way readonly works is my initial impression of it when I first encountered it. I got that impression before I read any documentation on the property. First impressions can be exactly right, but they are usually wrong. As soon as I got it through my head that the object I was looking at was a reference type it came clear how readonly worked. Doesn't even have to be a reference type, everything has a reference location in memory, that's how const can work as well.
  • Code as War Crime

    database design question workspace
    26
    0 Votes
    26 Posts
    2 Views
    G
    You know that a Windows service can be allowed to interact with the desktop in which case you can use and you need UI controls. I don't know what the intention is from those few line of codes but this is far from a War Crime, so I think you're exaggerating. Yes, I know that : Quote: In most cases, it is recommended that you not change the Allow service to interact with desktop setting. If you allow the service to interact with the desktop, any information that the service displays on the desktop will also be displayed on an interactive user's desktop. A malicious user could then take control of the service or attack it from the interactive desktop. I have seen worse. giuchici
  • C#'s sneaky typedef

    csharp
    37
    0 Votes
    37 Posts
    50 Views
    J
    The "var" thing in C# is often miss-interpreted. Because everyone thinks of runtime type identification (VB...). But in C# it's not - it's only syntactic sugar if you don't want to retype complicated Type-names like: Dictionary, List>>, but the compiler always knows what type it is - it's normal strong compile-time type checking. Even the IntelliSense knows the type. But there are situations it is neccessary: you - as the programmer - sometimes do not know which type an expression will give back (anonymouse types), but the compiler will create a class for the anonymouse type during compilation and can fill in the missing type instead of the var keywords - but again: AT COMPILE TIME. So in your example: object field = new SomeClass(); var x = field; will result in x interpreted as object not SomeClass. Don't mix that up with GetType() or typeof operator in c# - you can always ask an object for it's type - AT RUNTIME. This is an better example: object field1 = new SomeClass(); var field2 = new SomeClass(); Where for field1 you are holding a SomeClass-instance as a base class reference (everything derives from object) where field2 is totally equivalent to: SomeClass field2 = new SomeClass(); If you want my personal opinion: I just use it where needed (anonymouse types) or for LINQ (there you often have those ugly long typenames). For me it had another nice side-effect I didn't think of in the first place: If you have specific algorithms or snippets and used the var keyword instead of the real type, you get code that is great for copy-pasting arround. This sometimes helps to focus on the underlaying constructs - and it helped me "to see" how repetitive code can be unified. var regards = from reg in AllRegards where reg.Quality = "best" select new { Regards=reg, Quality=reg.Quality }; (this would be valid C# (LINQ) giving back an anonymouse type - you can not know it's Name, so use of var keyword is mandatory...)
  • Interesting Observation

    question css database
    8
    0 Votes
    8 Posts
    0 Views
    R
    Pablo Aliskevicius wrote: To my surprise, the output was this: print #1 That's the thing am Asking.... am Unable to understand why the Print #1 is Printed....... I am trying to Find why it's printing Print #1 with no Luck...... If we Don't use Begin and End( But i always Use....) Then it will execute the first statement... But Here... That's not the case.... Trying to figure out the Mystery Behind it... :doh: Raj.......
  • Take care of your TEMP folder!

    help com graphics sysadmin tools
    10
    0 Votes
    10 Posts
    0 Views
    Richard DeemingR
    If you just want to generate a random filename without creating a file, try Path.GetRandomFileName[^] instead. "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • 0 Votes
    4 Posts
    0 Views
    K
    Sorry unable to delete. :(
  • Why not: // just shoot me!

    24
    0 Votes
    24 Posts
    5 Views
    L
    Luiz Felipe Stangarlin wrote: This is why I hate the facebook, I cannot hate things, can only like things. How in the world I am supposed to only like things. I think exactly opposite. While I'm not a huge fan of a facebook, this particular feature is fine for me. Whereas I do dislike various things, a non-existance of downvoting mechanism forces me to express the dislike in a commentary (hopefully constructive). No downvoting makes the website more positive, which is a desired feature for a social network. We all have enough univoters in the real life... Anyway, there are a lot of "hatred groups" on FB. Giving a 'like' to them is a way to express hatred, if you really need to. Greetings - Jacek
  • Comments in a foreign language

    13
    0 Votes
    13 Posts
    0 Views
    L
    Did he use Polish diacritic in the variable names (like "ą ę ó" etc.)? That would be awful. BTW I have no idea what the hell is "Boffo"... it sounds like a joke to me. Once I was working on a project in which there was a requirement to name database columns in Polish. :doh: Maybe it's because the rest of it was in Deutsch. The code was in English, though, while comments still in Polish... Greetings - Jacek
  • Found something interesting

    help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Can't people read the form description anymore?

    question
    11
    0 Votes
    11 Posts
    2 Views
    Z
    Quote: Can't people read? I'm fine, how are you? There are only 10 types of people in the world, those who understand binary and those who don't.
  • Nested if-else statements...

    15
    0 Votes
    15 Posts
    3 Views
    F
    There're lots of ways to optimise this code (without a right/wrong flags, there are more elegant solutions) but I don't think it's thread author's intention to get a code review... How can we code so ugly when we're fresh eh? :laugh: It's so funny to review our old codes. These days I found a code of mine written in C# and using a goto, WTF? :omg: *palmface*
  • Life of Software Developer

    question
    27
    0 Votes
    27 Posts
    0 Views
    F
    From Socrates: All I know is that I know nothing. X| I love it but sometimes I get tired of studying too much and I need a break. The thing is that in this field of knowledge we can't get often nor long breaks from studying and updating our's knowledge base. The more I study and get to know new things, I realize that I'm so dumb and I still need to learn so many things. That's so frustrating. :( The thing is that I work from 8am to 6pm and study from 7pm to 10:30pm. I freelance on Saturdays and spend time with my family in Sundays. It's hectic and I don't have time for anything. Fortunately this is my last year in university, I believe I'll enjoy my studies and my family better from the next year and so on. :)
  • Code Safety and The .Net CLR & Java Runtime

    csharp dotnet question c++ java
    5
    0 Votes
    5 Posts
    0 Views
    D
    So which forum? I based my decision on the WORST/BEST PRACTICES which is mentioned at the top.
  • Not 'Clap' but 'CLAP', dammit.

    help com docker question announcement
    8
    0 Votes
    8 Posts
    0 Views
    R
    Not to be pedantic, but I think you'll find the clap is a bacterial infection. (Just don't ask how I became an expert ;-))
  • Yet another Subversion rant

    sysadmin collaboration question announcement
    36
    0 Votes
    36 Posts
    75 Views
    R
    It depends: having a completely distributed source control system is gold, for me. Which happens also to be blazingly fast, btw. Oh well, whatever.
  • Production code adds a BCC to email account of developer

    com
    7
    0 Votes
    7 Posts
    0 Views
    R
    Thinking the best, he wanted to be sure that the system was running perfectly, thinking the worst, he may be working for someone else... However, if the account was a corporate account (and not his personal email account), most likely he was monitoring the system. CEO at: - Rafaga Systems - Para Facturas - Modern Components for the moment...
  • Let's "switch" to Something Else

    c++
    34
    0 Votes
    34 Posts
    2 Views
    J
    Was that meant to be English?