text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Uses of Class java.awt.PageAttributes.OrientationRequestedType (Java Platform SE 7 )</title>
<meta name="date" content="2014-12-18">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Java™ Platform
Standard Ed. 7

Prev

Next

Frames

No Frames

All Classes

Uses of Class
java.awt.PageAttributes.OrientationRequestedType

Packages that use PageAttributes.OrientationRequestedType

Package
Description

java.awt

Contains all of the classes for creating user
interfaces and for painting graphics and images.

Uses of PageAttributes.OrientationRequestedType in java.awt

Fields in java.awt declared as PageAttributes.OrientationRequestedType

Modifier and Type
Field and Description

static PageAttributes.OrientationRequestedType
PageAttributes.OrientationRequestedType.LANDSCAPE

The OrientationRequestedType instance to use for specifying a
 landscape orientation.

static PageAttributes.OrientationRequestedType
PageAttributes.OrientationRequestedType.PORTRAIT

The OrientationRequestedType instance to use for specifying a
 portrait orientation.

Methods in java.awt that return PageAttributes.OrientationRequestedType

Modifier and Type
Method and Description

PageAttributes.OrientationRequestedType
PageAttributes.getOrientationRequested()

Returns the print orientation for pages using these attributes.

Methods in java.awt with parameters of type PageAttributes.OrientationRequestedType

Modifier and Type
Method and Description

void
PageAttributes.setOrientationRequested(PageAttributes.OrientationRequestedType orientationRequested)

Specifies the print orientation for pages using these attributes.

Constructors in java.awt with parameters of type PageAttributes.OrientationRequestedType

Constructor and Description

PageAttributes(PageAttributes.ColorType color,
              PageAttributes.MediaType media,
              PageAttributes.OrientationRequestedType orientationRequested,
              PageAttributes.OriginType origin,
              PageAttributes.PrintQualityType printQuality,
              int[] printerResolution)

Constructs a PageAttributes instance with the specified values for
 every attribute.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Java™ Platform
Standard Ed. 7

Prev

Next

Frames

No Frames

All Classes

 Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2015, Oracle and/or its affiliates.  All rights reserved.


text:
#include "src/profiling/common/proc_utils.h"

#include <sys/stat.h>
#include <unistd.h>

#include <cinttypes>

#include "perfetto/ext/base/file_utils.h"
#include "perfetto/ext/base/optional.h"
#include "perfetto/ext/base/string_utils.h"
#include "src/profiling/common/proc_cmdline.h"

namespace perfetto {
namespace profiling {
namespace {

base::Optional<uint32_t> ParseProcStatusSize(const std::string& status,
                                             const std::string& key) {
  auto entry_idx = status.find(key);
  if (entry_idx == std::string::npos)
    return {};
  entry_idx = status.find_first_not_of(" \t", entry_idx + key.size());
  if (entry_idx == std::string::npos)
    return {};
  int32_t val = atoi(status.c_str() + entry_idx);
  if (val < 0) {
    PERFETTO_ELOG("Unexpected value reading %s", key.c_str());
    return {};
  }
  return static_cast<uint32_t>(val);
}
}  // namespace

base::Optional<std::string> ReadStatus(pid_t pid) {
  std::string path = "/proc/" + std::to_string(pid) + "/status";
  std::string status;
  bool read_proc = base::ReadFile(path, &status);
  if (!read_proc) {
    PERFETTO_ELOG("Failed to read %s", path.c_str());
    return base::nullopt;
  }
  return base::Optional<std::string>(status);
}

base::Optional<uint32_t> GetRssAnonAndSwap(const std::string& status) {
  auto anon_rss = ParseProcStatusSize(status, "RssAnon:");
  auto swap = ParseProcStatusSize(status, "VmSwap:");
  if (anon_rss.has_value() && swap.has_value()) {
    return *anon_rss + *swap;
  }
  return base::nullopt;
}

void RemoveUnderAnonThreshold(uint32_t min_size_kb, std::set<pid_t>* pids) {
  for (auto it = pids->begin(); it != pids->end();) {
    const pid_t pid = *it;

    base::Optional<std::string> status = ReadStatus(pid);
    base::Optional<uint32_t> rss_and_swap;
    if (status)
      rss_and_swap = GetRssAnonAndSwap(*status);

    if (rss_and_swap && rss_and_swap < min_size_kb) {
      PERFETTO_LOG("Removing pid %d from profiled set (anon: %d kB < %" PRIu32
                   ")",
                   pid, *rss_and_swap, min_size_kb);
      it = pids->erase(it);
    } else {
      ++it;
    }
  }
}

base::Optional<Uids> GetUids(const std::string& status) {
  auto entry_idx = status.find("Uid:");
  if (entry_idx == std::string::npos)
    return base::nullopt;

  Uids uids;
  const char* str = &status[entry_idx + 4];
  char* endptr;

  uids.real = strtoull(str, &endptr, 10);
  if (*endptr != ' ' && *endptr != '\t')
    return base::nullopt;

  str = endptr;
  uids.effective = strtoull(str, &endptr, 10);
  if (*endptr != ' ' && *endptr != '\t')
    return base::nullopt;

  str = endptr;
  uids.saved_set = strtoull(str, &endptr, 10);
  if (*endptr != ' ' && *endptr != '\t')
    return base::nullopt;

  str = endptr;
  uids.filesystem = strtoull(str, &endptr, 10);
  if (*endptr != '\n' && *endptr != '\0')
    return base::nullopt;
  return uids;
}

// Normalize cmdline in place. Stores new beginning of string in *cmdline_ptr.
// Returns new size of string (from new beginning).
// Modifies string in *cmdline_ptr.
ssize_t NormalizeCmdLine(char** cmdline_ptr, size_t size) {
  char* cmdline = *cmdline_ptr;
  char* first_arg = static_cast<char*>(memchr(cmdline, '\0', size));
  if (first_arg == nullptr) {
    errno = EOVERFLOW;
    return -1;
  }
  // For consistency with what we do with Java app cmdlines, trim everything
  // after the @ sign of the first arg.
  char* first_at = static_cast<char*>(memchr(cmdline, '@', size));
  if (first_at != nullptr && first_at < first_arg) {
    *first_at = '\0';
    first_arg = first_at;
  }
  char* start = static_cast<char*>(
      memrchr(cmdline, '/', static_cast<size_t>(first_arg - cmdline)));
  if (start == nullptr) {
    start = cmdline;
  } else {
    // Skip the /.
    start++;
  }
  *cmdline_ptr = start;
  return first_arg - start;
}

base::Optional<std::vector<std::string>> NormalizeCmdlines(
    const std::vector<std::string>& cmdlines) {
  std::vector<std::string> normalized_cmdlines;
  normalized_cmdlines.reserve(cmdlines.size());

  for (size_t i = 0; i < cmdlines.size(); i++) {
    std::string cmdline = cmdlines[i];  // mutable copy
    // Add nullbyte to make sure it's a C string.
    cmdline.resize(cmdline.size() + 1, '\0');
    char* cmdline_cstr = &(cmdline[0]);
    ssize_t size = NormalizeCmdLine(&cmdline_cstr, cmdline.size());
    if (size == -1) {
      PERFETTO_PLOG("Failed to normalize cmdline %s. Stopping the parse.",
                    cmdlines[i].c_str());
      return base::nullopt;
    }
    normalized_cmdlines.emplace_back(cmdline_cstr, static_cast<size_t>(size));
  }
  return base::make_optional(normalized_cmdlines);
}

// This is mostly the same as GetHeapprofdProgramProperty in
// https://android.googlesource.com/platform/bionic/+/master/libc/bionic/malloc_common.cpp
// This should give the same result as GetHeapprofdProgramProperty.
bool GetCmdlineForPID(pid_t pid, std::string* name) {
  std::string filename = "/proc/" + std::to_string(pid) + "/cmdline";
  base::ScopedFile fd(base::OpenFile(filename, O_RDONLY | O_CLOEXEC));
  if (!fd) {
    PERFETTO_DPLOG("Failed to open %s", filename.c_str());
    return false;
  }
  char cmdline[512];
  const size_t max_read_size = sizeof(cmdline) - 1;
  ssize_t rd = read(*fd, cmdline, max_read_size);
  if (rd == -1) {
    PERFETTO_DPLOG("Failed to read %s", filename.c_str());
    return false;
  }

  if (rd == 0) {
    PERFETTO_DLOG("Empty cmdline for %" PRIdMAX ". Skipping.",
                  static_cast<intmax_t>(pid));
    return false;
  }

  // In some buggy kernels (before http://bit.ly/37R7qwL) /proc/pid/cmdline is
  // not NUL-terminated (see b/147438623). If we read < max_read_size bytes
  // assume we are hitting the aforementioned kernel bug and terminate anyways.
  const size_t rd_u = static_cast<size_t>(rd);
  if (rd_u >= max_read_size && memchr(cmdline, '\0', rd_u) == nullptr) {
    // We did not manage to read the first argument.
    PERFETTO_DLOG("Overflow reading cmdline for %" PRIdMAX,
                  static_cast<intmax_t>(pid));
    errno = EOVERFLOW;
    return false;
  }

  cmdline[rd] = '\0';
  char* cmdline_start = cmdline;
  ssize_t size = NormalizeCmdLine(&cmdline_start, rd_u);
  if (size == -1)
    return false;
  name->assign(cmdline_start, static_cast<size_t>(size));
  return true;
}

void FindAllProfilablePids(std::set<pid_t>* pids) {
  ForEachPid([pids](pid_t pid) {
    if (pid == getpid())
      return;

    char filename_buf[128];
    snprintf(filename_buf, sizeof(filename_buf), "/proc/%d/%s", pid, "cmdline");
    struct stat statbuf;
    // Check if we have permission to the process.
    if (stat(filename_buf, &statbuf) == 0)
      pids->emplace(pid);
  });
}

void FindPidsForCmdlines(const std::vector<std::string>& cmdlines,
                         std::set<pid_t>* pids) {
  ForEachPid([&cmdlines, pids](pid_t pid) {
    if (pid == getpid())
      return;
    std::string process_cmdline;
    process_cmdline.reserve(512);
    GetCmdlineForPID(pid, &process_cmdline);
    for (const std::string& cmdline : cmdlines) {
      if (process_cmdline == cmdline)
        pids->emplace(static_cast<pid_t>(pid));
    }
  });
}

namespace glob_aware {
void FindPidsForCmdlinePatterns(const std::vector<std::string>& patterns,
                                std::set<pid_t>* pids) {
  ForEachPid([&patterns, pids](pid_t pid) {
    if (pid == getpid())
      return;
    std::string cmdline;
    if (!glob_aware::ReadProcCmdlineForPID(pid, &cmdline))
      return;
    const char* binname =
        glob_aware::FindBinaryName(cmdline.c_str(), cmdline.size());

    for (const std::string& pattern : patterns) {
      if (glob_aware::MatchGlobPattern(pattern.c_str(), cmdline.c_str(),
                                       binname)) {
        pids->insert(pid);
      }
    }
  });
}
}  // namespace glob_aware

}  // namespace profiling
}  // namespace perfetto

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.ServiceModel;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Services.Protocols;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using bv.com.eidss;
using eidssdroid.Model;
using eidssdroid.model.Database;
using eidss.model.Enums;

