text:
package rx.schedulers;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

import org.junit.Test;

import rx.Observable;
import rx.Observable.OnSubscribe;
import rx.Scheduler;
import rx.Scheduler.Worker;
import rx.Subscriber;
import rx.Subscription;
import rx.functions.Action0;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.subscriptions.Subscriptions;

/**
 * Base tests for schedulers that involve threads (concurrency).
 *
 * These can only run on Schedulers that launch threads since they expect async/concurrent behavior.
 *
 * The Current/Immediate schedulers will not work with these tests.
 */
public abstract class AbstractSchedulerConcurrencyTests extends AbstractSchedulerTests {

    /**
     * Bug report: https://github.com/ReactiveX/RxJava/issues/431
     * @throws InterruptedException if a wait is interrupted
     */
    @Test
    public final void testUnSubscribeForScheduler() throws InterruptedException {
        final AtomicInteger countReceived = new AtomicInteger();
        final AtomicInteger countGenerated = new AtomicInteger();
        final CountDownLatch latch = new CountDownLatch(1);

        Observable.interval(50, TimeUnit.MILLISECONDS)
                .map(new Func1<Long, Long>() {
                    @Override
                    public Long call(Long aLong) {
                        countGenerated.incrementAndGet();
                        return aLong;
                    }
                })
                .subscribeOn(getScheduler())
                .observeOn(getScheduler())
                .subscribe(new Subscriber<Long>() {
                    @Override
                    public void onCompleted() {
                        System.out.println("--- completed");
                    }

                    @Override
                    public void onError(Throwable e) {
                        System.out.println("--- onError");
                    }

                    @Override
                    public void onNext(Long args) {
                        if (countReceived.incrementAndGet() == 2) {
                            unsubscribe();
                            latch.countDown();
                        }
                        System.out.println("==> Received " + args);
                    }
                });

        latch.await(1000, TimeUnit.MILLISECONDS);

        System.out.println("----------- it thinks it is finished ------------------ ");
        Thread.sleep(100);

        assertEquals(2, countGenerated.get());
    }

    @Test
    public void testUnsubscribeRecursiveScheduleFromOutside() throws InterruptedException {
        final CountDownLatch latch = new CountDownLatch(1);
        final CountDownLatch unsubscribeLatch = new CountDownLatch(1);
        final AtomicInteger counter = new AtomicInteger();
        final Worker inner = getScheduler().createWorker();
        try {
            inner.schedule(new Action0() {

                @Override
                public void call() {
                    inner.schedule(new Action0() {

                        int i;

                        @Override
                        public void call() {
                            System.out.println("Run: " + i++);
                            if (i == 10) {
                                latch.countDown();
                                try {
                                    // wait for unsubscribe to finish so we are not racing it
                                    unsubscribeLatch.await();
                                } catch (InterruptedException e) {
                                    // we expect the countDown if unsubscribe is not working
                                    // or to be interrupted if unsubscribe is successful since
                                    // the unsubscribe will interrupt it as it is calling Future.cancel(true)
                                    // so we will ignore the stacktrace
                                }
                            }

                            counter.incrementAndGet();
                            inner.schedule(this);
                        }
                    });
                }

            });

            latch.await();
            inner.unsubscribe();
            unsubscribeLatch.countDown();
            Thread.sleep(200); // let time pass to see if the scheduler is still doing work
            assertEquals(10, counter.get());
        } finally {
            inner.unsubscribe();
        }
    }

    @Test
    public void testUnsubscribeRecursiveScheduleFromInside() throws InterruptedException {
        final CountDownLatch unsubscribeLatch = new CountDownLatch(1);
        final AtomicInteger counter = new AtomicInteger();
        final Worker inner = getScheduler().createWorker();
        try {
            inner.schedule(new Action0() {

                @Override
                public void call() {
                    inner.schedule(new Action0() {

                        int i;

                        @Override
                        public void call() {
                            System.out.println("Run: " + i++);
                            if (i == 10) {
                                inner.unsubscribe();
                            }

                            counter.incrementAndGet();
                            inner.schedule(this);
                        }
                    });
                }

            });

            unsubscribeLatch.countDown();
            Thread.sleep(200); // let time pass to see if the scheduler is still doing work
            assertEquals(10, counter.get());
        } finally {
            inner.unsubscribe();
        }
    }

    @Test
    public void testUnsubscribeRecursiveScheduleWithDelay() throws InterruptedException {
        final CountDownLatch latch = new CountDownLatch(1);
        final CountDownLatch unsubscribeLatch = new CountDownLatch(1);
        final AtomicInteger counter = new AtomicInteger();
        final Worker inner = getScheduler().createWorker();

        try {
            inner.schedule(new Action0() {

                @Override
                public void call() {
                    inner.schedule(new Action0() {

                        long i = 1L;

                        @Override
                        public void call() {
                            if (i++ == 10) {
                                latch.countDown();
                                try {
                                    // wait for unsubscribe to finish so we are not racing it
                                    unsubscribeLatch.await();
                                } catch (InterruptedException e) {
                                    // we expect the countDown if unsubscribe is not working
                                    // or to be interrupted if unsubscribe is successful since
                                    // the unsubscribe will interrupt it as it is calling Future.cancel(true)
                                    // so we will ignore the stacktrace
                                }
                            }

                            counter.incrementAndGet();
                            inner.schedule(this, 10, TimeUnit.MILLISECONDS);
                        }
                    }, 10, TimeUnit.MILLISECONDS);
                }
            });

            latch.await();
            inner.unsubscribe();
            unsubscribeLatch.countDown();
            Thread.sleep(200); // let time pass to see if the scheduler is still doing work
            assertEquals(10, counter.get());
        } finally {
            inner.unsubscribe();
        }
    }

    @Test
    public void recursionFromOuterActionAndUnsubscribeInside() throws InterruptedException {
        final CountDownLatch latch = new CountDownLatch(1);
        final Worker inner = getScheduler().createWorker();
        try {
            inner.schedule(new Action0() {

                int i;

                @Override
                public void call() {
                    i++;
                    if (i % 100000 == 0) {
                        System.out.println(i + "  Total Memory: " + Runtime.getRuntime().totalMemory() + "  Free: " + Runtime.getRuntime().freeMemory());
                    }
                    if (i < 1000000L) {
                        inner.schedule(this);
                    } else {
                        latch.countDown();
                    }
                }
            });

            latch.await();
        } finally {
            inner.unsubscribe();
        }
    }

    @Test
    public void testRecursion() throws InterruptedException {
        final CountDownLatch latch = new CountDownLatch(1);
        final Worker inner = getScheduler().createWorker();
        try {
            inner.schedule(new Action0() {

                private long i;

                @Override
                public void call() {
                    i++;
                    if (i % 100000 == 0) {
                        System.out.println(i + "  Total Memory: " + Runtime.getRuntime().totalMemory() + "  Free: " + Runtime.getRuntime().freeMemory());
                    }
                    if (i < 1000000L) {
                        inner.schedule(this);
                    } else {
                        latch.countDown();
                    }
                }
            });

            latch.await();
        } finally {
            inner.unsubscribe();
        }
    }

    @Test
    public void testRecursionAndOuterUnsubscribe() throws InterruptedException {
        // use latches instead of Thread.sleep
        final CountDownLatch latch = new CountDownLatch(10);
        final CountDownLatch completionLatch = new CountDownLatch(1);
        final Worker inner = getScheduler().createWorker();
        try {
            Observable<Integer> obs = Observable.unsafeCreate(new OnSubscribe<Integer>() {
                @Override
                public void call(final Subscriber<? super Integer> observer) {
                    inner.schedule(new Action0() {
                        @Override
                        public void call() {
                            observer.onNext(42);
                            latch.countDown();

                            // this will recursively schedule this task for execution again
                            inner.schedule(this);
                        }
                    });

                    observer.add(Subscriptions.create(new Action0() {

                        @Override
                        public void call() {
                            inner.unsubscribe();
                            observer.onCompleted();
                            completionLatch.countDown();
                        }

                    }));

                }
            });

            final AtomicInteger count = new AtomicInteger();
            final AtomicBoolean completed = new AtomicBoolean(false);
            Subscription subscribe = obs.subscribe(new Subscriber<Integer>() {
                @Override
                public void onCompleted() {
                    System.out.println("Completed");
                    completed.set(true);
                }

                @Override
                public void onError(Throwable e) {
                    System.out.println("Error");
                }

                @Override
                public void onNext(Integer args) {
                    count.incrementAndGet();
                    System.out.println(args);
                }
            });

            if (!latch.await(5000, TimeUnit.MILLISECONDS)) {
                fail("Timed out waiting on onNext latch");
            }

            // now unsubscribe and ensure it stops the recursive loop
            subscribe.unsubscribe();
            System.out.println("unsubscribe");

            if (!completionLatch.await(5000, TimeUnit.MILLISECONDS)) {
                fail("Timed out waiting on completion latch");
            }

            // the count can be 10 or higher due to thread scheduling of the unsubscribe vs the scheduler looping to emit the count
            assertTrue(count.get() >= 10);
            assertTrue(completed.get());
        } finally {
            inner.unsubscribe();
        }
    }

    @Test
    public final void testSubscribeWithScheduler() throws InterruptedException {
        final Scheduler scheduler = getScheduler();

        final AtomicInteger count = new AtomicInteger();

        Observable<Integer> o1 = Observable.<Integer> just(1, 2, 3, 4, 5);

        o1.subscribe(new Action1<Integer>() {

            @Override
            public void call(Integer t) {
                System.out.println("Thread: " + Thread.currentThread().getName());
                System.out.println("t: " + t);
                count.incrementAndGet();
            }
        });

        // the above should be blocking so we should see a count of 5
        assertEquals(5, count.get());

        count.set(0);

        // now we'll subscribe with a scheduler and it should be async

        final String currentThreadName = Thread.currentThread().getName();

        // latches for deterministically controlling the test below across threads
        final CountDownLatch latch = new CountDownLatch(5);
        final CountDownLatch first = new CountDownLatch(1);

        o1.subscribeOn(scheduler).subscribe(new Action1<Integer>() {

            @Override
            public void call(Integer t) {
                try {
                    // we block the first one so we can assert this executes asynchronously with a count
                    first.await(1000, TimeUnit.SECONDS);
                } catch (InterruptedException e) {
                    throw new RuntimeException("The latch should have released if we are async.", e);
                }

                assertFalse(Thread.currentThread().getName().equals(currentThreadName));
                System.out.println("Thread: " + Thread.currentThread().getName());
                System.out.println("t: " + t);
                count.incrementAndGet();
                latch.countDown();
            }
        });

        // assert we are async
        assertEquals(0, count.get());
        // release the latch so it can go forward
        first.countDown();

        // wait for all 5 responses
        latch.await();
        assertEquals(5, count.get());
    }

    @Test
    public void workerUnderConcurrentUnsubscribeShouldNotAllowLaterTasksToRunDueToUnsubscriptionRace() {
        Scheduler scheduler = getScheduler();
        for (int i = 0; i < 1000; i++) {
            Worker worker = scheduler.createWorker();
            final Queue<Integer> q = new ConcurrentLinkedQueue<Integer>();
            Action0 action1 = new Action0() {

                @Override
                public void call() {
                    q.add(1);
                }
            };
            Action0 action2 = new Action0() {

                @Override
                public void call() {
                    q.add(2);
                }
            };
            worker.schedule(action1);
            worker.schedule(action2);
            worker.unsubscribe();
            if (q.size() == 1 && q.poll() == 2) {
                //expect a queue of 1,2 or 1. If queue is just 2 then we have a problem!
                fail("wrong order on loop " + i);
            }
        }
    }
}


text:
module Middleman
  class PreviewServer
    class ServerHostname
      class ServerFullHostname < SimpleDelegator
        def to_s
          __getobj__
        end

        def self.match?(*)
          true
        end

        alias_method :to_browser, :to_s
      end

      class ServerPlainHostname < SimpleDelegator
        def to_s
          __getobj__ + '.local'
        end

        def self.match?(name)
          # rubocop:disable Style/CaseEquality
          name != 'localhost' && /^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?\.?$/ === name
          # rubocop:enable Style/CaseEquality
        end

        alias_method :to_browser, :to_s
      end

      def self.new(string)
        @names = []
        @names << ServerPlainHostname
        @names << ServerFullHostname

        @names.find { |n| n.match? string }.new(string)
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
            <a href="<?php echo site_url('thread'); ?>">Home /

        <?php $cat_total = count($cat); foreach ($cat as $key => $c): ?>

            <a href="<?php echo site_url('thread/category/'.$c['slug']); ?>"><?php echo $c['name']; ?>
            <?php if ($key+1 != $cat_total): ?>
            /
            <?php endif; ?>

        <?php endforeach; ?>

        <?php if (isset($tmp_success)): ?>

            ×

Reply posted!

        <?php endif; ?>
        <?php if (isset($tmp_success_new)): ?>

            ×

New thread created!

        <?php endif; ?>

<?php echo $thread->title; ?>

        <?php
        function time_ago($date) {

            if(empty($date)) {
                return "No date provided";
            }

            $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
            $lengths = array("60","60","24","7","4.35","12","10");
            $now = time();
            $unix_date = strtotime($date);

            // check validity of date

            if(empty($unix_date)) {
                return "Bad date";
            }

            // is it future date or past date
            if($now > $unix_date) {
                $difference = $now - $unix_date;
                $tense = "ago";
            } else {
                $difference = $unix_date - $now;
                $tense = "from now";
            }
            for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
                $difference /= $lengths[$j];
            }
            $difference = round($difference);
            if($difference != 1) {
                $periods[$j].= "s";
            }

            return "$difference $periods[$j] {$tense}";
        }
        ?>
        <link rel="stylesheet" href="<?php echo base_url(); ?>resources/jquery/jwysiwyg/jquery.wysiwyg.css"/>

        <?php foreach ($posts as $post): ?>

                <?php echo $post->post; ?>

                <li class="dropdown" id="menu<?php echo $post->id; ?>">
                <a class="dropdown-toggle" data-toggle="dropdown" href="#menu<?php echo $post->id; ?>" style="border: 1px solid #d9d9d9;font-size: 11px;">
                Quote / Reply

<form class="well" action="" method="post" style="margin: 5px 10px;width: 600px;text-align: left;">
                        <input type="hidden" name="row[thread_id]" value="<?php echo $thread->id; ?>"/>
                        <input type="hidden" name="row[reply_to_id]" value="<?php echo $post->id; ?>"/>
                        <input type="hidden" name="row[author_id]" value="<?php echo $this->session->userdata('cibb_user_id'); ?>"/>
                        <input type="hidden" name="row[date_add]" value="<?php echo date('Y-m-d H:i:s'); ?>"/>
                        <textarea name="row[post]" id="replypost<?php echo $post->id; ?>" class="textpostreply" cols="72" style="height:180px;" class="span12">
                        </textarea>
                        <input type="submit" style="margin-top:15px;font-weight: bold;" name="btn-post" class="btn btn-primary" value="Reply Post"/>
                    </form>

                    posted by <?php echo $post->username; ?>, <?php echo time_ago($post->date_add); ?>

        <?php endforeach; ?>

<?php echo $page; ?>

Reply Thread

        <form class="well" action="" method="post" style="margin: 5px 10px;">
            <input type="hidden" name="row[thread_id]" value="<?php echo $thread->id; ?>"/>
            <input type="hidden" name="row[reply_to_id]" value="0"/>
            <input type="hidden" name="row[author_id]" value="<?php echo $this->session->userdata('cibb_user_id'); ?>"/>
            <input type="hidden" name="row[date_add]" value="<?php echo date('Y-m-d H:i:s'); ?>"/>
            <textarea name="row[post]" class="span12" id="textpost" style="height:150px;"></textarea>
            <input type="submit" style="margin-top:15px;font-weight: bold;" name="btn-post" class="btn btn-primary" value="Reply Post"/>
        </form>

            Categories

            <?php foreach($categories as $cat): ?>

<a href="<?php echo site_url('thread/category/'.$cat['slug']); ?>"><?php echo $cat['name']; ?>

            <?php endforeach; ?>


text:
OPEN_RDO_PARSER_NAMESPACE

// --------------------------------------------------------------------------------
// -------------------- IContextParamDefinitionManager
// --------------------------------------------------------------------------------
PREDECLARE_OBJECT_INTERFACE(IContextParamDefinitionManager)
struct IContextParamDefinitionManager: public rdo::RefCounter<IContextParamDefinitionManager>
{
DECLARE_FACTORY(IContextParamDefinitionManager)
public:
    virtual void pushParamDefinitionContext() = 0;
    virtual void popParamDefinitionContext () = 0;

protected:
    IContextParamDefinitionManager()
    {}
    virtual ~IContextParamDefinitionManager()
    {}
};

#define DECLARE_IContextParamDefinitionManager \
    void pushParamDefinitionContext();         \
    void popParamDefinitionContext ();

// --------------------------------------------------------------------------------
// -------------------- ContextParamDefinition
// --------------------------------------------------------------------------------
class ContextParamDefinition: public Context
{
DECLARE_FACTORY(ContextParamDefinition)
public:
    void pushParam(const LPRDOParam& pParam);

private:
    typedef  boost::function<void (const LPRDOParam&)>  OnPushParam;

    ContextParamDefinition(const OnPushParam& onPushParam);
    virtual ~ContextParamDefinition();

    OnPushParam m_onPushParam;
};
DECLARE_POINTER(ContextParamDefinition);

CLOSE_RDO_PARSER_NAMESPACE


text:
'use strict';

import React from 'react/addons';
import Comment from '../src/Comment';

var TestUtils = React.addons.TestUtils;

describe('Comment', () => {
    var component;

    beforeEach(() => {
        component = TestUtils.renderIntoDocument(<Comment author="Test Author">Some text</Comment>);
    });

    it('should display the correct author name', () => {
        expect(component.getDOMNode().textContent).toMatch(/Test Author/);
    });

    it('should display the correct content', () => {
        expect(component.getDOMNode().textContent).toMatch(/Some text/);
    });
});


text: sudo cp PushWorker.conf /etc/init/PushWorker_001.conf


text:
///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000-2003 Intel Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither name of Intel Corporation nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////

#include "config.h"
#if EXCLUDE_GENA == 0
#ifdef INCLUDE_CLIENT_APIS

#include "gena.h"
#include "sysdep.h"
#include "uuid.h"
#include "upnpapi.h"
#include "parsetools.h"
#include "statcodes.h"
#include "httpparser.h"
#include "httpreadwrite.h"

extern ithread_mutex_t GlobalClientSubscribeMutex;

/************************************************************************
* Function : GenaAutoRenewSubscription
*
* Parameters:
*	IN void *input: Thread data(upnp_timeout *) needed to send the renewal
*
* Description:
*	This is a thread function to send the renewal just before the
*	subscription times out.
*
* Returns: VOID
*
***************************************************************************/
static void
GenaAutoRenewSubscription( IN void *input )
{
    upnp_timeout *event = ( upnp_timeout * ) input;
    void *cookie;
    Upnp_FunPtr callback_fun;
    struct Handle_Info *handle_info;
    struct Upnp_Event_Subscribe *sub_struct =
        ( struct Upnp_Event_Subscribe * )
        event->Event;

    int send_callback = 0;
    int eventType = 0;

    if( AUTO_RENEW_TIME == 0 ) {
        UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
            "GENA SUB EXPIRED" );
        sub_struct->ErrCode = UPNP_E_SUCCESS;
        send_callback = 1;
        eventType = UPNP_EVENT_SUBSCRIPTION_EXPIRED;
    } else {
        UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
            "GENA AUTO RENEW" );
        if( ( ( sub_struct->ErrCode = genaRenewSubscription( event->handle,
                                                             sub_struct->
                                                             Sid,
                                                             &sub_struct->
                                                             TimeOut ) ) !=
              UPNP_E_SUCCESS )
            && ( sub_struct->ErrCode != GENA_E_BAD_SID )
            && ( sub_struct->ErrCode != GENA_E_BAD_HANDLE ) ) {
            send_callback = 1;
            eventType = UPNP_EVENT_AUTORENEWAL_FAILED;
        }
    }
    if( send_callback ) {
        HandleReadLock();
        if( GetHandleInfo( event->handle, &handle_info ) != HND_CLIENT ) {
            HandleUnlock();
            free_upnp_timeout( event );
            return;
        }
        UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
            "HANDLE IS VALID" );
        callback_fun = handle_info->Callback;
        cookie = handle_info->Cookie;
        HandleUnlock();
        //make callback

        callback_fun( eventType, event->Event, cookie );
    }

    free_upnp_timeout( event );
}

