Skip to content

Clever Code

Showcase your best code, your most elegant solution, or your most hard fought subtle bug you've found and fixed

This category can be followed from the open social web via the handle clever-code@forum.codeproject.com

361 Topics 3.2k Posts
  • Mix Mode DLL

    c++
    6
    0 Votes
    6 Posts
    2 Views
    D
    :laugh: 5. If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker My Blog - My Photos - ScrewTurn Wiki
  • weird optimization

    database algorithms data-structures performance help
    19
    0 Votes
    19 Posts
    3 Views
    M
    Well done, good catch! "Codegen problem with nested do-while / for loops (/O2)" I just gave my vote of Very-Important. Note-to-self: try to avoid flying with Microsoft powered airplanes.
  • 0 Votes
    8 Posts
    2 Views
    L
    Exactly the same happened to me, when I named my .bat file shutdown.bat :) and was calling shutdown from that file causing an infinite loop
  • WSS to MOSS migration

    help sysadmin java sharepoint question
    2
    0 Votes
    2 Posts
    3 Views
    M
    I would rather get my handy dandy hands on K8 MOSS than working with such desk stuff... _____________________________________ Action without thought is not action Action without emotion is not life
  • 0 Votes
    7 Posts
    5 Views
    C
    Had the same problem and spent a couple of days tracking it down. I should know better ... no non-essential software on the development machine. Maybe in a VPC. As a note it seems to have an adverse affect on Ultramon as well. When I upgraded iTunes it went whacky. With iTunes out things are stable again. I'll pass on iAnything (tunes, pod, phone). Thomas Thomas
  • Flash kills VS debugging (vshost.exe)

    csharp visual-studio com beta-testing html
    6
    0 Votes
    6 Posts
    2 Views
    C
    Always hated Adobe for their products that come with tray and startup applications. Asynchronously daydreaming...
  • Who finds it first... [closed] : [modified]

    com help
    23
    0 Votes
    23 Posts
    4 Views
    N
    dighn wrote: How does stSourcePath.size==0 even compile?! IIRC, VC++ 6.0 would let things like this compile. Programming Blog utf8-cpp
  • char x = 0;

    performance question lounge
    17
    0 Votes
    17 Posts
    4 Views
    S
    :laugh::laugh: Regards, Satips.:rose: Don't walk in front of me, I may not follow; Don't walk behind me, I may not lead; Walk beside me, and just be my friend. - Albert Camus
  • A typo that cost 5 man hours and almost a re-design

    c++ com csharp winforms design
    10
    0 Votes
    10 Posts
    2 Views
    S
    Quite Funny i ahve got the Bug after seeing the code. i think that i got this probelm while i was coding on this a year before. Regards, Satips.:rose: Don't walk in front of me, I may not follow; Don't walk behind me, I may not lead; Walk beside me, and just be my friend. - Albert Camus
  • What's inside a package?

    help csharp visual-studio sysadmin hardware
    6
    0 Votes
    6 Posts
    2 Views
    S
    mav.northwind wrote: Black holes are the places where God divided by 0... Nice One. Regards, Satips.:rose: Don't walk in front of me, I may not follow; Don't walk behind me, I may not lead; Walk beside me, and just be my friend. - Albert Camus
  • 0 Votes
    5 Posts
    3 Views
    N
    Time to use c# P Think of the environment; please don't print this message unless you really need to.
  • Story of a single threaded server

    help csharp asp-net database com
    10
    0 Votes
    10 Posts
    4 Views
    X
    Yes, interprocess communication does have some overhead. But in this case the overhead is so insignificant in the overall picture that users do not notice any difference. The admins cannot see any difference in terms of CPU usage, etc. My .NET Business Application Framework My Home Page
  • Return of the double postback bug

    csharp help html asp-net sysadmin
    13
    0 Votes
    13 Posts
    3 Views
    L
    Hmmm, I like the border, but I still prefer my 'rendering' :p [StructLayoutAttribute(LayoutKind.Sequential)] public struct SystemTime { public short year; public short month; public short dayOfWeek; public short day; public short hour; public short minute; public short second; public short milliseconds; } ** xacc.ide-0.2.0.57 - now with C# 2.0 parser and seamless VS2005 solution support! **
  • Cutesy string code I wrote today

    csharp com help
    15
    0 Votes
    15 Posts
    7 Views
    P
    Anna-Jayne Metcalfe wrote: *** Insufficent Caffeine Error *** Not really - it was intentional, it relies on a subtle difference between value equality (tested with ==) and reference equality ('enforced' with =) We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP My first real C# project | Linkify!|FoldWithUs! | sighist
  • Super Subtle

    help c++ data-structures regex question
    10
    0 Votes
    10 Posts
    3 Views
    A
    Spotted it right away. I must have spent way too much time stepping through message map code (those sort of return value mismatches could happen all too easily with VC6) before I jumped onto the WTL bandwagon. :doh: Anna :rose: Linting the day away :cool: Anna's Place | Tears and Laughter "If mushy peas are the food of the devil, the stotty cake is the frisbee of God"
  • dynamic_cast changed behavior in VS5

    help csharp c++ visual-studio oop
    7
    0 Votes
    7 Posts
    3 Views
    A
    Correct. Ami
  • What is the size of my log file?

    question
    12
    0 Votes
    12 Posts
    2 Views
    S
    One year ago i've discovered the following diamond: Variable names are mine because original was meaningless. void superPupelMegaRobustMethod() { Thread watchdog = new WatchdogThread().start(); ... watchdog.stop(); } .. void run() { // watchdog loop boolean timeElapsed = false; while(true) { if (timeElapsed) () { new Thread() { .... superPupelMegaRobustMethod(); ..... }.start(); } Thread.sleep(1000); timeElapsed = true; } }
  • weird call stack problem w/VC 6... [modified]

    c++ com data-structures tools help
    6
    0 Votes
    6 Posts
    3 Views
    J
    Chris Losinger wrote: Jesse Evans wrote: Where would you have posted this? in the Visual C++ forum. Done. Thanks. 'til next we type... HAVE FUN!! -- Jesse
  • Strange Embedded Problem

    help hardware design performance
    6
    0 Votes
    6 Posts
    6 Views
    A
    I don't know dude... I'd bet your solution works, but it sounds like you're just acheiving the same thing as a larger deadband using a timer instead of your sensor. Your relay chatter sounds like a classical deadband problem, where you're using a binary-valued actuator to control a continuous-valued process. There's a direct tradeoff between tolerable following error in your process variable and the duty-cycle of your actuator. But you've been doing this a long time, so I'm probably not telling you anything you don't already know.
  • Digits to numeric value?

    testing beta-testing question
    8
    0 Votes
    8 Posts
    3 Views
    D
    Thanks! :) I've also tried other unicode numerics, as circled numbers, super- and subscript numbers, but isdigit(...) returned false for them. It seems that the Nd (Numeric-decimal) type from the UCD is checked.