Author: fxh4xl334vdz

  • contour-auth-multi-tenant

    contour-auth-multi-tenant

    contour-auth-multi-tenant is an Envoy-compatible authorization server that builds upon the foundation of contour-authserver.

    contour-authserver implements the Envoy external authorization
    GRPC protocol (both v2 and v3). contour-authserver has two authorization
    backends that are selected by subcommands.

    contour-auth-multi-tenant adds multi-tenancy feature to contour-authserver and improves its performance to make it production-ready.

    Key Features:

    • Multi-Tenancy Support: One of the standout features of contour-auth-multi-tenant is its built-in support for multi-tenancy. This allows us to securely manage and isolate authorization scopes for different tenants within a single instance.

    • Enhanced Performance: contour-auth-multi-tenant has meticulously been optimized to deliver outstanding performance under heavy loads. This ensures that your application’s authorization layer can handle requests efficiently, without introducing bottlenecks or delays.

    htpasswd

    Usage:

    Run a htpasswd basic authentication server
    
    Usage:
      contour-authserver htpasswd [OPTIONS]
    
    Flags:
          --address string             The address the authentication endpoint binds to. (default ":9090")
          --auth-realm string          Basic authentication realm. (default "default")
      -h, --help                       help for htpasswd
          --metrics-address string     The address the metrics endpoint binds to. (default ":8080")
          --selector string            Selector (label-query) to filter Secrets, supports '=', '==', and '!='.
          --tls-ca-path string         Path to the TLS CA certificate bundle.
          --tls-cert-path string       Path to the TLS server certificate.
          --tls-key-path string        Path to the TLS server key.
          --watch-namespaces strings   The list of namespaces to watch for Secrets.
    

    htpasswd Secrets

    The htpasswd backend implements HTTP basic authentication
    against a set of Secrets that contain htpasswd formatted data.
    The htpasswd data must be stored in the auth key, which is compatible
    with ingress-nginx auth-file Secrets.

    The htpasswd backend only accesses Secrets that are
    annotated with auth.contour.snappcloud.io/type: basic.

    Secrets that are annotated with the auth.contour.snappcloud.io/realm
    will only be used if the annotation value matches the value of the
    --auth-realm flag.
    The auth.contour.snappcloud.io/realm: * annotation explicitly marks
    a Secret as being valid for all realms.
    This is equivalent to omitting the annotation.

    When it authenticates a request, the htpasswd backend injects the
    Auth-Username and Auth-Realm headers, which contain the
    authenticated user name and the basic authentication realm respectively.

    The --watch-namespaces flag specifies the namespaces where the
    htpasswd backend will discover Secrets.
    If this flag is empty, Secrets from all namespaces will be used.

    The --selector flag accepts a label selector that can be
    used to further restrict which Secrets the htpasswd backend will consume. (Use it for lower resource consumption and better performance as it reduce reconcile loops dramatically if there are lots of secrets)

    htpasswd Multi-Tenancy Support

    While contour-authserver matches the provided credential in the Authorization header against all the Secrets, contour-auth-multi-tenant offers a more refined approach. It matches the provided credential against a user-defined Secret, enabling precise control over authorization scopes.

    To leverage the multi-tenancy feature of contour-auth-multi-tenant, include a secret reference in your Envoy CheckRequest. Specify the reference in the request’s context, using secretRef as the key and the namespace/secretName format for the value.

    Here is a sample HTTPProxy instance in which htpasswd is supported. Please notice that defining an authPolicy is a necessity in order to be able to use the specified secret.

    example:

    apiVersion: projectcontour.io/v1
    kind: HTTPProxy
    metadata:
      name: SAMPLE_NAME
      namespace: SAMPLE_NAMESPACE
    spec:
      ingressClassName: INGRESS_CLASS_NAME
      routes:
        - conditions:
            - prefix: /
          services:
            - name: SERVICE_NAME
              port: 80
      virtualhost:
        authorization:
          authPolicy:
            context:
              secretRef: NAMESPACE/SECRET_NAME
          extensionRef:
            name: EXTENSION_SERVICE_NAME
            namespace: EXTENSION_SERVICE_NAMESPACE
        fqdn: SAMPLE_FQDN
        tls:
          enableFallbackCertificate: false
          secretName: NAMESPACE/TLS_CERT_NAME
    

    The ExtensionService does not necessarily need to be in the same namespace as the configuration provides the namespace option.
    It has been supposed that the service listens on root path / and port 80.

    htpasswd Secret Configuration

    It is important to note that the procedure of matching Secrets occures by comparing the existing Secrets’ labels with Contour Authserver’s secretSelector. In addition, it is worth mentioning that the key auth should be present while using the label.
    The default value for secretSelector is auth.contour.snappcloud.io/type=basic which can be modified to a desirable one following the mentioned format.

    example:

    auth.contour.sample.label/type=basic
    

    OIDC

    Usage:

    Run a oidc authentication server
    
    Usage:
      contour-authserver oidc [OPTIONS]
    
    Flags:
          --config string              Path to config file ( yaml format )
      -h, --help                       help for htpasswd
          --tls-ca-path string         Path to the TLS CA certificate bundle.
          --tls-cert-path string       Path to the TLS server certificate.
          --tls-key-path string        Path to the TLS server key.
    
    

    Oidc configuration can be specified with configmaps.
    Please visit DexIDP for more detail.

    ## The following entries are the variables  accepted by the Contour OIDC module.
    ## server address and port 
    address: ":9443"
    
    ## OIDC issuer URL 
    issuerURL: "http://<path to your SSO server>"
    
    ## App redirect path ( usually point back to app url)
    redirectURL: "https://<path to your applications>"
    redirectPath: "/callback"
    allowEmptyClientSecret: false
    scopes:
    - openid
    - profile
    - email
    - offline_access
    usernameClaim: "nickname"
    emailClaim: ""
    serveTLS: false
    clientID: "<your client id>"
    clientSecret: "<your client secret>"
    

    Request Headers

    Both authorization backends emit the Auth-Handler header, which
    publishes the name of the backend that approved or rejected the
    authorization.

    The authorization context is also reflected into HTTP headers
    prefixed with Auth-Context-. Note that This can generate malformed
    HTTP headers. The testserver backend always creates the context
    headers, but the htpasswd backend only does so for authenticated
    requests (i.e. the origin server gets them bu the client never
    does.)

    Deploying contour-auth-multi-tenant

    The recommended way to deploy contour-auth-multi-tenant is to use the Kustomize
    deployment YAML. This will deploy services for htpasswd and oidc backends. For developer deployments,
    Skaffold seems to work reasonably well.

    Releasing contour-auth-multi-tenant

    Maintainers who need to release a new version of contour-auth-multi-tenant
    can follow the following steps:

    # Ensure that you have a Github token either in $GITHUB_TOKEN or in ~/.config/goreleaser/github_token.
    # Ensure that goreleaser is installed.
    
    # Tag the release.
    $ ./hack/make-release-tag.sh $OLDVERS $NEWVERS
    
    # Push the release tag to Github.
    $ git push origin $NEWVERS
    
    # Build and release binaries and Docker images.
    $ make release
    
    # Log in with your GitHub account and token to push the images.
    $ docker login -u <GitHub username>
    $ docker push ghcr.io/projectcontour/contour-authserver:$NEWVERS
    $ docker push ghcr.io/projectcontour/contour-authserver:latest
    
    # Log out.
    $ docker logout

    Visit original content creator repository

  • trader

    Laravel Trader

    Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

    Laravel package for trader extension interface.

    Requirements

    Make sure all dependencies have been installed before moving on:

    Install

    Pull the package via Composer:

    $ composer require laratrade/trader

    Usage

    Via dependency injection

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    class MyClass
    {
        /**
         * The trader instance.
         *
         * @var Trader
         */
        protected $trader;
    
        /**
         * Create a new instance.
         *
         * @param Trader $trader
         */
        public function __construct(Trader $trader)
        {
            $this->indicatorManager = $trader;
        }
        
        /**
         * Handle my function.
         */
        public function myFunction()
        {
            ...
            $acos = $this->trader->acos($real);
            ...
        }
    }

    Via facade

    <?php
    
    use Laratrade\Trader\Facades\Trader;
    
    class MyClass
    {   
        /**
         * Handle my function.
         */
        public function myFunction()
        {
            ...
            $acos = Trader::acos($real);
            ...
        }
    }

    Via helper

    <?php
    
    class MyClass
    {   
        /**
         * Handle my function.
         */
        public function myFunction()
        {
            ...
            $acos = trader()->acos($real);
            ...
        }
    }

    Constants

    MA_TYPE_SMA

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::MA_TYPE_SMA;

    MA_TYPE_EMA

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::MA_TYPE_EMA;

    MA_TYPE_WMA

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::MA_TYPE_WMA;

    MA_TYPE_DEMA

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::MA_TYPE_DEMA;

    MA_TYPE_TEMA

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::MA_TYPE_TEMA;

    MA_TYPE_TRIMA

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::MA_TYPE_TRIMA;

    MA_TYPE_KAMA

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::MA_TYPE_KAMA;

    MA_TYPE_MAMA

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::MA_TYPE_MAMA;

    MA_TYPE_T3

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::MA_TYPE_T3;

    REAL_MIN

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::REAL_MIN;

    REAL_MAX

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::REAL_MAX;

    FUNC_UNST_ADX

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_ADX;

    FUNC_UNST_ADXR

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_ADXR;

    FUNC_UNST_ATR

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_ATR;

    FUNC_UNST_CMO

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_CMO;

    FUNC_UNST_DX

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_DX;

    FUNC_UNST_EMA

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_EMA;

    FUNC_UNST_HT_DCPERIOD

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_HT_DCPERIOD;

    FUNC_UNST_HT_DCPHASE

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_HT_DCPHASE;

    FUNC_UNST_HT_PHASOR

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_HT_PHASOR;

    FUNC_UNST_HT_SINE

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_HT_SINE;

    FUNC_UNST_HT_TRENDLINE

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_HT_TRENDLINE;

    FUNC_UNST_HT_TRENDMODE

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_HT_TRENDMODE;

    FUNC_UNST_KAMA

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_KAMA;

    FUNC_UNST_MAMA

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_MAMA;

    FUNC_UNST_MFI

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_MFI;

    FUNC_UNST_MINUS_DI

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_MINUS_DI;

    FUNC_UNST_MINUS_DM

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_MINUS_DM;

    FUNC_UNST_NATR

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_NATR;

    FUNC_UNST_PLUS_DI

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_PLUS_DI;

    FUNC_UNST_PLUS_DM

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_PLUS_DM;

    FUNC_UNST_RSI

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_RSI;

    FUNC_UNST_STOCHRSI

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_STOCHRSI;

    FUNC_UNST_T3

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_T3;

    FUNC_UNST_ALL

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_ALL;

    FUNC_UNST_NONE

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::FUNC_UNST_NONE;

    COMPATIBILITY_DEFAULT

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::COMPATIBILITY_DEFAULT;

    COMPATIBILITY_METASTOCK

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::COMPATIBILITY_METASTOCK;

    ERR_SUCCESS

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_SUCCESS;

    ERR_LIB_NOT_INITIALIZE

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_LIB_NOT_INITIALIZE;

    ERR_BAD_PARAM

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_BAD_PARAM;

    ERR_ALLOC_ERR

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_ALLOC_ERR;

    ERR_GROUP_NOT_FOUND

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_GROUP_NOT_FOUND;

    ERR_FUNC_NOT_FOUND

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_FUNC_NOT_FOUND;

    ERR_INVALID_HANDLE

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_INVALID_HANDLE;

    ERR_INVALID_PARAM_HOLDER

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_INVALID_PARAM_HOLDER;

    ERR_INVALID_PARAM_HOLDER_TYPE

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_INVALID_PARAM_HOLDER_TYPE;

    ERR_INVALID_PARAM_FUNCTION

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_INVALID_PARAM_FUNCTION;

    ERR_INPUT_NOT_ALL_INITIALIZE

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_INPUT_NOT_ALL_INITIALIZE;

    ERR_OUTPUT_NOT_ALL_INITIALIZE

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_OUTPUT_NOT_ALL_INITIALIZE;

    ERR_OUT_OF_RANGE_START_INDEX

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_OUT_OF_RANGE_START_INDEX;

    ERR_OUT_OF_RANGE_END_INDEX

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_OUT_OF_RANGE_END_INDEX;

    ERR_INVALID_LIST_TYPE

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_INVALID_LIST_TYPE;

    ERR_BAD_OBJECT

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_BAD_OBJECT;

    ERR_NOT_SUPPORTED

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_NOT_SUPPORTED;

    ERR_INTERNAL_ERROR

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_INTERNAL_ERROR;

    ERR_UNKNOWN_ERROR

    <?php
    
    use Laratrade\Trader\Contracts\Trader;
    
    echo Trader::ERR_UNKNOWN_ERROR;

    Functions

    acos

    Vector Trigonometric ACos

    $result = Trader::acos($real);

    ad

    Chaikin A/D Line

    $result = Trader::ad(array $high, array $low, array $close, array $volume);

    add

    Vector Arithmetic Add

    $result = Trader::add(array $real0, array $real1);

    adosc

    Chaikin A/D Oscillator

    $result = Trader::adosc(array $high, array $low, array $close, array $volume, int $fastPeriod = 3, int $slowPeriod = 10);

    adx

    Average Directional Movement Index

    $result = Trader::adx(array $high, array $low, array $close, int $timePeriod = 14);

    adxr

    Average Directional Movement Index Rating

    $result = Trader::adxr(array $high, array $low, array $close, int $timePeriod = 14);

    apo

    Absolute Price Oscillator

    $result = Trader::apo(array $real, int $fastPeriod = 12, int $slowPeriod = 26, int $mAType = 0);

    aroon

    Aroon

    $result = Trader::aroon(array $high, array $low, int $timePeriod = 14);

    aroonosc

    Aroon Oscillator

    $result = Trader::aroonosc(array $high, array $low, int $timePeriod = 14);

    asin

    Vector Trigonometric ASin

    $result = Trader::asin(array $real);

    atan

    Vector Trigonometric ATan

    $result = Trader::atan(array $real);

    atr

    Average True Range

    $result = Trader::atr(array $high, array $low, array $close, int $timePeriod = 14);

    avgprice

    Average Price

    $result = Trader::avgprice(array $open, array $high, array $low, array $close);

    bbands

    Bollinger Bands

    $result = Trader::bbands(array $real, int $timePeriod = 5, float $nbDevUp = 2.0, float $nbDevDn = 2.0, int $mAType = 0);

    beta

    Beta

    $result = Trader::beta(array $real0, array $real1, int $timePeriod = 5);

    bop

    Balance Of Power

    $result = Trader::bop(array $open, array $high, array $low, array $close);

    cci

    Commodity Channel Index

    $result = Trader::cci(array $high, array $low, array $close, int $timePeriod = null);

    cdl2crows

    Two Crows

    $result = Trader::cdl2crows(array $open, array $high, array $low, array $close);

    cdl3blackcrows

    Three Black Crows

    $result = Trader::cdl3blackcrows(array $open, array $high, array $low, array $close);

    cdl3inside

    Three Inside Up/Down

    $result = Trader::cdl3inside(array $open, array $high, array $low, array $close);

    cdl3linestrike

    Three-Line Strike

    $result = Trader::cdl3linestrike(array $open, array $high, array $low, array $close);

    cdl3outside

    Three Outside Up/Down

    $result = Trader::cdl3outside(array $open, array $high, array $low, array $close);

    cdl3starsinsouth

    Three Stars In The South

    $result = Trader::cdl3starsinsouth(array $open, array $high, array $low, array $close);

    cdl3whitesoldiers

    Three Advancing White Soldiers

    $result = Trader::cdl3whitesoldiers(array $open, array $high, array $low, array $close);

    cdlabandonedbaby

    Abandoned Baby

    $result = Trader::cdlabandonedbaby(array $open, array $high, array $low, array $close, float $penetration = 0.3);

    cdladvanceblock

    Advance Block

    $result = Trader::cdladvanceblock(array $open, array $high, array $low, array $close);

    cdlbelthold

    Belt-hold

    $result = Trader::cdlbelthold(array $open, array $high, array $low, array $close);

    cdlbreakaway

    Breakaway

    $result = Trader::cdlbreakaway(array $open, array $high, array $low, array $close);

    cdlclosingmarubozu

    Closing Marubozu

    $result = Trader::cdlclosingmarubozu(array $open, array $high, array $low, array $close);

    cdlconcealbabyswall

    Concealing Baby Swallow

    $result = Trader::cdlclosingmarubozu(array $open, array $high, array $low, array $close);

    cdlcounterattack

    Counterattack

    $result = Trader::cdlconcealbabyswall(array $open, array $high, array $low, array $close);

    cdldarkcloudcover

    Dark Cloud Cover

    $result = Trader::cdldarkcloudcover(array $open, array $high, array $low, array $close, float $penetration = 0.5);

    cdldoji

    Doji

    $result = Trader::cdldoji(array $open, array $high, array $low, array $close);

    cdldojistar

    Doji Star

    $result = Trader::cdldojistar(array $open, array $high, array $low, array $close);

    cdldragonflydoji

    Dragonfly Doji

    $result = Trader::cdldragonflydoji(array $open, array $high, array $low, array $close);

    cdlengulfing

    Engulfing Pattern

    $result = Trader::cdlengulfing(array $open, array $high, array $low, array $close);

    cdleveningdojistar

    Evening Doji Star

    $result = Trader::cdleveningdojistar(array $open, array $high, array $low, array $close, float $penetration = 0.3);

    cdleveningstar

    Evening Star

    $result = Trader::cdleveningstar(array $open, array $high, array $low, array $close, float $penetration = 0.3);

    cdlgapsidesidewhite

    Up/Down-gap side-by-side white lines

    $result = Trader::cdlgapsidesidewhite(array $open, array $high, array $low, array $close);

    cdlgravestonedoji

    Gravestone Doji

    $result = Trader::cdlgravestonedoji(array $open, array $high, array $low, array $close);

    cdlhammer

    Hammer

    $result = Trader::cdlhammer(array $open, array $high, array $low, array $close);

    cdlhangingman

    Hanging Man

    $result = Trader::cdlhangingman(array $open, array $high, array $low, array $close);

    cdlharami

    Harami Pattern

    $result = Trader::cdlharami(array $open, array $high, array $low, array $close);

    cdlharamicross

    Harami Cross Pattern

    $result = Trader::cdlharamicross(array $open, array $high, array $low, array $close);

    cdlhighwave

    High-Wave Candle

    $result = Trader::cdlhighwave(array $open, array $high, array $low, array $close);

    cdlhikkake

    Hikkake Pattern

    $result = Trader::cdlhikkake(array $open, array $high, array $low, array $close);

    cdlhikkakemod

    Modified Hikkake Pattern

    $result = Trader::cdlhikkakemod(array $open, array $high, array $low, array $close);

    cdlhomingpigeon

    Homing Pigeon

    $result = Trader::cdlhomingpigeon(array $open, array $high, array $low, array $close);

    cdlidentical3crows

    Identical Three Crows

    $result = Trader::cdlidentical3crows(array $open, array $high, array $low, array $close);

    cdlinneck

    In-Neck Pattern

    $result = Trader::cdlinneck(array $open, array $high, array $low, array $close);

    cdlinvertedhammer

    Inverted Hammer

    $result = Trader::cdlinvertedhammer(array $open, array $high, array $low, array $close);

    cdlkicking

    Kicking

    $result = Trader::cdlkicking(array $open, array $high, array $low, array $close);

    cdlkickingbylength

    Kicking – bull/bear determined by the longer marubozu

    $result = Trader::cdlkickingbylength(array $open, array $high, array $low, array $close);

    cdlladderbottom

    Ladder Bottom

    $result = Trader::cdlladderbottom(array $open, array $high, array $low, array $close);

    cdllongleggeddoji

    Long Legged Doji

    $result = Trader::cdllongleggeddoji(array $open, array $high, array $low, array $close);

    cdllongline

    Long Line Candle

    $result = Trader::cdllongline(array $open, array $high, array $low, array $close);

    cdlmarubozu

    Marubozu

    $result = Trader::cdlmarubozu(array $open, array $high, array $low, array $close);

    cdlmatchinglow

    Matching Low

    $result = Trader::cdlmatchinglow(array $open, array $high, array $low, array $close);

    cdlmathold

    Mat Hold

    $result = Trader::cdlmathold(array $open, array $high, array $low, array $close, float $penetration = 0.5);

    cdlmorningdojistar

    Morning Doji Star

    $result = Trader::cdlmorningdojistar(array $open, array $high, array $low, array $close, float $penetration = 0.3);

    cdlmorningstar

    Morning Star

    $result = Trader::cdlmorningstar(array $open, array $high, array $low, array $close, float $penetration = 0.3);

    cdlonneck

    On-Neck Pattern

    $result = Trader::cdlonneck(array $open, array $high, array $low, array $close);

    cdlpiercing

    Piercing Pattern

    $result = Trader::cdlpiercing(array $open, array $high, array $low, array $close);

    cdlrickshawman

    Rickshaw Man

    $result = Trader::cdlrickshawman(array $open, array $high, array $low, array $close);

    cdlrisefall3methods

    Rising/Falling Three Methods

    $result = Trader::cdlrisefall3methods(array $open, array $high, array $low, array $close);

    cdlseparatinglines

    Separating Lines

    $result = Trader::cdlseparatinglines(array $open, array $high, array $low, array $close);

    cdlshootingstar

    Shooting Star

    $result = Trader::cdlshootingstar(array $open, array $high, array $low, array $close);

    cdlshortline

    Short Line Candle

    $result = Trader::cdlshortline(array $open, array $high, array $low, array $close);

    cdlspinningtop

    Spinning Top

    $result = Trader::cdlspinningtop(array $open, array $high, array $low, array $close);

    cdlstalledpattern

    Stalled Pattern

    $result = Trader::cdlstalledpattern(array $open, array $high, array $low, array $close);

    cdlsticksandwich

    Stick Sandwich

    $result = Trader::cdlsticksandwich(array $open, array $high, array $low, array $close);

    cdltakuri

    Takuri (Dragonfly Doji with very long lower shadow)

    $result = Trader::cdltakuri(array $open, array $high, array $low, array $close);

    cdltasukigap

    Tasuki Gap

    $result = Trader::cdltasukigap(array $open, array $high, array $low, array $close);

    cdlthrusting

    Thrusting Pattern

    $result = Trader::cdlthrusting(array $open, array $high, array $low, array $close);

    cdltristar

    Tristar Pattern

    $result = Trader::cdltristar(array $open, array $high, array $low, array $close);

    cdlunique3river

    Unique 3 River

    $result = Trader::cdlunique3river(array $open, array $high, array $low, array $close);

    cdlupsidegap2crows

    Upside Gap Two Crows

    $result = Trader::cdlupsidegap2crows(array $open, array $high, array $low, array $close);

    cdlxsidegap3methods

    Upside/Downside Gap Three Methods

    $result = Trader::cdlxsidegap3methods(array $open, array $high, array $low, array $close);

    ceil

    Vector Ceil

    $result = Trader::ceil(array $real);

    cmo

    Chande Momentum Oscillator

    $result = Trader::cmo(array $real, int $timePeriod = 14);

    correl

    Pearson’s Correlation Coefficient (r)

    $result = Trader::correl(array $real0, array $real1, int $timePeriod = 30);

    cos

    Vector Trigonometric Cos

    $result = Trader::cos(array $real);

    cosh

    Vector Trigonometric Cosh

    $result = Trader::cosh(array $real);

    dema

    Double Exponential Moving Average

    $result = Trader::dema(array $real, int $timePeriod = 30);

    div

    Vector Arithmetic Div

    $result = Trader::div(array $real0, array $real1);

    dx

    Directional Movement Index

    $result = Trader::dx(array $high, array $low, array $close, int $timePeriod = 14);

    ema

    Exponential Moving Average

    $result = Trader::ema(array $real, int $timePeriod = 30);

    errno

    Get error code

    $result = Trader::errno();

    exp

    Vector Arithmetic Exp

    $result = Trader::exp(array $real);

    floor

    Vector Floor

    $result = Trader::floor(array $real);

    get_compat

    Get compatibility mode

    $result = Trader::get_compat();

    get_unstable_period

    Get unstable period

    $result = Trader::get_unstable_period(int $functionId);

    ht_dcperiod

    Hilbert Transform – Dominant Cycle Period

    $result = Trader::ht_dcperiod(array $real);

    ht_dcphase

    Hilbert Transform – Dominant Cycle Phase

    $result = Trader::ht_dcphase(array $real);

    ht_phasor

    Hilbert Transform – Phasor Components

    $result = Trader::ht_phasor(array $open, array $close);

    ht_sine

    Hilbert Transform – SineWave

    $result = Trader::ht_sine(array $open, array $close);

    ht_trendline

    Hilbert Transform – Instantaneous Trendline

    $result = Trader::ht_trendline(array $real);

    ht_trendmode

    Hilbert Transform – Trend vs Cycle Mode

    $result = Trader::ht_trendmode(array $real);

    kama

    Kaufman Adaptive Moving Average

    $result = Trader::kama(array $real, int $timePeriod = 30);

    linearreg_angle

    Linear Regression Angle

    $result = Trader::linearreg_angle(array $real, int $timePeriod = 14);

    linearreg_intercept

    Linear Regression Intercept

    $result = Trader::linearreg_intercept(array $real, int $timePeriod = 14);

    linearreg_slope

    Linear Regression Slope

    $result = Trader::linearreg_slope(array $real, int $timePeriod = 14);

    linearreg

    Linear Regression

    $result = Trader::linearreg(array $real, int $timePeriod = 14);

    ln

    Vector Log Natural

    $result = Trader::ln(array $real);

    log10

    Vector Log10

    $result = Trader::log10(array $real);

    ma

    Moving average

    $result = Trader::ma(array $real, int $timePeriod = 30, int $mAType = 0);

    macd

    Moving Average Convergence/Divergence

    $result = Trader::macd(array $real, int $fastPeriod = 12, int $slowPeriod = 26, int $signalPeriod = 9);

    macdext

    MACD with controllable MA type

    $result = Trader::macdext(array $real, int $fastPeriod = 12, int $fastMAType = 0, int $slowPeriod = 26, int $slowMAType = 0, int $signalPeriod = 9);

    macdfix

    Moving Average Convergence/Divergence Fix 12/26

    $result = Trader::macdfix(array $real, int $signalPeriod = 9);

    mama

    MESA Adaptive Moving Average

    $result = Trader::mama(array $real, float $fastLimit = 0.5, float $slowLimit = 0.05);

    mavp

    Moving average with variable period

    $result = Trader::mavp(array $real, array $periods, int $minPeriod = 2, int $maxPeriod = 30, int $mAType = 0);

    max

    Highest value over a specified period

    $result = Trader::max(array $real, int $timePeriod = 30);

    maxindex

    Index of highest value over a specified period

    $result = Trader::maxindex(array $real, int $timePeriod = 30);

    medprice

    Median Price

    $result = Trader::medprice(array $high, array $low);

    mfi

    Money Flow Index

    $result = Trader::mfi(array $high, array $low, array $close, array $volume, int $timePeriod = 14);

    midpoint

    MidPoint over period

    $result = Trader::midpoint(array $real, int $timePeriod = 14);

    midprice

    Midpoint Price over period

    $result = Trader::midprice(array $high, array $low, int $timePeriod = 14);

    min

    Lowest value over a specified period

    $result = Trader::min(array $real, int $timePeriod = 30);

    minindex

    Index of lowest value over a specified period

    $result = Trader::minindex(array $real, int $timePeriod = 30);

    minmax

    Lowest and highest values over a specified period

    $result = Trader::minmax(array $real, int $timePeriod = 30);

    minmaxindex

    Indexes of lowest and highest values over a specified period

    $result = Trader::minmaxindex(array $real, int $timePeriod = 30);

    minus_di

    Minus Directional Indicator

    $result = Trader::minus_di(array $high, array $low, array $close, int $timePeriod = 14);

    minus_dm

    Minus Directional Movement

    $result = Trader::minus_dm(array $high, array $low, int $timePeriod = 14);

    mom

    Momentum

    $result = Trader::mom(array $real, int $timePeriod = 10);

    mult

    Vector Arithmetic Mult

    $result = Trader::mult(array $real0, array $real1);

    natr

    Normalized Average True Range

    $result = Trader::natr(array $high, array $low, array $close, int $timePeriod = 14);

    obv

    On Balance Volume

    $result = Trader::obv(array $real, array $volume);

    plus_di

    Plus Directional Indicator

    $result = Trader::plus_di(array $high, array $low, array $close, int $timePeriod = 14);

    plus_dm

    Plus Directional Movement

    $result = Trader::plus_dm(array $high, array $low, int $timePeriod = 14);

    ppo

    Percentage Price Oscillator

    $result = Trader::ppo(array $real, int $fastPeriod = 12, int $slowPeriod = 26, int $mAType = 0);

    roc

    Rate of change : ((price/prevPrice)-1)*100

    $result = Trader::roc(array $real, int $timePeriod = 10);

    rocp

    Rate of change Percentage: (price-prevPrice)/prevPrice

    $result = Trader::rocp(array $real, int $timePeriod = 10);

    rocr100

    Rate of change ratio 100 scale: (price/prevPrice)*100

    $result = Trader::rocr100(array $real, int $timePeriod = 10);

    rocr

    Rate of change ratio: (price/prevPrice)

    $result = Trader::rocr(array $real, int $timePeriod = 10);

    rsi

    Relative Strength Index

    $result = Trader::rsi(array $real, int $timePeriod = 14);

    sar

    Parabolic SAR

    $result = Trader::sar(array $high, array $low, float $acceleration = 0.02, float $maximum = 0.2);

    sarext

    Parabolic SAR – Extended

    $result = Trader::sarext(array $high, array $low, float $startValue = 0.0, float $offsetOnReverse = 0.0, float $accelerationInitLong = 0.02, float $accelerationLong = 0.02, float $accelerationMaxLong = 0.2, float $accelerationInitShort = 0.02, float $accelerationShort = 0.02, float $accelerationMaxShort = 0.2);

    set_compat

    Set compatibility mode

    Trader::set_compat(int $compatId);

    set_unstable_period

    Set unstable period

    Trader::set_unstable_period(int $functionId, int $timePeriod);

    sin

    Vector Trigonometric Sin

    $result = Trader::sin(array $real);

    sinh

    Vector Trigonometric Sinh

    $result = Trader::sinh(array $real);

    sma

    Simple Moving Average

    $result = Trader::sma(array $real, int $timePeriod = 30);

    sqrt

    Vector Square Root

    $result = Trader::sqrt(array $real);

    stddev

    Standard Deviation

    $result = Trader::stddev(array $real, int $timePeriod = 5, float $nbDev = 1.0);

    stoch

    Stochastic

    $result = Trader::stoch(array $high, array $low, array $close, int $fastK_Period = 5, int $slowK_Period = 3, int $slowK_MAType = 0, int $slowD_Period = 3, int $slowD_MAType = 0);

    stochf

    Stochastic Fast

    $result = Trader::stochf(array $high, array $low, array $close, int $fastK_Period = 5, int $fastD_Period = 3, int $fastD_MAType = 0);

    stochrsi

    Stochastic Relative Strength Index

    $result = Trader::stochrsi(array $real, int $timePeriod = 14, int $fastK_Period = 5, int $fastD_Period = 3, int $fastD_MAType = 0);

    sub

    Vector Arithmetic Subtraction

    $result = Trader::sub(array $real0, array $real1);

    sum

    Summation

    $result = Trader::sum(array $real, int $timePeriod = 30);

    t3

    Triple Exponential Moving Average (T3)

    $result = Trader::t3(array $real, int $timePeriod = 5, float $vFactor = 0.7);

    tan

    Vector Trigonometric Tan

    $result = Trader::tan(array $real);

    tanh

    Vector Trigonometric Tanh

    $result = Trader::tanh(array $real);

    tema

    Triple Exponential Moving Average

    $result = Trader::tema(array $real, int $timePeriod = 30);

    trange

    True Range

    $result = Trader::trange(array $high, array $low, array $close);

    trima

    Triangular Moving Average

    $result = Trader::trima(array $real, int $timePeriod = 30);

    trix

    1-day Rate-Of-Change (ROC) of a Triple Smooth EMA

    $result = Trader::trix(array $real, int $timePeriod = 30);

    tsf

    Time Series Forecast

    $result = Trader::tsf(array $real, int $timePeriod = 14);

    typprice

    Typical Price

    $result = Trader::typprice(array $high, array $low, array $close);

    ultosc

    Ultimate Oscillator

    $result = Trader::ultosc(array $high, array $low, array $close, int $timePeriod1 = 7, int $timePeriod2 = 14, int $timePeriod3 = 28);

    var

    Variance

    $result = Trader::var(array $real, int $timePeriod = 5, float $nbDev = 1.0);

    wclprice

    Weighted Close Price

    $result = Trader::wclprice(array $high, array $low, array $close);

    willr

    Williams’ %R

    $result = Trader::willr(array $high, array $low, array $close, int $timePeriod = 14);

    wma

    Weighted Moving Average

    $result = Trader::wma(array $real, int $timePeriod = 30);

    Testing

    $ composer test

    Security

    If you discover any security related issues, please use the issue tracker.

    Credits

    License

    The MIT License (MIT). Please see License File for more information.

    Visit original content creator repository
  • variantcalling

    sanger-tol/variantcalling

    Cite with Zenodo

    Nextflow run with conda run with docker run with singularity Launch on Nextflow Tower

    Introduction

    sanger-tol/variantcalling is a bioinformatics best-practice analysis pipeline for variant calling using DeepVariant for PacBio data.

    The pipeline is built using Nextflow, a workflow tool to run tasks across multiple compute infrastructures in a very portable manner. It uses Docker/Singularity containers making installation trivial and results highly reproducible. The Nextflow DSL2 implementation of this pipeline uses one container per process which makes it much easier to maintain and update software dependencies. Where possible, these processes have been submitted to and installed from nf-core/modules in order to make them available to all nf-core pipelines, and to everyone within the Nextflow community!

    On release, automated continuous integration tests run the pipeline on a full-sized dataset on the LSF infrastructure. This ensures that the pipeline runs on LSF, has sensible resource allocation defaults set to run on real-world datasets, and permits the persistent storage of results to benchmark between pipeline releases and other analysis sources.

    Pipeline summary

    The pipeline takes aligned or unaligned PacBio sample reads (CRAM/BAM files) from a CSV file and the reference file in FASTA format, and then uses DeepVariant tool to make variant calling.

    Steps involved:

    • Split fasta file into smaller files, normally one sequence per file unless the sequences are too small.
    • Align the reads if not aligned.
    • Merge input BAM/CRAM files together if they have the same sample names.
    • Filter out reads using the -F 0x900 option to only retain the primary alignments.
    • Run DeepVariant using filtered BAM/CRAM files against each of split fasta files.
    • Merge all VCF and GVCF files generated by DeepVariant by sample together for each input BAM/CRAM file.
    • Run VCFtools to calculate heterozygosity and per site nucleotide diversity.

    Quick Start

    1. Install Nextflow (>=23.10.1)

    2. Install any of Docker, Singularity (you can follow this tutorial), Podman, Shifter or Charliecloud for full pipeline reproducibility (you can use Conda both to install Nextflow itself and also to manage software within pipelines. Please only use it within pipelines as a last resort; see docs).

    3. Download the pipeline and test it on a minimal dataset with a single command:

      # for aligned reads
      nextflow run sanger-tol/variantcalling -profile test,YOURPROFILE --outdir <OUTDIR>
      
      # for unaligned reads
      nextflow run sanger-tol/variantcalling -profile test_align,YOURPROFILE --outdir <OUTDIR>
      

      Note that some form of configuration will be needed so that Nextflow knows how to fetch the required software. This is usually done in the form of a config profile (YOURPROFILE in the example command above). You can chain multiple config profiles in a comma-separated string.

      • The pipeline comes with config profiles called docker, singularity, podman, shifter, charliecloud and conda which instruct the pipeline to use the named tool for software management. For example, -profile test,docker.
      • Please check nf-core/configs to see if a custom config file to run nf-core pipelines already exists for your Institute. If so, you can simply use -profile <institute> in your command. This will enable either docker or singularity and set the appropriate execution settings for your local compute environment.
      • If you are using singularity, please use the nf-core download command to download images first, before running the pipeline. Setting the NXF_SINGULARITY_CACHEDIR or singularity.cacheDir Nextflow options enables you to store and re-use the images from a central location for future pipeline runs.
      • If you are using conda, it is highly recommended to use the NXF_CONDA_CACHEDIR or conda.cacheDir settings to store the environments in a central location for future pipeline runs.
    4. Start running your own analysis!

      nextflow run sanger-tol/variantcalling --input samplesheet.csv --outdir <OUTDIR> --fasta genome.fasta.gz -profile <docker/singularity/podman/shifter/charliecloud/conda/institute>

    Credits

    sanger-tol/variantcalling was originally written by Guoying Qi.

    We thank the following people for their extensive assistance in the development of this pipeline:

    • Priyanka Surana for the pipeline design, code review and Nextflow technical supports.
    • Matthieu Muffato for the pipeline design, code review and Nextflow technical supports.

    We also acknowledge the work of Damon-Lee Pointon for attempting to create an short read variant calling subworkflow.

    Contributions and Support

    If you would like to contribute to this pipeline, please see the contributing guidelines.

    For further information or help, don’t hesitate to get in touch on the Slack #pipelines channel. Please create an issue on GitHub if you are not on the Sanger slack channel.

    Citations

    If you use sanger-tol/variantcalling for your analysis, please cite it using the following doi: 10.5281/zenodo.7890527

    An extensive list of references for the tools used by the pipeline can be found in the CITATIONS.md file.

    This pipeline uses code and infrastructure developed and maintained by the nf-core community, reused here under the MIT license.

    The nf-core framework for community-curated bioinformatics pipelines.

    Philip Ewels, Alexander Peltzer, Sven Fillinger, Harshil Patel, Johannes Alneberg, Andreas Wilm, Maxime Ulysse Garcia, Paolo Di Tommaso & Sven Nahnsen.

    Nat Biotechnol. 2020 Feb 13. doi: 10.1038/s41587-020-0439-x.

    Visit original content creator repository
  • wdtools

    Wikidata entiy linking tools

    Tools to link entities and concepts in text to Wikidata items and to
    extract useful information from the Wikidata knowledge graph

    Entities play an important role in text and are often used to describe what the text is about. One approach we evaluated was to find entity mentions in a report or document, link these to corresponding entities in the Wikidata knowledge graph, and use their information to improve the search.

    Document entities

    We use SpaCy to process text in a report or document and identify the named entity mentions along with their type. The standard SpaCy pipelines for most common languages come with a named entity recognition module that has been trained to identify the relatively limited set of Ontonotes types \cite{hovy2006ontonotes}. While it works reasonably well, it does miss some named entities and often assign the wrong type to entities that are found.

    SpaCy’s predefined pipelines also do not do coreference, i.e., identifying a set of entity mentions, nominal mentions and pronouns that refer to the same entity. This can be important for many subsequent tasks, such as noting how often an entity was mentioned in a document. We experimented with the addition of a simple coference tool that recognized name shortening (e.g., “Joe Biden” and “Biden”) and abbreviations (e.g., “World Health Organization” and “WHO”) for coreference.

    The Ontonotes named entities refer to a instance of type, such as an individual person or organization, a specific location, or a nationality. We also experimented with identifying potential mentions of concepts that might be linkable, such as “letter bomb”, “lava flow” or “potentially hazardous asteroid”. Our strategy was simple: look for a nominal compound possible preceded by an adjective.

    Wikidata entities

    Wikidata is a collaboratively edited multilingual knowledge graph that is intended to provide common data for Wikipedia sites and other applications. It currently has about one billion facts on about 100 million items. It has a web interface to support exploration and editing by people, a set of APIs to access its information programmatically, and a SPARQL endpoint for querying RDF model of the knowledge graph. Wikidata’s ontology has very fine-grained type system with more than two-million types and a much smaller set of properties, currently about NNNNN in number.

    Wikidata is inherently multilingual and draws on data from more Wikipedia sites in nearly 300 different languages. It gives each item a identifier beginning with the letter Q like Q64780099 (the Human Language Technology Center of Excellence), and each property an id beginning with the letter P, for example P31, which is the property “instance of” that links an item with one of its immediate types and P279 that links a type to one of its immediate super–types.

    Entity linking

    Visit original content creator repository

  • hipster

    Hipster

    CI

    A powerful and friendly heuristic search library implemented in Java.

    What’s Hipster4j?

    The aim of Hipster4j is to provide an easy to use yet powerful and flexible type-safe Java library for heuristic search. Hipster relies on a flexible model with generic operators that allow you to reuse and change the behavior of the algorithms very easily. Algorithms are also implemented in an iterative way, avoiding recursion. This has many benefits: full control over the search, access to the internals at runtime or a better and clear scale-out for large search spaces using the heap memory.

    You can use Hipster4j to solve from simple graph search problems to more advanced state-space search problems where the state space is complex and weights are not just double values but custom defined costs.

    Features

    The current version of the library comes with some very well-known and wide used search algorithms. We’re working to add more algorithms soon:

    • Search algorithms:
      • Uninformed search:
        • DFS: Depth-First-Search.
        • BFS: Breadth-First-Search.
        • Dijkstra’s algorithm.
        • Bellman-Ford.
      • Informed search:
        • A star (A*).
        • IDA star (IDA*), Iterative Deepening A*.
        • AD star (AD*): Anytime Dynamic A*.
      • Local search:
        • Hill-Climbing.
        • Enforced-Hill-Climbing.
      • Multiobjective search
        • Multiobjective LS algorithm. Original paper: Martins, E. D. Q. V., & Santos, J. L. E. (1999). “The labeling algorithm for the multiobjective shortest path problem”. Departamento de Matematica, Universidade de Coimbra, Portugal, Tech. Rep. TR-99/005 (see an example)
    • 3rd party adapters:

    If you don’t find the algorithm or the feature you are looking for, please consider contributing to Hipster!. You can open a new issue or better fork this repository and create a pull request with your contribution.

    Getting started

    The easiest way to use Hipster is adding it as a dependency with your favourite dependency manager. Maven users can include the library using the following snippet:

    Snapshots

    You can use the latest (unstable) version of Hipster under development. Just add the following dependency into your pom.xml:

    <!-- Use sonatype oss public for snapshots --> <repositories> <repository> <id>sonatype-oss-public</id> <url>https://oss.sonatype.org/content/groups/public/</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <dependencies> <!-- Add this dependency under your pom.xml <dependencies> section to add all the dependencies of Hipster to your project. Add hipster-core instead of hipster-all for basic functionality. --> <dependency> <groupId>es.usc.citius.hipster</groupId> <artifactId>hipster-all</artifactId> <version>1.0.2-SNAPSHOT</version> </dependency> </dependencies>

    Releases

    Current stable release is v1.0.1. See the milestones to check the current development status.

    dependencies> <!-- Add this dependency under your pom.xml <dependencies> section to add all the dependencies of Hipster to your project. Add hipster-core instead of hipster-all for core functionality. --> <dependency> <groupId>es.usc.citius.hipster</groupId> <artifactId>hipster-all</artifactId> <version>1.0.1</version> </dependency> </dependencies>

    Quick Example

    Let’s solve the graph used in this Wikipedia article about Shortest paths.

    DirectedGraph

    Although Hipster is graph agnostic, we include some useful classes to create a graph or a directed graph and the search problem. We create a graph using the GraphBuilder class and then we use the GraphSearchProblem to create the required components to solve it using Dijkstra’s algorithm:

    // Create a simple weighted directed graph with Hipster where
    // vertices are Strings and edge values are just doubles
    HipsterDirectedGraph<String,Double> graph = 
        GraphBuilder.<String,Double>create()
         .connect("A").to("B").withEdge(4d)
         .connect("A").to("C").withEdge(2d)
         .connect("B").to("C").withEdge(5d)
         .connect("B").to("D").withEdge(10d)
         .connect("C").to("E").withEdge(3d)
         .connect("D").to("F").withEdge(11d)
         .connect("E").to("D").withEdge(4d)
         .createDirectedGraph();
    
    // Create the search problem. For graph problems, just use
    // the GraphSearchProblem util class to generate the problem with ease.
    SearchProblem p = GraphSearchProblem
                               .startingFrom("A")
                               .in(graph)
                               .takeCostsFromEdges()
                               .build();
                               
    // Search the shortest path from "A" to "F"
    System.out.println(Hipster.createDijkstra(p).search("F"));

    Output result: `Total solutions: 1 Total time: 6 ms Total number of iterations: 6

    • Solution 1:
    • States: [A, C, E, D, F]
    • Actions: [2.0, 3.0, 4.0, 11.0]
    • Search information: WeightedNode{state=F, cost=20.0, estimation=0.0, score=20.0}`

    But that’s not all. Hipster comes with different problem examples that illustrate how Hipster can be used to solve a wide variety of problems (not only graph search).

    What’s next?

    If you want to learn how to solve a problem by searching with Hipster, check the wiki and the JavaDoc documentation. We also suggest you to check this presentation for a quick introduction.

    License & Citation

    This software is licensed under the Apache 2 license, quoted below.

    Copyright 2013 Centro de Investigación en Tecnoloxías da Información (CITIUS),
    University of Santiago de Compostela (USC).
    
    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.
    

    Citation

    This library was presented in the “9th Iberian Conference on Information Systems and Technologies (CISTI), 2014”. If you use this library in your research projects, we encourage you to please cite our work:

    Rodriguez-Mier, P., Gonzalez-Sieira, A., Mucientes, M., Lama, M. & Bugarin, A. (2014). Hipster: An Open Source Java Library for Heuristic Search. 9th Iberian Conference on Information Systems and Technologies (CISTI).

    @inproceedings{RodriguezMier2014,
      author = {Rodriguez-Mier, Pablo and Gonzalez-Sieira, Adrian and Mucientes, Manuel and and Lama, Manuel and Bugarin, Alberto},
      booktitle = {9th Iberian Conference on Information Systems and Technologies (CISTI 2014)},
      month = jun,
      volume = 1,
      title = {{Hipster: An Open Source Java Library for Heuristic Search}},
      pages = {481--486},
      isbn = "978-989-98434-2-4"
      address = "Barcelona",
      year = {2014}
    }
    
    Visit original content creator repository
  • foodfy

    Foodfy

    Author Languages Stars Forks Contributors

    Take your culinary skills to the next level. Cook, Explore & Manage Recipes.



    📌 Table of Contents

    🚀 Features

    • 👩🏽‍🍳 Explore recipes and find amazing chefs.
    • 🍕 Create an account to manage recipes, chefs and users.
    • 📨 As an administrator of the platform, you’re able to invite other users.
    • 🌏 Multi language support – English and Portuguese.
    • 🎨 A cool dark mode theme toggle.

    Obs: The admin platform isn’t all translated yet.

    👷 Installation

    You need to install Node.js and Yarn first, then in order to clone the project via HTTPS, run this command:

    git clone https://github.com/LauraBeatris/foodfy.git

    SSH URLs provide access to a Git repository via SSH, a secure protocol. If you have a SSH key registered in your Github account, clone the project using this command:

    git clone git@github.com:LauraBeatris/foodfy.git

    Install dependencies

    yarn install

    Create your environment variables based on the examples of .env.example

    cp .env.example .env

    After copying the examples, make sure to fill the variables with new values.

    🏃 Getting Started

    Running with docker-compose

    In order to prepare the database and also run the application, set your environment variables and then execute docker-compose

    docker-compose up

    With this command, the port seted in your environment PORT variable will be available to access the application.

    Manually setup

    You may prefer to manually configure the database and the application.

    Install Postgres to create a database or if you have Docker in your machine, fill the environment values related to database configurations and the run the following commands in order to create a postgres container.

    docker-compose up postgres

    Execute the follow command to create tables, relationships and procedures:

    yarn db:create

    To start, run the seeds provided in Seeds in order to populate the database with an initial data.

    yarn run:seeds

    Run the following command in order to start the application in a development environment:

    yarn dev

    📮 Faq

    Question: What are the technologies used in this project?

    Answer: The tecnologies used in this project are NodeJS + Express Framework to handle the server, Nunjucks to develop amazing views & SCSS to handle the styles architecture and a better maintenance than normal CSS.

    Question: How the multi language support is handled by the server?

    Answer: This application handle multi language support with the help of a library called i18n-node. It has a middleware that gather language settings of visitors and then persist translations from JSON files related with a specific locale.

    The locale is storaged as a cookie named foodfy:locale and that can be changed by passing a query string with the value ?lang=pt

    Question: Are all kind of users able to create and update chefs or recipes?

    Answer: The application has two kind of users: Visitors and Administrators. As a administrator, you’re able to create, update and view all the data related to recipes, chefs and also other users. Visitors can also access the admin platform but they don’t have access to the views responsable to create and update data.

    🐛 Issues

    Feel free to file a new issue with a respective title and description on the the Foodfy repository. If you already found a solution to your problem, i would love to review your pull request! Have a look at our contribution guidelines to find out about the coding standards.

    🎉 Contributing

    Check out the contributing page to see the best places to file issues, start discussions and begin contributing.

    📕 License

    Released in 2020. This project is under the MIT license.

    Made with love by Laura Beatris 💜🚀

    Visit original content creator repository
  • budapest

    Netlify Status

    GitHub Actions Status

    Determine idle time in WepApps

    You can use the running version of this project at https://polatengin-budapest.netlify.com/

    What is idle timeout

    Idle time is duration the user is remaining inactive on the web page. During idle time, user does nothing on the web page, he/she may even away from the computer.

    Many web apps, such as banking, gaming, etc. need to detect if the user is idle to increase performance, security, etc.

    For high risky web apps, 2-3 minutes inactivity is risky, such as, finance apps, personal password vault apps, etc.

    For low risky web apps, sometimes 15-20 minutes inactivity is OK., such as, news apps, blog apps, etc.

    Also, many web apps, need to have some calls to the backend or need to establish communication channels to backend, but when user is idle, it doesn’t a requirement anymore. So, if the web app can detect the user is idle, then it can close communication channel and stop calling backend services to free-up resources on the backend side.

    How to detect if the user is idle

    When user is on the page, he/she usually use peripherals to interact with the page, such as, keyboard, mouse, touch screen, etc.

    It’s possible to attach couple of Events from DOM API and reset the timer if one of them triggered. If nothing happened in the past for example 20 seconds, we can conclude that the user is idle.

    Here is the few events we can hook,

    Implementation

    Start by creating npm project with executing following command in your favorite Terminal (my favorite is Microsoft Terminal 😀)

    npm init --force

    It’s possible to develop code in Typescript and transpile the code to Javascript with webpack. In order to prepare the project for that, let’s add couple of DevDependencies;

    npm install typescript webpack webpack-cli --save-dev

    Also, it’ll be needed to serve project locally for debug purposes, let’s add http-server as a DevDependency;

    npm install http-server --save-dev

    Also, it’ll be needed to pre-process html and typescript files with webpack, for example to minify them. Let’s add couple of more DevDependencies;

    npm install clean-webpack-plugin copy-webpack-plugin html-minifier-webpack-plugin html-webpack-plugin ts-loader --save-dev

    Finally, it’ll be needed to produce and emit events to notify the page that user is inactive for certain amount of time, let’s add rxjs as a final dependency;

    npm install rxjs

    Now, we’re ready to develop code.

    Since we’re good software engineers, we ❤ reusable code.

    Let’s create idle_timeout.src file in src folder.

    First, we need a class definition;

    import { Observable, Observer } from 'rxjs';
    
    export class IdleTimeOut {
    }

    Now, we need a mechanism to prevent developers to instantiate the class more than 1 time. We’re going to handle this requirement by implementing Singleton Design Pattern;

    public static Current: IdleTimeOut = new IdleTimeOut();
    
    private constructor() {
    };

    Now we need another mechanism to tap to few events;

    ['mousedown', 'mousemove', 'keypress', 'scroll', 'touchstart', 'load'].forEach((event) => {
      document.addEventListener(event, this.Reset , true);
    });

    So, we can reset idle timer;

    public Reset = () => {
      this._tick_count = 0;
      if (this._observer) {
        this._observer.next(this._tick_count);
      }
    
      clearInterval(this._interval);
      this._interval = setInterval(() => { this._observer.next(++this._tick_count); }, 1000);
    }

    Finally, we only need to have an Observable to alert outside-world about the progress of idle time;

    private _tick_count: number = 0;
    private _interval: ReturnType<typeof setInterval>;
    
    private _observer: Observer<number>;
    
    public OnTick: Observable<number> = new Observable();
    
    this.OnTick = Observable.create((observer: Observer<number>) => { this._observer = observer });

    That’s it for the IdleTimeOut component, continue with creating index.html file under src folder with following content;

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Budapest - Detect if the user is idle</title>
    </head>
    <body>
      <span>Idle time: </span><span id="idle_time"></span>
    </body>
    </html>

    Now, we can continue with creating index.ts file under src folder.

    First of all, we need to import IdleTimeOut component;

    import { IdleTimeOut } from './idle_timeout';
    
    const $idle_time = document.getElementById('idle_time');
    
    console.log(IdleTimeOut.Current);

    We can call Reset() method and reset the idle timer programmatically;

    IdleTimeOut.Current.Reset();

    Also, we can attach to OnTick event and decide the actions, such as, when everything is fine, when to logout, etc.

    IdleTimeOut.Current.OnTick.subscribe(seconds => {
      console.log(IdleTimeOut.Current);
    
      if (seconds <= 4) {
        $idle_time.innerText = 'everything is fine! 😀';
      } else if (seconds > 20) {
        document.location.href = "https://github.com/logout";
      } else {
        $idle_time.innerText = `page has not been used for ${seconds} seconds`;
      }
    });

    Here is the example screenshot;

    Sample Screenshot

    Visit original content creator repository
  • AntiBio-Advisor

    AntiBio-Advisor

    An intelligent interface project targeted towards educating people of different ages about when and why to use antibiotic medication.

    This will be done by educating users through the use of a simple to use chat-bot which will answer varied questions relating to antibiotics and its use.

    Antibio.Advisor.mp4

    Table of Contents

    Motivation

    Antibiotic overuse breeds treatment resistance. This is a global problem that is rapidly increasing and threatens our ability to treat common infectious diseases.

    According to the World Health Organisation: “Antimicrobials – including antibiotics, antivirals, antifungals and antiparasitics – are medicines used to prevent and treat infections in humans, animals and plants.” Excessive antibiotic use leads to heightened drug resistance, impacting treatment efficacy and complicating infection management, posing severe health risks.

    Antimicrobial Resistance (AMR) generates drug-resistant organisms globally, limiting treatment options, inflating healthcare costs, and elevating risks during medical procedures, necessitating urgent prevention and treatment strategies.

    Proposed Solution

    Antibio Advisor, a web app tailored for individuals 18 or older but available for all. Our web app offers an array of vital features: an intelligent chatbot for medical guidance, an interactive map to locate pharmacies and general practitioners, and a comprehensive term guide.

    Prioritising user awareness, our platform provides essential information in the form of a FAQs page, an informative Quiz and a prescription info page.

    The web app features mentioned above needed to be implemented in such a manner that they are easily accessible and usable. This was facilitated through a variety of different features such as:

    • Web Page Demo which guides the user on proper usage of applicable web pages.
    • Dynamic page size applicable for use with computers, mobile devices and tablets.
    • Colourful and simple interface to ensure easy navigation.
    • Elderly individuals were also considered through the use of a large font to ensure ease of use.

    Chatbot

    Chatbot

    As outlined above the chatbot has a myriad of different features ranging from:

    • Set of initial prompts aimed at providing the user with a possible conversation starter.
    • Clear button allowing the user to clear the current conversation and start afresh.
    • Speech to text button allowing to use voice to communicate with the chatbot directly.
    • Text to Speech button and volume slider allowing users to have messages read out loud.

    These features and the general chatbot layout was selected whilst keeping the possible users in mind to ensure a pleasant user experience. Additionally the UIs adaptability to different screen sizes maintains the ease of use of the chatbot and its features.

    FAQ

    The FAQ page is composed of a variety of relevant questions sorted according to relevant age groups these being General, Adult, Child, Elderly. This is done as certain knowledge is more applicable to certain age demographics. Additionally the FAQ can be sorted in accordance with the symptoms these being General, Cough, Rash, Skin Condition.

    FAQ

    Further adding to the intractability of the webpage each question only displays the answer when selected by the user. This can be seen in the image showcased in this slide.

    Prescription Info

    The main components of the Prescription Info page showcased here consist of three dropdowns relating to the antibiotic name, abbreviations and notations used by doctors when prescribing medicine.

    These dropdowns when appropriately selected provide the user with explanations regarding their antibiotics and the relevant dosages as denoted by a medical professionals prescription notation. The dropdowns in addition to a sample explanation can be seen below.

    Prescription Info

    Map

    The map was designed to showcase the users nearest pharmacies and general practitioners, this was carried out to provide the user with all the required information they might require to purchase, enquire or return unused antibiotics. In the map the blue markers represent general practitioners and the red markers represent pharmacies.

    Map

    Learn More

    The Learn More page similar to the FAQ page provides the user with a further degree of general information on the topic of AMR in contrast to the specific information presented in the FAQ page.

    Learn More

    This page contains an informative video alongside an interactive carousel composed of several infographics and informative paragraphs.

    Quiz

    The webapp also includes a quiz web page which compiles four questions from a possible set. This provides users a fun and engaging manner by which they can test their knowledge on AMR. Upon submitting the quiz users are provided with the correct answer where applicable in addition to a score showcased below. Furthermore the quiz can be regenerated multiple times and additional question can easily be added through the editing of a simple .json file.

    Quiz

    Ethical Considerations

    The website is not intended to replace medical advice, and the chatbot is not a substitute for a doctor. The chatbot is intended to provide general information and guidance on antibiotics and their use. Additionally, a disclaimer is provided on the chatbot page to ensure that users are aware of the chatbot’s limitations.

    Moreover, no user data is stored or kept, ensuring that no chatbot history or personal information is stored on the platform or any cloud storage system.

    Ethical Considerations

    Mobile Functionality

    The web app is designed to be used on a variety of different devices ranging from mobile phones to tablets and computers. This is achieved through the use of a dynamic page size which adapts to the screen size of the device being used. This ensures that the web app is usable on a variety of different devices and maintains the ease of use of the web app.

    Mobile Design

    Interactable Design

    The web app offers feedback to the user in the form of different bot expressions. This is achieved through the use of different images which are displayed depending on the current state of the demo bot.

    Interactable Design Interactable Design

    A Good Design takes a lot of Effort, Feedback and Time

    The design of the web app was a long and arduous process which required a lot of effort and feedback. The design process was broken down into 3 main stages:

    1. Paper Prototyping – This stage involved the creation of a paper prototype which was used to gather feedback from potential users. This feedback was then used to improve the design of the web app.
    2. Computer Prototyping – This stage involved the creation of a computer prototype which was used to gather feedback in the form of recommendations and improvements. This feedback was then used to improve the design of the web app. Additionally, in this stage improvements from the previous stage were implemented into the design.
    3. Final Design – This stage involved the creation of the final design which utilised the feedback gathered from the previous stages to create a final design which was then implemented into the web app.

    Design

    Libraries used

    The following libraries were used in the development of the web app:

    License

    Copyright © Antibio Advisor 2023
    Created by: Matthias Bartolo, Jerome Agius and Isaac Muscat
    This project was developed under supervision of Dr Vanessa Camilleri and Mr Gavin Schranz at the University of Malta.

    University of Malta Logo

    Visit original content creator repository
  • hakyll-flakes

    To Returning Users

    If you used this project prior to 2025-11-11, it’s been redesigned. I realised that making this a library was over-engineered. The amount of code it took to invoke it was almost as much as the code in the project itself, and it still wasn’t flexible enough for people’s needs. It’s now a template that’s designed to be copied and fiddled with to make it work for your website.

    hakyll-flakes

    This repo is a template that reflects how I build my hakyll website using Nix.

    To use it, copy the flake.nix into your own project or adapt it to fit with what you already have in your flake.nix. There isn’t much code, and I recommend you read through it to get an idea of what it does.

    You can take inspiration also from the rest of the repository if it’s helpful, though it was mostly just generated with hakyll-init so that it constituted a complete example.

    If you want to start a fresh project, it may be useful to run nix flake init -t github:radvendii/hakyll-flakes in an empty directory, though it just copies the whole repo in there.

    Before you start, you will probably want to change the name in flake.nix and package.yaml to something more personalized than my-website.

    The outputs of flake.nix are designed to be used in the following ways:

    • nix build .#website (or just nix build) goes through the whole process and produces a result/ symlink with your compiled static website inside.
    • nix build .#builder this builds the website builder, your hakyll-based site.hs file. You can find it at result/bin/<project name>.
    • nix run -- watch This will compile and run your website builder, creating the _site directory and loading the website at localhost:8000. It will also rebuild the website if you change the files (but not if you change site.hs)
    • nix develop – this will provide you with the inputs you need to build the website in your $PATH. Also gives you what you need to set up the haskell LSP for your editor with all of your haskell packages available.

    Visit original content creator repository