text:
package scalacookbook.chapter10

/**
  * Created by liguodong on 2016/7/24.
  */
object TransformOneCollectionForYield extends App {

  val a = Array(1, 2, 3, 4, 5)

  val eCopy = for (e <- a) yield e
  println(eCopy.toList)

  val eDouble = for (e <- a) yield e * 2
  println(eDouble.toList)

  val e2 = for (e <- a) yield e % 2
  println(e2.toList)

  println("----------------")

  val fruits = Vector("apple", "banana", "lime", "orange")

  val ucFruits = for (e <- fruits) yield e.toUpperCase
  println(ucFruits)

  // converts the original collection into a sequence of Tuple2 elements
  val indexVector = for (i <- 0 until fruits.length) yield (i, fruits(i))
  println(indexVector)

  //a sequence of Tuple2 elements that contains each original string
  //along with its length.
  val f = for (f <- fruits) yield (f, f.length)
  println(f)

  val x = for (e <- fruits) yield {
    // imagine this required multiple lines
    val s = e.toUpperCase
    s
  }
  println(x)

  println("---------------")

  case class Person (name: String)
  val friends = Vector("Mark", "Regina", "Matt")

  val person = for (f <- friends) yield Person(f)
  println(person)

  val x2 = for (e <- fruits if e.length < 6) yield e.toUpperCase
  println(x2)

  //Discussion
  val fruits2 = scala.collection.mutable.ArrayBuffer("apple", "banana")

  val x3 = for (e <- fruits2) yield e.toUpperCase
  println(x3)

  println("=====================")
  val fruits3 = "apple" :: "banana" :: "orange" :: Nil
  val x4 = for (e <- fruits3) yield e.toUpperCase
  println(x4)

  //Using guards

  val cars = Vector("Mercedes", "Porsche", "Tesla")
  val filterResult = for {
    c <- cars
    if c.startsWith("M")
  } yield c

  println(filterResult)
}


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

#ifndef TRANSFORM_UTIL_EARTH_CONSTANTS_H_
#define TRANSFORM_UTIL_EARTH_CONSTANTS_H_

namespace swri_transform_util
{
  /**
   * Earth equatorial radius in meters according to WGS84.
   */
  static const double _earth_equator_radius = 6378137.0;

  static const double _earth_mean_radius = 6371009.0;

  /**
   * Earth equatorial circumference in meters according to WGS84.
   */
  static const double _earth_equator_circumference = 40075016.69;

  /**
   * Earth 'first' eccentricity according to WGS84.
   */
  static const double _earth_eccentricity = 0.08181919084261;

  /**
   * Earth flattening according to WGS84.
   *
   * Flattening is a measure of the compression of a sphere along a diameter to
   * form an ellipsoid of revolution.
   *
   * See: http://en.wikipedia.org/wiki/Flattening
   */
  static const double _earth_flattening = 3.35281066475e-3;

  /**
   * Earth rotation rate in radians per second.
   */
  static const double _earth_rotation_rate = 7.292115e-5;
}

#endif  // TRANSFORM_UTIL_EARTH_CONSTANTS_H_

redpajama_set_name: RedPajamaGithub


text:
<?php
/**
* Admin theme page
* Admin can view and modify the them.
*
*
* @see, controllers/admin/theme.php
*
*/
?>

<? /*

<?php echo $page_title;?>

        <form action="<?=base_url("admin/theme/update");?>" method="post">

<?=$table_themes;?>

        <input type="submit" value="Update" class="leftmar short" />
        <input id="btn_cancel" type="reset" value="Cancel" class="short" />

        </form>

*/ ?>

<?php echo $page_title;?>

    <form action="<?=admin_base_url("theme/update");?>" method="post">
    <?=$table_themes;?>

        <input type="submit" value="Update" id="btn_update" class="leftmar short" /> <input id="btn_cancel" type="reset" value="Cancel" class="short" />

    </form>


text:
Project to create an MPS language from its textual description given with the PE grammar.

## Setup

The version of MPS to use is *MPS-3.3-RC1*.

## Getting started

