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
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • I just made a secret GOTO

    com
    5
    0 Votes
    5 Posts
    0 Views
    P
    That's a bit mroe complex than this simplified example of course (surprisingly, I don't have variales named "thingie" in there) - depending on the forma,t it's read only access or no access at all, indeed. Since the conversion runs in a separate process, I'm in the middle of a transaction, and I have to be careful to throw more milliseconds into that piece of code, tat "close, convert and retry" seems to be the best approach. Alternatively, I thought of an inner function that returns either the newly initialized session, or information about how to upgrade, but that code doesn#t look much better either. ORDER BY what user wants
  • Fsking ASP.NET!

    csharp help asp-net visual-studio com
    3
    0 Votes
    3 Posts
    0 Views
    S
    Bernhard Hiller wrote: But why then is it so absolutely necessary to insist in a particular version, culture, and even PublicKeyToken? because the assembly is signed? http://msdn.microsoft.com/en-us/library/wd40t7ad.aspx[^] the runtime is just trying to ensure you load what you expect. I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p) "Given the chance I'd rather work smart than work hard." - PHS241 "'Sophisticated platform' typically means 'I have no idea how it works.'"
  • When things to more than you think

    javascript help announcement c++ com
    2
    0 Votes
    2 Posts
    3 Views
    S
    Interesting!! :) My programming get away... The Blog... DirectX for WinRT/C# since 2013! Taking over the world since 1371!
  • Undoubtedly this is my own ignorance in glorious action but...

    csharp c++ wpf
    5
    0 Votes
    5 Posts
    1 Views
    A
    As a matter of fact it did. I had to explicitly implement the OnMnemonic function to trap the accelerator and send it along as the character that it was supposed to be. Pretty clunky. I'm surprised that the interoperability is not better but I get that is what happens when HWND based dialogs are mixed with XAML based dialogs.
  • Face, meet palm...

    database com graphics help tutorial
    2
    0 Votes
    2 Posts
    0 Views
    L
    Dave Kreskowiak wrote: The targetPictureBox just showed a nice big red X. For 2 hours I couldn't figure out why this code worked yesterday but didn't work today! I was hoping the reason was going to be "the picture was a big red X". Oh well. (Then again, if that was the case, it wouldn't quite belong here I guess.)
  • Message Automatically Removed

    13
    0 Votes
    13 Posts
    0 Views
    pkfoxP
    As CM says "Leave the egos at the door" When the going gets weird the weird turn pro - Hunter S Thompson RIP
  • 0 Votes
    13 Posts
    0 Views
    M
    Agreed... My Reading-o-Meter Previous -> Read "CLR via C#" by Jeffrey Richter. Current -> Exploring WCF thru Apress' "Pro WCF" by Chris Peiris and Dennis Mulder. Next -> Need to read "The Art of Computer Programming" by Donald E. Knuth. My blog - My recent article
  • Misaligned elephants

    c++ question
    26
    0 Votes
    26 Posts
    0 Views
    M
    Is this on a 16-bit, 32-bit or 64 bit environment? If you are using Visual Studio, check the preprocessor directives in all the projects. Also check the code generation struct member alignment. I've had this before: all projects just used default settings except some were VS6, some were VS2003 and some were VS2005. I just got random unexplanable crashes, so, like you, I decided to look at the sizeof things and they were very different. Nowadays I avoid such things by not having inline functions. It may run slower but at least you don't spend weeks trying to figure out stuff like this.
  • Epic Visual Studios "No Code"

    csharp html visual-studio winforms com
    25
    0 Votes
    25 Posts
    6 Views
    C
    "Has anyone else come across the bug in Visual Studios 2012 where it runs code that isn't there?" Ok, with just that statement alone, this had to be said: I assume you're not referring to the MS bug in general where others tend to inject hacks into your system and run code that neither you, nor any other legitimate vendor, wrote. :laugh:
  • This one is for the Java experts

    java database question
    10
    0 Votes
    10 Posts
    0 Views
    S
    Nagy Vilmos wrote: I wanted to mention that, the point of an AtomicBoolean is that it doesn't need synchronisation because it's, well, atomic. The synchronization isn't necessarily for the setting/getting, but for the wait()/notifyAll(). They are using the variable both as a flag and a synchronization object, though it is a little unusual to wait with a relatively short timeout and then loop if you are going to signal the monitor as well. I personally would have used CountDownLatch or CyclicBarrier.
  • Expletive Deleted

    question
    37
    0 Votes
    37 Posts
    47 Views
    A
    Me too! -AspDotNetDev Thou mewling ill-breeding pignut!
  • Saw something strange...

    20
    0 Votes
    20 Posts
    2 Views
    B
    I have seen one where that goes 6 levels deep. X| brisingr_aerowing@Gryphon-PC $ rake in_the_dough Raking in the dough brisingr_aerowing@Gryphon-PC $ make lots_of_money Making lots_of_money
  • Tasks and stack traces...

    database com design data-structures debugging
    5
    0 Votes
    5 Posts
    0 Views
    D
    Yeah, right! Too bad I need to fix all the problems with the data, otherwise I would ignore 'em and log 'em. The script the app runs already generates about 120MB worth of log data just showing what it sees in the data and what it does to it. A guide to posting questions on CodeProject[^] Dave Kreskowiak
  • Last assignment of the day done!

    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • With all these touch screen devices...

    2
    0 Votes
    2 Posts
    0 Views
    M
    Optional responses: Siri: :omg: While the sentiment is appreciated, I don't have lips to likewise respond in kind. Besides, your breathe reaks. Siri: :wtf: OK! OK!! I'll show you a list of local stores that have breath mints, already!! Siri: X|
  • What this 'null' check doing here...

    csharp dotnet wcf
    59
    0 Votes
    59 Posts
    16 Views
    M
    Not a prob, I was in fact, just starting the day, and clearly had too little coffee in my system to type, much less proof. We had just been playing around with javascript to see what happens when you don't declare a variable versus when you declare it and don't assign a value - how it affects checking for undefined, not-undefined, null, etc. And, Yes, I typically write a lot more in T-SQL, but I also use VB, VB.NET, et al in my daily work - hence my disclaimer about not writing a lot of C#. I'm always careful when checking for nulls, so when I see comparison operator my hair stands up a bit. Initially, to me, the code looked as though someone had somehow had a bad experience populating the list from using the "new List();" call, and so put in a safety-catch (if you will) to try again if necessary. Or, perhaps, the second part was already there, and someone later came along and added the first line... I'm sure they though it was right at the time. Who knows! Thanks for the note KP. Cheers and happy coding, Mark
  • Something is not as I expected

    csharp visual-studio help
    6
    0 Votes
    6 Posts
    0 Views
    D
    Sh** I remember that ',' I school days, first curse in all year using Visual C++... beautiful monitors of 14" at 1024*768... We were calculating taxes for students based on Age and grade... There were some students that were paying always 0.00 ... we debug (we were students, still stupids at debuging)... noting show wrong... After like 5 hours... I went to play Ping Ping.. I returned, found my 2 teammates debugging.. then I notices and ask: Guys is that payment * 0.05 or payment * 0,05... I learned that day that VC++ when 0,05 does Payment * 0 * 05.. then everything become 0!!!!
  • Epic

    com
    6
    0 Votes
    6 Posts
    0 Views
    I
    Richard Deeming wrote: The Soapbox seems to be mainly for terrible jokes and insane rants. Just for those lacking a sense of humour. The most rants are very funny. :cool: Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.