namespace EIDSS
{
    [Activity]
    public class LoadReferencesActivity : Activity
    {
        private const int PROGRESS_DIALOG_ID = 0;
        private ProgressDialog mDialog;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetTitle(Resource.String.TitleLoadReferences);
            SetContentView(Resource.Layout.LoadReferencesLayout);

            Button buttonOk = FindViewById<Button>(Resource.Id.OkButton);
            Button buttonCancel = FindViewById<Button>(Resource.Id.CancelButton);
            EditText org = FindViewById<EditText>(Resource.Id.LoginOrganization);
            EditText name = FindViewById<EditText>(Resource.Id.LoginName);
            EditText pwd = FindViewById<EditText>(Resource.Id.LoginPassword);
            using (EidssDatabase db = new EidssDatabase(this))
            {
                var opt = db.Options();
                org.Text = opt.strLoginOrganization;
                name.Text = opt.strLoginUsername;
            }

            buttonOk.Click += delegate
            {
                ShowDialog(PROGRESS_DIALOG_ID);
                ThreadPool.QueueUserWorkItem(c =>
                {
                    int iErr = 0;
                    using (EidssDatabase db = new EidssDatabase(this))
                    {
                        var opt = db.Options();
                        string url = opt.strServerUrl;
                        BaseReferenceRaw[] refs = null;
                        BaseReferenceTranslationRaw[] refs_trans = null;
                        GisBaseReferenceRaw[] gis_refs = null;
                        GisBaseReferenceTranslationRaw[] gis_refs_trans = null;
                        bool bRes = false;
                        try
                        {
                            OAClient oa = new OAClient(url);
                            bRes = oa.Proxy.LoadReferences(org.Text, name.Text, pwd.Text,
                                                                new ArrayOfLong()
                                                                {
                                                                    (long)BaseReferenceType.rftDiagnosis,
                                                                    (long)BaseReferenceType.rftHumanAgeType,
                                                                    (long)BaseReferenceType.rftHumanGender,
                                                                    (long)BaseReferenceType.rftFinalState,
                                                                    (long)BaseReferenceType.rftHospStatus
                                                                },
                                                                new ArrayOfString() { "en", "ru", "ka" },
                                                                out refs, out refs_trans, out gis_refs, out gis_refs_trans);
                        }
                        catch (EndpointNotFoundException)
                        {
                            iErr = Resource.String.ConnectionFailed; // java.lang.IllegalArgumentException, org.xmlpull.v1.XmlPullParserException, java.net.SocketTimeoutException
                        }
                        catch (FaultException)
                        {
                            iErr = Resource.String.AccessFailed; // java.lang.ClassCastException: org.ksoap2.SoapFault cannot be cast to org.ksoap2.serialization.SoapObject
                        }
                        catch (CommunicationException)
                        {
                            iErr = Resource.String.ConnectionFailed;
                        }
                        catch (Exception)
                        {
                            iErr = Resource.String.ConnectionFailed;
                        }
                        if (iErr == 0 && !bRes)
                        {
                            iErr = Resource.String.LoginFailed; // java.lang.ClassCastException: org.ksoap2.serialization.NullSoapObject cannot be cast to org.ksoap2.serialization.SoapObject
                        }
                        if (bRes)
                        {
                            bRes = db.LoadReferences(refs, refs_trans, gis_refs, gis_refs_trans);
                            if (bRes)
                            {
                                opt.strLoginOrganization = org.Text;
                                opt.strLoginUsername = name.Text;
                                db.OptionsUpdate(opt);

                                this.Finish();
                            }
                        }
                    }
                    mDialog.Dismiss();

                    if (iErr != 0)
                        RunOnUiThread(() => ShowDialog(iErr));
                });
            };

            buttonCancel.Click += delegate
            {
                this.Finish();
            };
        }

        protected override Dialog OnCreateDialog(int id)
        {
            switch (id)
            {
                case PROGRESS_DIALOG_ID:
                    mDialog = ProgressDialog.Show(this, "", Resources.GetString(Resource.String.WaitLoading), true);
                    return mDialog;
                case Resource.String.ConnectionFailed:
                case Resource.String.LoginFailed:
                case Resource.String.AccessFailed:
                    return EidssAndroidHelpers.ErrorDialog(this, Resources.GetString(id));
            }
            return null;
        }

    }
}


text:
namespace metrics {

TEST(ExpiredHistogramsCheckerTests, BasicTest) {
  uint64_t expired_hashes[] = {1, 2, 3};
  size_t size = 3;
  std::string whitelist_str = "";
  ExpiredHistogramsChecker checker(expired_hashes, size, whitelist_str);

  EXPECT_TRUE(checker.ShouldRecord(0));
  EXPECT_FALSE(checker.ShouldRecord(3));
}

TEST(ExpiredHistogramsCheckerTests, WhitelistTest) {
  std::string hist1 = "hist1";
  std::string hist2 = "hist2";
  std::string hist3 = "hist3";
  std::string hist4 = "hist4";

  uint64_t expired_hashes[] = {base::HashMetricName(hist1),
                               base::HashMetricName(hist2)};
  size_t size = 2;
  std::string whitelist_str = hist2 + "," + hist4;
  ExpiredHistogramsChecker checker(expired_hashes, size, whitelist_str);

  EXPECT_FALSE(checker.ShouldRecord(base::HashMetricName(hist1)));
  EXPECT_TRUE(checker.ShouldRecord(base::HashMetricName(hist2)));
  EXPECT_TRUE(checker.ShouldRecord(base::HashMetricName(hist3)));
  EXPECT_TRUE(checker.ShouldRecord(base::HashMetricName(hist4)));
}

}  // namespace metrics


text:
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace Audit.EntityFramework.Core.UnitTest
{
    public class DemoContext : AuditDbContext
    {
        public const string CnnString = "data source=localhost;initial catalog=Demo;integrated security=true;";

        public DbSet<Tenant> Tenants { get; set; }
        public DbSet<Employee> Employees { get; set; }
        public DbSet<PettyCashTransaction> Pettys { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseSqlServer(CnnString);
            optionsBuilder.EnableSensitiveDataLogging();
        }

        protected override void OnModelCreating(ModelBuilder _)
        {
            _.Entity<Tenant>().ToTable("Tenant");
            _.Entity<Employee>().ToTable("Employee");
            _.Entity<PettyCashTransaction>().ToTable("PettyCashTransaction");

            _.Entity<Tenant>()
                .HasKey(t => t.Id);

            _.Entity<Employee>()
                .HasKey(t => new { t.Id, t.TenantId });

            _.Entity<PettyCashTransaction>()
                .HasKey(t => new { t.Id });

            _.Entity<PettyCashTransaction>()
                .HasOne(t => t.Employee)
                .WithMany()
                .HasForeignKey(t => new { t.EmployeeId, t.TenantId });

            _.Entity<PettyCashTransaction>()
                .HasOne(t => t.Trustee)
                .WithMany()
                .HasForeignKey(t => new { t.TrusteeId, t.TenantId });
        }
    }

    public class Tenant
    {
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        public int Id { get; set; }
        public string Name { get; set; }
    }
    public class Employee
    {
        public int Id { get; set; }
        public int TenantId { get; set; }
        public string Name { get; set; }
    }
    public class PettyCashTransaction
    {
        public int Id { get; set; }
        public int EmployeeId { get; set; }
        public int TrusteeId { get; set; }
        public int TenantId { get; set; }

        public Employee Employee { get; set; }
        public Employee Trustee { get; set; }
    }
}


text:
<?xml version="1.0" encoding="utf-8" standalone="no"?><!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
--><Server xmlns:svns="http://org.wso2.securevault/configuration" port="8005" shutdown="SHUTDOWN">

  <Service className="org.wso2.carbon.tomcat.ext.service.ExtendedStandardService" name="Catalina">

    <!--
	optional attributes:

	proxyPort="80"
    -->
    <Connector URIEncoding="UTF-8" acceptCount="200" acceptorThreadCount="2" bindOnInit="false" compressableMimeType="text/html,text/javascript,application/x-javascript,application/javascript,application/xml,text/css,application/xslt+xml,text/xsl,image/gif,image/jpg,image/jpeg" compression="on" compressionMinSize="2048" connectionUploadTimeout="120000" disableUploadTimeout="false" maxHttpHeaderSize="8192" maxKeepAliveRequests="200" maxThreads="250" minSpareThreads="50" noCompressionUserAgents="gozilla, traviata" port="9763" protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="9443" server="WSO2 Carbon Server"/>

    <!--
	optional attributes:

	proxyPort="443"
    -->
    <Connector SSLEnabled="true" URIEncoding="UTF-8" acceptCount="200" acceptorThreadCount="2" bindOnInit="false" clientAuth="false" compressableMimeType="text/html,text/javascript,application/x-javascript,application/javascript,application/xml,text/css,application/xslt+xml,text/xsl,image/gif,image/jpg,image/jpeg" compression="on" compressionMinSize="2048" connectionUploadTimeout="120000" disableUploadTimeout="false" enableLookups="false" keystoreFile="${carbon.home}/repository/resources/security/wso2carbon.jks" keystorePass="password" maxHttpHeaderSize="8192" maxKeepAliveRequests="200" maxThreads="250" minSpareThreads="50" noCompressionUserAgents="gozilla, traviata" port="9443" protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https" secure="true" server="WSO2 Carbon Server" sslProtocol="TLS" svns:secretAlias="Server.Service.Connector.keystorePass"/>

    <Engine defaultHost="localhost" name="Catalina">

      <!--Realm className="org.apache.catalina.realm.MemoryRealm" pathname="${carbon.home}/repository/conf/tomcat/tomcat-users.xml"/-->

      <Realm className="org.wso2.carbon.tomcat.ext.realms.CarbonTomcatRealm"/>

      <Host appBase="${carbon.home}/repository/deployment/server/webapps/" autoDeploy="false" deployOnStartup="false" name="localhost" unpackWARs="true">
          <Valve className="org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve"/>
          <Valve className="org.apache.catalina.valves.AccessLogValve" directory="${carbon.home}/repository/logs" pattern="combined" prefix="http_access_management_console_" suffix=".log"/>
          <Valve className="org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve" threshold="600"/>
          <Valve className="org.wso2.carbon.tomcat.ext.valves.CompositeValve"/>
      </Host>
    </Engine>
  </Service>