This project utilizes the [PE project](https://github.com/mar9000/pe "PE project") to parse `.pe` files and construct the AST of the language described by the `.pe` file, the AST is then imported into MPS.

PE4MPS is at the moment capable to create:

  * Concepts.
  * Interfaces.
  * Enums.
  * Constrained datatype.
  * Concept editors with some intentions to display/hide optional child or property.

The TextGen aspect should be easily derived with rules similar to those used for generating editors and will be one of
next implemented features.

Once you have imported the project under `code/p24mps` in MPS:

  * a small language *org.mar9000.pemap* to create *PEMapping* nodes.
  * a PEMapping simply map an external `.pe` file to an MPS language.
  * the imported DOT language and its sandbox solution.
  * the plugin solution *org.mar9000.pe.import* used to add a menu to the *Tools* menu.
  * the solution *org.mar9000.pe.import* containing the *MPSPEImporter* class.

The solution *org.mar9000.pemap.sandbox* has a PEMapping already configured to import `/opt/working-dir/pe/tests/pe/DOT.pe` into the *org.mar9000.mps.DOT* language. If you want to test the import of the language you should put into *PE file path* the location of the DOT.pe file that you can find into the PE project.

The additional menu under *Tools* is *Import PE file* and appears only when you are over a *PEMapping* node.


text:
require "spec_helper"

describe Stacks::Backends::NamespacedBackend do

  before(:each) do
    @backend = Stacks::Backends::NamespacedBackend.new
    @backend.namespace = "test_namespace"
    @item = double
  end

  describe "#prefix_keys" do

    it "includes the namespace in the prefix keys" do
      @backend.prefix_keys.include?("test_namespace")
    end

  end

  describe "#prefix_key" do

    it "includes the name space in the full key" do
      @backend.prefix_key.include?("test_namespace")
    end

  end

  context "with prefix and suffix keys" do

    before(:each) do
      @item.stub(:key) { "test_key" }
      @item.stub(:value) { "test_value" }
    end

    describe "#get" do

      it "returns the unmarshaled value of what's stored for the item" do
        Stacks.redis.hset(@backend.prefix_key,
                           @backend.suffix_key(@item),
                           Marshal.dump(@item.value))
        @backend.get(@item).should == "test_value"
      end

    end

    describe "#set" do

      it "stores the marshaled version of an item's value in the cache" do
        @backend.set(@item)
        @backend.get(@item).should == "test_value"
      end

    end

    describe "#expire" do

      it "sets a redis expiration for the prefix key" do
        Stacks.redis.should_receive(:expire).with(@backend.prefix_key, 666)
        @backend.expire(@item, 666)
      end

    end

    describe "#clear_cache" do

      it "deletes all keys under the namespace" do
        backend1 = Stacks::Backends::NamespacedBackend.new
        backend1.namespace = "test_namespace1"
        backend2 = Stacks::Backends::NamespacedBackend.new
        backend2.namespace = "test_namespace2"

        backend1.set(@item)
        backend2.set(@item)

        backend1.get(@item).should == @item.value
        backend2.get(@item).should == @item.value

        backend1.clear_cache

        expect { backend1.get(@item) }.to raise_error(Stacks::NoValueException)
        backend2.get(@item).should == @item.value
      end

    end

    describe "#keys" do

      it "returns the various suffix keys used in the namespace" do
        @backend.set(@item)
        @backend.keys.should == [@item.key]
      end

    end

    describe "#del" do

      it "removes the item from the cache" do
        expect { @backend.get(@item) }.to raise_error(Stacks::NoValueException)
        @backend.set(@item)
        @backend.get(@item).should == "test_value"
        @backend.del(@item)
        expect { @backend.get(@item) }.to raise_error(Stacks::NoValueException)
      end

    end

  end

end


text:
using System.Linq;
using Eto.Forms;
using Xamarin.Forms;
using Xamarin.Forms.Platform.EtoForms.Renderers;

[assembly: ExportRenderer(typeof(StackLayout), typeof(StackLayoutRenderer))]

namespace Xamarin.Forms.Platform.EtoForms.Renderers {

    public class StackLayoutRenderer : LayoutRenderer<StackLayout> {

        public StackLayoutRenderer() {
            Control.Content = Table = new TableLayout();
        }

        public override void Clear() {
            base.Clear();
            Table.Rows.Clear();
        }

        public override void OnElementChanged() {
            base.OnElementChanged();
            CreateStack();
        }

        private TableLayout Table;

        protected void CreateStack() {
            Table.Rows.Clear();
            if (Element.Orientation == StackOrientation.Vertical)
                CreateVerticalStack();
            else
                CreateHorizonalStack();
        }

        protected void CreateHorizonalStack() {
            var controls = Element.Children.Select(e => new TableCell(Renderer.Render(e).Result, e.HorizontalOptions.Expands)).ToArray();
            var table = new TableLayout();
            Table.Rows.Add(new TableRow(table) { ScaleHeight = Element.VerticalOptions.Expands });
            table.Rows.Add(new TableRow(controls) { ScaleHeight = Element.VerticalOptions.Expands });

            //Table.Rows [0].Cells.Add (null);
        }

        protected void CreateVerticalStack() {
            foreach (var m in Element.Children) {
                var table = new TableLayout();

                Table.Rows.Add(new TableRow(table) { ScaleHeight = m.VerticalOptions.Expands });

                var cntrl = Renderer.Render(m).Result;
                var first = new TableCell(null, !m.HorizontalOptions.Expands);
                var center = new TableCell(null, !m.HorizontalOptions.Expands);
                var last = new TableCell(null, !m.HorizontalOptions.Expands);
                switch (m.HorizontalOptions.Alignment) {
                    case LayoutAlignment.Start:
                        first = new TableCell(cntrl, m.HorizontalOptions.Expands);
                        break;

                    case LayoutAlignment.Center:
                        center = new TableCell(cntrl, m.HorizontalOptions.Expands);
                        break;

                    case LayoutAlignment.End:
                        last = new TableCell(cntrl, m.HorizontalOptions.Expands);
                        break;

                    default:
                        var cell = new TableCell(cntrl, true);
                        table.Rows.Add(new TableRow(cell) { ScaleHeight = m.VerticalOptions.Expands });
                        continue;
                }

                table.Rows.Add(new TableRow(first, center, last) { ScaleHeight = m.VerticalOptions.Expands });
            }
            //Table.Rows.Add(null);
        }
    }
}


text:
@interface TIconicAlertAnimation : NSObject

- (instancetype)initWithPresent:(BOOL)isPresenting;

@end


text:
package com.blunderer.materialdesignlibrary.sample.scrollviews;

import android.os.Handler;

import com.blunderer.materialdesignlibrary.sample.R;

public class ScrollViewFragment
        extends com.blunderer.materialdesignlibrary.fragments.ScrollViewFragment {

    @Override
    public int getContentView() {
        return R.layout.fragment_scrollview;
    }

    @Override
    public boolean pullToRefreshEnabled() {
        return true;
    }

    @Override
    public int[] getPullToRefreshColorResources() {
        return new int[]{R.color.color_primary};
    }

    @Override
    public void onRefresh() {
        new Handler().postDelayed(new Runnable() {

            @Override
            public void run() {
                setRefreshing(false);
            }

        }, 2000);
    }

}


text:
package com.thejavageek;
import javax.xml.ws.Endpoint;
public class HelloWorldServerPublisher {

	public static void main(String[] args) {
		System.out.println("Beginning to publish HelloWorldService now");
		Endpoint.publish("http://127.0.0.1:9876/hw", new HelloWorldServerImpl());
		System.out.println("Done publishing");
	}

}


text:
package android.support.v7.app;

import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v7.internal.view.SupportMenuInflater;
import android.support.v7.internal.view.WindowCallbackWrapper;
import android.support.v7.internal.view.menu.MenuBuilder;
import android.support.v7.internal.widget.TintTypedArray;
import android.support.v7.view.ActionMode;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.Window;

// Referenced classes of package android.support.v7.app:
//            AppCompatDelegate, ActionBar, AppCompatCallback

abstract class AppCompatDelegateImplBase extends AppCompatDelegate
{
    private class ActionBarDrawableToggleImpl
        implements ActionBarDrawerToggle.Delegate
    {

        final AppCompatDelegateImplBase this$0;

        public Context getActionBarThemedContext()
        {
            return AppCompatDelegateImplBase.this.getActionBarThemedContext();
        }

        public Drawable getThemeUpIndicator()
        {
            TintTypedArray tinttypedarray = TintTypedArray.obtainStyledAttributes(getActionBarThemedContext(), null, new int[] {
                android.support.v7.appcompat.R.attr.homeAsUpIndicator
            });
            Drawable drawable = tinttypedarray.getDrawable(0);
            tinttypedarray.recycle();
            return drawable;
        }

        public boolean isNavigationVisible()
        {
            ActionBar actionbar = getSupportActionBar();
            return actionbar != null && (actionbar.getDisplayOptions() & 4) != 0;
        }

        public void setActionBarDescription(int i)
        {
            ActionBar actionbar = getSupportActionBar();
            if (actionbar != null)
            {
                actionbar.setHomeActionContentDescription(i);
            }
        }

        public void setActionBarUpIndicator(Drawable drawable, int i)
        {
            ActionBar actionbar = getSupportActionBar();
            if (actionbar != null)
            {
                actionbar.setHomeAsUpIndicator(drawable);
                actionbar.setHomeActionContentDescription(i);
            }
        }

        private ActionBarDrawableToggleImpl()
        {
            this$0 = AppCompatDelegateImplBase.this;
            super();
        }

    }

    class AppCompatWindowCallbackBase extends WindowCallbackWrapper
    {

        final AppCompatDelegateImplBase this$0;

        public boolean dispatchKeyEvent(KeyEvent keyevent)
        {
            return AppCompatDelegateImplBase.this.dispatchKeyEvent(keyevent) || super.dispatchKeyEvent(keyevent);
        }

        public boolean dispatchKeyShortcutEvent(KeyEvent keyevent)
        {
            return super.dispatchKeyShortcutEvent(keyevent) || onKeyShortcut(keyevent.getKeyCode(), keyevent);
        }

        public void onContentChanged()
        {
        }

        public boolean onCreatePanelMenu(int i, Menu menu)
        {
            if (i == 0 && !(menu instanceof MenuBuilder))
            {
                return false;
            } else
            {
                return super.onCreatePanelMenu(i, menu);
            }
        }

        public boolean onMenuOpened(int i, Menu menu)
        {
            return super.onMenuOpened(i, menu) || AppCompatDelegateImplBase.this.onMenuOpened(i, menu);
        }

        public void onPanelClosed(int i, Menu menu)
        {
            super.onPanelClosed(i, menu);
            AppCompatDelegateImplBase.this.onPanelClosed(i, menu);
        }

        public boolean onPreparePanel(int i, View view, Menu menu)
        {
            MenuBuilder menubuilder;
            boolean flag;
            if (menu instanceof MenuBuilder)
            {
                menubuilder = (MenuBuilder)menu;
            } else
            {
                menubuilder = null;
            }
            if (i == 0 && menubuilder == null)
            {
                flag = false;
            } else
            {
                if (menubuilder != null)
                {
                    menubuilder.setOverrideVisibleItems(true);
                }
                boolean flag1 = super.onPreparePanel(i, view, menu);
                flag = flag1;
                if (menubuilder != null)
                {
                    menubuilder.setOverrideVisibleItems(false);
                    return flag1;
                }
            }
            return flag;
        }

        AppCompatWindowCallbackBase(android.view.Window.Callback callback)
        {
            this$0 = AppCompatDelegateImplBase.this;
            super(callback);
        }
    }

    ActionBar mActionBar;
    final AppCompatCallback mAppCompatCallback;
    final android.view.Window.Callback mAppCompatWindowCallback;
    final Context mContext;
    boolean mHasActionBar;
    private boolean mIsDestroyed;
    boolean mIsFloating;
    MenuInflater mMenuInflater;
    final android.view.Window.Callback mOriginalWindowCallback;
    boolean mOverlayActionBar;
    boolean mOverlayActionMode;
    private CharSequence mTitle;
    final Window mWindow;
    boolean mWindowNoTitle;

    AppCompatDelegateImplBase(Context context, Window window, AppCompatCallback appcompatcallback)
    {
        mContext = context;
        mWindow = window;
        mAppCompatCallback = appcompatcallback;
        mOriginalWindowCallback = mWindow.getCallback();
        if (mOriginalWindowCallback instanceof AppCompatWindowCallbackBase)
        {
            throw new IllegalStateException("AppCompat has already installed itself into the Window");
        } else
        {
            mAppCompatWindowCallback = wrapWindowCallback(mOriginalWindowCallback);
            mWindow.setCallback(mAppCompatWindowCallback);
            return;
        }
    }

    abstract boolean dispatchKeyEvent(KeyEvent keyevent);

    final Context getActionBarThemedContext()
    {
        Context context = null;
        Object obj = getSupportActionBar();
        if (obj != null)
        {
            context = ((ActionBar) (obj)).getThemedContext();
        }
        obj = context;
        if (context == null)
        {
            obj = mContext;
        }
        return ((Context) (obj));
    }

    public final ActionBarDrawerToggle.Delegate getDrawerToggleDelegate()
    {
        return new ActionBarDrawableToggleImpl();
    }

    public MenuInflater getMenuInflater()
    {
        if (mMenuInflater == null)
        {
            initWindowDecorActionBar();
            Context context;
            if (mActionBar != null)
            {
                context = mActionBar.getThemedContext();
            } else
            {
                context = mContext;
            }
            mMenuInflater = new SupportMenuInflater(context);
        }
        return mMenuInflater;
    }

    public ActionBar getSupportActionBar()
    {
        initWindowDecorActionBar();
        return mActionBar;
    }

    final CharSequence getTitle()
    {
        if (mOriginalWindowCallback instanceof Activity)
        {
            return ((Activity)mOriginalWindowCallback).getTitle();
        } else
        {
            return mTitle;
        }
    }

    final android.view.Window.Callback getWindowCallback()
    {
        return mWindow.getCallback();
    }

    abstract void initWindowDecorActionBar();

    final boolean isDestroyed()
    {
        return mIsDestroyed;
    }

    public boolean isHandleNativeActionModesEnabled()
    {
        return false;
    }

    public final void onDestroy()
    {
        mIsDestroyed = true;
    }

    abstract boolean onKeyShortcut(int i, KeyEvent keyevent);

    abstract boolean onMenuOpened(int i, Menu menu);

    abstract void onPanelClosed(int i, Menu menu);

    abstract void onTitleChanged(CharSequence charsequence);

    final ActionBar peekSupportActionBar()
    {
        return mActionBar;
    }

    public void setHandleNativeActionModesEnabled(boolean flag)
    {
    }

    public final void setTitle(CharSequence charsequence)
    {
        mTitle = charsequence;
        onTitleChanged(charsequence);
    }

    abstract ActionMode startSupportActionModeFromWindow(android.support.v7.view.ActionMode.Callback callback);

    android.view.Window.Callback wrapWindowCallback(android.view.Window.Callback callback)
    {
        return new AppCompatWindowCallbackBase(callback);
    }
}


text:
package io.wearturilo.network;

import android.app.Application;
import com.octo.android.robospice.persistence.CacheManager;
import com.octo.android.robospice.persistence.exception.CacheCreationException;
import com.octo.android.robospice.retrofit.RetrofitGsonSpiceService;
import io.wearturilo.WearturiloApp;
import javax.inject.Inject;
import javax.inject.Named;
import retrofit.RestAdapter;

public class WearturiloRetrofitSpiceService extends RetrofitGsonSpiceService {

    @Inject
    @Named("MAIN")
    RestAdapter.Builder restAdapterBuilder;

    public void onCreate() {
        super.onCreate();
        addRetrofitInterface(StationListClient.class);
    }

    @Override
    protected String getServerUrl() {
        throw new UnsupportedOperationException("Shouldn't call");
    }

    @Override
    protected RestAdapter.Builder createRestAdapterBuilder() {
        return restAdapterBuilder;
    }

    @Override
    public int getThreadCount() {
        return 3;
    }

    @Override
    public CacheManager createCacheManager(Application application) throws CacheCreationException {
        WearturiloApp.component(this).inject(this);
        CacheManager cacheManager = new CacheManager();
        return cacheManager;
    }
}


text:
package com.njnu.kai.rn.modules;

import android.app.Activity;
import android.util.Log;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.devsupport.DevSupportManager;
import com.facebook.react.devsupport.DisabledDevSupportManager;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

/**
 */
public class ReactAppManagerModule extends ReactContextBaseJavaModule {

    private static final String TAG = "ReactAppManagerModule";

    private static final String REACT_APPLICATION_CLASS_NAME = "com.facebook.react.ReactApplication";
    private static final String REACT_NATIVE_HOST_CLASS_NAME = "com.facebook.react.ReactNativeHost";

    public ReactAppManagerModule(ReactApplicationContext reactContext) {
        super(reactContext);
    }

    @Override
    public String getName() {
        return "TestAppManager";
    }

    @ReactMethod
    public void restartPage(Promise promise) {
        final Activity currentActivity = getCurrentActivity();
        if (currentActivity == null) {
            Log.e(TAG, "restartPage activity is null");
        } else {
            currentActivity.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    reloadBundle();
                }
            });
        }
    }

    private void reloadBundle() {
        final Activity currentActivity = getCurrentActivity();

        if (!ReactActivity.class.isInstance(currentActivity)) {
            // Our preferred reload logic relies on the user's Activity inheriting
            // from the core ReactActivity class, so if it doesn't, we fallback
            // early to our legacy behavior.
            loadBundleLegacy(currentActivity);
        } else {
            try {
                ReactActivity reactActivity = (ReactActivity)currentActivity;
                ReactInstanceManager instanceManager;

                // #1) Get the ReactInstanceManager instance, which is what includes the
                //     logic to reload the current React context.
                try {
                    // In RN 0.29, the "mReactInstanceManager" field yields a null value, so we try
                    // to get the instance manager via the ReactNativeHost, which only exists in 0.29.
                    Method getApplicationMethod = ReactActivity.class.getMethod("getApplication");
                    Object reactApplication = getApplicationMethod.invoke(reactActivity);
                    Class reactApplicationClass = tryGetClass(REACT_APPLICATION_CLASS_NAME);
                    Method getReactNativeHostMethod = reactApplicationClass.getMethod("getReactNativeHost");
                    Object reactNativeHost = getReactNativeHostMethod.invoke(reactApplication);
                    Class reactNativeHostClass = tryGetClass(REACT_NATIVE_HOST_CLASS_NAME);
                    Method getReactInstanceManagerMethod = reactNativeHostClass.getMethod("getReactInstanceManager");
                    instanceManager = (ReactInstanceManager)getReactInstanceManagerMethod.invoke(reactNativeHost);
                } catch (Exception e) {
                    // The React Native version might be older than 0.29, so we try to get the
                    // instance manager via the "mReactInstanceManager" field.
                    Field instanceManagerField = ReactActivity.class.getDeclaredField("mReactInstanceManager");
                    instanceManagerField.setAccessible(true);
                    instanceManager = (ReactInstanceManager)instanceManagerField.get(reactActivity);
                }
                //restartPage instanceManager is: com.facebook.react.ReactInstanceManagerImpl
                Log.i(TAG, "restartPage instanceManager is: " + instanceManager.getClass().getName());
                try {
                    Field devSupportManagerField = instanceManager.getClass().getDeclaredField("mDevSupportManager");
                    devSupportManagerField.setAccessible(true);
                    DevSupportManager devSupportManager = (DevSupportManager)devSupportManagerField.get(instanceManager);
                    if (devSupportManager instanceof DisabledDevSupportManager) {
                        loadBundleLegacy(currentActivity);
                    } else {
                        devSupportManager.handleReloadJS();
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }

            } catch (Exception e) {
                // Our reflection logic failed somewhere
                // so fall back to restarting the Activity
                loadBundleLegacy(currentActivity);
            }
        }
    }

    private void loadBundleLegacy(final Activity currentActivity) {
        currentActivity.recreate();
    }

    private Class tryGetClass(String className) {
        try {
            return Class.forName(className);
        } catch (ClassNotFoundException e) {
            return null;
        }
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--Generated by crowdin.net-->
<resources>
  <string name="app_name">Dual Battery Widget</string>
  <string name="widget_name">Dual Battery Widget</string>
  <string name="widget_name_1x1">Dual Battery Widget 1x1</string>
  <string name="widget_name_2x2">Dual Battery Widget 2x2</string>
  <string name="widget_name_3x4">Dual Battery Widget 3x4</string>
  <string name="undocked">Nicht angedockt</string>
  <string name="unknown">Unbekannt</string>
  <string name="battery_main">Intern</string>
  <string name="battery_dock">Dock</string>
  <string name="settings">Einstellungen</string>
  <string name="sendFeedback">Feedback einsenden</string>
  <string name="showBatterySummary">Zeige Akkustatus</string>
  <string name="propHeader_BatteryInfo">Akkustand</string>
  <string name="propHeader_Properties">Widget-Einstellungen</string>
  <string name="propHeader_Feedback">Feedback</string>
  <string name="propHeader_Donate">Spenden</string>
  <string name="propHeader_About">Über</string>
  <string name="propTitle_General">Allgemein</string>
  <string name="propTitle_Dock">Einstellungen für den Akku im Dock</string>
  <string name="prop_batterySelection">Akku auswählen</string>
  <string name="prop_alwaysShowDock">Immer den Dock-Akku anzeigen</string>
  <string name="prop_alwaysShowDock_summary">Zeige die Dock-Batterie auch, wenn die externe Tastatur nicht verbunden ist</string>
  <string name="prop_showNotDockedMsg">Status im ungedockten Zustand anzeigen lassen</string>
  <string name="prop_showNotDockedMsg_summary">Wenn das Dock nicht angeschlossen ist, soll eine Nachricht über den fehlenden externen Akku angezeigt werden.</string>
  <string name="prop_textPosition">Textposition</string>
  <string name="prop_textPosition_summary">Platz für die Anzeige des Akkustatus (%s)</string>
  <string name="prop_textSize">Textgröße</string>
  <string name="prop_textColor">Textfarbe</string>
  <string name="prop_margin">Seitenwahl für die Anzeige</string>
  <string name="prop_margin_summary">Der Abstand soll so groß wie der Text sein (%s)</string>
  <string name="prop_showLabel">Das Akku-Label anzeigen lassen</string>
  <string name="prop_showLabel_summary">
        Zeigt das Akku-Label am unteren Rand.
        \nKann überschrieben werden, wenn der Akkustatus am gleichen Ort angezeigt wird.
    </string>
  <string name="prop_showDockHistory">Zeige altes Label</string>
  <string name="prop_showDockHistory_summary">Zeige den zuletzt gespeicherten Stand des Dock-Akkus, wenn das Dock nicht angeschlossen ist.</string>
  <string name="prop_swapBatteries">Wechsle die Batterie-Icons</string>
  <string name="prop_tempUnits">Einheit für die Temperatur</string>
  <string name="prop_showNotificationIcon">Zeige Benachrichtigungs-Icon</string>
  <string name="prop_showNotificationIcon_summary">Zeige die Akkukapazität in der Benachrichtigungsleiste</string>
  <string name="prop_defaultDaysTab">Standardzeitraum für Geschichte</string>
  <string name="sett_textPos_Invisible">Unsichtbar</string>
  <string name="sett_textPos_Above">Darüber</string>
  <string name="sett_textPos_Top">Oben</string>
  <string name="sett_textPos_Middle">Zentrum</string>
  <string name="sett_textPos_Bottom">Unten</string>
  <string name="sett_textPos_Below">Darunter</string>
  <string name="sett_battSel_Both">Beide</string>
  <string name="sett_battSel_Main">Nur den internen Akku</string>
  <string name="sett_battSel_Dock">Nur den Dock-Akku</string>
  <string name="sett_textColor_White">Weiß</string>
  <string name="sett_textColor_Black">Schwarz</string>
  <string name="sett_margin_None">Keine</string>
  <string name="sett_margin_Top">Oben</string>
  <string name="sett_margin_Bottom">Unten</string>
  <string name="sett_margin_Both">Beide</string>
  <string name="sett_tempUnits_C">Celsius</string>
  <string name="sett_tempUnits_F">Fahrenheit</string>
  <string name="sett_defaultDaysTab_3">3 Tage</string>
  <string name="sett_defaultDaysTab_7">7 Tage</string>
  <string name="sett_defaultDaysTab_30">30 Tage</string>
  <string name="about_0_head">Das Dual Battery Widget wurde ursprünglich für das Asus Eee Pad Transformer entwickelt, ein Gerät mit zweitem Akku in der Docking-Station. Leider bieten die standard Android-Tools keine Möglichkeit, die Kapazität des zweiten Akkus anzuzeigen. Diese App wurde daher erstellt, um diese Lücke zu füllen.
\n</string>
  <string name="about_1_author">Erstellt von: Artiom Chilaru</string>
  <string name="about_2_projectpage">Projektseite:</string>
  <string name="about_3_source">\nDas Widget ist open-source und steht unter der Apache 2.0 Lizenz
\nDu bist herzlich dazu eingeladen das Projekt auf GitHub zu forken:</string>
  <string name="about_4_translate">\nWenn du mit der Übersetzung des Projekts helfen möchtest, kannst du dies hier tun:</string>
  <string name="about_5_translators_thanks">\n
\nVielen Dank an all die Menschen, die bei der Übersetzung dieses Projekts geholfen haben, darunter:</string>
  <string name="feedback_head">Danke, dass du dir die Zeit für dieses Formular nimmst. Ich schätze deine Meinung und möchte das Widget immer verbessern.

Sag uns was du über das Widget denkst oder was du in den kommenden Versionen sehen möchtest und ich werde auf dich zurück kommen.     </string>
  <string name="feedback_hint">Bitte gib dein Feedback ein</string>
  <string name="battery_info_status_label">Akkustatus:</string>
  <string name="battery_info_last_charged_label">Letzter Zeitpunkt der Aufladung:</string>
  <string name="battery_info_scale_label">Akkukapazität:</string>
  <string name="battery_info_level_label">Akkustand:</string>
  <string name="battery_info_health_label">Gesundheitszustand des Akkus:</string>
  <string name="battery_info_technology_label">Akku-Art:</string>
  <string name="battery_info_voltage_label">Akkuspannung:</string>
  <string name="battery_info_voltage_units_mV">mV</string>
  <string name="battery_info_voltage_units_V">V</string>
  <string name="battery_info_temperature_label">Akkutemperatur:</string>
  <string name="battery_info_dock_status_label">Dock-Akku Status:</string>
  <string name="battery_info_dock_level_label">Dock Ladekapazität:</string>
  <string name="battery_info_dock_last_connected_label">Das Dock war zuletzt angeschlossen:</string>
  <string name="battery_info_status_charging">Lade</string>
  <string name="battery_info_status_discharging">Entlade</string>
  <string name="battery_info_status_not_charging">Lade nicht auf</string>
  <string name="battery_info_status_full">Voll</string>
  <string name="battery_info_health_good">Gut</string>
  <string name="battery_info_health_overheat">Überhitzt</string>
  <string name="battery_info_health_dead">Tot</string>
  <string name="battery_info_health_over_voltage">Überspannung</string>
  <string name="battery_info_health_unspecified_failure">Unbekannter Fehler</string>
  <string name="battery_info_dock_status_charging">Lade</string>
  <string name="battery_info_dock_status_discharging">Entlade</string>
  <string name="battery_info_dock_status_docked">Angedockt</string>
  <string name="battery_info_dock_status_undocked">Nicht angedockt</string>
  <string name="donate_head">Danke, dass du dich für die Unterstützung meines Widgets entschieden hast. Deine Hilfe wird sehr geschätzt!
\n
\nBitte wähle eine der unten stehenden Möglichkeiten     </string>
  <string name="donate_play">Google Play</string>
  <string name="donation_play_1">Standart (£0,99)</string>
  <string name="donation_play_3">Kauf mir einen Drink (£3,00)</string>
  <string name="donation_play_7">Wenn du wirklich Nummer 7 magst (£7,77)</string>
  <string name="donate_paypal">PayPal</string>
  <string name="donation_paypal">Zu PayPal gehen</string>
  <string name="alert_just_swapped">WICHTIG! Mit dieser Version haben wir die Standardreihenfolge der Widget-Icons geändert (du kannst sie wieder in den Widget-Einstellungen wechseln). Um die neuen Asus-Updates wieder zu spiegeln, werden der Dock-Akku links und die Hauptbatterie auf der rechten Seite erscheinen!</string>
</resources>


text:
<?php
App::uses('Video', 'Model');

/**
 * Video Test Case
 *
 */
class VideoTest extends CakeTestCase {

/**
 * Fixtures
 *
 * @var array
 */
	public $fixtures = array(
		'app.video',
		'app.section',
		'app.tagged',
		'app.tag'
	);

/**
 * setUp method
 *
 * @return void
 */
	public function setUp() {
		parent::setUp();
		$this->Video = ClassRegistry::init('Video');
	}

	public function testCreate() {
		$video = array(
			'Video' => array(
				'video' => 'https://www.youtube.com/watch?v=HE46n2Rs9Jo',
				'title' => 'Title 4',
				'blurb' => 'Lorem ipsum dolor sit amet',
				'section_id' => 1,
				'is_published' => 0,
				'published_date' => '2014-09-13',
				'published_time' => '14:41:50',
				'status' => 1),
		);

		$this->Video->save($video);

		$videos = $this->Video->find('all');
		$this->assertCount(4, $videos);
	}

	public function testEdit() {
		$video = array(
			'Video' => array(
				'id' => 1,
				'title' => 'New Title',
				'section_id' => 3,
				'video' => 'https://www.youtube.com/watch?v=HE46n2Rs9Jo',
				'published_date' => '2014-09-13',
				'published_time' => '14:41:50',
			),
		);

		$this->Video->save($video);

		$modified_video = $this->Video->findById(1);

		$this->assertEquals($video['Video']['title'], $modified_video['Video']['title']);
		$this->assertEquals($video['Video']['section_id'], $modified_video['Video']['section_id']);
		$this->assertEquals('HE46n2Rs9Jo', $modified_video['Video']['video_number']);
	}

	public function testFind() {
		$video = $this->Video->findById(1);

		$this->assertEquals('Link 1', $video['Video']['title']);
		$this->assertEquals('1', $video['Video']['section_id']);
		$this->assertEquals('https://www.youtube.com/watch?v=0KSOMA3QBU0', $video['Video']['video']);
	}
/**
 * tearDown method
 *
 * @return void
 */
	public function tearDown() {
		unset($this->Video);

		parent::tearDown();
	}

}


text:
#include "common/default_types/r1cs_ppzkpcd_pp.hpp"
#include "zk_proof_systems/pcd/r1cs_pcd/r1cs_sp_ppzkpcd/r1cs_sp_ppzkpcd.hpp"
#include "zk_proof_systems/pcd/r1cs_pcd/r1cs_sp_ppzkpcd/examples/run_r1cs_sp_ppzkpcd.hpp"

using namespace libsnark;

template<typename PCD_ppT>
void profile_tally(const size_t arity, const size_t max_layer)
{
    const size_t wordsize = 32;
    const bool test_serialization = true;
    const bool bit = run_r1cs_sp_ppzkpcd_tally_example<PCD_ppT>(wordsize, arity, max_layer, test_serialization);
    assert(bit);
}

int main(void)
{
    typedef default_r1cs_ppzkpcd_pp PCD_pp;

    start_profiling();
    PCD_pp::init_public_params();

    const size_t arity = 2;
    const size_t max_layer = 2;

    profile_tally<PCD_pp>(arity, max_layer);
}


text:
module Azure::Relay::Mgmt::V2017_04_01
  module Models
    #
    # Definition of resource.
    #
    class ResourceNamespacePatch < Resource

      include MsRestAzure

      # @return [Hash{String => String}] Resource tags.
      attr_accessor :tags

      #
      # Mapper for ResourceNamespacePatch class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'ResourceNamespacePatch',
          type: {
            name: 'Composite',
            class_name: 'ResourceNamespacePatch',
            model_properties: {
              id: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'id',
                type: {
                  name: 'String'
                }
              },
              name: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'name',
                type: {
                  name: 'String'
                }
              },
              type: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'type',
                type: {
                  name: 'String'
                }
              },
              tags: {
                client_side_validation: true,
                required: false,
                serialized_name: 'tags',
                type: {
                  name: 'Dictionary',
                  value: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'StringElementType',
                      type: {
                        name: 'String'
                      }
                  }
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
import os
import numpy as np

import sys
sys.path.append('/home/ilya/code/mlxtend')
from mlxtend.plotting import plot_learning_curves
from sklearn import decomposition
from sklearn.model_selection import StratifiedShuffleSplit, StratifiedKFold
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.neighbors import KNeighborsClassifier
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import FunctionTransformer
from sklearn.preprocessing import Imputer
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC

from data_load import load_data
sys.path.append('/home/ilya/xgboost/xgboost/python-package/')
import xgboost as xgb
from keras.constraints import maxnorm
from keras.layers import Dense, Dropout
from keras.models import Sequential
from keras.optimizers import SGD
from keras.wrappers.scikit_learn import KerasClassifier

data_dir = '/home/ilya/code/ml4vs/data/LMC_SC20__corrected_list_of_variables/raw_index_values'
file_1 = 'vast_lightcurve_statistics_variables_only.log'
file_0 = 'vast_lightcurve_statistics_constant_only.log'
file_0 = os.path.join(data_dir, file_0)
file_1 = os.path.join(data_dir, file_1)
names = ['Magnitude', 'clipped_sigma', 'meaningless_1', 'meaningless_2',
         'star_ID', 'weighted_sigma', 'skew', 'kurt', 'I', 'J', 'K', 'L',
         'Npts', 'MAD', 'lag1', 'RoMS', 'rCh2', 'Isgn', 'Vp2p', 'Jclp', 'Lclp',
         'Jtim', 'Ltim', 'CSSD', 'Ex', 'inv_eta', 'E_A', 'S_B', 'NXS', 'IQR']
names_to_delete = ['meaningless_1', 'meaningless_2', 'star_ID',
                   'Npts', 'CSSD', 'clipped_sigma', 'lag1', 'L', 'Lclp', 'Jclp',
                   'MAD', 'Ltim']
X, y, df, feature_names, delta = load_data([file_0, file_1], names,
                                           names_to_delete)
target = 'variable'
predictors = list(df)
predictors.remove(target)

# Function that transforms some features
def log_axis(X_, names=None):
    X = X_.copy()
    tr_names = ['clipped_sigma', 'weighted_sigma', 'RoMS', 'rCh2', 'Vp2p',
                'Ex', 'inv_eta', 'S_B']
    for name in tr_names:
        try:
            # print "Log-Transforming {}".format(name)
            i = names.index(name)
            X[:, i] = np.log(X[:, i])
        except ValueError:
            print "No {} in predictors".format(name)
            pass
    return X

clf_xgb = xgb.XGBClassifier(n_estimators=87, learning_rate=0.111,
                            max_depth=6,
                            min_child_weight=2,
                            subsample=0.275,
                            colsample_bytree=0.85,
                            colsample_bylevel=0.55,
                            gamma=3.14,
                            max_delta_step=7,
                            scale_pos_weight=6,
                            seed=1)

# Create model for NN
def create_baseline():
    model = Sequential()
    model.add(Dense(18, input_dim=18, init='normal', activation='relu',
                    W_constraint=maxnorm(9.388)))
    model.add(Dropout(0.04))
    model.add(Dense(13, init='normal', activation='relu',
                    W_constraint=maxnorm(2.72)))
    # model.add(Activation(space['Activation']))
    model.add(Dropout(0.09))
    model.add(Dense(1, init='normal', activation='sigmoid'))

    # Compile model
    learning_rate = 0.213
    decay_rate = 0.001
    momentum = 0.9
    sgd = SGD(lr=learning_rate, decay=decay_rate, momentum=momentum,
              nesterov=False)
    model.compile(loss='binary_crossentropy', optimizer=sgd,
                  metrics=['accuracy'])
    return model
estimators = list()
estimators.append(('imputer', Imputer(missing_values='NaN', strategy='median',
                                      axis=0, verbose=2)))
estimators.append(('scaler', StandardScaler()))
estimators.append(('mlp', KerasClassifier(build_fn=create_baseline,
                                          nb_epoch=175,
                                          batch_size=1024,
                                          verbose=2)))
clf_nn = Pipeline(estimators)

clf_rf = RandomForestClassifier(n_estimators=1400,
                                max_depth=16,
                                max_features=5,
                                min_samples_split=16,
                                min_samples_leaf=2,
                                class_weight={0: 1, 1: 28},
                                verbose=1, random_state=1, n_jobs=4)

# Create model for LR
clf = LogisticRegression(C=1.29, class_weight={0: 1, 1: 2},
                         random_state=1, max_iter=300, n_jobs=1,
                         tol=10.**(-5))
pca = decomposition.PCA(n_components=16, random_state=1)
estimators = list()
estimators.append(('imputer', Imputer(missing_values='NaN', strategy='median',
                                      axis=0, verbose=2)))
estimators.append(('func', FunctionTransformer(log_axis, kw_args={'names':
                                                                      predictors})))
estimators.append(('scaler', StandardScaler()))
estimators.append(('pca', pca))
estimators.append(('clf', clf))
clf_lr = Pipeline(estimators)

# Model for kNN
clf = KNeighborsClassifier(n_neighbors=6,
                           weights='distance', n_jobs=4)
estimators = list()
estimators.append(('imputer', Imputer(missing_values='NaN', strategy='median',
                                      axis=0, verbose=2)))
estimators.append(('scaler', StandardScaler()))
estimators.append(('clf', clf))
clf_knn = Pipeline(estimators)

# Model for SVM
clf = SVC(C=37.3, class_weight={0: 1, 1: 3}, probability=False,
          gamma=0.0126, random_state=1)
estimators = list()
estimators.append(('imputer', Imputer(missing_values='NaN', strategy='median',
                                      axis=0, verbose=2)))
estimators.append(('scaler', StandardScaler()))
estimators.append(('clf', clf))
clf_svm = Pipeline(estimators)

# sss = StratifiedShuffleSplit(n_splits=4, test_size=0.25, random_state=1)
# errors_full = list()
# for train_index, test_index in sss.split(X, y):
#     X_train, X_test = X[train_index], X[test_index]
#     y_train, y_test = y[train_index], y[test_index]
#     errors = plot_learning_curves(X_train, y_train, X_test, y_test, clf_lr,
#                                   scoring='f1', print_model=False)
#     errors_full.append(errors)

cv = StratifiedShuffleSplit(n_splits=20, test_size=0.25, random_state=0)
from plotting import plot_learning_curve
plot_learning_curve(clf_xgb, 'SGB', X, y, cv=cv, n_jobs=4, scoring='f1')


text:
import scrapy
import talib
from mykgb import indicator
from myapp.models import *
from mykgb.items import *

class PriceDailySignalSpider(scrapy.Spider):
    name = "price_daily_signal"
    allowed_domains = ["www.sina.com"]
    start_urls = ['http://www.sina.com/']

    def parse(self, response):
        # print(response.body)
        Signal.objects.all().delete()
        Signal.objects.update(macd=0, kdj=0, rsi=0, cci=0)
        codes = Codeset.objects.filter(actived=True)
        for code in codes:
            qs = Price.objects.filter(code=code).order_by('date')
            df = qs.to_dataframe(index='date')
            macd = indicator.get_macd(df)
            kdj = indicator.get_kdj(df)
            rsi = indicator.get_rsi(df)
            cci = indicator.get_cci(df)
            signal, created = Signal.objects.update_or_create(code=code)
            signal.macd = sum(macd.values())
            signal.kdj = sum(kdj.values())
            signal.rsi = sum(rsi.values())
            signal.cci = sum(cci.values())
            signal.save()
        signal_msg = self.send_signal()
        # sm("最新版内盘信号", signal_msg, self.receiver, self.msg_cc)

    def send_signal(self):
        signal = ''
        df = Signal.objects.all().to_dataframe()
        df['signal'] = df['macd'] + df['kdj'] + df['rsi'] + df['cci']
        df = df[df['signal'] != 0].sort_values(by=['signal'], ascending=[-1])
        print(df)
        for index, row in df.iterrows():
            if row['signal'] <= 0:
                signal += u'
做空 ' + row['code'] + u'强度:' + str(row['signal'])
                '
'
            else:
                signal += u'
做多 ' + row['code'] + u'强度:' + str(row['signal'])
                '
'
            signal += '
' + '  macd:' + str(row['macd']) + '  macd:' + str(row['kdj']) + '  kdj:' + str(
                row['macd']) + '  rsi:' + str(row[
                                                  'rsi']) + '  cci:' + \
                      str(row['cci']) + '
'
        return signal


text:
var test = require('tape');
var segments = require('../');
var linearize = require('svg-linearize');
var fs = require('fs');
var src = fs.readFileSync(__dirname + '/files/face.svg', 'utf8');
var expected = require('./files/face.json');

test('points', function (t) {
    t.plan(1);
    var div = document.createElement('div');
    div.innerHTML = src;

    var svg = div.querySelector('svg');
    var points = segments(linearize(svg));
    t.deepEqual(points, expected);
});


text:
import { Component,OnChanges,HostListener } from '@angular/core';

import '../js/test.js';

const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html'
})

