text:
#ifndef TIMEAPP_H
#define TIMEAPP_H

#include "gatt.h"

#ifdef __cplusplus
extern "C"
{
#endif

/*********************************************************************
 * INCLUDES
 */

/*********************************************************************
 * CONSTANTS
 */

// Time App Task Events
#define START_DEVICE_EVT                              0x0001
#define START_DISCOVERY_EVT                           0x0002
#define CLOCK_UPDATE_EVT                              0x0004

// Time App discovery states
enum
{
  DISC_IDLE = 0x00,                       // Idle state

  DISC_CURR_TIME_START = 0x10,            // Current time service
  DISC_CURR_TIME_SVC,                     // Discover service
  DISC_CURR_TIME_CHAR,                    // Discover all characteristics
  DISC_CURR_TIME_CT_TIME_CCCD,            // Discover CT time CCCD

  DISC_DST_CHG_START = 0x20,              // DST change service
  DISC_DST_CHG_SVC,                       // Discover service
  DISC_DST_CHG_CHAR,                      // Discover all characteristics

  DISC_REF_TIME_START = 0x30,             // Reference time service
  DISC_REF_TIME_SVC,                      // Discover service
  DISC_REF_TIME_CHAR,                     // Discover all characteristics

  DISC_NWA_START = 0x40,                  // NwA service
  DISC_NWA_SVC,                           // Discover service
  DISC_NWA_CHAR,                          // Discover all characteristics
  DISC_NWA_NWA_CCCD,                      // Discover NwA CCCD

  DISC_ALERT_NTF_START = 0x50,            // Alert notification service
  DISC_ALERT_NTF_SVC,                     // Discover service
  DISC_ALERT_NTF_CHAR,                    // Discover all characteristics
  DISC_ALERT_NTF_NEW_CCCD,                // Discover new alert CCCD
  DISC_ALERT_NTF_UNREAD_CCCD,             // Discover unread alert status CCCD

  DISC_BATT_START = 0x60,                 // Battery service
  DISC_BATT_SVC,                          // Discover service
  DISC_BATT_CHAR,                         // Discover all characteristics
  DISC_BATT_LVL_CCCD,                     // Discover battery level CCCD

  DISC_PAS_START = 0x70,                  // Phone alert status service
  DISC_PAS_SVC,                           // Discover service
  DISC_PAS_CHAR,                          // Discover all characteristics
  DISC_PAS_ALERT_CCCD,                    // Discover alert status CCCD
  DISC_PAS_RINGER_CCCD,                   // Discover ringer setting CCCD

  DISC_FAILED = 0xFF                      // Discovery failed
};

// Time App handle cache indexes
enum
{
  HDL_CURR_TIME_CT_TIME_START,            // Current time start handle
  HDL_CURR_TIME_CT_TIME_END,              // Current time end handle
  HDL_CURR_TIME_CT_TIME_CCCD,             // Current time CCCD
  HDL_CURR_TIME_LOC_INFO,                 // Local time info
  HDL_CURR_TIME_REF_INFO,                 // Reference time info

  HDL_DST_CHG_TIME_DST,                   // Time with DST

  HDL_REF_TIME_UPD_CTRL,                  // Time update control point
  HDL_REF_TIME_UPD_STATE,                 // Time update state

  HDL_NWA_NWA_START,                      // NwA start handle
  HDL_NWA_NWA_END,                        // NwA end handle
  HDL_NWA_NWA_CCCD,                       // NwA CCCD

  HDL_ALERT_NTF_NEW_START,                // New alert start handle
  HDL_ALERT_NTF_NEW_END,                  // New alert end handle
  HDL_ALERT_NTF_UNREAD_START,             // Unread alert status start handle
  HDL_ALERT_NTF_UNREAD_END,               // Unread alert status end handle
  HDL_ALERT_NTF_CTRL,                     // Alert notification control point
  HDL_ALERT_NTF_NEW_CAT,                  // Supported New Alert Category
  HDL_ALERT_NTF_UNREAD_CAT,               // Supported Unread Alert Category
  HDL_ALERT_NTF_NEW_CCCD,                 // New alert CCCD
  HDL_ALERT_NTF_UNREAD_CCCD,              // Alert unread alert status CCCD

  HDL_BATT_LEVEL_START,                   // Battery level start handle
  HDL_BATT_LEVEL_END,                     // Battery level end handle
  HDL_BATT_LEVEL_CCCD,                    // Battery level CCCD

  HDL_PAS_ALERT_START,                    // Alert status start handle
  HDL_PAS_ALERT_END,                      // Alert status end handle
  HDL_PAS_RINGER_START,                   // Ringer setting start handle
  HDL_PAS_RINGER_END,                     // Ringer setting end handle
  HDL_PAS_CTRL,                           // Ringer control point
  HDL_PAS_ALERT_CCCD,                     // Alert status CCCD
  HDL_PAS_RINGER_CCCD,                    // Ringer setting CCCD

  HDL_CACHE_LEN
};

// Configuration states
#define TIMEAPP_CONFIG_START              0x00
#define TIMEAPP_CONFIG_CMPL               0xFF

// Alert Notification Service values for alert notification control point
#define ALERT_NOTIF_ENABLE_NEW            0   // Enable New Incoming Alert Notification
#define ALERT_NOTIF_ENABLE_UNREAD         1   // Enable Unread Category Status Notification
#define ALERT_NOTIF_DISABLE_NEW           2   // Disable New Incoming Alert Notification
#define ALERT_NOTIF_DISABLE_UNREAD        3   // Disable Unread Category Status Notification
#define ALERT_NOTIF_NOTIFY_NEW            4   // Notify New Incoming Alert immediately
#define ALERT_NOTIF_NOTIFY_UNREAD         5   // Notify Unread Category Status immediately

// Alert Notification Service category IDs
#define ALERT_NOTIF_CAT_ALL               0xFF

// Index into timeAppConfigList to start of connection setup characteristics
#define TIMEAPP_CONFIG_CONN_START         15

/*********************************************************************
 * MACROS
 */

// LCD macros
#if HAL_LCD == TRUE
#define LCD_WRITE_STRING(str, option)                       HalLcdWriteString( (str), (option))
#define LCD_WRITE_SCREEN(line1, line2)                      HalLcdWriteScreen( (line1), (line2) )
#define LCD_WRITE_STRING_VALUE(title, value, format, line)  HalLcdWriteStringValue( (title), (value), (format), (line) )
#else
#define LCD_WRITE_STRING(str, option)
#define LCD_WRITE_SCREEN(line1, line2)
#define LCD_WRITE_STRING_VALUE(title, value, format, line)
#endif

/*********************************************************************
 * GLOBAL VARIABLES
 */

// Task ID
extern uint8 timeAppTaskId;

// Connection handle
extern uint16 timeAppConnHandle;

// Handle cache
extern uint16 timeAppHdlCache[HDL_CACHE_LEN];

/*********************************************************************
 * FUNCTIONS
 */

/*
 * Task Initialization for the BLE Application
 */
extern void TimeApp_Init( uint8 task_id );

/*
 * Task Event Processor for the BLE Application
 */
extern uint16 TimeApp_ProcessEvent( uint8 task_id, uint16 events );

/*
 * Time App clock functions
 */
extern void timeAppClockInit( void );
extern void timeAppClockDisplay( void );
extern void timeAppClockSet( uint8 *pData );

/*
 * Time App service discovery functions
 */
extern uint8 timeAppDiscStart( void );
extern uint8 timeAppDiscGattMsg( uint8 state, gattMsgEvent_t *pMsg );

/*
 * Time App characteristic configuration functions
 */
extern uint8 timeAppConfigNext( uint8 state );
extern uint8 timeAppConfigGattMsg( uint8 state, gattMsgEvent_t *pMsg );

/*
 * Time App indication and notification handling functions
 */
extern void timeAppIndGattMsg( gattMsgEvent_t *pMsg );

/*********************************************************************
*********************************************************************/

#ifdef __cplusplus
}
#endif

#endif /* TIMEAPP_H */


text:
#ifndef __ROWSIZE_H__
#define __ROWSIZE_H__

#include <set>

#include "helper.h"

const std::set<int> VALID_ROWSIZES = {K(16), K(32), K(64), K(128), K(256)};

#define PAGES_PER_ROW (rowsize / PAGESIZE)
#define MAX_ROWSIZE K(256)

int RS_autodetect(void);

struct model {
    std::string model; // ro.product.model
    std::string name;  // ro.product.name
    std::string board; // ro.product.board
    std::string platform; // ro.board.platform
    int kmalloc_heap;
    int rowsize;
    std::string generic_name;
};

#endif // __ROWSIZE_H__

redpajama_set_name: RedPajamaGithub


text:
package services.testdata.candidate.onlinetests.phase1

import common.FutureEx
import javax.inject.{ Inject, Singleton }
import model.exchange.testdata.CreateCandidateResponse.CreateCandidateResponse
import model.testdata.candidate.CreateCandidateData.CreateCandidateData
import org.joda.time.DateTime
import play.api.mvc.RequestHeader
import services.onlinetesting.phase1.Phase1TestService
import services.testdata.candidate.ConstructiveGenerator
import uk.gov.hmrc.http.HeaderCarrier

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future

@Singleton
class Phase1TestsStartedStatusGenerator @Inject() (val previousStatusGenerator: Phase1TestsInvitedStatusGenerator,
                                                   otService: Phase1TestService
                                                  ) extends ConstructiveGenerator {

  def generate(generationId: Int, generatorConfig: CreateCandidateData)
              (implicit hc: HeaderCarrier, rh: RequestHeader): Future[CreateCandidateResponse] = {
    for {
      candidate <- previousStatusGenerator.generate(generationId, generatorConfig)
      _ <- FutureEx.traverseSerial(candidate.phase1TestGroup.get.tests.map(_.orderId))(orderId =>
        otService.markAsStarted(orderId, generatorConfig.phase1TestData.flatMap(_.start).getOrElse(DateTime.now))
      )
    } yield candidate
  }
}


text:
package org.jbehaviour.plugins.remote;

public interface IResourcesItem {
	String getName();
	String getLongName();
	boolean isCanRead();
	boolean isCanWrite();
	long getSize();
	void setName(String name);
	void setLongName(String longName);
	void setCanRead(boolean canRead);
	void setCanWrite(boolean canWrite);
	void setSize(long _size);
}


text:
package org.hisp.dhis.api.mobile.model.LWUITmodel;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.List;

import org.hisp.dhis.api.mobile.model.Model;
import org.hisp.dhis.api.mobile.model.ModelList;
import org.hisp.dhis.api.mobile.model.OptionSet;
import org.hisp.dhis.common.ValueType;

 /**
 * @author Nguyen Kim Lai
 */
public class ProgramStageDataElement extends Model
{
    private String clientVersion;

    private String type;

    private String numberType;

    private boolean compulsory;

    private ModelList categoryOptionCombos;

    private OptionSet optionSet;

    private String value;

    public static final String TYPE_STRING = "string";

    public static final String TYPE_PHONE_NUMBER = "phoneNumber";

    public static final String TYPE_EMAIL = "email";

    public static final String TYPE_NUMBER = "number";

    public static final String TYPE_LETTER = "letter";

    public static final String TYPE_BOOL = "bool";

    public static final String TYPE_TRUE_ONLY = "trueOnly";

    public static final String TYPE_DATE = "date";

    public static final String TYPE_TRACKER_ASSOCIATE = "trackerAssociate";

    public static final String TYPE_USERS = "users";