/************************************************************************
* Function : ScheduleGenaAutoRenew
*
* Parameters:
*	IN int client_handle: Handle that also contains the subscription list
*	IN int TimeOut: The time out value of the subscription
*	IN client_subscription * sub: Subscription being renewed
*
* Description:
*	This function schedules a job to renew the subscription just before
*	time out.
*
* Returns: int
*	return GENA_E_SUCCESS if successful else returns appropriate error
***************************************************************************/
static int
ScheduleGenaAutoRenew( IN int client_handle,
                       IN int TimeOut,
                       IN client_subscription * sub )
{
    struct Upnp_Event_Subscribe *RenewEventStruct = NULL;
    upnp_timeout *RenewEvent = NULL;
    int return_code = GENA_SUCCESS;
    ThreadPoolJob job;

    if( TimeOut == UPNP_INFINITE ) {
        return GENA_SUCCESS;
    }

    RenewEventStruct = ( struct Upnp_Event_Subscribe * )malloc( sizeof
                                                                ( struct
                                                                  Upnp_Event_Subscribe ) );

    if( RenewEventStruct == NULL ) {
        return UPNP_E_OUTOF_MEMORY;
    }

    RenewEvent = ( upnp_timeout * ) malloc( sizeof( upnp_timeout ) );

    if( RenewEvent == NULL ) {
        free( RenewEventStruct );
        return UPNP_E_OUTOF_MEMORY;
    }
    //schedule expire event
    strcpy( RenewEventStruct->Sid, sub->sid );
    RenewEventStruct->ErrCode = UPNP_E_SUCCESS;
    strncpy( RenewEventStruct->PublisherUrl, sub->EventURL,
             NAME_SIZE - 1 );
    RenewEventStruct->TimeOut = TimeOut;

    //RenewEvent->EventType=UPNP_EVENT_SUBSCRIPTION_EXPIRE;
    RenewEvent->handle = client_handle;
    RenewEvent->Event = RenewEventStruct;

    TPJobInit( &job, ( start_routine ) GenaAutoRenewSubscription,
               RenewEvent );
    TPJobSetFreeFunction( &job, ( free_routine ) free_upnp_timeout );
    TPJobSetPriority( &job, MED_PRIORITY );

    //Schedule the job
    if( ( return_code = TimerThreadSchedule( &gTimerThread,
                                             TimeOut - AUTO_RENEW_TIME,
                                             REL_SEC, &job, SHORT_TERM,
                                             &( RenewEvent->
                                                eventId ) ) ) !=
        UPNP_E_SUCCESS ) {
        free( RenewEvent );
        free( RenewEventStruct );
        return return_code;
    }

    sub->RenewEventId = RenewEvent->eventId;
    return GENA_SUCCESS;
}

/************************************************************************
* Function : gena_unsubscribe
*
* Parameters:
*	IN char *url: Event URL of the service
*	IN char *sid: The subcription ID.
*	OUT http_parser_t* response: The UNSUBCRIBE response from the device
*
* Description:
*	This function sends the UNSUBCRIBE gena request and recieves the
*	response from the device and returns it as a parameter
*
* Returns: int
*	return 0 if successful else returns appropriate error
***************************************************************************/
static int
gena_unsubscribe( IN char *url,
                  IN char *sid,
                  OUT http_parser_t * response )
{
    int return_code;
    uri_type dest_url;
    membuffer request;

    // parse url
    return_code = http_FixStrUrl( url, strlen( url ), &dest_url );
    if( return_code != 0 ) {
        return return_code;
    }
    // make request msg
    membuffer_init( &request );
    request.size_inc = 30;
    return_code = http_MakeMessage(
        &request, 1, 1,
        "q" "ssc" "Uc",
        HTTPMETHOD_UNSUBSCRIBE, &dest_url,
        "SID: ", sid );

    //Not able to make the message so destroy the existing buffer
    if( return_code != 0 ) {
        membuffer_destroy( &request );
        return return_code;
    }
    // send request and get reply
    return_code = http_RequestAndResponse( &dest_url, request.buf,
                                           request.length,
                                           HTTPMETHOD_UNSUBSCRIBE,
                                           HTTP_DEFAULT_TIMEOUT,
                                           response );

    membuffer_destroy( &request );

    if( return_code != 0 )
        httpmsg_destroy( &response->msg );

    if( return_code == 0 && response->msg.status_code != HTTP_OK ) {
        return_code = UPNP_E_UNSUBSCRIBE_UNACCEPTED;
        httpmsg_destroy( &response->msg );
    }

    return return_code;
}

/************************************************************************
* Function : gena_subscribe
*
* Parameters:
*	IN char *url: url of service to subscribe
*	INOUT int* timeout:subscription time desired (in secs)
*	IN char* renewal_sid:for renewal, this contains a currently h
*						 held subscription SID. For first time
*						 subscription, this must be NULL
*	OUT char** sid: SID returned by the subscription or renew msg
*
* Description:
*	This function subscribes or renew subscription
*
* Returns: int
*	return 0 if successful else returns appropriate error
***************************************************************************/
static int
gena_subscribe( IN char *url,
                INOUT int *timeout,
                IN char *renewal_sid,
                OUT char **sid )
{
    int return_code;
    memptr sid_hdr,
      timeout_hdr;
    char timeout_str[25];
    membuffer request;
    uri_type dest_url;
    http_parser_t response;

    *sid = NULL;                // init

    // request timeout to string
    if ( timeout == NULL ) {
        timeout = (int *)malloc(sizeof(int));
        if(timeout == 0) return  UPNP_E_OUTOF_MEMORY;
        sprintf( timeout_str, "%d", CP_MINIMUM_SUBSCRIPTION_TIME );
    } else if( ( *timeout > 0 )&& ( *timeout < CP_MINIMUM_SUBSCRIPTION_TIME ) ) {
        sprintf( timeout_str, "%d", CP_MINIMUM_SUBSCRIPTION_TIME );
    } else if( *timeout >= 0 ) {
        sprintf( timeout_str, "%d", *timeout );
    } else {
        strcpy( timeout_str, "infinite" );
    }

    // parse url
    return_code = http_FixStrUrl( url, strlen( url ), &dest_url );
    if( return_code != 0 ) {
        return return_code;
    }
    // make request msg
    membuffer_init( &request );
    request.size_inc = 30;
    if( renewal_sid ) {
        // renew subscription
        return_code = http_MakeMessage(
            &request, 1, 1,
            "q" "ssc" "sscc",
            HTTPMETHOD_SUBSCRIBE, &dest_url,
            "SID: ", renewal_sid,
            "TIMEOUT: Second-", timeout_str );
    } else {
        // subscribe
        return_code = http_MakeMessage(
            &request, 1, 1,
            "q" "sssdsc" "sc" "sscc",
            HTTPMETHOD_SUBSCRIBE, &dest_url,
            "CALLBACK: <http://", LOCAL_HOST, ":", LOCAL_PORT, "/>",
            "NT: upnp:event",
	    "TIMEOUT: Second-", timeout_str );
    }
    if( return_code != 0 ) {
        return return_code;
    }
    // send request and get reply
    return_code = http_RequestAndResponse( &dest_url, request.buf,
                                           request.length,
                                           HTTPMETHOD_SUBSCRIBE,
                                           HTTP_DEFAULT_TIMEOUT,
                                           &response );

    membuffer_destroy( &request );

    if( return_code != 0 ) {
        httpmsg_destroy( &response.msg );
        return return_code;
    }
    if( response.msg.status_code != HTTP_OK ) {
        httpmsg_destroy( &response.msg );
        return UPNP_E_SUBSCRIBE_UNACCEPTED;
    }
    // get SID and TIMEOUT
    if( httpmsg_find_hdr( &response.msg, HDR_SID, &sid_hdr ) == NULL ||
        sid_hdr.length == 0 ||
        httpmsg_find_hdr( &response.msg,
                          HDR_TIMEOUT, &timeout_hdr ) == NULL ||
        timeout_hdr.length == 0 ) {
        httpmsg_destroy( &response.msg );
        return UPNP_E_BAD_RESPONSE;
    }
    // save timeout
    if( matchstr( timeout_hdr.buf, timeout_hdr.length, "%iSecond-%d%0",
                  timeout ) == PARSE_OK ) {
        // nothing
    } else if( memptr_cmp_nocase( &timeout_hdr, "Second-infinite" ) == 0 ) {
        *timeout = -1;
    } else {
        httpmsg_destroy( &response.msg );
        return UPNP_E_BAD_RESPONSE;
    }

    // save SID
    *sid = str_alloc( sid_hdr.buf, sid_hdr.length );
    if( *sid == NULL ) {
        httpmsg_destroy( &response.msg );
        return UPNP_E_OUTOF_MEMORY;
    }

    httpmsg_destroy( &response.msg );
    return UPNP_E_SUCCESS;
}

/************************************************************************
* Function : genaUnregisterClient
*
* Parameters:
*	IN UpnpClient_Handle client_handle: Handle containing all the control
*			point related information
*
* Description:
*	This function unsubcribes all the outstanding subscriptions and cleans
*	the subscription list. This function is called when control point
*	unregisters.
*
* Returns: int
*	return UPNP_E_SUCCESS if successful else returns appropriate error
***************************************************************************/
int
genaUnregisterClient( IN UpnpClient_Handle client_handle )
{
    client_subscription sub_copy;
    int return_code = UPNP_E_SUCCESS;
    struct Handle_Info *handle_info = NULL;
    http_parser_t response;

    while( TRUE ) {
        HandleLock();
        if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
            HandleUnlock();
            return GENA_E_BAD_HANDLE;
        }

        if( handle_info->ClientSubList == NULL ) {
            return_code = UPNP_E_SUCCESS;
            break;
        }

        return_code = copy_client_subscription( handle_info->ClientSubList,
                                                &sub_copy );
        if( return_code != HTTP_SUCCESS ) {
            break;
        }

        RemoveClientSubClientSID( &handle_info->ClientSubList,
                                  sub_copy.sid );

        HandleUnlock();

        return_code = gena_unsubscribe( sub_copy.EventURL,
                                        sub_copy.ActualSID, &response );
        if( return_code == 0 ) {
            httpmsg_destroy( &response.msg );
        }

        free_client_subscription( &sub_copy );
    }

    freeClientSubList( handle_info->ClientSubList );
    HandleUnlock();
    return return_code;
}

/************************************************************************
* Function : genaUnSubscribe
*
* Parameters:
*	IN UpnpClient_Handle client_handle: UPnP client handle
*	IN SID in_sid: The subscription ID
*
* Description:
*	This function unsubscribes a SID. It first validates the SID and
*	client_handle,copies the subscription, sends UNSUBSCRIBE http request
*	to service processes request and finally removes the subscription
*
* Returns: int
*	return UPNP_E_SUCCESS if service response is OK else
*	returns appropriate error
***************************************************************************/
#ifdef INCLUDE_CLIENT_APIS
int
genaUnSubscribe( IN UpnpClient_Handle client_handle,
                 IN const Upnp_SID in_sid )
{
    client_subscription *sub;
    int return_code = GENA_SUCCESS;
    struct Handle_Info *handle_info;
    client_subscription sub_copy;
    http_parser_t response;

    HandleLock();

    // validate handle and sid

    if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
        HandleUnlock();
        return GENA_E_BAD_HANDLE;
    }

    if( ( sub =
          GetClientSubClientSID( handle_info->ClientSubList, in_sid ) )
        == NULL ) {
        HandleUnlock();
        return GENA_E_BAD_SID;
    }

    return_code = copy_client_subscription( sub, &sub_copy );

    HandleUnlock();

    return_code = gena_unsubscribe( sub_copy.EventURL, sub_copy.ActualSID,
                                    &response );

    if( return_code == 0 ) {
        httpmsg_destroy( &response.msg );
    }

    free_client_subscription( &sub_copy );

    HandleLock();

    if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
        HandleUnlock();
        return GENA_E_BAD_HANDLE;
    }

    RemoveClientSubClientSID( &handle_info->ClientSubList, in_sid );

    HandleUnlock();

    return return_code;
}
#endif

