text:
package org.keycloak.testsuite.admin.client;

import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.keycloak.admin.client.resource.ClientResource;
import org.keycloak.events.admin.OperationType;
import org.keycloak.events.admin.ResourceType;
import org.keycloak.representations.idm.ClientRepresentation;
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.testsuite.AbstractAuthTest;
import org.keycloak.testsuite.Assert;
import org.keycloak.testsuite.admin.ApiUtil;
import org.keycloak.testsuite.events.EventsListenerProviderFactory;
import org.keycloak.testsuite.util.AdminEventPaths;
import org.keycloak.testsuite.util.AssertAdminEvents;
import org.keycloak.testsuite.util.RealmBuilder;

import javax.ws.rs.core.Response;
import java.util.List;

/**
 *
 * @author Stan Silvert ssilvert@redhat.com (C) 2016 Red Hat Inc.
 */
public abstract class AbstractClientTest extends AbstractAuthTest {

    @Rule
    public AssertAdminEvents assertAdminEvents = new AssertAdminEvents(this);

    @Override
    public void setDefaultPageUriParameters() {
        super.setDefaultPageUriParameters();
        testRealmPage.setAuthRealm("test");
        accountPage.setAuthRealm("test");
    }

    @Before
    public void setupAdminEvents() {
        RealmRepresentation realm = testRealmResource().toRepresentation();
        if (realm.getEventsListeners() == null || !realm.getEventsListeners().contains(EventsListenerProviderFactory.PROVIDER_ID)) {
            realm = RealmBuilder.edit(testRealmResource().toRepresentation()).testEventListener().build();
            testRealmResource().update(realm);
        }
    }

    @After
    public void tearDownAdminEvents() {
        RealmRepresentation realm = RealmBuilder.edit(testRealmResource().toRepresentation()).removeTestEventListener().build();
        testRealmResource().update(realm);
    }

    protected RealmRepresentation realmRep() {
        return testRealmResource().toRepresentation();
    }

    protected String getRealmId() {
        return "test";
    }

    // returns UserRepresentation retrieved from server, with all fields, including id
    protected UserRepresentation getFullUserRep(String userName) {
        // the search returns all users who has userName contained in their username.
        List<UserRepresentation> results = testRealmResource().users().search(userName, null, null, null, null, null);
        UserRepresentation result = null;
        for (UserRepresentation user : results) {
            if (userName.equals(user.getUsername())) {
                result = user;
            }
        }
        Assert.assertNotNull("Did not find user with username " + userName, result);
        return result;
    }

    protected String createOidcClient(String name) {
        return createClient(createOidcClientRep(name));
    }

    protected String createOidcBearerOnlyClient(String name) {
        ClientRepresentation clientRep = createOidcClientRep(name);
        clientRep.setBearerOnly(Boolean.TRUE);
        clientRep.setPublicClient(Boolean.FALSE);
        return createClient(clientRep);
    }

    protected String createOidcConfidentialClientWithAuthz(String name) {
        ClientRepresentation clientRep = createOidcClientRep(name);
        clientRep.setBearerOnly(Boolean.FALSE);
        clientRep.setPublicClient(Boolean.FALSE);
        clientRep.setAuthorizationServicesEnabled(Boolean.TRUE);
        clientRep.setServiceAccountsEnabled(Boolean.TRUE);
        String id = createClient(clientRep);
        assertAdminEvents.assertEvent(getRealmId(), OperationType.CREATE, AdminEventPaths.clientResourcePath(id), ResourceType.AUTHORIZATION_RESOURCE_SERVER);
        return id;
    }

    protected ClientRepresentation createOidcClientRep(String name) {
        ClientRepresentation clientRep = new ClientRepresentation();
        clientRep.setClientId(name);
        clientRep.setName(name);
        clientRep.setRootUrl("foo");
        clientRep.setProtocol("openid-connect");
        return clientRep;
    }

    protected String createSamlClient(String name) {
        ClientRepresentation clientRep = new ClientRepresentation();
        clientRep.setClientId(name);
        clientRep.setName(name);
        clientRep.setProtocol("saml");
        return createClient(clientRep);
    }

    protected String createClient(ClientRepresentation clientRep) {
        Response resp = testRealmResource().clients().create(clientRep);
        resp.close();
        String id = ApiUtil.getCreatedId(resp);

        assertAdminEvents.assertEvent(getRealmId(), OperationType.CREATE, AdminEventPaths.clientResourcePath(id), clientRep, ResourceType.CLIENT);

        return id;
    }

    protected void removeClient(String clientDbId) {
        testRealmResource().clients().get(clientDbId).remove();

        assertAdminEvents.assertEvent(getRealmId(), OperationType.DELETE, AdminEventPaths.clientResourcePath(clientDbId), ResourceType.CLIENT);
    }

    protected ClientRepresentation findClientRepresentation(String name) {
        ClientResource clientRsc = findClientResource(name);
        if (clientRsc == null) return null;
        return findClientResource(name).toRepresentation();
    }

    protected ClientResource findClientResource(String name) {
        return ApiUtil.findClientResourceByName(testRealmResource(), name);
    }

    protected ClientResource findClientResourceById(String id) {
        return ApiUtil.findClientResourceByClientId(testRealmResource(), id);
    }

}


text:
package client

import (
	"fmt"
	"net"
	"net/http"
	"net/url"
	"strings"

	common "github.com/cilium/cilium/common"

	l "github.com/op/go-logging"
	"gopkg.in/resty.v0"
)

var log = l.MustGetLogger("cilium-net-client")

func init() {
	common.SetupLOG(log, "DEBUG")
}

// Client has the internal details necessary to talk with the daemon.
type Client struct {
	*resty.Client
}

// NewDefaultClient creates and returns a client that will talk with common.CiliumStock.
func NewDefaultClient() (*Client, error) {
	return NewClient("unix://"+common.CiliumSock, nil)
}

// NewClient creates and returns a client that will send requests to host, using the
// http.Client httpCli with transport and httpHeaders.
func NewClient(host string, transport *http.Transport) (*Client, error) {

	var (
		httpCli        *http.Client
		protoAddrParts = strings.SplitN(host, "://", 2)
		proto, addr    string
	)

	if len(protoAddrParts) != 2 {
		return nil, fmt.Errorf("invalid host format '%s'", host)
	} else {
		proto, addr = protoAddrParts[0], protoAddrParts[1]
	}

	switch proto {
	case "tcp":
		if _, err := url.Parse("tcp://" + addr); err != nil {
			return nil, err
		}
		addr = "http://" + addr
	case "http":
		addr = "http://" + addr
	}

	transport = configureTransport(transport, proto, addr)

	if httpCli != nil {
		httpCli.Transport = transport
	} else {
		httpCli = &http.Client{Transport: transport}
	}

	r := resty.New().SetTransport(transport).SetScheme("http").SetCloseConnection(true)
	if proto != "unix" {
		r.SetHostURL(addr)
	}

	log.Debugf("Client talking with host: %s", host)
	return &Client{
		r,
	}, nil
}

func configureTransport(tr *http.Transport, proto, addr string) *http.Transport {
	if tr == nil {
		tr = &http.Transport{}
	}

	if proto == "unix" {
		// No need for compression in local communications.
		tr.DisableCompression = true
		tr.Dial = func(_, _ string) (net.Conn, error) {
			return net.Dial(proto, addr)
		}
	} else {
		tr.Proxy = http.ProxyFromEnvironment
		tr.Dial = (&net.Dialer{}).Dial
	}

	return tr
}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

const angular = require('angular');

import {INSTANCE_STATES} from './instance.states';
import './InstanceSearchResultFormatter';
import './instanceSelection.less';

module.exports = angular
  .module('spinnaker.core.instance', [
    require('./details/console/consoleOutputLink.directive.js'),
    require('./loadBalancer/instanceLoadBalancerHealth.directive.js'),
    require('./details/multipleInstances.controller.js'),
    require('./details/instanceLinks.component'),
    require('./instanceList.directive'),
    INSTANCE_STATES
  ]);


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>br.com.its.archetypes.angularjs</groupId>
  <artifactId>webapps-parent-archetype</artifactId>
  <version>1.0.0</version>
  <packaging>maven-archetype</packaging>

  <name>webapps-parent-archetype</name>

  <build>
    <extensions>
      <extension>
        <groupId>org.apache.maven.archetype</groupId>
        <artifactId>archetype-packaging</artifactId>
        <version>2.2</version>
      </extension>
    </extensions>

    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-archetype-plugin</artifactId>
          <version>2.2</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <description>webapps module archetype for creating web application with AngularJS 1.0.x with Yeoman, Twitter bootstrap, Hibernate 4.x, Spring Core 3.x, Jersey 1.x, DBUnit and Util Java API separated by modules  back/front-end.</description>

  <url>https://github.com/ITSStartup/archetype-webapps-angularjs</url>
</project>


