text:
0.9.10
======
*5/31/12*

Graphite 0.9.10 has been released and is now available. The packages for Whisper, Carbon, and Graphite-web are available via several sources:

* Pypi (and by extension, `pip <http://www.pip-installer.org/en/latest/index.html>`_)

 - http://pypi.python.org/pypi/graphite-web/
 - http://pypi.python.org/pypi/carbon/
 - http://pypi.python.org/pypi/whisper/

* GitHub

 - https://github.com/graphite-project/graphite-web/downloads
 - https://github.com/graphite-project/carbon/downloads
 - https://github.com/graphite-project/whisper/downloads

* Launchpad

 - https://launchpad.net/graphite/0.9/0.9.10

This release contains a fabulous amount of incremental improvement over 0.9.9. Some highlights include:
* Fixes to several annoying Composer and Dashboard UI bugs
* Import of Saved Graphs into Dashboards
* Fixes to cache-full behavior for carbon-cache and carbon senders (relay and aggregator)
* Many new useful render functions and graph options
* Improvements to the rendering engine and fixes to many rendering bugs
* Support for rendering graphs as annotated SVG
* Better organized and more flexible Graphite-web config layout (local_settings.py)

Upgrading from 0.9.9 should be as simple as updating the packages. It is recommended but not necessary that local_settings.py be recreated based on the newly shipped local_settings.py.example as it includes many newly exposed settings and an improved organization and comments. Carbon's config files also have a few new settings as well to check out.

The Graphite project is also in the midst of some project changes. For those who have not yet noticed, the Graphite codebase has been moved to GitHub (http://github.com/graphite-project) and split into individual components (Graphite-web, Carbon, Whisper, and soon Ceres). The Launchpad project remains active in supporting the project with its Answers (http://answers.launchpad.net/graphite/) and Bugs (http://bugs.launchpad.net/graphite/) functionality.

Development going forward will focus on preparing what will become Graphite 0.10.0 which will include support for the Ceres database format as well as a major refactor of the Carbon daemon (nicknamed "Megacarbon"). The master branches of the project should be considered to be in an 'alpha' state for the time being and subject to backwards-incompatible changes. Fixes to the current version will be maintained in the 0.9.x project branches but no 0.9.11 version is planned for the time being.

A big thanks goes out to all those who have helped the project in contributions of time and energy in the form of code contributions, testing, discussion, and helping each other out with support questions. Additional thanks are due to Aman Gupta (tmm1) for all of his great work on the rendering engine and other fixes, Sidnei Da Silva for his work migrating the project to GitHub and his fixes, and everyone who's taken the time to answer questions on the Answers site and on IRC.

As always, if you need any assistance please `ask a question <https://answers.launchpad.net/graphite>`_ or join us on IRC in #graphite on Freenode.

The following is a summary of changes since the last release:

New features
------------

Whisper
^^^^^^^

* Allocate Whisper files in chunks by default (jordansissel)
* Allow Whisper files to be allocated sparsely (jordansissel)
* Add whisper-merge command to copy data from one file to another (sidnei)
* Add whisper-dump utility (amosshapira)

Graphite Dashboard
^^^^^^^^^^^^^^^^^^

* New button to retrieve Graph URL (octplane)
* Add button to send email of rendered graph as attachment (bkjones)
* Allow relative 'until' time to be set in dashboard (daniellawrence)
* Add ability to import Graphs into dashboards from URL or Saved Graphs

Rendering Engine
^^^^^^^^^^^^^^^^

* New minorY option to configure minor gridlines (whd)
* New alpha() function to set individual color alpha values (tmm1)
* Allow areaAlpha to set alpha values for all styles of stacked graphs (tmm1)
* New minimumAbove() function: draw only series whose min is above n (tmm1)
* New areaBetween() function: draw the area between two graph lines (tmm1)
* New holtWintersConfidenceArea() function: display area between Holt-Winters confidence bands (tmm1)
* New SVG output format with embedded graph metadata (tmm1)
* New metric whitelist/blacklist functionality using pattern files
* New filterBelowPercentile() function: remove data below n percentile from a series (tmm1)
* New removeAbovePercentile() and removeAboveValue() functions to remove outliers (tmm1)
* New removeBelowPercentile() and removeBelowValue() functions to match above counterparts
* New aliasSub() function: perform a regex search/replace on metric names (tmm1)
* New rangeOfSeries() function: reduces multiple series into the value range of each point (saysjonathan)
* New movingMedian() function: moving median, similar to movingAverage (recursify)
* New multiplySeries() function: combine series by multiplying them
* New hideYAxis option (mdeeks)
* New percentileOfSeries() function: Combines series into the value at n percentile for each point
* New transformNull() function: transforms None values to specified (cbrinley)
* New scaleToSeconds() function: scales values based on series step (redbaron)
* New aliasByMetric() function: trims all but the last element of metric name in legend (obfuscurity)
* New uniqueLegend option to filter duplicate metric names in legend (mdeeks)
* New vtitleRight option to label 2nd Y-axis

Carbon
^^^^^^

* Allow flock() mode to be configured for Whisper
* Allow flushing of rrdcached before rrd data fetches (shufgy)
* Add ability to configure carbon metric prefix (jblaine)

Bug fixes
---------
Whisper
^^^^^^^

* Record only the last value when duplicate timestamps are sent (knyar)
* Fix rrd2whisper.py script to work with newer python-rrdtool api

Carbon
^^^^^^

* Fix full drain of queue after cache-full event when flow-control is enabled in both client and carbon-cache
* Fix unnecessary drop of a single metric point when cache is full
* Fix instrumentation of carbon-relay (darrellb)

Webapp
^^^^^^

* Fix reading of Gzip'd whisper files and remote reading of RRDs
* Fix registration of Event model in admin site
* Fix events() to work with timezone aware dates
* Fix Event model to use tagging properly and fix compatibility with MySQL (hellvinz)
* Fix compatibility of built-in json module in events and graphlot
* Fix loading of saved graphs where a target has a '%' in the name

Rendering Engine
^^^^^^^^^^^^^^^^

* Fix removal of whitespace above stacked graphs with yMax setting (tmm1)
* Use powers of 2 when calculating yStep and yUnitSystem=binary (tmm1)
* Force 100% usage of vertical space when yMax=max
* Compact memcached keys to keep size under 250 after Django processing (Kevin Clark)
* Fix alignFromTrue functionality in summarize() (tmm1)
* Fix cases of mismatched units in holt-winters bootstraps (lapsu,tmm1)
* Force integer in moving average window parameter (lapsu)
* Fix incorrect cache fetch when storage dir is symlinked (mk-fraggod)
* Fix infinite loop in Y-axis render when series range is very-very small
* Fix "Undo Function" button when braces expressions are present in the target
* Fix legend column calculation (darrellb)
* Fix broken aliasByNode() (darrellb)
* Fix rendering failures when infinite values are present in series
* Fix legend text overlap with dual Y-axis mode (nleskiw)
* Fix missing hunk of graph on right side with Dual Y-axis
* Fix cactiStyle() handling of None values
* Fix rendering breakage during DST time switch
* Allow multiple named stacks of metrics (aleh)
* Fix incorrect/misaligned graphs when series with unaligned steps are mixed in a graph
* Properly shift over series that have a later start time than the graph start

Composer
^^^^^^^^

* Fix JS error on IE due to tailing list commas (reed-r-lance)
* Fix usage of + instead of %20 for spaces in URL encoding in composer view
* Fix display of a broken image rather than "No Data" when last target is removed
* Fix the loss of multiple targets when loading a saved graph with new params (vilkaspilkas)
* Fix unremovable duplicate metrics

Dashboard
^^^^^^^^^

* Fix automatic edit field selection on click (octplane)
* Fix usage of browser cache-busting uniq parameter to be filtered from memcache key (sidnei)
* Fix inability to remove Graphs with duplicate target lists

Other improvements
------------------

Carbon
^^^^^^

* Match time units used in storage-schemas.conf with those in the webapp (ohlol)
* Only log Carbon queue fullness once (sidnei)
* Only log Carbon queue space free if it was once full (sidnei)
* Log a message with the affected filename when a Whisper update fails (bmhatfield)
* Move carbon instance logs to their own directory to prevent clobbering
* Prevent carbon-aggregator from clobbering aggregated values when aggregating to same-name
* Add SSL option to amqp publisher (sidnei)
* Remove duplicate dot metric path filtering for performance (drawks)
* Refactor of schema validation to give more informative errors
* Add reloading of rewrite-rules and aggregation-schemas for consistency

Webapp
^^^^^^

* Refactor settings.py to allow more complete configuration in local_settings.py
* Make Graphite compatible with Django 1.4
* Add jsonp support for /browser endpoint
* Make it harder to break metric browsing with a bad DATA_DIRS entry

Rendering Engine
^^^^^^^^^^^^^^^^

* Make asPercent() much more flexible and useful
* stddev() function made more robust
* Allow metrics to begin with a braces-wildcard
* Prevent drawAsInfinite() lines from affecting Y axis height (bmhatfield)
* Pass through time with secondly rather than minutely resolution to rrdfetch (tmm1)
* Tree branches should display above all leaves (mdeeks)
* Add alignToInterval to hitcount() function similar to summarize() (jwoschitz)
* Fix PieGraph missing function
* Allow timeShift() to shift forward as well as backward

Composer
^^^^^^^^

* Don't reorder targets when applying functions
* Refactor of Graph Options menu

Dashboard
^^^^^^^^^

* Explicitly size img tags to keep scroll position intact during reloads
* Default the navBar as collapsed when loading an existing dashboard view
* Show wildcards in top nav browsing view
* Allow dashboards to have any character in title (octplane)
* Make "Remove All Graphs" and "Change Size" dialogs modal (dannyla)
* Make the new "north" navbar the default


text:
import unittest

from openprocurement.api.tests.base import snitch

from openprocurement.tender.belowthreshold.tests.base import test_lots

from openprocurement.tender.competitivedialogue.tests.base import (
    test_bids,
    test_shortlistedFirms,
    BaseCompetitiveDialogEUStage2ContentWebTest,
    BaseCompetitiveDialogUAStage2ContentWebTest
)
from openprocurement.tender.belowthreshold.tests.cancellation import (
    TenderCancellationResourceTestMixin,
    TenderCancellationDocumentResourceTestMixin
)
from openprocurement.tender.belowthreshold.tests.cancellation_blanks import (
    # TenderStage2LotCancellationResourceTest
    create_tender_lot_cancellation,
    patch_tender_lot_cancellation,
    # TenderStage2LotsCancellationResourceTest
    create_tender_lots_cancellation,
    patch_tender_lots_cancellation,
)
from openprocurement.tender.competitivedialogue.tests.stage2.cancellation_blanks import (
    cancellation_active_qualification_j1427,
)

for bid in test_bids:
    bid['tenderers'][0]['identifier']['id'] = test_shortlistedFirms[0]['identifier']['id']
    bid['tenderers'][0]['identifier']['scheme'] = test_shortlistedFirms[0]['identifier']['scheme']

class TenderStage2EUCancellationResourceTest(BaseCompetitiveDialogEUStage2ContentWebTest, TenderCancellationResourceTestMixin):
    pass

class TenderStage2EULotCancellationResourceTest(BaseCompetitiveDialogEUStage2ContentWebTest):
    initial_lots = test_lots
    initial_bids = test_bids

    test_create_tender_cancellation = snitch(create_tender_lot_cancellation)
    test_patch_tender_cancellation = snitch(patch_tender_lot_cancellation)
    test_cancellation_active_qualification_j1427 = snitch(cancellation_active_qualification_j1427)

class TenderStage2EULotsCancellationResourceTest(BaseCompetitiveDialogEUStage2ContentWebTest):
    initial_lots = 2 * test_lots
    initial_bids = test_bids

    test_create_tender_cancellation = snitch(create_tender_lots_cancellation)
    test_patch_tender_cancellation = snitch(patch_tender_lots_cancellation)
    test_cancellation_active_qualification_j1427 = snitch(cancellation_active_qualification_j1427)

class TenderStage2EUCancellationDocumentResourceTest(BaseCompetitiveDialogEUStage2ContentWebTest, TenderCancellationDocumentResourceTestMixin):

    def setUp(self):
        super(TenderStage2EUCancellationDocumentResourceTest, self).setUp()
        # Create cancellation
        response = self.app.post_json('/tenders/{}/cancellations?acc_token={}'.format(self.tender_id,
                                                                                self.tender_token),
                                      {'data': {'reason': 'cancellation reason'}})
        cancellation = response.json['data']
        self.cancellation_id = cancellation['id']

class TenderStage2UACancellationResourceTest(BaseCompetitiveDialogUAStage2ContentWebTest, TenderCancellationResourceTestMixin):

    initial_auth = ('Basic', ('broker', ''))

class TenderStage2UALotCancellationResourceTest(BaseCompetitiveDialogUAStage2ContentWebTest):
    initial_lots = test_lots
    initial_auth = ('Basic', ('broker', ''))

    test_create_tender_cancellation = snitch(create_tender_lot_cancellation)
    test_patch_tender_cancellation = snitch(patch_tender_lot_cancellation)

class TenderStage2UALotsCancellationResourceTest(BaseCompetitiveDialogUAStage2ContentWebTest):
    initial_lots = 2 * test_lots
    initial_auth = ('Basic', ('broker', ''))

    test_create_tender_cancellation = snitch(create_tender_lots_cancellation)
    test_patch_tender_cancellation = snitch(patch_tender_lots_cancellation)

class TenderStage2UACancellationDocumentResourceTest(BaseCompetitiveDialogUAStage2ContentWebTest, TenderCancellationDocumentResourceTestMixin):

    initial_auth = ('Basic', ('broker', ''))

    def setUp(self):
        super(TenderStage2UACancellationDocumentResourceTest, self).setUp()
        # Create cancellation
        response = self.app.post_json('/tenders/{}/cancellations?acc_token={}'.format(self.tender_id,
                                                                                self.tender_token),
                                      {'data': {'reason': 'cancellation reason'}})
        cancellation = response.json['data']
        self.cancellation_id = cancellation['id']

def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TenderStage2EUCancellationResourceTest))
    suite.addTest(unittest.makeSuite(TenderStage2EULotCancellationResourceTest))
    suite.addTest(unittest.makeSuite(TenderStage2EULotsCancellationResourceTest))
    suite.addTest(unittest.makeSuite(TenderStage2EUCancellationDocumentResourceTest))
    suite.addTest(unittest.makeSuite(TenderStage2UACancellationResourceTest))
    suite.addTest(unittest.makeSuite(TenderStage2UALotCancellationResourceTest))
    suite.addTest(unittest.makeSuite(TenderStage2UALotsCancellationResourceTest))
    suite.addTest(unittest.makeSuite(TenderStage2UACancellationDocumentResourceTest))
    return suite

