text:
package com.android.server.policy;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.XmlResourceParser;
import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;

import com.android.internal.util.XmlUtils;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;

/**
 * Manages quick launch shortcuts by:
 * <li> Keeping the local copy in sync with the database (this is an observer)
 * <li> Returning a shortcut-matching intent to clients
 */
class ShortcutManager {
    private static final String TAG = "ShortcutManager";

    private static final String TAG_BOOKMARKS = "bookmarks";
    private static final String TAG_BOOKMARK = "bookmark";

    private static final String ATTRIBUTE_PACKAGE = "package";
    private static final String ATTRIBUTE_CLASS = "class";
    private static final String ATTRIBUTE_SHORTCUT = "shortcut";
    private static final String ATTRIBUTE_CATEGORY = "category";
    private static final String ATTRIBUTE_SHIFT = "shift";

    private final SparseArray<ShortcutInfo> mShortcuts = new SparseArray<>();
    private final SparseArray<ShortcutInfo> mShiftShortcuts = new SparseArray<>();

    private final Context mContext;

    public ShortcutManager(Context context) {
        mContext = context;
        loadShortcuts();
    }

    /**
     * Gets the shortcut intent for a given keycode+modifier. Make sure you
     * strip whatever modifier is used for invoking shortcuts (for example,
     * if 'Sym+A' should invoke a shortcut on 'A', you should strip the
     * 'Sym' bit from the modifiers before calling this method.
     * <p>
     * This will first try an exact match (with modifiers), and then try a
     * match without modifiers (primary character on a key).
     *
     * @param kcm The key character map of the device on which the key was pressed.
     * @param keyCode The key code.
     * @param metaState The meta state, omitting any modifiers that were used
     * to invoke the shortcut.
     * @return The intent that matches the shortcut, or null if not found.
     */
    public Intent getIntent(KeyCharacterMap kcm, int keyCode, int metaState) {
        ShortcutInfo shortcut = null;

        // If the Shift key is pressed, then search for the shift shortcuts.
        boolean isShiftOn = (metaState & KeyEvent.META_SHIFT_ON) == KeyEvent.META_SHIFT_ON;
        SparseArray<ShortcutInfo> shortcutMap = isShiftOn ? mShiftShortcuts : mShortcuts;

        // First try the exact keycode (with modifiers).
        int shortcutChar = kcm.get(keyCode, metaState);
        if (shortcutChar != 0) {
            shortcut = shortcutMap.get(shortcutChar);
        }

        // Next try the primary character on that key.
        if (shortcut == null) {
            shortcutChar = Character.toLowerCase(kcm.getDisplayLabel(keyCode));
            if (shortcutChar != 0) {
                shortcut = shortcutMap.get(shortcutChar);
            }
        }

        return (shortcut != null) ? shortcut.intent : null;
    }

    private void loadShortcuts() {
        PackageManager packageManager = mContext.getPackageManager();
        try {
            XmlResourceParser parser = mContext.getResources().getXml(
                    com.android.internal.R.xml.bookmarks);
            XmlUtils.beginDocument(parser, TAG_BOOKMARKS);

            while (true) {
                XmlUtils.nextElement(parser);

                if (parser.getEventType() == XmlPullParser.END_DOCUMENT) {
                    break;
                }

                if (!TAG_BOOKMARK.equals(parser.getName())) {
                    break;
                }

                String packageName = parser.getAttributeValue(null, ATTRIBUTE_PACKAGE);
                String className = parser.getAttributeValue(null, ATTRIBUTE_CLASS);
                String shortcutName = parser.getAttributeValue(null, ATTRIBUTE_SHORTCUT);
                String categoryName = parser.getAttributeValue(null, ATTRIBUTE_CATEGORY);
                String shiftName = parser.getAttributeValue(null, ATTRIBUTE_SHIFT);

                if (TextUtils.isEmpty(shortcutName)) {
                    Log.w(TAG, "Unable to get shortcut for: " + packageName + "/" + className);
                    continue;
                }

                final int shortcutChar = shortcutName.charAt(0);
                final boolean isShiftShortcut = (shiftName != null && shiftName.equals("true"));

                final Intent intent;
                final String title;
                if (packageName != null && className != null) {
                    ActivityInfo info = null;
                    ComponentName componentName = new ComponentName(packageName, className);
                    try {
                        info = packageManager.getActivityInfo(componentName,
                                PackageManager.MATCH_DIRECT_BOOT_AWARE
                                        | PackageManager.MATCH_DIRECT_BOOT_UNAWARE
                                        | PackageManager.MATCH_UNINSTALLED_PACKAGES);
                    } catch (PackageManager.NameNotFoundException e) {
                        String[] packages = packageManager.canonicalToCurrentPackageNames(
                                new String[] { packageName });
                        componentName = new ComponentName(packages[0], className);
                        try {
                            info = packageManager.getActivityInfo(componentName,
                                    PackageManager.MATCH_DIRECT_BOOT_AWARE
                                            | PackageManager.MATCH_DIRECT_BOOT_UNAWARE
                                            | PackageManager.MATCH_UNINSTALLED_PACKAGES);
                        } catch (PackageManager.NameNotFoundException e1) {
                            Log.w(TAG, "Unable to add bookmark: " + packageName
                                    + "/" + className, e);
                            continue;
                        }
                    }

                    intent = new Intent(Intent.ACTION_MAIN);
                    intent.addCategory(Intent.CATEGORY_LAUNCHER);
                    intent.setComponent(componentName);
                    title = info.loadLabel(packageManager).toString();
                } else if (categoryName != null) {
                    intent = Intent.makeMainSelectorActivity(Intent.ACTION_MAIN, categoryName);
                    title = "";
                } else {
                    Log.w(TAG, "Unable to add bookmark for shortcut " + shortcutName
                            + ": missing package/class or category attributes");
                    continue;
                }

                ShortcutInfo shortcut = new ShortcutInfo(title, intent);
                if (isShiftShortcut) {
                    mShiftShortcuts.put(shortcutChar, shortcut);
                } else {
                    mShortcuts.put(shortcutChar, shortcut);
                }
            }
        } catch (XmlPullParserException e) {
            Log.w(TAG, "Got exception parsing bookmarks.", e);
        } catch (IOException e) {
            Log.w(TAG, "Got exception parsing bookmarks.", e);
        }
    }

    private static final class ShortcutInfo {
        public final String title;
        public final Intent intent;

        public ShortcutInfo(String title, Intent intent) {
            this.title = title;
            this.intent = intent;
        }
    }
}


text:
#ifndef JSFunction_h
#define JSFunction_h

#include "InternalFunction.h"

namespace JSC {

    class ExecutableBase;
    class FunctionExecutable;
    class FunctionPrototype;
    class JSActivation;
    class JSGlobalObject;

    class JSFunction : public InternalFunction {
        friend class JIT;
        friend class JSGlobalData;

        typedef InternalFunction Base;

    public:
        JSFunction(ExecState*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeFunction);
        JSFunction(ExecState*, NonNullPassRefPtr<FunctionExecutable>, ScopeChainNode*);
        virtual ~JSFunction();

        JSObject* construct(ExecState*, const ArgList&);
        JSValue call(ExecState*, JSValue thisValue, const ArgList&);

        void setScope(const ScopeChain& scopeChain) { setScopeChain(scopeChain); }
        ScopeChain& scope() { return scopeChain(); }

        ExecutableBase* executable() const { return m_executable.get(); }

        // To call either of these methods include Executable.h
        inline bool isHostFunction() const;
        FunctionExecutable* jsExecutable() const;

        static JS_EXPORTDATA const ClassInfo info;

        static PassRefPtr<Structure> createStructure(JSValue prototype)
        {
            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
        }

        NativeFunction nativeFunction()
        {
            return *WTF::bitwise_cast<NativeFunction*>(m_data);
        }

        virtual ConstructType getConstructData(ConstructData&);
        virtual CallType getCallData(CallData&);

    protected:
        const static unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames | InternalFunction::StructureFlags;

    private:
        JSFunction(NonNullPassRefPtr<Structure>);

        bool isHostFunctionNonInline() const;

        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
        virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
        virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
        virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
        virtual bool deleteProperty(ExecState*, const Identifier& propertyName);

        virtual void markChildren(MarkStack&);

        virtual const ClassInfo* classInfo() const { return &info; }

        static JSValue argumentsGetter(ExecState*, const Identifier&, const PropertySlot&);
        static JSValue callerGetter(ExecState*, const Identifier&, const PropertySlot&);
        static JSValue lengthGetter(ExecState*, const Identifier&, const PropertySlot&);

        RefPtr<ExecutableBase> m_executable;
        ScopeChain& scopeChain()
        {
            ASSERT(!isHostFunctionNonInline());
            return *WTF::bitwise_cast<ScopeChain*>(m_data);
        }
        void clearScopeChain()
        {
            ASSERT(!isHostFunctionNonInline());
            new (m_data) ScopeChain(NoScopeChain());
        }
        void setScopeChain(ScopeChainNode* sc)
        {
            ASSERT(!isHostFunctionNonInline());
            new (m_data) ScopeChain(sc);
        }
        void setScopeChain(const ScopeChain& sc)
        {
            ASSERT(!isHostFunctionNonInline());
            *WTF::bitwise_cast<ScopeChain*>(m_data) = sc;
        }
        void setNativeFunction(NativeFunction func)
        {
            *WTF::bitwise_cast<NativeFunction*>(m_data) = func;
        }
        unsigned char m_data[sizeof(void*)];
    };

    JSFunction* asFunction(JSValue);

    inline JSFunction* asFunction(JSValue value)
    {
        ASSERT(asObject(value)->inherits(&JSFunction::info));
        return static_cast<JSFunction*>(asObject(value));
    }

} // namespace JSC

#endif // JSFunction_h

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace DvsaCommonApiTest\Service\Exception;

use DvsaCommonApi\Service\Exception\BadRequestException;

/**
 * Class BadRequestExceptionTest.
 */
class BadRequestExceptionTest extends \PHPUnit\Framework\TestCase
{
    public function testConstructor()
    {
        $message = 'Invalid vehicle';
        $errorCode = 50;

        $errors = [[
            'message' => $message,
            'code' => $errorCode,
            'displayMessage' => $message,
        ]];

        $badRequestException = new BadRequestException($message, $errorCode);

        $this->assertEquals($message, $badRequestException->getMessage());
        $this->assertEquals(400, $badRequestException->getCode());
        $this->assertEquals($errors, $badRequestException->getErrors());
    }

    public function testConstructorThreeParams()
    {
        $message = 'Invalid vehicle';
        $errorCode = 50;
        $displayMessage = 'Invalid vehicle and color in bad taste';

        $errors = [[
            'message' => $message,
            'code' => $errorCode,
            'displayMessage' => $displayMessage,
        ]];

        $badRequestException = new BadRequestException($message, $errorCode, $displayMessage);

        $this->assertEquals($message, $badRequestException->getMessage());
        $this->assertEquals(400, $badRequestException->getCode());
        $this->assertEquals($errors, $badRequestException->getErrors());
    }
}


