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
  • Fun with double

    csharp com
    12
    0 Votes
    12 Posts
    0 Views
    realJSOPR
    :) ".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
  • dotnet core web api : generate sub-webs for users

    csharp html asp-net com sysadmin
    17
    0 Votes
    17 Posts
    0 Views
    raddevusR
    Yeah since I implemented httpS I changed the code a lot but didn't repost because it was getting so long. The sun page is httpS also but the retrieval of the Dilbert comic is via http so browsers do complain for that reason. Can't be helped though because Dilbert site has no httpS alternative. FYI that URL is built up using location.protocol and other JavaScript to build it properly now whether user in http or https.
  • C# Recipe for uncatchable exception

    csharp debugging help visual-studio com
    32
    0 Votes
    32 Posts
    0 Views
    P
    You can debug exceptions when they are thrown. This means you stop even if there's a catch block that's going to "eat" the exception. Or, you can debug only exceptions that are uncaught or are rethrown. In this case, if there's a catch clause, you will not see the exception until it is rethrown (if it ever is rethrown). Usually on the second case, an exception that kills the application will not give you a chance to debug it. On the first case, you usually have that option (and for an exception throwing another exception, throwing another exception you would be bothered thousand of times before the app is killed).
  • Why use the correct exception type?

    winforms graphics question
    29
    0 Votes
    29 Posts
    1 Views
    S
    ...or even worse: GeneralException - exception that can be anything from anywhere.. sorry, no stack. In order to understand stack overflow, you must first understand stack overflow.
  • 0 Votes
    49 Posts
    3 Views
    D
    Sander Rossel wrote: How is that any different from calling Console.WriteLine("test"); etc.? It's just more code to call Console.WriteLine and you aren't chaining anything or using the Tee output :confused: Using a Hello World example would be so much more useful! CQ de W5ALT Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
  • Well - its not private any more...

    6
    0 Votes
    6 Posts
    0 Views
    B
    :doh: Someone needs a whack with a clue bat. What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???
  • What use are foreign keys anyway?

    database sql-server sysadmin question
    60
    0 Votes
    60 Posts
    6 Views
    J
    Ah, the good, old high volume one-way discussion.
  • 0 Votes
    10 Posts
    0 Views
    S
    indian143 wrote: I agree with you partially but if the signals of Phone can go and come from Headset using Bluetooth You do get what Bluetooth is right? Its a simple (well relatively), radio transmission and receive standard. Common sense is admitting there is cause and effect and that you can exert some control over what you understand.
  • Customise my static without a ctor

    c++ performance question
    5
    0 Votes
    5 Posts
    2 Views
    J
    David O'Neil wrote: Why does the struct have to have a static copy of itself in it? Doubt it but might be the pattern used by some of .NET for defaults. Think string.Empty or Comparer.Default[^].
  • Daylight saving bug? Or working as designed?

    help question
    10
    0 Votes
    10 Posts
    0 Views
    P
    I generally work 07:00 to 15:30 . No need to change your clock or insist that other do.
  • Code of the Day!!

    7
    0 Votes
    7 Posts
    0 Views
    OriginalGriffO
    He'd have got away with it too, if it hadn't been for those meddling script kiddies. Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
  • Hello IT, I need some technical information...

    question help sysadmin business
    26
    0 Votes
    26 Posts
    4 Views
    C
    :thumbsup: I support a customer located out in LA. I was trying to vpn into their network, nothing was working. Tried calling the office, no answer (lines dead), so I called my contact on his cell. Seems the mid-size firm they used for telecommunications (phones, internet, etc) was having a technical issue. In one day: - hi, my network is down. them: "yes, we're aware of the situation, should be fixed shortly." - hi, now my phones don't work either. them: "yes, we've had a hardware failure, we're working it." - hello? calling them now gets a this number has been disconnected message. Apparently, this mid-size firm had invested in a fairly large network switch that had worked fine for several years. They had dozens of companies contracted to provide network, voip, etc. Over the weekend, the switch crashed hard, and they learned no one had backed up anything. At all... The owners of the company immediately declared bankruptcy, cashed out, closed the doors and left. Charlie Gilley <italic>Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
  • Exception handling found in ...

    help
    7
    0 Votes
    7 Posts
    1 Views
    V
    This is a design pattern : Encapsulation by Deception ! ;P Zen and the art of software maintenance : rm -rf * Maths is like love : a simple idea but it can get complicated.
  • 0 Votes
    6 Posts
    0 Views
    H
    no .. nothing like that ..
  • How do I interact with the table?

    question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    3 Posts
    0 Views
    U
    I agree that w3school tutorials are not always clear and also it would be more helpful to have a possibility to try to solve a problem on each rule instead of just watching how the code act. Cheers, paper writer, programmer
  • How to add a single item to an array

    python com data-structures tutorial code-review
    31
    0 Votes
    31 Posts
    2 Views
    R
    You are correct, Smalltalk images do work similarly, but there is a risk implied, as discussed by Gilad Bracha in Room 101... [Room 101: An Image Problem](https://gbracha.blogspot.co.uk/2009/10/image-problem.html) "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
  • Does NULL <> 'string'?

    database help question
    55
    0 Votes
    55 Posts
    6 Views
    A
    It's either col equals null meaning a field with no value or you've got an epmty string you can use Select * From Table Where (col is null or col = '') or IsNull method to find epty strngs and null values _______________________________________________________________________________________________ Alec programming[^] expert
  • 0 Votes
    15 Posts
    0 Views
    P
    raddevus wrote: I needed to know that when I went to determine if the queue already had the item, if it would return faster when the item was found at the top (next item out) versus found at the bottom (last out position). I assumed, but wasn't sure. This code gives a good definitive answer You forgot the important qualifier through -- this code gives a good definitive answer for build XXX of the library. In the next build, the implementer may find a bug with the way they're doing things and have to change it, altering the performance. If you're writing code that depends that much on the performance of some class, you need to write the class yourself. I live in Oregon, and I'm an engineer.
  • I failed to predict this one...new csv format

    help hardware security learning
    20
    0 Votes
    20 Posts
    0 Views
    K
    John Simmons / outlaw programmer wrote: Seems to me your code is working. Getting one field where multiple fields are expected was a problem. :confused: The original logic was just to remove any commas found between double-quotes. Doing this with the single field (of comma delimited values) just pushed everything together and made a mess. A little added logic to detect if the entire line is wrapped fixed everything. :) Easy. The point was that sometimes you just have to take what the client gives you and make it work...that and how lazy (or stupid) the client's dev was for not understanding what the problem was. :) "Go forth into the source" - Neal Morse