text:
This a plugin for [Zorro](http://www.takemoneyfromtherichandgiveittothepoor.com/) which lets you trade with [Dukascopy](http://www.dukascopy.com). It implements the [Zorro-Broker-API](http://www.zorro-trader.com/manual/en/brokerplugin.htm).

## General installation

1.) Download and install the latest **32-bit** [Java JDK](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html). Make sure it is the 32-bit version(x86 suffix) since the plugin DLL is a 32-bit library. In case you already have a 32-bit JDK installation(check it with *java -version*) you might skip this step.

2.) Install [Zorro](http://www.takemoneyfromtherichandgiveittothepoor.com/download.php) if not already on your machine.

3.) Download the [dukascopy.zip](https://github.com/juxeii/dztools/releases/download/v0.9.7/dzjforex-0.9.7.zip) archive.

4.) Extract the archive into *${yourZorroInstallPath}* folder.

5.) You will find the file *zorroDukascopy.bat* in your installation path. Edit it with a text editor and adapt the path to your Java installation. Save the file and run it. Now the dukascopy entry is visible in the drop down box for the brokers.

## Configuration/Usage

After extracting the dztools archive you should see a *dukascopy.dll* and a folder *dukascopy* in the *Plugin* directory of your Zorro installation.

Start Zorro and check if the *Account* drop-down-box shows *Dukascopy* as an available broker.
Pick a script of your choice and press *Trade*. If everything is fine you should see that the login to Dukascopy has been successful.

The plugin stores its logs to *dukascopy/logs/dzplugin.log*(the default log level is *info*). If you encounter problems open *dukascopy/dzplugin/log4j2.xml* for configuring the log level. Then change the log level for the file dzplugin-appender to *debug* and save the file. A new Zorro session will now produce a more verbose *dzplugin.log* file which you can use to report errors.

You can also change the log level for Dukascopy via *dztools/dzplugin/log4j.properties*.

## Remarks
The following broker commands are supported:
- GET_MAXREQUESTS
- GET_PRICETYPE
- GET_LOCK
- SET_PATCH
- SET_ORDERTEXT
- GET_DIGITS
- GET_MAXLOT
- GET_MINLOT
- GET_MARGININIT
- GET_TRADEALLOWED
- GET_TIME
- GET_MAXTICKS
- GET_SERVERSTATE
- GET_ACCOUNT
- SET_HWND
- SET_SLIPPAGE
- SET_LIMIT

- Plugin triggers Zorro on each tick change(thanks AndrewAMD!) to get a high tick resolution
- You can adapt the plugin.maxticks parameter in the Plugin.properties file. The higher the value the more data is fetched from Dukascopy when you want to download bars/ticks.


text:
import time
import logging

from django.db import models
import serial

from . import get_path
from mic import MicAnalyzer

logger = logging.getLogger(__name__)

class AcControl(models.Model):
    name = models.CharField(max_length=100, unique=True)

    # The priority for using when sending commands (lower value = higher priority)
    priority = models.PositiveIntegerField(default=1)

    # Serial port device ID where the Arduino is connected
    # ('COM#' on Windows, some '/dev/tty*' on Linux)
    # set to 'MOCK-SERIAL' to mock the serial port instead of using a real one
    serial_port = models.CharField(max_length=50, default=u'MOCK-SERIAL')

    # Beep detection parameters
    #  Timeout to wait for beep
    beep_timeout = models.FloatField(default=1.5)

    #  Time to wait after starting mic-listening and before sending command.
    listen_delay = models.FloatField(default=0.2)

    # Set to full path of debug recording file
    # If not blank, the beep-detection recording will be saved to this file.
    debug_rec_file = models.CharField(max_length=255, blank=True, default='')

    _serial = None

    def __unicode__(self):
        return u'%s (%s) #%d' % (self.name, self.serial_port, self.priority)

    def isMockSerial(self):
        return u'MOCK-SERIAL' == self.serial_port

    def initSerialPort(self):
        if self.isMockSerial():
            self._serial = None
            logger.debug(u'Arduino A/C-Control v1.0 - Ready')
        else:
            # Initialize serial port
            # (let exceptions bubble up in case of serial errors)
            logger.debug('Initializing %s' % (self))
            self._serial = serial.Serial(self.serial_port, timeout=2.0)
            logger.debug(self._serial.readline().strip())

    def writeParam(self, p, v):
        if self._serial:
            # Send command string via serial and get a line response
            self._serial.write('%s%d' % (p, v))
            res = unicode(self._serial.readline().strip())
        elif self.isMockSerial():
            # Mocked behaviour - success
            res = u'%s parameter set to %d' % (p, v)
        else:
            raise serial.SerialException(u'Serial port not initialized')
        logger.debug(res)
        if res.find(u'parameter set to') < 0:
            raise serial.SerialException(
                    u'Failed setting parameter %s to value %d' % (p, v))

    def _get_mic_mock_file(self):
        if self.isMockSerial():
            from random import choice
            return choice([get_path(u'test-data', 'noise.raw'),
                           get_path(u'test-data', 'beeps-1.raw')])

    def writeSendAndListen(self):
        analyzer = MicAnalyzer()
        mock_file = self._get_mic_mock_file()
        if self.isMockSerial():
            # Mocked behaviour - randomized success / beep-timeout
            #  (using the microphone analyzer, with canned recording)
            res = u'Success'
            logger.debug(u'Using mock file %s' % (mock_file))
        # Activate mic-listening and send the "Send" command via serial
        analyzer.start_listen(self.beep_timeout, rec_file=mock_file,
                              debug_rec_file=self.debug_rec_file)
        time.sleep(self.listen_delay)
        if self._serial:
            self._serial.write('S')
            # Dummy-read a line-response, and store the interesting response
            logger.debug(self._serial.readline().strip())
            res = self._serial.readline().strip()
        logger.debug(res)
        # Wait for beep
        if u'Success' == res and not analyzer.is_beep():
            res = u'Beep Timeout'
        return res

    def sendCommand(self, params):
        try:
            self.initSerialPort()
            self.writeParam('P', int(params['pwr']))
            self.writeParam('M', int(params['mode']))
            self.writeParam('F', int(params['fan']))
            self.writeParam('T', int(params['temp']))
            res = self.writeSendAndListen()
        except serial.SerialException, ex:
            logger.debug(u'Serial port %s error: %s' % (self.serial_port, ex))
            res = u'Serial Error'
        except KeyError, ex:
            res = u'Missing Parameter (%s)' % (ex)
            logger.debug(res)
        except ValueError, ex:
            res = u'Invalid Parameter'
            logger.debug(u'%s (%s)' % (res, ex))
        return res


text:
DotLedger.module('Collections', function () {
  this.SavedSearches = this.Base.extend({
    url: '/api/saved_searches',

    model: DotLedger.Models.SavedSearch
  });
});


text:
#import "NSBinder.h"

@class NSArray;

@interface _NSMultipleValueBinder : _NSBinder
{
	NSArray* _rowValues;
	NSString* _arrayKeyPath;
	NSString* _valueKeyPath;
}
-(void)applyToCell:(id)cell inRow:(int)row;
-(void)applyFromCell:(id)cell inRow:(int)row;
-(void)updateRowValues;
-(NSArray*)rowValues;
-(BOOL)allowsEditingForRow:(int)row;
-(void)cacheArrayKeyPath;
@end

@interface _NSTableViewContentBinder : _NSBinder

@end