if __name__ == '__main__':
    unittest.main(defaultTest='suite')

redpajama_set_name: RedPajamaGithub


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/maps/routing/v2/polyline.proto

package com.google.maps.routing.v2;

public interface PolylineOrBuilder
    extends
    // @@protoc_insertion_point(interface_extends:google.maps.routing.v2.Polyline)
    com.google.protobuf.MessageOrBuilder {

  /**
   *
   *
   *

   * The string encoding of the polyline using the [polyline encoding
   * algorithm](https://developers.google.com/maps/documentation/utilities/polylinealgorithm)
   *

   *
   * string encoded_polyline = 1;
   *
   * @return Whether the encodedPolyline field is set.
   */
  boolean hasEncodedPolyline();
  /**
   *
   *
   *

   * The string encoding of the polyline using the [polyline encoding
   * algorithm](https://developers.google.com/maps/documentation/utilities/polylinealgorithm)
   *

   *
   * string encoded_polyline = 1;
   *
   * @return The encodedPolyline.
   */
  java.lang.String getEncodedPolyline();
  /**
   *
   *
   *

   * The string encoding of the polyline using the [polyline encoding
   * algorithm](https://developers.google.com/maps/documentation/utilities/polylinealgorithm)
   *

   *
   * string encoded_polyline = 1;
   *
   * @return The bytes for encodedPolyline.
   */
  com.google.protobuf.ByteString getEncodedPolylineBytes();

  /**
   *
   *
   *

   * Specifies a polyline using the [GeoJSON LineString
   * format](https://tools.ietf.org/html/rfc7946#section-3.1.4)
   *

   *
   * .google.protobuf.Struct geo_json_linestring = 2;
   *
   * @return Whether the geoJsonLinestring field is set.
   */
  boolean hasGeoJsonLinestring();
  /**
   *
   *
   *

   * Specifies a polyline using the [GeoJSON LineString
   * format](https://tools.ietf.org/html/rfc7946#section-3.1.4)
   *

   *
   * .google.protobuf.Struct geo_json_linestring = 2;
   *
   * @return The geoJsonLinestring.
   */
  com.google.protobuf.Struct getGeoJsonLinestring();
  /**
   *
   *
   *

   * Specifies a polyline using the [GeoJSON LineString
   * format](https://tools.ietf.org/html/rfc7946#section-3.1.4)
   *

   *
   * .google.protobuf.Struct geo_json_linestring = 2;
   */
  com.google.protobuf.StructOrBuilder getGeoJsonLinestringOrBuilder();

  public com.google.maps.routing.v2.Polyline.PolylineTypeCase getPolylineTypeCase();
}


text:
// This file is automatically generated.

package adila.db;

/*
 * Samsung Galaxy Ace 3
 *
 * DEVICE: loganlte
 * MODEL: GT-S7275
 */
final class loganlte {
    public static final String DATA = "Samsung|Galaxy Ace 3|";
}


text:
package org.apache.kafka.common.metrics;

import java.util.List;

/**
 * A compound stat is a stat where a single measurement and associated data structure feeds many metrics. This is the
 * example for a histogram which has many associated percentiles.
 */
public interface CompoundStat extends Stat {

    public List<NamedMeasurable> stats();

    public static class NamedMeasurable {

        private final String name;
        private final String description;
        private final Measurable stat;

        public NamedMeasurable(String name, String description, Measurable stat) {
            super();
            this.name = name;
            this.description = description;
            this.stat = stat;
        }

        public String name() {
            return name;
        }

        public String description() {
            return description;
        }

        public Measurable stat() {
            return stat;
        }

    }

}


text:
package android.particles.com.retrofit.common;

import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by YLM on 2016/11/20.
 */
public class RetrofitSingleton{
    private static ApiInterface apiService = null;
    private static ApiInterface imgApiService = null;
    private static Retrofit retrofit = null;
    private static Retrofit imgRetrofit = null;

    private RetrofitSingleton() {
        initImgRetrofit();
        initRetrofit();
        apiService = retrofit.create(ApiInterface.class);
        imgApiService = imgRetrofit.create(ApiInterface.class);

    }

    private static void initRetrofit() {
        retrofit = new Retrofit.Builder()
                .baseUrl(ApiInterface.HOST)
                .addConverterFactory(GsonConverterFactory.create())
                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .build();
    }
    private static void initImgRetrofit(){
        imgRetrofit = new Retrofit.Builder()
                .baseUrl(ApiInterface.IMG_HOST)
                .addConverterFactory(GsonConverterFactory.create())
                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .build();
    }

    public static ApiInterface getApiService() {
        if (apiService == null) {
            throw new NullPointerException("get apiService must be called after init");
        }
        return apiService;
    }
    public static ApiInterface getImgApiService() {
        if (apiService == null) {
            throw new NullPointerException("get apiService must be called after init");
        }
        return imgApiService;
    }

    public static RetrofitSingleton getInstance() {
        return SingletonHolder.INSTANCE;
    }

    private static class SingletonHolder {
        private static final RetrofitSingleton INSTANCE = new RetrofitSingleton();
    }
}


text:
import SvgStrategy from '../base/SvgStrategy';
import RadialAxes from '../components/RadialAxes';
import SunburstDisk from '../components/SunburstDisk';
import TextIndicator from '../components/TextIndicator';
import Spinner from '../components/Spinner';
import PauseSet from '../components/PauseSet';

class SvgStrategySunburst extends SvgStrategy {

    private axes: RadialAxes;
    private disk: SunburstDisk;
    private textIndicator: TextIndicator;
    private spinner: Spinner;
    private pauseButton: PauseSet;

    constructor() {
        super();
        this.axes = new RadialAxes();
        this.disk = new SunburstDisk(
            this.axes.x, this.axes.y
        );
        this.textIndicator = new TextIndicator();
    }

    public draw(data: [{}]) {
        this.container.translate(
            this.config.get('width') / 2,
            this.config.get('height') / 2
        );
        this.container.updateComponents(data);
    }

    public initialize(): void {
        super.initialize();
        let spinner = this.config.get('spinner'),
            pauseButton = this.config.get('pauseButton');

        this.container
            .add(this.axes)
            .add(this.disk)
            .add(this.textIndicator);

        if (spinner) {
            this.spinner = new Spinner();
            this.container.add(this.spinner);
        }

        if (pauseButton) {
            this.config.put('pauseButtonTranslate', [-10, this.config.get('height') / 2]);
        }
    }

}

export default SvgStrategySunburst;


text:
/*
 * UltraCart Rest API V2
 *
 * UltraCart REST API Version 2
 *
 * OpenAPI spec version: 2.0.0
 * Contact: support@ultracart.com
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 */

using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = com.ultracart.admin.v2.Client.SwaggerDateConverter;

namespace com.ultracart.admin.v2.Model
{
    /// <summary>
    /// IntegrationLogLog
    /// </summary>
    [DataContract]
    public partial class IntegrationLogLog :  IEquatable<IntegrationLogLog>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="IntegrationLogLog" /> class.
        /// </summary>
        /// <param name="contents">contents.</param>
        /// <param name="name">name.</param>
        public IntegrationLogLog(string contents = default(string), string name = default(string))
        {
            this.Contents = contents;
            this.Name = name;
        }

