text:
package org.elasticsearch.cluster.service;

import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.ClusterStateObserver;
import org.elasticsearch.cluster.LocalNodeMasterListener;
import org.elasticsearch.cluster.block.ClusterBlocks;
import org.elasticsearch.cluster.coordination.NoMasterBlockService;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider;
import org.elasticsearch.cluster.service.ClusterApplier.ClusterApplyListener;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.MockLogAppender;
import org.elasticsearch.test.junit.annotations.TestLogging;
import org.elasticsearch.threadpool.TestThreadPool;
import org.elasticsearch.threadpool.ThreadPool;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;

import java.util.Objects;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;

import static java.util.Collections.emptyMap;
import static java.util.Collections.emptySet;
import static org.elasticsearch.test.ClusterServiceUtils.createNoOpNodeConnectionsService;
import static org.elasticsearch.test.ClusterServiceUtils.setState;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;

public class ClusterApplierServiceTests extends ESTestCase {

    private static ThreadPool threadPool;
    private TimedClusterApplierService clusterApplierService;

    @BeforeClass
    public static void createThreadPool() {
        threadPool = new TestThreadPool(ClusterApplierServiceTests.class.getName());
    }

    @AfterClass
    public static void stopThreadPool() {
        if (threadPool != null) {
            threadPool.shutdownNow();
            threadPool = null;
        }
    }

    @Before
    public void setUp() throws Exception {
        super.setUp();
        clusterApplierService = createTimedClusterService(true);
    }

    @After
    public void tearDown() throws Exception {
        clusterApplierService.close();
        super.tearDown();
    }

    private TimedClusterApplierService createTimedClusterService(boolean makeMaster) {
        DiscoveryNode localNode = new DiscoveryNode("node1", buildNewFakeTransportAddress(), emptyMap(),
            emptySet(), Version.CURRENT);
        TimedClusterApplierService timedClusterApplierService = new TimedClusterApplierService(Settings.builder().put("cluster.name",
            "ClusterApplierServiceTests").build(), new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS),
            threadPool);
        timedClusterApplierService.setNodeConnectionsService(createNoOpNodeConnectionsService());
        timedClusterApplierService.setInitialState(ClusterState.builder(new ClusterName("ClusterApplierServiceTests"))
            .nodes(DiscoveryNodes.builder()
                .add(localNode)
                .localNodeId(localNode.getId())
                .masterNodeId(makeMaster ? localNode.getId() : null))
            .blocks(ClusterBlocks.EMPTY_CLUSTER_BLOCK).build());
        timedClusterApplierService.start();
        return timedClusterApplierService;
    }

    @TestLogging(value = "org.elasticsearch.cluster.service:TRACE", reason = "to ensure that we log cluster state events on TRACE level")
    public void testClusterStateUpdateLogging() throws Exception {
        MockLogAppender mockAppender = new MockLogAppender();
        mockAppender.start();
        mockAppender.addExpectation(
                new MockLogAppender.SeenEventExpectation(
                        "test1",
                        ClusterApplierService.class.getCanonicalName(),
                        Level.DEBUG,
                        "*processing [test1]: took [1s] no change in cluster state"));
        mockAppender.addExpectation(
                new MockLogAppender.SeenEventExpectation(
                        "test2",
                        ClusterApplierService.class.getCanonicalName(),
                        Level.TRACE,
                        "*failed to execute cluster state applier in [2s]*"));
        mockAppender.addExpectation(
            new MockLogAppender.SeenEventExpectation(
                "test3",
                ClusterApplierService.class.getCanonicalName(),
                Level.DEBUG,
                "*processing [test3]: took [0s] no change in cluster state*"));

        Logger clusterLogger = LogManager.getLogger(ClusterApplierService.class);
        Loggers.addAppender(clusterLogger, mockAppender);
        try {
            clusterApplierService.currentTimeOverride = threadPool.relativeTimeInMillis();
            clusterApplierService.runOnApplierThread("test1",
                currentState -> clusterApplierService.currentTimeOverride += TimeValue.timeValueSeconds(1).millis(),
                new ClusterApplyListener() {
                    @Override
                    public void onSuccess(String source) { }

                    @Override
                    public void onFailure(String source, Exception e) {
                        fail();
                    }
            });
            clusterApplierService.runOnApplierThread("test2",
                currentState -> {
                    clusterApplierService.currentTimeOverride += TimeValue.timeValueSeconds(2).millis();
                    throw new IllegalArgumentException("Testing handling of exceptions in the cluster state task");
                },
                new ClusterApplyListener() {
                    @Override
                    public void onSuccess(String source) {
                        fail();
                    }

                    @Override
                    public void onFailure(String source, Exception e) { }
                });
            // Additional update task to make sure all previous logging made it to the loggerName
            clusterApplierService.runOnApplierThread("test3",
                currentState -> {},
                new ClusterApplyListener() {
                    @Override
                    public void onSuccess(String source) { }

                    @Override
                    public void onFailure(String source, Exception e) {
                        fail();
                    }
                });
            assertBusy(mockAppender::assertAllExpectationsMatched);
        } finally {
            Loggers.removeAppender(clusterLogger, mockAppender);
            mockAppender.stop();
        }
    }

    @TestLogging(value = "org.elasticsearch.cluster.service:WARN", reason = "to ensure that we log cluster state events on WARN level")
    public void testLongClusterStateUpdateLogging() throws Exception {
        MockLogAppender mockAppender = new MockLogAppender();
        mockAppender.start();
        mockAppender.addExpectation(
                new MockLogAppender.UnseenEventExpectation(
                        "test1 shouldn't see because setting is too low",
                        ClusterApplierService.class.getCanonicalName(),
                        Level.WARN,
                        "*cluster state applier task [test1] took [*] which is above the warn threshold of *"));
        mockAppender.addExpectation(
                new MockLogAppender.SeenEventExpectation(
                        "test2",
                        ClusterApplierService.class.getCanonicalName(),
                        Level.WARN,
                        "*cluster state applier task [test2] took [32s] which is above the warn threshold of [*]: " +
                            "[running task [test2]] took [*"));
        mockAppender.addExpectation(
                new MockLogAppender.SeenEventExpectation(
                        "test4",
                        ClusterApplierService.class.getCanonicalName(),
                        Level.WARN,
                        "*cluster state applier task [test3] took [34s] which is above the warn threshold of [*]: " +
                            "[running task [test3]] took [*"));

        Logger clusterLogger = LogManager.getLogger(ClusterApplierService.class);
        Loggers.addAppender(clusterLogger, mockAppender);
        try {
            final CountDownLatch latch = new CountDownLatch(4);
            final CountDownLatch processedFirstTask = new CountDownLatch(1);
            clusterApplierService.currentTimeOverride = threadPool.relativeTimeInMillis();
            clusterApplierService.runOnApplierThread("test1",
                currentState -> clusterApplierService.currentTimeOverride += TimeValue.timeValueSeconds(1).millis(),
                new ClusterApplyListener() {
                    @Override
                    public void onSuccess(String source) {
                        latch.countDown();
                        processedFirstTask.countDown();
                    }

                    @Override
                    public void onFailure(String source, Exception e) {
                        fail();
                    }
                });
            processedFirstTask.await();
            clusterApplierService.runOnApplierThread("test2",
                currentState -> {
                    clusterApplierService.currentTimeOverride += TimeValue.timeValueSeconds(32).millis();
                    throw new IllegalArgumentException("Testing handling of exceptions in the cluster state task");
                },
                new ClusterApplyListener() {
                    @Override
                    public void onSuccess(String source) {
                        fail();
                    }

                    @Override
                    public void onFailure(String source, Exception e) {
                        latch.countDown();
                    }
                });
            clusterApplierService.runOnApplierThread("test3",
                currentState -> clusterApplierService.currentTimeOverride += TimeValue.timeValueSeconds(34).millis(),
                new ClusterApplyListener() {
                    @Override
                    public void onSuccess(String source) {
                        latch.countDown();
                    }

                    @Override
                    public void onFailure(String source, Exception e) {
                        fail();
                    }
                });
            // Additional update task to make sure all previous logging made it to the loggerName
            // We don't check logging for this on since there is no guarantee that it will occur before our check
            clusterApplierService.runOnApplierThread("test4",
                currentState -> {},
                new ClusterApplyListener() {
                    @Override
                    public void onSuccess(String source) {
                        latch.countDown();
                    }

                    @Override
                    public void onFailure(String source, Exception e) {
                        fail();
                    }
                });
            latch.await();
        } finally {
            Loggers.removeAppender(clusterLogger, mockAppender);
            mockAppender.stop();
        }
        mockAppender.assertAllExpectationsMatched();
    }

    public void testLocalNodeMasterListenerCallbacks() {
        TimedClusterApplierService timedClusterApplierService = createTimedClusterService(false);

        AtomicBoolean isMaster = new AtomicBoolean();
        timedClusterApplierService.addLocalNodeMasterListener(new LocalNodeMasterListener() {
            @Override
            public void onMaster() {
                isMaster.set(true);
            }

            @Override
            public void offMaster() {
                isMaster.set(false);
            }

            @Override
            public String executorName() {
                return ThreadPool.Names.SAME;
            }
        });

        ClusterState state = timedClusterApplierService.state();
        DiscoveryNodes nodes = state.nodes();
        DiscoveryNodes.Builder nodesBuilder = DiscoveryNodes.builder(nodes).masterNodeId(nodes.getLocalNodeId());
        state = ClusterState.builder(state).blocks(ClusterBlocks.EMPTY_CLUSTER_BLOCK).nodes(nodesBuilder).build();
        setState(timedClusterApplierService, state);
        assertThat(isMaster.get(), is(true));

        nodes = state.nodes();
        nodesBuilder = DiscoveryNodes.builder(nodes).masterNodeId(null);
        state = ClusterState.builder(state).blocks(ClusterBlocks.builder().addGlobalBlock(NoMasterBlockService.NO_MASTER_BLOCK_WRITES))
            .nodes(nodesBuilder).build();
        setState(timedClusterApplierService, state);
        assertThat(isMaster.get(), is(false));
        nodesBuilder = DiscoveryNodes.builder(nodes).masterNodeId(nodes.getLocalNodeId());
        state = ClusterState.builder(state).blocks(ClusterBlocks.EMPTY_CLUSTER_BLOCK).nodes(nodesBuilder).build();
        setState(timedClusterApplierService, state);
        assertThat(isMaster.get(), is(true));

        timedClusterApplierService.close();
    }

    public void testClusterStateApplierCantSampleClusterState() throws InterruptedException {
        AtomicReference<Throwable> error = new AtomicReference<>();
        AtomicBoolean applierCalled = new AtomicBoolean();
        clusterApplierService.addStateApplier(event -> {
            try {
                applierCalled.set(true);
                clusterApplierService.state();
                error.set(new AssertionError("successfully sampled state"));
            } catch (AssertionError e) {
                if (e.getMessage().contains("should not be called by a cluster state applier") == false) {
                    error.set(e);
                }
            }
        });

        CountDownLatch latch = new CountDownLatch(1);
        clusterApplierService.onNewClusterState("test", () -> ClusterState.builder(clusterApplierService.state()).build(),
            new ClusterApplyListener() {

                @Override
                public void onSuccess(String source) {
                    latch.countDown();
                }

                @Override
                public void onFailure(String source, Exception e) {
                    error.compareAndSet(null, e);
                }
            }
        );

        latch.await();
        assertNull(error.get());
        assertTrue(applierCalled.get());
    }

    public void testClusterStateApplierBubblesUpExceptionsInApplier() throws InterruptedException {
        AtomicReference<Throwable> error = new AtomicReference<>();
        clusterApplierService.addStateApplier(event -> {
            throw new RuntimeException("dummy exception");
        });
        clusterApplierService.allowClusterStateApplicationFailure();

        CountDownLatch latch = new CountDownLatch(1);
        clusterApplierService.onNewClusterState("test", () -> ClusterState.builder(clusterApplierService.state()).build(),
            new ClusterApplyListener() {

                @Override
                public void onSuccess(String source) {
                    latch.countDown();
                    fail("should not be called");
                }

                @Override
                public void onFailure(String source, Exception e) {
                    assertTrue(error.compareAndSet(null, e));
                    latch.countDown();
                }
            }
        );

        latch.await();
        assertNotNull(error.get());
        assertThat(error.get().getMessage(), containsString("dummy exception"));
    }

    public void testClusterStateApplierBubblesUpExceptionsInSettingsApplier() throws InterruptedException {
        AtomicReference<Throwable> error = new AtomicReference<>();
        clusterApplierService.clusterSettings.addSettingsUpdateConsumer(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING,
            v -> {});
        clusterApplierService.allowClusterStateApplicationFailure();

        CountDownLatch latch = new CountDownLatch(1);
        clusterApplierService.onNewClusterState("test", () -> ClusterState.builder(clusterApplierService.state())
                .metadata(Metadata.builder(clusterApplierService.state().metadata())
                    .persistentSettings(
                        Settings.builder().put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), false).build())
                    .build())
                .build(),
            new ClusterApplyListener() {

                @Override
                public void onSuccess(String source) {
                    latch.countDown();
                    fail("should not be called");
                }

                @Override
                public void onFailure(String source, Exception e) {
                    assertTrue(error.compareAndSet(null, e));
                    latch.countDown();
                }
            }
        );

        latch.await();
        assertNotNull(error.get());
        assertThat(error.get().getMessage(), containsString("illegal value can't update"));
    }

    public void testClusterStateApplierSwallowsExceptionInListener() throws InterruptedException {
        AtomicReference<Throwable> error = new AtomicReference<>();
        AtomicBoolean applierCalled = new AtomicBoolean();
        clusterApplierService.addListener(event -> {
            assertTrue(applierCalled.compareAndSet(false, true));
            throw new RuntimeException("dummy exception");
        });

        CountDownLatch latch = new CountDownLatch(1);
        clusterApplierService.onNewClusterState("test", () -> ClusterState.builder(clusterApplierService.state()).build(),
            new ClusterApplyListener() {

                @Override
                public void onSuccess(String source) {
                    latch.countDown();
                }

                @Override
                public void onFailure(String source, Exception e) {
                    error.compareAndSet(null, e);
                }
            }
        );

        latch.await();
        assertNull(error.get());
        assertTrue(applierCalled.get());
    }

    public void testClusterStateApplierCanCreateAnObserver() throws InterruptedException {
        AtomicReference<Throwable> error = new AtomicReference<>();
        AtomicBoolean applierCalled = new AtomicBoolean();
        clusterApplierService.addStateApplier(event -> {
            try {
                applierCalled.set(true);
                ClusterStateObserver observer = new ClusterStateObserver(event.state(),
                    clusterApplierService, null, logger, threadPool.getThreadContext());
                observer.waitForNextChange(new ClusterStateObserver.Listener() {
                    @Override
                    public void onNewClusterState(ClusterState state) {

                    }

                    @Override
                    public void onClusterServiceClose() {

                    }

                    @Override
                    public void onTimeout(TimeValue timeout) {

                    }
                });
            } catch (AssertionError e) {
                error.set(e);
            }
        });

        CountDownLatch latch = new CountDownLatch(1);
        clusterApplierService.onNewClusterState("test", () -> ClusterState.builder(clusterApplierService.state()).build(),
            new ClusterApplyListener() {
                @Override
                public void onSuccess(String source) {
                    latch.countDown();
                }

                @Override
                public void onFailure(String source, Exception e) {
                    error.compareAndSet(null, e);
                }
        });

        latch.await();
        assertNull(error.get());
        assertTrue(applierCalled.get());
    }

    static class TimedClusterApplierService extends ClusterApplierService {

        final ClusterSettings clusterSettings;
        volatile Long currentTimeOverride = null;
        boolean applicationMayFail;

        TimedClusterApplierService(Settings settings, ClusterSettings clusterSettings, ThreadPool threadPool) {
            super("test_node", settings, clusterSettings, threadPool);
            this.clusterSettings = clusterSettings;
        }

        @Override
        protected long currentTimeInMillis() {
            return Objects.requireNonNullElseGet(currentTimeOverride, super::currentTimeInMillis);
        }

        @Override
        protected boolean applicationMayFail() {
            return this.applicationMayFail;
        }

        void allowClusterStateApplicationFailure() {
            this.applicationMayFail = true;
        }
    }

}