text:
import java.util.Collection;
import java.util.HashSet;
import org.omg.dds.core.InstanceHandle;
import org.omg.dds.core.ServiceEnvironment;
import org.omg.dds.core.policy.Durability;
import org.omg.dds.core.policy.Ownership;
import org.omg.dds.core.policy.OwnershipStrength;
import org.omg.dds.core.policy.Partition;
import org.omg.dds.core.policy.PolicyFactory;
import org.omg.dds.core.policy.Reliability;
import org.omg.dds.core.policy.WriterDataLifecycle;
import org.omg.dds.core.status.Status;
import org.omg.dds.domain.DomainParticipant;
import org.omg.dds.domain.DomainParticipantFactory;
import org.omg.dds.pub.DataWriter;
import org.omg.dds.pub.DataWriterQos;
import org.omg.dds.pub.Publisher;
import org.omg.dds.pub.PublisherQos;
import org.omg.dds.topic.Topic;
import org.omg.dds.topic.TopicQos;

import OwnershipData.Stock;

public class OwnershipDataPublisher {
	static String partitionName = "Ownership example";

	public static void main(String args[]) {
	    try {
    		if (args.length < 4) {
    			System.err
    					.println("*** [Publisher] usage : Publisher <publisher_name> <ownership_strength> <nb_iterations> <stop_subscriber_flag>");
    			System.exit(-1);
    		}

    		String publisher_name = args[0];
    		int ownership_strength = Integer.parseInt(args[1]);
    		int nb_iteration = Integer.parseInt(args[2]);
    		boolean stop_subscriber = (Integer.parseInt(args[3]) == 1);

    		System.setProperty(
                    ServiceEnvironment.IMPLEMENTATION_CLASS_NAME_PROPERTY,
                    "org.opensplice.dds.core.OsplServiceEnvironment");
    		ServiceEnvironment env = ServiceEnvironment
    		        .createInstance(OwnershipDataPublisher.class.getClassLoader());

    		DomainParticipantFactory dpf = DomainParticipantFactory.getInstance(env);

    		// create Domain Participant
    		DomainParticipant participant = dpf.createParticipant();

    		// create Topic with reliable, transient and ownership qos
    		PolicyFactory policyFactory = env.getSPI().getPolicyFactory();
    		Reliability reliable = policyFactory.Reliability().withReliable();
    		Durability durability = policyFactory.Durability().withTransient();
    		Ownership ownership = policyFactory.Ownership().withExclusive();
    		TopicQos topicQos = participant.getDefaultTopicQos().withPolicies(reliable,durability,ownership);
    		Collection<Class<? extends Status>> status = new HashSet<Class<? extends Status>>();
    		Topic<Stock> topic = participant.createTopic("OwnershipStockTracker", Stock.class,topicQos, null, status);

    		// create Publisher with partition qos
    		Partition partition = policyFactory.Partition().withName(partitionName);
    		PublisherQos pubQos = participant.getDefaultPublisherQos().withPolicy(partition);
    		Publisher pub = participant.createPublisher(pubQos);

    		// create DataWriter with autDisposeUnregisteredInstances qos
    		WriterDataLifecycle wdlq = policyFactory.WriterDataLifecycle().withAutDisposeUnregisteredInstances(false);
    		OwnershipStrength ownerShipStrength = policyFactory.OwnershipStrength().withValue(ownership_strength);
    		DataWriterQos dwQos = pub.copyFromTopicQos(pub.getDefaultDataWriterQos().withPolicies(wdlq,ownerShipStrength),topic.getQos());
    		DataWriter<Stock> writer = pub.createDataWriter(topic,dwQos);

    		Stock stock = new Stock();
            stock.ticker = "MSFT";
            stock.price = 0;
            stock.publisher = publisher_name;
            stock.strength = ownership_strength;
            InstanceHandle userHandle = writer.registerInstance(stock);

    		// Publisher publishes the prices in dollars
    		System.out.println("=== [Publisher] Publisher " + publisher_name + " with strength : " + ownership_strength);
    		System.out.println(" / sending " + nb_iteration + " prices ..." + " stop_subscriber flag=" + args[3]);
    		// The subscriber should display the prices sent by the publisher with
    		// the highest ownership strength
    		float price = 10.0f;
    		for (int x = 0; x < nb_iteration; x++) {
    			 stock.price = price;
    	         writer.write(stock, userHandle);
    			// Sleep(delay_200ms);
    			try {
    				Thread.sleep(200);// sleep for 200 ms
    			} catch (InterruptedException ie) {
    			}
    			price = price + 0.5f;
    		}
    		if (stop_subscriber) {
    			// send a price = -1 to stop subscriber
    			stock.price = -1.0f;
    			System.out.println("=== Stopping the subscriber");
    			writer.write(stock, userHandle);
    		}
    		// clean up
    		participant.close();
	    } catch(Exception e) {
            System.out.println("Error occured: " + e.getMessage());
            e.printStackTrace();
        }
	}
}


text:
<p id="harris_rayna" data-toggle="tooltip" title="">
    Rayna
    Harris is a graduate student at the University of Texas in
    Austin. She studies the neuromolecular basis of social behavior
    and is involved in several initiatives to enhance training in the
    life sciences.

    Instructor Trainer

    Steering Committee (2016 Member, 2017 Secretary)


text:
using System;
using System.Collections.Generic;
using System.IO;

namespace mzxrules.OcaLib.Cutscenes
{
    public abstract class CutsceneCommand
    {
        public Int32 Command { get; protected set; }
        public int Length { get { return GetLength(); } }

        protected CutsceneCommand(int command, BinaryReader br)
        {
            Command = command;
        }
        protected CutsceneCommand() { }

        public virtual string ReadCommand()
        {
            throw new InvalidOperationException();
        }

        protected virtual int GetLength()
        {
            throw new InvalidOperationException();
        }

        public virtual void Save(BinaryWriter bw)
        {
            throw new InvalidOperationException();
        }
    }
}


text:
callerSaves :: GlobalReg -> Bool
#ifdef CALLER_SAVES_Base
callerSaves BaseReg           = True
#endif
#ifdef CALLER_SAVES_R1
callerSaves (VanillaReg 1 _)  = True
#endif
#ifdef CALLER_SAVES_R2
callerSaves (VanillaReg 2 _)  = True
#endif
#ifdef CALLER_SAVES_R3
callerSaves (VanillaReg 3 _)  = True
#endif
#ifdef CALLER_SAVES_R4
callerSaves (VanillaReg 4 _)  = True
#endif
#ifdef CALLER_SAVES_R5
callerSaves (VanillaReg 5 _)  = True
#endif
#ifdef CALLER_SAVES_R6
callerSaves (VanillaReg 6 _)  = True
#endif
#ifdef CALLER_SAVES_R7
callerSaves (VanillaReg 7 _)  = True
#endif
#ifdef CALLER_SAVES_R8
callerSaves (VanillaReg 8 _)  = True
#endif
#ifdef CALLER_SAVES_R9
callerSaves (VanillaReg 9 _)  = True
#endif
#ifdef CALLER_SAVES_R10
callerSaves (VanillaReg 10 _) = True
#endif
#ifdef CALLER_SAVES_F1
callerSaves (FloatReg 1)      = True
#endif
#ifdef CALLER_SAVES_F2
callerSaves (FloatReg 2)      = True
#endif
#ifdef CALLER_SAVES_F3
callerSaves (FloatReg 3)      = True
#endif
#ifdef CALLER_SAVES_F4
callerSaves (FloatReg 4)      = True
#endif
#ifdef CALLER_SAVES_D1
callerSaves (DoubleReg 1)     = True
#endif
#ifdef CALLER_SAVES_D2
callerSaves (DoubleReg 2)     = True
#endif
#ifdef CALLER_SAVES_L1
callerSaves (LongReg 1)       = True
#endif
#ifdef CALLER_SAVES_Sp
callerSaves Sp                = True
#endif
#ifdef CALLER_SAVES_SpLim
callerSaves SpLim             = True
#endif
#ifdef CALLER_SAVES_Hp
callerSaves Hp                = True
#endif
#ifdef CALLER_SAVES_HpLim
callerSaves HpLim             = True
#endif
#ifdef CALLER_SAVES_CCCS
callerSaves CCCS              = True
#endif
#ifdef CALLER_SAVES_CurrentTSO
callerSaves CurrentTSO        = True
#endif
#ifdef CALLER_SAVES_CurrentNursery
callerSaves CurrentNursery    = True
#endif
callerSaves _                 = False

activeStgRegs :: [GlobalReg]
activeStgRegs = [
#ifdef REG_Base
    BaseReg
#endif
#ifdef REG_Sp
    ,Sp
#endif
#ifdef REG_Hp
    ,Hp
#endif
#ifdef REG_R1
    ,VanillaReg 1 VGcPtr
#endif
#ifdef REG_R2
    ,VanillaReg 2 VGcPtr
#endif
#ifdef REG_R3
    ,VanillaReg 3 VGcPtr
#endif
#ifdef REG_R4
    ,VanillaReg 4 VGcPtr
#endif
#ifdef REG_R5
    ,VanillaReg 5 VGcPtr
#endif
#ifdef REG_R6
    ,VanillaReg 6 VGcPtr
#endif
#ifdef REG_R7
    ,VanillaReg 7 VGcPtr
#endif
#ifdef REG_R8
    ,VanillaReg 8 VGcPtr
#endif
#ifdef REG_R9
    ,VanillaReg 9 VGcPtr
#endif
#ifdef REG_R10
    ,VanillaReg 10 VGcPtr
#endif
#ifdef REG_SpLim
    ,SpLim
#endif
#ifdef REG_F1
    ,FloatReg 1
#endif
#ifdef REG_F2
    ,FloatReg 2
#endif
#ifdef REG_F3
    ,FloatReg 3
#endif
#ifdef REG_F4
    ,FloatReg 4
#endif
#ifdef REG_D1
    ,DoubleReg 1
#endif
#ifdef REG_D2
    ,DoubleReg 2
#endif
    ]

haveRegBase :: Bool
#ifdef REG_Base
haveRegBase = True
#else
haveRegBase = False
#endif


text:
package org.mobop.flatseeker;

import android.app.Activity;
import android.content.Intent;
import android.support.v4.app.Fragment;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.CheckedTextView;
import android.widget.ExpandableListView;
import android.widget.TextView;
import android.widget.Toast;

import org.mobop.flatseeker.model.Flat;
import org.mobop.flatseeker.model.Model;
import org.mobop.flatseeker.model.Search;

import java.util.ArrayList;
import java.util.List;

/**
 * Flatseeker MobOp
 * HES-SO
 * Created by Gregori BURRI, Etienne FRANK on 02.11.2014.
 */
public class SearchExpandableListAdapter extends BaseExpandableListAdapter {

    public final static int TAG_NOTE = 1;

    final SparseArray<Search> groups;
    public LayoutInflater inflater;
    public Activity activity;
    ExpandableListView mExpandableList;

    Model model;
    ActualSearch actualSearch;

    public SearchExpandableListAdapter(Fragment act, SparseArray<Search> groups, Model model, ActualSearch actualSearch) {
        activity = act.getActivity();
        this.groups = groups;
        inflater = activity.getLayoutInflater();
        this.model = model;
        this.actualSearch = actualSearch;
    }

