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
  1. Home
  2. The Lounge
  3. How fair is this?

How fair is this?

Scheduled Pinned Locked Moved The Lounge
question
21 Posts 12 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Eytukan
    wrote on last edited by
    #1

    If someone stores 'Sex' attrib as

    bool isMale;

    haha just seen this in code. :-D

    Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

    C G Sander RosselS M F 5 Replies Last reply
    0
    • E Eytukan

      If someone stores 'Sex' attrib as

      bool isMale;

      haha just seen this in code. :-D

      Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

      C Offline
      C Offline
      CodeWraith
      wrote on last edited by
      #2

      Strange. I don't know that as a boolean flag. Here N can have any value from 0x0 - 0xF.

      Instruction: SET X Mnemonic: SEX Machine Code: EN Registers: N → X

      I have lived with several Zen masters - all of them were cats. His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.

      E 1 Reply Last reply
      0
      • E Eytukan

        If someone stores 'Sex' attrib as

        bool isMale;

        haha just seen this in code. :-D

        Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

        G Offline
        G Offline
        GuyThiebaut
        wrote on last edited by
        #3

        How can it be bool when the answer can be "Yes please"?

        “That which can be asserted without evidence, can be dismissed without evidence.”

        ― Christopher Hitchens

        E 1 Reply Last reply
        0
        • E Eytukan

          If someone stores 'Sex' attrib as

          bool isMale;

          haha just seen this in code. :-D

          Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

          Sander RosselS Offline
          Sander RosselS Offline
          Sander Rossel
          wrote on last edited by
          #4

          Perhaps the software registers wire connectors and there really only is one alternative? :D

          Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

          E 1 Reply Last reply
          0
          • G GuyThiebaut

            How can it be bool when the answer can be "Yes please"?

            “That which can be asserted without evidence, can be dismissed without evidence.”

            ― Christopher Hitchens

            E Offline
            E Offline
            Eytukan
            wrote on last edited by
            #5

            :-D

            Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

            1 Reply Last reply
            0
            • E Eytukan

              If someone stores 'Sex' attrib as

              bool isMale;

              haha just seen this in code. :-D

              Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

              M Offline
              M Offline
              Marc Clifton
              wrote on last edited by
              #6

              At least it wasn't bool? isMale; :laugh:

              Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

              E 1 Reply Last reply
              0
              • C CodeWraith

                Strange. I don't know that as a boolean flag. Here N can have any value from 0x0 - 0xF.

                Instruction: SET X Mnemonic: SEX Machine Code: EN Registers: N → X

                I have lived with several Zen masters - all of them were cats. His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.

                E Offline
                E Offline
                Eytukan
                wrote on last edited by
                #7

                And a feminist code reviewer would definitely hate to see it. (the original code) lol :)

                Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

                C 1 Reply Last reply
                0
                • Sander RosselS Sander Rossel

                  Perhaps the software registers wire connectors and there really only is one alternative? :D

                  Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                  E Offline
                  E Offline
                  Eytukan
                  wrote on last edited by
                  #8

                  hehe good one :) :thumbsup:

                  Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

                  1 Reply Last reply
                  0
                  • M Marc Clifton

                    At least it wasn't bool? isMale; :laugh:

                    Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                    E Offline
                    E Offline
                    Eytukan
                    wrote on last edited by
                    #9

                    I just love it, when a fun post turns out to be a productive one. I'm just discovering this "null-conditional Operators" :laugh: I'm a bit outdated, may be C# 4.0, that's when I became a manager. lol happy to take away these cool tips :beer: Thanks Marc!

                    Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

                    Richard DeemingR M 2 Replies Last reply
                    0
                    • E Eytukan

                      And a feminist code reviewer would definitely hate to see it. (the original code) lol :)

                      Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

                      C Offline
                      C Offline
                      CodeWraith
                      wrote on last edited by
                      #10

                      I can give you a good stack of assembly source code where this instruction is used frequently.

                      I have lived with several Zen masters - all of them were cats. His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.

                      1 Reply Last reply
                      0
                      • E Eytukan

                        I just love it, when a fun post turns out to be a productive one. I'm just discovering this "null-conditional Operators" :laugh: I'm a bit outdated, may be C# 4.0, that's when I became a manager. lol happy to take away these cool tips :beer: Thanks Marc!

                        Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

                        Richard DeemingR Offline
                        Richard DeemingR Offline
                        Richard Deeming
                        wrote on last edited by
                        #11

                        bool? is a nullable value type[^]. Null conditional operators[^] are something completely different. :)


                        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                        E 1 Reply Last reply
                        0
                        • Richard DeemingR Richard Deeming

                          bool? is a nullable value type[^]. Null conditional operators[^] are something completely different. :)


                          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                          E Offline
                          E Offline
                          Eytukan
                          wrote on last edited by
                          #12

                          You just made it double productive :-D :thumbsup: thanks I was just thinking how can I google that. Then just went by searching ? operator in C#

                          Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

                          1 Reply Last reply
                          0
                          • E Eytukan

                            If someone stores 'Sex' attrib as

                            bool isMale;

                            haha just seen this in code. :-D

                            Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

                            F Offline
                            F Offline
                            F ES Sitecore
                            wrote on last edited by
                            #13

                            Given genders are hard to keep up with these days I use google's api to retrieve an up-to-date list rather than storing my own

                            public class Gender
                            {
                            public string Key { get; set; }
                            public string Description { get; set; }
                            public string PronounSubset { get; set; }
                            }

                            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://genders.googleapis.com/genders/api/json?key=API\_KEY");
                            request.Method = "GET";
                            request.ContentType = "application/json";
                            WebResponse response = request.GetResponse();
                            using (var reader = new StreamReader(response.GetResponseStream()))
                            {
                            string data = reader.ReadToEnd();

                            JavaScriptSerializer s = new JavaScriptSerializer();
                            var genders = s.Deserialize\>(data);
                            
                            foreach(var gender in genders)
                            {
                                System.Diagnostics.Debug.WriteLine("{0} {1} ({2})", gender.Key, gender.Description, gender.PronounSubset);
                            }
                            

                            }

                            D B Z F 4 Replies Last reply
                            0
                            • F F ES Sitecore

                              Given genders are hard to keep up with these days I use google's api to retrieve an up-to-date list rather than storing my own

                              public class Gender
                              {
                              public string Key { get; set; }
                              public string Description { get; set; }
                              public string PronounSubset { get; set; }
                              }

                              HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://genders.googleapis.com/genders/api/json?key=API\_KEY");
                              request.Method = "GET";
                              request.ContentType = "application/json";
                              WebResponse response = request.GetResponse();
                              using (var reader = new StreamReader(response.GetResponseStream()))
                              {
                              string data = reader.ReadToEnd();

                              JavaScriptSerializer s = new JavaScriptSerializer();
                              var genders = s.Deserialize\>(data);
                              
                              foreach(var gender in genders)
                              {
                                  System.Diagnostics.Debug.WriteLine("{0} {1} ({2})", gender.Key, gender.Description, gender.PronounSubset);
                              }
                              

                              }

                              D Offline
                              D Offline
                              Daniel Pfeffer
                              wrote on last edited by
                              #14

                              :omg: :wtf: It won't help; you're bound to offend someone, anyway...

                              Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

                              1 Reply Last reply
                              0
                              • F F ES Sitecore

                                Given genders are hard to keep up with these days I use google's api to retrieve an up-to-date list rather than storing my own

                                public class Gender
                                {
                                public string Key { get; set; }
                                public string Description { get; set; }
                                public string PronounSubset { get; set; }
                                }

                                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://genders.googleapis.com/genders/api/json?key=API\_KEY");
                                request.Method = "GET";
                                request.ContentType = "application/json";
                                WebResponse response = request.GetResponse();
                                using (var reader = new StreamReader(response.GetResponseStream()))
                                {
                                string data = reader.ReadToEnd();

                                JavaScriptSerializer s = new JavaScriptSerializer();
                                var genders = s.Deserialize\>(data);
                                
                                foreach(var gender in genders)
                                {
                                    System.Diagnostics.Debug.WriteLine("{0} {1} ({2})", gender.Key, gender.Description, gender.PronounSubset);
                                }
                                

                                }

                                B Offline
                                B Offline
                                Bassam Abdul Baki
                                wrote on last edited by
                                #15

                                Shouldn't the female be 0 and the male be 1?

                                Web - BM - RSS - Math - LinkedIn

                                1 Reply Last reply
                                0
                                • F F ES Sitecore

                                  Given genders are hard to keep up with these days I use google's api to retrieve an up-to-date list rather than storing my own

                                  public class Gender
                                  {
                                  public string Key { get; set; }
                                  public string Description { get; set; }
                                  public string PronounSubset { get; set; }
                                  }

                                  HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://genders.googleapis.com/genders/api/json?key=API\_KEY");
                                  request.Method = "GET";
                                  request.ContentType = "application/json";
                                  WebResponse response = request.GetResponse();
                                  using (var reader = new StreamReader(response.GetResponseStream()))
                                  {
                                  string data = reader.ReadToEnd();

                                  JavaScriptSerializer s = new JavaScriptSerializer();
                                  var genders = s.Deserialize\>(data);
                                  
                                  foreach(var gender in genders)
                                  {
                                      System.Diagnostics.Debug.WriteLine("{0} {1} ({2})", gender.Key, gender.Description, gender.PronounSubset);
                                  }
                                  

                                  }

                                  Z Offline
                                  Z Offline
                                  ZurdoDev
                                  wrote on last edited by
                                  #16

                                  I really hope this is a joke. :sigh:

                                  Everyone is born right handed. Only the strongest overcome it. Fight for left-handed rights and hand equality.

                                  1 Reply Last reply
                                  0
                                  • F F ES Sitecore

                                    Given genders are hard to keep up with these days I use google's api to retrieve an up-to-date list rather than storing my own

                                    public class Gender
                                    {
                                    public string Key { get; set; }
                                    public string Description { get; set; }
                                    public string PronounSubset { get; set; }
                                    }

                                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://genders.googleapis.com/genders/api/json?key=API\_KEY");
                                    request.Method = "GET";
                                    request.ContentType = "application/json";
                                    WebResponse response = request.GetResponse();
                                    using (var reader = new StreamReader(response.GetResponseStream()))
                                    {
                                    string data = reader.ReadToEnd();

                                    JavaScriptSerializer s = new JavaScriptSerializer();
                                    var genders = s.Deserialize\>(data);
                                    
                                    foreach(var gender in genders)
                                    {
                                        System.Diagnostics.Debug.WriteLine("{0} {1} ({2})", gender.Key, gender.Description, gender.PronounSubset);
                                    }
                                    

                                    }

                                    F Offline
                                    F Offline
                                    Forogar
                                    wrote on last edited by
                                    #17

                                    I thought, "This looks handy. Let me try it." I have my own API_KEY so I set up in the call but couldn't make it work to genders.googleapis.com - I got a 404 error. Any ideas?

                                    - I would love to change the world, but they won’t give me the source code.

                                    N 1 Reply Last reply
                                    0
                                    • E Eytukan

                                      I just love it, when a fun post turns out to be a productive one. I'm just discovering this "null-conditional Operators" :laugh: I'm a bit outdated, may be C# 4.0, that's when I became a manager. lol happy to take away these cool tips :beer: Thanks Marc!

                                      Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

                                      M Offline
                                      M Offline
                                      Marc Clifton
                                      wrote on last edited by
                                      #18

                                      Vunic wrote:

                                      Thanks Marc!

                                      YW! Richard beat me to it, but my favorites are continuation and coalescing operators, so you can write stuff like this (not that you'd want to, mind you, at least without really thinking about whether your data model is really right, but really handy when you need it!):

                                      int? n;
                                      string ns = n?.ToString() ?? "0"; // oops, forgot the quotes in the original post.

                                      Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                                      E 1 Reply Last reply
                                      0
                                      • M Marc Clifton

                                        Vunic wrote:

                                        Thanks Marc!

                                        YW! Richard beat me to it, but my favorites are continuation and coalescing operators, so you can write stuff like this (not that you'd want to, mind you, at least without really thinking about whether your data model is really right, but really handy when you need it!):

                                        int? n;
                                        string ns = n?.ToString() ?? "0"; // oops, forgot the quotes in the original post.

                                        Latest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                                        E Offline
                                        E Offline
                                        Eytukan
                                        wrote on last edited by
                                        #19

                                        :thumbsup: thanks. :)

                                        Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.

                                        1 Reply Last reply
                                        0
                                        • F Forogar

                                          I thought, "This looks handy. Let me try it." I have my own API_KEY so I set up in the call but couldn't make it work to genders.googleapis.com - I got a 404 error. Any ideas?

                                          - I would love to change the world, but they won’t give me the source code.

                                          N Offline
                                          N Offline
                                          Nish Nishant
                                          wrote on last edited by
                                          #20

                                          He was probably joking. The Android SDK defines it as female, male, or other. See [Person.Gender  |  Google APIs for Android  |  Google Developers](https://developers.google.com/android/reference/com/google/android/gms/plus/model/people/Person.Gender)

                                          Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com

                                          F 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

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