Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

mdblack98

@mdblack98
About
Posts
18
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • This morning on the east coast of the US, and it's a Microsoft rant...
    M mdblack98

    Just went through this on a new car buy from a Toyota dealer. The dealer had a charge on the invoice for a "security" system. Found out it was being installed when delivered at port due to vehicle thefts and their insurance requires it. They most certainly are NOT tracking you. We just told them to NOT install it as the one they use is a horrible system (i.e. cheap).

    The Lounge hosting cloud help question

  • For want of a nail
    M mdblack98

    Compress the disk. Depending on the file types stored might create a lot of empty space.

    The Lounge adobe career

  • What's y'all's favorite way of dealing with floating point precision?
    M mdblack98

    Maybe you want a currency library? You can control the rounding too with this. currency.js[^]

    The Lounge question javascript career

  • Sometimes It Pays To Cover All Bases
    M mdblack98

    I'm reminded of the work we did for SEPTA (South Eastern Pennsylvania Transit Authority). We did the computer aided dispatch system which had to communicate to the trains via packet radio. When they showed us the protocol they wanted to use I just about died. No error check, no ACK/NAK. Asked them how we were supposed to test the protocol they said they were going to use a VT100 terminal to type in the messages. I proposed a better protocol and told them we would design an emulator so we could emulate the entire train system. Then there was one big bugaboo....they had to be able to connect dispatch to all the train's audio systems for emergency announcements and such. I told them they needed a broadcast message and they said "no". I also explained to them that with the ACK/NAK protocol and single train connections it would take up to 30 minutes to get all the trains connected and another 30 minutes to disconnect them (all during which the live dispatch radio system is connected to train speakers). I put this in writing to them. They said "we aren't going to fix it". Around 3 years after we delivered the system they called us and blamed us for the 30 minute delay. I had to haul out the letters between us to show them we warned them.

    The Lounge help css design question announcement

  • A gentle puzzle I was just asked.
    M mdblack98

    Since this is a coding site here are the possibilities for a 32-bit int.

    #include #include int main()
    {
    int pos = 1;
    int neg = INT_MIN;
    printf("pos=%d neg=%d\n", pos,neg);
    printf("pos+neg=%d\n", pos+neg);
    printf("pos-neg=%d\n", pos-neg);
    printf("neg+pos=%d\n", neg+pos); // yes I know it's commutative but here for completeness
    printf("neg-pos=%d\n", neg-pos);
    return 0;
    }

    pos=1 neg=-2147483648
    pos+neg=-2147483647
    pos-neg=-2147483647 // Hmmm...this seems wrong -- subtracting negative SHOULD add it.
    neg+pos=-2147483647
    neg-pos=2147483647

    The Lounge question com lounge

  • win11 dismay: can't have vertical taskbar?!
    M mdblack98

    See if this helps... How to move Taskbar to top or side on Windows 11 - Pureinfotech[^]

    The Lounge question css com data-structures tutorial

  • ( C/C++ historical question) was there a point in time where adding a return at the end of a void function was required ?
    M mdblack98

    In the C89 standard draft (the actual standard you have to buy). Shows that return has never been required....minimalist approach... https://port70.net/~nsz/c/c89/c89-draft.html#3.2.2.2

    3.6.6.4 The return statement
    ...
    Reaching the } that terminates a function is equivalent to executing a return statement without an expression.

    The Lounge question c++ devops

  • Four fours
    M mdblack98

    I didn't program the entire solution...left that for others to do. One could make the necessary change to solve the X/Y problem of trying to get 5 5's or 3 5's or such an arbitrary combination. I was just demonstrating the "let's use 4's" to solve the values. That's why I said there needed to be more work to do the special cases of "only 4" or "only X" values. You eight need to increase or decrease the # of terms so is a bit more challenging.

    The Lounge html tutorial learning

  • Four fours
    M mdblack98

    It works for four fours. But this is "Code Project" and writing a routine to do just that one example is no fun.

    The Lounge html tutorial learning

  • Four fours
    M mdblack98

    Since this is "codeproject" my train trip was short. Took about 15 minutes to get the 1st order solution in C. Yes...I know it's simplistic....but a good exercise nonetheless. Obviously could be improved for all the special cases....could obviously compute squares, square roots, factorials, etc and start from the largest of those to reduce the value. I'll leave that exercise for others. In this code just change the modulus value to whatever you want and you'll get all the 1st order solutions. #include int modulus = 5; void do4(int n) { int mod = n % modulus; int i, j; printf("%d=", n); for (i = modulus; i <= n; i += modulus) { if (i > modulus) { printf("+"); } printf("%d", modulus); } for (j = 0; j < mod; ++j) { if (i != modulus) { printf("+"); } printf("(%d/%d)", modulus, modulus); } printf("\n"); } void main(void) { int i; for (i = 1; i <= 100; ++i) { do4(i); } }

    The Lounge html tutorial learning

  • word wrapping
    M mdblack98

    Look at the CSS options which cover a lot https://tippingpoint.dev/pure-css-truncate-text Seem like simple wrap would be good for an ereader just splitting the word at the last char on the line...no ellipses or such needed.

    The Lounge html css question

  • 25 years of programming reduced to a question.
    M mdblack98

    I was asked that question once....I told them "I've never done that particular function before so I would search for a solution before reinventing the wheel". I got the job.

    The Lounge question lounge graphics game-dev hosting

  • To the guy asking if we'd using COVID-19 tracking apps...
    M mdblack98

    Yeah...I see holes.... Let's start with #1. The "only on your device" is something you won't know. They also said you can recreate your GUID so that means the police can recreate your GUID. Then...when you get diagnosed as a COVD carrier and you smoosh the button...who's to say your phone won't scream at every other phone in the office...or the 120 kids are in your class...? Let's shut down businesses!! When this "6 foot" rule is being incorrectly applied as a cure all. The 6 foot rule came from an study on airplanes of "how close is too close" and they found that less than 6 feet for more than 10 minutes was too close. They didn't come up with any graphs that showed that 7 feet for 12 minutes is safe. They are finally starting to figure out now that all you have to do is walk through an area where an infected person has breathed and you can get it. No sneezing or coughing needed. It sounds like COVD has a very high replication rate so even a small viral load can overwhelm your antibody production.

    The Lounge csharp javascript cloud linq com

  • true-false or false-true
    M mdblack98

    I would prefer something that rings true and has an explanation when it fails. Assert.IsTrue(TokenIsValid(token), "Invalid Token: "+ TokenCheck(token)); TokenCheck would say "Empty", "Wrong Length...must be 4 bytes" (or whatever), "Exceeds limits of 0-100"...etc.... Mike

    The Lounge com question

  • Dumb Old Program Question
    M mdblack98

    Found this that may be fairly easy to figure out what it's trying to create. There are other solutions too for tracing file access. It's may be failing the file creation as it's using a on-existent path and hopefully this software sees the failure. https://www.visualclick.com/content/cptrax-for-windows-active-directory.htm Or process monitor should do it too http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx You can run it directly from the site if you want http://live.sysinternals.com/Procmon.exe Mike

    The Lounge question com business sales workspace

  • Redundancy Peaking
    M mdblack98

    Ummm...if you dissassemble something isn't there a program to disassemble? Ergo a test program? I was simply providing an example that proves that this is not redundant code at all. The disassembly does confirm it though so thanks for that observation.

    The Weird and The Wonderful question

  • Redundancy Peaking
    M mdblack98

    And I ran this test once with "if mybool" and once with "if mybool = True". No difference in speed. 1st one showed 33 seconds, 2nd one showed 32 seconds.

    Module Module1

    Sub Main()
        Dim mytime As Date
        Dim mybool As Boolean
        Dim mydiff As TimeSpan
        Dim j As Double
        mytime = TimeOfDay()
        While mytime = TimeOfDay()
        End While
        mybool = True
        j = 0
        For i = 1 To 100000
            For j = 1 To 100000
                If mybool = True Then
                    j = j + 1
                End If
            Next
        Next
        mydiff = TimeOfDay() - mytime
        Console.WriteLine(mydiff)
        Console.ReadKey()
    End Sub
    

    End Module

    The Weird and The Wonderful question

  • Redundancy Peaking
    M mdblack98

    It's not redundant at all...it's explicit. And there's also a difference between "= True" and not leaving it empty. Any non-zero value is "True" but "True" is not any non-zero value. There's no extra code generated as this is what is actually done when you leave off the "= True" part. Given there's no difference in the generated code I fail to see your problem. Personally, I prefer explicit coding as you're much less likely to make a mistake. How's this for redundant? if (a==1) { cout << "a=1" << endl; } Braces are completely redundant...but you'll never bite yourself by forgetting to put them in when you have to expand the clause in the future.

    The Weird and The Wonderful question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups