text:
Awesome Print is a Ruby library that pretty prints Ruby objects in full color
exposing their internal structure with proper indentation. Rails ActiveRecord
objects and usage within Rails templates are supported via included mixins.

### Installation ###
    # Installing as Ruby gem
    $ gem install awesome_print

    # Cloning the repository
    $ git clone git://github.com/michaeldv/awesome_print.git

### Usage ###

    require "awesome_print"
    ap object, options = {}

Default options:

    :indent     => 4,      # Indent using 4 spaces.
    :index      => true,   # Display array indices.
    :html       => false,  # Use ANSI color codes rather than HTML.
    :multiline  => true,   # Display in multiple lines.
    :plain      => false,  # Use colors.
    :raw        => false,  # Do not recursively format object instance variables.
    :sort_keys  => false,  # Do not sort hash keys.
    :limit      => false,  # Limit large output for arrays and hashes. Set to a boolean or integer.
    :color => {
      :args       => :pale,
      :array      => :white,
      :bigdecimal => :blue,
      :class      => :yellow,
      :date       => :greenish,
      :falseclass => :red,
      :fixnum     => :blue,
      :float      => :blue,
      :hash       => :pale,
      :keyword    => :cyan,
      :method     => :purpleish,
      :nilclass   => :red,
      :rational   => :blue,
      :string     => :yellowish,
      :struct     => :pale,
      :symbol     => :cyanish,
      :time       => :greenish,
      :trueclass  => :green,
      :variable   => :cyanish
    }

Supported color names:

    :gray, :red, :green, :yellow, :blue, :purple, :cyan, :white
    :black, :redish, :greenish, :yellowish, :blueish, :purpleish, :cyanish, :pale

### Examples ###
    $ cat > 1.rb
    require "awesome_print"
    data = [ false, 42, %w(forty two), { :now => Time.now, :class => Time.now.class, :distance => 42e42 } ]
    ap data
    ^D
    $ ruby 1.rb
    [
        [0] false,
        [1] 42,
        [2] [
            [0] "forty",
            [1] "two"
        ],
        [3] {
               :class => Time < Object,
                 :now => Fri Apr 02 19:55:53 -0700 2010,
            :distance => 4.2e+43
        }
    ]

    $ cat > 2.rb
    require "awesome_print"
    data = { :now => Time.now, :class => Time.now.class, :distance => 42e42 }
    ap data, :indent => -2  # <-- Left align hash keys.
    ^D
    $ ruby 2.rb
    {
      :class    => Time < Object,
      :now      => Fri Apr 02 19:55:53 -0700 2010,
      :distance => 4.2e+43
    }

    $ cat > 3.rb
    require "awesome_print"
    data = [ false, 42, %w(forty two) ]
    data << data  # <-- Nested array.
    ap data, :multiline => false
    ^D
    $ ruby 3.rb
    [ false, 42, [ "forty", "two" ], [...] ]

    $ cat > 4.rb
    require "awesome_print"
    class Hello
      def self.world(x, y, z = nil, &blk)
      end
    end
    ap Hello.methods - Class.methods
    ^D
    $ ruby 4.rb
    [
        [0] world(x, y, *z, &blk) Hello
    ]

    $ cat > 5.rb
    require "awesome_print"
    ap (''.methods - Object.methods).grep(/!/)
    ^D
    $ ruby 5.rb
    [
        [ 0] capitalize!()           String
        [ 1]      chomp!(*arg1)      String
        [ 2]       chop!()           String
        [ 3]     delete!(*arg1)      String
        [ 4]   downcase!()           String
        [ 5]     encode!(*arg1)      String
        [ 6]       gsub!(*arg1)      String
        [ 7]     lstrip!()           String
        [ 8]       next!()           String
        [ 9]    reverse!()           String
        [10]     rstrip!()           String
        [11]      slice!(*arg1)      String
        [12]    squeeze!(*arg1)      String
        [13]      strip!()           String
        [14]        sub!(*arg1)      String
        [15]       succ!()           String
        [16]   swapcase!()           String
        [17]         tr!(arg1, arg2) String
        [18]       tr_s!(arg1, arg2) String
        [19]     upcase!()           String
    ]

    $ cat > 6.rb
    require "awesome_print"
    ap 42 == ap(42)
    ^D
    $ ruby 6.rb
    42
    true
    $ cat 7.rb
    require "awesome_print"
    some_array = (1..1000).to_a
    ap some_array, :limit => true
    ^D
    $ ruby 7.rb
    [
        [  0] 1,
        [  1] 2,
        [  2] 3,
        [  3] .. [996],
        [997] 998,
        [998] 999,
        [999] 1000
    ]

    $ cat 8.rb
    require "awesome_print"
    some_array = (1..1000).to_a
    ap some_array, :limit => 5
    ^D
    $ ruby 8.rb
    [
        [  0] 1,
        [  1] 2,
        [  2] .. [997],
        [998] 999,
        [999] 1000
    ]

### Example (Rails console) ###
    $ rails console
    rails> require "awesome_print"
    rails> ap Account.all(:limit => 2)
    [
        [0] #<Account:0x1033220b8> {
                         :id => 1,
                    :user_id => 5,
                :assigned_to => 7,
                       :name => "Hayes-DuBuque",
                     :access => "Public",
                    :website => "http://www.hayesdubuque.com",
            :toll_free_phone => "1-800-932-6571",
                      :phone => "(111)549-5002",
                        :fax => "(349)415-2266",
                 :deleted_at => nil,
                 :created_at => Sat, 06 Mar 2010 09:46:10 UTC +00:00,
                 :updated_at => Sat, 06 Mar 2010 16:33:10 UTC +00:00,
                      :email => "info@hayesdubuque.com",
            :background_info => nil
        },
        [1] #<Account:0x103321ff0> {
                         :id => 2,
                    :user_id => 4,
                :assigned_to => 4,
                       :name => "Ziemann-Streich",
                     :access => "Public",
                    :website => "http://www.ziemannstreich.com",
            :toll_free_phone => "1-800-871-0619",
                      :phone => "(042)056-1534",
                        :fax => "(106)017-8792",
                 :deleted_at => nil,
                 :created_at => Tue, 09 Feb 2010 13:32:10 UTC +00:00,
                 :updated_at => Tue, 09 Feb 2010 20:05:01 UTC +00:00,
                      :email => "info@ziemannstreich.com",
            :background_info => nil
        }
    ]
    rails> ap Account
    class Account < ActiveRecord::Base {
                     :id => :integer,
                :user_id => :integer,
            :assigned_to => :integer,
                   :name => :string,
                 :access => :string,
                :website => :string,
        :toll_free_phone => :string,
                  :phone => :string,
                    :fax => :string,
             :deleted_at => :datetime,
             :created_at => :datetime,
             :updated_at => :datetime,
                  :email => :string,
        :background_info => :string
    }
    rails>

### IRB integration ###
To use awesome_print as default formatter in irb and Rails console add the following
code to your ~/.irbrc file:

	require "awesome_print"
  AwesomePrint.irb!

### PRY integration ###
If you miss awesome_print's way of formatting output, here's how you can use it in place
of the formatting which comes with pry. Add the following code to your ~/.pryrc:

	require "awesome_print"
  AwesomePrint.pry!

### Logger Convenience Method ###
awesome_print adds the 'ap' method to the Logger and ActiveSupport::BufferedLogger classes
letting you call:

    logger.ap object

By default, this logs at the :debug level. You can override that globally with:

    :log_level => :info

in the custom defaults (see below). You can also override on a per call basis with:

    logger.ap object, :warn

### ActionView Convenience Method ###
awesome_print adds the 'ap' method to the ActionView::Base class making it available
within Rails templates. For example:

    <%= ap @accounts.first %>   # ERB
    != ap @accounts.first       # HAML

With other web frameworks (ex: in Sinatra templates) you can explicitly request HTML
formatting:

    <%= ap @accounts.first, :html => true %>

### Setting Custom Defaults ###
You can set your own default options by creating ``.aprc`` file in your home
directory. Within that file assign your  defaults to ``AwesomePrint.defaults``.
For example:

    # ~/.aprc file.
    AwesomePrint.defaults = {
      :indent => -2,
      :color => {
        :hash  => :pale,
        :class => :white
      }
    }

### Running Specs ###

    $ gem install rspec           # RSpec 2.x is the requirement.
    $ rake spec                   # Run the entire spec suite.
    $ rspec spec/logger_spec.rb   # Run individual spec file.

### Note on Patches/Pull Requests ###
* Fork the project on Github.
* Make your feature addition or bug fix.
* Add specs for it, making sure $ rake spec is all green.
* Commit, do not mess with rakefile, version, or history.
* Send me commit URL (*do not* send me pull requests).

### Contributors ###

* Adam Doppelt -- https://github.com/gurgeous
* Andrew O'Brien -- https://github.com/AndrewO
* Andrew Horsman -- https://github.com/basicxman
* Barry Allard -- https://github.com/steakknife
* Benoit Daloze -- http://github.com/eregon
* Brandon Zylstra -- https://github.com/brandondrew
* Dan Lynn -- https://github.com/danlynn
* Daniel Johnson -- https://github.com/adhd360
* Daniel Bretoi -- http://github.com/danielb2
* Eloy Duran -- http://github.com/alloy
* Elpizo Choi -- https://github.com/fuJiin
* Evan Senter -- https://github.com/evansenter
* George . -- https://github.com/gardelea
* Greg Weber -- https://github.com/gregwebs
* Jeff Felchner -- https://github.com/jfelchner
* Nikolaj Nikolajsen -- https://github.com/nikolajsen
* Ryan Schlesinger -- https://github.com/ryansch
* Sean Gallagher -- http://github.com/torandu
* Stephan Hagemann -- https://github.com/shageman
* Tim Harper -- http://github.com/timcharper
* Tobias Crawley -- http://github.com/tobias
* Thibaut Barrère -- https://github.com/thbar
* Viktar Basharymau -- https://github.com/DNNX

### License ###
Copyright (c) 2010-2012 Michael Dvorkin

http://www.dvorkin.net

%w(mike dvorkin.net) * "@" || %w(mike fatfreecrm.com) * "@"

Released under the MIT license. See LICENSE file for details.


text:
package org.mifos.customers.center.persistence;

import java.util.Date;

import junit.framework.Assert;

import org.mifos.application.meeting.MeetingTemplateImpl;
import org.mifos.application.meeting.business.MeetingBO;
import org.mifos.application.meeting.exceptions.MeetingException;
import org.mifos.customers.business.CustomerBO;
import org.mifos.customers.center.CenterTemplate;
import org.mifos.customers.center.CenterTemplateImpl;
import org.mifos.customers.center.business.CenterBO;
import org.mifos.customers.exceptions.CustomerException;
import org.mifos.customers.office.business.OfficeBO;
import org.mifos.customers.office.business.OfficeTemplate;
import org.mifos.customers.office.business.OfficeTemplateImpl;
import org.mifos.customers.office.exceptions.OfficeException;
import org.mifos.customers.office.persistence.OfficePersistence;
import org.mifos.customers.office.util.helpers.OfficeLevel;
import org.mifos.framework.MifosIntegrationTestCase;
import org.mifos.framework.TestUtils;
import org.mifos.framework.exceptions.PersistenceException;
import org.mifos.framework.exceptions.ValidationException;
import org.mifos.framework.hibernate.helper.QueryResult;
import org.mifos.framework.hibernate.helper.StaticHibernateUtil;
import org.mifos.framework.util.helpers.TestObjectFactory;
import org.mifos.security.util.UserContext;