export class AppComponent {
	text = '';
	rText = '';
	key;

	oldLength = 10;
	length = 10;

	constructor(){
		this.generate();
	}

	@HostListener('document:keypress', ['$event'])
	handleKeyboardEvent(event: KeyboardEvent) {
		this.key = event.key;
		if ((event.keyCode ? event.keyCode : event.which) == 13) { //Enter keycode
			this.generate();
		}
	}

	ngDoCheck(){
		if(this.oldLength!=this.length){
			this.oldLength = this.length;

			if(this.length==42){
				console.log(':)');
			}
		}

		this.rText = this.text.split("").reverse().join("").substring(0,this.length)+(this.text.length>this.length?"...":"");
	}

	generate(){
		this.text = '';

		for( var i=0; i < this.length; i++ )
        	this.text += possible.charAt(Math.floor(Math.random() * possible.length));
	}
}


text:
#include "btActivatingCollisionAlgorithm.h"
#include "btCollisionDispatcher.h"
#include "btCollisionObject.h"

btActivatingCollisionAlgorithm::btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci)
:btCollisionAlgorithm(ci)
//,
//m_colObj0(0),
//m_colObj1(0)
{
}
btActivatingCollisionAlgorithm::btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* colObj0,btCollisionObject* colObj1)
:btCollisionAlgorithm(ci)
//,
//m_colObj0(0),
//m_colObj1(0)
{
//	if (ci.m_dispatcher1->needsCollision(colObj0,colObj1))
//	{
//		m_colObj0 = colObj0;
//		m_colObj1 = colObj1;
//
//		m_colObj0->activate();
//		m_colObj1->activate();
//	}
}