/************************************************************************
* Function : genaSubscribe
*
* Parameters:
*	IN UpnpClient_Handle client_handle:
*	IN char * PublisherURL: NULL Terminated, of the form :
*						"http://134.134.156.80:4000/RedBulb/Event"
*	INOUT int * TimeOut: requested Duration, if -1, then "infinite".
*						in the OUT case: actual Duration granted
*						by Service, -1 for infinite
*	OUT Upnp_SID out_sid:sid of subscription, memory passed in by caller
*
* Description:
*	This function subscribes to a PublisherURL ( also mentioned as EventURL
*	some places). It sends SUBSCRIBE http request to service processes
*	request. Finally adds a Subscription to
*	the clients subscription list, if service responds with OK
*
* Returns: int
*	return UPNP_E_SUCCESS if service response is OK else
*	returns appropriate error
***************************************************************************/
#ifdef INCLUDE_CLIENT_APIS
int
genaSubscribe( IN UpnpClient_Handle client_handle,
               IN char *PublisherURL,
               INOUT int *TimeOut,
               OUT Upnp_SID out_sid )
{
    int return_code = GENA_SUCCESS;
    client_subscription *newSubscription = NULL;
    uuid_upnp uid;
    Upnp_SID temp_sid;
    char *ActualSID = NULL;
    struct Handle_Info *handle_info;
    char *EventURL = NULL;

    UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
        "GENA SUBSCRIBE BEGIN" );

    memset( out_sid, 0, sizeof( Upnp_SID ) );

    HandleReadLock();
    // validate handle
    if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
        HandleUnlock();
        return GENA_E_BAD_HANDLE;
    }
    HandleUnlock();

    // subscribe
    SubscribeLock();
    return_code =
        gena_subscribe( PublisherURL, TimeOut, NULL, &ActualSID );
    HandleLock();
    if( return_code != UPNP_E_SUCCESS ) {
        UpnpPrintf( UPNP_CRITICAL, GENA, __FILE__, __LINE__,
            "SUBSCRIBE FAILED in transfer error code: %d returned\n",
            return_code );
        goto error_handler;
    }

    if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
        return_code = GENA_E_BAD_HANDLE;
        goto error_handler;
    }
    // generate client SID
    uuid_create( &uid );
    uuid_unpack( &uid, temp_sid );
    sprintf( out_sid, "uuid:%s", temp_sid );

    // create event url
    EventURL = ( char * )malloc( strlen( PublisherURL ) + 1 );
    if( EventURL == NULL ) {
        return_code = UPNP_E_OUTOF_MEMORY;
        goto error_handler;
    }

    strcpy( EventURL, PublisherURL );

    // fill subscription
    newSubscription =
        ( client_subscription * ) malloc( sizeof( client_subscription ) );
    if( newSubscription == NULL ) {
        return_code = UPNP_E_OUTOF_MEMORY;
        goto error_handler;
    }
    newSubscription->EventURL = EventURL;
    newSubscription->ActualSID = ActualSID;
    strcpy( newSubscription->sid, out_sid );
    newSubscription->RenewEventId = -1;
    newSubscription->next = handle_info->ClientSubList;
    handle_info->ClientSubList = newSubscription;

    // schedule expiration event
    return_code = ScheduleGenaAutoRenew( client_handle, *TimeOut,
                                         newSubscription );

  error_handler:
    if( return_code != UPNP_E_SUCCESS ) {
        free( ActualSID );
        free( EventURL );
        free( newSubscription );
    }
    HandleUnlock();
    SubscribeUnlock();
    return return_code;
}
#endif

/************************************************************************
* Function : genaRenewSubscription
*
* Parameters:
*	IN UpnpClient_Handle client_handle: Client handle
*	IN const Upnp_SID in_sid: subscription ID
*	INOUT int * TimeOut: requested Duration, if -1, then "infinite".
*						in the OUT case: actual Duration granted
*						by Service, -1 for infinite
*
* Description:
*	This function renews a SID. It first validates the SID and
*	client_handle and copies the subscription. It sends RENEW
*	(modified SUBSCRIBE) http request to service and processes
*	the response.
*
* Returns: int
*	return UPNP_E_SUCCESS if service response is OK else
*	returns appropriate error
***************************************************************************/
int
genaRenewSubscription( IN UpnpClient_Handle client_handle,
                       IN const Upnp_SID in_sid,
                       INOUT int *TimeOut )
{
    int return_code = GENA_SUCCESS;
    client_subscription *sub;
    client_subscription sub_copy;
    struct Handle_Info *handle_info;

    char *ActualSID;
    ThreadPoolJob tempJob;

    HandleLock();

    // validate handle and sid
    if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
        HandleUnlock();
        return GENA_E_BAD_HANDLE;
    }

    if( ( sub = GetClientSubClientSID( handle_info->ClientSubList,
                                       in_sid ) ) == NULL ) {
        HandleUnlock();
        return GENA_E_BAD_SID;
    }
    // remove old events
    if( TimerThreadRemove( &gTimerThread, sub->RenewEventId, &tempJob ) ==
        0 ) {

        free_upnp_timeout( ( upnp_timeout * ) tempJob.arg );
    }

    UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
        "REMOVED AUTO RENEW  EVENT" );

    sub->RenewEventId = -1;
    return_code = copy_client_subscription( sub, &sub_copy );

    HandleUnlock();

    if( return_code != HTTP_SUCCESS ) {
        return return_code;
    }

    return_code = gena_subscribe( sub_copy.EventURL, TimeOut,
                                  sub_copy.ActualSID, &ActualSID );
    HandleLock();

    if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
        HandleUnlock();
        if( return_code == UPNP_E_SUCCESS ) {
            free( ActualSID );
        }
        return GENA_E_BAD_HANDLE;
    }
    // we just called GetHandleInfo, so we don't check for return value
    //GetHandleInfo(client_handle, &handle_info);

    if( return_code != UPNP_E_SUCCESS ) {
        // network failure (remove client sub)
        RemoveClientSubClientSID( &handle_info->ClientSubList, in_sid );
        free_client_subscription( &sub_copy );
        HandleUnlock();
        return return_code;
    }
    // get subscription
    if( ( sub = GetClientSubClientSID( handle_info->ClientSubList,
                                       in_sid ) ) == NULL ) {
        free( ActualSID );
        free_client_subscription( &sub_copy );
        HandleUnlock();
        return GENA_E_BAD_SID;
    }
    // store actual sid
    free( sub->ActualSID );
    sub->ActualSID = ActualSID;

    // start renew subscription timer
    return_code = ScheduleGenaAutoRenew( client_handle, *TimeOut, sub );
    if( return_code != GENA_SUCCESS ) {
        RemoveClientSubClientSID( &handle_info->ClientSubList, sub->sid );
    }
    free_client_subscription( &sub_copy );
    HandleUnlock();
    return return_code;
}

/************************************************************************
* Function : gena_process_notification_event
*
* Parameters:
*	IN SOCKINFO *info: Socket structure containing the device socket
*					information
*	IN http_message_t* event: The http message contains the GENA
*								notification
*
* Description:
*	This function processes NOTIFY events that are sent by devices.
*	called by genacallback()
*
* Returns: void
*
* Note : called by genacallback()
****************************************************************************/
void
gena_process_notification_event( IN SOCKINFO * info,
                                 IN http_message_t * event )
{
    struct Upnp_Event event_struct;
    int eventKey;
    token sid;
    client_subscription *subscription;
    IXML_Document *ChangedVars;
    struct Handle_Info *handle_info;
    void *cookie;
    Upnp_FunPtr callback;
    UpnpClient_Handle client_handle;

    memptr sid_hdr;
    memptr nt_hdr,
      nts_hdr;
    memptr seq_hdr;

    // get SID
    if( httpmsg_find_hdr( event, HDR_SID, &sid_hdr ) == NULL ) {
        error_respond( info, HTTP_PRECONDITION_FAILED, event );

        return;
    }
    sid.buff = sid_hdr.buf;
    sid.size = sid_hdr.length;

    // get event key
    if( httpmsg_find_hdr( event, HDR_SEQ, &seq_hdr ) == NULL ||
        matchstr( seq_hdr.buf, seq_hdr.length, "%d%0", &eventKey )
        != PARSE_OK ) {
        error_respond( info, HTTP_BAD_REQUEST, event );

        return;
    }
    // get NT and NTS headers
    if( httpmsg_find_hdr( event, HDR_NT, &nt_hdr ) == NULL ||
        httpmsg_find_hdr( event, HDR_NTS, &nts_hdr ) == NULL ) {
        error_respond( info, HTTP_BAD_REQUEST, event );

        return;
    }
    // verify NT and NTS headers
    if( memptr_cmp( &nt_hdr, "upnp:event" ) != 0 ||
        memptr_cmp( &nts_hdr, "upnp:propchange" ) != 0 ) {
        error_respond( info, HTTP_PRECONDITION_FAILED, event );

        return;
    }
    // parse the content (should be XML)
    if( !has_xml_content_type( event ) ||
        event->msg.length == 0 ||
        ( ixmlParseBufferEx( event->entity.buf, &ChangedVars ) ) !=
        IXML_SUCCESS ) {
        error_respond( info, HTTP_BAD_REQUEST, event );

        return;
    }

    HandleLock();

    // get client info
    if( GetClientHandleInfo( &client_handle, &handle_info ) != HND_CLIENT ) {
        error_respond( info, HTTP_PRECONDITION_FAILED, event );
        HandleUnlock();
        ixmlDocument_free( ChangedVars );

        return;
    }
    // get subscription based on SID
    if( ( subscription = GetClientSubActualSID( handle_info->ClientSubList,
                                                &sid ) ) == NULL ) {
        if( eventKey == 0 ) {
            // wait until we've finished processing a subscription
            //   (if we are in the middle)
            // this is to avoid mistakenly rejecting the first event if we
            //   receive it before the subscription response
            HandleUnlock();

            // try and get Subscription Lock
            //   (in case we are in the process of subscribing)
            SubscribeLock();

            // get HandleLock again
            HandleLock();

            if( GetClientHandleInfo( &client_handle, &handle_info )
                != HND_CLIENT ) {
                error_respond( info, HTTP_PRECONDITION_FAILED, event );
                SubscribeUnlock();
                HandleUnlock();
                ixmlDocument_free( ChangedVars );

                return;
            }

            if( ( subscription =
                  GetClientSubActualSID( handle_info->ClientSubList,
                                         &sid ) ) == NULL ) {
                error_respond( info, HTTP_PRECONDITION_FAILED, event );
                SubscribeUnlock();
                HandleUnlock();
                ixmlDocument_free( ChangedVars );

                return;
            }

            SubscribeUnlock();
        } else {
            error_respond( info, HTTP_PRECONDITION_FAILED, event );
            HandleUnlock();
            ixmlDocument_free( ChangedVars );

            return;
        }
    }

    error_respond( info, HTTP_OK, event );  // success

    // fill event struct
    strcpy( event_struct.Sid, subscription->sid );
    event_struct.EventKey = eventKey;
    event_struct.ChangedVariables = ChangedVars;

    // copy callback
    callback = handle_info->Callback;
    cookie = handle_info->Cookie;

    HandleUnlock();

    // make callback with event struct
    // In future, should find a way of mainting
    // that the handle is not unregistered in the middle of a
    // callback
    callback( UPNP_EVENT_RECEIVED, &event_struct, cookie );

    ixmlDocument_free( ChangedVars );
}

