text:
<?xml version="1.0" encoding="utf-8"?>

<info><title>Zend_Service_Simpy</title></info>

<info><title>Einführung</title></info>

        <para>
            <classname>Zend_Service_Simpy</classname> ist ein schlanker Wrapper für das freie REST
            <acronym>API</acronym> des Simpy Lesezeichen-Services.
        </para>

        <para>
            Um <classname>Zend_Service_Simpy</classname> zu nutzen, solltest du bereits ein
            Simpy-Konto besitzen. Falls dies nicht der Fall ist, kannst du dies auf der
            <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://simpy.com">Simpy Webseite</link> tun. Für weitere Informationen über
            das Simpy REST <acronym>API</acronym>, kannst du in der
            <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.simpy.com/doc/api/rest">Simpy REST <acronym>API</acronym>
                Dokumentation</link> nachlesen.
        </para>

        <para>
            Das Simpy REST <acronym>API</acronym> erlaubt es dem Entwickler, mit verschiedenen
            Aspekten des Services, welche die Simpy Webseite bietet, zu interagieren. Diese
            Sektionen zeigen dir, wie man <classname>Zend_Service_Simpy</classname> in jedem dieser
            Bereiche nutzen kann.

            <itemizedlist>
                <listitem>
                    <para>Links: Erstellen, Laden, Aktualisieren, Löschen</para>
                </listitem>

                <listitem>
                    <para>Tags: Laden, Löschen, Umbenennen, Zusammenfassen, Splitten</para>
                </listitem>

                <listitem>
                    <para>Notes: Erstellen, Laden, Aktualisieren, Löschen</para>
                </listitem>

                <listitem>
                    <para>Watchlists: Holen, Alle holen</para>
                </listitem>
            </itemizedlist>
        </para>

<info><title>Links</title></info>

        <para>
            Beim Anfragen von Links, werden diese absteigend nach deren Datum - wann es
            hinzugefügt wurde - sortiert. Es kann nach Links anhand des Titels, des Spitznamens,
            der Tags, der Notizen oder sogar des Inhalts der verknüpften Webseite gesucht werden.
            Simpy erlaubt es, jegliche oder alle dieser Felder mit Phrasen, booleschen
            Operatoren und Wildcards zu durchsuchen. Siehe in den
            <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.simpy.com/faq#searchSyntax">Suchsyntax</link>- und
            <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.simpy.com/faq#searchFieldsLinks">Suchfelder</link>-Sektionen
            der Simipy FAQ für weitere Informationen.
        </para>

        <example xml:id="zend.service.simpy.links.querying"><info><title>Abfragen von Links</title></info>

            <programlisting language="php"><![CDATA[
$simpy = new Zend_Service_Simpy('yourusername', 'yourpassword');

/* Suche nach den 10 letzten hinzugefügten Links */
$linkQuery = new Zend_Service_Simpy_LinkQuery();
$linkQuery->setLimit(10);

/* Holen und darstellen */
$linkSet = $simpy->getLinks($linkQuery);
foreach ($linkSet as $link) {
    echo 'getUrl();
    echo '">';
    echo $link->getTitle();
    echo '
';
}

/* Suche nach den 5 letzten hinzugefügten Links mit 'PHP'
im Titel */
$linkQuery->setQueryString('title:PHP');
$linkQuery->setLimit(5);

/* Suche nach allen Links mit 'French' im Titel und
'lanuage' in den Tags */
$linkQuery->setQueryString('+title:French +tags:language');

/* Suche nach allen Links mit 'French' im Titel und ohne
'travel' in den Tags */
$linkQuery->setQueryString('+title:French -tags:travel');

/* Suche nach allen Links, die am 9.12.2006 hinzugefügt wurden */
$linkQuery->setDate('2006-12-09');

/* Suche nach allen Links, die nach dem 9.12.2006 hinzugefügt wurden (
das Datum ist nicht eingeschlossen) */
$linkQuery->setAfterDate('2006-12-09');

/* Suche nach allen Links, die vom dem 9.12.2006 hinzugefügt wurden (
das angegebene Datum ist ausgeschlossen) */
$linkQuery->setBeforeDate('2006-12-09');

/* Suche nach allen Links, die zwischen dem 1.12.2006 und dem 9.12.2006
hinzugefügt wurden (die beiden Daten sind dabei ausgeschlossen) */
$linkQuery->setBeforeDate('2006-12-01');
$linkQuery->setAfterDate('2006-12-09');
]]></programlisting>
        </example>

        <para>
            Links werden eindeutig durch ihren <acronym>URL</acronym> angezeigt. In anderen Worten,
            falls ein Versuch gemacht wird, einen Link zu speichern, der denselben
            <acronym>URL</acronym> hat wie ein bereits existierender Link, werden die Daten des
            alten Links mit den neuen Daten überschrieben.
        </para>

        <example xml:id="zend.service.simpy.links.modifying"><info><title>Modifizieren von Links</title></info>

            <programlisting language="php"><![CDATA[
$simpy = new Zend_Service_Simpy('yourusername', 'yourpassword');

/* Speichern eines link */
$simpy->saveLink(
    'Zend Framework' // Titel
    'http://framework.zend.com', // URL
    Zend_Service_Simpy_Link::ACCESSTYPE_PUBLIC, // Zugriffstyp
    'zend, framework, php' // Tags
    'Zend Framework home page' // Alternativer Titel
    'This site rocks!' // Notiz
);

/* Überschreibe den existierenden Link mit neuen Daten */
$simpy->saveLink(
    'Zend Framework'
    'http://framework.zend.com',
    // der Zugriffstyp wurde geändert
    Zend_Service_Simpy_Link::ACCESSTYPE_PRIVATE,
    // Die Reihenfolge der Tags hat sich geändert
    'php, zend, framework'
    // Alternativer Titel wurde geändert
    'Zend Framework'
    // Notiz hat sich geändert
    'This site REALLY rocks!'
);

/* Den Link löschen */
$simpy->deleteLink('http://framework.zend.com');

/* Ein wirklich einfacher Weg den Frühjahrsputz
   bei deinen Links zu machen ;-) */
$linkSet = $this->_simpy->getLinks();
foreach ($linkSet as $link) {
    $this->_simpy->deleteLink($link->getUrl());
}
]]></programlisting>
        </example>

<info><title>Tags</title></info>

        <para>
            Wenn die Tags zurückgegeben werden, werden sie in absteigender
            Reihenfolge (d.h. der größte zuerst) nach der Häufigkeit der
            Benutzung durch die Links sortiert.
        </para>

        <example xml:id="zend.service.simpy.tags.working"><info><title>Arbeiten mit Tags</title></info>

            <programlisting language="php"><![CDATA[
$simpy = new Zend_Service_Simpy('yourusername', 'yourpassword');

/* Speicher einen Link mit Tags */
$simpy->saveLink(
    'Zend Framework' // Titel
    'http://framework.zend.com', // URL
    Zend_Service_Simpy_Link::ACCESSTYPE_PUBLIC, // Zugriffstyp
    'zend, framework, php' // Tags
);

/* Hole eine Liste mit allen Tags, die von Links und
Notizen genutzt werden */
$tagSet = $simpy->getTags();

/* Stelle jeden Tag mit der Anzahl der Links, die ihn nutzen, dar */
foreach ($tagSet as $tag) {
    echo $tag->getTag();
    echo ' - ';
    echo $tag->getCount();
    echo '
';
}

/* Entferne das 'zend'-Tag von allen Links, die es benutzen */
$simpy->removeTag('zend');

/* Nenne das 'framework'-Tag zu 'frameworks' um */
$simpy->renameTag('framework', 'frameworks');

/* Splitte das 'frameworks'-Tag in 'framework' und
'development' auf. D.h. dass alle Links, die 'frameworks'
als Tag besitzen, nunmehr stattdessen 'framework' und 'development'
besitzen */
$simpy->splitTag('frameworks', 'framework', 'development');

/* Fasse 'framework' und 'development' wieder zu 'frameworks'
zusammen; vereinfacht ist es das Gegenteil, ein Tag zu splitten */
$simpy->mergeTags('framework', 'development', 'frameworks');
]]></programlisting>
        </example>

<info><title>Notizen</title></info>

        <para>
            Notizen können gespeichert, geladen und gelöscht werden. Sie sind
            eindeutig durch eine numerische ID definiert.
        </para>

        <example xml:id="zend.service.simpy.notes.working"><info><title>Arbeiten mit Notizen</title></info>

            <programlisting language="php"><![CDATA[
$simpy = new Zend_Service_Simpy('yourusername', 'yourpassword');

/* Eine Notiz speichern */
$simpy->saveNote(
    'Test Note', // Titel
    'test,note', // Tags
    'This is a test note.' // Beschreibung
);

/* Eine bereits existierende Notiz überschreiben */
$simpy->saveNote(
    'Updated Test Note', // Titel
    'test,note,updated', // Tags
    'This is an updated test note.', // Beschreibung
    $note->getId() // Eindeutige ID
);

/* Suche nach den 10 letzten hinzugefügten Notizen */
$noteSet = $simpy->getNotes(null, 10);

/* Zeige diese Notizen an */
foreach ($noteSet as $note) {
    echo '
';
    echo $note->getTitle();
    echo '
';
    echo $note->getDescription();
    echo '
';
    echo $note->getTags();
    echo '
';
}

/* Suche nach allen Notizen mit 'PHP' im Titel */
$noteSet = $simpy->getNotes('title:PHP');

/* Suche nach allen Notizen mit 'PHP' im Titel und ohne
'framework' in der Beschreibung */
$noteSet = $simpy->getNotes('+title:PHP -description:framework');

/* Löschen einer Notiz */
$simpy->deleteNote($note->getId());
]]></programlisting>
        </example>

<info><title>Watchlists</title></info>

        <para>
            Watchlisten können durch das <acronym>API</acronym> nicht erstellt oder entfernt
            werden, sondern lediglich zurückgegeben. Folglich musst du eine
            Watchlist über die Simpy Webseite erstellen, bevor du diese
            über das <acronym>API</acronym> nutzt.
        </para>

        <example xml:id="zend.service.simpy.watchlists.retrieving"><info><title>Zurückgeben von Watchlisten</title></info>

            <programlisting language="php"><![CDATA[
$simpy = new Zend_Service_Simpy('yourusername', 'yourpassword');

/* Hole eine Liste von allen Watchlisten */
$watchlistSet = $simpy->getWatchlists();

/* Zeige die Daten jeder Watchlist an */
foreach ($watchlistSet as $watchlist) {
    echo $watchlist->getId();
    echo '
';
    echo $watchlist->getName();
    echo '
';
    echo $watchlist->getDescription();
    echo '
';
    echo $watchlist->getAddDate();
    echo '
';
    echo $watchlist->getNewLinks();
    echo '
';

    foreach ($watchlist->getUsers() as $user) {
        echo $user;
        echo '
';
    }

    foreach ($watchlist->getFilters() as $filter) {
        echo $filter->getName();
        echo '
';
        echo $filter->getQuery();
        echo '
';
    }
}

/* Hole eine spezielle Watchlist anhand einer ID */
$watchlist = $simpy->getWatchlist($watchlist->getId());
$watchlist = $simpy->getWatchlist(1);
]]></programlisting>
        </example>


text:
using System;
using System.Net;

namespace OSharp.Web.Http.Messages
{
    public class MovedPermanentlyResponse : ResourceIdentifierBase
    {
        public MovedPermanentlyResponse()
            : base(HttpStatusCode.MovedPermanently)
        {
        }