    @Override
    public void serialize( DataOutputStream dout )
        throws IOException
    {
        super.serialize( dout );
        dout.writeUTF( this.getType() );
        if ( this.getNumberType() != null )
        {
            dout.writeBoolean( true );
            dout.writeUTF( this.getNumberType() );
        }
        else
        {
            dout.writeBoolean( false );
        }
        dout.writeBoolean( this.isCompulsory() );

        List<Model> cateOptCombos = this.getCategoryOptionCombos().getModels();
        if ( cateOptCombos == null || cateOptCombos.size() <= 0 )
        {
            dout.writeInt( 0 );
        }
        else
        {
            dout.writeInt( cateOptCombos.size() );
            for ( Model each : cateOptCombos )
            {
                each.setClientVersion( TWO_POINT_TEN );
                each.serialize( dout );
            }
        }

        if ( optionSet == null || optionSet.getOptions().size() <= 0 )
        {
            dout.writeBoolean( false );
        }
        else
        {
            dout.writeBoolean( true );
            optionSet.setClientVersion( TWO_POINT_TEN );
            optionSet.serialize( dout );
        }

        if ( this.getValue() == null )
        {
            dout.writeBoolean( false );
        }
        else
        {
            dout.writeBoolean( true );
            dout.writeUTF( this.getValue() );
        }
    }

    @Override
    public void deSerialize( DataInputStream dint )
        throws IOException
    {
        super.deSerialize( dint );
        this.setType( dint.readUTF() );
        if( dint.readBoolean() )
        {
            this.setNumberType( dint.readUTF() );
        }
        else
        {
            this.setNumberType( null );
        }
        this.setCompulsory( dint.readBoolean() );
        this.categoryOptionCombos = new ModelList();
        this.categoryOptionCombos.deSerialize( dint );

        if( dint.readBoolean() == false )
        {
            this.optionSet = null;
        }
        else
        {
            this.optionSet = new OptionSet();
            this.optionSet.deSerialize( dint );
        }

        if ( dint.readBoolean() == false )
        {
            this.setValue( null );
        }
        else
        {
            this.setValue( dint.readUTF() );
        }
    }

    @Override
    public String getClientVersion()
    {
        return clientVersion;
    }

    @Override
    public void setClientVersion( String clientVersion )
    {
        this.clientVersion = clientVersion;
    }

    public String getValue()
    {
        return value;
    }

    public void setValue( String value )
    {
        this.value = value;
    }

    public String getType()
    {
        return type;
    }

    public void setType( String type )
    {
        this.type = type;
    }

    public void setType (ValueType type) {
        if ( type == ValueType.BOOLEAN )
        {
            this.setType( TYPE_BOOL );
        }
        else if ( type == ValueType.DATE || type == ValueType.DATETIME )
        {
            this.setType( TYPE_DATE );
        }
        else if ( type == ValueType.EMAIL )
        {
            this.setType( TYPE_EMAIL );
        }
        else if ( type == ValueType.INTEGER || type == ValueType.NUMBER )
        {
            this.setType( TYPE_NUMBER );
        }
        else if ( type == ValueType.LETTER )
        {
            this.setType( TYPE_LETTER );
        }
        else if ( type == ValueType.LONG_TEXT )
        {
            this.setType( TYPE_STRING );
        }
        else if ( type == ValueType.PHONE_NUMBER )
        {
            this.setType( TYPE_PHONE_NUMBER );
        }
        else if ( type == ValueType.TRACKER_ASSOCIATE )
        {
            this.setType( TYPE_TRACKER_ASSOCIATE );
        }
        else if ( type == ValueType.TRUE_ONLY )
        {
            this.setType( TYPE_TRUE_ONLY );
        }
        else if ( type == ValueType.USERNAME )
        {
            this.setType( TYPE_USERS );
        }
        else
        {
            this.setType( TYPE_STRING );
        }
    }

    public boolean isCompulsory()
    {
        return compulsory;
    }

    public void setCompulsory( boolean compulsory )
    {
        this.compulsory = compulsory;
    }

    public ModelList getCategoryOptionCombos()
    {
        return categoryOptionCombos;
    }

    public void setCategoryOptionCombos( ModelList categoryOptionCombos )
    {
        this.categoryOptionCombos = categoryOptionCombos;
    }

    public OptionSet getOptionSet()
    {
        return optionSet;
    }

    public void setOptionSet( OptionSet optionSet )
    {
        this.optionSet = optionSet;
    }

    public String getNumberType()
    {
        return numberType;
    }

    public void setNumberType( String numberType )
    {
        this.numberType = numberType;
    }

}


text:
title: Noa
date: 12/04/2021
---

**Postanak 6,9**

**U mnoštvu zapisa koji govore o zlu pretpotopnog svijeta, Noa se ističe kao suprotnost onima koji su ga okruživali. Pogledajte koje se tri pojedinosti spominju u vezi s njim u uvodnom retku. Opišite što prema vašem mišljenju znači svaka od tih pojedinosti:**

`1.	Noa je bio "pravedan"`

`2.	Bio je "bezazlen"`

`3.	"S Bogom je hodio"`

Noa je očito imao spasonosni odnos s Gospodinom. S njim je Bog mogao raditi, slušao Ga je i bio Mu poslušan, uzdao se u Njega. Zato je preko njega mogao ispuniti svoje ciljeve, i zato ga je Petar u Novom zavjetu, nazvao "glasnikom pravednosti" (2. Petrova 2,5).

`Pročitajte Postanak 6,8. Kako nam ovaj redak pomaže da razu-mijemo odnos između Noe i Boga?`

Riječ "milost" ovdje se prvi put pojavljuje u Svetom pismu i ima isto značenje kao u novozavjetnim tekstovima, u kojima je opisano Božje milosrđe i nezaslužena naklonost koju On pokazuje prema gre- šnicima. Dakle, treba imati u vidu da je i sam Noa, koliko god bio "pravedan" i "neporočan", još uvijek bio grešnik kojem je bila potrebna nezaslužena naklonost njegovog Boga. U tom smislu Noa se nije razlikovao od bilo koga od nas tko svesrdno nastoji slijediti Gospodina.

Imajući na umu da je i Noi bila potrebna Božja milost kao i svima nama, razmislite o svojem životu i postavite sebi pitanje: Bi li se i za mene moglo reći da sam poput Noe "pravedan", "neporočan" i da "s Bogom hodim"? Zapišite razloge za svoj odgovor, kakav god on bio, i (ako vam nije neugodno) iznesite ga u subotu pred svojim razredom.


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Rua</tipo><logradouro>D</logradouro><bairro>Vila Santa Clara</bairro><cidade>Guarujá</cidade><uf>SP</uf><cep>11435070</cep></feed>


text:
"""
Shows backlog count of ScheduledJobs of type Email
"""

from __future__ import absolute_import
from __future__ import print_function

from typing import Any
from django.conf import settings
from django.core.management.base import BaseCommand

from zerver.models import ScheduledJob

from datetime import datetime, timedelta

class Command(BaseCommand):
    help = """Shows backlog count of ScheduledJobs of type Email
(The number of currently overdue (by at least a minute) email jobs)

This is run as part of the nagios health check for the deliver_email command.
Please note that this is only relevant to the SMTP-based email delivery (no Mandrill).

Usage: ./manage.py print_email_delivery_backlog
"""

    def handle(self, *args, **options):
        # type: (*Any, **Any) -> None
        print(len(ScheduledJob.objects.filter(type=ScheduledJob.EMAIL,
                                                  scheduled_timestamp__lte=datetime.utcnow()-timedelta(minutes=1))))


text:
set -e

download(){
 wget -N --continue -P./binaries/ $*
}

echo "Downloading binaries..."

echo "Downloading kernel 2.6 (MIPS)..."
download https://github.com/firmadyne/kernel-v2.6/releases/download/v1.1/vmlinux.mipsel
download https://github.com/firmadyne/kernel-v2.6/releases/download/v1.1/vmlinux.mipseb

echo "Downloading kernel 4.1 (ARM)..."
download https://github.com/firmadyne/kernel-v4.1/releases/download/v1.1/zImage.armel

echo "Downloading console..."
download https://github.com/firmadyne/console/releases/download/v1.0/console.armel
download https://github.com/firmadyne/console/releases/download/v1.0/console.mipseb
download https://github.com/firmadyne/console/releases/download/v1.0/console.mipsel

echo "Downloading libnvram..."
download https://github.com/firmadyne/libnvram/releases/download/v1.0c/libnvram.so.armel
download https://github.com/firmadyne/libnvram/releases/download/v1.0c/libnvram.so.mipseb
download https://github.com/firmadyne/libnvram/releases/download/v1.0c/libnvram.so.mipsel

echo "Done!"


text:
package com.smcplugin.psi.impl;

import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import static com.smcplugin.psi.SmcTypes.*;
import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.smcplugin.psi.*;

public class SmcOnStateImpl extends ASTWrapperPsiElement implements SmcOnState {

  public SmcOnStateImpl(ASTNode node) {
    super(node);
  }

  public void accept(@NotNull PsiElementVisitor visitor) {
    if (visitor instanceof SmcVisitor) ((SmcVisitor)visitor).visitOnState(this);
    else super.accept(visitor);
  }

  @Override
  @Nullable
  public SmcEntry getEntry() {
    return findChildByClass(SmcEntry.class);
  }

  @Override
  @Nullable
  public SmcExit getExit() {
    return findChildByClass(SmcExit.class);
  }

}


text:
playground app for testing out hapi

## Getting Started
Install the module with: `npm install hapi`

```javascript
var hapi = require('hapi');
hapi.awesome(); // "awesome"
```

## Documentation
_(Coming soon)_

## Examples
_(Coming soon)_

## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).

## Release History
_(Nothing yet)_

## License
Copyright (c) 2014 Eric Ma
Licensed under the MIT license.


text:
package com.splunk;