        /// <summary>
        /// Gets or Sets Contents
        /// </summary>
        [DataMember(Name="contents", EmitDefaultValue=false)]
        public string Contents { get; set; }

        /// <summary>
        /// Gets or Sets Name
        /// </summary>
        [DataMember(Name="name", EmitDefaultValue=false)]
        public string Name { get; set; }

        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            var sb = new StringBuilder();
            sb.Append("class IntegrationLogLog {\n");
            sb.Append("  Contents: ").Append(Contents).Append("\n");
            sb.Append("  Name: ").Append(Name).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }

        /// <summary>
        /// Returns the JSON string presentation of the object
        /// </summary>
        /// <returns>JSON string presentation of the object</returns>
        public virtual string ToJson()
        {
            return JsonConvert.SerializeObject(this, Formatting.Indented);
        }

        /// <summary>
        /// Returns true if objects are equal
        /// </summary>
        /// <param name="input">Object to be compared</param>
        /// <returns>Boolean</returns>
        public override bool Equals(object input)
        {
            return this.Equals(input as IntegrationLogLog);
        }

        /// <summary>
        /// Returns true if IntegrationLogLog instances are equal
        /// </summary>
        /// <param name="input">Instance of IntegrationLogLog to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(IntegrationLogLog input)
        {
            if (input == null)
                return false;

            return
                (
                    this.Contents == input.Contents ||
                    (this.Contents != null &&
                    this.Contents.Equals(input.Contents))
                ) &&
                (
                    this.Name == input.Name ||
                    (this.Name != null &&
                    this.Name.Equals(input.Name))
                );
        }

        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;
                if (this.Contents != null)
                    hashCode = hashCode * 59 + this.Contents.GetHashCode();
                if (this.Name != null)
                    hashCode = hashCode * 59 + this.Name.GetHashCode();
                return hashCode;
            }
        }

        /// <summary>
        /// To validate all properties of the instance
        /// </summary>
        /// <param name="validationContext">Validation context</param>
        /// <returns>Validation Result</returns>
        IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
        {
            yield break;
        }
    }

}


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

<title>ApduExecException</title>
<meta name="date" content="2018-10-24">
<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.fitpay.android.paymentdevice.utils

Class ApduExecException

java.lang.Object

java.lang.Throwable

java.lang.Exception

com.fitpay.android.paymentdevice.utils.ApduExecException

All Implemented Interfaces:

java.io.Serializable

public class ApduExecException
extends java.lang.Exception

Created by Vlad on 15.11.2016.

See Also:

Serialized Form

Constructor Summary

Constructors

Constructor and Description

ApduExecException(java.lang.String state,
                 java.lang.String message)

ApduExecException(java.lang.String state,
                 java.lang.String message,
                 java.lang.String commandId)

ApduExecException(java.lang.String state,
                 java.lang.String message,
                 java.lang.String commandId,
                 java.lang.String responseCode)

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

java.lang.String
getMessage()

java.lang.String
getResponseCode()

java.lang.String
getResponseState()

Methods inherited from class java.lang.Throwable

addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

ApduExecException

public ApduExecException(java.lang.String state,
                         java.lang.String message)

ApduExecException

public ApduExecException(java.lang.String state,
                         java.lang.String message,
                         java.lang.String commandId)

ApduExecException

public ApduExecException(java.lang.String state,
                         java.lang.String message,
                         java.lang.String commandId,
                         java.lang.String responseCode)

Method Detail

getResponseState

public java.lang.String getResponseState()

getResponseCode

public java.lang.String getResponseCode()

getMessage

public java.lang.String getMessage()

Overrides:

getMessage in class java.lang.Throwable

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


text:
/**
 * Constructor
 *
 * EditorManager is a Mediator for EditorParts
 * EditorParts do not know each other,
 * only know their Mediator EditorManager.
 *
 * @see
 * @since: 2015.07.19
 * @author: hw.shim
 */

// @formatter:off
define([
    'dojo/topic',
    'external/eventEmitter/EventEmitter',
    'webida-lib/plugins/workbench/plugin', //TODO : refactor
    'webida-lib/plugins/workbench/ui/DataSource',
    'webida-lib/plugins/workbench/ui/TabPartContainer',
    'webida-lib/plugins/workbench/ui/Workbench',
    'webida-lib/util/genetic',
    'webida-lib/util/logger/logger-client',
], function(
    topic,
    EventEmitter,
    workbench,
    DataSource,
    TabPartContainer,
    Workbench,
    genetic,
    Logger
) {
    'use strict';
// @formatter:on

    /**
     * @typedef {Object} DataSource
     * @typedef {Object} Part
     */

    var logger = new Logger();
    //logger.setConfig('level', Logger.LEVELS.log);
    //logger.off();

    function EditorManager() {
        logger.info('new EditorManager()');

        /** @type {Object} */
        this.subscribed = {};

        //this.subscribe();
    }

    genetic.inherits(EditorManager, EventEmitter, {

        /**
         * subscribe to topic
         */
        // @formatter:off
        subscribe: function() {
            this.subscribed['#REQUEST.openFile'] = topic.subscribe(
                '#REQUEST.openFile', this.requestOpen.bind(this));
        },
        // @formatter:on

        unsubscribe: function() {
            for (var prop in this.subscribed) {
                this.subscribed[prop].remove();
            }
        },

        getPartClassName: function(dataSource) {
            var path = this.getPartClassPath(dataSource);
            return path.split(/[\\/]/).pop();
        },

        getPartClassPath: function(dataSource) {
            return 'plugins/webida.editor.example.codemirror/CmEditorPart';
        },

        /**
         * @param {DataSource} dataSourceId
         * @param {Object} options
         * @param {requestOpenCallback} callback
         */
        /**
         * @callback requestOpenCallback
         * @param {Part} part
         */
        requestOpen: function(dataSourceId, options, callback) {
            logger.info('> requestOpen(' + dataSourceId + ', ' + options + ', callback)');

            var that = this;
            options = options || {};

            //1. prepare DataSource
            var dsRegistry = workbench.getDataSourceRegistry();
            var dataSource = dsRegistry.getDataSourceById(dataSourceId);
            if (dataSource === null) {
                workbench.createDataSource(dataSourceId, function(dataSource) {
                    that._showPart(dataSource, options, callback);
                });
            } else {
                this._showPart(dataSource, options, callback);
            }
        },

        /**
         * @private
         */
        _showPart: function(dataSource, options, callback) {
            logger.info('_showPart(' + dataSource + ', ' + options + ', callback)');

            var page = workbench.getCurrentPage();
            var registry = page.getPartRegistry();
            var ClassName = this.getPartClassName(dataSource);
            var parts = registry.getPartsByClassName(dataSource, ClassName);

            //'open with specific editor' or 'default editor' not opened yet
            if (options.unlimitedOpen === true || parts.length === 0) {
                this._createPart(dataSource, options, callback);
            } else {
                //'default editor' already exists
                if (parts.length > 0) {
                    logger.log('show existing editor');
                }
            }
        },

        /**
         * @private
         */
        _createPart: function(dataSource, options, callback) {
            logger.info('_createPart(' + dataSource + ', ' + options + ', callback)');

            var page = workbench.getCurrentPage();
            var layoutPane = page.getChildById('webida.layout_pane.center');

            //3. create Tab & add to Pane
            var tabPartContainer = new TabPartContainer(dataSource);
            layoutPane.addPartContainer(tabPartContainer);

            //4. create Part
            tabPartContainer.createPart(options, callback);
        }
    });

    EditorManager.DATA_SOURCE_OPENED = 'dataSourceOpened';

    return EditorManager;
});


text:
using Microsoft.SqlServer.TransactSql.ScriptDom;
using System;
using System.Collections.Generic;
using TSQLLint.Core.Interfaces;
using TSQLLint.Infrastructure.Rules.Common;

namespace TSQLLint.Infrastructure.Rules
{
    public class MultiTableAliasRule : BaseRuleVisitor, ISqlRule
    {
        private HashSet<string> cteNames = new HashSet<string>();

        public MultiTableAliasRule(Action<string, string, int, int> errorCallback)
            : base(errorCallback)
        {
        }

        public override string RULE_NAME => "multi-table-alias";

        public override string RULE_TEXT => "Unaliased table found in multi table joins";

        public override void Visit(TSqlStatement node)
        {
            var childCommonTableExpressionVisitor = new ChildCommonTableExpressionVisitor();
            node.AcceptChildren(childCommonTableExpressionVisitor);
            cteNames = childCommonTableExpressionVisitor.CommonTableExpressionIdentifiers;
        }

        public override void Visit(TableReference node)
        {
            void ChildCallback(TSqlFragment childNode)
            {
                var dynamicSqlAdjustment = GetDynamicSqlColumnOffset(childNode);
                var tabsOnLine = ColumnNumberCalculator.CountTabsBeforeToken(childNode.StartLine, childNode.LastTokenIndex, childNode.ScriptTokenStream);
                var column = ColumnNumberCalculator.GetColumnNumberBeforeToken(tabsOnLine, childNode.ScriptTokenStream[childNode.FirstTokenIndex]);
                errorCallback(RULE_NAME, RULE_TEXT, GetLineNumber(childNode), column + dynamicSqlAdjustment);
            }

            var childTableJoinVisitor = new ChildTableJoinVisitor();
            node.AcceptChildren(childTableJoinVisitor);

            if (!childTableJoinVisitor.TableJoined)
            {
                return;
            }

            var childTableAliasVisitor = new ChildTableAliasVisitor(ChildCallback, cteNames);
            node.AcceptChildren(childTableAliasVisitor);
        }

        public class ChildCommonTableExpressionVisitor : TSqlFragmentVisitor
        {
            public HashSet<string> CommonTableExpressionIdentifiers { get; } = new HashSet<string>();

            public override void Visit(CommonTableExpression node)
            {
                CommonTableExpressionIdentifiers.Add(node.ExpressionName.Value);
            }
        }

        public class ChildTableJoinVisitor : TSqlFragmentVisitor
        {
            public bool TableJoined { get; private set; }

            public override void Visit(JoinTableReference node)
            {
                TableJoined = true;
            }
        }

        public class ChildTableAliasVisitor : TSqlFragmentVisitor
        {
            private readonly Action<TSqlFragment> childCallback;

            public ChildTableAliasVisitor(Action<TSqlFragment> errorCallback, HashSet<string> cteNames)
            {
                CteNames = cteNames;
                childCallback = errorCallback;
            }

            public HashSet<string> CteNames { get; }

            public override void Visit(NamedTableReference node)
            {
                if (CteNames.Contains(node.SchemaObject.BaseIdentifier.Value))
                {
                    return;
                }

                if (node.Alias == null)
                {
                    childCallback(node);
                }
            }
        }
    }
}


text:
package com.apchernykh.todo.atleap.sample;

import com.blandware.android.atleap.AppContext;

public class Constants {
    public static final String TODO_API_BASE_URL = AppContext.getContext().getString(R.string.todo_api_base_url);

