Counts a single page of the specified gender. If this is the first page
of that gender on this site, a suitable key is added to the list of the
site's genders.

@param gender
the gender to count
@param siteRecord
the site record to count it for
356821
private void countGender(EntityIdValue gender, SiteRecord siteRecord) {
		Integer curValue = siteRecord.genderCounts.get(gender);
		if (curValue == null) {
			siteRecord.genderCounts.put(gender, 1);
		} else {
			siteRecord.genderCounts.put(gender, curValue + 1);
		}
	}
1188475
public void setSitePath(String sitepath) {

        if (!isLeafType() && !sitepath.endsWith("/")) {
            sitepath = sitepath + "/";
        }
        m_sitePath = sitepath;
    }
18421
public void onReceiveSitemapPreloadData(CmsSitemapEntryBean sitemapPreloadData) {

        fillWithPreloadInfo(Collections.singletonList(sitemapPreloadData));
        String siteRoot = sitemapPreloadData.getSiteRoot();
        if (siteRoot != null) {
            selectSite(siteRoot);
        }
    }
545981
@Override
  public void writePage(int pageID, P page) {
    if (page.isDirty()) {
      try {
        countWrite();
        byte[] array = pageToByteArray(page);
        file.getRecordBuffer(pageID).put(array);
        page.setDirty(false);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
  }
1023813
private void initializeGenderSpinner() {
        genderSpinner = (Spinner) findViewById(R.id.gender_spinner);
        genderSpinner
                .addValidator(Validators.notNull(this, R.string.not_null_validator_error_message));
    }
98150
public void addNormalSites(boolean includeRoot, String startFolder) {

        CmsSiteManagerImpl siteManager = OpenCms.getSiteManager();
        List<CmsSite> sites = siteManager.getAvailableSites(m_cms, true, false, m_cms.getRequestContext().getOuFqn());
        try {
            CmsObject rootCms = OpenCms.initCmsObject(m_cms);
            rootCms.getRequestContext().setSiteRoot("/");
            if (sites.isEmpty()) {
                String siteRoot = m_cms.getRequestContext().getSiteRoot();
                if (!rootCms.existsResource(siteRoot, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) {
                    if (startFolder != null) {
                        siteRoot = CmsStringUtil.joinPaths(siteRoot, startFolder);
                    }
                    if ((startFolder == null)
                        || !rootCms.existsResource(siteRoot, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) {
                        siteRoot = null;
                    }
                }
                if (siteRoot != null) {
                    Type type = Type.site;
                    String message = siteRoot;
                    addOption(type, siteRoot, message);
                }
            }
            for (CmsSite site : sites) {
                // Do not add the shared site - it will be among sites if you are on the shared site at the moment.
                if (site.isSharedSite()) {
                    continue;
                }
                String siteRoot = site.getSiteRoot();
                if (!rootCms.existsResource(siteRoot, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) {
                    if (startFolder != null) {
                        siteRoot = CmsStringUtil.joinPaths(siteRoot, startFolder);
                    }
                    if ((startFolder == null)
                        || !rootCms.existsResource(siteRoot, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) {
                        siteRoot = null;
                    }
                }
                if (siteRoot != null) {
                    Type type = Type.site;
                    String message = null;
                    String title = site.getTitle();
                    if (!CmsStringUtil.isEmptyOrWhitespaceOnly(title)) {
                        message = title;
                    } else {
                        message = siteRoot;
                    }
                    if (siteRoot.equals("")) {
                        type = Type.root;
                        Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(m_cms);
                        message = Messages.get().getBundle(locale).key(Messages.GUI_ROOT_SITE_0);
                        if (!includeRoot) {
                            continue;
                        }
                    }
                    addOption(type, siteRoot, message);
                }
            }
        } catch (CmsException e) {
            LOG.error(e);
        }
    }
571462
public com.google.api.ads.admanager.axis.v201805.GrpGender getGender() {
        return gender;
    }
216137
function ( nodes ) {
			var gender = nodes[0],
				forms = nodes.slice( 1 );

			return this.language.gender( gender, forms );
		}
409003
public void setGender(com.google.api.ads.admanager.axis.v201805.GrpGender gender) {
        this.gender = gender;
    }
751780
function runProgramLogic() {
  var users = db.getCollection("users");
  var ov500 = users.getDynamicView("over 500");

  // generate random number between 1-1000
  // since our view is 'over500' there is 50% change it will be
  // in our dynamic view results
  var randomAge = Math.floor(Math.random() * 1000) + 1;
  // another 50% chance of being male
  var randomGender = Math.floor(Math.random() * 2);

  var newUser = {
    name : "user #" + users.count(),
    age : randomAge,
    gender : (randomGender?"m":"f")
  }

  console.log("");
  console.log("adding user : ");
  console.log(newUser);
  console.log("");

  users.insert(newUser);

  let result = ov500.data();
  console.log("'over 500' dynamic view results : ");
  console.log(result);
  console.log("");

  // now let's take our 'generic' bulk filtering dynamic view and further query its 'current' results
  // to find only the gender 'm' users in the dynamic view results.
  result = ov500.branchResultset().find({gender: 'm'}).data();
  console.log("over 500 males : ");
  console.log(result);
  console.log("");
  
  // branchResultset can also take transforms if you want to craft frequently used transformations
  // on view results... see the wiki page on collection transforms for examples of that if interested.

  console.log("press ctrl-c to quit");

}
1044758
public static long count(nitro_service service, String sitename) throws Exception{
		gslbsite_gslbservice_binding obj = new gslbsite_gslbservice_binding();
		obj.set_sitename(sitename);
		options option = new options();
		option.set_count(true);
		gslbsite_gslbservice_binding response[] = (gslbsite_gslbservice_binding[]) obj.get_resources(service,option);
		if (response != null) {
			return response[0].__count;
		}
		return 0;
	}
49913
protected void updateSite(Site value, String xmlTag, Counter counter, Element element)
   {
      boolean shouldExist = value != null;
      Element root = updateElement(counter, element, xmlTag, shouldExist);
      if (shouldExist)
      {
         Counter innerCount = new Counter(counter.getDepth() + 1);
         findAndReplaceSimpleElement(innerCount, root, "id", value.getId(), null);
         findAndReplaceSimpleElement(innerCount, root, "name", value.getName(), null);
         findAndReplaceSimpleElement(innerCount, root, "url", value.getUrl(), null);
      }
   }
474880
def genderize(name, api_token=None):
    """"""

    GENDERIZE_API_URL = "https://api.genderize.io/"
    TOTAL_RETRIES = 10
    MAX_RETRIES = 5
    SLEEP_TIME = 0.25
    STATUS_FORCELIST = [502]

    params = {
        'name': name
    }

    if api_token:
        params['apikey'] = api_token

    session = requests.Session()

    retries = urllib3.util.Retry(total=TOTAL_RETRIES,
                                 connect=MAX_RETRIES,
                                 status=MAX_RETRIES,
                                 status_forcelist=STATUS_FORCELIST,
                                 backoff_factor=SLEEP_TIME,
                                 raise_on_status=True)

    session.mount('http://', requests.adapters.HTTPAdapter(max_retries=retries))
    session.mount('https://', requests.adapters.HTTPAdapter(max_retries=retries))

    r = session.get(GENDERIZE_API_URL, params=params)
    r.raise_for_status()
    result = r.json()

    gender = result['gender']
    prob = result.get('probability', None)

    acc = int(prob * 100) if prob else None

    return gender, acc
333734
private void setFieldsForSite(boolean enableAll) {

        try {
            if (!CmsStringUtil.isEmptyOrWhitespaceOnly(m_site.getSiteRoot())) {
                CmsProperty prop = m_clonedCms.readPropertyObject(
                    m_site.getSiteRoot(),
                    CmsPropertyDefinition.PROPERTY_TEMPLATE,
                    false);
                if (!prop.isNullProperty()) {
                    if (!m_templates.contains(prop.getValue())) {
                        m_simpleFieldTemplate.addItem(prop.getValue());
                    }
                    m_simpleFieldTemplate.select(prop.getValue());
                } else {
                    if (!m_templates.isEmpty()) {
                        m_simpleFieldTemplate.setValue(m_templates.get(0).getRootPath());
                    }
                }
                m_simpleFieldTemplate.setEnabled(enableAll);
            }
        } catch (CmsException e) {
            LOG.error("Unable to read template property.", e);
        }

        m_simpleFieldSiteRoot.setVisible(true);
        m_simpleFieldSiteRoot.setValue(m_site.getSiteRoot());
        m_simpleFieldSiteRoot.setCmsObject(m_clonedCms);
        m_simpleFieldSiteRoot.addValidator(new SiteRootValidator());
        m_simpleFieldSiteRoot.setEnabled(enableAll);
        m_simpleFieldSiteRoot.addValueChangeListener(new ValueChangeListener() {

            /**vaadin serial id. */
            private static final long serialVersionUID = 4680456758446195524L;

            public void valueChange(ValueChangeEvent event) {

                setTemplateField();
                checkOnOfflineSiteRoot();
            }

        });
        m_simpleFieldParentFolderName.setVisible(false);
        m_simpleFieldFolderName.setVisible(false);

        displayResourceInfoDirectly(
            Collections.singletonList(
                new CmsResourceInfo(
                    m_site.getTitle(),
                    m_site.getSiteRoot(),
                    m_manager.getFavIcon(m_site.getSiteRoot()))));

        m_tab.removeTab(m_tab.getTab(4));
        m_simpleFieldTitle.removeTextChangeListener(null);
        m_simpleFieldTitle.setEnabled(enableAll);
        m_simpleFieldParentFolderName.setEnabled(false);
        m_simpleFieldParentFolderName.setValue(
            m_site.getSiteRoot().substring(
                0,
                m_site.getSiteRoot().length()
                    - m_site.getSiteRoot().split("/")[m_site.getSiteRoot().split("/").length - 1].length()));

        m_simpleFieldFolderName.removeAllValidators(); //can not be changed
        m_fieldCreateOU.setVisible(false);

        m_alreadyUsedURL.remove(m_site.getSiteMatcher().forDifferentScheme("https")); //Remove current url to avoid validation problem
        m_alreadyUsedURL.remove(m_site.getSiteMatcher().forDifferentScheme("http"));

        setFieldTitle(m_site.getTitle());
        setFieldFolder(getFolderNameFromSiteRoot(m_site.getSiteRoot()));
        m_simpleFieldFolderName.setEnabled(false);
        m_simpleFieldTitle.setEnabled(enableAll);

        setFieldServer(m_site.getUrl());
        m_simpleFieldServer.setEnabled(enableAll);
        if (m_site.hasSecureServer()) {
            m_fieldSecureServer.setValue(m_site.getSecureUrl());
        }
        if (m_site.getErrorPage() != null) {
            m_fieldErrorPage.setValue(m_site.getErrorPage());
        }
        m_fieldWebServer.setValue(new Boolean(m_site.isWebserver()));
        m_fieldWebServer.setEnabled(enableAll);
        m_fieldExclusiveURL.setValue(new Boolean(m_site.isExclusiveUrl()));
        m_fieldExclusiveURL.setEnabled(enableAll);
        m_fieldExclusiveError.setValue(new Boolean(m_site.isExclusiveError()));
        m_fieldExclusiveError.setEnabled(enableAll);

        Map<String, String> siteParameters = m_site.getParameters();
        for (Entry<String, String> parameter : siteParameters.entrySet()) {
            addParameter(getParameterString(parameter));
        }

        List<CmsSiteMatcher> siteAliases = m_site.getAliases();

        for (CmsSiteMatcher siteMatcher : siteAliases) {
            if (enableAll) {
                m_aliasGroup.addRow(createAliasComponent(siteMatcher.getUrl(), siteMatcher.isRedirect()));
            } else {
                Component c = createAliasComponent(siteMatcher.getUrl(), siteMatcher.isRedirect());
                c.setEnabled(false);
                m_aliases.addComponent(c);
            }
        }

        setTemplateField();

        setUpComboBoxPosition();

        if (!m_fieldSecureServer.isEmpty()) {
            m_fieldExclusiveURL.setEnabled(true && enableAll);
            m_fieldExclusiveError.setEnabled(true && enableAll);
        }
        setFaviconIfExist();
        checkOnOfflineSiteRoot();
        m_fieldUploadFavIcon.setVisible(false);
        m_simpleFieldEncryption.setContainerDataSource(getSSLModeContainer("caption", true, m_site.getSSLMode()));
        m_simpleFieldEncryption.select(m_site.getSSLMode());
        m_simpleFieldEncryption.setEnabled(enableAll);

        m_fieldErrorPage.setEnabled(enableAll);
        m_addParameter.setVisible(enableAll);
        m_fieldPosition.setEnabled(enableAll);
    }
1363288
private SiteRecord getSiteRecord(String siteKey) {
		SiteRecord siteRecord = this.siteRecords.get(siteKey);
		if (siteRecord == null) {
			siteRecord = new SiteRecord(siteKey);
			this.siteRecords.put(siteKey, siteRecord);
		}
		return siteRecord;
	}
213046
public static SiteIdentifier single (final int siteId, final String siteString) {
        return new SiteIdentifier() {
            public int identifySite (HttpServletRequest req) {
                return siteId;
            }
            public String getSiteString (int siteId) {
                return siteString;
            }
            public int getSiteId (String siteString) {
                return siteId;
            }
            public Iterator<Site> enumerateSites () {
                return Collections.singletonList(new Site(siteId, siteString)).iterator();
            }
        };
    }
204760
def gender=(gender)
      validator = EnumAttributeValidator.new('String', ["M", "F", ""])
      unless validator.valid?(gender)
        fail ArgumentError, "invalid value for 'gender', must be one of #{validator.allowable_values}."
      end
      @gender = gender
    end