        public MovedPermanentlyResponse(Uri resource)
            : base(HttpStatusCode.MovedPermanently, resource)
        {
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef MTCONSTANTS_H
#define MTCONSTANTS_H

// 1. 常用变量
// 1.1 Log
#ifdef DEBUG // 调试版本
#define MTLog(...) NSLog(__VA_ARGS__)
#else // 发布版本
#define MTLog(...)
#endif
#define MTDebugLog(s, ...) MTLog(@"%s(%d): %@", __FUNCTION__, __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__])
#define kTipAlert7(s, ...)     [[[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:(s), ##__VA_ARGS__] delegate:nil cancelButtonTitle:@"知道了" otherButtonTitles:nil] show]
#define kTipAlert(s, ...) {UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"提示"                                                      message:[NSString stringWithFormat:(s), ##__VA_ARGS__]                                                       preferredStyle:UIAlertControllerStyleAlert];UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"知道了" style:UIAlertActionStyleDefault                                                     handler:^(UIAlertAction * action) {}];[alert addAction:defaultAction];[self presentViewController:alert animated:YES completion:nil];}

// 1.2 weak or strong variable
#define MTWeak(var, weakVar) __weak __typeof(&*var) weakVar = var
#define MTStrong_DoNotCheckNil(weakVar, _var) __typeof(&*weakVar) _var = weakVar
#define MTStrong(weakVar, _var) MTStrong_DoNotCheckNil(weakVar, _var); if (!_var) return;

#define MTWeak_(var) MTWeak(var, weak_##var);
#define MTStrong_(var) MTStrong(weak_##var, _##var);

/** defines a weak `self` named `__weakSelf` */
#define MTWeakSelf      MTWeak(self, __weakSelf);
/** defines a strong `self` named `_self` from `__weakSelf` */
#define MTStrongSelf    MTStrong(__weakSelf, _self);

// 1.3 版本
#define kVersionCoding [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]
#define kVersionBuildCoding [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]

#define kHigher_iOS_8_3 (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_8_3)

// 1.4 iPhone设备及屏幕适配
#define kDevice_Is_iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define kDevice_Is_iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define kDevice_Is_iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)
#define kKeyWindow [UIApplication sharedApplication].keyWindow
#define kScreenBounds [UIScreen mainScreen].bounds
#define kScreenW [UIScreen mainScreen].bounds.size.width
#define kScreenH [UIScreen mainScreen].bounds.size.height

// 1.5 其他UIKit相关
#define RGB(A, B, C)  [UIColor colorWithRed:A/255.0 green:B/255.0 blue:C/255.0 alpha:1.0]
#define UI_NAVIGATION_BAR_HEIGHT    44
#define UI_TAB_BAR_HEIGHT           49
#define UI_STATUS_BAR_HEIGHT        20
#define UI_SCREEN_WIDTH             320
#define UI_SCREEN_HEIGHT            480

#define UI_LABEL_LENGTH             200
#define UI_LABEL_HEIGHT             15
#define UI_LABEL_FONT_SIZE          12
#define UI_LABEL_FONT               [UIFont systemFontOfSize:UI_LABEL_FONT_SIZE]

// 2. Bundle
// 2.1 取出main bundle中的资源的路径
#define ResourcePath(path)  [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:path]

// 2.2 根据指定路径从main bundle中加载生成无缓存的图片(UIImage)对象
#define ImageWithPath(path) [[UIImage alloc] initWithContentsOfFile:path]

/* 01和02可以组合使用
 * eg: UIImage *image = ImageWithPath(ResourcePath(@"abc/123.jpg"));
 * 以上代码,将main bundle的abc目录下的123.jpg生成了不缓存的UIImage对象
 */

// 3.

#endif


text:
pub mod async_std_backend;
#[cfg(feature = "sync")]
pub mod blocking;
pub mod request_trait;
#[cfg(feature = "with-tokio")]
pub mod tokio_backend;

pub use request_trait::*;


text:
<?php

namespace yiiunit\framework\widgets;

use Yii;
use yii\data\ArrayDataProvider;
use yii\widgets\ListView;
use yiiunit\TestCase;

/**
 * @group widgets
 */
class ListViewTest extends \yiiunit\TestCase
{
    protected function setUp()
    {
        parent::setUp();
        $this->mockApplication();
    }

    public function testEmptyListShown()
    {
        $this->getListView([
            'dataProvider' => new ArrayDataProvider(['allModels' => []]),
            'emptyText' => "Nothing at all",
        ])->run();

        $this->expectOutputString('

Nothing at all

');
    }

    public function testEmptyListNotShown()
    {
        $this->getListView([
            'dataProvider' => new ArrayDataProvider(['allModels' => []]),
            'showOnEmpty' => true,
        ])->run();

        $this->expectOutputString(<< 'w0',
            'dataProvider' => $this->getDataProvider(),
        ], $options));
    }

    private function getDataProvider()
    {
        return new ArrayDataProvider([
            'allModels' => [
                ['id' => 1, 'login' => 'silverfire'],
                ['id' => 2, 'login' => 'samdark'],
                ['id' => 3, 'login' => 'cebe'],
            ],
        ]);
    }

    public function testSimplyListView()
    {
        $this->getListView()->run();

        $this->expectOutputString(<<<HTML

Showing 1-3 of 3 items.

0

1

2

HTML
        );
    }

    public function testWidgetOptions()
    {
        $this->getListView(['options' => ['class' => 'test-passed'], 'separator' => ''])->run();

        $this->expectOutputString(<<<HTML

Showing 1-3 of 3 items.

0

1

2

HTML
        );
    }

    public function itemViewOptions()
    {
        return [
            [
                null,
                '

Showing 1-3 of 3 items.

0

1

2

',
            ],
            [
                function ($model, $key, $index, $widget) {
                    return "Item #{$index}: {$model['login']} - Widget: " . $widget->className();
                },
                '

Showing 1-3 of 3 items.

Item #0: silverfire - Widget: yii\widgets\ListView

Item #1: samdark - Widget: yii\widgets\ListView

Item #2: cebe - Widget: yii\widgets\ListView

',
            ],
            [
                '@yiiunit/data/views/widgets/ListView/item',
                '

Showing 1-3 of 3 items.

Item #0: silverfire - Widget: yii\widgets\ListView

Item #1: samdark - Widget: yii\widgets\ListView

Item #2: cebe - Widget: yii\widgets\ListView

',
            ],
        ];
    }

    /**
     * @dataProvider itemViewOptions
     */
    public function testItemViewOptions($itemView, $expected)
    {
        $this->getListView(['itemView' => $itemView])->run();
        $this->expectOutputString($expected);
    }

    public function itemOptions()
    {
        return [
            [
                null,
                '

Showing 1-3 of 3 items.

0

1

2

',
            ],
            [
                function ($model, $key, $index, $widget) {
                    return [
                        'tag' => 'span',
                        'data' => [
                            'test' => 'passed',
                            'key' => $key,
                            'index' => $index,
                            'id' => $model['id'],
                        ],

                    ];
                },
                '

Showing 1-3 of 3 items.

0
1
2

',
            ],
        ];
    }

    /**
     * @dataProvider itemOptions
     */
    public function testItemOptions($itemOptions, $expected)
    {
        $this->getListView(['itemOptions' => $itemOptions])->run();
        $this->expectOutputString($expected);
    }

    public function testBeforeAndAfterItem()
    {
        $before = function ($model, $key, $index, $widget) {
            $widget = get_class($widget);
            return "";
        };
        $after = function ($model, $key, $index, $widget) {
            if ($model['id'] === 1) {
                return null;
            }
            $widget = get_class($widget);
            return "";
        };
        $this->getListView([
            'beforeItem' => $before,
            'afterItem' => $after
        ])->run();

        $this->expectOutputString(<<<HTML

Showing 1-3 of 3 items.

0

1

2

HTML
);
    }
}


text:
<!--
     Copyright (C) 2021 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<resources>
    <string name="app_name">Bluetooth Advertisements</string>
    <string name="action_settings">Settings</string>
    <string name="broadcast_device">Broadcast Device</string>
    <string name="already_started">Already started.</string>
    <string name="data_too_large">Data too large.</string>
    <string name="not_supported">Feature not supported.</string>
    <string name="inter_err">Internal error.</string>
    <string name="loc_req_title">Need location access for Bluetooth Scanning</string>
    <string name="loc_req_msg">Grant location access to discover nearby Bluetooth devices</string>
    <string name="okay">Okay</string>
    <string name="loc_req_denied_msg">Cannot scan for Bluetooth because location permission was denied</string>
    <string name="bt_scanning">already scanning</string>
    <string name="bt_notif_title">Advertising Device via Bluetooth</string>
    <string name="bt_notif_txt">This device is discoverable to others nearby</string>
    <string name="refresh">Refresh</string>
</resources>


text:
package com.google.security.zynamics.binnavi.standardplugins.callresolver;

import com.google.security.zynamics.binnavi.API.disassembly.AddressSpace;
import com.google.security.zynamics.binnavi.API.disassembly.Module;
import com.google.security.zynamics.binnavi.API.plugins.IAddressSpaceMenuPlugin;
import com.google.security.zynamics.binnavi.API.plugins.IModuleMenuPlugin;
import com.google.security.zynamics.binnavi.API.plugins.PluginInterface;
import com.google.security.zynamics.binnavi.api2.IPluginInterface;

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

import javax.swing.JComponent;
import javax.swing.JMenuItem;

/**
 * This is the plugin class that gets picked up by com.google.security.zynamics.binnavi. The plugin
 * extends the context menus of modules and address spaces in the project tree of the main window.
 */
public final class CallResolverPlugin implements IModuleMenuPlugin, IAddressSpaceMenuPlugin {
  @Override
  public List<JComponent> extendAddressSpaceMenu(final List<AddressSpace> spaces) {
    final List<JComponent> menus = new ArrayList<JComponent>();

    if (spaces.size() == 1) {
      menus.add(new JMenuItem(new ResolveCallsAction(
          PluginInterface.instance().getMainWindow().getFrame(),
          new AddressSpaceCallResolverTarget(spaces.get(0)))));
    }

    return menus;
  }

  @Override
  public List<JComponent> extendModuleMenu(final List<Module> modules) {
    final List<JComponent> menus = new ArrayList<JComponent>();

    if (modules.size() == 1) {
      menus.add(new JMenuItem(new ResolveCallsAction(
          PluginInterface.instance().getMainWindow().getFrame(),
          new ModuleCallResolverTarget(modules.get(0)))));
    }

    return menus;
  }

  @Override
  public String getDescription() {
    return "This plugin can be used to resolve indirect function calls that depend on one more "
        + "or variable values that are not known to the disassembly.";
  }

  @Override
  public long getGuid() {
    return 423547690534790L;
  }

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

  @Override
  public void init(final IPluginInterface pluginInterface) {}

  @Override
  public void unload() {}
}


text:
using System;
using System.Collections.Generic;
using Binance.Net.Converters;
using Binance.Net.Enums;
using CryptoExchange.Net.Converters;
using Newtonsoft.Json;

namespace Binance.Net.Objects.Models.Spot.Mining
{
    /// <summary>
    /// Revenue list
    /// </summary>
    public class BinanceOtherRevenueList
    {
        /// <summary>
        /// Total number of results
        /// </summary>
        public int TotalNum { get; set; }
        /// <summary>
        /// Page size
        /// </summary>
        public int PageSize { get; set; }
        /// <summary>
        /// Revenue items
        /// </summary>
        public IEnumerable<BinanceOtherRevenueItem> OtherProfits { get; set; } = Array.Empty<BinanceOtherRevenueItem>();
    }

    /// <summary>
    /// Revenue
    /// </summary>
    public class BinanceOtherRevenueItem
    {
        /// <summary>
        /// Timestamp
        /// </summary>
        [JsonConverter(typeof(DateTimeConverter))]
        [JsonProperty("time")]
        public DateTime Timestamp { get; set; }
        /// <summary>
        /// Coin
        /// </summary>
        [JsonProperty("coinName")]
        public string Coin { get; set; } = string.Empty;
        /// <summary>
        /// Earning type
        /// </summary>
        [JsonConverter(typeof(BinanceEarningTypeConverter))]
        public BinanceEarningType Type { get; set; }
        /// <summary>
        /// Profit quantity
        /// </summary>
        [JsonProperty("profitAmount")]
        public decimal ProfitQuantity { get; set; }
        /// <summary>
        /// Status
        /// </summary>
        public MinerStatus Status { get; set; }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
RockArrayAdapter
</TITLE>

<META NAME="date" CONTENT="2010-11-12">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

com.wfemmer.sinkmap

Class RockArrayAdapter

java.lang.Object
  <any>
      com.wfemmer.sinkmap.RockArrayAdapter

public class RockArrayAdapter
extends <any>

Author:

Billy Femmer

Constructor Summary

RockArrayAdapter(Activity context,
                 java.lang.String[] names)

Method Summary

 View
getView(int position,
        View convertView,
        ViewGroup parent)

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

RockArrayAdapter

public RockArrayAdapter(Activity context,
                        java.lang.String[] names)

Method Detail

getView

public View getView(int position,
                    View convertView,
                    ViewGroup parent)

      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
Installation on Windows
=======================

.. note:: You can also :doc:`install MapProxy inside an existing OSGeo4W installation<install_osgeo4w>`.

At frist you need a working Python installation. You can download Python from: http://www.python.org/download/. MapProxy requires Python 2.7, 3.3 or 3.4. Python 2.6 should still work, but it is no longer officially supported.

Virtualenv
----------

*If* you are using your Python installation for other applications as well, then we advise you to install MapProxy into a `virtual Python environment`_ to avoid any conflicts with different dependencies. *You can skip this if you only use the Python installation for MapProxy.*
`Read about virtualenv <http://virtualenv.openplans.org/#what-it-does>`_ if you want to now more about the benefits.

.. _`virtual Python environment`: http://guide.python-distribute.org/virtualenv.html

To create a new virtual environment for your MapProxy installation and to activate it go to the command line and call::