text:
using System;
using System.Linq;
using System.Numerics;
using System.Text;

namespace Convert_from_base_10_to_base_N
{
    public class Program
    {
        public static void Main()
        {
            var numbers = Console.ReadLine().Split(' ').Select(BigInteger.Parse).ToArray();

            Console.WriteLine(ConvertToBaseN(numbers[1], (int)numbers[0]));
        }

        public static BigInteger ConvertToBaseN(BigInteger baseTen, int divisor)
        {
            var sb = new StringBuilder();

            var rest = 0;
            var num = baseTen;

            while (num > 0)
            {
                rest = (int)(num % divisor);
                num = num / divisor;

                sb.Append(rest.ToString());
            }

            return BigInteger.Parse(ReverseString(sb.ToString()));
        }

        public static string ReverseString(string str)
        {
            var sb = new StringBuilder(str.Length);

            for (int i = str.Length - 1; i >= 0; i--)
            {
                sb.Append(str[i]);
            }

            return sb.ToString();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
function addClearOnClick(tag, target) {
  tag.onclick = function() {
    target.value = '';
  }
}
function addViewOnClick(tag, target) {
  var href;
  tag.onclick = function() {
    href = target.value;
    if(href)
      window.open(href, 'sympal_assetsViewFile', '');
  }
}

HTMLElement.prototype.getElementByTagName = function(tag_name, index) {
  index = index ? index : 0;
  var tags = this.getElementsByTagName(tag_name);
  return tags[index];
}

HTMLElement.prototype.getElementsByClassName = function(class_name) {
  var tags = this.getElementsByTagName('*');
  var matches = [], i=0; tag;
  for(i; i<tags.length;++i) {
    tag = tags[i];
    if(tag.hasAttribute('class') && tag.getAttribute('class') == class_name)
      matches.push(tag);
  }
  return matches;
}

HTMLElement.prototype.getElementByClassName = function(class_name, index) {
  index = index ? index : 0;
  var tags = this.getElementsByClassName(class_name);
  return tags[index];
}

window.onload = function() {
  var wrappers = document.getElementsByClassName('sympal_assets_input_file');

  var wrapper, i=0, delete_link, view_lin, input;
  for(i; i<wrappers.length;++i) {
    wrapper = wrappers[i];
    input = wrapper.getElementByTagName('input');
    delete_link = wrapper.getElementByClassName('delete');
    view_link = wrapper.getElementByClassName('view');
    addClearOnClick(delete_link, input);
    addViewOnClick(view_link, input);
  }

}


text:
/*
* <auto-generated>
*     This code was generated by a tool.
*
*     Changes to this file may cause incorrect behavior and will be lost if
*     the code is regenerated.
* </auto-generated>
*/

#import "MOZUWishlistItemClient.h"
#import "MOZUWishlistItemResource.h"

@interface MOZUWishlistItemResource()
@property(readwrite, nonatomic) MOZUAPIContext * apiContext;
@end

@implementation MOZUWishlistItemResource

-(id)initWithAPIContext:(MOZUAPIContext *)apiContext {
	if (self = [super init]) {
		self.apiContext = apiContext;
		return self;
	}
	else {
		return nil;
	}
}

-(id)cloneWithAPIContextModification:(MOZUAPIContextModificationBlock)apiContextModification {
	MOZUAPIContext* cloned = [self.apiContext cloneWith:apiContextModification];
	return [self initWithAPIContext:cloned];
}

//
#pragma mark -
#pragma mark Get Operations
#pragma mark -
//

/**
Retrieves the details of an item in a shopper wish list.
@param responseFields Use this field to include those fields which are not included by default.
@param wishlistId Unique identifier of the wish list.
@param wishlistItemId Unique identifier of the item to remove from the shopper wish list.
*/

- (void)wishlistItemWithWishlistId:(NSString *)wishlistId wishlistItemId:(NSString *)wishlistItemId responseFields:(NSString *)responseFields completionHandler:(void(^)(MOZUWishlistItem *result, MOZUAPIError *error, NSHTTPURLResponse *response))handler
 {
	MOZUClient *client = [MOZUWishlistItemClient clientForGetWishlistItemOperationWithWishlistId:wishlistId wishlistItemId:wishlistItemId responseFields:responseFields];
	client.context = self.apiContext;
	[client executeWithCompletionHandler:^(id result, NSHTTPURLResponse *response, MOZUAPIError *error) {
		if (handler != nil) {
			handler(result, error, response);
		}
	}];
}

/**
Retrieves a list of items in a shopper wish list according to any specified filter and sort criteria.
@param filter A set of expressions that consist of a field, operator, and value and represent search parameter syntax when filtering results of a query. Valid operators include equals (eq), does not equal (ne), greater than (gt), less than (lt), greater than or equal to (ge), less than or equal to (le), starts with (sw), or contains (cont). For example - "filter=IsDisplayed+eq+true"
@param pageSize The number of results to display on each page when creating paged results from a query. The maximum value is 200.
@param responseFields Use this field to include those fields which are not included by default.
@param sortBy The property by which to sort results and whether the results appear in ascending (a-z) order, represented by ASC or in descending (z-a) order, represented by DESC. The sortBy parameter follows an available property. For example: "sortBy=productCode+asc"
@param startIndex When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with a PageSize of 25, to get the 51st through the 75th items, use startIndex=3.
@param wishlistId Unique identifier of the wish list.
*/

- (void)wishlistItemsWithWishlistId:(NSString *)wishlistId startIndex:(NSNumber *)startIndex pageSize:(NSNumber *)pageSize sortBy:(NSString *)sortBy filter:(NSString *)filter responseFields:(NSString *)responseFields completionHandler:(void(^)(MOZUWishlistItemCollection *result, MOZUAPIError *error, NSHTTPURLResponse *response))handler
 {
	MOZUClient *client = [MOZUWishlistItemClient clientForGetWishlistItemsOperationWithWishlistId:wishlistId startIndex:startIndex pageSize:pageSize sortBy:sortBy filter:filter responseFields:responseFields];
	client.context = self.apiContext;
	[client executeWithCompletionHandler:^(id result, NSHTTPURLResponse *response, MOZUAPIError *error) {
		if (handler != nil) {
			handler(result, error, response);
		}
	}];
}

/**
Retrieve a list of items in a customer wish list by supplying the wish list name.
@param customerAccountId The unique identifier of the customer account for which to retrieve wish lists.
@param filter A set of expressions that consist of a field, operator, and value and represent search parameter syntax when filtering results of a query. Valid operators include equals (eq), does not equal (ne), greater than (gt), less than (lt), greater than or equal to (ge), less than or equal to (le), starts with (sw), or contains (cont). For example - "filter=IsDisplayed+eq+true"
@param pageSize The number of results to display on each page when creating paged results from a query. The maximum value is 200.
@param responseFields Use this field to include those fields which are not included by default.
@param sortBy The property by which to sort results and whether the results appear in ascending (a-z) order, represented by ASC or in descending (z-a) order, represented by DESC. The sortBy parameter follows an available property. For example: "sortBy=productCode+asc"
@param startIndex When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with a PageSize of 25, to get the 51st through the 75th items, use startIndex=3.
@param wishlistName The name of the wish list to retrieve.
*/

- (void)wishlistItemsByWishlistNameWithCustomerAccountId:(NSInteger)customerAccountId wishlistName:(NSString *)wishlistName startIndex:(NSNumber *)startIndex pageSize:(NSNumber *)pageSize sortBy:(NSString *)sortBy filter:(NSString *)filter responseFields:(NSString *)responseFields completionHandler:(void(^)(MOZUWishlistItemCollection *result, MOZUAPIError *error, NSHTTPURLResponse *response))handler
 {
	MOZUClient *client = [MOZUWishlistItemClient clientForGetWishlistItemsByWishlistNameOperationWithCustomerAccountId:customerAccountId wishlistName:wishlistName startIndex:startIndex pageSize:pageSize sortBy:sortBy filter:filter responseFields:responseFields];
	client.context = self.apiContext;
	[client executeWithCompletionHandler:^(id result, NSHTTPURLResponse *response, MOZUAPIError *error) {
		if (handler != nil) {
			handler(result, error, response);
		}
	}];
}

//
#pragma mark -
#pragma mark Post Operations
#pragma mark -
//

/**
Adds a product in a site's catalog as an item in a shopper wish list.
@param body Properties of an item in a shopper wish list.
@param responseFields Use this field to include those fields which are not included by default.
@param wishlistId Unique identifier of the wish list.
*/

- (void)addItemToWishlistWithBody:(MOZUWishlistItem *)body wishlistId:(NSString *)wishlistId responseFields:(NSString *)responseFields completionHandler:(void(^)(MOZUWishlistItem *result, MOZUAPIError *error, NSHTTPURLResponse *response))handler
 {
	MOZUClient *client = [MOZUWishlistItemClient clientForAddItemToWishlistOperationWithBody:body wishlistId:wishlistId responseFields:responseFields];
	client.context = self.apiContext;
	[client executeWithCompletionHandler:^(id result, NSHTTPURLResponse *response, MOZUAPIError *error) {
		if (handler != nil) {
			handler(result, error, response);
		}
	}];
}

//
#pragma mark -
#pragma mark Put Operations
#pragma mark -
//

/**
Updates the quantity of an item in a shopper wish list.
@param quantity The number of cart items in the shopper's active cart.
@param responseFields Use this field to include those fields which are not included by default.
@param wishlistId Unique identifier of the wish list.
@param wishlistItemId Unique identifier of the item to remove from the shopper wish list.
*/

- (void)updateWishlistItemQuantityWithWishlistId:(NSString *)wishlistId wishlistItemId:(NSString *)wishlistItemId quantity:(NSInteger)quantity responseFields:(NSString *)responseFields completionHandler:(void(^)(MOZUWishlistItem *result, MOZUAPIError *error, NSHTTPURLResponse *response))handler
 {
	MOZUClient *client = [MOZUWishlistItemClient clientForUpdateWishlistItemQuantityOperationWithWishlistId:wishlistId wishlistItemId:wishlistItemId quantity:quantity responseFields:responseFields];
	client.context = self.apiContext;
	[client executeWithCompletionHandler:^(id result, NSHTTPURLResponse *response, MOZUAPIError *error) {
		if (handler != nil) {
			handler(result, error, response);
		}
	}];
}

/**
Updates the details of an item in a shopper wish list.
@param body Properties of an item in a shopper wish list.
@param responseFields Use this field to include those fields which are not included by default.
@param wishlistId Unique identifier of the wish list.
@param wishlistItemId Unique identifier of the item to remove from the shopper wish list.
*/

- (void)updateWishlistItemWithBody:(MOZUWishlistItem *)body wishlistId:(NSString *)wishlistId wishlistItemId:(NSString *)wishlistItemId responseFields:(NSString *)responseFields completionHandler:(void(^)(MOZUWishlistItem *result, MOZUAPIError *error, NSHTTPURLResponse *response))handler
 {
	MOZUClient *client = [MOZUWishlistItemClient clientForUpdateWishlistItemOperationWithBody:body wishlistId:wishlistId wishlistItemId:wishlistItemId responseFields:responseFields];
	client.context = self.apiContext;
	[client executeWithCompletionHandler:^(id result, NSHTTPURLResponse *response, MOZUAPIError *error) {
		if (handler != nil) {
			handler(result, error, response);
		}
	}];
}

//
#pragma mark -
#pragma mark Delete Operations
#pragma mark -
//

/**
Removes all items associated with a shopper wish list.
@param wishlistId Unique identifier of the wish list.
*/

- (void)removeAllWishlistItemsWithWishlistId:(NSString *)wishlistId completionHandler:(void(^)(MOZUWishlist *result, MOZUAPIError *error, NSHTTPURLResponse *response))handler
 {
	MOZUClient *client = [MOZUWishlistItemClient clientForRemoveAllWishlistItemsOperationWithWishlistId:wishlistId];
	client.context = self.apiContext;
	[client executeWithCompletionHandler:^(id result, NSHTTPURLResponse *response, MOZUAPIError *error) {
		if (handler != nil) {
			handler(result, error, response);
		}
	}];
}

/**
Removes an item from the wish list specified in the request.
@param wishlistId Unique identifier of the wish list.
@param wishlistItemId Unique identifier of the item to remove from the shopper wish list.
*/

- (void)deleteWishlistItemWithWishlistId:(NSString *)wishlistId wishlistItemId:(NSString *)wishlistItemId completionHandler:(void(^)(MOZUAPIError *error, NSHTTPURLResponse *response))handler
 {
	MOZUClient *client = [MOZUWishlistItemClient clientForDeleteWishlistItemOperationWithWishlistId:wishlistId wishlistItemId:wishlistItemId];
	client.context = self.apiContext;
	[client executeWithCompletionHandler:^(id result, NSHTTPURLResponse *response, MOZUAPIError *error) {
		if (handler != nil) {
			handler(error, response);
		}
	}];
}

@end


text:
local modpath, prettypath, fullpath, configdir, docstringspath, hasinitfile, autoload_extensions = ...

os.exit = hs._exit

local function runstring(s)
  local fn, err = load("return " .. s)
  if not fn then fn, err = load(s) end
  if not fn then return tostring(err) end

  local str = ""
  local results = table.pack(pcall(fn))
  for i = 2,results.n do
    if i > 2 then str = str .. "\t" end
    str = str .. tostring(results[i])
  end
  return str
end

--- hs.configdir
--- Constant
--- A string containing Hammerspoon's configuration directory. Typically `~/.hammerspoon/`
hs.configdir = configdir

--- hs.docstrings_json_file
--- Constant
--- A string containing the full path to the `docs.json` file inside Hammerspoon's app bundle. This contains the full Hammerspoon API documentation and can be accessed in the Console using `help("someAPI")`. It can also be loaded and processed by the `hs.doc` extension
hs.docstrings_json_file = docstringspath

--- hs.showError(err)
--- Function
--- Shows an error to the user, using Hammerspoon's Console
---
--- Parameters:
---  * err - A string containing an error message
---
--- Returns:
---  * None
---
--- Notes:
---  * You can override this function if you wish to route errors differently
---  * Modules can call this in the event of an error, e.g. in callbacks from the user:
---
---     ```local ok, err = xpcall(callbackfn, debug.traceback)
---     if not ok then hs.showError(err) end```
function hs.showError(err)
  hs._notify("Hammerspoon config error") -- undecided on this line
  print(err)
  hs.focus()
  hs.openConsole()
end

--- hs.toggleConsole()
--- Function
--- Toggles the visibility of the console
---
--- Parameters:
---  * None
---
--- Returns:
---  * None
---
--- Notes:
---  * If the console is not currently open, it will be opened. If it is open and not the focused window, it will be brought forward and focused.
---  * If the console is focused, it will be closed.
function hs.toggleConsole()
    local console = hs.appfinder.windowFromWindowTitle("Hammerspoon Console")
    if console and (console ~= hs.window.focusedWindow()) then
        console:focus()
    elseif console then
        console:close()
    else
        hs.openConsole()
    end
end

--- hs.rawprint(aString)
--- Function
--- The original Lua print() function
---
--- Parameters:
---  * aString - A string to be printed
---
--- Returns:
---  * None
---
--- Notes:
---  * Hammerspoon overrides Lua's print() function, but this is a reference we retain to is, should you need it for any reason
local rawprint = print
hs.rawprint = rawprint
function print(...)
  rawprint(...)
  local vals = table.pack(...)

  for k = 1, vals.n do
    vals[k] = tostring(vals[k])
  end

  local str = table.concat(vals, "\t") .. "\n"
  hs._logmessage(str)
end

print("-- Augmenting require paths")
package.path=configdir.."/?.lua"..";"..configdir.."/?/init.lua"..";"..package.path..";"..modpath.."/?.lua"..";"..modpath.."/?/init.lua"
package.cpath=configdir.."/?.so"..";"..package.cpath..";"..modpath.."/?.so"

print("-- package.path:")
for part in string.gmatch(package.path, "([^;]+)") do
    print("      "..part)
end

print("-- package.cpath:")
for part in string.gmatch(package.cpath, "([^;]+)") do
    print("      "..part)
end

if autoload_extensions then
  print("-- Lazy extension loading enabled")
  hs._extensions = {}

  -- Discover extensions in our .app bundle
  local iter, dir_obj = require("hs.fs").dir(modpath.."/hs")
  local extension = iter(dir_obj)
  while extension do
      if (extension ~= ".") and (extension ~= "..") then
          hs._extensions[extension] = true
      end
      extension = iter(dir_obj)
  end

  -- Inject a lazy extension loader into the main HS table
  setmetatable(hs, {
      __index = function(t, key)
          if hs._extensions[key] ~= nil then
              print("-- Loading extension: "..key)
              hs[key] = require("hs."..key)
              return hs[key]
          else
              return nil
          end
      end
  })
end

local hscrash = require("hs.crash")
rawrequire = require
require = function(modulename)
    local result = rawrequire(modulename)
    pcall(function()
            hscrash.crashLog("require('"..modulename.."')")
            if string.sub(modulename, 1, 3) == "hs." then
                -- Reasonably certain that we're dealing with a Hammerspoon extension
                local extname = string.sub(modulename, 4, -1)
                for k,v in ipairs(hscrash.dumpCLIBS()) do
                    if string.find(v, extname) then
                        hscrash.crashLog("  Candidate CLIBS match: "..v)
                    end
                end
            end
          end)
    return result
end
hscrash.crashLog("Loaded from: "..modpath)

--- hs.help(identifier)
--- Function
--- Prints the documentation for some part of Hammerspoon's API
---
--- Parameters:
---  * identifier - A string containing the signature of some part of Hammerspoon's API (e.g. `"hs.reload"`)
---
--- Returns:
---  * None
---
--- Notes:
---  * This function is mainly for runtime API help while using Hammerspoon's Console
---  * You can also just use `help()` directly
function hs.help(identifier)
  local doc = require "hs.doc"
  local tree = doc.fromJSONFile(hs.docstrings_json_file)
  local result = tree

  for word in string.gmatch(identifier, '([^.]+)') do
    result = result[word]
  end

  print(result)
end
help = hs.help

if not hasinitfile then
  hs.notify.register("__noinitfile", function() os.execute("open http://www.hammerspoon.org/go/") end)
  hs.notify.show("Hammerspoon", "No config file found", "Click here for the Getting Started Guide", "__noinitfile")
  print(string.format("-- Can't find %s; create it and reload your config.", prettypath))
  return runstring
end

print("-- Loading " .. prettypath)
local fn, err = loadfile(fullpath)
if not fn then hs.showError(err) return runstring end

local ok, err = xpcall(fn, debug.traceback)
if not ok then hs.showError(err) return runstring end

print "-- Done."

return runstring


text:
require 'test_helper'

class PhotoTest < ActiveSupport::TestCase
  test "get photos by post" do
    post = Post.find(1)

    assert post.galleries.size == 1

    gallery = post.galleries[0]

    assert gallery.photos.size == 2
  end
end


text:
extern crate empty_struct;

fn main() {
    let empty_struct::XEmpty2 = (); //~ ERROR mismatched types
    let empty_struct::XEmpty6(..) = (); //~ ERROR mismatched types
}


text:
module Rack
  class ReverseProxyRule

    def initialize rule
      if rule.kind_of?(Proc) || rule.respond_to?(:call)
        @rule = rule
      else
        raise "Invalid Rule for reverse_proxy"
      end
    end

    attr_reader :rule, :url

    def match? env
      @url = @rule.call env
    end

    def get_uri
      return nil if @url.nil?
      URI.parse(@url)
    end

  end
end


text:
define(function() {

var SwitchHelper = function() {};
SwitchHelper.prototype = {

	create: function(widget, srcElement) {
		var parent = widget.dijitWidget.getParent();
		if (parent && parent.declaredClass === 'dojox.mobile.ListItem') {
			widget.addClass('mblItemSwitch');
//			dojo.addClass(widget.domNode, 'mblItemSwitch');
			// XXX need to add style to Model as well
		}
	}

};

return SwitchHelper;

});


text:
import os
from collections import Counter

from .progress import get_label_progress

def sibling_file(path, filename):
    return os.path.join(os.path.dirname(path), filename)

def get_extensions(srcdir):
    exts = set()
    for root, dirs, files in os.walk(srcdir):
        files = (f.rsplit('.') for f in files)
        files = (f[1] for f in files if len(f) == 2)
        exts.update(files)

    return exts

def iter_files(srcdir, exts):
    for root, dirs, files in os.walk(srcdir):
        for f in files:
            split = f.rsplit('.')

            if len(split) != 2:
                continue

            if split[1] not in exts:
                continue

            yield os.path.join(root, f)[len(srcdir) + 1:]

def grep_files(srcdir, files, func_pattern):
    func_occurrences = {}
    file_occurrences = {}

    search_progress = get_label_progress('Cross referencing functions:')

    for func in func_pattern:
        func_occurrences[func] = {}

    for path in search_progress(files):
        abspath = os.path.join(srcdir, path)
        with open(abspath) as fh:
            content = fh.read()

        file_occurrences[path] = []

        func_lines = {}

        for func, regex in func_pattern.iteritems():
            for match in regex.finditer(content):
                line = content.count('\n', 0, match.start()) + 1
                func_lines.setdefault(func, []).append(line)

        for func, lines in func_lines.iteritems():
            func_occurrences[func][path] = lines

        file_occurrences[path] = func_lines

    return func_occurrences, file_occurrences


text:
<?php

namespace crisal\EspecialidadBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 *@ORM\Entity(repositoryClass="crisal\EspecialidadBundle\Entity\ServiciosOfrecidosRepository")
 */

class ServiciosOfrecidos
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue
     */
    protected $id;

    /** @ORM\ManyToOne(targetEntity="crisal\EspecialidadBundle\Entity\Especialidades") */
    protected $especialidad;

    /** @ORM\Column(type="string", length=200) */
    protected $nombreServicio;

    public function getId()
    {
        return $this->id;
    }

    public function setEspecialidad(\crisal\EspecialidadBundle\Entity\Especialidades $especialidad)
    {
        $this->especialidad = $especialidad;
    }

    public function getEspecialidad()
    {
        return $this->especialidad;
    }

    public function setNombreServicio($nombreServicio)
    {
        $this->nombreServicio = $nombreServicio;
    }

    public function getNombreServicio()
    {
        return $this->nombreServicio;
    }

    public function __toString()
    {
        return $this->getNombreServicio();
    }

}

?>


text:
package fairies.client.render;

import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;

public class ModelFairyProps2 extends ModelBiped
{
    public ModelFairyProps2()
    {
        this(0.0F);
    }