btActivatingCollisionAlgorithm::~btActivatingCollisionAlgorithm()
{
//		m_colObj0->activate();
//		m_colObj1->activate();
}


text:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <title>rubygems_version (Rails::GemBoot)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />

# File test_rails_app/config/boot.rb, line 69
      def rubygems_version
        Gem::RubyGemsVersion rescue nil
      end


text:
from decimal import Decimal as D

import factory
from oscar.core.loading import get_model

class AccountFactory(factory.django.DjangoModelFactory):
    start_date = None
    end_date = None

    class Meta:
        model = get_model('oscar_accounts', 'Account')

class TransferFactory(factory.django.DjangoModelFactory):
    source = factory.SubFactory(AccountFactory)
    destination = factory.SubFactory(AccountFactory)

    class Meta:
        model = get_model('oscar_accounts', 'Transfer')

    @classmethod
    def _create(cls, model_class, *args, **kwargs):
        instance = model_class(**kwargs)
        instance.save()
        return instance

class TransactionFactory(factory.django.DjangoModelFactory):
    amount = D('10.00')
    transfer = factory.SubFactory(
        TransferFactory, amount=factory.SelfAttribute('..amount'))
    account = factory.SubFactory(AccountFactory)

    class Meta:
        model = get_model('oscar_accounts', 'Transaction')