 C:\Python27\python path\to\virtualenv.py c:\mapproxy_venv
 C:\mapproxy_venv\Scripts\activate.bat

.. note::
  The last step is required every time you start working with your MapProxy installation. Alternatively you can always explicitly call ``\mapproxy_venv\Scripts\<command>``.

.. note:: Apache mod_wsgi does not work well with virtualenv on Windows. If you want to use mod_wsgi for deployment, then you should skip the creation the virtualenv.

After you activated the new environment, you have access to ``python`` and ``easy_install``.
To install MapProxy with most dependencies call::

  easy_install MapProxy

This might take a minute. You can skip the next step.

Setuptools
----------

MapProxy and most dependencies can be installed with the ``easy_install`` command.
You need to `install the setuptool package <http://pypi.python.org/pypi/setuptools>`_ to get the ``easy_install`` command.

After that you can install MapProxy with::

    c:\Python27\Scripts\easy_install MapProxy

This might take a minute.

Dependencies
------------

Read :ref:`dependency_details` for more information about all dependencies.

Pillow and YAML
~~~~~~~~~~~~~~~

Pillow and PyYAML are installed automatically by ``easy_install``.

PyProj
~~~~~~

Since libproj4 is generally not available on a Windows system, you will also need to install the Python package ``pyproj``.

::

  easy_install pyproj

Shapely and GEOS *(optional)*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Shapely can be installed with ``easy_install Shapely``. This will already include the required ``geos.dll``.

GDAL *(optional)*
~~~~~~~~~~~~~~~~~

MapProxy requires GDAL/OGR for coverage support. MapProxy can either load the ``gdal.dll`` directly or use the ``osgeo.ogr`` Python package. You can `download and install inofficial Windows binaries of GDAL and the Python package <http://www.gisinternals.com/sdk/>`_ (e.g. `gdal-19-xxxx-code.msi`).

You need to add the installation path to the Windows ``PATH`` environment variable in both cases.
You can set the variable temporary on the command line (spaces in the filename need no quotes or escaping)::

  set PATH=%PATH%;C:\Program Files (x86)\GDAL

Or you can add it to your `systems environment variables <http://www.computerhope.com/issues/ch000549.htm>`_.

You also need to set ``GDAL_DRIVER_PATH`` or ``OGR_DRIVER_PATH`` to the ``gdalplugins`` directory when you want to use the Oracle plugin (extra download from URL above)::

    set GDAL_DRIVER_PATH=C:\Program Files (x86)\GDAL\gdalplugins

Platform dependent packages
---------------------------

All Python packages are downloaded from http://pypi.python.org/, but not all platform combinations might be available as a binary package, especially if you run a 64bit version of Windows.

If you run into troubles during installation, because it is trying to compile something (e.g. complaining about ``vcvarsall.bat``), you should look at Christoph Gohlke's `Unofficial Windows Binaries for Python Extension Packages <http://www.lfd.uci.edu/~gohlke/pythonlibs/>`_.

You can install the ``.exe`` packages with ``easy_install``::

  easy_install path\to\package-xxx.exe

Check installation
------------------

To check if the MapProxy was successfully installed you can call ``mapproxy-util``. You should see the installed version number.
::

    mapproxy-util --version

Now continue with :ref:`Create a configuration <create_configuration>` from the installation documentation.


text:
function saludarFamilia(apellido){
  return function saludarMiembrosDeFamilia(nombre) {
    console.log(`Hola ${nombre} ${apellido}`)
  }
}

const saludarGomez = saludarFamilia("Gomez")
const saludarPerez = saludarFamilia("Perez")
const saludarRomero = saludarFamilia("Romero")

saludarGomez("Pedro")
saludarGomez("Juan")
saludarGomez("Laura")
saludarGomez("Mónica")

saludarPerez("Dario")
saludarPerez("Martin")
saludarPerez("Julieta")

saludarRomero("Jorge")

function makePrefixer(prefijo){
  return function pegada(palabra){
    console.log(prefijo+palabra)
  }
}

const prefijoRe = makePrefixer("re")
const prefijoAlgo = makePrefixer("Algo")

prefijoRe("bueno")
prefijoAlgo(" bacano")


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Maze</title>
<meta name="date" content="2014-03-16">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

fr.upem.android.deadhal.maze

Class Maze

java.lang.Object

fr.upem.android.deadhal.maze.Maze

public class Maze
extends java.lang.Object

Class representing the maze

Author:

Alexandre ANDRE, Dylan BANCE, Remy BARBOSA, Houmam WEHBEH

Field Summary

Fields

Modifier and Type
Field and Description

private java.lang.String
id

private java.lang.String
name

private java.util.concurrent.ConcurrentHashMap<java.lang.String,Room>
rooms

Constructor Summary

Constructors

Constructor and Description

Maze()

Class' constructor

Maze(java.lang.String name)

Class' constructor

Method Summary

Methods

Modifier and Type
Method and Description

Maze
addRoom(Room room)

Add a room to the current maze

void
clean()

Method which allows to clean the maze in order to be reallocated for a new maze
 It clean id, the name and allocate a new ConcurrentHashMap

java.lang.String
getId()

java.lang.String
getName()

Room
getRoomById(java.lang.String id)

Return a room (if existing in the current maze) by its id

java.util.ArrayList<java.lang.String>
getRoomIds()

java.util.concurrent.ConcurrentHashMap<java.lang.String,Room>
getRooms()

java.util.TreeMap<java.lang.String,java.lang.String>
getRoomsByIdAndName()

Maze
removeRoom(Room room)

Remove a room from the current maze

Maze
setName(java.lang.String name)

Set the id and the name of the current maze from the passed name

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

id

private java.lang.String id

name

private java.lang.String name

rooms

private java.util.concurrent.ConcurrentHashMap<java.lang.String,Room> rooms

Constructor Detail

Maze

public Maze(java.lang.String name)

Class' constructor

Parameters:

name - The name of the maze

Maze

public Maze()

Class' constructor

Method Detail

clean

public void clean()

Method which allows to clean the maze in order to be reallocated for a new maze
 It clean id, the name and allocate a new ConcurrentHashMap

getRooms

public java.util.concurrent.ConcurrentHashMap<java.lang.String,Room> getRooms()

Returns:

The rooms of the current maze

setName

public Maze setName(java.lang.String name)

Set the id and the name of the current maze from the passed name

Parameters:

name - The name of the maze

Returns:

The current maze

getId

public java.lang.String getId()

Returns:

The id of the maze

getName

public java.lang.String getName()

Returns:

The name of the maze

addRoom

public Maze addRoom(Room room)

Add a room to the current maze

Parameters:

room - The room to add

Returns:

The current maze

removeRoom

public Maze removeRoom(Room room)

Remove a room from the current maze

Parameters:

room - The room to remove

Returns:

The current maze

getRoomsByIdAndName

public java.util.TreeMap<java.lang.String,java.lang.String> getRoomsByIdAndName()

Returns:

A ascendant ordered representation of the rooms by keys (room's id) and values (room's name) in the maze

getRoomIds

public java.util.ArrayList<java.lang.String> getRoomIds()

Returns:

A list of the room's id in the maze

getRoomById

public Room getRoomById(java.lang.String id)

Return a room (if existing in the current maze) by its id

Parameters:

id - The id of the room

Returns:

The room to retrieve

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/**
 * nsMappedAttributeElement is the base for elements supporting style mapped
 * attributes via nsMappedAttributes (HTML and MathML).
 */

#ifndef NS_MAPPEDATTRIBUTEELEMENT_H_
#define NS_MAPPEDATTRIBUTEELEMENT_H_

#include "mozilla/Attributes.h"
#include "nsStyledElement.h"

class nsMappedAttributes;
struct nsRuleData;

typedef void (*nsMapRuleToAttributesFunc)(const nsMappedAttributes* aAttributes,
                                          nsRuleData* aData);

typedef nsStyledElement nsMappedAttributeElementBase;

class nsMappedAttributeElement : public nsMappedAttributeElementBase
{

protected:

  explicit nsMappedAttributeElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
    : nsMappedAttributeElementBase(aNodeInfo)
  {}

public:
  virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;

  static void MapNoAttributesInto(const nsMappedAttributes* aAttributes,
                                  nsRuleData* aRuleData);

  NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
  virtual bool SetMappedAttribute(nsIDocument* aDocument,
                                    nsIAtom* aName,
                                    nsAttrValue& aValue,
                                    nsresult* aRetval) override;
};

#endif // NS_MAPPEDATTRIBUTEELEMENT_H_


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Patellaria rufocarnea Müll. Arg.

### Remarks
null


text:
<?php

/**
 * Send Informix query
 *
 * @phpstub
 *
 * @param string $query
 * @param resource $link_identifier
 * @param int $cursor_type
 * @param mixed $blobidarray
 *
 * @return resource Returns valid Informix result identifier on success, or false on errors.
 */
function ifx_query($query, $link_identifier, $cursor_type = NULL, $blobidarray = NULL)
{
}


text:
function[f] = chebifft(F,varargin);
% [f] = chebifft(F,{normalization='normal', scale=1, points = 'gq'})
%
%     Uses the IFFT to compute the nodal evaluations f from the modal coefficients
%     F.
%
%     Assumes the nodal evaluations f are located at the Chebyhsev-Gauss nodal
%     points. If they're located at different locations, make the optional input
%     points either 'grq' for Gauss-Radau or 'glq' for Gauss-Lobatto.
%     F must be a column vector (but this is vectorized across columns)

persistent input_schema
if isempty(input_schema)
  from labtools import input_schema
end

opt = input_schema({'normalization','scale', 'points'}, ...
  {'normal',1, 'gq'},[], varargin{:});

if strcmpi(opt.points, 'gq')

  N = size(F,1);
  shift = (1+1/(2*N))*(0:(-1):-(N-1)).';
  shift = 1/sqrt(2*pi)*exp(-i*pi*shift);
  shift(1) = sqrt(2)*shift(1);

  f = spdiags(shift,0,N,N)*F;
  f = [0; real(flipud(f(2:end))); real(f)] + i*[0; -imag(flipud(f(2:end))); imag(f)];
  f = ifft(ifftshift(f,1),[],1)*2*N;
  f = real(f(1:N));

elseif strcmpi(opt.points, 'grq')
  error('Not yet implemented')
elseif strcmpi(opt.points, 'glq')
  error('Not yet implemented')
else
  error('Unrecognized flag for location of nodes')
end


text:
layout: microblog
date: 2019-05-11 17:21:40 -0500
link:
collection: microblog
---
Every year change comes,
Hope lives for only colors.
And yet, a new last.

@dengaterade #shoehaiku


text:
package com.cinchapi.concourse.server.concurrent;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;

/**
 * A service that provides ReadLock and WriteLock instances for a given
 * {@link Token}. The locks that are returned from this service can be used to
 * lock notions of things that aren't strictly defined in their own
 * right (i.e. a {@code key} in a {@code record})
 *

 * WARNING: If the caller requests a lock for a given token,
 * but does not attempt to grab it immediately, then it is possible that
 * subsequent requests for locks identified by the same token will return
 * different instances. This is unlikely to happen in practice, but it is
 * recommended that lock grabs happen immediately after lock requests just to be
 * safe (e.g LockService.getReadLock(key, record).lock()).
 *

 *
 * @author Jeff Nelson
 */
public class LockService extends AbstractLockService<Token, TokenReadWriteLock> {

    /**
     * Return a new {@link LockService} instance.
     *
     * @return the LockService
     */
    public static LockService create() {
        return new LockService(
                new ConcurrentHashMap<Token, TokenReadWriteLock>());
    }

    /**
     * Return a {@link LockService} that does not actually provide any locks.
     * This is used in situations where access is guaranteed (or at least
     * assumed) to be isolated (e.g. a Transaction) and we need to simulate
     * locking for polymorphic consistency.
     *
     * @return the LockService
     */
    public static LockService noOp() {
        return NOOP_INSTANCE;
    }

    /**
     * A {@link LockService} that does not actually provide any locks. This is
     * used in situations where access is guaranteed (or at least assumed) to be
     * isolated (e.g. a Transaction) and we need to simulate locking for
     * polymorphic consistency.
     */
    private static final LockService NOOP_INSTANCE = new LockService() {

        @Override
        public ReadLock getReadLock(Token token) {
            return Locks.noOpReadLock();
        }

        @Override
        public WriteLock getWriteLock(Token token) {
            return Locks.noOpWriteLock();
        }
    };

    private LockService() {/* noop */}

    /**
     * Construct a new instance.
     *
     * @param locks
     */
    private LockService(ConcurrentHashMap<Token, TokenReadWriteLock> locks) {
        super(locks);
    }

