text:
drop table if exists tz_test;
create table tz_test(id int, tsltz datetime with local time zone primary key, str varchar(10));

set timezone '+00:00';

insert into tz_test values(1, datetimeltz'2014-07-01 10:00:00.789 PM', 'a');

--test: normal duplicate value, should be updated
insert into tz_test values(2, datetimeltz'2014-07-01 22:00:00.789', 'b') on duplicate key update id=2, str='updated1';
select if(id=2 and str='updated1', 'ok', 'nok') from tz_test order by 1;

--test: insert with same timezone, should be updated
insert into tz_test values(3, datetimeltz'2014-07-01 22:00:00.789 UTC', 'c') on duplicate key update id=2, str='updated2';
select if(id=2 and str='updated2', 'ok', 'nok') from tz_test order by 1;

--test: change session timezone and insert same value, a new row should be inserted
set timezone '-6:00';
insert into tz_test values(3, datetimeltz'2014-07-01 22:00:00.789', 'c') on duplicate key update id=3, str='updated';
select if(count(*)=2, 'ok', 'nok') from tz_test order by 1;

--test: insert with time zone 'America/Indiana/Tell_City', whose GMT offset is '-6:00', but should be inserted because of value is DST
insert into tz_test values(4, datetimeltz'2014-07-01 10:00:00.789 PM America/Indiana/Tell_City', 'd') on duplicate key update id=3, str='updated2';
select if(count(*)=3, 'ok', 'nok') from tz_test order by 1;
select * from tz_test order by 1;

--test: insert with time zone 'America/Indiana/Tell_City', whose GMT offset is '-6:00', should be updated
insert into tz_test values(5, datetimeltz'2014-07-01 11:00:00.789 PM America/Indiana/Tell_City', 'e') on duplicate key update id=5, str='updated1';
select if(str='updated1', 'ok', 'nok') from tz_test where id=5 order by 1;
select * from tz_test order by 1;

--test: change session timezone and insert, with same UTC value, should be updated
set timezone 'Asia/Shanghai';
insert into tz_test values(6, datetimeltz'2014-07-02 12:00:00.789 PM', 'f') on duplicate key update str='updated2';
select if(str='updated2', 'ok', 'nok') from tz_test where id=5 order by 1;
select * from tz_test order by 1;

--test: add unique constraint to another column and test
alter table tz_test modify id int unique;
insert into tz_test values(7, datetimeltz'2014-07-02 13:00:00.789 Asia/Seoul', 'g') on duplicate key update id=5, str='updated3';
select * from tz_test order by 1;

--test: test with different geographic timezone, but same GMT offset
insert into tz_test values(8, datetimeltz'2014-02-03 2:12:13.321 Asia/Hong_Kong', 'HongKong') on duplicate key update id=100, str='abcdefg';
insert into tz_test values(8, datetimeltz'2014-02-03 2:12:13.321 Asia/Shanghai', 'HongKong') on duplicate key update str='Shanghai';
select if(str='Shanghai', 'ok', 'nok') from tz_test where id=8 order by 1;
select if(count(*)=4, 'ok', 'nok') from tz_test order by 1;
select * from tz_test order by 1;

--test: test with ambiguous values
set timezone 'Asia/Seoul';
insert into tz_test values(10, datetimeltz'1987-10-11 2:11:12.112', 'default') on duplicate key update str='abc';
insert into tz_test values(11, datetimeltz'1987-10-11 2:11:12.112 Asia/Seoul KST', 'KST') on duplicate key update str='KST';
insert into tz_test values(12, datetimeltz'1987-10-11 2:11:12.112 Asia/Seoul KDT', 'KDT') on duplicate key update str='KDT';
select if(count(*)=6, 'ok', 'nok') from tz_test order by 1;
select * from tz_test order by 1;

drop table tz_test;

set timezone 'Asia/Seoul';

redpajama_set_name: RedPajamaGithub


text:
Always `populate()` certain fields in your mongoose schemas