    @Override
    public Object getChild(int groupPosition, int childPosition) {
        return groups.get(groupPosition).getFlat(childPosition);
    }

    @Override
    public long getChildId(int groupPosition, int childPosition) {
        return 0;
    }

    @Override
    public View getChildView(int groupPosition, final int childPosition,
                             boolean isLastChild, View convertView, ViewGroup parent) {
        final Flat flat = (Flat) getChild(groupPosition, childPosition);
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.listrow_flat, null);
        }

        TextView streetTbx = (TextView) convertView.findViewById(R.id.search_row);
        streetTbx.setText(flat.street);
        TextView priceTbx = (TextView) convertView.findViewById(R.id.searchFlatPrice);
        priceTbx.setText(String.valueOf(flat.price) + " CHF");
        TextView roomTbx = (TextView) convertView.findViewById(R.id.searchFlatRoom);
        roomTbx.setText(String.valueOf(flat.numberOfRooms));
        TextView sizeRoom = (TextView) convertView.findViewById(R.id.searchFlatSize);
        sizeRoom.setText(String.valueOf(flat.size) + " m²");
        TextView number = (TextView) convertView.findViewById(R.id.searchFlatNumber);
        number.setText(String.valueOf(flat.number));
        TextView floor = (TextView) convertView.findViewById(R.id.searchFlatFloor);
        floor.setText(String.valueOf(flat.floor));
        TextView estateAgent = (TextView) convertView.findViewById(R.id.searchFlatEstateAgent);
        estateAgent.setText(String.valueOf(flat.estateAgent));
        TextView contact = (TextView) convertView.findViewById(R.id.searchFlatContact);
        if (flat.contact==null||flat.contact.trim().isEmpty()){
            contact.setText("-".intern());
        }else {
            contact.setText(String.valueOf(flat.contact));
        }
        TextView note = (TextView) convertView.findViewById(R.id.searchFlatNote);
        if (flat.getNote()==null||flat.getNote().trim().isEmpty()){
            note.setText("-".intern());
        }else {
            note.setText(String.valueOf(flat.getNote()));
        }

        //start note activity
        convertView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(activity, NoteActivity.class);
                intent.putExtra(NoteActivity.NOTE_FLAT, (android.os.Parcelable) flat);
                activity.startActivityForResult(intent, TAG_NOTE);
            }
        });
        return convertView;
    }

    @Override
    public int getChildrenCount(int groupPosition) {
        return groups.get(groupPosition).getResult().size();
    }

    @Override
    public Object getGroup(int groupPosition) {
        return groups.get(groupPosition);
    }

    @Override
    public int getGroupCount() {
        return groups.size();
    }

    @Override
    public void onGroupCollapsed(int groupPosition) {
        super.onGroupCollapsed(groupPosition);

        if (groupPosition == actualSearch.get()) {
            actualSearch.set(-1);
        }
    }

    @Override
    public void onGroupExpanded(int groupPosition) {
        super.onGroupExpanded(groupPosition);

        if (actualSearch.get() != -1) {
            mExpandableList.collapseGroup(actualSearch.get());
        }
        actualSearch.set(groupPosition);

        List<Search> l = new ArrayList<Search>(model.getSearches());
        if (groupPosition < l.size() && l.get(groupPosition).getResult().isEmpty()) {
            Toast.makeText(activity, "No flat for this search. Delete it or modify it.", Toast.LENGTH_LONG).show();
        }
    }

    @Override
    public long getGroupId(int groupPosition) {
        return 0;
    }

    @Override
    public View getGroupView(int groupPosition, boolean isExpanded,
                             View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.listrow_search, null);
        }
        Search group = (Search) getGroup(groupPosition);
        ((CheckedTextView) convertView).setText(group.getParams().city);
        ((CheckedTextView) convertView).setChecked(isExpanded);
        mExpandableList = (ExpandableListView) activity.findViewById(R.id.listView);
        return convertView;
    }

    @Override
    public boolean hasStableIds() {
        return false;
    }

    @Override
    public boolean isChildSelectable(int groupPosition, int childPosition) {
        return false;
    }
}


text:
#ifdef max
#undef max
#endif

#define max(a,b) (((a)>(b))?(a):(b))

#ifdef min
#undef min
#endif

#define min(a,b) (((a)<(b))?(a):(b))

#define FORWARD 1
#define INVERSE 0
#define MAX_FFT_SIZE 4096
#define MAX_PAINT 5000
#define MAXNOD 800

#define fvec(name, size)\
if ((name=(double *)calloc(size, sizeof(double)))==NULL) {\
  printf("Insufficient memory\n");\
}
#define ffvec(name, size)\
if ((name=(float *)calloc(size, sizeof(float)))==NULL) {\
  printf("Insufficient memory\n");\
}
#define LSIZE 512
#define FLUSH_LIST(list, count, showGC, theGC)        \
          XDrawPoints(theDisplay,XtWindow(sketchpad),showGC,list,count, \
	    CoordModeOrigin);       \
          XDrawPoints(theDisplay,bitmap,theGC,list,count,     \
	    CoordModeOrigin);       \
        count=0

#define ADD_POINT(xx, yy, list, count, showGC, theGC) \
      list[count].x = xx;     \
      list[count].y = yy;     \
      if (++(count)==LSIZE) { \
              FLUSH_LIST(list,count,showGC,theGC);    \
      }

#if 0
#define ADD_POINT2(xx,yy,theGC) \
          XDrawPoint(theDisplay,XtWindow(sketchpad),theGC,xx,yy); \
          XDrawPoint(theDisplay,bitmap,theGC,xx,yy)

#undef ADD_POINT
#define ADD_POINT(xx,yy,list,count,showGC,theGC) ADD_POINT2(xx,yy,theGC)
#undef FLUSH_LIST
#define FLUSH_LIST /* */
#endif

#define Pi 3.141592654
#define TwoPi 6.2831853


text: int f(enum shapes shape);


text:
import java.awt.Graphics;
import javax.swing.plaf.metal.MetalTabbedPaneUI;

public class CustomTabbedPaneUI extends MetalTabbedPaneUI {

    @Override
    protected void paintContentBorderTopEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) {}

    @Override
    protected void paintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) {}

    @Override
    protected void paintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) {}

    @Override
    protected void paintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) {}

    @Override
    protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex) {}

} // end class CustemTabberPaneUI


text:
/* eslint-disable */

import './motion'

var doc = window.document
var ua = window.navigator.userAgent
var scrollObjs = {}
var plugins = {}
var dpr = window.dpr
  || (!!window.navigator.userAgent.match(/iPhone|iPad|iPod/)
    ? document.documentElement.clientWidth / window.screen.availWidth
    : 1)
var inertiaCoefficient = {
  normal: [2 * dpr, 0.0015 * dpr],
  slow: [1.5 * dpr, 0.003 * dpr],
  veryslow: [1.5 * dpr, 0.005 * dpr]
}
var timeFunction = {
  ease: [.25,.1,.25,1],
  liner: [0,0,1,1],
  'ease-in': [.42,0,1,1],
  'ease-out': [0,0,.58,1],
  'ease-in-out': [.42,0,.58,1]
}
var Firefox = !!ua.match(/Firefox/i)
var IEMobile = !!ua.match(/IEMobile/i)
var cssPrefix = Firefox ? '-moz-' : IEMobile ? '-ms-' : '-webkit-'
var stylePrefix = Firefox ? 'Moz' : IEMobile ? 'ms' : 'webkit'

function debugLog() {
  if (lib.scroll.outputDebugLog) {
    console.log.apply(console, arguments)
  }
}

function getBoundingClientRect(el) {
  var rect = el.getBoundingClientRect()
  if (!rect) {
    rect = {}
    rect.width = el.offsetWidth
    rect.height = el.offsetHeight

    rect.left = el.offsetLeft
    rect.top = el.offsetTop
    var parent = el.offsetParent
    while (parent) {
      rect.left += parent.offsetLeft
      rect.top += parent.offsetTop
      parent = parent.offsetParent
    }

    rect.right = rect.left + rect.width
    rect.bottom = rect.top + rect.height
  }
  return rect
}

function getMinScrollOffset(scrollObj) {
  return 0 - scrollObj.options[scrollObj.axis + 'PaddingTop']
}

function getMaxScrollOffset(scrollObj) {
  var rect = getBoundingClientRect(scrollObj.element)
  var pRect = getBoundingClientRect(scrollObj.viewport)
  var min = getMinScrollOffset(scrollObj)
  if (scrollObj.axis === 'y') {
    var max = 0 - rect.height + pRect.height
  } else {
    var max = 0 - rect.width + pRect.width
  }
  return Math.min(
    max + scrollObj.options[scrollObj.axis + 'PaddingBottom'],
    min
  )
}

function getBoundaryOffset(scrollObj, offset) {
  if (offset > scrollObj.minScrollOffset) {
    return offset - scrollObj.minScrollOffset
  }
  if (offset < scrollObj.maxScrollOffset) {
    return offset - scrollObj.maxScrollOffset
  }
}

function touchBoundary(scrollObj, offset) {
  if (offset > scrollObj.minScrollOffset) {
    offset = scrollObj.minScrollOffset
  } else if (offset < scrollObj.maxScrollOffset) {
    offset = scrollObj.maxScrollOffset
  }
  return offset
}

function fireEvent(scrollObj, eventName, extra) {
  debugLog(scrollObj.element.scrollId, eventName, extra)
  var event = doc.createEvent('HTMLEvents')
  event.initEvent(eventName, false, true)
  event.scrollObj = scrollObj
  if (extra) {
    for (var key in extra) {
      event[key] = extra[key]
    }
  }
  scrollObj.element.dispatchEvent(event)
  scrollObj.viewport.dispatchEvent(event)
}

function getTransformOffset(scrollObj) {
  var offset = {x: 0, y: 0}
  var transform = getComputedStyle(scrollObj.element)
    [stylePrefix + 'Transform']
  var matched
  var reg1 = new RegExp('^matrix3d'
    + '\\((?:[-\\d.]+,\\s*){12}([-\\d.]+),'
    + '\\s*([-\\d.]+)(?:,\\s*[-\\d.]+){2}\\)')
  var reg2 = new RegExp('^matrix'
    + '\\((?:[-\\d.]+,\\s*){4}([-\\d.]+),\\s*([-\\d.]+)\\)$')
  if (transform !== 'none') {
    if ((matched = transform.match(reg1) ||
        transform.match(reg2))) {
      offset.x = parseFloat(matched[1]) || 0
      offset.y = parseFloat(matched[2]) || 0
    }
  }

  return offset
}

var CSSMatrix = IEMobile ? 'MSCSSMatrix' : 'WebKitCSSMatrix'
var has3d = !!Firefox
  || CSSMatrix in window
  && 'm11' in new window[CSSMatrix]()
function getTranslate(x, y) {
  x = parseFloat(x)
  y = parseFloat(y)

  if (x != 0) {
    x += 'px'
  }

  if (y != 0) {
    y += 'px'
  }

  if (has3d) {
    return 'translate3d(' + x + ', ' + y + ', 0)'
  }
  return 'translate(' + x + ', ' + y + ')'
}

function setTransitionStyle(scrollObj, duration, timingFunction) {
  if (duration === '' && timingFunction === '') {
    scrollObj.element.style[stylePrefix + 'Transition'] = ''
  } else {
    scrollObj.element.style[stylePrefix + 'Transition']
      = cssPrefix + 'transform ' + duration + ' ' + timingFunction + ' 0s'
  }
}

function setTransformStyle(scrollObj, offset) {
  var x = 0
  var y = 0
  if (typeof offset === 'object') {
    x = offset.x
    y = offset.y
  } else {
    if (scrollObj.axis === 'y') {
      y = offset
    } else {
      x = offset
    }
  }
  scrollObj.element.style[stylePrefix + 'Transform'] = getTranslate(x, y)
}

var panning = false
doc.addEventListener('touchmove', function (e) {
  if (panning) {
    e.preventDefault()
    return false
  }
  return true
}, false)

function Scroll(element, options) {
  var that = this

  options = options || {}
  options.noBounce = !!options.noBounce
  options.padding = options.padding || {}

  if (options.isPrevent == null) {
    options.isPrevent = true
  } else {
    options.isPrevent = !!options.isPrevent
  }

  if (options.isFixScrollendClick == null) {
    options.isFixScrollendClick = true
  } else {
    options.isFixScrollendClick = !!options.isFixScrollendClick
  }

  if (options.padding) {
    options.yPaddingTop = -options.padding.top || 0
    options.yPaddingBottom = -options.padding.bottom || 0
    options.xPaddingTop = -options.padding.left || 0
    options.xPaddingBottom = -options.padding.right || 0
  } else {
    options.yPaddingTop = 0
    options.yPaddingBottom = 0
    options.xPaddingTop = 0
    options.xPaddingBottom = 0
  }

  options.direction = options.direction || 'y'
  options.inertia = options.inertia || 'normal'

  this.options = options
  that.axis = options.direction
  this.element = element
  this.viewport = element.parentNode
  this.plugins = {}

  this.element.scrollId = setTimeout(function () {
    scrollObjs[that.element.scrollId + ''] = that
  }, 1)

  this.viewport.addEventListener('touchstart', touchstartHandler, false)
  this.viewport.addEventListener('touchend', touchendHandler, false)
  this.viewport.addEventListener('touchcancel', touchendHandler, false)
  this.viewport.addEventListener('panstart', panstartHandler, false)
  this.viewport.addEventListener('panmove', panHandler, false)
  this.viewport.addEventListener('panend', panendHandler, false)

  if (options.isPrevent) {
    this.viewport.addEventListener('touchstart', function (e) {
      panning = true
    }, false)
    that.viewport.addEventListener('touchend', function (e) {
      panning = false
    }, false)
  }

  // if (options.isPrevent) {
  //   var d = this.axis === 'y'?'vertical':'horizontal'
  //   this.viewport.addEventListener(d + 'panstart', function (e) {
  //     panning = true
  //   }, false)
  //   that.viewport.addEventListener('panend', function (e) {
  //     panning = false
  //   }, false)
  // }

  if (options.isFixScrollendClick) {
    var preventScrollendClick
    var fixScrollendClickTimeoutId

    this.viewport.addEventListener('scrolling', function () {
      preventScrollendClick = true
      fixScrollendClickTimeoutId && clearTimeout(fixScrollendClickTimeoutId)
      fixScrollendClickTimeoutId = setTimeout(function (e) {
        preventScrollendClick = false
      }, 400)
    }, false)

    function preventScrollendClickHandler(e) {
      if (preventScrollendClick || isScrolling) {
        e.preventDefault()
        e.stopPropagation()
        return false
      }
      return true
    }

    function fireNiceTapEventHandler(e) {
      if (!preventScrollendClick && !isScrolling) {
        setTimeout(function () {
          var niceTapEvent = document.createEvent('HTMLEvents')
          niceTapEvent.initEvent('niceclick', true, true)
          e.target.dispatchEvent(niceTapEvent)
        }, 300)
      }
    }

    this.viewport.addEventListener('click', preventScrollendClickHandler)
    this.viewport.addEventListener('tap', fireNiceTapEventHandler)
  }

  function setTransitionEndHandler(h, t) {
    if (options.useFrameAnimation) {
      return
    }
    transitionEndHandler = null
    clearTimeout(transitionEndTimeoutId)

    transitionEndTimeoutId = setTimeout(function () {
      if (transitionEndHandler) {
        transitionEndHandler = null
        lib.animation.requestFrame(h)
      }
    }, (t || 400))

    transitionEndHandler = h
  }

  if (options.useFrameAnimation) {
    var scrollAnimation

    Object.defineProperty(this, 'animation', {
      get: function () {
        return scrollAnimation
      }
    })
  } else {
    var transitionEndHandler
    var transitionEndTimeoutId = 0

    element.addEventListener(
        Firefox
          ? 'transitionend'
          : (stylePrefix + 'TransitionEnd'), function (e) {
      if (transitionEndHandler) {
        var handler = transitionEndHandler

        transitionEndHandler = null
        clearTimeout(transitionEndTimeoutId)

        lib.animation.requestFrame(function () {
          handler(e)
        })
      }
    }, false)
  }

  var panFixRatio
  var isScrolling
  var isFlickScrolling
  var cancelScrollEnd

  Object.defineProperty(this, 'isScrolling', {
    get: function () {
      return !!isScrolling
    }
  })

  function isEnabled(e) {
    if (!that.enabled) {
      return false
    }

    if (typeof e.isVertical != 'undefined') {
      if (that.axis === 'y' && e.isVertical
          || that.axis === 'x' && !e.isVertical) {
        // gesture in same direction, stop bubbling up
        e.stopPropagation()
      } else {
        // gesture in different direction, bubbling up
        // to the top, without any other process
        return false
      }
    }

    return true
  }

  function touchstartHandler(e) {
    if (!isEnabled(e)) {
      return
    }

    if (isScrolling) {
      scrollEnd()
    }

    if (options.useFrameAnimation) {
      scrollAnimation && scrollAnimation.stop()
      scrollAnimation = null
    } else {
      var transform = getTransformOffset(that)
      setTransformStyle(that, transform)
      setTransitionStyle(that, '', '')
      transitionEndHandler = null
      clearTimeout(transitionEndTimeoutId)
    }
  }

  function touchendHandler(e) {
    if (!isEnabled(e)) {
      return
    }

    var s0 = getTransformOffset(that)[that.axis]
    var boundaryOffset = getBoundaryOffset(that, s0)

    if (boundaryOffset) {
      // dragging out of boundray, bounce is needed
      var s1 = touchBoundary(that, s0)

      if (options.useFrameAnimation) {
        // frame
        var _s = s1 - s0
        scrollAnimation = new lib.animation(
            400,
            lib.cubicbezier.ease,
            0,
            function (i1, i2) {
          var offset = (s0 + _s * i2).toFixed(2)
          setTransformStyle(that, offset)
          fireEvent(that, 'scrolling')
        })
        scrollAnimation.onend(scrollEnd)
        scrollAnimation.play()
      } else {
        // css
        var offset =  s1.toFixed(0)
        setTransitionEndHandler(scrollEnd, 400)
        setTransitionStyle(that, '0.4s', 'ease')
        setTransformStyle(that, offset)

        lib.animation.requestFrame(function doScroll() {
          if (isScrolling && that.enabled) {
            fireEvent(that, 'scrolling')
            lib.animation.requestFrame(doScroll)
          }
        })
      }

      if (boundaryOffset > 0) {
        fireEvent(that, that.axis === 'y' ? 'pulldownend' : 'pullrightend')
      } else if (boundaryOffset < 0) {
        fireEvent(that, that.axis === 'y' ? 'pullupend' : 'pullleftend')
      }
    } else if (isScrolling) {
      // without exceeding the boundary, just end it
      scrollEnd()
    }
  }

  var lastDisplacement
  function panstartHandler(e) {
    if (!isEnabled(e)) {
      return
    }

    that.transformOffset = getTransformOffset(that)
    that.minScrollOffset = getMinScrollOffset(that)
    that.maxScrollOffset = getMaxScrollOffset(that)
    panFixRatio = 2.5
    cancelScrollEnd = true
    isScrolling = true
    isFlickScrolling = false
    fireEvent(that, 'scrollstart')

    lastDisplacement = e['displacement' + that.axis.toUpperCase()]
  }

  function panHandler(e) {
    if (!isEnabled(e)) {
      return
    }

    // finger move less than 5 px. just ignore that.
    var displacement = e['displacement' + that.axis.toUpperCase()]
    if (Math.abs(displacement - lastDisplacement) < 5) {
      e.stopPropagation()
      return
    }
    lastDisplacement = displacement

    var offset = that.transformOffset[that.axis] + displacement
    if (offset > that.minScrollOffset) {
      offset = that.minScrollOffset
        + (offset - that.minScrollOffset) / panFixRatio
      panFixRatio *= 1.003
    } else if (offset < that.maxScrollOffset) {
      offset = that.maxScrollOffset
        - (that.maxScrollOffset - offset) / panFixRatio
      panFixRatio *= 1.003
    }
    if (panFixRatio > 4) {
      panFixRatio = 4
    }

    // tell whether or not reach the fringe
    var boundaryOffset = getBoundaryOffset(that, offset)
    if (boundaryOffset) {
      fireEvent(
          that,
          boundaryOffset > 0
          ? (that.axis === 'y' ? 'pulldown' : 'pullright')
          : (that.axis === 'y' ? 'pullup' : 'pullleft'), {
        boundaryOffset: Math.abs(boundaryOffset)
      })
      if (that.options.noBounce) {
        offset = touchBoundary(that, offset)
      }
    }

    setTransformStyle(that, offset.toFixed(2))
    fireEvent(that, 'scrolling')
  }

  function panendHandler(e) {
    if (!isEnabled(e)) {
      return
    }

    if (e.isSwipe) {
      flickHandler(e)
    }
  }

  function flickHandler(e) {
    cancelScrollEnd = true

    var v0, a0, t0, s0, s, motion0
    var v1, a1, t1, s1, motion1,sign
    var v2, a2, t2, s2, motion2, ft

    s0 = getTransformOffset(that)[that.axis]
    var boundaryOffset0 = getBoundaryOffset(that, s0)
    if (!boundaryOffset0) {
      // when fingers left the range of screen, let touch end handler
      // to deal with it.
      // when fingers left the screen, but still in the range of
      // screen, calculate the intertia.
      v0 = e['velocity' + that.axis.toUpperCase()]

      var maxV = 2
      var friction = 0.0015
      if (options.inertia && inertiaCoefficient[options.inertia]) {
        maxV = inertiaCoefficient[options.inertia][0]
        friction = inertiaCoefficient[options.inertia][1]
      }

      if (v0 > maxV) {
        v0 = maxV
      }
      if (v0 < -maxV) {
        v0 = -maxV
      }
      a0 = friction * (v0 / Math.abs(v0))
      motion0 = new lib.motion({
        v: v0,
        a: -a0
      })
      t0 = motion0.t
      s = s0 + motion0.s

      var boundaryOffset1 = getBoundaryOffset(that, s)
      if (boundaryOffset1) {
        debugLog('inertial calculation has exceeded the boundary',
          boundaryOffset1)

        v1 = v0
        a1 = a0
        if (boundaryOffset1 > 0) {
          s1 = that.minScrollOffset
          sign = 1
        } else {
          s1 = that.maxScrollOffset
          sign = -1
        }
        motion1 = new lib.motion({
          v: sign * v1,
          a: -sign * a1,
          s: Math.abs(s1 - s0)
        })
        t1 = motion1.t
        var timeFunction1 = motion1.generateCubicBezier()

        v2 = v1 - a1 * t1
        a2 = 0.03 * (v2 / Math.abs(v2))
        motion2 = new lib.motion({
          v: v2,
          a: -a2
        })
        t2 = motion2.t
        s2 = s1 + motion2.s
        var timeFunction2 = motion2.generateCubicBezier()

        if (options.noBounce) {
          debugLog('no bounce effect')

          if (s0 !== s1) {
            if (options.useFrameAnimation) {
              // frame
              var _s = s1 - s0
              var bezier = lib.cubicbezier(
                timeFunction1[0][0],
                timeFunction1[0][1],
                timeFunction1[1][0],
                timeFunction1[1][1]
              )
              scrollAnimation = new lib.animation(
                  t1.toFixed(0),
                  bezier,
                  0,
                  function (i1, i2) {
                var offset = (s0 + _s * i2)
                getTransformOffset(that, offset.toFixed(2))
                fireEvent(that, 'scrolling', {
                  afterFlick: true
                })
              })

              scrollAnimation.onend(scrollEnd)

              scrollAnimation.play()
            } else {
              // css
              var offset = s1.toFixed(0)
              setTransitionEndHandler(
                scrollEnd,
                (t1 / 1000).toFixed(2) * 1000
              )
              setTransitionStyle(
                that,
                (t1 / 1000).toFixed(2) + 's',
                'cubic-bezier(' + timeFunction1 + ')'
              )
              setTransformStyle(that, offset)
            }
          } else {
            scrollEnd()
          }
        } else if (s0 !== s2) {
          debugLog(
            'scroll for inertia',
            's=' + s2.toFixed(0),
            't=' + ((t1 + t2) / 1000).toFixed(2)
          )

          if (options.useFrameAnimation) {
            var _s = s2 - s0
            var bezier = lib.cubicbezier.easeOut
            scrollAnimation = new lib.animation(
                (t1 + t2).toFixed(0),
                bezier,
                0,
                function (i1, i2) {
              var offset = s0 + _s * i2
              setTransformStyle(that, offset.toFixed(2))
              fireEvent(that, 'scrolling',{
                afterFlick: true
              })
            })

            scrollAnimation.onend(function () {
              if (!that.enabled) {
                return
              }

              var _s = s1 - s2
              var bezier = lib.cubicbezier.ease
              scrollAnimation = new lib.animation(
                  400,
                  bezier,
                  0,
                  function (i1, i2) {
                var offset = s2 + _s * i2
                setTransformStyle(that, offset.toFixed(2))
                fireEvent(that, 'scrolling',{
                  afterFlick: true
                })
              })

              scrollAnimation.onend(scrollEnd)

              scrollAnimation.play()
            })

            scrollAnimation.play()
          } else {
            var offset = s2.toFixed(0)
            setTransitionEndHandler(function (e) {
              if (!that.enabled) {
                return
              }

              debugLog('inertial bounce',
                's=' + s1.toFixed(0),
                't=400'
              )

              if (s2 !== s1) {
                var offset = s1.toFixed(0)
                setTransitionStyle(that, '0.4s', 'ease')
                setTransformStyle(that, offset)
                setTransitionEndHandler(scrollEnd, 400)
              } else {
                scrollEnd()
              }
            }, ((t1 + t2) / 1000).toFixed(2) * 1000)

            setTransitionStyle(
              that,
              ((t1 + t2) / 1000).toFixed(2) + 's',
              'ease-out'
            )
            setTransformStyle(that, offset)
          }
        } else {
          scrollEnd()
        }
      } else {
        debugLog('inertial calculation hasn\'t exceeded the boundary')
        var timeFunction = motion0.generateCubicBezier()

        if (options.useFrameAnimation) {
          // frame
          var _s = s - s0
          var bezier = lib.cubicbezier(
            timeFunction[0][0],
            timeFunction[0][1],
            timeFunction[1][0],
            timeFunction[1][1]
          )
          scrollAnimation = new lib.animation(
              t0.toFixed(0),
              bezier,
              0,
              function (i1, i2) {
            var offset = (s0 + _s * i2).toFixed(2)
            setTransformStyle(that, offset)
            fireEvent(that, 'scrolling',{
              afterFlick: true
            })
          })

          scrollAnimation.onend(scrollEnd)

          scrollAnimation.play()
        } else {
          // css
          var offset = s.toFixed(0)
          setTransitionEndHandler(scrollEnd, (t0 / 1000).toFixed(2) * 1000)
          setTransitionStyle(
            that,
            (t0 / 1000).toFixed(2) + 's',
            'cubic-bezier(' + timeFunction + ')'
          )
          setTransformStyle(that, offset)
        }
      }

      isFlickScrolling = true
      if (!options.useFrameAnimation) {
        lib.animation.requestFrame(function doScroll() {
          if (isScrolling && isFlickScrolling && that.enabled) {
            fireEvent(that, 'scrolling', {
              afterFlick: true
            })
            lib.animation.requestFrame(doScroll)
          }
        })
      }
    }
  }

  function scrollEnd() {
    if (!that.enabled) {
      return
    }

    cancelScrollEnd = false

    setTimeout(function () {
      if (!cancelScrollEnd && isScrolling) {
        isScrolling = false
        isFlickScrolling = false

        if (options.useFrameAnimation) {
          scrollAnimation && scrollAnimation.stop()
          scrollAnimation = null
        } else {
          setTransitionStyle(that, '', '')
        }
        fireEvent(that, 'scrollend')
      }
    }, 50)
  }

  var proto = {
    init: function () {
      this.enable()
      this.refresh()
      this.scrollTo(0)
      return this
    },

    enable: function () {
      this.enabled = true
      return this
    },

    disable: function () {
      var el = this.element
      this.enabled = false

      if (this.options.useFrameAnimation) {
        scrollAnimation && scrollAnimation.stop()
      } else {
        lib.animation.requestFrame(function () {
          el.style[stylePrefix + 'Transform']
            = getComputedStyle(el)[stylePrefix + 'Transform']
        })
      }

      return this
    },

    getScrollWidth: function () {
      return getBoundingClientRect(this.element).width
    },

    getScrollHeight: function () {
      return getBoundingClientRect(this.element).height
    },

    getScrollLeft: function () {
      return -getTransformOffset(this).x - this.options.xPaddingTop
    },

    getScrollTop: function () {
      return -getTransformOffset(this).y - this.options.yPaddingTop
    },

    getMaxScrollLeft: function () {
      return -that.maxScrollOffset - this.options.xPaddingTop
    },

    getMaxScrollTop: function () {
      return -that.maxScrollOffset - this.options.yPaddingTop
    },

    getBoundaryOffset: function () {
      return Math.abs(
        getBoundaryOffset(this, getTransformOffset(this)[this.axis]) || 0
      )
    },

    refresh: function () {
      var el = this.element
      var isVertical = (this.axis === 'y')
      var type = isVertical ? 'height' : 'width'
      var size, rect, extraSize

      function getExtraSize(el, isVertical) {
        var extraType = isVertical ? ['top', 'bottom'] : ['left', 'right']
        return parseFloat(
          getComputedStyle(el.firstElementChild)['margin-' + extraType[0]]
        ) + parseFloat(
          getComputedStyle(el.lastElementChild)['margin-' + extraType[1]]
        )
      }

      if (this.options[type] != null) {
        // use options
        size = this.options[type]
      } else if (el.childElementCount <= 0) {
        el.style[type] = 'auto'
        size = null
      } else if (!!this.options.useElementRect) {
        el.style[type] = 'auto'
        rect = getBoundingClientRect(el)
        size = rect[type]
        size += getExtraSize(el, isVertical)
      } else {
        var range, rect
        var firstEl = el.firstElementChild
        var lastEl = el.lastElementChild

        if (document.createRange && !this.options.ignoreOverflow) {
          // use range
          range = document.createRange()
          range.selectNodeContents(el)
          rect = getBoundingClientRect(range)
        }

        if (rect) {
          size = rect[type]
        } else {
          // use child offsets
          while (firstEl) {
            if (getBoundingClientRect(firstEl)[type] === 0
                && firstEl.nextElementSibling) {
              firstEl = firstEl.nextElementSibling
            } else {
              break
            }
          }

          while (lastEl && lastEl !== firstEl) {
            if (getBoundingClientRect(lastEl)[type] === 0
                && lastEl.previousElementSibling) {
              lastEl = lastEl.previousElementSibling
            } else {
              break
            }
          }

          size = getBoundingClientRect(lastEl)[
              isVertical ? 'bottom' : 'right']
            - getBoundingClientRect(firstEl)[
              isVertical ? 'top' : 'left']
        }

        size += getExtraSize(el, isVertical)

      }

      el.style[type] = size ? size + 'px' : 'auto'

      this.transformOffset = getTransformOffset(this)
      this.minScrollOffset = getMinScrollOffset(this)
      this.maxScrollOffset = getMaxScrollOffset(this)

      this.scrollTo(
        -this.transformOffset[this.axis]
        - this.options[this.axis + 'PaddingTop']
      )
      fireEvent(this, 'contentrefresh')

      return this
    },

    offset: function (childEl) {
      var elRect = getBoundingClientRect(this.element)
      var childRect = getBoundingClientRect(childEl)
      if (this.axis === 'y') {
        var offsetRect = {
          top: childRect.top - elRect.top - this.options.yPaddingTop,
          left: childRect.left - elRect.left,
          right: elRect.right - childRect.right,
          width: childRect.width,
          height: childRect.height
        }

        offsetRect.bottom = offsetRect.top + offsetRect.height
      } else {
        var offsetRect = {
          top: childRect.top - elRect.top,
          bottom: elRect.bottom - childRect.bottom,
          left: childRect.left - elRect.left - this.options.xPaddingTop,
          width: childRect.width,
          height: childRect.height
        }

        offsetRect.right = offsetRect.left + offsetRect.width
      }
      return offsetRect
    },

    getRect: function (childEl) {
      var viewRect = getBoundingClientRect(this.viewport)
      var childRect = getBoundingClientRect(childEl)
      if (this.axis === 'y') {
        var offsetRect = {
          top: childRect.top - viewRect.top,
          left: childRect.left - viewRect.left,
          right: viewRect.right - childRect.right,
          width: childRect.width,
          height: childRect.height
        }

        offsetRect.bottom = offsetRect.top + offsetRect.height
      } else {
        var offsetRect = {
          top: childRect.top - viewRect.top,
          bottom: viewRect.bottom - childRect.bottom,
          left: childRect.left - viewRect.left,
          width: childRect.width,
          height: childRect.height
        }

        offsetRect.right = offsetRect.left + offsetRect.width
      }
      return offsetRect
    },

    isInView: function (childEl) {
      var viewRect = this.getRect(this.viewport)
      var childRect = this.getRect(childEl)
      if (this.axis === 'y') {
        return viewRect.top < childRect.bottom
          && viewRect.bottom > childRect.top
      }
      return viewRect.left < childRect.right
        && viewRect.right > childRect.left
    },

    scrollTo: function (offset, isSmooth) {
      var that = this
      var element = this.element

      offset = -offset - this.options[this.axis + 'PaddingTop']
      offset = touchBoundary(this, offset)

      isScrolling = true
      if (isSmooth === true) {
        if (this.options.useFrameAnimation) {
          var s0 = getTransformOffset(that)[this.axis]
          var _s = offset - s0
          scrollAnimation = new lib.animation(
              400,
              lib.cubicbezier.easeInOut,
              0,
              function (i1, i2) {
            var offset = (s0 + _s * i2).toFixed(2)
            setTransformStyle(that, offset)
            fireEvent(that, 'scrolling')
          })

          scrollAnimation.onend(scrollEnd)

          scrollAnimation.play()
        } else {
          setTransitionEndHandler(scrollEnd, 400)
          setTransitionStyle(that, '0.4s', 'ease-in-out')
          setTransformStyle(that, offset)

          function _cancelScroll() {
            if (isScrolling && that.enabled) {
              fireEvent(that, 'scrolling')
              lib.animation.requestFrame(_cancelScroll)
            }
          }

          lib.animation.requestFrame(_cancelScroll)
        }
      } else {
        if (!this.options.useFrameAnimation) {
          setTransitionStyle(that, '', '')
        }
        setTransformStyle(that, offset)
        scrollEnd()
      }

      return this
    },

    scrollToElement: function (childEl, isSmooth, topOffset) {
      var offset = this.offset(childEl)
      offset = offset[this.axis === 'y'?'top':'left']
      topOffset && (offset += topOffset)
      return this.scrollTo(offset, isSmooth)
    },

    getViewWidth: function () {
      return getBoundingClientRect(this.viewport).width
    },

    getViewHeight: function () {
      return getBoundingClientRect(this.viewport).height
    },

    addPulldownHandler: function (handler) {
      var that = this
      this.element.addEventListener('pulldownend', function (e) {
        that.disable()
        handler.call(that, e, function () {
          that.scrollTo(0, true)
          that.refresh()
          that.enable()
        })
      }, false)

      return this
    },

    addPullupHandler: function (handler) {
      var that = this

      this.element.addEventListener('pullupend', function (e) {
        that.disable()
        handler.call(that, e, function () {
          that.scrollTo(that.getScrollHeight(), true)
          that.refresh()
          that.enable()
        })
      }, false)

      return this
    },

    addScrollstartHandler: function (handler) {
      var that = this
      this.element.addEventListener('scrollstart', function (e) {
        handler.call(that, e)
      }, false)

      return this
    },

    addScrollingHandler: function (handler) {
      var that = this
      this.element.addEventListener('scrolling', function (e) {
        handler.call(that, e)
      }, false)

      return this
    },

    addScrollendHandler: function (handler) {
      var that = this
      this.element.addEventListener('scrollend', function (e) {
        handler.call(that, e)
      }, false)

      return this
    },

    addContentrenfreshHandler: function (handler) {
      var that = this
      this.element.addEventListener('contentrefresh', function (e) {
        handler.call(that, e)
      }, false)
    },

    addEventListener: function (name, handler, useCapture) {
      var that = this
      this.element.addEventListener(name, function (e) {
        handler.call(that, e)
      }, !!useCapture)
    },

    removeEventListener: function (name, handler) {
      var that = this
      this.element.removeEventListener(name, function (e) {
        handler.call(that, e)
      })
    },

    enablePlugin: function (name, options) {
      var plugin = plugins[name]
      if (plugin && !this.plugins[name]) {
        this.plugins[name] = true
        options = options || {}
        plugin.call(this, name, options)
      }
      return this
    }
  }

  for (var k in proto) {
    this[k] = proto[k]
  }
  // delete proto
}