import org.junit.Assert;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ServiceTest extends SDKTestCase {
    private static final String QUERY = "search index=_internal | head 10";

    @Test
    public void testCapabilities() throws Exception {
        List<String> expected = Arrays.asList(
            "admin_all_objects", "change_authentication",
            "change_own_password", "delete_by_keyword",
            "edit_deployment_client", "edit_deployment_server",
            "edit_dist_peer", "edit_forwarders", "edit_httpauths",
            "edit_input_defaults", "edit_monitor", "edit_roles",
            "edit_scripted", "edit_search_server", "edit_server",
            "edit_splunktcp", "edit_splunktcp_ssl", "edit_tcp", "edit_udp",
            "edit_user", "edit_web_settings", "get_metadata",
            "get_typeahead", "indexes_edit", "license_edit", "license_tab",
            "list_deployment_client", "list_forwarders", "list_httpauths",
            "list_inputs", "request_remote_tok", "rest_apps_management",
            "rest_apps_view", "rest_properties_get", "rest_properties_set",
            "restart_splunkd", "rtsearch", "schedule_search", "search",
            "use_file_operator");

        String[] caps = service.getCapabilities();
        for (String name : expected) {
            Assert.assertTrue(contains(caps, name));
        }
    }

    // Make a few simple requests and make sure the results look ok.
    @Test
    public void testGet() {
        // Check a few paths that we know exist
        String[] paths = {
            "/",
            "/services",
            "/services/search/jobs",
            "search/jobs",
            "authentication/users"
        };

        for (String path : paths)
            checkResponse(service.get(path));

        // And make sure we get the expected 404
        try {
            service.get("/zippy");
            Assert.fail("Expected HttpException");
        }
        catch (HttpException e) {
            Assert.assertEquals(404, e.getStatus());
        }
    }

    @Test
    public void testInfo() throws Exception {
        List <String> expected = Arrays.asList(
            "build", "cpu_arch", "guid", "isFree", "isTrial", "licenseKeys",
            "licenseSignature", "licenseState", "master_guid", "mode",
            "os_build", "os_name", "os_version", "serverName", "version");

        ServiceInfo info = service.getInfo();
        for (String name : expected)
            Assert.assertTrue(info.containsKey(name));

        info.getBuild();
        info.getCpuArch();
        info.getGuid();
        info.getLicenseKeys();
        info.getLicenseLabels();
        info.getLicenseSignature();
        info.getLicenseState();
        info.getMasterGuid();
        info.getMode();
        info.getOsBuild();
        info.getOsName();
        info.getOsVersion();
        info.getServerName();
        info.getVersion();
        info.isFree();
        info.isRtSearchEnabled();
        info.isTrial();

        Assert.assertEquals(info.getService(), service);
    }

    private void checkLoggedIn(Service service) {
        ResponseMessage response;
        response = service.get("/services/authentication/users");
        checkResponse(response);
    }

    protected void checkNotLoggedIn(Service service) {
        try {
            service.get("/services/authentication/users");
            Assert.fail("Expected HttpException");
        }
        catch (HttpException e) {
            Assert.assertEquals(401, e.getStatus());
        }
    }

    @Test
    public void testLogin() {
        Service service = new Service(
                (String) command.opts.get("host"),
                (Integer) command.opts.get("port"),
                (String) command.opts.get("scheme"));

        // Not logged in, should fail with 401
        checkNotLoggedIn(service);

        // Logged in, request should succeed
        service.login(
                (String) command.opts.get("username"),
                (String) command.opts.get("password"));
        checkLoggedIn(service);

        // Logout, the request should fail with a 401
        service.logout();
        checkNotLoggedIn(service);
    }

    @Test
    public void testLoginWithoutArguments() {
        ServiceArgs args = new ServiceArgs();
        args.setHost((String) command.opts.get("host"));
        args.setPort((Integer) command.opts.get("port"));
        args.setScheme((String) command.opts.get("scheme"));
        args.setUsername((String) command.opts.get("username"));
        args.setPassword((String) command.opts.get("password"));
        Service service = new Service(args);

        checkNotLoggedIn(service);

        service.login();
        checkLoggedIn(service);

        service.logout();
        checkNotLoggedIn(service);
    }

    @Test
    public void testLoginWithArgumentsOverridesServiceArgs() {
        ServiceArgs args = new ServiceArgs();
        args.setHost((String) command.opts.get("host"));
        args.setPort((Integer) command.opts.get("port"));
        args.setScheme((String) command.opts.get("scheme"));
        args.setUsername("I can't possibly be a user");
        args.setPassword("This password is nonsense.");
        Service service = new Service(args);

        checkNotLoggedIn(service);

        service.login(
            (String) command.opts.get("username"),
            (String) command.opts.get("password")
        );
        checkLoggedIn(service);

        service.logout();
        checkNotLoggedIn(service);
    }

    @Test(expected=IllegalStateException.class)
    public void testLoginWithoutAnyUsernameFails() {
        ServiceArgs args = new ServiceArgs();
        args.setHost((String) command.opts.get("host"));
        args.setPort((Integer) command.opts.get("port"));
        args.setScheme((String) command.opts.get("scheme"));
        Service service = new Service(args);

        service.login();
    }

    @Test
    public void testLoginWithToken() {
        String validToken = service.getToken();

        Assert.assertTrue(validToken.startsWith("Splunk "));

        Service s = new Service(service.getHost(), service.getPort());
        s.setToken(validToken);

        // Ensure we can perform some action.
        // In particular we don't expect an unauthenticated error.
        s.getSettings().refresh();

        // Make sure we're still using the same token.
        // In particular we don't want to trigger auto-login functionality
        // that gets a new token.
        Assert.assertEquals(s.getToken(), validToken);
    }

    @Test
    public void testLoginGetters() {
        Service s = new Service("theHost");
        try {
            s.login("theUser", "thePassword");
        } catch (Exception e) {
            // Don't care if login fails. It probably will.
        }

        Assert.assertEquals("theUser", s.getUsername());
        Assert.assertEquals("thePassword", s.getPassword());
    }

    @Test
    public void testJobs() throws InterruptedException {
        JobCollection jobs = service.getJobs();
        for (Job entity : jobs.values())
            testGetters(entity);

        Job job = jobs.create("search * | head 1");

        while (!job.isDone()) {
            Thread.sleep(500);
        }

        testGetters(job);
        job.cancel();
    }

    // Perform some non-intrusive inspection of the given Job object.
    private void testGetters(Job job) {
        ready(job);
        job.getDelegate();
        job.getDiskUsage();
        job.getDispatchState();
        job.getDoneProgress();
        job.getDropCount();
        job.getEarliestTime();
        job.getEventAvailableCount();
        job.getEventCount();
        job.getEventFieldCount();
        job.getEventIsStreaming();
        job.getEventIsTruncated();
        job.getEventSearch();
        job.getEventSorting();
        job.getKeywords();
        job.getLabel();
        job.getLatestTime();
        job.getNumPreviews();
        job.getPriority();
        job.getRemoteSearch();
        job.getReportSearch();
        job.getResultCount();
        job.getResultIsStreaming();
        job.getResultPreviewCount();
        job.getRunDuration();
        job.getScanCount();
        job.getSearch();
        job.getSearchEarliestTime();
        job.getSearchLatestTime();
        job.getSid();
        job.getStatusBuckets();
        job.getTtl();
        job.isDone();
        job.isFailed();
        job.isFinalized();
        job.isPaused();
        job.isPreviewEnabled();
        job.isRealTimeSearch();
        job.isSaved();
        job.isSavedSearch();
        job.isZombie();
        Assert.assertEquals(job.getName(), job.getSid());
    }

    @Test
    public void testSettersAndGettersPattern() {
        Settings settings = service.getSettings();

        // Save
        String originalHost = settings.getHost();
        int originalMinSpace = settings.getMinFreeSpace();

        // Ensure setter updates local state
        settings.setHost("sdk-host");
        Assert.assertEquals("sdk-host", settings.getHost());

        // Ensure update() merges arguments with local state
        settings.setHost("sdk-host2");
        settings.update(Args.create("minFreeSpace", 500));
        Assert.assertEquals("sdk-host2", settings.getHost());
        Assert.assertEquals(500, settings.getMinFreeSpace());

        // Ensure update argument takes precedence over local state
        settings.setMinimumFreeSpace(600);
        settings.update(Args.create("minFreeSpace", 700));
        Assert.assertEquals(700, settings.getMinFreeSpace());

        // Restore
        {
            settings.setHost(originalHost);
            settings.setMinimumFreeSpace(originalMinSpace);
            settings.update();

            Assert.assertEquals(settings.getMinFreeSpace(),
                    originalMinSpace);
            Assert.assertEquals(settings.getHost(), originalHost);
        }

        // Twiddling the host value makes Splunk want to restart.
        // No actual instability results, though.
        clearRestartMessage();
    }

    @Test
    public void testUsers() {
        Args args;
        User user;

        String username = "sdk-user";
        String password = "changeme!";

        UserCollection users = service.getUsers();

        // Cleanup potential prior failed test run.
        users.remove(username);
        Assert.assertFalse(users.containsKey(username));

        // Create user using base create method
        {
            args = new Args();
            args.put("password", password);
            args.put("roles", "power");
            user = users.create(username, args);

            Assert.assertTrue(users.containsKey(username));
            Assert.assertEquals(username, user.getName());
            Assert.assertEquals(1, user.getRoles().length);
            Assert.assertTrue(contains(user.getRoles(), "power"));

            users.remove(username);
            Assert.assertFalse(users.containsKey(username));
        }

        // Create user using derived create method
        {
            user = users.create(username, password, "power");

            Assert.assertTrue(users.containsKey(username));
            Assert.assertEquals(username, user.getName());
            Assert.assertEquals(1, user.getRoles().length);
            Assert.assertTrue(contains(user.getRoles(), "power"));

            users.remove(username);
            Assert.assertFalse(users.containsKey(username));
        }

        // Create using derived method with multiple roles
        {
            user = users.create(
                username, password, new String[] { "power", "user" });

            Assert.assertTrue(users.containsKey(username));
            Assert.assertEquals(username, user.getName());
            Assert.assertEquals(2, user.getRoles().length);
            Assert.assertTrue(contains(user.getRoles(), "power"));
            Assert.assertTrue(contains(user.getRoles(), "user"));

            users.remove(username);
            Assert.assertFalse(users.containsKey(username));
        }

        // Create using derived method with multiple roles and extra properties
        {
            args = new Args();
            args.put("realname", "Renzo");
            args.put("email", "email.me@now.com");
            args.put("defaultApp", "search");
            user = users.create(
                username, password, new String[] { "power", "user" }, args);

            Assert.assertTrue(users.containsKey(username));
            Assert.assertEquals(username, user.getName());
            Assert.assertEquals(2, user.getRoles().length);
            Assert.assertTrue(contains(user.getRoles(), "power"));
            Assert.assertTrue(contains(user.getRoles(), "user"));
            Assert.assertEquals("Renzo", user.getRealName());
            Assert.assertEquals("email.me@now.com", user.getEmail());
            Assert.assertEquals("search", user.getDefaultApp());
            Assert.assertNotNull(user.getPassword());
            user.getDefaultAppIsUserOverride();
            Assert.assertNotNull(user.getDefaultAppSourceRole());
            Assert.assertNotNull(user.getType());

            // Probe
            {
                String tz = user.getTz();

                user.setDefaultApp("search");
                user.setEmail("none@noway.com");
                user.setPassword("new-password");
                user.setRealName("SDK-name");
                if (service.versionCompare("4.3") >= 0) {
                    user.setRestartBackgroundJobs(false);
                    user.setTz("Pacific/Midway");
                }
                user.setRoles("power");
                user.update();
                user.refresh();

                Assert.assertEquals("search", user.getDefaultApp());
                Assert.assertEquals("none@noway.com", user.getEmail());
                Assert.assertEquals("SDK-name", user.getRealName());
                Assert.assertEquals(1, user.getRoles().length);
                if (service.versionIsAtLeast("4.3")) {
                    Assert.assertEquals("Pacific/Midway", user.getTz());
                }
                Assert.assertTrue(contains(user.getRoles(), "power"));

                if (service.versionIsAtLeast("4.3")) {
                    user.setTz(tz == null ? "" : tz);
                }
                user.setRoles(new String[] {"power"});
                user.update();
                user.refresh();
                Assert.assertTrue(contains(user.getRoles(), "power"));
            }

            users.remove(username);
            Assert.assertFalse(users.containsKey(username));
        }
    }

    @SuppressWarnings("deprecation")
    @Test
    public void testClassicServiceArgs() {
        ServiceArgs args = new ServiceArgs();
        args.app = "myapp";
        args.host = "myhost.splunk.com";
        args.owner = "myuser";
        args.port = 9999;
        args.scheme = "https";
        args.token = "Splunk MY_SESSION_KEY";

        Service service = new Service(args);
        Assert.assertEquals(args.app, service.getApp());
        Assert.assertEquals(args.host, service.getHost());
        Assert.assertEquals(args.owner, service.getOwner());
        Assert.assertEquals((int) args.port, (int) service.getPort());
        Assert.assertEquals(args.scheme, service.getScheme());
        Assert.assertEquals(args.token, service.getToken());
    }

    @SuppressWarnings("deprecation")
    @Test
    public void testNewServiceArgs() {
        ServiceArgs args = new ServiceArgs();
        args.setApp("myapp");
        args.setHost("myhost.splunk.com");
        args.setOwner("myuser");
        args.setPort(9999);
        args.setScheme("https");
        args.setToken("Splunk MY_SESSION_KEY");

        Assert.assertEquals("Arg setters didn't replicate value to deprecated fields.",
                args.app, "myapp");

        Service service = new Service(args);
        Assert.assertEquals(args.app, service.getApp());
        Assert.assertEquals(args.host, service.getHost());
        Assert.assertEquals(args.owner, service.getOwner());
        Assert.assertEquals((int) args.port, (int) service.getPort());
        Assert.assertEquals(args.scheme, service.getScheme());
        Assert.assertEquals(args.token, service.getToken());
    }

    @Test
    public void testNewServiceArgsAsMap() {
        ServiceArgs args = new ServiceArgs();
        args.put("app", "myapp");
        args.put("host", "myhost.splunk.com");
        args.put("owner", "myuser");
        args.put("port", 9999);
        args.put("scheme", "https");
        args.put("token", "Splunk MY_SESSION_KEY");

        Service service = new Service(args);
        Assert.assertEquals("myapp", service.getApp());
        Assert.assertEquals("myhost.splunk.com", service.getHost());
        Assert.assertEquals("myuser", service.getOwner());
        Assert.assertEquals(9999, (int) service.getPort());
        Assert.assertEquals("https", service.getScheme());
        Assert.assertEquals("Splunk MY_SESSION_KEY", service.getToken());
    }

    @Test
    public void testNewServiceArgsWithDefaults() {
        ServiceArgs args = new ServiceArgs();

        Service service = new Service(args);
        Assert.assertEquals(null, service.getApp());
        Assert.assertEquals("localhost", service.getHost());
        Assert.assertEquals(null, service.getOwner());
        Assert.assertEquals(8089, (int) service.getPort());
        Assert.assertEquals("https", service.getScheme());
        Assert.assertEquals(null, service.getToken());
    }

    @Test
    public void testConstructors() {
        Service s;

        s = new Service("localhost");
        Assert.assertEquals("localhost", s.getHost());
        Assert.assertEquals(8089, s.getPort());
        Assert.assertEquals("https", s.getScheme());

        s = new Service("localhost", 9999);
        Assert.assertEquals("localhost", s.getHost());
        Assert.assertEquals(9999, s.getPort());
        Assert.assertEquals("https", s.getScheme());

        s = new Service("localhost", 9999, "http");
        Assert.assertEquals("localhost", s.getHost());
        Assert.assertEquals(9999, s.getPort());
        Assert.assertEquals("http", s.getScheme());
    }

    @Test
    public void testSearch() throws IOException {
        service.search(QUERY);    // throws no exception

        Job job = service.search(QUERY, new Args());
        while (!job.isDone()) {
            sleep(200);
        }

        InputStream jobOutput = job.getResults();
        try {
            ResultsReaderXml resultsReader = new ResultsReaderXml(jobOutput);

            Map<String, String> event;
            int nEvents = 0;

            do {
                event = resultsReader.getNextEvent();
                if (event != null) {
                    nEvents += 1;
                }
            } while (event != null);

            Assert.assertEquals(10, nEvents);
        }
        finally {
            jobOutput.close();
        }
    }

    @Test
    public void testOneshot() throws IOException {
        service.oneshotSearch(QUERY); // throws no exception

        InputStream jobOutput = service.oneshotSearch(
            QUERY,
            new Args("output_mode", "json")
        );

        try {
            ResultsReaderJson resultsReader = new ResultsReaderJson(jobOutput);

            Map<String, String> event;
            int nEvents = 0;

            do {
                event = resultsReader.getNextEvent();
                if (event != null) {
                    nEvents += 1;
                }
            } while (event != null);

            Assert.assertEquals(10, nEvents);
        }
        finally {
            jobOutput.close();
        }
    }

    // === Utility ===

    private static void checkResponse(ResponseMessage response) {
        Assert.assertEquals(200, response.getStatus());

        // Make sure we can at least load the Atom response
        AtomFeed.parseStream(response.getContent());
    }

    // Wait for the given job to be ready
    private static Job ready(Job job) {
        while (!job.isReady()) {
            sleep(10);
        }
        return job;
    }

    @Test
    public void testLoginWithNamespace() {
        Args loginArgs = new Args();
        loginArgs.add("username", command.opts.get("username"));
        loginArgs.add("password", command.opts.get("password"));
        loginArgs.add("sharing", "user");
        loginArgs.add("owner", "admin");
        loginArgs.add("app", "search");
        loginArgs.add("host", command.opts.get("host"));
        loginArgs.add("port", command.opts.get("port"));

        Service.connect(loginArgs);
    }

    @Test
    public void testHandleErrorsReturnedAsJson() {
        JobExportArgs exportArgs = new JobExportArgs();

        exportArgs.setOutputMode(JobExportArgs.OutputMode.JSON);
        exportArgs.setSearchMode(JobExportArgs.SearchMode.REALTIME);
        exportArgs.setEarliestTime("rt");
        exportArgs.setLatestTime("rt");

        try {
            service.export("notasearchcommand", exportArgs);
        } catch (Exception e) {
            Assert.assertEquals(
                    "HTTP 400 -- {\"messages\":[{\"type\":\"FATAL\",\"text\":" +
                            "\"Unknown search command 'notasearchcommand'.\"}]}",
                    e.getMessage()
            );
            return;
        }
        Assert.fail();
    }

    @Test
    public void testDelete() {
        Args deleteArgs = Args.create("output_mode", "json");
        try {
            service.delete("/services/search/jobs/foobar_doesntexist", deleteArgs);
        } catch (HttpException e) {
            Assert.assertEquals(404, e.getStatus());
            Assert.assertNotNull(e.getDetail());
        }
    }

    @Test
    public void testPost() {
        HashMap<String, Object> args = new HashMap<String, Object>();
        args.put("foo", "bar");

        ResponseMessage response;
        response = service.post("/services/search/jobs", args);
        Assert.assertEquals(200, response.getStatus());
        Assert.assertTrue(firstLineIsXmlDtd(response.getContent()));
    }

}