</Server>


text:
package edu.rmellema.Scalacalc
import java.awt.BorderLayout
import java.awt.event.{ActionEvent, ActionListener}
import javax.swing.{JTextField, JScrollPane, JTextArea, JFrame}

object CalcFrame extends JFrame with ActionListener {
  private val textArea:  JTextArea  = new JTextArea("Welcome to Scalacalc!\n", 25, 80)
  private val textField: JTextField = new JTextField(80)
  private val calc                  = new Calculator()

  private def write(s: String): Unit = textArea.append(s + "\n")

  override def actionPerformed(actionEvent: ActionEvent): Unit = {
    val ln = textField.getText
    write("> " + ln)
    textField.setText("")
    try {
      write(calc.evaluate(ln).toString)
    } catch {
      case e: Exception => write("Error: " + e.getMessage)
    }
  }

  def initialize() = {
    setTitle("Scalacalc")
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
    textArea.setEditable(false)
    textArea.setLineWrap(true)
    textArea.setWrapStyleWord(true)
    val scroll = new JScrollPane(textArea)
    add(scroll, BorderLayout.CENTER)
    textField.addActionListener(this)
    add(textField, BorderLayout.SOUTH)
    pack()
    setVisible(true)
  }

  def main(args: Array[String]): Unit = {
    initialize()
  }
}


text:
/**
 * @file
 * Definitions of a base set associative compressed superblocks tag store.
 */

#include "mem/cache/tags/compressed_tags.hh"

#include "base/trace.hh"
#include "debug/CacheComp.hh"
#include "mem/cache/replacement_policies/base.hh"
#include "mem/cache/replacement_policies/replaceable_entry.hh"
#include "mem/cache/tags/indexing_policies/base.hh"
#include "mem/packet.hh"
#include "params/CompressedTags.hh"

namespace gem5
{

CompressedTags::CompressedTags(const Params &p)
    : SectorTags(p)
{
}

void
CompressedTags::tagsInit()
{
    // Create blocks and superblocks
    blks = std::vector<CompressionBlk>(numBlocks);
    superBlks = std::vector<SuperBlk>(numSectors);

    // Initialize all blocks
    unsigned blk_index = 0;          // index into blks array
    for (unsigned superblock_index = 0; superblock_index < numSectors;
         superblock_index++)
    {
        // Locate next cache superblock
        SuperBlk* superblock = &superBlks[superblock_index];

        // Superblocks must be aware of the block size due to their co-
        // allocation conditions
        superblock->setBlkSize(blkSize);

        // Associate a replacement data entry to the block
        superblock->replacementData = replacementPolicy->instantiateEntry();

        // Initialize all blocks in this superblock
        superblock->blks.resize(numBlocksPerSector, nullptr);
        for (unsigned k = 0; k < numBlocksPerSector; ++k){
            // Select block within the set to be linked
            SectorSubBlk*& blk = superblock->blks[k];

            // Locate next cache block
            blk = &blks[blk_index];

            // Associate a data chunk to the block
            blk->data = &dataBlks[blkSize*blk_index];

            // Associate superblock to this block
            blk->setSectorBlock(superblock);

            // Associate the superblock replacement data to this block
            blk->replacementData = superblock->replacementData;

            // Set its index and sector offset
            blk->setSectorOffset(k);

            // Update block index
            ++blk_index;
        }

        // Link block to indexing policy
        indexingPolicy->setEntry(superblock, superblock_index);
    }
}

CacheBlk*
CompressedTags::findVictim(Addr addr, const bool is_secure,
                           const std::size_t compressed_size,
                           std::vector<CacheBlk*>& evict_blks)
{
    // Get all possible locations of this superblock
    const std::vector<ReplaceableEntry*> superblock_entries =
        indexingPolicy->getPossibleEntries(addr);

    // Check if the superblock this address belongs to has been allocated. If
    // so, try co-allocating
    Addr tag = extractTag(addr);
    SuperBlk* victim_superblock = nullptr;
    bool is_co_allocation = false;
    const uint64_t offset = extractSectorOffset(addr);
    for (const auto& entry : superblock_entries){
        SuperBlk* superblock = static_cast<SuperBlk*>(entry);
        if (superblock->matchTag(tag, is_secure) &&
            !superblock->blks[offset]->isValid() &&
            superblock->isCompressed() &&
            superblock->canCoAllocate(compressed_size))
        {
            victim_superblock = superblock;
            is_co_allocation = true;
            break;
        }
    }

    // If the superblock is not present or cannot be co-allocated a
    // superblock must be replaced
    if (victim_superblock == nullptr){
        // Choose replacement victim from replacement candidates
        victim_superblock = static_cast<SuperBlk*>(
            replacementPolicy->getVictim(superblock_entries));

        // The whole superblock must be evicted to make room for the new one
        for (const auto& blk : victim_superblock->blks){
            if (blk->isValid()) {
                evict_blks.push_back(blk);
            }
        }
    }

    // Get the location of the victim block within the superblock
    SectorSubBlk* victim = victim_superblock->blks[offset];

    // It would be a hit if victim was valid in a co-allocation, and upgrades
    // do not call findVictim, so it cannot happen
    if (is_co_allocation){
        assert(!victim->isValid());

        // Print all co-allocated blocks
        DPRINTF(CacheComp, "Co-Allocation: offset %d of %s\n", offset,
                victim_superblock->print());
    }

    // Update number of sub-blocks evicted due to a replacement
    sectorStats.evictionsReplacement[evict_blks.size()]++;

    return victim;
}

void
CompressedTags::forEachBlk(std::function<void(CacheBlk &)> visitor)
{
    for (CompressionBlk& blk : blks) {
        visitor(blk);
    }
}

bool
CompressedTags::anyBlk(std::function<bool(CacheBlk &)> visitor)
{
    for (CompressionBlk& blk : blks) {
        if (visitor(blk)) {
            return true;
        }
    }
    return false;
}

} // namespace gem5


text:
<?php defined('SYSPATH') or die('No direct script access.');

class Event_Model extends ORM implements Acl_Resource_Interface {

  protected $belongs_to = array('user', 'calendar');

  protected $has_many = array('signups');

  protected $has_many_polymorphic = array('comments' => 'object');

  protected $child_name = 'events';

  protected $parent_key = 'parent_id';

  /**
   * Start/end time formatting.
   */
  function show_date() {
    if ($this->all_day) {
      if ($this->start != $this->end && $this->has_end()) {
        return date::display($this->start, 'M d, Y') .' to '. date::display($this->end, 'M d, Y') .'- All Day';
      }
      return date::display($this->start, 'M d, Y') .' - All Day';
    }
    else if ($this->end_time && $this->start_day != $this->end_day) {
      return date::display($this->start, 'F jS, Y g:ia') .' to '. date::display($this->end, 'F jS, Y g:ia');
    }
    else if ($this->end_time) {
      return date::display($this->start, 'F jS, Y g:ia') .' to '. date::time($this->end);
    }
    else {
      return date::display($this->start, 'F jS, Y g:ia');
    }
  }

  function start() {
    return $this->all_day ? '' : str_replace(':00', '', date::time($this->start, TRUE));
  }

  function end() {
    return str_replace(':00', '', date::time($this->end, TRUE));
  }

  /**
   * Show the date of the event.
   */
  function date() {
    return date::display($this->start, 'Y/m/d');
  }

  /**
   * Does this event have an end date/time?
   */
  public function has_end() {
    if ($this->end != '0000-00-00 00:00:00' && $this->end > $this->start) {
      return TRUE;
    }
    return FALSE;
  }

  public function is_parent() {
    return (bool) $this->parent_id ? FALSE : TRUE;
  }

  /**
   * Show map
   */
  public function map() {
    if ($this->lat && $this->long) {
      return Gmap::static_map(array($this->lat => $this->long), NULL, 14, 'mobile', Kohana::config('gmaps.small.width'), Kohana::config('gmaps.small.height'));
    }
    else if ($this->location) {
      list($this->lat, $this->long) = Gmap::address_to_ll($this->location);
      if ($this->lat && $this->long) {
        $this->save();
        return $this->map();
      }
    }
    return FALSE;
  }

  /**
   * Format the location
   *
   * @param boolean    Linkable to google directions
   */
  function location($text = NULL) {
    if (is_null($text)) {
      $text = $this->location;
    }
    if ($this->mappable)
      return html::anchor('http://maps.google.com/maps?saddr='. $this->location, $text, array('target' => '_blank'));
    return $this->location;
  }

  /**
   * Signup
   */
  public function user_signed_up($user_id = NULL) {
    $user_id = is_null($user_id) ? kohana::config('chapterboard.user_id') : $user_id;
    foreach ($this->signups as $signup) {
      if ($signup->user_id == $user_id)
        return $signup;
    }
    return FALSE;
  }

  /**
   * Attendee names
   */
  public function attendees() {
    $signups = array();
    foreach ($this->signups as $signup) {
      if ($signup->rsvp == 1) {
        $signups[$signup->user_id] = $signup->user_id;
      }
    }
    if (count($signups)) {
      $user_id = kohana::config('chapterboard.user_id');
      if (in_array($user_id, $signups)) {
        $args = array('@rsvp' => html::anchor('calendar/event/'. $this->id, 'change RSVP'));
        return format::plural(count($signups) - 1, 'You and @count other member are attending - @rsvp', 'You and @count other members are attending - @rsvp', $args);
      }
      else if ($this->user_signed_up()->rsvp == 2) {
        $args = array('@rsvp' => html::anchor('calendar/event/'. $this->id, 'change RSVP'));
        return format::plural(count($signups), '@count member is attending (you are not attending) - @rsvp', '@count members are attending (you are not attending) - @rsvp', $args);
      }
      else {
        $args = array('@rsvp' => html::anchor('calendar/event/'. $this->id, 'RSVP now'));
        return format::plural(count($signups), '@count member is attending - @rsvp', '@count members are attending - @rsvp', $args);
      }
    }
    else  {
      return 'No members are attending - '. html::anchor('calendar/event/'. $this->id, 'RSVP now');
    }
  }