lib.scroll = function (el, options) {
  if (arguments.length === 1 && !(arguments[0] instanceof HTMLElement)) {
    options = arguments[0]
    if (options.scrollElement) {
      el = options.scrollElement
    } else if (options.scrollWrap) {
      el = options.scrollWrap.firstElementChild
    } else {
      throw new Error('no scroll element')
    }
  }

  if (!el.parentNode) {
    throw new Error('wrong dom tree')
  }
  if (options
      && options.direction
      && ['x', 'y'].indexOf(options.direction) < 0) {
    throw new Error('wrong direction')
  }

  var scroll
  if (options.downgrade === true
      && lib.scroll.downgrade) {
    scroll = lib.scroll.downgrade(el, options)
  } else {
    if (el.scrollId) {
      scroll = scrollObjs[el.scrollId]
    } else {
      scroll = new Scroll(el, options)
    }
  }
  return scroll
}

lib.scroll.plugin = function (name, constructor) {
  if (constructor) {
    name = name.split(',')
    name.forEach(function (n) {
      plugins[n] = constructor
    })
  } else {
    return plugins[name]
  }
}


text:
#ifndef __ALLOCATOR_FILL_RANDOM_H__
#define __ALLOCATOR_FILL_RANDOM_H__

#include <fstream>
#include <iterator>