    public static final String ACCOUNT_TYPE = "com.apchernykh.todo.atleap.sample.user_account_type";
    public static final String ACCOUNT_TOKEN_TYPE = "ACCOUNT_TOKEN_TYPE";

}


text:
import Debug from 'debug';
import Transaction from '../../transaction';
import * as helpers from '../../helpers';

const debug = Debug('knex:tx');

export default class Transaction_Maria extends Transaction {

  query(conn, sql, status, value) {
    const t = this
    const q = this.trxClient.query(conn, sql)
      .catch(err => err.code === 1305, () => {
        helpers.warn(
          'Transaction was implicitly committed, do not mix transactions and ' +
          'DDL with MariaDB (#805)'
        );
      })
      .catch(function(err) {
        status = 2
        value = err
        t._completed = true
        debug('%s error running transaction query', t.txid)
      })
      .tap(function() {
        if (status === 1) t._resolver(value)
        if (status === 2) t._rejecter(value)
      })
    if (status === 1 || status === 2) {
      t._completed = true
    }
    return q;
  }

}


text:
.class public Landroid/net/wifi/p2p/WifiP2pDeviceList;
.super Ljava/lang/Object;
.source "WifiP2pDeviceList.java"

# interfaces
.implements Landroid/os/Parcelable;

# static fields
.field public static final CREATOR:Landroid/os/Parcelable$Creator;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/os/Parcelable$Creator",
            "<",
            "Landroid/net/wifi/p2p/WifiP2pDeviceList;",
            ">;"
        }
    .end annotation
.end field

# instance fields
.field private mDevices:Ljava/util/Collection;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Collection",
            "<",
            "Landroid/net/wifi/p2p/WifiP2pDevice;",
            ">;"
        }
    .end annotation
.end field

# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 120
    new-instance v0, Landroid/net/wifi/p2p/WifiP2pDeviceList$1;

    invoke-direct {v0}, Landroid/net/wifi/p2p/WifiP2pDeviceList$1;-><init>()V

    sput-object v0, Landroid/net/wifi/p2p/WifiP2pDeviceList;->CREATOR:Landroid/os/Parcelable$Creator;

    return-void
.end method

.method public constructor <init>()V
    .locals 1

    .prologue
    .line 37
    invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V

    .line 38
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Landroid/net/wifi/p2p/WifiP2pDeviceList;->mDevices:Ljava/util/Collection;

    .line 39
    return-void
.end method

.method public constructor <init>(Landroid/net/wifi/p2p/WifiP2pDeviceList;)V
    .locals 1
    .parameter "source"

    .prologue
    .line 42
    invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V

    .line 43
    if-eqz p1, :cond_0

    .line 44
    invoke-virtual {p1}, Landroid/net/wifi/p2p/WifiP2pDeviceList;->getDeviceList()Ljava/util/Collection;

    move-result-object v0

    iput-object v0, p0, Landroid/net/wifi/p2p/WifiP2pDeviceList;->mDevices:Ljava/util/Collection;

    .line 46
    :cond_0
    return-void
.end method

.method public constructor <init>(Ljava/util/ArrayList;)V
    .locals 3
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/ArrayList",
            "<",
            "Landroid/net/wifi/p2p/WifiP2pDevice;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 49
    .local p1, devices:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Landroid/net/wifi/p2p/WifiP2pDevice;>;"
    invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V

    .line 50
    new-instance v2, Ljava/util/ArrayList;

    invoke-direct {v2}, Ljava/util/ArrayList;-><init>()V

    iput-object v2, p0, Landroid/net/wifi/p2p/WifiP2pDeviceList;->mDevices:Ljava/util/Collection;

    .line 51
    invoke-virtual {p1}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v1

    .local v1, i$:Ljava/util/Iterator;
    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_0

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/net/wifi/p2p/WifiP2pDevice;

    .line 52
    .local v0, device:Landroid/net/wifi/p2p/WifiP2pDevice;
    iget-object v2, p0, Landroid/net/wifi/p2p/WifiP2pDeviceList;->mDevices:Ljava/util/Collection;

    invoke-interface {v2, v0}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z

    goto :goto_0

    .line 54
    .end local v0           #device:Landroid/net/wifi/p2p/WifiP2pDevice;
    :cond_0
    return-void
.end method

# virtual methods
.method public clear()Z
    .locals 1

    .prologue
    .line 58
    iget-object v0, p0, Landroid/net/wifi/p2p/WifiP2pDeviceList;->mDevices:Ljava/util/Collection;

    invoke-interface {v0}, Ljava/util/Collection;->isEmpty()Z

    move-result v0

    if-eqz v0, :cond_0

    const/4 v0, 0x0

    .line 60
    :goto_0
    return v0

    .line 59
    :cond_0
    iget-object v0, p0, Landroid/net/wifi/p2p/WifiP2pDeviceList;->mDevices:Ljava/util/Collection;

    invoke-interface {v0}, Ljava/util/Collection;->clear()V

    .line 60
    const/4 v0, 0x1

    goto :goto_0
.end method

.method public describeContents()I
    .locals 1

    .prologue
    .line 108
    const/4 v0, 0x0

    return v0
.end method

.method public getDeviceList()Ljava/util/Collection;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/Collection",
            "<",
            "Landroid/net/wifi/p2p/WifiP2pDevice;",
            ">;"
        }
    .end annotation

    .prologue
    .line 95
    iget-object v0, p0, Landroid/net/wifi/p2p/WifiP2pDeviceList;->mDevices:Ljava/util/Collection;

    invoke-static {v0}, Ljava/util/Collections;->unmodifiableCollection(Ljava/util/Collection;)Ljava/util/Collection;

    move-result-object v0

    return-object v0
.end method

.method public remove(Landroid/net/wifi/p2p/WifiP2pDevice;)Z
    .locals 1
    .parameter "device"

    .prologue
    .line 89
    if-nez p1, :cond_0

    const/4 v0, 0x0

    .line 90
    :goto_0
    return v0

    :cond_0
    iget-object v0, p0, Landroid/net/wifi/p2p/WifiP2pDeviceList;->mDevices:Ljava/util/Collection;

    invoke-interface {v0, p1}, Ljava/util/Collection;->remove(Ljava/lang/Object;)Z

    move-result v0

    goto :goto_0
.end method

.method public toString()Ljava/lang/String;
    .locals 4

    .prologue
    .line 99
    new-instance v2, Ljava/lang/StringBuffer;

    invoke-direct {v2}, Ljava/lang/StringBuffer;-><init>()V

    .line 100
    .local v2, sbuf:Ljava/lang/StringBuffer;
    iget-object v3, p0, Landroid/net/wifi/p2p/WifiP2pDeviceList;->mDevices:Ljava/util/Collection;

    invoke-interface {v3}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;

    move-result-object v1

    .local v1, i$:Ljava/util/Iterator;
    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-eqz v3, :cond_0

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/net/wifi/p2p/WifiP2pDevice;

    .line 101
    .local v0, device:Landroid/net/wifi/p2p/WifiP2pDevice;
    const-string v3, "\n"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    invoke-virtual {v3, v0}, Ljava/lang/StringBuffer;->append(Ljava/lang/Object;)Ljava/lang/StringBuffer;

    goto :goto_0

    .line 103
    .end local v0           #device:Landroid/net/wifi/p2p/WifiP2pDevice;
    :cond_0
    invoke-virtual {v2}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v3

    return-object v3
.end method

.method public update(Landroid/net/wifi/p2p/WifiP2pDevice;)V
    .locals 4
    .parameter "device"

    .prologue
    .line 65
    if-nez p1, :cond_1

    .line 85
    :cond_0
    :goto_0
    return-void

    .line 66
    :cond_1
    iget-object v2, p0, Landroid/net/wifi/p2p/WifiP2pDeviceList;->mDevices:Ljava/util/Collection;

    invoke-interface {v2}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;

    move-result-object v1

    .local v1, i$:Ljava/util/Iterator;
    :cond_2
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_3

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/net/wifi/p2p/WifiP2pDevice;

    .line 68
    .local v0, d:Landroid/net/wifi/p2p/WifiP2pDevice;
    invoke-virtual {v0, p1}, Landroid/net/wifi/p2p/WifiP2pDevice;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_2

    .line 69
    iget-object v2, p1, Landroid/net/wifi/p2p/WifiP2pDevice;->deviceName:Ljava/lang/String;

    iput-object v2, v0, Landroid/net/wifi/p2p/WifiP2pDevice;->deviceName:Ljava/lang/String;

    .line 70
    iget-object v2, p1, Landroid/net/wifi/p2p/WifiP2pDevice;->primaryDeviceType:Ljava/lang/String;

    iput-object v2, v0, Landroid/net/wifi/p2p/WifiP2pDevice;->primaryDeviceType:Ljava/lang/String;

    .line 71
    iget-object v2, p1, Landroid/net/wifi/p2p/WifiP2pDevice;->secondaryDeviceType:Ljava/lang/String;

    iput-object v2, v0, Landroid/net/wifi/p2p/WifiP2pDevice;->secondaryDeviceType:Ljava/lang/String;

    .line 72
    iget v2, p1, Landroid/net/wifi/p2p/WifiP2pDevice;->wpsConfigMethodsSupported:I

    iput v2, v0, Landroid/net/wifi/p2p/WifiP2pDevice;->wpsConfigMethodsSupported:I

    .line 73
    iget v2, p1, Landroid/net/wifi/p2p/WifiP2pDevice;->deviceCapability:I

    iput v2, v0, Landroid/net/wifi/p2p/WifiP2pDevice;->deviceCapability:I

    .line 74
    iget v2, p1, Landroid/net/wifi/p2p/WifiP2pDevice;->groupCapability:I

    iput v2, v0, Landroid/net/wifi/p2p/WifiP2pDevice;->groupCapability:I

    .line 75
    iget v2, v0, Landroid/net/wifi/p2p/WifiP2pDevice;->status:I

    const/4 v3, 0x2

    if-ne v2, v3, :cond_0

    .line 77
    const/4 v2, 0x3

    iput v2, v0, Landroid/net/wifi/p2p/WifiP2pDevice;->status:I

    goto :goto_0

    .line 84
    .end local v0           #d:Landroid/net/wifi/p2p/WifiP2pDevice;
    :cond_3
    iget-object v2, p0, Landroid/net/wifi/p2p/WifiP2pDeviceList;->mDevices:Ljava/util/Collection;

    invoke-interface {v2, p1}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z

    goto :goto_0
.end method