    /**
     * Return the ReadLock that is identified by {@code objects}. Every caller
     * requesting a lock for {@code token} is guaranteed to get the same
     * instance if the lock is currently held by a reader of a writer.
     *
     * @param objects
     * @return the ReadLock
     */
    public ReadLock getReadLock(Object... objects) {
        return getReadLock(Token.wrap(objects));
    }

    /**
     * Return the WriteLock that is identified by {@code objects}. Every caller
     * requesting a lock for {@code token} is guaranteed to get the same
     * instance if the lock is currently held by a reader of a writer.
     *
     * @param objects
     * @return the WriteLock
     */
    public WriteLock getWriteLock(Object... objects) {
        return getWriteLock(Token.wrap(objects));
    }

    @Override
    protected TokenReadWriteLock createLock(Token token) {
        return new TokenReadWriteLock(token);
    }

}


text:
<dom-module id="login-page">

    <template>
        <paper-card id="form-card" heading="Авторизация">

                <form is="iron-form" id="form" method="post" action="/api/authorize">
                    <paper-input type="email" name="email" label="Email"></paper-input>
                    <paper-input type="password" name="password" label="Пароль"></paper-input>
                </form>

            <temlate is="dom-if" if="[[error]]">

[[error]]

            </temlate>

                <paper-button on-tap="submitForm">Вход</paper-button>

        </paper-card>
    </template>

</dom-module>


text:
#!/usr/bin/env bash

node_modules/mocha/bin/mocha "test/**/*.test.js"


text:
package byteexec

import (
	"os"
	"path"
)

func renameExecutable(orig string) string {
	return orig + ".exe"
}

func pathForRelativeFiles() (string, error) {
	return path.Join(os.Getenv("APPDATA"), "byteexec"), nil
}


text:
import threading,time,sys,logging
from onep import OnepV1
from exceptions import *

# setup default configurations
transport_config = {'host':'m2.exosite.com',
                    'port':'80',
                    'url':'/api:v1/rpc/process',
                    'timeout':3}
datastore_config = {'write_buffer_size':1024,
                    'read_cache_size':1024,
                    'read_cache_expire_time':5,
                    'log_level':'debug'}

logdict = {'debug':logging.DEBUG, 'info':logging.INFO, 'warn':logging.WARN, 'error':logging.ERROR}
logger = logging.getLogger("Datastore")
ch = logging.StreamHandler()
formatter = logging.Formatter("[%(levelname)s %(asctime)s %(funcName)s:%(lineno)d] %(message)s")
ch.setFormatter(formatter)
logger.addHandler(ch)

lock = threading.Lock()

#==============================================================================
class Datastore():
#==============================================================================
#-------------------------------------------------------------------------------
  def __init__(self,cik,interval,autocreate=False,config=datastore_config,transport=transport_config):
    self._liveBuffer = dict()
    self._recordBuffer = dict()
    self._aliasDict = dict()
    self._cache = dict()
    self._cacheCount = 0
    self._recordCount = 0
    self._auto = autocreate
    self._config = config
    self._conn = OnepV1(transport['host'],transport['port'],transport['url'],transport['timeout'])
    self._cik  = cik
    if interval < 1:
      interval = 1
    self._interval = interval
    logger.setLevel(logdict[self._config['log_level']])

#-------------------------------------------------------------------------------
  def __bufferCount(self):
    return len(self._liveBuffer) + self._recordCount

#-------------------------------------------------------------------------------
  def __isBufferFull(self):
    return self.__bufferCount() >= self._config['write_buffer_size']

#-------------------------------------------------------------------------------
  def __isLiveBufferEmpty(self):
    if self._liveBuffer:
      return False
    else:
      return True

#-------------------------------------------------------------------------------
  def __forceTerminate(self):
    if self._killed and self._forceterminate:
      self._liveBuffer.clear()
      return True
    else:
      return False

#==============================================================================
# One platform queries below
#==============================================================================
#-------------------------------------------------------------------------------
  def __lookup(self,alias,forcequery=False):
    if (not forcequery) and self._aliasDict.has_key(alias):
      return self._aliasDict[alias]
    else:
      status,res = self._conn.lookup(self._cik,'alias',alias)
      if not status:
        self._aliasDict[alias] = False
        return False
      else:
        self._aliasDict[alias] = res
        return res

#-------------------------------------------------------------------------------
  def __read(self,alias,count=1,sort='desc',starttime=None,endtime=None):
    rid = self.__lookup(alias)
    if None != starttime and None != endtime:
      status,res = self._conn.read(self._cik,rid,{"starttime":starttime,"endtime":endtime,"limit":count,"sort":sort})
    else:
      status,res = self._conn.read(self._cik,rid,{"limit":count,"sort":sort})
    if not status:
      raise OneException("Error message from one platform (read): %s" % res)
    return res

#-------------------------------------------------------------------------------
  def __record(self,alias,entries):
    rid = self.__lookup(alias)
    record_status,record_message = self._conn.record(self._cik,rid,entries)
    if not ( True == record_status and 'ok' == record_message):
      raise OneException("Error message from one platform (record): %s" % record_message)
    return True

#-------------------------------------------------------------------------------
  def __writegroup(self,entries):
    data = list()
    for (alias,value) in entries:
      rid = self.__lookup(alias)
      data.append([rid,value])
    write_status,write_message = self._conn.writegroup(self._cik,data)
    if not (True == write_status and 'ok' == write_message):
      raise OneException("Error message from one platform (write): %s,%s" % (value,write_message))
    return True

#-------------------------------------------------------------------------------
  def __createDataport(self,alias,name=None,format="string",preprocess=[],count="infinity",duration="infinity",visibility='parent'):
    if None == name:
      name = alias
    desc = {"format":format,"name":name,'visibility':visibility,"retention":{"count":count,"duration":duration},"preprocess":preprocess}
    create_status,rid = self._conn.create(self._cik,"dataport",desc)
    if create_status:
      map_status,map_message = self._conn.map(self._cik,rid,alias)
      if map_status:
        self._aliasDict[alias] = rid
        return True
      else:
        self._conn.drop(self._cik,rid)
        logger.error(map_message)
        return False
    else:
      logger.error(rid)
      return False

#-------------------------------------------------------------------------------
  def __checkDataportExist(self,alias):
    if self.__lookup(alias):
      return True
    else:
      if self._auto:
        if not self.__createDataport(alias=alias,format=self._auto['format'],preprocess=self._auto['preprocess'],count=self._auto['count'],duration=self._auto['duration'],visibility=self._auto['visibility']):
          raise OneException("Fail to create dataport.")
        return True
      else:
        logger.warn("Data source does not exist while not in AUTO_CREATE mode.")
        return False

#==============================================================================
# Write buffer processing below
#==============================================================================
#-------------------------------------------------------------------------------
  def __processJsonRPC(self):
    while not self.__forceTerminate():
      time.sleep(self._interval)
      livedata = list()
      lock.acquire()
      try:
        timestamp = int(time.time())
        aliases = self._liveBuffer.keys()
        for alias in aliases:
          value = self._liveBuffer[alias]
          try:
            if self.__checkDataportExist(alias): # create datasource if necessary
              livedata.append([alias,value]) # Move to live data
              logger.debug("Data to be written (alias,value): ('%s',%s)" % (alias,value) )
          except OneException: #catch exception, add to recordBuffer
            if not self._recordBuffer.has_key(alias):
                self._recordBuffer[alias] = list()
            self._recordBuffer[alias].append([timestamp,value,True])
            self._recordCount += 1
          finally:
            del self._liveBuffer[alias]
      finally:
        self._liveBuffer.clear()
        lock.release()
      # write live data
      if livedata:
        timestamp = int(time.time())
        try:
          self.__writegroup(livedata)
          logger.info("[Live] Written to 1p:" + str(livedata))
        except OneException,e: # go to historical data when write live data failure
          print e.message
          lock.acquire()
          try:
            for (alias,value) in livedata:
              if not self._recordBuffer.has_key(alias):
                self._recordBuffer[alias] = list()
              offset = True
              self._recordBuffer[alias].append([timestamp,value,offset])
              self._recordCount += 1
          finally:
            lock.release()
        except Exception,e:
          print sys.exc_info()[0]
      ## write historical data
      lock.acquire()
      try:
        aliases =  self._recordBuffer.keys()
        curtime = int(time.time())
        for alias in aliases:
          entries = self._recordBuffer[alias]
          try:
            if self.__checkDataportExist(alias):
              recentry = list()
              for entry in entries:
                if True == entry[2]: #offset mode
                  offset = entry[0] - curtime
                  recentry.append([offset, entry[1]])
                else:
                  recentry.append([entry[0], entry[1]])
              if recentry:
                self.__record(alias,recentry)
                logger.info("[Historical] Written to 1p: " + alias + ", " + str(recentry))
                self._recordCount -= len(entries)
                del self._recordBuffer[alias]
            else:
              del self._recordBuffer[alias]
          except OneException,e:
            logger.error(e.message)
            continue
      finally:
        lock.release()
      if self._killed and not self._recordBuffer:
        self._forceterminate = True

#==============================================================================
# Read cache routines below
#==============================================================================
#-------------------------------------------------------------------------------
  def __addCacheData(self,alias,count):
    if self.__isCacheFull():
      self.__clearCache()
    self._cache[alias] = dict()
    data = self.__refreshData(alias,count)
    if data:
      self._cacheCount += 1
    return data

#-------------------------------------------------------------------------------
  def __isExpired(self,alias):
    try:
      return int(time.time()) - self._cache[alias]['time'] > self._config['read_cache_expire_time']
    except:
      return True

#-------------------------------------------------------------------------------
  def __isCacheFull(self):
    return self._cacheCount >= self._config['read_cache_size']

#-------------------------------------------------------------------------------
  def __clearCache(self):
    self._cache.clear()
    self._cache = dict()
    self._cacheCount = 0

#-------------------------------------------------------------------------------
  def __refreshData(self,alias,count):
    try:
      time.sleep(1)
      data = self.__read(alias,count)
      self._cache[alias]['data'] = data
      self._cache[alias]['time'] = int(time.time())
      return data
    except OneException,e:
      logger.error(e.message)
    except Exception,e:
      print sys.exc_info()[0]
      logger.error("Unknown error when reading data.")
    return False

#==============================================================================
# Public methods below
#==============================================================================
#-------------------------------------------------------------------------------
  def isThreadAlive(self):
    return self._thread.isAlive()

#-------------------------------------------------------------------------------
  def comment(self,alias,visibility,commentstr):
    rid = self.__lookup(alias)
    if rid:
      status,message = self._conn.comment(self._cik,rid,visibility,commentstr)
      if status:
        return True
    return False

#-------------------------------------------------------------------------------
  def createDataport(self,alias,format,name=None,preprocess=[],count=0,duration=0,visibility="public"):
    rid = self.__lookup(alias)
    if rid:
      return False,"Alias already existed."
    else:
      if self.__createDataport(alias,name,format,preprocess,count,duration,visibility):
        return True,True
      else:
        return False,"Failed to create Dataport."

#-------------------------------------------------------------------------------
  def read(self,alias,count=1):
    if self._cache.has_key(alias): #has cache data
      if self.__isExpired(alias) or count != len(self._cache[alias]['data']):
        return self.__refreshData(alias,count)
      else:
        return self._cache[alias]['data']
    else: #no cache data
      return self.__addCacheData(alias,count)

#-------------------------------------------------------------------------------
  def record(self,alias,entries):
    if self.__isBufferFull() or not (self._auto or self.__lookup(alias)):
      return False
    lock.acquire()
    try:
      if not self._recordBuffer.has_key(alias):
        self._recordBuffer[alias] = list()
      for (t,value) in entries:
        recentry = [t,value,False]
        self._recordBuffer[alias].append(recentry)
    finally:
      lock.release()

#-------------------------------------------------------------------------------
  def restart(self):
    self.stop(force=True)
    self.start()

#-------------------------------------------------------------------------------
  def start(self,daemon=False):
    time.sleep(1)
    self._killed = False
    self._forceterminate = False
    self._thread = threading.Thread(target=self.__processJsonRPC)
    self._thread.setDaemon(daemon)
    self._thread.start()

#-------------------------------------------------------------------------------
  def stop(self,force=False):
    self._killed = True
    self._forceterminate = force

#-------------------------------------------------------------------------------
  def write(self,alias,value):
    if self.__isBufferFull() or not (self._auto or self.__lookup(alias)):
      return False
    else:
      lock.acquire()
      try:
        if self._liveBuffer.has_key(alias):
          self._liveBuffer[alias] = value
          logger.debug("Update the (alias,value) in buffer:%s,%s" % (alias,value))
          return False
        else:
          self._liveBuffer[alias] = value
      finally:
        lock.release()
      logger.debug("Current buffer count: %s" % self.__bufferCount())
      logger.debug("Add to buffer:%s,%s" % (alias,value))
      return True


text:
/** PURE_IMPORTS_START .._.._Observable,.._.._observable_timer PURE_IMPORTS_END */
import { Observable } from '../../Observable';
import { timer as staticTimer } from '../../observable/timer';
Observable.timer = staticTimer;
//# sourceMappingURL=timer.js.map


text:
/*
 * vim:ts=4:sw=4:expandtab
 *
 * i3bar - an xcb-based status- and ws-bar for i3
 * © 2010-2012 Axel Wagner and contributors (see also: LICENSE)
 *
 * ipc.c: Communicating with i3
 *
 */
#ifndef IPC_H_
#define IPC_H_

#include <stdint.h>

/*
 * Initiate a connection to i3.
 * socket-path must be a valid path to the ipc_socket of i3
 *
 */
int init_connection(const char *socket_path);

/*
 * Destroy the connection to i3.
 *
 */
void destroy_connection(void);

/*
 * Sends a Message to i3.
 * type must be a valid I3_IPC_MESSAGE_TYPE (see i3/ipc.h for further information)
 *
 */
int i3_send_msg(uint32_t type, const char* payload);

/*
 * Subscribe to all the i3-events, we need
 *
 */
void subscribe_events(void);

#endif


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<title>${title}</title>

<meta name="verify-v1"
	content="UsIBiaQhhmjFrBwcJ2n4XIvEImPNG4SMVP365rRcpxE=" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<#list sitemap.sections as section>

${section.name}

<#list section.entries as entry> <#if
entry=page>

${entry.title}

<#else>

${entry.title}

</#if> </#list>

</#list>

Hosted by

${body}

Last Published: 11 Oct 2008

© 2005-2008


text:
Cobalt.navigate.protoype = function(){
  var self = this;

  var Navigate = {
    push: function(options){
      if (!options || !options.page || !options.controller) return;

      self.send({
        type   : "navigation",
        action : "push",
        data : {
          page       : options.page,
          controller : options.controller,
          animated   : (options.animated !== false), //default to true
          data : options.data
        }
      });
    },

    pop: function(options){
      if (!options || !options.page || !options.controller) return;

      self.send({
        type    : "navigation",
        action  : "pop",
        data: {
          data : data
        }
      });
    },

    popTo: function(options){
      if (!options || !options.page || !options.controller) return;

      self.send({
        type   : "navigation",
        action : "pop",
        data : {
          page       : options.page,
          controller : options.controller,
          data : options.data
        }
      });
    },

    replace: function(options){
      if (!options || !options.page || !options.controller) return;

      self.send({
        type   : "navigation",
        action : "replace",
        data : {
          page       : options.page,
          controller : options.controller,
          animated   : (options.animated !== false), //default to true
          data : options.data
        }
      });
    },

    modal: function(options){
      if (!options || !options.page || !options.controller) return;

      self.adapter.navigateToModal(options);
    },

    dismiss: function(options){
      if (!options || !options.page || !options.controller) return;

      self.adapter.dismissFromModal(options);
    },
  };

  return Navigate;
};


text: <!doctype html>


text:
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core.TestFramework;
using Azure.Data.Tables;
using Newtonsoft.Json.Linq;
using NUnit.Framework;

namespace Microsoft.Azure.WebJobs.Extensions.Tables.Tests
{
    public class TableCreationTests : TablesLiveTestBase
    {
        public TableCreationTests(bool isAsync, bool useCosmos): base(isAsync, useCosmos, createTable: false)
        {
        }

