text:
<project name="som" basedir="." default="compile-all"
    xmlns:unless="ant:unless"
    xmlns:if="ant:if"
    xmlns:jacoco="antlib:org.jacoco.ant">

    <property name="src.dir"     location="src"/>
    <property name="src_gen.dir" location="src_gen"/>
    <property name="lib.dir"     location="libs" />
    <property name="bd.dir"      location="${lib.dir}/black-diamonds/" />
    <property name="unit.dir"    value="tests/java" />
    <property name="kompos.dir"  value="tools/kompos" />
    <property name="graal.dir"   location="${lib.dir}/truffle/compiler" />
    <property name="truffle.dir" location="${lib.dir}/truffle/truffle" />
    <property name="sdk.dir"     location="${lib.dir}/truffle/sdk" />
    <property name="sdk.build"   location="${sdk.dir}/mxbuild/dists" />
    <property name="truffle.build" location="${truffle.dir}/mxbuild/dists" />
    <property name="somns-deps.version" value="0.3.3" />
    <property name="checkstyle.version" value="8.8" />
    <property name="jacoco.version"     value="0.8.0" />

    <property name="lib.url" value="https://dl.bintray.com/smarr/SOM" />
    <!-- <property name="lib.url" value="http://stefan-marr.de/dev" /> -->

    <property name="mx.cmd" value="../../mx/mx" />

    <property name="build.dir"   value="build"/>
    <property name="classes.dir" value="${build.dir}/classes"/>

    <property environment="env"/>

    <path id="project.classpath">
        <pathelement location="${classes.dir}" />
        <pathelement location="${unit.dir}" />
        <pathelement location="${bd.dir}/build/classes" />
        <pathelement location="${sdk.build}/graal-sdk.jar" />
        <pathelement location="${sdk.build}/word-api.jar" />
        <pathelement location="${lib.dir}/somns-deps-dev.jar" />
        <pathelement location="${lib.dir}/somns-deps.jar" />
        <pathelement location="${truffle.build}/truffle-api.jar" />
        <pathelement location="${truffle.build}/truffle-debug.jar" />
        <pathelement location="${truffle.build}/truffle-dsl-processor.jar" />
        <pathelement location="${truffle.build}/truffle-tck.jar" />
    </path>

    <condition property="is.atLeastJava9" value="true" else="false">
      <or>
        <matches string="${java.version}" pattern="^9"/>
        <matches string="${java.version}" pattern="^1[0-9]"/>
      </or>
    </condition>
    <echo>
        ant.java.version: ${ant.java.version}
        java.version:     ${java.version}
        is.atLeastJava9:  ${is.atLeastJava9}
    </echo>

    <target name="clean" description="Remove build directories and generated code">
        <delete dir="${build.dir}"/>
        <delete dir="${src_gen.dir}"/>
    </target>

    <target name="clean-truffle" depends="check-truffle-available" if="truffle.present">
        <exec executable="${mx.cmd}" dir="${truffle.dir}">
            <arg value="clean"/>
        </exec>
    </target>

    <target name="clobber" description="Do clean, and also clean truffle build" depends="clean,clean-truffle">
        <delete dir="${kompos.dir}/out"/>
        <delete dir="${kompos.dir}/node_modules"/>
        <ant dir="${bd.dir}" useNativeBasedir="true" target="clean" inheritAll="false"/>
    </target>

    <target name="check-truffle-available">
        <available file="${lib.dir}/truffle/.git" property="truffle.present"/>
    </target>
    <target name="truffle" depends="check-truffle-available"
            unless="truffle.present">
      <exec executable="./.gitloadmodules" failonerror="true">
      </exec>
    </target>

    <target name="truffle-libs" unless="skip.libs" depends="truffle,build-graal">
        <exec executable="${mx.cmd}" dir="${truffle.dir}" failonerror="true">
            <arg value="build"/>
            <arg value="--no-native"/>
        </exec>
    </target>

    <target name="build-graal" description="Build the embedded Graal" unless="skip.graal">
      <echo unless:true="${is.atLeastJava9}" level="warning">
          The used JDK needs to have JVMCI support, which is the case for Java 9.
          If Java 8 is needed, see
          http://www.oracle.com/technetwork/oracle-labs/program-languages/downloads/index.html
          for a JVMCI JDK Download.
      </echo>

      <exec executable="${mx.cmd}" dir="${graal.dir}" failonerror="true">
        <arg value="build" />
        <arg value="--no-native" />
      </exec>
    </target>

    <target name="bd-libs"> <!-- implicit dependency on truffle-libs -->
        <ant dir="${bd.dir}" useNativeBasedir="true" target="libs-junit" inheritAll="false">
            <property name="force.java8"   value="${is.atLeastJava9}" />
        </ant>
        <ant dir="${bd.dir}" useNativeBasedir="true" target="compile-nodeps" inheritAll="false">
            <property name="sdk.build"   value="${sdk.build}" />
            <property name="truffle.dir" value="${truffle.dir}" />
            <property name="truffle.build" value="${truffle.build}" />
            <property name="force.java8"   value="${is.atLeastJava9}" />
        </ant>
    </target>

    <target name="ideinit" depends="source">
        <exec executable="${mx.cmd}" dir="${truffle.dir}" failonerror="true">
            <arg value="eclipseinit"/>
        </exec>
        <exec executable="${mx.cmd}" dir="${sdk.dir}" failonerror="true">
            <arg value="eclipseinit"/>
        </exec>
    </target>

    <target name="libs" depends="truffle-libs,bd-libs" unless="skip.libs">
        <get src="${lib.url}/somns-deps-${somns-deps.version}.jar"
            usetimestamp="true"
            dest="${lib.dir}/somns-deps.jar" />
        <get src="${lib.url}/somns-deps-dev-${somns-deps.version}.jar"
            usetimestamp="true"
            dest="${lib.dir}/somns-deps-dev.jar" />
    </target>

    <target name="source" description="Download Source Jars for development">
        <get src="${lib.url}/somns-deps-source-${somns-deps.version}.jar"
            usetimestamp="true"
            dest="${lib.dir}/somns-deps-source.jar" />
    </target>

    <target name="eclipseformat">
        <pathconvert pathsep=" " property="javafiles">
            <fileset dir="${src.dir}">
                <include name="**/*.java"/>
            </fileset>
            <fileset dir="${unit.dir}">
                <include name="**/*.java"/>
            </fileset>
        </pathconvert>
        <exec executable="${env.ECLIPSE_EXE}" dir="${basedir}">
            <arg value="-nosplash"/>
            <arg value="-application"/>
            <arg value="-consolelog"/>
            <arg value="-data"/>
            <arg value="${basedir}"/>
            <arg value="-vm"/>
            <arg value="${env.JAVA_HOME}/bin/java"/>
            <arg value="org.eclipse.jdt.core.JavaCodeFormatter"/>
            <arg value="-config"/>
            <arg value="${basedir}/.settings/org.eclipse.jdt.core.prefs"/>
            <arg line="${javafiles}"/>
        </exec>
    </target>

    <target name="eclipseformat-check" depends="eclipseformat">
        <exec executable="git" dir="${basedir}">
            <arg value="status" />
            <arg value="*.java" />
        </exec>
        <exec executable="git" dir="${basedir}" failonerror="true">
            <arg value="diff-index" />
            <arg value="--quiet" />
            <arg value="--exit-code" />
            <arg value="--ignore-submodules" />
            <arg value="HEAD" />
        </exec>
    </target>

    <target name="checkstyle-jar">
        <get src="http://tenet.dl.sourceforge.net/project/checkstyle/checkstyle/${checkstyle.version}/checkstyle-${checkstyle.version}-all.jar"
            usetimestamp="true"
            dest="${lib.dir}/checkstyle-${checkstyle.version}-all.jar" />
    </target>

    <target name="checkstyle" depends="checkstyle-jar" description="Check Code with Checkstyle">
        <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties" classpath="${lib.dir}/checkstyle-${checkstyle.version}-all.jar" />
        <checkstyle config=".checkstyle_checks.xml">
          <fileset dir="src" includes="**/*.java"/>
          <formatter type="plain"/>
        </checkstyle>
    </target>

    <target name="jacoco-lib" description="Get JaCoCo dependency">
        <get src="http://search.maven.org/remotecontent?filepath=org/jacoco/jacoco/${jacoco.version}/jacoco-${jacoco.version}.zip"
            usetimestamp="true"
            dest="${lib.dir}/jacoco-${jacoco.version}.zip" />
        <unzip src="${lib.dir}/jacoco-${jacoco.version}.zip" dest="${lib.dir}/jacoco"/>
        <taskdef uri="antlib:org.jacoco.ant"
            resource="org/jacoco/ant/antlib.xml"
            classpath="${lib.dir}/jacoco/lib/jacocoant.jar" />
    </target>

    <target name="codacy-coverage-lib" description="Report Coverage to Codacy">
        <get src="https://oss.sonatype.org/service/local/repositories/releases/content/com/codacy/codacy-coverage-reporter/2.0.2/codacy-coverage-reporter-2.0.2-assembly.jar"
            usetimestamp="true"
            dest="${lib.dir}/codacy-coverage-reporter.jar" />
    </target>

    <target name="java8-on-java9" description="Support Java 9 or later" if="${is.atLeastJava9}">
      <mkdir dir="${classes.dir}" />
      <javac includeantruntime="false" srcdir="${lib.dir}/java8" destdir="${classes.dir}" debug="true">
        <compilerarg line="--release 8" />
      </javac>
    </target>

    <target name="compile-som" description="Compile SOMns" depends="java8-on-java9">
        <mkdir dir="${build.dir}"/>
        <mkdir dir="${classes.dir}" />
        <mkdir dir="${src_gen.dir}" />
        <javac includeantruntime="false" srcdir="${src.dir}" destdir="${classes.dir}" debug="true">
          <classpath refid="project.classpath" />
          <compilerarg line="-s ${src_gen.dir}" />
          <compilerarg line="-XDignore.symbol.file" />
          <compilerarg line="-Xlint:all" />
          <compilerarg line="--release 8" if:true="${is.atLeastJava9}" />
        </javac>
        <javac includeantruntime="false" srcdir="${src_gen.dir}" destdir="${classes.dir}" debug="true">
          <classpath refid="project.classpath" />
          <compilerarg line="-s ${src_gen.dir}" />
          <compilerarg line="-Xlint:all" />
          <compilerarg line="--release 8" if:true="${is.atLeastJava9}" />
        </javac>
        <javac includeantruntime="false" srcdir="${unit.dir}" destdir="${classes.dir}" debug="true">
          <classpath refid="project.classpath" />
          <compilerarg line="--release 8" if:true="${is.atLeastJava9}" />
        </javac>
    </target>

    <target name="compile" depends="libs,compile-som" description="Compile SOMns and dependencies">
    </target>

    <target name="kompos" description="Build Kompos">
        <exec executable="npm" dir="${kompos.dir}" failonerror="true">
            <arg value="--quiet"/>
            <arg value="install"/>
        </exec>
    </target>

    <target name="compile-all" depends="compile,kompos" description="Build SOMns and Kompos">
    </target>

    <target name="jar" depends="compile" description="Package as JAR">
        <jar destfile="${build.dir}/som.jar" basedir="${classes.dir}"></jar>
    </target>

    <target name="unit-tests" depends="compile,jacoco-lib" description="Execute tests">
      <jacoco:coverage>
        <junit haltonerror="false" haltonfailure="false" failureproperty="test.failed"
            outputtoformatters="true" fork="true" forkmode="once">
            <jvmarg value="-ea" />
            <jvmarg value="-esa" />
            <classpath refid="project.classpath" />
            <batchtest fork="yes" filtertrace="false">
              <fileset dir="${unit.dir}">
                  <include name="**/*Test*.java"/>
                  <include name="**/*TCK.java"/>
              </fileset>
            </batchtest>
            <formatter type="brief" usefile="false"/>
        </junit>
     </jacoco:coverage>

     <jacoco:coverage>
        <java classname="som.VM" fork="true" failonerror="true">
            <classpath refid="project.classpath" />
            <jvmarg value="-ea" />
            <jvmarg value="-esa" />
            <arg line="core-lib/TestSuite/TestRunner.ns" />
        </java>
     </jacoco:coverage>

     <fail message="Basic tests failed." if="test.failed" />
    </target>

    <target name="som-tests" depends="compile">
      <!-- delete old coverage data, this should be the first task generating coverage data -->
      <delete file="all.gcov" />

      <exec executable="./som" failonerror="true">
        <arg value="--coverage" />
        <arg value="all.gcov" />
        <arg value="--java-coverage" />
        <arg value="jacoco.exec" />
        <arg value="-G" />
        <arg value="core-lib/TestSuite/TestRunner.ns" />
      </exec>

      <exec executable="./som" failonerror="true">
        <arg value="-X" />
        <arg value="core-lib/TestSuite/TestRunner.ns" />
      </exec>
    </target>

    <target name="dynamic-metrics-tests" depends="compile-som">
      <exec executable="tests/dym/test.sh" failonerror="true">
          <arg value="--coverage" />
      </exec>
    </target>

    <target name="superinstructions-tests" depends="compile-som">
      <exec executable="tests/superinstructions/test.sh" failonerror="true"></exec>
    </target>

    <target name="update-test-data" depends="compile-som" description="Updates the test data for DynamicMetrics and SuperInstructions">
      <exec executable="tests/dym/test.sh" failonerror="true">
        <arg value="update" />
      </exec>
      <exec executable="tests/superinstructions/test.sh" failonerror="true">
        <arg value="update" />
      </exec>
    </target>

    <target name="replay-tests" depends="compile">
      <exec executable="tests/replay/test.sh" failonerror="true">
          <arg value="1" />
      </exec>
      <exec executable="tests/replay/test.sh" failonerror="true">
          <arg value="2" />
      </exec>
    </target>

    <target name="core-tests" depends="unit-tests,som-tests,dynamic-metrics-tests,superinstructions-tests">
    </target>

    <target name="send-java-coverage" depends="jacoco-lib,codacy-coverage-lib">
      <jacoco:report>
        <executiondata>
          <file file="jacoco.exec"/>
        </executiondata>

        <structure name="SOMns coverage">
          <classfiles>
            <fileset dir="${classes.dir}"/>
            <fileset dir="${bd.dir}/build/classes"/>
          </classfiles>
          <sourcefiles encoding="UTF-8">
            <fileset dir="src"/>
            <fileset dir="${bd.dir}/src"/>
          </sourcefiles>
        </structure>

        <!-- <html destdir="report"/> -->
        <xml destfile="jacoco.xml"/>
      </jacoco:report>

      <java classname="com.codacy.CodacyCoverageReporter">
        <classpath>
          <pathelement location="${lib.dir}/codacy-coverage-reporter.jar" />
        </classpath>
        <arg value="-l" />
        <arg value="Java" />
        <arg value="-r" />
        <arg value="jacoco.xml" />
      </java>
    </target>

    <target name="send-somns-coverage">
        <!-- submit coverage data -->
        <java classname="coveralls.Report" fork="true" failonerror="true">
            <classpath refid="project.classpath" />
            <arg value="${env.COVERALLS_REPO_TOKEN}" />
            <arg value="all.gcov" />
        </java>
    </target>

    <target name="coverage" depends="send-java-coverage,send-somns-coverage" />

    <target name="tests" depends="core-tests,replay-tests,coverage">
    </target>