text:
#include <config.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#ifdef HAVE_LINUX_LIMITS_H
#include <linux/limits.h>
#endif

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <assert.h>

#include "registers.h"

struct Clown_ActivePeriphery clown_periphery[CLOWN_NPORTS];
Bit clown_active_count = 0;
jmp_buf begin_or_abort;
struct Clown_Registers clown;

struct Clown_IOPort clown_port[CLOWN_NPORTS];
Bit    Clown_IRQ[MAX_TRAP];

DDword clown_time;

Dword read_from_port (Bit port_no)
{
    if (clown_port[port_no].used && clown_port[port_no].read_hook) {
	return clown_port[port_no].read_hook ();
    } else
	return 0;
}

void write_to_port (Bit port_no, Dword datum)
{
    if (clown_port[port_no].used && clown_port[port_no].write_hook)
	clown_port[port_no].write_hook (datum);
}

int load_device (struct Clown_IODevice *device, Bit first_port, Bit IRQ)
{
    Bit code;
    detach_device (device);
    code = attach_device (device, first_port, IRQ);

    if (!silent) {
	if (code) {
	    fprintf (stderr, "%3d registers, I/O base = %2d, IRQ = %2d.\n",
		     device->n_registers, device->first_port, device->IRQ);
	} else {
	    fprintf (stderr, "\tFailed.\n");
	}
    }
    return code;
}

int detach_device (struct Clown_IODevice *device)
{
    int i;

    if (!device)
	return 0;

    if (!device->attached)
	return 1;

    /* Check if the requested range of ports is still available */
    for (i = 0; i < device->n_registers; i++) {
	clown_port[device->first_port + i].used = 0;
	clown_port[device->first_port + i].write_hook = NULL;
	clown_port[device->first_port + i].read_hook = NULL;
    }

    Clown_IRQ[device->IRQ] = 0;

    if (device->reset || device->execute) {
	int i;
	for (i = 0; i < clown_active_count; i++)
	    if (clown_periphery[i].device == device) {
		int j;
		for (j = i + 1; j < clown_active_count; j++)
		    clown_periphery[j - 1] = clown_periphery[j];
	    }

	clown_active_count--;
    }

    device->attached = 0;
    return 1;
}

int attach_device (struct Clown_IODevice *device, Bit first_port, Bit IRQ)
{
    int i;

    if (!device)
	return 0;

    if (device->attached)
	return device->first_port == first_port;;

    /* Check if the requested range of ports is still available */
    for (i = 0; i < device->n_registers; i++)
	if (clown_port[first_port + i].used)
	    return 0;

    if (Clown_IRQ[IRQ])
	return 0;
    else {
	Clown_IRQ[IRQ] = 1;
	device->IRQ = IRQ;
    }

    /* assign ports to registers */
    for (i = 0; i < device->n_registers; i++) {
	if (device->registers[i].read_hook) {
	    clown_port[first_port + i].read_hook
		= device->registers[i].read_hook;
	    clown_port[first_port + i].used = 1;
	}
	if (device->registers[i].write_hook) {
	    clown_port[first_port + i].write_hook
		= device->registers[i].write_hook;
	    clown_port[first_port + i].used = 1;
	}
    }

    device->first_port = first_port;

    if (device->reset || device->execute) {
	clown_periphery[clown_active_count].device = device;
	clown_active_count++;
    }

    /* Pass this function to the module to enable interrupts */
/*    device->raise = raise_exception;*/
    /* Pass these functions to the module to enable direct bus control */
/*    device->read = read_from_port;
    device->write = write_to_port;*/

    if (device->init && !device->init ()) {
	detach_device (device);	/* failed to initialize */
	return 0;
    } else {
	device->attached = 1;
	return 1;
    }
}


text:
#include <sbml/common/common.h>
#include <sbml/math/FormulaParser.h>
#include <sbml/math/FormulaFormatter.h>

#include <sbml/SBase.h>
#include <sbml/Delay.h>
#include <sbml/xml/XMLNamespaces.h>
#include <sbml/SBMLDocument.h>

#include <check.h>

#include <sbml/common/extern.h>

LIBSBML_CPP_NAMESPACE_USE

BEGIN_C_DECLS

static Delay_t *D;

void
DelayTest_setup (void)
{
  D = Delay_create(2, 4);

  if (D == NULL)
  {
    fail("Delay_create() returned a NULL pointer.");
  }
}

void
DelayTest_teardown (void)
{
  Delay_free(D);
}

START_TEST (test_Delay_create)
{
  fail_unless( SBase_getTypeCode((SBase_t *) D) == SBML_DELAY );
  fail_unless( SBase_getMetaId    ((SBase_t *) D) == NULL );
  fail_unless( SBase_getNotes     ((SBase_t *) D) == NULL );
  fail_unless( SBase_getAnnotation((SBase_t *) D) == NULL );

  fail_unless( Delay_getMath(D) == NULL );
}
END_TEST

//START_TEST (test_Delay_createWithMath)
//{
//  ASTNode_t            *math = SBML_parseFormula("x^3");
//  Delay_t *fd   = Delay_createWithMath(math);
//
//  const ASTNode_t * math1;
//  char * formula;
//
//  fail_unless( SBase_getTypeCode((SBase_t *) fd) == SBML_DELAY );
//  fail_unless( SBase_getMetaId    ((SBase_t *) fd) == NULL );
//  fail_unless( SBase_getNotes     ((SBase_t *) fd) == NULL );
//  fail_unless( SBase_getAnnotation((SBase_t *) fd) == NULL );
//
//
//  math1 = Delay_getMath(fd);
//  fail_unless( math1 != NULL );
//
//  formula = SBML_formulaToString(math1);
//  fail_unless( formula != NULL );
//  fail_unless( !strcmp(formula, "x^3") );
//  fail_unless( Delay_getMath(fd) != math );
//  fail_unless( Delay_isSetMath(fd) );
//
//
//  Delay_free(fd);
//}
//END_TEST

START_TEST (test_Delay_free_NULL)
{
  Delay_free(NULL);
}
END_TEST