text:
// ReSharper disable SuspiciousTypeConversion.Global
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable StringIndexOfIsCultureSpecific.1
// ReSharper disable StringIndexOfIsCultureSpecific.2
// ReSharper disable StringCompareToIsCultureSpecific
// ReSharper disable StringCompareIsCultureSpecific.1
// ReSharper disable UnusedMemberInSuper.Global
namespace Apache.Ignite.Core.Tests.Cache.Query.Linq
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.RegularExpressions;
    using Apache.Ignite.Linq;
    using NUnit.Framework;

    /// <summary>
    /// Tests LINQ.
    /// </summary>
    public partial class CacheLinqTest
    {
        /// <summary>
        /// Tests strings.
        /// </summary>
        [Test]
        public void TestStrings()
        {
            var strings = GetSecondPersonCache().AsCacheQueryable().Select(x => x.Value.Name);

            CheckFunc(x => x.PadLeft(20), strings);
            CheckFunc(x => x.PadLeft(20, 'l'), strings);
            CheckFunc(x => x.PadRight(20), strings);
            CheckFunc(x => x.PadRight(20, 'r'), strings);

            CheckFunc(x => x.ToLower(), strings);
            CheckFunc(x => x.ToUpper(), strings);
            CheckFunc(x => x.StartsWith("Person_9"), strings);
            CheckFunc(x => x.EndsWith("7"), strings);
            CheckFunc(x => x.Contains("son_3"), strings);
            CheckFunc(x => x.Length, strings);

            CheckFunc(x => x.IndexOf("9"), strings);
            CheckFunc(x => x.IndexOf("7", 4), strings);

            CheckFunc(x => x.Substring(4), strings);
            CheckFunc(x => x.Substring(4, 5), strings);

            CheckFunc(x => x.Trim(), strings);

#if !NETCOREAPP2_0  // Trim is not supported on .NET Core
            CheckFunc(x => x.Trim('P'), strings);
            var toTrim = new[] { 'P' };
            CheckFunc(x => x.Trim(toTrim), strings);
            CheckFunc(x => x.Trim(new List<char> { 'P' }.ToArray()), strings);
            CheckFunc(x => x.Trim('3'), strings);
            CheckFunc(x => x.TrimStart('P'), strings);
            CheckFunc(x => x.TrimStart(toTrim), strings);
            CheckFunc(x => x.TrimStart('3'), strings);
            Assert.Throws<NotSupportedException>(() => CheckFunc(x => x.TrimStart('P', 'e'), strings));
            CheckFunc(x => x.TrimEnd('P'), strings);
            CheckFunc(x => x.TrimEnd(toTrim), strings);
            CheckFunc(x => x.TrimEnd('3'), strings);
            var toTrimFails = new[] { 'P', 'c' };
            Assert.Throws<NotSupportedException>(() => CheckFunc(x => x.Trim(toTrimFails), strings));
            Assert.Throws<NotSupportedException>(() => CheckFunc(x => x.TrimStart(toTrimFails), strings));
            Assert.Throws<NotSupportedException>(() => CheckFunc(x => x.TrimEnd(toTrimFails), strings));
#endif

            CheckFunc(x => Regex.Replace(x, @"son.\d", "kele!"), strings);
            CheckFunc(x => Regex.Replace(x, @"son.\d", "kele!", RegexOptions.None), strings);
            CheckFunc(x => Regex.Replace(x, @"person.\d", "akele!", RegexOptions.IgnoreCase), strings);
            CheckFunc(x => Regex.Replace(x, @"person.\d", "akele!", RegexOptions.Multiline), strings);
            CheckFunc(x => Regex.Replace(x, @"person.\d", "akele!", RegexOptions.IgnoreCase | RegexOptions.Multiline),
                strings);
            var notSupportedException = Assert.Throws<NotSupportedException>(() => CheckFunc(x =>
                Regex.IsMatch(x, @"^person\d", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant), strings));
            Assert.AreEqual("RegexOptions.CultureInvariant is not supported", notSupportedException.Message);

            CheckFunc(x => Regex.IsMatch(x, @"^Person_9\d"), strings);
            CheckFunc(x => Regex.IsMatch(x, @"^person_9\d", RegexOptions.None), strings);
            CheckFunc(x => Regex.IsMatch(x, @"^person_9\d", RegexOptions.IgnoreCase), strings);
            CheckFunc(x => Regex.IsMatch(x, @"^Person_9\d", RegexOptions.Multiline), strings);
            CheckFunc(x => Regex.IsMatch(x, @"^person_9\d", RegexOptions.IgnoreCase | RegexOptions.Multiline), strings);
            notSupportedException = Assert.Throws<NotSupportedException>(() => CheckFunc(x =>
                Regex.IsMatch(x, @"^person_9\d",RegexOptions.IgnoreCase | RegexOptions.CultureInvariant), strings));
            Assert.AreEqual("RegexOptions.CultureInvariant is not supported", notSupportedException.Message);

            CheckFunc(x => x.Replace("son", ""), strings);
            CheckFunc(x => x.Replace("son", "kele"), strings);

            // Concat
            CheckFunc(x => x + x, strings);

            // String + int
            CheckFunc(x => x + 10, strings);
        }
    }
}


text:
require File.expand_path('../../spec_helper', __FILE__)

describe ActsAsTaggableOn::TagsHelper do
  before(:each) do
    clean_database!

    @bob = TaggableModel.create(:name => "Bob Jones",  :language_list => "ruby, php")
    @tom = TaggableModel.create(:name => "Tom Marley", :language_list => "ruby, java")
    @eve = TaggableModel.create(:name => "Eve Nodd",   :language_list => "ruby, c++")

    @helper = class Helper
      include ActsAsTaggableOn::TagsHelper
    end.new
  end

  it "should yield the proper css classes" do
    tags = { }

    @helper.tag_cloud(TaggableModel.tag_counts_on(:languages), ["sucky", "awesome"]) do |tag, css_class|
      tags[tag.name] = css_class
    end

    tags["ruby"].should == "awesome"
    tags["java"].should == "sucky"
    tags["c++"].should == "sucky"
    tags["php"].should == "sucky"
  end

  it "should handle tags with zero counts (build for empty)" do
    bob = ActsAsTaggableOn::Tag.create(:name => "php")
    tom = ActsAsTaggableOn::Tag.create(:name => "java")
    eve = ActsAsTaggableOn::Tag.create(:name => "c++")

    tags = { }

    @helper.tag_cloud(ActsAsTaggableOn::Tag.all, ["sucky", "awesome"]) do |tag, css_class|
      tags[tag.name] = css_class
    end

    tags["java"].should == "sucky"
    tags["c++"].should == "sucky"
    tags["php"].should == "sucky"
  end
end


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.amaralguincho_app.TelaFuncionario" >

    <ImageView
        android:id="@+id/imgFotoFuncionarioTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:src="@drawable/ic_launcher" />

    <TextView
        android:id="@+id/lblSobrenomeFuncionarioTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/imgFotoFuncionarioTelaFuncionario"
        android:layout_toRightOf="@+id/imgFotoFuncionarioTelaFuncionario"
        android:text="@string/lblSobrenomeFuncionarioTelaFuncionario" />

    <TextView
        android:id="@+id/lblNome1MotoristaTelaHabilitacao"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/lblSobrenomeFuncionarioTelaFuncionario"
        android:layout_below="@+id/lblSobrenomeFuncionarioTelaFuncionario"
        android:text="@string/lblNomeFuncionarioTelaFuncionario"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <Button
        android:id="@+id/btnHabilitacaoTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignRight="@+id/imgFotoFuncionarioTelaFuncionario"
        android:layout_below="@+id/imgFotoFuncionarioTelaFuncionario"
        android:text="@string/btnHabilitacaoTelaFuncionario" />

    <TextView
        android:id="@+id/lblHabilitacaoTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/btnHabilitacaoTelaFuncionario"
        android:layout_alignBottom="@+id/btnHabilitacaoTelaFuncionario"
        android:layout_alignLeft="@+id/lblNome1MotoristaTelaHabilitacao"
        android:text="@string/lblHabilitacaoTelaFuncionario"
        android:textAppearance="?android:attr/textAppearanceSmall" />

    <TextView
        android:id="@+id/lblCodigoTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/btnHabilitacaoTelaFuncionario"
        android:layout_marginTop="24dp"
        android:text="@string/lblCodigoTelaFuncionario" />

    <TextView
        android:id="@+id/lblSexoTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/lblCodigoTelaFuncionario"
        android:layout_below="@+id/lblCodigoTelaFuncionario"
        android:layout_marginTop="45dp"
        android:text="@string/lblSexoTelaFuncionario" />

    <TextView
        android:id="@+id/lblDataNascimentoTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/lblSexoTelaFuncionario"
        android:layout_alignBottom="@+id/lblSexoTelaFuncionario"
        android:layout_alignLeft="@+id/lblNome2TelaFuncionario"
        android:text="@string/lblDataNascimentoTelaFuncionario" />

    <TextView
        android:id="@+id/lblCpfTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/lblSexoTelaFuncionario"
        android:layout_below="@+id/lblSexoTelaFuncionario"
        android:layout_marginTop="47dp"
        android:text="@string/lblCpfTelaFuncionario" />

    <TextView
        android:id="@+id/lblEmailTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/lblCpfTelaFuncionario"
        android:layout_below="@+id/lblCpfTelaFuncionario"
        android:layout_marginTop="48dp"
        android:text="@string/lblEmailTelaFuncionario" />

    <TextView
        android:id="@+id/lblResedenciaTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/lblEmailTelaFuncionario"
        android:layout_below="@+id/lblEmailTelaFuncionario"
        android:layout_marginTop="39dp"
        android:text="@string/lblResedenciaTelaFuncionario" />

    <EditText
        android:id="@+id/txtCodigoTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignRight="@+id/btnHabilitacaoTelaFuncionario"
        android:layout_below="@+id/lblCodigoTelaFuncionario"
        android:ems="10"
        android:text="@string/txtCodigoTelaFuncionario" >

        <requestFocus />
    </EditText>

    <EditText
        android:id="@+id/txtNomeTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/txtCodigoTelaFuncionario"
        android:layout_alignBottom="@+id/txtCodigoTelaFuncionario"
        android:layout_alignRight="@+id/lblSobrenomeFuncionarioTelaFuncionario"
        android:layout_toRightOf="@+id/lblResedenciaTelaFuncionario"
        android:ems="10"
        android:text="@string/txtNomeTelaFuncionario" />

    <EditText
        android:id="@+id/txtSobrenomeTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/txtNomeTelaFuncionario"
        android:layout_alignBottom="@+id/txtNomeTelaFuncionario"
        android:layout_alignLeft="@+id/textView2"
        android:ems="10"
        android:text="@string/txtSobrenomeTelaFuncionario" />

    <EditText
        android:id="@+id/txtSexoTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignRight="@+id/lblSexoTelaFuncionario"
        android:layout_below="@+id/lblSexoTelaFuncionario"
        android:ems="10"
        android:text="@string/txtSexoTelaFuncionario" />

    <EditText
        android:id="@+id/txtDataNascimentoTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/txtSexoTelaFuncionario"
        android:layout_alignBottom="@+id/txtSexoTelaFuncionario"
        android:layout_alignLeft="@+id/lblDataNascimentoTelaFuncionario"
        android:layout_alignRight="@+id/textView2"
        android:ems="10"
        android:text="@string/txtDataNascimentoTelaFuncionario" />

    <TextView
        android:id="@+id/lblNumeroRegistroTelaHabilitacao"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/lblEmailTelaFuncionario"
        android:layout_alignRight="@+id/lblDataNascimentoTelaFuncionario"
        android:text="@string/lblTelefoneTelaFuncionario" />

    <TextView
        android:id="@+id/lblNome2TelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/txtNomeTelaFuncionario"
        android:layout_alignRight="@+id/txtNomeTelaFuncionario"
        android:text="@string/lblNome2TelaFuncionario" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/txtSobrenomeTelaFuncionario"
        android:layout_alignLeft="@+id/lblNumeroRegistroTelaHabilitacao"
        android:text="@string/lblSobrenome2TelaFuncionario" />

    <EditText
        android:id="@+id/txtCpfTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignRight="@+id/lblHabilitacaoTelaFuncionario"
        android:layout_below="@+id/lblCpfTelaFuncionario"
        android:ems="10"
        android:text="@string/txtCpfTelaFuncionario" />

    <EditText
        android:id="@+id/txtTelefoneTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/txtCpfTelaFuncionario"
        android:layout_alignBottom="@+id/txtCpfTelaFuncionario"
        android:layout_alignLeft="@+id/lblNumeroRegistroTelaHabilitacao"
        android:ems="10"
        android:text="@string/txtTelefoneTelaFuncionario" />

    <EditText
        android:id="@+id/txtEmailTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/lblEmailTelaFuncionario"
        android:layout_alignRight="@+id/txtResidenciaTelaFuncionario"
        android:layout_below="@+id/lblEmailTelaFuncionario"
        android:ems="10"
        android:text="@string/txtEmailTelaFuncionario" />

    <EditText
        android:id="@+id/txtResidenciaTelaFuncionario"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/lblResedenciaTelaFuncionario"
        android:layout_alignRight="@+id/txtTelefoneTelaFuncionario"
        android:layout_below="@+id/lblResedenciaTelaFuncionario"
        android:ems="10"
        android:text="@string/txtResidenciaTelaFuncionario" />