#endif // INCLUDE_CLIENT_APIS
#endif // EXCLUDE_GENA


text:
package items;

import dominio.*;

public class BastonDeSaruman extends Item {

	public BastonDeSaruman(){
		super();
		this.prioridad = 5;
		this.nombre = "Baston de Saruman";
		this.ataque = 1;
		this.magia = 4;
	}
}


text:
<?php

namespace Zenify\DoctrineMethodsHydrator\Tests\UI;

interface MockControlFactoryInterface
{

	/**
	 * @return MockControl
	 */
	function create();

}


text:
package org.gertje.abacus.symboltable;

public class NoSuchVariableException extends Exception {

	public NoSuchVariableException(String message) {
		super(message);
	}
}


text:
package org.projectomakase.omakase.job.task;

import org.projectomakase.omakase.event.UnregisterWorker;
import org.projectomakase.omakase.job.task.jcr.TaskNodeDAO;
import org.projectomakase.omakase.task.api.TaskStatus;
import org.projectomakase.omakase.task.api.TaskStatusUpdate;

import javax.enterprise.event.Observes;
import javax.inject.Inject;

/**
 * Implements observer methods for the different types of application events that need to be processed by the task framework.
 *
 * @author Richard Lucas
 */
public class TaskEventHandler {

    @Inject
    TaskManager taskManager;
    @Inject
    Tasks tasks;
    @Inject
    TaskNodeDAO taskDAO;

    public void handleUnregisterWorker(@Observes UnregisterWorker unregisterWorker) {
        taskDAO.findAllExecutingTasksAssociatedToWorker(unregisterWorker.getWorkerId()).stream().map(tasks::fromTaskNode).forEach(
                task -> taskManager.updateTaskStatus(task.getId(), createTaskStatusUpdate(unregisterWorker)));
    }

    private static TaskStatusUpdate createTaskStatusUpdate(UnregisterWorker unregisterWorker) {
        return new TaskStatusUpdate(TaskStatus.FAILED_DIRTY, "Worker " + unregisterWorker.getWorkerId() + "was unregistered while executing this task.", -1);
    }

}


text:
using Android.Content;
using Android.Graphics;
using Android.Util;
using Android.Views;

namespace Storm.Mvvm.Framework.ColorPicker
{
	internal class ColorPanelView : View
	{
		private const float BORDER_WIDTH_PX = 1;

		private uint _color = 0xFF000000;
		private uint _borderColor = 0xFF6E6E6E;

		private Paint _colorPaint;
		private Paint _borderPaint;

		private RectF _colorRect;
		private RectF _drawingRect;

		public ColorPanelView(Context context)
			: base(context)
		{
			Init();
		}

		public uint Color
		{
			get { return _color; }
			set
			{
				_color = value;
				Invalidate();
			}
		}

		public uint BorderColor
		{
			get { return _borderColor; }
			set
			{
				_borderColor = value;
				Invalidate();
			}
		}

		public ColorPanelView(Context context, IAttributeSet attrs)
			: base(context, attrs)
		{
			Init();
		}

		public ColorPanelView(Context context, IAttributeSet attrs, int defStyleAttr)
			: base(context, attrs, defStyleAttr)
		{
			Init();
		}

		private void Init()
		{
			_borderPaint = new Paint();
			_colorPaint = new Paint();
		}

		protected override void OnDraw(Canvas canvas)
		{
			RectF rect = _colorRect;

			// ReSharper disable once ConditionIsAlwaysTrueOrFalse
			if (BORDER_WIDTH_PX > 0)
			{
				_borderPaint.Color = new Color((int) _borderColor);
				canvas.DrawRect(_drawingRect, _borderPaint);
			}

			_colorPaint.Color = new Color((int) _color);
			canvas.DrawRect(rect, _colorPaint);
		}

		protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
		{
			int width = MeasureSpec.GetSize(widthMeasureSpec);
			int height = MeasureSpec.GetSize(heightMeasureSpec);

			SetMeasuredDimension(width, height);
		}

		protected override void OnSizeChanged(int w, int h, int oldw, int oldh)
		{
			base.OnSizeChanged(w, h, oldw, oldh);

			_drawingRect = new RectF
			{
				Left = PaddingLeft,
				Right = w - PaddingRight,
				Top = PaddingTop,
				Bottom = h - PaddingBottom
			};

			SetUpColorRect();
		}

		private void SetUpColorRect()
		{
			RectF dRect = _drawingRect;

			float left = dRect.Left + BORDER_WIDTH_PX;
			float top = dRect.Top + BORDER_WIDTH_PX;
			float bottom = dRect.Bottom - BORDER_WIDTH_PX;
			float right = dRect.Right - BORDER_WIDTH_PX;

			_colorRect = new RectF(left, top, right, bottom);
		}
	}
}


text:
#ifndef __parallax_demo__
#define __parallax_demo__

// http://www.learnopengl.com/#!Advanced-Lighting/Parallax-Mapping
// http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/a-closer-look-at-parallax-occlusion-mapping-r3262
// http://sunandblackcat.com/tipFullView.php?topicid=28

#include <ciri/Game.hpp>
#include <ciri/graphics/MayaCamera.hpp>
#include "../../common/AxisGrid.hpp"
#include "../../common/AxisWidget.hpp"
#include "../../common/Model.hpp"

__declspec(align(16))
struct ParallaxVertexConstants {
	cc::Mat4f world;
	cc::Mat4f xform;
	cc::Vec3f campos;
};

class ParallaxDemo : public ciri::App {
public:
	ParallaxDemo();
	virtual ~ParallaxDemo();
	void* operator new( size_t i );
	void operator delete( void* p );

protected:
	virtual void onInitialize();
	virtual void onLoadContent();
	virtual void onEvent( const ciri::WindowEvent& evt );
	virtual void onUpdate( const double deltaTime, const double elapsedTime );
	virtual void onFixedUpdate( const double deltaTime, const double elapsedTime );
	virtual void onDraw();
	virtual void onUnloadContent();

private:
	bool loadShaders();
	void unloadShaders();

private:
	ciri::MayaCamera _camera;
	AxisGrid _grid;
	AxisWidget _axis;
	std::shared_ptr<ciri::IDepthStencilState> _depthStencilState;
	std::shared_ptr<ciri::IRasterizerState> _rasterizerState;
	Model* _model;
	std::shared_ptr<ciri::IShader> _parallaxShader;
	std::shared_ptr<ciri::IConstantBuffer> _parallaxVertexConstantBuffer;
	ParallaxVertexConstants _parallaxVertexConstants;
	std::shared_ptr<ciri::ITexture2D> _diffuseTexture;
	std::shared_ptr<ciri::ITexture2D> _normalTexture;
	std::shared_ptr<ciri::ITexture2D> _parallaxTexture;
	std::shared_ptr<ciri::ISamplerState> _parallaxSampler;
};

#endif /* __parallax_demo__ */


