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
  • 99 bottles of beer in Malbolge

    question csharp html adobe architecture
    6
    0 Votes
    6 Posts
    24 Views
    J
    Yes? :) Wrong is evil and must be defeated. - Jeff Ello Never stop dreaming - Freddie Kruger
  • Client sided login

    question javascript com adobe architecture
    16
    0 Votes
    16 Posts
    23 Views
    L
    Someone went to a coding-bootcamp, and was so great at his work his code needn't be reviewed :laugh: Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
  • can I have $4

    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • wow -_-

    com announcement
    1
    0 Votes
    1 Posts
    6 Views
    No one has replied
  • How NOT to calculate the end of month...

    ruby
    14
    0 Votes
    14 Posts
    28 Views
    M
    This gets you the last *date* of the month, but if you’re actually looking for the “end” of the month and don’t want fencepost errors, you’d want the first of the next month (with no time component) and then use a strict less-than in your comparisons.
  • Who wants to see my p*enis

    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • html button not firing on mobile, oh

    help csharp javascript html asp-net
    6
    0 Votes
    6 Posts
    10 Views
    raddevusR
    Closing the loop on this... That second link explains that the onclick event should fire and it is correct. I created another barebones HTML page and added a button with an onclick event and tried it from my Amazon Kindle fire pad (running Silk browser) and it worked with no problem. Hmmm...maybe I had a syntax error on my original HTML and it pre-cluded the touch event from firing properly while a normal desktop browser handled it?? :~ Well, thanks again for your help. :thumbsup:
  • 0 Votes
    14 Posts
    55 Views
    E
    The first time I used random numbers in C, in my first programming class in university, I went through the same questions just to realize that certain numbers are simply not in the sequence generated by the pseudo-random number generator. In your example it is zero but you can probably pick any other number and the same will happen. If javascript does not automatically reseed you will have always the same sequence and never have the number you want. Later, in university, I studied how pseudo random number generators were constructed in silicon and understood why certain numbers never show up using a certain seed. If I recall correctly (as it was two decades ago), the seed must be one that triggers the maximum length sequence of the generator and most seeds do not. If you search for "pseudo random generator logic gates" or something similar you probably find information about it if you are interested. Curiously, I trashed yesterday one of the Springer publications from 2007 that shows up in the results :doh: I am sorry if I sounded too aggressive about the floating point counter. Usually a "while(1)" is used for boundless loops. When I saw it I thought you were using it without knowing. Unfortunately, I already had my share of people "asking" me to fix their programs that do not stop because of loop conditions that are never met (like using integers with double/boolean/string/pointers/etc). Best regards and keep the curiosity high :)
  • 0 Votes
    6 Posts
    21 Views
    S
    When was Microsoft tech writing EVER known for anything but Horrible tech writing? :mad: Old codger
  • When Poor Design Gets Baked Into a File Format

    design question
    11
    0 Votes
    11 Posts
    35 Views
    L
    Empty is not the same as "unknown". If it is unknown, then that is what it should state. Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
  • Griff and 10gb update

    csharp css visual-studio com hosting
    4
    0 Votes
    4 Posts
    13 Views
    OriginalGriffO
    Couple of minutes, was all. (50+Mb Fibre-to-cabinet connection) If you want to include someone, use the at-code system: and at-sign followed by the Username (not necessarily the same as the "Display name", your Display name is "Afzaal Ahmad Zeeshan", but your user name is "afzaal_ahmad_zeeshan"). If you do that, they get an email alert that you are talking to them. You can find the Username on the user homepage, top left corner, just below the DisplayName @afzaal_ahmad_zeeshan Just like that! "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!
  • Incomprehensible C++ error messages

    question c++ help
    19
    0 Votes
    19 Posts
    92 Views
    R
    The SPL compiler on Prime used to do something similar
  • 0 Votes
    3 Posts
    14 Views
    Greg UtasG
    David A. Gray wrote: I just pasted a block of #define directives [sic] from the application header of a C++ program that I am writing... He that lieth down with dogs shall rise up with fleas. --Poor Richard's Almanack Robust Services Core | Software Techniques for Lemmings | Articles
  • Lets' change things up; how about the inept and stupid

    linux help
    18
    0 Votes
    18 Posts
    27 Views
    K
    One major difference between the TCP/IP protocol suite and the OSI protocol suite is that the former asks you to try to make sense of whatever you receive, one way or the other. OSI follows the principle that a protocol error is fatal, you cancel the connection. Disconnect is mandatory; if you continue operation trying to keep it going, then you are not conformant to the standard. Those sloppy, haphazard implementations are kicked out. If you want to exchange data, you better do it in the proper way! Of course it makes it more difficult to be an eager student who has not yet learnt proper behavior; before he goes out in the wide open world he must know what to do. The Internet lenient philosophy is fair enough while you are still playing in the sand pit, but not when you grow up. Programming languages are similar. They should define clearly what you can and cannot do. They should specify clearly all the issues that the compiler is required to detect, those that the generated code / runtime system is required to detect, and those that cannot reasonably be detected neither at compile time nor run time but is nevertheless an error. I know of one language specifications that includes all three, the Z.200 CHILL language. Unfortunately, CHILL never made it as a mainstream language (nobody really tried to make it!) - it was a language design of excellent quality. But I guess most programmers moving from C to CHILL would feel the strict discipline as a straightjacket.
  • .Net core 3.0 breaking changes

    csharp asp-net dotnet com
    3
    0 Votes
    3 Posts
    6 Views
    B
    Quote: And then I also discovered that they switch to their own JSON deserializer This thing "wow, this new JSON serializer is so fast" really annoys me. Of course, it's fast, it lacks features Newtonsoft has. There are lots of other fast serializers with a lack of features i.e. Utf8Json, why not compare with them. It's worth noting that one can use Messagepack to serialize things fast. Quote: I hate open source. I wonder whether this is open source or just sloppiness.
  • purchased code from who knows where

    6
    0 Votes
    6 Posts
    15 Views
    J
    Just because it works does not mean that it is not broken. It is amazing the number of things duck-tape will fix. INTP "Program testing can be used to show the presence of bugs, but never to show their absence." - Edsger Dijkstra "I have never been lost, but I will admit to being confused for several weeks. " - Daniel Boone
  • My very own accidental DoS program

    help visual-studio sysadmin windows-admin sales
    3
    0 Votes
    3 Posts
    12 Views
    J
    I'll admit I did not read all that. But a year ago I ran into a problem at a company I was working for. There was another company that provide I black box, literally. Basically, it ask for some information and our system was too slow to provide it. So, it ask again. The issue was that we provided the information after a couple of request's, but it kept asking over and over again. I wrote a simple application to figure out what was going on. It turned out that the query (question) was ask continuously over a long period of time and all the answer's where apparently ignored. Do to a bad design (in my opinion), we had over a 128 threads (up/down over time) querying the database for the same information that we had already provided to the black-box. It is my one and only experience of having a piece of equipment perpetrating a DOS attack on a system; even if it was not intentional. INTP "Program testing can be used to show the presence of bugs, but never to show their absence." - Edsger Dijkstra "I have never been lost, but I will admit to being confused for several weeks. " - Daniel Boone
  • Bubble Sort, O(N^2) aka Quadratic time

    csharp data-structures learning ruby asp-net
    23
    0 Votes
    23 Posts
    88 Views
    J
    I like the analyses and have studied how to compute the Big-O and Theta. I have also implemented every sorting algorithm I have ever seen (years ago). My only issue has been, how much brains does it require to understand that a loop inside a loop (the bubble) is not efficient. The rest is just proving that you are right. Of course, for school, you have to provide the reason you are right and that is actually part of the fun of learning. But in the real world, they tend to take it for granted that you can see the obvious without actually calculating the Big-O. INTP "Program testing can be used to show the presence of bugs, but never to show their absence." - Edsger Dijkstra "I have never been lost, but I will admit to being confused for several weeks. " - Daniel Boone
  • 0 Votes
    5 Posts
    23 Views
    honey the codewitchH
    I don't have a degree either, and it's one of the reasons I find the work above so valuable. Real programmers use butterflies
  • 0 Votes
    3 Posts
    9 Views
    honey the codewitchH
    Yeah I converted a splay tree from typescript to C# once to learn how it was done, and it was a joy. I didn't end up using the implementation, because it was recursive, but it taught me the concepts. Real programmers use butterflies