START_TEST (test_Delay_setMath)
{
  ASTNode_t *math = SBML_parseFormula("lambda(x, x^3)");

  const ASTNode_t * math1;
  char * formula;

  Delay_setMath(D, math);

  math1 = Delay_getMath(D);
  fail_unless( math1 != NULL );

  formula = SBML_formulaToString(math1);
  fail_unless( formula != NULL );
  fail_unless( !strcmp(formula, "lambda(x, x^3)") );
  fail_unless( Delay_getMath(D) != math );
  fail_unless( Delay_isSetMath(D) );

  /* Reflexive case (pathological) */
  Delay_setMath(D, (ASTNode_t *) Delay_getMath(D));
  math1 = Delay_getMath(D);
  fail_unless( math1 != NULL );

  formula = SBML_formulaToString(math1);
  fail_unless( formula != NULL );
  fail_unless( !strcmp(formula, "lambda(x, x^3)") );

  Delay_setMath(D, NULL);
  fail_unless( !Delay_isSetMath(D) );

  if (Delay_getMath(D) != NULL)
  {
    fail("Delay_setMath(D, NULL) did not clear ASTNode.");
  }
}
END_TEST

START_TEST (test_Delay_setMath1)
{
  ASTNode_t *math = SBML_parseFormula("2 * k");

  int i = Delay_setMath(D, math);

  fail_unless( i == LIBSBML_OPERATION_SUCCESS);
  fail_unless( Delay_getMath(D) != math );
  fail_unless( Delay_isSetMath(D) );

  i = Delay_setMath(D, NULL);

  fail_unless( i == LIBSBML_OPERATION_SUCCESS);
  fail_unless( Delay_getMath(D) == NULL );
  fail_unless( !Delay_isSetMath(D) );

  ASTNode_free(math);
}
END_TEST

START_TEST (test_Delay_setMath2)
{
  ASTNode_t *math = ASTNode_createWithType(AST_DIVIDE);

  int i = Delay_setMath(D, math);

  fail_unless( i == LIBSBML_INVALID_OBJECT);
  fail_unless( !Delay_isSetMath(D) );

  ASTNode_free(math);
}
END_TEST

START_TEST (test_Delay_createWithNS )
{
  XMLNamespaces_t *xmlns = XMLNamespaces_create();
  XMLNamespaces_add(xmlns, "http://www.sbml.org", "testsbml");
  SBMLNamespaces_t *sbmlns = SBMLNamespaces_create(2,1);
  SBMLNamespaces_addNamespaces(sbmlns,xmlns);

  Delay_t *object =
    Delay_createWithNS (sbmlns);

  fail_unless( SBase_getTypeCode  ((SBase_t *) object) == SBML_DELAY );
  fail_unless( SBase_getMetaId    ((SBase_t *) object) == NULL );
  fail_unless( SBase_getNotes     ((SBase_t *) object) == NULL );
  fail_unless( SBase_getAnnotation((SBase_t *) object) == NULL );

  fail_unless( SBase_getLevel       ((SBase_t *) object) == 2 );
  fail_unless( SBase_getVersion     ((SBase_t *) object) == 1 );

  fail_unless( Delay_getNamespaces     (object) != NULL );
  fail_unless( XMLNamespaces_getLength(Delay_getNamespaces(object)) == 2 );

  Delay_free(object);
}
END_TEST

Suite *
create_suite_Delay (void)
{
  Suite *suite = suite_create("Delay");
  TCase *tcase = tcase_create("Delay");

  tcase_add_checked_fixture( tcase,
                             DelayTest_setup,
                             DelayTest_teardown );

  tcase_add_test( tcase, test_Delay_create       );
  //tcase_add_test( tcase, test_Delay_createWithMath   );
  tcase_add_test( tcase, test_Delay_setMath      );
  tcase_add_test( tcase, test_Delay_setMath1     );
  tcase_add_test( tcase, test_Delay_setMath2     );
  tcase_add_test( tcase, test_Delay_free_NULL );
  tcase_add_test( tcase, test_Delay_createWithNS         );

  suite_add_tcase(suite, tcase);

  return suite;
}

END_C_DECLS


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<title>Register</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link href="common.css" rel="stylesheet" type="text/css" />

<?php
require 'config.php';
require 'common.php';

if(isset($_REQUEST['user']) && isset($_REQUEST['password']) && isset($_REQUEST['passwordconfirm'])) {
	$error = false;

	if($_REQUEST['user'] === '') {
		$error = true;
		echo 'Error: Enter a username
';
	}
	if($_REQUEST['password'] === '') {
		$error = true;
		echo 'Error: Enter a password
';
	}
	else if($_REQUEST['password'] !== $_REQUEST['passwordconfirm']) {
		$error = true;
		echo 'Error: Passwords do not match
';
	}
	if(!$error && file_exists($_FILES['skin']['tmp_name'])) {
		if($_FILES['skin']['size'] > 2097152) {
			$error = true;
			echo 'Error: Skin size is too big: must be less than 2 MB
';
		}
		if($_FILES['skin']['type'] !== 'image/png') {
			$error = true;
			echo 'Error: Skin file must be in PNG format
';
		}
		list($width, $height) = getimagesize($_FILES['skin']['tmp_name']);
		if($width !== 64 || $height !== 32) {
			$error = true;
			echo 'Error: Skin file must be 64px by 32px
';
		}
	}

	$mysql = new mysqli($CONFIG['host'], $CONFIG['user'], $CONFIG['pass'], $CONFIG['database']);

	$result = $mysql->query('SELECT * FROM ' . $CONFIG['table'] . ' WHERE username="' . $mysql->real_escape_string($_REQUEST['user']) . '"');
	if($result->num_rows !== 0) {
		$error = true;
		echo 'Error: Username already registered
';
	}
	$result->free();

	if(!$error) {
		$id = gen_uniq($mysql, $CONFIG['table'], 'id');

		$result = $mysql->query('INSERT INTO ' . $CONFIG['table'] . ' (id, username, password) VALUES("' . $id . '", "' . $mysql->real_escape_string($_REQUEST['user']) . '", "' . $mysql->real_escape_string(hash('sha256', $_REQUEST['password'])) . '")');
		if($result === true) {
			if(file_exists($_FILES['skin']['tmp_name'])) {
				move_uploaded_file($_FILES['skin']['tmp_name'], 'skins/' . addslashes($_REQUEST['user']) . '.png');
			}
			unset($_REQUEST['user']);

			echo 'Successfully registered
';
		}
		else {
			echo 'Error: Could not add user to database
';
		}
	}

	$mysql->close();
}
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">

Username:
<input id="user" name="user" type="text" value="<?php echo isset($_REQUEST['user']) ? $_REQUEST['user'] : ''; ?>" />

Password:
<input id="password" name="password" type="password" />

Confirm Password:
<input id="passwordconfirm" name="passwordconfirm" type="password" />

Skin File: <input name="MAX_FILE_SIZE" type="hidden" value="2097152" />
<input id="skin" name="skin" type="file" />

<input name="submit" type="submit" value="Submit"/>

</form>


text:
This is the final step when creating a new account.
This step will show the summary of the account information we want to create.
We will see a summary of the Basic Information.

Create New Account Final Step.

You can still click the "Edit" button if you want to make changes.
Further below you will also see the summary of the Service History and the Account Notes.

Click either of the "Edit" button if you want to make changes to their respective section.
When you are done, you can click the "Finish" button to create the new account. You will be
redirected to the newly created account details page.
You can still click "Previous" to go to step 3.
The "Cancel" button exits with neither saving the data nor creating the account.


text:
/** The stats dashboard for Analyst */

window.StatsDashboard = function () {
  this.populateFilters();
  this.update();
};

/** populate the filters */
StatsDashboard.prototype.populateFilters = function () {
  var instance = this;
  // get all the possible values
  d3.json('values', function (err, data) {
    d3.select('#commit').selectAll('option.data')
      .data(data.commit)
      .enter().append('option')
      .text(String)
      .attr('value', String);

      d3.select('#instanceType').selectAll('option.data')
        .data(data.instanceType)
        .enter().append('option')
        .text(String)
        .attr('value', String);

      d3.select('#graphId').selectAll('option.data')
        .data(data.graphId)
        .enter().append('option')
        .text(String)
        .attr('value', String);

      d3.select('#jobId').selectAll('option.data')
        .data(data.jobId)
        .enter().append('option')
        .text(String)
        .attr('value', String);

      d3.selectAll('#filters select').on('change', function () {
        instance.update();
      });

      d3.select('#refresh').on('click', function () {
        instance.update();
      });

      d3.select('#download').on('click', function () {
        instance.downloadCsv();
      });
  });
};

/** update the graphs */
StatsDashboard.prototype.update = function () {
  // build the query string
  var qs = [];

  ['commit', 'instanceType', 'graphId', 'jobId', 'single', 'isochrone'].forEach(function (x) {
    var y = d3.select('#' + x + ' option:checked').attr('value');
    if (y !== null)
      qs.push(x + '=' + y);
  });

  // http://stackoverflow.com/questions/14422198
  d3.select('#charts').selectAll('div').remove();
  d3.select('#charts').append('div').append('h3').text('Makeup of compute time');

  this.queryString = qs.join('&');

  d3.json('stats?' + this.queryString, function (err, data) {
    var pie = c3.generate({
      data: {
        columns: [
          ['Initial stop search'].concat(data.map(function (d) { return d.initialStopSearch; })),
          ['Walk search to destination'].concat(data.map(function (d) { return d.walkSearch; })),
          ['Transit search'].concat(data.map(function (d) { return d.initialStopSearch; })),
          ['Propagation'].concat(data.map(function (d) { return d.propagation; })),
          ['Result sets'].concat(data.map(function (d) { return d.resultSets; }))
        ],
        type: 'pie',
      }
    });
    d3.select('#charts').node().appendChild(pie.element);

    // do kernel density estimation for the compute time after applying filters
    var compute = data.map(function (d) { return (d.total - d.graphBuild - d.stopTreeCaching) / 1000; });
    var max = Math.max.apply(this, compute);
    // in 1ms bins
    var x = d3.range(0, max, 0.001);
    var kde = science.stats.kde().sample(compute)(x).map(function (d) { return d[1]; });

    d3.select('#charts').append('div').append('h3').text('Distribution of total compute time (less graph building and stop tree caching)')

    var line = c3.generate({
      data: {
        x: 'x',
        columns: [
          ['x'].concat(x),
          ['Total compute time'].concat(kde)
        ]
      },
      axis: {
        x: {
          label: 'Seconds',

        },
        y: {
          show: false,
          min: 0
        }
      },
      legend: {
        show: false
      }
    });
    d3.select('#charts').node().appendChild(line.element);

    d3.select('#charts').append('div')
      .text('viewing ' + compute.length + ' jobs');
  });
};

StatsDashboard.prototype.downloadCsv = function () {
  window.location = 'csv?' + this.queryString;
};

new window.StatsDashboard();


text:
#include "webrtc/common_types.h"
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
#include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h"
#include "webrtc/modules/video_coding/main/source/encoded_frame.h"
#include "webrtc/modules/video_coding/main/source/jitter_buffer.h"
#include "webrtc/modules/video_coding/main/source/packet.h"
#include "webrtc/modules/video_coding/main/source/video_coding_impl.h"
#include "webrtc/system_wrappers/interface/clock.h"
#include "webrtc/system_wrappers/interface/trace_event.h"

namespace webrtc {
namespace vcm {

uint32_t
VCMProcessTimer::Period() const {
    return _periodMs;
}

uint32_t
VCMProcessTimer::TimeUntilProcess() const {
    const int64_t time_since_process = _clock->TimeInMilliseconds() -
        static_cast<int64_t>(_latestMs);
    const int64_t time_until_process = static_cast<int64_t>(_periodMs) -
        time_since_process;
    if (time_until_process < 0)
      return 0;
    return time_until_process;
}

void
VCMProcessTimer::Processed() {
    _latestMs = _clock->TimeInMilliseconds();
}
}  // namespace vcm

namespace {
// This wrapper provides a way to modify the callback without the need to expose
// a register method all the way down to the function calling it.
class EncodedImageCallbackWrapper : public EncodedImageCallback {
 public:
  EncodedImageCallbackWrapper()
      : cs_(CriticalSectionWrapper::CreateCriticalSection()), callback_(NULL) {}