text:
import { AfterContentInit, EventEmitter } from '@angular/core';
import { DateAdapter, MdDateFormats } from '@angular/material/core';
import { MdCalendarCell } from './calendar-body';
/**
 * An internal component used to display a single year in the datepicker.
 * @docs-private
 */
export declare class MdYearView<D> implements AfterContentInit {
    _dateAdapter: DateAdapter<D>;
    private _dateFormats;
    /** The date to display in this year view (everything other than the year is ignored). */
    activeDate: D;
    private _activeDate;
    /** The currently selected date. */
    selected: D | null;
    private _selected;
    /** A function used to filter which dates are selectable. */
    dateFilter: (date: D) => boolean;
    /** Emits when a new month is selected. */
    selectedChange: EventEmitter<D>;
    /** Grid of calendar cells representing the months of the year. */
    _months: MdCalendarCell[][];
    /** The label for this year (e.g. "2017"). */
    _yearLabel: string;
    /** The month in this year that today falls on. Null if today is in a different year. */
    _todayMonth: number | null;
    /**
     * The month in this year that the selected Date falls on.
     * Null if the selected Date is in a different year.
     */
    _selectedMonth: number | null;
    constructor(_dateAdapter: DateAdapter<D>, _dateFormats: MdDateFormats);
    ngAfterContentInit(): void;
    /** Handles when a new month is selected. */
    _monthSelected(month: number): void;
    /** Initializes this month view. */
    private _init();
    /**
     * Gets the month in this year that the given Date falls on.
     * Returns null if the given Date is in another year.
     */
    private _getMonthInCurrentYear(date);
    /** Creates an MdCalendarCell for the given month. */
    private _createCellForMonth(month, monthName);
    /** Whether the given month is enabled. */
    private _isMonthEnabled(month);
}


text:
Public Class ParamRepCajaBancosConciliacion
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.RadComboBox3.Filter = 1
        Me.RadComboBox1.Filter = 1
        Me.RadComboBox4.Filter = 1
        If Me.Page.IsPostBack = False Then
            Me.RadDatePicker1.SelectedDate = Date.Parse(Session("Fecha"))
        End If
    End Sub

    Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
        Dim idProyecto As Int32 = 0
        Dim CuentaInicio As String = ""
        Dim CuentaFin As String = ""

        If Me.RadComboBox3.SelectedValue.Length > 0 Then
            idProyecto = Me.RadComboBox3.SelectedValue
        End If
        If Me.RadComboBox1.SelectedValue.Length > 0 Then
            CuentaInicio = Me.RadComboBox1.SelectedValue
        End If
        If Me.RadComboBox4.SelectedValue.Length > 0 Then
            CuentaFin = Me.RadComboBox4.SelectedValue
        End If

        Dim cadena_java As String
        cadena_java = "<script type='text/javascript'> " & _
                                         " window.open('ReporteCajaBancosConciliacion.aspx?Fecha=" + Me.RadDatePicker1.SelectedDate.ToString + "&idProyecto=" + idProyecto.ToString + "&CuentaInicio=" + CuentaInicio.ToString + "&CuentaFin=" + CuentaFin.ToString + "' ); " & _
                                         Chr(60) & "/script>"
        ScriptManager.RegisterStartupScript(Page, GetType(Page), "Cerrar", cadena_java.ToString, False)

    End Sub

    Protected Sub RadComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles RadComboBox1.SelectedIndexChanged
        Me.RadComboBox4.Text = ""
        Me.RadComboBox4.SelectedValue = Me.RadComboBox1.SelectedValue
        Me.RadComboBox4.Text = Me.RadComboBox1.Text
    End Sub

End Class


text:
package localsearch.domainspecific.vehiclerouting.apps.truckcontainer;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.logging.Level;

import localsearch.domainspecific.vehiclerouting.apps.sharedaride.ShareARide;
import localsearch.domainspecific.vehiclerouting.apps.truckcontainer.model.ContainerTruckMoocInput;
import localsearch.domainspecific.vehiclerouting.apps.truckcontainer.model.Mooc;
import localsearch.domainspecific.vehiclerouting.apps.truckcontainer.model.Truck;
import localsearch.domainspecific.vehiclerouting.vrp.Constants;
import localsearch.domainspecific.vehiclerouting.vrp.ConstraintSystemVR;
import localsearch.domainspecific.vehiclerouting.vrp.IFunctionVR;
import localsearch.domainspecific.vehiclerouting.vrp.VRManager;
import localsearch.domainspecific.vehiclerouting.vrp.VarRoutesVR;
import localsearch.domainspecific.vehiclerouting.vrp.entities.ArcWeightsManager;
import localsearch.domainspecific.vehiclerouting.vrp.entities.Point;
import localsearch.domainspecific.vehiclerouting.vrp.invariants.AccumulatedWeightNodesVR;
import localsearch.domainspecific.vehiclerouting.vrp.invariants.EarliestArrivalTimeVR;

public class SearchOptimumSolution {
	TruckContainerSolver tcs;

	public SearchOptimumSolution(TruckContainerSolver tcs){
		super();
		this.tcs = tcs;
	}

	public void allRemoval(){
		System.out.println("all removal");
		tcs.mgr.performRemoveAllClientPoints();
		for(int i = 0; i < tcs.pickupPoints.size(); i++){
			Point pickup = tcs.pickupPoints.get(i);
			if(!tcs.rejectPickupPoints.contains(pickup)){
				tcs.rejectPickupPoints.add(pickup);
				tcs.rejectDeliveryPoints.add(tcs.pickup2Delivery.get(pickup));
			}
		}
		for(int k : tcs.group2marked.keySet())
			tcs.group2marked.put(k, 0);
	}

	public void routeRemoval(){
		Random r = new Random();
		int k = r.nextInt(tcs.XR.getNbRoutes()) + 1;
		System.out.println("routeRemoval: index of removed route = " + k);
		Point x = tcs.XR.getStartingPointOfRoute(k);
		Point next_x = tcs.XR.next(x);
		while(next_x != tcs.XR.getTerminatingPointOfRoute(k)){
			x = next_x;
			next_x = tcs.XR.next(x);
			tcs.mgr.performRemoveOnePoint(x);
			tcs.group2marked.put(tcs.point2Group.get(x), 0);
			if(tcs.point2Type.get(x) != tcs.START_MOOC
				&& tcs.point2Type.get(x) != tcs.END_MOOC){
				if(tcs.pickup2Delivery.keySet().contains(x))
					tcs.rejectPickupPoints.add(x);
				else
					tcs.rejectDeliveryPoints.add(x);
			}
			tcs.nChosed.put(x, tcs.nChosed.get(x)+1);
		}
		int groupTruck = tcs.point2Group.get(tcs.XR.getStartingPointOfRoute(k));
		tcs.group2marked.put(groupTruck, 0);
	}

	public void randomRequestRemoval(){
		Random R = new Random();
		int n = R.nextInt(tcs.upper_removal-tcs.lower_removal+1) + tcs.lower_removal;
		System.out.println("randomReqRemoval:number of removed request = " + n);
		if(n >= tcs.pickupPoints.size()){
			tcs.mgr.performRemoveAllClientPoints();
			for(int i = 0; i < tcs.pickupPoints.size(); i++){
				Point pickup = tcs.pickupPoints.get(i);
				if(!tcs.rejectPickupPoints.contains(pickup)){
					tcs.rejectPickupPoints.add(pickup);
					tcs.rejectDeliveryPoints.add(tcs.pickup2Delivery.get(pickup));
				}
			}
			for(int k : tcs.group2marked.keySet())
				tcs.group2marked.put(k, 0);
		}
		else{
			int i = 0;
			int c = 0;
			while(i < n && c++ < tcs.pickupPoints.size()){
				if(tcs.rejectPickupPoints.size() == tcs.pickupPoints.size())
					break;

				int rand = R.nextInt(tcs.pickupPoints.size());
				Point pickup = tcs.pickupPoints.get(rand);
				int ridx = tcs.XR.route(pickup);
				if(ridx == Constants.NULL_POINT)
					continue;
				if(!tcs.removeAllowed.get(pickup))
					continue;
				Point delivery = tcs.pickup2Delivery.get(tcs.pickupPoints.get(rand));
				tcs.mgr.performRemoveTwoPoints(pickup, delivery);
				tcs.rejectPickupPoints.add(pickup);
				tcs.rejectDeliveryPoints.add(delivery);
				tcs.group2marked.put(tcs.point2Group.get(pickup), 0);
				tcs.group2marked.put(tcs.point2Group.get(delivery), 0);
				if(tcs.XR.index(tcs.XR.getTerminatingPointOfRoute(ridx)) <= 1){
					int groupTruck = tcs.point2Group.get(tcs.XR.getStartingPointOfRoute(ridx));
					tcs.group2marked.put(groupTruck, 0);
				}
				i++;
				tcs.nChosed.put(pickup, tcs.nChosed.get(pickup)+1);
				tcs.nChosed.put(delivery, tcs.nChosed.get(delivery)+1);
			}
		}
	}