  /**
   * Unpublish.
   */
  public function unpublish() {
    $this->status = 0;
    return $this->save();
  }

  /**
   * Show all the events for a given month taking into account ACL.
   *
   * @param int     Two digit month.
   * @param int     Four digit year.
   * @param int     Calendar Id.
   * @param boolean Whether or not to include events 7 days before/after the
   *                start/end of the month to show on a month calendar.
   */
  public function find_by_month($month = NULL, $year = NULL, $calendar_id = NULL, $strict = FALSE) {
    $this->with('calendar')->with('calendar:site');

    if (is_numeric($calendar_id)) {
      $this->where('calendar_id', $calendar_id);
    }
    $this->orderby('start', 'ASC');
    $this->where('events.status', 1);

    $timezone = date::timezone();
    $offset = date::offset($timezone);
    if ($strict) {
      $start = strftime('%Y-%m-%d %H:%M:%S', mktime(24, 0, 0, $month, 0, $year) - $offset);
      $end = strftime('%Y-%m-%d %H:%M:%S', mktime(0, 0, 0, $month + 1, 1, $year) - $offset);
      $this->where('events.start >', $start);
      $this->where('events.start <', $end);
    }
    else {
      $start = strftime('%Y-%m-%d %H:%M:%S', mktime(24, 0, 0, $month - 1, 22, $year) - $offset);
      $end = strftime('%Y-%m-%d %H:%M:%S', mktime(0, 0, 0, $month + 1, 8, $year) - $offset);
      $this->where('events.start >', $start);
      $this->where('events.start <', $end);
    }
    // $result = $this->custom_where("calendar.site_id = %d OR (events.shared = 1 AND `calendar:site`.school_id = %d)", array(SITE_ID, SCHOOL_ID))->find_all();
    $this->custom_where(" AND calendar.site_id = %d", array(kohana::config('chapterboard.site_id')));
    $results = $this->find_all();
    if ($results->count())
      $return = FALSE;
      foreach ($results as $result) {
        if (A2::instance()->allowed($result->calendar, 'view')) {
          $return[] = $result;
        }
      }
      return $return;
    return FALSE;
  }

  /**
   * Show all the events for a given month taking into account ÅCL.
   */
  public function find_upcoming_events($until = NULL, $maximum = 0) {
    $until = date::to_db($until);
    $this->with('calendar');
    $this->orderby('start', 'ASC');
    $this->where('events.status', 1);
    $this->where('start >', date::to_db());
    $this->where('start <', $until);
    // $result = $this->custom_where("calendar.site_id = %d OR (events.shared = 1 AND `calendar:site`.school_id = %d)", array(SITE_ID, SCHOOL_ID))->find_all();
    $results = $this->where('calendar.site_id', kohana::config('chapterboard.site_id'))->find_all();
    if ($results->count())
      $return = FALSE;
      foreach ($results as $result) {
        if (A2::instance()->allowed($result->calendar, 'view')) {
          $return[] = $result;
        }
      }
      if ($maximum) {
        return array_slice($return, 0, $maximum);
      }
      return $return;
    return FALSE;
  }

  # Retrieve items for a user's iCal feed.
  public function find_ical(User_Model $user, Site_Model $site) {
   $start = date::to_db('-2 months');
   $this->with('calendar')->with('calendar:site');
   $this->where('events.start >', $start);
   $this->where('events.status', 1);
   $results = $this->custom_where(" AND (calendar.site_id = %d)", array($site->id))->find_all();
   if ($results->count()) {
     foreach ($results as $result) {
       if (A2::instance()->is_allowed($user, $result->calendar, 'view')) {
         $return[] = $result;
       }
     }
   }
   else {
     $return = FALSE;
   }
   return $return;
  }

  /**
   * Find all published comments that belong to a topic.
   */
  public function comments() {
    // custom join to preload whether or not the user liked the comment.
    $join_on = array(
      'comments.id' => 'votes.object_id',
      'votes.object_type' => '"comment"',
      'votes.user_id' => kohana::config('chapterboard.user_id')
    );
    return ORM::factory('comment')->select('value AS liked, comments.*')->custom_join('votes', $join_on, null, 'LEFT')->where(array('comments.object_type' => 'event', 'comments.object_id' => $this->id, 'comments.status' => 1))->find_all();
  }

  /**
   * Validation and saving user submitted input.
   */
  public function validate(array &$array, $save = FALSE, $is_child = FALSE) {
    $this->_date_translation($array);
    $array = Validation::factory($array)
        ->pre_filter('trim')
        ->add_rules('title', 'required')
        ->add_rules('body', 'blob')
        ->add_rules('start', 'date')
        ->add_rules('end', 'date')
        ->add_rules('start_day', 'date')
        ->add_rules('start_time', 'standard_text')
        ->add_rules('end_time', 'standard_text')
        ->add_rules('end_day', 'date')
        ->add_rules('all_day', 'numeric')
        ->add_rules('location', 'blob')
        ->add_rules('mappable', 'numeric')
        ->add_rules('rsvp', 'numeric')
        ->add_rules('reminder', 'numeric')
        ->add_rules('calendar_id', 'required', array($this, '_calendar_check'))
        ->add_rules('repeats', 'numeric')
        ->add_rules('period', 'standard_text')
        ->add_rules('period_option', 'standard_text')
        ->add_rules('until', 'standard_text')
        ->add_rules('until_occurrences', 'numeric')
        ->add_rules('until_date', 'date')
        ->add_callbacks('start', array($this, '_valid_start'))
        ->add_callbacks('end', array($this, '_valid_end'));
    if ( ! $is_child) {
      $array->add_callbacks('repeats', array($this, '_valid_repeat'));
    }
    return parent::validate($array, $save);
  }

  /**
   * Properly parse the incoming date start/end time.
   */
  public function _date_translation(&$array) {
    if ($array['all_day']) {
      $array['start'] = date::to_db($array['start_day']);
      $array['end'] = date::to_db($array['end_day']);
    }
    else {
      $array['start'] = date::to_db($array['start_day'] .' '. $array['start_time']);
      if ($array['end_time']) {
        $array['end'] = date::to_db($array['end_day'] .' '. $array['end_time']);
      }
      else {
        $array['end'] = date::to_db($array['end_day'] .' '. $array['start_time']);
      }
    }
  }

  /**
   * Ensure that the user is only adding an event to a calendar which they
   * have access to.
   */
  public function _calendar_check($id) {
    $calendar = ORM::factory('calendar', $id);
    if (A2::instance()->allowed($calendar, 'view'))
      return TRUE;
    return FALSE;
  }

  public function _valid_start(Validation $array, $field) {
    if ($array[$field] == '0000-00-00 00:00:00' || $array[$field] == '') {
      $array->add_error($field, 'datetime');
    }
  }

  /**
   * Make sure that if the user wants an end date, we have a valid one.
   */
  public function _valid_end(Validation $array, $field) {
    if ($array['end_day'] != $array['start_day'] || $array['end_time']) {
      if ($array[$field] == '0000-00-00 00:00:00' || $array[$field] == '') {
        $array->add_error($field, 'datetime');
      }

      // Validate end not before start.
      $start = date::display($array['start'], 'U');
      $end = date::display($array[$field], 'U');
      if ($end < $start) {
        $array->add_error($field, 'end_before_start');
      }
    }
  }

  /**
   * Validate event repeat input.
   */
  public function _valid_repeat(Validation $array, $field) {
    if ($array[$field]) {
      if ($array['until'] == 'occurrences') {
        if ($array['until_occurrences'] <= 0 || $array['until_occurrences'] > 100) {
          $array->add_error('until_occurrences', 'invalid');
        }
      }
      else if ($array['until'] == 'date') {
        if (date::day_difference($array['until_date'], $array['start_day']) <= 0) {
          $array->add_error('until_date', 'repeat_end_date');
        }
      }
    }
  }

  public function before_insert() {
    $this->user_id = kohana::config('chapterboard.user_id');
    $this->created = date::now();
    $this->updated = date::now();
    $this->status = 1;
    $this->end = $this->end ? $this->end : $this->start;
    if ($this->rsvp) {
      email::notify($this->user->email, 'event_rsvp_notice', $this, $this->title);
    }
  }

  public function after_insert() {
    $this->send_notifications();
    if ($this->repeats && $this->is_parent()) {
      $this->create_repeat_events();
    }
  }

  public function before_update() {
    $this->updated = date::now();
    if ($this->changed['location']) { // reset the lat long we cached
      $this->lat = 0;
      $this->long = 0;
    }
    //  Send notification if time/day/location has changed.
    $old = ORM::factory('event', $this->id);
    if ($old->start != $this->start || $old->end != $this->end || $old->location != $this->location) {
      $this->send_notifications('change');
    }
  }

  /**
   * Handle repeat event creation.
   */
  public function create_repeat_events() {
    if ($this->repeats) {
      $dates = $this->_repeat_dates();
      $parent_id = $this->id;
      foreach ($dates as $order => $date) {
        $child = clone $this; // Clone existing event.
        $child->id = NULL;
        $child->loaded = NULL; // Must set to null so that we save a new record.
        $input = array_merge($child->as_array(), $date);
        if ($child->validate($input, FALSE, TRUE)) {
          $child->parent_id = $parent_id;
          $child->child_n = (int) $order;
          $child->save();
        }
        else {
          log::system('event error', 'Failed to save repeat event properly.', 'error', array('errors' => $input->errors(), 'values' => $input->as_array()));
        }
      }
    }
  }

  public function update_repeat_events() {
    $dates = $this->_repeat_dates();
    $children = $this->children;
    $parent_id = $this->id;
    foreach ($dates as $order => $date) {
      if ($child = $children->current()) {
        $input = array_merge($this->as_array(), $date);
        $child->validate($input, TRUE, TRUE);
      }
      else {
        $child = clone $this;
        $child->id = NULL;
        $child->loaded = NULL;
        $input = array_merge($child->as_array(), $date);
        if ($child->validate($input, FALSE, TRUE)) {
          $child->parent_id = $parent_id;
          $child->child_n = (int) $order;
          $child->save();
        }
      }
      $children->next();
    }
    // Delete any extra events laying around.
    ORM::factory('event')->where('child_n >', (int) $order)->delete_all();
  }