text:
<?php return array (
  25 => '25',
  'Invalid Password.' => 'Ugyldig passord.',
  'Permissions' => 'Tillatelser',
  'Add Folder' => 'Lag ny mappe',
  'Rename' => 'Gi nytt navn',
  'Changelog' => 'Endringslogg',
  'Removed selected.' => 'Valgte er fjernet.',
  'Whoops, looks like something went wrong.' => 'Oisann, ser ut til at noe gikk galt.',
  'Enable' => 'Aktiver',
  'Manage media files' => 'Administrere mediafiler',
  'Update' => 'Oppdater',
  'Next' => 'Neste',
  'SMTP User' => 'SMPT brukernavn',
  'Hide in menu' => 'Gjem i meny',
  'User Settings' => 'Brukerinnstillinger',
  'Modified' => 'Endret',
  'Last registered' => 'Sist registrert',
  'Welcome to %site%!' => 'Velkommen til %site%!',
  'Check Connection' => 'Test tilkobling',
  'Invalid type.' => 'Ugyldig type.',
  'Poster Image' => 'Posterbilde',
  'Path' => 'Sti',
  'Unable to upload.' => 'Kunne ikke laste opp fil.',
  'Value' => 'Verdi',
  'Username' => 'Brukernavn',
  'Is your language not available? Please help out by translating Pagekit into your own language on %link%.' => 'Er ikke språket ditt oversatt? Vennligst hjelp oss med å oversette Pagekit til ditt eget språk på %link%.',
  'No Limit' => 'Ingen grense',
  'Code' => 'Kode',
  'Positions' => 'Posisjoner',
  'Your user account has been created and is pending approval by the site administrator.' => 'Din konto har blitt opprettet og venter godkjenning av sidens administrator.',
  'Invalid url.' => 'Ugyldig lenke.',
  'Remember Me' => 'Husk meg',
  'Info' => 'Info',
  'Permission' => 'Tillatelse',
  'Database name cannot be blank.' => 'Database navn kan ikke stå tomt.',
  7 => '7',
  'System' => 'System',
  'Unable to remove.' => 'Kunne ikke fjerne.',
  'Latest registered Users' => 'Siste registrerte bruker',
  'Approve an account at %site%.' => 'Godkjenn en konto på %site%.',
  'Developer' => 'Utvikler',
  'Logo' => 'Logo',
  'Cannot connect to the server. Please try again later.' => 'Kunne ikke koble til server. Vennligst prøv igjen senere.',
  'Install' => 'Installer',
  'Don\'t show' => 'Ikke vis',
  'Missing order data.' => 'Mangler data for rekkefølge.',
  'Warning: Give to trusted roles only; this permission has security implications.' => 'Advarsel: Gi kun til brukere du stoler på; denne tilgangen har sikkerhets implikasjoner',
  'Removing package folder.' => 'Fjerner pakkemappen.',
  'Offline' => 'Vedlikeholdsmodus',
  'Add %type%' => 'Legg til %type%',
  'User Login' => 'Bruker innlogging',
  'Confirm' => 'Bekreft',
  'Setup your site' => 'Sett opp din side',
  'Apply system updates' => 'Foreta systemoppdateringer',
  'Extensions' => 'Utvidelser',
  'Uploaded file invalid. (%s)' => 'Opplastet fil er ugyldig. (%s)',
  'Forgot Password' => 'Glemt passord',
  'Unable to send verification link.' => 'Ikke mulig å sende verifikasjonslenken.',
  'Sub Items' => 'Underelement',
  'Your database is up to date.' => 'Din database er oppdatert.',
  'User Registration' => 'Brukerregistrering',
  'TLS' => 'TLS',
  'Invalid key.' => 'Ugyldig nøkkel.',
  'Favicon' => 'Favikon',
  'Name cannot be blank.' => 'Navn kan ikke stå tomt.',
  'Roles' => 'Roller',
  'Connection not established! (%s)' => 'Tilkobling ikke etablert! (%s)',
  'Reset password' => 'Tilbakestill passord',
  'Database' => 'Database',
  'Imperial' => 'Imperial',
  'Activate Account' => 'Aktiver konto',
  'Menu' => 'Meny',
  'Message' => 'Beskjed',
  'Add Widget' => 'Ny modul',
  'None' => 'Ingen',
  'Visit Site' => 'Besøk side',
  'Testemail' => 'Test e-post',
  'URL' => 'URL',
  'Depth' => 'Dybde',
  'Invalid name.' => 'Ugyldig navn.',
  'Selected' => 'Valgt',
  'Request password' => 'Be om passord',
  'Thank you for signing up for %site%. Just one more step! Please click the button below to activate your account.' => 'Takk for at du registrerte deg på %site%. Klikk på knappen nedenfor for å aktivere din konto.',
  'Site Locale' => 'Side lokalisering',
  'Session expired. Please log in again.' => 'Sesjon utløpt. Vennligst logg inn igjen.',
  '"%title%" enabled.' => '"%title%" aktivert.',
  '"%name%" has not been loaded.' => '"%name%" har ikke blitt lastet inn.',
  4 => '4',
  'Type' => 'Type',
  'Manage extensions' => 'Administrere utvidelser',
  'Your account has been activated.' => 'Din konto har blitt aktivert.',
  'Disable cache' => 'Deaktiver hurtiglager',
  'Can\'t load json file from package.' => 'Kan ikke laste json fil fra pakke.',
  'Manage widgets' => 'Administrere moduler',
  'Hi %name%!' => 'Hei %name%!',
  'Menu Title' => 'Menytittel',
  'Total Users' => 'Totalt antall brukere',
  'Email address is invalid.' => 'Ugyldig e-post.',
  'Logout Redirect' => 'Logg ut videresending',
  9 => '9',
  'No pages found.' => 'Ingen sider funnet.',
  'Cache' => 'Hurtiglager',
  'Pagekit %version% is available.' => 'Pagekit %version% er tilgjengelig.',
  'Choose a title and create the administrator account.' => 'Velg en tittel og opprett administratorkontoen.',
  'Database Name' => 'Database navn',
  'Number of Posts' => 'Antall innlegg',
  'All' => 'Alle',
  'Already have an account?' => 'Har du allerede en konto?',
  'Please enable the SQLite database extension.' => 'Vennligst aktiver SQLite database utvidelsen.',
  'Enabled, but approval is required.' => 'Aktivert, men godkjenning kreves.',
  'Description' => 'Beskrivelse',
  'Logged in' => 'Innlogget',
  'Unknown' => 'Ukjent',
  'You have the latest version of Pagekit. You do not need to update. However, if you want to re-install version %version%, you can download the package and re-install manually.' => 'Du har siste versjon av Pagekit. Du trenger ikke å oppdatere. Om du vil reinstallere versjon %version%, kan du eller laste ned pakken og reinstallere den manuelt.',
  'Reset' => 'Nullstill',
  'Height' => 'Høyde',
  'Pagekit Version' => 'Pagekit versjon',
  'A new user signed up for %site% with the username %username%. Please click the button below to approve the account.' => 'En ny bruker har registrert seg på %site% med brukernavnet %username%. Klikk på knappen nedenfor for å godkjenne kontoen.',
  'Dashboard' => 'Dashbord',
  'Widget deleted.' => 'Modul slettet.',
  'Access admin area' => 'Tilgang til adminområdet',
  'New Password' => 'Nytt passord',
  'Unable to rename.' => 'Kunne ikke endre navn.',
  'Change password' => 'Endre passord',
  'password' => 'passord',
  'PHP Mailer' => 'PHP Mailer',
  3 => '3',
  'There is an update available for the package.' => 'En oppdatering er tilgjengelig for denne pakken.',
  'Select Cache to Clear' => 'Velg hurtiglager som skal tømmes',
  'Add User' => 'Lag ny bruker',
  '(Currently set to: %menu%)' => '(Foreløpig satt til: %menu%)',
  'Pages' => 'Sider',
  '%d TB' => '%d TB',
  'Mail' => 'E-post',
  '{0} %count% Users|{1} %count% User|]1,Inf[ %count% Users' => '{0} %count% brukere|{1} %count% bruker|]1,Inf[ %count% brukere',
  'Invalid id.' => 'Ugyldig ID.',
  'Upload' => 'Last opp',
  'Logout' => 'Logg ut',
  '- Menu -' => '- Meny -',
  'Storage' => 'Lagring',
  '{1} %count% Widget moved|]1,Inf[ %count% Widgets moved' => '{1} %count% modul flyttet|]1,Inf[ %count% moduler flyttet',
  'User Logout' => 'Bruker utlogging',
  1 => '1',
  'Reset Password' => 'Tilbakestill passord',
  'Duplicate Menu Id.' => 'Meny ID er duplikat.',
  'Email:' => 'E-post:',
  'Enable debug mode' => 'Aktiver feilsøkingsmodus',
  'Invalid file name.' => 'Ugyldig filnavn.',
  'Your account has not been activated.' => 'Din konto har ikke blitt aktivert.',
  'Hide' => 'Skjul',
  'No theme found.' => 'Ingen mal funnet.',
  'There is an update available.' => 'En oppdatering er tilgjengelig.',
  'Installing %title% %version%' => 'Installerer %title% %version%',
  'Connection established!' => 'Tilkobling etablert!',
  'Settings' => 'Innstillinger',
  'Image' => 'Bilde',
  'Request Password' => 'Be om passord',
  'Slug' => 'Permalenke',
  'Renamed.' => 'Navn endret.',
  'Url' => 'Lenke',
  'No Pagekit %type%' => 'Ingen Pagekit %type%',
  'Hidden' => 'Skjult',
  'Select Link' => 'Velg lenke',
  'Display' => 'Vis',
  'Show all' => 'Vis alle',
  'Title cannot be blank.' => 'Tittelen kan ikke være tom.',
  'User cannot be blank.' => 'Bruker kan ikke stå tomt.',
  'No Frontpage assigned.' => 'Ingen forside angitt.',
  'Name required.' => 'Navn kreves.',
  'Select Image' => 'Velg bilde',
  'Password must be 6 characters or longer.' => 'Passordet må være minst 6 tegn eller lengre.',
  'Table Prefix' => 'Tabellprefiks',
  'Node not found.' => 'Finner ikke node.',
  'Send Test Email' => 'Send test e-post',
  'Driver' => 'Database',
  'Muted' => 'Dempet',
  'Last login' => 'Sist innlogget',
  'Choose language' => 'Velg språk',
  'We got a request to reset your %site% password for %username%. If you ignore this message, your password won\'t be changed.' => 'Vi fikk en forespørsel om å nullstille ditt %site% passord for %username%. Hvis du ignorerer denne meldingen, vil ikke passordet endres.',
  'Invalid slug.' => 'Ugyldig slug.',
  'Setting' => 'Instilling',
  'No file uploaded.' => 'Ingen fil lastet opp.',
  'Prefix must start with a letter and can only contain alphanumeric characters (A-Z, 0-9) and underscore (_)' => 'Prefikset må starte med en bokstav og kan bare inneholde alfanumeriske tegn (A-Z, 0-9) og understrek (_)',
  'Close' => 'Lukk',
  'Latest logged in Users' => 'Siste innlogget bruker',
  'List' => 'Liste',
  'Invalid token. Please try again.' => 'Ugyldig token. Vennligst prøv igjen.',
  'Homepage:' => 'Hjemmeside:',
  'Login Now' => 'Logg inn nå',
  'Connect database' => 'Koble til database',
  'Show on all posts' => 'Vis på alle innlegg',
  'You may not call this step directly.' => 'Du kan ikke kontakte dette steget direkte.',
  'Folder already exists.' => 'Mappen finnes allerede.',
  'Use the site in maintenance mode' => 'Aktiver vedlikeholdsmodus',
  'Successfully removed.' => 'Fjernet.',
  'Access' => 'Tilgang',
  '{0} Registered Users|{1} Registered User|]1,Inf[ Registered Users' => '{0} Ingen registrerte brukere|\\{1} registrert bruker]1,Inf[ registrerte brukere',
  'Version %version%' => 'Versjon %version%',
  'Client' => 'Klient',
  'Enter a valid email address.' => 'Skriv inn en gyldig e-post adresse.',
  'Folder Name' => 'Mappenavn',
  'Enter password.' => 'Skriv passord.',
  'Unassigned' => 'Ikke tildelt',
  'Password' => 'Passord',
  'Loop' => 'Loop',
  'Installed' => 'Installert',
  '_subset' => '_subset',
  'Your account has not been activated or is blocked.' => 'Din knoto har ikke blitt aktivert eller er blokkert.',
  'Cannot obtain versions. Please try again later.' => 'Klarer ikke å laste ned versjoner. Prøv igjen senere.',
  100 => '100',
  'Invalid path.' => 'Ugyldig sti.',
  'Your account is blocked.' => 'Din konto har blitt blokkert.',
  'Thumbnail' => 'Miniatyrbilde',
  'Your Pagekit database has been updated successfully.' => 'Din Pagekit database har blitt oppdatert.',
  'Whoops, something went wrong.' => 'Beklager, noe har gått galt.',
  'Widgets reordered.' => 'Moduler er sortert.',
  'Password required.' => 'Passord kreves.',
  'Manage themes' => 'Administrere maler',
  'Enable Markdown' => 'Aktiver markdown',
  '%d  MB' => '%d  MB',
  'Temporary Files' => 'Midlertidige filer',
  'Mail delivery failed! (%s)' => 'E-post sending feilet! (%s)',
  'Username cannot be blank and may only contain alphanumeric characters (A-Z, 0-9) and some special characters ("._-")' => 'Brukernavnet kan ikke være tomt og kan bare inneholde alfanumeriske tegn (A-Z, 0-9) og noen spesielle tegn ("._-")',
  'Error' => 'Feil',
  'Please enter your email address. You will receive a link to create a new password via email.' => 'Skriv inn din e-post. Du vil motta en lenke for å skape nytt passord på denne.',
  40 => '40',
  '%d PB' => '%d PB',
  'Web Server' => 'Web server',
  'Hello!' => 'Hallo!',
  'Link' => 'Lenk',
  'Restrict Access' => 'Begrens tilgang',
  'Trash' => 'Papirkurv',
  'Password Confirmation' => 'Bekreft passord',
  33 => '33',
  'Email is invalid.' => 'Ugyldig e-post.',
  'SMTP Mailer' => 'SMTP Mailer',
  'Unit' => 'Enhet',
  'Disabled' => 'Deaktivert',
  'Email not available.' => 'E-posten er ikke tilgjengelig.',
  '%d  KB' => '%d  KB',
  'No account yet?' => 'Ingen konto ennå?',
  'Account activation' => 'Konto aktivering',
  'Add Page' => 'Legg til side',
  'Host cannot be blank.' => 'Vertsnavn kan ikke stå tomt.',
  'Test email!' => 'Test e-post!',
  'Manage user permissions' => 'Administrere brukerrettigheter',
  'Database error: %error%' => 'Database feil: %error%',
  'SMTP Encryption' => 'SMTP kryptering',
  '{1} %count% User selected|]1,Inf[ %count% Users selected' => '{1} %count% bruker valgt|]1,Inf[ %count% brukere valgt',
  'Field must be a valid email address.' => 'Feltet må være en e-post adresse.',
  'Approve Account' => 'Godkjenn konto',
  'Complete your registration by clicking the link provided in the mail that has been sent to you.' => 'Fullfør din registrering ved å klikke på lenken i e-posten vi har sendt deg.',
  'Order saved.' => 'Rekkefølge lagret.',
  'Download %version%' => 'Last ned %version%',
  'Unwritable' => 'Skrivebeskyttet',
  'Title' => 'Tittel',
  'Sign in to your account' => 'Logg inn på din konto',
  'Create an account' => 'Opprett en konto',
  'User' => 'Bruker',
  'Password cannot be blank.' => 'Passord kan ikke stå tomt.',
  'Autoplay' => 'Autostart',
  'Position' => 'Posisjon',
  'Start Level' => 'Start nivå',
  'SMTP Host' => 'SMPT',
  'Retry' => 'Prøv igjen',
  'n/a' => 'n/a',
  'SMTP Port' => 'SMTP port',
  'Login' => 'Logg inn',
  'Home' => 'Hjem',
  'Reset Confirm' => 'Godkjenn nullstilling',
  'Enabled' => 'Aktivert',
  'Unable to find "%name%".' => 'Kunne ikke finne "%name%".',
  'No widgets found.' => 'Finner ingen moduler.',
  'Themes' => 'Temaer',
  '%d Bytes' => '%d Bytes',
  'Unable to block yourself.' => 'Du kan ikke blokkere din bruker.',
  'You do not have access to the administration area of this site.' => 'Du har ikke tilgang til administrasjonsområdet på denne siden.',
  '{0} %count% Files|{1} %count% File|]1,Inf[ %count% Files' => '{0} %count% filer|{1} %count% fil|]1,Inf[ %count% filer',
  'No location found.' => 'Ingen plassering funnet.',
  'No URL given.' => 'Ingen lenke skrevet inn.',
  5 => '5',
  'Access system settings' => 'Tilgang til systemvalg',
  'Folder' => 'Mappe',
  'Check your email for the confirmation link.' => 'Sjekk din e-post for godkjenningslenken.',
  'Enable debug toolbar' => 'Aktiver feilsøkings verktøylinje',
  'Save' => 'Lagre',
  'We\'ll be back soon.' => 'Vi kommer snart tilbake.',
  'Menus' => 'Menyer',
  'Cancel' => 'Avbryt',
  15 => '15',
  'Select Video' => 'Velg video',
  'Version' => 'Versjon',
  'Database connection failed!' => 'Klarer ikke å koble til database!',
  'Current Password' => 'Nåværende passord',
  'Number of Users' => 'Antall brukere',
  'Directory created.' => 'Mappe opprettet.',
  'Alt' => 'Alt',
  'Enter your database connection details.' => 'Skriv inn detaljer for å koble til database',
  'Writable' => 'Skrivbar',
  'Active' => 'Aktiv',
  'Add Role' => 'Lag ny rolle',
  'Support' => 'Hjelp',
  'Registered since' => 'Registrert siden',
  'Manage menus' => 'Administrere menyer',
  'Successfully installed.' => 'Installert.',
  'Admin Locale' => 'Admin lokalisering',
  'Removing %title% %version%' => 'Fjerner %title% %version%',
  'Menu Positions' => 'Meny posisjoner',
  'The user\'s account has been activated and the user has been notified about it.' => 'Brukerens konto har blitt aktivert og brukeren har blitt notifisert.',
  'Marketplace' => 'Marketplace',
  '%d  GB' => '%d  GB',
  '{1} %count% Widget selected|]1,Inf[ %count% Widgets selected' => '{1} %count% modul valgt|]1,Inf[ %count% moduler valgt',
  'Invalid password.' => 'Ugyldig passord.',
  'Edit %type%' => 'Rediger %type%',
  'From Email' => 'Fra e-post',
  'Put the site offline and show the offline message.' => 'Sett nettsiden i vedlikeholdsmodus og for å vise vedlikeholdsbeskjeder.',
  'Cannot connect to the marketplace. Please try again later.' => 'Kunne ikke koble til Marketplace. Vennligst prøv igjen senere.',
  'Insufficient User Rights.' => 'Ikke tilstrekkelig brukerrettigheter.',
  'Copy' => 'Kopier',
  'Upload complete.' => 'Opplasting fullført.',
  'Clear' => 'Tøm',
  'Documentation' => 'Dokumentasjon',
  'Invalid Email.' => 'Ugyldig e-post.',
  'Extension' => 'Utvidelse',
  'Widgets' => 'Moduler',
  'Pages moved to %menu%.' => 'Sider flyttet til %menu%.',
  'Database access denied!' => 'Ikke tilgang til database!',
  'Controls' => 'Kontroller',
  'Slow down a bit.' => 'Ta det litt med ro.',
  'Require e-mail verification when a guest creates an account.' => 'Krev e-post verifisering når en gjest lager ny konto.',
  '%d ZB' => '%d ZB',
  'Manage users' => 'Administrere brukere',
  'Pagekit Installer' => 'Pagekit installasjon',
  '%d YB' => '%d YB',
  'Login!' => 'Logg inn!',
  '\'composer.json\' is missing.' => '\'composer.json\' finnes ikke.',
  'Clear Cache' => 'Tøm hurtiglager',
  'PHP' => 'PHP',
  'Show' => 'Vis',
  'SMTP Password' => 'SMTP passord',
  'No extension found.' => 'Ingen utvidelser funnet.',
  'Invalid username or password.' => 'Ugyldig brukernavn eller passord.',
  'Location' => 'Plassering',
  'Header' => 'Topptekst (header)',
  'Sign up now' => 'Registrer deg nå',
  'Users' => 'Brukere',
  'Hi %username%' => 'Hei %username%',
  'URL Alias' => 'Lenke alias',
  50 => '50',
  'Filter by' => 'Filtrer etter',
  'Username not available.' => 'Brukernavnet er ikke tilgjengelig.',
  'Add Video' => 'Legg til video',
  'Existing Pagekit installation detected. Choose different table prefix?' => 'Eksisterende Pagekit installasjon oppdaget. Velge annen tabellprefiks?',
  'View' => 'Vis',
  'Login Redirect' => 'Innloggins videresending',
  'General' => 'Generell',
  'Pagekit has been updated! Before we send you on your way, we have to update your database to the newest version.' => 'Pagekit har blitt oppdatert! Før vi sender deg på din vei, oppdaterer vi din database til nyeste versjon.',
  '%d EB' => '%d EB',
  6 => '6',
  '- Assign -' => '- Tildel -',
  'Hostname' => 'Vertsnavn',
  'Unable to enable "%name%".' => 'Kunne ikke aktivere "%name%".',
  'Mailer' => 'Mailer',
  'User not found.' => 'Finner ikke bruker.',
  'Unable to retrieve feed data.' => 'Kunne ikke hente data fra feeden.',
  'Permission denied.' => 'Tilgang nektet.',
  'Username is invalid.' => 'Ugyldig brukernavn.',
  'We\'re really happy to have you, %name%! Just login with the username %username%.' => 'Vi er glad for å ha deg med, %name%! Logg inn med brukernavnet %username%.',
  'Your email has been verified. Once an administrator approves your account, you will be notified by email.' => 'Din e-post har blitt godkjent. Du vil få en ny e-post så snart en administrator godkjenner kontoen din.',
  20 => '20',
  'Package path is missing.' => 'Pakkestien finnes ikke.',
  'No files uploaded.' => 'Ingen filer er opplastet.',
  'User Type' => 'Brukertype',
  'Unable to delete yourself.' => 'Du kan ikke slette din bruker.',
  'User Agent' => 'Brukeragent',
  8 => '8',
  'Ok' => 'Ok',
  'No files found.' => 'Ingen filer funnet.',
  'Activate your %site% account.' => 'Aktiver din %site% konto.',
  'Size' => 'Størrelse',
  '"composer.json" file not valid.' => '"composer.json" fil er ugyldig.',
  'License:' => 'Lisens:',
  'Unable to create directory.' => 'Kunne ikke opprette mappe.',
  'Blocked' => 'Blokkert',
  'Add Link' => 'Legg til lenke',
  'Metric' => 'Metrisk',
  'Only show on first post.' => 'Vis kun på det første innlegget',
  'Sign up' => 'Registrer deg',
  '"%title%" disabled.' => '"%title%" deaktivert.',
  'Reset password for %site%.' => 'Nullstill passord for %site%.',
  10 => '10',
  'Add Image' => 'Legg til bilde',
  'Post Content' => 'Post innhold',
  'Unknown email address.' => 'Ugyldig e-post adresse.',
  'Site Title' => 'Sidetittel',
  'Registration' => 'Registrering',
  'Mail successfully sent!' => 'E-post er sendt!',
  'Status' => 'Status',
  'Maintenance' => 'Vedlikehold',
  'Built On' => 'Kompilert på',
  'User Password Reset' => 'Brukerpassord tilbakestilling',
  'Meta' => 'Meta',
  'username' => 'brukernavn',
  'Localization' => 'Lokalisering',
  'Unable to activate "%name%".<br>A fatal error occured.' => 'Ikke mulig å aktivere "%name%".<br>En feil har oppstått.',
  'Invalid node type.' => 'Ugyldig nodetype.',
  '{1} %count% File selected|]1,Inf[ %count% Files selected' => '{1} %count% fil valgt|]1,Inf[ %count% filer valgt',
  'Demo' => 'Demo',
  'Select' => 'Velg',
  'Sign in' => 'Logg inn',
  'Installation failed!' => 'Installasjonen feilet!',
  '%type% saved.' => '%type% lagret.',
  'Unable to send confirmation link.' => 'Ikke mulig å sende godkjenningslenken.',
  'Footer' => 'Bunntekst (footer)',
  'Update Pagekit' => 'Oppdater Pagekit',
  'From Name' => 'Fra navn',
  'You have the latest version of Pagekit.' => 'Du har den seneste utgaven av Pagekit.',
  'Your password has been reset.' => 'Ditt passord har blitt nullstilt.',
  'No database connection.' => 'Ingen tilkobling til database.',
  'Your user account has been created.' => 'Din konto har blitt opprettet.',
  'Appicon' => 'Appikon',
  'Your Profile' => 'Din profil',
  'File' => 'Fil',
  'SSL' => 'SSL',
  'User Profile' => 'Brukerprofil',
  'Select your site language.' => 'Velg språk for siden.',
  'Can\'t write config.' => 'Kan ikke skrive konfigurasjon.',
  'Insert code in the header and footer of your theme. This is useful for tracking codes and meta tags.' => 'Sett kode i topp- og bunnteksten av malen. Dette er nyttig for sporingskoder og metakoder.',
  'Width' => 'Bredde',
  'Site title cannot be blank.' => 'Sidetittelen kan ikke være tom.',
  '{0} Logged in Users|{1} Logged in User|]1,Inf[ Logged in Users' => '{0} Ingen innloggede brukere|{1} Innlogget bruker|]1,Inf[ Innloggede brukere',
  'Show only for active item' => 'Vis kun for aktive elementer',
  'Verification' => 'Verifisering',
  'Handler' => 'System',
  'Unauthorized' => 'Uautorisert',
  'Email' => 'E-post',
  'New' => 'Ny',
  'Forgot Password?' => 'Glemt passord?',
  'No user found.' => 'Fant ingen brukere.',
  'Mail delivery failed!' => 'E-post sending feilet!',
  'Add Menu' => 'Legg til meny',
  30 => '30',
  2 => '2',
  'Redirect' => 'Videresending',
  'Nothing found.' => 'Ingenting funnet',
  'System Cache' => 'System hurtiglager',
  'Edit User' => 'Rediger bruker',
  'Role not found.' => 'Finner ikke rolle.',
  'Edit Widget' => 'Rediger modul',
  'Name' => 'Navn',
  'Page not found.' => 'Side ikke funnet.',
  'Please enable the PHP Open SSL extension.' => 'Vennligst aktiver PHP Open SSL utvidelsen.',
);