	public void shaw_removal(){
		Random R = new Random();
		int nRemove = R.nextInt(tcs.upper_removal-tcs.lower_removal+1) + tcs.lower_removal;

		System.out.println("Shaw removal : number of request removed = " + nRemove);

		int ipRemove;

		/*
		 * select randomly request r1 and its delivery dr1
		 */
		Point r1 = null;
		int c = 0;
		do{
			if(tcs.rejectPickupPoints.size() == tcs.pickupPoints.size()
				|| c++ < tcs.pickupPoints.size()){
				r1 = null;
				break;
			}
			ipRemove = R.nextInt(tcs.pickupPoints.size());
			r1 = tcs.pickupPoints.get(ipRemove);
		}while(nRemove > 0 && (tcs.rejectPickupPoints.contains(r1) || !tcs.removeAllowed.get(r1)));

		Point dr1 = null;
		if(r1 != null)
			dr1 = tcs.pickup2Delivery.get(r1);

		/*
		 * Remove request most related with r1
		 */
		int inRemove = 0;
		while(inRemove++ != nRemove && r1 != null && dr1 != null){

			Point removedPickup = null;
			Point removedDelivery = null;
			double relatedMin =  Double.MAX_VALUE;

			int routeOfR1 = tcs.XR.route(r1);
			/*
			 * Compute arrival time at request r1 and its delivery dr1
			 */
			System.out.println(r1 + " " + inRemove);
			System.out.println(routeOfR1);
			double arrivalTimeR1 = tcs.eat.getEarliestArrivalTime(tcs.XR.prev(r1))+
					tcs.serviceDuration.get(tcs.XR.prev(r1))+
					tcs.awm.getDistance(tcs.XR.prev(r1), r1);

			double serviceTimeR1 = 1.0*tcs.earliestAllowedArrivalTime.get(r1);
			serviceTimeR1 = arrivalTimeR1 > serviceTimeR1 ? arrivalTimeR1 : serviceTimeR1;

			double depatureTimeR1 = serviceTimeR1 + tcs.serviceDuration.get(r1);

			double arrivalTimeDR1 = tcs.eat.getEarliestArrivalTime(tcs.XR.prev(dr1))+
					tcs.serviceDuration.get(tcs.XR.prev(dr1))+
					tcs.awm.getDistance(tcs.XR.prev(dr1), dr1);

			double serviceTimeDR1 = 1.0*tcs.earliestAllowedArrivalTime.get(dr1);
			serviceTimeDR1 = arrivalTimeDR1 > serviceTimeDR1 ? arrivalTimeDR1 : serviceTimeDR1;

			double depatureTimeDR1 = serviceTimeDR1 + tcs.serviceDuration.get(dr1);

			tcs.rejectPickupPoints.add(r1);
			tcs.rejectDeliveryPoints.add(dr1);
			tcs.nChosed.put(r1, tcs.nChosed.get(r1)+1);
			tcs.nChosed.put(dr1, tcs.nChosed.get(dr1)+1);

			int ridx = tcs.XR.route(r1);
			tcs.group2marked.put(tcs.point2Group.get(r1), 0);
			tcs.group2marked.put(tcs.point2Group.get(dr1), 0);
			tcs.mgr.performRemoveTwoPoints(r1, dr1);

			if(tcs.XR.index(tcs.XR.getTerminatingPointOfRoute(ridx)) <= 1){
				int groupTruck = tcs.point2Group.get(tcs.XR.getStartingPointOfRoute(ridx));
				tcs.group2marked.put(groupTruck, 0);
			}
			/*
			 * find the request is the most related with r1
			 */
			for(int k=1; k<=tcs.XR.getNbRoutes(); k++){
				Point x = tcs.XR.getStartingPointOfRoute(k);
				for(x = tcs.XR.next(x); x != tcs.XR.getTerminatingPointOfRoute(k); x = tcs.XR.next(x)){
					if(!tcs.removeAllowed.get(x))
						continue;
					Point dX = tcs.pickup2Delivery.get(x);
					if(dX == null)
						continue;

					/*
					 * Compute arrival time of x and its delivery dX
					 */
					double arrivalTimeX = tcs.eat.getEarliestArrivalTime(tcs.XR.prev(x))+
							tcs.serviceDuration.get(tcs.XR.prev(x))+
							tcs.awm.getDistance(tcs.XR.prev(x), x);

					double serviceTimeX = 1.0*tcs.earliestAllowedArrivalTime.get(x);
					serviceTimeX = arrivalTimeX > serviceTimeX ? arrivalTimeX : serviceTimeX;

					double depatureTimeX = serviceTimeX + tcs.serviceDuration.get(x);

					double arrivalTimeDX =  tcs.eat.getEarliestArrivalTime(tcs.XR.prev(dX))+
							tcs.serviceDuration.get(tcs.XR.prev(dX))+
							tcs.awm.getDistance(tcs.XR.prev(dX), dX);

					double serviceTimeDX = 1.0*tcs.earliestAllowedArrivalTime.get(dX);
					serviceTimeDX = arrivalTimeDX > serviceTimeDX ? arrivalTimeDX : serviceTimeDX;

					double depatureTimeDX = serviceTimeDX + tcs.serviceDuration.get(dX);

					/*
					 * Compute related between r1 and x
					 */
					int lr1x;
					if(routeOfR1 == k){
						lr1x = 1;
					}else{
						lr1x = -1;
					}

					double related = tcs.shaw1st*(tcs.awm.getDistance(r1, x) + tcs.awm.getDistance(dX, dr1))+
							tcs.shaw2nd*(Math.abs(depatureTimeR1-depatureTimeX) + Math.abs(depatureTimeDX-depatureTimeDR1))+
							tcs.shaw3rd*lr1x;
					if(related < relatedMin){
						relatedMin = related;
						removedPickup = x;
						removedDelivery = dX;
					}
				}
			}

			r1 = removedPickup;
			dr1 = removedDelivery;
			if(r1 != null){
				tcs.nChosed.put(r1, tcs.nChosed.get(r1)+1);
				tcs.nChosed.put(dr1, tcs.nChosed.get(dr1)+1);
			}
		}

	}

	public void worst_removal(){
		Random R = new Random();
		int nRemove = R.nextInt(tcs.upper_removal-tcs.lower_removal+1) + tcs.lower_removal;
		System.out.println("worstRemoval: nRemove = " + nRemove);

		int inRemove = 0;
		int c = 0;
		while(inRemove++ != nRemove && c++ < tcs.pickupPoints.size()){
			if(tcs.rejectPickupPoints.size() == tcs.pickupPoints.size())
				break;
			double maxCost = Double.MIN_VALUE;
			Point removedPickup = null;
			Point removedDelivery = null;

			for(int k=1; k<=tcs.XR.getNbRoutes(); k++){
				Point x = tcs.XR.getStartingPointOfRoute(k);
				for(x = tcs.XR.next(x); x != tcs.XR.getTerminatingPointOfRoute(k); x = tcs.XR.next(x)){

					if(!tcs.removeAllowed.get(x))
						continue;

					Point dX = tcs.pickup2Delivery.get(x);
					if(dX == null){
						continue;
					}

					double cost = tcs.objective.evaluateRemoveTwoPoints(x, dX);
					if(cost > maxCost){
						maxCost = cost;
						removedPickup = x;
						removedDelivery = dX;
					}
				}
			}

			if(removedDelivery == null || removedPickup == null)
				break;
			int ridx = tcs.XR.route(removedPickup);
			tcs.rejectPickupPoints.add(removedPickup);
			tcs.rejectDeliveryPoints.add(removedDelivery);

			tcs.nChosed.put(removedDelivery, tcs.nChosed.get(removedDelivery)+1);
			tcs.nChosed.put(removedPickup, tcs.nChosed.get(removedPickup)+1);

			tcs.group2marked.put(tcs.point2Group.get(removedPickup), 0);
			tcs.group2marked.put(tcs.point2Group.get(removedDelivery), 0);
			tcs.mgr.performRemoveTwoPoints(removedPickup, removedDelivery);
			if(tcs.XR.index(tcs.XR.getTerminatingPointOfRoute(ridx)) <= 1){
				int groupTruck = tcs.point2Group.get(tcs.XR.getStartingPointOfRoute(ridx));
				tcs.group2marked.put(groupTruck, 0);
			}
		}
	}

	public void forbidden_removal(int nRemoval){

		System.out.println("forbidden_removal");

		for(int i=0; i < tcs.pickupPoints.size(); i++){
			Point pi = tcs.pickupPoints.get(i);
			Point pj = tcs.pickup2Delivery.get(pi);

			if(tcs.nChosed.get(pi) > tcs.nTabu){
				tcs.removeAllowed.put(pi, false);
				tcs.removeAllowed.put(pj, false);
			}
		}

		switch(nRemoval){
			case 0: routeRemoval(); break;
			case 1: randomRequestRemoval(); break;
			case 2: shaw_removal(); break;
			case 3: worst_removal(); break;
		}

		for(int i=0; i < tcs.pickupPoints.size(); i++){
			Point pi = tcs.pickupPoints.get(i);
			tcs.removeAllowed.put(pi, true);
			Point pj = tcs.pickup2Delivery.get(pi);
			tcs.removeAllowed.put(pj, true);
		}
	}

	public void greedyInsertion(){
		System.out.println("greedyInsertion");
		int c = 0;
		for(int i = 0; i < tcs.rejectPickupPoints.size(); i++){
			Point pickup = tcs.rejectPickupPoints.get(i);
			int groupId = tcs.point2Group.get(pickup);

			if(tcs.XR.route(pickup) != Constants.NULL_POINT
				|| tcs.group2marked.get(groupId) == 1)
				continue;
			//System.out.println(c++);
			Point delivery = tcs.pickup2Delivery.get(pickup);
			//add the request to route
			Point pre_pick = null;
			Point pre_delivery = null;
			double best_objective = Double.MAX_VALUE;
			for(int r = 1; r <= tcs.XR.getNbRoutes(); r++){
				Point st = tcs.XR.getStartingPointOfRoute(r);

				int groupTruck = tcs.point2Group.get(st);
				if(tcs.group2marked.get(groupTruck) == 1
						&& tcs.XR.index(tcs.XR.getTerminatingPointOfRoute(r)) <= 1)
					continue;
				for(Point p = st; p != tcs.XR.getTerminatingPointOfRoute(r); p = tcs.XR.next(p)){
					for(Point q = p; q != tcs.XR.getTerminatingPointOfRoute(r); q = tcs.XR.next(q)){
//						if((tcs.XR.prev(p)!= null && tcs.XR.prev(p).getID() % 2 == 1
//								&& p.getID() % 2 == 1
//								&& pickup.getID() % 2 == 1)
//								|| (tcs.XR.next(p) != null && tcs.XR.next(p).getID() % 2 == 1
//								&& p.getID() % 2 == 1
//								&& pickup.getID() % 2 == 1))
//								System.out.println("bug");
						tcs.mgr.performAddTwoPoints(pickup, p, delivery, q);
						tcs.insertMoocToRoutes(r);
						if(tcs.S.violations() == 0){
							double cost = tcs.objective.getValue();
							if( cost < best_objective){
								best_objective = cost;
								pre_pick = p;
								pre_delivery = q;
							}
						}
						tcs.mgr.performRemoveTwoPoints(pickup, delivery);
						tcs.removeMoocOnRoutes(r);
					}
				}
			}
			if(pre_pick != null && pre_delivery != null){
				tcs.mgr.performAddTwoPoints(pickup, pre_pick, delivery, pre_delivery);
				Point st = tcs.XR.getStartingPointOfRoute(tcs.XR.route(pre_pick));
				tcs.rejectPickupPoints.remove(pickup);
				tcs.rejectDeliveryPoints.remove(delivery);
				int groupTruck = tcs.point2Group.get(st);
				tcs.group2marked.put(groupTruck, 1);
				tcs.group2marked.put(groupId, 1);
				i--;
			}
		}
		tcs.insertMoocForAllRoutes();
	}

	public void greedyInsertionWithNoise(){
		System.out.println("greedyInsertionWithNoise");
//		HashMap<Truck, Integer> truck2marked = new HashMap<Truck, Integer>();
//		Truck[] trucks = tcs.input.getTrucks();
//		for(int i = 0; i < trucks.length; i++)
//			truck2marked.put(trucks[i], 0);
//		for(int r = 1; r <= tcs.XR.getNbRoutes(); r++){
//			if(tcs.XR.index(tcs.XR.getTerminatingPointOfRoute(r)) > 1){
//				Point st = tcs.XR.getStartingPointOfRoute(r);
//				Truck truck = tcs.startPoint2Truck.get(st);
//				truck2marked.put(truck, 1);
//			}
//		}

		for(int i = 0; i < tcs.rejectPickupPoints.size(); i++){
			Point pickup = tcs.rejectPickupPoints.get(i);
			int groupId = tcs.point2Group.get(pickup);

			if(tcs.XR.route(pickup) != Constants.NULL_POINT
				|| tcs.group2marked.get(groupId) == 1)
				continue;
			Point delivery = tcs.pickup2Delivery.get(pickup);
			//add the request to route
			Point pre_pick = null;
			Point pre_delivery = null;
			double best_objective = Double.MAX_VALUE;
			for(int r = 1; r <= tcs.XR.getNbRoutes(); r++){
				Point st = tcs.XR.getStartingPointOfRoute(r);

				int groupTruck = tcs.point2Group.get(st);

				if(tcs.group2marked.get(groupTruck) == 1 && tcs.XR.index(tcs.XR.getTerminatingPointOfRoute(r)) <= 1)
					continue;

				for(Point p = st; p != tcs.XR.getTerminatingPointOfRoute(r); p = tcs.XR.next(p)){
					for(Point q = p; q != tcs.XR.getTerminatingPointOfRoute(r); q = tcs.XR.next(q)){
//						if((tcs.XR.prev(p)!= null && tcs.XR.prev(p).getID() % 2 == 1
//								&& p.getID() % 2 == 1
//								&& pickup.getID() % 2 == 1)
//								|| (tcs.XR.next(p) != null && tcs.XR.next(p).getID() % 2 == 1
//								&& p.getID() % 2 == 1
//								&& pickup.getID() % 2 == 1))
//								System.out.println("bug");
						tcs.mgr.performAddTwoPoints(pickup, p, delivery, q);
						tcs.insertMoocToRoutes(r);

						if(tcs.S.violations() == 0){
							double cost = tcs.objective.getValue();
							double ran = Math.random()*2-1;
							cost += TruckContainerSolver.MAX_TRAVELTIME*0.1*ran;
							if( cost < best_objective){
								best_objective = cost;
								pre_pick = p;
								pre_delivery = q;
							}
						}
						tcs.mgr.performRemoveTwoPoints(pickup, delivery);
						tcs.removeMoocOnRoutes(r);
					}
				}
			}
			if(pre_pick != null && pre_delivery != null){
				tcs.mgr.performAddTwoPoints(pickup, pre_pick, delivery, pre_delivery);
				Point st = tcs.XR.getStartingPointOfRoute(tcs.XR.route(pre_pick));
				int groupTruck = tcs.point2Group.get(st);
				tcs.group2marked.put(groupTruck, 1);
				tcs.rejectPickupPoints.remove(pickup);
				tcs.rejectDeliveryPoints.remove(delivery);
				tcs.group2marked.put(groupId, 1);
				i--;
			}
		}
		tcs.insertMoocForAllRoutes();
	}