</RelativeLayout>


text:
package org.keycloak.cli;

import static org.keycloak.cli.Picocli.error;
import static org.keycloak.cli.Picocli.println;

import io.quarkus.bootstrap.runner.RunnerClassLoader;
import org.keycloak.configuration.KeycloakConfigSourceProvider;

import io.quarkus.bootstrap.runner.QuarkusEntryPoint;
import org.keycloak.util.Environment;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Model.CommandSpec;
import picocli.CommandLine.Option;
import picocli.CommandLine.Spec;

import java.lang.reflect.Field;
import java.nio.file.Path;
import java.util.Map;

@Command(name = "keycloak",
        usageHelpWidth = 150,
        header = "Keycloak - Open Source Identity and Access Management\n\nFind more information at: https://www.keycloak.org/%n",
        description = "Use this command-line tool to manage your Keycloak cluster%n", footerHeading = "%nUse \"${COMMAND-NAME} <command> --help\" for more information about a command.%nUse \"${COMMAND-NAME} options\" for a list of all command-line options.",
        footer = "%nby Red Hat",
        optionListHeading = "Configuration Options%n%n",
        commandListHeading = "%nCommands%n%n",
        version = {
        "Keycloak ${sys:kc.version}",
        "JVM: ${java.version} (${java.vendor} ${java.vm.name} ${java.vm.version})",
        "OS: ${os.name} ${os.version} ${os.arch}"
})
public class MainCommand {

    @Spec
    CommandSpec spec;

    @Option(names = { "--help" }, description = "This help message.", usageHelp = true)
    boolean help;

    @Option(names = { "--version" }, description = "Show version information", versionHelp = true)
    boolean version;

    @Option(names = "--profile", arity = "1", description = "Set the profile. Use 'dev' profile to enable development mode.", scope = CommandLine.ScopeType.INHERIT)
    public void setProfile(String profile) {
        System.setProperty("kc.profile", profile);
        System.setProperty("quarkus.profile", profile);
    }

    @Option(names = "--config-file", arity = "1", description = "Set the path to a configuration file.", paramLabel = "<path>", scope = CommandLine.ScopeType.INHERIT)
    public void setConfigFile(String path) {
        System.setProperty(KeycloakConfigSourceProvider.KEYCLOAK_CONFIG_FILE_PROP, path);
    }

    @Command(name = "config",
            description = "%nCreates a new server image based on the options passed to this command. Once created, configuration will be read from the server image and the server can be started without passing the same options again. Some configuration options require this command to be executed in order to actually change a configuration. For instance, the database vendor.%n",
            mixinStandardHelpOptions = true,
            usageHelpAutoWidth = true,
            optionListHeading = "%nOptions%n",
            parameterListHeading = "Available Commands%n")
    public void reAugment(@Option(names = "--verbose", description = "Print out more details when running this command.", required = false) Boolean verbose) {
        System.setProperty("quarkus.launch.rebuild", "true");
        println(spec.commandLine(), "Updating the configuration and installing your custom providers, if any. Please wait.");

        try {
            beforeReaugmentationOnWindows();
            QuarkusEntryPoint.main();
            println(spec.commandLine(), "Server configuration updated and persisted. Run the following command to review the configuration:\n");
            println(spec.commandLine(), "\t" + Environment.getCommand() + " show-config\n");
        } catch (Throwable throwable) {
            error(spec.commandLine(), "Failed to update server configuration.", throwable);
        }
    }

    private void beforeReaugmentationOnWindows() throws Exception {
        // On Windows, files generated during re-augmentation are locked and can't be re-created.
        // To workaround this behavior, we reset the internal cache of the runner classloader and force files
        // to be closed prior to re-augmenting the application
        // See KEYCLOAK-16218
        if (Environment.isWindows()) {
            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

            if (classLoader instanceof RunnerClassLoader) {
                RunnerClassLoader.class.cast(classLoader).resetInternalCaches();
            }
        }
    }

    @Command(name = "start-dev",
            description = "%nStart the server in development mode.%n",
            mixinStandardHelpOptions = true,
            optionListHeading = "%nOptions%n",
            parameterListHeading = "Available Commands%n")
    public void startDev(@Option(names = "--verbose", description = "Print out more details when running this command.", required = false) Boolean verbose) {
        System.setProperty("kc.profile", "dev");
        System.setProperty("quarkus.profile", "dev");
        KeycloakMain.start(spec.commandLine());
    }

    @Command(name = "export",
            description = "%nExport data from realms to a file or directory.%n",
            mixinStandardHelpOptions = true,
            showDefaultValues = true,
            optionListHeading = "%nOptions%n",
            parameterListHeading = "Available Commands%n")
    public void runExport(@Option(names = "--dir", arity = "1", description = "Set the path to a directory where files will be created with the exported data.", paramLabel = "<path>") String toDir,
            @Option(names = "--file", arity = "1", description = "Set the path to a file that will be created with the exported data.", paramLabel = "<path>") String toFile,
            @Option(names = "--realm", arity = "1", description = "Set the name of the realm to export", paramLabel = "<realm>") String realm,
            @Option(names = "--users", arity = "1", description = "Set how users should be exported. Possible values are: skip, realm_file, same_file, different_files.", paramLabel = "<strategy>", defaultValue = "different_files") String users,
            @Option(names = "--users-per-file", arity = "1", description = "Set the number of users per file. It's used only if --users=different_files.", paramLabel = "<number>", defaultValue = "50") Integer usersPerFile,
            @Option(names = "--verbose", description = "Print out more details when running this command.", required = false) Boolean verbose) {
        System.setProperty("keycloak.migration.action", "export");

        if (toDir != null) {
            System.setProperty("keycloak.migration.provider", "dir");
            System.setProperty("keycloak.migration.dir", toDir);
        } else if (toFile != null) {
            System.setProperty("keycloak.migration.provider", "singleFile");
            System.setProperty("keycloak.migration.file", toFile);
        } else {
            error(spec.commandLine(), "Must specify either --dir or --file options.");
        }

        System.setProperty("keycloak.migration.usersExportStrategy", users.toUpperCase());

        if (usersPerFile != null) {
            System.setProperty("keycloak.migration.usersPerFile", usersPerFile.toString());
        }

        if (realm != null) {
            System.setProperty("keycloak.migration.realmName", realm);
        }
        KeycloakMain.start(spec.commandLine());
    }