    public ModelFairyProps2(final float f)
    {
        this(f, 0.0F);
    }

    public ModelFairyProps2(final float f, final float f1)
    {
        heldItemLeft = 0;
        heldItemRight = 0;
        isSneak = false;
        flymode = false;
        retract = 0F;
        //Rogue Type
        rogueHead = new ModelRenderer(this);
        rogueHead.setTextureOffset(0, 0).addBox(-3F, -5.7F, -3F, 6, 6, 6, f + 0.4F);
        rogueHead.mirror = true;
        rogueHead.setTextureOffset(0, 0).addBox(-3F, -6.0F, -3F, 6, 6, 6, f + 0.125F);
        rogueHead.setRotationPoint(0.0F, 0.0F + f1, 0.0F);
        rogueBody = new ModelRenderer(this);
        rogueBody.setTextureOffset(0, 19).addBox(-2F, 0.0F, -1F, 4, 6, 2, f + 0.375F);
        rogueBody.setTextureOffset(12, 19).addBox(-2F, 1.0F, -2F, 4, 2, 1, f + 0.375F);
        rogueBody.setRotationPoint(0.0F, 0.0F + f1, 0.0F);
        rogueRightArm = new ModelRenderer(this, 0, 12);
        rogueRightArm.addBox(-1F, -1F, -1F, 2, 5, 2, f + 0.375F);
        rogueRightArm.setRotationPoint(-5F, 1.0F + f1, 0.0F);
        rogueLeftArm = new ModelRenderer(this, 0, 12);
        rogueLeftArm.mirror = true;
        rogueLeftArm.addBox(-1F, -1F, -1F, 2, 5, 2, f + 0.375F);
        rogueLeftArm.setRotationPoint(5F, 1.0F + f1, 0.0F);
        rogueRightLeg = new ModelRenderer(this, 12, 12);
        rogueRightLeg.addBox(-1F, 0.0F, -1F, 2, 5, 2, f + 0.375F);
        rogueRightLeg.setRotationPoint(-1F, 18F + f1, 0.0F);
        rogueLeftLeg = new ModelRenderer(this, 12, 12);
        rogueLeftLeg.mirror = true;
        rogueLeftLeg.addBox(-1F, 0.0F, -1F, 2, 5, 2, f + 0.375F);
        rogueLeftLeg.setRotationPoint(1.0F, 18F + f1, 0.0F);
        wingRight = new ModelRenderer(this, 12, 25);
        wingRight.addBox(0F, -1.75F, -1.0F, 6, 6, 1, f + 0.25F);
        wingRight.setRotationPoint(0.5F, 0.0F + f1, 1.0F);
        wingLeft = new ModelRenderer(this, 12, 25);
        wingLeft.mirror = true;
        wingLeft.addBox(-6F, -1.75F, -1.0F, 6, 6, 1, f + 0.25F);
        wingLeft.setRotationPoint(-0.5F, 0.0F + f1, 1.0F);
        //Blades, Yo.
        rogueBlade1 = new FairyModelRenderer(this, 24, 0);
        rogueBlade1.addBox(-1.5F, 4F, -1F, 1, 4, 2, f - 0.2F, 2, 0F);
        rogueBlade1.setRotationPoint(-5F, 1.0F + f1, 0.0F);
        rogueBlade2 = new FairyModelRenderer(this, 30, 0);
        rogueBlade2.addBox(-1.5F, 4F, -1F, 1, 4, 2, f - 0.2F, 2, 0F);
        rogueBlade2.setRotationPoint(-5F, 1.0F + f1, 0.0F);
    }