</project>


text:
#ifndef OSMIUM_INDEX_MAP_DENSE_MEM_ARRAY_HPP
#define OSMIUM_INDEX_MAP_DENSE_MEM_ARRAY_HPP

#include <vector>

#include <osmium/index/detail/vector_map.hpp>

#define OSMIUM_HAS_INDEX_MAP_DENSE_MEM_ARRAY

namespace osmium {

    namespace index {

        namespace map {

            template <typename TId, typename TValue>
            using DenseMemArray = VectorBasedDenseMap<std::vector<TValue>, TId, TValue>;

        } // namespace map

    } // namespace index

} // namespace osmium

#endif // OSMIUM_INDEX_MAP_DENSE_MEM_ARRAY_HPP

redpajama_set_name: RedPajamaGithub


text:
from __future__ import absolute_import
from __future__ import print_function

import shutil
import argparse
import os

def main():
    parser = argparse.ArgumentParser(description="Split train data into train and validation sets.")
    parser.add_argument('dataset_dir', type=str, help='Path to the directory which contains the dataset')
    args, _ = parser.parse_known_args()

    val_patients = set()
    with open(os.path.join(os.path.dirname(__file__), 'resources/valset.csv'), 'r') as valset_file:
        for line in valset_file:
            x, y = line.split(',')
            if int(y) == 1:
                val_patients.add(x)

    with open(os.path.join(args.dataset_dir, 'train/listfile.csv')) as listfile:
        lines = listfile.readlines()
        header = lines[0]
        lines = lines[1:]

    train_lines = [x for x in lines if x[:x.find("_")] not in val_patients]
    val_lines = [x for x in lines if x[:x.find("_")] in val_patients]
    assert len(train_lines) + len(val_lines) == len(lines)

    with open(os.path.join(args.dataset_dir, 'train_listfile.csv'), 'w') as train_listfile:
        train_listfile.write(header)
        for line in train_lines:
            train_listfile.write(line)

    with open(os.path.join(args.dataset_dir, 'val_listfile.csv'), 'w') as val_listfile:
        val_listfile.write(header)
        for line in val_lines:
            val_listfile.write(line)

    shutil.copy(os.path.join(args.dataset_dir, 'test/listfile.csv'),
                os.path.join(args.dataset_dir, 'test_listfile.csv'))