	public void regret_n_insertion(int n){
		System.out.println("regret insertion n = " + n);

		for(int i = 0; i < tcs.rejectPickupPoints.size(); i++){
			Point pickup = tcs.rejectPickupPoints.get(i);
			int groupId = tcs.point2Group.get(pickup);

			if(tcs.XR.route(pickup) != Constants.NULL_POINT
				|| tcs.group2marked.get(groupId) == 1)
				continue;
			Point delivery = tcs.pickup2Delivery.get(pickup);
			//add the request to route
			Point pre_pick = null;
			Point pre_delivery = null;
			double n_best_objective[] = new double[n];
			double best_regret_value = Double.MIN_VALUE;

			for(int it=0; it<n; it++){
				n_best_objective[it] = Double.MAX_VALUE;
			}

			for(int r = 1; r <= tcs.XR.getNbRoutes(); r++){
				Point st = tcs.XR.getStartingPointOfRoute(r);
				int groupTruck = tcs.point2Group.get(st);

				if(tcs.group2marked.get(groupTruck) == 1 && tcs.XR.index(tcs.XR.getTerminatingPointOfRoute(r)) <= 1)
					continue;

				for(Point p = st; p != tcs.XR.getTerminatingPointOfRoute(r); p = tcs.XR.next(p)){
					for(Point q = p; q != tcs.XR.getTerminatingPointOfRoute(r); q = tcs.XR.next(q)){
//						if((tcs.XR.prev(p)!= null && tcs.XR.prev(p).getID() % 2 == 1
//								&& p.getID() % 2 == 1
//								&& pickup.getID() % 2 == 1)
//								|| (tcs.XR.next(p) != null && tcs.XR.next(p).getID() % 2 == 1
//								&& p.getID() % 2 == 1
//								&& pickup.getID() % 2 == 1))
//								System.out.println("bug");
						tcs.mgr.performAddTwoPoints(pickup, p, delivery, q);
						tcs.insertMoocToRoutes(r);
						if(tcs.S.violations() == 0){
							double cost = tcs.objective.getValue();
							for(int it=0; it<n; it++){
								if(n_best_objective[it] > cost){
									for(int it2 = n-1; it2 > it; it2--){
										n_best_objective[it2] = n_best_objective[it2-1];
									}
									n_best_objective[it] = cost;
									break;
								}
							}
							double regret_value = 0;
							for(int it=1; it<n; it++){
								regret_value += Math.abs(n_best_objective[it] - n_best_objective[0]);
							}
							if(regret_value > best_regret_value){
								best_regret_value = regret_value;
								pre_pick = p;
								pre_delivery = q;
							}
						}
						tcs.mgr.performRemoveTwoPoints(pickup, delivery);
						tcs.removeMoocOnRoutes(r);
					}
				}
			}
			if(pre_pick != null && pre_delivery != null){
				tcs.mgr.performAddTwoPoints(pickup, pre_pick, delivery, pre_delivery);
				Point st = tcs.XR.getStartingPointOfRoute(tcs.XR.route(pre_pick));
				int groupTruck = tcs.point2Group.get(st);
				tcs.group2marked.put(groupTruck, 1);
				tcs.rejectPickupPoints.remove(pickup);
				tcs.rejectDeliveryPoints.remove(delivery);
				tcs.group2marked.put(groupId, 1);
				i--;
			}
		}
		tcs.insertMoocForAllRoutes();
	}

	public void first_possible_insertion(){
		System.out.println("first_possible_insertion");

		for(int i = 0; i < tcs.rejectPickupPoints.size(); i++){
			Point pickup = tcs.rejectPickupPoints.get(i);
			int groupId = tcs.point2Group.get(pickup);

			if(tcs.XR.route(pickup) != Constants.NULL_POINT
				|| tcs.group2marked.get(groupId) == 1)
				continue;
			Point delivery = tcs.pickup2Delivery.get(pickup);
			//add the request to route
			Point pre_pick = null;
			Point pre_delivery = null;
			double best_objective = Double.MAX_VALUE;
			boolean finded = false;
			for(int r = 1; r <= tcs.XR.getNbRoutes(); r++){
				if(finded)
					break;
				Point st = tcs.XR.getStartingPointOfRoute(r);
				int groupTruck = tcs.point2Group.get(st);
				if(tcs.group2marked.get(groupTruck) == 1 && tcs.XR.index(tcs.XR.getTerminatingPointOfRoute(r)) <= 1)
					continue;

				for(Point p = st; p != tcs.XR.getTerminatingPointOfRoute(r); p = tcs.XR.next(p)){
					if(finded)
						break;
					for(Point q = p; q != tcs.XR.getTerminatingPointOfRoute(r); q = tcs.XR.next(q)){
//						if((tcs.XR.prev(p)!= null && tcs.XR.prev(p).getID() % 2 == 1
//								&& p.getID() % 2 == 1
//								&& pickup.getID() % 2 == 1)
//								|| (tcs.XR.next(p) != null && tcs.XR.next(p).getID() % 2 == 1
//								&& p.getID() % 2 == 1
//								&& pickup.getID() % 2 == 1))
//								System.out.println("bug");
						tcs.mgr.performAddTwoPoints(pickup, p, delivery, q);
						tcs.insertMoocToRoutes(r);
						if(tcs.S.violations() == 0){
							double cost = tcs.objective.getValue();
							if( cost < best_objective){
								tcs.removeMoocOnRoutes(r);
								tcs.group2marked.put(groupTruck, 1);
								tcs.rejectPickupPoints.remove(pickup);
								tcs.rejectDeliveryPoints.remove(delivery);
								tcs.group2marked.put(groupId, 1);
								finded = true;
								i--;
								break;
							}
						}
						tcs.mgr.performRemoveTwoPoints(pickup, delivery);
						tcs.removeMoocOnRoutes(r);
					}
				}
			}
		}
		tcs.insertMoocForAllRoutes();
	}

	public void sort_before_insertion(int iInsertion){
		System.out.println("sort_before_insertion");

		sort_reject_people();

		switch(iInsertion){
			case 0: greedyInsertion(); break;
			case 1: greedyInsertionWithNoise(); break;
			case 2: regret_n_insertion(2); break;
			case 3: first_possible_insertion(); break;
		}

		Collections.shuffle(tcs.rejectPickupPoints);
	}

	private void sort_reject_people(){
		HashMap<Point, Integer> time_flexibility = new HashMap<Point, Integer>();

		for(int i = 0; i < tcs.rejectPickupPoints.size(); i++){
			Point pickup = tcs.rejectPickupPoints.get(i);
			Point delivery = tcs.pickup2Delivery.get(pickup);

			int lp = tcs.lastestAllowedArrivalTime.get(pickup);
			int ud = tcs.earliestAllowedArrivalTime.get(delivery);

			time_flexibility.put(pickup, ud-lp);
		}

		List<Point> keys = new ArrayList<Point>(time_flexibility.keySet());
		List<Integer> values = new ArrayList<Integer>(time_flexibility.values());
		Collections.sort(values);

		ArrayList<Point> rejectPointSorted = new ArrayList<Point>();
		for(int i = 0; i < values.size(); i++){
			int v = values.get(i);
			for(int j = 0; j < keys.size(); j++){
				Point p = keys.get(j);
				int vs = time_flexibility.get(p);
				if(vs == v){
					rejectPointSorted.add(p);
					keys.remove(p);
					break;
				}
			}
		}
		tcs.rejectPickupPoints = rejectPointSorted;
	}
}


text:
package ca.eandb.jmist.framework.loader.openexr.attribute;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

@OpenEXRAttributeType("string")
public final class StringAttribute implements Attribute {

  private final String value;

  public StringAttribute(String value) {
    this.value = value;
  }

  public String getValue() {
    return value;
  }

  public static StringAttribute read(DataInput in, int size) throws IOException {
    StringBuilder s = new StringBuilder();
    for (int i = 0; i < size; i++) {
      int b = in.readByte();
      s.append((char) b);
    }
    return new StringAttribute(s.toString());
  }

  @Override
  public void write(DataOutput out) throws IOException {
    out.writeBytes(value);
  }

}


text:
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![David deps][david-image]][david-url]
[![npm download][download-image]][download-url]