// Standard allocator, but fill the allocated region with random bits

template <typename T>
class allocator_fill_random : public std::allocator<T> {
  typedef std::allocator<T> super;
public:
  typedef typename super::value_type                             value_type;
  typedef typename super::pointer                                pointer;
  typedef typename super::reference                              reference;
  typedef typename super::const_pointer                          const_pointer;
  typedef typename super::const_reference                        const_reference;
  typedef typename super::size_type                              size_type;
  typedef typename super::difference_type                        difference_type;
  //  typedef typename super::rebind                                 rebind;
  typedef typename super::propagate_on_container_move_assignment propagate_on_container_move_assignment;

  allocator_fill_random() noexcept
  : super()
  { }

  allocator_fill_random (const allocator_fill_random& alloc) noexcept
    : super(alloc)
  { }

  template <class U>
  allocator_fill_random (const allocator_fill_random<U>& alloc) noexcept
    : super(alloc)
  { }

  pointer allocate(size_type n, allocator_fill_random::const_pointer hint=0) {
    auto res = super::allocate(n, hint);

    //    std::fill_n(res, n, (T)-1);
    std::ifstream rand("/dev/urandom");
    rand.read((char*)res, sizeof(T) * n);
    if(!rand.good()) throw std::runtime_error("Can't open /dev/urandom");
    return res;
  }
};

#endif /* __ALLOCATOR_FILL_RANDOM_H__ */


text:
import { StepsController } from "./controllers";
import { Process, State, HasControls } from "./types";

export interface ControlOptions<R, O extends HasControls> {
  name?: string;
  method: (options: O) => Process<R>;
}

export async function* control<R, O extends HasControls>(
  controlOptions: ControlOptions<R, O>,
  methodOptions: Omit<O, "controls">
): Process<R> {
  const { name, method } = controlOptions;

  const scope = [name || ""];

  const controller = new StepsController({ scope });

  const controls = {
    log: controller.log,
    declare: controller.declare,
    step: controller.step
  };

  yield* controller.begin();

  try {
    const completeMethodOptions = { ...methodOptions, controls } as O;
    const result = yield* method(completeMethodOptions);

    yield* controller.succeed({ result });

    // check for error state (in case of cascaded failures)
    if (controller.state !== State.Done) {
      return;
    }

    return result;
  } catch (error) {
    yield* controller.fail({ error });

    return;
  }
}

export const run = async <R, O extends HasControls>(
  controlOptions: ControlOptions<R, O>,
  methodOptions: Omit<O, "controls">
): Promise<R> => {
  const generator = control(controlOptions, methodOptions);

  while (true) {
    const { done, value } = await generator.next();

    if (done) {
      return value as R;
    }
  }
};


text:
JOBS="${JOBS:-4}"

# Parse named arguments passed into the annotator script
# and assign them global variable names.
function bb_parse_args {
  while [[ $1 ]]; do
    case "$1" in
      --factory-properties=*)
        FACTORY_PROPERTIES="$(echo "$1" | sed 's/^[^=]*=//')"
        BUILDTYPE=$(bb_get_json_prop "$FACTORY_PROPERTIES" target)
        ;;
      --build-properties=*)
        BUILD_PROPERTIES="$(echo "$1" | sed 's/^[^=]*=//')"
        ;;
      --slave-properties=*)
        SLAVE_PROPERTIES="$(echo "$1" | sed 's/^[^=]*=//')"
        ;;
      *)
        echo "@@@STEP_WARNINGS@@@"
        echo "Warning, unparsed input argument: '$1'"
        ;;
    esac
    shift
  done
}

# Basic setup for all bots to run after a source tree checkout.
# Args:
#   $1: source root.
#   $2 and beyond: key value pairs which are parsed by bb_parse_args.
function bb_baseline_setup {
  SRC_ROOT="$1"
  # Remove SRC_ROOT param
  shift
  cd $SRC_ROOT

  bb_parse_args "$@"

  export GYP_GENERATORS=ninja
  export GOMA_DIR=/b/build/goma
  . build/android/envsetup.sh ""

  local extra_gyp_defines="$(bb_get_json_prop "$SLAVE_PROPERTIES" \
     extra_gyp_defines)"
  export GYP_DEFINES+=" fastbuild=1 $extra_gyp_defines"
  if echo $extra_gyp_defines | grep -qE 'clang|asan'; then
    unset CXX_target
  fi

  local build_path="${SRC_ROOT}/out/${BUILDTYPE}"
  local landmines_triggered_path="$build_path/.landmines_triggered"
  python "$SRC_ROOT/build/landmines.py"

  if [[ $BUILDBOT_CLOBBER || -f "$landmines_triggered_path" ]]; then
    echo "@@@BUILD_STEP Clobber@@@"

    if [[ -z $BUILDBOT_CLOBBER ]]; then
      echo "Clobbering due to triggered landmines: "
      cat "$landmines_triggered_path"
    else
      # Also remove all the files under out/ on an explicit clobber
      find "${SRC_ROOT}/out" -maxdepth 1 -type f -exec rm -f {} +
    fi

    # Sdk key expires, delete android folder.
    # crbug.com/145860
    rm -rf ~/.android
    rm -rf "$build_path"
    if [[ -e $build_path ]] ; then
      echo "Clobber appeared to fail?  $build_path still exists."
      echo "@@@STEP_WARNINGS@@@"
    fi
  fi
}

# Retrieve a packed json property using python
function bb_get_json_prop {
  local JSON="$1"
  local PROP="$2"

  python -c "import json; print json.loads('$JSON').get('$PROP', '')"
}


text:
package com.etsy.statsd.profiler.reporter;

import com.etsy.statsd.profiler.Arguments;
import com.google.common.base.Preconditions;

import java.util.Map;

/**
 * Interface for reporters
 *
 * @author Andrew Johnson
 */
public abstract class Reporter<T> {
    public static final Class<?>[] CONSTRUCTOR_PARAM_TYPES = new Class<?>[]{Arguments.class};

    /**
     * The underlying implementation for this reporter
     */
    protected T client;