    @Command(name = "import",
            description = "%nImport data from a directory or a file.%n",
            mixinStandardHelpOptions = true,
            showDefaultValues = true,
            optionListHeading = "%nOptions%n",
            parameterListHeading = "Available Commands%n")
    public void runImport(@Option(names = "--dir", arity = "1", description = "Set the path to a directory containing the files with the data to import", paramLabel = "<path>") String toDir,
            @Option(names = "--file", arity = "1", description = "Set the path to a file with the data to import.", paramLabel = "<path>") String toFile,
            @Option(names = "--realm", arity = "1", description = "Set the name of the realm to import", paramLabel = "<realm>") String realm,
            @Option(names = "--override", arity = "1", description = "Set if existing data should be skipped or overridden.", paramLabel = "false", defaultValue = "true") boolean override,
            @Option(names = "--verbose", description = "Print out more details when running this command.", required = false) Boolean verbose) {
        System.setProperty("keycloak.migration.action", "import");
        if (toDir != null) {
            System.setProperty("keycloak.migration.provider", "dir");
            System.setProperty("keycloak.migration.dir", toDir);
        } else if (toFile != null) {
            System.setProperty("keycloak.migration.provider", "singleFile");
            System.setProperty("keycloak.migration.file", toFile);
        } else {
            error(spec.commandLine(), "Must specify either --dir or --file options.");
        }

        if (realm != null) {
            System.setProperty("keycloak.migration.realmName", realm);
        }

        System.setProperty("keycloak.migration.strategy", override ? "OVERWRITE_EXISTING" : "IGNORE_EXISTING");

        KeycloakMain.start(spec.commandLine());
    }

    @Command(name = "start",
            description = "%nStart the server.%n",
            mixinStandardHelpOptions = true,
            usageHelpAutoWidth = true,
            optionListHeading = "%nOptions%n",
            parameterListHeading = "Available Commands%n")
    public void start(
            @Option(names = "--show-config", arity = "0..1",
                    description = "Print out the configuration options when starting the server.",
                    fallbackValue = "show-config") String showConfig,
            @Option(names = "--verbose", description = "Print out more details when running this command.", required = false) Boolean verbose) {
        if ("show-config".equals(showConfig)) {
            System.setProperty("kc.show.config.runtime", Boolean.TRUE.toString());
            System.setProperty("kc.show.config", "all");
        } else if (showConfig != null) {
            throw new CommandLine.UnmatchedArgumentException(spec.commandLine(), "Invalid argument: " + showConfig);
        }
        KeycloakMain.start(spec.commandLine());
    }

    @Command(name = "show-config",
            description = "Print out the current configuration.",
            mixinStandardHelpOptions = true,
            optionListHeading = "%nOptions%n",
            parameterListHeading = "Available Commands%n")
    public void showConfiguration(
            @CommandLine.Parameters(paramLabel = "filter", defaultValue = "none", description = "Show all configuration options. Use 'all' to show all options.") String filter,
            @Option(names = "--verbose", description = "Print out more details when running this command.", required = false) Boolean verbose) {
        System.setProperty("kc.show.config", filter);
        KeycloakMain.start(spec.commandLine());
    }
}


text:
Notes:

Only BIFF8 is supported going forward. This is everything from and including Excel 97

Silverlight -
Does not currently support Silverlight as there is no ZipArchive implementation on Silverlight

Also, ConcurrentDictionary is not available on Silverlight though that can be worked around

Windows Phone
As far as I can tell it should work with Windows Phone 8.1, but we need some one who has Windows 8 to build ExcelDataReader.WindowsPhone


text:
.glyphicon.spinning {
    animation: spin 1s infinite linear;
    -webkit-animation: spin2 1s infinite linear;
}

@keyframes spin {
    from { transform: scale(1) rotate(0deg); }
    to { transform: scale(1) rotate(360deg); }
}

@-webkit-keyframes spin2 {
    from { -webkit-transform: rotate(0deg); }
    to { -webkit-transform: rotate(360deg); }
}

.result {
    max-height: 75vh;
}

.github-fork-ribbon {
  position: fixed;
}
.github-fork-ribbon.left-bottom:before {
    background-color: #080;
}


text:
module Locomotive
  class BaseController < ApplicationController

    include Locomotive::Concerns::SslController
    include Locomotive::Concerns::RedirectToMainHostController
    include Locomotive::Concerns::UrlHelpersController
    include Locomotive::Concerns::AccountController
    include Locomotive::Concerns::ExceptionController
    include Locomotive::Concerns::AuthorizationController
    include Locomotive::Concerns::StoreLocationController
    include Locomotive::Concerns::WithinSiteController
    include Locomotive::Concerns::WithinSiteController

    layout '/locomotive/layouts/application'

    helper Locomotive::BaseHelper, Locomotive::ErrorsHelper

    self.responder = Locomotive::ActionController::Responder # custom responder

    respond_to :html

  end
end


text:
<body>
<script>
if (window.testRunner) {
    testRunner.waitUntilDone();
    testRunner.dumpAsText();
    testRunner.setCanOpenWindows();
}

window.name = "start";
window.open("resources/form-submit-from-opened-window-helper.html");
</script>
</body>


text:
<?php

namespace Tests;

use Illuminate\Http\Request;
use League\OAuth1\Client;
use Mockery as m;
use PHPUnit_Framework_TestCase;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Session\SessionInterface;

use Tests\Fixtures\OAuthOneTestProviderStub;
use Laravel\Socialite\One\User;

class OAuthOneTest extends PHPUnit_Framework_TestCase
{
    public function tearDown()
    {
        m::close();
    }

    public function testRedirectGeneratesTheProperSymfonyRedirectResponse()
    {
        $server = m::mock(Client\Server\Twitter::class);
        $server->shouldReceive('getTemporaryCredentials')->once()->andReturn('temp');
        $server->shouldReceive('getAuthorizationUrl')->once()->with('temp')->andReturn('http://auth.url');
        $request = Request::create('foo');
        $request->setSession($session = m::mock(SessionInterface::class));
        $session->shouldReceive('set')->once()->with('oauth.temp', 'temp');

        $provider = new OAuthOneTestProviderStub($request, $server);
        $response = $provider->redirect();

        $this->assertInstanceOf(RedirectResponse::class, $response);
    }

    public function testUserReturnsAUserInstanceForTheAuthenticatedRequest()
    {
        $server = m::mock(Client\Server\Twitter::class);
        $temp = m::mock(Client\Credentials\TemporaryCredentials::class);
        $server->shouldReceive('getTokenCredentials')->once()->with($temp, 'oauth_token', 'oauth_verifier')->andReturn(
            $token = m::mock(Client\Credentials\TokenCredentials::class)
        );
        $server->shouldReceive('getUserDetails')->once()->with($token)->andReturn($user = m::mock(Client\Server\User::class));
        $token->shouldReceive('getIdentifier')->once()->andReturn('identifier');
        $token->shouldReceive('getSecret')->once()->andReturn('secret');
        $user->uid = 'uid';
        $user->email = 'foo@bar.com';
        $user->extra = ['extra' => 'extra'];
        $request = Request::create('foo', 'GET', ['oauth_token' => 'oauth_token', 'oauth_verifier' => 'oauth_verifier']);
        $request->setSession($session = m::mock(SessionInterface::class));
        $session->shouldReceive('get')->once()->with('oauth.temp')->andReturn($temp);

        $provider = new OAuthOneTestProviderStub($request, $server);
        $user = $provider->user();

        $this->assertInstanceOf(User::class, $user);
        $this->assertSame('uid', $user->id);
        $this->assertSame('foo@bar.com', $user->email);
        $this->assertSame(['extra' => 'extra'], $user->user);
    }

    /**
     * @expectedException \InvalidArgumentException
     */
    public function testExceptionIsThrownWhenVerifierIsMissing()
    {
        $server = m::mock(Client\Server\Twitter::class);
        $request = Request::create('foo');
        $request->setSession($session = m::mock(SessionInterface::class));

        $provider = new OAuthOneTestProviderStub($request, $server);
        $user = $provider->user();
    }
}


text:
using System;
using NUnit.Framework;
using NSubstitute;
using strange.extensions.context.api;
using strange.extensions.injector.api;

namespace reversi.main
{
	public class ConfigureApplicationServiceTest
	{
		ConfigureApplicationService _instance;

		[SetUp]
		public void SetUp()
		{
			_instance = new ConfigureApplicationService();
		}

		[TearDown]
		public void TearDown()
		{
			_instance = null;
		}