  protected function _repeat_dates() {
    $dates = array();
    // Convert the date into a number of occurrences.
    if ($this->until == 'date') {
      $day_count = date::day_difference($this->until_date, $this->start);
      switch($this->period) {
        case 'daily':
          $this->until_occurrences = $day_count + 1;
          break;
        case 'weekly':
          $this->until_occurrences = floor($day_count / 7) + 1;
          break;
        case 'monthly':
          $this->until_occurrences = date::month_difference($this->until_date, $this->start) + 1;
          if ($this->period_option == 'day_of_week') {
            $dow = date::display($this->start, 'l');
            $week = ceil(date::display($this->start, 'd') / 7);
            $end_month = mktime(0, 0, 1, date::display($this->start, 'n') + $this->until_occurrences, 1, date::display($this->start, 'Y'));
            $end_day = date('m/d/Y', strtotime("$week $dow", $end_month));
            if (date::day_difference($this->until_date, $end_day) >= 0) {
              $this->until_occurrences++;
            }
          }
          break;
        case 'yearly':
          $this->until_occurrences = floor($day_count / 365) + 1;
          break;
      }
    }
    switch ($this->period) {
      case 'daily':
        for ($i = 1; $i < $this->until_occurrences; $i++) {
          $dates[] = array(
            'start' => date::modify("+$i days", $this->start),
            'end' => date::modify("$i days", $this->end),
            'start_day' => date::display(date::modify("+$i days", $this->start), 'm/d/Y'),
            'end_day' => date::display(date::modify("+$i days", $this->end), 'm/d/Y'),
          );
        }
        break;
      case 'weekly':
        for ($i = 1; $i < $this->until_occurrences; $i++) {
          $offset = $i * 7;
          $dates[] = array(
            'start' => date::modify("+$offset days", $this->start),
            'end' => date::modify("+$offset days", $this->end),
            'start_day' => date::display(date::modify("+$offset days", $this->start), 'm/d/Y'),
            'end_day' => date::display(date::modify("+$offset days", $this->end), 'm/d/Y'),
          );
        }
        break;
      case 'monthly':
        if ($this->period_option == 'day_of_month') {
          for ($i = 1; $i < $this->until_occurrences; $i++) {
            $dates[] = array(
              'start' => date::modify("+$i months", $this->start),
              'end' => date::modify("+$i months", $this->end),
              'start_day' => date::display(date::modify("+$i months", $this->start), 'm/d/Y'),
              'end_day' => date::display(date::modify("+$i months", $this->end), 'm/d/Y'),
            );
          }
        }
        else {
          $start_dow = date::display($this->start, 'l');
          $start_week = ceil(date::display($this->start, 'd') / 7);
          $end_dow = date::display($this->end, 'l');
          $end_week = ceil(date::display($this->start, 'd') / 7);
          for ($i = 1; $i < $this->until_occurrences; $i++) {
            $start_month = mktime(0, 0, 1, date::display($this->start, 'n') + $i, 1, date::display($this->start, 'Y'));
            $start_day = date('m/d/Y', strtotime("$start_week $start_dow", $start_month));
            $difference = date::day_difference($this->end, $this->start, FALSE);
            $end_day = date('m/d/Y', strtotime(date::modify("+$difference days", $start_day)));

            $dates[] = array(
              'start' => date::to_db(sprintf('%s %s', $start_day, substr($this->start, -8))),
              'end' => date::to_db(sprintf('%s %s', $end_day, substr($this->end, -8))),
              'start_day' => $start_day,
              'end_day' => $end_day,
            );
          }
        }
        break;
      case 'yearly':
        for ($i = 1; $i < $this->until_occurrences; $i++) {
          $dates[] = array(
            'start' => date::modify("+$i years", $this->start),
            'end' => date::modify("+$i years", $this->end),
            'start_day' => date::display(date::modify("+$i years", $this->start), 'm/d/Y'),
            'end_day' => date::display(date::modify("+$i years", $this->end), 'm/d/Y'),
          );
        }
        break;
    }
    // print '<pre>'. print_r($dates, TRUE) .'</pre>';
    return $dates;
  }

  /**
   * Send notifications.
   *
   * $signup->value:  1 - New Events, 2 - New Events and Comments, 0 - No email
   * $this->signup->rsvp:   1 - Going,  2 - Not Going,  0 - Not Responded
   *
   * @param string the type of notification, whether its for a topic or comment.
   *
   * @param ORM object if the type is 'comment' we pass in the comment object
   * to use in the notification email.
   */
  public function send_notifications($type = 'event', $comment = NULL) {
    $from = email::notification_address('event', $this->id);
    $notifications = ORM::factory('notification')->with('user')->where('object_type', 'calendar')->where('object_id', $this->calendar_id)->where('value >', 0)->where('user.status', 1)->find_all();
    switch ($type) {
      case 'event':
        foreach ($notificaions as $notify) {
          // If the user has signed up for all notifications and the signup is not the current user, send email.
          if ($notify->value == 1 && $this->user_id != $notify->user_id) {
            if (A2::instance()->is_allowed($notify->user, $this->calendar, 'view')) {
              email::announcement($notify->user->email, $from, 'event_new', $this, $this->title);
            }
          }
        }
      break;
      case 'change': // Send new details to users who are attending.
        $user_id = kohana::config('chapterboard.user_id');
        foreach ($this->signups as $signup) {
          if ($signup->rsvp == 1 && $signup->user->event_notify && $signup->user_id != $user_id) {
            if (A2::instance()->is_allowed($signup->user, $this->calendar, 'view')) {
              email::announcement($signup->user->email, $from, 'event_updated', $this, $this->title);
            }
          }
        }
      break;
      case 'comment':
        // Gather an array of all the users who are activly involved in the topic.
        $users[] = $this->user_id;
        foreach ($this->db->query("SELECT user_id FROM comments WHERE object_type = 'event' AND object_id = ?", array($this->id)) as $row) {
          $users[] = $row->user_id;
        }
        // If signup user_id is not the current user and the user has signed up for all notifications, or the user is involved in the thread, send email.
        foreach ($notifications as $notify) {
          if ($comment->user_id != $notify->user_id AND ($notify->value == 1 OR ($notify->value == 2 && in_array($notify->user_id, $users)))) {
            // Make sure the user has access to view the event.
            if (A2::instance()->is_allowed($notify->user, $this->calendar, 'view')) {
              email::announcement($notify->user->email, $from, 'event_new_comment', $comment, $this->title);
            }
          }
        }
      break;
    }
  }

	/**
	 * Overload ORM::__get to support "parent" and "children" properties.
	 *
	 * @param   string  column name
	 * @return  mixed
	 */
	public function __get($column) {
		if ($column === 'parent')
		{
			if (empty($this->related[$column]))
			{
				// Load child model
				$model = ORM::factory(inflector::singular($this->child_name));

				if (array_key_exists($this->parent_key, $this->object))
				{
					// Find children of this parent
					$model->where($model->primary_key, $this->object[$this->parent_key])->find();
				}

				$this->related[$column] = $model;
			}

			return $this->related[$column];
		}
		elseif ($column === 'children')
		{
			if (empty($this->related[$column]))
			{
				$model = ORM::factory(inflector::singular($this->child_name));

				if ($this->child_name === $this->table_name)
				{
					// Load children within this table
					$this->related[$column] = $model
						->where($this->parent_key, $this->object[$this->primary_key])
            // ->where('status', TRUE) // Show only active
						->find_all();
				}
				else
				{
					// Find first selection of children
					$this->related[$column] = $model
						->where($this->foreign_key(), $this->object[$this->primary_key])
						->where($this->parent_key, NULL)
						->find_all();
				}
			}

			return $this->related[$column];
		}

		return parent::__get($column);
	}

  /**
   * Implementation of ACL resource id.
   */
  public function get_resource_id() {
    return 'event';
  }

}


text:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using DotSpatial.Controls;
using DotSpatial.Data;
using DotSpatial.NTSExtension;
using DotSpatial.Serialization;
using DotSpatial.Symbology;
using NetTopologySuite.Geometries;
using Point = System.Drawing.Point;

namespace DotSpatial.Plugins.ShapeEditor
{
    /// <summary>
    /// MoveVertexFunction works only with the actively selected layer in the legend.
    /// MoveVertex requires clicking on a shape in order to first select the shape to work with.
    /// Moving the mouse should highlight potential shapes for editing when not in edit mode.
    /// Clicking on the shape establishes "edit mode" for that shape.
    /// It should display all the vertices of the selected polygon in blue.
    /// The mouse down on a vertex starts dragging.
    /// but previous polygon location should be ok as well.
    /// A right click during drag should cancel the movement if dragging.
    /// A further right click will de-select the shape to edit.
    /// </summary>
    public class MoveVertexFunction : SnappableMapFunction
    {
        #region Fields

        private IFeatureCategory _activeCategory;
        private IFeature _activeFeature; // not yet selected
        private Coordinate _activeVertex;
        private Coordinate _closedCircleCoord;
        private Coordinate _dragCoord;
        private bool _dragging;
        private IFeatureSet _featureSet;
        private Rectangle _imageRect;
        private IFeatureLayer _layer;
        private Point _mousePosition;
        private Coordinate _nextPoint;
        private IFeatureCategory _oldCategory;
        private Coordinate _previousPoint;
        private IFeatureCategory _selectedCategory;
        private IFeature _selectedFeature;

        #endregion

        #region  Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="MoveVertexFunction"/> class where the Map will be defined.
        /// </summary>
        /// <param name="map">The map control that implements the IMap interface.</param>
        public MoveVertexFunction(IMap map)
            : base(map)
        {
            Configure();
        }

        #endregion

        #region Events

        /// <summary>
        /// Is raised after a vertex was moved.
        /// </summary>
        public event EventHandler<VertexMovedEventArgs> VertextMoved;

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the layer.
        /// </summary>
        public IFeatureLayer Layer
        {
            get
            {
                return _layer;
            }

            set
            {
                _layer = value;
                _featureSet = _layer.DataSet;
                InitializeSnapLayers();
            }
        }

        #endregion

        #region Methods

        /// <summary>
        /// Deselects the selected feature and removes the highlight from any highlighted feature.
        /// </summary>
        public void ClearSelection()
        {
            DeselectFeature();
            RemoveHighlightFromFeature();
            _oldCategory = null;
        }

        /// <summary>
        /// This should be called if for some reason the layer gets un-selected or whatever so that the selection
        /// should clear.
        /// </summary>
        public void DeselectFeature()
        {
            if (_selectedFeature != null)
            {
                _layer.SetCategory(_selectedFeature, _oldCategory);
            }

            _selectedFeature = null;
            Map.MapFrame.Initialize();
            Map.Invalidate();
        }