if __name__ == '__main__':
    main()


text:
/**
gcc srs_publish.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_publish
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#include "../../objs/include/srs_librtmp.h"

int main(int argc, char** argv)
{
    printf("publish rtmp stream to server like FMLE/FFMPEG/Encoder\n");
    printf("srs(simple-rtmp-server) client librtmp library.\n");
    printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision());

    if (argc <= 1) {
        printf("Usage: %s <rtmp_url>\n"
            "   rtmp_url     RTMP stream url to publish\n"
            "For example:\n"
            "   %s rtmp://127.0.0.1:1935/live/livestream\n",
            argv[0], argv[0]);
        exit(-1);
    }

    // warn it .
    // @see: https://github.com/simple-rtmp-server/srs/issues/126
    srs_human_trace("\033[33m%s\033[0m",
        "[warning] it's only a sample to use librtmp. "
        "please never use it to publish and test forward/transcode/edge/HLS whatever. "
        "you should refer to this tool to use the srs-librtmp to publish the real media stream."
        "read about: https://github.com/simple-rtmp-server/srs/issues/126");
    srs_human_trace("rtmp url: %s", argv[1]);
    srs_rtmp_t rtmp = srs_rtmp_create(argv[1]);

    if (srs_rtmp_handshake(rtmp) != 0) {
        srs_human_trace("simple handshake failed.");
        goto rtmp_destroy;
    }
    srs_human_trace("simple handshake success");

    if (srs_rtmp_connect_app(rtmp) != 0) {
        srs_human_trace("connect vhost/app failed.");
        goto rtmp_destroy;
    }
    srs_human_trace("connect vhost/app success");

    if (srs_rtmp_publish_stream(rtmp) != 0) {
        srs_human_trace("publish stream failed.");
        goto rtmp_destroy;
    }
    srs_human_trace("publish stream success");

    u_int32_t timestamp = 0;
    for (;;) {
        char type = SRS_RTMP_TYPE_VIDEO;
        int size = 4096;
        char* data = (char*)malloc(4096);

        timestamp += 40;

        if (srs_rtmp_write_packet(rtmp, type, timestamp, data, size) != 0) {
            goto rtmp_destroy;
        }
        srs_human_trace("sent packet: type=%s, time=%d, size=%d",
            srs_human_flv_tag_type2string(type), timestamp, size);

        usleep(40 * 1000);
    }

rtmp_destroy:
    srs_rtmp_destroy(rtmp);

    return 0;
}


text:
import javax.swing.*;

public class Foo {
    {
        new JPanel().<caret>
    }
}


text:
+++
title = "Singleton Design Pattern in Python"
date = "2020-01-02"
draft = false
tags = ['python', 'design pattern']
+++

Recently I dived into design patterns a little bit, to refresh a rusty knowledge.
It is something we are using in Python daily, however not often realizing that.
And I like reading those religious debates between programmers. One of them is the usage
of Singleton in Python. Let's see what is Pythonistas take on this beloved pattern.

<!--more-->

Design patterns are tried and tested solutions to common problems in Software Design.
The capture experiences and provides a solution template.

Categories of Design Patterns:

* Creational - objects creation mechanism, concern the ways and means of object instantiation
* Structural - how to assemble objects and classes into longer structures,
deal with the mutual composition of classes or objects
* Behavioral - effective communication between objects,
analyze the ways in which classes or objects interact and distribute responsibilities among them

Basic rules:

* Separate the things that change from those that stay the same
* Program to an interface, not and implementation
* Prefer composition over inheritance
* Delegation

---

*Singleton* is a creational design pattern that lets you ensure that a class has only one instance,
while providing a global access point to this instance.

There are many ways to implement it. First one might use magic *__new__* method.
However, it is not clear for the client of a class if it is creating a Singleton.
Subclassing is a problem.

```python
class Singleton:
    _instance = None

    def __new__(cls, *args, **kwargs):
        if not cls._instance:
            cls._instance = super().__new__(cls, *args, **kwargs)
        return cls._instance

>>> first_instance = Singleton()
>>> second_instance = Singleton()
>>> first_instance is second_instance  # True

# however it is not always clear

class Foo(Singleton): pass
class Bar(Singleton): pass

>>> f = Foo()
>>> b = Bar()
>>> f is b  # True

```

We could use a variation of Singleton with shared state - Monostate pattern, called 'Borg' by Alex Martelli.
Here we are more concerned about the state than identity.

```python
class Borg:
    _shared_state = {}

    def __new__(cls, *args, **kwargs):
        obj = super().__new__(cls, *args, **kwargs)
        obj.__dict__ = cls._shared_state
        return obj

# and subclassing is no problem

class Foo(Borg): pass
class Bar(Foo): pass
class Baz(Foo): _shared_state = {}  # data overriding
```

The second way uses *__call__* and metaclasses.

```python
class SingletonMeta(type):
    _instance = None

    def __call__(self):
        if not self._instance:
            self._instance = super().__call__()
        return self._instance

class Singleton(metaclass=SingletonMeta):
    ...

>>> first_instance = Singleton()
>>> second_instance = Singleton()
>>> first_instance is second_instance  # True
```

A better approach uses *classmethod*. It is more clear and does not block you from creating a usual instance.
Additionally provides lazy instantiation.

```python
class Singleton:
    _instance = None

    @classmethod
    def get_instance(cls):
        if not cls._instance:
            cls._instance = cls()
        return cls._instance

>>> first_instance = Singleton.get_instance()
>>> second_instance = Singleton()
>>> first_instance is second_instance  # False
>>> third_instance = Singleton.get_instance()
>>> first_instance is third_instance  # True
```

The more straightforward way uses modules, which are imported only once. It is hidden functionality we are often using and do not associate it with Singleton design pattern. But it accomplishes the same thing.

```python
class Singleton:
    pass

singleton = Singleton()

# from another module
from my_module import singleton
```

The most common reason against Singletons is that they are an implicit shared state. For example,
global variables and top-level modules are explicit shared state. However, let's say that the
singletons are constant. Because the usage of global constant, is widely accepted, it makes the singletons right choice
because none of the users can break them. Another point is when the singletons do not have shared state,
only take data (good example here is logging). In this scenario, the simplicity of using the singletons makes them a reasonable choice.

In the end, some voices will always say that no matter how we implement them, Singletons are not Pythonic.
And argue with that ;)

---

References:

* [Design Patterns in Python for the Untrained Eye - Pycon 2019][ortiz]
* [Why you don't need design patterns in Python? - Pycon 2019][bucz]
* [Creating a singleton in Python - StackOverflow][stack]
* [Singleton - Refactoring Guru][guru]
* [Advanced Topics in Programming Languages Series: Python Design Patterns - Google Tech Talks][mart]

[ortiz]: https://www.youtube.com/watch?v=o1FZ_Bd4DSM
[bucz]: https://www.youtube.com/watch?v=G5OeYHCJuv0
[stack]: https://stackoverflow.com/questions/6760685/creating-a-singleton-in-python
[guru]: https://refactoring.guru/design-patterns/singleton
[mart]: https://www.youtube.com/watch?v=1Sbzmz1Nxvo


text:
 			BACKEND USER(s) LIST

      		User name
      		Email
      		Role
					User state
					Action

              <input type="text" data-column="0"  class="form-control search-input-text">
              <input type="text" data-column="1"  class="form-control search-input-text">
               <select data-column="2"  class="form-control search-input-select">
                    <option value="">(All role)</option>
										<option value="CLAIM_HANDLER">CLAIM HANDLER</option>
										<option value="CONTENT_MANAGER">CONTENT MANAGER</option>
										<option value="HELP_DESK">HELP DESK</option>
										<option value="PAYMENT_OPERATOR">PAYMENT OPERATOR</option>
										<option value="CUSTOMER_MANAGER">CUSTOMER MANAGER</option>
										<option value="SUPER_USER">SUPER USER</option>
										<option value="INSURANCE_PROVIDER">Insurance Provider</option>
    </select>
                </select>

						 <select data-column="3"  class="form-control search-input-select">
									<option value="">(All)</option>
									<option value="Active">Active</option>
									<option value="Blocked">Blocked</option>
							</select>

<?php
$adminurl = AUTH_PANEL_URL;
$custum_js = <<<EOD
              <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.11/css/jquery.dataTables.css">

EOD;

	echo modules::run('auth_panel/template/add_custum_js',$custum_js );
?>


text:
include Java

# Some goodies for hirb. Should these be left up to the user's discretion?
require 'irb/completion'
require 'pathname'

# Add the directory names in hbase.jruby.sources commandline option
# to the ruby load path so I can load up my HBase ruby modules
sources = java.lang.System.getProperty('hbase.ruby.sources')
$LOAD_PATH.unshift Pathname.new(sources)

#
# FIXME: Switch args processing to getopt
#
# See if there are args for this shell. If any, read and then strip from ARGV
# so they don't go through to irb.  Output shell 'usage' if user types '--help'
cmdline_help = <<HERE # HERE document output as shell usage
Usage: shell [OPTIONS] [SCRIPTFILE [ARGUMENTS]]

 -d | --debug            Set DEBUG log levels.
 -h | --help             This help.
 -n | --noninteractive   Do not run within an IRB session and exit with non-zero
                         status on first error.
 -Dkey=value             Pass hbase-*.xml Configuration overrides. For example, to
                         use an alternate zookeeper ensemble, pass:
                           -Dhbase.zookeeper.quorum=zookeeper.example.org
                         For faster fail, pass the below and vary the values:
                           -Dhbase.client.retries.number=7
                           -Dhbase.ipc.client.connect.max.retries=3
HERE

# Takes configuration and an arg that is expected to be key=value format.
# If c is empty, creates one and returns it
def add_to_configuration(c, arg)
  kv = arg.split('=')
  kv.length == 2 || (raise "Expected parameter #{kv} in key=value format")
  c = org.apache.hadoop.hbase.HBaseConfiguration.create if c.nil?
  c.set(kv[0], kv[1])
  c
end

found = []
script2run = nil
log_level = org.apache.log4j.Level::ERROR
@shell_debug = false
interactive = true
_configuration = nil
D_ARG = '-D'.freeze
while (arg = ARGV.shift)
  if arg == '-h' || arg == '--help'
    puts cmdline_help
    exit
  elsif arg == D_ARG
    argValue = ARGV.shift || (raise "#{D_ARG} takes a 'key=value' parameter")
    _configuration = add_to_configuration(_configuration, argValue)
    found.push(arg)
    found.push(argValue)
  elsif arg.start_with? D_ARG
    _configuration = add_to_configuration(_configuration, arg[2..-1])
    found.push(arg)
  elsif arg == '-d' || arg == '--debug'
    log_level = org.apache.log4j.Level::DEBUG
    $fullBackTrace = true
    @shell_debug = true
    found.push(arg)
    puts 'Setting DEBUG log level...'
  elsif arg == '-n' || arg == '--noninteractive'
    interactive = false
    found.push(arg)
  elsif arg == '-r' || arg == '--return-values'
    warn '[INFO] the -r | --return-values option is ignored. we always behave '\
         'as though it was given.'
    found.push(arg)
  else
    # Presume it a script. Save it off for running later below
    # after we've set up some environment.
    script2run = arg
    found.push(arg)
    # Presume that any other args are meant for the script.
    break
  end
end

# Delete all processed args
found.each { |arg| ARGV.delete(arg) }
# Make sure debug flag gets back to IRB
ARGV.unshift('-d') if @shell_debug

# Set logging level to avoid verboseness
org.apache.log4j.Logger.getLogger('org.apache.zookeeper').setLevel(log_level)
org.apache.log4j.Logger.getLogger('org.apache.hadoop.hbase').setLevel(log_level)

# Require HBase now after setting log levels
require 'hbase_constants'

# Load hbase shell
require 'shell'

# Require formatter
require 'shell/formatter'

# Setup the HBase module.  Create a configuration.
@hbase = _configuration.nil? ? Hbase::Hbase.new : Hbase::Hbase.new(_configuration)

# Setup console
@shell = Shell::Shell.new(@hbase, interactive)
@shell.debug = @shell_debug

# Add commands to this namespace
# TODO avoid polluting main namespace by using a binding
@shell.export_commands(self)

# Add help command
def help(command = nil)
  @shell.help(command)
end

# Backwards compatibility method
def tools
  @shell.help_group('tools')
end

# Debugging method
def debug
  if @shell_debug
    @shell_debug = false
    conf.back_trace_limit = 0
    log_level = org.apache.log4j.Level::ERROR
  else
    @shell_debug = true
    conf.back_trace_limit = 100
    log_level = org.apache.log4j.Level::DEBUG
  end
  org.apache.log4j.Logger.getLogger('org.apache.zookeeper').setLevel(log_level)
  org.apache.log4j.Logger.getLogger('org.apache.hadoop.hbase').setLevel(log_level)
  debug?
end

def debug?
  puts "Debug mode is #{@shell_debug ? 'ON' : 'OFF'}\n\n"
  nil
end

# Include hbase constants
include HBaseConstants

# If script2run, try running it.  If we're in interactive mode, will go on to run the shell unless
# script calls 'exit' or 'exit 0' or 'exit errcode'.
load(script2run) if script2run

if interactive
  # Output a banner message that tells users where to go for help
  @shell.print_banner

  require 'irb'
  require 'irb/hirb'

  module IRB
    def self.start(ap_path = nil)
      $0 = File.basename(ap_path, '.rb') if ap_path

      IRB.setup(ap_path)
      @CONF[:IRB_NAME] = 'hbase'
      @CONF[:AP_NAME] = 'hbase'
      @CONF[:BACK_TRACE_LIMIT] = 0 unless $fullBackTrace

      hirb = if @CONF[:SCRIPT]
               HIRB.new(nil, @CONF[:SCRIPT])
             else
               HIRB.new
             end

      @CONF[:IRB_RC].call(hirb.context) if @CONF[:IRB_RC]
      @CONF[:MAIN_CONTEXT] = hirb.context

      catch(:IRB_EXIT) do
        hirb.eval_input
      end
    end
  end

  IRB.start
else
  begin
    # Noninteractive mode: if there is input on stdin, do a simple REPL.
    # XXX Note that this purposefully uses STDIN and not Kernel.gets
    #     in order to maintain compatibility with previous behavior where
    #     a user could pass in script2run and then still pipe commands on
    #     stdin.
    require 'irb/ruby-lex'
    require 'irb/workspace'
    workspace = IRB::WorkSpace.new(binding)
    scanner = RubyLex.new

    # RubyLex claims to take an IO but really wants an InputMethod
    module IOExtensions
      def encoding
        external_encoding
      end
    end
    IO.include IOExtensions

    scanner.set_input(STDIN)
    scanner.each_top_level_statement do |statement, linenum|
      puts(workspace.evaluate(nil, statement, 'stdin', linenum))
    end
  # XXX We're catching Exception on purpose, because we want to include
  #     unwrapped java exceptions, syntax errors, eval failures, etc.
  rescue Exception => exception
    message = exception.to_s
    # exception unwrapping in shell means we'll have to handle Java exceptions
    # as a special case in order to format them properly.
    if exception.is_a? java.lang.Exception
      warn 'java exception'
      message = exception.get_message
    end
    # Include the 'ERROR' string to try to make transition easier for scripts that
    # may have already been relying on grepping output.
    puts "ERROR #{exception.class}: #{message}"
    if $fullBacktrace
      # re-raising the will include a backtrace and exit.
      raise exception
    else
      exit 1
    end
  end
end


text:
'use strict'

const axios = require('axios')
const { getBlob } = require('./helpers/utils')
const tus = require('../..')

// Test timeout for end-to-end tests when uploading to real server.
const END_TO_END_TIMEOUT = 20 * 1000

describe('tus', () => {
  describe('end-to-end', () => {
    it('should upload to a real tus server', async () => {
      return new Promise((resolve, reject) => {
        const file = getBlob('hello world')
        const options = {
          endpoint: 'https://tusd.tusdemo.net/files/',
          metadata: {
            nonlatin: 'słońce',
            number  : 100,
            filename: 'hello.txt',
            filetype: 'text/plain',
          },
          onSuccess () {
            expect(upload.url).toMatch(/^https:\/\/tusd\.tusdemo\.net\/files\//)
            console.log('Upload URL:', upload.url) // eslint-disable-line no-console

            resolve(upload)
          },
          onError (err) {
            reject(err)
          },
        }

        const upload = new tus.Upload(file, options)
        upload.start()
      })
        .then(validateUploadContent)
        .then((upload) => {
          return upload.abort(true)
            .then(() => upload)
        })
        .then(validateUploadDeletion)
    }, END_TO_END_TIMEOUT)

    it('should upload to a real tus server with creation-with-upload', async () => {
      return new Promise((resolve, reject) => {
        const file = getBlob('hello world')
        const options = {
          endpoint: 'https://tusd.tusdemo.net/files/',
          metadata: {
            nonlatin: 'słońce',
            number  : 100,
            filename: 'hello.txt',
            filetype: 'text/plain',
          },
          onSuccess () {
            expect(upload.url).toMatch(/^https:\/\/tusd\.tusdemo\.net\/files\//)
            console.log('Upload URL:', upload.url) // eslint-disable-line no-console

            resolve(upload)
          },
          onError (err) {
            reject(err)
          },
        }

        const upload = new tus.Upload(file, options)
        upload.start()
      })
        .then(validateUploadContent)
    }, END_TO_END_TIMEOUT)
  })
})

function validateUploadContent (upload) {
  return axios.get(upload.url)
    .then((res) => {
      expect(res.status).toBe(200)
      expect(res.data).toBe('hello world')

      return validateUploadMetadata(upload)
    })
}

function validateUploadMetadata (upload) {
  return axios.head(upload.url, {
    headers: {
      'Tus-Resumable': '1.0.0',
    },
  }).then((res) => {
    expect(res.status).toBe(200)
    expect(res.data).toBe('')
    expect(res.headers['tus-resumable']).toBe('1.0.0')
    expect(res.headers['upload-offset']).toBe('11')
    expect(res.headers['upload-length']).toBe('11')

    // The values in the Upload-Metadata header may not be in the same
    // order as we submitted them (the specification does not require
    // that). Therefore, we split the values and verify that each one
    // is present.
    const metadataStr = res.headers['upload-metadata']
    expect(metadataStr).toBeTruthy()
    const metadata = metadataStr.split(',')
    expect(metadata).toContain('filename aGVsbG8udHh0')
    expect(metadata).toContain('filetype dGV4dC9wbGFpbg==')
    expect(metadata).toContain('nonlatin c8WCb8WEY2U=')
    expect(metadata).toContain('number MTAw')
    expect(metadata.length).toBe(4)

    return upload
  })
}

function validateUploadDeletion (upload) {
  return axios.get(upload.url, {
    validateStatus: (status) => status === 404,
  })
    .then((res) => {
      expect(res.status).toBe(404)

      return upload
    })
}


text:
    #define _TRANSFORMER_KIT_

    #import "TTTDateTransformers.h"
    #import "TTTImageTransformers.h"
    #import "TTTStringTransformers.h"
    #import "TTTJSONTransformer.h"
    #if __MAC_OS_X_VERSION_MIN_REQUIRED
    #import "TTTDataTransformers.h"
    #import "TTTCryptographyTransformers.h"
    #endif
    #import "NSValueTransformer+TransformerKit.h"
#endif