    @Override
	public void render(final Entity e, final float f, final float f1, final float f2, final float f3, final float f4, final float f5)
    {
        setRotationAngles(f, f1, f2, f3, f4, f5);
        rogueHead.render(f5);
        rogueBody.render(f5);
        rogueRightArm.render(f5);
        rogueLeftArm.render(f5);
        rogueRightLeg.render(f5);
        rogueLeftLeg.render(f5);
        wingLeft.render(f5);
        wingRight.render(f5);

        if (venom)
        {
            rogueBlade2.render(f5);
        }
        else
        {
            rogueBlade1.render(f5);
        }
    }

    public void setRotationAngles(final float f, final float f1, final float f2, final float f3, final float f4, final float f5)
    {
        rogueHead.rotateAngleY = f3 / (180F / (float)Math.PI);
        rogueHead.rotateAngleX = f4 / (180F / (float)Math.PI);

        if (!flymode)
        {
            rogueRightArm.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 2.0F * f1 * 0.5F;
            rogueLeftArm.rotateAngleX = MathHelper.cos(f * 0.6662F) * 2.0F * f1 * 0.5F;
            rogueRightLeg.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
            rogueLeftLeg.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 1.4F * f1;
        }
        else
        {
            rogueRightArm.rotateAngleX = 0.0F;
            rogueLeftArm.rotateAngleX = 0.0F;
            rogueRightLeg.rotateAngleX = 0.0F;
            rogueLeftLeg.rotateAngleX = 0.0F;
        }

        rogueRightArm.rotateAngleZ = 0.05F;
        rogueLeftArm.rotateAngleZ = -0.05F;
        rogueRightLeg.rotateAngleY = 0.0F;
        rogueLeftLeg.rotateAngleY = 0.0F;
        rogueRightLeg.rotateAngleZ = 0.0F;
        rogueLeftLeg.rotateAngleZ = 0.0F;

        if ((isRiding || isSneak) && !flymode)
        {
            rogueRightArm.rotateAngleX += -((float)Math.PI / 5F);
            rogueLeftArm.rotateAngleX += -((float)Math.PI / 5F);
            rogueRightLeg.rotateAngleX = -((float)Math.PI * 2F / 5F);
            rogueLeftLeg.rotateAngleX = -((float)Math.PI * 2F / 5F);
            rogueRightLeg.rotateAngleY = ((float)Math.PI / 10F);
            rogueLeftLeg.rotateAngleY = -((float)Math.PI / 10F);

            if (isSneak)
            {
                rogueRightLeg.rotateAngleX = -((float)Math.PI / 2F);
                rogueLeftLeg.rotateAngleX = -((float)Math.PI / 2F);
            }
        }

        if (heldItemLeft != 0)
        {
            rogueLeftArm.rotateAngleX = rogueLeftArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F);
        }

