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
D

David MacDermot

@David MacDermot
About
Posts
15
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Your favorite slowcooker recipe?
    D David MacDermot

    This meal is a family favorite, never gets old, and is easy and quick. :thumbsup:

    Italian Veggie & Pasta Soup

    1 lb ground beef
    3 carrots - chopped very small
    4 stalks Celery - chopped
    2 cans diced tomatoes - do not drain (for zest one could be tomatoes with green chilies)
    2 cans red kidney beans - could drain them but I don't
    3 cans beef broth
    1 24 oz can traditional spaghetti sauce
    1 8 oz pack of macaroni - elbow or, better yet, shells

    Brown and drain ground beef then add to pot.
    Add carrots and Celery to pot
    Empty all cans into pot
    Stir, cover and cook on low for 6-8 hrs or high for 4 hrs.

    Before serving cook up macaroni in separate pot.

    To serve put large spoon full of macaroni in bowl with a ladle full of soup.

    The Lounge question

  • News sources
    D David MacDermot

    When I was in college I got my news and opinion from a number of sources. Shortwave - BBC world service, Radio Moscow, & Radio Havana Cuba. On my job as a delivery driver - Rush Limbaugh - a well known conservative talk radio host. At home on weekends our National Public Radio Weekend edition. On Sunday I bought the paper on my way home from church and would read it front to back all afternoon. That was in the early 90's. Some years later I lived and worked in Ukraine. For the first time since I was a teenager I had a working television. The American NBC Nightly News with Tom Brokaw was broadcast in the morning in English without voice over. I only watched a few episodes because I was usually on the job when it was on. I found this news show to be very slick and somewhat entertaining but also lacking in news. They would wrap up the broadcast with a "look around the world segment" typically there would be a cool graphic globe spinning and the viewer would zoom in as the globe slowed and finally settled on some place in middle America. Cut to reporter in Centerville Nebraska who would do a piece on farmer Joe getting recognized by Guinness for growing the largest ever pumpkin squash. As I became more proficient in Russian I would watch the nightly news on ORT (first channel). The news reader would talk extensively about Russian participation in this or that world economic forum. Or some trade or military deal with these African countries. I got the impression that the average Russian got a clearer view of world affairs than the average American, a decidedly Russian biased view of course. Back in the states in the late 90's I learned that in order to better understand what was going on at home and abroad one had to bypass the regular news and go to the sources. Industry trade publications and financial publications. I could get an idea not only of what was going on in the world but often the why.

    The Lounge question announcement

  • iScreen = iScreen < 8 ? iScream : ...
    D David MacDermot

    BobJanova wrote:

    Yes, or at least bind the items to an object, of which this magic number was a property.

    That is exactly what I did when I had the pleasure of encountering this code while creating the next generation of the application. I employed a java enum style class in C#.

    public class Display
    {
    public static readonly Display OpeningSplashdisplay =
    new Display(1, "Opening Splash display");
    public static readonly Display StartUpDateConfig =
    new Display(2, "start up date config");

    //
    // Skip a lot of Displays
    //
    
    /// /// Enumerate the Display objects.
    /// 
    public static IEnumerable Values
    {
        get
        {
            object temp = null;
            FieldInfo\[\] fields = typeof(Display).GetFields(); // Obtain all fields
            foreach (FieldInfo field in fields)
            {
                temp = field.GetValue(null);
                if (temp is Display)
                    yield return (Display)temp;
            }
        }
    }
    
    private readonly byte value;
    private readonly string name;
    
    /// /// Enum constructor.
    /// 
    /// The numeric value of this object.
    /// The string representation of this object.
    Display(byte value, string name)
    {
        this.value = value;
        this.name = name;
    }
    
    /// /// Get the numeric value of this object.
    /// 
    /// The value as byte.
    public byte ToByte() { return value; }
    
    /// /// Get the string representation of this object.
    /// 
    /// A string.
    public override string ToString() { return name; }
    
    /// /// Convert byte representation to Language object.
    /// 
    /// A byte.
    /// A Display enumerated object.
    public static Display ParseByte(byte value)
    {
        foreach (Display d in Display.Values)
        {
            if (d.ToByte() == value)
                return d;
        }
    
        // If we reach here return default
        return Display.OpeningSplashdisplay;
    }
    

    }

    Here I load the combobox from the data structure.

    cmbDisplay.Items.AddRange(new List(Display.Values).To

    The Weird and The Wonderful question

  • What's the f()?!
    D David MacDermot

    Here's a little gem I came across a while back.

    private bool f(params object[] args) { return 0 != (int)Convert.ToUInt32(args[args.Length - 1]); }

    It's employed all over the code module. Here's one place:

    byte[][] outBuf = new byte[2][];
    outBuf[0] = new byte[256];
    outBuf[1] = new byte[256];

    //
    // Skip some stuff
    //

    for (int i = 0, j = 0; j < outBuf[i].Length || f(j = 0, ++i < 2); j++)
    outBuf[i][j] = 0x20; //outBuf initialization

    It would seem that the coder was disapointed that C# wouldn't allow abuse of the comma operator. So he substituted an argument list! Here's another place where it's used.

    public bool Visible
    {
    get { return f(_RawData[1] & VISIBLE); }
    set
    {
    if(f(_RawData[1] & VISIBLE) != value )
    _RawData[1] ^= VISIBLE;
    }
    }

    Well, that explains the name. Is this clever or a horror?

    The Weird and The Wonderful csharp ruby question

  • Absolutly Stupid Recruiter
    D David MacDermot

    I once got a call from some recruiter kid. From the background noise it sounded like a call center. Him: "Mr. MacDermot do you have any experience in SQL Server?" Me: "Yeh my software performs transactions with a company database." Him: "Well Have you maintaned SQL Server databases?" Me: "No, but I have written several back-ends for production test software using the SQLITE ADO .NET provider." Him: "Ok just a minute." Recruiter kid thinks he put me on hold but he didn't. Over the phone: "Hey we don't need a SQLITE developer do we?...Sequel Lightweight? No we don't need one of those..." Laughter ensues among several people. "Hey I'll bet you -- yack yack yack..." More laughter at my expense and so on for a minute or two until someone realized that the phone was still off hook. Suddenly the on hold music issues from the phone. Shortly after this the kid gets back on the line trying to sound professional and says "I'm sorry Mr. MacDermot our client is looking for a slightly different skill set."

    The Lounge csharp career visual-studio wpf help

  • Absolutly Stupid Recruiter
    D David MacDermot

    Yep, I'm a Fallbrooker but I work in Vista.

    The Lounge csharp career visual-studio wpf help

  • Absolutly Stupid Recruiter
    D David MacDermot

    Oceanside to Sorrento valley is hardly a painful commute. There's even a train that goes there. It sounds like the recruiter doesn't know the area.

    The Lounge csharp career visual-studio wpf help

  • iScreen = iScreen < 8 ? iScream : ...
    D David MacDermot

    The fellow who wrote this (shall remain nameless :) ) several years ago was enamored of the ternary operator (hmm... Lispy). It seemed to him rather clever at the time; that was, until he encountered it again during maintenance. The variable name he chose turned out to be somewhat prophetic in a phonetic sort of way.

            byte\[\] arySend = FetchCommand(cmd.CHANGE\_THE\_ACTIVE\_DISPLAY);
    
            int iScreen = this.cboDisplayName.SelectedIndex;
    
            iScreen = iScreen < 8 ? iScreen + 1 :
             (7 < iScreen && iScreen < 10 ? iScreen + 4 :
              (10 == iScreen ? iScreen + 5 :
               (11 == iScreen ? iScreen + 10 :
                (11 < iScreen && iScreen < 16 ? iScreen + 12 :
                 (15 < iScreen && iScreen < 20 ? iScreen + 24 :
                  (19 < iScreen && iScreen < 22 ? iScreen + 45 :
                   (22 == iScreen ? iScreen + 53 :
                    (23 == iScreen ? iScreen + 57 :
                     (23 < iScreen && iScreen < 26 ? iScreen + 65 :
                      (25 < iScreen && iScreen < 28 ? iScreen + 72 :
                       (27 < iScreen && iScreen < 30 ? iScreen + 152 :
                        (30 == iScreen ? iScreen + 160 :
                         (30 < iScreen && iScreen < 33 ? iScreen + 169 :
                          (33 == iScreen ? iScreen + 170 :
                           (34 == iScreen ? iScreen + 171 :
                            (35 == iScreen ? iScreen + 175 :
                             (35 < iScreen && iScreen < 41 ? iScreen + 176 :
                              (41 == iScreen ? iScreen + 203 :
                               (42 == iScreen ? iScreen + 208 :
                                iScreen = iScreen + 212 ))))))))))))))))))); // 43 == iScreen
    
            arySend\[2\] = Convert.ToByte(iScreen);
            arySend\[3\] = 0x01; // Refresh screen
    
    The Weird and The Wonderful question

  • Take your kids to work day [modified]
    D David MacDermot

    I brought two of mine on seperate days a while back. I planned a few work related and non work related activities for them in advance and both boys really enjoyed it. The day I brought the younger boy, I set him up in an empty workspace nearby with his oragami book, scrap paper, and scisors. He made all sorts of figures which he gave out to everyone in the office. Next, lunch out at the nearest strip mall followed by a visit to an free exhibit in the business park. That afternoon I had him help me set up and verify a test station which we shipped to a contractor before going home. For the older boy, I set up a junk workstation with VS Express and pointed him to a CodeProject article on how to write your first game. With the exception of lunch and the free exhibit, I hardly knew he was there most of the time.

    The Lounge question announcement

  • how could I print or save datagrid view records?
    D David MacDermot

    Try Another DataGridView Printer[^]

    C# css question

  • Religion... Why?
    D David MacDermot

    Thanks :-D

    The Back Room question css com lounge

  • Religion... Why?
    D David MacDermot

    I'm afraid I don't see a contradiction between the accounts of Ch1 and Ch2. The writing style is not unlike that used in many of the articles here on Code Project. You have in Ch1 an overview of the big picture and then in Ch2 the focus is shifted to details that the writer desires to highlight. Since the focus shifts to the particulars of Adam's creation it stands to reason that there is a principle in that account that the reader should understand, something of significance. Someone might argue that the following verse

    GE2:19

    And out of the ground the LORD God formed every beast of the field, and every fowl of the air; and brought [them] unto Adam to see what he would call them: and whatsoever Adam called every living creature, that [was] the name thereof.

    simply emphasizes the creative work of God and that the animals were made of the same physical substance that Adam was made out of. What I find interesting about this particular passage is that God involves man in the process of naming or categorizing these animals. This kind of reminds me of the science field trips that we used to take as kids in order to learn about our environment and the behavior of various different birds and animals. I would hardly think that Adam was bored, what's to say that he wasn't fascinated with biology and what-not and certainly too busy to be interrupted by the fairer sex at that particular time :-) However If God wanted Adam to really appreciate his mate he very well might have arranged things this way so that Adam could learn to desire a companion for himself that was in his likeness. I can imagine Adam waking up after the operation. "Hey what just happened to me... I feel..." Adam pauses and scratches his head "No... I don't feel! What happened to all my feelings!?" So Adam becomes 2 people, he retained his reason and she got his feelings :-) Concerning the account of Cain and Able, there is nothing in the text to suggest that there were not other people around by that time. The writer focuses attention on the two because the murder was significant. Cain would have married a genetically close relative when he took a wife - something prohibitted much later in biblical history. This is a notion that offends the sensabilities of modern folks, and for good reason. We know that such unions today tend to produce genetic defects in offspring, defects that in some cases cause a great deal of suffering. I recon that the original gene

    The Back Room question css com lounge

  • Evidence!
    D David MacDermot

    It is interesting that the first clip tends to support the notion that each of us creates his own reality via observation. That would equal chaos. Surely my wife's perception of me does not measure up to my own perception of my self and the disconnect could be disasterous to my health and well being if nothing else! It gives me no little comfort to substitute God in the role of observer. He can keep track of all of the details, run the universe, observe each molicule, and give us life. Of course, if I am not the one running the universe I guess I might have to answer to the one who actually is.

    The Back Room html com

  • The black hole
    D David MacDermot

    I have several classes I use for instrumentation control and port access. I use the write only property as a means of passing instructions to the remote devices (reads easier in my opinion) and this suggests that the property value is not stored just passed along. Ex: remoteDevice.IO.Send = "SETVOLT 25"; If I wanted to set some kind of parameter value that is stored in the class but should not be read I would use the following method: serializer.SetInitialValue(103);

    The Weird and The Wonderful question

  • Audible Horror
    D David MacDermot

    After having worked with a bunch of old bell system telecom engineers I learned that the symbol is actually an octothorpe. Certainly not a very sharp sounding name. Brings to mind tentacles of spaghetti code.

    The Weird and The Wonderful com tools 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