  virtual ~EncodedImageCallbackWrapper() {}

  void Register(EncodedImageCallback* callback) {
    CriticalSectionScoped cs(cs_.get());
    callback_ = callback;
  }

  // TODO(andresp): Change to void as return value is ignored.
  virtual int32_t Encoded(EncodedImage& encoded_image,
                          const CodecSpecificInfo* codec_specific_info,
                          const RTPFragmentationHeader* fragmentation) {
    CriticalSectionScoped cs(cs_.get());
    if (callback_)
      return callback_->Encoded(
          encoded_image, codec_specific_info, fragmentation);
    return 0;
  }

 private:
  scoped_ptr<CriticalSectionWrapper> cs_;
  EncodedImageCallback* callback_ GUARDED_BY(cs_);
};

class VideoCodingModuleImpl : public VideoCodingModule {
 public:
  VideoCodingModuleImpl(Clock* clock,
                        EventFactory* event_factory,
                        bool owns_event_factory)
      : VideoCodingModule(),
        sender_(new vcm::VideoSender(clock, &post_encode_callback_)),
        receiver_(new vcm::VideoReceiver(clock, event_factory)),
        own_event_factory_(owns_event_factory ? event_factory : NULL) {}

  virtual ~VideoCodingModuleImpl() {
    sender_.reset();
    receiver_.reset();
    own_event_factory_.reset();
  }

  virtual int32_t TimeUntilNextProcess() OVERRIDE {
    int32_t sender_time = sender_->TimeUntilNextProcess();
    int32_t receiver_time = receiver_->TimeUntilNextProcess();
    assert(sender_time >= 0);
    assert(receiver_time >= 0);
    return VCM_MIN(sender_time, receiver_time);
  }

  virtual int32_t Process() OVERRIDE {
    int32_t sender_return = sender_->Process();
    int32_t receiver_return = receiver_->Process();
    if (sender_return != VCM_OK)
      return sender_return;
    return receiver_return;
  }

  virtual int32_t InitializeSender() OVERRIDE {
    return sender_->InitializeSender();
  }

  virtual int32_t RegisterSendCodec(const VideoCodec* sendCodec,
                                    uint32_t numberOfCores,
                                    uint32_t maxPayloadSize) OVERRIDE {
    return sender_->RegisterSendCodec(sendCodec, numberOfCores, maxPayloadSize);
  }

  virtual int32_t SendCodec(VideoCodec* currentSendCodec) const OVERRIDE {
    return sender_->SendCodec(currentSendCodec);
  }

  virtual VideoCodecType SendCodec() const OVERRIDE {
    return sender_->SendCodec();
  }

  virtual int32_t RegisterExternalEncoder(VideoEncoder* externalEncoder,
                                          uint8_t payloadType,
                                          bool internalSource) OVERRIDE {
    return sender_->RegisterExternalEncoder(
        externalEncoder, payloadType, internalSource);
  }

  virtual int32_t CodecConfigParameters(uint8_t* buffer,
                                        int32_t size) OVERRIDE {
    return sender_->CodecConfigParameters(buffer, size);
  }

  virtual int Bitrate(unsigned int* bitrate) const OVERRIDE {
    return sender_->Bitrate(bitrate);
  }

  virtual int FrameRate(unsigned int* framerate) const OVERRIDE {
    return sender_->FrameRate(framerate);
  }

  virtual int32_t SetChannelParameters(uint32_t target_bitrate,  // bits/s.
                                       uint8_t lossRate,
                                       uint32_t rtt) OVERRIDE {
    return sender_->SetChannelParameters(target_bitrate, lossRate, rtt);
  }

  virtual int32_t RegisterTransportCallback(
      VCMPacketizationCallback* transport) OVERRIDE {
    return sender_->RegisterTransportCallback(transport);
  }

  virtual int32_t RegisterSendStatisticsCallback(
      VCMSendStatisticsCallback* sendStats) OVERRIDE {
    return sender_->RegisterSendStatisticsCallback(sendStats);
  }

  virtual int32_t RegisterVideoQMCallback(
      VCMQMSettingsCallback* videoQMSettings) OVERRIDE {
    return sender_->RegisterVideoQMCallback(videoQMSettings);
  }

  virtual int32_t RegisterProtectionCallback(
      VCMProtectionCallback* protection) OVERRIDE {
    return sender_->RegisterProtectionCallback(protection);
  }

  virtual int32_t SetVideoProtection(VCMVideoProtection videoProtection,
                                     bool enable) OVERRIDE {
    int32_t sender_return =
        sender_->SetVideoProtection(videoProtection, enable);
    int32_t receiver_return =
        receiver_->SetVideoProtection(videoProtection, enable);
    if (sender_return == VCM_OK)
      return receiver_return;
    return sender_return;
  }

  virtual int32_t AddVideoFrame(
      const I420VideoFrame& videoFrame,
      const VideoContentMetrics* contentMetrics,
      const CodecSpecificInfo* codecSpecificInfo) OVERRIDE {
    return sender_->AddVideoFrame(
        videoFrame, contentMetrics, codecSpecificInfo);
  }

  virtual int32_t IntraFrameRequest(int stream_index) OVERRIDE {
    return sender_->IntraFrameRequest(stream_index);
  }

  virtual int32_t EnableFrameDropper(bool enable) OVERRIDE {
    return sender_->EnableFrameDropper(enable);
  }

  virtual int32_t SentFrameCount(VCMFrameCount& frameCount) const OVERRIDE {
    return sender_->SentFrameCount(&frameCount);
  }

  virtual int SetSenderNackMode(SenderNackMode mode) OVERRIDE {
    return sender_->SetSenderNackMode(mode);
  }

  virtual int SetSenderReferenceSelection(bool enable) OVERRIDE {
    return sender_->SetSenderReferenceSelection(enable);
  }

  virtual int SetSenderFEC(bool enable) OVERRIDE {
    return sender_->SetSenderFEC(enable);
  }

  virtual int SetSenderKeyFramePeriod(int periodMs) OVERRIDE {
    return sender_->SetSenderKeyFramePeriod(periodMs);
  }

  virtual int StartDebugRecording(const char* file_name_utf8) OVERRIDE {
    return sender_->StartDebugRecording(file_name_utf8);
  }

  virtual int StopDebugRecording() OVERRIDE {
    sender_->StopDebugRecording();
    return VCM_OK;
  }

  virtual void SuspendBelowMinBitrate() OVERRIDE {
    return sender_->SuspendBelowMinBitrate();
  }

  virtual bool VideoSuspended() const OVERRIDE {
    return sender_->VideoSuspended();
  }

  virtual int32_t InitializeReceiver() OVERRIDE {
    return receiver_->InitializeReceiver();
  }

  virtual int32_t RegisterReceiveCodec(const VideoCodec* receiveCodec,
                                       int32_t numberOfCores,
                                       bool requireKeyFrame) OVERRIDE {
    return receiver_->RegisterReceiveCodec(
        receiveCodec, numberOfCores, requireKeyFrame);
  }

  virtual int32_t RegisterExternalDecoder(VideoDecoder* externalDecoder,
                                          uint8_t payloadType,
                                          bool internalRenderTiming) OVERRIDE {
    return receiver_->RegisterExternalDecoder(
        externalDecoder, payloadType, internalRenderTiming);
  }

  virtual int32_t RegisterReceiveCallback(
      VCMReceiveCallback* receiveCallback) OVERRIDE {
    return receiver_->RegisterReceiveCallback(receiveCallback);
  }

  virtual int32_t RegisterReceiveStatisticsCallback(
      VCMReceiveStatisticsCallback* receiveStats) OVERRIDE {
    return receiver_->RegisterReceiveStatisticsCallback(receiveStats);
  }

  virtual int32_t RegisterDecoderTimingCallback(
      VCMDecoderTimingCallback* decoderTiming) OVERRIDE {
    return receiver_->RegisterDecoderTimingCallback(decoderTiming);
  }

  virtual int32_t RegisterFrameTypeCallback(
      VCMFrameTypeCallback* frameTypeCallback) OVERRIDE {
    return receiver_->RegisterFrameTypeCallback(frameTypeCallback);
  }

  virtual int32_t RegisterPacketRequestCallback(
      VCMPacketRequestCallback* callback) OVERRIDE {
    return receiver_->RegisterPacketRequestCallback(callback);
  }

  virtual int RegisterRenderBufferSizeCallback(
      VCMRenderBufferSizeCallback* callback) OVERRIDE {
    return receiver_->RegisterRenderBufferSizeCallback(callback);
  }

  virtual int32_t Decode(uint16_t maxWaitTimeMs) OVERRIDE {
    return receiver_->Decode(maxWaitTimeMs);
  }

  virtual int32_t DecodeDualFrame(uint16_t maxWaitTimeMs) OVERRIDE {
    return receiver_->DecodeDualFrame(maxWaitTimeMs);
  }

  virtual int32_t ResetDecoder() OVERRIDE { return receiver_->ResetDecoder(); }

  virtual int32_t ReceiveCodec(VideoCodec* currentReceiveCodec) const OVERRIDE {
    return receiver_->ReceiveCodec(currentReceiveCodec);
  }

  virtual VideoCodecType ReceiveCodec() const OVERRIDE {
    return receiver_->ReceiveCodec();
  }

  virtual int32_t IncomingPacket(const uint8_t* incomingPayload,
                                 uint32_t payloadLength,
                                 const WebRtcRTPHeader& rtpInfo) OVERRIDE {
    return receiver_->IncomingPacket(incomingPayload, payloadLength, rtpInfo);
  }

  virtual int32_t SetMinimumPlayoutDelay(uint32_t minPlayoutDelayMs) OVERRIDE {
    return receiver_->SetMinimumPlayoutDelay(minPlayoutDelayMs);
  }

  virtual int32_t SetRenderDelay(uint32_t timeMS) OVERRIDE {
    return receiver_->SetRenderDelay(timeMS);
  }

  virtual int32_t Delay() const OVERRIDE { return receiver_->Delay(); }

  virtual int32_t ReceivedFrameCount(VCMFrameCount& frameCount) const OVERRIDE {
    return receiver_->ReceivedFrameCount(&frameCount);
  }

  virtual uint32_t DiscardedPackets() const OVERRIDE {
    return receiver_->DiscardedPackets();
  }

  virtual int SetReceiverRobustnessMode(ReceiverRobustness robustnessMode,
                                        VCMDecodeErrorMode errorMode) OVERRIDE {
    return receiver_->SetReceiverRobustnessMode(robustnessMode, errorMode);
  }

  virtual void SetNackSettings(size_t max_nack_list_size,
                               int max_packet_age_to_nack,
                               int max_incomplete_time_ms) OVERRIDE {
    return receiver_->SetNackSettings(
        max_nack_list_size, max_packet_age_to_nack, max_incomplete_time_ms);
  }

  void SetDecodeErrorMode(VCMDecodeErrorMode decode_error_mode) OVERRIDE {
    return receiver_->SetDecodeErrorMode(decode_error_mode);
  }

  virtual int SetMinReceiverDelay(int desired_delay_ms) OVERRIDE {
    return receiver_->SetMinReceiverDelay(desired_delay_ms);
  }

  virtual int32_t SetReceiveChannelParameters(uint32_t rtt) OVERRIDE {
    return receiver_->SetReceiveChannelParameters(rtt);
  }

  virtual void RegisterPreDecodeImageCallback(
      EncodedImageCallback* observer) OVERRIDE {
    receiver_->RegisterPreDecodeImageCallback(observer);
  }

  virtual void RegisterPostEncodeImageCallback(
      EncodedImageCallback* observer) OVERRIDE {
    post_encode_callback_.Register(observer);
  }