        [RecordedTest]
        [GenericTestCase(typeof(ITableEntity))]
        [GenericTestCase(typeof(TableEntity))]
        [GenericTestCase(typeof(JObject))]
        [GenericTestCase(typeof(StructTableEntity))]
        [GenericTestCase(typeof(PocoTableEntity))]
        public async Task Table_IfBoundToTypeAndTableIsMissing_DoesNotCreate<T>()
        {
            // Act
            await CallAsync<BindEntity<T>>();
            // Assert
            Assert.False(await TableExistsAsync(TableName));
        }

        private class BindEntity<T>
        {
            public static void Call([Table(TableNameExpression, "PK", "RK")] T entity)
            {
                Assert.AreEqual(default(T), entity);
            }
        }

        [RecordedTest]
        [GenericTestCase(typeof(ITableEntity))]
        [GenericTestCase(typeof(TableEntity))]
        [GenericTestCase(typeof(JObject))]
        [GenericTestCase(typeof(StructTableEntity))]
        [GenericTestCase(typeof(PocoTableEntity))]
        public async Task Table_IfBoundToCollectorAndTableIsMissing_DoesNotCreate<T>()
        {
            // Act
            await CallAsync<BindCollector<T>>();
            // Assert
            Assert.False(await TableExistsAsync(TableName));
        }

        private class BindCollector<T>
        {
            public static void Call([Table(TableNameExpression)] ICollector<T> entities)
            {
                Assert.NotNull(entities);
            }
        }

        [RecordedTest]
        [GenericTestCase(typeof(ITableEntity))]
        [GenericTestCase(typeof(TableEntity))]
        [GenericTestCase(typeof(JObject))]
        [GenericTestCase(typeof(StructTableEntity))]
        [GenericTestCase(typeof(PocoTableEntity))]
        public async Task Table_IfBoundToCollectorAndTableIsMissingAndAdds_CreatesTable<T>()
        {
            // Act
            await CallAsync<BindCollectorAndAdd<T>>();
            // Assert
            var entity = TableClient.GetEntityAsync<TableEntity>(PartitionKey, RowKey);
            Assert.AreEqual("test value", entity.Result.Value["Value"]);
        }

        private class BindCollectorAndAdd<T>
        {
            public static void Call([Table(TableNameExpression)] ICollector<T> entities)
            {
                entities.Add(Create<T>());
            }
        }

        [RecordedTest]
        [GenericTestCase(typeof(ITableEntity))]
        [GenericTestCase(typeof(TableEntity))]
        [GenericTestCase(typeof(JObject))]
        [GenericTestCase(typeof(PocoTableEntity))]
        public async Task Table_IfBoundToOutParameterAndTableIsMissingAndAdds_CreatesTable<T>()
        {
            // Act
            await CallAsync<BindOut<T>>();
            // Assert
            var entity = TableClient.GetEntityAsync<TableEntity>(PartitionKey, RowKey);
            Assert.AreEqual("test value", entity.Result.Value["Value"]);
        }

        private class BindOut<T>
        {
            public static void Call([Table(TableNameExpression)] out T entity)
            {
                entity = Create<T>();
            }
        }

        [RecordedTest]
        [GenericTestCase(typeof(ITableEntity))]
        [GenericTestCase(typeof(TableEntity))]
        [GenericTestCase(typeof(JObject))]
        [GenericTestCase(typeof(StructTableEntity))]
        [GenericTestCase(typeof(PocoTableEntity))]
        [GenericTestCase(typeof(ExplicitlyImplementedITableEntity))]
        public async Task Table_IfBoundToReturnAndTableIsMissingAndAdds_CreatesTable<T>()
        {
            // Act
            await CallAsync<BindReturn<T>>();
            // Assert
            var entity = TableClient.GetEntityAsync<TableEntity>(PartitionKey, RowKey);
            Assert.AreEqual("test value", entity.Result.Value["Value"]);
        }

        private class BindReturn<T>
        {
            [return: Table(TableNameExpression)]
            public static T Call()
            {
                return Create<T>();
            }
        }

        [RecordedTest]
        public async Task Table_IfBoundToTableClient_BindsAndCreatesTable()
        {
            // Act
            TableClient result = (await CallAsync<BindToTableClientProgram>()).Table;

            // Assert
            Assert.NotNull(result);
            Assert.AreEqual(TableName, result.Name);

            Assert.True(await TableExistsAsync(TableName).ConfigureAwait(false));
        }

        private class BindToTableClientProgram
        {
            public void Run([Table(TableNameExpression)] TableClient table)
            {
                Table = table;
            }

            public TableClient Table { get; set; }
        }

        private static T Create<T>()
        {
            if (typeof(T) == typeof(TableEntity) || typeof(T) == typeof(ITableEntity))
            {
                return (T)(object)new TableEntity(PartitionKey, RowKey)
                {
                    ["Value"] = "test value"
                };
            }
            if (typeof(T) == typeof(JObject))
            {
                return (T)(object)new JObject()
                {
                    ["RowKey"] = RowKey,
                    ["PartitionKey"] = PartitionKey,
                    ["Value"] = "test value"
                };
            }

            if (typeof(T) == typeof(PocoTableEntity))
            {
                return (T)(object)new PocoTableEntity()
                {
                    RowKey = RowKey,
                    PartitionKey = PartitionKey,
                    Value = "test value"
                };
            }

            if (typeof(T) == typeof(StructTableEntity))
            {
                return (T)(object)new StructTableEntity()
                {
                    RowKey = RowKey,
                    PartitionKey = PartitionKey,
                    Value = "test value"
                };
            }

            if (typeof(T) == typeof(ExplicitlyImplementedITableEntity))
            {
                return (T)(object)new ExplicitlyImplementedITableEntity()
                {
                    StringRK = RowKey,
                    StringPK = PartitionKey,
                    Value = "test value"
                };
            }

            Assert.Fail();
            return default;
        }

        private class PocoTableEntity
        {
            public string RowKey { get; set; }
            public string PartitionKey { get; set; }
            public string Value { get; set; }
        }

        private struct StructTableEntity
        {
            public string RowKey { get; set; }
            public string PartitionKey { get; set; }
            public string Value { get; set; }
        }

        private class ExplicitlyImplementedITableEntity : ITableEntity
        {
            public string StringPK { get; set; }
            public string StringRK { get; set; }
            public string Value { get; set; }

            public DateTimeOffset? Timestamp { get; set; }
            public ETag ETag { get; set; }
            string ITableEntity.PartitionKey
            {
                get => StringPK;
                set => StringPK = value;
            }
            string ITableEntity.RowKey
            {
                get => StringRK;
                set => StringRK = value;
            }
        }
    }
}


text:
package com.serjltt.moshi.adapters;

import com.squareup.moshi.JsonAdapter;
import com.squareup.moshi.Moshi;
import org.junit.Test;

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

public final class SerializeOnlyJsonAdapterTest {
  // Lazy adapters work only within the context of moshi.
  private final Moshi moshi = new Moshi.Builder()
      .add(SerializeOnly.ADAPTER_FACTORY)
      .add(SerializeNulls.ADAPTER_FACTORY)
      .add(new Custom.CustomAdapter()) // We need to check that other annotations are not lost.
      .build();

  @Test public void serializeOnly() throws Exception {
    JsonAdapter<Data1> adapter = moshi.adapter(Data1.class);

    Data1 fromJson = adapter.fromJson("{\"data\": \"test\"}");
    assertThat(fromJson.data).isNull();

    fromJson.data = "1234";
    assertThat(adapter.toJson(fromJson)).isEqualTo("{\"data\":\"1234\"}");
  }

  @Test public void factoryMaintainsOtherAnnotations() throws Exception {
    JsonAdapter<Data2> adapter = moshi.adapter(Data2.class);

    Data2 fromJson = adapter.fromJson("{\"data\": \"test\"}");
    assertThat(fromJson.data).isNull();

    fromJson.data = "1234Custom";
    String toJson = adapter.toJson(fromJson);
    assertThat(toJson).isEqualTo("{\"data\":\"1234\"}");

    Data2 data = new Data2();
    data.data = null;
    toJson = adapter.toJson(data);
    assertThat(toJson).isEqualTo("{\"data\":null}");
  }

  @Test public void toStringReflectsInnerAdapter() throws Exception {
    JsonAdapter<String> adapter = moshi.adapter(String.class, SerializeOnly.class);

    assertThat(adapter.toString()).isEqualTo("JsonAdapter(String).nullSafe().serializeOnly()");
  }

  private static class Data1 {
    @SerializeOnly String data;
  }