public class CenterPersistenceIntegrationTest extends MifosIntegrationTestCase {
    public CenterPersistenceIntegrationTest() throws Exception {
        super();
    }

    private CustomerBO center;
    private OfficePersistence officePersistence;
    private CenterPersistence centerPersistence;

    @Override
    public void setUp() throws Exception {
        super.setUp();
        officePersistence = new OfficePersistence();
        centerPersistence = new CenterPersistence();
        initializeStatisticsService();
    }

    @Override
    public void tearDown() throws Exception {
        TestObjectFactory.cleanUp(center);
        StaticHibernateUtil.closeSession();
        super.tearDown();
    }

    public void testCreateCenter() throws PersistenceException, OfficeException, MeetingException, CustomerException,
            ValidationException {
        UserContext userContext = TestUtils.makeUser();
        long beforeTransactionCount = getStatisticsService().getSuccessfulTransactionCount();
        OfficeTemplate template = OfficeTemplateImpl.createNonUniqueOfficeTemplate(OfficeLevel.BRANCHOFFICE);
        try {
            OfficeBO office = getOfficePersistence().createOffice(userContext, template);
            MeetingBO meeting = new MeetingBO(MeetingTemplateImpl.createWeeklyMeetingTemplate());
            CenterTemplate centerTemplate = new CenterTemplateImpl(meeting, office.getOfficeId());
            CenterBO center = getCenterPersistence().createCenter(userContext, centerTemplate);

            Assert.assertNotNull(center.getCustomerId());
           Assert.assertTrue(center.isActive());
        } finally {
            StaticHibernateUtil.rollbackTransaction();
        }
        long afterTransactionCount = getStatisticsService().getSuccessfulTransactionCount();
       Assert.assertEquals(beforeTransactionCount, afterTransactionCount);
    }

    public void testIsCenterExists_true() throws Exception {
        String centerName = "NewCenter";
        center = TestObjectFactory.createWeeklyFeeCenter(centerName, getMeeting());
        StaticHibernateUtil.closeSession();
       Assert.assertTrue(new CenterPersistence().isCenterExists(centerName));
    }

    public void testIsCenterExists_false() throws PersistenceException {
        String centerName = "NewCenter";
        center = TestObjectFactory.createWeeklyFeeCenter(centerName, getMeeting());
        StaticHibernateUtil.closeSession();
        Assert.assertFalse(new CenterPersistence().isCenterExists("NewCenter11"));
    }

    public void testGetCenter() throws Exception {
        String centerName = "NewCenter";
        center = TestObjectFactory.createWeeklyFeeCenter(centerName, getMeeting());
        center = new CenterPersistence().getCenter(center.getCustomerId());
       Assert.assertEquals(centerName, center.getDisplayName());
    }

    private MeetingBO getMeeting() {
        MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
        meeting.setMeetingStartDate(new Date());
        return meeting;
    }

    public void testSearch() throws Exception {
        String centerName = "NewCenter";
        center = TestObjectFactory.createWeeklyFeeCenter(centerName, getMeeting());
        QueryResult queryResult = new CenterPersistence().search(center.getDisplayName(), Short.valueOf("1"));
        Assert.assertNotNull(queryResult);
       Assert.assertEquals(1, queryResult.getSize());
       Assert.assertEquals(1, queryResult.get(0, 10).size());
    }

    OfficePersistence getOfficePersistence() {
        return officePersistence;
    }

    CenterPersistence getCenterPersistence() {
        return centerPersistence;
    }
}

redpajama_set_name: RedPajamaGithub


text:
import { findDOMNode } from 'react-dom';

var findNodeHandle = component => {
  var node;

  try {
    node = findDOMNode(component);
  } catch (e) {}

  return node;
};

export default findNodeHandle;


text:
"""
Created on Sun Apr  2 17:03:04 2017

@author: Villanueva
"""

import warnings
import pytest

from simetuc.util import IonType, Transition, DecayTransition, Excitation, EneryTransferProcess
from simetuc.util import log_exceptions_warnings

def test_transition():
    '''Test generic transitions'''

    # labels are skipped in comparisons and hashing
    t1 = Transition(IonType.S, 1, 0)
    t2 = Transition(IonType.S, 1, 0, label_ion='Yb', label_i='ES', label_f='GS')
    assert t1 == t2
    assert hash(t1) == hash(t2)

    # different states yield different Transitions
    t3 = Transition(IonType.S, 2, 0)
    assert t3 != t1
    assert t3 != t2
    assert hash(t3) != hash(t1)
    assert hash(t3) != hash(t2)

    # different ions yield different Transitions
    t4 = Transition(IonType.A, 1, 0)
    assert t4 != t1
    assert hash(t4) != hash(t1)

def test_decay_transition():
    '''Test generic decay or branching transitions'''

    # labels are skipped in comparisons and hashing
    t1 = DecayTransition(IonType.S, 1, 0, branching_ratio=0.4)
    t2 = DecayTransition(IonType.S, 1, 0, branching_ratio=0.4,
                         label_ion='Yb', label_i='ES', label_f='GS')
    assert t1 == t2
    assert hash(t1) == hash(t2)
    t1_dec = DecayTransition(IonType.S, 1, 0, decay_rate=1e5)
    t2_dec = DecayTransition(IonType.S, 1, 0, decay_rate=1e5,
                             label_ion='Yb', label_i='ES', label_f='GS')
    assert t1_dec == t2_dec
    assert hash(t1_dec) == hash(t2_dec)

    # different branching_ratios: not equal but same hash
    t3 = DecayTransition(IonType.S, 1, 0, branching_ratio=0.1)
    assert t3 != t1
    assert t3 != t2
    assert hash(t3) == hash(t1)
    assert hash(t3) == hash(t2)

    # compare Transitions with DecayTransitions, ignores values
    t4 = Transition(IonType.S, 1, 0)
    assert t1 == t4
    assert t4 == t1
    assert hash(t1) == hash(t4)

def test_exc_transition():
    '''Test excitation transitions'''

    t1 = Excitation(IonType.S, 1, 0, active=True, degeneracy=4/3, pump_rate=4e-2,
                    power_dens=1e7, t_pulse=1e-8)
    t2 = Excitation(IonType.S, 1, 0, active=True, degeneracy=4/3, pump_rate=4e-2,
                    power_dens=1e7, t_pulse=1e-8,
                    label_ion='Yb', label_i='ES', label_f='GS')
    assert t1 == t2

    # different params
    t3 = Excitation(IonType.S, 1, 0, active=False, degeneracy=4/3, pump_rate=4e-2,
                    power_dens=1e7, t_pulse=1e-8)
    assert t3 != t1
    assert t3 != t2

def test_ET_process():
    '''Test excitation transitions'''

    strength = 1e9
    t1 = Transition(IonType.S, 1, 0)
    t2 = Transition(IonType.S, 0, 1)
    et1 = EneryTransferProcess([t1, t2], mult=6, strength=strength)
    et2 = EneryTransferProcess([t1, t2], mult=8, strength=strength)
    assert et1 != et2

    t3 = Transition(IonType.S, 0, 1, label_ion='Yb')
    et3 = EneryTransferProcess([t1, t3], mult=6, strength=strength)
    assert et1 == et3

    assert et1.strength == strength
    assert et1.strength_avg == strength

    strength_avg = 1e3
    et4 = EneryTransferProcess([t1, t2], mult=8, strength=strength, strength_avg=strength_avg)
    assert et4.strength_avg == strength_avg

def test_log_exceptions_warnings_nothing():
    '''Tests the logging of exceptions and warnings'''

    # no exceptions or warnings
    @log_exceptions_warnings
    def raise_nothing(arg1, arg2=1):
        return str(arg1) + str(arg2)
    raise_nothing('a', arg2=6)

def test_log_exceptions_warnings_warning(caplog):
    '''Tests the logging of exceptions and warnings'''

    # warning
    @log_exceptions_warnings
    def raise_warning(arg1, arg2=1):
        warnings.warn(str(arg1) + str(arg2))
    with warnings.catch_warnings():
        warnings.filterwarnings("ignore", message="asd6")
        raise_warning('asd', arg2=6)
    assert len(caplog.records) == 1
    assert caplog.records[0].levelname == 'WARNING'
    assert 'UserWarning: "asd6" in test_util.py' in caplog.text

def test_log_exceptions_warnings_exception(caplog):
    '''Tests the logging of exceptions and warnings'''

    # exception
    @log_exceptions_warnings
    def raise_exception(arg1, arg2=1):
        return 1/0
    with pytest.raises(ZeroDivisionError) as excinfo:
        raise_exception('a', arg2=6)
    assert excinfo.type == ZeroDivisionError
    assert len(caplog.records) == 1
    assert caplog.records[0].levelname == 'ERROR'
    assert 'division by zero' in caplog.text


text:
Subchart Example

This is a basic demonstration of the C3 Area Chart graphing sine and cosine
    data across the interval of -360° to +360° at 45° degree increments.
    This example includes a subchart which allows the user to select subsets
    of the data.


text:
This example showcases Next.js's [Static Generation](https://nextjs.org/docs/basic-features/pages) feature using [Ghost](https://ghost.org/) as the data source.