.method public writeToParcel(Landroid/os/Parcel;I)V
    .locals 3
    .parameter "dest"
    .parameter "flags"

    .prologue
    .line 113
    iget-object v2, p0, Landroid/net/wifi/p2p/WifiP2pDeviceList;->mDevices:Ljava/util/Collection;

    invoke-interface {v2}, Ljava/util/Collection;->size()I

    move-result v2

    invoke-virtual {p1, v2}, Landroid/os/Parcel;->writeInt(I)V

    .line 114
    iget-object v2, p0, Landroid/net/wifi/p2p/WifiP2pDeviceList;->mDevices:Ljava/util/Collection;

    invoke-interface {v2}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;

    move-result-object v1

    .local v1, i$:Ljava/util/Iterator;
    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_0

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/net/wifi/p2p/WifiP2pDevice;

    .line 115
    .local v0, device:Landroid/net/wifi/p2p/WifiP2pDevice;
    invoke-virtual {p1, v0, p2}, Landroid/os/Parcel;->writeParcelable(Landroid/os/Parcelable;I)V

    goto :goto_0

    .line 117
    .end local v0           #device:Landroid/net/wifi/p2p/WifiP2pDevice;
    :cond_0
    return-void
.end method


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//
// ZapReadyToRun.cpp
//

//
// Zapping of ready-to-run specific structures
//
// ======================================================================================

#include "common.h"

#include "zapreadytorun.h"

#include "zapimport.h"

#include "nativeformatwriter.h"

#include "nibblestream.h"

using namespace NativeFormat;

void ZapReadyToRunHeader::Save(ZapWriter * pZapWriter)
{
    ZapImage * pImage = ZapImage::GetImage(pZapWriter);

    READYTORUN_HEADER readyToRunHeader;

    ZeroMemory(&readyToRunHeader, sizeof(readyToRunHeader));

    readyToRunHeader.Signature = READYTORUN_SIGNATURE;
    readyToRunHeader.MajorVersion = READYTORUN_MAJOR_VERSION;
    readyToRunHeader.MinorVersion = READYTORUN_MINOR_VERSION;

    if (pImage->m_ModuleDecoder.IsPlatformNeutral())
        readyToRunHeader.Flags |= READYTORUN_FLAG_PLATFORM_NEUTRAL_SOURCE;

    // If all types loaded succesfully, set a flag to skip type loading sanity checks at runtime
    if (pImage->GetCompileInfo()->AreAllClassesFullyLoaded(pImage->GetModuleHandle()))
        readyToRunHeader.Flags |= READYTORUN_FLAG_SKIP_TYPE_VALIDATION;

    readyToRunHeader.NumberOfSections = m_Sections.GetCount();

    pZapWriter->Write(&readyToRunHeader, sizeof(readyToRunHeader));

    qsort(&m_Sections[0], m_Sections.GetCount(), sizeof(Section), SectionCmp);

    for(COUNT_T i = 0; i < m_Sections.GetCount(); i++)
    {
        READYTORUN_SECTION section;
        section.Type = m_Sections[i].type;
        ZapWriter::SetDirectoryData(&section.Section, m_Sections[i].pSection);
        pZapWriter->Write(&section, sizeof(section));
    }
}

class BlobVertex : public NativeFormat::Vertex
{
    int m_cbSize;

public:
    BlobVertex(int cbSize)
        : m_cbSize(cbSize)
    {
    }

    void * GetData()
    {
        return this + 1;
    }

    int GetSize()
    {
        return m_cbSize;
    }

    virtual void Save(NativeWriter * pWriter)
    {
        byte * pData = (byte *)GetData();
        for (int i = 0; i < m_cbSize; i++)
            pWriter->WriteByte(pData[i]);
    }
};

class BlobVertexKey
{
    PVOID   _pData;
    int     _cbSize;

public:
    BlobVertexKey(PVOID pData, int cbSize)
        : _pData(pData), _cbSize(cbSize)
    {
    }

    void * GetData()
    {
        return _pData;
    }

    int GetSize()
    {
        return _cbSize;
    }
};

class BlobVertexSHashTraits : public DefaultSHashTraits<BlobVertex *>
{
public:
    typedef BlobVertexKey key_t;

    static key_t GetKey(element_t e)
    {
        LIMITED_METHOD_CONTRACT;
        return key_t(e->GetData(), e->GetSize());
    }
    static BOOL Equals(key_t k1, key_t k2)
    {
        LIMITED_METHOD_CONTRACT;
        if (k1.GetSize() != k2.GetSize())
            return FALSE;
        return memcmp(k1.GetData(), k2.GetData(), k1.GetSize()) == 0;
    }
    static count_t Hash(key_t k)
    {
        LIMITED_METHOD_CONTRACT;
        count_t hash = 5381 + (count_t)(k.GetSize() << 7);

        PBYTE pbData = (PBYTE)k.GetData();
        PBYTE pbDataEnd = pbData + k.GetSize();

        for (/**/ ; pbData < pbDataEnd; pbData++)
        {
            hash = ((hash << 5) + hash) ^ *pbData;
        }
        return hash;
    }
};

class EntryPointVertex : public NativeFormat::Vertex
{
    DWORD m_methodIndex;
    BlobVertex * m_pFixups;

public:
    EntryPointVertex(DWORD methodIndex, BlobVertex * pFixups)
        : m_methodIndex(methodIndex), m_pFixups(pFixups)
    {
    }

    virtual void Save(NativeWriter * pWriter)
    {
        if (m_pFixups != NULL)
        {
            int existingOffset = pWriter->GetCurrentOffset(m_pFixups);
            if (existingOffset != -1)
            {
                pWriter->WriteUnsigned((m_methodIndex << 2) | 3);
                pWriter->WriteUnsigned(pWriter->GetCurrentOffset() - existingOffset);
            }
            else
            {
                pWriter->WriteUnsigned((m_methodIndex << 2) | 1);
                pWriter->SetCurrentOffset(m_pFixups);
                m_pFixups->Save(pWriter);
            }
        }
        else
        {
            pWriter->WriteUnsigned(m_methodIndex << 1);
        }
    }
};

void ZapImage::OutputEntrypointsTableForReadyToRun()
{
    BeginRegion(CORINFO_REGION_COLD);

    NativeWriter writer;

    NativeSection * pSection = writer.NewSection();

    VertexArray vertexArray(pSection);
    pSection->Place(&vertexArray);

    bool fEmpty = true;

    SHash< NoRemoveSHashTraits < BlobVertexSHashTraits > > fixupBlobs;

    COUNT_T nCount = m_MethodCompilationOrder.GetCount();
    for (COUNT_T i = 0; i < nCount; i++)
    {
        ZapMethodHeader * pMethod = m_MethodCompilationOrder[i];

        mdMethodDef token = GetJitInfo()->getMethodDefFromMethod(pMethod->GetHandle());

        int rid = RidFromToken(token);
        _ASSERTE(rid != 0);

        BlobVertex * pFixupBlob = NULL;

        if (pMethod->m_pFixupList != NULL)
        {
            NibbleWriter writer;
            m_pImportTable->PlaceFixups(pMethod->m_pFixupList, writer);

            DWORD cbBlob;
            PVOID pBlob = writer.GetBlob(&cbBlob);

            pFixupBlob = fixupBlobs.Lookup(BlobVertexKey(pBlob, cbBlob));
            if (pFixupBlob == NULL)
            {
                void * pMemory = new (GetHeap()) BYTE[sizeof(BlobVertex) + cbBlob];
                pFixupBlob = new (pMemory) BlobVertex(cbBlob);
                memcpy(pFixupBlob->GetData(), pBlob, cbBlob);

                fixupBlobs.Add(pFixupBlob);
            }
        }

        vertexArray.Set(rid - 1, new (GetHeap()) EntryPointVertex(pMethod->GetMethodIndex(), pFixupBlob));

        fEmpty = false;
    }

    if (fEmpty)
        return;

    vertexArray.ExpandLayout();

    vector<byte>& blob = writer.Save();

    ZapNode * pBlob = ZapBlob::NewBlob(this, &blob[0], blob.size());
    m_pCodeMethodDescsSection->Place(pBlob);

    ZapReadyToRunHeader * pReadyToRunHeader = GetReadyToRunHeader();
    pReadyToRunHeader->RegisterSection(READYTORUN_SECTION_METHODDEF_ENTRYPOINTS, pBlob);
    pReadyToRunHeader->RegisterSection(READYTORUN_SECTION_RUNTIME_FUNCTIONS, m_pRuntimeFunctionSection);

    if (m_pImportSectionsTable->GetSize() != 0)
        pReadyToRunHeader->RegisterSection(READYTORUN_SECTION_IMPORT_SECTIONS, m_pImportSectionsTable);

    if (m_pLazyMethodCallHelperSection->GetNodeCount() != 0)
        pReadyToRunHeader->RegisterSection(READYTORUN_SECTION_DELAYLOAD_METHODCALL_THUNKS, m_pLazyMethodCallHelperSection);

    if (m_pExceptionInfoLookupTable->GetSize() != 0)
        pReadyToRunHeader->RegisterSection(READYTORUN_SECTION_EXCEPTION_INFO, m_pExceptionInfoLookupTable);

    EndRegion(CORINFO_REGION_COLD);
}

class DebugInfoVertex : public NativeFormat::Vertex
{
    BlobVertex * m_pDebugInfo;

public:
    DebugInfoVertex(BlobVertex * pDebugInfo)
        : m_pDebugInfo(pDebugInfo)
    {
    }

    virtual void Save(NativeWriter * pWriter)
    {
        int existingOffset = pWriter->GetCurrentOffset(m_pDebugInfo);
        if (existingOffset != -1)
        {
            _ASSERTE(pWriter->GetCurrentOffset() > existingOffset);
            pWriter->WriteUnsigned(pWriter->GetCurrentOffset() - existingOffset);
        }
        else
        {
            pWriter->WriteUnsigned(0);
            pWriter->SetCurrentOffset(m_pDebugInfo);
            m_pDebugInfo->Save(pWriter);
        }
    }
};

void ZapImage::OutputDebugInfoForReadyToRun()
{
    NativeWriter writer;

    NativeSection * pSection = writer.NewSection();

    VertexArray vertexArray(pSection);
    pSection->Place(&vertexArray);

    bool fEmpty = true;

    SHash< NoRemoveSHashTraits < BlobVertexSHashTraits > > debugInfoBlobs;

    COUNT_T nCount = m_MethodCompilationOrder.GetCount();
    for (COUNT_T i = 0; i < nCount; i++)
    {
        ZapMethodHeader * pMethod = m_MethodCompilationOrder[i];

        ZapBlob * pDebugInfo = pMethod->GetDebugInfo();
        if (pDebugInfo == NULL)
            continue;

        DWORD cbBlob = pDebugInfo->GetBlobSize();
        PVOID pBlob = pDebugInfo->GetData();

        BlobVertex * pDebugInfoBlob = debugInfoBlobs.Lookup(BlobVertexKey(pBlob, cbBlob));
        if (pDebugInfoBlob == NULL)
        {
            void * pMemory = new (GetHeap()) BYTE[sizeof(BlobVertex) + cbBlob];
            pDebugInfoBlob = new (pMemory) BlobVertex(cbBlob);
            memcpy(pDebugInfoBlob->GetData(), pBlob, cbBlob);

            debugInfoBlobs.Add(pDebugInfoBlob);
        }

        vertexArray.Set(pMethod->GetMethodIndex(), new (GetHeap()) DebugInfoVertex(pDebugInfoBlob));

        fEmpty = false;
    }

    if (fEmpty)
        return;

    vertexArray.ExpandLayout();

    vector<byte>& blob = writer.Save();

    ZapNode * pBlob = ZapBlob::NewBlob(this, &blob[0], blob.size());
    m_pDebugSection->Place(pBlob);

    GetReadyToRunHeader()->RegisterSection(READYTORUN_SECTION_DEBUG_INFO, pBlob);
}

