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
  • 0 Votes
    15 Posts
    2 Views
    L
    Wait until I post a picture of my new outfit. :) How about a dark robe, covered with mystic symbols like the hex codes from 00 to FF. A matching pointy hat and some kind of staff or wand. Growing the obligatory beard my take a while :) Edit: Just for fun, I just took it as my signature modified on Thursday, May 15, 2008 5:32 AM
  • What "for" ?

    c++ question
    19
    0 Votes
    19 Posts
    3 Views
    R
    A fair criticism, but remember that Visual C++ 6.0 was written before the standard was actually finalized, and at the time it was released that was one of the breaking changes.
  • Ugh

    question
    8
    0 Votes
    8 Posts
    0 Views
    T
    Yeah... ugh. I was unaware of that use of the comma operator. Before posting my ignorance of it, I looked up the comma operator in C#, but didn't find that usage. Thanks for the "pointer". ;-)
  • The Classic [modified]

    question csharp c++ java
    30
    0 Votes
    30 Posts
    0 Views
    S
    //At college a professor tried to tell me that I can't possibly write better code than a compiler. I proved him wrong, but it's not really hard do better than a compiler in most cases.// I have found that, in general, the smaller a routine, the more likely it can receive a big speedup from hand assembly (at least if it doesn't match a particular 'pattern' the compiler can recognize and optimize). Some years back I wrote a game for an XT which had about 20 lines of assembly code in a 1400-line game. The assembly code ran about ten times as fast as what the compiler could generate, and yet still represented about 80% of the main loop's worst-case execution time. Nowadays a lot of my hobby programming is in assembly language, though. On a game machine with 128 bytes of RAM (code runs from ROM) when there are 76 clock cycles per scan line to handle display drawing, assembly code is pretty much a must. A BASIC compiler exists using some pre-defined display kernels, and people have done some cool things with it, but for real power programming hand-written assembly is the only way to go.
  • Just set Auth to true [modified]

    com hardware security help
    7
    0 Votes
    7 Posts
    2 Views
    E
    :laugh: :-D
  • Replace what? [modified]

    database question
    13
    0 Votes
    13 Posts
    0 Views
    S
    Well, I mean the guy who wrote it must have been using a Hex editor and the link break was just another two bytes to him, as he could only see "0D 0A" which looks normal, to him... :laugh: :D -Spacix All your skynet questions[^] belong to solved I dislike the black-and-white voting system on questions/answers. X|
  • Oh man...

    com
    18
    0 Votes
    18 Posts
    0 Views
    W
    :) Can i categorize it with advice ? http://www.wiltech-center.com
  • Help me please!

    php visual-studio com help
    16
    0 Votes
    16 Posts
    0 Views
    T
    leppie wrote: I have crap like the following scattered all over my code base!!!! I am spending more time rewriting absurd code than getting stuff done! Int32 YearNow = Convert.ToInt16(DateTime.Now.Year.ToString().Substring(2, 2));Int32 MonthNow = Convert.ToInt16(DateTime.Now.Month.ToString()); Weird. Very Weird. You're converting an Int32 to a string which becomes an Int16 and that gets promoted to an Int32? :wtf: People using Windows XP are still living in 2001.
  • The worst code i've ever seen....

    java com tools performance
    54
    0 Votes
    54 Posts
    0 Views
    D
    Georgi Atanasov wrote: it is not good to show such attitude when talking with other people. I'd agree certainly, however my original statement wasn't intended in perhaps the way it was percieved. Georgi Atanasov wrote: one how says Java is the worst code ever I never said that (I hope), that would be Haskell perhaps. However as a programming language that claims to produce software for all purposes (essentially) then compaired to .NET it does have significant performance and memory limitations that to my mind at least make it all but crippled. Georgi Atanasov wrote: Java world is larger than the .NET one I have heard that quoted before, and I wouldn't be as bold as too disagree, however I would say that just because it's used more doesn't make it good. Ask a linux advocate and they would use a similar argument perhaps. Georgi Atanasov wrote: it is actually PLATFORM INDEPENDENT I don't dispute that Java some benefits, however I would argue that things like platform independance is very low on my list of priorities. Georgi Atanasov wrote: does not have Interop calls in the class library If it doesn't make the language more complicated to use or of lower performance where is the advantage of not doing that? Georgi Atanasov wrote: I think you miss some of my statements I was pretty careful to read your posts (and have double checked them before posting this), however while you are technically right in the aspects of java benefits you state, I question however they are of any significance to the average progremmer or perhaps even to industry. If a language is simple to use, works well, and performs well, does it really matter the underlying implementation issues? Georgi Atanasov wrote: OK, about the Value and Reference types - these are the two basic types in .NET. Value types are special objects, which reside on the Stack and are accessed by copying their values (of course you may always pass a value type by ref). Reference (or instance) types on the other hand are objects, which reside on the managed heap, reserved by the CLR, and are accessed by reference. These objects are target of the
  • Read-only properties

    question
    42
    0 Votes
    42 Posts
    0 Views
    J
    I'd say small, embedded systems like set-top boxes or microwave ovens or TiVos or suchlike....close enough to the original problem domain addressed by what eventually became J2SE 1.0, without all the EE or additional-API BS-cleaverly-disguised-as-APIs. When Java was hijacked from scratching-an-itch to become the cornerstone of the One "True" Programming Religion, with hundreds of thousands of low-cost, mass-produced "proessionals", the nice, more-or-less-forward progress of software discovery and evolution took a nasty, twisted turn. For many shops controlled by Javacolytes, that 'twisted turn' has straightened out nicely. They're under a constant acceleration of ten meters per second per second... Jeff Dickey Seven Sigma Software and Services Phone/SMS: +65 8333 4403 Yahoo! IM: jeff_dickey MSN IM:    jeff_dickey at hotmail.com ICQ IM:    8053918 Skype:     jeff_dickey
  • why o' why?

    question
    25
    0 Votes
    25 Posts
    4 Views
    M
    This points out another coding horror/problem (whatever). It gets past IE 7. Sad but yes IE 7 lets it past while Opera and Firefox don't. The most we can hope is that IE 7 was made to ignore the problem. I seen a page where the title is in the body instead of the header so it is shown on the actual page.
  • Audible Horror

    com tools question
    23
    0 Votes
    23 Posts
    1 Views
    P
    Jeff Dickey wrote: You should try working in South Asia. :-P I'm already in South_east_ Asia, and even as someone who speaks the local language (aside from English), it's a horror to behold. The only thing even more horrible is the code they write... Btw, which country are you working from? Do you know...LinFu?
  • Give me a horror :)

    csharp tutorial com tools
    18
    0 Votes
    18 Posts
    3 Views
    C
    I too use the 'do', also Back in my VB6 days, I would often (amongst other things) start an app up using a Select. Select Case False Case DoThis() Case DoThat() Case Else //Launch Main Form End Select Each method is called in turn, the first method that fails (returns false) aborts the startup. Much cleaner than endless if-else's, and although it's probably not correct to compare Select and switch, switch is no match. modified on Thursday, April 3, 2008 3:58 AM
  • Bool expression??

    csharp linq functional question
    24
    0 Votes
    24 Posts
    0 Views
    P
    I considered creating a new thread for this, but (obviously) decided not to. I spent yesterday at the "Heroes happen {here}" event (in Phoenix) and most of the demoes in the "developers' track" was presented by a "developer evangelist", and it seemed like every one of his methods that returned a bool was written in that form. :mad:
  • Anonamous delegates gone mad!

    csharp wpf com
    9
    0 Votes
    9 Posts
    1 Views
    D
    Yes, I suppose.
  • I didn't really think that people like this existed . . .

    7
    0 Votes
    7 Posts
    2 Views
    D
    It depends what the life of the code is indended. If it was a short term piece of interim code then perhaps it might be justifiable (perhaps even on performance grounds)
  • Handling Exceptions...

    database apache mysql com sysadmin
    13
    0 Votes
    13 Posts
    1 Views
    D
    It should be done both browser side and server side... Browser to reduce load in the server, and server to prevent security and otherwise issues.
  • Interesting Variable Names

    16
    0 Votes
    16 Posts
    0 Views
    D
    Justin Perez wrote: Very unprofessional, immature, and like you said, very difficult to debug. I agree, however...... A bit of fun boosts moral and increases productivity.... Lee still remembers that code whereas I bet he doesn't remember much other code from the same period.
  • Stupid variable names

    21
    0 Votes
    21 Posts
    1 Views
    D
    Sounds like a clever chap to me.... My kind of plan.... Guarenteed employment for life (or the life of the software :) )
  • Use session for pass value [modified]

    10
    0 Votes
    10 Posts
    0 Views
    K
    I think you have incorrect place to post. :) My blog