text:
redis - a node.js redis client
===========================

[![Build Status](https://travis-ci.org/NodeRedis/node_redis.svg?branch=master)](https://travis-ci.org/NodeRedis/node_redis)
[![Coverage Status](https://coveralls.io/repos/NodeRedis/node_redis/badge.svg?branch=)](https://coveralls.io/r/NodeRedis/node_redis?branch=)
[![Windows Tests](https://img.shields.io/appveyor/ci/BridgeAR/node-redis/master.svg?label=Windows%20Tests)](https://ci.appveyor.com/project/BridgeAR/node-redis/branch/master)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/NodeRedis/node_redis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

This is a complete and feature rich Redis client for node.js. It supports all Redis commands and focuses on high performance.

Install with:

    npm install redis

## Usage Example

```js
var redis = require("redis"),
    client = redis.createClient();

// if you'd like to select database 3, instead of 0 (default), call
// client.select(3, function() { /* ... */ });

client.on("error", function (err) {
    console.log("Error " + err);
});

client.set("string key", "string val", redis.print);
client.hset("hash key", "hashtest 1", "some value", redis.print);
client.hset(["hash key", "hashtest 2", "some other value"], redis.print);
client.hkeys("hash key", function (err, replies) {
    console.log(replies.length + " replies:");
    replies.forEach(function (reply, i) {
        console.log("    " + i + ": " + reply);
    });
    client.quit();
});
```

This will display:

    mjr:~/work/node_redis (master)$ node example.js
    Reply: OK
    Reply: 0
    Reply: 0
    2 replies:
        0: hashtest 1
        1: hashtest 2
    mjr:~/work/node_redis (master)$

Note that the API is entirely asynchronous. To get data back from the server, you'll need to use a callback.
From v.2.6 on the API supports camelCase and snake_case and all options / variables / events etc. can be used either way.
It is recommended to use camelCase as this is the default for the Node.js landscape.

### Promises

You can also use node_redis with promises by promisifying node_redis with [bluebird](https://github.com/petkaantonov/bluebird) as in:

```js
var redis = require('redis');
bluebird.promisifyAll(redis.RedisClient.prototype);
bluebird.promisifyAll(redis.Multi.prototype);
```

It'll add a *Async* to all node_redis functions (e.g. return client.getAsync().then())

```js
// We expect a value 'foo': 'bar' to be present
// So instead of writing client.get('foo', cb); you have to write:
return client.getAsync('foo').then(function(res) {
    console.log(res); // => 'bar'
});

// Using multi with promises looks like:

return client.multi().get('foo').execAsync().then(function(res) {
    console.log(res); // => 'bar'
});
```

### Sending Commands

Each Redis command is exposed as a function on the `client` object.
All functions take either an `args` Array plus optional `callback` Function or
a variable number of individual arguments followed by an optional callback.
Examples:

```js
client.hmset(["key", "test keys 1", "test val 1", "test keys 2", "test val 2"], function (err, res) {});
// Works the same as
client.hmset("key", ["test keys 1", "test val 1", "test keys 2", "test val 2"], function (err, res) {});
// Or
client.hmset("key", "test keys 1", "test val 1", "test keys 2", "test val 2", function (err, res) {});
```

Note that in either form the `callback` is optional:

```js
client.set("some key", "some val");
client.set(["some other key", "some val"]);
```

If the key is missing, reply will be null. Only if the [Redis Command Reference](http://redis.io/commands) states something else it will not be null.

```js
client.get("missingkey", function(err, reply) {
    // reply is null when the key is missing
    console.log(reply);
});
```

For a list of Redis commands, see [Redis Command Reference](http://redis.io/commands)

Minimal parsing is done on the replies. Commands that return a integer return JavaScript Numbers, arrays return JavaScript Array. `HGETALL` returns an Object keyed by the hash keys. All strings will either be returned as string or as buffer depending on your setting.
Please be aware that sending null, undefined and Boolean values will result in the value coerced to a string!

# API

## Connection and other Events

`client` will emit some events about the state of the connection to the Redis server.

### "ready"

`client` will emit `ready` once a connection is established. Commands issued before the `ready` event are queued,
then replayed just before this event is emitted.

### "connect"

`client` will emit `connect` as soon as the stream is connected to the server.

### "reconnecting"

`client` will emit `reconnecting` when trying to reconnect to the Redis server after losing the connection. Listeners
are passed an object containing `delay` (in ms) and `attempt` (the attempt #) attributes.

### "error"

`client` will emit `error` when encountering an error connecting to the Redis server or when any other in node_redis occurs.
If you use a command without callback and encounter a ReplyError it is going to be emitted to the error listener.

So please attach the error listener to node_redis.

### "end"

`client` will emit `end` when an established Redis server connection has closed.

### "drain" (deprecated)

`client` will emit `drain` when the TCP connection to the Redis server has been buffering, but is now
writable. This event can be used to stream commands in to Redis and adapt to backpressure.

If the stream is buffering `client.should_buffer` is set to true. Otherwise the variable is always set to false.
That way you can decide when to reduce your send rate and resume sending commands when you get `drain`.

You can also check the return value of each command as it will also return the backpressure indicator (deprecated).
If false is returned the stream had to buffer.

### "warning"

`client` will emit `warning` when password was set but none is needed and if a deprecated option / function / similar is used.

### "idle" (deprecated)

`client` will emit `idle` when there are no outstanding commands that are awaiting a response.

## redis.createClient()
If you have `redis-server` running on the same machine as node, then the defaults for
port and host are probably fine and you don't need to supply any arguments. `createClient()` returns a `RedisClient` object. Otherwise, `createClient()` accepts these arguments:

* `redis.createClient([options])`
* `redis.createClient(unix_socket[, options])`
* `redis.createClient(redis_url[, options])`
* `redis.createClient(port[, host][, options])`

__Tip:__ If the Redis server runs on the same machine as the client consider using unix sockets if possible to increase throughput.

#### `options` object properties
| Property  | Default   | Description |
|-----------|-----------|-------------|
| host      | 127.0.0.1 | IP address of the Redis server |
| port      | 6379      | Port of the Redis server |
| path      | null      | The UNIX socket string of the Redis server |
| url       | null      | The URL of the Redis server. Format: `[redis:]//[[user][:password@]][host][:port][/db-number][?db=db-number[&password=bar[&option=value]]]` (More info avaliable at [IANA](http://www.iana.org/assignments/uri-schemes/prov/redis)). |
| parser    | javascript | __Deprecated__ Use either the built-in JS parser [`javascript`]() or the native [`hiredis`]() parser. __Note__ `node_redis` < 2.6 uses hiredis as default if installed. This changed in v.2.6.0. |
| string_numbers | null | Set to `true`, `node_redis` will return Redis number values as Strings instead of javascript Numbers. Useful if you need to handle big numbers (above `Number.MAX_SAFE_INTEGER === 2^53`). Hiredis is incapable of this behavior, so setting this option to `true` will result in the built-in javascript parser being used no matter the value of the `parser` option. |
| return_buffers | false | If set to `true`, then all replies will be sent to callbacks as Buffers instead of Strings. |
| detect_buffers | false | If set to `true`, then replies will be sent to callbacks as Buffers. This option lets you switch between Buffers and Strings on a per-command basis, whereas `return_buffers` applies to every command on a client. __Note__: This doesn't work properly with the pubsub mode. A subscriber has to either always return Strings or Buffers. |
| socket_keepalive | true | If set to `true`, the keep-alive functionality is enabled on the underlying socket. |
| no_ready_check | false |  When a connection is established to the Redis server, the server might still be loading the database from disk. While loading, the server will not respond to any commands. To work around this, `node_redis` has a "ready check" which sends the `INFO` command to the server. The response from the `INFO` command indicates whether the server is ready for more commands. When ready, `node_redis` emits a `ready` event. Setting `no_ready_check` to `true` will inhibit this check. |
| enable_offline_queue |  true | By default, if there is no active connection to the Redis server, commands are added to a queue and are executed once the connection has been established. Setting `enable_offline_queue` to `false` will disable this feature and the callback will be executed immediately with an error, or an error will be emitted if no callback is specified. |
| retry_max_delay | null | __Deprecated__ _Please use `retry_strategy` instead._ By default, every time the client tries to connect and fails, the reconnection delay almost doubles. This delay normally grows infinitely, but setting `retry_max_delay` limits it to the maximum value provided in milliseconds. |
| connect_timeout | 3600000 | __Deprecated__ _Please use `retry_strategy` instead._ Setting `connect_timeout` limits the total time for the client to connect and reconnect. The value is provided in milliseconds and is counted from the moment a new client is created or from the time the connection is lost. The last retry is going to happen exactly at the timeout time. Default is to try connecting until the default system socket timeout has been exceeded and to try reconnecting until 1h has elapsed. |
| max_attempts | 0 | __Deprecated__ _Please use `retry_strategy` instead._ By default, a client will try reconnecting until connected. Setting `max_attempts` limits total amount of connection attempts. Setting this to 1 will prevent any reconnect attempt. |
| retry_unfulfilled_commands | false | If set to `true`, all commands that were unfulfilled while the connection is lost will be retried after the connection has been reestablished. Use this with caution if you use state altering commands (e.g. `incr`). This is especially useful if you use blocking commands. |
| password | null | If set, client will run Redis auth command on connect. Alias `auth_pass` __Note__ `node_redis` < 2.5 must use `auth_pass` |
| db | null | If set, client will run Redis `select` command on connect. |
| family | IPv4 | You can force using IPv6 if you set the family to 'IPv6'. See Node.js [net](https://nodejs.org/api/net.html) or [dns](https://nodejs.org/api/dns.html) modules on how to use the family type. |
| disable_resubscribing | false | If set to `true`, a client won't resubscribe after disconnecting. |
| rename_commands | null | Passing an object with renamed commands to use instead of the original functions. See the [Redis security topics](http://redis.io/topics/security) for more info. |
| tls | null | An object containing options to pass to [tls.connect](http://nodejs.org/api/tls.html#tls_tls_connect_port_host_options_callback) to set up a TLS connection to Redis (if, for example, it is set up to be accessible via a tunnel). |
| prefix | null | A string used to prefix all used keys (e.g. `namespace:test`). Please be aware that the `keys` command will not be prefixed. The `keys` command has a "pattern" as argument and no key and it would be impossible to determine the existing keys in Redis if this would be prefixed. |
| retry_strategy | function | A function that receives an options object as parameter including the retry `attempt`, the `total_retry_time` indicating how much time passed since the last time connected, the `error` why the connection was lost and the number of `times_connected` in total. If you return a number from this function, the retry will happen exactly after that time in milliseconds. If you return a non-number, no further retry will happen and all offline commands are flushed with errors. Return an error to return that specific error to all offline commands. Example below. |

```js
var redis = require("redis");
var client = redis.createClient({detect_buffers: true});

client.set("foo_rand000000000000", "OK");

// This will return a JavaScript String
client.get("foo_rand000000000000", function (err, reply) {
    console.log(reply.toString()); // Will print `OK`
});

// This will return a Buffer since original key is specified as a Buffer
client.get(new Buffer("foo_rand000000000000"), function (err, reply) {
    console.log(reply.toString()); // Will print `<Buffer 4f 4b>`
});
client.quit();
```

retry_strategy example
```js
var client = redis.createClient({
    retry_strategy: function (options) {
        if (options.error.code === 'ECONNREFUSED') {
            // End reconnecting on a specific error and flush all commands with a individual error
            return new Error('The server refused the connection');
        }
        if (options.total_retry_time > 1000 * 60 * 60) {
            // End reconnecting after a specific timeout and flush all commands with a individual error
            return new Error('Retry time exhausted');
        }
        if (options.times_connected > 10) {
            // End reconnecting with built in error
            return undefined;
        }
        // reconnect after
        return Math.max(options.attempt * 100, 3000);
    }
});
```

## client.auth(password[, callback])

When connecting to a Redis server that requires authentication, the `AUTH` command must be sent as the
first command after connecting. This can be tricky to coordinate with reconnections, the ready check,
etc. To make this easier, `client.auth()` stashes `password` and will send it after each connection,
including reconnections. `callback` is invoked only once, after the response to the very first
`AUTH` command sent.
NOTE: Your call to `client.auth()` should not be inside the ready handler. If
you are doing this wrong, `client` will emit an error that looks
something like this `Error: Ready check failed: ERR operation not permitted`.

## backpressure

### stream

The client exposed the used [stream](https://nodejs.org/api/stream.html) in `client.stream` and if the stream or client had to [buffer](https://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback) the command in `client.should_buffer`.
In combination this can be used to implement backpressure by checking the buffer state before sending a command and listening to the stream [drain](https://nodejs.org/api/stream.html#stream_event_drain) event.

## client.quit()

This sends the quit command to the redis server and ends cleanly right after all running commands were properly handled.
If this is called while reconnecting (and therefor no connection to the redis server exists) it is going to end the connection right away instead of
resulting in further reconnections! All offline commands are going to be flushed with an error in that case.

## client.end(flush)

Forcibly close the connection to the Redis server. Note that this does not wait until all replies have been parsed.
If you want to exit cleanly, call `client.quit()` as mentioned above.

You should set flush to true, if you are not absolutely sure you do not care about any other commands.
If you set flush to false all still running commands will silently fail.

This example closes the connection to the Redis server before the replies have been read. You probably don't
want to do this:

```js
var redis = require("redis"),
    client = redis.createClient();

client.set("foo_rand000000000000", "some fantastic value", function (err, reply) {
    // This will either result in an error (flush parameter is set to true)
    // or will silently fail and this callback will not be called at all (flush set to false)
    console.log(err);
});
client.end(true); // No further commands will be processed
client.get("foo_rand000000000000", function (err, reply) {
    console.log(err); // => 'The connection has already been closed.'
});
```

`client.end()` without the flush parameter set to true should NOT be used in production!

## Error handling (>= v.2.6)

All redis errors are returned as `ReplyError`.
All unresolved commands that get rejected due to what ever reason return a `AbortError`.
As subclass of the `AbortError` a `AggregateError` exists. This is emitted in case multiple unresolved commands without callback got rejected in debug_mode.
They are all aggregated and a single error is emitted in that case.

Example:
```js
var redis = require('./');
var assert = require('assert');
var client = redis.createClient();

client.on('error', function (err) {
    assert(err instanceof Error);
    assert(err instanceof redis.AbortError);
    assert(err instanceof redis.AggregateError);
    assert.strictEqual(err.errors.length, 2); // The set and get got aggregated in here
    assert.strictEqual(err.code, 'NR_CLOSED');
});
client.set('foo', 123, 'bar', function (err, res) { // To many arguments
    assert(err instanceof redis.ReplyError); // => true
    assert.strictEqual(err.command, 'SET');
    assert.deepStrictEqual(err.args, ['foo', 123, 'bar']);

    redis.debug_mode = true;
    client.set('foo', 'bar');
    client.get('foo');
    process.nextTick(function () {
        client.end(true); // Force closing the connection while the command did not yet return
        redis.debug_mode = false;
    });
});

```

Every `ReplyError` contains the `command` name in all-caps and the arguments (`args`).

If node_redis emits a library error because of another error, the triggering error is added to the returned error as `origin` attribute.

___Error codes___

node_redis returns a `NR_CLOSED` error code if the clients connection dropped. If a command unresolved command got rejected a `UNERCTAIN_STATE` code is returned.
A `CONNECTION_BROKEN` error code is used in case node_redis gives up to reconnect.

## client.unref()

Call `unref()` on the underlying socket connection to the Redis server, allowing the program to exit once no more commands are pending.

This is an **experimental** feature, and only supports a subset of the Redis protocol. Any commands where client state is saved on the Redis server, e.g. `*SUBSCRIBE` or the blocking `BL*` commands will *NOT* work with `.unref()`.

```js
var redis = require("redis")
var client = redis.createClient()

/*
    Calling unref() will allow this program to exit immediately after the get command finishes. Otherwise the client would hang as long as the client-server connection is alive.
*/
client.unref()
client.get("foo", function (err, value){
    if (err) throw(err)
    console.log(value)
})
```

## Friendlier hash commands

Most Redis commands take a single String or an Array of Strings as arguments, and replies are sent back as a single String or an Array of Strings.
When dealing with hash values, there are a couple of useful exceptions to this.

### client.hgetall(hash, callback)

The reply from an HGETALL command will be converted into a JavaScript Object by `node_redis`. That way you can interact
with the responses using JavaScript syntax.

Example:

```js
client.hmset("hosts", "mjr", "1", "another", "23", "home", "1234");
client.hgetall("hosts", function (err, obj) {
    console.dir(obj);
});
```

Output:

```js
{ mjr: '1', another: '23', home: '1234' }
```

### client.hmset(hash, obj[, callback])

Multiple values in a hash can be set by supplying an object:

```js
client.HMSET(key2, {
    "0123456789": "abcdefghij", // NOTE: key and value will be coerced to strings
    "some manner of key": "a type of value"
});
```

The properties and values of this Object will be set as keys and values in the Redis hash.

### client.hmset(hash, key1, val1, ... keyn, valn, [callback])

Multiple values may also be set by supplying a list:

```js
client.HMSET(key1, "0123456789", "abcdefghij", "some manner of key", "a type of value");
```

## Publish / Subscribe

Example of the publish / subscribe API. This program opens two
client connections, subscribes to a channel on one of them, and publishes to that
channel on the other:

```js
var redis = require("redis");
var sub = redis.createClient(), pub = redis.createClient();
var msg_count = 0;

sub.on("subscribe", function (channel, count) {
    pub.publish("a nice channel", "I am sending a message.");
    pub.publish("a nice channel", "I am sending a second message.");
    pub.publish("a nice channel", "I am sending my last message.");
});

sub.on("message", function (channel, message) {
    console.log("sub channel " + channel + ": " + message);
    msg_count += 1;
    if (msg_count === 3) {
        sub.unsubscribe();
        sub.quit();
        pub.quit();
    }
});

sub.subscribe("a nice channel");
```

When a client issues a `SUBSCRIBE` or `PSUBSCRIBE`, that connection is put into a "subscriber" mode.
At that point, only commands that modify the subscription set are valid and quit (and depending on the redis version ping as well). When the subscription
set is empty, the connection is put back into regular mode.

If you need to send regular commands to Redis while in subscriber mode, just open another connection with a new client (hint: use `client.duplicate()`).

## Subscriber Events

If a client has subscriptions active, it may emit these events:

### "message" (channel, message)

Client will emit `message` for every message received that matches an active subscription.
Listeners are passed the channel name as `channel` and the message as `message`.

### "pmessage" (pattern, channel, message)

Client will emit `pmessage` for every message received that matches an active subscription pattern.
Listeners are passed the original pattern used with `PSUBSCRIBE` as `pattern`, the sending channel
name as `channel`, and the message as `message`.

### "message_buffer" (channel, message)

This is the same as the `message` event with the exception, that it is always going to emit a buffer.
If you listen to the `message` event at the same time as the `message_buffer`, it is always going to emit a string.

### "pmessage_buffer" (pattern, channel, message)

This is the same as the `pmessage` event with the exception, that it is always going to emit a buffer.
If you listen to the `pmessage` event at the same time as the `pmessage_buffer`, it is always going to emit a string.

### "subscribe" (channel, count)

Client will emit `subscribe` in response to a `SUBSCRIBE` command. Listeners are passed the
channel name as `channel` and the new count of subscriptions for this client as `count`.

### "psubscribe" (pattern, count)

Client will emit `psubscribe` in response to a `PSUBSCRIBE` command. Listeners are passed the
original pattern as `pattern`, and the new count of subscriptions for this client as `count`.

### "unsubscribe" (channel, count)

Client will emit `unsubscribe` in response to a `UNSUBSCRIBE` command. Listeners are passed the
channel name as `channel` and the new count of subscriptions for this client as `count`. When
`count` is 0, this client has left subscriber mode and no more subscriber events will be emitted.

### "punsubscribe" (pattern, count)

Client will emit `punsubscribe` in response to a `PUNSUBSCRIBE` command. Listeners are passed the
channel name as `channel` and the new count of subscriptions for this client as `count`. When
`count` is 0, this client has left subscriber mode and no more subscriber events will be emitted.

## client.multi([commands])

`MULTI` commands are queued up until an `EXEC` is issued, and then all commands are run atomically by
Redis. The interface in `node_redis` is to return an individual `Multi` object by calling `client.multi()`.
If any command fails to queue, all commands are rolled back and none is going to be executed (For further information look at [transactions](http://redis.io/topics/transactions)).

```js
var redis  = require("./index"),
    client = redis.createClient(), set_size = 20;

client.sadd("bigset", "a member");
client.sadd("bigset", "another member");

while (set_size > 0) {
    client.sadd("bigset", "member " + set_size);
    set_size -= 1;
}

// multi chain with an individual callback
client.multi()
    .scard("bigset")
    .smembers("bigset")
    .keys("*", function (err, replies) {
        // NOTE: code in this callback is NOT atomic
        // this only happens after the the .exec call finishes.
        client.mget(replies, redis.print);
    })
    .dbsize()
    .exec(function (err, replies) {
        console.log("MULTI got " + replies.length + " replies");
        replies.forEach(function (reply, index) {
            console.log("Reply " + index + ": " + reply.toString());
        });
    });
```

### Multi.exec([callback])

`client.multi()` is a constructor that returns a `Multi` object. `Multi` objects share all of the
same command methods as `client` objects do. Commands are queued up inside the `Multi` object
until `Multi.exec()` is invoked.

If your code contains an syntax error an EXECABORT error is going to be thrown and all commands are going to be aborted. That error contains a `.errors` property that contains the concret errors.
If all commands were queued successfully and an error is thrown by redis while processing the commands that error is going to be returned in the result array! No other command is going to be aborted though than the onces failing.

You can either chain together `MULTI` commands as in the above example, or you can queue individual
commands while still sending regular client command as in this example:

```js
var redis  = require("redis"),
    client = redis.createClient(), multi;

// start a separate multi command queue
multi = client.multi();
multi.incr("incr thing", redis.print);
multi.incr("incr other thing", redis.print);

// runs immediately
client.mset("incr thing", 100, "incr other thing", 1, redis.print);

// drains multi queue and runs atomically
multi.exec(function (err, replies) {
    console.log(replies); // 101, 2
});
```

In addition to adding commands to the `MULTI` queue individually, you can also pass an array
of commands and arguments to the constructor:

```js
var redis  = require("redis"),
    client = redis.createClient(), multi;

client.multi([
    ["mget", "multifoo", "multibar", redis.print],
    ["incr", "multifoo"],
    ["incr", "multibar"]
]).exec(function (err, replies) {
    console.log(replies);
});
```

### Multi.exec_atomic([callback])

Identical to Multi.exec but with the difference that executing a single command will not use transactions.

## client.batch([commands])

Identical to .multi without transactions. This is recommended if you want to execute many commands at once but don't have to rely on transactions.

`BATCH` commands are queued up until an `EXEC` is issued, and then all commands are run atomically by
Redis. The interface in `node_redis` is to return an individual `Batch` object by calling `client.batch()`.
The only difference between .batch and .multi is that no transaction is going to be used.
Be aware that the errors are - just like in multi statements - in the result. Otherwise both, errors and results could be returned at the same time.

If you fire many commands at once this is going to boost the execution speed significantly compared to fireing the same commands in a loop without waiting for the result! See the benchmarks for further comparison. Please remember that all commands are kept in memory until they are fired.

## Monitor mode

Redis supports the `MONITOR` command, which lets you see all commands received by the Redis server
across all client connections, including from other client libraries and other computers.

A `monitor` event is going to be emitted for every command fired from any client connected to the server including the monitoring client itself.
The callback for the `monitor` event takes a timestamp from the Redis server, an array of command arguments and the raw monitoring string.

Example:

```js
var client  = require("redis").createClient();
client.monitor(function (err, res) {
    console.log("Entering monitoring mode.");
});
client.set('foo', 'bar');

client.on("monitor", function (time, args, raw_reply) {
    console.log(time + ": " + args); // 1458910076.446514:['set', 'foo', 'bar']
});
```

# Extras

Some other things you might like to know about.

## client.server_info

After the ready probe completes, the results from the INFO command are saved in the `client.server_info`
object.

The `versions` key contains an array of the elements of the version string for easy comparison.

    > client.server_info.redis_version
    '2.3.0'
    > client.server_info.versions
    [ 2, 3, 0 ]

## redis.print()

A handy callback function for displaying return values when testing. Example:

```js
var redis = require("redis"),
    client = redis.createClient();

client.on("connect", function () {
    client.set("foo_rand000000000000", "some fantastic value", redis.print);
    client.get("foo_rand000000000000", redis.print);
});
```

This will print:

    Reply: OK
    Reply: some fantastic value

Note that this program will not exit cleanly because the client is still connected.

## Multi-word commands

To execute redis multi-word commands like `SCRIPT LOAD` or `CLIENT LIST` pass
the second word as first parameter:

    client.script('load', 'return 1');
    client.multi().script('load', 'return 1').exec(...);
    client.multi([['script', 'load', 'return 1']]).exec(...);

## client.duplicate([options][, callback])

Duplicate all current options and return a new redisClient instance. All options passed to the duplicate function are going to replace the original option.
If you pass a callback, duplicate is going to wait until the client is ready and returns it in the callback. If an error occurs in the meanwhile, that is going to return an error instead in the callback.

## client.send_command(command_name[, [args][, callback]])

All Redis commands have been added to the `client` object. However, if new commands are introduced before this library is updated,
you can use `send_command()` to send arbitrary commands to Redis.
The command_name has to be lower case.

All commands are sent as multi-bulk commands. `args` can either be an Array of arguments, or omitted / set to undefined.

## client.connected

Boolean tracking the state of the connection to the Redis server.

## client.command_queue_length

The number of commands that have been sent to the Redis server but not yet replied to. You can use this to
enforce some kind of maximum queue depth for commands while connected.

## client.offline_queue_length

The number of commands that have been queued up for a future connection. You can use this to enforce
some kind of maximum queue depth for pre-connection commands.

### Commands with Optional and Keyword arguments

This applies to anything that uses an optional `[WITHSCORES]` or `[LIMIT offset count]` in the [redis.io/commands](http://redis.io/commands) documentation.

Example:
```js
var args = [ 'myzset', 1, 'one', 2, 'two', 3, 'three', 99, 'ninety-nine' ];
client.zadd(args, function (err, response) {
    if (err) throw err;
    console.log('added '+response+' items.');

    // -Infinity and +Infinity also work
    var args1 = [ 'myzset', '+inf', '-inf' ];
    client.zrevrangebyscore(args1, function (err, response) {
        if (err) throw err;
        console.log('example1', response);
        // write your code here
    });

    var max = 3, min = 1, offset = 1, count = 2;
    var args2 = [ 'myzset', max, min, 'WITHSCORES', 'LIMIT', offset, count ];
    client.zrevrangebyscore(args2, function (err, response) {
        if (err) throw err;
        console.log('example2', response);
        // write your code here
    });
});
```

## Performance

Much effort has been spent to make `node_redis` as fast as possible for common
operations.

```
Lenovo T450s, i7-5600U and 12gb memory
clients: 1, NodeJS: 6.2.0, Redis: 3.2.0, parser: javascript, connected by: tcp
         PING,         1/1 avg/max:   0.02/  5.26 2501ms total,   46916 ops/sec
         PING,  batch 50/1 avg/max:   0.06/  4.35 2501ms total,  755178 ops/sec
   SET 4B str,         1/1 avg/max:   0.02/  4.75 2501ms total,   40856 ops/sec
   SET 4B str,  batch 50/1 avg/max:   0.11/  1.51 2501ms total,  432727 ops/sec
   SET 4B buf,         1/1 avg/max:   0.05/  2.76 2501ms total,   20659 ops/sec
   SET 4B buf,  batch 50/1 avg/max:   0.25/  1.76 2501ms total,  194962 ops/sec
   GET 4B str,         1/1 avg/max:   0.02/  1.55 2501ms total,   45156 ops/sec
   GET 4B str,  batch 50/1 avg/max:   0.09/  3.15 2501ms total,  524110 ops/sec
   GET 4B buf,         1/1 avg/max:   0.02/  3.07 2501ms total,   44563 ops/sec
   GET 4B buf,  batch 50/1 avg/max:   0.10/  3.18 2501ms total,  473171 ops/sec
 SET 4KiB str,         1/1 avg/max:   0.03/  1.54 2501ms total,   32627 ops/sec
 SET 4KiB str,  batch 50/1 avg/max:   0.34/  1.89 2501ms total,  146861 ops/sec
 SET 4KiB buf,         1/1 avg/max:   0.05/  2.85 2501ms total,   20688 ops/sec
 SET 4KiB buf,  batch 50/1 avg/max:   0.36/  1.83 2501ms total,  138165 ops/sec
 GET 4KiB str,         1/1 avg/max:   0.02/  1.37 2501ms total,   39389 ops/sec
 GET 4KiB str,  batch 50/1 avg/max:   0.24/  1.81 2501ms total,  208157 ops/sec
 GET 4KiB buf,         1/1 avg/max:   0.02/  2.63 2501ms total,   39918 ops/sec
 GET 4KiB buf,  batch 50/1 avg/max:   0.31/  8.56 2501ms total,  161575 ops/sec
         INCR,         1/1 avg/max:   0.02/  4.69 2501ms total,   45685 ops/sec
         INCR,  batch 50/1 avg/max:   0.09/  3.06 2501ms total,  539964 ops/sec
        LPUSH,         1/1 avg/max:   0.02/  3.04 2501ms total,   41253 ops/sec
        LPUSH,  batch 50/1 avg/max:   0.12/  1.94 2501ms total,  425090 ops/sec
    LRANGE 10,         1/1 avg/max:   0.02/  2.28 2501ms total,   39850 ops/sec
    LRANGE 10,  batch 50/1 avg/max:   0.25/  1.85 2501ms total,  194302 ops/sec
   LRANGE 100,         1/1 avg/max:   0.05/  2.93 2501ms total,   21026 ops/sec
   LRANGE 100,  batch 50/1 avg/max:   1.52/  2.89 2501ms total,   32767 ops/sec
 SET 4MiB str,         1/1 avg/max:   5.16/ 15.55 2502ms total,     193 ops/sec
 SET 4MiB str,  batch 20/1 avg/max:  89.73/ 99.96 2513ms total,     223 ops/sec
 SET 4MiB buf,         1/1 avg/max:   2.23/  8.35 2501ms total,     446 ops/sec
 SET 4MiB buf,  batch 20/1 avg/max:  41.47/ 50.91 2530ms total,     482 ops/sec
 GET 4MiB str,         1/1 avg/max:   2.79/ 10.91 2502ms total,     358 ops/sec
 GET 4MiB str,  batch 20/1 avg/max: 101.61/118.11 2541ms total,     197 ops/sec
 GET 4MiB buf,         1/1 avg/max:   2.32/ 14.93 2502ms total,     430 ops/sec
 GET 4MiB buf,  batch 20/1 avg/max:  65.01/ 84.72 2536ms total,     308 ops/sec
 ```

## Debugging

To get debug output run your `node_redis` application with `NODE_DEBUG=redis`.

This is also going to result in good stack traces opposed to useless ones otherwise for any async operation.
If you only want to have good stack traces but not the debug output run your application in development mode instead (`NODE_ENV=development`).

Good stack traces are only activated in development and debug mode as this results in a significant performance penalty.

___Comparison___:
Useless stack trace:
```
ReplyError: ERR wrong number of arguments for 'set' command
    at parseError (/home/ruben/repos/redis/node_modules/redis-parser/lib/parser.js:158:12)
    at parseType (/home/ruben/repos/redis/node_modules/redis-parser/lib/parser.js:219:14)
```
Good stack trace:
```
ReplyError: ERR wrong number of arguments for 'set' command
    at new Command (/home/ruben/repos/redis/lib/command.js:9:902)
    at RedisClient.set (/home/ruben/repos/redis/lib/commands.js:9:3238)
    at Context.<anonymous> (/home/ruben/repos/redis/test/good_stacks.spec.js:20:20)
    at callFnAsync (/home/ruben/repos/redis/node_modules/mocha/lib/runnable.js:349:8)
    at Test.Runnable.run (/home/ruben/repos/redis/node_modules/mocha/lib/runnable.js:301:7)
    at Runner.runTest (/home/ruben/repos/redis/node_modules/mocha/lib/runner.js:422:10)
    at /home/ruben/repos/redis/node_modules/mocha/lib/runner.js:528:12
    at next (/home/ruben/repos/redis/node_modules/mocha/lib/runner.js:342:14)
    at /home/ruben/repos/redis/node_modules/mocha/lib/runner.js:352:7
    at next (/home/ruben/repos/redis/node_modules/mocha/lib/runner.js:284:14)
    at Immediate._onImmediate (/home/ruben/repos/redis/node_modules/mocha/lib/runner.js:320:5)
    at processImmediate [as _immediateCallback] (timers.js:383:17)
```

## How to Contribute
- Open a pull request or an issue about what you want to implement / change. We're glad for any help!
 - Please be aware that we'll only accept fully tested code.

## Contributors

The original author of node_redis is [Matthew Ranney](https://github.com/mranney)

The current lead maintainer is [Ruben Bridgewater](https://github.com/BridgeAR)

Many [others](https://github.com/NodeRedis/node_redis/graphs/contributors) contributed to `node_redis` too. Thanks to all of them!

## License

[MIT](LICENSE)

### Consolidation: It's time for celebration

Right now there are two great redis clients around and both have some advantages above each other. We speak about ioredis and node_redis. So after talking to each other about how we could improve in working together we (that is @luin and @BridgeAR) decided to work towards a single library on the long run. But step by step.

First of all, we want to split small parts of our libraries into others so that we're both able to use the same code. Those libraries are going to be maintained under the NodeRedis organization. This is going to reduce the maintance overhead, allows others to use the very same code, if they need it and it's way easyer for others to contribute to both libraries.

We're very happy about this step towards working together as we both want to give you the best redis experience possible.

If you want to join our cause by help maintaining something, please don't hesitate to contact either one of us.


text:
FileTexture::FileTexture(const std::string &path, bool sRGB) : sRGB(sRGB) {
	data = stbi_load(path.c_str(), &width, &height, &numberOfComponents, 0);
	if (!data) {
		std::cout << "Error loading image " + path << ". Reason: " << stbi_failure_reason() << std::endl;
	}
}

FileTexture::~FileTexture() {
	if (data) {
		stbi_image_free(data);
	}
}

glm::vec3 FileTexture::value(float u, float v, float scaleU, float scaleV) const {
	int s = static_cast<int>(Utils::decimalPart(u * scaleU) * static_cast<float>(width - 1));
	int t = static_cast<int>(Utils::decimalPart(v * scaleV) * static_cast<float>(height - 1));

	uint32 invertedY = height - 1 - t;
	byte *texel = data + ((invertedY * width) + s) * numberOfComponents;

	glm::vec3 color(static_cast<float>(*texel) / 255.999f,
		static_cast<float>(*(texel + 1)) / 255.999f,
		static_cast<float>(*(texel + 2)) / 255.999f);

	return sRGB ? Utils::srgbToRgb(color) : color;
}

redpajama_set_name: RedPajamaGithub


text:
var M = require('./markov.js');
var TT = require('./twitter.js');
const conf = require('./conf.js');
var Twit = require('twit');
//var target = 'da_667'; // HARD TARGET for testing
var T = new Twit(conf.robot);

var options = {
  nick: conf.robot.screen_name
};
var stream = T.stream('statuses/filter', { track: options.nick });
//console.log('starting okrobot...')
stream.on('tweet', function(tweet){
  console.log(tweet.user.screen_name+": "+tweet.text)
  var arg = tweet.text.split(' ');
  // if(arg[0] != "@"+options.nick) return; // if tweet not to me...
  if((arg[1] == 'markov') ){ // markov request
    TT.twitterHistory(arg[2], function(tdata){
	let bulkString = [];
	for(let x of tdata){
		bulkString.push(M.parseText(x.text));
	};
    var mdata = M.genTweet(bulkString);
      T.post('statuses/update', { status: "@"+tweet.user.screen_name+" "+mdata.toString(), in_reply_to_status_id: tweet.id_str }, function(err, data, response) {
        console.log("status: @"+tweet.user.screen_name+" "+mdata.toString() )
        return;
      });
    })
  } else if((arg[1] == 'scrubdaddy') && (tweet.user.screen_name == 'cheeseanddope')){ // scrub tweets
    console.log(tweet.user.screen_name + " requested scrub")
    TT.scrubDaddy();
    T.post('statuses/update', { status: "@"+tweet.user.screen_name+" "+ 'scrubbing tweets daddy uwu' }, function(err, data, response) {
      console.log("status: @"+tweet.user.screen_name+" "+'scrubbing tweets')
      return;
    });
  } else { // conversation return, previously markov search request
    //var tmp = arg;
    TT.twitterSearch(arg.join(' OR '), function(tdata){
    let bulkString = [];
	for(let x of tdata){
		// console.log(x)
		bulkString.push(M.parseText(x.text));
	};
    var mdata = M.genTweet(bulkString);
      T.post('statuses/update', { status: "@"+tweet.user.screen_name+" "+mdata, in_reply_to_status_id: tweet.id_str }, function(err, data, response) {
        console.log("status: @"+tweet.user.screen_name+" "+mdata)
        return;
      });
    })
  }
});

stream.on('direct_message', function(dmesg){
console.log(dmesg)
})


text:
/*global describe, it, before, beforeEach, after, afterEach */

var request = require('request'),
  should = require('should'),
  fs = require('fs'),
  config = require('../config.json');

describe('Trips API', function () {

  // place it here to use in various tests
  var testTripID = null;

  // start server
  before(function (done) {
    this.app = require('../index');
    this.server = this.app.listen(8888, done);
  });

  // empty db
  before(function (done) {
    this.timeout(10000);
    require('../models/database').empty(done);
  });

  // create some fixtures
  before(function (done) {
    require('../models/database').batch([
      { type: 'put', key: 'trip_123', value: {id: '123', any: 'field'} },
      { type: 'put', key: 'trip_1234', value: {id: '1234', any: 'field'} },
      { type: 'put', key: 'trip_12345', value: {id: '12345', any: 'field'} },
      { type: 'put', key: 'driver_123', value: {id: '123', any: 'field'} }
    ], done);
  });

  describe('GET /trips', function () {
    it('respond with list of trips', function (done) {
      request({
        url: 'http://localhost:8888/trips',
        json: true
      }, function (err, res, body) {
        should.not.exist(err);
        res.statusCode.should.equal(200);
        body.length.should.equal(3);
        done();
      });
    });
  });
  describe('POST /admin/trips', function () {

    it('need auth', function (done) {

      var formData = {
        some: 'fields'
      };

      request({
        method: 'POST',
        url: 'http://localhost:8888/admin/trips',
        formData: formData
      }, function (err, res, body) {
        should.not.exist(err);
        res.statusCode.should.equal(401);
        done();
      });
    });

    it('create doc', function (done) {
      var req = request({
        method: 'POST',
        auth: {
          user: config.adminuser,
          pass: config.adminpass
        },
        url: 'http://localhost:8888/admin/trips',
        form: true
      }, function (err, res, body) {
        should.not.exist(err);
        res.statusCode.should.equal(200);
        body = JSON.parse(body);
        body.should.have.property('id');
        testTripID = body.id;
        body.should.have.property('attachments');
        body.should.have.property('some', 'fields');
        body.should.not.have.property('attachment1.json');
        done();
      });

      var form = req.form();
      form.append('some', 'fields');
      form.append('what', 'ever');
      form.append("attachment1.json", fs.createReadStream('./package.json'));
      form.append("attachment2.js", fs.createReadStream('./server/index.js'));

    });

  });

  describe('GET /trips/id/attachment', function () {

    it('works', function (done) {
      var url = 'http://localhost:8888/trips/' + testTripID + '/index.js';
      request(url, function (err, res, body) {
        should.not.exist(err);
        res.statusCode.should.equal(200);
        done();
      });
    });

  });

  describe('DELETE /admin/trips/:id', function () {
    it('works', function (done) {
      request({
        method: 'DELETE',
        auth: {
          user: config.adminuser,
          pass: config.adminpass
        },
        url: 'http://localhost:8888/admin/trips/' + testTripID,
        form: true
      }, function (err, res, body) {
        should.not.exist(err);
        res.statusCode.should.equal(204);
        done();
      });
    });
  });

});


text:
require_relative 'base'
require_relative 'exceptions'
require 'json'

class GdsApi::GovUkDelivery < GdsApi::Base
  include GdsApi::ExceptionHandling

  def initialize(endpoint_url, options={})
    super(endpoint_url, options.merge({timeout: 10}))
  end

  def subscribe(email, feed_urls)
    data = {email: email, feed_urls: feed_urls}
    url = "#{base_url}/subscriptions"
    post_url(url, data)
  end

  def topic(feed_url, title, description=nil)
    data = {feed_url: feed_url, title: title, description: description}
    url = "#{base_url}/lists"
    post_url(url, data)
  end

  def signup_url(feed_url)
    if response = get_json("#{base_url}/list-url?feed_url=#{CGI.escape(feed_url)}")
      response.list_url
    end
  end

  def notify(feed_urls, subject, body)
    data = {feed_urls: feed_urls, subject: subject, body: body}
    url = "#{base_url}/notifications"
    post_url(url, data)
  end

private
  def base_url
    endpoint
  end

  def post_url(url, data)
    if ! @options[:noop]
      post_json(url, data)
    elsif @options[:noop] && @options[:stdout]
      puts "Would POST #{data.to_json} to #{url}"
    end
  end
end


text:
using System;

namespace Teaq
{
    /// <summary>
    /// Interface that composes all repository query capabilities offered by Teaq.
    /// </summary>
    public interface IDataContext :
        IScalarQueryProvider,
        INonQueryProvider,
        IEntityQueryProvider,
        IValueQueryProvider,
        IDisposable
    {
        /// <summary>
        /// Gets the connection string to the underlying data store.
        /// </summary>
        string ConnectionString { get; }
    }
}


text:
<?php

namespace Test\Phinx\Util;

use Phinx\Util\Util;

class UtilTest extends \PHPUnit_Framework_TestCase
{
    private function getCorrectedPath($path)
    {
        return str_replace('/', DIRECTORY_SEPARATOR, $path);
    }

    public function testGetExistingMigrationClassNames()
    {
        $expectedResults = array(
            'TestMigration',
            'TestMigration2',
        );

        $existingClassNames = Util::getExistingMigrationClassNames($this->getCorrectedPath(__DIR__ . '/_files/migrations'));
        $this->assertCount(count($expectedResults), $existingClassNames);
        foreach ($expectedResults as $expectedResult) {
            $this->arrayHasKey($expectedResult, $existingClassNames);
        }
    }

    public function testGetExistingMigrationClassNamesWithFile()
    {
        $file = $this->getCorrectedPath(__DIR__ . '/_files/migrations/20120111235330_test_migration.php');
        $existingClassNames = Util::getExistingMigrationClassNames($file);
        $this->assertCount(0, $existingClassNames);
    }

    public function testGetCurrentTimestamp()
    {
        $dt = new \DateTime('now', new \DateTimeZone('UTC'));
        $expected = $dt->format(Util::DATE_FORMAT);

        $current = Util::getCurrentTimestamp();

        // Rather than using a strict equals, we use greater/lessthan checks to
        // prevent false positives when the test hits the edge of a second.
        $this->assertGreaterThanOrEqual($expected, $current);
        // We limit the assertion time to 2 seconds, which should never fail.
        $this->assertLessThanOrEqual($expected + 2, $current);
    }

    public function testMapClassNameToFileName()
    {
        $expectedResults = array(
            'CamelCase87afterSomeBooze'   => '/^\d{14}_camel_case87after_some_booze\.php$/',
            'CreateUserTable'             => '/^\d{14}_create_user_table\.php$/',
            'LimitResourceNamesTo30Chars' => '/^\d{14}_limit_resource_names_to30_chars\.php$/',
        );

        foreach ($expectedResults as $input => $expectedResult) {
            $this->assertRegExp($expectedResult, Util::mapClassNameToFileName($input));
        }
    }

    public function testMapFileNameToClassName()
    {
        $expectedResults = array(
            '20150902094024_create_user_table.php'    => 'CreateUserTable',
            '20150902102548_my_first_migration2.php'  => 'MyFirstMigration2',
        );

        foreach ($expectedResults as $input => $expectedResult) {
            $this->assertEquals($expectedResult, Util::mapFileNameToClassName($input));
        }
    }

    public function testisValidPhinxClassName()
    {
        $expectedResults = array(
            'CAmelCase'         => false,
            'CreateUserTable'   => true,
            'UserSeeder'        => true,
            'Test'              => true,
            'test'              => false
        );

        foreach ($expectedResults as $input => $expectedResult) {
            $this->assertEquals($expectedResult, Util::isValidPhinxClassName($input));
        }
    }
}


text:
Exposes `gh` to the global environment. Tries to follow both the form of Github
HTTP API and JS style.

    gh.authenticate("fitzgen", "sdfk32we-FAKE-uydfs7f-rhrwe8r7");
    var huddlej = gh.user("huddlej");
    huddlej.show(function (data) {
        console.log(data.user);
    });
    huddlej.repos(function (data) {
        console.log("Number of repos: " + data.repositories.length);
    });
    var wujs = gh.repo("fitzgen", "wu.js")
    wujs.show(function (data) {
        console.log("Number of watchers: " + data.repository.watchers);
    });
    wujs.update({ has_wiki: 0 }); // Unfortunately, no callbacks with POSTs :(

COMPLETE
========

* Authentication
* Users
* Repos
* Commits
* Issues
* Gists
* Network
* Objects

TODO
====

* Documentation


text:
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import * as Q from "q";
import * as tl from 'azure-pipelines-task-lib/task';

import * as javacommons from 'azure-pipelines-tasks-java-common/java-common';
import * as ccUtils from 'azure-pipelines-tasks-codecoverage-tools/codecoverageutilities';
import {CodeCoverageEnablerFactory} from 'azure-pipelines-tasks-codecoverage-tools/codecoveragefactory';

tl.setResourcePath(path.join(__dirname, 'task.json'));

const TESTRUN_SYSTEM = "VSTS - ant";
const isWindows = os.type().match(/^Win/);

function pathExistsAsFile(path: string) {
    try {
        return tl.stats(path).isFile();
    }
    catch (error) {
        return false;
    }
}

function publishTestResults(publishJUnitResults, testResultsFiles: string) {
    if (publishJUnitResults == 'true') {
        //check for pattern in testResultsFiles
        let matchingTestResultsFiles;
        if (testResultsFiles.indexOf('*') >= 0 || testResultsFiles.indexOf('?') >= 0) {
            tl.debug('Pattern found in testResultsFiles parameter');
            const buildFolder = tl.getVariable('System.DefaultWorkingDirectory');
            matchingTestResultsFiles = tl.findMatch(buildFolder, testResultsFiles, null, { matchBase: true });
        }
        else {
            tl.debug('No pattern found in testResultsFiles parameter');
            matchingTestResultsFiles = [testResultsFiles];
        }

        if (!matchingTestResultsFiles || matchingTestResultsFiles.length === 0) {
            console.log(tl.loc('NoTestResults', testResultsFiles));
            return 0;
        }

        let tp = new tl.TestPublisher("JUnit");
        const testRunTitle = tl.getInput('testRunTitle');

        tp.publish(matchingTestResultsFiles, 'true', "", "", testRunTitle, 'true', TESTRUN_SYSTEM);
    }
}

function processAntOutputLine(line) {
    if (line == null) {
        return;
    }

    const javacText = "[javac] ";
    //[java] [javac] c:\path\to\file:100: error: error_msg
    const compileErrorFileRegexWin = /^(\[java\])?\s*\[javac\]\s*([^:]:[^:]+):(\d+):\s*(.+)$/
    //[java] [javac] /path/to/file:100: error: error_msg
    const compileErrorFileRegexUnix = /^(\[java\])?\s*\[javac\]\s*([^:]+):(\d+):\s*(.+)$/
    const compileErrorFileRegex = (isWindows) ? compileErrorFileRegexWin : compileErrorFileRegexUnix;

    let severity = null;
    if (line.indexOf(javacText) >= 0) {
        // parse javac errors and warnings
        const matches = compileErrorFileRegex.exec(line);
        if (matches) {
            let errorMessage = matches[4];
            if (errorMessage) {
                if (errorMessage.startsWith('warning:')) {
                    severity = 'warning';
                } else if (errorMessage.startsWith('error:')) {
                    severity = 'error';
                }
            }

            tl.command('task.issue', {
                type: severity,
                sourcepath: matches[2],
                linenumber: matches[3],
            }, matches[0]);
        }
    }
}

async function doWork() {

    function execEnableCodeCoverage(): Q.Promise<string> {
        return enableCodeCoverage()
            .then(function (resp) {
                tl.debug("Enabled code coverage successfully");
                return "CodeCoverage_9064e1d0";
            }).catch(function (err) {
                tl.warning("Failed to enable code coverage: " + err);
                return "";
            });
    };

    function enableCodeCoverage(): Q.Promise<any> {
        if (!isCodeCoverageOpted) {
            return Q.resolve(true);
        }

        const classFilter: string = tl.getInput('classFilter');
        const classFilesDirectories: string = tl.getInput('classFilesDirectories', true);
        const sourceDirectories: string = tl.getInput('srcDirectories');
        // appending with small guid to keep it unique. Avoiding full guid to ensure no long path issues.
        const reportDirectoryName = "CCReport43F6D5EF";
        reportDirectory = path.join(buildRootPath, reportDirectoryName);
        const reportBuildFileName = "CCReportBuildA4D283EG.xml";
        reportBuildFile = path.join(buildRootPath, reportBuildFileName);
        let summaryFileName = "";
        if (ccTool.toLowerCase() == "jacoco") {
            summaryFileName = "summary.xml";
        }else if (ccTool.toLowerCase() == "cobertura") {
            summaryFileName = "coverage.xml";
        }
        summaryFile = path.join(buildRootPath, reportDirectoryName, summaryFileName);
        const coberturaCCFile = path.join(buildRootPath, "cobertura.ser");
        let instrumentedClassesDirectory = path.join(buildRootPath, "InstrumentedClasses");

        // clean any previous reports.
        try {
            tl.rmRF(coberturaCCFile);
            tl.rmRF(reportDirectory);
            tl.rmRF(reportBuildFile);
            tl.rmRF(instrumentedClassesDirectory);
        } catch (err) {
            tl.debug("Error removing previous cc files: " + err);
        }

        let buildProps: { [key: string]: string } = {};
        buildProps['buildfile'] = antBuildFile;
        buildProps['classfilter'] = classFilter
        buildProps['classfilesdirectories'] = classFilesDirectories;
        buildProps['sourcedirectories'] = sourceDirectories;
        buildProps['summaryfile'] = summaryFileName;
        buildProps['reportdirectory'] = reportDirectory;
        buildProps['ccreporttask'] = "CodeCoverage_9064e1d0"
        buildProps['reportbuildfile'] = reportBuildFile;

        let ccEnabler = new CodeCoverageEnablerFactory().getTool("ant", ccTool.toLowerCase());
        return ccEnabler.enableCodeCoverage(buildProps);
    }

    async function publishCodeCoverage(codeCoverageOpted: boolean, ccReportTask: string) {
        tl.debug("publishCodeCoverage f=" + failIfCodeCoverageEmpty + " opt=" + codeCoverageOpted + " task=" + ccReportTask);
        if (failIfCodeCoverageEmpty && codeCoverageOpted && !ccReportTask) {
            throw tl.loc('NoCodeCoverage');
        }
        else if (codeCoverageOpted && ccReportTask) {
            tl.debug("Collecting code coverage reports");
            var antRunner = tl.tool(anttool);
            antRunner.arg('-buildfile');
            if (pathExistsAsFile(reportBuildFile)) {
                antRunner.arg(reportBuildFile);
                antRunner.arg(ccReportTask);
            }
            else {
                antRunner.arg(antBuildFile);
                antRunner.arg(ccReportTask);
            }
            antRunner.exec().then(async function (code) {
                if (failIfCodeCoverageEmpty && await ccUtils.isCodeCoverageFileEmpty(summaryFile, ccTool)) {
                    throw tl.loc('NoCodeCoverage');
                }
                if (pathExistsAsFile(summaryFile)) {
                    tl.debug("Summary file = " + summaryFile);
                    tl.debug("Report directory = " + reportDirectory);
                    tl.debug("Publishing code coverage results to TFS");
                    let ccPublisher = new tl.CodeCoveragePublisher();
                    ccPublisher.publish(ccTool, summaryFile, reportDirectory, "");
                }
                else {
                    tl.warning("No code coverage results found to be published. This could occur if there were no tests executed or there was a build failure. Check the ant output for details.");
                }
            }).fail(function (err) {
                tl.warning("No code coverage results found to be published. This could occur if there were no tests executed or there was a build failure. Check the ant output for details.");
            });
        }
    }

    try {
        var anttool = tl.which('ant', true);
        var antv = tl.tool(anttool);
        antv.arg('-version');

        var antb = tl.tool(anttool);
        var antBuildFile = tl.getPathInput('antBuildFile', true, true);
        antb.arg('-buildfile');
        antb.arg(antBuildFile);

        // options and targets are optional
        antb.line(tl.getInput('options', false));
        antb.arg(tl.getDelimitedInput('targets', ' ', false));

        // update ANT_HOME if user specified path manually (not required, but if so, check it)
        var antHomeUserInputPath = tl.getPathInput('antHomeUserInputPath', false, true);
        if (antHomeUserInputPath) {
            tl.debug('Using path from user input to set ANT_HOME');
            tl.debug('Set ANT_HOME to ' + antHomeUserInputPath);
            process.env['ANT_HOME'] = antHomeUserInputPath;
        }

        // Warn if ANT_HOME is not set either locally or on the task via antHomeUserInputPath
        var antHome = tl.getVariable('ANT_HOME');
        if (!antHome) {
            tl.warning('The ANT_HOME environment variable is not set.  Please make sure that it exists and is set to the location of the bin folder.  See https://ant.apache.org/manual/install.html.');
        }

        // update JAVA_HOME if user selected specific JDK version or set path manually
        var javaHomeSelection = tl.getInput('javaHomeSelection', true);
        var specifiedJavaHome = null;
        var javaTelemetryData = null;
        if (javaHomeSelection == 'JDKVersion') {
            tl.debug('Using JDK version to find and set JAVA_HOME');
            var jdkVersion = tl.getInput('jdkVersion');
            var jdkArchitecture = tl.getInput('jdkArchitecture');
            javaTelemetryData = { "jdkVersion": jdkVersion };

            if (jdkVersion != 'default') {
                specifiedJavaHome = javacommons.findJavaHome(jdkVersion, jdkArchitecture);
            }
        }
        else {
            tl.debug('Using path from user input to set JAVA_HOME');
            var jdkUserInputPath = tl.getPathInput('jdkUserInputPath', true, true);
            specifiedJavaHome = jdkUserInputPath;
            javaTelemetryData = { "jdkVersion": "custom" };
        }
        javacommons.publishJavaTelemetry('Ant', javaTelemetryData);

        if (specifiedJavaHome) {
            tl.debug('Set JAVA_HOME to ' + specifiedJavaHome);
            process.env['JAVA_HOME'] = specifiedJavaHome;
        }

        var ccTool = tl.getInput('codeCoverageTool');
        var isCodeCoverageOpted = (typeof ccTool != "undefined" && ccTool && ccTool.toLowerCase() != 'none');
        var failIfCodeCoverageEmpty: boolean = tl.getBoolInput('failIfCoverageEmpty');
        var buildRootPath = path.dirname(antBuildFile);

        var summaryFile: string = null;
        var reportDirectory: string = null;
        var ccReportTask: string = null;
        var reportBuildFile: string = null;
        var publishJUnitResults = tl.getInput('publishJUnitResults');
        var testResultsFiles = tl.getInput('testResultsFiles', true);
        var publishJUnitResults = tl.getInput('publishJUnitResults');
        var testResultsFiles = tl.getInput('testResultsFiles', true);

        ccReportTask = await execEnableCodeCoverage();

        await antv.exec();
        var buffer;
        antb.on('stdout', (data) => {
            if (data) {
                buffer += data.toString();
                let idx = buffer.indexOf(os.EOL);
                while (idx > -1) {
                    let line = buffer.substring(0, idx);
                    processAntOutputLine(line);
                    buffer = buffer.substring(idx + os.EOL.length);
                    idx = buffer.indexOf(os.EOL);
                }
            }
        });

        await antb.exec()
            .then(async function (code) {
                publishTestResults(publishJUnitResults, testResultsFiles);
                await publishCodeCoverage(isCodeCoverageOpted, ccReportTask);
                tl.setResult(tl.TaskResult.Succeeded, "Task succeeded");
            })
            .fail(function (err) {
                console.error(err.message);
                publishTestResults(publishJUnitResults, testResultsFiles);
                tl.debug('taskRunner fail');
                tl.setResult(tl.TaskResult.Failed, err);
            });
    } catch (e) {
        tl.debug(e.message);
        tl.error(e);
        tl.setResult(tl.TaskResult.Failed, e.message);
    }
}

doWork();


text:
/* This stylesheet generated by Transfonter (http://transfonter.org) on October 1, 2016 2:41 PM */

@font-face {
	font-family: 'Libre Baskerville';
	src: url('./fonts/Libre_Baskerville/LibreBaskerville-Bold.eot');
	src: local('Libre Baskerville Bold'), local('LibreBaskerville-Bold'),
		url('./fonts/Libre_Baskerville/LibreBaskerville-Bold.eot?#iefix') format('embedded-opentype'),
		url('./fonts/Libre_Baskerville/LibreBaskerville-Bold.woff2') format('woff2'),
		url('./fonts/Libre_Baskerville/LibreBaskerville-Bold.woff') format('woff'),
		url('./fonts/Libre_Baskerville/LibreBaskerville-Bold.ttf') format('truetype'),
		url('./fonts/Libre_Baskerville/LibreBaskerville-Bold.svg#LibreBaskerville-Bold') format('svg');
	font-weight: bold;
	font-style: normal;
}

@font-face {
	font-family: 'Libre Baskerville';
	src: url('./fonts/Libre_Baskerville/LibreBaskerville-Italic.eot');
	src: local('Libre Baskerville Italic'), local('LibreBaskerville-Italic'),
		url('./fonts/Libre_Baskerville/LibreBaskerville-Italic.eot?#iefix') format('embedded-opentype'),
		url('./fonts/Libre_Baskerville/LibreBaskerville-Italic.woff2') format('woff2'),
		url('./fonts/Libre_Baskerville/LibreBaskerville-Italic.woff') format('woff'),
		url('./fonts/Libre_Baskerville/LibreBaskerville-Italic.ttf') format('truetype'),
		url('./fonts/Libre_Baskerville/LibreBaskerville-Italic.svg#LibreBaskerville-Italic') format('svg');
	font-weight: normal;
	font-style: italic;
}

@font-face {
	font-family: 'Libre Baskerville';
	src: url('./fonts/Libre_Baskerville/LibreBaskerville-Regular.eot');
	src: local('Libre Baskerville'), local('LibreBaskerville-Regular'),
		url('./fonts/Libre_Baskerville/LibreBaskerville-Regular.eot?#iefix') format('embedded-opentype'),
		url('./fonts/Libre_Baskerville/LibreBaskerville-Regular.woff2') format('woff2'),
		url('./fonts/Libre_Baskerville/LibreBaskerville-Regular.woff') format('woff'),
		url('./fonts/Libre_Baskerville/LibreBaskerville-Regular.ttf') format('truetype'),
		url('./fonts/Libre_Baskerville/LibreBaskerville-Regular.svg#LibreBaskerville-Regular') format('svg');
	font-weight: normal;
	font-style: normal;
}


text:
#include <gtest/gtest.h>
#include "tensorflow/lite/interpreter.h"
#include "tensorflow/lite/kernels/register.h"
#include "tensorflow/lite/kernels/test_util.h"
#include "tensorflow/lite/model.h"

namespace tflite {
namespace {

using ::testing::ElementsAre;

class LogicalOpModel : public SingleOpModel {
 public:
  LogicalOpModel(std::initializer_list<int> input1_shape,
                 std::initializer_list<int> input2_shape, BuiltinOperator op) {
    input1_ = AddInput(TensorType_BOOL);
    input2_ = AddInput(TensorType_BOOL);
    output_ = AddOutput(TensorType_BOOL);
    ConfigureBuiltinOp(op);
    BuildInterpreter({input1_shape, input2_shape});
  }

  int input1() { return input1_; }
  int input2() { return input2_; }

  std::vector<bool> GetOutput() { return ExtractVector<bool>(output_); }
  std::vector<int> GetOutputShape() { return GetTensorShape(output_); }

 private:
  int input1_;
  int input2_;
  int output_;

  void ConfigureBuiltinOp(BuiltinOperator op) {
    switch (op) {
      case BuiltinOperator_LOGICAL_OR: {
        SetBuiltinOp(op, BuiltinOptions_LogicalOrOptions,
                     CreateLogicalOrOptions(builder_).Union());
        break;
      }
      case BuiltinOperator_LOGICAL_AND: {
        SetBuiltinOp(op, BuiltinOptions_LogicalAndOptions,
                     CreateLogicalAndOptions(builder_).Union());
        break;
      }
      default: { FAIL() << "We shouldn't get here."; }
    }
  }
};

TEST(LogicalTest, LogicalOr) {
  LogicalOpModel model({1, 1, 1, 4}, {1, 1, 1, 4}, BuiltinOperator_LOGICAL_OR);
  model.PopulateTensor<bool>(model.input1(), {true, false, false, true});
  model.PopulateTensor<bool>(model.input2(), {true, false, true, false});
  model.Invoke();

  EXPECT_THAT(model.GetOutput(), ElementsAre(true, false, true, true));
  EXPECT_THAT(model.GetOutputShape(), ElementsAre(1, 1, 1, 4));
}

TEST(LogicalTest, BroadcastLogicalOr) {
  LogicalOpModel model({1, 1, 1, 4}, {1, 1, 1, 1}, BuiltinOperator_LOGICAL_OR);
  model.PopulateTensor<bool>(model.input1(), {true, false, false, true});
  model.PopulateTensor<bool>(model.input2(), {false});
  model.Invoke();

  EXPECT_THAT(model.GetOutput(), ElementsAre(true, false, false, true));
  EXPECT_THAT(model.GetOutputShape(), ElementsAre(1, 1, 1, 4));
}

TEST(LogicalTest, LogicalAnd) {
  LogicalOpModel model({1, 1, 1, 4}, {1, 1, 1, 4}, BuiltinOperator_LOGICAL_AND);
  model.PopulateTensor<bool>(model.input1(), {true, false, false, true});
  model.PopulateTensor<bool>(model.input2(), {true, false, true, false});
  model.Invoke();

  EXPECT_THAT(model.GetOutput(), ElementsAre(true, false, false, false));
  EXPECT_THAT(model.GetOutputShape(), ElementsAre(1, 1, 1, 4));
}

TEST(LogicalTest, BroadcastLogicalAnd) {
  LogicalOpModel model({1, 1, 1, 4}, {1, 1, 1, 1}, BuiltinOperator_LOGICAL_AND);
  model.PopulateTensor<bool>(model.input1(), {true, false, false, true});
  model.PopulateTensor<bool>(model.input2(), {true});
  model.Invoke();

  EXPECT_THAT(model.GetOutput(), ElementsAre(true, false, false, true));
  EXPECT_THAT(model.GetOutputShape(), ElementsAre(1, 1, 1, 4));
}

}  // namespace
}  // namespace tflite


text:
package com.ghstudios.android.ui.list;

import android.app.*;
import android.content.*;
import android.content.DialogInterface.*;
import android.database.Cursor;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.app.ListFragment;
import android.support.v4.content.Loader;
import android.view.*;
import android.widget.*;
import com.ghstudios.android.data.classes.ASBSet;
import com.ghstudios.android.data.database.ASBSetCursor;
import com.ghstudios.android.data.database.DataManager;
import com.ghstudios.android.loader.ASBSetListCursorLoader;
import com.ghstudios.android.mhgendatabase.R;
import com.ghstudios.android.ui.detail.*;
import com.ghstudios.android.ui.dialog.ASBSetAddDialogFragment;

public class ASBSetListFragment extends ListFragment implements LoaderCallbacks<Cursor> {

    public static final String EXTRA_ASB_SET_ID = "com.daviancorp.android.ui.general.asb_set_id";
    public static final String EXTRA_ASB_SET_NAME = "com.daviancorp.android.ui.general.asb_set_name";
    public static final String EXTRA_ASB_SET_RANK = "com.daviancorp.android.ui.general.asb_set_rank";
    public static final String EXTRA_ASB_SET_HUNTER_TYPE = "com.daviancorp.android.ui.general.asb_set_hunter_type";

    public static final String DIALOG_ADD_ASB_SET = "add_asb_set";

    public static final int REQUEST_ADD_ASB_SET = 0;
    public static final int REQUEST_EDIT_ASB_SET = 1;

    FloatingActionButton fab;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setHasOptionsMenu(true);
        getLoaderManager().initLoader(R.id.asb_set_list_fragment, null, this);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
       View view = inflater.inflate(R.layout.fragment_list_generic_context, container, false);
       fab = (FloatingActionButton) view.findViewById(R.id.fab);
       fab.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               showAddDialog();
           }
       });
        return view;

    }

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        super.onCreateOptionsMenu(menu, inflater);
        inflater.inflate(R.menu.menu_asb_set_list, menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.asb_set_add:
                showAddDialog();
                return true;

            default:
                return false;
        }
    }

    public void showAddDialog() {
        FragmentManager fm = getActivity().getSupportFragmentManager();
        ASBSetAddDialogFragment dialog = ASBSetAddDialogFragment.newInstance();
        dialog.setTargetFragment(this, REQUEST_ADD_ASB_SET);
        dialog.show(fm, DIALOG_ADD_ASB_SET);
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == Activity.RESULT_OK) {
            switch (requestCode) {
                case REQUEST_ADD_ASB_SET: {
                    String name = data.getStringExtra(EXTRA_ASB_SET_NAME);
                    int rank = data.getIntExtra(EXTRA_ASB_SET_RANK, -1);
                    int hunterType = data.getIntExtra(EXTRA_ASB_SET_HUNTER_TYPE, -1);

                    DataManager.get(getActivity()).queryAddASBSet(
                            name,
                            rank,
                            hunterType
                    );

                    updateUI();
                    break;
                }

                case REQUEST_EDIT_ASB_SET: {
                    long id = data.getLongExtra(EXTRA_ASB_SET_ID, -1);
                    String name = data.getStringExtra(EXTRA_ASB_SET_NAME);
                    int rank = data.getIntExtra(EXTRA_ASB_SET_RANK, -1);
                    int hunterType = data.getIntExtra(EXTRA_ASB_SET_HUNTER_TYPE, -1);

                    DataManager.get(getActivity()).queryUpdateASBSet(id, name, rank, hunterType);

                    updateUI();
                    break;
                }
            }
        }
    }

    @Override
    public void onListItemClick(ListView l, View v, int position, long id) {
        Intent i = new Intent(getActivity(), ASBActivity.class);
        i.putExtra(EXTRA_ASB_SET_NAME, v.getTag().toString());
        i.putExtra(EXTRA_ASB_SET_ID, id);
        startActivity(i);
    }

    @Override
    public Loader<Cursor> onCreateLoader(int id, Bundle args) {
        return new ASBSetListCursorLoader(getActivity());
    }

    @Override
    public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
        ASBSetListCursorAdapter adapter = new ASBSetListCursorAdapter(getActivity(), (ASBSetCursor) cursor);
        setListAdapter(adapter);

        final ListView l = getListView();
        l.setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() {
            @Override
            public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
                mode.setTitle(l.getCheckedItemCount() + " selected");

                if (l.getCheckedItemCount() > 1) {
                    // We hide the edit button since you can only edit one set at a time
                    mode.getMenu().findItem(R.id.action_edit_data).setVisible(false);
                }
                else {
                    mode.getMenu().findItem(R.id.action_edit_data).setVisible(true);
                }
            }

            @Override
            public boolean onCreateActionMode(ActionMode mode, Menu menu) {
                MenuInflater inflater = mode.getMenuInflater();
                inflater.inflate(R.menu.context_menu_asb_list, menu);
                return true;
            }

            @Override
            public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
                return false;
            }

            @Override
            public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
                switch (item.getItemId()) {
                    case R.id.action_edit_data:
                        ASBSet set = DataManager.get(getActivity()).getASBSet(l.getCheckedItemIds()[0]);

                        FragmentManager fm = getActivity().getSupportFragmentManager();
                        ASBSetAddDialogFragment dialog = ASBSetAddDialogFragment.newInstance(
                                set.getId(),
                                set.getName(),
                                set.getRank(),
                                set.getHunterType()
                        );
                        dialog.setTargetFragment(ASBSetListFragment.this, REQUEST_EDIT_ASB_SET);
                        dialog.show(fm, DIALOG_ADD_ASB_SET);
                        break;

                    case R.id.action_delete:
                        createConfirmDeleteDialog().show();
                        break;

                    case R.id.action_copy:
                        createConfirmCopyDialog().show();
                        break;
                }
                return false;
            }

            @Override
            public void onDestroyActionMode(ActionMode mode) { }

            private AlertDialog.Builder createConfirmDeleteDialog() {
                AlertDialog.Builder b = new AlertDialog.Builder(getActivity())
                        .setPositiveButton(R.string.delete, new OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                for (long id : l.getCheckedItemIds()) {
                                    DataManager.get(getActivity()).queryDeleteASBSet(id);
                                }
                                updateUI();
                            }
                        })
                        .setNegativeButton(android.R.string.cancel, null);

                if (l.getCheckedItemCount() == 1) {
                    b.setMessage(getResources().getString(R.string.dialog_message_delete, DataManager.get(getActivity()).getASBSet(l.getCheckedItemIds()[0]).getName()))
                            .setTitle(R.string.asb_dialog_title_delete_set);
                }
                else {
                    b.setMessage(getResources().getString(R.string.dialog_message_delete_multi, l.getCheckedItemCount()))
                            .setTitle(R.string.asb_dialog_title_delete_set_multi);
                }

                return b;
            }

            private AlertDialog.Builder createConfirmCopyDialog() {
                AlertDialog.Builder b = new AlertDialog.Builder(getActivity())
                        .setPositiveButton(R.string.copy, new OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                for (long id : l.getCheckedItemIds()) {
                                    DataManager.get(getActivity()).queryAddASBSet(id);
                                }
                                updateUI();
                            }
                        })
                        .setNegativeButton(android.R.string.cancel, null);

                if (l.getCheckedItemCount() == 1) {
                    b.setMessage(getResources().getString(R.string.dialog_message_copy, DataManager.get(getActivity()).getASBSet(l.getCheckedItemIds()[0]).getName()))
                            .setTitle(R.string.asb_dialog_title_copy_set);
                }
                else {
                    b.setMessage(getResources().getString(R.string.dialog_message_delete_multi, l.getCheckedItemCount()))
                            .setTitle(R.string.asb_dialog_title_copy_set_multi);
                }

                return b;
            }
        });

        l.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE_MODAL);
    }

    @Override
    public void onLoaderReset(Loader<Cursor> loader) {
        // Stop using the cursor (via the adapter)
        setListAdapter(null);
    }

    private void updateUI() {
        getLoaderManager().getLoader(R.id.asb_set_list_fragment).forceLoad();
        ASBSetListCursorAdapter adapter = (ASBSetListCursorAdapter) getListAdapter();
        adapter.notifyDataSetChanged();
    }

    private class ASBSetListCursorAdapter extends CursorAdapter {

        private ASBSetCursor cursor;

        public ASBSetListCursorAdapter(Context context, ASBSetCursor cursor) {
            super(context, cursor, 0);

            this.cursor = cursor;
        }

        @Override
        public View newView(Context context, Cursor cursor, ViewGroup parent) {
            // Use a layout inflater to get a row view
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            return inflater.inflate(R.layout.fragment_asb_sets_list_item, parent, false);
        }

        @Override
        public void bindView(View view, Context context, Cursor cursor) {
            final ASBSet set = this.cursor.getASBSet();

            TextView textView = (TextView) view.findViewById(R.id.name_text);
            textView.setText(set.getName());

            TextView propertiesText = (TextView) view.findViewById(R.id.properties_text);

            int rank = set.getRank();
            String[] arr = context.getResources().getStringArray(R.array.rank);
            if(rank>= arr.length) rank = arr.length-1;

            String rankString = arr[rank] + " Rank";
            String hunterType = context.getResources().getStringArray(R.array.hunter_type)[set.getHunterType()];

            propertiesText.setText(rankString + ", " + hunterType);

            view.setTag(set.getName());
        }
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta name="generator"

content="HTML Tidy for Mac OS, see www.w3.org" />

<title>XHTML Functional -- ANCHOR - STYLE</title>

Clicking here should link to

Netscape's home page. There should be a solid border around the

link.