    public Reporter(Arguments arguments) {
        Preconditions.checkNotNull(arguments);
        handleArguments(arguments);
        client = createClient(arguments.server, arguments.port, arguments.metricsPrefix);
    }

    /**
     * Record a gauge value
     *
     * @param key The name of the gauge
     * @param value The value of the gauge
     */
    public abstract void recordGaugeValue(String key, long value);

  /**
   * @see #recordGaugeValue(String, long)
   */
    public abstract void recordGaugeValue(String key, double value);

    /**
     * Record multiple gauge values
     * This is useful for reporters that can send points in batch
     *
     * @param gauges A map of gauge names to values
     */
    public abstract void recordGaugeValues(Map<String, ? extends Number> gauges);

    /**
     * CPUTracingProfiler can emit some metrics that indicate the upper and lower bound on the length of stack traces
     * This is helpful for querying this data for some backends (such as Graphite) that do not have rich query languages
     * Reporters can override this to disable these metrics
     *
     * @return true if the bounds metrics should be emitted, false otherwise
     */
    public boolean emitBounds() {
        return true;
    }

    /**
     * Construct the underlying client implementation for this reporter
     *
     * @param server The server to which to report data
     * @param port The port on which the server is running
     * @param prefix The prefix for metrics
     * @return An instance of T, the client implementation
     */
    protected abstract T createClient(String server, int port, String prefix);

    /**
     * Handle any additional arguments necessary for this reporter
     *
     * @param arguments The arguments given to the profiler agent
     */
    protected abstract void handleArguments(Arguments arguments);
}