        /// <summary>
        /// Removes the highlighting from the actively highlighted feature.
        /// </summary>
        public void RemoveHighlightFromFeature()
        {
            if (_activeFeature != null)
            {
                _layer.SetCategory(_activeFeature, _oldCategory);
            }

            _activeFeature = null;
        }

        /// <inheritdoc />
        protected override void OnDeactivate()
        {
            ClearSelection();
            base.OnDeactivate();
        }

        /// <inheritdoc />
        protected override void OnDraw(MapDrawArgs e)
        {
            Rectangle mouseRect = new Rectangle(_mousePosition.X - 3, _mousePosition.Y - 3, 6, 6);
            if (_selectedFeature != null)
            {
                foreach (Coordinate c in _selectedFeature.Geometry.Coordinates)
                {
                    Point pt = e.GeoGraphics.ProjToPixel(c);
                    if (e.GeoGraphics.ImageRectangle.Contains(pt))
                    {
                        e.Graphics.FillRectangle(Brushes.Blue, pt.X - 2, pt.Y - 2, 4, 4);
                    }

                    if (mouseRect.Contains(pt))
                    {
                        e.Graphics.FillRectangle(Brushes.Red, mouseRect);
                    }
                }
            }

            if (_dragging)
            {
                if (_featureSet.FeatureType == FeatureType.Point || _featureSet.FeatureType == FeatureType.MultiPoint)
                {
                    Rectangle r = new Rectangle(_mousePosition.X - (_imageRect.Width / 2), _mousePosition.Y - (_imageRect.Height / 2), _imageRect.Width, _imageRect.Height);
                    _selectedCategory.Symbolizer.Draw(e.Graphics, r);
                }
                else
                {
                    e.Graphics.FillRectangle(Brushes.Red, _mousePosition.X - 3, _mousePosition.Y - 3, 6, 6);
                    Point b = _mousePosition;
                    Pen p = new Pen(Color.Blue)
                    {
                        DashStyle = DashStyle.Dash
                    };
                    if (_previousPoint != null)
                    {
                        Point a = e.GeoGraphics.ProjToPixel(_previousPoint);
                        e.Graphics.DrawLine(p, a, b);
                    }

                    if (_nextPoint != null)
                    {
                        Point c = e.GeoGraphics.ProjToPixel(_nextPoint);
                        e.Graphics.DrawLine(p, b, c);
                    }

                    p.Dispose();
                }
            }
        }

        /// <inheritdoc />
        protected override void OnMouseDown(GeoMouseArgs e)
        {
            if (e.Button == MouseButtons.Left || e.Button == MouseButtons.Right)
            {
                _mousePosition = e.Location;
                if (_dragging)
                {
                    if (e.Button == MouseButtons.Right)
                    {
                        _dragging = false;
                        Map.Invalidate();
                        Map.IsBusy = false;
                    }
                }
                else
                {
                    if (_selectedFeature != null)
                    {
                        Rectangle mouseRect = new Rectangle(_mousePosition.X - 3, _mousePosition.Y - 3, 6, 6);

                        Envelope env = Map.PixelToProj(mouseRect).ToEnvelope();

                        if (CheckForVertexDrag(e))
                        {
                            return;
                        }

                        // No vertex selection has occured.
                        if (!_selectedFeature.Geometry.Intersects(env.ToPolygon()))
                        {
                            // We are clicking down outside of the given polygon, so clear our selected feature
                            DeselectFeature();
                            return;
                        }
                    }

                    if (_activeFeature != null)
                    {
                        // Don't start dragging a vertices right away for polygons and lines.
                        // First you select the polygon, which displays the vertices, then they can be moved.
                        if (_featureSet.FeatureType == FeatureType.Polygon)
                        {
                            _selectedFeature = _activeFeature;
                            _activeFeature = null;

                            if (!(_selectedCategory is IPolygonCategory sc))
                            {
                                _selectedCategory = new PolygonCategory(Color.FromArgb(55, 0, 255, 255), Color.Blue, 1)
                                {
                                    LegendItemVisible = false
                                };
                            }

                            _layer.SetCategory(_selectedFeature, _selectedCategory);
                        }
                        else if (_featureSet.FeatureType == FeatureType.Line)
                        {
                            _selectedFeature = _activeFeature;
                            _activeFeature = null;

                            if (!(_selectedCategory is ILineCategory sc))
                            {
                                _selectedCategory = new LineCategory(Color.Cyan, 1)
                                {
                                    LegendItemVisible = false
                                };
                            }

                            _layer.SetCategory(_selectedFeature, _selectedCategory);
                        }
                        else
                        {
                            _dragging = true;
                            Map.IsBusy = true;
                            _dragCoord = _activeFeature.Geometry.Coordinates[0];
                            MapPointLayer mpl = _layer as MapPointLayer;
                            mpl?.SetVisible(_activeFeature, false);

                            if (!(_selectedCategory is IPointCategory sc))
                            {
                                if (_layer.GetCategory(_activeFeature).Symbolizer.Copy() is IPointSymbolizer ps)
                                {
                                    ps.SetFillColor(Color.Cyan);
                                    _selectedCategory = new PointCategory(ps);
                                }
                            }
                        }
                    }

                    Map.MapFrame.Initialize();
                    Map.Invalidate();
                }
            }

            base.OnMouseDown(e);
        }

        /// <inheritdoc />
        protected override void OnMouseMove(GeoMouseArgs e)
        {
            _mousePosition = e.Location;
            if (_dragging)
            {
                // Begin snapping changes
                Coordinate snappedCoord = e.GeographicLocation;
                if (ComputeSnappedLocation(e, ref snappedCoord))
                {
                    _mousePosition = Map.ProjToPixel(snappedCoord);
                }

                // End snapping changes
                UpdateDragCoordinate(snappedCoord); // Snapping changes
            }
            else
            {
                if (_selectedFeature != null)
                {
                    VertexHighlight();
                }
                else
                {
                    // Before a shape is selected it should be possible to highlight shapes to indicate which one
                    // will be selected.
                    bool requiresInvalidate = false;
                    if (_activeFeature != null)
                    {
                        if (ShapeRemoveHighlight(e))
                        {
                            requiresInvalidate = true;
                        }
                    }

                    if (_activeFeature == null)
                    {
                        if (ShapeHighlight(e))
                        {
                            requiresInvalidate = true;
                        }
                    }

                    if (requiresInvalidate)
                    {
                        Map.MapFrame.Initialize();
                        Map.Invalidate();
                    }
                }

                // check to see if the coordinates intersect with a shape in our current featureset.
            }

            base.OnMouseMove(e);
        }

        /// <inheritdoc />
        protected override void OnMouseUp(GeoMouseArgs e)
        {
            if (e.Button == MouseButtons.Left && _dragging)
            {
                _dragging = false;
                Map.IsBusy = false;
                _featureSet.InvalidateVertices();

                if (_featureSet.FeatureType == FeatureType.Point || _featureSet.FeatureType == FeatureType.MultiPoint)
                {
                    if (_activeFeature == null)
                    {
                        return;
                    }

                    OnVertexMoved(new VertexMovedEventArgs(_activeFeature));
                    if (_layer.GetCategory(_activeFeature) != _selectedCategory)
                    {
                        _layer.SetCategory(_activeFeature, _selectedCategory);
                        _layer.SetVisible(_activeFeature, true);
                    }
                }
                else
                {
                    if (_selectedFeature == null)
                    {
                        return;
                    }

                    OnVertexMoved(new VertexMovedEventArgs(_selectedFeature));
                    if (_layer.GetCategory(_selectedFeature) != _selectedCategory)
                    {
                        _layer.SetCategory(_selectedFeature, _selectedCategory);
                    }
                }
            }

            Map.MapFrame.Initialize();
            base.OnMouseUp(e);
        }

        /// <summary>
        /// This function checks to see if the current mouse location is over a vertex.
        /// </summary>
        /// <param name="e">The GeoMouseArgs parameter contains information about the mouse location and geographic coordinates.</param>
        /// <returns>True, if the current mouse location is over a vertex.</returns>
        private bool CheckForVertexDrag(GeoMouseArgs e)
        {
            Rectangle mouseRect = new Rectangle(_mousePosition.X - 3, _mousePosition.Y - 3, 6, 6);
            Envelope env = Map.PixelToProj(mouseRect).ToEnvelope();
            if (e.Button == MouseButtons.Left)
            {
                if (_layer.DataSet.FeatureType == FeatureType.Polygon)
                {
                    for (int prt = 0; prt < _selectedFeature.Geometry.NumGeometries; prt++)
                    {
                        Geometry g = _selectedFeature.Geometry.GetGeometryN(prt);
                        IList<Coordinate> coords = g.Coordinates;
                        for (int ic = 0; ic < coords.Count; ic++)
                        {
                            Coordinate c = coords[ic];
                            if (env.Contains(c))
                            {
                                _dragging = true;
                                _dragCoord = c;
                                if (ic == 0)
                                {
                                    _closedCircleCoord = coords[coords.Count - 1];
                                    _previousPoint = coords[coords.Count - 2];
                                    _nextPoint = coords[1];
                                }
                                else if (ic == coords.Count - 1)
                                {
                                    _closedCircleCoord = coords[0];
                                    _previousPoint = coords[coords.Count - 2];
                                    _nextPoint = coords[1];
                                }
                                else
                                {
                                    _previousPoint = coords[ic - 1];
                                    _nextPoint = coords[ic + 1];
                                    _closedCircleCoord = null;
                                }

                                Map.Invalidate();
                                return true;
                            }
                        }
                    }
                }
                else if (_layer.DataSet.FeatureType == FeatureType.Line)
                {
                    for (int prt = 0; prt < _selectedFeature.Geometry.NumGeometries; prt++)
                    {
                        Geometry g = _selectedFeature.Geometry.GetGeometryN(prt);
                        IList<Coordinate> coords = g.Coordinates;
                        for (int ic = 0; ic < coords.Count; ic++)
                        {
                            Coordinate c = coords[ic];
                            if (env.Contains(c))
                            {
                                _dragging = true;
                                _dragCoord = c;

                                if (ic == 0)
                                {
                                    _previousPoint = null;
                                    _nextPoint = coords[1];
                                }
                                else if (ic == coords.Count - 1)
                                {
                                    _previousPoint = coords[coords.Count - 2];
                                    _nextPoint = null;
                                }
                                else
                                {
                                    _previousPoint = coords[ic - 1];
                                    _nextPoint = coords[ic + 1];
                                }

                                Map.Invalidate();
                                return true;
                            }
                        }
                    }
                }
            }

            return false;
        }