void ZapImage::OutputTypesTableForReadyToRun(IMDInternalImport * pMDImport)
{
    NativeWriter writer;
    VertexHashtable typesHashtable;

    NativeSection * pSection = writer.NewSection();
    pSection->Place(&typesHashtable);

    // Note on duplicate types with same name: there is not need to perform that check when building
    // the hashtable. If such types were encountered, the R2R compilation would fail before reaching here.

    LPCUTF8 pszName;
    LPCUTF8 pszNameSpace;

    // Save the TypeDefs to the hashtable
    {
        HENUMInternalHolder hEnum(pMDImport);
        hEnum.EnumAllInit(mdtTypeDef);

        mdToken mdTypeToken;
        while (pMDImport->EnumNext(&hEnum, &mdTypeToken))
        {
            DWORD dwHash = 0;
            mdTypeDef mdCurrentToken = mdTypeToken;

            do
            {
                if (FAILED(pMDImport->GetNameOfTypeDef(mdCurrentToken, &pszName, &pszNameSpace)))
                    ThrowHR(COR_E_BADIMAGEFORMAT);

                dwHash = ((dwHash << 5) + dwHash) ^ HashStringA(pszName);
                dwHash = ((dwHash << 5) + dwHash) ^ HashStringA(pszNameSpace == NULL ? "" : pszNameSpace);

            } while (SUCCEEDED(pMDImport->GetNestedClassProps(mdCurrentToken, &mdCurrentToken)));

            typesHashtable.Append(dwHash, pSection->Place(new UnsignedConstant(RidFromToken(mdTypeToken) << 1)));
        }
    }

    // Save the ExportedTypes to the hashtable
    {
        HENUMInternalHolder hEnum(pMDImport);
        hEnum.EnumInit(mdtExportedType, mdTokenNil);

        mdToken mdTypeToken;
        while (pMDImport->EnumNext(&hEnum, &mdTypeToken))
        {
            DWORD dwHash = 0;
            mdTypeDef mdCurrentToken = mdTypeToken;

            do
            {
                if (FAILED(pMDImport->GetExportedTypeProps(mdCurrentToken, &pszNameSpace, &pszName, &mdCurrentToken, NULL, NULL)))
                    ThrowHR(COR_E_BADIMAGEFORMAT);

                dwHash = ((dwHash << 5) + dwHash) ^ HashStringA(pszName);
                dwHash = ((dwHash << 5) + dwHash) ^ HashStringA(pszNameSpace == NULL ? "" : pszNameSpace);

            } while (TypeFromToken(mdCurrentToken) == mdtExportedType);

            typesHashtable.Append(dwHash, pSection->Place(new UnsignedConstant((RidFromToken(mdTypeToken) << 1) | 1)));
        }
    }

    vector<byte>& blob = writer.Save();

    ZapNode * pBlob = ZapBlob::NewBlob(this, &blob[0], blob.size());
    _ASSERTE(m_pAvailableTypesSection);
    m_pAvailableTypesSection->Place(pBlob);

    GetReadyToRunHeader()->RegisterSection(READYTORUN_SECTION_AVAILABLE_TYPES, pBlob);
}

//
// Verify that data structures and flags shared between NGen and ReadyToRun are in sync
//

//
// READYTORUN_IMPORT_SECTION
//
static_assert_no_msg(sizeof(READYTORUN_IMPORT_SECTION)          == sizeof(CORCOMPILE_IMPORT_SECTION));

static_assert_no_msg((int)READYTORUN_IMPORT_SECTION_TYPE_UNKNOWN     == (int)CORCOMPILE_IMPORT_TYPE_UNKNOWN);

static_assert_no_msg((int)READYTORUN_IMPORT_SECTION_FLAGS_EAGER      == (int)CORCOMPILE_IMPORT_FLAGS_EAGER);

//
// READYTORUN_METHOD_SIG
//
static_assert_no_msg((int)READYTORUN_METHOD_SIG_UnboxingStub         == (int)ENCODE_METHOD_SIG_UnboxingStub);
static_assert_no_msg((int)READYTORUN_METHOD_SIG_InstantiatingStub    == (int)ENCODE_METHOD_SIG_InstantiatingStub);
static_assert_no_msg((int)READYTORUN_METHOD_SIG_MethodInstantiation  == (int)ENCODE_METHOD_SIG_MethodInstantiation);
static_assert_no_msg((int)READYTORUN_METHOD_SIG_SlotInsteadOfToken   == (int)ENCODE_METHOD_SIG_SlotInsteadOfToken);
static_assert_no_msg((int)READYTORUN_METHOD_SIG_MemberRefToken       == (int)ENCODE_METHOD_SIG_MemberRefToken);
static_assert_no_msg((int)READYTORUN_METHOD_SIG_Constrained          == (int)ENCODE_METHOD_SIG_Constrained);
static_assert_no_msg((int)READYTORUN_METHOD_SIG_OwnerType            == (int)ENCODE_METHOD_SIG_OwnerType);

//
// READYTORUN_FIELD_SIG
//
static_assert_no_msg((int)READYTORUN_FIELD_SIG_IndexInsteadOfToken   == (int)ENCODE_FIELD_SIG_IndexInsteadOfToken);
static_assert_no_msg((int)READYTORUN_FIELD_SIG_MemberRefToken        == (int)ENCODE_FIELD_SIG_MemberRefToken);
static_assert_no_msg((int)READYTORUN_FIELD_SIG_OwnerType             == (int)ENCODE_FIELD_SIG_OwnerType);

//
// READYTORUN_FIXUP
//
static_assert_no_msg((int)READYTORUN_FIXUP_TypeHandle                == (int)ENCODE_TYPE_HANDLE);
static_assert_no_msg((int)READYTORUN_FIXUP_MethodHandle              == (int)ENCODE_METHOD_HANDLE);
static_assert_no_msg((int)READYTORUN_FIXUP_FieldHandle               == (int)ENCODE_FIELD_HANDLE);

static_assert_no_msg((int)READYTORUN_FIXUP_MethodEntry               == (int)ENCODE_METHOD_ENTRY);
static_assert_no_msg((int)READYTORUN_FIXUP_MethodEntry_DefToken      == (int)ENCODE_METHOD_ENTRY_DEF_TOKEN);
static_assert_no_msg((int)READYTORUN_FIXUP_MethodEntry_RefToken      == (int)ENCODE_METHOD_ENTRY_REF_TOKEN);

static_assert_no_msg((int)READYTORUN_FIXUP_VirtualEntry              == (int)ENCODE_VIRTUAL_ENTRY);
static_assert_no_msg((int)READYTORUN_FIXUP_VirtualEntry_DefToken     == (int)ENCODE_VIRTUAL_ENTRY_DEF_TOKEN);
static_assert_no_msg((int)READYTORUN_FIXUP_VirtualEntry_RefToken     == (int)ENCODE_VIRTUAL_ENTRY_REF_TOKEN);
static_assert_no_msg((int)READYTORUN_FIXUP_VirtualEntry_Slot         == (int)ENCODE_VIRTUAL_ENTRY_SLOT);

static_assert_no_msg((int)READYTORUN_FIXUP_Helper                    == (int)ENCODE_READYTORUN_HELPER);
static_assert_no_msg((int)READYTORUN_FIXUP_StringHandle              == (int)ENCODE_STRING_HANDLE);

static_assert_no_msg((int)READYTORUN_FIXUP_NewObject                  == (int)ENCODE_NEW_HELPER);
static_assert_no_msg((int)READYTORUN_FIXUP_NewArray                   == (int)ENCODE_NEW_ARRAY_HELPER);

static_assert_no_msg((int)READYTORUN_FIXUP_IsInstanceOf               == (int)ENCODE_ISINSTANCEOF_HELPER);
static_assert_no_msg((int)READYTORUN_FIXUP_ChkCast                    == (int)ENCODE_CHKCAST_HELPER);

static_assert_no_msg((int)READYTORUN_FIXUP_FieldAddress               == (int)ENCODE_FIELD_ADDRESS);
static_assert_no_msg((int)READYTORUN_FIXUP_CctorTrigger               == (int)ENCODE_CCTOR_TRIGGER);

static_assert_no_msg((int)READYTORUN_FIXUP_StaticBaseNonGC            == (int)ENCODE_STATIC_BASE_NONGC_HELPER);
static_assert_no_msg((int)READYTORUN_FIXUP_StaticBaseGC               == (int)ENCODE_STATIC_BASE_GC_HELPER);
static_assert_no_msg((int)READYTORUN_FIXUP_ThreadStaticBaseNonGC      == (int)ENCODE_THREAD_STATIC_BASE_NONGC_HELPER);
static_assert_no_msg((int)READYTORUN_FIXUP_ThreadStaticBaseGC         == (int)ENCODE_THREAD_STATIC_BASE_GC_HELPER);

static_assert_no_msg((int)READYTORUN_FIXUP_FieldBaseOffset            == (int)ENCODE_FIELD_BASE_OFFSET);
static_assert_no_msg((int)READYTORUN_FIXUP_FieldOffset                == (int)ENCODE_FIELD_OFFSET);

static_assert_no_msg((int)READYTORUN_FIXUP_TypeDictionary             == (int)ENCODE_TYPE_DICTIONARY);
static_assert_no_msg((int)READYTORUN_FIXUP_MethodDictionary           == (int)ENCODE_METHOD_DICTIONARY);

static_assert_no_msg((int)READYTORUN_FIXUP_Check_TypeLayout           == (int)ENCODE_CHECK_TYPE_LAYOUT);
static_assert_no_msg((int)READYTORUN_FIXUP_Check_FieldOffset          == (int)ENCODE_CHECK_FIELD_OFFSET);

static_assert_no_msg((int)READYTORUN_FIXUP_DelegateCtor               == (int)ENCODE_DELEGATE_CTOR);

//
// READYTORUN_EXCEPTION
//
static_assert_no_msg(sizeof(READYTORUN_EXCEPTION_LOOKUP_TABLE_ENTRY) == sizeof(CORCOMPILE_EXCEPTION_LOOKUP_TABLE_ENTRY));
static_assert_no_msg(sizeof(READYTORUN_EXCEPTION_CLAUSE) == sizeof(CORCOMPILE_EXCEPTION_CLAUSE));


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GDBusObjectSkeleton: GIO Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GIO Reference Manual">
<link rel="up" href="gdbus-convenience.html" title="High-level D-Bus Support">
<link rel="prev" href="GDBusObject.html" title="GDBusObject">
<link rel="next" href="GDBusObjectProxy.html" title="GDBusObjectProxy">
<meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">