  private static class Data2 {
    @Custom @SerializeOnly @SerializeNulls String data;
  }
}


text:
@interface MOBProjectionEPSG6475 : MOBProjection

@end


text:
#include "dm365_ipipeif.h"
#include "vpfe_mc_capture.h"

static const unsigned int ipipeif_input_fmts[] = {
	MEDIA_BUS_FMT_UYVY8_2X8,
	MEDIA_BUS_FMT_SGRBG12_1X12,
	MEDIA_BUS_FMT_Y8_1X8,
	MEDIA_BUS_FMT_UV8_1X8,
	MEDIA_BUS_FMT_YDYUYDYV8_1X16,
	MEDIA_BUS_FMT_SBGGR8_1X8,
};

static const unsigned int ipipeif_output_fmts[] = {
	MEDIA_BUS_FMT_UYVY8_2X8,
	MEDIA_BUS_FMT_SGRBG12_1X12,
	MEDIA_BUS_FMT_Y8_1X8,
	MEDIA_BUS_FMT_UV8_1X8,
	MEDIA_BUS_FMT_YDYUYDYV8_1X16,
	MEDIA_BUS_FMT_SBGGR8_1X8,
	MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8,
	MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8,
};

static int
ipipeif_get_pack_mode(u32 in_pix_fmt)
{
	switch (in_pix_fmt) {
	case MEDIA_BUS_FMT_SBGGR8_1X8:
	case MEDIA_BUS_FMT_Y8_1X8:
	case MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8:
	case MEDIA_BUS_FMT_UV8_1X8:
		return IPIPEIF_5_1_PACK_8_BIT;

	case MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8:
		return IPIPEIF_5_1_PACK_8_BIT_A_LAW;

	case MEDIA_BUS_FMT_SGRBG12_1X12:
		return IPIPEIF_5_1_PACK_16_BIT;

	case MEDIA_BUS_FMT_SBGGR12_1X12:
		return IPIPEIF_5_1_PACK_12_BIT;

	default:
		return IPIPEIF_5_1_PACK_16_BIT;
	}
}

static inline u32 ipipeif_read(void *addr, u32 offset)
{
	return readl(addr + offset);
}

static inline void ipipeif_write(u32 val, void *addr, u32 offset)
{
	writel(val, addr + offset);
}

static void ipipeif_config_dpc(void *addr, struct ipipeif_dpc *dpc)
{
	u32 val = 0;

	if (dpc->en) {
		val = (dpc->en & 1) << IPIPEIF_DPC2_EN_SHIFT;
		val |= dpc->thr & IPIPEIF_DPC2_THR_MASK;
	}
	ipipeif_write(val, addr, IPIPEIF_DPC2);
}

#define IPIPEIF_MODE_CONTINUOUS			0
#define IPIPEIF_MODE_ONE_SHOT			1

static int get_oneshot_mode(enum ipipeif_input_entity input)
{
	if (input == IPIPEIF_INPUT_MEMORY)
		return IPIPEIF_MODE_ONE_SHOT;
	if (input == IPIPEIF_INPUT_ISIF)
		return IPIPEIF_MODE_CONTINUOUS;

	return -EINVAL;
}

static int
ipipeif_get_cfg_src1(struct vpfe_ipipeif_device *ipipeif)
{
	struct v4l2_mbus_framefmt *informat;

	informat = &ipipeif->formats[IPIPEIF_PAD_SINK];
	if (ipipeif->input == IPIPEIF_INPUT_MEMORY &&
	   (informat->code == MEDIA_BUS_FMT_Y8_1X8 ||
	    informat->code == MEDIA_BUS_FMT_UV8_1X8))
		return IPIPEIF_CCDC;

	return IPIPEIF_SRC1_PARALLEL_PORT;
}

static int
ipipeif_get_data_shift(struct vpfe_ipipeif_device *ipipeif)
{
	struct v4l2_mbus_framefmt *informat;

	informat = &ipipeif->formats[IPIPEIF_PAD_SINK];

	switch (informat->code) {
	case MEDIA_BUS_FMT_SGRBG12_1X12:
		return IPIPEIF_5_1_BITS11_0;

	case MEDIA_BUS_FMT_Y8_1X8:
	case MEDIA_BUS_FMT_UV8_1X8:
		return IPIPEIF_5_1_BITS11_0;

	default:
		return IPIPEIF_5_1_BITS7_0;
	}
}

static enum ipipeif_input_source
ipipeif_get_source(struct vpfe_ipipeif_device *ipipeif)
{
	struct v4l2_mbus_framefmt *informat;

	informat = &ipipeif->formats[IPIPEIF_PAD_SINK];
	if (ipipeif->input == IPIPEIF_INPUT_ISIF)
		return IPIPEIF_CCDC;

	if (informat->code == MEDIA_BUS_FMT_UYVY8_2X8)
		return IPIPEIF_SDRAM_YUV;

	return IPIPEIF_SDRAM_RAW;
}

void vpfe_ipipeif_ss_buffer_isr(struct vpfe_ipipeif_device *ipipeif)
{
	struct vpfe_video_device *video_in = &ipipeif->video_in;

	if (ipipeif->input != IPIPEIF_INPUT_MEMORY)
		return;

	spin_lock(&video_in->dma_queue_lock);
	vpfe_video_process_buffer_complete(video_in);
	video_in->state = VPFE_VIDEO_BUFFER_NOT_QUEUED;
	vpfe_video_schedule_next_buffer(video_in);
	spin_unlock(&video_in->dma_queue_lock);
}

int vpfe_ipipeif_decimation_enabled(struct vpfe_device *vpfe_dev)
{
	struct vpfe_ipipeif_device *ipipeif = &vpfe_dev->vpfe_ipipeif;

	return ipipeif->config.decimation;
}

int vpfe_ipipeif_get_rsz(struct vpfe_device *vpfe_dev)
{
	struct vpfe_ipipeif_device *ipipeif = &vpfe_dev->vpfe_ipipeif;

	return ipipeif->config.rsz;
}

#define RD_DATA_15_2		0x7

/*
 * ipipeif_hw_setup() - This function sets up IPIPEIF
 * @sd: pointer to v4l2 subdev structure
 * return -EINVAL or zero on success
 */
static int ipipeif_hw_setup(struct v4l2_subdev *sd)
{
	struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd);
	struct v4l2_mbus_framefmt *informat, *outformat;
	struct ipipeif_params params = ipipeif->config;
	enum ipipeif_input_source ipipeif_source;
	u32 isif_port_if;
	void *ipipeif_base_addr;
	unsigned int val;
	int data_shift;
	int pack_mode;
	int source1;
	int tmp;

	ipipeif_base_addr = ipipeif->ipipeif_base_addr;

	/* Enable clock to IPIPEIF and IPIPE */
	vpss_enable_clock(VPSS_IPIPEIF_CLOCK, 1);

	informat = &ipipeif->formats[IPIPEIF_PAD_SINK];
	outformat = &ipipeif->formats[IPIPEIF_PAD_SOURCE];

	/* Combine all the fields to make CFG1 register of IPIPEIF */
	tmp = val = get_oneshot_mode(ipipeif->input);
	if (tmp < 0) {
		dev_err(&sd->devnode->dev, "ipipeif: links setup required");
		return -EINVAL;
	}
	val <<= ONESHOT_SHIFT;

	ipipeif_source = ipipeif_get_source(ipipeif);
	val |= ipipeif_source << INPSRC_SHIFT;

	val |= params.clock_select << CLKSEL_SHIFT;
	val |= params.avg_filter << AVGFILT_SHIFT;
	val |= params.decimation << DECIM_SHIFT;

	pack_mode = ipipeif_get_pack_mode(informat->code);
	val |= pack_mode << PACK8IN_SHIFT;

	source1 = ipipeif_get_cfg_src1(ipipeif);
	val |= source1 << INPSRC1_SHIFT;

	data_shift = ipipeif_get_data_shift(ipipeif);
	if (ipipeif_source != IPIPEIF_SDRAM_YUV)
		val |= data_shift << DATASFT_SHIFT;
	else
		val &= ~(RD_DATA_15_2 << DATASFT_SHIFT);

	ipipeif_write(val, ipipeif_base_addr, IPIPEIF_CFG1);

	switch (ipipeif_source) {
	case IPIPEIF_CCDC:
		ipipeif_write(ipipeif->gain, ipipeif_base_addr, IPIPEIF_GAIN);
		break;

	case IPIPEIF_SDRAM_RAW:
	case IPIPEIF_CCDC_DARKFM:
		ipipeif_write(ipipeif->gain, ipipeif_base_addr, IPIPEIF_GAIN);
		/* fall through */
	case IPIPEIF_SDRAM_YUV:
		val |= data_shift << DATASFT_SHIFT;
		ipipeif_write(params.ppln, ipipeif_base_addr, IPIPEIF_PPLN);
		ipipeif_write(params.lpfr, ipipeif_base_addr, IPIPEIF_LPFR);
		ipipeif_write(informat->width, ipipeif_base_addr, IPIPEIF_HNUM);
		ipipeif_write(informat->height,
			      ipipeif_base_addr, IPIPEIF_VNUM);
		break;

	default:
		return -EINVAL;
	}

	/*check if decimation is enable or not */
	if (params.decimation)
		ipipeif_write(params.rsz, ipipeif_base_addr, IPIPEIF_RSZ);

	/* Setup sync alignment and initial rsz position */
	val = params.if_5_1.align_sync & 1;
	val <<= IPIPEIF_INIRSZ_ALNSYNC_SHIFT;
	val |= params.if_5_1.rsz_start & IPIPEIF_INIRSZ_MASK;
	ipipeif_write(val, ipipeif_base_addr, IPIPEIF_INIRSZ);
	isif_port_if = informat->code;

	if (isif_port_if == MEDIA_BUS_FMT_Y8_1X8)
		isif_port_if = MEDIA_BUS_FMT_YUYV8_1X16;
	else if (isif_port_if == MEDIA_BUS_FMT_UV8_1X8)
		isif_port_if = MEDIA_BUS_FMT_SGRBG12_1X12;

	/* Enable DPCM decompression */
	switch (ipipeif_source) {
	case IPIPEIF_SDRAM_RAW:
		val = 0;
		if (outformat->code == MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8) {
			val = 1;
			val |= (IPIPEIF_DPCM_8BIT_10BIT & 1) <<
				IPIPEIF_DPCM_BITS_SHIFT;
			val |= (ipipeif->dpcm_predictor & 1) <<
				IPIPEIF_DPCM_PRED_SHIFT;
		}
		ipipeif_write(val, ipipeif_base_addr, IPIPEIF_DPCM);

		/* set DPC */
		ipipeif_config_dpc(ipipeif_base_addr, &params.if_5_1.dpc);

		ipipeif_write(params.if_5_1.clip,
			      ipipeif_base_addr, IPIPEIF_OCLIP);

		/* fall through for SDRAM YUV mode */
		/* configure CFG2 */
		val = ipipeif_read(ipipeif_base_addr, IPIPEIF_CFG2);
		switch (isif_port_if) {
		case MEDIA_BUS_FMT_YUYV8_1X16:
		case MEDIA_BUS_FMT_UYVY8_2X8:
		case MEDIA_BUS_FMT_Y8_1X8:
			RESETBIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
			SETBIT(val, IPIPEIF_CFG2_YUV16_SHIFT);
			ipipeif_write(val, ipipeif_base_addr, IPIPEIF_CFG2);
			break;

		default:
			RESETBIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
			RESETBIT(val, IPIPEIF_CFG2_YUV16_SHIFT);
			ipipeif_write(val, ipipeif_base_addr, IPIPEIF_CFG2);
			break;
		}

	case IPIPEIF_SDRAM_YUV:
		/* Set clock divider */
		if (params.clock_select == IPIPEIF_SDRAM_CLK) {
			val = ipipeif_read(ipipeif_base_addr, IPIPEIF_CLKDIV);
			val |= (params.if_5_1.clk_div.m - 1) <<
				IPIPEIF_CLKDIV_M_SHIFT;
			val |= (params.if_5_1.clk_div.n - 1);
			ipipeif_write(val, ipipeif_base_addr, IPIPEIF_CLKDIV);
		}
		break;

	case IPIPEIF_CCDC:
	case IPIPEIF_CCDC_DARKFM:
		/* set DPC */
		ipipeif_config_dpc(ipipeif_base_addr, &params.if_5_1.dpc);

		/* Set DF gain & threshold control */
		val = 0;
		if (params.if_5_1.df_gain_en) {
			val = params.if_5_1.df_gain_thr &
				IPIPEIF_DF_GAIN_THR_MASK;
			ipipeif_write(val, ipipeif_base_addr, IPIPEIF_DFSGTH);
			val = (params.if_5_1.df_gain_en & 1) <<
				IPIPEIF_DF_GAIN_EN_SHIFT;
			val |= params.if_5_1.df_gain &
				IPIPEIF_DF_GAIN_MASK;
		}
		ipipeif_write(val, ipipeif_base_addr, IPIPEIF_DFSGVL);
		/* configure CFG2 */
		val = VPFE_PINPOL_POSITIVE << IPIPEIF_CFG2_HDPOL_SHIFT;
		val |= VPFE_PINPOL_POSITIVE << IPIPEIF_CFG2_VDPOL_SHIFT;

		switch (isif_port_if) {
		case MEDIA_BUS_FMT_YUYV8_1X16:
		case MEDIA_BUS_FMT_YUYV10_1X20:
			RESETBIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
			SETBIT(val, IPIPEIF_CFG2_YUV16_SHIFT);
			break;

		case MEDIA_BUS_FMT_YUYV8_2X8:
		case MEDIA_BUS_FMT_UYVY8_2X8:
		case MEDIA_BUS_FMT_Y8_1X8:
		case MEDIA_BUS_FMT_YUYV10_2X10:
			SETBIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
			SETBIT(val, IPIPEIF_CFG2_YUV16_SHIFT);
			val |= IPIPEIF_CBCR_Y << IPIPEIF_CFG2_YUV8P_SHIFT;
			break;

		default:
			/* Bayer */
			ipipeif_write(params.if_5_1.clip, ipipeif_base_addr,
				IPIPEIF_OCLIP);
		}
		ipipeif_write(val, ipipeif_base_addr, IPIPEIF_CFG2);
		break;

	default:
		return -EINVAL;
	}