[![Build Status](https://travis-ci.org/mongodb-js/mongoose-autopopulate.svg?branch=master)](https://travis-ci.org/vkarpov15/mongoose-autopopulate)
[![Coverage Status](https://coveralls.io/repos/mongodb-js/mongoose-autopopulate/badge.svg?branch=master)](https://coveralls.io/r/mongodb-js/mongoose-autopopulate?branch=master)

**Note:** This plugin will *only* work with mongoose >= 4.0. Do NOT use
this plugin with mongoose 3.x. You have been warned.

**Note:** population is a powerful feature, but it has limitations and
helps you get away with poor schema design.  In particular, it is usually
bad MongoDB schema design to include arrays that grow without bound in
your documents. Do not include a constantly-growing array of ObjectIds
in your schema - your data will become unwieldy as the array grows and
you will eventually hit the [16mb document size limit](http://docs.mongodb.org/manual/reference/limits/#BSON-Document-Size).
In general, think carefully when designing your schemas.

# API

The `mongoose-autopopulate` module exposes a single function that you can
pass to the `mongoose.Schema.prototype.plugin()` function. Below you will
see how to use this function.

Suppose you have two collections, "people" and "bands". The `People` model
looks like this:

```javascript
var personSchema = new Schema({ name: String, birthName: String });
Person = mongoose.model('people', personSchema, 'people');
```

Suppose your "people" collection has one document:

```javascript
{
  name: 'Axl Rose',
  birthName: 'William Bruce Rose, Jr.',
  _id: '54ef3f374849dcaa649a3abc'
};
```

And your "bands" collection has one document:

```javascript
{
  _id: '54ef3f374849dcaa649a3abd',
  name: "Guns N' Roses",
  lead: '54ef3f374849dcaa649a3abc',
}
```

#### It supports an autopopulate option in schemas

You can set the `autopopulate` option for the `lead` field.
This means that, every time you call `find()` or `findOne()`,
`mongoose-autopopulate` will automatically call `.populate('lead')`
for you.

```javascript

    var bandSchema = new Schema({
      name: String,
      lead: { type: ObjectId, ref: 'people', autopopulate: true }
    });
    bandSchema.plugin(autopopulate);

    var Band = mongoose.model('band3', bandSchema, 'bands');
    Band.findOne({ name: "Guns N' Roses" }, function(error, doc) {
      assert.ifError(error);
      assert.equal('Axl Rose', doc.lead.name);
      assert.equal('William Bruce Rose, Jr.', doc.lead.birthName);
      done();
    });

```

#### It can specify an options argument

Advanced users of `populate()` may want to specify additional
options, such as selecting fields. If you set the `autopopulate`
option to an object, `mongoose-autopopulate` will merge the object
into populate options. The `findOne()` below is equivalent to
`Band.findOne({ name: "Guns N' Roses" }).populate({ path: 'lead', select: 'name });`

```javascript

    var bandSchema = new Schema({
      name: String,
      lead: { type: ObjectId, ref: 'people', autopopulate: { select: 'name' } }
    });
    bandSchema.plugin(autopopulate);

    var Band = mongoose.model('band2', bandSchema, 'bands');
    Band.findOne({ name: "Guns N' Roses" }, function(error, doc) {
      assert.ifError(error);
      assert.equal('Axl Rose', doc.lead.name);
      assert.ok(!doc.lead.birthName);
      done();
    });

```

#### It can specify a function that returns options

You can also set the `autopopulate` option to be a function.
Then `mongoose-autopopulate` will call the function with
the query object as the context and use the return value.
The below `populate()` uses the same options as the previous
example.

```javascript

    var numCalls = 0;
    var optionsFunction = function() {
      ++numCalls;
      return { select: 'name' };
    };

    var bandSchema = new Schema({
      name: String,
      lead: { type: ObjectId, ref: 'people', autopopulate: optionsFunction }
    });
    bandSchema.plugin(autopopulate);

    var Band = mongoose.model('band4', bandSchema, 'bands');
    Band.find({ name: "Guns N' Roses" }, function(error, docs) {
      assert.ifError(error);
      assert.equal(1, docs.length);
      assert.equal(1, numCalls);
      var doc = docs[0];
      assert.equal('Axl Rose', doc.lead.name);
      assert.ok(!doc.lead.birthName);
      done();
    });

```


text:
<!DOCTYPE HTML>

    <title>Admin Panel</title>

      <link rel="stylesheet" href="../css/normalize.css">
      <link rel="stylesheet" href="../css/animate.css">
      <link rel="stylesheet" href="../css/bootstrap.css">
      <link rel="stylesheet" href="../css/colors.css">
      <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">

        <button type="button" class="btn btn-cyan"></button>
        <button href="#" type="button" class="btn btn-cyan">Back Home</button>
        <button href="#" type="button" class="btn btn-cyan">Create</button>
        <button href="#" type="button" class="btn btn-cyan">Account</button>


text:
#if !defined(ALIZE_MixtureGD_h)
#define ALIZE_MixtureGD_h

#if defined(_WIN32)
#if defined(ALIZE_EXPORTS)
#define ALIZE_API __declspec(dllexport)
#else
#define ALIZE_API __declspec(dllimport)
#endif
#else
#define ALIZE_API
#endif

#include "Mixture.h"
#include "DistribGD.h"

namespace alize
{
  class MixtureStat; // TODO : garder ici ?
  class Config;
  class StatServer;

  /// Class for a mixture of gaussian distributions with diagonal vector
  /// of covariance (DistribGD objects).
  ///
  /// @author Frederic Wils  frederic.wils@lia.univ-avignon.fr
  /// @version 1.0
  /// @date 2003

  class ALIZE_API MixtureGD : public Mixture
  {

  public :

    //explicit MixtureGD(const Config& config);
    MixtureGD(const MixtureGD&);
    explicit MixtureGD(const String& id, unsigned long vectSize,
                      unsigned long distribCount = 0);
    virtual bool operator==(const Mixture&) const;

    static MixtureGD& create(const K&, const String& id,
          unsigned long vectSize, unsigned long distribCount = 0);
    //static MixtureGD& create(const Config& config);

    MixtureGD& duplicate(const K&, DuplDistrib) const; // not virtual

    /// @exception Exception if the dimensions or the numbers of
    ///      distributions does not match or if the types are not
    ///      the same
    ///
    MixtureGD& operator=(const MixtureGD&);

    /// Adds a distribution GD to this mixture
    /// @param d DistribGD object to add
    /// @param w weight of the distribution
    /// @exception Exception if the dimension of the mixture is not equal
    ///      to the dimension of the distribution
    ///
    void addDistrib(const K&, DistribGD& d, weight_t w = 0.0);

    /// Adds a distribution to this mixture
    /// @param d Distrib object to add
    /// @param w weight of the distribution
    /// @exception Exception if d is not a DistribGD object
    /// @exception Exception if the dimension of d is not equals to the
    ///      dimension of the mixture
    ///
    virtual void addDistrib(const K&, Distrib& d, weight_t w = 0.0);

    /// Replace a distribution GD by an other one
    /// @param d DistribGD object to set
    /// @param index position of the distribution to be replaced
    /// @exception IndexOutOfBoundsException
    /// @exception Exception if the dimension of d is not equals to the
    ///      dimension of the mixture
    ///
    void setDistrib(const K&, DistribGD& d, unsigned long index);

    /// Replace a distribution by an other one
    /// @param d DistribGD object to set
    /// @param index position of the distribution to be replaced
    /// @exception IndexOutOfBoundsException
    /// @exception Exception if d is not a DistribGD object
    /// @exception Exception if the dimension of d is not equals to the
    ///      dimension of the mixture
    ///
    virtual void setDistrib(const K&, Distrib& d, unsigned long index);

    /// @exception Exception if the dimensions or the numbers of
    ///      distributions does not match or if the types are not
    ///      the same
    ///
    Mixture& operator=(const Mixture&);

    virtual ~MixtureGD();

    /// Returns a distribution
    /// @param index position of the distribution
    /// @return a reference to the distribution
    /// @exception IndexOutOfBoundsException
    ///
    DistribGD& getDistrib(unsigned long index) const; // NOT virtual method

    virtual DistribType getType() const;

    virtual String getClassName() const;
    virtual String toString() const;

  private :

    virtual Mixture& clone(DuplDistrib) const;
    virtual MixtureStat& createNewMixtureStatObject(
                     const K&, StatServer&, const Config&) const;
  };

} // end namespace alize

#endif // !defined(ALIZE_MixtureGD_h)


text:
/*
 * Etkinlik.io API
 * Tüm etkinlikleri toplamayı, kategorize etmeyi ve ilgili kişilere duyurmayı amaç edinmiş bir projedir. Bu API dokümantasyonu ile bir çok kaynaktan ve organizatörden beslenerek bir araya getirdiğimiz etkinlik içeriğine entegre olarak uygulamalar geliştirebilirsiniz.
 *
 * OpenAPI spec version: 1.0.0
 *
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */

package io.swagger.client.model;

import java.util.Objects;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;

/**
 * Tur
 */
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-11-29T05:46:48.775Z")
public class Tur {
  @SerializedName("id")
  private Integer id = null;

  @SerializedName("adi")
  private String adi = null;

  @SerializedName("radi")
  private String radi = null;

  public Tur id(Integer id) {
    this.id = id;
    return this;
  }

   /**
   * Tür id bilgisi.
   * @return id
  **/
  @ApiModelProperty(value = "Tür id bilgisi.")
  public Integer getId() {
    return id;
  }

  public void setId(Integer id) {
    this.id = id;
  }

  public Tur adi(String adi) {
    this.adi = adi;
    return this;
  }

   /**
   * Tür adı bilgisi.
   * @return adi
  **/
  @ApiModelProperty(value = "Tür adı bilgisi.")
  public String getAdi() {
    return adi;
  }

  public void setAdi(String adi) {
    this.adi = adi;
  }

  public Tur radi(String radi) {
    this.radi = radi;
    return this;
  }

   /**
   * Tür radı (slug) bilgisi.
   * @return radi
  **/
  @ApiModelProperty(value = "Tür radı (slug) bilgisi.")
  public String getRadi() {
    return radi;
  }

  public void setRadi(String radi) {
    this.radi = radi;
  }

  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Tur tur = (Tur) o;
    return Objects.equals(this.id, tur.id) &&
        Objects.equals(this.adi, tur.adi) &&
        Objects.equals(this.radi, tur.radi);
  }

  @Override
  public int hashCode() {
    return Objects.hash(id, adi, radi);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class Tur {\n");

    sb.append("    id: ").append(toIndentedString(id)).append("\n");
    sb.append("    adi: ").append(toIndentedString(adi)).append("\n");
    sb.append("    radi: ").append(toIndentedString(radi)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(java.lang.Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

}


text:
package au.com.dius.pact.model

import com.typesafe.scalalogging.StrictLogging

import scala.collection.JavaConversions

case class RequestMatching(expectedInteractions: Seq[RequestResponseInteraction]) {
  import au.com.dius.pact.model.RequestMatching._

  def matchInteraction(actual: Request): RequestMatch = {
    def compareToActual(expected: RequestResponseInteraction) = compareRequest(expected, actual)
    val matches = expectedInteractions.map(compareToActual)
    if (matches.isEmpty)
      RequestMismatch
    else
      matches.reduceLeft(_ merge _)
  }

  def findResponse(actual: Request): Option[Response] =
    matchInteraction(actual).toOption.map(_.asInstanceOf[RequestResponseInteraction].getResponse)
}

object RequestMatching extends StrictLogging {
  import au.com.dius.pact.model.Matching._

  var diffConfig = DiffConfig(allowUnexpectedKeys = false, structural = false)

  implicit def liftPactForMatching(pact: RequestResponsePact): RequestMatching =
    RequestMatching(JavaConversions.collectionAsScalaIterable(pact.getInteractions).toSeq)

  def isPartialMatch(problems: Seq[RequestPartMismatch]): Boolean = !problems.exists {
    case PathMismatch(_,_,_) | MethodMismatch(_,_) => true
    case _ => false
  }

  def decideRequestMatch(expected: RequestResponseInteraction, problems: Seq[RequestPartMismatch]): RequestMatch =
    if (problems.isEmpty) FullRequestMatch(expected)
    else if (isPartialMatch(problems)) PartialRequestMatch(expected, problems)
    else RequestMismatch

  def compareRequest(expected: RequestResponseInteraction, actual: Request): RequestMatch = {
    val mismatches: Seq[RequestPartMismatch] = requestMismatches(expected.getRequest, actual)
    logger.debug("Request mismatch: " + mismatches)
    decideRequestMatch(expected, mismatches)
  }

  def requestMismatches(expected: Request, actual: Request): Seq[RequestPartMismatch] = {
    logger.debug("comparing to expected request: \n" + expected)
    (matchMethod(expected.getMethod, actual.getMethod)
      ++ matchPath(expected, actual)
      ++ matchQuery(expected, actual)
      ++ matchCookie(au.com.dius.pact.matchers.util.CollectionUtils.toOptionalList(expected.cookie),
      au.com.dius.pact.matchers.util.CollectionUtils.toOptionalList(actual.cookie))
      ++ matchRequestHeaders(expected, actual)
      ++ matchBody(expected, actual, diffConfig)).toSeq
  }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (c) 1997, 2019 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Distribution License v. 1.0, which is available at
    http://www.eclipse.org/org/documents/edl-v10.php.

    SPDX-License-Identifier: BSD-3-Clause

-->

<descriptor since="2.0">
  <description>This is a Provider test</description>

  <client name="fromjava.seinoimpl" sideEffectFree="true">
  <description>testSimple</description>
  <![CDATA[
        Bar bar = new Bar();
        bar.setAge(33);

        assertEquals("test", echoImplPort.echoString("test"));
        assertEquals("Mary & Paul", echoImplPort.echoString("Mary & Paul"));
        assertEquals(bar.getAge(), echoImplPort.echoBar(bar).getAge());
        Holder age = new Holder();
        age.value = 33;
        echoImplPort.echoIntHolder(age);
        assertEquals(66, age.value);
  ]]></client>

  <service basedir="./server">
  </service>

</descriptor>


text:
package de.craftolution.craftoplugin.module.web.packets;

import de.craftolution.craftoplugin.module.web.common.Packet;
import de.craftolution.craftoplugin.module.web.common.TCPPacket;
import de.craftolution.craftoplugin.service.log.Log;
import de.craftolution.craftoplugin.service.messenger.text.Text;
import de.craftolution.craftoplugin.service.module.utils.Utils;
import de.craftolution.craftoplugin.service.task.utils.duration.TickDuration;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;

import java.util.UUID;

import static de.craftolution.craftoplugin.service.messenger.text.TextTemplates.RIGHT_POINTER;

public class VerifyPlayerIdentityPacket implements Packet, Utils {

	public UUID uuid;
	public String token;

	@Override
	public TCPPacket serialize() {
		return new TCPPacket(PacketType.VERIFY_PLAYER_IDENTITY).add(uuid.toString()).add(token);
	}

	@Override
	public void handle(TCPPacket packet) throws Exception {
		uuid = UUID.fromString(packet.getString(0));
		token = packet.getString(1);

		final Player player = Bukkit.getPlayer(uuid);

		debug("Received VerifyPlayerIdentityPacket(%s, %s, %s)", uuid, token, player);

		if (player != null && player.isOnline()) {
			final Text[] msgs = new Text[7];

			msgs[0] = Text.of(" ");

			msgs[1] = Text.builder()
				.append(RIGHT_POINTER + " Hey " + player.getName() + "!")
				.color(ChatColor.GRAY)
				.build();

			msgs[2] = Text.builder()
				.append(RIGHT_POINTER + " Möchtest du Minecraft mit craftolution.de verknüpfen?")
				.color(ChatColor.GRAY)
				.build();

			msgs[3] = Text.builder()
				.append(RIGHT_POINTER + " Dann klicke einfach auf den folgenden Code:")
				.color(ChatColor.GRAY)
				.build();

			msgs[4] = Text.builder()
				.append(RIGHT_POINTER + " ")
				.color(ChatColor.GRAY)
				.append(token)
				.color(ChatColor.WHITE)
				.onClickOpenUrl("https://craftolution.de/verify/" + token)
				.onInsertion(token)
				.onHover("Klicke hier um dich zu verifizieren...")
				.build();

			msgs[5] = Text.builder()
				.append(RIGHT_POINTER + " Falls nicht, melde dich bei uns.")
				.color(ChatColor.GRAY)
				.build();

			msgs[6] = Text.of(" ");

			runLater(TickDuration.ofSeconds(5), () -> {
				Player onlinePlayer = Bukkit.getPlayer(uuid);

				for (Text msg : msgs) {
					send(onlinePlayer, msg);
				}
			});
		}
		else {
			Log.warn(getClass(), "Missing player " + uuid + " for packet: " + packet);
		}
	}

}


text:
namespace v8 {
namespace internal {

template <typename T>
template <typename V>
v8::Local<V> CustomArguments<T>::GetReturnValue(Isolate* isolate) {
  // Check the ReturnValue.
  Object** handle = &this->begin()[kReturnValueOffset];
  // Nothing was set, return empty handle as per previous behaviour.
  if ((*handle)->IsTheHole()) return v8::Local<V>();
  return Utils::Convert<Object, V>(Handle<Object>(handle));
}

v8::Local<v8::Value> FunctionCallbackArguments::Call(FunctionCallback f) {
  Isolate* isolate = this->isolate();
  VMState<EXTERNAL> state(isolate);
  ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
  FunctionCallbackInfo<v8::Value> info(begin(),
                                       argv_,
                                       argc_,
                                       is_construct_call_);
  f(info);
  return GetReturnValue<v8::Value>(isolate);
}

#define WRITE_CALL_0(Function, ReturnValue)                            \
  v8::Local<ReturnValue> PropertyCallbackArguments::Call(Function f) { \
    Isolate* isolate = this->isolate();                                \
    VMState<EXTERNAL> state(isolate);                                  \
    ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));       \
    PropertyCallbackInfo<ReturnValue> info(begin());                   \
    f(info);                                                           \
    return GetReturnValue<ReturnValue>(isolate);                       \
  }

#define WRITE_CALL_1(Function, ReturnValue, Arg1)                     \
  v8::Local<ReturnValue> PropertyCallbackArguments::Call(Function f,  \
                                                         Arg1 arg1) { \
    Isolate* isolate = this->isolate();                               \
    VMState<EXTERNAL> state(isolate);                                 \
    ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));      \
    PropertyCallbackInfo<ReturnValue> info(begin());                  \
    f(arg1, info);                                                    \
    return GetReturnValue<ReturnValue>(isolate);                      \
  }

#define WRITE_CALL_2(Function, ReturnValue, Arg1, Arg2)          \
  v8::Local<ReturnValue> PropertyCallbackArguments::Call(        \
      Function f, Arg1 arg1, Arg2 arg2) {                        \
    Isolate* isolate = this->isolate();                          \
    VMState<EXTERNAL> state(isolate);                            \
    ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
    PropertyCallbackInfo<ReturnValue> info(begin());             \
    f(arg1, arg2, info);                                         \
    return GetReturnValue<ReturnValue>(isolate);                 \
  }

#define WRITE_CALL_2_VOID(Function, ReturnValue, Arg1, Arg2)                   \
void PropertyCallbackArguments::Call(Function f,                               \
                                     Arg1 arg1,                                \
                                     Arg2 arg2) {                              \
  Isolate* isolate = this->isolate();                                          \
  VMState<EXTERNAL> state(isolate);                                            \
  ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));                 \
  PropertyCallbackInfo<ReturnValue> info(begin());                             \
  f(arg1, arg2, info);                                                         \
}

FOR_EACH_CALLBACK_TABLE_MAPPING_0(WRITE_CALL_0)
FOR_EACH_CALLBACK_TABLE_MAPPING_1(WRITE_CALL_1)
FOR_EACH_CALLBACK_TABLE_MAPPING_2(WRITE_CALL_2)
FOR_EACH_CALLBACK_TABLE_MAPPING_2_VOID_RETURN(WRITE_CALL_2_VOID)

#undef WRITE_CALL_0
#undef WRITE_CALL_1
#undef WRITE_CALL_2
#undef WRITE_CALL_2_VOID

double ClobberDoubleRegisters(double x1, double x2, double x3, double x4) {
  // TODO(ulan): This clobbers only subset of registers depending on compiler,
  // Rewrite this in assembly to really clobber all registers.
  // GCC for ia32 uses the FPU and does not touch XMM registers.
  return x1 * 1.01 + x2 * 2.02 + x3 * 3.03 + x4 * 4.04;
}

}  // namespace internal
}  // namespace v8


text:
var currentGIF = 0, // Show the GIFs in order
    timeOffset = 2; // Add (or subtract) a time offset to compensate for the location of my server

var config = require('./config.js'),
    slackbot = require('node-slackbot'),
    needle = require('needle');

var gifURL = 'http://www.jessemillar.com/andybernard/images/gifs/',
    gifs = [gifURL + 'awkward.gif', gifURL + 'dancing.gif', gifURL + 'flying.gif', gifURL + 'lachrymose.gif', gifURL + 'nailed.gif', gifURL + 'smug.gif'],
    closingTime = 'https://open.spotify.com/track/1A5V1sxyCLpKJezp75tUXn';

var date = new Date();
console.log('The current time is ' + Number(date.getHours() - timeOffset) + ':' + date.getMinutes() + ' on day index ' + date.getDay());

setInterval(function() { // Tell everyone when it's time to go home (at 5pm)
    var date = new Date();

    if (date.getDay() > 0 && date.getDay < 6) { // If it's a weekday
        if (date.getHours() == (16 + timeOffset) && date.getMinutes() == 59) { // Push a message one minute before 5pm
            needle.get('https://slack.com/api/chat.postMessage?token=' + config.apiToken + "&channel=%23general&text=It's%20closing%20time%2C%20everybody!%20https%3A%2F%2Fopen.spotify.com%2Ftrack%2F1A5V1sxyCLpKJezp75tUXn");
        }
    }
}, 1000 * 60); // Check the time every minute

var andy = new slackbot(config.botToken); // Respond to messages

andy.use(function(message, callback) {
    if (message.type == 'message' && message.user) {
        needle.get('https://slack.com/api/users.info?token=' + config.apiToken + '&user=' + message.user, function(error, response) {
            if (!error) {
                if (!response.body.user.is_bot) { // Make sure we're not reading back one of our own messages
                    console.log(response.body.user.real_name + ' said, "' + message.text + '"');

                    andy.sendMessage(message.channel, gifs[currentGIF]); // The default response of a random GIF

                    if (currentGIF < gifs.length - 1) { // Show the GIFs in order
                        currentGIF++;
                    } else {
                        currentGIF = 0;
                    }
                }
            }
        });
    }

    callback();
});

andy.connect();


text:
<!DOCTYPE html>

  <meta charset='UTF-8'>
  <title>Atom-Beautify Documentation</title>

  <link rel='stylesheet' href='../../stylesheets/application.css' type='text/css'>

      Atom-Beautify

    »

      Index

    »
    src
    »
    config.coffee

        File:
        config.coffee

          Defined in:
          src

Variables Summary

    module.exports
    =

{
  general: {
    title: 'General',
    type: 'object',
    collapsed: true,
    order: -1,
    description: 'General options for Atom Beautify',
    properties: {
      analytics: {
        title: 'Anonymous Analytics',
        type: 'boolean',
        "default": true,
        description: "There is [Segment.io](https://segment.io/) which forwards data to [Google Analytics](http://www.google.com/analytics/) to track what languages are being used the most, as well as other stats. Everything is anonymized and no personal information, such as source code, is sent. See https://github.com/Glavin001/atom-beautify/issues/47 for more details."
      },
      _analyticsUserId: {
        title: 'Analytics User Id',
        type: 'string',
        "default": "",
        description: "Unique identifier for this user for tracking usage analytics"
      },
      loggerLevel: {
        title: "Logger Level",
        type: 'string',
        "default": 'warn',
        description: 'Set the level for the logger',
        "enum": ['verbose', 'debug', 'info', 'warn', 'error']
      },
      beautifyEntireFileOnSave: {
        title: "Beautify Entire File On Save",
        type: 'boolean',
        "default": true,
        description: "When beautifying on save, use the entire file, even if there is selected text in the editor. Important: The `beautify on save` option for the specific language must be enabled for this to be applicable. This option is not `beautify on save`."
      },
      muteUnsupportedLanguageErrors: {
        title: "Mute Unsupported Language Errors",
        type: 'boolean',
        "default": false,
        description: "Do not show \"Unsupported Language\" errors when they occur"
      },
      muteAllErrors: {
        title: "Mute All Errors",
        type: 'boolean',
        "default": false,
        description: "Do not show any/all errors when they occur"
      }
    }
  }
}

  By

    Codo

  2.1.1
  ✲
  Press H to see the keyboard shortcuts
  ✲
  @netzpirat
  ✲
  @_inossidabile

  <input type='text'>

    Quickly fuzzy find classes, mixins, methods, file:

      T
      Open fuzzy finder dialog

    Control the navigation frame:

      L
      Toggle list view

      C
      Show class list

      I
      Show mixin list

      F
      Show file list

      M
      Show method list

      E
      Show extras list

    You can focus and blur the search input:

      S
      Focus search input

      Esc
      Blur search input


text:
import smtplib

def prompt(prompt):
    return raw_input(prompt).strip()

fromaddr = 'noreply@openenglish.com'
toaddrs  = 'notifications@openenglish.com'
msg = """From: noreply@openenglish.com
To: notifications@openenglish.com
Subject: [PRD] Payment Service app: http://tolkien:thejohn@prd-payment-service-i.oe-sys.com:8080/payment_service/static/restapi.html not reachable, please check it .

Payment Service not reachable after promotion to SLAVE (10.0.111.15).
"""

print "Message length is " + repr(len(msg))

#Change according to your settings
smtp_server = 'email-smtp.us-east-1.amazonaws.com'
smtp_username = 'AKIAIR24K7DNISBVFDIA'
smtp_password = 'Apy+o8s5eDvKXjtFsNjTL/OCeKP+4gCMUQBRr0CRLX8z'
smtp_port = '587'
#smtp_port = '25'
smtp_do_tls = True

server = smtplib.SMTP(
    host = smtp_server,
    port = smtp_port,
    #timeout = 10  # A Python 2.4 no le gusta esto...
)

server.set_debuglevel(10)
server.starttls()
server.ehlo()
server.login(smtp_username, smtp_password)
server.sendmail(fromaddr, toaddrs, msg)
print server.quit()


text:
factoor
=======

Invoice management system for Mexico.


text:
FROM alpine:3.4
MAINTAINER Roberto J. Rojas <robertojrojas@gmail.com>

ADD birds-service /usr/bin/birds-service

ENV POSTGRESQL_DB_URI postgres://birdman:mycape@localhost/birddb?sslmode=disable

EXPOSE 8092

ENTRYPOINT ["birds-service"]


text:
from torch.utils.data import Dataset

class SupervisedDataset(Dataset):
    def __init__(self, x, y):
        super().__init__()
        self.x = x
        self.y = y

    def shuffle(self):
        perm = np.random.permutation(len(self.x))
        self.x = [self.x[i] for i in perm]
        self.y = [self.y[i] for i in perm]

    @classmethod
    def concatenate(cls, dataset1, dataset2):
        return cls(dataset1.x + dataset2.x, dataset1.y + dataset2.y)

    @property
    def dim(self):
        return self.x[0].size()[1]

    def __len__(self):
        return len(self.x)

    def __getitem__(self, idx):
        return self.x[idx], self.y[idx]

    def extend(self, new_dataset):
        self.x = self.x + new_dataset.x
        self.y = self.y + new_dataset.y


text:
=======================
salt.modules.introspect
=======================

.. automodule:: salt.modules.introspect
    :members:


text:
package nested_write

import (
	"fmt"
	git "github.com/libgit2/git2go"
	"github.com/tbd-ci/tbd/git/empty_ref"
	"time"
)

type Paths map[string]git.Oid

func AppendTreeViaIndex(p Paths, t *git.Tree) (*git.Tree, error) {
	idx, err := git.NewIndex()
	if err != nil {
		return nil, err
	}

	for path, oid := range p {
		obj, err := t.Owner().Lookup(&oid)
		if err != nil {
			return nil, err
		}
		switch obj.Type() {
		case git.ObjectTree:
			subtree := obj.(*git.Tree)
			for i := uint64(0); i < subtree.EntryCount(); i++ {
				entry := subtree.EntryByIndex(i)
				p[path+"/"+entry.Name] = *entry.Id
			}
			delete(p, path)
		case git.ObjectBlob:
		default:
			return nil, fmt.Errorf("Expected blob or tree, got '%s'", obj.Type().String())
		}
	}

	for path, oid := range p {
		err = idx.Add(&git.IndexEntry{
			Ctime: time.Now(),
			Mtime: time.Now(),
			Mode:  git.FilemodeBlob,
			Uid:   0,
			Gid:   0,
			Size:  0,
			Id:    &oid,
			Path:  path,
		})
		if err != nil {
			panic(err)
			return nil, err
		}
	}
	treeOid, err := idx.WriteTreeTo(t.Owner())
	if err != nil {
		return nil, err
	}

	savedTree, err := t.Owner().LookupTree(treeOid)
	if err != nil {
		return nil, err
	}
	blankTree, err := emptyTree(t.Owner())
	if err != nil {
		return nil, err
	}
	mergeOpts, err := git.DefaultMergeOptions()
	if err != nil {
		return nil, err
	}
	mergeIdx, err := t.Owner().MergeTrees(blankTree, t, savedTree, &mergeOpts)
	if err != nil {
		return nil, err
	}
	mergeOid, err := mergeIdx.WriteTreeTo(t.Owner())
	if err != nil {
		return nil, err
	}
	return t.Owner().LookupTree(mergeOid)
}

func emptyTree(repo *git.Repository) (*git.Tree, error) {
	bld, err := repo.TreeBuilder()
	if err != nil {
		return nil, err
	}
	treeOid, err := bld.Write()
	if err != nil {
		return nil, err
	}
	return repo.LookupTree(treeOid)
}

func AppendRef(p Paths, ref string, in *git.Repository, author *git.Signature) error {
	var err error
	if author == nil {
		author, err = in.DefaultSignature()
		if err != nil {
			return err
		}
	}
	commit, err := Append(p, ref, in, author)
	if err != nil {
		return err
	}
	refb, err := in.LookupReference(ref)
	if err != nil {
		// This ref doesn't exist; create it.
		commitOpts := empty_ref.DefaultCommitOptions()
		commitOpts.Author = commit.Author()
		commitOpts.Committer = commit.Committer()
		commitOpts.ReflogWho = commit.Committer()

		refb, err = empty_ref.AssertRefIsCommit(
			in,
			ref,
			commitOpts,
		)
		if err != nil {
			return err
		}
	}
	refb.SetTarget(commit.Id(), commit.Author(), "Completed build")
	return nil
}

func Append(p Paths, ref string, in *git.Repository, author *git.Signature) (*git.Commit, error) {
	committish := Lookup(in, ref)
	commits := []*git.Commit{committish.commit}
	if committish.err != nil {
		// ref doesn't exist; use a nil commit and an empty tree.
		commits = []*git.Commit{}
		bld, err := in.TreeBuilder()
		if err != nil {
			return nil, err
		}
		treeId, err := bld.Write()
		if err != nil {
			return nil, err
		}
		committish.tree, err = in.LookupTree(treeId)
		if err != nil {
			return nil, err
		}
	}

	tree, err := AppendTreeViaIndex(p, committish.tree)
	if err != nil {
		return nil, err
	}
	commitId, err := in.CreateCommit(
		"",
		author,
		author,
		"Add build",
		tree,
		commits...,
	)
	if err != nil {
		return nil, err
	}
	return in.LookupCommit(commitId)
}

type Committish struct {
	err    error
	ref    *git.Reference
	commit *git.Commit
	tree   *git.Tree
}

func Lookup(repo *git.Repository, ref string) (c Committish) {
	c.ref, c.err = repo.LookupReference(ref)
	if c.err != nil {
		return
	}
	c.commit, c.err = repo.LookupCommit(c.ref.Target())
	if c.err != nil {
		return
	}
	c.tree, c.err = c.commit.Tree()
	if c.err != nil {
		return
	}
	return
}


text:
module Heirloom
  class Catalog
    class List

      def initialize(args)
        @config = args[:config]
      end

      def all
        query  = "SELECT * FROM heirloom"
        sdb.select query
      end

      private

      def sdb
        @sdb ||= AWS::SimpleDB.new :config => @config
      end

    end
  end
end


text:
// ==========================================================
// XBM Loader
//
// Design and implementation by
// - Hervé Drolon <drolon@infonie.fr>
// part of the code adapted from the netPBM package (xbmtopbm.c)
//
// This file is part of FreeImage 3
//
// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
// THIS DISCLAIMER.
//
// Use at your own risk!
//
//
// ==========================================================

#include "FreeImage.h"
#include "Utilities.h"

// ==========================================================
// Internal functions
// ==========================================================

#define MAX_LINE	512

static const char *ERR_XBM_SYNTAX	= "Syntax error";
static const char *ERR_XBM_LINE		= "Line too long";
static const char *ERR_XBM_DECL		= "Unable to find a line in the file containing the start of C array declaration (\"static char\" or whatever)";
static const char *ERR_XBM_EOFREAD	= "EOF / read error";
static const char *ERR_XBM_WIDTH	= "Invalid width";
static const char *ERR_XBM_HEIGHT	= "Invalid height";
static const char *ERR_XBM_MEMORY	= "Out of memory";

/**
Get a string from a stream.
Read the string from the current stream to the first newline character.
The result stored in str is appended with a null character.
@param str Storage location for data
@param n Maximum number of characters to read
@param io Pointer to the FreeImageIO structure
@param handle Handle to the stream
@return Returns str. NULL is returned to indicate an error or an end-of-file condition.
*/
static char*
readLine(char *str, int n, FreeImageIO *io, fi_handle handle) {
	char c;
	int count, i = 0;
	do {
		count = io->read_proc(&c, 1, 1, handle);
		str[i++] = c;
	} while((c != '\n') && (i < n));
	if(count <= 0)
		return NULL;
	str[i] = '\0';
	return str;
}

/**
Get a char from the stream
@param io Pointer to the FreeImageIO structure
@param handle Handle to the stream
@return Returns the next character in the stream
*/
static int
readChar(FreeImageIO *io, fi_handle handle) {
	BYTE c;
	io->read_proc(&c, 1, 1, handle);
	return c;
}

/**
Read an XBM file into a buffer
@param io Pointer to the FreeImageIO structure
@param handle Handle to the stream
@param widthP (return value) Pointer to the bitmap width
@param heightP (return value) Pointer to the bitmap height
@param dataP (return value) Pointer to the bitmap buffer
@return Returns NULL if OK, returns an error message otherwise
*/
static const char*
readXBMFile(FreeImageIO *io, fi_handle handle, int *widthP, int *heightP, char **dataP) {
	char line[MAX_LINE], name_and_type[MAX_LINE];
	char* ptr;
	char* t;
	int version = 0;
	int raster_length, v;
	int bytes, bytes_per_line, padding;
	int c1, c2, value1, value2;
	int hex_table[256];
	BOOL found_declaration;
	/* in scanning through the bitmap file, we have found the first
	 line of the C declaration of the array (the "static char ..."
	 or whatever line)
	 */
	BOOL eof;	// we've encountered end of file while searching file

	*widthP = *heightP = -1;

	found_declaration = FALSE;    // haven't found it yet; haven't even looked
	eof = FALSE;                  // haven't encountered end of file yet

	while(!found_declaration && !eof) {

		if( readLine(line, MAX_LINE, io, handle) == NULL) {
			eof = TRUE;
		}
		else {
			if( strlen( line ) == MAX_LINE - 1 )
				return( ERR_XBM_LINE );
			if( sscanf(line, "#define %s %d", name_and_type, &v) == 2 ) {
				if( ( t = strrchr( name_and_type, '_' ) ) == NULL )
					t = name_and_type;
				else
					t++;
				if ( ! strcmp( "width", t ) )
					*widthP = v;
				else if ( ! strcmp( "height", t ) )
					*heightP = v;
				continue;
			}

			if( sscanf( line, "static short %s = {", name_and_type ) == 1 ) {
				version = 10;
				found_declaration = TRUE;
			}
			else if( sscanf( line, "static char %s = {", name_and_type ) == 1 ) {
				version = 11;
				found_declaration = TRUE;
			}
			else if(sscanf(line, "static unsigned char %s = {", name_and_type ) == 1 ) {
				version = 11;
				found_declaration = TRUE;
			}
		}
	}

	if(!found_declaration)
		return( ERR_XBM_DECL );

	if(*widthP == -1 )
		return( ERR_XBM_WIDTH );
	if( *heightP == -1 )
		return( ERR_XBM_HEIGHT );

	padding = 0;
	if ( ((*widthP % 16) >= 1) && ((*widthP % 16) <= 8) && (version == 10) )
		padding = 1;

	bytes_per_line = (*widthP + 7) / 8 + padding;

	raster_length =  bytes_per_line * *heightP;
	*dataP = (char*) malloc( raster_length );
	if ( *dataP == (char*) 0 )
		return( ERR_XBM_MEMORY );

	// initialize hex_table
	for ( c1 = 0; c1 < 256; c1++ ) {
		hex_table[c1] = 256;
	}
	hex_table['0'] = 0;
	hex_table['1'] = 1;
	hex_table['2'] = 2;
	hex_table['3'] = 3;
	hex_table['4'] = 4;
	hex_table['5'] = 5;
	hex_table['6'] = 6;
	hex_table['7'] = 7;
	hex_table['8'] = 8;
	hex_table['9'] = 9;
	hex_table['A'] = 10;
	hex_table['B'] = 11;
	hex_table['C'] = 12;
	hex_table['D'] = 13;
	hex_table['E'] = 14;
	hex_table['F'] = 15;
	hex_table['a'] = 10;
	hex_table['b'] = 11;
	hex_table['c'] = 12;
	hex_table['d'] = 13;
	hex_table['e'] = 14;
	hex_table['f'] = 15;

	if(version == 10) {
		for( bytes = 0, ptr = *dataP; bytes < raster_length; bytes += 2 ) {
			while( ( c1 = readChar(io, handle) ) != 'x' ) {
				if ( c1 == EOF )
					return( ERR_XBM_EOFREAD );
			}

			c1 = readChar(io, handle);
			c2 = readChar(io, handle);
			if( c1 == EOF || c2 == EOF )
				return( ERR_XBM_EOFREAD );
			value1 = ( hex_table[c1] << 4 ) + hex_table[c2];
			if ( value1 >= 256 )
				return( ERR_XBM_SYNTAX );
			c1 = readChar(io, handle);
			c2 = readChar(io, handle);
			if( c1 == EOF || c2 == EOF )
				return( ERR_XBM_EOFREAD );
			value2 = ( hex_table[c1] << 4 ) + hex_table[c2];
			if ( value2 >= 256 )
				return( ERR_XBM_SYNTAX );
			*ptr++ = (char)value2;
			if ( ( ! padding ) || ( ( bytes + 2 ) % bytes_per_line ) )
				*ptr++ = (char)value1;
		}
	}
	else {
		for(bytes = 0, ptr = *dataP; bytes < raster_length; bytes++ ) {
			/*
			** skip until digit is found
			*/
			for( ; ; ) {
				c1 = readChar(io, handle);
				if ( c1 == EOF )
					return( ERR_XBM_EOFREAD );
				value1 = hex_table[c1];
				if ( value1 != 256 )
					break;
			}
			/*
			** loop on digits
			*/
			for( ; ; ) {
				c2 = readChar(io, handle);
				if ( c2 == EOF )
					return( ERR_XBM_EOFREAD );
				value2 = hex_table[c2];
				if ( value2 != 256 ) {
					value1 = (value1 << 4) | value2;
					if ( value1 >= 256 )
						return( ERR_XBM_SYNTAX );
				}
				else if ( c2 == 'x' || c2 == 'X' ) {
					if ( value1 == 0 )
						continue;
					else return( ERR_XBM_SYNTAX );
				}
				else break;
			}
			*ptr++ = (char)value1;
		}
	}

	return NULL;
}

// ==========================================================
// Plugin Interface
// ==========================================================

static int s_format_id;

// ==========================================================
// Plugin Implementation
// ==========================================================

static const char * DLL_CALLCONV
Format() {
	return "XBM";
}

static const char * DLL_CALLCONV
Description() {
	return "X11 Bitmap Format";
}

static const char * DLL_CALLCONV
Extension() {
	return "xbm";
}

static const char * DLL_CALLCONV
RegExpr() {
	return NULL;
}

static const char * DLL_CALLCONV
MimeType() {
	return "image/x-xbitmap";
}

static BOOL DLL_CALLCONV
Validate(FreeImageIO *io, fi_handle handle) {
	char magic[8];
	if(readLine(magic, 7, io, handle)) {
		if(strcmp(magic, "#define") == 0)
			return TRUE;
	}
	return FALSE;
}

static BOOL DLL_CALLCONV
SupportsExportDepth(int depth) {
	return FALSE;
}

static BOOL DLL_CALLCONV
SupportsExportType(FREE_IMAGE_TYPE type) {
	return FALSE;
}

// ----------------------------------------------------------

static FIBITMAP * DLL_CALLCONV
Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
	char *buffer = NULL;
	int width, height;
	FIBITMAP *dib = NULL;

	try {

		// load the bitmap data
		const char* error = readXBMFile(io, handle, &width, &height, &buffer);
		// Microsoft doesn't implement throw between functions :(
		if(error) throw (char*)error;

		// allocate a new dib
		dib = FreeImage_Allocate(width, height, 1);
		if(!dib) throw (char*)ERR_XBM_MEMORY;

		// write the palette data
		RGBQUAD *pal = FreeImage_GetPalette(dib);
		pal[0].rgbRed = pal[0].rgbGreen = pal[0].rgbBlue = 0;
		pal[1].rgbRed = pal[1].rgbGreen = pal[1].rgbBlue = 255;

		// copy the bitmap
		BYTE *bP = (BYTE*)buffer;
		for(int y = 0; y < height; y++) {
			BYTE count = 0;
			BYTE mask = 1;
			BYTE *bits = FreeImage_GetScanLine(dib, height - 1 - y);

			for(int x = 0; x < width; x++) {
				if(count >= 8) {
					bP++;
					count = 0;
					mask = 1;
				}
				if(*bP & mask) {
					// Set bit(x, y) to 0
					bits[x >> 3] &= (0xFF7F >> (x & 0x7));
				} else {
					// Set bit(x, y) to 1
					bits[x >> 3] |= (0x80 >> (x & 0x7));
				}
				count++;
				mask <<= 1;
			}
			bP++;
		}

		free(buffer);
		return dib;

	} catch(const char *text) {
		if(buffer)	free(buffer);
		if(dib)		FreeImage_Unload(dib);
		FreeImage_OutputMessageProc(s_format_id, text);
		return NULL;
	}
}

// ==========================================================
//   Init
// ==========================================================

void DLL_CALLCONV
InitXBM(Plugin *plugin, int format_id) {
    s_format_id = format_id;

	plugin->format_proc = Format;
	plugin->description_proc = Description;
	plugin->extension_proc = Extension;
	plugin->regexpr_proc = RegExpr;
	plugin->open_proc = NULL;
	plugin->close_proc = NULL;
	plugin->pagecount_proc = NULL;
	plugin->pagecapability_proc = NULL;
	plugin->load_proc = Load;
	plugin->save_proc = NULL;
	plugin->validate_proc = Validate;
	plugin->mime_proc = MimeType;
	plugin->supports_export_bpp_proc = SupportsExportDepth;
	plugin->supports_export_type_proc = SupportsExportType;
	plugin->supports_icc_profiles_proc = NULL;
}


text:
@interface QNUpToken : NSObject

+ (instancetype)parse:(NSString *)token;

@property (copy, nonatomic, readonly) NSString *token;

@property (readonly) BOOL hasReturnUrl;

@end


text:
using System;
using System.IO;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SharpCompress.Archive;
using SharpCompress.Archive.GZip;

namespace SharpCompress.Test
{
    [TestClass]
    public class GZipArchiveTests : ArchiveTests
    {
        public GZipArchiveTests()
        {
            UseExtensionInsteadOfNameToVerify = true;
        }

        [TestMethod]
        public void GZip_Archive_Generic()
        {
            ResetScratch();
            using (Stream stream = File.Open(Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar.gz"), FileMode.Open))
            using (var archive = ArchiveFactory.Open(stream))
            {
                var entry = archive.Entries.First();
                entry.WriteToFile(Path.Combine(SCRATCH_FILES_PATH, entry.Key));
            }
            CompareArchivesByPath(Path.Combine(SCRATCH_FILES_PATH, "Tar.tar"),
                Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar"));
        }

        [TestMethod]
        public void GZip_Archive()
        {
            ResetScratch();
            using (Stream stream = File.Open(Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar.gz"), FileMode.Open))
            using (var archive = GZipArchive.Open(stream))
            {
                var entry = archive.Entries.First();
                entry.WriteToFile(Path.Combine(SCRATCH_FILES_PATH, entry.Key));
            }
            CompareArchivesByPath(Path.Combine(SCRATCH_FILES_PATH, "Tar.tar"),
                Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar"));
        }

        [TestMethod]
        [ExpectedException(typeof(InvalidOperationException))]
        public void GZip_Archive_NoAdd()
        {
            string jpg = Path.Combine(ORIGINAL_FILES_PATH, "jpg\\test.jpg");
            ResetScratch();
            using (Stream stream = File.Open(Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar.gz"), FileMode.Open))
            using (var archive = GZipArchive.Open(stream))
            {
                archive.AddEntry("jpg\\test.jpg", jpg);
                archive.SaveTo(Path.Combine(SCRATCH_FILES_PATH, "Tar.tar.gz"));
            }
        }
    }
}