        private void Configure()
        {
            YieldStyle = YieldStyles.LeftButton | YieldStyles.RightButton;
        }

        /// <summary>
        /// Fires the VertexMoved event.
        /// </summary>
        /// <param name="e">The event args.</param>
        private void OnVertexMoved(VertexMovedEventArgs e)
        {
            VertextMoved?.Invoke(this, e);
        }

        /// <summary>
        /// Before a shape is selected, moving the mouse over a shape will highlight that shape by changing
        /// its appearance. This tests features to determine the first feature to qualify as the highlight.
        /// </summary>
        /// <param name="e">The GeoMouseArgs parameter contains information about the mouse location and geographic coordinates.</param>
        /// <returns>A value indicating whether the shape was successfully highlighted.</returns>
        private bool ShapeHighlight(GeoMouseArgs e)
        {
            if (e == null)
                throw new ArgumentNullException(nameof(e), "e is null.");

            Rectangle mouseRect = new Rectangle(_mousePosition.X - 3, _mousePosition.Y - 3, 6, 6);
            Extent ext = Map.PixelToProj(mouseRect);
            Polygon env = ext.ToEnvelope().ToPolygon();
            bool requiresInvalidate = false;
            foreach (IFeature feature in _featureSet.Features)
            {
                if (_featureSet.FeatureType == FeatureType.Point || _featureSet.FeatureType == FeatureType.MultiPoint)
                {
                    if (_layer is MapPointLayer mpl)
                    {
                        int w = 3;
                        int h = 3;

                        if (mpl.GetCategory(feature) is PointCategory pc)
                        {
                            if (pc.Symbolizer.ScaleMode != ScaleMode.Geographic)
                            {
                                Size2D size = pc.Symbolizer.GetSize();
                                w = (int)size.Width;
                                h = (int)size.Height;
                            }
                        }

                        _imageRect = new Rectangle(e.Location.X - (w / 2), e.Location.Y - (h / 2), w, h);
                        if (_imageRect.Contains(Map.ProjToPixel(feature.Geometry.Coordinates[0])))
                        {
                            _activeFeature = feature;
                            _oldCategory = mpl.GetCategory(feature);
                            if (_selectedCategory == null)
                            {
                                _selectedCategory = _oldCategory.Copy();
                                _selectedCategory.SetColor(Color.Red);
                                _selectedCategory.LegendItemVisible = false;
                            }

                            mpl.SetCategory(_activeFeature, _selectedCategory);
                        }
                    }

                    requiresInvalidate = true;
                }
                else
                {
                    if (feature.Geometry.Intersects(env))
                    {
                        _activeFeature = feature;
                        _oldCategory = _layer.GetCategory(_activeFeature);

                        if (_featureSet.FeatureType == FeatureType.Polygon)
                        {
                            if (!(_activeCategory is IPolygonCategory pc))
                            {
                                _activeCategory = new PolygonCategory(Color.FromArgb(55, 255, 0, 0), Color.Red, 1)
                                {
                                    LegendItemVisible = false
                                };
                            }
                        }

                        if (_featureSet.FeatureType == FeatureType.Line)
                        {
                            if (!(_activeCategory is ILineCategory pc))
                            {
                                _activeCategory = new LineCategory(Color.Red, 3)
                                {
                                    LegendItemVisible = false
                                };
                            }
                        }

                        _layer.SetCategory(_activeFeature, _activeCategory);
                        requiresInvalidate = true;
                    }
                }
            }

            return requiresInvalidate;
        }

        /// <summary>
        /// Highlighting shapes with a mouse over is something that also needs to be undone when the
        /// mouse leaves. This test handles changing the colors back to normal when the mouse leaves a shape.
        /// </summary>
        /// <param name="e">The GeoMouseArgs parameter contains information about the mouse location and geographic coordinates.</param>
        /// <returns>Boolean, true if mapframe initialize (or visual change) is necessary.</returns>
        private bool ShapeRemoveHighlight(GeoMouseArgs e)
        {
            // If no shapes have ever been highlighted, this is meaningless.
            if (_oldCategory == null)
            {
                return false;
            }

            Rectangle mouseRect = new Rectangle(_mousePosition.X - 3, _mousePosition.Y - 3, 6, 6);
            Extent ext = Map.PixelToProj(mouseRect);
            Polygon env = ext.ToEnvelope().ToPolygon();
            bool requiresInvalidate = false;

            if (_layer is MapPointLayer mpl)
            {
                int w = 3;
                int h = 3;

                if (mpl.GetCategory(_activeFeature) is PointCategory pc)
                {
                    if (pc.Symbolizer.ScaleMode != ScaleMode.Geographic)
                    {
                        w = (int)pc.Symbolizer.GetSize().Width;
                        h = (int)pc.Symbolizer.GetSize().Height;
                    }
                }

                Rectangle rect = new Rectangle(e.Location.X - (w / 2), e.Location.Y - (h / 2), w * 2, h * 2);
                if (!rect.Contains(Map.ProjToPixel(_activeFeature.Geometry.Coordinates[0])))
                {
                    mpl.SetCategory(_activeFeature, _oldCategory);
                    _activeFeature = null;
                    requiresInvalidate = true;
                }
            }
            else
            {
                if (!_activeFeature.Geometry.Intersects(env))
                {
                    _layer.SetCategory(_activeFeature, _oldCategory);
                    _activeFeature = null;
                    requiresInvalidate = true;
                }
            }

            return requiresInvalidate;
        }

        private void UpdateDragCoordinate(Coordinate loc)
        {
            // Cannot change selected feature at this time because we are dragging a vertex
            _dragCoord.X = loc.X;
            _dragCoord.Y = loc.Y;
            if (_closedCircleCoord != null)
            {
                _closedCircleCoord.X = loc.X;
                _closedCircleCoord.Y = loc.Y;
            }

            Map.Invalidate();
        }

        private void VertexHighlight()
        {
            // The feature is selected so color vertex that can be moved but don't highlight other shapes.
            Rectangle mouseRect = new Rectangle(_mousePosition.X - 3, _mousePosition.Y - 3, 6, 6);
            Extent ext = Map.PixelToProj(mouseRect);
            if (_activeVertex != null && !ext.Contains(_activeVertex))
            {
                _activeVertex = null;
                Map.Invalidate();
            }

            foreach (Coordinate c in _selectedFeature.Geometry.Coordinates)
            {
                if (ext.Contains(c))
                {
                    _activeVertex = c;
                    Map.Invalidate();
                }
            }
        }

        #endregion
    }
}


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Content** | [**GithubContent**](GithubContent.md) |  | [optional]
**Class** | **string** |  | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


text: WebRTC static server with API proxy.


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="@color/black_color"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <TabHost
        android:id="@android:id/tabhost"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <LinearLayout
                    android:id="@+id/tab_orders"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:gravity="center_horizontal"
                        android:padding="@dimen/min_padding"
                        android:text="@string/layout_add_1_str_6"
                        android:textAppearance="?android:textAppearanceMedium"
                        android:textColor="@color/yellow_color" />

                    <ListView
                        android:id="@+id/list_stat"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent" />

                </LinearLayout>

                <LinearLayout
                    android:id="@+id/tab_summary"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:gravity="center_horizontal"
                        android:padding="@dimen/min_padding"
                        android:text="@string/layout_add_1_str_7"
                        android:textAppearance="?android:textAppearanceMedium"
                        android:textColor="@color/yellow_color" />

                    <TableLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent">

                        <TableRow
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="1"
                                android:text="@string/layout_add_1_str_8" />

                            <TextView
                                android:id="@+id/text_total_distance"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="1"
                                android:gravity="center_horizontal"
                                android:text="0" />
                        </TableRow>

                        <TableRow
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="1"
                                android:text="@string/layout_add_1_str_9" />

                            <TextView
                                android:id="@+id/text_idle_time"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="1"
                                android:gravity="center_horizontal"
                                android:text="0" />
                        </TableRow>

                        <TableRow
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="1"
                                android:text="@string/layout_add_1_str_10" />

                            <TextView
                                android:id="@+id/text_orders_count"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="1"
                                android:gravity="center_horizontal"
                                android:text="0" />
                        </TableRow>

                        <TableRow
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="1"
                                android:text="@string/layout_add_1_str_11" />

                            <TextView
                                android:id="@+id/text_total_price"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_weight="1"
                                android:gravity="center_horizontal"
                                android:text="0" />
                        </TableRow>
                    </TableLayout>

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:text="11" />
                </LinearLayout>
            </FrameLayout>
        </LinearLayout>
    </TabHost>
</LinearLayout>


text:
package org.zaproxy.zap.extension.stdmenus;

import java.awt.Component;

import javax.swing.JTree;

import org.parosproxy.paros.extension.ExtensionPopupMenuItem;
import org.parosproxy.paros.model.SiteNode;
import org.parosproxy.paros.view.SiteMapPanel;
import org.zaproxy.zap.model.Target;

public class PopupContextTreeMenu extends ExtensionPopupMenuItem {
	private static final long serialVersionUID = 1L;

	private int contextId = -1;

    /**
	 * This method initializes
	 *
	 */
	public PopupContextTreeMenu() {
		super();
	}

	@Override
    public boolean isEnableForComponent(Component invoker) {
		contextId = -1;
		if (invoker instanceof JTree && SiteMapPanel.CONTEXT_TREE_COMPONENT_NAME.equals(invoker.getName())) {
			JTree contextTree = (JTree)invoker;
			SiteNode node = (SiteNode)contextTree.getLastSelectedPathComponent();
			if (node == null || node.isRoot()) {
				return false;
			}
			contextId = ((Target)node.getUserObject()).getContext().getIndex();
			return isEnabledForContext(contextId);
		}
		return false;
    }

	/**
	 * Override this method if the menu is not relevant all of the time
	 * @param context
	 * @return
	 */
	public boolean isEnabledForContext(int contextId) {
		return true;
	}

	protected int getContextId() {
		return contextId;
	}

    @Override
    public boolean isSafe() {
        return true;
    }
}


text:
#pragma warning disable 1591

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Xml.Serialization;

namespace NGM.CasClient.Client.Validation.Schema.Saml20.Metadata
{
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace="urn:oasis:names:tc:SAML:2.0:metadata")]
    [XmlRoot("PDPDescriptor", Namespace="urn:oasis:names:tc:SAML:2.0:metadata", IsNullable=false)]
    public class PdpDescriptorType : RoleDescriptorType {
        [XmlElement("AuthzService")]
        public EndpointType[] AuthzService
        {
            get;
            set;
        }

        [XmlElement("AssertionIDRequestService")]
        public EndpointType[] AssertionIdRequestService
        {
            get;
            set;
        }

        [XmlElement("NameIDFormat", DataType="anyURI")]
        public string[] NameIdFormat
        {
            get;
            set;
        }
    }
}