	return 0;
}

static int
ipipeif_set_config(struct v4l2_subdev *sd, struct ipipeif_params *config)
{
	struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd);
	struct device *dev = ipipeif->subdev.v4l2_dev->dev;

	if (!config) {
		dev_err(dev, "Invalid configuration pointer\n");
		return -EINVAL;
	}

	ipipeif->config.clock_select = config->clock_select;
	ipipeif->config.ppln = config->ppln;
	ipipeif->config.lpfr = config->lpfr;
	ipipeif->config.rsz = config->rsz;
	ipipeif->config.decimation = config->decimation;
	if (ipipeif->config.decimation &&
	   (ipipeif->config.rsz < IPIPEIF_RSZ_MIN ||
	    ipipeif->config.rsz > IPIPEIF_RSZ_MAX)) {
		dev_err(dev, "rsz range is %d to %d\n",
			IPIPEIF_RSZ_MIN, IPIPEIF_RSZ_MAX);
		return -EINVAL;
	}

	ipipeif->config.avg_filter = config->avg_filter;

	ipipeif->config.if_5_1.df_gain_thr = config->if_5_1.df_gain_thr;
	ipipeif->config.if_5_1.df_gain = config->if_5_1.df_gain;
	ipipeif->config.if_5_1.df_gain_en = config->if_5_1.df_gain_en;

	ipipeif->config.if_5_1.rsz_start = config->if_5_1.rsz_start;
	ipipeif->config.if_5_1.align_sync = config->if_5_1.align_sync;
	ipipeif->config.if_5_1.clip = config->if_5_1.clip;

	ipipeif->config.if_5_1.dpc.en = config->if_5_1.dpc.en;
	ipipeif->config.if_5_1.dpc.thr = config->if_5_1.dpc.thr;

	ipipeif->config.if_5_1.clk_div.m = config->if_5_1.clk_div.m;
	ipipeif->config.if_5_1.clk_div.n = config->if_5_1.clk_div.n;

	return 0;
}

static int
ipipeif_get_config(struct v4l2_subdev *sd, void __user *arg)
{
	struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd);
	struct ipipeif_params *config = arg;
	struct device *dev = ipipeif->subdev.v4l2_dev->dev;

	if (!arg) {
		dev_err(dev, "Invalid configuration pointer\n");
		return -EINVAL;
	}

	config->clock_select = ipipeif->config.clock_select;
	config->ppln = ipipeif->config.ppln;
	config->lpfr = ipipeif->config.lpfr;
	config->rsz = ipipeif->config.rsz;
	config->decimation = ipipeif->config.decimation;
	config->avg_filter = ipipeif->config.avg_filter;

	config->if_5_1.df_gain_thr = ipipeif->config.if_5_1.df_gain_thr;
	config->if_5_1.df_gain = ipipeif->config.if_5_1.df_gain;
	config->if_5_1.df_gain_en = ipipeif->config.if_5_1.df_gain_en;

	config->if_5_1.rsz_start = ipipeif->config.if_5_1.rsz_start;
	config->if_5_1.align_sync = ipipeif->config.if_5_1.align_sync;
	config->if_5_1.clip = ipipeif->config.if_5_1.clip;

	config->if_5_1.dpc.en = ipipeif->config.if_5_1.dpc.en;
	config->if_5_1.dpc.thr = ipipeif->config.if_5_1.dpc.thr;

	config->if_5_1.clk_div.m = ipipeif->config.if_5_1.clk_div.m;
	config->if_5_1.clk_div.n = ipipeif->config.if_5_1.clk_div.n;

	return 0;
}

/*
 * ipipeif_ioctl() - Handle ipipeif module private ioctl's
 * @sd: pointer to v4l2 subdev structure
 * @cmd: configuration command
 * @arg: configuration argument
 */
static long ipipeif_ioctl(struct v4l2_subdev *sd,
			  unsigned int cmd, void *arg)
{
	struct ipipeif_params *config = arg;
	int ret = -ENOIOCTLCMD;

	switch (cmd) {
	case VIDIOC_VPFE_IPIPEIF_S_CONFIG:
		ret = ipipeif_set_config(sd, config);
		break;

	case VIDIOC_VPFE_IPIPEIF_G_CONFIG:
		ret = ipipeif_get_config(sd, arg);
		break;
	}
	return ret;
}

/*
 * ipipeif_s_ctrl() - Handle set control subdev method
 * @ctrl: pointer to v4l2 control structure
 */
static int ipipeif_s_ctrl(struct v4l2_ctrl *ctrl)
{
	struct vpfe_ipipeif_device *ipipeif =
		container_of(ctrl->handler, struct vpfe_ipipeif_device, ctrls);

	switch (ctrl->id) {
	case VPFE_CID_DPCM_PREDICTOR:
		ipipeif->dpcm_predictor = ctrl->val;
		break;

	case V4L2_CID_GAIN:
		ipipeif->gain = ctrl->val;
		break;

	default:
		return -EINVAL;
	}

	return 0;
}

#define ENABLE_IPIPEIF		0x1

void vpfe_ipipeif_enable(struct vpfe_device *vpfe_dev)
{
	struct vpfe_ipipeif_device *ipipeif = &vpfe_dev->vpfe_ipipeif;
	void *ipipeif_base_addr = ipipeif->ipipeif_base_addr;
	unsigned char val;

	if (ipipeif->input != IPIPEIF_INPUT_MEMORY)
		return;

	do {
		val = ipipeif_read(ipipeif_base_addr, IPIPEIF_ENABLE);
	} while (val & 0x1);

	ipipeif_write(ENABLE_IPIPEIF, ipipeif_base_addr, IPIPEIF_ENABLE);
}

/*
 * ipipeif_set_stream() - Enable/Disable streaming on ipipeif subdev
 * @sd: pointer to v4l2 subdev structure
 * @enable: 1 == Enable, 0 == Disable
 */
static int ipipeif_set_stream(struct v4l2_subdev *sd, int enable)
{
	struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd);
	struct vpfe_device *vpfe_dev = to_vpfe_device(ipipeif);
	int ret = 0;

	if (!enable)
		return ret;

	ret = ipipeif_hw_setup(sd);
	if (!ret)
		vpfe_ipipeif_enable(vpfe_dev);

	return ret;
}

/*
 * ipipeif_enum_mbus_code() - Handle pixel format enumeration
 * @sd: pointer to v4l2 subdev structure
 * @cfg: V4L2 subdev pad config
 * @code: pointer to v4l2_subdev_mbus_code_enum structure
 * return -EINVAL or zero on success
 */
static int ipipeif_enum_mbus_code(struct v4l2_subdev *sd,
				  struct v4l2_subdev_pad_config *cfg,
			struct v4l2_subdev_mbus_code_enum *code)
{
	switch (code->pad) {
	case IPIPEIF_PAD_SINK:
		if (code->index >= ARRAY_SIZE(ipipeif_input_fmts))
			return -EINVAL;

		code->code = ipipeif_input_fmts[code->index];
		break;

	case IPIPEIF_PAD_SOURCE:
		if (code->index >= ARRAY_SIZE(ipipeif_output_fmts))
			return -EINVAL;

		code->code = ipipeif_output_fmts[code->index];
		break;

	default:
		return -EINVAL;
	}

	return 0;
}

/*
 * ipipeif_get_format() - Handle get format by pads subdev method
 * @sd: pointer to v4l2 subdev structure
 * @cfg: V4L2 subdev pad config
 * @fmt: pointer to v4l2 subdev format structure
 */
static int
ipipeif_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
		struct v4l2_subdev_format *fmt)
{
	struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd);

	if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE)
		fmt->format = ipipeif->formats[fmt->pad];
	else
		fmt->format = *(v4l2_subdev_get_try_format(sd, cfg, fmt->pad));

	return 0;
}

#define MIN_OUT_WIDTH			32
#define MIN_OUT_HEIGHT			32

/*
 * ipipeif_try_format() - Handle try format by pad subdev method
 * @ipipeif: VPFE ipipeif device.
 * @cfg: V4L2 subdev pad config
 * @pad: pad num.
 * @fmt: pointer to v4l2 format structure.
 * @which : wanted subdev format
 */
static void
ipipeif_try_format(struct vpfe_ipipeif_device *ipipeif,
		   struct v4l2_subdev_pad_config *cfg, unsigned int pad,
		   struct v4l2_mbus_framefmt *fmt,
		   enum v4l2_subdev_format_whence which)
{
	unsigned int max_out_height;
	unsigned int max_out_width;
	unsigned int i;

	max_out_width = IPIPE_MAX_OUTPUT_WIDTH_A;
	max_out_height = IPIPE_MAX_OUTPUT_HEIGHT_A;

	if (pad == IPIPEIF_PAD_SINK) {
		for (i = 0; i < ARRAY_SIZE(ipipeif_input_fmts); i++)
			if (fmt->code == ipipeif_input_fmts[i])
				break;

		/* If not found, use SBGGR10 as default */
		if (i >= ARRAY_SIZE(ipipeif_input_fmts))
			fmt->code = MEDIA_BUS_FMT_SGRBG12_1X12;
	} else if (pad == IPIPEIF_PAD_SOURCE) {
		for (i = 0; i < ARRAY_SIZE(ipipeif_output_fmts); i++)
			if (fmt->code == ipipeif_output_fmts[i])
				break;

		/* If not found, use UYVY as default */
		if (i >= ARRAY_SIZE(ipipeif_output_fmts))
			fmt->code = MEDIA_BUS_FMT_UYVY8_2X8;
	}

	fmt->width = clamp_t(u32, fmt->width, MIN_OUT_HEIGHT, max_out_width);
	fmt->height = clamp_t(u32, fmt->height, MIN_OUT_WIDTH, max_out_height);
}

static int
ipipeif_enum_frame_size(struct v4l2_subdev *sd,
			struct v4l2_subdev_pad_config *cfg,
			struct v4l2_subdev_frame_size_enum *fse)
{
	struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd);
	struct v4l2_mbus_framefmt format;

	if (fse->index != 0)
		return -EINVAL;

	format.code = fse->code;
	format.width = 1;
	format.height = 1;
	ipipeif_try_format(ipipeif, cfg, fse->pad, &format, fse->which);
	fse->min_width = format.width;
	fse->min_height = format.height;

	if (format.code != fse->code)
		return -EINVAL;

	format.code = fse->code;
	format.width = -1;
	format.height = -1;
	ipipeif_try_format(ipipeif, cfg, fse->pad, &format, fse->which);
	fse->max_width = format.width;
	fse->max_height = format.height;

	return 0;
}

/*
 * __ipipeif_get_format() - helper function for getting ipipeif format
 * @ipipeif: pointer to ipipeif private structure.
 * @cfg: V4L2 subdev pad config
 * @pad: pad number.
 * @which: wanted subdev format.
 *
 */
static struct v4l2_mbus_framefmt *
__ipipeif_get_format(struct vpfe_ipipeif_device *ipipeif,
		       struct v4l2_subdev_pad_config *cfg, unsigned int pad,
		       enum v4l2_subdev_format_whence which)
{
	if (which == V4L2_SUBDEV_FORMAT_TRY)
		return v4l2_subdev_get_try_format(&ipipeif->subdev, cfg, pad);

	return &ipipeif->formats[pad];
}

/*
 * ipipeif_set_format() - Handle set format by pads subdev method
 * @sd: pointer to v4l2 subdev structure
 * @cfg: V4L2 subdev pad config
 * @fmt: pointer to v4l2 subdev format structure
 * return -EINVAL or zero on success
 */
static int
ipipeif_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
		struct v4l2_subdev_format *fmt)
{
	struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd);
	struct v4l2_mbus_framefmt *format;

	format = __ipipeif_get_format(ipipeif, cfg, fmt->pad, fmt->which);
	if (format == NULL)
		return -EINVAL;

	ipipeif_try_format(ipipeif, cfg, fmt->pad, &fmt->format, fmt->which);
	*format = fmt->format;

	if (fmt->which == V4L2_SUBDEV_FORMAT_TRY)
		return 0;

	if (fmt->pad == IPIPEIF_PAD_SINK &&
	    ipipeif->input != IPIPEIF_INPUT_NONE)
		ipipeif->formats[fmt->pad] = fmt->format;
	else if (fmt->pad == IPIPEIF_PAD_SOURCE &&
		 ipipeif->output != IPIPEIF_OUTPUT_NONE)
		ipipeif->formats[fmt->pad] = fmt->format;
	else
		return -EINVAL;

	return 0;
}