		[Test]
		public void testMapBindsIApplicationToApplicationWrapperAsASingleton ()
		{
			var mockContext = Substitute.For<ICrossContextCapable>();
			var mockBinder = Substitute.For<ICrossContextInjectionBinder>();
			mockContext.injectionBinder.Returns( mockBinder );
			var mockBinding = Substitute.For<IInjectionBinding>();
			mockBinder.Bind<IApplication>().Returns( mockBinding );
			var mockFinalBinding = Substitute.For<IInjectionBinding>();
			mockBinding.To<ApplicationWrapper>().Returns(mockFinalBinding);

			_instance.Setup( mockContext );

			mockBinder.Received().Bind<IApplication>();
			mockBinding.Received().To<ApplicationWrapper>();
			mockFinalBinding.Received().ToSingleton();
		}
	}
}


text:
//     let argml = builder.create('graphml',{version: '1.0',
// encoding: 'UTF-8',
// standalone: true})
//       .a('xmlns' , 'http://graphml.graphdrawing.org/xmlns')
//       .a('xmlns:arg' , 'xmlns:arg="http://www.argunet.org/xml/argml')
//       .a('xmlns:xsi' , 'http://www.w3.org/2001/XMLSchema-instance')
//       .a('xmlns:y'  , 'http://www.yworks.com/xml/graphml')
//       .a('xsi:schemaLocation' , 'http://www.argunet.org/xml/argml argunetxml.xsd http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd');

//       argml.e('key',{
//         'attr.name' :  'arg.debate',
//         'id' : 'd0'
//       });
//       argml.e('key',{
//         'for' : 'graphml',
//         'yfiles.type' :  'resources',
//         'id' : 'd1'
//       });
//       argml.e('key',{
//         'attr.name' :  'arg.node',
//         'for' : 'node',
//         'id' : 'd2'
//       });
//       argml.e('key',{
//         'for' : 'node',
//         'yfiles.type' :  'nodegraphics',
//         'id' : 'd3'
//       });
//       argml.e('key',{
//         'attr.name' : 'arg.edge',
//         'for' :  'edge',
//         'id' : 'd4'
//       });
//       argml.e('key',{
//         'for' : 'edge',
//         'yfiles.type' :  'edgegraphics',
//         'id' : 'd5'
//       });

//     let graph = argml.e('graph',{
//       'edgedefault' : 'directed',
//       'id' : 'G'
//     });

//     let statementArgMLIds = {};
//     let argumentArgMLIds = {};
//     let nodesByTitle = {};
//     //first we create argmlIds for every node and statement
//     //we could do this on the fly, but this way its cleaner
//     for(let node of data.map.nodes){
//       nodesByTitle[node.title] = node;
//       if(node.type == "statement"){
//         node.argmlId = statementArgMLIds[node.title];
//         if(!node.argmlId){
//             node.argmlId = this.getId();
//             statementArgMLIds[node.title] = node.argmlId;
//         }
//       }else if(node.type == "argument"){
//         node.argmlId = argumentArgMLIds[node.title];
//         if(!node.argmlId){
//             node.argmlId = this.getId();
//             argumentArgMLIds[node.title] = node.argmlId;
//         }

//         let argument = data.arguments[node.title];
//         for(let statement of argument.pcs){
//           let argmlId = statementArgMLIds[statement.title];
//           if(!argmlId){
//               argmlId = this.getId();
//               statementArgMLIds[statement.title] = argmlId;
//           }
//         }
//       }
//     }

//     for(let node of data.map.nodes){
//       let nodeEl = graph.e('node',{id: node.id});
//       let argDataEl = nodeEl.e('data',{'key':'d2'});

//       if(node.type == "statement"){
//         let statement = data.statements[node.title];
//         let thesisEl = argDataEl.e('arg:thesis',{'id':node.argmlId, 'colorIndex':'0'}).e('arg:title', null, statement.label).up();
//         let lastMember = _.last(statement.members);
//         thesisEl.e('arg:content', null, lastMember.text);
//         let shapeNode = nodeEl.e('data',{'key':'d3'}).e('y:shapeNode');
//         shapeNode.e('y:Geometry',{
//           'width':'135.0',
//           'x':'0',
//           'y':'0'
//         });
//         shapeNode.e('y:Fill',{
//           'color':'#FFFFFF',
//           'transparent':'false'
//         });
//         shapeNode.e('y:BorderStyle',{
//           'color':'#63AEF2',
//           'type':'line',
//           'width':'3.0'
//         });
//         shapeNode.e('y:NodeLabel',{
//           'alignment':'center',
//           'autoSizePolicy':'node_width',
//           'configuration':'CroppingLabel',
//           'fontFamily':'Dialog',
//           'fontSize':'12',
//           'fontStyle':'plain',
//           'hasBackgroundColor':'false',
//           'hasLineColor':'false',
//           'height':'0.0',
//           'modelName':'internal',
//           'modelPosition':'c',
//           'textColor':'#000000',
//           'visible':'true',
//           'width':'135.0',
//           x:'0.0'
//         });
//         shapeNode.e('y:NodeLabel',{
//           'alignment':'center',
//           'autoSizePolicy':'content',
//           'fontFamily':'Arial',
//           'fontSize':'13',
//           'fontStyle':'bold',
//           'hasBackgroundColor':'false',
//           'hasLineColor':'false',
//           'modelName':'internal',
//           'modelPosition':'t',
//           'textColor':'#000000',
//           'visible':'true',
//           'width':'118.0',
//           'x':'8.5'
//         },node.title);

//         shapeNode.e('y:NodeLabel',{
//           'alignment':'center',
//           'autoSizePolicy':'content',
//           'fontFamily':'Arial',
//           'fontSize':'13',
//           'fontStyle':'plain',
//           'hasBackgroundColor':'false',
//           'hasLineColor':'false',
//           'modelName':'internal',
//           'modelPosition':'b',
//           'textColor':'#000000',
//           'visible':'true',
//           'width':'128.0',
//           'x':'3.5'
//         },lastMember.text);
//         shapeNode.e('y:Shape',{'type':'roundrectangle'});

//       }else if(node.type == "argument"){
//         let argument = data.arguments[node.title];
//         let lastDescriptionStatement = _.last(argument.descriptions.members);
//         let description = (lastDescriptionStatement)?lastDescriptionStatement.text : "";
//         let argEl = argDataEl.e('arg:argument',{
//           'id' : node.argmlId,
//           'colorIndex' : '0',
//         }).e('arg:title',null,argument.title).up();
//         argEl.e('arg:description', null, description);
//         for(let i = 0; i < argument.pcs.length; i++){
//           let statement = argument.pcs[i];
//           let equivalenceClass = data.statements[statement.title];
//           let lastMember = _.last(equivalenceClass.members);
//           let propositionType = 'premise';
//           let argmlId = statementArgMLIds[statement.title];

//           if(statement.role == 'conclusion'){
//             if(i == argument.pcs.length - 1){
//               propositionType = 'conclusion';
//             }else{
//               propositionType = 'preliminaryConclusion';
//             }
//           }
//           argEl.e('arg:proposition',{
//             'id' : argmlId,
//             'type' : propositionType
//           }).e('arg:content', null, lastMember.text);
//           //let equivalenceClass = data.statements[statement.title];