> This boilerplate demonstrates simple usage and best practices. If you are looking for a more feature rich Next.js generator for Ghost including the Casper theme,
> check out [next-cms-ghost](https://github.com/styxlab/next-cms-ghost).

## Deploy your own

Once you have access to [the environment variables you'll need](#step-2-set-up-environment-variables), deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example):

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/git?c=1&s=https://github.com/vercel/next.js/tree/canary/examples/cms-ghost&env=ghost_BUCKET_SLUG,ghost_READ_KEY,ghost_PREVIEW_SECRET&envDescription=Required%20to%20connect%20the%20app%20with%20ghost&envLink=https://vercel.link/cms-ghost-env)

### Related examples

- [WordPress](/examples/cms-wordpress)
- [DatoCMS](/examples/cms-datocms)
- [Sanity](/examples/cms-sanity)
- [TakeShape](/examples/cms-takeshape)
- [Prismic](/examples/cms-prismic)
- [Contentful](/examples/cms-contentful)
- [Strapi](/examples/cms-strapi)
- [Agility CMS](/examples/cms-agilitycms)
- [ButterCMS](/examples/cms-buttercms)
- [Storyblok](/examples/cms-storyblok)
- [GraphCMS](/examples/cms-graphcms)
- [Kontent](/examples/cms-kontent)
- [Umbraco Heartcore](/examples/cms-umbraco-heartcore)
- [Blog Starter](/examples/blog-starter)
- [Builder.io](/examples/cms-builder-io)

## How to use

Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:

```bash
npx create-next-app --example cms-ghost cms-ghost-app
# or
yarn create next-app --example cms-ghost cms-ghost-app
```

### Setp 1. Run Next.js in development mode

To get started, no configuration is needed as this example sources the content from a demo Ghost CMS.

```bash
npm install
npm run dev

# or

yarn install
yarn dev
```

Your blog should be up and running on [http://localhost:3000](http://localhost:3000)! If it doesn't work, post on [GitHub discussions](https://github.com/vercel/next.js/discussions).

### Step 2. Set up environment variables

If you already have a Ghost CMS running, you should create new Content API keys in the Ghost Admin panel under Integrations -> Add custom integration.
Once your keys are generated, copy them into the environment variables as follows. Your `.env.local` file should look like this:

```bash
GHOST_API_URL=...
GHOST_API_KEY=...
```

Make sure to use the Content API Key.

### Step 3. Set up Headless Ghost CMS

If you do not have access to a Ghost CMS, you need to create one for your own content. The demo Ghost CMS is running on Hetzner Cloud, which is described in [Ghost CMS on Hetzner Cloud](https://www.jamify.org/2020/04/07/ghost-cms-on-hetzner-cloud/). Note that a Ghost install on localhost is not sufficient for public deploys, as the images on your local computer are not accessible from outside.

### Step 4. Deploy on Vercel

You can deploy this app to the cloud with [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).

#### Deploy Your Local Project

To deploy your local project to Vercel, push it to GitHub/GitLab/Bitbucket and [import to Vercel](https://vercel.com/import/git?utm_source=github&utm_medium=readme&utm_campaign=next-example).

**Important**: When you import your project on Vercel, make sure to click on **Environment Variables** and set them to match your `.env.local` file.

#### Deploy from Our Template

Alternatively, you can deploy using our template by clicking on the Deploy button below.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/git?c=1&s=https://github.com/vercel/next.js/tree/canary/examples/cms-ghost&env=GHOST_API_URL,GHOST_API_KEY&envDescription=Required%20to%20connect%20the%20app%20with%20ghost&envLink=https://vercel.link/cms-ghost-env)


text:
title: Getting Started
page_title: Getting Started - Appium
description: We will explore how to use Appium, the Microsoft recommended open source test automation framework, with Telerik UI for WinForms.
slug: geting-started
tags: appium
published: True
position: 2
---

# Getting Started

Here are the steps to write a **WinAppDriver** test:

1\. Run **WinAppDriver.exe** as an administrator and leave it running. Note the address the application is listening to, you will need it later.

![appium-getting-started 001](images/appium-getting-started001.png)

2\. Add UnitTest project to the solution of your test application or create a separate solution.

![appium-getting-started 002](images/appium-getting-started002.png)

3\. Right-click the Unit Test project in **Solution Explorer** and select "**Manage NuGet Packages…**". Install the latest stable Appium.WebDriver package.

4\. Create "**TestSession**" class where you set the **AppiumOptions** as follows:

````C#

public class TestSession
    {
        private const string WindowsApplicationDriverUrl = "http://127.0.0.1:4723";
        private const string TestApp = @"D:\WinAppDriver_WinForms_Tests\RadControlsTest\RadControlsTest\bin\Debug\RadControlsTest.exe";

        protected static WindowsDriver<WindowsElement> session;
        public static WindowsDriver<WindowsElement> desktopSession;

        public static void Setup(TestContext context)
        {
            // Launch RadGridView test application if it is not yet launched
            if (session == null || desktopSession == null)
            {
                TearDown();

                // Create a new session to bring up the test application
                AppiumOptions options = new AppiumOptions();
                options.AddAdditionalCapability("app", TestApp);
                options.AddAdditionalCapability("deviceName", "WindowsPC");
                options.AddAdditionalCapability("platformName", "Windows");

                session = new WindowsDriver<WindowsElement>(new Uri(WindowsApplicationDriverUrl), options);
                Assert.IsNotNull(session);
                Assert.IsNotNull(session.SessionId);

                // Set implicit timeout to 1.5 seconds to make element search to retry every 500 ms for at most three times
                session.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1.5);

                AppiumOptions optionsDesktop = new AppiumOptions();
                optionsDesktop.AddAdditionalCapability("app", "Root");
                optionsDesktop.AddAdditionalCapability("deviceName", "WindowsPC");
                optionsDesktop.AddAdditionalCapability("ms:experimental-webdriver", true);
                desktopSession = new WindowsDriver<WindowsElement>(new Uri(WindowsApplicationDriverUrl), optionsDesktop);
            }
        }

        public static void TearDown()
        {
            if (session != null)
            {
                session.Quit();
                session = null;
            }

            if (desktopSession != null)
            {
                desktopSession.Quit();
                desktopSession = null;
            }
        }
    }

````

5\. Rename the auto generated "**UnitTest1**" class to "**RadControlsScenarios**" which should inherit "**TestSession**". Here is the place to mention that our sample test application consists of **RadGridView**, **RadButton** and **RadDropDownButton** controls.

![appium-getting-started 003](images/appium-getting-started003.png)

6\. Next, we should create "**ClassInitialize**" and "**ClassCleanup**" methods.

````C#

[ClassInitialize]
public static void ClassInitialize(TestContext context)
{
    Setup(context);

    radGridView = session.FindElementByAccessibilityId("radGridView1");
    radDropDownButtonThemes = session.FindElementByAccessibilityId("radDropDownButton1");
}

[ClassCleanup]
public static void ClassCleanup()
{
    TearDown();
}

````

There are two general ways to write tests: Using **WinAppDriver UI Recorder** tool to record tests at runtime and writing tests from scratch using inspect.exe tool for locating elements in your application.

7\. Launch the **WinAppDriver UI Recorder** and click "**Record**." Hover over the "**radButton1**" and wait until it starts flashing blue. The Recorder's status bar will change its text from "**Active**" to "**XPath Ready**". Once you have recorded a sequence of steps you wish to reproduce, click "**Pause**" within the recorder. You can open the actions selector to make certain that all UI actions have been recorded.

![appium-getting-started 004](images/appium-getting-started004.png)

All you need to do now is to click the "**Generate and copy C# code to Clipboard**" button to copy the code for all recorded actions. Paste this code into the **TestMethod**.

````C#

[TestMethod]
public void ClickRadButton()
{
    // LeftClick on Button "radButton1" at (473,17)
    Console.WriteLine("LeftClick on Button \"radButton1\" at (473,17)");
    string xpath_LeftClickButtonradButton1_473_17 = "/Pane[@ClassName=\"#32769\"][@Name=\"Desktop 1\"]/Window[@Name=\"RadForm1\"][starts-with(@AutomationId,\"RadForm\")]/Table[@Name=\"Telerik.WinControls.UI.RadGridView ; 10;12\"][starts-with(@AutomationId,\"radGridView\")]/Button[@Name=\"radButton1\"][starts-with(@AutomationId,\"radButton\")]";
    var winElem_LeftClickButtonradButton1_473_17 = desktopSession.FindElementByAbsoluteXPath(xpath_LeftClickButtonradButton1_473_17);
    if (winElem_LeftClickButtonradButton1_473_17 != null)
    {
        winElem_LeftClickButtonradButton1_473_17.Click();
    }
    else
    {
        Console.WriteLine($"Failed to find element using xpath: {xpath_LeftClickButtonradButton1_473_17}");
        return;
    }

    var button = desktopSession.FindElementByName("clicked");
    Assert.IsTrue(button != null);
}

````

8\. Now, lets write two more tests from scratch. The first scenario is deleting a row from RadGridView's Context Menu and verifying the RadGridView rows count.

````C#

private static WindowsElement radGridView;
[TestMethod]
public void DeleteGridRow()
{
     var gridRowElements = radGridView.FindElementsByXPath(@"//*").Where(i => i.TagName == "ControlType.Custom").ToList();
     Assert.IsTrue(gridRowElements.Count == 9, "Expected rows: 9, Actual rows: " + gridRowElements.Count);

     radGridView.Click();
     radGridView.RightClick();

     desktopSession.FindElementByName("Delete Row").Click();

     gridRowElements = radGridView.FindElementsByXPath(@"//*").Where(i => i.TagName == "ControlType.Custom").ToList();
     Assert.IsTrue(gridRowElements.Count == 8, "Expected rows: 8, Actual rows: " + gridRowElements.Count);
}

````

9\. Let's continue with a scenario where we click a **RadDropDownButton**, followed by **RadMenuItem** in order to change the **ApplicationThemeName**.

````C#
private static WindowsElement radDropDownButtonThemes;
[TestMethod]
public void SetDarkThemeFromDropDown()
{
    radDropDownButtonThemes.Click();
    desktopSession.FindElementByName("FluentDark").Click();
    Thread.Sleep(3000);
}

````

10\. Create a public static class **WindowsElementExtensions**.cs and define the **FindElementByAbsoluteXPath** method. You will need that if you use the **UI Recorder** tool for your tests.

````C#
public static WindowsElement FindElementByAbsoluteXPath(this WindowsDriver<WindowsElement> desktopSession, string xPath, int nTryCount = 3)
{
    WindowsElement uiTarget = null;
    while (nTryCount-- > 0)
    {
        try
        {
            uiTarget = desktopSession.FindElementByXPath(xPath);
        }
        catch
        {
        }
        if (uiTarget != null)
        {
            break;
        }
        else
        {
            System.Threading.Thread.Sleep(400);
        }
    }
    return uiTarget;
}
````

Additionally, here you can write helper methods such as **DoubleClick**, **RightClick** or **Click** with a **X** and **Y** offset in order to test different scenarios.

````C#
public static void DoubleClick(this WindowsElement element, int offsetX = 0, int offsetY = 0
{
    Actions actions = new Actions(element.WrappedDriver);
    actions.Build();
    actions.MoveToElement(element);
    actions.MoveByOffset(offsetX, offsetY);
    actions.DoubleClick();
    actions.Perform();
}

public static void Click(this WindowsElement element, int offsetX = 0, int offsetY = 0)
{
    Actions actions = new Actions(element.WrappedDriver);
    actions.Build();
    actions.MoveToElement(element);
    actions.MoveByOffset(offsetX, offsetY);
    actions.Click();
    actions.Perform();
}

public static void RightClick(this WindowsElement element, int offsetX = 0, int offsetY = 0)
{
    Actions actions = new Actions(element.WrappedDriver);
    actions.Build();
    actions.MoveToElement(element);
    actions.MoveByOffset(offsetX, offsetY);
    actions.ContextClick();
    actions.Perform();
}

````

11\. Right-click the Unit Test project in Visual Studio and click "**Run Tests**". The test will launch your application, repeat all recorded steps, and close the application afterwards. All test activity is logged in the WinAppDriver console.

![appium-getting-started 005](images/appium-getting-started005.gif)


text:
- Type: Warning
- Contract: Crowdfunding
- Function name: withdrawfunds()
- PC address: 816

### Description
In the function `withdrawfunds()` a non-zero amount of Ether is sent to msg.sender.
Call value is balance_at_1461501637330902918203684832716283019655932542975 & address.

There is a check on storage index 7. This storage slot can be written to by calling the function `crowdfunding()`.

In *ether_send.sol:*

```
msg.sender.transfer(this.balance)
```
## Use of tx.origin
- Type: Warning
- Contract: Origin
- Function name: transferOwnership(address)
- PC address: 317

### Description
Function transferOwnership(address) retrieves the transaction origin (tx.origin) using the ORIGIN opcode. Use tx.sender instead.
See also: https://solidity.readthedocs.io/en/develop/security-considerations.html#tx-origin

In *origin.sol:*

```
tx.origin
```
## CALL with gas to dynamic address
- Type: Warning
- Contract: Reentrancy
- Function name: withdraw(uint256)
- PC address: 552

### Description
The function withdraw(uint256) contains a function call to the address of the transaction sender. The available gas is forwarded to the called contract. Make sure that the logic of the calling contract is not adversely affected if the called contract misbehaves (e.g. reentrancy).

In *reentrancy.sol:*

```
msg.sender.call.value(_amount)()
```
## Unchecked CALL return value
- Type: Informational
- Contract: Reentrancy
- Function name: withdraw(uint256)
- PC address: 552

### Description
The function withdraw(uint256) contains a call to msg.sender.
The return value of this call is not checked. Note that the function will continue to execute with a return value of '0' if the called contract throws.

In *reentrancy.sol:*

```
msg.sender.call.value(_amount)()
```
## Integer Underflow
- Type: Warning
- Contract: Under
- Function name: sendeth(address,uint256)
- PC address: 649

### Description
A possible integer underflow exists in the function `sendeth(address,uint256)`.
The SUB instruction at address 649 may result in a value < 0.

In *underflow.sol:*

```
balances[msg.sender] -= _value
```
## Integer Underflow
- Type: Warning
- Contract: Under
- Function name: sendeth(address,uint256)
- PC address: 567

### Description
A possible integer underflow exists in the function `sendeth(address,uint256)`.
The SUB instruction at address 567 may result in a value < 0.

In *underflow.sol:*

```
balances[msg.sender] - _value
```
## Weak random
- Type: Warning
- Contract: WeakRandom
- Function name: _function_0xe9874106
- PC address: 1285

### Description
In the function `_function_0xe9874106` the following predictable state variables are used to determine Ether recipient:
- block.coinbase

In *weak_random.sol:*

```
winningAddress.transfer(prize)
```


text:
Oskari.clazz.define('Oskari.geojson.bundle.geojson.request.RemoveGeoJSONRequest',
  function (groupId) {
    this._groupId = groupId;
  }, {
    __name: 'GeoJSONPlugin.RemoveGeoJSONRequest',
    getName: function () {
      return this.__name;
    },
    getGroupId: function () {
      return this._groupId;
    }
  }, {
    'protocol': ['Oskari.mapframework.request.Request']
  });


text:
package util.tasks

/**
 * Abstract timed task
 * @param time time when task should run (0 to run immediately)
 * @param priority task priorityColumn [0,maxInt]
 * Created by CAB on 13.10.2014.
 */

abstract class TimedTask (val time:Long, val priority:Int) {
  def execute():Unit}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Mosaddek">
    <meta name="keyword" content="FlatLab, Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <link rel="shortcut icon" href="img/favicon.png">

    <title>Inbox</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-reset.css" rel="stylesheet">

    <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="assets/jquery-file-upload/css/jquery.fileupload-ui.css" rel="stylesheet" type="text/css" >

      <link href="css/slidebars.css" rel="stylesheet">

    <link href="css/style.css" rel="stylesheet">
    <link href="css/style-responsive.css" rel="stylesheet" />

        Flatlab

                      6

You have 6 pending tasks

Dashboard v1.3

40%

                                      40% Complete (success)

Database Update

60%

                                      60% Complete (warning)

Iphone Development

87%

                                      87% Complete

Mobile App

33%

                                      33% Complete (danger)

Dashboard v1.3

45%

                                      45% Complete

                          See All Tasks

                      5

You have 5 new messages

                                    Jonathan Smith
                                    Just now

                                        Hello, this is an example msg.

                                    Jhon Doe
                                    10 mins

                                     Hi, Jhon Doe Bhai how are you ?

                                    Jason Stathum
                                    3 hrs

                                        This is awesome dashboard.

                                    Jondi Rose
                                    Just now

                                        Hello, this is metrolab

                          See all messages

                      7

You have 7 new notifications

                              Server #3 overloaded.
                              34 mins

                              Server #10 not respoding.
                              1 Hours

                              Database overloaded 24%.
                              4 hrs

                              New user registered.
                              Just now

                              Application error.
                              10 mins

                          See all notifications

                  <input type="text" class="form-control search" placeholder="Search">

                      Jhon Doue

Profile

 Settings

 Notification

 Log Out

                          Dashboard

                          Layouts

Boxed Page

Horizontal Menu

Different Color Top bar

Mega Menu

Language Switch Bar

Email Template

                          UI Elements

General

Buttons

Modal

Toastr Notifications

Widget

Slider

Nestable

Tree View

Font Awesome

                          Components

Grids

Calendar

Gallery

Todo List

Draggable Portlet

                          Form Stuff

Form Components

Advanced Components

Form Wizard

Form Validation

Dropzone File Upload

Inline Editor

Image Cropping

Multiple File Upload

                          Data Tables

Basic Table

Responsive Table

Dynamic Table

Editable Table

                          Mail

Inbox

Inbox Details

                          Charts

Morris

Chartjs

Flot Charts

xChart

                          Shop

List View

Details View

                          Google Maps

                          Chat Room

Lobby

 Chat Room

                          Extra

Blank Page

Sidebar Closed

People Directory

Coming Soon

Lock Screen

Profile

Invoice

Project List

Project Details

Search Result

Pricing Table

FAQ

FB Wall

404 Error

500 Error

                          Login Page

                          Multi level Menu

Menu Item 1

                              Menu Item 2

Menu Item 2.1

                                      Menu Item 3

Menu Item 3.1

Menu Item 3.2

Jonathan Smith

                              jsmith@gmail.com

                              Compose

                                          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Compose

                                          <form class="form-horizontal" role="form">

                                                  To

                                                      <input type="text" class="form-control" id="inputEmail1" placeholder="">

                                                  Cc / Bcc

                                                      <input type="text" class="form-control" id="cc" placeholder="">

                                                  Subject

                                                      <input type="text" class="form-control" id="inputPassword1" placeholder="">

                                                  Message

                                                      <textarea name="" id="" class="form-control" cols="30" rows="10"></textarea>

                                                        Attachment
                                                        <input type="file" multiple=""  name="files[]">

                                                      <button type="submit" class="btn btn-send">Send</button>

                                          </form>

                               Inbox 2

                               Sent Mail

                               Important

                               Drafts 30

                               Trash

Labels

   Work

   Design

   Family

   Friends

   Office

Buddy online

   Jhone Doe
I do not think

   Sumon
Busy with coding

   Anjelina Joli
I out of control

   Jonathan Smith
I am not here

   Tawseef
I do not think

Inbox

                          <form class="pull-right position" action="#">

                                  <input type="text"  placeholder="Search Mail" class="sr-input">
                                  <button type="button" class="btn sr-btn"></button>

                          </form>

                                 <input type="checkbox" class="mail-checkbox mail-group-checkbox">

                                         All

 None

 Read

 Unread

                                     More

 Mark as Read

 Spam

 Delete

                                     Move to

 Mark as Read

 Spam

 Delete

1-50 of 234

                                      <input type="checkbox" class="mail-checkbox">

                                  Vector Lab
                                  Lorem ipsum dolor imit set.

                                  9:27 AM

                                      <input type="checkbox" class="mail-checkbox">

                                  Mosaddek Hossain
                                  Hi Bro, How are you?

                                  March 15

                                      <input type="checkbox" class="mail-checkbox">

                                  Dulal khan
                                  Lorem ipsum dolor sit amet

                                  June 15

                                      <input type="checkbox" class="mail-checkbox">

                                  Facebook
                                  Dolor sit amet, consectetuer adipiscing

                                  April 01

                                      <input type="checkbox" class="mail-checkbox">

                                  Mosaddek urgent
                                  Lorem ipsum dolor sit amet

                                  May 23

                                      <input type="checkbox" class="mail-checkbox">

                                  Facebook
                                  Dolor sit amet, consectetuer adipiscing

                                  March 14

                                      <input type="checkbox" class="mail-checkbox">

                                  Rafiq
                                  Lorem ipsum dolor sit amet

                                  January 19

                                      <input type="checkbox" class="mail-checkbox">

                                  Facebook megazine
                                  Dolor sit amet, consectetuer adipiscing

                                  March 04

                                      <input type="checkbox" class="mail-checkbox">

                                  Mosaddek
                                  Lorem ipsum dolor sit amet

                                  June 13

                                      <input type="checkbox" class="mail-checkbox">

                                  Facebook family
                                  Dolor sit amet, consectetuer adipiscing

                                  March 24

                                      <input type="checkbox" class="mail-checkbox">

                                  Mosaddek
                                  Lorem ipsum dolor sit amet

                                  March 09

                                      <input type="checkbox" class="mail-checkbox">

                                  Facebook
                                  Dolor sit amet, consectetuer adipiscing

                                  May 14

                                      <input type="checkbox" class="mail-checkbox">

                                  Sumon
                                  Lorem ipsum dolor sit amet

                                  February 25

                                      <input type="checkbox" class="mail-checkbox">

                                  Facebook
                                  Dolor sit amet, consectetuer adipiscing

                                  March 14

                                      <input type="checkbox" class="mail-checkbox">

                                  Dulal
                                  Lorem ipsum dolor sit amet

                                  April 07

                                      <input type="checkbox" class="mail-checkbox">

                                  Twitter
                                  Dolor sit amet, consectetuer adipiscing

                                  July 14

                                      <input type="checkbox" class="mail-checkbox">

                                  Sumon
                                  Lorem ipsum dolor sit amet

                                  August 10

                                      <input type="checkbox" class="mail-checkbox">

                                  Facebook
                                  Dolor sit amet, consectetuer adipiscing

                                  April 14

                                      <input type="checkbox" class="mail-checkbox">

                                  Mosaddek
                                  Lorem ipsum dolor sit amet

                                  June 16

                                      <input type="checkbox" class="mail-checkbox">

                                  Sumon
                                  Lorem ipsum dolor sit amet

                                  August 10

                                      <input type="checkbox" class="mail-checkbox">

                                  Facebook
                                  Dolor sit amet, consectetuer adipiscing

                                  April 14

Online Customers

                          John Doe
                          Dream Land, AU

                              3

                          Jonathan Smith
                          United States

                              5

                          Jane Doe
                          ABC, USA

                          Anjelina Joli
                          Fockland, UK

                              7

                          Mr Tasi
                          Dream Land, USA

 pending Task

Dashboard v1.3

40%

                              40% Complete (success)

Database Update

60%

                              60% Complete (warning)

Iphone Development

87%

                              87% Complete

Mobile App

33%

                              33% Complete (danger)

Dashboard v1.3

45%

                              45% Complete

                  See All Tasks

              2013 © FlatLab by VectorLab.


text:
require 'helper'

describe Twitter::REST::API::SuggestedUsers do

  before do
    @client = Twitter::REST::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
  end

  describe "#suggestions" do
    context "with a category slug passed" do
      before do
        stub_get("/1.1/users/suggestions/art-design.json").to_return(:body => fixture("category.json"), :headers => {:content_type => "application/json; charset=utf-8"})
      end
      it "requests the correct resource" do
        @client.suggestions("art-design")
        expect(a_get("/1.1/users/suggestions/art-design.json")).to have_been_made
      end
      it "returns the users in a given category of the Twitter suggested user list" do
        suggestion = @client.suggestions("art-design")
        expect(suggestion).to be_a Twitter::Suggestion
        expect(suggestion.name).to eq("Art & Design")
        expect(suggestion.users).to be_an Array
        expect(suggestion.users.first).to be_a Twitter::User
      end
    end
    context "without arguments passed" do
      before do
        stub_get("/1.1/users/suggestions.json").to_return(:body => fixture("suggestions.json"), :headers => {:content_type => "application/json; charset=utf-8"})
      end
      it "requests the correct resource" do
        @client.suggestions
        expect(a_get("/1.1/users/suggestions.json")).to have_been_made
      end
      it "returns the list of suggested user categories" do
        suggestions = @client.suggestions
        expect(suggestions).to be_an Array
        expect(suggestions.first).to be_a Twitter::Suggestion
        expect(suggestions.first.name).to eq("Art & Design")
      end
    end
  end

  describe "#suggest_users" do
    before do
      stub_get("/1.1/users/suggestions/art-design/members.json").to_return(:body => fixture("members.json"), :headers => {:content_type => "application/json; charset=utf-8"})
    end
    it "requests the correct resource" do
      @client.suggest_users("art-design")
      expect(a_get("/1.1/users/suggestions/art-design/members.json")).to have_been_made
    end
    it "returns users in a given category of the Twitter suggested user list and return their most recent status if they are not a protected user" do
      suggest_users = @client.suggest_users("art-design")
      expect(suggest_users).to be_an Array
      expect(suggest_users.first).to be_a Twitter::User
      expect(suggest_users.first.id).to eq(13)
    end
  end

end


text:
/*

Javascript chain

by Chunlong ( jszen.com )
longbill.cn@gmail.com

Example:

new JSChain(
{
	foo: function(next)
	{
		console.log('foo');
		setTimeout(next,1000);
	},
	bar: function(a,b,next)
	{
		console.log('bar: '+a+' '+b);
		setTimeout(next,1000);
	}
}).foo().bar('hello','world').exec(function(next)
{
	console.log('cumtome function');
	setTimeout(next,1000);
}).exec(function()
{
	console.log('done');
});

*/

function JSChain(obj)
{
	var self = this;
	this.____items = []; //this remembers the callback functions list
	this.____finally = null;
	this.____next = function(jump)  //execute next function
	{
		if (!jump)
		{
			var func = self.____items.shift();
			if (func) func.call();
		}
		else self.____items = [];

		if (self.____items.length == 0 && typeof self.____finally == 'function')
		{
			self.____finally.call(obj);
			self.____finally = null;
		}
	};

	this.exec = function() //support for custom function
	{
		var args = [].slice.call(arguments,1),func = arguments[0];
		args.push(self.____next);
		self.____items.push(function()
		{
			func.apply(obj,args);
		});
		return self;
	};

	this.end = function(func) //support for final function
	{
		self.____finally = func;
		return self;
	};

	//copy and wrap the methods of obj
	for(var func in obj)
	{
		if (typeof obj[func] == 'function' && obj.hasOwnProperty(func))
		{
			(function(func)
			{
				self[func] = function()
				{
					var args = [].slice.call(arguments);
					args.push(self.____next); //pass next callback to the last argument
					self.____items.push(function() //wrap the function and push into callbacks array
					{
						obj[func].apply(obj,args);
					});
					return self; //always return JSChain it self like jQuery
				}
			})(func); // this is the closure tricks
		}
	}

	//start execute the chained functions in next tick
	setTimeout(self.____next,0);
	return this;
}

module.exports = JSChain;


text:
require 'ziya/charts/support/base'

module Ziya::Charts::Support
  # Creates a linkable area on the chart to use with the link component.
  # See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=link
  # for additional documentation, examples and futher detail.
  class Area < Base
    has_attribute :x, :y, :width, :height, :url, :priority, :target, :tooltip,
                  :timeout, :retry, :spinning_wheel
  end
end


text:
BEGIN_LEFDEF_PARSER_NAMESPACE

// Struct holds the data for one property.
class lefiProp
{
 public:
  lefiProp();
  void Init();

  void Destroy();
  ~lefiProp();

  void setPropType(const char* typ, const char* string);
  void setRange(double left, double right);
  void setNumber(double num);
  void setPropInteger();
  void setPropReal();
  void setPropString();
  void setPropQString(const char* string);
  void setPropNameMapString(const char* string);
  void clear();

  const char* string() const;
  const char* propType() const;
  const char* propName() const;
  char dataType() const;
  // either I:integer R:real S:string Q:quotedstring
  // N:property name is not defined in the property definition section
  int hasNumber() const;
  int hasRange() const;
  int hasString() const;
  int hasNameMapString() const;
  double number() const;
  double left() const;
  double right() const;

  void bumpSize(int size);
  void bumpName(int size);

  void print(FILE* f) const;

 protected:
  char* propType_;  // "design" "net" "macro" ...
  char* propName_;  // name.
  int nameSize_;    // allocated size of name.
  char hasRange_;   // either 0:NO or 1:YES.
  char hasNumber_;  // either 0:NO or 1:YES.
  char hasNameMapString_;
  char dataType_;     // either I:integer R:real S:string Q:quotedstring.
                      // N:property name is not defined.
  char* stringData_;  // if it is a string the data is here.
  int stringLength_;  // allocated size of stringData.
  double left_;
  double right_;  // if it has a range the numbers are here.
  double d_;      // if it is a real or int the number is here.
};

END_LEFDEF_PARSER_NAMESPACE

USE_LEFDEF_PARSER_NAMESPACE

#endif


text:
class WelcomeController < ApplicationController

  def home
    if !!current_user
      redirect_to user_preps_path(current_user)
    end
  end

end


text:
require 'rentlinx/modules/photoable'
require 'rentlinx/modules/amenityable'
require 'rentlinx/modules/linkable'

module Rentlinx
  # An object that represents a Rentlinx property.
  class Property < Base
    ATTRIBUTES = [:companyID, :propertyID, :description, :address, :city, :state,
                  :zip, :marketingName, :hideAddress, :latitude, :longitude,
                  :website, :yearBuilt, :numUnits, :phoneNumber, :extension,
                  :faxNumber, :emailAddress, :acceptsHcv, :propertyType,
                  :activeURL, :companyName, :leadsURL,
                  :premium, :capAmount, :rentlinxID].freeze

    REQUIRED_ATTRIBUTES = [:propertyID, :address, :city, :state, :zip,
                           :phoneNumber, :emailAddress].freeze

    attr_accessor(*ATTRIBUTES)

    # Posts the property with all of its attached units.
    #
    # TODO: Discuss whether or not these kinds of methods are needed,
    # or whether we should have post do everything every time.
    def post_with_units
      post
      units.each(&:post) unless units.nil? || units.empty?
    end

    # The list of units attached to the property.
    #
    # If the units list is empty, it will query Rentlinx for the list
    # of units stored on their end.
    #
    # @return a list of Rentlinx::Unit objects
    def units
      @units ||= get_units_for_property_id(propertyID)
    end

    # Allows assigning a list of units to the property.
    #
    # @param unit_list [Array] a list of Rentlinx::Unit objects
    # @return the updated list of Rentlinx::Unit objects
    def units=(unit_list)
      @units = unit_list.map do |unit|
        unit.propertyID = propertyID
        unit
      end
    end

    # Queries rentlinx and builds a property with the given ID.
    #
    # The returned property will have all the attributes Rentlinx
    # has for the property on their end.
    #
    # @param id [String] the rentlinx id of the property
    # @return a Rentlinx::Property that is up to date with the remote one
    def self.from_id(id)
      get_from_id(:property, id)
    end

    # Asks rentlinx for a list of places where the property is posted
    #
    # @param id [String] the rentlinx id of the property
    # @return a list of hashes
    def self.websites(id)
      Rentlinx.client.get_websites(id)
    end

    include Rentlinx::Photoable
    # For internal use.
    def photo_class
      Rentlinx::PropertyPhoto
    end

    include Rentlinx::Amenityable
    # For internal use.
    def amenity_class
      Rentlinx::PropertyAmenity
    end

    include Rentlinx::Linkable
    # For internal use.
    def link_class
      Rentlinx::PropertyLink
    end

    private

    def get_units_for_property_id(id)
      Rentlinx.client.get_units_for_property_id(id)
    end
  end
end


text:
/*

    Name:       Base16 Kimbie Dark
    Author:     Jan T. Sott

    Pygments template by Jan T. Sott (https://github.com/idleberg)
    Created with Base16 Builder by Chris Kempson (https://github.com/chriskempson/base16-builder)

*/
.highlight pre .hll { background-color: #84613d }
.highlight pre  { background: #221a0f; color: #fbebd4 }
.highlight pre .c { color: #a57a4c } /* Comment */
.highlight pre .err { color: #dc3958 } /* Error */
.highlight pre .k { color: #98676a } /* Keyword */
.highlight pre .l { color: #f79a32 } /* Literal */
.highlight pre .n { color: #fbebd4 } /* Name */
.highlight pre .o { color: #088649 } /* Operator */
.highlight pre .p { color: #fbebd4 } /* Punctuation */
.highlight pre .cm { color: #a57a4c } /* Comment.Multiline */
.highlight pre .cp { color: #a57a4c } /* Comment.Preproc */
.highlight pre .c1 { color: #a57a4c } /* Comment.Single */
.highlight pre .cs { color: #a57a4c } /* Comment.Special */
.highlight pre .gd { color: #dc3958 } /* Generic.Deleted */
.highlight pre .ge { font-style: italic } /* Generic.Emph */
.highlight pre .gh { color: #fbebd4; font-weight: bold } /* Generic.Heading */
.highlight pre .gi { color: #889b4a } /* Generic.Inserted */
.highlight pre .gp { color: #a57a4c; font-weight: bold } /* Generic.Prompt */
.highlight pre .gs { font-weight: bold } /* Generic.Strong */
.highlight pre .gu { color: #088649; font-weight: bold } /* Generic.Subheading */
.highlight pre .kc { color: #98676a } /* Keyword.Constant */
.highlight pre .kd { color: #98676a } /* Keyword.Declaration */
.highlight pre .kn { color: #088649 } /* Keyword.Namespace */
.highlight pre .kp { color: #98676a } /* Keyword.Pseudo */
.highlight pre .kr { color: #98676a } /* Keyword.Reserved */
.highlight pre .kt { color: #f06431 } /* Keyword.Type */
.highlight pre .ld { color: #889b4a } /* Literal.Date */
.highlight pre .m { color: #f79a32 } /* Literal.Number */
.highlight pre .s { color: #889b4a } /* Literal.String */
.highlight pre .na { color: #8ab1b0 } /* Name.Attribute */
.highlight pre .nb { color: #fbebd4 } /* Name.Builtin */
.highlight pre .nc { color: #f06431 } /* Name.Class */
.highlight pre .no { color: #dc3958 } /* Name.Constant */
.highlight pre .nd { color: #088649 } /* Name.Decorator */
.highlight pre .ni { color: #fbebd4 } /* Name.Entity */
.highlight pre .ne { color: #dc3958 } /* Name.Exception */
.highlight pre .nf { color: #8ab1b0 } /* Name.Function */
.highlight pre .nl { color: #fbebd4 } /* Name.Label */
.highlight pre .nn { color: #f06431 } /* Name.Namespace */
.highlight pre .nx { color: #8ab1b0 } /* Name.Other */
.highlight pre .py { color: #fbebd4 } /* Name.Property */
.highlight pre .nt { color: #088649 } /* Name.Tag */
.highlight pre .nv { color: #dc3958 } /* Name.Variable */
.highlight pre .ow { color: #088649 } /* Operator.Word */
.highlight pre .w { color: #fbebd4 } /* Text.Whitespace */
.highlight pre .mf { color: #f79a32 } /* Literal.Number.Float */
.highlight pre .mh { color: #f79a32 } /* Literal.Number.Hex */
.highlight pre .mi { color: #f79a32 } /* Literal.Number.Integer */
.highlight pre .mo { color: #f79a32 } /* Literal.Number.Oct */
.highlight pre .sb { color: #889b4a } /* Literal.String.Backtick */
.highlight pre .sc { color: #fbebd4 } /* Literal.String.Char */
.highlight pre .sd { color: #a57a4c } /* Literal.String.Doc */
.highlight pre .s2 { color: #889b4a } /* Literal.String.Double */
.highlight pre .se { color: #f79a32 } /* Literal.String.Escape */
.highlight pre .sh { color: #889b4a } /* Literal.String.Heredoc */
.highlight pre .si { color: #f79a32 } /* Literal.String.Interpol */
.highlight pre .sx { color: #889b4a } /* Literal.String.Other */
.highlight pre .sr { color: #889b4a } /* Literal.String.Regex */
.highlight pre .s1 { color: #889b4a } /* Literal.String.Single */
.highlight pre .ss { color: #889b4a } /* Literal.String.Symbol */
.highlight pre .bp { color: #fbebd4 } /* Name.Builtin.Pseudo */
.highlight pre .vc { color: #dc3958 } /* Name.Variable.Class */
.highlight pre .vg { color: #dc3958 } /* Name.Variable.Global */
.highlight pre .vi { color: #dc3958 } /* Name.Variable.Instance */
.highlight pre .il { color: #f79a32 } /* Literal.Number.Integer.Long */


text:
package com.bearsoft.org.netbeans.modules.form;

import com.bearsoft.org.netbeans.modules.form.completion.FormModuleCompletionContext;
import com.eas.client.cache.PlatypusFiles;
import com.eas.client.forms.Form;
import com.eas.designer.application.module.PlatypusModuleDataObject;
import com.eas.designer.application.module.completion.ModuleCompletionContext;
import java.io.IOException;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.loaders.DataFolder;
import org.openide.loaders.DataNode;
import org.openide.loaders.DataObject;
import org.openide.loaders.FileEntry;
import org.openide.loaders.MultiFileLoader;
import org.openide.nodes.Node;
import org.openide.nodes.Node.Cookie;

/**
 * The DataObject for forms.
 *
 * @author Ian Formanek, Petr Hamernik, mg
 */
public class PlatypusFormDataObject extends PlatypusModuleDataObject {

    /**
     * The entry for the .layout file
     */
    protected FileEntry formEntry;

    public PlatypusFormDataObject(FileObject aJsFile, MultiFileLoader loader) throws Exception {
        super(aJsFile, loader);
        FileObject aFormFile = FileUtil.findBrother(aJsFile, PlatypusFiles.FORM_EXTENSION);
        formEntry = (FileEntry) registerEntry(aFormFile);
    }

    public FileObject getFormFile() {
        return formEntry.getFile();
    }

    @Override
    public ModuleCompletionContext getCompletionContext() {
        return new FormModuleCompletionContext(this, Form.class);
    }

    @Override
    protected Cookie[] createServices() {
        return new Cookie[]{new PlatypusFormSupport(this)};
    }

    public boolean isReadOnly() {
        FileObject javaFO = getPrimaryFile();
        FileObject formFO = formEntry.getFile();
        return !javaFO.canWrite() || !formFO.canWrite();
    }

    public FileEntry getFormEntry() {
        return formEntry;
    }

    /**
     * Provides node that should represent this data object. When a node for
     * representation in a parent is requested by a call to getNode(parent) it
     * is the exact copy of this node with only parent changed. This
     * implementation creates instance DataNode.
     *

     * This method is called only once.
     *
     * @return the node representation for this data object
     * @see DataNode
     */
    @Override
    protected Node createNodeDelegate() {
        FormDataNode node = new FormDataNode(this);
        return node;
    }

    // Serialization
    static final long serialVersionUID = -975322113627854168L;

    private void readObject(java.io.ObjectInputStream is)
            throws java.io.IOException, ClassNotFoundException {
        is.defaultReadObject();
    }

    @Override
    protected DataObject handleCopyRename(DataFolder df, String name, String ext) throws IOException {
        FileObject fo = getPrimaryEntry().copyRename(df.getPrimaryFile(), name, ext);
        return DataObject.find(fo);
    }
}


text:
package io.xspec.maven.xspecMavenPlugin.utils;

import io.xspec.maven.xspecMavenPlugin.XSpecRunner;
import static org.junit.Assert.*;
import org.junit.Test;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;

/**
 * Tests XSpecResultsHandler
 * @author cmarchand
 */
public class XSpecResultsHandlerTest {
    private static final Attributes EMPTY_ATTRS = new AttributesImpl();

    @Test
    public void testNothing() {
        XSpecResultsHandler handler = new XSpecResultsHandler();
        assertEquals(0, handler.getFailed());
        assertEquals(0, handler.getPassed());
        assertEquals(0, handler.getPending());
        assertEquals(0, handler.getTests());
        assertEquals(handler.getTests(), handler.getFailed()+handler.getPassed()+handler.getPending());
    }

    @Test
    public void testAnotherElement() throws SAXException {
        XSpecResultsHandler handler = new XSpecResultsHandler();
        handler.startDocument();
        handler.startElement(XSpecRunner.XSPEC_NS, "content", "x:content", EMPTY_ATTRS);
        handler.endElement(XSpecRunner.XSPEC_NS, "content", "x:content");
        assertEquals(0, handler.getFailed());
        assertEquals(0, handler.getPassed());
        assertEquals(0, handler.getPending());
        assertEquals(0, handler.getTests());
        assertEquals(handler.getTests(), handler.getFailed()+handler.getPassed()+handler.getPending());
    }

    @Test
    public void testAnotherNS() throws SAXException {
        XSpecResultsHandler handler = new XSpecResultsHandler();
        handler.startDocument();
        handler.startElement("top:marchand:xml:maven", "test", "x:test", EMPTY_ATTRS);
        handler.endElement("top:marchand:xml:maven", "test", "x:test");
        assertEquals(0, handler.getFailed());
        assertEquals(0, handler.getPassed());
        assertEquals(0, handler.getPending());
        assertEquals(0, handler.getTests());
        assertEquals(handler.getTests(), handler.getFailed()+handler.getPassed()+handler.getPending());
    }

    @Test   // this should have one failed, because no attribute
    public void testNoAttribute() throws Exception {
        XSpecResultsHandler handler = new XSpecResultsHandler();
        handler.startDocument();
        handler.startElement(XSpecRunner.XSPEC_NS, "test", "x:test", EMPTY_ATTRS);
        handler.endElement(XSpecRunner.XSPEC_NS, "test", "x:test");
        assertEquals(1, handler.getFailed());
        assertEquals(0, handler.getPassed());
        assertEquals(0, handler.getPending());
        assertEquals(1, handler.getTests());
        assertEquals(handler.getTests(), handler.getFailed()+handler.getPassed()+handler.getPending());
    }

    @Test   // this should have one success
    public void testSuccess() throws Exception {
        XSpecResultsHandler handler = new XSpecResultsHandler();
        handler.startDocument();
        AttributesImpl attrs = new AttributesImpl();
        attrs.addAttribute(null, "successful", "successful", "string", "true");
        handler.startElement(XSpecRunner.XSPEC_NS, "test", "x:test", attrs);
        handler.endElement(XSpecRunner.XSPEC_NS, "test", "x:test");
        assertEquals(0, handler.getFailed());
        assertEquals(1, handler.getPassed());
        assertEquals(0, handler.getPending());
        assertEquals(1, handler.getTests());
        assertEquals(handler.getTests(), handler.getFailed()+handler.getPassed()+handler.getPending());
    }

    @Test   // this should have one success
    public void testSuccessFalse() throws Exception {
        XSpecResultsHandler handler = new XSpecResultsHandler();
        handler.startDocument();
        AttributesImpl attrs = new AttributesImpl();
        attrs.addAttribute(null, "successful", "successful", "string", "false");
        handler.startElement(XSpecRunner.XSPEC_NS, "test", "x:test", attrs);
        handler.endElement(XSpecRunner.XSPEC_NS, "test", "x:test");
        assertEquals(1, handler.getFailed());
        assertEquals(0, handler.getPassed());
        assertEquals(0, handler.getPending());
        assertEquals(1, handler.getTests());
        assertEquals(handler.getTests(), handler.getFailed()+handler.getPassed()+handler.getPending());
    }

    @Test   // this should have one pending
    public void testPending() throws Exception {
        XSpecResultsHandler handler = new XSpecResultsHandler();
        handler.startDocument();
        AttributesImpl attrs = new AttributesImpl();
        attrs.addAttribute(null, "pending", "pending", "string", "Because not implemented");
        handler.startElement(XSpecRunner.XSPEC_NS, "test", "x:test", attrs);
        handler.endElement(XSpecRunner.XSPEC_NS, "test", "x:test");
        assertEquals(0, handler.getFailed());
        assertEquals(0, handler.getPassed());
        assertEquals(1, handler.getPending());
        assertEquals(1, handler.getTests());
        assertEquals(handler.getTests(), handler.getFailed()+handler.getPassed()+handler.getPending());
    }

    @Test   // this should have one failed
    public void testPendingEmpty() throws Exception {
        XSpecResultsHandler handler = new XSpecResultsHandler();
        handler.startDocument();
        AttributesImpl attrs = new AttributesImpl();
        attrs.addAttribute(null, "pending", "pending", "string", "");
        handler.startElement(XSpecRunner.XSPEC_NS, "test", "x:test", attrs);
        handler.endElement(XSpecRunner.XSPEC_NS, "test", "x:test");
        assertEquals(1, handler.getFailed());
        assertEquals(0, handler.getPassed());
        assertEquals(0, handler.getPending());
        assertEquals(1, handler.getTests());
        assertEquals(handler.getTests(), handler.getFailed()+handler.getPassed()+handler.getPending());
    }
}


text:
<?php
/*
	Question2Answer by Gideon Greenspan and contributors
	http://www.question2answer.org/

	File: qa-include/qa-ajax-favorite.php
	Description: Server-side response to Ajax favorite requests

	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	More about this license: http://www.question2answer.org/license.php
*/

	require_once QA_INCLUDE_DIR.'app/users.php';
	require_once QA_INCLUDE_DIR.'app/cookies.php';
	require_once QA_INCLUDE_DIR.'app/favorites.php';
	require_once QA_INCLUDE_DIR.'app/format.php';

	$entitytype=qa_post_text('entitytype');
	$entityid=qa_post_text('entityid');
	$setfavorite=qa_post_text('favorite');

	$userid=qa_get_logged_in_userid();

	if (!qa_check_form_security_code('favorite-'.$entitytype.'-'.$entityid, qa_post_text('code')))
		echo "QA_AJAX_RESPONSE\n0\n".qa_lang('misc/form_security_reload');

	elseif (isset($userid)) {
		$cookieid=qa_cookie_get();

		qa_user_favorite_set($userid, qa_get_logged_in_handle(), $cookieid, $entitytype, $entityid, $setfavorite);

		$favoriteform=qa_favorite_form($entitytype, $entityid, $setfavorite, qa_lang($setfavorite ? 'main/remove_favorites' : 'main/add_favorites'));

		$themeclass=qa_load_theme_class(qa_get_site_theme(), 'ajax-favorite', null, null);
		$themeclass->initialize();

		echo "QA_AJAX_RESPONSE\n1\n";

		$themeclass->favorite_inner_html($favoriteform);
	}

/*
	Omit PHP closing tag to help avoid accidental output
*/


text:
#import <UIKit/UIKit.h>

/**
 The position of the button bar, typically aligned with the leading or trailing edge of the screen.

 Default: MDCBarButtonLayoutPositionNone
 */
typedef NS_OPTIONS(NSUInteger, MDCButtonBarLayoutPosition) {
  MDCButtonBarLayoutPositionNone = 0,

  /** The button bar is on the leading side of the screen. */
  MDCButtonBarLayoutPositionLeading = 1 << 0,
  MDCButtonBarLayoutPositionLeft = MDCButtonBarLayoutPositionLeading,

  /** The button bar is on the trailing side of the screen. */
  MDCButtonBarLayoutPositionTrailing = 1 << 1,
  MDCButtonBarLayoutPositionRight = MDCButtonBarLayoutPositionTrailing,
};

@protocol MDCButtonBarDelegate;

/**
 The MDCButtonBar class provides a view comprised of a horizontal list of buttons.

 This view will register KVO listeners on the provided button items for the following properties:

 - enabled
 - title
 - image

 If any of the above properties change, the MDCButtonBar will immediately reflect the change
 in the visible UIButton instance.
 */
IB_DESIGNABLE
@interface MDCButtonBar : UIView

#pragma mark Button Items

/**
 An array of UIBarButtonItem objects that will be used to populate the button views in this bar.

 Setting a new array of items will result in immediate recreation of the button views.

 Once set, changes made to the UIBarButtonItem properties will be observed and applied to the
 created button views.

 ### Item target/action method signature

 The complete action method signature is:

 - (void)didTap:(UIBarButtonItem *)item event:(UIEvent *)event button:(UIButton *)button;

 Each argument can be optionally-specified. E.g. @selector(didTap) is an acceptable action.

 ### iPad popover support

 MDCButtonBar is not able to associate UIBarButtonItem instances with their corresponding UIButton
 instance, so certain UIKit methods that accept a UIBarButtonItem cannot be used. This includes,
 but may not be limited to:

 - UIPopoverController::presentPopoverFromBarButtonItem:permittedArrowDirections:animated:
 - UIPrinterPickerController::presentFromBarButtonItem:animated:completionHandler:
 - UIPrintInteractionController::presentFromBarButtonItem:animated:completionHandler:
 - UIDocumentInteractionController::presentOptionsMenuFromBarButtonItem:animated:
 - UIDocumentInteractionController::presentOpenInMenuFromBarButtonItem:animated:

 Instead, you must use the related -FromRect: variant which requires a CGRect and view. You can
 use the provided UIButton by implementing the complete action method signature:

 - (void)didTap:(UIBarButtonItem *)item event:(UIEvent *)event button:(UIButton *)button;
 */
@property(nonatomic, copy, nullable) NSArray<UIBarButtonItem *> *items;

/**
 If greater than zero, will ensure that any UIButton with a title is aligned to the provided
 baseline.

 The baseline is expressed in number of points from the top edge of the receiver's
 bounds.

 Default: 0
 */
@property(nonatomic) CGFloat buttonTitleBaseline;

/**
 Sets the title font for the given state for all buttons.

 @param font The font that should be displayed on text buttons for the given state.
 @param state The state for which the font should be displayed.
 */
- (void)setButtonsTitleFont:(nullable UIFont *)font forState:(UIControlState)state;

/**
 Returns the font set for @c state that was set by setButtonsTitleFont:forState:.

 If no font has been set for a given state, the returned value will fall back to the value
 set for UIControlStateNormal.

 @param state The state for which the font should be returned.
 @return The font associated with the given state.
 */
- (nullable UIFont *)buttonsTitleFontForState:(UIControlState)state;

/**
 Sets the title label color for the given state for all buttons.

 @param color The color that should be used on text buttons labels for the given state.
 @param state The state for which the color should be used.
 */
- (void)setButtonsTitleColor:(nullable UIColor *)color forState:(UIControlState)state;

/**
 Returns the color set for @c state that was set by setButtonsTitleColor:forState:.

 If no value has been set for a given state, the returned value will fall back to the value
 set for UIControlStateNormal.

 @param state The state for which the color should be returned.
 @return The color associated with the given state.
 */
- (nullable UIColor *)buttonsTitleColorForState:(UIControlState)state;

/**
 The position of the button bar, usually positioned on the leading or trailing edge of the screen.

 Default: MDCBarButtonLayoutPositionNone
 */
@property(nonatomic) MDCButtonBarLayoutPosition layoutPosition;

/**
 The inkColor that is used for all buttons in the button bar.

 If set to nil, button bar buttons use default ink color.
 */
@property(nonatomic, strong, nullable) UIColor *inkColor;

/**
 Returns a height adhering to the Material spec for Bars and a width that is able to accommodate
 every item present in the `items` property. The provided size is ignored.
 */
- (CGSize)sizeThatFits:(CGSize)size;

@end

typedef NS_OPTIONS(NSUInteger, MDCBarButtonItemLayoutHints) {
  MDCBarButtonItemLayoutHintsNone = 0,

  /** Whether or not this bar button item is the first button in the list. */
  MDCBarButtonItemLayoutHintsIsFirstButton = 1 << 0,

  /** Whether or not this bar button item is the last button in the list. */
  MDCBarButtonItemLayoutHintsIsLastButton = 1 << 1,
};

/**
 The MDCButtonBarDelegate protocol defines the means by which MDCButtonBar can request that a
 view be created for a bar button item.

 An object that conforms to this protocol must forward UIControlEventTouchUpInside events to the
 button bar's didTapButton:event: method signature in order to pass the correct UIBarButtonItem
 argument to the item's target/action invocation. This method signature is made available by
 importing the MDCAppBarButtonBarBuilder.h header. The MDCAppBarButtonBarBuilder.h header should
 *only* be
 imported in files that implement objects conforming to MDCButtonBarDelegate.

 @seealso MDCBarButtonItemLayoutHints
 */
@protocol MDCButtonBarDelegate <NSObject>
@required

/** Asks the receiver to return a view that represents the given bar button item. */
- (nonnull UIView *)buttonBar:(nonnull MDCButtonBar *)buttonBar
                  viewForItem:(nonnull UIBarButtonItem *)barButtonItem
                  layoutHints:(MDCBarButtonItemLayoutHints)layoutHints;

@end


text:
#include "woothee.h"
#include "crawler.h"
#include "browser.h"
#include "os.h"
#include "mobilephone.h"
#include "appliance.h"
#include "misc.h"
#include "dataset.h"

static woothee_t *
woothee_create(void)
{
  woothee_t *self;

  self = (woothee_t *)malloc(sizeof(woothee_t));
  if (!self) {
    fprintf(stderr, "ERROR: Cannot allocate memory\n");
    return NULL;
  }
  memset(self, 0, sizeof(woothee_t));

  return self;
}

void
woothee_delete(woothee_t *self)
{
  if (!self) {
    return;
  }

  if (self->name) {
    free(self->name);
  }
  if (self->category) {
    free(self->category);
  }
  if (self->os) {
    free(self->os);
  }
  if (self->version) {
    free(self->version);
  }
  if (self->os_version) {
    free(self->os_version);
  }
  if (self->vendor) {
    free(self->vendor);
  }

  free(self);
}

static int
try_crawler(const char *useragent, woothee_t *result)
{
  if (woothee_crawler_challenge_google(useragent, result)) {
    return 1;
  }
  if (woothee_crawler_challenge_crawlers(useragent, result)) {
    return 1;
  }
  return 0;
}

static int
try_browser(const char *useragent, woothee_t *result)
{
  if (woothee_browser_challenge_msie(useragent, result)) {
    return 1;
  }
  if (woothee_browser_challenge_safari_chrome(useragent, result)) {
    return 1;
  }
  if (woothee_browser_challenge_firefox(useragent, result)) {
    return 1;
  }
  if (woothee_browser_challenge_opera(useragent, result)) {
    return 1;
  }
  if (woothee_browser_challenge_webview(useragent, result)) {
    return 1;
  }
  return 0;
}

static int
try_os(const char *useragent, woothee_t *result)
{
  if (woothee_os_challenge_windows(useragent, result)) {
    return 1;
  }

  /* OSX PC and iOS devices (strict check) */
  if (woothee_os_challenge_osx(useragent, result)) {
    return 1;
  }

  /* Linux PC and Android */
  if (woothee_os_challenge_linux(useragent, result)) {
    return 1;
  }

  /* all useragents matches /(iPhone|iPad|iPod|Android|BlackBerry)/ */
  if (woothee_os_challenge_smartphone(useragent, result)) {
    return 1;
  }

  /* mobile phones like KDDI-.* */
  if (woothee_os_challenge_mobilephone(useragent, result)) {
    return 1;
  }

  /* Nintendo DSi/Wii with Opera */
  if (woothee_os_challenge_appliance(useragent, result)) {
    return 1;
  }

  /* Win98, BSD, classic MacOS, ... */
  if (woothee_os_challenge_misc(useragent, result)) {
    return 1;
  }

  return 0;
}

static int
try_mobilephone(const char *useragent, woothee_t *result)
{
  if (woothee_mobilephone_challenge_docomo(useragent, result)) {
    return 1;
  }
  if (woothee_mobilephone_challenge_au(useragent, result)) {
    return 1;
  }
  if (woothee_mobilephone_challenge_softbank(useragent, result)) {
    return 1;
  }
  if (woothee_mobilephone_challenge_willcom(useragent, result)) {
    return 1;
  }
  if (woothee_mobilephone_challenge_misc(useragent, result)) {
    return 1;
  }
  return 0;
}

static int
try_appliance(const char *useragent, woothee_t *result)
{
  if (woothee_appliance_challenge_playstation(useragent, result)) {
    return 1;
  }
  if (woothee_appliance_challenge_nintendo(useragent, result)) {
    return 1;
  }
  if (woothee_appliance_challenge_digitaltv(useragent, result)) {
    return 1;
  }
  return 0;
}

static int
try_misc(const char *useragent, woothee_t *result)
{
  if (woothee_misc_challenge_desktoptools(useragent, result)) {
    return 1;
  }
  return 0;
}

static int
try_rare_cases(const char *useragent, woothee_t *result)
{
  if (woothee_misc_challenge_smartphone_patterns(useragent, result)) {
    return 1;
  }

  if (woothee_browser_challenge_sleipnir(useragent, result)) {
    return 1;
  }

  if (woothee_misc_challenge_http_library(useragent, result)) {
    return 1;
  }

  if (woothee_misc_challenge_maybe_rss_reader(useragent, result)) {
    return 1;
  }

  if (woothee_crawler_challenge_maybe_crawler(useragent, result)) {
    return 1;
  }

  return 0;
}

static woothee_t *
exec_parse(const char *useragent)
{
  woothee_t *result;

  if (!useragent) {
    return NULL;
  }

  result = woothee_create();
  if (!result) {
    return NULL;
  }

  if (strcmp(useragent, "-") == 0) {
    return result;
  }

  if (try_crawler(useragent, result)) {
    return result;
  }

  if (try_browser(useragent, result)) {
    if (try_os(useragent, result)) {
      return result;
    } else {
      return result;
    }
  }

  if (try_mobilephone(useragent, result)) {
      return result;
  }

  if (try_appliance(useragent, result)) {
      return result;
  }

  if (try_misc(useragent, result)) {
      return result;
  }

  /* browser unknown. check os only */
  if (try_os(useragent, result)) {
      return result;
  }

  if (try_rare_cases(useragent, result)) {
    return result;
  }

  return result;
}

woothee_t *
woothee_parse(const char *useragent)
{
  woothee_t *result = exec_parse(useragent);

  if (!result) {
    return NULL;
  }

  if (!result->name) {
    result->name = strdup(WOOTHEE_DATASET_VALUE_UNKNOWN);
  }
  if (!result->category) {
    result->category = strdup(WOOTHEE_DATASET_VALUE_UNKNOWN);
  }
  if (!result->os) {
    result->os = strdup(WOOTHEE_DATASET_VALUE_UNKNOWN);
  }
  if (!result->os_version) {
    result->os_version = strdup(WOOTHEE_DATASET_VALUE_UNKNOWN);
  }
  if (!result->version) {
    result->version = strdup(WOOTHEE_DATASET_VALUE_UNKNOWN);
  }
  if (!result->vendor) {
    result->vendor = strdup(WOOTHEE_DATASET_VALUE_UNKNOWN);
  }

  return result;
}

int
woothee_is_crawler(const char *useragent)
{
  woothee_t *result;
  int is_crawler = 0;

  if (!useragent || strlen(useragent) < 1 || strcmp(useragent, "-") == 0) {
    return is_crawler;
  }

  result = woothee_create();
  if (!result) {
    return is_crawler;
  }

  if (try_crawler(useragent, result)) {
    is_crawler = 1;
  }

  woothee_delete(result);

  return is_crawler;
}


text:
require "jtest/commands/new"
require "jtest/commands/find"
require "jtest/commands/test"
require "jtest/commands/update"

module Jtest
  module Commands

  end
end


text:
using System;
using System.Collections.Generic;
using ReMi.Common.Utils;

namespace ReMi.BusinessEntities.Reports
{
    public class Report
    {
        public List<String> Headers { get; set; }
        public List<List<String>> Data { get; set; }

        public override string ToString()
        {
            return String.Format("Headers={0}, Data={1}", Headers.FormatElements(), Data.FormatElements());
        }
    }
}


text:
<?php
/**
 * ORM trait for a PHPCraft subject
 * traits optional automatic called methods:
 *      setTraitDependencies[trait-name](): calls $this->setTraitDependencies
 *      setTraitInjections[trait-name](): calls $this->setTraitInjections
 *      processRouteTrait[trait-name](): processes route
 *      processConfigurationTrait[trait-name](): processes configuration
 *      initTrait[trait-name](): performs any task needed by trait BEFORE subject action is performed
 * @author vuk <http://vuk.bg.it>
 */

namespace PHPCraft\Subject\Traits;

trait ORM{

    /**
    * included trait flag
    **/
    protected $hasORM = true;

    /**
    * specific database object informations: table, view, primaryKey
    * primary key is always an array of at least 1 field, even in case of simple primary key definition
    **/
    protected $ORMParameters;

    /**
     * Sets trait dependencies from other traits
     **/
    public function setTraitDependenciesORM()
    {
        $this->setTraitDependencies('ORM', ['Database']);
    }

    /**
     * Processes configuration
     * @param array $configuration
     **/
    protected function processConfigurationTraitORM(&$configuration)
    {
        //check parameters
        if(!isset($configuration['subjects'][$this->name]['ORM'])) {
            throw new \Exception(sprintf('missing ORM parameters into %s subject configuration', $this->name));
        } else {
            $parameters = ['table', 'view', 'primaryKey'];
            foreach($parameters as $parameter) {
                if(!isset($configuration['subjects'][$this->name]['ORM'][$parameter]) || !$configuration['subjects'][$this->name]['ORM'][$parameter]) {
                    throw new \Exception(sprintf('missing %s ORM parameters into %s subject configuration', $parameter, $this->name));
                }
            }
            $this->setORMParameters($configuration['subjects'][$this->name]['ORM']['table'], $configuration['subjects'][$this->name]['ORM']['view'], $configuration['subjects'][$this->name]['ORM']['primaryKey']);
        }
    }

     /**
     * sets
     * @param string $table
     * @param string $view
     * @param mixed $primaryKey string | array (in case of compound primary keys)
     **/
    public function setORMParameters($table, $view, $primaryKey)
    {
        $this->ORMParameters['table'] = $table;
        $this->ORMParameters['view'] = $view;
        $this->ORMParameters['primaryKey'] = is_array($primaryKey) ? $primaryKey : [$primaryKey];

    }

    /**
     * returns table name with eventual schema
     * @return string
     **/
    public function table()
    {
        return $this->schema()
             . $this->ORMParameters['table'];
    }

    /**
     * returns view name with eventual schema
     * @return string
     **/
    public function view()
    {
        return $this->schema()
             . $this->ORMParameters['view'];
    }

    /**
     * Builds where conditions (using = operator) from an array of values indexed by fields names
     * @param mixed $primaryKey string | array indexed by PK fields in case of compound primary key
     * @throw exception if value(s) do not fit primary key definition
     **/
    protected function primaryKeyWhere($primaryKeyValue)
    {
        //value is not an array
        if(!is_array($primaryKeyValue)) {
            //turn value into array for first primary key field
            $primaryKeyValue = [
                $this->ORMParameters['primaryKey'][0] => $primaryKeyValue
            ];
        }
        //loop primary key fields
        foreach($this->ORMParameters['primaryKey'] as $field) {
            //check value
            if(!isset($primaryKeyValue[$field])) {
                throw new \Exception(sprintf('missing field % value in where clause for table %s compound primary key', $field, $this->table()));
            } else {
                $this->queryBuilder->where($field, $primaryKeyValue[$field]);
            }
        }
    }

    /**
     * gets records
     * @param array $where conditions (usiing = operator) in the form field => value
     * @param array $order order in the form field => direction (ASC | DESC)
     * @return array of records
     **/
    public function get($where = array(), $order = array())
    {
        $this->connectToDB();
        $this->queryBuilder->table($this->view());
        //where
        $this->where($where);
        //order
        foreach($order as $field => $direction) {
            $this->queryBuilder->orderBy($field, $direction);
        }
        $records = $this->queryBuilder->get();
        return $records;
    }

    /**
     * gets one record, first of recordset
     * @param array $where conditions in the form field => value
     * @param array $order order in the form field => direction (ASC | DESC)
     * @return object record
     **/
    public function getFirst($where = array(), $order = array())
    {
        return current($this->get($where, $order));
    }

    /**
     * gets one record by primary key value(s)
     * @param mixed $primaryKeyValue it can be:
     *          a single string value
     *          associative array of values indexed by fields names (compound primary key)
     * @return object record
     **/
    public function getByPrimaryKey($primaryKeyValue)
    {
        $this->connectToDB();
        $this->queryBuilder->table($this->view());
        $this->primaryKeyWhere($primaryKeyValue);
        return current($this->queryBuilder->get());
    }

    /**
     * Inserts record
     * @param array $fieldsValues
     * @return mixed $primaryKeyValue id of new record (if query builder insert operation returns it) or false
     */
    public function insert($fieldsValues)
    {
        $this->connectToDB();
        $this->queryBuilder->table($this->table());
        return $this->queryBuilder->insert($fieldsValues);
    }

    /**
     * Updates record
     * @param mixed $primaryKeyValue it can be:
     *          a single string value
     *          associative array of values indexed by fields names (compound primary key)
     * @param array $fieldsValues
     * @return mixed $primaryKeyValue or false
     */
    public function update($primaryKeyValue, $fieldsValues)
    {
        $this->connectToDB();
        $this->queryBuilder->table($this->table());
        $this->primaryKeyWhere($primaryKeyValue);
        $this->queryBuilder->update($fieldsValues);
        return $primaryKeyValue;
    }

    /**
     * Deletes record
     * @param array $fieldsValues
     */
    public function delete($fieldsValues)
    {
        $this->connectToDB();
        $this->queryBuilder->table($this->table());
        $this->queryBuilder->delete($fieldsValues);
    }
}


text:
'use strict';
angular.module('doorman.controllers')
        .controller("MainController", function ($location, $scope, DetalleTransaccionFactory, CarritoFactory, $cookies, $mdToast, $mdDialog) {
            $scope.productos = [];
            DetalleTransaccionFactory.recent(function (res) {
                $scope.productos = res;
            });

            $scope.detalle = function (producto) {
                console.log(producto);
            }

            $scope.carrito = function (producto) {
                if ($cookies.get('client') !== null && $cookies.get('client') !== undefined) {
                    var carrito = {
                        productoId: producto,
                        precio: producto.precio,
                    };
                    CarritoFactory.add({id: $cookies.get('client')}, carrito, function (res) {
                        if (res.codigo === 0) {
                            $mdToast.show(
                                    $mdToast.simple()
                                    .textContent(res.mensaje)
                                    .position('top right')
                                    .hideDelay(1500)
                                    );
                        } else {
                            $mdDialog.show(
                                    $mdDialog.alert()
                                    .parent(angular.element(document.querySelector('#popupContainer')))
                                    .clickOutsideToClose(true)
                                    .title('Hubo un problema')
                                    .textContent(res.mensaje)
                                    .ok('Ok')
                                    );
                        }
                    });
                } else {
                    $mdDialog.show(
                            $mdDialog.alert()
                            .parent(angular.element(document.querySelector('#popupContainer')))
                            .clickOutsideToClose(true)
                            .title('Hubo un problema')
                            .textContent("Primero inicia sesión")
                            .ok('Ok')
                            );
                }
            }
        });


text:
<template name="mainMenu">

                - Fork this App
                - Meteor Package

Also check out:

Open Source Live Chat App

Flexbox Grid Meteor package

Flexbox Grid (main website)

PostCSS for Meteor

Meteor Logo App

Ghost themes - pxt.be

ABC free Ghost theme

Foundation 5 for Meteor

Jeet grid system for Meteor

Scotty boilerplate for Meteor

Accounts system for Meteor

Notifications for Meteor

Notifications for React

</template>