#pragma warning restore 1591


text:
$(document).ready(function() {
  var settings = $('.js-settings');
  var editor = '';

  $('.contentReload').bind('click', function(e) {
    setTimeout(function() {
      editor = $(".editor").ghostDown();
    }, 5);
  });

  $("#term_name").bind("change keyup", function() {
    if ($("#term_id").val() === '') {
      $("#term_slug").val($(this).val().replace(/[^a-zA-Z0-9 -]/g, "").toLowerCase().split(" ").join("-"));
    }
  });
  $("#menu_name").bind("change keyup", function() {
    $("#menu_key").val($(this).val().toLowerCase().split(" ").join("-"));
  });
  $(".checkall").change(function() {
    var checkboxes;
    checkboxes = $(this).closest("form").find(":checkbox");
    checkboxes.attr("checked", $(this).is(":checked"));
  });
  $.ajaxSetup({
    beforeSend: function(xhr) {
      xhr.setRequestHeader("X-CSRF-Token", $("meta[name=\"csrf-token\"]").attr("content"));
    }
  });
  $(".updatepost").bind("click", function(e) {
    $("body").find("form").submit();
    e.preventDefault();
  });
  if ($("#post_post_title").length > 0) {
    setInterval((function() {
      var form, formData, content;

      if(editor != ''){
        content = editor.ghostDown('getMarkdown');
        $('#post_post_content').val(content);
      }

      if ($("#post_post_title").val() !== "") {
        form = $("form :input[name!='utf8'][name!='_method'][name!='authenticity_token']");
        formData = form.serialize();
        if ($("input[name=\"_method\"]").length > 0) {
          $.ajax({
            type: "POST",
            url: settings.attr('data-site-url') + "admin/articles/autosave",
            data: formData,
            success: function(data) {
              if (data !== 'f') {
                $("#revisionsContainer, #revisions").html(data);
              }
            }
          });
        }
      }
    }), 120000);
  }
  $("body").on('ifChecked ifUnchecked', 'th #check_all', function(event) {
    if (event.type === 'ifChecked') {
      $('tbody td input[type=checkbox]').iCheck('check');
    } else {
      $('tbody td input[type=checkbox]').iCheck('uncheck');
    }
  });
  $("#post_post_title").bind("change keyup", function() {
    if ($("#post_id").val() === '') {
      $("#post_post_slug").val($(this).val().replace(/[^a-zA-Z0-9 -]/g, "").toLowerCase().split(" ").join("-"));
    }
  });
  $(".chosen-select").chosen({
    width: "100%",
    placeholder_text_multiple: "Please start typing..."
  });

  $("[rel='tooltip']").tooltip();
  dTable = $("#dtable").dataTable({
    bLengthChange: false,
    bInfo: false,
    iDisplayLength: parseInt(settings.attr('data-pagination-limit')),
    oLanguage: {
      sSearch: "",
      sEmptyTable: "There are currently no records!"
    },
    bSort: false,
    fnInitComplete: function(oSettings, json) {
      $("#dtable_paginate").detach().prependTo("#paginationWrapper");
    }
  });
  $("#tableFilter").keyup(function() {
    dTable.fnFilter($(this).val());
  });
  $('.tooltipState').tooltip({delay: {show:500, hide:100}});

  $('.pop').popover();

});


text:
using System;
using System.Collections;
using Bridge;
using Bridge.Test.NUnit;
using System.Collections.Generic;
using System.Linq;

namespace Newtonsoft.Json.Tests.Issues
{
    [Category("Issues")]
    [TestFixture(TestNameFormat = "#14 - {0}")]
    public class Case14
    {
        public sealed class Multiple<T>
        {
            #region Properties
            public bool Done { get; set; }
            public int Code { get; set; }
            public T[] Data { get; set; }
            #endregion
        }

        [Test]
        public static void TestCaseInsensitiveMatch()
        {
            var msg1 = "{\"data\": [1, 2, 3],\"done\": true, \"code\": 16}";
            var test1 = JsonConvert.DeserializeObject<Multiple<int>>(msg1);
            Assert.True(test1.Done);
            Assert.AreEqual(16, test1.Code);
            Assert.AreEqual(3, test1.Data.Length);
            Assert.AreEqual(1, test1.Data[0]);
            Assert.AreEqual(2, test1.Data[1]);
            Assert.AreEqual(3, test1.Data[2]);

            var msg2 = "{\"Data\": [1, 2, 3],\"Done\": true, \"Code\": 16}";
            var test2 = JsonConvert.DeserializeObject<Multiple<int>>(msg2);
            Assert.True(test2.Done);
            Assert.AreEqual(16, test2.Code);
            Assert.AreEqual(3, test2.Data.Length);
            Assert.AreEqual(1, test2.Data[0]);
            Assert.AreEqual(2, test2.Data[1]);
            Assert.AreEqual(3, test2.Data[2]);
        }
    }
}


text:
// .NAME vtkInformationVariantVectorKey - Key for variant vector values.
// .SECTION Description
// vtkInformationVariantVectorKey is used to represent keys for variant
// vector values in vtkInformation.h

#ifndef __vtkInformationVariantVectorKey_h
#define __vtkInformationVariantVectorKey_h

#include "vtkCommonCoreModule.h" // For export macro
#include "vtkInformationKey.h"

#include "vtkCommonInformationKeyManager.h" // Manage instances of this type.

class vtkVariant;

class VTKCOMMONCORE_EXPORT vtkInformationVariantVectorKey : public vtkInformationKey
{
public:
  vtkTypeMacro(vtkInformationVariantVectorKey,vtkInformationKey);
  void PrintSelf(ostream& os, vtkIndent indent);

  vtkInformationVariantVectorKey(const char* name, const char* location,
                                 int length=-1);
  ~vtkInformationVariantVectorKey();

  // Description:
  // Get/Set the value associated with this key in the given
  // information object.
  void Append(vtkInformation* info, const vtkVariant& value);
  void Set(vtkInformation* info, const vtkVariant* value, int length);
  const vtkVariant* Get(vtkInformation* info) const;
  const vtkVariant& Get(vtkInformation* info, int idx) const;
  void Get(vtkInformation* info, vtkVariant* value) const;
  int Length(vtkInformation* info) const;

  // Description:
  // Copy the entry associated with this key from one information
  // object to another.  If there is no entry in the first information
  // object for this key, the value is removed from the second.
  virtual void ShallowCopy(vtkInformation* from, vtkInformation* to);

  // Description:
  // Print the key's value in an information object to a stream.
  virtual void Print(ostream& os, vtkInformation* info);

protected:
  // The required length of the vector value (-1 is no restriction).
  int RequiredLength;

private:
  vtkInformationVariantVectorKey(const vtkInformationVariantVectorKey&);  // Not implemented.
  void operator=(const vtkInformationVariantVectorKey&);  // Not implemented.
};

#endif


text:
module Blorgh
  class Engine < ::Rails::Engine
    isolate_namespace Blorgh

    config.generators do |g|
      g.test_framework :rspec
      g.fixture_replacement :factory_girl, :dir => 'spec/factories'
    end
  end
end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>ServletConnection (Variant 0.10.1)</title>
<meta name="date" content="2019-09-04">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

  \

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.variant.client.servlet

Interface ServletConnection

All Superinterfaces:

com.variant.client.Connection

public interface ServletConnection
extends com.variant.client.Connection

Servlet-aware wrapper around bare client's implementation of Connection.
 Replaces bare client's session creation methods with ones which take an instance
 of HttpServletRequest and return the narrower, servlet-aware ServletSession

Since:

0.5

Method Summary

All Methods Instance Methods Abstract Methods

Modifier and Type
Method and Description

ServletSession
getOrCreateSession(HttpServletRequest req)

Rewritten signature in terms of Servlet API.

ServletSession
getOrCreateSession(java.lang.Object... userData)

Equivalent to getOrCreateSession((HttpServletRequest)userData[0]).

java.util.Optional<ServletSession>
getSession(HttpServletRequest req)

Rewritten signature in terms of Servlet API.

java.util.Optional<ServletSession>
getSession(java.lang.Object... userData)

Equivalent to getSession((HttpServletRequest)userData[0]).

java.util.Optional<ServletSession>
getSessionById(java.lang.String sessionId)

Get an existing session by ID.

Methods inherited from interface com.variant.client.Connection

getClient, getSchemaName

Method Detail

getOrCreateSession

ServletSession getOrCreateSession(java.lang.Object... userData)

Equivalent to getOrCreateSession((HttpServletRequest)userData[0]).
 Use getOrCreateSession(HttpServletRequest) instead.

Specified by:

getOrCreateSession in interface com.variant.client.Connection

getSession

java.util.Optional<ServletSession> getSession(java.lang.Object... userData)

Equivalent to getSession((HttpServletRequest)userData[0]).
 Use getSession(HttpServletRequest) instead.

Specified by:

getSession in interface com.variant.client.Connection

getSessionById

java.util.Optional<ServletSession> getSessionById(java.lang.String sessionId)

Get an existing session by ID.

Specified by:

getSessionById in interface com.variant.client.Connection

See Also:

Connection.getSessionById(String)

getOrCreateSession

ServletSession getOrCreateSession(HttpServletRequest req)

Rewritten signature in terms of Servlet API.

Specified by:

getOrCreateSession in interface com.variant.client.Connection

Parameters:

req -

Returns:

getSession

java.util.Optional<ServletSession> getSession(HttpServletRequest req)

Rewritten signature in terms of Servlet API.

Specified by:

getSession in interface com.variant.client.Connection

Parameters:

req -

Returns:

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

  \

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Release 0.10.1. Updated 04 Sep 2019.
 Copyright © 2019 Variant Inc.


text:
namespace v8 {
namespace internal {

class HMergeRemovableSimulatesPhase : public HPhase {
 public:
  explicit HMergeRemovableSimulatesPhase(HGraph* graph)
      : HPhase("H_Merge removable simulates", graph) { }

  void Run();

 private:
  DISALLOW_COPY_AND_ASSIGN(HMergeRemovableSimulatesPhase);
};

} }  // namespace v8::internal

#endif  // V8_HYDROGEN_REMOVABLE_SIMULATES_H_