//           //Hopefully the out-commented code will not be necessary in the future as ArgML will be cleaned up
//           //Until then, not all semantic relations will be exported. In most cases, this is not a problem.
//           // //In ArgML all semantic relations that are possibly not represented by edges, are saved in arg:proposition objects as arg:supportReference and arg:attackReference
//           // //These are:
//           // //1) Outgoing relations of premises and preliminiary conclusions
//           // //2) Incoming relations of conclusions
//           // for(let relation of equivalenceClass.relations){
//           //   //1) save outgoing relations of premises and preliminiary conclusions
//           //   if((propositionType == "premise" ||propositionType == "preliminaryConclusion") && relation.from == equivalenceClass){
//           //     let referenceAttributes = {};
//           //
//           //     if(relation.from instanceof EquivalenceClass){
//           //       let sourceArgmlId = statementArgMLIds[relation.from.title];
//           //       referenceAttributes.refersToProposition = sourceArgmlId;
//           //     }
//           //     let sourceNode = nodesByTitle[relation.from.title];
//           //     if(sourceNode){
//           //       referenceAttributes.refersToNode = sourceNode.id;
//           //       referenceAttributes.refersToArgunetNode = sourceNode.argmlId;
//           //     }
//           //
//           //     if(relation.type == "attack"){
//           //       propEl.e('arg:supportReference',referenceAttributes);
//           //     }else if(relation.type == "support"){
//           //       propEl.e('arg:attackReference',referenceAttributes);
//           //     }else if(relation.type == "contradiction"){
//           //       propEl.e('arg:contradictionReference',referenceAttributes);
//           //     }
//           //
//           //   //2) save incoming relations of conclusions
//           //   }else if(statement.role == "conclusion" && relation.to == equivalenceClass){
//           //     let referenceAttributes = {};
//           //
//           //     if(relation.to instanceof EquivalenceClass){
//           //       let targetArgmlId = statementArgMLIds[relation.to.title];
//           //       referenceAttributes.refersToProposition = targetArgmlId;
//           //     }
//           //     let targetNode = nodesByTitle[relation.to.title];
//           //     if(targetNode){
//           //       referenceAttributes.refersToNode = targetNode.id;
//           //       referenceAttributes.refersToArgunetNode = targetNode.argmlId;
//           //     }
//           //
//           //     if(relation.type == "attack"){
//           //       propEl.e('arg:supportReference',referenceAttributes);
//           //     }else if(relation.type == "support"){
//           //       propEl.e('arg:attackReference',referenceAttributes);
//           //     }else if(relation.type == "contradiction"){
//           //       propEl.e('arg:contradictionReference',referenceAttributes);
//           //     }
//           //
//           //   }
//           // }
//         }
//         let shapeNode = nodeEl.e('data',{'key':'d3'}).e('y:shapeNode');
//         shapeNode.e('y:Geometry',{
//           'width': '135',
//           'x':'0',
//           'y':'0'
//         });
//         shapeNode.e('y:Fill',{
//           'color':'#63AEF2',
//           'color2':'#82BEF5',
//           'transparent':'false'
//         });
//         shapeNode.e('y:BorderStyle',{
//           'color':'#000000',
//           'type':'line',
//           'width':'1.0'
//         });
//         shapeNode.e('y:NodeLabel',{
//           'alignment':'center',
//           'autoSizePolicy':'node_width',
//           'configuration':'CroppingLabel',
//           'fontFamily':'Dialog',
//           'fontSize':'12',
//           'fontStyle':'plain',
//           'hasBackgroundColor':'false',
//           'hasLineColor':'false',
//           'height':'0.0',
//           'modelName':'internal',
//           'modelPosition':'c',
//           'textColor':'#000000',
//           'visible':'true',
//           'width':'135.0',
//           'x':'0.0'
//         });
//         shapeNode.e('y:NodeLabel',{
//           'alignment':'center',
//           'autoSizePolicy':'content',
//           'fontFamily':'Arial',
//           'fontSize':'13',
//           'fontStyle':'bold',
//           'hasBackgroundColor':'false',
//           'hasLineColor':'false',
//           'modelName':'internal',
//           'modelPosition':'t',
//           'textColor':'#000000',
//           'visible':'true',
//           'width':'88.0',
//           x:'23.5'
//         }, node.title);

//         shapeNode.e('y:NodeLabel',{
//           'alignment':'center',
//           'autoSizePolicy':'content',
//           'fontFamily':'Arial',
//           'fontSize':'13',
//           'fontStyle':'plain',
//           'hasBackgroundColor':'false',
//           'hasLineColor':'false',
//           'modelName':'internal',
//           'modelPosition':'b',
//           'textColor':'#000000',
//           'visible':'true',
//           'width':'131.0',
//           'x':'2.0'
//         }, description);
//         shapeNode.e('y:Shape',{'type':'roundrectangle'});

//       }
//     }

//     for(let edge of data.map.edges){
//       let edgeEl = graph.e('edge',{id:edge.id, source:edge.from.id, target:edge.to.id});
//       let edgeType;
//       let edgeColor = '#00FF00';
//       if(edge.type == 'attack'){
//         edgeColor = '#FF0000';
//         if(edge.status == "sketched"){
//           edgeType = "sketchedAttack";
//         }else{
//           edgeType = "attack";
//         }
//       }else if(edge.type == "support"){
//         if(edge.status == "sketched"){
//           edgeType = "sketchedSupport";
//         }else{
//           edgeType = "support";
//         }
//       }
//       let argEdgeAttributes = {
//         'sourceNodeId': edge.from.argmlId,
//         'targetNodeId': edge.to.argmlId,
//         'type': edgeType
//       };
//       if(edge.fromStatement){
//         argEdgeAttributes.sourcePropositionId = statementArgMLIds[edge.fromStatement.title];
//       }
//       if(edge.toStatement){
//         argEdgeAttributes.targetPropositionId = statementArgMLIds[edge.toStatement.title];
//       }
//       edgeEl.e('data',{'key':'d4'}).e('arg:edge', argEdgeAttributes);

//       let polyLineEdge = edgeEl.e('data',{'key':'d5'}).e('y:PolyLineEdge');
//       polyLineEdge.e('y:LineStyle',{
//         'color':edgeColor,
//         'type':'line',
//         'width':'2.0'
//       });
//       polyLineEdge.e('y:Path',{
//         'sx':'0',
//         'sy':'0',
//         'tx':'0',
//         'ty':'0'
//       }).e('y:Point',{'x':'0','y':'0'}).up().e('y:Point',{'x':'0','y':'0'});
//       polyLineEdge.e('y:Arrows',{
//         'source':'none',
//         'target':'standard'
//       });
//       polyLineEdge.e('y:BendStyle', {
//         'smoothed':'false'
//       });
//     }
//     if(this.settings.convertToString){
//       data.argml = argml.end({
//           pretty: true,
//           indent: '  ',
//           newline: '\n',
//           allowEmpty: false
//       });
//     }else{
//       data.argml = argml;
//     }
//     return data;
//   }
//   getId(){
//     return chance.natural({min:0, max:9223372036854775807}); //positive long value
//   }
// }
// module.exports = {
//   ArgMLExport: ArgMLExport
// }


text:
(function () {
  window.extra = function (name) {
    return `!${name}!`
  }

  window.onload = function () {
    // clear the description
    var words = document.querySelector('.description').textContent
    document.querySelector('.description').innerHTML = ''

    var letters = words.split('')
    for (var i = 0; i < letters.length; i++) {
      setTimeout((function (c) {
        if (c === '|') {
          return function () { document.querySelector('.description').innerHTML = document.querySelector('.description').innerHTML + '</br>' }
        }
        return function () { document.querySelector('.description').innerHTML = document.querySelector('.description').innerHTML + c }
      }(letters[i])), 50 * i)
    }

    var buttons = document.querySelectorAll('.run');
    [].forEach.call(buttons, function (button) {
      button.click()
    })
  }
}())


text: Startup-ready web application


text:
import { Pipe, PipeTransform } from "@angular/core";

// From stackoverflow
// http://stackoverflow.com/a/35750252
@Pipe({name: 'keys'})
export class KeysPipe implements PipeTransform {
  transform(value, args:string[]) : any {
    let keys = [];
    for (var enumMember in value) {
      var isValueProperty = parseInt(enumMember, 10) >= 0
      if (isValueProperty) {
        keys.push({key: enumMember, value: value[enumMember]});
        // Uncomment if you want log
        // console.log("enum member: ", value[enumMember]);
      }
    }
    return keys;
  }
}


text:
require 'tilt/template'
require 'bluecloth'

module Tilt
  # BlueCloth Markdown implementation. See:
  # http://deveiate.org/projects/BlueCloth/
  class BlueClothTemplate < Template
    self.default_mime_type = 'text/html'

    def prepare
      @engine = BlueCloth.new(data, options)
      @output = nil
    end

    def evaluate(scope, locals, &block)
      @output ||= @engine.to_html
    end

    def allows_script?
      false
    end
  end
end


text:
package com.levelup.picturecache.loaders;

import uk.co.senab.bitmapcache.BitmapLruCache;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.ImageView;

import com.levelup.picturecache.transforms.bitmap.BitmapTransform;
import com.levelup.picturecache.transforms.storage.StorageTransform;

/**
 * Display bitmaps on an {@link View}, the default/error placeholder is defined by a {@link Drawable}
 *
It also handles the Bitmaps transformations use for storage and/or display

 */
public class ViewLoaderDefaultDrawable<T extends View> extends ViewLoader<T> {
	private final Drawable defaultDrawable;

	/**
	 * constructor of the {@link ViewLoaderDefaultDrawable}
	 * @param view the ImageView on which the loaded bitmap will be displayed
	 * @param defaultDrawable a drawable to be used as placeholder while the bitmap is loading, may be null
	 * @param storageTransform the transformation to use before storing the bitmap in the cache
	 * @param loadTransform the non-persistent transformation to use on the bitmap before displaying it
	 */
	public ViewLoaderDefaultDrawable(T view, Drawable defaultDrawable, StorageTransform storageTransform, BitmapTransform loadTransform) {
		super(view, storageTransform, loadTransform);
		this.defaultDrawable = defaultDrawable;
	}

	@Override
	public void displayDefaultView(BitmapLruCache drawableCache) {
		if (getImageView() instanceof ImageView) {
			((ImageView) getImageView()).setImageDrawable(defaultDrawable);
		}
	}

	@Override
	public void displayErrorView(BitmapLruCache cache) {
		if (getImageView() instanceof ImageView) {
			((ImageView) getImageView()).setImageDrawable(defaultDrawable);
		}
	}
}


text:
package com.freiheit.fuava.ctprofiler.guice;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * To select a method for profiling, you have to annotate
 * the associated class and the method with this annotation.
 *
 * Does not work for private methods!
 *
 * @author Peter Kolloch <peter.kolloch@freiheit.com>
 */
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface ProfileMe {

}