text:
%% Machine Learning Online Class - Exercise 3 | Part 1: One-vs-all

%  Instructions
%  ------------
%
%  This file contains code that helps you get started on the
%  linear exercise. You will need to complete the following functions
%  in this exericse:
%
%     lrCostFunction.m (logistic regression cost function)
%     oneVsAll.m
%     predictOneVsAll.m
%     predict.m
%
%  For this exercise, you will not need to change any code in this file,
%  or any other files other than those mentioned above.
%

%% Initialization
clear ; close all; clc

%% Setup the parameters you will use for this part of the exercise
input_layer_size  = 400;  % 20x20 Input Images of Digits
num_labels = 10;          % 10 labels, from 1 to 10
                          % (note that we have mapped "0" to label 10)

%% =========== Part 1: Loading and Visualizing Data =============
%  We start the exercise by first loading and visualizing the dataset.
%  You will be working with a dataset that contains handwritten digits.
%

% Load Training Data
fprintf('Loading and Visualizing Data ...\n')

load('ex3data1.mat'); % training data stored in arrays X, y
m = size(X, 1);

% Randomly select 100 data points to display
rand_indices = randperm(m);
sel = X(rand_indices(1:100), :);

displayData(sel);

fprintf('Program paused. Press enter to continue.\n');
pause;