+/- the async version of [koa-etag](https://github.com/koajs/etag).

:bulb:**This middleware is designed for [Koa](https://github.com/koajs/koa) v2.x.x and use [Babel](https://babeljs.io/) for ES5 compatibility.**

:wrench:**This middleware is a work-in-progress**. Feedback / PR are welcome and encouraged. If you'd like to collaborate on this project, let me know.

## Installation

```
$ npm install --save koa-async-etag
```

## Usage

```js
import Koa from 'koa';
import eTag from 'koa-async-etag';

const app = new Koa();

app.use(eTag);

app.use(async (ctx, next) => {
  await next();
  ctx.body = 'Hello World';
});

app.listen(3000);
```

## License

[MIT](LICENSE)

[npm-image]: https://img.shields.io/npm/v/koa-async-etag.svg?style=flat-square
[npm-url]: https://npmjs.org/package/koa-async-etag
[travis-image]:https://img.shields.io/travis/broucz/koa-async-etag.svg?style=flat-square
[travis-url]: https://travis-ci.org/broucz/koa-async-etag
[coveralls-image]: https://img.shields.io/coveralls/broucz/koa-async-etag.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/broucz/koa-async-etag?branch=master
[david-image]: https://img.shields.io/david/broucz/koa-async-etag.svg?style=flat-square
[david-url]: https://david-dm.org/broucz/koa-async-etag
[download-image]: https://img.shields.io/npm/dm/koa-async-etag.svg?style=flat-square
[download-url]: https://npmjs.org/package/koa-async-etag


text:
module Quotes
  module UseCases
    class UseCase
      include Support::ValidationHelpers

      def quotes_gateway
        @quotes_gateway ||= Gateways::QuotesGateway.new
      end

      def publications_gateway
        @publications_gateway ||= Gateways::PublicationsGateway.new
      end

      def quote_boundary
        @quote_boundary ||= Services::QuoteBoundary.new
      end

      def publication_boundary
        @publication_boundary ||= Services::PublicationBoundary.new
      end

      def ensure_valid_input!(uid)
        reason = "The given UID is invalid"

        unless uid.kind_of? Integer || uid.nil?
          raise_argument_error(reason, uid)
        end
      end

    end
  end
end


text:
<!DOCTYPE html>

    <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
          <meta name="author" content="">
            <link rel="shortcut icon" href="../assets/ico/favicon.png">

              <title>Jay Wang - About Me</title>

              <link href="../dist/css/bootstrap.css" rel="stylesheet">

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

              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">

              </button>
              Jay Wang

                  Home

                  Updates

                  About Me

                    Professional Résumé

Jump To

                      Academic Career

                      Professional Career

                      Demos & Projects

                      Download a Copy

                  Contact Me

              What's up. Here are some things about me!

                My name is Jiayuan Wang, I prefer Jay. I was born near Shanghai, China on February 5, 1992.
                I moved to Germany when I was 5 years old and lived in Hanover and Berlin for two years.
                I attended 1st grade in Hanover and 2nd grade in Berlin. I did well in classes, to the
                teachers' surprise, and picked upspeaking  German in a month, and reading and writing in three.
                When November 2000 came around, I moved to Boston, Massachusetts and was placed in 3rd grade
                at the Lucy Stone School in Dorchester. I picked up English after 2 months
                and got the highest overall achievement award for my grade every year, which I was really
                proud of as a child. I made many friends at my elementary
                school and still remember their names and what they taught me to help me adapt to living in
                Dorchester.

                For 6th grade I went to the Richard J. Murphy School (also in Dorchester), where I first made
                friends with white kids; my elementary school was mostly African American and Hispanic.
                I learned swimming in that middle school and also started playing basketball, my favorite sport.
                It's something I can't do without even to this day. For 7th till 12th grade, I enrolled in the first high
                school that was created in the United States back in the colonial days. Boston Latin School, a public
                exam school known for rigorously preparing its students for graduation and college. Although
                there were some hard times in my six years at BLS, I have a lot of good memories of the school
                and now loved my time there, especially my four years of high school.

                Right now, I am currently a student of Tufts University, Class of 2014. Tufts is home of the Jumbos,
                our elephant mascot. My major is in Computer Science of the Engineering school.
                I love the hilly Medford campus, the friendly students, and the passionate debates that define Tufts and who we are.
                I've seen a lot of wonderful things and gained a plethora of knowledge in my 21 years, and I look forward to more amazing experiences in the future...

                  Back to top

© 2013 Jay Wang. · Updated October 2013.


text:
using System;

using Craswell.Automation.DataAccess;

namespace Craswell.WebRepositories.Tangerine
{
    /// <summary>
    /// Tangerine transaction.
    /// </summary>
    public class TangerineTransaction : IAccountTransaction
    {
        #region IAccountTransaction implementation
        /// <summary>
        /// Gets or sets the identifier.
        /// </summary>
        /// <value>The identifier.</value>
        public int Id { get; set; }

        /// <summary>
        /// Gets the transaction type.
        /// </summary>
        /// <value>The type.</value>
        public TransactionType Type { get; set; }

        /// <summary>
        /// Gets or sets the timestamp.
        /// </summary>
        /// <value>The timestamp.</value>
        public DateTime Timestamp { get; set; }

        /// <summary>
        /// Gets or sets the subject.
        /// </summary>
        /// <value>The subject.</value>
        public string Subject { get; set; }

        /// <summary>
        /// Gets or sets the amount.
        /// </summary>
        /// <value>The amount.</value>
        public double Amount { get; set; }
        #endregion
    }
}


text:
package parquet.thrift;

import org.apache.thrift.TBase;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TProtocol;

import parquet.schema.MessageType;
import parquet.thrift.struct.ThriftType.StructType;

public class TBaseRecordConverter<T extends TBase<?,?>> extends ThriftRecordConverter<T> {

  public TBaseRecordConverter(final Class<T> thriftClass, MessageType parquetSchema, StructType thriftType) {
    super(new ThriftReader<T>() {
      @Override
      public T readOneRecord(TProtocol protocol) throws TException {
        try {
          T thriftObject = thriftClass.newInstance();
          thriftObject.read(protocol);
          return thriftObject;
        } catch (Exception e) {
          throw new RuntimeException(e);
        }
      }
    }, thriftClass.getSimpleName(), parquetSchema, thriftType);
  }

}


text:
package org.codehaus.enunciate.examples.objc.schema;

/**
 * @author Ryan Heaton
 */
public enum Color {

  RED,

  YELLOW,

  GREEN,

  BLUE

}


text:
HOST=staging.example.com

# Your SSH Key
KEY=~/.ssh/my_key.pem

# The webroot you want to setup (if using NGINX)
WEBROOT=/var/www/staging.example.com/public

# Define your OS flavor (app/sources/$OS)
# ubuntu is the default and the only one provided, but you can certainly create your own
# OS=ubuntu


text:
package com.thoughtworks.go.server.domain;

import org.junit.jupiter.api.Test;

import java.util.Date;

import static org.assertj.core.api.Assertions.assertThat;

public class ServerBackupTest {

    @Test
    void shouldBeSuccessfulIfStatusCompleted() {
        assertThat(new ServerBackup("path", new Date(), "admin", "").isSuccessful()).isFalse();
        assertThat(new ServerBackup("path", new Date(), "admin", BackupStatus.ERROR, "", 123).isSuccessful()).isFalse();
        assertThat(new ServerBackup("path", new Date(), "admin", BackupStatus.COMPLETED, "", 123).isSuccessful()).isTrue();
    }

    @Test
    void shouldMarkCompleted() {
        ServerBackup backup = new ServerBackup("path", new Date(), "admin", "");
        assertThat(backup.getStatus()).isNotEqualTo(BackupStatus.COMPLETED);

        backup.markCompleted();
        assertThat(backup.getStatus()).isEqualTo(BackupStatus.COMPLETED);
        assertThat(backup.getMessage()).isEmpty();
    }

    @Test
    void shouldMarkError() {
        ServerBackup backup = new ServerBackup("path", new Date(), "admin", "");
        assertThat(backup.getStatus()).isNotEqualTo(BackupStatus.ERROR);
        assertThat(backup.hasFailed()).isFalse();

        backup.markError("boom");

        assertThat(backup.getStatus()).isEqualTo(BackupStatus.ERROR);
        assertThat(backup.getMessage()).isEqualTo("boom");
        assertThat(backup.hasFailed()).isTrue();
    }

    @Test
    void shouldSetProgressStatus() {
        ServerBackup backup = new ServerBackup("path", new Date(), "admin", "");
        assertThat(backup.getBackupProgressStatus()).hasValue(BackupProgressStatus.STARTING);

        backup.setProgressStatus(BackupProgressStatus.BACKUP_CONFIG);

        assertThat(backup.getBackupProgressStatus()).hasValue(BackupProgressStatus.BACKUP_CONFIG);
        assertThat(backup.getMessage()).isEqualTo(BackupProgressStatus.BACKUP_CONFIG.getMessage());
        assertThat(backup.getStatus()).isEqualTo(BackupStatus.IN_PROGRESS);
    }
}


text:
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
    # ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASES = {
    'default': {
        'ENGINE': 'django_riak_engine',
        'NAME': 'test',
        'USER': '',
        'PASSWORD': '',
        'HOST': 'localhost',
        'PORT': '8091',
    }
}
TIME_ZONE = 'US/Pacific'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = True
USE_L10N = True
MEDIA_ROOT = ''
MEDIA_URL = ''
ADMIN_MEDIA_PREFIX = '/media/'
SECRET_KEY = '+w96)4ir4=lqr5m)9od6!^zlsbkp3=o+nl7k@o_7#50ibfu&pl'
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)
MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
)
ROOT_URLCONF = 'django_riak_mapreduce.urls'
TEMPLATE_DIRS = (
)
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'djangotoolbox',
    'riak_mapreduce',
    # Uncomment the next line to enable the admin:
    # 'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
)


text:
package org.unitils.dbunit;

/**
 * Test class.
 *
 * @author Jeroen Horemans
 * @author Thomas De Rycke
 * @author Willemijn Wouters
 *
 * @since 3.4
 *
 */
public class JustAClass {

    public void method1() {
        //do nothing
    }
}


text:
/*
 *  @file    PropertyLabelCache.h
 *  @author  Kuilong Liu
 *  @date    2013.05.17
 */
#ifndef _PROPERTY_LABEL_CACHE_HPP_
#define _PROPERTY_LABEL_CACHE_HPP_

#include "StorageManager.h"
#include "PropertyCacheItem.h"
#include <string>
#include <list>
#include <iostream>
#include <util/scheduler.h>
#include <boost/bind.hpp>
#include <boost/unordered_map.hpp>

using namespace std;

namespace sf1r { namespace logserver {

class PropertyLabelCache
{
public:
	typedef boost::unordered_map<std::string, PropCacheItem> LabelHitMapT;
	typedef boost::unordered_map<std::string, LabelHitMapT> CollLabelMapT;
	PropertyLabelCache(PropertyLabelStorageManager* p)
		:plsm_(p)
	{
		std::string jn = "PropertyLabelCronJob";
        bool res = izenelib::util::Scheduler::addJob(jn,
        	2*60*60*1000,
        	0,
            boost::bind(&PropertyLabelCache::cronjob, this));
        if(res)
            LOG(INFO) << "Create cron job for PropertyLabelCache."<< endl;
        else
            LOG(ERROR) << "Failed in create cron job! (PropertyLabelCache)"<<endl;
	}
	~PropertyLabelCache()
	{
		LOG(INFO)<<"~PropertyLabelCache"<<endl;
	}
	void close()
	{
		cronjob();
	}
	void load()
	{
		plsm_->load(cache_);
	}
	bool insert(const std::string& c, const std::string& label, uint64_t hitnum)
	{
		if(cache_.find(c) == cache_.end())
		{
			PropCacheItem pi(hitnum);
			LabelHitMapT lh;
			lh[label] = pi;
			cache_[c] = lh;
			return true;
		}
		if(cache_[c].find(label) == cache_[c].end())
		{
			PropCacheItem pi(hitnum);
			cache_[c][label]=pi;
			return true;
		}
		cache_[c][label].hit_docs_num += hitnum;
		cache_[c][label].modify = true;
		return true;
	}

	bool get(const std::string& c, std::list<std::map<std::string, std::string> >& res)
	{
		if(cache_.find(c) == cache_.end())
			return true;

		LabelHitMapT::iterator it;
		for(it=cache_[c].begin(); it!=cache_[c].end();it++)
		{
			std::map<std::string, std::string> ma;
			ma["label_name"] = it->first;
			ma["hit_docs_num"] = boost::lexical_cast<std::string>((it->second).hit_docs_num);
			res.push_back(ma);
		}
		return true;
	}
	bool del(const std::string& c)
	{
		if(cache_.find(c) == cache_.end())
			return true;
		cache_.erase(cache_.find(c));
		return plsm_->del(c);
	}
	void cronjob()
	{
		CollLabelMapT::iterator it;
		LabelHitMapT::iterator iter;
		for(it=cache_.begin();it!=cache_.end();it++)
		{
			std::string coll = it->first;
			for(iter=(it->second).begin();iter!=(it->second).end();iter++)
			{
				if((iter->second).modify)
				{
					std::string label = iter->first;
					uint64_t hitnum = (iter->second).hit_docs_num;
					plsm_->insert(coll, label, hitnum);
					(iter->second).modify = false;
				}
			}
		}
	}
private:
	CollLabelMapT cache_;
	PropertyLabelStorageManager* plsm_;
};

} // end of namespace logserver
} // end of namespace sf1r
#endif


text:
import { Component, OnInit } from '@angular/core';

import { TrafficChartService } from './dirver-score.server';
import * as Chart from 'chart.js';

@Component({
  selector: 'app-dirver-hazardous',
  templateUrl: './dirver-hazardous.component.html',
  styleUrls: ['./dirver-hazardous.component.scss']
})
export class DirverHazardousComponent implements OnInit {

  public doughnutData: Array<Object>;

  constructor(private trafficChartService: TrafficChartService) {
    this.doughnutData = trafficChartService.getData();
  }

  ngAfterViewInit() {
    this._loadDoughnutCharts();
  }

  private _loadDoughnutCharts() {
    let el = jQuery('.chart-area').get(0) as HTMLCanvasElement;
    new Chart(el.getContext('2d')).Doughnut(this.doughnutData, {
      segmentShowStroke: false,
      percentageInnerCutout: 64,
      responsive: true
    });
  }

  ngOnInit() {
  }

}


text:
class Api::V1::RepliesController < Api::ApiController
  resource_description do
    description 'Viewing replies to a post'
  end

  api :GET, '/posts/:id/replies', 'Load all the replies for a given post as JSON resources'
  param :post_id, :number, required: true, desc: "Post ID"
  param :page, :number, required: false, desc: 'Page in results'
  param :per_page, :number, required: false, desc: 'Number of replies to load per page. Defaults to 25, accepts values from 1-100 inclusive.'
  error 403, "Post is not visible to the user"
  error 404, "Post not found"
  def index
    return unless (post = find_object(Post, param: :post_id))
    access_denied and return unless post.visible_to?(current_user)

    replies = post.replies
      .select('replies.*, characters.name, characters.screenname, icons.keyword, icons.url, users.username, users.deleted as user_deleted, character_aliases.name as alias')
      .joins(:user)
      .left_outer_joins(:character)
      .left_outer_joins(:icon)
      .left_outer_joins(:character_alias)
      .ordered
    paginate json: replies, per_page: per_page
  end
end