Top  |
                  Description  |
                  Object Hierarchy  |
                  Implemented Interfaces  |
                  Properties  |
                  Signals

GDBusObjectSkeleton

GDBusObjectSkeleton — Service-side D-Bus object

Functions

<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>

GDBusObjectSkeleton *

g_dbus_object_skeleton_new ()

void

g_dbus_object_skeleton_flush ()

void

g_dbus_object_skeleton_add_interface ()

void

g_dbus_object_skeleton_remove_interface ()

void

g_dbus_object_skeleton_remove_interface_by_name ()

void

g_dbus_object_skeleton_set_object_path ()

Properties

<colgroup>
<col width="150px" class="properties_type">
<col width="300px" class="properties_name">
<col width="200px" class="properties_flags">
</colgroup>

gchar *
g-object-path
Read / Write / Construct

Signals

<colgroup>
<col width="150px" class="signals_return">
<col width="300px" class="signals_name">
<col width="200px" class="signals_flags">
</colgroup>

gboolean
authorize-method
Run Last

Types and Values

<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>

GDBusObjectSkeleton

struct
GDBusObjectSkeletonClass

Object Hierarchy

    GObject
    ╰── GDBusObjectSkeleton

Implemented Interfaces

GDBusObjectSkeleton implements
 GDBusObject.

Includes

#include <gio/gio.h>

Description

A GDBusObjectSkeleton instance is essentially a group of D-Bus
interfaces. The set of exported interfaces on the object may be
dynamic and change at runtime.

This type is intended to be used with GDBusObjectManager.

Functions

g_dbus_object_skeleton_new ()

GDBusObjectSkeleton *
g_dbus_object_skeleton_new (const gchar *object_path);

Creates a new GDBusObjectSkeleton.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

object_path

An object path.

Returns

 A GDBusObjectSkeleton. Free with g_object_unref().

Since: 2.30

g_dbus_object_skeleton_flush ()

void
g_dbus_object_skeleton_flush (GDBusObjectSkeleton *object);

This method simply calls g_dbus_interface_skeleton_flush() on all
interfaces belonging to object
. See that method for when flushing
is useful.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

object

A GDBusObjectSkeleton.

Since: 2.30

g_dbus_object_skeleton_add_interface ()

void
g_dbus_object_skeleton_add_interface (GDBusObjectSkeleton *object,
                                      GDBusInterfaceSkeleton *interface_);

Adds interface_
 to object
.

If object
 already contains a GDBusInterfaceSkeleton with the same
interface name, it is removed before interface_
 is added.

Note that object
 takes its own reference on interface_
 and holds
it until removed.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

object

A GDBusObjectSkeleton.

interface_

A GDBusInterfaceSkeleton.

Since: 2.30

g_dbus_object_skeleton_remove_interface ()

void
g_dbus_object_skeleton_remove_interface
                               (GDBusObjectSkeleton *object,
                                GDBusInterfaceSkeleton *interface_);

Removes interface_
 from object
.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

object

A GDBusObjectSkeleton.

interface_

A GDBusInterfaceSkeleton.

Since: 2.30

g_dbus_object_skeleton_remove_interface_by_name ()

void
g_dbus_object_skeleton_remove_interface_by_name
                               (GDBusObjectSkeleton *object,
                                const gchar *interface_name);

Removes the GDBusInterface with interface_name
 from object
.

If no D-Bus interface of the given interface exists, this function
does nothing.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

object

A GDBusObjectSkeleton.

interface_name

A D-Bus interface name.

Since: 2.30

g_dbus_object_skeleton_set_object_path ()

void
g_dbus_object_skeleton_set_object_path
                               (GDBusObjectSkeleton *object,
                                const gchar *object_path);

Sets the object path for object
.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

object

A GDBusObjectSkeleton.

object_path

A valid D-Bus object path.

Since: 2.30

Types and Values

GDBusObjectSkeleton

typedef struct _GDBusObjectSkeleton GDBusObjectSkeleton;

The GDBusObjectSkeleton structure contains private data and should only be
accessed using the provided API.

Since: 2.30

struct GDBusObjectSkeletonClass

struct GDBusObjectSkeletonClass {
  GObjectClass parent_class;

  /* Signals */
  gboolean (*authorize_method) (GDBusObjectSkeleton       *object,
                                GDBusInterfaceSkeleton    *interface_,
                                GDBusMethodInvocation *invocation);
};

Class structure for GDBusObjectSkeleton.

Members

<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>

authorize_method ()

Signal class handler for the "authorize-method" signal.

Since: 2.30

Property Details

The "g-object-path" property

  "g-object-path"            gchar *

The object path where the object is exported.

Flags: Read / Write / Construct

Default value: NULL

Since: 2.30

Signal Details

The "authorize-method" signal

gboolean
user_function (GDBusObjectSkeleton    *object,
               GDBusInterfaceSkeleton *interface,
               GDBusMethodInvocation  *invocation,
               gpointer                user_data)

Emitted when a method is invoked by a remote caller and used to
determine if the method call is authorized.

This signal is like GDBusInterfaceSkeleton's
"g-authorize-method" signal,
except that it is for the enclosing object.

The default class handler just returns TRUE.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

object

The GDBusObjectSkeleton emitting the signal.

interface

The GDBusInterfaceSkeleton that invocation
is for.

invocation

A GDBusMethodInvocation.

user_data

user data set when the signal handler was connected.

Returns

 TRUE if the call is authorized, FALSE otherwise.

Flags: Run Last

Since: 2.30

Generated by GTK-Doc V1.25.1


text:
driveplayer
===========

Google Drive API based music player


text:
using System;
namespace PocLib
{
    public class Decorator
    {
        public Decorator()
        {
        }
        internal static void Start()
        {
            Human s = new SuperHuman();
            Human x = new XMan();
            GainBuff gs = new GainBuff(s);
            GainBuff gx = new GainBuff(x);
		    gs.SuperPower();
            gx.SuperPower();

		}
    }
    public abstract class Human
    {
		public abstract string SuperPower();

	}
    /// <summary>
    /// Abstract class still inherits from another abstract class
    /// </summary>
    public class SuperHuman : Human
    {
        public override string SuperPower()
        {
			return "Fly";
        }
    }
    public class XMan : Human
    {
        public override string SuperPower()
        {
            return "Mind Control";
        }
    }
    /// <summary>
    /// 裝飾者幫實體加功能!
    /// </summary>
    public class GainBuff : Human
    {
        string se;
        public GainBuff(Human _human)
        {
            se = _human.SuperPower();
        }
        public override string SuperPower()
        {
            string str = $"Buff + {se}";
            Console.WriteLine(str);
            return str;
        }
    }
}


text:
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            Toggle navigation

          </button>
          AVNA

Home

About

Articles

            {% if session.logged_in %}

Dashboard

Logout

            {% else %}

Register

Login

            {% endif %}


text:
<resources>
    <string name="app_name">ffmpeg.excutor.library</string>
    <string name="shipped_ffmpeg_version">n2.4.2</string>
</resources>


text:
if begin
     try
       import FactCheck
       true
     catch
      false
     end
   end

  export using_fixtures

  immutable ApplyFixturesFlag end
  const using_fixtures = ApplyFixturesFlag()

  import FactCheck.facts
  facts(fn::Function, applyfixtures::ApplyFixturesFlag; fixture_values=false) = facts(fn, nothing, applyfixtures, fixture_values=fixture_values)
  facts(fn::Function, desc, applyfixtures::ApplyFixturesFlag; fixture_values=false) = apply_fixtures((args::Any...)->facts(( () -> fn(args...) ), desc), :facts, fixture_values=fixture_values)

  import FactCheck.context
  context(fn::Function, applyfixtures::ApplyFixturesFlag; fixture_values=false) = apply_fixtures((args::Any...)->context(( () -> fn(args...) )), :context, fixture_values=fixture_values)
  context(fn::Function, desc, applyfixtures::ApplyFixturesFlag; fixture_values=false) = apply_fixtures((args::Any...)->context(( () -> fn(args...) ), desc), :context, fixture_values=fixture_values)
end


text:
using System;
using System.Text;
using System.Data.Common;
using System.Data.Linq;
using System.Data.Entity;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Runtime.Serialization;
using System.Configuration;
using System.ServiceModel;
using System.IO;
using System.Linq;
using System.ComponentModel;
using System.Reflection;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.Linq;

using Hydra.Framework;
using Hydra.Framework.Java;
using Hydra.Framework.Helpers;
using Hydra.Framework.Cryptographics;
using Hydra.Framework.Mapping.CoordinateSystems;
using Hydra.Framework.Collections;
using Hydra.Framework.Conversions;
using DomainModel = Hydra.DomainModel;
using Hydra.DomainStatus;
using Hydra.Data.Model;
using Hydra.Data.RepositoryInterfaces;
using Hydra.Domain.Mapping;
using Hydra.SqlRepository;
using Hydra.SqlRepository.EntityConfiguration;
using Hydra.ServiceContracts;