text:
This is the demo app for Sinja, provided both as an example of and for testing
Sinja. It uses [Sequel ORM](http://sequel.jeremyevans.net) with an in-memory
SQLite database and demonstrates the [Sequel
extension](https://github.com/mwpastore/sinja-sequel) for Sinja. It works under
both MRI/YARV 2.3+ and JRuby 9.1+. It is a very simplistic blog-like
application with [database
tables](http://sequel.jeremyevans.net/rdoc/files/doc/schema_modification_rdoc.html),
[models](http://sequel.jeremyevans.net/rdoc/files/README_rdoc.html#label-Sequel+Models),
[serializers](https://github.com/fotinakis/jsonapi-serializers), and
[controllers](/) for [authors](/demo-app/classes/author.rb),
[posts](/demo-app/classes/post.rb), [comments](/demo-app/classes/comment.rb),
and [tags](/demo-app/classes/tag.rb).

### Usage

Assuming you have a working, [Bundler](http://bundler.io)-enabled Ruby
environment, simply clone this repo, `cd` into the `demo-app` subdirectory, and
run the following commands:

```
$ bundle install
$ bundle exec ruby app.rb [-p <PORT>]
```

The web server will report the port it's listening on (most likely 4567), or
you can specify a port with the `-p` option.

Alternatively, if you don't want to clone this repo and set up a Ruby
environment just for a quick demo, it's available on Docker Cloud as
[mwpastore/sinja-demo-app](https://cloud.docker.com/app/mwpastore/repository/docker/mwpastore/sinja-demo-app):

```
$ docker run -it -p 4567:4567 --rm mwpastore/sinja-demo-app
```

It will respond to {json:api}-compliant requests (don't forget to set an
`Accept` header) to `/authors`, `/posts`, `/comments`, and `/tags`, although
not every endpoint is implemented. Log in by setting the `X-Email` header on
the request to the email address of a registered user; the email address for
the default admin user is all@yourbase.com. **This is clearly extremely
insecure and should not be used as-is in production. Caveat emptor.**

You can point it at a different database by setting `DATABASE_URL` in the
environment before executing `app.rb`. See the relevant [Sequel
documentation](http://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html)
for more information. It (rather naïvely) migrates the database and
creates the default admin user at startup.

### Productionalizing

You can certainly use this as a starting point for a production application,
but you will at least want to:

- [ ] Use a persistent database
- [ ] Remove or change the default admin user
- [ ] Separate the class files (e.g. `author.rb`, `post.rb`) into separate
      files for migrations, models, serializers, and Sinja controllers
- [ ] Create a Gemfile using the dependencies in the top-level
      [gemspec](/sinja.gemspec) as a starting point
- [ ] Add authentication and rewrite the `role` helper to enable the
      authorization scheme. You can use the existing roles as defined or rename
      them (e.g. use `:admin` instead of `:superuser`)
- [ ] Use a real application server such as [Puma](http://puma.io) or
      [Passenger](https://www.phusionpassenger.com) instead of Ruby's
      stdlib (WEBrick)
- [ ] Configure Sequel's connection pool (i.e. `:max_connections`) to match the
      application server's thread pool (if any) size, e.g.
      `Puma.cli_config.options[:max_threads]`
- [ ] Add caching directives (i.e. `cache_control`, `expires`, `last_modified`,
      and `etag`) as appropriate

And probably a whole lot more!


text:
module Effective
  module Snippets
    class CheckBoxTag < Snippet
      attribute :label, String
      attribute :html_class, String

      def value_type
        Boolean
      end

      def snippet_name
        'Check Box Tag'
      end

      def snippet_image
        '/assets/effective_pages/check_box_tag.png'
      end

      def snippet_description
        'Standard form check box'
      end

    end
  end
end


text:
Start the Iptables service by executing the command `service iptables stop`.

    module.exports = header: 'Iptables Stop', handler: ->
      @service.stop name: 'iptables'


text:
import bodyParser from 'body-parser'
import cors from 'cors'
import compression from 'compression'
import helmet from 'helmet'

module.exports = app => {
  const port = process.env.PORT || 3001
  app.set('port', port)
  app.set('json spaces', 4)
  app.use(bodyParser.json())
  app.use(cors({
    methods: ['GET'],
    allowedHeaders: ['Content-Type']
  }))
  app.use(compression())
  app.use(helmet())
}


text:
<?php

namespace Zotlabs\Update;

class _1023 {
function run() {
	$r = q("ALTER TABLE `item` ADD `revision` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `lang` , add index ( revision ) ");
	if($r)
		return UPDATE_SUCCESS;
	return UPDATE_FAILED;
}

}


text:
layout: post
title: " London Still... "
date: 2006-10-05 22:34:00 +0100
comments: true
published: true
categories: ["blog", "archives"]
tags: ["On Travels", "On Generalities"]
alias: ["/mattsblog/archive/2006/10/05/1460.aspx"]
---

Just listening to The Waifs this morning, and I'm still loving 'London Still':

Wonder if you can pick up my
Accent on the phone
When I call across the country
When I call across the world
I see you in my kitchen
I can picture you now
As you toast to your small town
When you drink the happy hour
I’m in London still
I’m in London still
I'm in London still

I took the tube over to Camden
To wander around
I bought some funky records
With that old Motown sound
And I miss you like my left arm
That's been lost in a war
Today I dream of home and not of London anymore
I'm in London still
I'm in London still
Yeah I'm in London still

You know it’s okay
I’m kinda happy here for now
I think I've finally grown up
And got myself a lover now
And if I ever come home
And I, I think I will
I hope you're gonna wanna hang at my place on Sunday still
Oh yeah I hope you will
Cause I'm in London still

You know we got it sorted, yeah
We really got it down
To a fine art on Sunday
In a sleepy Sunday town
I wonder what I'm missing
I think of songs I've never heard
I'm dreaming of your voices
And I'm dreaming of your herb
I'm in London still
I'm in London still
I'm in London still

Oh I'm in London still
la-la-la-la-la London still
I'm in London

Really liking this one. Kinda meloncholy, but in a good way.


text:
package bot

import (
	"testing"

	"github.com/jriddick/geoffrey/msg"

	. "github.com/smartystreets/goconvey/convey"
)

var testHandler = Handler{
	Name:        "Test",
	Description: "Testing handler",
	Event:       "PING",
	Run: func(bot *Bot, msg *msg.Message) (bool, error) {
		return true, nil
	},
}

func TestHandler(t *testing.T) {
	Convey("With handler", t, func() {
		Convey("Should be able to register new handler", func() {
			So(RegisterHandler(testHandler), ShouldBeNil)
		})

		Convey("Should not be able to register the same handler twice", func() {
			So(RegisterHandler(testHandler), ShouldNotBeNil)
		})
	})
}


text:
package training.movieflix.repository;

import java.util.List;
import java.util.Map;

import training.movieflix.entity.Rating;

public interface RatingRepository {

	public double findByArguments(Map<String, String> params);

	public Rating findById(String id);

	public List<Rating> findByUserIdMovieId(String userId, String movieId);

	public Rating create(Rating emp);

	public Rating update(Rating emp);

	public void delete(Rating emp);
}


text:
package org.elasticsearch.ingest.processor;

import org.elasticsearch.ingest.core.AbstractProcessorFactory;
import org.elasticsearch.test.ESTestCase;
import org.junit.Before;

import java.util.HashMap;
import java.util.Map;

import static org.hamcrest.CoreMatchers.equalTo;

public class DeDotProcessorFactoryTests extends ESTestCase {

    private DeDotProcessor.Factory factory;

    @Before
    public void init() {
        factory = new DeDotProcessor.Factory();
    }

    public void testCreate() throws Exception {
        Map<String, Object> config = new HashMap<>();
        config.put("separator", "_");
        String processorTag = randomAsciiOfLength(10);
        config.put(AbstractProcessorFactory.TAG_KEY, processorTag);
        DeDotProcessor deDotProcessor = factory.create(config);
        assertThat(deDotProcessor.getSeparator(), equalTo("_"));
        assertThat(deDotProcessor.getTag(), equalTo(processorTag));
    }

    public void testCreateMissingSeparatorField() throws Exception {
        Map<String, Object> config = new HashMap<>();
        DeDotProcessor deDotProcessor = factory.create(config);
        assertThat(deDotProcessor.getSeparator(), equalTo(DeDotProcessor.DEFAULT_SEPARATOR));
    }

}


text:
define(['exports', 'module', 'react', '../DropdownMenu'], function (exports, module, _react, _DropdownMenu) {
  'use strict';

  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

  var _React = _interopRequireDefault(_react);

  var _DropdownMenu2 = _interopRequireDefault(_DropdownMenu);

  module.exports = _React['default'].createFactory(_DropdownMenu2['default']);
});


text:
package org.apache.pulsar.functions.runtime.kubernetes;

import java.util.Map;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.pulsar.common.configuration.FieldContext;
import org.apache.pulsar.common.nar.NarClassLoader;

@Data
@Accessors(chain = true)
public class KubernetesRuntimeFactoryConfig {
    @FieldContext(
        doc = "Uri to kubernetes cluster, leave it to empty and it will use the kubernetes settings in"
            + " function worker machine"
    )
    protected String k8Uri;
    @FieldContext(
        doc = "The Kubernetes namespace to run the function instances. It is `default`,"
            + " if this setting is left to be empty"
    )
    protected String jobNamespace;
    @FieldContext(
            doc = "The Kubernetes pod name to run the function instances. It is set to"
                + "`pf-<tenant>-<namespace>-<function_name>-<random_uuid(8)>` if this setting is left to be empty"
        )
    protected String jobName;
    @FieldContext(
        doc = "The docker image used to run function instance. By default it is `apachepulsar/pulsar`"
    )
    protected String pulsarDockerImageName;

    @FieldContext(
            doc = "The function docker images used to run function instance according to different "
                    + "configurations provided by users. By default it is `apachepulsar/pulsar`"
    )
    protected Map<String, String> functionDockerImages;

    @FieldContext(
            doc = "The image pull policy for image used to run function instance. By default it is `IfNotPresent`"
    )
    protected String imagePullPolicy;
    @FieldContext(
            doc = "The root directory of pulsar home directory in the pulsar docker image specified"
                    + " `pulsarDockerImageName`. By default it is under `/pulsar`. If you are using your own"
                    + " customized image in `pulsarDockerImageName`, you need to set this setting accordingly"
    )
    protected String pulsarRootDir;
    @FieldContext(
            doc = "The config admin CLI allows users to customize the configuration of the admin cli tool, such as:"
                    + " `/bin/pulsar-admin and /bin/pulsarctl`. "
                    + "By default it is `/bin/pulsar-admin`. If you want to use `pulsarctl` "
                    + " you need to set this setting accordingly"
    )
    protected String configAdminCLI;
    @FieldContext(
        doc = "This setting only takes effects if `k8Uri` is set to null. If your function worker is"
            + " also running as a k8s pod, set this to `true` is let function worker to submit functions to"
            + " the same k8s cluster as function worker is running. Set this to `false` if your function worker"
            + " is not running as a k8s pod"
    )
    protected Boolean submittingInsidePod;
    @FieldContext(
        doc = "The pulsar service url that pulsar functions should use to connect to pulsar."
            + " If it is not set, it will use the pulsar service url configured in function worker."
    )
    protected String pulsarServiceUrl;
    @FieldContext(
        doc = "The pulsar admin url that pulsar functions should use to connect to pulsar."
            + " If it is not set, it will use the pulsar admin url configured in function worker."
    )
    protected String pulsarAdminUrl;
    @FieldContext(
        doc = "The flag indicates to install user code dependencies. (applied to python package)"
    )
    protected Boolean installUserCodeDependencies;
    @FieldContext(
        doc = "The repository that pulsar functions use to download python dependencies"
    )
    protected String pythonDependencyRepository;
    @FieldContext(
        doc = "The repository that pulsar functions use to download extra python dependencies"
    )
    protected String pythonExtraDependencyRepository;

    @FieldContext(
        doc = "the directory for dropping extra function dependencies. "
            + "If it is not absolute path, it is relative to `pulsarRootDir`"
    )
    protected String extraFunctionDependenciesDir;
    @FieldContext(
        doc = "The custom labels that function worker uses to select the nodes for pods"
    )
    protected Map<String, String> customLabels;

    @FieldContext(
        doc = "The expected metrics collection interval, in seconds"
    )
    protected Integer expectedMetricsCollectionInterval = 30;
    @FieldContext(
        doc = "Kubernetes Runtime will periodically checkback on"
            + " this configMap if defined and if there are any changes"
            + " to the kubernetes specific stuff, we apply those changes"
    )
    protected String changeConfigMap;
    @FieldContext(
        doc = "The namespace for storing change config map"
    )
    protected String changeConfigMapNamespace;

    @FieldContext(
            doc = "Additional memory padding added on top of the memory "
                    + "requested by the function per on a per instance basis"
    )
    protected int percentMemoryPadding;

    @FieldContext(
            doc = "The ratio cpu request and cpu limit to be set for a function/source/sink."
                    + "  The formula for cpu request is cpuRequest = userRequestCpu / cpuOverCommitRatio"
    )
    protected double cpuOverCommitRatio = 1.0;

    @FieldContext(
            doc = "The ratio memory request and memory limit to be set for a function/source/sink."
                    + "  The formula for memory request is memoryRequest = userRequestMemory / memoryOverCommitRatio"
    )
    protected double memoryOverCommitRatio = 1.0;

    @FieldContext(
      doc = "The port inside the function pod which is used by the worker to communicate with the pod"
    )
    private Integer grpcPort = 9093;

    @FieldContext(
      doc = "The port inside the function pod on which prometheus metrics are exposed"
    )
    private Integer metricsPort = 9094;

    @FieldContext(
       doc = "The directory inside the function pod where nar packages will be extracted"
    )
    private String narExtractionDirectory = NarClassLoader.DEFAULT_NAR_EXTRACTION_DIR;

    @FieldContext(
            doc = "The classpath where function instance files stored"
    )
    private String functionInstanceClassPath = "";
    @FieldContext(
            doc = "The duration in seconds before the StatefulSet deleted on function stop/restart. "
                    + "Value must be non-negative integer. The value zero indicates delete immediately. "
                    + "Default is 5 seconds."
    )
    protected int gracePeriodSeconds = 5;

}


text:
package com.company.exchange;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.core.task.SimpleAsyncTaskExecutor;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.util.concurrent.Executor;

@SpringBootApplication
@EnableScheduling
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
<title>归档: 2019/5 - Mengfei</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/outdated-browser/1.1.5/outdatedbrowser.min.css">

<link rel="icon" href="/favicon.png">

<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Ovo|Source+Code+Pro">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bulma/0.6.2/css/bulma.min.css">

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/lightgallery/1.6.8/css/lightgallery.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/justifiedGallery/3.6.5/css/justifiedGallery.min.css">

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-light.min.css">

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

                    首页

            归档

            标签

            分类

            关于

2019

">
                    <time class="is-text-small" datetime="2019-05-29T17:03:30.000Z" itemprop="datePublished">
                        5月 30</time>

Cygwin工具入门

">
                    <time class="is-text-small" datetime="2019-05-29T17:03:30.000Z" itemprop="datePublished">
                        5月 30</time>

macOS登录FTP

">
                    <time class="is-text-small" datetime="2019-05-29T10:50:18.000Z" itemprop="datePublished">
                        5月 29</time>

Windows Time Machine 时间机器

">
                    <time class="is-text-small" datetime="2019-05-28T17:42:22.000Z" itemprop="datePublished">
                        5月 29</time>

美国电网分区 NERC Regions

">
                    <time class="is-text-small" datetime="2019-05-25T16:57:59.000Z" itemprop="datePublished">
                        5月 26</time>

韩文Hwp打开软件

                © 2019 Mengfei
                Powered by Hexo & Minos

            <button class="button is-small" aria-haspopup="true" aria-controls="dropdown-menu7">

                简体中文

            </button>

                    简体中文

                    English

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×

            <input type="text" class="searchbox-input ins-search-input" placeholder="站内搜索" />


text:
package io.druid.server.lookup.cache;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import io.druid.discovery.DiscoveryDruidNode;
import io.druid.discovery.DruidNodeDiscovery;
import io.druid.discovery.DruidNodeDiscoveryProvider;
import io.druid.discovery.LookupNodeService;
import io.druid.server.DruidNode;
import io.druid.server.http.HostAndPortWithScheme;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
 */
public class LookupNodeDiscoveryTest
{
  private DruidNodeDiscoveryProvider druidNodeDiscoveryProvider;
  private DruidNodeDiscovery druidNodeDiscovery;
  private LookupNodeDiscovery lookupNodeDiscovery;

  @Before
  public void setup()
  {
    druidNodeDiscoveryProvider = EasyMock.createStrictMock(DruidNodeDiscoveryProvider.class);

    druidNodeDiscovery = EasyMock.createStrictMock(DruidNodeDiscovery.class);

    EasyMock.expect(druidNodeDiscoveryProvider.getForService(LookupNodeService.DISCOVERY_SERVICE_KEY))
            .andReturn(druidNodeDiscovery);

    DiscoveryDruidNode node1 = new DiscoveryDruidNode(
        new DruidNode("s1", "h1", 8080, null, true, false),
        DruidNodeDiscoveryProvider.NODE_TYPE_HISTORICAL,
        ImmutableMap.of(
            LookupNodeService.DISCOVERY_SERVICE_KEY, new LookupNodeService("tier1"))
    );

    DiscoveryDruidNode node2 = new DiscoveryDruidNode(
        new DruidNode("s2", "h2", 8080, null, true, false),
        DruidNodeDiscoveryProvider.NODE_TYPE_PEON,
        ImmutableMap.of(
            LookupNodeService.DISCOVERY_SERVICE_KEY, new LookupNodeService("tier1"))
    );

    DiscoveryDruidNode node3 = new DiscoveryDruidNode(
        new DruidNode("s3", "h3", 8080, null, true, false),
        DruidNodeDiscoveryProvider.NODE_TYPE_PEON,
        ImmutableMap.of(
            LookupNodeService.DISCOVERY_SERVICE_KEY, new LookupNodeService("tier2"))
    );

    EasyMock.expect(druidNodeDiscovery.getAllNodes())
            .andReturn(ImmutableSet.of(node1, node2, node3))
            .anyTimes();;

    EasyMock.replay(druidNodeDiscoveryProvider, druidNodeDiscovery);

    lookupNodeDiscovery = new LookupNodeDiscovery(druidNodeDiscoveryProvider);
  }

  @Test
  public void testGetNodesInTier() throws Exception
  {
    Assert.assertEquals(
        ImmutableList.of(
            HostAndPortWithScheme.fromParts("http", "h1", 8080),
            HostAndPortWithScheme.fromParts("http", "h2", 8080)
        ),
        ImmutableList.copyOf(lookupNodeDiscovery.getNodesInTier("tier1"))
    );

    Assert.assertEquals(
        ImmutableList.of(
            HostAndPortWithScheme.fromParts("http", "h3", 8080)
        ),
        ImmutableList.copyOf(lookupNodeDiscovery.getNodesInTier("tier2"))
    );

    Assert.assertEquals(
        ImmutableList.of(),
        ImmutableList.copyOf(lookupNodeDiscovery.getNodesInTier("tier3"))
    );

    EasyMock.verify(druidNodeDiscoveryProvider, druidNodeDiscovery);
  }

  @Test
  public void testGetAllTiers() throws Exception
  {
    Assert.assertEquals(
        ImmutableSet.of("tier1", "tier2"),
        lookupNodeDiscovery.getAllTiers()
    );

    EasyMock.verify(druidNodeDiscoveryProvider, druidNodeDiscovery);
  }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using Hyak.Common;
using Microsoft.Azure.Management.BackupServices.Models;

namespace Microsoft.Azure.Management.BackupServices.Models
{
    /// <summary>
    /// The definition of a CSMContainerListResponse.
    /// </summary>
    public partial class CSMContainerListResponse : CSMListResponse
    {
        private IList<CSMContainerResponse> _value;

        /// <summary>
        /// Optional. List of container responses.
        /// </summary>
        public IList<CSMContainerResponse> Value
        {
            get { return this._value; }
            set { this._value = value; }
        }

        /// <summary>
        /// Initializes a new instance of the CSMContainerListResponse class.
        /// </summary>
        public CSMContainerListResponse()
        {
            this.Value = new LazyList<CSMContainerResponse>();
        }
    }
}


text:
A simple text adventure engine

## Installation

Add this line to your application's Gemfile:

    gem 'adventurer'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install adventurer

## Usage

TODO: Write usage instructions here

## Contributing

1. Fork it ( http://github.com/<my-github-username>/adventurer/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request