 private:
  EncodedImageCallbackWrapper post_encode_callback_;
  scoped_ptr<vcm::VideoSender> sender_;
  scoped_ptr<vcm::VideoReceiver> receiver_;
  scoped_ptr<EventFactory> own_event_factory_;
};
}  // namespace

uint8_t VideoCodingModule::NumberOfCodecs() {
  return VCMCodecDataBase::NumberOfCodecs();
}

int32_t VideoCodingModule::Codec(uint8_t listId, VideoCodec* codec) {
  if (codec == NULL) {
    return VCM_PARAMETER_ERROR;
  }
  return VCMCodecDataBase::Codec(listId, codec) ? 0 : -1;
}

int32_t VideoCodingModule::Codec(VideoCodecType codecType, VideoCodec* codec) {
  if (codec == NULL) {
    return VCM_PARAMETER_ERROR;
  }
  return VCMCodecDataBase::Codec(codecType, codec) ? 0 : -1;
}

VideoCodingModule* VideoCodingModule::Create() {
  return new VideoCodingModuleImpl(
      Clock::GetRealTimeClock(), new EventFactoryImpl, true);
}

VideoCodingModule* VideoCodingModule::Create(Clock* clock,
                                             EventFactory* event_factory) {
  assert(clock);
  assert(event_factory);
  return new VideoCodingModuleImpl(clock, event_factory, false);
}

void VideoCodingModule::Destroy(VideoCodingModule* module) {
  if (module != NULL) {
    delete static_cast<VideoCodingModuleImpl*>(module);
  }
}
}  // namespace webrtc


text:
package specification;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;

/**
 * Created by Tomas Hanus on 2/21/2015.
 */
@XmlAccessorType(XmlAccessType.NONE)
public class Batchlet {

    private String id;

    // Attributes
    @XmlAttribute
    private String ref;

    @XmlElement
    private Properties properties;

    public Batchlet(String id) {
        this.id = id;
        this.ref = this.id + "_ref";
    }

    public Batchlet() {
    }

    public String getRef() {
        return ref;
    }

    public void setRef(String ref) {
        this.ref = ref;
    }

    public Properties getProperties() {
        return properties;
    }

    public void setProperties(Properties properties) {
        this.properties = properties;
    }
}


text: Hello Directive Template ~ {{timeX}}


text:
require 'rexml/document'
require 'Tkmws/util'

module Tkmws

    class Response
    public

        attr_reader :action
        attr_reader :code
        attr_reader :is_success
        attr_reader :products

        def initialize(action, code, body)
            @action     = action
            @code       = code.to_i
            @is_success = false
            @products   = []
            if @code == 200
                @document = REXML::Document.new(body)
                process_root(@document.root)
            end
        end

    private

        def process_competitive_pricing(root, product)
            root.get_elements('NumberOfOfferListings/OfferListingCount').each do |element|
                condition = element.attribute('condition').value
                case condition
                when 'Any' then product.offer_count.any = element.text.to_i
                when 'Collectible' then product.offer_count.collectible = element.text.to_i
                when 'New' then product.offer_count.new = element.text.to_i
                when 'Used' then product.offer_count.used = element.text.to_i
                end
            end
        end

        def process_lowest_offer(root, product)
            offer = Offer.new
            offer.condition = Tkmws.to_string(root, 'Qualifiers/ItemCondition')
            offer.subcondition = Tkmws.to_string(root, 'Qualifiers/ItemSubcondition')
            offer.fulfillment = Tkmws.to_string(root, 'Qualifiers/FulfillmentChannel')
            offer.landed_price = Tkmws.to_integer(root, 'Price/LandedPrice/Amount')
            offer.listing_price = Tkmws.to_integer(root, 'Price/ListingPrice/Amount')
            offer.shipping_price = Tkmws.to_integer(root, 'Price/Shipping/Amount')
            product.offers.push(offer)
        end

        def process_sales_rankings(root, product)
            root.each_element do |sales_rank|
                ranking = Ranking.new
                ranking.category_id = Tkmws.to_string(sales_rank, 'ProductCategoryId')
                ranking.rank = Tkmws.to_integer(sales_rank, 'Rank')
                product.rankings.push(ranking)
            end
        end

        def process_item_attributes(root, product)
            product.binding  = Tkmws.to_string(root, 'ns2:Binding')
            product.brand    = Tkmws.to_string(root, 'ns2:Brand')
            product.color    = Tkmws.to_string(root, 'ns2:Color')

            d = Dimensions.new
            d.height = Tkmws.to_millimeters(root, 'ns2:ItemDimensions/ns2:Height')
            d.length = Tkmws.to_millimeters(root, 'ns2:ItemDimensions/ns2:Length')
            d.width  = Tkmws.to_millimeters(root, 'ns2:ItemDimensions/ns2:Width')
            d.weight = Tkmws.to_grams(root, 'ns2:ItemDimensions/ns2:Weight')
            product.dimensions = d

            product.manufacturer = Tkmws.to_string(root, 'ns2:Manufacturer')
            product.model = Tkmws.to_string(root, 'ns2:Model')

            p = Dimensions.new
            p.height = Tkmws.to_millimeters(root, 'ns2:PackageDimensions/ns2:Height')
            p.length = Tkmws.to_millimeters(root, 'ns2:PackageDimensions/ns2:Length')
            p.width  = Tkmws.to_millimeters(root, 'ns2:PackageDimensions/ns2:Width')
            p.weight = Tkmws.to_grams(root, 'ns2:PackageDimensions/ns2:Weight')
            product.package = p

            product.quantity = Tkmws.to_integer(root, 'ns2:PackageQuantity')
            product.publisher = Tkmws.to_string(root, 'ns2:Publisher')
            product.title = Tkmws.to_string(root, 'ns2:Title')
            product.product_group = Tkmws.to_string(root, 'ns2:ProductGroup')
            product.product_type_name = Tkmws.to_string(root, 'ns2:ProductTypeName')
            product.release_date = Tkmws.to_date(root, 'ns2:ReleaseDate')
        end

        def process_product(root)

            # find or create product object.
            identifiers = root.get_elements('Identifiers')
            asin = Tkmws.to_string(identifiers, 'MarketplaceASIN/ASIN')
            product = nil
            @products.each do |p|
                if p.asin == asin
                    product = p
                end
            end
            if !product
                product = Product.new
                product.asin = asin
                @products.push(product)
            end

            # analyze item attributes
            item_attributes = root.get_elements('AttributeSets/ns2:ItemAttributes')
            if !item_attributes.empty?
                process_item_attributes(item_attributes.first, product)
            end

            # analyze sales rankings
            sales_rankings = root.get_elements('SalesRankings')
            product.rankings = []
            if !sales_rankings.empty?
                process_sales_rankings(sales_rankings.first, product)
            end

            # analyze lowest offer listings
            lowest_offer_listings = root.get_elements('LowestOfferListings/LowestOfferListing')
            product.offers = []
            lowest_offer_listings.each do |lowest_offer|
                process_lowest_offer(lowest_offer, product)
            end

            # analyze competitive pricing
            competitive_pricing = root.get_elements('CompetitivePricing')
            product.offer_count = OfferCount.new(0, 0, 0, 0)
            if !competitive_pricing.empty?
                process_competitive_pricing(competitive_pricing.first, product)
            end
        end

        def process_category(root, categories)
            categories.push(Tkmws.to_string(root, 'ProductCategoryName'))
            parent = root.get_elements('Parent')
            if parent.empty?
               return categories
            else
               return process_category(parent.first, categories)
            end
        end

        def process_root(root)
            result = root.get_elements("#{@action}Result").first

            if result
                if result.has_attributes?
                    @is_success = result.attribute('status').value == 'Success'
                else
                    @is_success = true
                end
            end

            if @is_success

                products = result.get_elements('Products')
                products.first.each_element do |product|
                    process_product(product)
                end if !products.empty?

                products = result.get_elements('Product')
                products.each do |product|
                    process_product(product)
                end

                if @action == 'GetProductCategoriesForASIN'
                    product = Product.new
                    product.categories = []
                    result.get_elements('Self').each do |element|
                        product.categories.push(process_category(element, []))
                    end
                    @products.push(product)
                end
            end
        end

    end

end


text:
package org.elasticsearch.common.xcontent;

import org.elasticsearch.test.ESTestCase;

import java.util.Arrays;

import static org.hamcrest.Matchers.equalTo;

public class SuggestingErrorOnUnknownTests extends ESTestCase {
    private String errorMessage(String unknownField, String... candidates) {
        return new SuggestingErrorOnUnknown().errorMessage("test", unknownField, Arrays.asList(candidates));
    }