static void ipipeif_set_default_config(struct vpfe_ipipeif_device *ipipeif)
{
#define WIDTH_I			640
#define HEIGHT_I		480

	const struct ipipeif_params ipipeif_defaults = {
		.clock_select = IPIPEIF_SDRAM_CLK,
		.ppln = WIDTH_I + 8,
		.lpfr = HEIGHT_I + 10,
		.rsz = 16,	/* resize ratio 16/rsz */
		.decimation = IPIPEIF_DECIMATION_OFF,
		.avg_filter = IPIPEIF_AVG_OFF,
		.if_5_1 = {
			.clk_div = {
				.m = 1,	/* clock = sdram clock * (m/n) */
				.n = 6
			},
			.clip = 4095,
		},
	};
	memcpy(&ipipeif->config, &ipipeif_defaults,
	       sizeof(struct ipipeif_params));
}

/*
 * ipipeif_init_formats() - Initialize formats on all pads
 * @sd: VPFE ipipeif V4L2 subdevice
 * @fh: V4L2 subdev file handle
 *
 * Initialize all pad formats with default values. Try formats are initialized
 * on the file handle.
 */
static int
ipipeif_init_formats(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
	struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd);
	struct v4l2_subdev_format format;

	memset(&format, 0, sizeof(format));
	format.pad = IPIPEIF_PAD_SINK;
	format.which = V4L2_SUBDEV_FORMAT_TRY;
	format.format.code = MEDIA_BUS_FMT_SGRBG12_1X12;
	format.format.width = IPIPE_MAX_OUTPUT_WIDTH_A;
	format.format.height = IPIPE_MAX_OUTPUT_HEIGHT_A;
	ipipeif_set_format(sd, fh->pad, &format);

	memset(&format, 0, sizeof(format));
	format.pad = IPIPEIF_PAD_SOURCE;
	format.which = V4L2_SUBDEV_FORMAT_TRY;
	format.format.code = MEDIA_BUS_FMT_UYVY8_2X8;
	format.format.width = IPIPE_MAX_OUTPUT_WIDTH_A;
	format.format.height = IPIPE_MAX_OUTPUT_HEIGHT_A;
	ipipeif_set_format(sd, fh->pad, &format);

	ipipeif_set_default_config(ipipeif);

	return 0;
}

/*
 * ipipeif_video_in_queue() - ipipeif video in queue
 * @vpfe_dev: vpfe device pointer
 * @addr: buffer address
 */
static int
ipipeif_video_in_queue(struct vpfe_device *vpfe_dev, unsigned long addr)
{
	struct vpfe_ipipeif_device *ipipeif = &vpfe_dev->vpfe_ipipeif;
	void *ipipeif_base_addr = ipipeif->ipipeif_base_addr;
	unsigned int adofs;
	u32 val;

	if (ipipeif->input != IPIPEIF_INPUT_MEMORY)
		return -EINVAL;

	switch (ipipeif->formats[IPIPEIF_PAD_SINK].code) {
	case MEDIA_BUS_FMT_Y8_1X8:
	case MEDIA_BUS_FMT_UV8_1X8:
	case MEDIA_BUS_FMT_YDYUYDYV8_1X16:
		adofs = ipipeif->formats[IPIPEIF_PAD_SINK].width;
		break;

	default:
		adofs = ipipeif->formats[IPIPEIF_PAD_SINK].width << 1;
		break;
	}

	/* adjust the line len to be a multiple of 32 */
	adofs += 31;
	adofs &= ~0x1f;
	val = (adofs >> 5) & IPIPEIF_ADOFS_LSB_MASK;
	ipipeif_write(val, ipipeif_base_addr, IPIPEIF_ADOFS);

	/* lower sixteen bit */
	val = (addr >> IPIPEIF_ADDRL_SHIFT) & IPIPEIF_ADDRL_MASK;
	ipipeif_write(val, ipipeif_base_addr, IPIPEIF_ADDRL);

	/* upper next seven bit */
	val = (addr >> IPIPEIF_ADDRU_SHIFT) & IPIPEIF_ADDRU_MASK;
	ipipeif_write(val, ipipeif_base_addr, IPIPEIF_ADDRU);

	return 0;
}

/* subdev core operations */
static const struct v4l2_subdev_core_ops ipipeif_v4l2_core_ops = {
	.ioctl = ipipeif_ioctl,
};

static const struct v4l2_ctrl_ops ipipeif_ctrl_ops = {
	.s_ctrl = ipipeif_s_ctrl,
};

static const struct v4l2_ctrl_config vpfe_ipipeif_dpcm_pred = {
	.ops = &ipipeif_ctrl_ops,
	.id = VPFE_CID_DPCM_PREDICTOR,
	.name = "DPCM Predictor",
	.type = V4L2_CTRL_TYPE_INTEGER,
	.min = 0,
	.max = 1,
	.step = 1,
	.def = 0,
};

/* subdev file operations */
static const struct v4l2_subdev_internal_ops ipipeif_v4l2_internal_ops = {
	.open = ipipeif_init_formats,
};

/* subdev video operations */
static const struct v4l2_subdev_video_ops ipipeif_v4l2_video_ops = {
	.s_stream = ipipeif_set_stream,
};

/* subdev pad operations */
static const struct v4l2_subdev_pad_ops ipipeif_v4l2_pad_ops = {
	.enum_mbus_code = ipipeif_enum_mbus_code,
	.enum_frame_size = ipipeif_enum_frame_size,
	.get_fmt = ipipeif_get_format,
	.set_fmt = ipipeif_set_format,
};

/* subdev operations */
static const struct v4l2_subdev_ops ipipeif_v4l2_ops = {
	.core = &ipipeif_v4l2_core_ops,
	.video = &ipipeif_v4l2_video_ops,
	.pad = &ipipeif_v4l2_pad_ops,
};

static const struct vpfe_video_operations video_in_ops = {
	.queue = ipipeif_video_in_queue,
};

static int
ipipeif_link_setup(struct media_entity *entity, const struct media_pad *local,
		const struct media_pad *remote, u32 flags)
{
	struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
	struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd);
	struct vpfe_device *vpfe = to_vpfe_device(ipipeif);
	unsigned int index = local->index;

	/* FIXME: this is actually a hack! */
	if (is_media_entity_v4l2_subdev(remote->entity))
		index |= 2 << 16;

	switch (index) {
	case IPIPEIF_PAD_SINK:
		/* Single shot mode */
		if (!(flags & MEDIA_LNK_FL_ENABLED)) {
			ipipeif->input = IPIPEIF_INPUT_NONE;
			break;
		}
		ipipeif->input = IPIPEIF_INPUT_MEMORY;
		break;

	case IPIPEIF_PAD_SINK | 2 << 16:
		/* read from isif */
		if (!(flags & MEDIA_LNK_FL_ENABLED)) {
			ipipeif->input = IPIPEIF_INPUT_NONE;
			break;
		}
		if (ipipeif->input != IPIPEIF_INPUT_NONE)
			return -EBUSY;

		ipipeif->input = IPIPEIF_INPUT_ISIF;
		break;

	case IPIPEIF_PAD_SOURCE | 2 << 16:
		if (!(flags & MEDIA_LNK_FL_ENABLED)) {
			ipipeif->output = IPIPEIF_OUTPUT_NONE;
			break;
		}
		if (remote->entity == &vpfe->vpfe_ipipe.subdev.entity)
			/* connencted to ipipe */
			ipipeif->output = IPIPEIF_OUTPUT_IPIPE;
		else if (remote->entity == &vpfe->vpfe_resizer.
			crop_resizer.subdev.entity)
			/* connected to resizer */
			ipipeif->output = IPIPEIF_OUTPUT_RESIZER;
		else
			return -EINVAL;
		break;

	default:
		return -EINVAL;
	}

	return 0;
}

static const struct media_entity_operations ipipeif_media_ops = {
	.link_setup = ipipeif_link_setup,
};

/*
 * vpfe_ipipeif_unregister_entities() - Unregister entity
 * @ipipeif - pointer to ipipeif subdevice structure.
 */
void vpfe_ipipeif_unregister_entities(struct vpfe_ipipeif_device *ipipeif)
{
	/* unregister video device */
	vpfe_video_unregister(&ipipeif->video_in);

	/* unregister subdev */
	v4l2_device_unregister_subdev(&ipipeif->subdev);
	/* cleanup entity */
	media_entity_cleanup(&ipipeif->subdev.entity);
}

int
vpfe_ipipeif_register_entities(struct vpfe_ipipeif_device *ipipeif,
			       struct v4l2_device *vdev)
{
	struct vpfe_device *vpfe_dev = to_vpfe_device(ipipeif);
	unsigned int flags;
	int ret;

	/* Register the subdev */
	ret = v4l2_device_register_subdev(vdev, &ipipeif->subdev);
	if (ret < 0)
		return ret;

	ret = vpfe_video_register(&ipipeif->video_in, vdev);
	if (ret) {
		pr_err("Failed to register ipipeif video-in device\n");
		goto fail;
	}
	ipipeif->video_in.vpfe_dev = vpfe_dev;

	flags = 0;
	ret = media_create_pad_link(&ipipeif->video_in.video_dev.entity, 0,
					&ipipeif->subdev.entity, 0, flags);
	if (ret < 0)
		goto fail;

	return 0;
fail:
	v4l2_device_unregister_subdev(&ipipeif->subdev);

	return ret;
}

#define IPIPEIF_GAIN_HIGH		0x3ff
#define IPIPEIF_DEFAULT_GAIN		0x200

int vpfe_ipipeif_init(struct vpfe_ipipeif_device *ipipeif,
		      struct platform_device *pdev)
{
	struct v4l2_subdev *sd = &ipipeif->subdev;
	struct media_pad *pads = &ipipeif->pads[0];
	struct media_entity *me = &sd->entity;
	static resource_size_t  res_len;
	struct resource *res;
	int ret;

	res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
	if (!res)
		return -ENOENT;

	res_len = resource_size(res);
	res = request_mem_region(res->start, res_len, res->name);
	if (!res)
		return -EBUSY;

	ipipeif->ipipeif_base_addr = ioremap_nocache(res->start, res_len);
	if (!ipipeif->ipipeif_base_addr) {
		ret =  -EBUSY;
		goto fail;
	}

	v4l2_subdev_init(sd, &ipipeif_v4l2_ops);

	sd->internal_ops = &ipipeif_v4l2_internal_ops;
	strlcpy(sd->name, "DAVINCI IPIPEIF", sizeof(sd->name));
	sd->grp_id = 1 << 16;	/* group ID for davinci subdevs */

	v4l2_set_subdevdata(sd, ipipeif);

	sd->flags |= V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_HAS_DEVNODE;
	pads[IPIPEIF_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
	pads[IPIPEIF_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
	ipipeif->input = IPIPEIF_INPUT_NONE;
	ipipeif->output = IPIPEIF_OUTPUT_NONE;
	me->ops = &ipipeif_media_ops;

	ret = media_entity_pads_init(me, IPIPEIF_NUM_PADS, pads);
	if (ret)
		goto fail;

	v4l2_ctrl_handler_init(&ipipeif->ctrls, 2);
	v4l2_ctrl_new_std(&ipipeif->ctrls, &ipipeif_ctrl_ops,
			  V4L2_CID_GAIN, 0,
			  IPIPEIF_GAIN_HIGH, 1, IPIPEIF_DEFAULT_GAIN);
	v4l2_ctrl_new_custom(&ipipeif->ctrls, &vpfe_ipipeif_dpcm_pred, NULL);
	v4l2_ctrl_handler_setup(&ipipeif->ctrls);
	sd->ctrl_handler = &ipipeif->ctrls;

	ipipeif->video_in.ops = &video_in_ops;
	ipipeif->video_in.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
	ret = vpfe_video_init(&ipipeif->video_in, "IPIPEIF");
	if (ret) {
		pr_err("Failed to init IPIPEIF video-in device\n");
		goto fail;
	}
	ipipeif_set_default_config(ipipeif);
	return 0;
fail:
	release_mem_region(res->start, res_len);
	return ret;
}

void
vpfe_ipipeif_cleanup(struct vpfe_ipipeif_device *ipipeif,
		     struct platform_device *pdev)
{
	struct resource *res;

	v4l2_ctrl_handler_free(&ipipeif->ctrls);
	iounmap(ipipeif->ipipeif_base_addr);
	res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
	if (res)
		release_mem_region(res->start, resource_size(res));

}