text:
from common import prepare, CHAR_DISTRIBUTION

def generate_palette(distribution):
    max = distribution[0][0]
    result = []
    for brightness, ignored in distribution:
        c = 255 * brightness / max
        result.append(c)
        result.append(c)
        result.append(c)
    return result

BlackAndWhiteMapping = {
    'palette': [0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF],
    'charmap': [' ', '@']
}

GrayscaleMapping = {
    'palette': generate_palette(CHAR_DISTRIBUTION),
    'charmap': map(lambda x: x[1], CHAR_DISTRIBUTION)
}

def image_to_text(image, mapping):
    palette = mapping['palette'] + [0] * (768 - len(mapping['palette']))
    prepared_image = prepare(image, palette)
    sz = prepared_image.size
    r = []
    for y in range(sz[1]):
        ln = ''
        for x in range(sz[0]):
            pxi = prepared_image.getpixel((x, y))
            ln += mapping['charmap'][pxi]
        r.append(ln)
    return '\n'.join(r)


text:
<?php

namespace AppBundle\Patterns\Strategy;

/**
 * Class LogToDatabase
 * @package AppBundle\Patterns\Strategy
 */
class LogToDatabase implements Logger
{

    /**
     * @param $data
     */
    public function log($data) : void
    {
        var_dump('log the data to a database');
    }
}


text:
import { Single } from "../../base/single/single";

export declare class SingleSelectInsertList extends Single {
    static xtype: string;
    static EVENT_CHANGE: string;
}


text:
<?php

class RetailOps_Api_Model_Catalog_Adapter_Category extends RetailOps_Api_Model_Catalog_Adapter_Abstract
{
    protected $_categories;
    /**
     * Array of already processed category indexes to avoid double save
     * @var array
     */
    protected $_wereProcessed = array();

    protected $_section = 'category';

    protected function _construct()
    {
        $this->_initCategories();
        $this->_errorCodes = array(
            'cant_save_category' => 201,
        );
        parent::_construct();
    }

    /**
     * @param array $productData
     * @param Mage_Catalog_Model_Product $product
     * @return mixed|void
     */
    public function processData(array &$productData, $product)
    {
        $assignedCategories = array();
        $categoryApi = $this->_getCategoryApi();
        if (isset($productData['categories'])) {
            foreach ($productData['categories'] as $categoriesData) {
                $categoryPath = array();
                foreach ($categoriesData as $categoryData) {
                    try {
                        $data = new Varien_Object($categoryData);
                        $parentCategoryPath = $categoryPath;
                        $categoryPath[] = $categoryData['name'];
                        $index = $this->_getCategoryPathIndex($categoryPath);
                        if (!in_array($index, $this->_wereProcessed)) {
                            if (!isset($this->_categories[$index])) {
                                $parentIndex = $this->_getCategoryPathIndex($parentCategoryPath);
                                $parentId = isset($this->_categories[$parentIndex]) ? $this->_categories[$parentIndex] : 1;

                                Mage::dispatchEvent('retailops_catalog_category_create_before',
                                    array('category_data' => $data));

                                $categoryId = $categoryApi->create($parentId, $data->getData());
                                $this->_categories[$index] = $categoryId;

                                Mage::dispatchEvent('retailops_catalog_category_create_after',
                                    array('category_id' => $categoryId, 'category_data' => $data));

                            } else {
                                $categoryId = $this->_categories[$index];

                                Mage::dispatchEvent('retailops_catalog_category_update_before',
                                    array('category_id' => $categoryId, 'category_data' => $data));

                                $categoryApi->update($categoryId, $data->getData());

                                Mage::dispatchEvent('retailops_catalog_category_update_after',
                                    array('category_id' => $categoryId, 'category_data' => $data));
                            }
                            $this->_wereProcessed[] = $index;
                        }
                        if (!empty($categoryData['link'])) {
                            $categoryId = $this->_categories[$index];
                            $assignedCategories[] = $categoryId;
                        }
                    } catch (Mage_Api_Exception $e) {
                        $this->_throwException(
                            sprintf('Error while saving category %s, message: %s', $categoryData['name'], $e->getCustomMessage()),
                            'cant_save_category'
                        );
                    }
                }
            }
            if (empty($productData['unset_other_categories']) || !$productData['unset_other_categories']) {
                $assignedCategories = array_merge($assignedCategories, $product->getCategoryIds());
            }
            $productData['category_ids'] = $assignedCategories;
        }
    }

    /**
     * @param Mage_Catalog_Model_Resource_Product_Collection $productCollection
     * @return $this
     */
    public function prepareOutputData($productCollection)
    {
        $usedCategoryIds = array();
        /** @var $product Mage_Catalog_Model_Product */
        foreach ($productCollection as $product) {
            $usedCategoryIds = array_merge($usedCategoryIds, $product->getCategoryIds());
        }
        $usedCategoryIds = array_unique($usedCategoryIds);
        /** @var $collection Mage_Catalog_Model_Resource_Category_Collection */
        $collection = Mage::getModel('catalog/category')->getCollection();
        $collection->addAttributeToSelect('path');
        $collection->addIdFilter($usedCategoryIds);
        $categoryToLoad = array();
        /** @var $category Mage_Catalog_Model_Category */
        foreach ($collection as $category) {
            $categoryToLoad = array_merge($categoryToLoad, $category->getPathIds());
        }
        $categoryToLoad = array_unique($categoryToLoad);
        /** @var $fullCollection Mage_Catalog_Model_Resource_Category_Collection */
        $fullCollection = Mage::getModel('catalog/category')->getCollection();
        $fullCollection->addAttributeToSelect('*');
        $fullCollection->addIdFilter($categoryToLoad);
        foreach ($fullCollection as $category) {
            $this->_categories[$category->getId()] = $category;
        }

        return $this;
    }

    /**
     * @param Mage_Catalog_Model_Product $product
     * @return array
     */
    public function outputData($product)
    {
        $data = array();
        $categoryIds = $product->getCategoryIds();
        $categoryPaths = array();
        foreach ($categoryIds as $categoryId) {
            $categoryPath = $this->_getCategoryData($categoryId);
            $categoryPaths[]['path'] = $categoryPath;
        }

        $data['categories'] = $categoryPaths;

        return $data;
    }

    /**
     * Get category data
     *
     * @param $categoryId
     * @return array
     */
    protected function _getCategoryData($categoryId)
    {
        $data = array();
        if (isset($this->_categories[$categoryId])) {
            $category = $this->_categories[$categoryId];
            $path = array_slice($category->getPathIds(), 1);
            foreach ($path as $catId) {
                if (isset($this->_categories[$catId])) {
                    $parentCategory = $this->_categories[$catId];
                    $data[] = $parentCategory->getData();
                }
            }
        }

        return $data;
    }

    /**
     * @return $this
     */
    protected function _initCategories()
    {
        $collection = Mage::getResourceModel('catalog/category_collection')->addNameToResult();
        /* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */
        foreach ($collection as $category) {
            $structure = explode('/', $category->getPath());
            $pathSize  = count($structure);
            if ($pathSize > 1) {
                $path = array();
                for ($i = 1; $i < $pathSize; $i++) {
                    $path[] = $collection->getItemById($structure[$i])->getName();
                }
                $index = $this->_getCategoryPathIndex($path);
                $this->_categories[$index] = $category->getId();
            }
        }

        return $this;
    }

    /**
     * @return Mage_Catalog_Model_Category_Api
     */
    protected function _getCategoryApi()
    {
        return Mage::getModel('catalog/category_api');
    }

    /**
     * @param $path
     * @return string
     */
    protected function _getCategoryPathIndex($path)
    {
        return implode('/', $path);
    }
}


text:
#include "../../HQEngineApp.h"
#include "../HQEventSeparateThread.h"

#include <android/log.h>

#define  LOGI(...)  __android_log_print(ANDROID_LOG_INFO, "HQGameThread", __VA_ARGS__)

HQEventQueue* hq_engine_eventQueue_internal;
HQGameThead ge_hqGameThread("HQEngine Game Thread");

extern JavaVM *ge_jvm;
extern JNIEnv * AttachCurrenThreadJEnv();

extern void HQAppInternalOnGameThreadExit();

HQGameThead ::HQGameThead(const char *threadName)
	:HQThread(threadName)
{
}

void HQGameThead :: Run()
{
	//attach this thread to jvm
	JNIEnv *env;
	jint re = ge_jvm->GetEnv((void**)&env, JNI_VERSION_1_2);

	if(re == JNI_EDETACHED)
	{
		AttachCurrenThreadJEnv();
	}

	//create event queue
	hq_engine_eventQueue_internal = new HQEventQueue();

	LOGI("before calling m_entryFunc, m_entryFunc=%p", m_entryFunc);

	m_entryFunc(0, NULL);

	LOGI("after calling m_entryFunc");

	delete hq_engine_eventQueue_internal;

	HQAppInternalOnGameThreadExit();
}