namespace Hydra.Services
{
    //
    //**********************************************************************
    /// <summary>
    /// RoleExtension Business Service
    /// </summary>
    //**********************************************************************
    //
    [Serializable]
    [DataContract(Namespace = "http://www.Hydra.com/BusinessServices")]
    public class RoleExtensionService
        : IRoleExtensionService
    {
        #region Member Variables
        /// <summary>
        /// Gets or sets the role repository.
        /// </summary>
        /// <value>The role repository.</value>
        public IRepository<Hydra.Data.Model.RoleExtension> Repository
        {
            get;
            private set;
        }

        /// <summary>
        /// RoleExtension Mapper
        /// </summary>
        private RoleExtensionMapping mapper = new RoleExtensionMapping();
        #endregion

        #region Constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="OrganisationService"/> class.
        /// </summary>
        /// <param name="repository">The repository I want the orgainsation manager to support.</param>
        public RoleExtensionService(IRepository<Hydra.Data.Model.RoleExtension> repository)
            : base()
        {
            try
            {
                // Create AccountRepository Reference
                Repository = repository;
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }
        }
        #endregion

        #region Properties
        #endregion

        #region Private Methods
        /// <summary>
        /// Performs the date validation.
        /// </summary>
        /// <param name="role">The role.</param>
        private void PerformDateValidation(DomainModel.InternalRoleExtension role)
        {
            try
            {
                if (role.ChangedOn != null &&
                    role.ChangedOn.Equals(DateTime.MinValue))
                    role.ChangedOn = DateTime.Now;
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }
        }

        /// <summary>
        /// Performs the mandatory validation.
        /// </summary>
        /// <param name="role">The role.</param>
        private void PerformMandatoryValidation(DomainModel.InternalRoleExtension role)
        {
            try
            {
                if (role.ID.Equals(-1))
                    throw new MandatoryDataValidationException("Internal Validation Error processing Mandatory Attribute", "ID");

                if (string.IsNullOrEmpty(role.Name))
                    throw new MandatoryDataValidationException("Internal Validation Error processing Mandatory Attribute", "RoleName");
            }
            catch (MandatoryDataValidationException me)
            {
                CacheUtil.ReportException(me);
                throw me;
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }
        }
        #endregion

        #region Public Methods
        /// <summary>
        /// Sets the role repository.
        /// </summary>
        /// <param name="repository">The role repository.</param>
        public void SetRepository(IRepository<Hydra.Data.Model.RoleExtension> repository)
        {
            Repository = repository;
        }

        /// <summary>
        /// Updates the role.
        /// </summary>
        /// <param name="role">The role.</param>
        public void Update(DomainModel.InternalRoleExtension role)
        {
            try
            {
                PerformDateValidation(role);
                PerformMandatoryValidation(role);

                Repository.Update(mapper.MapDomainEntityToDataEntity(role));
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }
        }

        /// <summary>
        /// Adds the role.
        /// </summary>
        /// <param name="role">The role.</param>
        public void Add(ref DomainModel.InternalRoleExtension role)
        {
            int maxRecords = -1;

            try
            {
                PerformDateValidation(role);
                PerformMandatoryValidation(role);

                RoleExtension newRole = Repository.Add(mapper.MapDomainEntityToDataEntity(role));

                // Retrieve Count
                maxRecords = Repository.Count;

                // Translate to new role
                role = mapper.MapDataEntityToDomainEntity(newRole);
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }
        }

        /// <summary>
        /// Adds the permission.
        /// </summary>
        /// <param name="role">The role.</param>
        /// <param name="permission">The permission.</param>
        /// <param name="service">The service.</param>
        /// <returns></returns>
        public DomainModel.AssociateRolePermission AddPermission(DomainModel.InternalRoleExtension role, DomainModel.InternalPermission permission, IRolePermissionService service)
        {
            DomainModel.AssociateRolePermission item = null;

            try
            {
                // Assume the role and permission are consistent and valid
                if (role != null &&
                    permission != null)
                {
                    if (!service.DoesExist(role.ID, permission.ID))
                    {
                        item = new DomainModel.AssociateRolePermission(1, permission.ID, role.ID);
                        service.Add(ref item);
                    }
                }
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }

            return item;
        }

        /// <summary>
        /// Deletes the permission.
        /// </summary>
        /// <param name="rolePermission">The permission.</param>
        /// <param name="service">The service.</param>
        public void DeletePermission(DomainModel.AssociateRolePermission rolePermission, IRolePermissionService service)
        {
            try
            {
                // Assume the role and permission are consistent and valid
                if (rolePermission != null)
                {
                    if (service.DoesExist(rolePermission.RoleExtensionId, rolePermission.PermissionId))
                        service.Delete(rolePermission);
                }
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }
        }

        /// <summary>
        /// Deletes the role and associations.
        /// </summary>
        /// <param name="role">The role.</param>
        public void Delete(DomainModel.InternalRoleExtension role)
        {
            try
            {
                // TODO: Add RoleExtension Permission Association
                Repository.Delete(role.ID);
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }
        }

        /// <summary>
        /// Deletes the specified role.
        /// </summary>
        /// <param name="role">The role.</param>
        /// <param name="service">The service.</param>
        public void Delete(DomainModel.InternalRoleExtension role, IRolePermissionService service)
        {
            try
            {
                // Remove permission associations from the role first
                service.ListOfPermissionsForRole(role.ID).ForEach(item => service.Delete(item));

                Delete(role);
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }
        }

        /// <summary>
        /// Gets the specified organisation
        /// </summary>
        /// <param name="id">The organisation id.</param>
        /// <returns></returns>
        public DomainModel.InternalRoleExtension Get(int id)
        {
            DomainModel.InternalRoleExtension role = null;

            try
            {
                role = mapper.MapDataEntityToDomainEntity(Repository.GetById(id));
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }

            return role;
        }

        /// <summary>
        /// Gets the specified role name.
        /// </summary>
        /// <param name="roleName">Name of the role.</param>
        /// <returns></returns>
        public DomainModel.InternalRoleExtension GetRole(string roleName)
        {
            DomainModel.InternalRoleExtension result = null;

            try
            {
                var q = from c in Repository.GetAll.ToList<RoleExtension>()
                        orderby c.OrganisationID, c.Name
                        select c;

                result = mapper.MapDataEntityToDomainEntity(q.First());
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }

            return result;
        }

        /// <summary>
        /// Does the item Exist in the repository
        /// </summary>
        /// <param name="id">The item id.</param>
        /// <returns>Boolean, true if exists</returns>
        public bool Exists(int id)
        {
            bool result = false;

            try
            {
                result = (id > 0 && Repository.GetById(id) != null);
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }

            return result;
        }

        /// <summary>
        /// Find the Maximum Number of objects currently in persisted cache.
        /// </summary>
        /// <returns>Max Number of items</returns>
        public int MaxID()
        {
            return (from c in Repository.GetAll.ToList<RoleExtension>()
                    orderby c.OrganisationID, c.Name
                    select c.ID).Max();
        }

        /// <summary>
        /// AccountList of RoleExtensions
        /// </summary>
        /// <returns></returns>
        public List<DomainModel.InternalRoleExtension> List()
        {
            List<DomainModel.InternalRoleExtension> myList = new System.Collections.Generic.List<DomainModel.InternalRoleExtension>();

            try
            {
                var q = from c in Repository.GetAll.ToList<RoleExtension>()
                        orderby c.OrganisationID, c.Name
                        select c;

                foreach (RoleExtension role in q)
                    myList.Add(mapper.MapDataEntityToDomainEntity(role));
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }

            return myList;
        }

        /// <summary>
        /// AccountList of RoleExtensions for an organisation
        /// </summary>
        /// <param name="organisationId">The organisation id.</param>
        /// <returns></returns>
        public List<DomainModel.InternalRoleExtension> List(int organisationId)
        {
            List<DomainModel.InternalRoleExtension> myList = new System.Collections.Generic.List<DomainModel.InternalRoleExtension>();

            try
            {
                var q = from c in Repository.GetAll.ToList<RoleExtension>()
                        where c.OrganisationID.Equals(organisationId)
                        orderby c.Name
                        select c;

                foreach (RoleExtension role in q)
                    myList.Add(mapper.MapDataEntityToDomainEntity(role));
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }

            return myList;
        }

        /// <summary>
        /// AccountList of RoleExtensions for an organisation
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns></returns>
        public List<DomainModel.InternalRoleExtension> List(DomainModel.RoleType type)
        {
            List<DomainModel.InternalRoleExtension> myList = new System.Collections.Generic.List<DomainModel.InternalRoleExtension>();

            try
            {
                var q = from c in Repository.GetAll.ToList<RoleExtension>()
                        where c.Type.Equals((int)type)
                        orderby c.Name
                        select c;

                foreach (RoleExtension role in q)
                    myList.Add(mapper.MapDataEntityToDomainEntity(role));
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }

            return myList;
        }

        /// <summary>
        /// AccountList of RoleExtensions for an organisation
        /// </summary>
        /// <param name="organisationId">The organisation id.</param>
        /// <param name="type">The type.</param>
        /// <returns></returns>
        public List<DomainModel.InternalRoleExtension> List(int organisationId, DomainModel.RoleType type)
        {
            List<DomainModel.InternalRoleExtension> myList = new System.Collections.Generic.List<DomainModel.InternalRoleExtension>();

            try
            {
                var q = from c in Repository.GetAll.ToList<RoleExtension>()
                        where c.OrganisationID.Equals(organisationId) &&
                              c.Type.Equals((int)type)
                        orderby c.Name
                        select c;

                foreach (RoleExtension role in q)
                    myList.Add(mapper.MapDataEntityToDomainEntity(role));
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }

            return myList;
        }

        /// <summary>
        /// Builds the RoleExtension cache list from database.
        /// </summary>
        /// <returns>A new RoleExtension Dictionary</returns>
        public Dictionary<int, DomainModel.InternalRoleExtension> BuildCacheListFromDatabase()
        {
            Dictionary<int, DomainModel.InternalRoleExtension> tree = null;

            try
            {
                tree = new System.Collections.Generic.Dictionary<int, DomainModel.InternalRoleExtension>();
                List().ForEach((item) => { tree.Add(item.ID, item); });
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }

            return tree;
        }

        /// <summary>
        /// Serializes the specified role.
        /// </summary>
        /// <param name="role">The role to serialize.</param>
        /// <returns></returns>
        public string Serialize(DomainModel.InternalRoleExtension role)
        {
            string result = string.Empty;

            try
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    using (XmlTextWriter writer = new XmlTextWriter(ms, System.Text.Encoding.GetEncoding(Strings.ENCODING)))
                    {
                        XmlSerializer s = new XmlSerializer(typeof(DomainModel.InternalRoleExtension));
                        if (s != null)
                        {
                            s.Serialize(writer, role);
                            result = System.Text.Encoding.GetEncoding(Strings.ENCODING).GetString(ms.ToArray());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }

            return result;
        }

        /// <summary>
        /// Serialize a list of RoleExtensions.
        /// </summary>
        /// <param name="list">The list of RoleExtensions.</param>
        /// <returns></returns>
        public string Serialize(List<DomainModel.InternalRoleExtension> list)
        {
            StringBuilder sb = new StringBuilder();
            string result = string.Empty;

            try
            {
                sb.Append(Strings.XMLHEADER);
                sb.Append(string.Format("<{0}>", Strings.ROLE_COLLECTION_NAME));

                list.ForEach((item) =>
                {
                    result = Serialize(item);
                    sb.Append(result.Replace(Strings.XMLHEADER, "").Replace(Strings.XMLXSI, "").Replace(Strings.XMLXSD, ""));
                });

                sb.Append(string.Format("</{0}>", Strings.ROLE_COLLECTION_NAME));
            }
            catch (Exception ex)
            {
                CacheUtil.ReportException(ex);
                throw ex;
            }

            return sb.ToString();
        }
        #endregion
    }
}


text:
import logging
from logging.config import dictConfig

def configure_logging():
    dictConfig({
        'version': 1,
        'formatters': {
            'customFormat': {
                'format': '%(asctime)s - %(levelname)s - %(message)s',
            },
        },
        'handlers': {
            'customFileHandler': {
                'class': 'logging.FileHandler',
                'filename': '../lightning.log',
                'formatter': 'customFormat',
                'level': logging.DEBUG,
            },
        },
        'loggers': {
            'lightning': {
                'handlers': ['customFileHandler'],
                'level': logging.INFO,
                'propagate': 0
            },
        },
    })


text:
package kieker.analysis.util.timeseries;

import java.time.Instant;

/**
 * @author Sören Henning
 *
 * @since 1.14
 */
public class DoubleTimeSeriesPoint extends AbstractTimeSeriesPoint {

	private final double value;

	public DoubleTimeSeriesPoint(final Instant time, final double value) {
		super(time);
		this.value = value;
	}

	public double getValue() {
		return this.value;
	}

	@Override
	public String valueToString() {
		return Double.toString(this.value);
	}

}