        if (heldItemRight != 0)
        {
            rogueRightArm.rotateAngleX = rogueRightArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F);
        }

        rogueRightArm.rotateAngleY = 0.0F;
        rogueLeftArm.rotateAngleY = 0.0F;

        if (onGround > -9990F)
        {
            float f6 = onGround;
            rogueBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f6) * (float)Math.PI * 2.0F) * 0.2F;
            wingLeft.rotateAngleY = wingRight.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f6) * (float)Math.PI * 2.0F) * 0.2F;
            rogueRightArm.rotationPointZ = MathHelper.sin(rogueBody.rotateAngleY) * 5F;
            rogueRightArm.rotationPointX = -MathHelper.cos(rogueBody.rotateAngleY) * 5F + 2.0F;
            rogueLeftArm.rotationPointZ = -MathHelper.sin(rogueBody.rotateAngleY) * 5F;
            rogueLeftArm.rotationPointX = MathHelper.cos(rogueBody.rotateAngleY) * 5F - 2.0F;
            rogueRightArm.rotateAngleY += rogueBody.rotateAngleY;
            rogueLeftArm.rotateAngleY += rogueBody.rotateAngleY;
            rogueLeftArm.rotateAngleX += rogueBody.rotateAngleY;
            f6 = 1.0F - onGround;
            f6 *= f6;
            f6 *= f6;
            f6 = 1.0F - f6;
            final float f8 = MathHelper.sin(f6 * (float)Math.PI);
            final float f9 = MathHelper.sin(onGround * (float)Math.PI) * -(rogueHead.rotateAngleX - 0.7F) * 0.75F;
            rogueRightArm.rotateAngleX -= f8 * 1.2D + f9;
            rogueRightArm.rotateAngleY += rogueBody.rotateAngleY * 2.0F;
            rogueRightArm.rotateAngleZ = MathHelper.sin(onGround * (float)Math.PI) * -0.4F;
        }

        if (flymode)
        {
            final float f7 = (float)Math.PI;
            rogueBody.rotateAngleX = f7 / 2.0F;
            rogueBody.rotationPointY = 19F;
            wingLeft.rotateAngleX = f7 / 2.0F;
            wingRight.rotateAngleX = f7 / 2.0F;
            wingLeft.rotationPointY = 17.5F;
            wingRight.rotationPointY = 17.5F;
            wingLeft.rotationPointZ = 1.0F;
            wingRight.rotationPointZ = 1.0F;
            rogueRightLeg.rotationPointZ = 0.0F;
            rogueLeftLeg.rotationPointZ = 0.0F;
            rogueRightArm.rotationPointY = 19F;
            rogueLeftArm.rotationPointY = 19F;
            rogueRightLeg.rotationPointY = 18F;
            rogueLeftLeg.rotationPointY = 18F;
            rogueRightLeg.rotationPointZ = 6F;
            rogueLeftLeg.rotationPointZ = 6F;
            rogueHead.rotationPointZ = -3F;
            rogueHead.rotationPointY = 19.75F;
        }
        else
        {
            rogueBody.rotateAngleX = 0.0F;
            rogueBody.rotationPointY = 12F;
            wingLeft.rotateAngleX = 0.0F;
            wingRight.rotateAngleX = 0.0F;
            wingLeft.rotationPointY = 12.5F;
            wingRight.rotationPointY = 12.5F;
            wingLeft.rotationPointZ = 1.0F;
            wingRight.rotationPointZ = 1.0F;
            rogueRightLeg.rotationPointZ = 0.0F;
            rogueLeftLeg.rotationPointZ = 0.0F;

            if (isRiding)
            {
                rogueRightArm.rotationPointY = 13F;
                rogueLeftArm.rotationPointY = 13F;
            }
            else
            {
                rogueRightArm.rotationPointY = 13F;
                rogueLeftArm.rotationPointY = 13F;
            }

            rogueRightLeg.rotationPointY = 18F;
            rogueLeftLeg.rotationPointY = 18F;
            rogueRightLeg.rotationPointZ = 0.0F;
            rogueLeftLeg.rotationPointZ = 0.0F;
            rogueHead.rotationPointZ = 0.0F;
            rogueHead.rotationPointY = 12F;
        }

        if (flymode)
        {
            rogueRightArm.rotateAngleZ += MathHelper.cos(f2 * 0.09F) * 0.1F + 0.05F;
            rogueLeftArm.rotateAngleZ -= MathHelper.cos(f2 * 0.09F) * 0.1F + 0.05F;
            rogueRightArm.rotateAngleX += MathHelper.sin(f2 * 0.067F) * 0.1F;
            rogueLeftArm.rotateAngleX -= MathHelper.sin(f2 * 0.067F) * 0.1F;
            rogueRightLeg.rotateAngleZ += MathHelper.cos(f2 * 0.09F) * 0.1F + 0.05F;
            rogueLeftLeg.rotateAngleZ -= MathHelper.cos(f2 * 0.09F) * 0.1F + 0.05F;
            rogueRightLeg.rotateAngleX = 0.1F;
            rogueLeftLeg.rotateAngleX = 0.1F;
        }
        else
        {
            rogueRightArm.rotateAngleZ += MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F;
            rogueLeftArm.rotateAngleZ -= MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F;
            rogueRightArm.rotateAngleX += MathHelper.sin(f2 * 0.067F) * 0.05F;
            rogueLeftArm.rotateAngleX -= MathHelper.sin(f2 * 0.067F) * 0.05F;
        }

        if (flymode)
        {
            wingLeft.rotateAngleY = 0.1F;
            wingRight.rotateAngleY = -0.1F;
            wingLeft.rotateAngleY += Math.sin(sinage) / 6F;
            wingRight.rotateAngleY -= Math.sin(sinage) / 6F;
            wingLeft.rotateAngleZ = 0.5F;
            wingRight.rotateAngleZ = -0.5F;
        }
        else
        {
            wingLeft.rotateAngleY = 0.6F;
            wingRight.rotateAngleY = -0.6F;
            wingLeft.rotateAngleY += Math.sin(sinage) / 3F;
            wingRight.rotateAngleY -= Math.sin(sinage) / 3F;
            wingLeft.rotateAngleZ = 0.125F;
            wingRight.rotateAngleZ = -0.125F;
        }

        wingLeft.rotateAngleZ += Math.cos(sinage) / (flymode ? 3F : 8F);
        wingRight.rotateAngleZ -= Math.cos(sinage) / (flymode ? 3F : 8F);
        rogueBlade1.rotateAngleX = rogueBlade2.rotateAngleX = rogueRightArm.rotateAngleX;
        rogueBlade1.rotateAngleY = rogueBlade2.rotateAngleY = rogueRightArm.rotateAngleY;
        rogueBlade1.rotateAngleZ = rogueBlade2.rotateAngleZ = rogueRightArm.rotateAngleZ;
        rogueBlade1.rotationPointX = rogueBlade2.rotationPointX = rogueRightArm.rotationPointX;
        rogueBlade1.rotationPointY = rogueBlade2.rotationPointY = rogueRightArm.rotationPointY;
        rogueBlade1.rotationPointZ = rogueBlade2.rotationPointZ = rogueRightArm.rotationPointZ;
    }

    @Override
	public void renderEars(final float f)
    {
    }

    @Override
	public void renderCloak(final float f)
    {
    }

    public ModelRenderer rogueHead;
    public ModelRenderer rogueBody;
    public ModelRenderer rogueLeftArm;
    public ModelRenderer rogueRightArm;
    public ModelRenderer rogueLeftLeg;
    public ModelRenderer rogueRightLeg;

    public ModelRenderer wingLeft;
    public ModelRenderer wingRight;

    public FairyModelRenderer rogueBlade1, rogueBlade2;

    public boolean flymode;
    public float sinage;
    public float retract;
    public boolean venom;
}


text:
<?
/**
*
*/
class CategoryController extends Controller
{

	function init() {
		if ( isGuest() )
			$this->redirect("/login");

		$this->layout = "/layouts/admin";
		$this->pageTitle = Yii::t("general", "XYZPedia"). " - ";
	}

	public function actionIndex() {
		$this->forward("/admin/category/list");
	}

	public function actionList() {
		// check cap
		if ( !can("post", "list") ) {
			throwException(404, Yii::t("admin", "No access."));
		}
		$this->pageTitle.= Yii::t("admin", "Category");

		$categories = Category::model()->findAll();
		$this->render("/admin/category/list", array(
			"action" => "category",
			"categories" => $categories,
		));
	}
}
?>