%% ============ Part 2: Vectorize Logistic Regression ============
%  In this part of the exercise, you will reuse your logistic regression
%  code from the last exercise. You task here is to make sure that your
%  regularized logistic regression implementation is vectorized. After
%  that, you will implement one-vs-all classification for the handwritten
%  digit dataset.
%

fprintf('\nTraining One-vs-All Logistic Regression...\n')

lambda = 0.5;
% Train on first t examples, then predict later rows(X)-t examples
t = 250;
num_samples_per_label = rows(X)/num_labels; % 500 images per digit
Xt = zeros(t*num_labels, columns(X));
yt = zeros(t*num_labels,1);
for i = 1:num_labels
    Xt((i-1)*t+1:i*t,:) = X(num_samples_per_label*(i-1)+1:num_samples_per_label*(i-1)+t,:);
    yt((i-1)*t+1:i*t,:) = y(num_samples_per_label*(i-1)+1:num_samples_per_label*(i-1)+t,:);

end
%Xt = X;
%yt = y;
[all_theta] = oneVsAll(Xt, yt, num_labels, lambda);

displayData(all_theta(:, 2:end));

fprintf('Program paused. Press enter to continue.\n');
pause;

%% ================ Part 3: Predict for One-Vs-All ================
%  After ...
remainder = num_samples_per_label - t;
Xremainder = zeros(remainder*num_labels, columns(X));
yremainder = zeros(remainder*num_labels, 1);
for i=1:num_labels
    Xremainder((i-1)*remainder+1:i*remainder,:) = X((i-1)*num_samples_per_label+1+t:i*num_samples_per_label,:);
    yremainder((i-1)*remainder+1:i*remainder,:) = y((i-1)*num_samples_per_label+1+t:i*num_samples_per_label,:);
end
%Xremainder = X;
%yremainder = y;

pred = predictOneVsAll(all_theta, Xremainder);

fprintf('\nTraining Set Accuracy: %f\n', mean(double(pred == yremainder)) * 100);


text:
package org.apache.pig;

import java.io.IOException;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.OutputFormat;
import org.apache.hadoop.mapreduce.RecordWriter;

import org.apache.pig.classification.InterfaceAudience;
import org.apache.pig.classification.InterfaceStability;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.util.UDFContext;

/**
* StoreFuncs take records from Pig's processing and store them into a data store.  Most frequently
* this is an HDFS file, but it could also be an HBase instance, RDBMS, etc.
*/
@InterfaceAudience.Public
@InterfaceStability.Stable
public interface StoreFuncInterface {

    /**
     * This method is called by the Pig runtime in the front end to convert the
     * output location to an absolute path if the location is relative. The
     * StoreFuncInterface implementation is free to choose how it converts a relative
     * location to an absolute location since this may depend on what the location
     * string represent (hdfs path or some other data source).
     * The static method {@link LoadFunc#getAbsolutePath} provides a default
     * implementation for hdfs and hadoop local file system and it can be used
     * to implement this method.
     *
     * @param location location as provided in the "store" statement of the script
     * @param curDir the current working direction based on any "cd" statements
     * in the script before the "store" statement. If there are no "cd" statements
     * in the script, this would be the home directory -
     * <pre>/user/<username> </pre>
     * @return the absolute location based on the arguments passed
     * @throws IOException if the conversion is not possible
     */
    String relToAbsPathForStoreLocation(String location, Path curDir) throws IOException;

    /**
     * Return the OutputFormat associated with StoreFuncInterface.  This will be called
     * on the front end during planning and on the backend during
     * execution.
     * @return the {@link OutputFormat} associated with StoreFuncInterface
     * @throws IOException if an exception occurs while constructing the
     * OutputFormat
     *
     */
    OutputFormat getOutputFormat() throws IOException;

    /**
     * Communicate to the storer the location where the data needs to be stored.
     * The location string passed to the {@link StoreFuncInterface} here is the
     * return value of {@link StoreFuncInterface#relToAbsPathForStoreLocation(String, Path)}
     * This method will be called in the frontend and backend multiple times. Implementations
     * should bear in mind that this method is called multiple times and should
     * ensure there are no inconsistent side effects due to the multiple calls.
     * {@link #checkSchema(ResourceSchema)} will be called before any call to
     * {@link #setStoreLocation(String, Job)}.
     *

     * @param location Location returned by
     * {@link StoreFuncInterface#relToAbsPathForStoreLocation(String, Path)}
     * @param job The {@link Job} object
     * @throws IOException if the location is not valid.
     */
    void setStoreLocation(String location, Job job) throws IOException;

    /**
     * Set the schema for data to be stored.  This will be called on the
     * front end during planning if the store is associated with a schema.
     * A Store function should implement this function to
     * check that a given schema is acceptable to it.  For example, it
     * can check that the correct partition keys are included;
     * a storage function to be written directly to an OutputFormat can
     * make sure the schema will translate in a well defined way.
     * @param s to be checked
     * @throws IOException if this schema is not acceptable.  It should include
     * a detailed error message indicating what is wrong with the schema.
     */
    void checkSchema(ResourceSchema s) throws IOException;

    /**
     * Initialize StoreFuncInterface to write data.  This will be called during
     * execution before the call to putNext.
     * @param writer RecordWriter to use.
     * @throws IOException if an exception occurs during initialization
     */
    void prepareToWrite(RecordWriter writer) throws IOException;

    /**
     * Write a tuple to the data store.
     * @param t the tuple to store.
     * @throws IOException if an exception occurs during the write
     */
    void putNext(Tuple t) throws IOException;

    /**
     * This method will be called by Pig both in the front end and back end to
     * pass a unique signature to the {@link StoreFuncInterface} which it can use to store
     * information in the {@link UDFContext} which it needs to store between
     * various method invocations in the front end and back end.  This is necessary
     * because in a Pig Latin script with multiple stores, the different
     * instances of store functions need to be able to find their (and only their)
     * data in the UDFContext object.
     * @param signature a unique signature to identify this StoreFuncInterface
     */
    public void setStoreFuncUDFContextSignature(String signature);

    /**
     * This method will be called by Pig if the job which contains this store
     * fails. Implementations can clean up output locations in this method to
     * ensure that no incorrect/incomplete results are left in the output location
     * @param location Location returned by
     * {@link StoreFuncInterface#relToAbsPathForStoreLocation(String, Path)}
     * @param job The {@link Job} object - this should be used only to obtain
     * cluster properties through {@link Job#getConfiguration()} and not to set/query
     * any runtime job information.
     */
    void cleanupOnFailure(String location, Job job) throws IOException;

    /**
     * This method will be called by Pig if the job which contains this store
     * is successful, and some cleanup of intermediate resources is required.
     * Implementations can clean up output locations in this method to
     * ensure that no incorrect/incomplete results are left in the output location
     * @param location Location returned by
     * {@link StoreFuncInterface#relToAbsPathForStoreLocation(String, Path)}
     * @param job The {@link Job} object - this should be used only to obtain
     * cluster properties through {@link Job#getConfiguration()} and not to set/query
     * any runtime job information.
     */
    void cleanupOnSuccess(String location, Job job) throws IOException;
}


text:
package com.aelns.dao;

import com.aelns.model.PlatformApplication;
import com.aelns.model.PlatformApplicationExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;

public interface PlatformApplicationMapper {
    int countByExample(PlatformApplicationExample example);

    int deleteByExample(PlatformApplicationExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(PlatformApplication record);

    int insertSelective(PlatformApplication record);

    List<PlatformApplication> selectByExample(PlatformApplicationExample example);

    PlatformApplication selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") PlatformApplication record, @Param("example") PlatformApplicationExample example);

    int updateByExample(@Param("record") PlatformApplication record, @Param("example") PlatformApplicationExample example);

    int updateByPrimaryKeySelective(PlatformApplication record);

    int updateByPrimaryKey(PlatformApplication record);
}