    public void testNoCandidates() {
        assertThat(errorMessage("foo"), equalTo("[test] unknown field [foo]"));
    }
    public void testBadCandidates() {
        assertThat(errorMessage("foo", "bar", "baz"), equalTo("[test] unknown field [foo]"));
    }
    public void testOneCandidate() {
        assertThat(errorMessage("foo", "bar", "fop"), equalTo("[test] unknown field [foo] did you mean [fop]?"));
    }
    public void testManyCandidate() {
        assertThat(errorMessage("foo", "bar", "fop", "fou", "baz"),
                equalTo("[test] unknown field [foo] did you mean any of [fop, fou]?"));
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.communication.callautomation.implementation.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** The request payload start for call recording operation with call locator. */
@Fluent
public final class StartCallRecordingRequestInternal {
    /*
     * The call locator.
     */
    @JsonProperty(value = "callLocator", required = true)
    private CallLocatorInternal callLocator;

    /*
     * The uri to send notifications to.
     */
    @JsonProperty(value = "recordingStateCallbackUri")
    private String recordingStateCallbackUri;

    /*
     * The content type of call recording.
     */
    @JsonProperty(value = "recordingContentType")
    private RecordingContentInternal recordingContentType;

    /*
     * The channel type of call recording.
     */
    @JsonProperty(value = "recordingChannelType")
    private RecordingChannelInternal recordingChannelType;

    /*
     * The format type of call recording.
     */
    @JsonProperty(value = "recordingFormatType")
    private RecordingFormatInternal recordingFormatType;

    /*
     * The sequential order in which audio channels are assigned to
     * participants in the unmixed recording.
     * When 'recordingChannelType' is set to 'unmixed' and
     * `audioChannelParticipantOrdering is not specified,
     * the audio channel to participant mapping will be automatically assigned
     * based on the order in which participant
     * first audio was detected.  Channel to participant mapping details can be
     * found in the metadata of the recording.
     */
    @JsonProperty(value = "audioChannelParticipantOrdering")
    private List<CommunicationIdentifierModel> audioChannelParticipantOrdering;

    /*
     * Recording storage mode. `External` enables bring your own storage.
     */
    @JsonProperty(value = "recordingStorageType")
    private RecordingStorageType recordingStorageType;

    /**
     * Get the callLocator property: The call locator.
     *
     * @return the callLocator value.
     */
    public CallLocatorInternal getCallLocator() {
        return this.callLocator;
    }

    /**
     * Set the callLocator property: The call locator.
     *
     * @param callLocator the callLocator value to set.
     * @return the StartCallRecordingRequestInternal object itself.
     */
    public StartCallRecordingRequestInternal setCallLocator(CallLocatorInternal callLocator) {
        this.callLocator = callLocator;
        return this;
    }

    /**
     * Get the recordingStateCallbackUri property: The uri to send notifications to.
     *
     * @return the recordingStateCallbackUri value.
     */
    public String getRecordingStateCallbackUri() {
        return this.recordingStateCallbackUri;
    }

    /**
     * Set the recordingStateCallbackUri property: The uri to send notifications to.
     *
     * @param recordingStateCallbackUri the recordingStateCallbackUri value to set.
     * @return the StartCallRecordingRequestInternal object itself.
     */
    public StartCallRecordingRequestInternal setRecordingStateCallbackUri(String recordingStateCallbackUri) {
        this.recordingStateCallbackUri = recordingStateCallbackUri;
        return this;
    }

    /**
     * Get the recordingContentType property: The content type of call recording.
     *
     * @return the recordingContentType value.
     */
    public RecordingContentInternal getRecordingContentType() {
        return this.recordingContentType;
    }

    /**
     * Set the recordingContentType property: The content type of call recording.
     *
     * @param recordingContentType the recordingContentType value to set.
     * @return the StartCallRecordingRequestInternal object itself.
     */
    public StartCallRecordingRequestInternal setRecordingContentType(RecordingContentInternal recordingContentType) {
        this.recordingContentType = recordingContentType;
        return this;
    }

    /**
     * Get the recordingChannelType property: The channel type of call recording.
     *
     * @return the recordingChannelType value.
     */
    public RecordingChannelInternal getRecordingChannelType() {
        return this.recordingChannelType;
    }

    /**
     * Set the recordingChannelType property: The channel type of call recording.
     *
     * @param recordingChannelType the recordingChannelType value to set.
     * @return the StartCallRecordingRequestInternal object itself.
     */
    public StartCallRecordingRequestInternal setRecordingChannelType(RecordingChannelInternal recordingChannelType) {
        this.recordingChannelType = recordingChannelType;
        return this;
    }

    /**
     * Get the recordingFormatType property: The format type of call recording.
     *
     * @return the recordingFormatType value.
     */
    public RecordingFormatInternal getRecordingFormatType() {
        return this.recordingFormatType;
    }

    /**
     * Set the recordingFormatType property: The format type of call recording.
     *
     * @param recordingFormatType the recordingFormatType value to set.
     * @return the StartCallRecordingRequestInternal object itself.
     */
    public StartCallRecordingRequestInternal setRecordingFormatType(RecordingFormatInternal recordingFormatType) {
        this.recordingFormatType = recordingFormatType;
        return this;
    }

    /**
     * Get the audioChannelParticipantOrdering property: The sequential order in which audio channels are assigned to
     * participants in the unmixed recording. When 'recordingChannelType' is set to 'unmixed' and
     * `audioChannelParticipantOrdering is not specified, the audio channel to participant mapping will be automatically
     * assigned based on the order in which participant first audio was detected. Channel to participant mapping details
     * can be found in the metadata of the recording.
     *
     * @return the audioChannelParticipantOrdering value.
     */
    public List<CommunicationIdentifierModel> getAudioChannelParticipantOrdering() {
        return this.audioChannelParticipantOrdering;
    }

    /**
     * Set the audioChannelParticipantOrdering property: The sequential order in which audio channels are assigned to
     * participants in the unmixed recording. When 'recordingChannelType' is set to 'unmixed' and
     * `audioChannelParticipantOrdering is not specified, the audio channel to participant mapping will be automatically
     * assigned based on the order in which participant first audio was detected. Channel to participant mapping details
     * can be found in the metadata of the recording.
     *
     * @param audioChannelParticipantOrdering the audioChannelParticipantOrdering value to set.
     * @return the StartCallRecordingRequestInternal object itself.
     */
    public StartCallRecordingRequestInternal setAudioChannelParticipantOrdering(
            List<CommunicationIdentifierModel> audioChannelParticipantOrdering) {
        this.audioChannelParticipantOrdering = audioChannelParticipantOrdering;
        return this;
    }

    /**
     * Get the recordingStorageType property: Recording storage mode. `External` enables bring your own storage.
     *
     * @return the recordingStorageType value.
     */
    public RecordingStorageType getRecordingStorageType() {
        return this.recordingStorageType;
    }

    /**
     * Set the recordingStorageType property: Recording storage mode. `External` enables bring your own storage.
     *
     * @param recordingStorageType the recordingStorageType value to set.
     * @return the StartCallRecordingRequestInternal object itself.
     */
    public StartCallRecordingRequestInternal setRecordingStorageType(RecordingStorageType recordingStorageType) {
        this.recordingStorageType = recordingStorageType;
        return this;
    }
}


text: SELECT a FROM t1 WHERE r < 36028797018963967 ORDER BY r DESC


text:
package com.cryptoregistry.ec;

import java.math.BigInteger;

import org.bouncycastle.crypto.params.ECDomainParameters;
import org.bouncycastle.math.ec.ECCurve;
import org.bouncycastle.math.ec.ECPoint;
import org.bouncycastle.util.encoders.Hex;

public class Secp128r1 extends ECParametersHolderBase {

	private static final String NAME = "secp128r1";

	private Secp128r1(ECDomainParameters params) {
		super(params);
	}

	static Secp128r1 instance() {
		ECDomainParameters p = init(NAME);
		return new Secp128r1(p);
	}

	private static ECDomainParameters init(String name) {
		// p = (2^128 - 3) / 76439
		BigInteger p = fromHex("DB7C2ABF62E35E668076BEAD208B");
		BigInteger a = fromHex("DB7C2ABF62E35E668076BEAD2088");
		BigInteger b = fromHex("659EF8BA043916EEDE8911702B22");
		byte[] S = Hex.decode("00F50B028E4D696E676875615175290472783FB1");
		BigInteger n = fromHex("DB7C2ABF62E35E7628DFAC6561C5");
		BigInteger h = BigInteger.valueOf(1);

		ECCurve curve = new ECCurve.Fp(p, a, b);
		// ECPoint G = curve.decodePoint(Hex.decode("02"
		// + "09487239995A5EE76B55F9C2F098"));
		ECPoint G = curve.decodePoint(Hex.decode("04"
				+ "09487239995A5EE76B55F9C2F098"
				+ "A89CE5AF8724C0A23E0E0FF77500"));

		return new NamedECDomainParameters(curve, G, n, h, S, name);
	}

	@Override
	public ECDomainParameters createParameters() {
		return cached;
	}

}


text:
classdef DipoleSim < ftb.EEG
    %DipoleSim Summary of this class goes here
    %   Detailed explanation goes here

    properties(SetAccess = private);
        % other properties see ftb.EEG
    end

    methods
        function obj = DipoleSim(params,name)
            %   params (struct or string)
            %       struct or file name
            %
            %   name (string)
            %       object name
            %   prev (Object)
            %       previous analysis step

            % use EEG constructor
            obj@ftb.EEG(params,name);
            obj.prefix = 'DS';
        end

        function obj = add_prev(obj,prev)

            % parse inputs
            p = inputParser;
            addRequired(p,'prev',@(x)isa(x,'ftb.Leadfield'));
            parse(p,prev);

            % set the previous step, aka Leadfield
            obj.prev = p.Results.prev;
        end

        function obj = process(obj)
            if ~obj.init_called
                error(['ftb:' mfilename],...
                    'not initialized');
            end

            % get analysis step objects
            elecObj = obj.get_dep('ftb.Electrodes');
            hmObj = obj.get_dep('ftb.Headmodel');

            if obj.check_file(obj.preprocessed)
                hm = ftb.util.loadvar(hmObj.mri_headmodel);
                elec = ftb.util.loadvar(elecObj.elec_aligned);

                % convert units of headmodel and elec to match dip units
                if isfield(obj.config.ft_dipolesimulation,'dip')
                    if isfield(obj.config.ft_dipolesimulation.dip,'unit')
                        units = obj.config.ft_dipolesimulation.dip.unit;
                        fprintf('%s: converting units to %s\n',...
                            strrep(class(obj),'ftb.',''), units);
                        hm = ft_convert_units(hm, units);
                        elec = ft_convert_units(elec, units);
                    else
                        warning(['ftb:' mfilename],...
                            'units not specified in dipole params');
                    end
                end

                % setup cfg
                cfgin = obj.config.ft_dipolesimulation;
                cfgin.elec = elec;
                cfgin.headmodel = hm;

                % remove fiducial channels
                if ~isfield(cfgin, 'channel')
                    cfgin.channel = elecObj.remove_fiducials();
                    fprintf('%s: removing fiducial electrodes\n',...
                        strrep(class(obj),'ftb.',''))
                end

                % simulate dipoles
                data = ft_dipolesimulation(cfgin);
                save(obj.preprocessed, 'data');
            else
                fprintf('%s: skipping ft_dipolesimulation, already exists\n',...
                    strrep(class(obj),'ftb.',''));
            end

            if obj.check_file(obj.timelock)
                cfgin = obj.config.ft_timelockanalysis;
                cfgin.inputfile = obj.preprocessed;
                cfgin.outputfile = obj.timelock;

                ft_timelockanalysis(cfgin);
            else
                fprintf('%s: skipping ft_timelockanalysis, already exists\n',...
                    strrep(class(obj),'ftb.',''));
            end

        end

        function plot(obj, elements)
            %   elements
            %       cell array of head model elements to be plotted:
            %       'dipole'
            %       can also include elements from previous stages
            %       'leadfield'
            %       'electrodes'
            %       'electrodes-aligned'
            %       'electrodes-labels'
            %       'scalp'
            %       'skull'
            %       'brain'
            %       'fiducials'

            unit = 'mm';

            for i=1:length(elements)
                switch elements{i}

                    case 'dipole'
                        hold on;

                        component = 'signal';

                        switch component
                            case 'signal'
                                color = 'blue';
                            case 'interference'
                                color = 'red';
                            otherwise
                        end

                        params = obj.config.ft_dipolesimulation;
                        if isfield(params, 'dip')
                            dip = params.dip;
                            if ~isequal(dip.unit, unit)
                                switch dip.unit
                                    case 'cm'
                                        dip.pos = dip.pos*10;
                                    otherwise
                                        error(['ftb:' mfilename],...
                                            'implement unit %s', dip.unit);
                                end
                            end
                            ft_plot_dipole(dip.pos, dip.mom,...
                                ...'diameter',5,...
                                ...'length', 10,...
                                'color', color,...
                                'unit', unit);
                        end
                end
            end

            % plot previous steps
            if ~isempty(obj.prev)
                obj.prev.plot(elements);
            end
        end

        function plot_data(obj,mode)
            %   mode (string)
            %       selects data to plot: 'simulated', 'timelock'

            switch mode
                case 'timelock'
                    lfObj = obj.prev;
                    eObj = lfObj.prev;
                    %cfg.layout = ftb.util.loadvar(eObj.elec_aligned);
                    cfg.elecfile = eObj.elec_aligned;
                    layout = ft_prepare_layout(cfg,[]);

                    data = ftb.util.loadvar(obj.timelock);
                    cfg = [];
                    %cfg.hlim = [0 1];
                    cfg.layout = layout;
                    cfg.showlabels = 'yes';
                    %ft_singleplotER(cfg, data);
                    ft_multiplotER(cfg, data);
                case 'simulated'
                    lfObj = obj.prev;
                    eObj = lfObj.prev;
                    %cfg.layout = ftb.util.loadvar(eObj.elec_aligned);
                    cfg.elecfile = eObj.elec_aligned;
                    layout = ft_prepare_layout(cfg,[]);

                    data = ftb.util.loadvar(obj.simulated);
                    cfg = [];
                    %cfg.hlim = [0 1];
                    cfg.layout = layout;
                    cfg.showlabels = 'yes';
                    %ft_singleplotER(cfg, data);
                    ft_multiplotER(cfg, data);
                otherwise
                    error(['ftb:' mfilename],...
                        'unknown mode %s');
            end
        end

    end
end


text:
#region Using Directives

using JetBrains.Annotations;

#endregion

namespace Pharmatechnik.Nav.Language;

public interface IEdgeModeSymbol: ISymbol {

    EdgeMode EdgeMode { get; }

    [NotNull]
    IEdge Edge { get; }

    string DisplayName { get; }
    string Verb        { get; }

}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
    <title>About</title>

Copyright (c) 2105, Julia Computing Inc. All rights reserved.